@a2simcode/ui 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/simcode-ui.es.js +259 -259
- package/dist/simcode-ui.umd.js +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/dist/simcode-ui.umd.js
CHANGED
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
roundFun,
|
|
14
14
|
sumFun,
|
|
15
15
|
sumproductFun,
|
|
16
|
-
getCompValue)=>{ return ${E} }`;let B;const _=Vo(E);if(_.res)try{B=_.fn(i,a,l,r,s,d,c,f,u,p,h,m,g,b,w)}catch(T){console.log(T,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(B)?"":(o.decimal!==void 0&&(B=B.toFixed(o.decimal)),B)}),S=n.computed(()=>{let y=C.value;return o.thousandSeparator&&(y=Oi(y)),o.isChinese&&(y=Ai(y)),y});return n.watch(C,y=>{k("update:modelValue",y),k("change",{value:y,data:S.value})}),(y,E)=>{const B=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(B,{modelValue:S.value,"onUpdate:modelValue":E[0]||(E[0]=_=>S.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),hd={key:0},Ta=te(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,i=n.computed(()=>({...o})),a=n.ref(),l=n.ref(null),r=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&s()}),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}),n.watch(()=>o.endValue,p=>{l.value&&l.value.update&&l.value.update(p)});const s=()=>{l.value||(r.value.startVal=o.startValue,r.value.decimalPlaces=o.decimals,r.value.duration=o.duration,l.value=new Vs.CountUp(a.value,Number(o.endValue),r.value),l.value.start(()=>{o.callback?.(l.value)}))};return n.onUnmounted(()=>{l.value=null}),n.onBeforeUnmount(()=>{l.value=null}),t({myProps:i,el:a,init:s,start:p=>{l.value&&l.value.start&&l.value.start(()=>{p?.(l.value)})},pauseResume:()=>{l.value&&l.value.pauseResume&&l.value.pauseResume()},reset:()=>{l.value&&l.value.reset&&l.value.reset()},update:p=>{l.value&&l.value.update&&l.value.update(p)}}),(p,h)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:a},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",hd,n.toDisplayString(e.endValue),1))],512))}})),md={class:"j-block j-data-panel"},gd={key:0,class:"j-data-panel-header"},yd={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},bd={class:"j-data-panel-header-right"},wd={class:"j-data-panel-body"},Na=te(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",md,[e.title?(n.openBlock(),n.createElementBlock("div",gd,[n.createElementVNode("div",yd,n.toDisplayString(e.title),1),n.createElementVNode("div",bd,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",wd,[n.renderSlot(t.$slots,"default")])]))}})),vd={class:"j-divider-content"},$a=te(n.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=n.computed(()=>{const a={color:t.color};return t.size&&Number(t.size)&&(a.fontSize=`${t.size}px`),a}),i=n.computed(()=>({borderTopStyle:t.borderStyle}));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:n.normalizeStyle(o.value)},[n.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:n.normalizeStyle(i.value)},null,4),n.createElementVNode("div",vd,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(i.value)},null,4)],6))}})),Cd={class:"j-hpanel"},kd={class:"j-hpanel-main"},Ma=te(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",Cd,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",kd,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),La=te(n.defineComponent({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},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,i=t,a=n.ref(),l=n.ref(),r=async(f,u)=>{o.ok&&(f("保存数据中..."),l.value=await o.ok(),i("update:modelValue",l.value),i("change",{value:l.value}),u(),a.value.close())},s=()=>o.beforeClose?o.beforeClose(l.value):!0,d=()=>{o.closed?.()},c=()=>{a.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(l.value)},200)};return n.watch(()=>o.modelValue,f=>{l.value=f},{immediate:!0}),(f,u)=>{const p=n.resolveComponent("j-button"),h=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(p,n.mergeProps({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:c}),null,16,["type","label","size"]),n.createVNode(h,{ref_key:"layerRef",ref:a,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:r,onClosed:d},{default:n.withCtx(()=>[n.renderSlot(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Pa=te(n.defineComponent({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},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,i=t,a=n.computed({get:()=>o.modelValue,set:u=>{i("update:modelValue",u)}}),l=n.ref(""),r=u=>{l.value=u},s=()=>l.value,d=u=>o.beforeClose?o.beforeClose(u):!0,c=u=>{i("change",u)},f=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(u,p)=>{const h=n.resolveComponent("j-code-mirror"),m=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{modelValue:a.value,"onUpdate:modelValue":p[1]||(p[1]=b=>a.value=b),type:e.type,"btn-text":f.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":d,ok:s,open:r,onChange:c},{default:n.withCtx(()=>[n.createVNode(m,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(h,{value:l.value,"onUpdate:value":p[0]||(p[0]=b=>l.value=b),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:n.withCtx(()=>[n.createVNode(h,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}})),Ra=te(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 i=e,a=o,l=n.ref(),r=n.ref(),s=n.computed({get(){return i.modelValue===null||i.modelValue===void 0?r.value:i.modelValue},set(g){r.value=g,a("update:modelValue",g),a("input",g)}}),d=g=>{a("input",g)},c=g=>{a("focus",g)},f=g=>{a("blur",g)},u=()=>{a("clear"),a("update:modelValue","")},p=g=>{a("change",g)},h=g=>{a("color-change",g)},m=g=>{a("active-change",g)};return t({focus:()=>{l.value?.focus()},blur:()=>{l.value?.blur()},select:()=>{l.value?.select()}}),(g,b)=>{const k=n.resolveComponent("el-color-picker"),v=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled}])},[n.createVNode(v,n.mergeProps({placeholder:e.placeholder,modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=w=>s.value=w),size:e.size,ref_key:"inputRef",ref:l,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},g.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:u,onChange:p}),{[e.inputType]:n.withCtx(()=>[n.createVNode(k,{size:e.size,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=w=>s.value=w),disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:m},null,8,["size","modelValue","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["placeholder","modelValue","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}})),Aa=te(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"}},setup(e){const t=e,o=n.computed(()=>t.class||""),i=n.computed(()=>{const a={...t.style};return t.color&&(a.color=t.color),t.size&&(typeof t.size=="number"?a.fontSize=`${t.size}px`:a.fontSize=t.size),t.weight&&(a.fontWeight=t.weight),a});return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(i.value)},n.toDisplayString(e.title),7))}})),Oa=te(n.defineComponent({name:"JCodeMirror",__name:"code-mirror",props:{value:{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:value","change"],setup(e,{expose:t,emit:o}){const i=e,a=o,l=n.ref(),r=n.ref("");let s=null;const d=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return zt.javascript();case"css":case"text/css":return $s.css();case"html":case"text/html":return Ms.html();case"json":case"application/json":return Ls.json();case"sql":case"text/x-sql":return Ps.sql();case"xml":case"text/xml":return Rs.xml();case"python":case"text/x-python":return As.python();case"markdown":case"text/markdown":return Os.markdown();case"java":case"text/x-java":return Fs.java();case"vue":case"text/x-vue":return zt.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return zt.javascript({jsx:!1,typescript:!0});case"jsx":return zt.javascript({jsx:!0,typescript:!1});case"tsx":return zt.javascript({jsx:!0,typescript:!0});default:return zt.javascript()}},c=()=>{const g=[Ns.basicSetup,Ze.lineNumbers(),Ze.highlightActiveLineGutter(),Ze.highlightSpecialChars(),Eo.history(),Ze.drawSelection(),Ze.dropCursor(),Dt.indentOnInput(),Dt.bracketMatching(),Bo.closeBrackets(),Ze.rectangularSelection(),Dt.foldGutter(),Ze.keymap.of([...Bo.closeBracketsKeymap,...Eo.defaultKeymap,...Eo.historyKeymap,...Dt.foldKeymap]),Dt.syntaxHighlighting(Dt.defaultHighlightStyle)];return g.push(d(i.mode)),i.readonly&&g.push(So.EditorState.readOnly.of(!0)),i.isHint&&i.handleHint&&g.push(Bo.autocompletion({override:[b=>{const k=b.matchBefore(/\w*/);if(!k||k.from===k.to)return null;const v=i.handleHint(k.text);return v.length===0?null:{from:k.from,options:v.map(w=>({label:typeof w=="string"?w:w.label||w.name||"",detail:typeof w=="string"?"":w.detail||"",type:typeof w=="string"?"variable":w.type||"variable",apply:typeof w=="string"?w:w.apply||w.name||w.label||""}))}}]})),g.push(Ze.EditorView.updateListener.of(b=>{if(b.docChanged){const k=b.state.doc.toString();r.value=k,a("update:value",k),a("change",{value:k})}})),g},f=async()=>{if(!l.value)return;const g=So.EditorState.create({doc:i.value,extensions:c()});s=new Ze.EditorView({state:g,parent:l.value}),r.value=i.value},u=()=>{if(!s)return;const g=s.state.doc.toString();s&&s.destroy();const b=So.EditorState.create({doc:g,extensions:c()});l.value&&(s=new Ze.EditorView({state:b,parent:l.value}));const k=s.state.doc.toString();k!==i.value&&s.dispatch({changes:{from:0,to:k.length,insert:i.value}})},p=()=>{if(!s)return;const g=s.state.doc.length;s.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(s){const b=s.state.doc.length;s.dispatch({selection:{anchor:b,head:b},scrollIntoView:!0})}},100)},h=()=>{let g=Ts.format(i.value);g=g.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),a("update:value",g),a("change",{value:g})};let m=null;return n.watch(()=>i.value,g=>{g!==r.value&&(r.value=g,s&&u(),setTimeout(()=>{s&&i.isScrollToBottom&&p()}))}),n.watch(()=>i.mode,()=>{s&&u()}),n.onMounted(async()=>{await n.nextTick(),await f(),typeof window<"u"&&window.ResizeObserver&&l.value&&(m=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),m.observe(l.value))}),n.onUnmounted(()=>{m&&l.value&&(m.unobserve(l.value),m.disconnect(),m=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(g,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:l,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),xd=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,i=n.useTemplateRef("actionRef"),a=n.ref("0"),l=n.computed(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":a.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:r.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),r=n.computed(()=>Number.parseInt(a.value)>10&&!o.isPassing);return t({getEl:()=>i.value,getStyle:()=>i?.value?.style,setLeft:s=>{a.value=s}}),(s,d)=>{const c=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:i,style:n.normalizeStyle(l.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),Sd=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,i=n.useTemplateRef("barRef"),a=n.ref("0"),l=n.computed(()=>{const{barStyle:r,toLeft:s}=o;return{...r,width:s?"0":a.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:()=>i.value,setWidth:r=>{a.value=r}}),(r,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:i,style:n.normalizeStyle(l.value)},null,4))}}),Bd=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,i=n.useTemplateRef("contentRef"),a=n.computed(()=>{const{contentStyle:r}=o;return{...r,fontSize:"12px"}});t({getEl:()=>i.value});const l=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(r,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:i,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(a.value)},[n.createElementVNode("div",{style:n.normalizeStyle(l.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Fa=te(n.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:n.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:n.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,i=t,a=n.useModel(e,"modelValue"),l=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),r=n.useTemplateRef("wrapperRef"),s=n.useTemplateRef("barRef"),d=n.useTemplateRef("contentRef"),c=n.useTemplateRef("actionRef");n.watch(()=>l.isPassing,k=>{if(k){const{endTime:v,startTime:w}=l,C=(v-w)/1e3;i("success",{isPassing:k,time:C.toFixed(1)}),a.value=k}}),n.watchEffect(()=>{l.isPassing=!!a.value});function f(k){return"pageX"in k?k.pageX:"touches"in k&&k.touches[0]?k.touches[0].pageX:0}function u(k){l.isPassing||c.value&&(i("start",k),l.moveDistance=f(k)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),l.startTime=Date.now(),l.isMoving=!0)}function p(k){const v=r.value?.offsetWidth??220,w=k?.offsetWidth??40,C=v-w-6;return{actionWidth:w,offset:C,wrapperWidth:v}}function h(k){const{isMoving:v,moveDistance:w}=l;if(v){const C=n.unref(c),S=n.unref(s);if(!C||!S)return;const{actionWidth:y,offset:E,wrapperWidth:B}=p(C.getEl()),_=f(k)-w;i("move",{event:k,moveDistance:w,moveX:_}),_>0&&_<=E?(C.setLeft(`${_}px`),S.setWidth(`${_+y/2}px`)):_>E&&(C.setLeft(`${B-y}px`),S.setWidth(`${B-y/2}px`),g())}}function m(k){const{isMoving:v,isPassing:w,moveDistance:C}=l;if(v&&!w){i("end",k);const S=c.value,y=n.unref(s);if(!S||!y)return;const E=f(k)-C,{actionWidth:B,offset:_,wrapperWidth:T}=p(S.getEl());E<_?b():(S.setLeft(`${T-B}px`),y.setWidth(`${T-B/2}px`),g()),l.isMoving=!1}}function g(){l.endTime=Date.now(),l.isPassing=!0,l.isMoving=!1}function b(){l.isMoving=!1,l.isPassing=!1,l.moveDistance=0,l.toLeft=!1,l.startTime=0,l.endTime=0;const k=n.unref(c),v=n.unref(s),w=n.unref(d);!k||!v||!w||(w.getEl().style.width="100%",l.toLeft=!0,setTimeout(()=>{l.toLeft=!1,k.setLeft("0"),v.setWidth("0")},300))}return(k,v)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:r,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:m,onMousemove:h,onMouseup:m,onTouchend:m,onTouchmove:h},[n.createVNode(Sd,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":l.toLeft},null,8,["bar-style","to-left"]),n.createVNode(Bd,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":l.isPassing},null,8,["content-style","is-passing"]),n.createVNode(xd,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":l.isPassing,"to-left":l.toLeft,onMousedown:u,onTouchstart:u},null,8,["action-style","is-passing","to-left"])],38))}}));function Ed(e,t){return n.getCurrentScope()?(n.onScopeDispose(e,t),!0):!1}const _d=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function jd(e){return Array.isArray(e)?e:[e]}function Vd(e){return n.getCurrentInstance()}function Td(e,t=!0,o){Vd()?n.onMounted(e,o):t?e():n.nextTick(e)}const Ia=_d?window:void 0;function Xt(e){var t;const o=n.toValue(e);return(t=o?.$el)!==null&&t!==void 0?t:o}function Nd(){const e=n.shallowRef(!1),t=n.getCurrentInstance();return t&&n.onMounted(()=>{e.value=!0},t),e}function $d(e){const t=Nd();return n.computed(()=>(t.value,!!e()))}function Md(e,t,o={}){const{window:i=Ia,...a}=o;let l;const r=$d(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},d=n.watch(n.computed(()=>{const f=n.toValue(e);return Array.isArray(f)?f.map(u=>Xt(u)):[Xt(f)]}),f=>{if(s(),r.value&&i){l=new ResizeObserver(t);for(const u of f)u&&l.observe(u,a)}},{immediate:!0,flush:"post"}),c=()=>{s(),d()};return Ed(c),{isSupported:r,stop:c}}function Ld(e,t={width:0,height:0},o={}){const{window:i=Ia,box:a="content-box"}=o,l=n.computed(()=>{var u;return(u=Xt(e))===null||u===void 0||(u=u.namespaceURI)===null||u===void 0?void 0:u.includes("svg")}),r=n.shallowRef(t.width),s=n.shallowRef(t.height),{stop:d}=Md(e,([u])=>{const p=a==="border-box"?u.borderBoxSize:a==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(i&&l.value){const h=Xt(e);if(h){const m=h.getBoundingClientRect();r.value=m.width,s.value=m.height}}else if(p){const h=jd(p);r.value=h.reduce((m,{inlineSize:g})=>m+g,0),s.value=h.reduce((m,{blockSize:g})=>m+g,0)}else r.value=u.contentRect.width,s.value=u.contentRect.height},o);Td(()=>{const u=Xt(e);u&&(r.value="offsetWidth"in u?u.offsetWidth:t.width,s.value="offsetHeight"in u?u.offsetHeight:t.height)});const c=n.watch(()=>Xt(e),u=>{r.value=u?t.width:0,s.value=u?t.height:0});function f(){d(),c()}return{width:r,height:s,stop:f}}function Lo(e,t){const{containerStyle:o,wrapperProps:i,scrollTo:a,calculateRange:l,currentList:r,containerRef:s}="itemHeight"in t?Ad(t,e):Rd(t,e);return{list:r,scrollTo:a,containerProps:{ref:s,onScroll:()=>{l()},style:o},wrapperProps:i}}function za(e){const t=n.shallowRef(null),o=Ld(t),i=n.ref([]),a=n.shallowRef(e);return{state:n.ref({start:0,end:10}),source:a,currentList:i,size:o,containerRef:t}}function Da(e,t,o){return i=>{if(typeof o=="number")return Math.ceil(i/o);const{start:a=0}=e.value;let l=0,r=0;for(let s=a;s<t.value.length;s++){const d=o(s);if(l+=d,r=s,l>i)break}return r-a}}function Ha(e,t){return o=>{if(typeof t=="number")return Math.floor(o/t)+1;let i=0,a=0;for(let l=0;l<e.value.length;l++){const r=t(l);if(i+=r,i>=o){a=l;break}}return a+1}}function Wa(e,t,o,i,{containerRef:a,state:l,currentList:r,source:s}){return()=>{const d=a.value;if(d){const c=o(e==="vertical"?d.scrollTop:d.scrollLeft),f=i(e==="vertical"?d.clientHeight:d.clientWidth),u=c-t,p=c+f+t;l.value={start:u<0?0:u,end:p>s.value.length?s.value.length:p},r.value=s.value.slice(l.value.start,l.value.end).map((h,m)=>({data:h,index:m+l.value.start}))}}}function Ua(e,t){return o=>typeof e=="number"?o*e:t.value.slice(0,o).reduce((i,a,l)=>i+e(l),0)}function Ja(e,t,o,i){n.watch([e.width,e.height,()=>n.toValue(t),o],()=>{i()})}function Ya(e,t){return n.computed(()=>typeof e=="number"?t.value.length*e:t.value.reduce((o,i,a)=>o+e(a),0))}const Pd={horizontal:"scrollLeft",vertical:"scrollTop"};function qa(e,t,o,i){return a=>{i.value&&(i.value[Pd[e]]=o(a),t())}}function Rd(e,t){const o=za(t),{state:i,source:a,currentList:l,size:r,containerRef:s}=o,d={overflowX:"auto"},{itemWidth:c,overscan:f=5}=e,u=Da(i,a,c),p=Wa("horizontal",f,Ha(a,c),u,o),h=Ua(c,a),m=n.computed(()=>h(i.value.start)),g=Ya(c,a);return Ja(r,t,s,p),{scrollTo:qa("horizontal",p,h,s),calculateRange:p,wrapperProps:n.computed(()=>({style:{height:"100%",width:`${g.value-m.value}px`,marginLeft:`${m.value}px`,display:"flex"}})),containerStyle:d,currentList:l,containerRef:s}}function Ad(e,t){const o=za(t),{state:i,source:a,currentList:l,size:r,containerRef:s}=o,d={overflowY:"auto"},{itemHeight:c,overscan:f=5}=e,u=Da(i,a,c),p=Wa("vertical",f,Ha(a,c),u,o),h=Ua(c,a),m=n.computed(()=>h(i.value.start)),g=Ya(c,a);return Ja(r,t,s,p),{calculateRange:p,scrollTo:qa("vertical",p,h,s),containerStyle:d,wrapperProps:n.computed(()=>({style:{width:"100%",height:`${g.value-m.value}px`,marginTop:`${m.value}px`}})),currentList:l,containerRef:s}}const Od=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{getMenuMap:a,toArray:l,activeMenu:r,theme:s}=On(),{getHMoreMenus:d}=gc(),c=n.ref([]);o.pId==="moreId"?c.value=d.value:c.value=l(a()[o.pId||""]||[],[]);const f=m=>{const g=c.value.find(b=>b.active);g?.value!==m.value&&(g&&(g.active=!1),i("click",m))},{list:u,containerProps:p,wrapperProps:h}=Lo(c,{itemHeight:44});return(m,g)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":n.unref(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},n.unref(p)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),b=>(n.openBlock(),n.createBlock(In,{key:b.data.value,"parent-actives":n.unref(r)?.pid?.split(".")||[],item:b.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),Fd={class:"j-menu-item-label"},Id={class:"j-menu-item-label"},zd={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},Dd={class:"j-menu-item-label"},In=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}=Pe(),i=t,a=l=>{i("click",l)};return(l,r)=>{const s=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),c=n.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(n.openBlock(),n.createBlock(d,{key:0,placement:"right"},{content:n.withCtx(()=>[n.createElementVNode("span",null,n.toDisplayString(n.unref(o)(e.item.label)),1)]),default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:r[0]||(r[0]=n.withModifiers(f=>a(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",Fd,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(n.openBlock(),n.createBlock(c,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,"popper-class":"j-sub-menu"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,style: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"])):n.createCommentVNode("",!0),n.createElementVNode("div",Id,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",zd)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(Od,{"p-id":e.item.value,onClick:a},null,8,["p-id"])]),_:1},8,["placement"])):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:r[1]||(r[1]=n.withModifiers(f=>a(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style: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"])):n.createCommentVNode("",!0),n.createElementVNode("div",Dd,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2))}}}),Hd=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=u=>{i("click",u)},s=n.computed(()=>o.menuList),{list:d,containerProps:c,wrapperProps:f}=Lo(s,{itemHeight:44});return(u,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(l)==="dark"}]},n.unref(c)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(f))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(d),h=>(n.openBlock(),n.createBlock(In,{key:h.data.value,"parent-actives":n.unref(a)?.pid?.split(".")||[],item:h.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":h.data.entering,"menu-item-leaving":h.data.leaving}),onClick:r},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Wd=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=n.ref(),s=n.ref(0);let d=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&r.value&&(d=new ResizeObserver(()=>{r.value&&(s.value=r.value.offsetWidth)}),d.observe(r.value))});const c=n.computed(()=>{const h=[];let m=0,g=0;const b=o.menuList.length;return o.menuList.forEach(k=>{g++;const v=(fn(k.label)||0)+32+16+4+8;m+=v,(g===b&&m<=s.value||g<b&&m+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=n.computed(()=>{const h=[];let m=0;const g=c.value.length;return o.menuList.forEach(b=>{m++,m>=g&&h.push(b)}),h}),u=n.computed(()=>{const h=a.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(m=>m.value===h[1])>-1||f.value.findIndex(m=>m.value===a.value?.value)>-1)&&h.push("moreId"),h}),p=h=>{i("click",h)};return yc({getHMoreMenus:f}),n.onUnmounted(()=>{d&&r.value&&(d.unobserve(r.value),d.disconnect(),d=null)}),(h,m)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:r,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(l)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,g=>(n.openBlock(),n.createBlock(In,{key:g.value,"parent-actives":u.value,item:g,"is-horizontal":"",onClick:p},null,8,["parent-actives","item"]))),128))],2))}}),Ud=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=n.computed(()=>(o.menuList.forEach((h,m)=>{h.color=r[m%r.length]}),o.menuList)),d=n.computed(()=>a.value?.pid?.split(".")||[]),c=h=>{i("click",h)},{list:f,containerProps:u,wrapperProps:p}=Lo(s,{itemHeight:96});return(h,m)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(l)==="dark"}]},n.unref(u)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(p))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),g=>(n.openBlock(),n.createBlock(In,{key:g.data.value,"parent-actives":d.value,item:g.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),Ga=te(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,i=t;let a={};const l=n.ref("");l.value=o.activeId||"";const r=(g,b,k,v,w)=>{k=k||[];for(let C=0,S=k.length;C<S;C++){const y=k[C],E={};E.pid=b,E.indent=v,l.value===y.value&&(E.active=!0),Object.keys(y).forEach(_=>{_!=="children"&&(E[_]=y[_])}),w&&w.includes(y.value)&&(E.open=!0),g.push(E);const B=y.children||[];B.length>0&&(E.hasChildren=!0,w||(a[E.value]=B),(!w||E.open&&!o.collapsed)&&r(g,`${b}.${E.value}`,B,v+1,w))}},s=(g,b)=>{const k=[];return r(k,"0",g,0,b),k},d=n.ref([]);let c=[];const f=()=>{a={},c=s(o.menus);const g=[];if(l.value&&o.mode==="inline"){const b=c.find(k=>k.value===l.value);b&&g.push(...b.pid.split("."))}d.value=s(o.menus,g),console.log("showMenuList",d.value)};n.watch(()=>o.menus,()=>{f()},{immediate:!0}),n.watch(()=>o.mode,()=>{f()});const u=()=>{if(d.value.find(b=>b.active)?.value!==l.value){const b=c.find(k=>k.value===l.value);if(b){const k=[];o.mode==="inline"&&k.push(...b.pid.split(".")),d.value=s(o.menus,k)}}},p=n.computed(()=>c.find(g=>g.value===l.value));n.watch(()=>o.activeId,()=>{l.value=o.activeId||"",u()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const g=[];if(l.value){const b=c.find(k=>k.value===l.value);b&&g.push(...b.pid.split("."))}d.value=s(o.menus,g)}});const h=n.computed(()=>o.theme),m=g=>{if(g.hasChildren){if(o.collapsed)return;const b=[];b.push(...g.pid.split(".")),g.open||b.push(g.value);const k=s(o.menus,b),v=new Set(d.value.map(C=>C.value)),w=new Set(k.map(C=>C.value));k.forEach(C=>{v.has(C.value)||(C.entering=!0)}),d.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),d.value=k,setTimeout(()=>{d.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{const b=d.value.find(k=>k.active);if(b?.value===g.value)return;b&&(b.active=!1),g.active=!0,l.value=g.value,i("click",g)}};return mc({getMenuMap:()=>a,toArray:s,activeMenu:p,theme:h}),(g,b)=>e.mode==="inline"?(n.openBlock(),n.createBlock(Hd,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:m},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(Wd,{key:1,"menu-list":d.value,onClick:m},null,8,["menu-list"])):(n.openBlock(),n.createBlock(Ud,{key:2,"menu-list":d.value,onClick:m},null,8,["menu-list"]))}})),Jd={class:"j-keyword-panel"},Yd={key:0},qd={key:1,class:"columns-wrapper"},Gd=n.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props: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}=Pe(),i=e,a=n.useModel(e,"checkAll"),l=n.useModel(e,"checkFields"),r=n.ref(!1),s=n.ref(""),d=n.computed(()=>i.columns.filter(p=>p.config?.filter?.isSearchKeyword?s.value?p.config?.label?.indexOf(s.value)!=-1:!0:!1).map(p=>({label:p.config?.label,value:p.id}))),c=()=>{a.value||(a.value=!0,r.value=!1,l.value=[])},f=p=>{p.length>0?a.value=!1:a.value=!0};return t({init:()=>{a.value?r.value=!1:r.value=!0}}),(p,h)=>{const m=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),b=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",Jd,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:a.value}]),onClick:c},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),a.value?(n.openBlock(),n.createBlock(m,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:h[0]||(h[0]=k=>r.value=!r.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(m,{icon:r.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),r.value?(n.openBlock(),n.createElementBlock("div",Yd,[n.createVNode(g,{class:"no-border background",modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=k=>s.value=k),modelModifiers:{trim:!0},placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(m,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),r.value?(n.openBlock(),n.createElementBlock("div",qd,[n.createVNode(b,{options:d.value,modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=k=>l.value=k),onChange:f,style:{display:"flex","flex-direction":"column"}},null,8,["options","modelValue"])])):n.createCommentVNode("",!0)])}}}),Kd={key:0,class:"title"},Xd={class:"content"},Zd={class:"relation"},Qd={style:{width:"72px"}},eu={class:"btn-wrapper"},tu={class:"field-wrapper"},nu={class:"buttons"},Ka=n.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:n.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=n.useModel(e,"relation"),r=n.useModel(e,"isPin"),s=n.ref([]),d=()=>{r.value=!r.value},c=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:u.value.join(","),options:f.value}),config:{appendTo:r.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:r.value?132:160,change:({value:v,row:w})=>{const S=a.columns.find(B=>B.id===v)?.config||{};let y="eq",E="text";["options"].includes(S.dataType||"")?y="in":["dateTime"].includes(S.dataType||"")&&(y="range",E="dateTime"),w.method=y,w.type=S.valueType||E}}},{id:"method",type:"j-select",getCompConfig:({row:v})=>{const C=a.columns.find(S=>S.id===v.field)?.config||{};return["options","switch"].includes(C.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(C.dataType||"")?{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:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{width:r.value?120:144,appendTo:r.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:v})=>{v.value=void 0}}},{id:"value",type:"input",getCompType:({row:v})=>{const C=a.columns.find(S=>S.id===v.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(v.method)||["eq","ne"].includes(v.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(v.method)?"j-date-range":["formula"].includes(v.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:v})=>{if(["empty","not_empty"].includes(v.method||""))return{display:!1};const C=a.columns.find(y=>y.id===v.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=C.dataType,S.dataCode=C.dataCode,S.options=C.options):["switch"].includes(C.dataType||"")?(S.options=[],S.dataType="options",C.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(v.method)?(S.placeholder="",S.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"}],S.dataType="options"):(S.type="datetime",["range"].includes(v.method)?(S.startPlaceholder="开始时间",S.endPlaceholder="结束时间",S.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):S.placeholder="")),S},config:{width:r.value?234:296,appendTo:r.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{s.value=a.searchFieldList});const f=n.computed(()=>a.columns.filter(v=>!v.children?.length).map(v=>({label:v.config?.label,value:v.id,dataType:v.config?.dataType,options:v.config?.options}))),u=n.computed(()=>s.value.map(v=>v.field)),p=({data:v})=>{if(u.value.includes(v.value))return;const C=a.columns.find(E=>E.id===v.value)?.config||{};let S="eq",y="text";["options","dataItem"].includes(C.dataType||"")?S="in":["dateTime"].includes(C.dataType||"")&&(S="range",y="dateTime"),s.value.push({field:v.value,method:S,type:C.valueType||y})},h=o,m=()=>{s.value.length=0},g=()=>{r.value?h("filter"):h("close",!0)},b=()=>{s.value.forEach(v=>{v.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(v,w)=>{const C=n.resolveComponent("j-icon"),S=n.resolveComponent("j-select"),y=n.resolveComponent("j-button-select"),E=n.resolveComponent("j-button"),B=n.resolveComponent("j-input-rows"),_=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":r.value}])},[r.value?(n.openBlock(),n.createElementBlock("div",Kd,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",Xd,[n.createElementVNode("div",Zd,[n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("筛选出符合以下")),1),n.createElementVNode("div",Qd,[n.createVNode(S,{teleported:!1,noBorder:!0,modelValue:l.value,"onUpdate:modelValue":w[0]||(w[0]=T=>l.value=T),options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("条件的数据")),1)]),n.createElementVNode("div",eu,[n.createVNode(y,{label:"添加过滤条件",options:f.value,modelValue:u.value.join(","),onChange:p},null,8,["options","modelValue"]),s.value.length>0?(n.openBlock(),n.createBlock(E,{key:0,type:"text",danger:"",label:"删除全部",onClick:m})):n.createCommentVNode("",!0)]),n.createElementVNode("div",tu,[n.createVNode(B,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=T=>s.value=T),columns:c,editConfig:{isAddBtn:!1},isWrap:r.value},null,8,["modelValue","isWrap"])]),n.createVNode(_,{placement:"bottom",content:r.value?n.unref(i)("取消固定"):n.unref(i)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:d},[n.createVNode(C,{rotate:45,icon:r.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",nu,[n.createVNode(E,{label:n.unref(i)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(E,{label:n.unref(i)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:b},null,8,["label"])])],2)}}}),ou={class:"j-order-panel"},iu={class:"content"},au={class:"btn-wrapper"},lu={class:"field-wrapper"},ru={class:"buttons"},su=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=o,r=n.computed(()=>a.columns.filter(m=>!m.children?.length&&m.config?.sorter?.isNot!==!0).map(m=>({label:m.config?.label,value:m.id}))),s=n.ref([]),d=n.computed(()=>s.value.map(m=>m.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:m})=>({title:m.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:m})=>{d.value.includes(m.value)||s.value.push({label:m.label,value:m.value,sord:"ASC"})},u=m=>{s.value=JSON.parse(JSON.stringify(m))},p=()=>{l("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],l("clear")};return t({init:u}),(m,g)=>{const b=n.resolveComponent("j-button-select"),k=n.resolveComponent("j-input-rows"),v=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",ou,[n.createElementVNode("div",iu,[n.createElementVNode("div",au,[n.createVNode(b,{label:"添加排序规则",options:r.value,modelValue:d.value.join(","),onChange:f},null,8,["options","modelValue"])]),n.createElementVNode("div",lu,[n.createVNode(k,{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=w=>s.value=w),columns:c,editConfig:{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",ru,[n.createVNode(v,{label:n.unref(i)("排序"),type:"primary",onClick:p},null,8,["label"]),s.value.length>0?(n.openBlock(),n.createBlock(v,{key:0,label:n.unref(i)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),cu={class:"j-column-panel"},du={class:"content"},uu={class:"search-wrapper"},fu={class:"tree-wrapper"},pu={class:"buttons"},hu=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:i}=Pe(),a=e,l=o,r=n.ref(),s=n.ref(""),d={},c=n.ref([]),f=n.ref([]),u=(y,E)=>{const B=[],_=new Map;y.forEach(j=>{_.set(j.id,j),d[j.id]=j});const T=new Set;return E&&E.length>0&&E.forEach(j=>{const D=_.get(j.id);if(D){T.add(D.id);const A={id:D.id,label:D.config?.label||D.id,type:D.type,display:D.config?.display!==!1};D.children&&D.children.length>0&&(A.children=u(D.children,j.children)),B.push(A)}}),y.forEach(j=>{if(!T.has(j.id)){const D={id:j.id,label:j.config?.label||j.id,type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(D.children=u(j.children)),B.push(D)}}),B},p=(y,E)=>E.length===0?y:y.map(B=>{const _=E.some(j=>B.label.toLowerCase().includes(j.toLowerCase())),T=B.children?p(B.children,E):[];return _||T.length>0?{...B,children:T.length>0?T:B.children}:null}).filter(Boolean),h=n.computed(()=>{if(!s.value)return f.value;const y=s.value.split(/\s+/).filter(Boolean);return p(f.value,y)}),m=n.ref([]),g=n.computed(()=>{const y=new Map;if(a.columnConfig&&a.columnConfig.length>0){const E=B=>{B.forEach(_=>{y.set(_.id,_),_.children&&E(_.children)})};E(a.columnConfig)}return y}),b=()=>{const y=E=>{const B=[];return E.forEach(_=>{let T=!0;if(g.value.size>0){const j=g.value.get(_.id);j?T=j.display:T=_.config?.display!==!1}else T=_.config?.display!==!1;T&&(B.push(_.id),_.children&&B.push(...y(_.children)))}),B};m.value=y(a.columns)},k=(y,{node:E})=>{y.includes(E.id)?m.value.push(E.id):m.value=m.value.filter(_=>_!==E.id)},v=(y,E,B)=>B==="inner"?!1:y.parent===E.parent,w=()=>{const y=E=>E.map(B=>{const _={...B,display:m.value.includes(B.id)};return B.children&&(_.children=y(B.children)),_});l("save",y(f.value))},C=()=>{if(b(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",r.value){const y=r.value;y.setCheck&&y.setCheck(m.value);const E=y.$refs?.treeRef||y;E?.setCheckedKeys&&E.setCheckedKeys(m.value)}};return t({init:()=>{b(),c.value=u(a.columns,a.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(y,E)=>{const B=n.resolveComponent("j-icon"),_=n.resolveComponent("el-input"),T=n.resolveComponent("j-tree"),j=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",cu,[n.createElementVNode("div",du,[n.createElementVNode("div",uu,[n.createVNode(_,{modelValue:s.value,"onUpdate:modelValue":E[0]||(E[0]=D=>s.value=D),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(B,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",fu,[n.createVNode(T,{ref_key:"treeRef",ref:r,list:h.value,"is-tree-data":!0,"default-checked-keys":m.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":v,check:k},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",pu,[n.createVNode(j,{label:n.unref(i)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(j,{label:n.unref(i)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),mu={class:"j-table-panel-left"},gu={class:"j-table-panel-top"},yu={class:"j-table-panel-top-left"},bu={class:"j-table-panel-top-right"},wu={key:0,style:{width:"200px"}},vu={class:"j-table-panel-main"},Cu={key:0,class:"j-table-panel-filter-panel"},Xa=te(n.defineComponent({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},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:"操作"},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=o;a.isMultiple&&!a.rowKey&&console.warn("rowKey is required when isMultiple is true");const r=n.ref();let s=[];const d=n.ref(0),c=n.ref(1);let f=a.pageSize||100,u="";const p=n.ref([]),h=n.ref(!1),m=n.computed(()=>a.batchButtons&&a.batchButtons.length>0),g=n.computed(()=>p.value.length>0),b=n.computed(()=>m.value&&g.value||h.value),k=n.computed(()=>a.isPage&&!b.value);m.value&&!a.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const v=z=>a.rowKey?a.rowKey.split(",").map(de=>z[de.trim()]).join("::"):"",w=(z,F)=>{if(!F||F.length===0)return z.filter(J=>J.config?.display!==!1).map(J=>J.children&&J.children.length>0?{...J,children:w(J.children)}:J);const de=new Map(z.map(J=>[J.id,J])),ve=[];return F.forEach(J=>{const oe=de.get(J.id);if(oe){if(J.display){let ge=oe;oe.children&&oe.children.length>0&&(ge={...oe,children:w(oe.children,J.children)}),ve.push(ge)}de.delete(J.id)}}),z.forEach(J=>{if(de.has(J.id)&&J.config?.display!==!1){let oe=J;J.children&&J.children.length>0&&(oe={...J,children:w(J.children)}),ve.push(oe)}}),ve},C=n.computed(()=>w(a.columns,se.value)),S=n.computed(()=>Ui(a.columns,z=>z.config.label)),y=n.ref(""),E=n.computed(()=>S.value.some(z=>z.config?.filter?.isSearchKeyword)),B=n.ref(),_=n.ref(!0),T=n.ref([]),j=n.computed(()=>_.value?"搜索全部":`搜索范围:${S.value.filter(z=>T.value.includes(z.id)).map(z=>z.config?.label).join("、")}`),D=()=>{B.value.init()},A=n.ref(),R=n.ref(!1),V=n.ref(!1),x=n.ref(!1),L=n.ref([]),P=n.ref("and"),G=n.ref(),K=n.ref(!1),ne=n.ref([]),pe=()=>{G.value.init(ne.value)},fe=z=>{ne.value=z,K.value=!1,De()},Y=()=>{ne.value=[],De()},he=n.ref(),ae=n.ref(!1),se=n.ref(),xe=n.computed(()=>se.value!=null),Ve=()=>{he.value?.init()},H=z=>{console.log("handleColumnSave:",z),se.value=z,ae.value=!1},X=n.ref(!1),le=()=>{X.value=!X.value},we=()=>{p.value=[],r.value&&(r.value.setSelection?.([]),h.value&&(h.value=!1,r.value.setRecords(s)))},$e=()=>{h.value=!h.value,h.value?r.value?.setRecords(p.value):r.value?.setRecords(s),r.value?.setSelection?.(p.value)},Re=n.computed(()=>{if(p.value.length>0){const z=[{label:`已选${p.value.length}条`,type:"text"},{label:h.value?"全部":"仅选中",type:"text",click:$e},{label:"清空选中",type:"text",click:we}],F=a.batchButtons.map(de=>({...de,click:()=>{de.click&&de.click(p.value)}}));return[...z,...F]}return a.buttons}),me=async()=>{const z={},F={};F.rel=P.value;const de=A.value?.getSearchFields?.()||L.value;F.cond=de.filter(J=>J.value!==void 0&&J.value!==null&&J.value!=="").map(J=>({field:J.field,method:J.method,value:J.value,type:J.type})),F.cond.length>0?x.value=!0:x.value=!1,z.filter=F;const ve=ne.value.map(J=>J.value+" "+J.sord).join(",");if(y.value&&(z.keyword={value:y.value,fields:_.value?S.value.filter(J=>J.config?.filter?.isSearchKeyword).map(J=>J.id):n.unref(T)}),a.loadData){if(a.isPage){z.pagination={rows:f,page:c.value,sort:ve||u||a.sort||a.rowKey};const J=await a.loadData(z)||{};s=J.rows||[],d.value=J.records||0}else z.sort=ve,s=await a.loadData(z)||[],d.value=s.length;r.value.setRecords(s),m.value?(p.value=[],h.value=!1):a.rowKey&&p.value.length>0&&r.value?.setSelection?.(p.value)}},De=async()=>{c.value=1,await me()},ut=({rows:z,page:F})=>{f=z,c.value=F,me()},ot=async()=>{c.value=1,await me()},O=async()=>{await me()},q=async()=>{await ot()},I=z=>{l("ready",z)},N=z=>{let F=[];if(m.value)F=z;else if(!a.rowKey)F=z;else{const de=new Map(z.map(J=>[v(J),J])),ve=new Map(p.value.map(J=>[v(J),J]));s.forEach(J=>{const oe=v(J);de.has(oe)?ve.set(oe,de.get(oe)):ve.delete(oe)}),F=Array.from(ve.values())}p.value=F,l("select",F),h.value&&F.length===0?(h.value=!1,r.value&&r.value.setRecords(s)):h.value&&F.length>0&&r.value&&(r.value.setRecords(F),r.value.setSelection?.(F))},$=()=>p.value||[],W=z=>{p.value=z,r.value?.setSelection?.(z)},U=()=>r.value?.getInstance?.();return n.onMounted(async()=>{a.immediate&&await O()}),t({refreshData:O,resetData:ot,getSelection:$,setSelection:W,clearSelection:()=>{we()},getInstance:U}),(z,F)=>{const de=n.resolveComponent("j-buttons"),ve=n.resolveComponent("j-icon"),J=n.resolveComponent("el-popover"),oe=n.resolveComponent("el-tooltip"),ge=n.resolveComponent("el-input"),ue=n.resolveComponent("j-button"),Te=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:X.value,"no-padding":e.noPadding||X.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":X.value}])},[n.createElementVNode("div",mu,[n.createElementVNode("div",gu,[n.createElementVNode("div",yu,[n.createVNode(de,{list:Re.value},null,8,["list"])]),n.createElementVNode("div",bu,[E.value&&!b.value?(n.openBlock(),n.createElementBlock("div",wu,[n.createVNode(ge,{modelValue:y.value,"onUpdate:modelValue":F[2]||(F[2]=re=>y.value=re),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索数据"),onKeyup:n.withKeys(De,["enter"]),onClear:De,clearable:"",class:"j-suffix"},{prefix:n.withCtx(()=>[n.createVNode(ve,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(oe,{placement:"bottom",content:j.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:D,onHide:De},{reference:n.withCtx(()=>[n.createVNode(ve,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(Gd,{ref_key:"keywordPanelRef",ref:B,columns:S.value,"check-all":_.value,"onUpdate:checkAll":F[0]||(F[0]=re=>_.value=re),"check-fields":T.value,"onUpdate:checkFields":F[1]||(F[1]=re=>T.value=re)},null,8,["columns","check-all","check-fields"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!R.value&&!b.value?(n.openBlock(),n.createBlock(J,{key:1,placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,visible:V.value,"onUpdate:visible":F[6]||(F[6]=re=>V.value=re),onHide:De},{reference:n.withCtx(()=>[n.createVNode(ue,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:x.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Ka,{ref_key:"filterPanelRef",ref:A,"is-pin":R.value,"onUpdate:isPin":F[3]||(F[3]=re=>R.value=re),relation:P.value,"onUpdate:relation":F[4]||(F[4]=re=>P.value=re),searchFieldList:L.value,columns:S.value,onFilter:De,onClose:F[5]||(F[5]=re=>V.value=!1)},null,8,["is-pin","relation","searchFieldList","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:2,placement:"bottom",content:n.unref(i)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:pe,visible:K.value,"onUpdate:visible":F[7]||(F[7]=re=>K.value=re)},{reference:n.withCtx(()=>[n.createVNode(ue,{class:n.normalizeClass({active:ne.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(su,{ref_key:"orderPanelRef",ref:G,columns:S.value,onSave:fe,onClear:Y},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:3,placement:"bottom",content:n.unref(i)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:Ve,visible:ae.value,"onUpdate:visible":F[8]||(F[8]=re=>ae.value=re)},{reference:n.withCtx(()=>[n.createVNode(ue,{class:n.normalizeClass({active:xe.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(hu,{ref_key:"columnPanelRef",ref:he,columns:e.columns,"column-config":se.value,onSave:H},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:4,placement:"bottom",content:n.unref(i)("刷新")},{default:n.withCtx(()=>[n.createVNode(ue,{onClick:q,type:"text",icon:"mdi:refresh"})]),_:1},8,["content"])),n.createVNode(oe,{placement:"bottom",content:X.value?n.unref(i)("退出全屏"):n.unref(i)("全屏")},{default:n.withCtx(()=>[n.createVNode(ue,{onClick:le,type:"text",icon:X.value?"mdi:fullscreen-exit":"mdi:fullscreen"},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",vu,[n.createVNode(Te,{ref_key:"tableRef",ref:r,columns:C.value,records:n.unref(s),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":k.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"table-page":c.value,"onUpdate:tablePage":F[9]||(F[9]=re=>c.value=re),onLoadPageData:ut,onReady:I,onSelectionChanged:N},null,8,["columns","records","is-tree","is-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","actions-max-count","actions-label","table-page"])])]),R.value&&!b.value?(n.openBlock(),n.createElementBlock("div",Cu,[n.createVNode(Ka,{ref_key:"filterPanelRef",ref:A,"is-pin":R.value,"onUpdate:isPin":F[10]||(F[10]=re=>R.value=re),relation:P.value,"onUpdate:relation":F[11]||(F[11]=re=>P.value=re),searchFieldList:L.value,columns:S.value,onFilter:De},null,8,["is-pin","relation","searchFieldList","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),ku={class:"j-button-select"},xu={class:"search-wraper"},Su={class:"options-wraper"},Bu=["onClick"],Za=te(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,i=t,{t:a}=Pe(),l=n.ref(""),r=n.computed(()=>l.value===""?o.options:o.options.filter(c=>(c.label||"").includes(l.value))),s=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const u=[...s.value,c.value].join(",");i("update:modelValue",u),i("change",{value:u,data:c})};return(c,f)=>{const u=n.resolveComponent("j-button"),p=n.resolveComponent("j-icon"),h=n.resolveComponent("el-input"),m=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(m,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(u,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:n.withCtx(()=>[n.createElementVNode("div",ku,[n.createElementVNode("div",xu,[n.createVNode(h,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=g=>l.value=g),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Su,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,g=>(n.openBlock(),n.createElementBlock("div",{key:g.value,class:n.normalizeClass(["option-item",{active:s.value.includes(g.value)||g.disabled}]),onClick:n.withModifiers(b=>d(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(p,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)(g.label)),1)],10,Bu))),128))])])]),_:1},8,["width"])}}})),Eu={class:"j-tree-item-text"},_u={key:2,class:"j-tree-item-button-group"},ju={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Qa=te(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},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,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 i=e,a=o,{useData:l,t:r}=Pe(),{getTreeData:s,loadData:d}=l(),c=n.ref(),f=n.ref(!1),u=n.ref(""),p=n.ref([]),h={children:"children",label:"label",disabled:"disabled"},m=n.computed(()=>s?s({dataType:i.dataType,dataCode:i.dataCode,labelKey:i.labelKey,valueKey:i.valueKey,pidKey:i.pidKey,idKey:i.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>i.dataCode||i.dataType?m.value:i.list?n.unref(i.list):p.value),b=async()=>{f.value=!0,i.loadData&&(p.value=await i.loadData()||[]),d&&await d(i.dataType,i.dataCode),f.value=!1,n.nextTick(()=>{i.afterLoadData&&i.afterLoadData(g.value||[])})},k=(A,R=!0)=>{c.value?.setCurrentKey(A,R)},v=()=>c.value?.getCurrentKey(),w=(A,R=!1)=>{c.value?.setCheckedKeys(A,R)},C=(A=!1)=>c.value?.getCheckedKeys(A),S=async(A,R,V,x)=>{if(u.value=A.value,i.nodeClickFlow&&i.runFlow){const L=JSON.parse(i.nodeClickFlow);await i.runFlow(L,{value:A.value})}i.click&&i.click(A.value,A,x)},y=(A,{checkedKeys:R,checkedNodes:V,halfCheckedKeys:x,halfCheckedNodes:L})=>{i.check&&i.check(R,{node:A,checkedNodes:V,halfCheckedKeys:x,halfCheckedNodes:L})},E=(A,R,V,x)=>{a("node-drop",A,R,V,x)},B=A=>{const R=pt(i.treeButtons);return A&&i.filterButton?i.filterButton({buttons:R,node:A}):R},_=(A,R)=>{A.disabled||A.click&&A.click(R)},T=n.ref(""),j=(A,R)=>{T.value=A?R.value:"",console.log(T.value,"row")},D=(A,R,V)=>i.allowDrop?i.allowDrop(A,R,V):!(V=="inner"&&!R.data.canInner);return n.onMounted(async()=>{(i.immediate&&i.loadData||i.dataType||i.dataCode)&&await b()}),n.watch(()=>i.list,()=>{f.value=!0,n.nextTick(()=>{f.value=!1})}),n.watch(()=>i.dataCode||i.dataType,()=>{b()}),t({refreshData:b,setValue:k,getValue:v,setCheck:w,getCheck:C}),(A,R)=>{const V=n.resolveComponent("j-icon"),x=n.resolveComponent("j-button"),L=n.resolveComponent("el-dropdown-item"),P=n.resolveComponent("el-dropdown-menu"),G=n.resolveComponent("el-dropdown"),K=n.resolveComponent("el-tree"),ne=n.resolveComponent("el-empty"),pe=n.resolveDirective("loading");return n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&g.value.length>0?(n.openBlock(),n.createBlock(K,{key:0,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":u.value,data:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,onNodeClick:S,onCheck:y,onNodeDrop:E,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":D,"expand-on-click-node":e.expandOnClickNode,ref_key:"treeRef",ref:c},{default:n.withCtx(({node:fe})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===fe.data.value}])},[fe.data.openIcon?(n.openBlock(),n.createBlock(V,{key:0,class:"j-tree-item-open-icon",size:18,icon:fe.data.openIcon,color:fe.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),fe.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(V,{key:1,class:"j-tree-item-default-icon",size:18,icon:fe.data[e.iconKey]||e.defaultIcon||"",color:fe.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",Eu,n.toDisplayString(fe.label),1),B(fe.data).length?(n.openBlock(),n.createElementBlock("div",_u,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B(fe.data),(Y,he)=>(n.openBlock(),n.createBlock(G,{key:he,trigger:"click",onVisibleChange:ae=>j(ae,fe.data)},{dropdown:n.withCtx(()=>[n.createVNode(P,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Y.children,(ae,se)=>(n.openBlock(),n.createBlock(L,{key:se,disabled:ae.disabled,divided:ae.divided,onClick:n.withModifiers(xe=>_(ae,fe.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:ae.danger?"var(--j-color-danger)":ae.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ae.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(V,{key:0,icon:ae.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(r)(ae.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode(x,{icon:Y.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):n.createCommentVNode("",!0)],2)]),_:1},8,["node-key","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"])):(n.openBlock(),n.createElementBlock("div",ju,[n.createVNode(ne,{description:n.unref(r)(e.emptyDes)},null,8,["description"])]))],2)),[[pe,f.value]])}}})),el=te(pa),Vu=Is;async function Tu(e,t,o){const i={...o};delete i.ruleIndex,delete i.trigger;const a=new Vu({[e]:[i]});let l=[];try{await a.validate({[e]:t})}catch(r){r.errors?l=r.errors.map(({message:s})=>s):l=[i.message||"校验错误"]}return l.length>0?l[0]:""}async function Nu(e,t,o){const i=o.map((a,l)=>({...a,ruleIndex:l})).sort(({warningOnly:a,ruleIndex:l},{warningOnly:r,ruleIndex:s})=>!!a==!!r?l-s:a?1:-1);for(let a=0;a<i.length;a+=1){const l=i[a];"pattern"in l&&(t+="");const r=await Tu(e,t,l);if(r!=="")return{name:e,errors:r}}}function $u(e,t){const o=(l,r,s,d,c)=>{Object.keys(r).forEach(f=>{let u=f;s&&(u=`${s}.${f}`);const p=r[f],{rules:h,myGridtableId:m}=t(u,s?r:void 0,d,c);if(h.length){const g=i(u,p,h);l.push(g)}m&&p.forEach(g=>{o(l,g,m,p,s?r:void 0)})})},i=(l,r,s)=>Nu(l,r,s);return{validateForm:async()=>{const l=n.unref(e),r=[];o(r,l,"");const s=await Promise.all(r),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:i}}const tl=te(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}},emits:["change"],setup(e,{expose:t,emit:o}){const i=e,a=o,{useData:l,existField:r,httpGet:s,httpPost:d,success:c,warning:f,error:u,info:p,t:h}=Pe();let m;l&&(m=l());const g=O=>{u&&u(O)},b=n.ref(!1),k=n.computed(()=>i.config?.gutter||16),v=n.computed(()=>i.config?.span||24),w=n.computed(()=>i.config?.labelWidth),C=n.computed(()=>i.config?.labelPosition||"right"),S=n.computed(()=>B.length===1&&(B[0].type==="j-tabs"||B[0].type==="j-layout"||B[0].config?.isAutoWindow)),y=n.reactive({}),E=n.ref({}),B=[],_={},T=n.ref({});let j={},D={},A=[],R={};const V=O=>{a("change",O)},x=O=>Rn(_[O]?.type||"")&&!_[O]?.config?.notInput||_[O]?.config?.isInput,L=O=>["j-table","j-input-rows","j-input-cards"].includes(_[O]?.type||"");let P;const G=(O,q)=>{Object.keys(O).forEach(I=>{const N=O[I];q&&(I=q+"."+I),N!=null&&typeof N=="object"&&!Mn(N)&&G(N,I),y[I]=N})},K=(O,q)=>{let I=O.id;return I||(O.config?.table&&O.config?.field?I=`${O.config.table}.${O.config.field}`:O.config?.table?I=O.config?.table:O.config?.field&&(I=O.config?.field),q&&L(q)&&(I=`${q}.${I}`)),I||Pn("j")},ne=(O,q,I,N="")=>{O.forEach($=>{$.id=K($,N);const W={id:$.id,slot:$.slot,type:$.type,getCompType:$.getCompType,getCompConfig:$.getCompConfig,config:{},children:[]};q.push(W);const{children:U}=$;Ln(W,$,["children","config"]),Ln(W.config,$.config||{},[]),_[$.id]&&console.warn("有重复的组件id:"+$.id),_[$.id]=W,i.readonly===!0&&(W.config.readonly=!0);let Q=!1,z;N!==""&&L(N)&&(Q=!0,W.config=$.config||{},W.config.parentTableId=N,z=_[N]?.config?.table);const F=W.config||{};if(x($.id))!I&&Q===!1&&(F?.defaultValue===0?y[$.id]=F?.defaultValue:y[$.id]=F?.defaultValue||void 0),F.table&&F.field?j[`${F.table}_${F.field}`.toLowerCase()]=$.id:F.field&&(Q?j[`${z}_${F.field}`.toLowerCase()]=$.id:j[`${F.field}`.toLowerCase()]=$.id);else if(Q&&F.field)j[`${z}_${F.field}`.toLowerCase()]=$.id;else if(L($.id))!I&&!F.isSubTable&&(y[$.id]=[]),F.table&&(j[F.table.toLowerCase()||""]=$.id),F.isSubTable||A.push(W);else if(F?.defaultValue)y[$.id]=F?.defaultValue;else if($.type==="collapse"&&F?.isExpand){const de=[];(F?.groups||[]).forEach(ve=>{de.push(ve.i)}),y[$.id]=de}U&&U.length>0&&ne(U,W.children,I,W.id)})},pe=async(O,q)=>{b.value=!1;const I=!!q;B.splice(0,B.length),j={},D={},A=[],P=q,cn(y),T.value={},I&&G(q,""),ne(O,B,I),R=pt(y),n.nextTick(()=>{b.value=!0,n.nextTick(()=>{ut(i.config?.codeInit,{})})})},fe=(O,q,I)=>{const N=[];return q.forEach($=>{const W={};Object.keys($).forEach(U=>{if(!I||I(U,$[U],O)){const Q=le(U);if(Q?.type==="j-table")W[Q?.id||""]=fe(U,$[U],I);else{let z=j[`${O}_${U}`.toLowerCase()]||U;z=z.indexOf(".")!==-1?z.split(".")[1]:z,W[z]=$[U]}}}),N.push(W)}),N},Y=(O,q)=>{Object.keys(O||{}).forEach(I=>{let N=O[I];const $=le(I);if($===void 0)N&&(Mn(N)&&(N=N[0]||{}),typeof N=="object"?Object.keys(N).forEach(W=>{if(!q||q(I,N[W],I)){let U=W;I!=="main"&&(U=`${I}_${W}`),D[U]=I,y[j[U.toLowerCase()]||W]=N[W]}}):y[I]=N);else if(L($.id||"")){if(!Array.isArray(N)){console.warn("表格数据不是数组:"+I);return}N?.length>0?y[j[I.toLowerCase()]||I]=fe(I,N,q):y[j[I.toLowerCase()]||I]=[]}else(!q||q(I,N,I))&&(y[j[I.toLowerCase()]||I]=N)}),P&&Object.keys(y).forEach(I=>{const N=le(I);(N===void 0||!["tabs","collapse"].includes(N.type||""))&&Ri(P,I,y[I])})},he=(O,q=!1)=>{const I={};return Object.keys(O).forEach(N=>{if(N==="parentRow")return;const $=_[N];if($){const W=$.config?.table,U=$.config?.field;if(q)U?I[U]=O[N]:I[N]=O[N];else if(L(N)){const Q=[];O[N].forEach(z=>{Q.push(he(z,!0))}),I[W||N]=Q}else W&&U?(I[W]=I[W]||{},I[W][U]=O[N]):U&&(I[U]=O[N])}else q?N!=="_X_ROW_KEY"&&N!=="_isHover"&&(I[N]=O[N]):D[N]?(I[D[N]]=I[D[N]]||{},I[D[N]][N.replace(`${D[N]}_`,"")]=O[N]):I[N]=O[N]}),I},ae=(O=!0)=>O?he(y):y,se=(O,q,I,N)=>{let $=_[O];if($==null){const U=O.split(".");$=_[U[U.length-1]]||{}}if(!$)return{};const W=$t({config:{...$.config||{},...T.value[$.id]||{}},getCompConfig:$.getCompConfig,formData:y,tableData:I,row:q,pRowData:N});return W._componentId=$?.id,W},xe=(O,q,I,N)=>{const $=se(O,q,I,N);if($.isNotRule!==!0&&$.display!==!1){const W=$.rule||[],U=W.find(Q=>Q.type==="only");return U&&(U.validator=async(Q,z)=>{if(z){const F={table:Q.table,key:Q.key,keyName:Q.keyName,field:Q.field,keyValue:Q.getKeyValue?Q.getKeyValue():"",value:z,paramNames:Q.paramNames,getParams:Q.getParams,withProjectId:Q.withProjectId,getValue:Q.getValue,formData:y};if(!await r(F))throw h(Q.message)||h("数据值重复")}}),{rules:W,myGridtableId:L($._componentId)?$._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Ve}=$u(y,xe),H=async()=>{E.value={};const O=await Ve();return Object.keys(O).length>0?(E.value=O,g(`${h(_[Object.keys(O)[0]]?.config?.label)}:${h(O[Object.keys(O)[0]].msg)}`),!1):!0},X=()=>{E.value={},cn(y),Object.keys(R||{}).forEach(O=>{y[O]=R[O]})},le=O=>{let q=_[O];return q===void 0&&j[O.toLowerCase()]&&(q=_[j[O.toLowerCase()]]),q},we=({id:O,i:q,value:I,type:N})=>{if(N==="add")y[O].push(I);else if(N==="delete")y[O].splice(q,1);else{const $=le(O);$&&($.config.parentTableId?y[$.config.parentTableId][q][O]=I:y[O]=I)}},$e=({id:O,i:q})=>{const I=le(O);if(I){if(I.config.parentTableId){const N=y[I.config.parentTableId],$=I.id?I.id.replace(`${I.config.parentTableId}.`,""):"";if(q!=null)return(N[q]||{})[$||""];const W=[];return N&&N.forEach(U=>{W.push(U[$||""])}),W}if(L(I.id||"")){const N=[];return y[I.id||""].forEach($=>{N.push(he($,!0))}),N}return y[I.id||""]}if(y[O])return y[O]},Re=async({id:O,i:q})=>{const I=$e({id:O,i:q}),N=le(O);if(N&&m?.getLabel)if(q!==void 0){const $=I[q],W=y[N.config.parentTableId||""][q],U=$t({config:N.config,getCompConfig:N.getCompConfig,formData:y,tableData:y[N.config.parentTableId||""],row:W});return await m?.getLabel({value:$,config:U,formData:y,tableData:y[N.config.parentTableId||""],row:W})}else{const $=$t({config:N.config,getCompConfig:N.getCompConfig,formData:y});return await m?.getLabel({value:I,config:$,formData:y})}return I},me=async(O,q)=>m?.loadViewDataList?await m?.loadViewDataList(O,q,!1):[],De=O=>(O.set=we,O.get=$e,O.setFormData=Y,O.getFormData=ae,O.getLabel=Re,O.getViewData=me,O.getDateNow=q=>qi(new Date,q||"YYYY-MM-DD HH:mm:ss"),O.httpGet=s||(()=>{console.log("当前状态不支持")}),O.httpPost=d||(()=>{console.log("当前状态不支持")}),O.loading=q=>{Ht(q)},O.showMsg=({text:q,type:I})=>{switch(I){case"success":c&&c(q);break;case"warning":f&&f(q);break;case"error":u&&u(q);break;case"info":p&&p(q);break;default:p&&p(q);break}console.log("showMsg",q,I)},O),ut=async(O,q)=>{if(O&&O.trim()){O=`async (jcode) => {${O}}`;const{res:I,fn:N}=Vo(O);I&&await N(De(q))}},ot=(O,q)=>{T.value[O]={...T.value[O]||{},...q}};return i.schema&&pe(i.schema),fa({formData:y,compsConfig:T,errorFields:E,isAutoWindow:S,gutter:k,span:v,labelWidth:w,labelPosition:C,getValue:$e,formChange:V}),t({init:pe,reset:X,validate:H,setValue:we,getValue:$e,getLabel:Re,setFormData:Y,getFormData:ae,setCompConfig:ot}),(O,q)=>{const I=n.resolveComponent("j-form-item"),N=n.resolveComponent("el-row"),$=n.resolveComponent("el-form");return b.value?(n.openBlock(),n.createBlock($,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:q[0]||(q[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[S.value?(n.openBlock(),n.createBlock(I,n.normalizeProps(n.mergeProps({key:0},B[0])),null,16)):(n.openBlock(),n.createBlock(N,{key:1,gutter:k.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(B,W=>n.createVNode(I,n.mergeProps({key:W.id,ref_for:!0},W),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),nl=te(n.defineComponent({name:"JFormItem",__name:"form-item",props:{id:{type:String,default:""},type:{type:String,default:""},getCompType:{type:Function,default:void 0},config:{type:Object,default:()=>{}},getCompConfig:{type:Function,default:void 0},children:{type:Array,default:()=>[]}},setup(e){const t=e,{formData:o,compsConfig:i,errorFields:a,isAutoWindow:l,span:r,labelWidth:s}=Kt(),{t:d}=Pe(),c=n.computed(()=>$t({config:{...t.config||{},...i?.value?.[t.id]||{}},getCompConfig:t.getCompConfig,formData:o})),f=n.computed(()=>t.getCompType?t.getCompType({config:t.config,formData:o}):t.type),u=n.computed(()=>Rn(f.value)&&!c.value?.notInput||c.value?.isInput),p=n.computed(()=>c.value?.labelWidth||s.value),h=n.computed(()=>(c.value?.rule||[]).some(b=>b.required===!0)),m=n.computed(()=>{const g=a?.value?.[t.id];return g?g.msg:""});return(g,b)=>{const k=n.resolveComponent("j-comp"),v=n.resolveComponent("el-form-item"),w=n.resolveComponent("el-col");return c.value.display!==!1&&!n.unref(l)?(n.openBlock(),n.createBlock(w,{key:0,span:c.value.span||n.unref(r),style:n.normalizeStyle({...c.value.colStyle||{}}),class:n.normalizeClass(c.value.colClass||{})},{default:n.withCtx(()=>[u.value?(n.openBlock(),n.createBlock(v,{key:0,label:n.unref(d)(c.value.notShowLabel?"":c.value.label||""),"label-position":c.value.labelPosition,"label-width":p.value,required:h.value,error:n.unref(d)(m.value)},{default:n.withCtx(()=>[n.createVNode(k,{id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"])]),_:1},8,["label","label-position","label-width","required","error"])):(n.openBlock(),n.createBlock(k,{key:1,id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"]))]),_:1},8,["span","style","class"])):c.value.display!==!1?(n.openBlock(),n.createBlock(k,{key:1,id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"])):n.createCommentVNode("",!0)}}})),Mu={class:"j-page"},ol=te(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,i=n.ref(!1),a=[],l={},r=n.reactive({}),s=(c,f)=>{c.forEach(u=>{u.id=u.id||Pn("c");const p={id:u.id,slot:u.slot,type:u.type,config:{},children:[]},{children:h}=u;l[u.id]=p,Ln(p.config,u.config||{},["defaultValue"]),u?.config?.defaultValue!==void 0&&(r.value[u.id]=u.config.defaultValue),f.push(p),h&&h.length>0&&s(h,p.children)})},d=c=>{i.value=!1,a.splice(0,a.length),cn(l),cn(r),s(c,a),n.nextTick(()=>{i.value=!0})};return o.schema&&d(o.schema),t({init:d}),(c,f)=>{const u=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",Mu,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,p=>n.createVNode(u,{key:p.id,id:p.id,type:p.type,config:p.config,children:p.children},null,8,["id","type","config","children"])),64))])}}})),il=te(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref("");return n.watch(()=>o.modelValue,l=>{l?a.value=l:(a.value=dn(),i("update:modelValue",a.value))},{immediate:!0}),(l,r)=>{const s=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(s,{modelValue:a.value,"onUpdate:modelValue":r[0]||(r[0]=d=>a.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),Lu={class:"j-input-rows"},Pu={key:0,class:"j-input-rows-num"},Ru={key:1,class:"j-input-rows-char"},al=te(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:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,i=e,a=t,{formData:l}=Kt(),r=n.computed(()=>i.editConfig.isAddBtn!==!1),s=n.computed(()=>i.editConfig.addBtnText||"添加"),d=n.computed(()=>i.editConfig.buttonsAlign||"left"),c=n.computed(()=>i.editConfig.isRemoveBtn!==!1),f=n.computed(()=>i.editConfig.readonly),u=n.computed(()=>i.editConfig.drag),p=n.computed(()=>i.editConfig.isNullValue!==!1),h=n.ref(),m=["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"],g=n.ref([]);i.modelValue&&i.modelValue.length>0?(g.value=i.modelValue||[],g.value.forEach(C=>{C.i||(C.i=dn())})):(g.value=[],a("update:modelValue",g.value)),n.watch(()=>i.modelValue,C=>{g.value=i.modelValue||[],g.value=C||[],g.value.forEach(S=>{S.i||(S.i=dn())})},{deep:!0});const k=()=>{const C={i:dn()};i.columns.forEach(S=>{const y=S.config?.valueRowKey||S.id||"";y&&(C[y]=pt(S.config?.defaultValue))}),g.value.push(C),a("change",{id:i.id,value:C,data:C,formData:l,tableData:g.value,type:"add"})},v=C=>{const S=g.value[C];g.value.splice(C,1),a("change",{id:i.id,value:S,data:S,formData:l,tableData:g.value,type:"delete"})},w=C=>{a("rowChange",C)};return n.onMounted(()=>{if(!u.value||!h.value)return;const C=h.value,{initSortable:S}=ea(C,{handle:".j-input-rows-drag",onEnd:y=>{const{oldIndex:E,newIndex:B}=y;if(o(E)||o(B)||E===B||E<0||B<0)return;const _=g.value.splice(E,1)[0];g.value.splice(B,0,_),a("change",{id:i.id,value:_,data:_,formData:l,tableData:g.value,type:"sort"})}});S()}),Mo({tableData:g.value,rowChange:w}),(C,S)=>{const y=n.resolveComponent("j-comp"),E=n.resolveComponent("j-icon"),B=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Lu,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(_,T)=>(n.openBlock(),n.createElementBlock("div",{key:_.i+T,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",Pu,n.toDisplayString(T+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",Ru,n.toDisplayString(m[T%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,j=>(n.openBlock(),n.createBlock(y,n.mergeProps({key:j.id,ref_for:!0},j,{row:_}),null,16,["row"]))),128)),u.value?(n.openBlock(),n.createBlock(E,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),c.value&&(p.value||g.value.length>1)&&!f.value?(n.openBlock(),n.createBlock(E,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:j=>v(T)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!f.value&&r.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":d.value}),class:"j-input-rows-actions"},[r.value?(n.openBlock(),n.createBlock(B,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:k},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),ll=te(n.defineComponent({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"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:()=>[]}},setup(e){const t=e,o=Kt(),{t:i}=Pe(),a=n.computed(()=>t.formConfig?.gutter||16),l=n.computed(()=>t.formConfig?.span||24),r=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),d=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),c=n.ref(!1),f=()=>{c.value=!0};return fa({...o,isAutoWindow:d,gutter:a,span:l,labelWidth:r}),(u,p)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),b=n.resolveComponent("el-form"),k=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(h,n.mergeProps(u.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:f}),null,16,["type","size","icon"]),n.createVNode(k,{visible:c.value,"onUpdate:visible":p[1]||(p[1]=v=>c.value=v),title:n.unref(i)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(b,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":r.value,size:e.formConfig?.size,onSubmit:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[d.value?(n.openBlock(),n.createBlock(m,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:a.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,v=>(n.openBlock(),n.createBlock(m,n.mergeProps({key:v.id,ref_for:!0},v),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),rl=te(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,i=t,a=n.computed({get(){return o.modelValue},set(r){i("update:modelValue",r)}}),l=r=>{i("change",r)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{a.value=!a.value,l(a.value)},100)}),(r,s)=>{const d=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(d,n.mergeProps(r.$attrs,{modelValue:a.value,"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),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":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,id:e.id,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:l}),n.createSlots({_:2},[r.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"active-action")]),key:"0"}:void 0,r.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"inactive-action")]),key:"1"}:void 0,r.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"active")]),key:"2"}:void 0,r.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"inactive")]),key:"3"}:void 0]),1040,["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","id","tabindex","aria-label","loading","disabled"])}}})),sl=te(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:{}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,i=c=>{o("update:modelValue",c)},a=(c,f)=>{o("tab-click",c,f)},l=c=>{o("tab-change",c)},r=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const u=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(u,n.mergeProps(c.$attrs,{"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":i,onTabClick:a,onTabChange:l,onTabRemove:r,onTabAdd:s,onEdit:d}),{default:n.withCtx(()=>[n.renderSlot(c.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),cl=te(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,i=l=>{o("update:modelValue",l)},a=l=>{o("change",l)};return(l,r)=>{const s=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(s,n.mergeProps(l.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:a,"onUpdate:modelValue":i}),{default:n.withCtx(()=>[n.renderSlot(l.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),Au={class:"j-editor"},dl=te(Ea(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,i=t,a=n.ref(),l=n.ref(),r=n.shallowRef(),s=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=u=>{if(!u)return"";let p=u;return o.apiUrl&&o.token&&(p=p.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),p},f=u=>{if(!u)return"";let p=u;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;p=p.split(h).join("{learun_img_api}"),o.token&&(p=p.split(`token=${o.token}`).join("{learun_img_token}"))}return p};return n.onMounted(()=>{const u={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};u.onChange=h=>{if(d)return;const m=h.getHtml(),g=f(m);i("update:value",g),i("change",{value:g})};const p=Ni.createEditor({selector:a.value,html:c(o.value),config:u,mode:"default"});r.value=p,Ni.createToolbar({editor:p,selector:l.value,mode:"default"})}),n.watch(()=>o.value,u=>{const p=r.value;if(p){const h=p.getHtml(),m=c(u);f(h)!==u&&(d=!0,p.setHtml(m),d=!1)}}),n.watch(()=>o.readonly,u=>{const p=r.value;p&&(u?p.disable():p.enable())}),n.onBeforeUnmount(()=>{const u=r.value;u?.destroy()}),(u,p)=>(n.openBlock(),n.createElementBlock("div",Au,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:l,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:a,class:"j-editor-content",style:n.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-60cd5d0b"]])),Ou={key:0,class:"j-map-loading"},Fu=te(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 i=e,a=o,l=n.ref(!0),r=n.ref();let s=null,d=null,c=null,f=null;const u=async()=>{l.value=!0;try{s=await ta(i.mapKey)}catch(k){console.error("Failed to load Baidu Map:",k),l.value=!1;return}if(d!=null){h(i.lng,i.lat),l.value=!1;return}if(!r.value)return;d=new s.Map(r.value,{enableMapClick:!1});const b=new s.Point(121.480248,31.236276);d.centerAndZoom(b,17),c=new s.Marker(b,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",k=>{p(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=>{p(k.point)}),f.addEventListener("locationError",k=>{alert(k.message)}),d.addControl(f),d.addEventListener("click",k=>{p(k.point)}),d.enableScrollWheelZoom(!0),h(i.lng,i.lat),l.value=!1},p=b=>{new s.Geocoder().getLocation(b,v=>{c.setPosition(b),d.panTo(b),a("update:address",v.address),a("update:lng",b.lng),a("update:lat",b.lat),a("change",{value:{address:v.address,lng:b.lng,lat:b.lat}})})},h=(b,k)=>{if(b&&k&&s){const v=new s.Point(b,k);c&&c.setPosition(v),d&&d.panTo(v)}};let m=null;return t({setPoint:h,querySearchAsync:(b,k)=>{!d||!s||(m||(m=new s.LocalSearch(d,{onSearchComplete:v=>{const w=[];if(v){const C=v.getCurrentNumPois();for(let S=0;S<C;S++)w.push(v.getPoi(S))}k(w)}})),m.search(b))}}),n.onMounted(()=>{u()}),(b,k)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[l.value?(n.openBlock(),n.createElementBlock("div",Ou,[n.createVNode(Nt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"j-map-container",ref_key:"mapRef",ref:r},null,512)],4))}})),Iu=/^class[ {]/;function zu(e){return Iu.test(e.toString())}function Po(e){return Array.isArray(e)}function Ro(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zn(...e){e.length===1&&Po(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Du=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Hu=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Wu=/\/\*([^*]*)\*\//m;function Uu(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(zu(e)?Du:Hu);if(!t)return[];const o=t[1]||t[2];return o&&o.split(",").map(i=>{const a=i.match(Wu);return(a&&a[1]||i).trim()})||[]}function ul(e,t){const o=t||{get:function(w,C){if(i.push(w),C===!1)return null;throw s(`No provider for "${w}"!`)}},i=[],a=this._providers=Object.create(o._providers||null),l=this._instances=Object.create(null),r=l.injector=this,s=function(w){const C=i.join(" -> ");return i.length=0,new Error(C?`${w} (Resolving: ${C})`:w)};function d(w,C){if(!a[w]&&w.includes(".")){const S=w.split(".");let y=d(S.shift());for(;S.length;)y=y[S.shift()];return y}if(Ro(l,w))return l[w];if(Ro(a,w)){if(i.indexOf(w)!==-1)throw i.push(w),s("Cannot resolve circular dependency!");return i.push(w),l[w]=a[w][0](a[w][1]),i.pop(),l[w]}return o.get(w,C)}function c(w,C){if(typeof C>"u"&&(C={}),typeof w!="function")if(Po(w))w=zn(w.slice());else throw s(`Cannot invoke "${w}". Expected a function!`);const y=(w.$inject||Uu(w)).map(E=>Ro(C,E)?C[E]:d(E));return{fn:w,dependencies:y}}function f(w){const{fn:C,dependencies:S}=c(w),y=Function.prototype.bind.call(C,null,...S);return new y}function u(w,C,S){const{fn:y,dependencies:E}=c(w,S);return y.apply(C,E)}function p(w){return zn(C=>w.get(C))}function h(w,C){if(C&&C.length){const S=Object.create(null),y=Object.create(null),E=[],B=[],_=[];let T,j,D,A;for(let R in a)T=a[R],C.indexOf(R)!==-1&&(T[2]==="private"?(j=E.indexOf(T[3]),j===-1?(D=T[3].createChild([],C),A=p(D),E.push(T[3]),B.push(D),_.push(A),S[R]=[A,R,"private",D]):S[R]=[_[j],R,"private",B[j]]):S[R]=[T[2],T[1]],y[R]=!0),(T[2]==="factory"||T[2]==="type")&&T[1].$scope&&C.forEach(V=>{T[1].$scope.indexOf(V)!==-1&&(S[R]=[T[2],T[1]],y[V]=!0)});C.forEach(R=>{if(!y[R])throw new Error('No provider for "'+R+'". Cannot use provider from the parent!')}),w.unshift(S)}return new ul(w,r)}const m={factory:u,type:f,value:function(w){return w}};function g(w,C){const S=w.__init__||[];return function(){S.forEach(y=>{typeof y=="string"?C.get(y):C.invoke(y)})}}function b(w){const C=w.__exports__;if(C){const S=w.__modules__,y=Object.keys(w).reduce((j,D)=>(D!=="__exports__"&&D!=="__modules__"&&D!=="__init__"&&D!=="__depends__"&&(j[D]=w[D]),j),Object.create(null)),E=(S||[]).concat(y),B=h(E),_=zn(function(j){return B.get(j)});C.forEach(function(j){a[j]=[_,j,"private",B]});const T=(w.__init__||[]).slice();return T.unshift(function(){B.init()}),w=Object.assign({},w,{__init__:T}),g(w,B)}return Object.keys(w).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const y=w[S];if(y[2]==="private"){a[S]=y;return}const E=y[0],B=y[1];a[S]=[m[E],Ju(E,B),E]}),g(w,r)}function k(w,C){return w.indexOf(C)!==-1||(w=(C.__depends__||[]).reduce(k,w),w.indexOf(C)!==-1)?w:w.concat(C)}function v(w){const C=w.reduce(k,[]).map(b);let S=!1;return function(){S||(S=!0,C.forEach(y=>y()))}}this.get=d,this.invoke=u,this.instantiate=f,this.createChild=h,this.init=v(e)}function Ju(e,t){return e!=="value"&&Po(t)&&(t=zn(t.slice())),t}function Mt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var Yu=1e3;function at(e,t){var o=this;t=t||Yu,e.on(["render.shape","render.connection"],t,function(i,a){var l=i.type,r=a.element,s=a.gfx,d=a.attrs;if(o.canRender(r))return l==="render.shape"?o.drawShape(s,r,d):o.drawConnection(s,r,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,a){if(o.canRender(a))return i.type==="render.getShapePath"?o.getShapePath(a):o.getConnectionPath(a)})}at.prototype.canRender=function(e){},at.prototype.drawShape=function(e,t){},at.prototype.drawConnection=function(e,t){},at.prototype.getShapePath=function(e){},at.prototype.getConnectionPath=function(e){};const Dn=Object.prototype.toString,qu=Object.prototype.hasOwnProperty;function Ao(e){return e===void 0}function Zt(e){return e!==void 0}function Oo(e){return e==null}function Ne(e){return Dn.call(e)==="[object Array]"}function ht(e){return Dn.call(e)==="[object Object]"}function We(e){return Dn.call(e)==="[object Number]"}function mt(e){const t=Dn.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Gu(e){if(!Ne(e))throw new Error("must supply array")}function Fo(e,t){return!Oo(e)&&qu.call(e,t)}function gt(e,t){const o=zo(t);let i;return Z(e,function(a,l){if(o(a,l))return i=a,!1}),i}function Qt(e,t){const o=zo(t);let i=[];return Z(e,function(a,l){o(a,l)&&i.push(a)}),i}function Z(e,t){let o,i;if(Ao(e))return;const a=Ne(e)?tf:ef;for(let l in e)if(Fo(e,l)&&(o=e[l],i=t(o,a(l)),i===!1))return o}function Ku(e,t){if(Ao(e))return[];Gu(e);const o=zo(t);return e.filter(function(i,a){return!o(i,a)})}function en(e,t,o){return Z(e,function(i,a){o=t(o,i,a)}),o}function fl(e,t){return!!en(e,function(o,i,a){return o&&t(i,a)},!0)}function Xu(e,t){return!!gt(e,t)}function yt(e,t){let o=[];return Z(e,function(i,a){o.push(t(i,a))}),o}function Zu(e){return yt(e,t=>t)}function pl(e,t,o={}){return t=Io(t),Z(e,function(i){let a=t(i)||"_",l=o[a];l||(l=o[a]=[]),l.push(i)}),o}function Qu(e,...t){e=Io(e);let o={};return Z(t,a=>pl(a,e,o)),yt(o,function(a,l){return a[0]})}function hl(e,t){t=Io(t);let o=[];return Z(e,function(i,a){let l=t(i,a),r={d:l,v:i};for(var s=0;s<o.length;s++){let{d}=o[s];if(l<d){o.splice(s,0,r);return}}o.push(r)}),yt(o,i=>i.v)}function Io(e){return mt(e)?e:t=>t[e]}function zo(e){return mt(e)?e:t=>t===e}function ef(e){return e}function tf(e){return Number(e)}function nf(e,t){let o,i,a,l;function r(u){let p=Date.now(),h=u?0:l+t-p;if(h>0)return s(h);e.apply(a,i),d()}function s(u){o=setTimeout(r,u)}function d(){o&&clearTimeout(o),o=l=i=a=void 0}function c(){o&&r(!0),d()}function f(...u){l=Date.now(),i=u,a=this,o||s(t)}return f.flush=c,f.cancel=d,f}function Do(e,t){return e.bind(t)}function ie(e,...t){return Object.assign(e,...t)}function Ho(e,t){let o={},i=Object(e);return Z(t,function(a){a in i&&(o[a]=e[a])}),o}function of(e,t){let o={},i=Object(e);return Z(i,function(a,l){t.indexOf(l)===-1&&(o[l]=a)}),o}function af(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function lf(e,t){return t.appendChild(af(e,t))}function Ee(e,t){return lf(t,e),e}var Wo=2,ml={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Wo,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Wo,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function rf(e,t){return ml[t]?e.style[t]:e.getAttributeNS(null,t)}function gl(e,t,o){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=ml[i];a?(a===Wo&&typeof o=="number"&&(o=String(o)+"px"),e.style[i]=o):e.setAttributeNS(null,t,o)}function sf(e,t){var o=Object.keys(t),i,a;for(i=0,a;a=o[i];i++)gl(e,a,t[a])}function ce(e,t,o){if(typeof t=="string")if(o!==void 0)gl(e,t,o);else return rf(e,t);else sf(e,t);return e}const cf=Object.prototype.toString;function Ge(e){return new bt(e)}function bt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}bt.prototype.add=function(e){return this.list.add(e),this},bt.prototype.remove=function(e){return cf.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},bt.prototype.removeMatching=function(e){const t=this.array();for(let o=0;o<t.length;o++)e.test(t[o])&&this.remove(t[o]);return this},bt.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},bt.prototype.array=function(){return Array.from(this.list)},bt.prototype.has=bt.prototype.contains=function(e){return this.list.contains(e)};function yl(e){return e.cloneNode(!0)}var Uo={svg:"http://www.w3.org/2000/svg"},bl='<svg xmlns="'+Uo.svg+'"';function df(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Uo.svg)===-1&&(e=bl+e.substring(4)):(e=bl+">"+e+"</svg>",t=!0);var o=uf(e);if(!t)return o;for(var i=document.createDocumentFragment(),a=o.firstChild;a.firstChild;)i.appendChild(a.firstChild);return i}function uf(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Se(e,t){var o;return e=e.trim(),e.charAt(0)==="<"?(o=df(e).firstChild,o=document.importNode(o,!0)):o=document.createElementNS(Uo.svg,e),t&&ce(o,t),o}var Jo=null;function wl(){return Jo===null&&(Jo=Se("svg")),Jo}function vl(e,t){var o,i,a=Object.keys(t);for(o=0;i=a[o];o++)e[i]=t[i];return e}function ff(e,t,o,i,a,l){var r=wl().createSVGMatrix();switch(arguments.length){case 0:return r;case 1:return vl(r,e);case 6:return vl(r,{a:e,b:t,c:o,d:i,e:a,f:l})}}function pf(e){return wl().createSVGTransform()}function Lt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function hf(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function mf(e,t){var o,i;for(e.clear(),o=0;i=t[o];o++)e.appendItem(hf(e,i))}function Yo(e,t){var o=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),mf(o,t)),o.consolidate()}function Pt(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function gf(e){return["M",e.x,e.y]}function qo(e){return["L",e.x,e.y]}function yf(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function bf(e,t){const o=e.length,i=[gf(e[0])];for(let a=1;a<o;a++){const l=e[a-1],r=e[a],s=e[a+1];if(!s||!t){i.push(qo(r));continue}const d=Math.min(t,Go(r.x-l.x,r.y-l.y),Go(s.x-r.x,s.y-r.y));if(!d){i.push(qo(r));continue}const c=Hn(r,l,d),f=Hn(r,l,d*.5),u=Hn(r,s,d),p=Hn(r,s,d*.5);i.push(qo(c)),i.push(yf(f,p,u))}return i}function Hn(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Go(i,a),r=o/l;return{x:e.x+i*r,y:e.y+a*r}}function Go(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,o){We(t)&&(o=t,t=null),t||(t={});const i=Se("path",t);return We(o)&&(i.dataset.cornerRadius=String(o)),Cl(i,e)}function Cl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return ce(e,{d:Pt(bf(t,o))}),e}function wf(e){return Qt(e,function(t){return!gt(e,function(o){return o!==t&&kl(t,o)})})}function kl(e,t){if(t){if(e===t)return t;if(e.parent)return kl(e.parent,t)}}function xl(e,t,o){o=o||0,Ne(e)||(e=[e]),Z(e,function(i,a){var l=t(i,a,o);Ne(l)&&l.length&&xl(l,t,o+1)})}function vf(e,t,o){Ao(t)&&(t=!0),ht(t)&&(o=t,t=!0),o=o||{};var i=hn(o.allShapes),a=hn(o.allConnections),l=hn(o.enclosedElements),r=hn(o.enclosedConnections),s=hn(o.topLevel,t&&pl(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),i[f.source.id]&&i[f.target.id]&&(r[f.id]=l[f.id]=f),a[f.id]=f}function c(f){if(l[f.id]=f,f.waypoints)r[f.id]=a[f.id]=f;else return i[f.id]=f,Z(f.incoming,d),Z(f.outgoing,d),f.children}return xl(e,c),{allShapes:i,allConnections:a,topLevel:s,enclosedConnections:r,enclosedElements:l}}function Wn(e,t){t=!!t,Ne(e)||(e=[e]);var o,i,a,l;return Z(e,function(r){var s=r;r.waypoints&&!t&&(s=Wn(r.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,u=s.width||0;(d<o||o===void 0)&&(o=d),(c<i||i===void 0)&&(i=c),(d+u>a||a===void 0)&&(a=d+u),(c+f>l||l===void 0)&&(l=c+f)}),{x:o,y:i,height:l-i,width:a-o}}function Cf(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Sl(e){return!!(e&&e.isFrame)}function hn(e,t){return ie({},e||{},t||{})}var kf=1;function wt(e,t){at.call(this,e,kf),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Mt(wt,at),wt.prototype.canRender=function(){return!0},wt.prototype.drawShape=function(t,o,i){var a=Se("rect");return ce(a,{x:0,y:0,width:o.width||0,height:o.height||0}),Sl(o)?ce(a,ie({},this.FRAME_STYLE,i||{})):ce(a,ie({},this.SHAPE_STYLE,i||{})),Ee(t,a),a},wt.prototype.drawConnection=function(t,o,i){var a=Ko(o.waypoints,ie({},this.CONNECTION_STYLE,i||{}));return Ee(t,a),a},wt.prototype.getShapePath=function(t){var o=t.x,i=t.y,a=t.width,l=t.height,r=[["M",o,i],["l",a,0],["l",0,l],["l",-a,0],["z"]];return Pt(r)},wt.prototype.getConnectionPath=function(t){var o=t.waypoints,i,a,l=[];for(i=0;a=o[i];i++)a=a.original||a,l.push([i===0?"M":"L",a.x,a.y]);return Pt(l)},wt.$inject=["eventBus","styles"];function xf(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(o,i,a){var l=this.style(i,a);return ie(l,{class:o})},this.style=function(o,i){!Ne(o)&&!i&&(i=o,o=[]);var a=en(o,function(l,r){return ie(l,e[r]||{})},{});return i?ie(a,i):a},this.computeStyle=function(o,i,a){return Ne(i)||(a=i,i=[]),t.style(i||[],ie({},a,o||{}))}}const Sf={__init__:["defaultRenderer"],defaultRenderer:["type",wt],styles:["type",xf]};function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ef(e,t){return t.forEach(function(o){o&&typeof o!="string"&&!Array.isArray(o)&&Object.keys(o).forEach(function(i){if(i!=="default"&&!(i in e)){var a=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:function(){return o[i]}})}})}),Object.freeze(e)}function Bl(e,...t){const o=e.style;return Z(t,function(i){i&&Z(i,function(a,l){o[l]=a})}),e}function _f(e,t,o){return arguments.length==2?e.getAttribute(t):(e.setAttribute(t,o),e)}const jf=Object.prototype.toString;function Vf(e){return new vt(e)}function vt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}vt.prototype.add=function(e){return this.list.add(e),this},vt.prototype.remove=function(e){return jf.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},vt.prototype.removeMatching=function(e){const t=this.array();for(let o=0;o<t.length;o++)e.test(t[o])&&this.remove(t[o]);return this},vt.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},vt.prototype.array=function(){return Array.from(this.list)},vt.prototype.has=vt.prototype.contains=function(e){return this.list.contains(e)};function Tf(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Xo(e,t,o){var i=o?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function Nf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Un={},El;function $f(){if(El)return Un;El=1;var e,t,o;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",o=e!=="addEventListener"?"on":""}return Un.bind=function(a,l,r,s){return e||i(),a[e](o+l,r,s||!1),r},Un.unbind=function(a,l,r,s){return t||i(),a[t](o+l,r,s||!1),r},Un}var _l=$f(),Mf=Nf(_l),ke=Ef({__proto__:null,default:Mf},[_l]),jl=["focus","blur"];function Lf(e,t,o,i,a){return jl.indexOf(o)!==-1&&(a=!0),ke.bind(e,o,function(l){var r=l.target||l.srcElement;l.delegateTarget=Xo(r,t,!0),l.delegateTarget&&i.call(e,l)},a)}function Pf(e,t,o,i){return jl.indexOf(t)!==-1&&(i=!0),ke.unbind(e,t,o,i)}var Vl={bind:Lf,unbind:Pf};function mn(e,t){return t=t||document,t.querySelector(e)}function Rf(e,t){return t=t||document,t.querySelectorAll(e)}function gn(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function lt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var i=e.indexOf(t);if(i!==-1){if(i===o)return;if(o!==-1)e.splice(i,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Zo(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Af(e,t,o,i){if(!e||!t||!o)return!1;var a=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),l=Qo(e,t);return Math.abs(a/l)<=i}var Of=2;function Tl(e,t){var o=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[a,l]of Object.entries(i))if(Ff(a,o))return l;return!1}function Ff(e,t){const o=t[0];return fl(t,function(i){return Math.abs(o[e]-i[e])<=Of})}function Nl(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}var If=/,?([a-z]),?/gi,$l=parseFloat,je=Math,Ct=je.PI,Qe=je.min,et=je.max,Ml=je.pow,kt=je.abs,zf=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Df=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ll=Array.isArray||function(e){return e instanceof Array};function Hf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wf(e,t){for(var o=0,i=e.length;o<i;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function Uf(e){function t(){var o=Array.prototype.slice.call(arguments,0),i=o.join("␀"),a=t.cache=t.cache||{},l=t.count=t.count||[];return Hf(a,i)?(Wf(l,i),a[i]):(l.length>=1e3&&delete a[l.shift()],l.push(i),a[i]=e(...arguments),a[i])}return t}function Jf(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(zf,function(i,a,l){var r=[],s=a.toLowerCase();for(l.replace(Df,function(d,c){c&&r.push(+c)}),s=="m"&&r.length>2&&(o.push([a,...r.splice(0,2)]),s="l",a=a=="m"?"l":"L");r.length>=t[s]&&(o.push([a,...r.splice(0,t[s])]),!!t[s]););}),o.toString=ti,o}function Yf(e){for(var t=0,o=e.length;t<o;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function qf(e){for(var t=0,o=e.length;t<o;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function ei(e,t,o,i){return arguments.length===1&&(t=e.y,o=e.width,i=e.height,e=e.x),{x:e,y:t,width:o,height:i,x2:e+o,y2:t+i}}function ti(){return this.join(",").replace(If,"$1")}function Gf(e){for(var t=new Array(e.length),o=0,i=e.length;o<i;o++)for(var a=e[o],l=t[o]=new Array(a.length),r=0,s=a.length;r<s;r++)l[r]=a[r];return t.toString=ti,t}function Pl(e,t,o,i,a,l,r,s,d){var c=1-d,f=Ml(c,3),u=Ml(c,2),p=d*d,h=p*d,m=f*e+u*3*d*o+c*3*d*d*a+h*r,g=f*t+u*3*d*i+c*3*d*d*l+h*s;return{x:Jn(m),y:Jn(g)}}function Rl(e){var t=np(...e);return ei(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function xt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function Kf(e,t){return e=ei(e),t=ei(t),xt(t,e.x,e.y)||xt(t,e.x2,e.y)||xt(t,e.x,e.y2)||xt(t,e.x2,e.y2)||xt(e,t.x,t.y)||xt(e,t.x2,t.y)||xt(e,t.x,t.y2)||xt(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 Al(e,t,o,i,a){var l=-3*t+9*o-9*i+3*a,r=e*l+6*t-12*o+6*i;return e*r-3*t+3*o}function Ol(e,t,o,i,a,l,r,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,m=0;m<f;m++){var g=c*u[m]+c,b=Al(g,e,o,a,r),k=Al(g,t,i,l,s),v=b*b+k*k;h+=p[m]*je.sqrt(v)}return c*h}function Xf(e,t,o,i,a,l,r,s){if(!(et(e,o)<Qe(a,r)||Qe(e,o)>et(a,r)||et(t,i)<Qe(l,s)||Qe(t,i)>et(l,s))){var d=(e*i-t*o)*(a-r)-(e-o)*(a*s-l*r),c=(e*i-t*o)*(l-s)-(t-i)*(a*s-l*r),f=(e-o)*(l-s)-(t-i)*(a-r);if(f){var u=Jn(d/f),p=Jn(c/f),h=+u.toFixed(2),m=+p.toFixed(2);if(!(h<+Qe(e,o).toFixed(2)||h>+et(e,o).toFixed(2)||h<+Qe(a,r).toFixed(2)||h>+et(a,r).toFixed(2)||m<+Qe(t,i).toFixed(2)||m>+et(t,i).toFixed(2)||m<+Qe(l,s).toFixed(2)||m>+et(l,s).toFixed(2)))return{x:u,y:p}}}}function Jn(e){return Math.round(e*1e11)/1e11}function Zf(e,t,o){var i=Rl(e),a=Rl(t);if(!Kf(i,a))return[];var l=Ol(...e),r=Ol(...t),s=Fl(e)?1:~~(l/5)||1,d=Fl(t)?1:~~(r/5)||1,c=new Array(s+1),f=new Array(d+1),u={},p=[],h,m;for(h=0;h<s+1;h++){var g=Pl(...e,h/s);c[h]={x:g.x,y:g.y,t:h/s}}for(h=0;h<d+1;h++)g=Pl(...t,h/d),f[h]={x:g.x,y:g.y,t:h/d};for(h=0;h<s;h++)for(m=0;m<d;m++){var b=c[h],k=c[h+1],v=f[m],w=f[m+1],C=kt(k.x-b.x)<.01?"y":"x",S=kt(w.x-v.x)<.01?"y":"x",y=Xf(b.x,b.y,k.x,k.y,v.x,v.y,w.x,w.y),E;if(y){if(E=y.x.toFixed(9)+"#"+y.y.toFixed(9),u[E])continue;u[E]=!0;var B=b.t+kt((y[C]-b[C])/(k[C]-b[C]))*(k.t-b.t),_=v.t+kt((y[S]-v[S])/(w[S]-v[S]))*(w.t-v.t);B>=0&&B<=1&&_>=0&&_<=1&&p.push({x:y.x,y:y.y,t1:B,t2:_})}}return p}function Qf(e,t,o){e=Dl(e),t=Dl(t);for(var i,a,l,r,s,d,c,f,u,p,h=[],m=0,g=e.length;m<g;m++){var b=e[m];if(b[0]=="M")i=s=b[1],a=d=b[2];else{b[0]=="C"?(u=[i,a,...b.slice(1)],i=u[6],a=u[7]):(u=[i,a,i,a,s,d,s,d],i=s,a=d);for(var k=0,v=t.length;k<v;k++){var w=t[k];if(w[0]=="M")l=c=w[1],r=f=w[2];else{w[0]=="C"?(p=[l,r,...w.slice(1)],l=p[6],r=p[7]):(p=[l,r,l,r,c,f,c,f],l=c,r=f);var C=Zf(u,p);{for(var S=0,y=C.length;S<y;S++)C[S].segment1=m,C[S].segment2=k,C[S].bez1=u,C[S].bez2=p;h=h.concat(C)}}}}}return h}function ep(e){return Ll(e)&&Ll(e[0])}function tp(e){if(Yf(e))return e;var t=new Array(e.length),o=0,i=0,a=0,l=0,r=0,s;e[0][0]=="M"&&(o=+e[0][1],i=+e[0][2],a=o,l=i,r++,t[0]=["M",o,i]);for(var d,c,f=r,u=e.length;f<u;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]+i;break;case"V":d[1]=+c[1]+i;break;case"H":d[1]=+c[1]+o;break;case"M":a=+c[1]+o,l=+c[2]+i;default:for(var p=1,h=c.length;p<h;p++)d[p]=+c[p]+(p%2?o:i)}else for(var m=0,g=c.length;m<g;m++)d[m]=c[m];switch(s=s.toUpperCase(),d[0]){case"Z":o=+a,i=+l;break;case"H":o=d[1];break;case"V":i=d[1];break;case"M":a=d[d.length-2],l=d[d.length-1];default:o=d[d.length-2],i=d[d.length-1]}}return t.toString=ti,t}function Fl(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Yn(e,t,o,i){return[e,t,o,i,o,i]}function Il(e,t,o,i,a,l){var r=.3333333333333333,s=2/3;return[r*e+s*o,r*t+s*i,r*a+s*o,r*l+s*i,a,l]}function zl(e,t,o,i,a,l,r,s,d,c){var f=Ct*120/180,u=Ct/180*(+a||0),p=[],h,m=Uf(function(se,xe,Ve){var H=se*je.cos(Ve)-xe*je.sin(Ve),X=se*je.sin(Ve)+xe*je.cos(Ve);return{x:H,y:X}});if(c)E=c[0],B=c[1],S=c[2],y=c[3];else{h=m(e,t,-u),e=h.x,t=h.y,h=m(s,d,-u),s=h.x,d=h.y;var g=(e-s)/2,b=(t-d)/2,k=g*g/(o*o)+b*b/(i*i);k>1&&(k=je.sqrt(k),o=k*o,i=k*i);var v=o*o,w=i*i,C=(l==r?-1:1)*je.sqrt(kt((v*w-v*b*b-w*g*g)/(v*b*b+w*g*g))),S=C*o*b/i+(e+s)/2,y=C*-i*g/o+(t+d)/2,E=je.asin(((t-y)/i).toFixed(9)),B=je.asin(((d-y)/i).toFixed(9));E=e<S?Ct-E:E,B=s<S?Ct-B:B,E<0&&(E=Ct*2+E),B<0&&(B=Ct*2+B),r&&E>B&&(E=E-Ct*2),!r&&B>E&&(B=B-Ct*2)}var _=B-E;if(kt(_)>f){var T=B,j=s,D=d;B=E+f*(r&&B>E?1:-1),s=S+o*je.cos(B),d=y+i*je.sin(B),p=zl(s,d,o,i,a,0,r,j,D,[B,T,S,y])}_=B-E;var A=je.cos(E),R=je.sin(E),V=je.cos(B),x=je.sin(B),L=je.tan(_/4),P=4/3*o*L,G=4/3*i*L,K=[e,t],ne=[e+P*R,t-G*A],pe=[s+P*x,d-G*V],fe=[s,d];if(ne[0]=2*K[0]-ne[0],ne[1]=2*K[1]-ne[1],c)return[ne,pe,fe].concat(p);p=[ne,pe,fe].concat(p).join().split(",");for(var Y=[],he=0,ae=p.length;he<ae;he++)Y[he]=he%2?m(p[he-1],p[he],u).y:m(p[he],p[he+1],u).x;return Y}function np(e,t,o,i,a,l,r,s){for(var d=[],c=[[],[]],f,u,p,h,m,g,b,k,v=0;v<2;++v){if(v==0?(u=6*e-12*o+6*a,f=-3*e+9*o-9*a+3*r,p=3*o-3*e):(u=6*t-12*i+6*l,f=-3*t+9*i-9*l+3*s,p=3*i-3*t),kt(f)<1e-12){if(kt(u)<1e-12)continue;h=-p/u,0<h&&h<1&&d.push(h);continue}b=u*u-4*p*f,k=je.sqrt(b),!(b<0)&&(m=(-u+k)/(2*f),0<m&&m<1&&d.push(m),g=(-u-k)/(2*f),0<g&&g<1&&d.push(g))}for(var w=d.length,C=w,S;w--;)h=d[w],S=1-h,c[0][w]=S*S*S*e+3*S*S*h*o+3*S*h*h*a+h*h*h*r,c[1][w]=S*S*S*t+3*S*S*h*i+3*S*h*h*l+h*h*h*s;return c[0][C]=e,c[1][C]=t,c[0][C+1]=r,c[1][C+1]=s,c[0].length=c[1].length=C+2,{x0:Qe(...c[0]),y0:Qe(...c[1]),x1:et(...c[0]),y1:et(...c[1])}}function Dl(e){if(ep(e)||(e=Jf(e)),qf(e))return e;for(var t=Gf(tp(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,h,m){var g,b;if(!p)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(p[0]in{T:1,Q:1})&&(h.qx=h.qy=null),p[0]){case"M":h.X=p[1],h.Y=p[2];break;case"A":p=["C",...zl(h.x,h.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(g=h.x*2-h.bx,b=h.y*2-h.by):(g=h.x,b=h.y),p=["C",g,b,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),p=["C",...Il(h.x,h.y,h.qx,h.qy,p[1],p[2])];break;case"Q":h.qx=p[1],h.qy=p[2],p=["C",...Il(h.x,h.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Yn(h.x,h.y,p[1],p[2])];break;case"H":p=["C",...Yn(h.x,h.y,p[1],h.y)];break;case"V":p=["C",...Yn(h.x,h.y,h.x,p[1])];break;case"Z":p=["C",...Yn(h.x,h.y,h.X,h.Y)];break}return p},a=function(p,h){if(p[h].length>7){p[h].shift();for(var m=p[h];m.length;)l[h]="A",p.splice(h++,0,["C",...m.splice(0,6)]);p.splice(h,1),c=t.length}},l=[],r="",s="",d=0,c=t.length;d<c;d++){t[d]&&(r=t[d][0]),r!="C"&&(l[d]=r,d&&(s=l[d-1])),t[d]=i(t[d],o,s),l[d]!="A"&&r=="C"&&(l[d]="C"),a(t,d);var f=t[d],u=f.length;o.x=f[u-2],o.y=f[u-1],o.bx=$l(f[u-4])||o.x,o.by=$l(f[u-3])||o.y}return t}function rt(e){return ht(e)&&Fo(e,"waypoints")}function Hl(e){return ht(e)&&Fo(e,"labelTarget")}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function op(e){return yn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function ip(e){for(var t=e.waypoints,o=t.reduce(function(c,f,u){var p=t[u-1];if(p){var h=c[c.length-1],m=h&&h.endLength||0,g=rp(p,f);c.push({start:p,end:f,startLength:m,endLength:m+g,length:g})}return c},[]),i=o.reduce(function(c,f){return c+f.length},0),a=i/2,l=0,r=o[l];r.endLength<a;)r=o[++l];var s=(a-r.startLength)/r.length,d={x:r.start.x+(r.end.x-r.start.x)*s,y:r.start.y+(r.end.y-r.start.y)*s};return d}function tt(e){return rt(e)?ip(e):op(e)}function bn(e,t,o){o=o||0,ht(o)||(o={x:o,y:o});var i=qn(e),a=qn(t),l=i.bottom+o.y<=a.top,r=i.left-o.x>=a.right,s=i.top-o.y>=a.bottom,d=i.right+o.x<=a.left,c=l?"top":s?"bottom":null,f=d?"left":r?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function ap(e,t,o){var i=lp(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?yn(i[0]):i.length>1?(i=hl(i,function(a){var l=Math.floor(a.t2*100)||1;return l=100-l,l=(l<10?"0":"")+l,a.segment2+"#"+l}),yn(i[o?0:i.length-1])):null}function lp(e,t){return Qf(e,t)}function rp(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gn(e,t){return Math.round(e*t)/t}function Wl(e){return We(e)?e+"px":e}function sp(e){for(;e.parent;)e=e.parent;return e}function cp(e){e=ie({},{width:"100%",height:"100%"},e);const t=e.container||document.body,o=document.createElement("div");return o.setAttribute("class","djs-container djs-parent"),Bl(o,{position:"relative",overflow:"hidden",width:Wl(e.width),height:Wl(e.height)}),t.appendChild(o),o}function Ul(e,t,o){const i=Se("g");Ge(i).add(t);const a=o!==void 0?o:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[a]||null),i}const dp="base",Jl=0,up=1,fp={shape:["x","y","width","height"],connection:["waypoints"]};function ee(e,t,o,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=o,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}ee.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ee.prototype._init=function(e){const t=this._eventBus,o=this._container=cp(e),i=this._svg=Se("svg");ce(i,{width:"100%",height:"100%"}),_f(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,l=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),Ee(o,i);const a=this._viewport=Ul(i,"viewport");e.deferUpdate&&(this._viewboxChanged=nf(Do(this._viewboxChanged,this),300)),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:a})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},ee.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},ee.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ee.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const o=Cf(t);o==="root"?this.removeRootElement(t):this._removeElement(t,o)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ee.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ee.prototype.restoreFocus=function(){document.activeElement===document.body&&this.focus()},ee.prototype.isFocused=function(){return this._focused},ee.prototype.getDefaultLayer=function(){return this.getLayer(dp,Jl)},ee.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let o=this._layers[e];if(o||(o=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&o.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return o.group},ee.prototype._getChildIndex=function(e){return en(this._layers,function(t,o){return o.visible&&e>=o.index&&t++,t},0)},ee.prototype._createLayer=function(e,t){typeof t>"u"&&(t=up);const o=this._getChildIndex(t);return{group:Ul(this._viewport,"layer-"+e,o),index:t,visible:!0}},ee.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const o=this._viewport,i=t.group,a=t.index;if(t.visible)return i;const l=this._getChildIndex(a);return o.insertBefore(i,o.childNodes[l]||null),t.visible=!0,i},ee.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const o=t.group;return t.visible&&(Lt(o),t.visible=!1),o},ee.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Lt(t.group))},ee.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ee.prototype.findRoot=function(e){return typeof e=="string"&&(e=this._elementRegistry.get(e)),e?(this._findPlaneForRoot(sp(e))||{}).rootElement:void 0},ee.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ee.prototype._findPlaneForRoot=function(e){return gt(this._planes,function(t){return t.rootElement===e})},ee.prototype.getContainer=function(){return this._container},ee.prototype._updateMarker=function(e,t,o){let i;e.id||(e=this._elementRegistry.get(e)),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(Z([i.gfx,i.secondaryGfx],function(a){a&&(o?(e.markers.add(t),Ge(a).add(t)):(e.markers.delete(t),Ge(a).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!o}))},ee.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ee.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ee.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),e.markers?e.markers.has(t):!1},ee.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ee.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ee.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const o=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(o,Jl);return this.hideLayer(o),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ee.prototype.removeRootElement=function(e){if(typeof e=="string"&&(e=this._elementRegistry.get(e)),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(o){return o.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},ee.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},ee.prototype._removeRoot=function(e){const t=this._elementRegistry,o=this._eventBus;o.fire("root.remove",{element:e}),o.fire("root.removed",{element:e}),t.remove(e)},ee.prototype._addRoot=function(e,t){const o=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),o.add(e,t),i.fire("root.added",{element:e,gfx:t})},ee.prototype._setRoot=function(e,t){const o=this._rootElement;o&&(this._elementRegistry.updateGraphics(o,null,!0),this.hideLayer(o.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},ee.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const o=fp[e];if(!fl(o,function(a){return typeof t[a]<"u"}))throw new Error("must supply { "+o.join(", ")+" } with "+e)},ee.prototype._setParent=function(e,t,o){lt(t.children,e,o),e.parent=t},ee.prototype._addElement=function(e,t,o,i){o=o||this.getRootElement();const a=this._eventBus,l=this._graphicsFactory;this._ensureValid(e,t),a.fire(e+".add",{element:t,parent:o}),this._setParent(t,o,i);const r=l.create(e,t,i);return this._elementRegistry.add(t,r),l.update(e,t,r),a.fire(e+".added",{element:t,gfx:r}),t},ee.prototype.addShape=function(e,t,o){return this._addElement("shape",e,t,o)},ee.prototype.addConnection=function(e,t,o){return this._addElement("connection",e,t,o)},ee.prototype._removeElement=function(e,t){const o=this._elementRegistry,i=this._graphicsFactory,a=this._eventBus;if(e=o.get(e.id||e),!!e)return a.fire(t+".remove",{element:e}),i.remove(e),gn(e.parent&&e.parent.children,e),e.parent=null,a.fire(t+".removed",{element:e}),o.remove(e),e},ee.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ee.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ee.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ee.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ee.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ee.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,o=this.getSize();let i,a,l,r,s,d,c;if(e)this._changeViewbox(function(){s=Math.min(o.width/e.width,o.height/e.height);const f=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Yo(t,f)});else return l=this._rootElement?this.getActiveLayer():null,i=l&&l.getBBox()||{},r=Yo(t),a=r?r.matrix:ff(),s=Gn(a.a,1e3),d=Gn(-a.e||0,1e3),c=Gn(-a.f||0,1e3),e=this._cachedViewbox={x:d?d/s:0,y:c?c/s:0,width:o.width/s,height:o.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:o},e;return e},ee.prototype.scroll=function(e){const t=this._viewport;let o=t.getCTM();return e&&this._changeViewbox(function(){e=ie({dx:0,dy:0},e||{}),o=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(o),Yl(t,o)}),{x:o.e,y:o.f}},ee.prototype.scrollToElement=function(e,t){let o=100;typeof e=="string"&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===e)return;t||(t={}),typeof t=="number"&&(o=t),t={top:t.top||o,right:t.right||o,bottom:t.bottom||o,left:t.left||o};const a=Wn(e),l=qn(a),r=this.viewbox(),s=this.zoom();let d,c;r.y+=t.top/s,r.x+=t.left/s,r.width-=(t.right+t.left)/s,r.height-=(t.bottom+t.top)/s;const f=qn(r);if(!(a.width<r.width&&a.height<r.height))d=a.x-r.x,c=a.y-r.y;else{const p=Math.max(0,l.right-f.right),h=Math.min(0,l.left-f.left),m=Math.max(0,l.bottom-f.bottom),g=Math.min(0,l.top-f.top);d=p||h,c=m||g}this.scroll({dx:-d*s,dy:-c*s})},ee.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let o,i;return this._changeViewbox(function(){typeof t!="object"&&(o=this.viewbox().outer,t={x:o.width/2,y:o.height/2}),i=this._setZoom(e,t)}),Gn(i.a,1e3)};function Yl(e,t){const o="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",o)}ee.prototype._fitViewport=function(e){const t=this.viewbox(),o=t.outer,i=t.inner;let a,l;return i.x>=0&&i.y>=0&&i.x+i.width<=o.width&&i.y+i.height<=o.height&&!e?l={x:0,y:0,width:Math.max(i.width+i.x,o.width),height:Math.max(i.height+i.y,o.height)}:(a=Math.min(1,o.width/i.width,o.height/i.height),l={x:i.x+(e?i.width/2-o.width/a/2:0),y:i.y+(e?i.height/2-o.height/a/2:0),width:o.width/a,height:o.height/a}),this.viewbox(l),this.viewbox(!1).scale},ee.prototype._setZoom=function(e,t){const o=this._svg,i=this._viewport,a=o.createSVGMatrix(),l=o.createSVGPoint();let r,s,d,c,f;d=i.getCTM();const u=d.a;return t?(r=ie(l,t),s=r.matrixTransform(d.inverse()),c=a.translate(s.x,s.y).scale(1/u*e).translate(-s.x,-s.y),f=d.multiply(c)):f=a.scale(e),Yl(this._viewport,f),f},ee.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ee.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let o;e.waypoints?o=this.getGraphics(e).getBBox():o=e;const i=o.x*t.scale-t.x*t.scale,a=o.y*t.scale-t.y*t.scale,l=o.width*t.scale,r=o.height*t.scale;return{x:i,y:a,width:l,height:r}},ee.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var tn="data-element-id";function Ue(e){this._elements={},this._eventBus=e}Ue.$inject=["eventBus"],Ue.prototype.add=function(e,t,o){var i=e.id;this._validateId(i),ce(t,tn,i),o&&ce(o,tn,i),this._elements[i]={element:e,gfx:t,secondaryGfx:o}},Ue.prototype.remove=function(e){var t=this._elements,o=e.id||e,i=o&&t[o];i&&(ce(i.gfx,tn,""),i.secondaryGfx&&ce(i.secondaryGfx,tn,""),delete t[o])},Ue.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var o=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,o,i)},Ue.prototype.updateGraphics=function(e,t,o){var i=e.id||e,a=this._elements[i];return o?a.secondaryGfx=t:a.gfx=t,t&&ce(t,tn,i),t},Ue.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ce(e,tn);var o=this._elements[t];return o&&o.element},Ue.prototype.filter=function(e){var t=[];return this.forEach(function(o,i){e(o,i)&&t.push(o)}),t},Ue.prototype.find=function(e){for(var t=this._elements,o=Object.keys(t),i=0;i<o.length;i++){var a=o[i],l=t[a],r=l.element,s=l.gfx;if(e(r,s))return r}},Ue.prototype.getAll=function(){return this.filter(function(e){return e})},Ue.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(o){var i=t[o],a=i.element,l=i.gfx;return e(a,l)})},Ue.prototype.getGraphics=function(e,t){var o=e.id||e,i=this._elements[o];return i&&(t?i.secondaryGfx:i.gfx)},Ue.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function pp(e,t,o,i){var a=o.inverse;return Object.defineProperty(e,"remove",{value:function(l){var r=this.indexOf(l);return r!==-1&&(this.splice(r,1),t.unset(l,a,i)),l}}),Object.defineProperty(e,"contains",{value:function(l){return this.indexOf(l)!==-1}}),Object.defineProperty(e,"add",{value:function(l,r){var s=this.indexOf(l);if(typeof r>"u"){if(s!==-1)return;r=this.length}s!==-1&&this.splice(s,1),this.splice(r,0,l),s===-1&&t.set(l,a,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function hp(e){return e.__refs_collection===!0}function mp(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ql(e,t,o){var i=pp(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(a){e.set(a,t.inverse,o)})}function gp(e,t,o){var i=t.inverse,a=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return a},set:function(l){if(l!==a){var r=a;a=null,r&&e.unset(r,i,o),a=l,e.set(a,i,o)}}})}function qe(e,t){if(!(this instanceof qe))return new qe(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}qe.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?ql(this,t,e):gp(this,t,e)},qe.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return hp(o)||ql(this,t,e),o},qe.prototype.ensureBound=function(e,t){mp(e,t)||this.bind(e,t)},qe.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},qe.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var ni=new qe({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gl=new qe({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Kl=new qe({name:"attachers",collection:!0},{name:"host"}),Xl=new qe({name:"outgoing",collection:!0},{name:"source"}),Zl=new qe({name:"incoming",collection:!0},{name:"target"});function nn(){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)}}),ni.bind(this,"parent"),Gl.bind(this,"labels"),Xl.bind(this,"outgoing"),Zl.bind(this,"incoming")}function wn(){nn.call(this),ni.bind(this,"children"),Kl.bind(this,"host"),Kl.bind(this,"attachers")}Mt(wn,nn);function Ql(){nn.call(this),ni.bind(this,"children")}Mt(Ql,wn);function er(){wn.call(this),Gl.bind(this,"labelTarget")}Mt(er,wn);function tr(){nn.call(this),Xl.bind(this,"source"),Zl.bind(this,"target")}Mt(tr,nn);var yp={connection:tr,shape:wn,label:er,root:Ql};function bp(e,t){var o=yp[e];if(!o)throw new Error("unknown type: <"+e+">");return ie(new o,t)}function wp(e){return e instanceof nn}function st(){this._uid=12}st.prototype.createRoot=function(e){return this.create("root",e)},st.prototype.createLabel=function(e){return this.create("label",e)},st.prototype.createShape=function(e){return this.create("shape",e)},st.prototype.createConnection=function(e){return this.create("connection",e)},st.prototype.create=function(e,t){return t=ie({},t||{}),t.id||(t.id=e+"_"+this._uid++),bp(e,t)};var Kn="__fn",nr=1e3,vp=Array.prototype.slice;function ze(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ze.prototype.on=function(e,t,o,i){if(e=Ne(e)?e:[e],mt(t)&&(i=o,o=t,t=nr),!We(t))throw new Error("priority must be a number");var a=o;i&&(a=Do(o,i),a[Kn]=o[Kn]||o);var l=this;e.forEach(function(r){l._addListener(r,{priority:t,callback:a,next:null})})},ze.prototype.once=function(e,t,o,i){var a=this;if(mt(t)&&(i=o,o=t,t=nr),!We(t))throw new Error("priority must be a number");function l(){l.__isTomb=!0;var r=o.apply(i,arguments);return a.off(e,l),r}l[Kn]=o,this.on(e,t,l)},ze.prototype.off=function(e,t){e=Ne(e)?e:[e];var o=this;e.forEach(function(i){o._removeListener(i,t)})},ze.prototype.createEvent=function(e){var t=new vn;return t.init(e),t},ze.prototype.fire=function(e,t){var o,i,a,l;if(l=vp.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof vn?o=t:o=this.createEvent(t),l[0]=o;var r=o.type;e!==r&&(o.type=e);try{a=this._invokeListeners(o,l,i)}finally{e!==r&&(o.type=r)}return a===void 0&&o.defaultPrevented&&(a=!1),a}},ze.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ze.prototype._destroy=function(){this._listeners={}},ze.prototype._invokeListeners=function(e,t,o){for(var i;o&&!e.cancelBubble;)i=this._invokeListener(e,t,o),o=o.next;return i},ze.prototype._invokeListener=function(e,t,o){var i;if(o.callback.__isTomb)return i;try{i=Cp(o.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(a){if(!this.handleError(a))throw console.error("unhandled error in event listener",a),a}return i},ze.prototype._addListener=function(e,t){var o=this._getListeners(e),i;if(!o){this._setListeners(e,t);return}for(;o;){if(o.priority<t.priority){t.next=o,i?i.next=t:this._setListeners(e,t);return}i=o,o=o.next}i.next=t},ze.prototype._getListeners=function(e){return this._listeners[e]},ze.prototype._setListeners=function(e,t){this._listeners[e]=t},ze.prototype._removeListener=function(e,t){var o=this._getListeners(e),i,a,l;if(!t){this._setListeners(e,null);return}for(;o;)i=o.next,l=o.callback,(l===t||l[Kn]===t)&&(a?a.next=i:this._setListeners(e,i)),a=o,o=i};function vn(){}vn.prototype.stopPropagation=function(){this.cancelBubble=!0},vn.prototype.preventDefault=function(){this.defaultPrevented=!0},vn.prototype.init=function(e){ie(this,e||{})};function Cp(e,t){return e.apply(null,t)}function Xn(e){return e.childNodes[0]}function kp(e){return e.parentNode.childNodes[1]}function Zn(e,t,o){var i=pf();i.setTranslate(t,o),Yo(e,i)}function Je(e,t){this._eventBus=e,this._elementRegistry=t}Je.$inject=["eventBus","elementRegistry"],Je.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),o;return e.parent?(o=kp(t),o||(o=Se("g"),Ge(o).add("djs-children"),Ee(t.parentNode,o))):o=t,o},Je.prototype._clear=function(e){var t=Xn(e);return Tf(t),t},Je.prototype._createContainer=function(e,t,o,i){var a=Se("g");Ge(a).add("djs-group"),typeof o<"u"?or(a,t,t.childNodes[o]):Ee(t,a);var l=Se("g");Ge(l).add("djs-element"),Ge(l).add("djs-"+e),i&&Ge(l).add("djs-frame"),Ee(a,l);var r=Se("g");return Ge(r).add("djs-visual"),Ee(l,r),l},Je.prototype.create=function(e,t,o){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,o,Sl(t))},Je.prototype.updateContainments=function(e){var t=this,o=this._elementRegistry,i;i=en(e,function(a,l){return l.parent&&(a[l.parent.id]=l.parent),a},{}),Z(i,function(a){var l=a.children;if(l){var r=t._getChildrenContainer(a);Z(l.slice().reverse(),function(s){var d=o.getGraphics(s);or(d.parentNode,r)})}})},Je.prototype.drawShape=function(e,t,o={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:o})},Je.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Je.prototype.drawConnection=function(e,t,o={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:o})},Je.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Je.prototype.update=function(e,t,o){if(t.parent){var i=this._clear(o);if(e==="shape")this.drawShape(i,t),Zn(o,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ce(o,"display","none"):ce(o,"display","block")}},Je.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Lt(t.parentNode)};function or(e,t,o){var i=o||t.firstChild;e!==i&&t.insertBefore(e,i)}const xp={__depends__:[Sf],__init__:["canvas"],canvas:["type",ee],elementRegistry:["type",Ue],elementFactory:["type",st],eventBus:["type",ze],graphicsFactory:["type",Je]};function Sp(e){var t=new ul(e);return t.init(),t}function Bp(e){e=e||{};var t={config:["value",e]},o=[t,xp].concat(e.modules||[]);return Sp(o)}function Cn(e,t){this._injector=t||Bp(e),this.get("eventBus").fire("diagram.init")}Cn.prototype.get=function(e,t){return this._injector.get(e,t)},Cn.prototype.invoke=function(e,t,o){return this._injector.invoke(e,t,o)},Cn.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Cn.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function ir(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Qn(e){return e.originalEvent||e.srcEvent}function oi(e){ir(e),ir(Qn(e))}function kn(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 ar=1500;function lr(e,t,o){var i=this,a=o.get("dragging",!1);function l(r){if(!r.hover){var s=r.originalEvent,d=i._findTargetGfx(s),c=d&&e.get(d);d&&c&&(r.stopPropagation(),a.hover({element:c,gfx:d}),a.move(s))}}a&&t.on("drag.start",function(r){t.once("drag.move",ar,function(s){l(s)})}),(function(){var r,s;t.on("element.hover",function(d){r=d.gfx,s=d.element}),t.on("element.hover",ar,function(d){s&&t.fire("element.out",{element:s,gfx:r})}),t.on("element.out",function(){r=null,s=null})})(),this._findTargetGfx=function(r){var s,d;if(r instanceof MouseEvent)return s=kn(r),d=document.elementFromPoint(s.x,s.y),Ep(d)}}lr.$inject=["elementRegistry","eventBus","injector"];function Ep(e){return Xo(e,"svg, .djs-element",!0)}const _p={__init__:["hoverFix"],hoverFix:["type",lr]};function jp(){return/mac/i.test(navigator.platform)}function rr(e,t){return(Qn(e)||e).button===t}function eo(e){return rr(e,0)}function Vp(e){return rr(e,1)}function Tp(e){var t=Qn(e)||e;return eo(e)&&t.shiftKey}function Np(e){return!0}function to(e){return eo(e)||Vp(e)}var sr=500;function cr(e,t,o){var i=this;function a(B,_,T){if(!s(B,_)){var j,D,A;T?D=t.getGraphics(T):(j=_.delegateTarget||_.target,j&&(D=j,T=t.get(D))),!(!D||!T)&&(A=e.fire(B,{element:T,gfx:D,originalEvent:_}),A===!1&&(_.stopPropagation(),_.preventDefault()))}}var l={};function r(B){return l[B]}function s(B,_){var T=c[B]||eo;return!T(_)}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":Np,"element.mousedown":to,"element.mouseup":to,"element.click":to,"element.dblclick":to};function f(B,_,T){var j=d[B];if(!j)throw new Error("unmapped DOM event name <"+B+">");return a(j,_,T)}var u="svg, .djs-element";function p(B,_,T,j){var D=l[T]=function(A){a(T,A)};j&&(c[T]=j),D.$delegate=Vl.bind(B,u,_,D)}function h(B,_,T){var j=r(T);j&&Vl.unbind(B,_,j.$delegate)}function m(B){Z(d,function(_,T){p(B,T,_)})}function g(B){Z(d,function(_,T){h(B,T,_)})}e.on("canvas.destroy",function(B){g(B.svg)}),e.on("canvas.init",function(B){m(B.svg)}),e.on(["shape.added","connection.added"],function(B){var _=B.element,T=B.gfx;e.fire("interactionEvents.createHit",{element:_,gfx:T})}),e.on(["shape.changed","connection.changed"],sr,function(B){var _=B.element,T=B.gfx;e.fire("interactionEvents.updateHit",{element:_,gfx:T})}),e.on("interactionEvents.createHit",sr,function(B){var _=B.element,T=B.gfx;i.createDefaultHit(_,T)}),e.on("interactionEvents.updateHit",function(B){var _=B.element,T=B.gfx;i.updateDefaultHit(_,T)});var b=S("djs-hit djs-hit-stroke"),k=S("djs-hit djs-hit-click-stroke"),v=S("djs-hit djs-hit-all"),w=S("djs-hit djs-hit-no-move"),C={all:v,"click-stroke":k,stroke:b,"no-move":w};function S(B,_){return _=ie({stroke:"white",strokeWidth:15},_||{}),o.cls(B,["no-fill","no-border"],_)}function y(B,_){var T=C[_];if(!T)throw new Error("invalid hit type <"+_+">");return ce(B,T),B}function E(B,_){Ee(B,_)}this.removeHits=function(B){var _=Rf(".djs-hit",B);Z(_,Lt)},this.createDefaultHit=function(B,_){var T=B.waypoints,j=B.isFrame,D;return T?this.createWaypointsHit(_,T):(D=j?"stroke":"all",this.createBoxHit(_,D,{width:B.width,height:B.height}))},this.createWaypointsHit=function(B,_){var T=Ko(_);return y(T,"stroke"),E(B,T),T},this.createBoxHit=function(B,_,T){T=ie({x:0,y:0},T);var j=Se("rect");return y(j,_),ce(j,T),E(B,j),j},this.updateDefaultHit=function(B,_){var T=mn(".djs-hit",_);if(T)return B.waypoints?Cl(T,B.waypoints):ce(T,{width:B.width,height:B.height}),T},this.fire=a,this.triggerMouseEvent=f,this.mouseHandler=r,this.registerEvent=p,this.unregisterEvent=h}cr.$inject=["eventBus","elementRegistry","styles"];const $p={__init__:["interactionEvents"],interactionEvents:["type",cr]};function on(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(i){var a=i.element;o.deselect(a)}),e.on(["diagram.clear","root.set"],function(i){o.select(null)})}on.$inject=["eventBus","canvas"],on.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var i=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},on.prototype.get=function(){return this._selectedElements},on.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},on.prototype.select=function(e,t){var o=this._selectedElements,i=o.slice();Ne(e)||(e=e?[e]:[]);var a=this._canvas,l=a.getRootElement();e=e.filter(function(r){var s=a.findRoot(r);return l===s}),t?Z(e,function(r){o.indexOf(r)===-1&&o.push(r)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:o})};var dr="hover",ur="selected";function fr(e,t){this._canvas=e;function o(a,l){e.addMarker(a,l)}function i(a,l){e.removeMarker(a,l)}t.on("element.hover",function(a){o(a.element,dr)}),t.on("element.out",function(a){i(a.element,dr)}),t.on("selection.changed",function(a){function l(c){i(c,ur)}function r(c){o(c,ur)}var s=a.oldSelection,d=a.newSelection;Z(s,function(c){d.indexOf(c)===-1&&l(c)}),Z(d,function(c){s.indexOf(c)===-1&&r(c)})})}fr.$inject=["canvas","eventBus"];function pr(e,t,o,i){e.on("create.end",500,function(a){var l=a.context,r=l.canExecute,s=l.elements,d=l.hints||{},c=d.autoSelect;if(r){if(c===!1)return;Ne(c)?t.select(c):t.select(s.filter(Mp))}}),e.on("connect.end",500,function(a){var l=a.context,r=l.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(a){var l=a.previousSelection||[],r=i.get(a.context.shape.id),s=gt(l,function(d){return r.id===d.id});s||t.select(r)}),e.on("element.click",function(a){if(eo(a)){var l=a.element;l===o.getRootElement()&&(l=null);var r=t.isSelected(l),s=t.get().length>1,d=Tp(a);if(r&&s)return d?t.deselect(l):t.select(l);r?t.deselect(l):t.select(l,d)}})}pr.$inject=["eventBus","selection","canvas","elementRegistry"];function Mp(e){return!e.hidden}const no={__init__:["selectionVisuals","selectionBehavior"],__depends__:[$p],selection:["type",on],selectionVisuals:["type",fr],selectionBehavior:["type",pr]};var Lp=/^djs-cursor-.*$/;function ii(e){var t=Vf(document.body);t.removeMatching(Lp),e&&t.add("djs-cursor-"+e)}function hr(){ii(null)}var Pp=5e3;function mr(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Pp,o),function(){e.off(t,o)}}function gr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function an(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rp(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var ln=Math.round,yr="djs-drag-active";function Rt(e){e.preventDefault()}function Ap(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Op(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function br(e,t,o,i){var a={threshold:5,trapClick:!0},l;function r(w){var C=t.viewbox(),S=t._container.getBoundingClientRect();return{x:C.x+(w.x-S.left)/C.scale,y:C.y+(w.y-S.top)/C.scale}}function s(w,C){C=C||l;var S=e.createEvent(ie({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,S)===!1?!1:e.fire(C.prefix+"."+w,S)}function d(w){var C=w.filter(function(S){return i.get(S.id)});C.length&&o.select(C)}function c(w,C){var S=l.payload,y=l.displacement,E=l.globalStart,B=kn(w),_=an(B,E),T=l.localStart,j=r(B),D=an(j,T);if(!l.active&&(C||Op(_)>l.threshold)){if(ie(S,{x:ln(T.x+y.x),y:ln(T.y+y.y),dx:0,dy:0},{originalEvent:w}),s("start")===!1)return b();l.active=!0,l.keepSelection||(S.previousSelection=o.get(),o.select(null)),l.cursor&&ii(l.cursor),t.addMarker(t.getRootElement(),yr)}oi(w),l.active&&(ie(S,{x:ln(j.x+y.x),y:ln(j.y+y.y),dx:ln(D.x),dy:ln(D.y)},{originalEvent:w}),s("move"))}function f(w){var C,S=!0;l.active&&(w&&(l.payload.originalEvent=w,oi(w)),S=s("end")),S===!1&&s("rejected"),C=k(S!==!0),s("ended",C)}function u(w){Rp("Escape",w)&&(Rt(w),b())}function p(w){var C;l.active&&(C=mr(e),setTimeout(C,400),Rt(w)),f(w)}function h(w){c(w)}function m(w){var C=l.payload;C.hoverGfx=w.gfx,C.hover=w.element,s("hover")}function g(w){s("out");var C=l.payload;C.hoverGfx=null,C.hover=null}function b(w){var C;if(l){var S=l.active;S&&s("cancel"),C=k(w),S&&s("canceled",C)}}function k(w){var C,S;s("cleanup"),hr(),l.trapClick?S=p:S=f,ke.unbind(document,"mousemove",c),ke.unbind(document,"dragstart",Rt),ke.unbind(document,"selectstart",Rt),ke.unbind(document,"mousedown",S,!0),ke.unbind(document,"mouseup",S,!0),ke.unbind(document,"keyup",u),ke.unbind(document,"touchstart",h,!0),ke.unbind(document,"touchcancel",b,!0),ke.unbind(document,"touchmove",c,!0),ke.unbind(document,"touchend",f,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),yr);var y=l.payload.previousSelection;return w!==!1&&y&&!o.get().length&&d(y),C=l,l=null,C}function v(w,C,S,y){l&&b(!1),typeof C=="string"&&(y=S,S=C,C=null),y=ie({},a,y||{});var E=y.data||{},B,_,T,j,D;y.trapClick?j=p:j=f,w?(B=Qn(w)||w,_=kn(w),oi(w),B.type==="dragstart"&&Rt(B)):(B=null,_={x:0,y:0}),T=r(_),C||(C=T),D=Ap(B),l=ie({prefix:S,data:E,payload:{},globalStart:_,displacement:an(C,T),localStart:T,isTouch:D},y),y.manual||(D?(ke.bind(document,"touchstart",h,!0),ke.bind(document,"touchcancel",b,!0),ke.bind(document,"touchmove",c,!0),ke.bind(document,"touchend",f,!0)):(ke.bind(document,"mousemove",c),ke.bind(document,"dragstart",Rt),ke.bind(document,"selectstart",Rt),ke.bind(document,"mousedown",j,!0),ke.bind(document,"mouseup",j,!0)),ke.bind(document,"keyup",u),e.on("element.hover",m),e.on("element.out",g)),s("init"),y.autoActivate&&c(w,!0)}e.on("diagram.destroy",b),this.init=v,this.move=c,this.hover=m,this.out=g,this.end=f,this.cancel=b,this.context=function(){return l},this.setOptions=function(w){ie(a,w)}}br.$inject=["eventBus","canvas","selection","elementRegistry"];const wr={__depends__:[_p,no],dragging:["type",br]};function vr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}vr.prototype.next=function(){return this._prefix+ ++this._counter};const Fp=new vr("ps");var Ip=["marker-start","marker-mid","marker-end"],zp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function St(e,t,o,i){this._elementRegistry=e,this._canvas=o,this._styles=i}St.$inject=["elementRegistry","eventBus","canvas","styles"],St.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")},St.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},St.prototype.addDragger=function(e,t,o,i="djs-dragger"){o=o||this.getGfx(e);var a=yl(o),l=o.getBoundingClientRect();return this._cloneMarkers(Xn(a),i),ce(a,this._styles.cls(i,[],{x:l.top,y:l.left})),Ee(t,a),ce(a,"data-preview-support-element-id",e.id),a},St.prototype.addFrame=function(e,t){var o=Se("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ee(t,o),ce(o,"data-preview-support-element-id",e.id),o},St.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var i=this;e.childNodes&&e.childNodes.forEach(a=>{i._cloneMarkers(a,t,o)}),Up(e)&&Ip.forEach(function(a){if(ce(e,a)){var l=Dp(e,a,i._canvas.getContainer());l&&i._cloneMarker(o,e,l,a,t)}})},St.prototype._cloneMarker=function(e,t,o,i,a="djs-dragger"){var l=[o.id,a,Fp.next()].join("-"),r=mn("marker#"+o.id,e);e=e||this._canvas._svg;var s=r||yl(o);s.id=l,Ge(s).add(a);var d=mn(":scope > defs",e);d||(d=Se("defs"),Ee(e,d)),Ee(d,s);var c=Wp(s.id);ce(t,i,c)};function Dp(e,t,o){var i=Hp(ce(e,t));return mn("marker#"+i,o||document)}function Hp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Wp(e){return"url(#"+e+")"}function Up(e){return zp.indexOf(e.nodeName)!==-1}const Jp={__init__:["previewSupport"],previewSupport:["type",St]};function ai(e){this._commandStack=e.get("commandStack",!1)}ai.$inject=["injector"],ai.prototype.allowed=function(e,t){var o=!0,i=this._commandStack;return i&&(o=i.canExecute(e,t)),o===void 0?!0:o};const Cr={__init__:["rules"],rules:["type",ai]};var Yp="drop-ok",kr="drop-not-ok",xr="attach-ok",Sr="new-parent",Br="create",qp=2e3;function Er(e,t,o,i,a){function l(d,c,f,u,p){if(!c)return!1;d=Qt(d,function(v){var w=v.labelTarget;return!v.parent&&!(Hl(v)&&d.indexOf(w)!==-1)});var h=gt(d,function(v){return!rt(v)}),m=!1,g=!1,b=!1;jr(d)&&(m=a.allowed("shape.attach",{position:f,shape:h,target:c})),m||(jr(d)?b=a.allowed("shape.create",{position:f,shape:h,source:u,target:c}):b=a.allowed("elements.create",{elements:d,position:f,target:c}));var k=p.connectionTarget;return b||m?(h&&u&&(g=a.allowed("connection.create",{source:k===u?h:u,target:k===u?u:h,hints:{targetParent:c,targetAttach:m}})),{attach:m,connect:g}):b===null||m===null?null:!1}function r(d,c){[xr,Yp,kr,Sr].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,u=d.hover,p=c.source,h=c.hints||{};if(!u){c.canExecute=!1,c.target=null;return}_r(d);var m={x:d.x,y:d.y},g=c.canExecute=u&&l(f,u,m,p,h);u&&g!==null&&(c.target=u,g&&g.attach?r(u,xr):r(u,g?Sr:kr))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&r(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,u=c.shape,p=c.elements,h=c.target,m=c.canExecute,g=m&&m.attach,b=m&&m.connect,k=c.hints||{};if(m===!1||!h)return!1;_r(d);var v={x:d.x,y:d.y};b?u=i.appendShape(f,u,v,h,{attach:g,connection:b===!0?{}:b,connectionTarget:k.connectionTarget}):(p=i.createElements(p,v,h,ie({},k,{attach:g})),u=gt(p,function(w){return!rt(w)})),ie(c,{elements:p,shape:u}),ie(d,{elements:p,shape:u})});function s(){var d=t.context();d&&d.prefix===Br&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],qp,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){Ne(c)||(c=[c]);var u=gt(c,function(m){return!rt(m)});if(u){f=ie({elements:c,hints:{},shape:u},f||{}),Z(c,function(m){We(m.x)||(m.x=0),We(m.y)||(m.y=0)});var p=Qt(c,function(m){return!m.hidden}),h=Wn(p);Z(c,function(m){rt(m)&&(m.waypoints=yt(m.waypoints,function(g){return{x:g.x-h.x-h.width/2,y:g.y-h.y-h.height/2}})),ie(m,{x:m.x-h.x-h.width/2,y:m.y-h.y-h.height/2})}),t.init(d,Br,{cursor:"grabbing",autoActivate:!0,data:{shape:u,elements:c,context:f}})}}}Er.$inject=["canvas","dragging","eventBus","modeling","rules"];function _r(e){var t=e.context,o=t.createConstraints;o&&(o.left&&(e.x=Math.max(e.x,o.left)),o.right&&(e.x=Math.min(e.x,o.right)),o.top&&(e.y=Math.max(e.y,o.top)),o.bottom&&(e.y=Math.min(e.y,o.bottom)))}function jr(e){return e&&e.length===1&&!rt(e[0])}var Gp=750;function Vr(e,t,o,i,a){function l(r){var s=Se("g");ce(s,a.cls("djs-drag-group",["no-events"]));var d=Se("g");return r.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Xn(f),c)):(f=o._createContainer("shape",d),o.drawShape(Xn(f),c),Zn(f,c.x,c.y)),i.addDragger(c,s,f))}),s}t.on("create.move",Gp,function(r){var s=r.hover,d=r.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=l(c));var u;s?(f.parentNode||(u=e.getActiveLayer(),Ee(u,f)),Zn(f,r.x,r.y)):Lt(f)}),t.on("create.cleanup",function(r){var s=r.context,d=s.dragGroup;d&&Lt(d)})}Vr.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Kp={__depends__:[wr,Jp,Cr,no],__init__:["create","createPreview"],create:["type",Er],createPreview:["type",Vr]};function Tr(e,t,o,i){function a(r,s){return i.allowed("connection.create",{source:r,target:s})}function l(r,s){return a(s,r)}e.on("connect.hover",function(r){var s=r.context,d=s.start,c=r.hover,f;if(s.hover=c,f=s.canExecute=a(d,c),!Oo(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=l(d,c),!Oo(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(r){var s=r.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(r){var s=r.context,d=s.canExecute,c=s.connectionStart,f={x:r.x,y:r.y},u=s.source,p=s.target;if(!d)return!1;var h=null,m={connectionStart:li(s)?f:c,connectionEnd:li(s)?c:f};ht(d)&&(h=d),s.connection=o.connect(u,p,h,m)}),this.start=function(r,s,d,c){ht(d)||(c=d,d=tt(s)),t.init(r,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Tr.$inject=["eventBus","dragging","modeling","rules"];function li(e){var t=e.hover,o=e.source,i=e.target;return t&&o&&t===o&&o!==i}var Xp=1100,Zp=900,Nr="connect-ok",$r="connect-not-ok";function Mr(e,t,o){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(a){var l=a.context,r=l.canExecute,s=l.hover,d=l.source,c=l.start,f=l.startPosition,u=l.target,p=l.connectionStart||f,h=l.connectionEnd||{x:a.x,y:a.y},m=p,g=h;li(l)&&(m=h,g=p),i.drawPreview(l,r,{source:d||c,target:u||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",Zp,function(a){var l=a.context,r=a.hover,s=l.canExecute;s!==null&&o.addMarker(r,s?Nr:$r)}),t.on(["connect.out","connect.cleanup"],Xp,function(a){var l=a.hover;l&&(o.removeMarker(l,Nr),o.removeMarker(l,$r))}),i&&t.on("connect.cleanup",function(a){i.cleanUp(a.context)})}Mr.$inject=["injector","eventBus","canvas"];const Qp={__depends__:[no,Cr,wr],__init__:["connectPreview"],connect:["type",Tr],connectPreview:["type",Mr]};var eh=15;function Lr(e,t){var o;function i(s){return r(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function a(s){var d=o.start,c=o.button,f=kn(s),u=an(f,d);if(!o.dragging&&th(u)>eh&&(o.dragging=!0,c===0&&mr(e),ii("grab")),o.dragging){var p=o.last||o.start;u=an(f,p),t.scroll({dx:u.x,dy:u.y}),o.last=f}s.preventDefault()}function l(s){ke.unbind(document,"mousemove",a),ke.unbind(document,"mouseup",l),o=null,hr()}function r(s){if(!Xo(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:kn(s)},ke.bind(document,"mousemove",a),ke.bind(document,"mouseup",l),!0}}this.isActive=function(){return!!o}}Lr.$inject=["eventBus","canvas"];function th(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const nh={__init__:["moveCanvas"],moveCanvas:["type",Lr]};function ri(e){return Math.log(e)/Math.log(10)}function Pr(e,t){var o=ri(e.min),i=ri(e.max),a=Math.abs(o)+Math.abs(i);return a/t}function oh(e,t){return Math.max(e.min,Math.min(e.max,t))}var ih=Math.sign||function(e){return e>=0?1:-1},si={min:.2,max:4},Rr=10,ah=.1,lh=.75;function nt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=Do(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||lh;var i=this;t.on("canvas.focus.changed",function(a){i._init(a.focused&&e.enabled!==!1)})}nt.$inject=["config.zoomScroll","eventBus","canvas"],nt.prototype.scroll=function(t){this._canvas.scroll(t)},nt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},nt.prototype.zoom=function(t,o){var i=Pr(si,Rr*2);this._totalDelta+=t,Math.abs(this._totalDelta)>ah&&(this._zoom(t,o,i),this._totalDelta=0)},nt.prototype._handleWheel=function(t){if(this._canvas.isFocused()){var o=this._container;t.preventDefault();var i=t.ctrlKey||jp()&&t.metaKey,a=t.shiftKey,l=-1*this._scale,r;if(i?l*=t.deltaMode===0?.02:.32:l*=t.deltaMode===0?1:16,i){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};r=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*ih(t.deltaY)*l,this.zoom(r,d)}else a?r={dx:l*t.deltaY,dy:0}:r={dx:l*t.deltaX,dy:l*t.deltaY},this.scroll(r)}},nt.prototype.stepZoom=function(t,o){var i=Pr(si,Rr);this._zoom(t,o,i)},nt.prototype._zoom=function(e,t,o){var i=this._canvas,a=e>0?1:-1,l=ri(i.zoom()),r=Math.round(l/o)*o;r+=o*a;var s=Math.pow(10,r);i.zoom(oh(si,s),t)},nt.prototype.toggle=function(t){var o=this._container,i=this._handleWheel,a=this._enabled;return typeof t>"u"&&(t=!a),a!==t&&ke[t?"bind":"unbind"](o,"wheel",i,!1),this._enabled=t,t},nt.prototype._init=function(e){this.toggle(e)};const rh={__init__:["zoomScroll"],zoomScroll:["type",nt]};function Be(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)}Be.$inject=["eventBus","injector"],Be.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()},Be.prototype.canExecute=function(e,t){const o={command:e,context:t},i=this._getHandler(e);let a=this._fire(e,"canExecute",o);if(a===void 0){if(!i)return!1;i.canExecute&&(a=i.canExecute(t))}return a},Be.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Be.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()}},Be.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()}},Be.prototype.register=function(e,t){this._setHandler(e,t)},Be.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)},Be.prototype.canUndo=function(){return!!this._getUndoAction()},Be.prototype.canRedo=function(){return!!this._getRedoAction()},Be.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Be.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Be.prototype._internalUndo=function(e){const t=e.command,o=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const i=t?[e+"."+t,t]:[e];let a;o=this._eventBus.createEvent(o);for(const l of i)if(a=this._eventBus.fire("commandStack."+l,o),o.cancelBubble)break;return a},Be.prototype._createId=function(){return this._uid++},Be.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Be.prototype._internalExecute=function(e,t){const o=e.command,i=e.context,a=this._getHandler(o);if(!a)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),a.preExecute&&a.preExecute(i),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),a.execute&&this._markDirty(a.execute(i)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),a.postExecute&&a.postExecute(i),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,i=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,i=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:Qu("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Be.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Be.prototype._revertedAction=function(e){this._stackIdx--},Be.prototype._getHandler=function(e){return this._handlerMap[e]},Be.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};const sh={commandStack:["type",Be]};function rn(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 ch=1e3;function Fe(e){this._eventBus=e}Fe.$inject=["eventBus"];function dh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Fe.prototype.on=function(e,t,o,i,a,l){if((mt(t)||We(t))&&(l=a,a=i,i=o,o=t,t=null),mt(o)&&(l=a,a=i,i=o,o=ch),ht(a)&&(l=a,a=!1),!mt(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var r=this._eventBus;Z(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");r.on(d,o,a?dh(i,l):i,l)})},Fe.prototype.canExecute=ct("canExecute"),Fe.prototype.preExecute=ct("preExecute"),Fe.prototype.preExecuted=ct("preExecuted"),Fe.prototype.execute=ct("execute"),Fe.prototype.executed=ct("executed"),Fe.prototype.postExecute=ct("postExecute"),Fe.prototype.postExecuted=ct("postExecuted"),Fe.prototype.revert=ct("revert"),Fe.prototype.reverted=ct("reverted");function ct(e){return function(o,i,a,l,r){(mt(o)||We(o))&&(r=l,l=a,a=i,i=o,o=null),this.on(o,e,i,a,l,r)}}var uh=250,Ar=1400;function ci(e,t,o){Fe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ar,function(a){var l=a.context,r=l.shapes,s=l.validatedShapes;l.shapes=Or(r),l.validatedShapes=Or(s)}),i&&t.on("shape.move.start",uh,function(a){var l=a.context,r=l.shapes,s=[];Z(r,function(d){Z(d.labels,function(c){!c.hidden&&l.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),Z(s,function(d){i.makeDraggable(l,d,!0)})}),this.preExecuted("elements.move",Ar,function(a){var l=a.context,r=l.closure,s=r.enclosedElements,d=[];Z(s,function(c){Z(c.labels,function(f){s[f.id]||d.push(f)})}),r.addAll(d)}),this.preExecute(["connection.delete","shape.delete"],function(a){var l=a.context,r=l.connection||l.shape;rn(r.labels,function(s){o.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(a){var l=a.context,r=l.shape,s=r.labelTarget;s&&(l.labelTargetIndex=Zo(s.labels,r),l.labelTarget=s,r.labelTarget=null)}),this.revert("shape.delete",function(a){var l=a.context,r=l.shape,s=l.labelTarget,d=l.labelTargetIndex;s&&(lt(s.labels,r,d),r.labelTarget=s)})}Mt(ci,Fe),ci.$inject=["injector","eventBus","modeling"];function Or(e){return Qt(e,function(t){return e.indexOf(t.labelTarget)===-1})}const fh={__init__:["labelSupport"],labelSupport:["type",ci]};function Fr(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const o=Math.random()*16|0;return(t==="x"?o:o&3|8).toString(16)})}function Ir(e,t){if(t){let o=e;return Object.keys(t).forEach(i=>{o=o.replace(new RegExp(`{${i}}`,"g"),t[i])}),o}return e}function Ke(e,...t){if(typeof Object.assign=="function")return Object.assign(e,...t);if(e==null)throw new TypeError("Cannot convert undefined or null to object");const o=Object(e);for(let i=0;i<t.length;i++){const a=t[i];if(a!=null)for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&(o[l]=a[l])}return o}function zr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ph(e,t){Array.isArray(e)&&e.forEach(t)}var oo={exports:{}},Dr;function hh(){return Dr||(Dr=1,typeof Object.create=="function"?oo.exports=function(t,o){o&&(t.super_=o,t.prototype=Object.create(o.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:oo.exports=function(t,o){if(o){t.super_=o;var i=function(){};i.prototype=o.prototype,t.prototype=new i,t.prototype.constructor=t}}),oo.exports}var mh=hh();const xn=Bf(mh),gh={width:90,height:20};function At(){st.call(this),this._translate=Ir}xn(At,st),At.$inject=[],At.prototype.baseCreate=st.prototype.create,At.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ke({type:"label"},gh,t)):this.createFlowElement(e,t)},At.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Fr()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const i=this._getDefaultSize(o.type);return t=Ke({businessObject:o,id:o.id},i,t),this.baseCreate(e,t)},At.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 io(e,t){this._modeling=e,this._canvas=t}io.$inject=["modeling","canvas"],io.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,i=e.alignment;Z(o,function(a){var l={x:0,y:0};Zt(i.left)?l.x=i.left-a.x:Zt(i.right)?l.x=i.right-a.width-a.x:Zt(i.center)?l.x=i.center-Math.round(a.width/2)-a.x:Zt(i.top)?l.y=i.top-a.y:Zt(i.bottom)?l.y=i.bottom-a.height-a.y:Zt(i.middle)&&(l.y=i.middle-Math.round(a.height/2)-a.y),t.moveElements([a],l,a.parent)})},io.prototype.postExecute=function(e){};function ao(e){this._modeling=e}ao.$inject=["modeling"],ao.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,i=e.shape,a=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,o,{attach:a.attach}),e.shape=i},ao.prototype.postExecute=function(e){var t=e.hints||{};yh(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 yh(e,t){return Xu(e.outgoing,function(o){return o.target===t})}function lo(e,t){this._canvas=e,this._layouter=t}lo.$inject=["canvas","layouter"],lo.prototype.execute=function(e){var t=e.connection,o=e.source,i=e.target,a=e.parent,l=e.parentIndex,r=e.hints;if(!o||!i)throw new Error("source and target required");if(!a)throw new Error("parent required");return t.source=o,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,r)),this._canvas.addConnection(t,a,l),t},lo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ro=Math.round;function di(e){this._modeling=e}di.$inject=["modeling"],di.prototype.preExecute=function(e){var t=e.elements,o=e.parent,i=e.parentIndex,a=e.position,l=e.hints,r=this._modeling;Z(t,function(u){We(u.x)||(u.x=0),We(u.y)||(u.y=0)});var s=Qt(t,function(u){return!u.hidden}),d=Wn(s);Z(t,function(u){rt(u)&&(u.waypoints=yt(u.waypoints,function(p){return{x:ro(p.x-d.x-d.width/2+a.x),y:ro(p.y-d.y-d.height/2+a.y)}})),ie(u,{x:ro(u.x-d.x-d.width/2+a.x),y:ro(u.y-d.y-d.height/2+a.y)})});var c=wf(t),f={};Z(t,function(u){if(rt(u)){f[u.id]=We(i)?r.createConnection(f[u.source.id],f[u.target.id],i,u,u.parent||o,l):r.createConnection(f[u.source.id],f[u.target.id],u,u.parent||o,l);return}var p=ie({},l);c.indexOf(u)===-1&&(p.autoResize=!1),Hl(u)&&(p=of(p,["attach"])),f[u.id]=We(i)?r.createShape(u,Ho(u,["x","y","width","height"]),u.parent||o,i,p):r.createShape(u,Ho(u,["x","y","width","height"]),u.parent||o,p)}),e.elements=Zu(f)};var Hr=Math.round;function Bt(e){this._canvas=e}Bt.$inject=["canvas"],Bt.prototype.execute=function(e){var t=e.shape,o=e.position,i=e.parent,a=e.parentIndex;if(!i)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?ie(t,o):ie(t,{x:o.x-Hr(t.width/2),y:o.y-Hr(t.height/2)}),this._canvas.addShape(t,i,a),t},Bt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Sn(e){Bt.call(this,e)}Mt(Sn,Bt),Sn.$inject=["canvas"];var bh=Bt.prototype.execute;Sn.prototype.execute=function(e){var t=e.shape;return vh(t),t.labelTarget=e.labelTarget,bh.call(this,e)};var wh=Bt.prototype.revert;Sn.prototype.revert=function(e){return e.shape.labelTarget=null,wh.call(this,e)};function vh(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Bn(e,t){this._canvas=e,this._modeling=t}Bn.$inject=["canvas","modeling"],Bn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;rn(o.incoming,function(i){t.removeConnection(i,{nested:!0})}),rn(o.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Bn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Zo(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Bn.prototype.revert=function(e){var t=e.connection,o=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,lt(o.children,t,i),this._canvas.addConnection(t,o),t};function ui(e,t){this._modeling=e,this._elementRegistry=t}ui.$inject=["modeling","elementRegistry"],ui.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,i=e.elements;Z(i,function(a){o.get(a.id)&&(a.waypoints?t.removeConnection(a):t.removeShape(a))})};function En(e,t){this._canvas=e,this._modeling=t}En.$inject=["canvas","modeling"],En.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;rn(o.incoming,function(i){t.removeConnection(i,{nested:!0})}),rn(o.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rn(o.children,function(i){rt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},En.prototype.execute=function(e){var t=this._canvas,o=e.shape,i=o.parent;return e.oldParent=i,e.oldParentIndex=Zo(i.children,o),t.removeShape(o),o},En.prototype.revert=function(e){var t=this._canvas,o=e.shape,i=e.oldParent,a=e.oldParentIndex;return lt(i.children,o,a),t.addShape(o,i),o};function so(e){this._modeling=e}so.$inject=["modeling"];var Wr={x:"y",y:"x"};so.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,i=e.axis,a=e.dimension;function l(b,k){b.range.min=Math.min(k[i],b.range.min),b.range.max=Math.max(k[i]+k[a],b.range.max)}function r(b){return b[i]+b[a]/2}function s(b){return b.length-1}function d(b){return b.max-b.min}function c(b,k){var v={y:0};v[i]=b-r(k),v[i]&&(v[Wr[i]]=0,t.moveElements([k],v,k.parent))}var f=o[0],u=s(o),p=o[u],h,m,g=0;Z(o,function(b,k){var v,w,C;if(b.elements.length<2){k&&k!==o.length-1&&(l(b,b.elements[0]),g+=d(b.range));return}v=hl(b.elements,i),w=v[0],k===u&&(w=v[s(v)]),C=r(w),b.range=null,Z(v,function(S){if(c(C,S),b.range===null){b.range={min:S[i],max:S[i]+S[a]};return}l(b,S)}),k&&k!==o.length-1&&(g+=d(b.range))}),m=Math.abs(p.range.min-f.range.max),h=Math.round((m-g)/(o.length-1)),!(h<o.length-1)&&Z(o,function(b,k){var v={},w;b===f||b===p||(w=o[k-1],b.range.max=0,Z(b.elements,function(C,S){v[Wr[i]]=0,v[i]=w.range.max-C[i]+h,b.range.min!==C[i]&&(v[i]+=C[i]-b.range.min),v[i]&&t.moveElements([C],v,C.parent),b.range.max=Math.max(C[i]+C[a],S?b.range.max:0)}))})},so.prototype.postExecute=function(e){};function co(e,t){this._layouter=e,this._canvas=t}co.$inject=["layouter","canvas"],co.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return ie(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},co.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function fi(){}fi.prototype.execute=function(e){var t=e.connection,o=e.delta,i=e.newParent||t.parent,a=e.newParentIndex,l=t.parent;return e.oldParent=l,e.oldParentIndex=gn(l.children,t),lt(i.children,t,a),t.parent=i,Z(t.waypoints,function(r){r.x+=o.x,r.y+=o.y,r.original&&(r.original.x+=o.x,r.original.y+=o.y)}),t},fi.prototype.revert=function(e){var t=e.connection,o=t.parent,i=e.oldParent,a=e.oldParentIndex,l=e.delta;return gn(o.children,t),lt(i.children,t,a),t.parent=i,Z(t.waypoints,function(r){r.x-=l.x,r.y-=l.y,r.original&&(r.original.x-=l.x,r.original.y-=l.y)}),t};function uo(e,t,o){var i=gr(t),a=gr(o),l=an(e,i),r={x:l.x*(o.width/t.width),y:l.y*(o.height/t.height)};return yn({x:a.x+r.x,y:a.y+r.y})}function pi(e,t,o){var i=fo(e),a=Jr(i,t),l=i[0];return a.length?a[a.length-1]:uo(l.original||l,o,t)}function hi(e,t,o){var i=fo(e),a=Jr(i,t),l=i[i.length-1];return a.length?a[0]:uo(l.original||l,o,t)}function mi(e,t,o){var i=fo(e),a=Ur(t,o),l=i[0];return uo(l.original||l,a,t)}function gi(e,t,o){var i=fo(e),a=Ur(t,o),l=i[i.length-1];return uo(l.original||l,a,t)}function Ur(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Jr(e,t){var o=yt(e,kh);return Qt(o,function(i){return Ch(i,t)})}function Ch(e,t){return bn(t,e,1)==="intersect"}function kh(e){return e.original||e}function yi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yi.prototype.add=function(e,t){return this.addAll([e],t)},yi.prototype.addAll=function(e,t){var o=vf(e,!!t,this);return ie(this,o),this};function _n(e){this._modeling=e}_n.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},_n.prototype.moveClosure=function(e,t,o,i,a){var l=this._modeling,r=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;a&&a.parent===o&&(f=!0),Z(r,function(u){l.moveShape(u,t,c[u.id]&&!f&&o,{recurse:!1,layout:!1})}),Z(s,function(u){var p=!!r[u.source.id],h=!!r[u.target.id];d[u.id]&&p&&h?l.moveConnection(u,t,c[u.id]&&!f&&o):l.layoutConnection(u,{connectionStart:p&&mi(u,u.source,t),connectionEnd:h&&gi(u,u.target,t)})})},_n.prototype.getClosure=function(e){return new yi().addAll(e,!0)};function po(e){this._helper=new _n(e)}po.$inject=["modeling"],po.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},po.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 Ot(e){this._modeling=e,this._helper=new _n(e)}Ot.$inject=["modeling"],Ot.prototype.execute=function(e){var t=e.shape,o=e.delta,i=e.newParent||t.parent,a=e.newParentIndex,l=t.parent;return e.oldBounds=Ho(t,["x","y","width","height"]),e.oldParent=l,e.oldParentIndex=gn(l.children,t),lt(i.children,t,a),ie(t,{parent:i,x:t.x+o.x,y:t.y+o.y}),t},Ot.prototype.postExecute=function(e){var t=e.shape,o=e.delta,i=e.hints,a=this._modeling;i.layout!==!1&&(Z(t.incoming,function(l){a.layoutConnection(l,{connectionEnd:gi(l,t,o)})}),Z(t.outgoing,function(l){a.layoutConnection(l,{connectionStart:mi(l,t,o)})})),i.recurse!==!1&&this.moveChildren(e)},Ot.prototype.revert=function(e){var t=e.shape,o=e.oldParent,i=e.oldParentIndex,a=e.delta;return lt(o.children,t,i),ie(t,{parent:o,x:t.x-a.x,y:t.y-a.y}),t},Ot.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Ot.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function jn(e){this._modeling=e}jn.$inject=["modeling"],jn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,i=e.connection,a=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return Ne(a)&&(e.oldWaypoints=i.waypoints,i.waypoints=a),t&&(e.oldSource=i.source,i.source=t),o&&(e.oldTarget=i.target,i.target=o),i},jn.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,i=e.newTarget,a=e.dockingOrPoints,l=e.hints||{},r={};l.connectionStart&&(r.connectionStart=l.connectionStart),l.connectionEnd&&(r.connectionEnd=l.connectionEnd),l.layoutConnection!==!1&&(o&&(!i||l.docking==="source")&&(r.connectionStart=r.connectionStart||Yr(Ne(a)?a[0]:a)),i&&(!o||l.docking==="target")&&(r.connectionEnd=r.connectionEnd||Yr(Ne(a)?a[a.length-1]:a)),l.newWaypoints&&(r.waypoints=l.newWaypoints),this._modeling.layoutConnection(t,r))},jn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,i=e.oldWaypoints,a=e.connection;return t&&(a.source=t),o&&(a.target=o),i&&(a.waypoints=i),a};function Yr(e){return e.original||e}function dt(e,t){this._modeling=e,this._rules=t}dt.$inject=["modeling","rules"],dt.prototype.preExecute=function(e){var t=this,o=this._modeling,i=this._rules,a=e.oldShape,l=e.newData,r=e.hints||{},s;function d(m,g,b){return i.allowed("connection.reconnect",{connection:b,source:m,target:g})}var c={x:l.x,y:l.y},f={x:a.x,y:a.y,width:a.width,height:a.height};s=e.newShape=e.newShape||t.createShape(l,c,a.parent,r),a.host&&o.updateAttachment(s,a.host);var u;r.moveChildren!==!1&&(u=a.children.slice(),o.moveElements(u,{x:0,y:0},s,r));var p=a.incoming.slice(),h=a.outgoing.slice();Z(p,function(m){var g=m.source,b=d(g,s,m);b&&t.reconnectEnd(m,s,hi(m,s,f),r)}),Z(h,function(m){var g=m.target,b=d(s,g,m);b&&t.reconnectStart(m,s,pi(m,s,f),r)})},dt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},dt.prototype.execute=function(e){},dt.prototype.revert=function(e){},dt.prototype.createShape=function(e,t,o,i){return this._modeling.createShape(e,t,o,i)},dt.prototype.reconnectStart=function(e,t,o,i){this._modeling.reconnectStart(e,t,o,i)},dt.prototype.reconnectEnd=function(e,t,o,i){this._modeling.reconnectEnd(e,t,o,i)};function Vn(e){this._modeling=e}Vn.$inject=["modeling"],Vn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,i=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(i&&(o.width<i.width||o.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&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},ie(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Vn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,i=e.oldBounds,a=e.hints||{};a.layout!==!1&&(Z(o.incoming,function(l){t.layoutConnection(l,{connectionEnd:hi(l,o,i)})}),Z(o.outgoing,function(l){t.layoutConnection(l,{connectionStart:pi(l,o,i)})}))},Vn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return ie(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function xh(e,t){var o=[];return Z(e.concat(t),function(i){var a=i.incoming,l=i.outgoing;Z(a.concat(l),function(r){var s=r.source,d=r.target;(Tn(e,s)||Tn(e,d)||Tn(t,s)||Tn(t,d))&&(Tn(o,r)||o.push(r))})}),o}function Tn(e,t){return e.indexOf(t)!==-1}function Sh(e,t,o){var i=e.x,a=e.y,l=e.width,r=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:i,y:a+d,width:l,height:r-d};case"s":return{x:i,y:a,width:l,height:r+d};case"w":return{x:i+s,y:a,width:l-s,height:r};case"e":return{x:i,y:a,width:l+s,height:r};default:throw new Error("unknown direction: "+t)}}function Et(e){this._modeling=e}Et.$inject=["modeling"],Et.prototype.preExecute=function(e){var t=e.delta,o=e.direction,i=e.movingShapes,a=e.resizingShapes,l=e.start,r={};this.moveShapes(i,t),Z(a,function(s){r[s.id]=Eh(s)}),this.resizeShapes(a,t,o),this.updateConnectionWaypoints(xh(i,a),t,o,l,i,a,r)},Et.prototype.execute=function(){},Et.prototype.revert=function(){},Et.prototype.moveShapes=function(e,t){var o=this;Z(e,function(i){o._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Et.prototype.resizeShapes=function(e,t,o){var i=this;Z(e,function(a){var l=Sh(a,o,t);i._modeling.resizeShape(a,l,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Et.prototype.updateConnectionWaypoints=function(e,t,o,i,a,l,r){var s=this,d=a.concat(l);Z(e,function(c){var f=c.source,u=c.target,p=Bh(c),h=Gr(o),m={};_t(d,f)&&_t(d,u)?(p=yt(p,function(g){return Kr(g,i,o)&&(g[h]=g[h]+t[h]),g.original&&Kr(g.original,i,o)&&(g.original[h]=g.original[h]+t[h]),g}),s._modeling.updateWaypoints(c,p,{labelBehavior:!1})):(_t(d,f)||_t(d,u))&&(_t(a,f)?m.connectionStart=mi(c,f,t):_t(a,u)?m.connectionEnd=gi(c,u,t):_t(l,f)?m.connectionStart=pi(c,f,r[f.id]):_t(l,u)&&(m.connectionEnd=hi(c,u,r[u.id])),s._modeling.layoutConnection(c,m))})};function qr(e){return ie({},e)}function Bh(e){return yt(e.waypoints,function(t){return t=qr(t),t.original&&(t.original=qr(t.original)),t})}function Gr(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Kr(e,t,o){var i=Gr(o);if(/e|s/.test(o))return e[i]>t;if(/n|w/.test(o))return e[i]<t}function _t(e,t){return e.indexOf(t)!==-1}function Eh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ho(e){this._modeling=e}ho.$inject=["modeling"],ho.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Xr(o),t.collapsed=!t.collapsed;var i=Zr(o,t.collapsed);return[t].concat(i)},ho.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,i=t.children,a=Qr(i,o);return t.collapsed=!t.collapsed,[t].concat(a)};function Xr(e){var t={};return Z(e,function(o){t[o.id]=o.hidden,o.children&&(t=ie({},t,Xr(o.children)))}),t}function Zr(e,t){var o=[];return Z(e,function(i){i.hidden=t,o=o.concat(i),i.children&&(o=o.concat(Zr(i.children,i.collapsed||t)))}),o}function Qr(e,t){var o=[];return Z(e,function(i){i.hidden=t[i.id],o=o.concat(i),i.children&&(o=o.concat(Qr(i.children,t)))}),o}function mo(e){this._modeling=e}mo.$inject=["modeling"],mo.prototype.execute=function(e){var t=e.shape,o=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=es(i,t),ts(o,t),t.host=o,t},mo.prototype.revert=function(e){var t=e.shape,o=e.newHost,i=e.oldHost,a=e.attacherIdx;return t.host=i,es(o,t),ts(i,t,a),t};function es(e,t){return gn(e&&e.attachers,t)}function ts(e,t,o){if(e){var i=e.attachers;i||(e.attachers=i=[]),lt(i,t,o)}}function bi(){}bi.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},bi.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function be(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var i=this;e.on("diagram.init",function(){i.registerHandlers(o)})}be.$inject=["eventBus","elementFactory","commandStack"],be.prototype.getHandlers=function(){return{"shape.append":ao,"shape.create":Bt,"shape.delete":En,"shape.move":Ot,"shape.resize":Vn,"shape.replace":dt,"shape.toggleCollapse":ho,spaceTool:Et,"label.create":Sn,"connection.create":lo,"connection.delete":Bn,"connection.move":fi,"connection.layout":co,"connection.updateWaypoints":bi,"connection.reconnect":jn,"elements.create":di,"elements.move":po,"elements.delete":ui,"elements.distribute":so,"elements.align":io,"element.updateAttachment":mo}},be.prototype.registerHandlers=function(e){Z(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},be.prototype.moveShape=function(e,t,o,i,a){typeof i=="object"&&(a=i,i=null);var l={shape:e,delta:t,newParent:o,newParentIndex:i,hints:a||{}};this._commandStack.execute("shape.move",l)},be.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},be.prototype.moveElements=function(e,t,o,i){i=i||{};var a=i.attach,l=o,r;a===!0?(r=o,l=o.parent):a===!1&&(r=null);var s={shapes:e,delta:t,newParent:l,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},be.prototype.moveConnection=function(e,t,o,i,a){typeof i=="object"&&(a=i,i=void 0);var l={connection:e,delta:t,newParent:o,newParentIndex:i,hints:a||{}};this._commandStack.execute("connection.move",l)},be.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},be.prototype.createConnection=function(e,t,o,i,a,l){typeof o=="object"&&(l=a,a=i,i=o,o=void 0),i=this._create("connection",i);var r={source:e,target:t,parent:a,parentIndex:o,connection:i,hints:l};return this._commandStack.execute("connection.create",r),r.connection},be.prototype.createShape=function(e,t,o,i,a){typeof i!="number"&&(a=i,i=void 0),a=a||{};var l=a.attach,r,s;e=this._create("shape",e),l?(r=o.parent,s=o):r=o;var d={position:t,shape:e,parent:r,parentIndex:i,host:s,hints:a};return this._commandStack.execute("shape.create",d),d.shape},be.prototype.createElements=function(e,t,o,i,a){Ne(e)||(e=[e]),typeof i!="number"&&(a=i,i=void 0),a=a||{};var l={position:t,elements:e,parent:o,parentIndex:i,hints:a};return this._commandStack.execute("elements.create",l),l.elements},be.prototype.createLabel=function(e,t,o,i){o=this._create("label",o);var a={labelTarget:e,position:t,parent:i||e.parent,shape:o};return this._commandStack.execute("label.create",a),a.shape},be.prototype.appendShape=function(e,t,o,i,a){a=a||{},t=this._create("shape",t);var l={source:e,position:o,target:i,shape:t,connection:a.connection,connectionParent:a.connectionParent,hints:a};return this._commandStack.execute("shape.append",l),l.shape},be.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},be.prototype.distributeElements=function(e,t,o){var i={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",i)},be.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},be.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},be.prototype.replaceShape=function(e,t,o){var i={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",i),i.newShape},be.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},be.prototype.resizeShape=function(e,t,o,i){var a={shape:e,newBounds:t,minBounds:o,hints:i};this._commandStack.execute("shape.resize",a)},be.prototype.createSpace=function(e,t,o,i,a){var l={delta:o,direction:i,movingShapes:e,resizingShapes:t,start:a};this._commandStack.execute("spaceTool",l)},be.prototype.updateWaypoints=function(e,t,o){var i={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",i)},be.prototype.reconnect=function(e,t,o,i,a){var l={connection:e,newSource:t,newTarget:o,dockingOrPoints:i,hints:a||{}};this._commandStack.execute("connection.reconnect",l)},be.prototype.reconnectStart=function(e,t,o,i){i||(i={}),this.reconnect(e,t,e.target,o,ie(i,{docking:"source"}))},be.prototype.reconnectEnd=function(e,t,o,i){i||(i={}),this.reconnect(e,e.source,t,o,ie(i,{docking:"target"}))},be.prototype.connect=function(e,t,o,i){return this.createConnection(e,t,o||{},e.parent,i)},be.prototype._create=function(e,t){return wp(t)?t:this._elementFactory.create(e,t)},be.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function wi(e){const t=e.businessObject;if(t)return t.name||""}function _h(e,t){const o=e.businessObject;return o.name=t,e}const jh={height:20},ns=15;function Vh(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Th(e){return go(e.label)}function Nh(e){const t=e.length/2-1,o=e[Math.floor(t)],i=e[Math.ceil(t+.01)],a=$h(e),l=Math.atan((i.y-o.y)/(i.x-o.x));let{x:r,y:s}=a;return Math.abs(l)<Math.PI/2?s-=ns:r+=ns,{x:r,y:s}}function $h(e){const t=e.length/2-1,o=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:o.x+(i.x-o.x)/2,y:o.y+(i.y-o.y)/2}}function Mh(e){return e.waypoints?Nh(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+jh.height/2}}function go(e){return e&&!!e.labelTarget}const Lh={width:0,height:0};function os(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return _h(c,d),[c,f]}function i(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!go(d)&&Vh(d)&&!Th(d)&&!is(c)){let p=Mh(d);p={x:p.x,y:p.y+7},e.createLabel(d,p,{id:f.id+"_label",businessObject:f})}}function a(s){return s.oldLabel=wi(s.element),o(s.element,s.newLabel)}function l(s){return o(s.element,s.oldLabel)}function r(s){const{element:d,newLabel:c}=s,f=d.label||d,u=s.hints||{};let{newBounds:p}=s;if(!go(f))return;if(go(f)&&is(c)){u.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=wi(f);typeof p>"u"&&(p=t.getExternalLabelBounds(f,h)),p&&e.resizeShape(f,p,Lh)}this.preExecute=i,this.execute=a,this.revert=l,this.postExecute=r}os.$inject=["modeling","textRenderer"];function is(e){return!e||!e.trim()}function Nn(e,t,o){be.call(this,e,t,o)}xn(Nn,be),Nn.$inject=["eventBus","elementFactory","commandStack"],Nn.prototype.getHandlers=function(){const e=be.prototype.getHandlers.call(this);return e["element.updateLabel"]=os,e},Nn.prototype.updateLabel=function(e,t,o,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:i||{}})};function vi(e,t){Fe.call(this,e);function o(i){const{context:a}=i,l=a.hints||{};let r;!a.cropped&&l.createElementsBehavior!==!1&&(r=a.connection,r.waypoints=t.getCroppedWaypoints(r),a.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}xn(vi,Fe),vi.$inject=["eventBus","connectionDocking"];function as(){}as.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var yo=20,Ph=5,bo=Math.round,ls=20,Rh={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ah(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Oh(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function rs(e,t,o){var i=bn(t,e,Ph),a=o.split(":")[0],l=bo((t.x-e.x)/2+e.x),r=bo((t.y-e.y)/2+e.y),s,d,c=Oh(a,i),f=/h|r|l/.test(a),u=!1,p=!1;return c?(s=f?{x:l,y:e.y}:{x:e.x,y:r},d=f?"h:h":"v:v"):(u=Ah(i,a),d=f?"h:v":"v:h",u?f?(p=r===e.y,s={x:e.x+yo*(/l/.test(a)?-1:1),y:p?r+yo:r}):(p=l===e.x,s={x:p?l+yo:l,y:e.y+yo*(/t/.test(a)?-1:1)}):s={x:l,y:r}),{waypoints:Ci(e,s,d).concat(s),directions:d,turnNextDirections:p}}function Fh(e,t,o){return rs(e,t,o)}function Ih(e,t,o){var i=rs(t,e,ss(o));return{waypoints:i.waypoints.slice().reverse(),directions:ss(i.directions),turnNextDirections:i.turnNextDirections}}function zh(e,t){var o=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var a=o+":"+i,l=Ci(e.waypoints[e.waypoints.length-1],t.waypoints[0],a);return{waypoints:l,directions:a}}function ss(e){return e.split(":").reverse().join(":")}function Dh(e,t,o){var i=bo((t.x-e.x)/2+e.x),a=bo((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:i,y:e.y},{x:i,y:t.y}];if(o==="v:v")return[{x:e.x,y:a},{x:t.x,y:a}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Ci(e,t,o){if(o=o||"h:h",!Xh(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ds(o)){var i=Fh(e,t,o),a=Ih(e,t,o),l=zh(i,a);return[].concat(i.waypoints,l.waypoints,a.waypoints)}return Dh(e,t,o)}function Hh(e,t,o){var i=Ci(e,t,o);return i.unshift(e),i.push(t),fs(i)}function Wh(e,t,o,i,a){var l=a&&a.preferredLayouts||[],r=Ku(l,"straight")[0]||"h:h",s=Rh[r]||0,d=bn(e,t,s),c=Kh(d,r);o=o||tt(e),i=i||tt(t);var f=c.split(":"),u=us(o,e,f[0],Zh(d)),p=us(i,t,f[1],d);return Hh(u,p,c)}function Uh(e,t,o,i,a,l){Ne(o)&&(a=o,l=i,o=tt(e),i=tt(t)),l=ie({preferredLayouts:[]},l),a=a||[];var r=l.preferredLayouts,s=r.indexOf("straight")!==-1,d;return d=s&&Yh(e,t,o,i,l),d||(d=l.connectionEnd&&Gh(t,e,i,a),d)||(d=l.connectionStart&&qh(e,t,o,a),d)?d:!l.connectionStart&&!l.connectionEnd&&a&&a.length?a:Wh(e,t,o,i,l)}function Jh(e,t,o){return e>=t&&e<=o}function cs(e,t,o){var i={x:"width",y:"height"};return Jh(t[e],o[e],o[e]+o[i[e]])}function Yh(e,t,o,i,a){var l={},r,s;return s=bn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(r="x"),/left|right/.test(s)&&(r="y"),a.preserveDocking==="target"?cs(r,i,e)?(l[r]=i[r],[{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:i.x,y:i.y}]):null:cs(r,o,t)?(l[r]=o[r],[{x:o.x,y:o.y},{x:l.x!==void 0?l.x:i.x,y:l.y!==void 0?l.y:i.y,original:{x:l.x!==void 0?l.x:i.x,y:l.y!==void 0?l.y:i.y}}]):null):null}function qh(e,t,o,i){return ki(e,t,o,i)}function Gh(e,t,o,i){var a=i.slice().reverse();return a=ki(e,t,o,a),a?a.reverse():null}function ki(e,t,o,i){function a(f){return f.length<3?!0:f.length>4?!1:!!gt(f,function(u,p){var h=f[p-1];return h&&Qo(u,h)<3})}function l(f,u,p){var h=Tl(u,f);switch(h){case"v":return{x:p.x,y:f.y};case"h":return{x:f.x,y:p.y}}return{x:f.x,y:f.y}}function r(f,u,p){var h;for(h=f.length-2;h!==0;h--)if(Nl(f[h],u,ls)||Nl(f[h],p,ls))return f.slice(h);return f}if(a(i))return null;var s=i[0],d=i.slice(),c;return d[0]=o,d[1]=l(d[1],s,o),c=r(d,e,t),c!==d&&(d=ki(e,t,o,c)),d&&Tl(d)?null:d}function Kh(e,t){if(ds(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 Xh(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ds(e){return e&&/t|r|b|l/.test(e)}function Zh(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 us(e,t,o,i){if(o==="h"&&(o=/left/.test(i)?"l":"r"),o==="v"&&(o=/top/.test(i)?"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 fs(e){return e.reduce(function(t,o,i){var a=t[t.length-1],l=e[i+1];return Af(a,l,o,0)||t.push(o),t},[])}function xi(){}xn(xi,as);const Ft=(e,t)=>e.type===t;xi.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,i=t.target||e.target,a=t.waypoints||e.waypoints;let{connectionStart:l,connectionEnd:r}=t,s,d;return r===void 0&&(l=wo(a&&a[0],o),r=wo(a&&a[a.length-1],i)),l||(l=wo(a&&a[0],o)),r||(r=wo(a&&a[a.length-1],i)),Ft(e,"myline")&&(o===i?s={preferredLayouts:Qh(o,e)}:Ft(o,"gatewayAnd")||Ft(o,"gatewayXor")||Ft(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Ft(i,"gatewayAnd")||Ft(i,"gatewayXor")||Ft(i,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ke(s,t),d=fs(Uh(o,i,l,r,a,s))),d||[l,r]};function wo(e,t){return e?e.original||e:tt(t)}function Qh(e,t){const{waypoints:o}=t,i=o&&o.length&&bn(o[0],e);return i==="top"?["t:r"]:i==="right"?["r:b"]:i==="left"?["l:t"]:["b:l"]}function ps(e){return ie({original:e.point.original||e.point},e.actual)}function jt(e,t){this._elementRegistry=e,this._graphicsFactory=t}jt.$inject=["elementRegistry","graphicsFactory"],jt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var i=this.getDockingPoint(e,t,!0),a=this.getDockingPoint(e,o),l=e.waypoints.slice(i.idx+1,a.idx);return l.unshift(ps(i)),l.push(ps(a)),l},jt.prototype.getDockingPoint=function(e,t,o){var i=e.waypoints,a,l,r;return a=o?0:i.length-1,l=i[a],r=this._getIntersection(t,e,o),{point:l,actual:r||l,idx:a}},jt.prototype._getIntersection=function(e,t,o){var i=this._getShapePath(e),a=this._getConnectionPath(t);return ap(i,a,o)},jt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},jt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},jt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const em={__depends__:[sh,fh,no],__init__:["modeling","elementUpdater"],modeling:["type",Nn],layouter:["type",xi],elementUpdater:["type",vi],elementFactory:["type",At],connectionDocking:["type",jt]};function tm(e){return e.businessObject}function vo(e,t){return e.businessObject.strokeWidth||t||1}function Xe(e,t){return e.businessObject.fillColor||t||"var(--color-bg-container)"}function _e(e,t){return e.businessObject.strokeColor||t||"var(--color-text)"}function nm(e){const t=e.x+e.width/2,o=e.y+e.height/2,i=e.width/2,a=[["M",t,o],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Pt(a)}function om(e,t){const{x:o,y:i,width:a,height:l}=e,r=[["M",o+t,i],["l",a-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-a,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-l],["a",t,t,0,0,1,t,-t],["z"]];return Pt(r)}function im(e){const{x:t,y:o,width:i,height:a}=e,l=i/2,r=a/2,s=[["M",t+l,o],["l",l,r],["l",-l,r],["l",-l,-r],["z"]];return Pt(s)}function am(e){const{x:t,y:o,width:i,height:a}=e,l=[["M",t,o],["l",i,0],["l",0,a],["l",-i,0],["z"]];return Pt(l)}const Si=10,Bi=.95,Vt=(e,t)=>e.type===t;function It(e,t,o,i,a,l,r){at.call(this,e,r);const s="var(--color-bg-container)",d="var(--color-text)",c={};Object.keys(l.palette).forEach(V=>{const x=l.palette[V];c[x.type]=x.options});const{computeStyle:f}=t;function u(V){return R[V]}function p(V){return t.computeStyle(V,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(V){return t.computeStyle(V,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function m(V,x,L,P){L=p(L);const G=Ko(x,L,P);return Ee(V,G),G}function g(V,x,L){return m(V,x,L,5)}function b(V,x,L,P,G){zr(P)&&(G=P,P=0),P=P||0,G=f(G,{stroke:d,strokeWidth:2,fill:s}),G.fill==="none"&&delete G.fillOpacity;const K=x/2,ne=L/2,pe=Se("circle");return ce(pe,{cx:K,cy:ne,r:Math.round((x+L)/4-P)}),ce(pe,G),Ee(V,pe),pe}function k(V,x,L,P,G,K){zr(G)&&(K=G,G=0),G=G||0,K=f(K,{stroke:d,strokeWidth:2,fill:s});const ne=Se("rect");return ce(ne,{x:G,y:G,width:x-G*2,height:L-G*2,rx:P,ry:P}),ce(ne,K),Ee(V,ne),ne}function v(V,x,L){L=f(L,["no-fill"],{strokeWidth:2,stroke:d});const P=Se("path");return ce(P,{d:x}),ce(P,L),Ee(V,P),P}function w(V,x,L,P){const G=x/2,K=L/2,pe=[{x:G,y:0},{x,y:K},{x:G,y:L},{x:0,y:K}].map(Y=>Y.x+","+Y.y).join(" ");P=f(P,{stroke:d,strokeWidth:2,fill:s});const fe=Se("polygon");return ce(fe,{points:pe}),ce(fe,P),Ee(V,fe),fe}function C(V,x,L,P){return v(x,L,Ke({"data-marker":V},P))}function S(V,x,L){L=Ke({size:{width:100}},L);const P=a.createText(x||"",L);return Ge(P).add("djs-label"),Ee(V,P),P}function y(V,x,L){const P=tm(x);return S(V,P.name,{box:x,align:L,padding:5,style:{fill:_e(x,d)}})}function E(V,x){const L={width:90,height:30,x:x.width/2+x.x,y:x.height/2+x.y};return S(V,wi(x),{box:L,fitBox:!0,style:Ke({},a.getExternalStyle(),{fill:_e(x,d)})})}function B(V,x,L){const P=L&&L.indexOf("SubProcessMarker")!==-1;let G;P?G={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:G={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},ph(L,K=>{u(K)(V,x,G)})}function _(V){return V.replace(/[^0-9a-zA-z]+/g,"_")}function T(V,x){const{ref:L={x:0,y:0},scale:P=1,element:G,parentGfx:K=i._svg}=x,ne=Se("marker",{id:V,viewBox:"0 0 20 20",refX:L.x,refY:L.y,markerWidth:20*P,markerHeight:20*P,orient:"auto"});Ee(ne,G);let pe=mn(":scope > defs",K);pe||(pe=Se("defs"),Ee(K,pe)),Ee(pe,ne)}function j(V,x,L,P){const G=x+"-"+_(L)+"-"+_(P)+"-"+Fr();return D(V,G,x,L,P),"url(#"+G+")"}function D(V,x,L,P,G){{const K=Se("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:G,stroke:G,strokeWidth:1})});T(x,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:V})}}function A(V,x,L,P){const G=c[x.type]?.icon||x.icon;if(G){const K=o.getScaledPath(G,{abspos:{x:L,y:P}});v(V,K,{strokeWidth:0,fill:_e(x,c[x.type]?.iconFill||x.iconFill)})}}const R={event(V,x,L){return"fillOpacity"in L||(L.fillOpacity=Bi),b(V,x.width,x.height,L)},startEvent(V,x){const L={fill:Xe(x,c.startEvent?.fill||x.fill),stroke:_e(x,c.startEvent?.stroke||x.stroke),strokeWidth:vo(x,c.startEvent?.strokeWidth||x.strokeWidth)},P=u("event")(V,x,L);return A(V,x,18,18),P},endEvent(V,x){const L=u("event")(V,x,{strokeWidth:vo(x,c.endEvent?.strokeWidth||x.strokeWidth||4),fill:Xe(x,c.endEvent?.fill||x.fill),stroke:_e(x,c.endEvent?.stroke||x.stroke)});return A(V,x,18,18),L},gateway(V,x){const L={fillOpacity:Bi,strokeWidth:vo(x,c[x.type]?.strokeWidth||x.strokeWidth||4),fill:Xe(x,c[x.type]?.fill||x.fill),stroke:_e(x,c[x.type]?.stroke||x.stroke)};return w(V,x.width,x.height,L)},gatewayAnd(V,x){const L=u("gateway")(V,x),P=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[x.type]?.width||x.width,containerHeight:c[x.type]?.height||x.height,position:{mx:.47,my:.29}});return v(V,P,{strokeWidth:1,fill:_e(x,c[x.type]?.iconFill||x.iconFill),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},gatewayXor(V,x){const L=u("gateway")(V,x),P=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:x.width,containerHeight:x.height,position:{mx:.32,my:.3}});return v(V,P,{strokeWidth:1,fill:_e(x,c[x.type]?.iconFill||x.iconFill),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},gatewayInclusive(V,x){const L=u("gateway")(V,x);return b(V,x.width,x.height,x.height*.24,{strokeWidth:2.5,fill:_e(x,s),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},activity(V,x,L){return L=L||{},"fillOpacity"in L||(L.fillOpacity=Bi),k(V,x.width,x.height,Si,L)},task(V,x){const L={fill:Xe(x,s),stroke:_e(x,d)},P=u("activity")(V,x,L);return y(V,x,"center-middle"),B(V,x),P},userTask(V,x){const L=u("task")(V,x),P=15,G=12,K=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:P,y:G}});v(V,K,{strokeWidth:.5,fill:Xe(x,s),stroke:_e(x,d)});const ne=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:P,y:G}});v(V,ne,{strokeWidth:.5,fill:Xe(x,s),stroke:_e(x,d)});const pe=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:P,y:G}});return v(V,pe,{strokeWidth:.5,fill:_e(x,d),stroke:_e(x,d)}),L},scriptTask(V,x){const L=u("task")(V,x),P=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(V,P,{strokeWidth:1,stroke:_e(x,d)}),L},SubProcessMarker(V,x){const L=k(V,14,14,0,{strokeWidth:1,fill:Xe(x,s),stroke:_e(x,d)});Zn(L,x.width/2-7.5,x.height-20);const P=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:x.width,containerHeight:x.height,position:{mx:(x.width/2-7.5)/x.width,my:(x.height-20)/x.height}});C("sub-process",V,P,{fill:Xe(x,s),stroke:_e(x,d)})},subprocess(V,x,L){L=Ke({fill:Xe(x,s),stroke:_e(x,d)},L);const P=u("activity")(V,x,L);return y(V,x,"center-middle"),B(V,x,["SubProcessMarker"]),P},label(V,x){return E(V,x)},myline(V,x){const L=Xe(x,l.lineStroke||s),P=_e(x,l.lineStroke||d);return g(V,x.waypoints,{markerEnd:j(V,"sequenceflow-end",L,P),stroke:P})},default(V,x){const L={strokeWidth:vo(x,c[x.type]?.strokeWidth||x.strokeWidth||1),fill:Xe(x,c[x.type]?.fill||x.fill),stroke:_e(x,c[x.type]?.stroke||x.stroke)},P=k(V,x.width,x.height,x.radius||Si,L);return y(V,x,"center-middle"),B(V,x),A(V,x,x.iconX,x.iconY),P}};this.handlers=R,this._drawPath=v}xn(It,at),It.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],It.prototype.canRender=function(){return!0},It.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},It.prototype.drawConnection=function(e,t){const{type:o}=t,i=this.handlers[o];return i(e,t)},It.prototype.getShapePath=function(e){return Vt(e,"startEvent")||Vt(e,"endEvent")?nm(e):Vt(e,"userTask")||Vt(e,"scriptTask")||Vt(e,"subprocess")?om(e,Si):Vt(e,"gatewayAnd")||Vt(e,"gatewayXor")||Vt(e,"gatewayInclusive")?im(e):am(e)};var lm=0,rm={width:150,height:50};function sm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function cm(e){return ht(e)?ie({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function dm(e,t){t.textContent=e;var o;try{var i,a=e==="";return t.textContent=a?"dummy":e,o=t.getBBox(),i={width:o.width+o.x*2,height:o.height},a&&(i.width=0),i}catch(l){return console.log(l),{width:0,height:0}}}function um(e,t,o){for(var i=e.shift(),a=i,l;;){if(l=dm(a,o),l.width=a?l.width:0,a===" "||a===""||l.width<Math.round(t)||a.length<2)return fm(e,a,i,l);a=hm(a,l.width,t)}}function fm(e,t,o,i){if(t.length<o.length){var a=o.slice(t.length).trim();e.unshift(a)}return{width:i.width,height:i.height,text:t}}var hs="";function pm(e,t){var o=e.split(/(\s|-|\u00AD)/g),i,a=[],l=0;if(o.length>1)for(;i=o.shift();)if(i.length+l<t)a.push(i),l+=i.length;else{(i==="-"||i===hs)&&a.pop();break}var r=a[a.length-1];return r&&r===hs&&(a[a.length-1]="-"),a.join("")}function hm(e,t,o){var i=Math.max(e.length*(o/t),1),a=pm(e,i);return a||(a=e.slice(0,Math.max(Math.round(i-1),1))),a}function mm(){var e=document.getElementById("helper-svg");return e||(e=Se("svg"),ce(e,{id:"helper-svg"}),Bl(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Co(e){this._config=ie({},{size:rm,padding:lm,style:{},align:"center-top"},e||{})}Co.prototype.createText=function(e,t){return this.layoutText(e,t).element},Co.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Co.prototype.layoutText=function(e,t){var o=ie({},this._config.size,t.box),i=ie({},this._config.style,t.style),a=sm(t.align||this._config.align),l=cm(t.padding!==void 0?t.padding:this._config.padding),r=t.fitBox||!1,s=gm(i),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-l.left-l.right,u=Se("text");ce(u,{x:0,y:0}),ce(u,i);var p=mm();for(Ee(p,u);d.length;)c.push(um(d,f,u));a.vertical==="middle"&&(l.top=l.bottom=0);var h=en(c,function(v,w,C){return v+(s||w.height)},0)+l.top+l.bottom,m=en(c,function(v,w,C){return w.width>v?w.width:v},0),g=l.top;a.vertical==="middle"&&(g+=(o.height-h)/2),g-=(s||c[0].height)/4;var b=Se("text");ce(b,i),Z(c,function(v){var w;switch(g+=s||v.height,a.horizontal){case"left":w=l.left;break;case"right":w=(r?m:f)-l.right-v.width;break;default:w=Math.max(((r?m:f)-v.width)/2+l.left,0)}var C=Se("tspan");ce(C,{x:w,y:g}),C.textContent=v.text,Ee(b,C)}),Lt(u);var k={width:m,height:h};return{dimensions:k,element:b}};function gm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const ym=12,bm=1.2,wm=30;function ms(e){const t=Ke({fontFamily:"Arial, sans-serif",fontSize:ym,fontWeight:"normal",lineHeight:bm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,i=Ke({},t,{fontSize:o},e&&e.externalStyle||{}),a=new Co({style:t});this.getExternalLabelBounds=function(l,r){const s=a.getDimensions(r,{box:{width:90,height:30,x:l.width/2+l.x,y:l.height/2+l.y},style:i});return{x:Math.round(l.x+l.width/2-s.width/2),y:Math.round(l.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(l,r){const s=a.getDimensions(r,{box:l,style:t,align:"left-top",padding:5});return{x:l.x,y:l.y,width:l.width,height:Math.max(wm,Math.round(s.height))}},this.createText=function(l,r){return a.createText(l,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ms.$inject=["config.textRenderer"];function vm(){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 i,a;o.abspos?(i=o.abspos.x,a=o.abspos.y):(i=o.containerWidth*o.position.mx,a=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&&(i-=l.width/2),l.height&&(a-=l.height/2)):l=this.pathMap[t];const r={};if(o.position){const d=o.containerHeight/l.height*o.yScaleFactor,c=o.containerWidth/l.width*o.xScaleFactor;for(let f=0;f<l.heightElements.length;f++)r["y"+f]=l.heightElements[f]*d;for(let f=0;f<l.widthElements.length;f++)r["x"+f]=l.widthElements[f]*c}return Sm(l.d,{mx:i,my:a,e:r})}}const Cm=/\{([^}]+)\}/g,km=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function xm(e,t,o){let i=o;return t.replace(km,(a,l,r,s,d)=>{l=l||s,i&&(l in i&&(i=i[l]),typeof i=="function"&&d&&(i=i()))}),i=(i==null||i===o?e:i)+"",i}function Sm(e,t){return String(e).replace(Cm,(o,i)=>xm(o,i,t))}const Bm={__init__:["myRenderer"],myRenderer:["type",It],textRenderer:["type",ms],pathMap:["type",vm]};function gs(e,t){return Ke({id:e.id,type:e.type,businessObject:e},t)}function Em(e,t,o){const i=e.waypoint;return!i||i.length<2?[tt(t),tt(o)]:i.map(a=>({x:a.x,y:a.y}))}function Tt(e,t,o,i,a,l){this._eventBus=e,this._canvas=o,this._elementFactory=i,this._elementRegistry=a,this._translate=Ir,this._textRenderer=l,this._modeling=t}Tt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Tt.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 i=this._getSource(e),a=this._getTarget(e);t=this._elementFactory.createConnection(gs(e,{source:i,target:a,waypoints:Em(e,i,a)})),this._canvas.addConnection(t)}else{const i=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(gs(e,{x:Math.round(e.x),y:Math.round(e.y),width:i.width,height:i.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Tt.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)},Tt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ke(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 i=this._elementRegistry.get(e+"_label");if(i)i.businessObject=o.businessObject,this._canvas.removeShape(i),this._canvas.addShape(i,o.parent);else{const{name:a}=t;if(a&&["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:a,id:e},r=this._textRenderer.getExternalLabelBounds(l,t.name);this._modeling.resizeShape(l,r,{width:0,height:0}),o&&this.addLabel(l,o)}}},Tt.prototype._getSource=function(e){return this._getElement(e.from)},Tt.prototype._getTarget=function(e){return this._getElement(e.to)},Tt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const _m={myImporter:["type",Tt]},jm=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const i=o.businessObject;if(o.type==="myline")o.source&&o.target&&(i.from=o.source.id,i.to=o.target.id,i.waypoint=o.waypoints.map(a=>({x:a.x,y:a.y})),t.push(i));else if(o.type!=="label")i.x=o.x,i.y=o.y,t.push(i);else{const a=t.find(l=>l.id===i.id);a&&(a.name=i.name||"",a.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Vm=(e,t)=>{const o=t.get("myImporter"),i=e.filter(l=>l.type!=="myline"),a=e.filter(l=>l.type==="myline");i.forEach(l=>{o.add(l)}),a.forEach(l=>{o.add(l)})},ys=te(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 i=e,a=o,l=n.ref(),r={"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",E=>{a("elementDblclick",E.element.businessObject)}),y.on("element.click",E=>{a("elementClick",E.element.businessObject)})},u=function(){return{palette:i.paletteOptions||r,lineStroke:i.lineStroke}},p=()=>{let y={__init__:["myOptions"],myOptions:["type",u]};s=new Cn({canvas:{container:l.value},modules:[Qp,Kp,em,nh,rh,y,Bm,_m]});const E=s.get("canvas"),B=s.get("elementFactory");c();const _=B.createRoot();E.setRootElement(_),f()};n.onMounted(()=>{p()});const h=y=>{const E=y==null?1:d+y;s.get("canvas").zoom(E),d=E},m=()=>{s.get("canvas").zoom(1);const y=s.get("elementRegistry").getAll();var E=jm(y);return E},g=y=>{s.clear(),c(),Vm(y,s)},b=y=>{s.get("myImporter").update(y.id,y)};return t({reset:()=>{c()},zoom:y=>{h(y)},getData:()=>m(),setData:y=>{g(y)},updateElemet:y=>{b(y)}}),(y,E)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:l,class:"lr-work-flow"},null,512))}})),Tm=[Li,na,oa,ia,aa,la,ra,sa,ca,da,ua,ma,ga,ya,ba,wa,va,Ca,ka,xa,Ba,_a,ja,Oa,Va,Ta,Na,$a,Ma,La,Pa,Ra,Aa,Za,Qa,el,tl,nl,ol,il,Fa,Ga,Xa,al,ll,rl,sl,cl,dl,Fu,ys],Nm={install:e=>{Tm.forEach(t=>{e.component(t.name,t)})}};M.EncryptionFactory=Qi,M.HashingFactory=nc,M.JAutoComplete=da,M.JBarcode=ja,M.JButton=Li,M.JButtonSelect=Za,M.JButtons=na,M.JCascaderSelect=ra,M.JCheckbox=sa,M.JCodeMirror=Oa,M.JCollapse=cl,M.JComp=el,M.JCount=Va,M.JCountUp=Ta,M.JDataPanel=Na,M.JDialog=ga,M.JDialogFull=ya,M.JDivider=$a,M.JDrawer=ba,M.JDynamicLayer=va,M.JEcharts=_a,M.JEditor=dl,M.JForm=tl,M.JFormItem=nl,M.JGuid=il,M.JHpanel=Ma,M.JIcon=ia,M.JInput=oa,M.JInputButton=La,M.JInputCode=Pa,M.JInputColor=Ra,M.JInputRows=al,M.JInputTag=Ca,M.JLayer=wa,M.JLayerForm=ll,M.JLayout=ua,M.JMenu=Ga,M.JNumber=ca,M.JPage=ol,M.JRadio=aa,M.JRate=ka,M.JSelect=la,M.JSlider=xa,M.JSliderCaptcha=Fa,M.JSwitch=rl,M.JTable=ma,M.JTablePanel=Xa,M.JTabs=sl,M.JTitle=Aa,M.JTree=Qa,M.JUpload=Ba,M.JWorkflowViewer=ys,M.buildShortUUID=Pn,M.buildUUID=dn,M.clearJson=cn,M.clone=Ln,M.deepClone=pt,M.default=Nm,M.formatToDate=pn,M.formatToDateTime=qi,M.fullScreenLoading=Ht,M.getCompConfig=$t,M.getCompType=No,M.getFunction=Vo,M.getIsInputComp=Rn,M.getIsTableInputComp=Ji,M.getLabel=Yi,M.getObjType=Pi,M.getTextWidth=fn,M.is=Mi,M.isArray=Mn,M.isNullOrEmpty=it,M.isObject=Ds,M.loadBMap=ta,M.lowerFirst=qs,M.myAesDecrypt=oc,M.numberToChinese=Ai,M.numberToThousandSeparator=Oi,M.pagination=Us,M.paginationEx=Js,M.set=Ri,M.setGroupMap=Ii,M.toArray=Di,M.toDecimal=un,M.toLeafArray=Ui,M.toSimpleTree=Ks,M.toTree=Gs,M.uniqueArray=Ys,M.upFirst=Fi,M.useSortable=ea,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
16
|
+
getCompValue)=>{ return ${E} }`;let B;const _=Vo(E);if(_.res)try{B=_.fn(i,a,l,r,s,d,c,f,u,p,h,m,g,b,w)}catch(T){console.log(T,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(B)?"":(o.decimal!==void 0&&(B=B.toFixed(o.decimal)),B)}),S=n.computed(()=>{let y=C.value;return o.thousandSeparator&&(y=Oi(y)),o.isChinese&&(y=Ai(y)),y});return n.watch(C,y=>{k("update:modelValue",y),k("change",{value:y,data:S.value})}),(y,E)=>{const B=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(B,{modelValue:S.value,"onUpdate:modelValue":E[0]||(E[0]=_=>S.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),hd={key:0},Ta=te(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,i=n.computed(()=>({...o})),a=n.ref(),l=n.ref(null),r=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&s()}),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}),n.watch(()=>o.endValue,p=>{l.value&&l.value.update&&l.value.update(p)});const s=()=>{l.value||(r.value.startVal=o.startValue,r.value.decimalPlaces=o.decimals,r.value.duration=o.duration,l.value=new Vs.CountUp(a.value,Number(o.endValue),r.value),l.value.start(()=>{o.callback?.(l.value)}))};return n.onUnmounted(()=>{l.value=null}),n.onBeforeUnmount(()=>{l.value=null}),t({myProps:i,el:a,init:s,start:p=>{l.value&&l.value.start&&l.value.start(()=>{p?.(l.value)})},pauseResume:()=>{l.value&&l.value.pauseResume&&l.value.pauseResume()},reset:()=>{l.value&&l.value.reset&&l.value.reset()},update:p=>{l.value&&l.value.update&&l.value.update(p)}}),(p,h)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:a},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",hd,n.toDisplayString(e.endValue),1))],512))}})),md={class:"j-block j-data-panel"},gd={key:0,class:"j-data-panel-header"},yd={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},bd={class:"j-data-panel-header-right"},wd={class:"j-data-panel-body"},Na=te(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",md,[e.title?(n.openBlock(),n.createElementBlock("div",gd,[n.createElementVNode("div",yd,n.toDisplayString(e.title),1),n.createElementVNode("div",bd,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",wd,[n.renderSlot(t.$slots,"default")])]))}})),vd={class:"j-divider-content"},$a=te(n.defineComponent({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=n.computed(()=>{const a={color:t.color};return t.size&&Number(t.size)&&(a.fontSize=`${t.size}px`),a}),i=n.computed(()=>({borderTopStyle:t.borderStyle}));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(`j-divider-container j-divider-${e.contentPosition}`),style:n.normalizeStyle(o.value)},[n.createElementVNode("div",{class:"j-divider-line j-divider-line-left",style:n.normalizeStyle(i.value)},null,4),n.createElementVNode("div",vd,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(i.value)},null,4)],6))}})),Cd={class:"j-hpanel"},kd={class:"j-hpanel-main"},Ma=te(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",Cd,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",kd,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),La=te(n.defineComponent({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},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,i=t,a=n.ref(),l=n.ref(),r=async(f,u)=>{o.ok&&(f("保存数据中..."),l.value=await o.ok(),i("update:modelValue",l.value),i("change",{value:l.value}),u(),a.value.close())},s=()=>o.beforeClose?o.beforeClose(l.value):!0,d=()=>{o.closed?.()},c=()=>{a.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(l.value)},200)};return n.watch(()=>o.modelValue,f=>{l.value=f},{immediate:!0}),(f,u)=>{const p=n.resolveComponent("j-button"),h=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(p,n.mergeProps({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:c}),null,16,["type","label","size"]),n.createVNode(h,{ref_key:"layerRef",ref:a,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:r,onClosed:d},{default:n.withCtx(()=>[n.renderSlot(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Pa=te(n.defineComponent({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},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,i=t,a=n.computed({get:()=>o.modelValue,set:u=>{i("update:modelValue",u)}}),l=n.ref(""),r=u=>{l.value=u},s=()=>l.value,d=u=>o.beforeClose?o.beforeClose(u):!0,c=u=>{i("change",u)},f=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(u,p)=>{const h=n.resolveComponent("j-code-mirror"),m=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{modelValue:a.value,"onUpdate:modelValue":p[1]||(p[1]=b=>a.value=b),type:e.type,"btn-text":f.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":d,ok:s,open:r,onChange:c},{default:n.withCtx(()=>[n.createVNode(m,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(h,{value:l.value,"onUpdate:value":p[0]||(p[0]=b=>l.value=b),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["value","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:n.withCtx(()=>[n.createVNode(h,{value:e.example,mode:e.mode,"read-only":""},null,8,["value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","width","height"])}}})),Ra=te(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 i=e,a=o,l=n.ref(),r=n.ref(),s=n.computed({get(){return i.modelValue===null||i.modelValue===void 0?r.value:i.modelValue},set(g){r.value=g,a("update:modelValue",g),a("input",g)}}),d=g=>{a("input",g)},c=g=>{a("focus",g)},f=g=>{a("blur",g)},u=()=>{a("clear"),a("update:modelValue","")},p=g=>{a("change",g)},h=g=>{a("color-change",g)},m=g=>{a("active-change",g)};return t({focus:()=>{l.value?.focus()},blur:()=>{l.value?.blur()},select:()=>{l.value?.select()}}),(g,b)=>{const k=n.resolveComponent("el-color-picker"),v=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled}])},[n.createVNode(v,n.mergeProps({placeholder:e.placeholder,modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=w=>s.value=w),size:e.size,ref_key:"inputRef",ref:l,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},g.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:u,onChange:p}),{[e.inputType]:n.withCtx(()=>[n.createVNode(k,{size:e.size,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=w=>s.value=w),disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:m},null,8,["size","modelValue","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["placeholder","modelValue","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}})),Aa=te(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"}},setup(e){const t=e,o=n.computed(()=>t.class||""),i=n.computed(()=>{const a={...t.style};return t.color&&(a.color=t.color),t.size&&(typeof t.size=="number"?a.fontSize=`${t.size}px`:a.fontSize=t.size),t.weight&&(a.fontWeight=t.weight),a});return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(i.value)},n.toDisplayString(e.title),7))}})),Oa=te(n.defineComponent({name:"JCodeMirror",__name:"code-mirror",props:{value:{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:value","change"],setup(e,{expose:t,emit:o}){const i=e,a=o,l=n.ref(),r=n.ref("");let s=null;const d=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return zt.javascript();case"css":case"text/css":return $s.css();case"html":case"text/html":return Ms.html();case"json":case"application/json":return Ls.json();case"sql":case"text/x-sql":return Ps.sql();case"xml":case"text/xml":return Rs.xml();case"python":case"text/x-python":return As.python();case"markdown":case"text/markdown":return Os.markdown();case"java":case"text/x-java":return Fs.java();case"vue":case"text/x-vue":return zt.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return zt.javascript({jsx:!1,typescript:!0});case"jsx":return zt.javascript({jsx:!0,typescript:!1});case"tsx":return zt.javascript({jsx:!0,typescript:!0});default:return zt.javascript()}},c=()=>{const g=[Ns.basicSetup,Ze.lineNumbers(),Ze.highlightActiveLineGutter(),Ze.highlightSpecialChars(),Eo.history(),Ze.drawSelection(),Ze.dropCursor(),Dt.indentOnInput(),Dt.bracketMatching(),Bo.closeBrackets(),Ze.rectangularSelection(),Dt.foldGutter(),Ze.keymap.of([...Bo.closeBracketsKeymap,...Eo.defaultKeymap,...Eo.historyKeymap,...Dt.foldKeymap]),Dt.syntaxHighlighting(Dt.defaultHighlightStyle)];return g.push(d(i.mode)),i.readonly&&g.push(So.EditorState.readOnly.of(!0)),i.isHint&&i.handleHint&&g.push(Bo.autocompletion({override:[b=>{const k=b.matchBefore(/\w*/);if(!k||k.from===k.to)return null;const v=i.handleHint(k.text);return v.length===0?null:{from:k.from,options:v.map(w=>({label:typeof w=="string"?w:w.label||w.name||"",detail:typeof w=="string"?"":w.detail||"",type:typeof w=="string"?"variable":w.type||"variable",apply:typeof w=="string"?w:w.apply||w.name||w.label||""}))}}]})),g.push(Ze.EditorView.updateListener.of(b=>{if(b.docChanged){const k=b.state.doc.toString();r.value=k,a("update:value",k),a("change",{value:k})}})),g},f=async()=>{if(!l.value)return;const g=So.EditorState.create({doc:i.value,extensions:c()});s=new Ze.EditorView({state:g,parent:l.value}),r.value=i.value},u=()=>{if(!s)return;const g=s.state.doc.toString();s&&s.destroy();const b=So.EditorState.create({doc:g,extensions:c()});l.value&&(s=new Ze.EditorView({state:b,parent:l.value}));const k=s.state.doc.toString();k!==i.value&&s.dispatch({changes:{from:0,to:k.length,insert:i.value}})},p=()=>{if(!s)return;const g=s.state.doc.length;s.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(s){const b=s.state.doc.length;s.dispatch({selection:{anchor:b,head:b},scrollIntoView:!0})}},100)},h=()=>{let g=Ts.format(i.value);g=g.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),a("update:value",g),a("change",{value:g})};let m=null;return n.watch(()=>i.value,g=>{g!==r.value&&(r.value=g,s&&u(),setTimeout(()=>{s&&i.isScrollToBottom&&p()}))}),n.watch(()=>i.mode,()=>{s&&u()}),n.onMounted(async()=>{await n.nextTick(),await f(),typeof window<"u"&&window.ResizeObserver&&l.value&&(m=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),m.observe(l.value))}),n.onUnmounted(()=>{m&&l.value&&(m.unobserve(l.value),m.disconnect(),m=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(g,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:l,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),xd=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,i=n.useTemplateRef("actionRef"),a=n.ref("0"),l=n.computed(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":a.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:r.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),r=n.computed(()=>Number.parseInt(a.value)>10&&!o.isPassing);return t({getEl:()=>i.value,getStyle:()=>i?.value?.style,setLeft:s=>{a.value=s}}),(s,d)=>{const c=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:i,style:n.normalizeStyle(l.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),Sd=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,i=n.useTemplateRef("barRef"),a=n.ref("0"),l=n.computed(()=>{const{barStyle:r,toLeft:s}=o;return{...r,width:s?"0":a.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:()=>i.value,setWidth:r=>{a.value=r}}),(r,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:i,style:n.normalizeStyle(l.value)},null,4))}}),Bd=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,i=n.useTemplateRef("contentRef"),a=n.computed(()=>{const{contentStyle:r}=o;return{...r,fontSize:"12px"}});t({getEl:()=>i.value});const l=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(r,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:i,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(a.value)},[n.createElementVNode("div",{style:n.normalizeStyle(l.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Fa=te(n.defineComponent({name:"JSliderCaptcha",__name:"slider-captcha",props:n.mergeModels({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:n.mergeModels(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,i=t,a=n.useModel(e,"modelValue"),l=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),r=n.useTemplateRef("wrapperRef"),s=n.useTemplateRef("barRef"),d=n.useTemplateRef("contentRef"),c=n.useTemplateRef("actionRef");n.watch(()=>l.isPassing,k=>{if(k){const{endTime:v,startTime:w}=l,C=(v-w)/1e3;i("success",{isPassing:k,time:C.toFixed(1)}),a.value=k}}),n.watchEffect(()=>{l.isPassing=!!a.value});function f(k){return"pageX"in k?k.pageX:"touches"in k&&k.touches[0]?k.touches[0].pageX:0}function u(k){l.isPassing||c.value&&(i("start",k),l.moveDistance=f(k)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),l.startTime=Date.now(),l.isMoving=!0)}function p(k){const v=r.value?.offsetWidth??220,w=k?.offsetWidth??40,C=v-w-6;return{actionWidth:w,offset:C,wrapperWidth:v}}function h(k){const{isMoving:v,moveDistance:w}=l;if(v){const C=n.unref(c),S=n.unref(s);if(!C||!S)return;const{actionWidth:y,offset:E,wrapperWidth:B}=p(C.getEl()),_=f(k)-w;i("move",{event:k,moveDistance:w,moveX:_}),_>0&&_<=E?(C.setLeft(`${_}px`),S.setWidth(`${_+y/2}px`)):_>E&&(C.setLeft(`${B-y}px`),S.setWidth(`${B-y/2}px`),g())}}function m(k){const{isMoving:v,isPassing:w,moveDistance:C}=l;if(v&&!w){i("end",k);const S=c.value,y=n.unref(s);if(!S||!y)return;const E=f(k)-C,{actionWidth:B,offset:_,wrapperWidth:T}=p(S.getEl());E<_?b():(S.setLeft(`${T-B}px`),y.setWidth(`${T-B/2}px`),g()),l.isMoving=!1}}function g(){l.endTime=Date.now(),l.isPassing=!0,l.isMoving=!1}function b(){l.isMoving=!1,l.isPassing=!1,l.moveDistance=0,l.toLeft=!1,l.startTime=0,l.endTime=0;const k=n.unref(c),v=n.unref(s),w=n.unref(d);!k||!v||!w||(w.getEl().style.width="100%",l.toLeft=!0,setTimeout(()=>{l.toLeft=!1,k.setLeft("0"),v.setWidth("0")},300))}return(k,v)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:r,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:m,onMousemove:h,onMouseup:m,onTouchend:m,onTouchmove:h},[n.createVNode(Sd,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":l.toLeft},null,8,["bar-style","to-left"]),n.createVNode(Bd,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":l.isPassing},null,8,["content-style","is-passing"]),n.createVNode(xd,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":l.isPassing,"to-left":l.toLeft,onMousedown:u,onTouchstart:u},null,8,["action-style","is-passing","to-left"])],38))}}));function Ed(e,t){return n.getCurrentScope()?(n.onScopeDispose(e,t),!0):!1}const _d=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function jd(e){return Array.isArray(e)?e:[e]}function Vd(e){return n.getCurrentInstance()}function Td(e,t=!0,o){Vd()?n.onMounted(e,o):t?e():n.nextTick(e)}const Ia=_d?window:void 0;function Xt(e){var t;const o=n.toValue(e);return(t=o?.$el)!==null&&t!==void 0?t:o}function Nd(){const e=n.shallowRef(!1),t=n.getCurrentInstance();return t&&n.onMounted(()=>{e.value=!0},t),e}function $d(e){const t=Nd();return n.computed(()=>(t.value,!!e()))}function Md(e,t,o={}){const{window:i=Ia,...a}=o;let l;const r=$d(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},d=n.watch(n.computed(()=>{const f=n.toValue(e);return Array.isArray(f)?f.map(u=>Xt(u)):[Xt(f)]}),f=>{if(s(),r.value&&i){l=new ResizeObserver(t);for(const u of f)u&&l.observe(u,a)}},{immediate:!0,flush:"post"}),c=()=>{s(),d()};return Ed(c),{isSupported:r,stop:c}}function Ld(e,t={width:0,height:0},o={}){const{window:i=Ia,box:a="content-box"}=o,l=n.computed(()=>{var u;return(u=Xt(e))===null||u===void 0||(u=u.namespaceURI)===null||u===void 0?void 0:u.includes("svg")}),r=n.shallowRef(t.width),s=n.shallowRef(t.height),{stop:d}=Md(e,([u])=>{const p=a==="border-box"?u.borderBoxSize:a==="content-box"?u.contentBoxSize:u.devicePixelContentBoxSize;if(i&&l.value){const h=Xt(e);if(h){const m=h.getBoundingClientRect();r.value=m.width,s.value=m.height}}else if(p){const h=jd(p);r.value=h.reduce((m,{inlineSize:g})=>m+g,0),s.value=h.reduce((m,{blockSize:g})=>m+g,0)}else r.value=u.contentRect.width,s.value=u.contentRect.height},o);Td(()=>{const u=Xt(e);u&&(r.value="offsetWidth"in u?u.offsetWidth:t.width,s.value="offsetHeight"in u?u.offsetHeight:t.height)});const c=n.watch(()=>Xt(e),u=>{r.value=u?t.width:0,s.value=u?t.height:0});function f(){d(),c()}return{width:r,height:s,stop:f}}function Lo(e,t){const{containerStyle:o,wrapperProps:i,scrollTo:a,calculateRange:l,currentList:r,containerRef:s}="itemHeight"in t?Ad(t,e):Rd(t,e);return{list:r,scrollTo:a,containerProps:{ref:s,onScroll:()=>{l()},style:o},wrapperProps:i}}function za(e){const t=n.shallowRef(null),o=Ld(t),i=n.ref([]),a=n.shallowRef(e);return{state:n.ref({start:0,end:10}),source:a,currentList:i,size:o,containerRef:t}}function Da(e,t,o){return i=>{if(typeof o=="number")return Math.ceil(i/o);const{start:a=0}=e.value;let l=0,r=0;for(let s=a;s<t.value.length;s++){const d=o(s);if(l+=d,r=s,l>i)break}return r-a}}function Ha(e,t){return o=>{if(typeof t=="number")return Math.floor(o/t)+1;let i=0,a=0;for(let l=0;l<e.value.length;l++){const r=t(l);if(i+=r,i>=o){a=l;break}}return a+1}}function Wa(e,t,o,i,{containerRef:a,state:l,currentList:r,source:s}){return()=>{const d=a.value;if(d){const c=o(e==="vertical"?d.scrollTop:d.scrollLeft),f=i(e==="vertical"?d.clientHeight:d.clientWidth),u=c-t,p=c+f+t;l.value={start:u<0?0:u,end:p>s.value.length?s.value.length:p},r.value=s.value.slice(l.value.start,l.value.end).map((h,m)=>({data:h,index:m+l.value.start}))}}}function Ua(e,t){return o=>typeof e=="number"?o*e:t.value.slice(0,o).reduce((i,a,l)=>i+e(l),0)}function Ja(e,t,o,i){n.watch([e.width,e.height,()=>n.toValue(t),o],()=>{i()})}function Ya(e,t){return n.computed(()=>typeof e=="number"?t.value.length*e:t.value.reduce((o,i,a)=>o+e(a),0))}const Pd={horizontal:"scrollLeft",vertical:"scrollTop"};function qa(e,t,o,i){return a=>{i.value&&(i.value[Pd[e]]=o(a),t())}}function Rd(e,t){const o=za(t),{state:i,source:a,currentList:l,size:r,containerRef:s}=o,d={overflowX:"auto"},{itemWidth:c,overscan:f=5}=e,u=Da(i,a,c),p=Wa("horizontal",f,Ha(a,c),u,o),h=Ua(c,a),m=n.computed(()=>h(i.value.start)),g=Ya(c,a);return Ja(r,t,s,p),{scrollTo:qa("horizontal",p,h,s),calculateRange:p,wrapperProps:n.computed(()=>({style:{height:"100%",width:`${g.value-m.value}px`,marginLeft:`${m.value}px`,display:"flex"}})),containerStyle:d,currentList:l,containerRef:s}}function Ad(e,t){const o=za(t),{state:i,source:a,currentList:l,size:r,containerRef:s}=o,d={overflowY:"auto"},{itemHeight:c,overscan:f=5}=e,u=Da(i,a,c),p=Wa("vertical",f,Ha(a,c),u,o),h=Ua(c,a),m=n.computed(()=>h(i.value.start)),g=Ya(c,a);return Ja(r,t,s,p),{calculateRange:p,scrollTo:qa("vertical",p,h,s),containerStyle:d,wrapperProps:n.computed(()=>({style:{width:"100%",height:`${g.value-m.value}px`,marginTop:`${m.value}px`}})),currentList:l,containerRef:s}}const Od=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{getMenuMap:a,toArray:l,activeMenu:r,theme:s}=On(),{getHMoreMenus:d}=gc(),c=n.ref([]);o.pId==="moreId"?c.value=d.value:c.value=l(a()[o.pId||""]||[],[]);const f=m=>{const g=c.value.find(b=>b.active);g?.value!==m.value&&(g&&(g.active=!1),i("click",m))},{list:u,containerProps:p,wrapperProps:h}=Lo(c,{itemHeight:44});return(m,g)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-sub-menu-content",{"j-menu-dark":n.unref(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},n.unref(p)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),b=>(n.openBlock(),n.createBlock(In,{key:b.data.value,"parent-actives":n.unref(r)?.pid?.split(".")||[],item:b.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),Fd={class:"j-menu-item-label"},Id={class:"j-menu-item-label"},zd={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},Dd={class:"j-menu-item-label"},In=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}=Pe(),i=t,a=l=>{i("click",l)};return(l,r)=>{const s=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),c=n.resolveComponent("el-popover");return e.collapsed&&!e.item.hasChildren?(n.openBlock(),n.createBlock(d,{key:0,placement:"right"},{content:n.withCtx(()=>[n.createElementVNode("span",null,n.toDisplayString(n.unref(o)(e.item.label)),1)]),default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}]),onClick:r[0]||(r[0]=n.withModifiers(f=>a(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",Fd,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?(n.openBlock(),n.createBlock(c,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,"popper-class":"j-sub-menu"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,style: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"])):n.createCommentVNode("",!0),n.createElementVNode("div",Id,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",zd)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(Od,{"p-id":e.item.value,onClick:a},null,8,["p-id"])]),_:1},8,["placement"])):(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:r[1]||(r[1]=n.withModifiers(f=>a(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.active,"p-active":e.parentActives.includes(e.item.value)}]),style:n.normalizeStyle({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?(n.openBlock(),n.createBlock(s,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style: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"])):n.createCommentVNode("",!0),n.createElementVNode("div",Dd,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["j-menu-item-arrow",{open:e.item.open}])},null,2)):n.createCommentVNode("",!0)],6)],2))}}}),Hd=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=u=>{i("click",u)},s=n.computed(()=>o.menuList),{list:d,containerProps:c,wrapperProps:f}=Lo(s,{itemHeight:44});return(u,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(l)==="dark"}]},n.unref(c)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(f))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(d),h=>(n.openBlock(),n.createBlock(In,{key:h.data.value,"parent-actives":n.unref(a)?.pid?.split(".")||[],item:h.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":h.data.entering,"menu-item-leaving":h.data.leaving}),onClick:r},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),Wd=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=n.ref(),s=n.ref(0);let d=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&r.value&&(d=new ResizeObserver(()=>{r.value&&(s.value=r.value.offsetWidth)}),d.observe(r.value))});const c=n.computed(()=>{const h=[];let m=0,g=0;const b=o.menuList.length;return o.menuList.forEach(k=>{g++;const v=(fn(k.label)||0)+32+16+4+8;m+=v,(g===b&&m<=s.value||g<b&&m+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=n.computed(()=>{const h=[];let m=0;const g=c.value.length;return o.menuList.forEach(b=>{m++,m>=g&&h.push(b)}),h}),u=n.computed(()=>{const h=a.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(m=>m.value===h[1])>-1||f.value.findIndex(m=>m.value===a.value?.value)>-1)&&h.push("moreId"),h}),p=h=>{i("click",h)};return yc({getHMoreMenus:f}),n.onUnmounted(()=>{d&&r.value&&(d.unobserve(r.value),d.disconnect(),d=null)}),(h,m)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:r,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(l)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,g=>(n.openBlock(),n.createBlock(In,{key:g.value,"parent-actives":u.value,item:g,"is-horizontal":"",onClick:p},null,8,["parent-actives","item"]))),128))],2))}}),Ud=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,i=t,{activeMenu:a,theme:l}=On(),r=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=n.computed(()=>(o.menuList.forEach((h,m)=>{h.color=r[m%r.length]}),o.menuList)),d=n.computed(()=>a.value?.pid?.split(".")||[]),c=h=>{i("click",h)},{list:f,containerProps:u,wrapperProps:p}=Lo(s,{itemHeight:96});return(h,m)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(l)==="dark"}]},n.unref(u)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(p))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),g=>(n.openBlock(),n.createBlock(In,{key:g.data.value,"parent-actives":d.value,item:g.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),Ga=te(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,i=t;let a={};const l=n.ref("");l.value=o.activeId||"";const r=(g,b,k,v,w)=>{k=k||[];for(let C=0,S=k.length;C<S;C++){const y=k[C],E={};E.pid=b,E.indent=v,l.value===y.value&&(E.active=!0),Object.keys(y).forEach(_=>{_!=="children"&&(E[_]=y[_])}),w&&w.includes(y.value)&&(E.open=!0),g.push(E);const B=y.children||[];B.length>0&&(E.hasChildren=!0,w||(a[E.value]=B),(!w||E.open&&!o.collapsed)&&r(g,`${b}.${E.value}`,B,v+1,w))}},s=(g,b)=>{const k=[];return r(k,"0",g,0,b),k},d=n.ref([]);let c=[];const f=()=>{a={},c=s(o.menus);const g=[];if(l.value&&o.mode==="inline"){const b=c.find(k=>k.value===l.value);b&&g.push(...b.pid.split("."))}d.value=s(o.menus,g),console.log("showMenuList",d.value)};n.watch(()=>o.menus,()=>{f()},{immediate:!0}),n.watch(()=>o.mode,()=>{f()});const u=()=>{if(d.value.find(b=>b.active)?.value!==l.value){const b=c.find(k=>k.value===l.value);if(b){const k=[];o.mode==="inline"&&k.push(...b.pid.split(".")),d.value=s(o.menus,k)}}},p=n.computed(()=>c.find(g=>g.value===l.value));n.watch(()=>o.activeId,()=>{l.value=o.activeId||"",u()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const g=[];if(l.value){const b=c.find(k=>k.value===l.value);b&&g.push(...b.pid.split("."))}d.value=s(o.menus,g)}});const h=n.computed(()=>o.theme),m=g=>{if(g.hasChildren){if(o.collapsed)return;const b=[];b.push(...g.pid.split(".")),g.open||b.push(g.value);const k=s(o.menus,b),v=new Set(d.value.map(C=>C.value)),w=new Set(k.map(C=>C.value));k.forEach(C=>{v.has(C.value)||(C.entering=!0)}),d.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),d.value=k,setTimeout(()=>{d.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{const b=d.value.find(k=>k.active);if(b?.value===g.value)return;b&&(b.active=!1),g.active=!0,l.value=g.value,i("click",g)}};return mc({getMenuMap:()=>a,toArray:s,activeMenu:p,theme:h}),(g,b)=>e.mode==="inline"?(n.openBlock(),n.createBlock(Hd,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:m},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(Wd,{key:1,"menu-list":d.value,onClick:m},null,8,["menu-list"])):(n.openBlock(),n.createBlock(Ud,{key:2,"menu-list":d.value,onClick:m},null,8,["menu-list"]))}})),Jd={class:"j-keyword-panel"},Yd={key:0},qd={key:1,class:"columns-wrapper"},Gd=n.defineComponent({name:"JKeywordPanel",__name:"keyword-panel",props: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}=Pe(),i=e,a=n.useModel(e,"checkAll"),l=n.useModel(e,"checkFields"),r=n.ref(!1),s=n.ref(""),d=n.computed(()=>i.columns.filter(p=>p.config?.filter?.isSearchKeyword?s.value?p.config?.label?.indexOf(s.value)!=-1:!0:!1).map(p=>({label:p.config?.label,value:p.id}))),c=()=>{a.value||(a.value=!0,r.value=!1,l.value=[])},f=p=>{p.length>0?a.value=!1:a.value=!0};return t({init:()=>{a.value?r.value=!1:r.value=!0}}),(p,h)=>{const m=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),b=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",Jd,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:a.value}]),onClick:c},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),a.value?(n.openBlock(),n.createBlock(m,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:h[0]||(h[0]=k=>r.value=!r.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(m,{icon:r.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),r.value?(n.openBlock(),n.createElementBlock("div",Yd,[n.createVNode(g,{class:"no-border background",modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=k=>s.value=k),modelModifiers:{trim:!0},placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(m,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),r.value?(n.openBlock(),n.createElementBlock("div",qd,[n.createVNode(b,{options:d.value,modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=k=>l.value=k),onChange:f,style:{display:"flex","flex-direction":"column"}},null,8,["options","modelValue"])])):n.createCommentVNode("",!0)])}}}),Kd={key:0,class:"title"},Xd={class:"content"},Zd={class:"relation"},Qd={style:{width:"72px"}},eu={class:"btn-wrapper"},tu={class:"field-wrapper"},nu={class:"buttons"},Ka=n.defineComponent({name:"JFilterPanel",__name:"filter-panel",props:n.mergeModels({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:n.mergeModels(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=n.useModel(e,"relation"),r=n.useModel(e,"isPin"),s=n.ref([]),d=()=>{r.value=!r.value},c=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:u.value.join(","),options:f.value}),config:{appendTo:r.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:r.value?132:160,change:({value:v,row:w})=>{const S=a.columns.find(B=>B.id===v)?.config||{};let y="eq",E="text";["options"].includes(S.dataType||"")?y="in":["dateTime"].includes(S.dataType||"")&&(y="range",E="dateTime"),w.method=y,w.type=S.valueType||E}}},{id:"method",type:"j-select",getCompConfig:({row:v})=>{const C=a.columns.find(S=>S.id===v.field)?.config||{};return["options","switch"].includes(C.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(C.dataType||"")?{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:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{width:r.value?120:144,appendTo:r.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:v})=>{v.value=void 0}}},{id:"value",type:"input",getCompType:({row:v})=>{const C=a.columns.find(S=>S.id===v.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(v.method)||["eq","ne"].includes(v.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(v.method)?"j-date-range":["formula"].includes(v.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:v})=>{if(["empty","not_empty"].includes(v.method||""))return{display:!1};const C=a.columns.find(y=>y.id===v.field)?.config||{},S={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(S.collapseTags=!0,S.collapseTagsTooltip=!0,S.dataType=C.dataType,S.dataCode=C.dataCode,S.options=C.options):["switch"].includes(C.dataType||"")?(S.options=[],S.dataType="options",C.activeValue==null?S.options.push({label:"是",value:"1"}):S.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?S.options.push({label:"否",value:"0"}):S.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(v.method)?(S.placeholder="",S.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"}],S.dataType="options"):(S.type="datetime",["range"].includes(v.method)?(S.startPlaceholder="开始时间",S.endPlaceholder="结束时间",S.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):S.placeholder="")),S},config:{width:r.value?234:296,appendTo:r.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{s.value=a.searchFieldList});const f=n.computed(()=>a.columns.filter(v=>!v.children?.length).map(v=>({label:v.config?.label,value:v.id,dataType:v.config?.dataType,options:v.config?.options}))),u=n.computed(()=>s.value.map(v=>v.field)),p=({data:v})=>{if(u.value.includes(v.value))return;const C=a.columns.find(E=>E.id===v.value)?.config||{};let S="eq",y="text";["options","dataItem"].includes(C.dataType||"")?S="in":["dateTime"].includes(C.dataType||"")&&(S="range",y="dateTime"),s.value.push({field:v.value,method:S,type:C.valueType||y})},h=o,m=()=>{s.value.length=0},g=()=>{r.value?h("filter"):h("close",!0)},b=()=>{s.value.forEach(v=>{v.value=void 0}),h("filter")};return t({getSearchFields:()=>s.value}),(v,w)=>{const C=n.resolveComponent("j-icon"),S=n.resolveComponent("j-select"),y=n.resolveComponent("j-button-select"),E=n.resolveComponent("j-button"),B=n.resolveComponent("j-input-rows"),_=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":r.value}])},[r.value?(n.openBlock(),n.createElementBlock("div",Kd,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",Xd,[n.createElementVNode("div",Zd,[n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("筛选出符合以下")),1),n.createElementVNode("div",Qd,[n.createVNode(S,{teleported:!1,noBorder:!0,modelValue:l.value,"onUpdate:modelValue":w[0]||(w[0]=T=>l.value=T),options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)("条件的数据")),1)]),n.createElementVNode("div",eu,[n.createVNode(y,{label:"添加过滤条件",options:f.value,modelValue:u.value.join(","),onChange:p},null,8,["options","modelValue"]),s.value.length>0?(n.openBlock(),n.createBlock(E,{key:0,type:"text",danger:"",label:"删除全部",onClick:m})):n.createCommentVNode("",!0)]),n.createElementVNode("div",tu,[n.createVNode(B,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=T=>s.value=T),columns:c,editConfig:{isAddBtn:!1},isWrap:r.value},null,8,["modelValue","isWrap"])]),n.createVNode(_,{placement:"bottom",content:r.value?n.unref(i)("取消固定"):n.unref(i)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:d},[n.createVNode(C,{rotate:45,icon:r.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",nu,[n.createVNode(E,{label:n.unref(i)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(E,{label:n.unref(i)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:b},null,8,["label"])])],2)}}}),ou={class:"j-order-panel"},iu={class:"content"},au={class:"btn-wrapper"},lu={class:"field-wrapper"},ru={class:"buttons"},su=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=o,r=n.computed(()=>a.columns.filter(m=>!m.children?.length&&m.config?.sorter?.isNot!==!0).map(m=>({label:m.config?.label,value:m.id}))),s=n.ref([]),d=n.computed(()=>s.value.map(m=>m.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:m})=>({title:m.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:m})=>{d.value.includes(m.value)||s.value.push({label:m.label,value:m.value,sord:"ASC"})},u=m=>{s.value=JSON.parse(JSON.stringify(m))},p=()=>{l("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],l("clear")};return t({init:u}),(m,g)=>{const b=n.resolveComponent("j-button-select"),k=n.resolveComponent("j-input-rows"),v=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",ou,[n.createElementVNode("div",iu,[n.createElementVNode("div",au,[n.createVNode(b,{label:"添加排序规则",options:r.value,modelValue:d.value.join(","),onChange:f},null,8,["options","modelValue"])]),n.createElementVNode("div",lu,[n.createVNode(k,{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=w=>s.value=w),columns:c,editConfig:{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",ru,[n.createVNode(v,{label:n.unref(i)("排序"),type:"primary",onClick:p},null,8,["label"]),s.value.length>0?(n.openBlock(),n.createBlock(v,{key:0,label:n.unref(i)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),cu={class:"j-column-panel"},du={class:"content"},uu={class:"search-wrapper"},fu={class:"tree-wrapper"},pu={class:"buttons"},hu=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:i}=Pe(),a=e,l=o,r=n.ref(),s=n.ref(""),d={},c=n.ref([]),f=n.ref([]),u=(y,E)=>{const B=[],_=new Map;y.forEach(j=>{_.set(j.id,j),d[j.id]=j});const T=new Set;return E&&E.length>0&&E.forEach(j=>{const D=_.get(j.id);if(D){T.add(D.id);const A={id:D.id,label:D.config?.label||D.id,type:D.type,display:D.config?.display!==!1};D.children&&D.children.length>0&&(A.children=u(D.children,j.children)),B.push(A)}}),y.forEach(j=>{if(!T.has(j.id)){const D={id:j.id,label:j.config?.label||j.id,type:j.type,display:j.config?.display!==!1};j.children&&j.children.length>0&&(D.children=u(j.children)),B.push(D)}}),B},p=(y,E)=>E.length===0?y:y.map(B=>{const _=E.some(j=>B.label.toLowerCase().includes(j.toLowerCase())),T=B.children?p(B.children,E):[];return _||T.length>0?{...B,children:T.length>0?T:B.children}:null}).filter(Boolean),h=n.computed(()=>{if(!s.value)return f.value;const y=s.value.split(/\s+/).filter(Boolean);return p(f.value,y)}),m=n.ref([]),g=n.computed(()=>{const y=new Map;if(a.columnConfig&&a.columnConfig.length>0){const E=B=>{B.forEach(_=>{y.set(_.id,_),_.children&&E(_.children)})};E(a.columnConfig)}return y}),b=()=>{const y=E=>{const B=[];return E.forEach(_=>{let T=!0;if(g.value.size>0){const j=g.value.get(_.id);j?T=j.display:T=_.config?.display!==!1}else T=_.config?.display!==!1;T&&(B.push(_.id),_.children&&B.push(...y(_.children)))}),B};m.value=y(a.columns)},k=(y,{node:E})=>{y.includes(E.id)?m.value.push(E.id):m.value=m.value.filter(_=>_!==E.id)},v=(y,E,B)=>B==="inner"?!1:y.parent===E.parent,w=()=>{const y=E=>E.map(B=>{const _={...B,display:m.value.includes(B.id)};return B.children&&(_.children=y(B.children)),_});l("save",y(f.value))},C=()=>{if(b(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",r.value){const y=r.value;y.setCheck&&y.setCheck(m.value);const E=y.$refs?.treeRef||y;E?.setCheckedKeys&&E.setCheckedKeys(m.value)}};return t({init:()=>{b(),c.value=u(a.columns,a.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(y,E)=>{const B=n.resolveComponent("j-icon"),_=n.resolveComponent("el-input"),T=n.resolveComponent("j-tree"),j=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",cu,[n.createElementVNode("div",du,[n.createElementVNode("div",uu,[n.createVNode(_,{modelValue:s.value,"onUpdate:modelValue":E[0]||(E[0]=D=>s.value=D),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(B,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",fu,[n.createVNode(T,{ref_key:"treeRef",ref:r,list:h.value,"is-tree-data":!0,"default-checked-keys":m.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":v,check:k},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",pu,[n.createVNode(j,{label:n.unref(i)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(j,{label:n.unref(i)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),mu={class:"j-table-panel-left"},gu={class:"j-table-panel-top"},yu={class:"j-table-panel-top-left"},bu={class:"j-table-panel-top-right"},wu={key:0,style:{width:"200px"}},vu={class:"j-table-panel-main"},Cu={key:0,class:"j-table-panel-filter-panel"},Xa=te(n.defineComponent({name:"JTablePanel",__name:"table-panel",props:{columns:{type:Array,required:!0,default:()=>[]},isTree:{type:Boolean,default:!1},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},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:"操作"},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:i}=Pe(),a=e,l=o;a.isMultiple&&!a.rowKey&&console.warn("rowKey is required when isMultiple is true");const r=n.ref();let s=[];const d=n.ref(0),c=n.ref(1);let f=a.pageSize||100,u="";const p=n.ref([]),h=n.ref(!1),m=n.computed(()=>a.batchButtons&&a.batchButtons.length>0),g=n.computed(()=>p.value.length>0),b=n.computed(()=>m.value&&g.value||h.value),k=n.computed(()=>a.isPage&&!b.value);m.value&&!a.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const v=z=>a.rowKey?a.rowKey.split(",").map(de=>z[de.trim()]).join("::"):"",w=(z,F)=>{if(!F||F.length===0)return z.filter(J=>J.config?.display!==!1).map(J=>J.children&&J.children.length>0?{...J,children:w(J.children)}:J);const de=new Map(z.map(J=>[J.id,J])),ve=[];return F.forEach(J=>{const oe=de.get(J.id);if(oe){if(J.display){let ge=oe;oe.children&&oe.children.length>0&&(ge={...oe,children:w(oe.children,J.children)}),ve.push(ge)}de.delete(J.id)}}),z.forEach(J=>{if(de.has(J.id)&&J.config?.display!==!1){let oe=J;J.children&&J.children.length>0&&(oe={...J,children:w(J.children)}),ve.push(oe)}}),ve},C=n.computed(()=>w(a.columns,se.value)),S=n.computed(()=>Ui(a.columns,z=>z.config.label)),y=n.ref(""),E=n.computed(()=>S.value.some(z=>z.config?.filter?.isSearchKeyword)),B=n.ref(),_=n.ref(!0),T=n.ref([]),j=n.computed(()=>_.value?"搜索全部":`搜索范围:${S.value.filter(z=>T.value.includes(z.id)).map(z=>z.config?.label).join("、")}`),D=()=>{B.value.init()},A=n.ref(),R=n.ref(!1),V=n.ref(!1),x=n.ref(!1),L=n.ref([]),P=n.ref("and"),G=n.ref(),K=n.ref(!1),ne=n.ref([]),pe=()=>{G.value.init(ne.value)},fe=z=>{ne.value=z,K.value=!1,De()},Y=()=>{ne.value=[],De()},he=n.ref(),ae=n.ref(!1),se=n.ref(),xe=n.computed(()=>se.value!=null),Ve=()=>{he.value?.init()},H=z=>{console.log("handleColumnSave:",z),se.value=z,ae.value=!1},X=n.ref(!1),le=()=>{X.value=!X.value},we=()=>{p.value=[],r.value&&(r.value.setSelection?.([]),h.value&&(h.value=!1,r.value.setRecords(s)))},$e=()=>{h.value=!h.value,h.value?r.value?.setRecords(p.value):r.value?.setRecords(s),r.value?.setSelection?.(p.value)},Re=n.computed(()=>{if(p.value.length>0){const z=[{label:`已选${p.value.length}条`,type:"text"},{label:h.value?"全部":"仅选中",type:"text",click:$e},{label:"清空选中",type:"text",click:we}],F=a.batchButtons.map(de=>({...de,click:()=>{de.click&&de.click(p.value)}}));return[...z,...F]}return a.buttons}),me=async()=>{const z={},F={};F.rel=P.value;const de=A.value?.getSearchFields?.()||L.value;F.cond=de.filter(J=>J.value!==void 0&&J.value!==null&&J.value!=="").map(J=>({field:J.field,method:J.method,value:J.value,type:J.type})),F.cond.length>0?x.value=!0:x.value=!1,z.filter=F;const ve=ne.value.map(J=>J.value+" "+J.sord).join(",");if(y.value&&(z.keyword={value:y.value,fields:_.value?S.value.filter(J=>J.config?.filter?.isSearchKeyword).map(J=>J.id):n.unref(T)}),a.loadData){if(a.isPage){z.pagination={rows:f,page:c.value,sort:ve||u||a.sort||a.rowKey};const J=await a.loadData(z)||{};s=J.rows||[],d.value=J.records||0}else z.sort=ve,s=await a.loadData(z)||[],d.value=s.length;r.value.setRecords(s),m.value?(p.value=[],h.value=!1):a.rowKey&&p.value.length>0&&r.value?.setSelection?.(p.value)}},De=async()=>{c.value=1,await me()},ut=({rows:z,page:F})=>{f=z,c.value=F,me()},ot=async()=>{c.value=1,await me()},O=async()=>{await me()},q=async()=>{await ot()},I=z=>{l("ready",z)},N=z=>{let F=[];if(m.value)F=z;else if(!a.rowKey)F=z;else{const de=new Map(z.map(J=>[v(J),J])),ve=new Map(p.value.map(J=>[v(J),J]));s.forEach(J=>{const oe=v(J);de.has(oe)?ve.set(oe,de.get(oe)):ve.delete(oe)}),F=Array.from(ve.values())}p.value=F,l("select",F),h.value&&F.length===0?(h.value=!1,r.value&&r.value.setRecords(s)):h.value&&F.length>0&&r.value&&(r.value.setRecords(F),r.value.setSelection?.(F))},$=()=>p.value||[],W=z=>{p.value=z,r.value?.setSelection?.(z)},U=()=>r.value?.getInstance?.();return n.onMounted(async()=>{a.immediate&&await O()}),t({refreshData:O,resetData:ot,getSelection:$,setSelection:W,clearSelection:()=>{we()},getInstance:U}),(z,F)=>{const de=n.resolveComponent("j-buttons"),ve=n.resolveComponent("j-icon"),J=n.resolveComponent("el-popover"),oe=n.resolveComponent("el-tooltip"),ge=n.resolveComponent("el-input"),ue=n.resolveComponent("j-button"),Te=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:X.value,"no-padding":e.noPadding||X.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":X.value}])},[n.createElementVNode("div",mu,[n.createElementVNode("div",gu,[n.createElementVNode("div",yu,[n.createVNode(de,{list:Re.value},null,8,["list"])]),n.createElementVNode("div",bu,[E.value&&!b.value?(n.openBlock(),n.createElementBlock("div",wu,[n.createVNode(ge,{modelValue:y.value,"onUpdate:modelValue":F[2]||(F[2]=re=>y.value=re),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索数据"),onKeyup:n.withKeys(De,["enter"]),onClear:De,clearable:"",class:"j-suffix"},{prefix:n.withCtx(()=>[n.createVNode(ve,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(oe,{placement:"bottom",content:j.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:D,onHide:De},{reference:n.withCtx(()=>[n.createVNode(ve,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(Gd,{ref_key:"keywordPanelRef",ref:B,columns:S.value,"check-all":_.value,"onUpdate:checkAll":F[0]||(F[0]=re=>_.value=re),"check-fields":T.value,"onUpdate:checkFields":F[1]||(F[1]=re=>T.value=re)},null,8,["columns","check-all","check-fields"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!R.value&&!b.value?(n.openBlock(),n.createBlock(J,{key:1,placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,visible:V.value,"onUpdate:visible":F[6]||(F[6]=re=>V.value=re),onHide:De},{reference:n.withCtx(()=>[n.createVNode(ue,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:x.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Ka,{ref_key:"filterPanelRef",ref:A,"is-pin":R.value,"onUpdate:isPin":F[3]||(F[3]=re=>R.value=re),relation:P.value,"onUpdate:relation":F[4]||(F[4]=re=>P.value=re),searchFieldList:L.value,columns:S.value,onFilter:De,onClose:F[5]||(F[5]=re=>V.value=!1)},null,8,["is-pin","relation","searchFieldList","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:2,placement:"bottom",content:n.unref(i)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:pe,visible:K.value,"onUpdate:visible":F[7]||(F[7]=re=>K.value=re)},{reference:n.withCtx(()=>[n.createVNode(ue,{class:n.normalizeClass({active:ne.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(su,{ref_key:"orderPanelRef",ref:G,columns:S.value,onSave:fe,onClear:Y},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:3,placement:"bottom",content:n.unref(i)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(J,{placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:Ve,visible:ae.value,"onUpdate:visible":F[8]||(F[8]=re=>ae.value=re)},{reference:n.withCtx(()=>[n.createVNode(ue,{class:n.normalizeClass({active:xe.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(hu,{ref_key:"columnPanelRef",ref:he,columns:e.columns,"column-config":se.value,onSave:H},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),b.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(oe,{key:4,placement:"bottom",content:n.unref(i)("刷新")},{default:n.withCtx(()=>[n.createVNode(ue,{onClick:q,type:"text",icon:"mdi:refresh"})]),_:1},8,["content"])),n.createVNode(oe,{placement:"bottom",content:X.value?n.unref(i)("退出全屏"):n.unref(i)("全屏")},{default:n.withCtx(()=>[n.createVNode(ue,{onClick:le,type:"text",icon:X.value?"mdi:fullscreen-exit":"mdi:fullscreen"},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",vu,[n.createVNode(Te,{ref_key:"tableRef",ref:r,columns:C.value,records:n.unref(s),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":k.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":d.value,"row-key":e.rowKey,actions:e.actions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"table-page":c.value,"onUpdate:tablePage":F[9]||(F[9]=re=>c.value=re),onLoadPageData:ut,onReady:I,onSelectionChanged:N},null,8,["columns","records","is-tree","is-show-number","is-multiple","is-page","page-sizes","page-size","page-total","row-key","actions","actions-max-count","actions-label","table-page"])])]),R.value&&!b.value?(n.openBlock(),n.createElementBlock("div",Cu,[n.createVNode(Ka,{ref_key:"filterPanelRef",ref:A,"is-pin":R.value,"onUpdate:isPin":F[10]||(F[10]=re=>R.value=re),relation:P.value,"onUpdate:relation":F[11]||(F[11]=re=>P.value=re),searchFieldList:L.value,columns:S.value,onFilter:De},null,8,["is-pin","relation","searchFieldList","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),ku={class:"j-button-select"},xu={class:"search-wraper"},Su={class:"options-wraper"},Bu=["onClick"],Za=te(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,i=t,{t:a}=Pe(),l=n.ref(""),r=n.computed(()=>l.value===""?o.options:o.options.filter(c=>(c.label||"").includes(l.value))),s=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const u=[...s.value,c.value].join(",");i("update:modelValue",u),i("change",{value:u,data:c})};return(c,f)=>{const u=n.resolveComponent("j-button"),p=n.resolveComponent("j-icon"),h=n.resolveComponent("el-input"),m=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(m,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(u,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:n.withCtx(()=>[n.createElementVNode("div",ku,[n.createElementVNode("div",xu,[n.createVNode(h,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=g=>l.value=g),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Su,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,g=>(n.openBlock(),n.createElementBlock("div",{key:g.value,class:n.normalizeClass(["option-item",{active:s.value.includes(g.value)||g.disabled}]),onClick:n.withModifiers(b=>d(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(p,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)(g.label)),1)],10,Bu))),128))])])]),_:1},8,["width"])}}})),Eu={class:"j-tree-item-text"},_u={key:2,class:"j-tree-item-button-group"},ju={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Qa=te(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},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},pidKey:{type:String,default:"pid"},idKey:{type:String},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,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 i=e,a=o,{useData:l,t:r}=Pe(),{getTreeData:s,loadData:d}=l(),c=n.ref(),f=n.ref(!1),u=n.ref(""),p=n.ref([]),h={children:"children",label:"label",disabled:"disabled"},m=n.computed(()=>s?s({dataType:i.dataType,dataCode:i.dataCode,labelKey:i.labelKey,valueKey:i.valueKey,pidKey:i.pidKey,idKey:i.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>i.dataCode||i.dataType?m.value:i.list?n.unref(i.list):p.value),b=async()=>{f.value=!0,i.loadData&&(p.value=await i.loadData()||[]),d&&await d(i.dataType,i.dataCode),f.value=!1,n.nextTick(()=>{i.afterLoadData&&i.afterLoadData(g.value||[])})},k=(A,R=!0)=>{c.value?.setCurrentKey(A,R)},v=()=>c.value?.getCurrentKey(),w=(A,R=!1)=>{c.value?.setCheckedKeys(A,R)},C=(A=!1)=>c.value?.getCheckedKeys(A),S=async(A,R,V,x)=>{if(u.value=A.value,i.nodeClickFlow&&i.runFlow){const L=JSON.parse(i.nodeClickFlow);await i.runFlow(L,{value:A.value})}i.click&&i.click(A.value,A,x)},y=(A,{checkedKeys:R,checkedNodes:V,halfCheckedKeys:x,halfCheckedNodes:L})=>{i.check&&i.check(R,{node:A,checkedNodes:V,halfCheckedKeys:x,halfCheckedNodes:L})},E=(A,R,V,x)=>{a("node-drop",A,R,V,x)},B=A=>{const R=pt(i.treeButtons);return A&&i.filterButton?i.filterButton({buttons:R,node:A}):R},_=(A,R)=>{A.disabled||A.click&&A.click(R)},T=n.ref(""),j=(A,R)=>{T.value=A?R.value:"",console.log(T.value,"row")},D=(A,R,V)=>i.allowDrop?i.allowDrop(A,R,V):!(V=="inner"&&!R.data.canInner);return n.onMounted(async()=>{(i.immediate&&i.loadData||i.dataType||i.dataCode)&&await b()}),n.watch(()=>i.list,()=>{f.value=!0,n.nextTick(()=>{f.value=!1})}),n.watch(()=>i.dataCode||i.dataType,()=>{b()}),t({refreshData:b,setValue:k,getValue:v,setCheck:w,getCheck:C}),(A,R)=>{const V=n.resolveComponent("j-icon"),x=n.resolveComponent("j-button"),L=n.resolveComponent("el-dropdown-item"),P=n.resolveComponent("el-dropdown-menu"),G=n.resolveComponent("el-dropdown"),K=n.resolveComponent("el-tree"),ne=n.resolveComponent("el-empty"),pe=n.resolveDirective("loading");return n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&g.value.length>0?(n.openBlock(),n.createBlock(K,{key:0,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":u.value,data:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,onNodeClick:S,onCheck:y,onNodeDrop:E,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":D,"expand-on-click-node":e.expandOnClickNode,ref_key:"treeRef",ref:c},{default:n.withCtx(({node:fe})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===fe.data.value}])},[fe.data.openIcon?(n.openBlock(),n.createBlock(V,{key:0,class:"j-tree-item-open-icon",size:18,icon:fe.data.openIcon,color:fe.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),fe.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(V,{key:1,class:"j-tree-item-default-icon",size:18,icon:fe.data[e.iconKey]||e.defaultIcon||"",color:fe.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",Eu,n.toDisplayString(fe.label),1),B(fe.data).length?(n.openBlock(),n.createElementBlock("div",_u,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B(fe.data),(Y,he)=>(n.openBlock(),n.createBlock(G,{key:he,trigger:"click",onVisibleChange:ae=>j(ae,fe.data)},{dropdown:n.withCtx(()=>[n.createVNode(P,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Y.children,(ae,se)=>(n.openBlock(),n.createBlock(L,{key:se,disabled:ae.disabled,divided:ae.divided,onClick:n.withModifiers(xe=>_(ae,fe.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:ae.danger?"var(--j-color-danger)":ae.color||e.buttonIconColor||"var(--j-color-text-2)"})},[ae.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(V,{key:0,icon:ae.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(r)(ae.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode(x,{icon:Y.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):n.createCommentVNode("",!0)],2)]),_:1},8,["node-key","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"])):(n.openBlock(),n.createElementBlock("div",ju,[n.createVNode(ne,{description:n.unref(r)(e.emptyDes)},null,8,["description"])]))],2)),[[pe,f.value]])}}})),el=te(pa),Vu=Is;async function Tu(e,t,o){const i={...o};delete i.ruleIndex,delete i.trigger;const a=new Vu({[e]:[i]});let l=[];try{await a.validate({[e]:t})}catch(r){r.errors?l=r.errors.map(({message:s})=>s):l=[i.message||"校验错误"]}return l.length>0?l[0]:""}async function Nu(e,t,o){const i=o.map((a,l)=>({...a,ruleIndex:l})).sort(({warningOnly:a,ruleIndex:l},{warningOnly:r,ruleIndex:s})=>!!a==!!r?l-s:a?1:-1);for(let a=0;a<i.length;a+=1){const l=i[a];"pattern"in l&&(t+="");const r=await Tu(e,t,l);if(r!=="")return{name:e,errors:r}}}function $u(e,t){const o=(l,r,s,d,c)=>{Object.keys(r).forEach(f=>{let u=f;s&&(u=`${s}.${f}`);const p=r[f],{rules:h,myGridtableId:m}=t(u,s?r:void 0,d,c);if(h.length){const g=i(u,p,h);l.push(g)}m&&p.forEach(g=>{o(l,g,m,p,s?r:void 0)})})},i=(l,r,s)=>Nu(l,r,s);return{validateForm:async()=>{const l=n.unref(e),r=[];o(r,l,"");const s=await Promise.all(r),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:i}}const tl=te(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}},emits:["change"],setup(e,{expose:t,emit:o}){const i=e,a=o,{useData:l,existField:r,httpGet:s,httpPost:d,success:c,warning:f,error:u,info:p,t:h}=Pe();let m;l&&(m=l());const g=O=>{u&&u(O)},b=n.ref(!1),k=n.computed(()=>i.config?.gutter||16),v=n.computed(()=>i.config?.span||24),w=n.computed(()=>i.config?.labelWidth),C=n.computed(()=>i.config?.labelPosition||"right"),S=n.computed(()=>B.length===1&&(B[0].type==="j-tabs"||B[0].type==="j-layout"||B[0].config?.isAutoWindow)),y=n.reactive({}),E=n.ref({}),B=[],_={},T=n.ref({});let j={},D={},A=[],R={};const V=O=>{a("change",O)},x=O=>Rn(_[O]?.type||"")&&!_[O]?.config?.notInput||_[O]?.config?.isInput,L=O=>["j-table","j-input-rows","j-input-cards"].includes(_[O]?.type||"");let P;const G=(O,q)=>{Object.keys(O).forEach(I=>{const N=O[I];q&&(I=q+"."+I),N!=null&&typeof N=="object"&&!Mn(N)&&G(N,I),y[I]=N})},K=(O,q)=>{let I=O.id;return I||(O.config?.table&&O.config?.field?I=`${O.config.table}.${O.config.field}`:O.config?.table?I=O.config?.table:O.config?.field&&(I=O.config?.field),q&&L(q)&&(I=`${q}.${I}`)),I||Pn("j")},ne=(O,q,I,N="")=>{O.forEach($=>{$.id=K($,N);const W={id:$.id,slot:$.slot,type:$.type,getCompType:$.getCompType,getCompConfig:$.getCompConfig,config:{},children:[]};q.push(W);const{children:U}=$;Ln(W,$,["children","config"]),Ln(W.config,$.config||{},[]),_[$.id]&&console.warn("有重复的组件id:"+$.id),_[$.id]=W,i.readonly===!0&&(W.config.readonly=!0);let Q=!1,z;N!==""&&L(N)&&(Q=!0,W.config=$.config||{},W.config.parentTableId=N,z=_[N]?.config?.table);const F=W.config||{};if(x($.id))!I&&Q===!1&&(F?.defaultValue===0?y[$.id]=F?.defaultValue:y[$.id]=F?.defaultValue||void 0),F.table&&F.field?j[`${F.table}_${F.field}`.toLowerCase()]=$.id:F.field&&(Q?j[`${z}_${F.field}`.toLowerCase()]=$.id:j[`${F.field}`.toLowerCase()]=$.id);else if(Q&&F.field)j[`${z}_${F.field}`.toLowerCase()]=$.id;else if(L($.id))!I&&!F.isSubTable&&(y[$.id]=[]),F.table&&(j[F.table.toLowerCase()||""]=$.id),F.isSubTable||A.push(W);else if(F?.defaultValue)y[$.id]=F?.defaultValue;else if($.type==="collapse"&&F?.isExpand){const de=[];(F?.groups||[]).forEach(ve=>{de.push(ve.i)}),y[$.id]=de}U&&U.length>0&&ne(U,W.children,I,W.id)})},pe=async(O,q)=>{b.value=!1;const I=!!q;B.splice(0,B.length),j={},D={},A=[],P=q,cn(y),T.value={},I&&G(q,""),ne(O,B,I),R=pt(y),n.nextTick(()=>{b.value=!0,n.nextTick(()=>{ut(i.config?.codeInit,{})})})},fe=(O,q,I)=>{const N=[];return q.forEach($=>{const W={};Object.keys($).forEach(U=>{if(!I||I(U,$[U],O)){const Q=le(U);if(Q?.type==="j-table")W[Q?.id||""]=fe(U,$[U],I);else{let z=j[`${O}_${U}`.toLowerCase()]||U;z=z.indexOf(".")!==-1?z.split(".")[1]:z,W[z]=$[U]}}}),N.push(W)}),N},Y=(O,q)=>{Object.keys(O||{}).forEach(I=>{let N=O[I];const $=le(I);if($===void 0)N&&(Mn(N)&&(N=N[0]||{}),typeof N=="object"?Object.keys(N).forEach(W=>{if(!q||q(I,N[W],I)){let U=W;I!=="main"&&(U=`${I}_${W}`),D[U]=I,y[j[U.toLowerCase()]||W]=N[W]}}):y[I]=N);else if(L($.id||"")){if(!Array.isArray(N)){console.warn("表格数据不是数组:"+I);return}N?.length>0?y[j[I.toLowerCase()]||I]=fe(I,N,q):y[j[I.toLowerCase()]||I]=[]}else(!q||q(I,N,I))&&(y[j[I.toLowerCase()]||I]=N)}),P&&Object.keys(y).forEach(I=>{const N=le(I);(N===void 0||!["tabs","collapse"].includes(N.type||""))&&Ri(P,I,y[I])})},he=(O,q=!1)=>{const I={};return Object.keys(O).forEach(N=>{if(N==="parentRow")return;const $=_[N];if($){const W=$.config?.table,U=$.config?.field;if(q)U?I[U]=O[N]:I[N]=O[N];else if(L(N)){const Q=[];O[N].forEach(z=>{Q.push(he(z,!0))}),I[W||N]=Q}else W&&U?(I[W]=I[W]||{},I[W][U]=O[N]):U&&(I[U]=O[N])}else q?N!=="_X_ROW_KEY"&&N!=="_isHover"&&(I[N]=O[N]):D[N]?(I[D[N]]=I[D[N]]||{},I[D[N]][N.replace(`${D[N]}_`,"")]=O[N]):I[N]=O[N]}),I},ae=(O=!0)=>O?he(y):y,se=(O,q,I,N)=>{let $=_[O];if($==null){const U=O.split(".");$=_[U[U.length-1]]||{}}if(!$)return{};const W=$t({config:{...$.config||{},...T.value[$.id]||{}},getCompConfig:$.getCompConfig,formData:y,tableData:I,row:q,pRowData:N});return W._componentId=$?.id,W},xe=(O,q,I,N)=>{const $=se(O,q,I,N);if($.isNotRule!==!0&&$.display!==!1){const W=$.rule||[],U=W.find(Q=>Q.type==="only");return U&&(U.validator=async(Q,z)=>{if(z){const F={table:Q.table,key:Q.key,keyName:Q.keyName,field:Q.field,keyValue:Q.getKeyValue?Q.getKeyValue():"",value:z,paramNames:Q.paramNames,getParams:Q.getParams,withProjectId:Q.withProjectId,getValue:Q.getValue,formData:y};if(!await r(F))throw h(Q.message)||h("数据值重复")}}),{rules:W,myGridtableId:L($._componentId)?$._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:Ve}=$u(y,xe),H=async()=>{E.value={};const O=await Ve();return Object.keys(O).length>0?(E.value=O,g(`${h(_[Object.keys(O)[0]]?.config?.label)}:${h(O[Object.keys(O)[0]].msg)}`),!1):!0},X=()=>{E.value={},cn(y),Object.keys(R||{}).forEach(O=>{y[O]=R[O]})},le=O=>{let q=_[O];return q===void 0&&j[O.toLowerCase()]&&(q=_[j[O.toLowerCase()]]),q},we=({id:O,i:q,value:I,type:N})=>{if(N==="add")y[O].push(I);else if(N==="delete")y[O].splice(q,1);else{const $=le(O);$&&($.config.parentTableId?y[$.config.parentTableId][q][O]=I:y[O]=I)}},$e=({id:O,i:q})=>{const I=le(O);if(I){if(I.config.parentTableId){const N=y[I.config.parentTableId],$=I.id?I.id.replace(`${I.config.parentTableId}.`,""):"";if(q!=null)return(N[q]||{})[$||""];const W=[];return N&&N.forEach(U=>{W.push(U[$||""])}),W}if(L(I.id||"")){const N=[];return y[I.id||""].forEach($=>{N.push(he($,!0))}),N}return y[I.id||""]}if(y[O])return y[O]},Re=async({id:O,i:q})=>{const I=$e({id:O,i:q}),N=le(O);if(N&&m?.getLabel)if(q!==void 0){const $=I[q],W=y[N.config.parentTableId||""][q],U=$t({config:N.config,getCompConfig:N.getCompConfig,formData:y,tableData:y[N.config.parentTableId||""],row:W});return await m?.getLabel({value:$,config:U,formData:y,tableData:y[N.config.parentTableId||""],row:W})}else{const $=$t({config:N.config,getCompConfig:N.getCompConfig,formData:y});return await m?.getLabel({value:I,config:$,formData:y})}return I},me=async(O,q)=>m?.loadViewDataList?await m?.loadViewDataList(O,q,!1):[],De=O=>(O.set=we,O.get=$e,O.setFormData=Y,O.getFormData=ae,O.getLabel=Re,O.getViewData=me,O.getDateNow=q=>qi(new Date,q||"YYYY-MM-DD HH:mm:ss"),O.httpGet=s||(()=>{console.log("当前状态不支持")}),O.httpPost=d||(()=>{console.log("当前状态不支持")}),O.loading=q=>{Ht(q)},O.showMsg=({text:q,type:I})=>{switch(I){case"success":c&&c(q);break;case"warning":f&&f(q);break;case"error":u&&u(q);break;case"info":p&&p(q);break;default:p&&p(q);break}console.log("showMsg",q,I)},O),ut=async(O,q)=>{if(O&&O.trim()){O=`async (jcode) => {${O}}`;const{res:I,fn:N}=Vo(O);I&&await N(De(q))}},ot=(O,q)=>{T.value[O]={...T.value[O]||{},...q}};return i.schema&&pe(i.schema),fa({formData:y,compsConfig:T,errorFields:E,isAutoWindow:S,gutter:k,span:v,labelWidth:w,labelPosition:C,getValue:$e,formChange:V}),t({init:pe,reset:X,validate:H,setValue:we,getValue:$e,getLabel:Re,setFormData:Y,getFormData:ae,setCompConfig:ot}),(O,q)=>{const I=n.resolveComponent("j-form-item"),N=n.resolveComponent("el-row"),$=n.resolveComponent("el-form");return b.value?(n.openBlock(),n.createBlock($,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:q[0]||(q[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[S.value?(n.openBlock(),n.createBlock(I,n.normalizeProps(n.mergeProps({key:0},B[0])),null,16)):(n.openBlock(),n.createBlock(N,{key:1,gutter:k.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(B,W=>n.createVNode(I,n.mergeProps({key:W.id,ref_for:!0},W),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),nl=te(n.defineComponent({name:"JFormItem",__name:"form-item",props:{id:{type:String,default:""},type:{type:String,default:""},getCompType:{type:Function,default:void 0},config:{type:Object,default:()=>{}},getCompConfig:{type:Function,default:void 0},children:{type:Array,default:()=>[]}},setup(e){const t=e,{formData:o,compsConfig:i,errorFields:a,isAutoWindow:l,span:r,labelWidth:s}=Kt(),{t:d}=Pe(),c=n.computed(()=>$t({config:{...t.config||{},...i?.value?.[t.id]||{}},getCompConfig:t.getCompConfig,formData:o})),f=n.computed(()=>t.getCompType?t.getCompType({config:t.config,formData:o}):t.type),u=n.computed(()=>Rn(f.value)&&!c.value?.notInput||c.value?.isInput),p=n.computed(()=>c.value?.labelWidth||s.value),h=n.computed(()=>(c.value?.rule||[]).some(b=>b.required===!0)),m=n.computed(()=>{const g=a?.value?.[t.id];return g?g.msg:""});return(g,b)=>{const k=n.resolveComponent("j-comp"),v=n.resolveComponent("el-form-item"),w=n.resolveComponent("el-col");return c.value.display!==!1&&!n.unref(l)?(n.openBlock(),n.createBlock(w,{key:0,span:c.value.span||n.unref(r),style:n.normalizeStyle({...c.value.colStyle||{}}),class:n.normalizeClass(c.value.colClass||{})},{default:n.withCtx(()=>[u.value?(n.openBlock(),n.createBlock(v,{key:0,label:n.unref(d)(c.value.notShowLabel?"":c.value.label||""),"label-position":c.value.labelPosition,"label-width":p.value,required:h.value,error:n.unref(d)(m.value)},{default:n.withCtx(()=>[n.createVNode(k,{id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"])]),_:1},8,["label","label-position","label-width","required","error"])):(n.openBlock(),n.createBlock(k,{key:1,id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"]))]),_:1},8,["span","style","class"])):c.value.display!==!1?(n.openBlock(),n.createBlock(k,{key:1,id:e.id,type:f.value,config:c.value,children:e.children},null,8,["id","type","config","children"])):n.createCommentVNode("",!0)}}})),Mu={class:"j-page"},ol=te(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,i=n.ref(!1),a=n.reactive([]),l={},r=n.reactive({}),s=(c,f)=>{c.forEach(u=>{u.id=u.id||Pn("c");const p={id:u.id,slot:u.slot,type:u.type,config:{},children:[]},{children:h}=u;l[u.id]=p,Ln(p.config,u.config||{},["defaultValue"]),u?.config?.defaultValue!==void 0&&(r.value[u.id]=u.config.defaultValue),f.push(p),h&&h.length>0&&s(h,p.children)})},d=c=>{i.value=!1,a.splice(0,a.length),cn(l),cn(r),s(c,a),n.nextTick(()=>{i.value=!0})};return o.schema&&d(o.schema),t({init:d}),(c,f)=>{const u=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",Mu,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a,p=>(n.openBlock(),n.createBlock(u,{key:p.id,id:p.id,type:p.type,config:p.config,children:p.children},null,8,["id","type","config","children"]))),128))])}}})),il=te(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref("");return n.watch(()=>o.modelValue,l=>{l?a.value=l:(a.value=dn(),i("update:modelValue",a.value))},{immediate:!0}),(l,r)=>{const s=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(s,{modelValue:a.value,"onUpdate:modelValue":r[0]||(r[0]=d=>a.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),Lu={class:"j-input-rows"},Pu={key:0,class:"j-input-rows-num"},Ru={key:1,class:"j-input-rows-char"},al=te(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:""}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=C=>C==null,i=e,a=t,{formData:l}=Kt(),r=n.computed(()=>i.editConfig.isAddBtn!==!1),s=n.computed(()=>i.editConfig.addBtnText||"添加"),d=n.computed(()=>i.editConfig.buttonsAlign||"left"),c=n.computed(()=>i.editConfig.isRemoveBtn!==!1),f=n.computed(()=>i.editConfig.readonly),u=n.computed(()=>i.editConfig.drag),p=n.computed(()=>i.editConfig.isNullValue!==!1),h=n.ref(),m=["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"],g=n.ref([]);i.modelValue&&i.modelValue.length>0?(g.value=i.modelValue||[],g.value.forEach(C=>{C.i||(C.i=dn())})):(g.value=[],a("update:modelValue",g.value)),n.watch(()=>i.modelValue,C=>{g.value=i.modelValue||[],g.value=C||[],g.value.forEach(S=>{S.i||(S.i=dn())})},{deep:!0});const k=()=>{const C={i:dn()};i.columns.forEach(S=>{const y=S.config?.valueRowKey||S.id||"";y&&(C[y]=pt(S.config?.defaultValue))}),g.value.push(C),a("change",{id:i.id,value:C,data:C,formData:l,tableData:g.value,type:"add"})},v=C=>{const S=g.value[C];g.value.splice(C,1),a("change",{id:i.id,value:S,data:S,formData:l,tableData:g.value,type:"delete"})},w=C=>{a("rowChange",C)};return n.onMounted(()=>{if(!u.value||!h.value)return;const C=h.value,{initSortable:S}=ea(C,{handle:".j-input-rows-drag",onEnd:y=>{const{oldIndex:E,newIndex:B}=y;if(o(E)||o(B)||E===B||E<0||B<0)return;const _=g.value.splice(E,1)[0];g.value.splice(B,0,_),a("change",{id:i.id,value:_,data:_,formData:l,tableData:g.value,type:"sort"})}});S()}),Mo({tableData:g.value,rowChange:w}),(C,S)=>{const y=n.resolveComponent("j-comp"),E=n.resolveComponent("j-icon"),B=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Lu,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(_,T)=>(n.openBlock(),n.createElementBlock("div",{key:_.i+T,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",Pu,n.toDisplayString(T+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",Ru,n.toDisplayString(m[T%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,j=>(n.openBlock(),n.createBlock(y,n.mergeProps({key:j.id,ref_for:!0},j,{row:_}),null,16,["row"]))),128)),u.value?(n.openBlock(),n.createBlock(E,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),c.value&&(p.value||g.value.length>1)&&!f.value?(n.openBlock(),n.createBlock(E,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:j=>v(T)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!f.value&&r.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":d.value}),class:"j-input-rows-actions"},[r.value?(n.openBlock(),n.createBlock(B,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:k},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),ll=te(n.defineComponent({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"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:()=>[]}},setup(e){const t=e,o=Kt(),{t:i}=Pe(),a=n.computed(()=>t.formConfig?.gutter||16),l=n.computed(()=>t.formConfig?.span||24),r=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),d=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),c=n.ref(!1),f=()=>{c.value=!0};return fa({...o,isAutoWindow:d,gutter:a,span:l,labelWidth:r}),(u,p)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),b=n.resolveComponent("el-form"),k=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(h,n.mergeProps(u.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:f}),null,16,["type","size","icon"]),n.createVNode(k,{visible:c.value,"onUpdate:visible":p[1]||(p[1]=v=>c.value=v),title:n.unref(i)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(b,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":r.value,size:e.formConfig?.size,onSubmit:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[d.value?(n.openBlock(),n.createBlock(m,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:a.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,v=>(n.openBlock(),n.createBlock(m,n.mergeProps({key:v.id,ref_for:!0},v),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),rl=te(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,i=t,a=n.computed({get(){return o.modelValue},set(r){i("update:modelValue",r)}}),l=r=>{i("change",r)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{a.value=!a.value,l(a.value)},100)}),(r,s)=>{const d=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(d,n.mergeProps(r.$attrs,{modelValue:a.value,"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),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":e.activeValue,"inactive-value":e.inactiveValue,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,id:e.id,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:l}),n.createSlots({_:2},[r.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"active-action")]),key:"0"}:void 0,r.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"inactive-action")]),key:"1"}:void 0,r.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"active")]),key:"2"}:void 0,r.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(r.$slots,"inactive")]),key:"3"}:void 0]),1040,["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","id","tabindex","aria-label","loading","disabled"])}}})),sl=te(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:{}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,i=c=>{o("update:modelValue",c)},a=(c,f)=>{o("tab-click",c,f)},l=c=>{o("tab-change",c)},r=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const u=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(u,n.mergeProps(c.$attrs,{"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":i,onTabClick:a,onTabChange:l,onTabRemove:r,onTabAdd:s,onEdit:d}),{default:n.withCtx(()=>[n.renderSlot(c.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),cl=te(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,i=l=>{o("update:modelValue",l)},a=l=>{o("change",l)};return(l,r)=>{const s=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(s,n.mergeProps(l.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:a,"onUpdate:modelValue":i}),{default:n.withCtx(()=>[n.renderSlot(l.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),Au={class:"j-editor"},dl=te(Ea(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,i=t,a=n.ref(),l=n.ref(),r=n.shallowRef(),s=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=u=>{if(!u)return"";let p=u;return o.apiUrl&&o.token&&(p=p.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),p},f=u=>{if(!u)return"";let p=u;if(o.apiUrl){const h=`${o.apiUrl}/system/annexesfile/`;p=p.split(h).join("{learun_img_api}"),o.token&&(p=p.split(`token=${o.token}`).join("{learun_img_token}"))}return p};return n.onMounted(()=>{const u={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};u.onChange=h=>{if(d)return;const m=h.getHtml(),g=f(m);i("update:value",g),i("change",{value:g})};const p=Ni.createEditor({selector:a.value,html:c(o.value),config:u,mode:"default"});r.value=p,Ni.createToolbar({editor:p,selector:l.value,mode:"default"})}),n.watch(()=>o.value,u=>{const p=r.value;if(p){const h=p.getHtml(),m=c(u);f(h)!==u&&(d=!0,p.setHtml(m),d=!1)}}),n.watch(()=>o.readonly,u=>{const p=r.value;p&&(u?p.disable():p.enable())}),n.onBeforeUnmount(()=>{const u=r.value;u?.destroy()}),(u,p)=>(n.openBlock(),n.createElementBlock("div",Au,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:l,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:a,class:"j-editor-content",style:n.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-60cd5d0b"]])),Ou={key:0,class:"j-map-loading"},Fu=te(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 i=e,a=o,l=n.ref(!0),r=n.ref();let s=null,d=null,c=null,f=null;const u=async()=>{l.value=!0;try{s=await ta(i.mapKey)}catch(k){console.error("Failed to load Baidu Map:",k),l.value=!1;return}if(d!=null){h(i.lng,i.lat),l.value=!1;return}if(!r.value)return;d=new s.Map(r.value,{enableMapClick:!1});const b=new s.Point(121.480248,31.236276);d.centerAndZoom(b,17),c=new s.Marker(b,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",k=>{p(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=>{p(k.point)}),f.addEventListener("locationError",k=>{alert(k.message)}),d.addControl(f),d.addEventListener("click",k=>{p(k.point)}),d.enableScrollWheelZoom(!0),h(i.lng,i.lat),l.value=!1},p=b=>{new s.Geocoder().getLocation(b,v=>{c.setPosition(b),d.panTo(b),a("update:address",v.address),a("update:lng",b.lng),a("update:lat",b.lat),a("change",{value:{address:v.address,lng:b.lng,lat:b.lat}})})},h=(b,k)=>{if(b&&k&&s){const v=new s.Point(b,k);c&&c.setPosition(v),d&&d.panTo(v)}};let m=null;return t({setPoint:h,querySearchAsync:(b,k)=>{!d||!s||(m||(m=new s.LocalSearch(d,{onSearchComplete:v=>{const w=[];if(v){const C=v.getCurrentNumPois();for(let S=0;S<C;S++)w.push(v.getPoi(S))}k(w)}})),m.search(b))}}),n.onMounted(()=>{u()}),(b,k)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[l.value?(n.openBlock(),n.createElementBlock("div",Ou,[n.createVNode(Nt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"j-map-container",ref_key:"mapRef",ref:r},null,512)],4))}})),Iu=/^class[ {]/;function zu(e){return Iu.test(e.toString())}function Po(e){return Array.isArray(e)}function Ro(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zn(...e){e.length===1&&Po(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Du=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Hu=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Wu=/\/\*([^*]*)\*\//m;function Uu(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(zu(e)?Du:Hu);if(!t)return[];const o=t[1]||t[2];return o&&o.split(",").map(i=>{const a=i.match(Wu);return(a&&a[1]||i).trim()})||[]}function ul(e,t){const o=t||{get:function(w,C){if(i.push(w),C===!1)return null;throw s(`No provider for "${w}"!`)}},i=[],a=this._providers=Object.create(o._providers||null),l=this._instances=Object.create(null),r=l.injector=this,s=function(w){const C=i.join(" -> ");return i.length=0,new Error(C?`${w} (Resolving: ${C})`:w)};function d(w,C){if(!a[w]&&w.includes(".")){const S=w.split(".");let y=d(S.shift());for(;S.length;)y=y[S.shift()];return y}if(Ro(l,w))return l[w];if(Ro(a,w)){if(i.indexOf(w)!==-1)throw i.push(w),s("Cannot resolve circular dependency!");return i.push(w),l[w]=a[w][0](a[w][1]),i.pop(),l[w]}return o.get(w,C)}function c(w,C){if(typeof C>"u"&&(C={}),typeof w!="function")if(Po(w))w=zn(w.slice());else throw s(`Cannot invoke "${w}". Expected a function!`);const y=(w.$inject||Uu(w)).map(E=>Ro(C,E)?C[E]:d(E));return{fn:w,dependencies:y}}function f(w){const{fn:C,dependencies:S}=c(w),y=Function.prototype.bind.call(C,null,...S);return new y}function u(w,C,S){const{fn:y,dependencies:E}=c(w,S);return y.apply(C,E)}function p(w){return zn(C=>w.get(C))}function h(w,C){if(C&&C.length){const S=Object.create(null),y=Object.create(null),E=[],B=[],_=[];let T,j,D,A;for(let R in a)T=a[R],C.indexOf(R)!==-1&&(T[2]==="private"?(j=E.indexOf(T[3]),j===-1?(D=T[3].createChild([],C),A=p(D),E.push(T[3]),B.push(D),_.push(A),S[R]=[A,R,"private",D]):S[R]=[_[j],R,"private",B[j]]):S[R]=[T[2],T[1]],y[R]=!0),(T[2]==="factory"||T[2]==="type")&&T[1].$scope&&C.forEach(V=>{T[1].$scope.indexOf(V)!==-1&&(S[R]=[T[2],T[1]],y[V]=!0)});C.forEach(R=>{if(!y[R])throw new Error('No provider for "'+R+'". Cannot use provider from the parent!')}),w.unshift(S)}return new ul(w,r)}const m={factory:u,type:f,value:function(w){return w}};function g(w,C){const S=w.__init__||[];return function(){S.forEach(y=>{typeof y=="string"?C.get(y):C.invoke(y)})}}function b(w){const C=w.__exports__;if(C){const S=w.__modules__,y=Object.keys(w).reduce((j,D)=>(D!=="__exports__"&&D!=="__modules__"&&D!=="__init__"&&D!=="__depends__"&&(j[D]=w[D]),j),Object.create(null)),E=(S||[]).concat(y),B=h(E),_=zn(function(j){return B.get(j)});C.forEach(function(j){a[j]=[_,j,"private",B]});const T=(w.__init__||[]).slice();return T.unshift(function(){B.init()}),w=Object.assign({},w,{__init__:T}),g(w,B)}return Object.keys(w).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const y=w[S];if(y[2]==="private"){a[S]=y;return}const E=y[0],B=y[1];a[S]=[m[E],Ju(E,B),E]}),g(w,r)}function k(w,C){return w.indexOf(C)!==-1||(w=(C.__depends__||[]).reduce(k,w),w.indexOf(C)!==-1)?w:w.concat(C)}function v(w){const C=w.reduce(k,[]).map(b);let S=!1;return function(){S||(S=!0,C.forEach(y=>y()))}}this.get=d,this.invoke=u,this.instantiate=f,this.createChild=h,this.init=v(e)}function Ju(e,t){return e!=="value"&&Po(t)&&(t=zn(t.slice())),t}function Mt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}var Yu=1e3;function at(e,t){var o=this;t=t||Yu,e.on(["render.shape","render.connection"],t,function(i,a){var l=i.type,r=a.element,s=a.gfx,d=a.attrs;if(o.canRender(r))return l==="render.shape"?o.drawShape(s,r,d):o.drawConnection(s,r,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,a){if(o.canRender(a))return i.type==="render.getShapePath"?o.getShapePath(a):o.getConnectionPath(a)})}at.prototype.canRender=function(e){},at.prototype.drawShape=function(e,t){},at.prototype.drawConnection=function(e,t){},at.prototype.getShapePath=function(e){},at.prototype.getConnectionPath=function(e){};const Dn=Object.prototype.toString,qu=Object.prototype.hasOwnProperty;function Ao(e){return e===void 0}function Zt(e){return e!==void 0}function Oo(e){return e==null}function Ne(e){return Dn.call(e)==="[object Array]"}function ht(e){return Dn.call(e)==="[object Object]"}function We(e){return Dn.call(e)==="[object Number]"}function mt(e){const t=Dn.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Gu(e){if(!Ne(e))throw new Error("must supply array")}function Fo(e,t){return!Oo(e)&&qu.call(e,t)}function gt(e,t){const o=zo(t);let i;return Z(e,function(a,l){if(o(a,l))return i=a,!1}),i}function Qt(e,t){const o=zo(t);let i=[];return Z(e,function(a,l){o(a,l)&&i.push(a)}),i}function Z(e,t){let o,i;if(Ao(e))return;const a=Ne(e)?tf:ef;for(let l in e)if(Fo(e,l)&&(o=e[l],i=t(o,a(l)),i===!1))return o}function Ku(e,t){if(Ao(e))return[];Gu(e);const o=zo(t);return e.filter(function(i,a){return!o(i,a)})}function en(e,t,o){return Z(e,function(i,a){o=t(o,i,a)}),o}function fl(e,t){return!!en(e,function(o,i,a){return o&&t(i,a)},!0)}function Xu(e,t){return!!gt(e,t)}function yt(e,t){let o=[];return Z(e,function(i,a){o.push(t(i,a))}),o}function Zu(e){return yt(e,t=>t)}function pl(e,t,o={}){return t=Io(t),Z(e,function(i){let a=t(i)||"_",l=o[a];l||(l=o[a]=[]),l.push(i)}),o}function Qu(e,...t){e=Io(e);let o={};return Z(t,a=>pl(a,e,o)),yt(o,function(a,l){return a[0]})}function hl(e,t){t=Io(t);let o=[];return Z(e,function(i,a){let l=t(i,a),r={d:l,v:i};for(var s=0;s<o.length;s++){let{d}=o[s];if(l<d){o.splice(s,0,r);return}}o.push(r)}),yt(o,i=>i.v)}function Io(e){return mt(e)?e:t=>t[e]}function zo(e){return mt(e)?e:t=>t===e}function ef(e){return e}function tf(e){return Number(e)}function nf(e,t){let o,i,a,l;function r(u){let p=Date.now(),h=u?0:l+t-p;if(h>0)return s(h);e.apply(a,i),d()}function s(u){o=setTimeout(r,u)}function d(){o&&clearTimeout(o),o=l=i=a=void 0}function c(){o&&r(!0),d()}function f(...u){l=Date.now(),i=u,a=this,o||s(t)}return f.flush=c,f.cancel=d,f}function Do(e,t){return e.bind(t)}function ie(e,...t){return Object.assign(e,...t)}function Ho(e,t){let o={},i=Object(e);return Z(t,function(a){a in i&&(o[a]=e[a])}),o}function of(e,t){let o={},i=Object(e);return Z(i,function(a,l){t.indexOf(l)===-1&&(o[l]=a)}),o}function af(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function lf(e,t){return t.appendChild(af(e,t))}function Ee(e,t){return lf(t,e),e}var Wo=2,ml={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Wo,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Wo,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function rf(e,t){return ml[t]?e.style[t]:e.getAttributeNS(null,t)}function gl(e,t,o){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=ml[i];a?(a===Wo&&typeof o=="number"&&(o=String(o)+"px"),e.style[i]=o):e.setAttributeNS(null,t,o)}function sf(e,t){var o=Object.keys(t),i,a;for(i=0,a;a=o[i];i++)gl(e,a,t[a])}function ce(e,t,o){if(typeof t=="string")if(o!==void 0)gl(e,t,o);else return rf(e,t);else sf(e,t);return e}const cf=Object.prototype.toString;function Ge(e){return new bt(e)}function bt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}bt.prototype.add=function(e){return this.list.add(e),this},bt.prototype.remove=function(e){return cf.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},bt.prototype.removeMatching=function(e){const t=this.array();for(let o=0;o<t.length;o++)e.test(t[o])&&this.remove(t[o]);return this},bt.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},bt.prototype.array=function(){return Array.from(this.list)},bt.prototype.has=bt.prototype.contains=function(e){return this.list.contains(e)};function yl(e){return e.cloneNode(!0)}var Uo={svg:"http://www.w3.org/2000/svg"},bl='<svg xmlns="'+Uo.svg+'"';function df(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Uo.svg)===-1&&(e=bl+e.substring(4)):(e=bl+">"+e+"</svg>",t=!0);var o=uf(e);if(!t)return o;for(var i=document.createDocumentFragment(),a=o.firstChild;a.firstChild;)i.appendChild(a.firstChild);return i}function uf(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Se(e,t){var o;return e=e.trim(),e.charAt(0)==="<"?(o=df(e).firstChild,o=document.importNode(o,!0)):o=document.createElementNS(Uo.svg,e),t&&ce(o,t),o}var Jo=null;function wl(){return Jo===null&&(Jo=Se("svg")),Jo}function vl(e,t){var o,i,a=Object.keys(t);for(o=0;i=a[o];o++)e[i]=t[i];return e}function ff(e,t,o,i,a,l){var r=wl().createSVGMatrix();switch(arguments.length){case 0:return r;case 1:return vl(r,e);case 6:return vl(r,{a:e,b:t,c:o,d:i,e:a,f:l})}}function pf(e){return wl().createSVGTransform()}function Lt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function hf(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function mf(e,t){var o,i;for(e.clear(),o=0;i=t[o];o++)e.appendItem(hf(e,i))}function Yo(e,t){var o=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),mf(o,t)),o.consolidate()}function Pt(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function gf(e){return["M",e.x,e.y]}function qo(e){return["L",e.x,e.y]}function yf(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function bf(e,t){const o=e.length,i=[gf(e[0])];for(let a=1;a<o;a++){const l=e[a-1],r=e[a],s=e[a+1];if(!s||!t){i.push(qo(r));continue}const d=Math.min(t,Go(r.x-l.x,r.y-l.y),Go(s.x-r.x,s.y-r.y));if(!d){i.push(qo(r));continue}const c=Hn(r,l,d),f=Hn(r,l,d*.5),u=Hn(r,s,d),p=Hn(r,s,d*.5);i.push(qo(c)),i.push(yf(f,p,u))}return i}function Hn(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Go(i,a),r=o/l;return{x:e.x+i*r,y:e.y+a*r}}function Go(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,o){We(t)&&(o=t,t=null),t||(t={});const i=Se("path",t);return We(o)&&(i.dataset.cornerRadius=String(o)),Cl(i,e)}function Cl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return ce(e,{d:Pt(bf(t,o))}),e}function wf(e){return Qt(e,function(t){return!gt(e,function(o){return o!==t&&kl(t,o)})})}function kl(e,t){if(t){if(e===t)return t;if(e.parent)return kl(e.parent,t)}}function xl(e,t,o){o=o||0,Ne(e)||(e=[e]),Z(e,function(i,a){var l=t(i,a,o);Ne(l)&&l.length&&xl(l,t,o+1)})}function vf(e,t,o){Ao(t)&&(t=!0),ht(t)&&(o=t,t=!0),o=o||{};var i=hn(o.allShapes),a=hn(o.allConnections),l=hn(o.enclosedElements),r=hn(o.enclosedConnections),s=hn(o.topLevel,t&&pl(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),i[f.source.id]&&i[f.target.id]&&(r[f.id]=l[f.id]=f),a[f.id]=f}function c(f){if(l[f.id]=f,f.waypoints)r[f.id]=a[f.id]=f;else return i[f.id]=f,Z(f.incoming,d),Z(f.outgoing,d),f.children}return xl(e,c),{allShapes:i,allConnections:a,topLevel:s,enclosedConnections:r,enclosedElements:l}}function Wn(e,t){t=!!t,Ne(e)||(e=[e]);var o,i,a,l;return Z(e,function(r){var s=r;r.waypoints&&!t&&(s=Wn(r.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,u=s.width||0;(d<o||o===void 0)&&(o=d),(c<i||i===void 0)&&(i=c),(d+u>a||a===void 0)&&(a=d+u),(c+f>l||l===void 0)&&(l=c+f)}),{x:o,y:i,height:l-i,width:a-o}}function Cf(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Sl(e){return!!(e&&e.isFrame)}function hn(e,t){return ie({},e||{},t||{})}var kf=1;function wt(e,t){at.call(this,e,kf),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Mt(wt,at),wt.prototype.canRender=function(){return!0},wt.prototype.drawShape=function(t,o,i){var a=Se("rect");return ce(a,{x:0,y:0,width:o.width||0,height:o.height||0}),Sl(o)?ce(a,ie({},this.FRAME_STYLE,i||{})):ce(a,ie({},this.SHAPE_STYLE,i||{})),Ee(t,a),a},wt.prototype.drawConnection=function(t,o,i){var a=Ko(o.waypoints,ie({},this.CONNECTION_STYLE,i||{}));return Ee(t,a),a},wt.prototype.getShapePath=function(t){var o=t.x,i=t.y,a=t.width,l=t.height,r=[["M",o,i],["l",a,0],["l",0,l],["l",-a,0],["z"]];return Pt(r)},wt.prototype.getConnectionPath=function(t){var o=t.waypoints,i,a,l=[];for(i=0;a=o[i];i++)a=a.original||a,l.push([i===0?"M":"L",a.x,a.y]);return Pt(l)},wt.$inject=["eventBus","styles"];function xf(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(o,i,a){var l=this.style(i,a);return ie(l,{class:o})},this.style=function(o,i){!Ne(o)&&!i&&(i=o,o=[]);var a=en(o,function(l,r){return ie(l,e[r]||{})},{});return i?ie(a,i):a},this.computeStyle=function(o,i,a){return Ne(i)||(a=i,i=[]),t.style(i||[],ie({},a,o||{}))}}const Sf={__init__:["defaultRenderer"],defaultRenderer:["type",wt],styles:["type",xf]};function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ef(e,t){return t.forEach(function(o){o&&typeof o!="string"&&!Array.isArray(o)&&Object.keys(o).forEach(function(i){if(i!=="default"&&!(i in e)){var a=Object.getOwnPropertyDescriptor(o,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:function(){return o[i]}})}})}),Object.freeze(e)}function Bl(e,...t){const o=e.style;return Z(t,function(i){i&&Z(i,function(a,l){o[l]=a})}),e}function _f(e,t,o){return arguments.length==2?e.getAttribute(t):(e.setAttribute(t,o),e)}const jf=Object.prototype.toString;function Vf(e){return new vt(e)}function vt(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}vt.prototype.add=function(e){return this.list.add(e),this},vt.prototype.remove=function(e){return jf.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},vt.prototype.removeMatching=function(e){const t=this.array();for(let o=0;o<t.length;o++)e.test(t[o])&&this.remove(t[o]);return this},vt.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},vt.prototype.array=function(){return Array.from(this.list)},vt.prototype.has=vt.prototype.contains=function(e){return this.list.contains(e)};function Tf(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Xo(e,t,o){var i=o?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function Nf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Un={},El;function $f(){if(El)return Un;El=1;var e,t,o;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",o=e!=="addEventListener"?"on":""}return Un.bind=function(a,l,r,s){return e||i(),a[e](o+l,r,s||!1),r},Un.unbind=function(a,l,r,s){return t||i(),a[t](o+l,r,s||!1),r},Un}var _l=$f(),Mf=Nf(_l),ke=Ef({__proto__:null,default:Mf},[_l]),jl=["focus","blur"];function Lf(e,t,o,i,a){return jl.indexOf(o)!==-1&&(a=!0),ke.bind(e,o,function(l){var r=l.target||l.srcElement;l.delegateTarget=Xo(r,t,!0),l.delegateTarget&&i.call(e,l)},a)}function Pf(e,t,o,i){return jl.indexOf(t)!==-1&&(i=!0),ke.unbind(e,t,o,i)}var Vl={bind:Lf,unbind:Pf};function mn(e,t){return t=t||document,t.querySelector(e)}function Rf(e,t){return t=t||document,t.querySelectorAll(e)}function gn(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function lt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var i=e.indexOf(t);if(i!==-1){if(i===o)return;if(o!==-1)e.splice(i,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Zo(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Af(e,t,o,i){if(!e||!t||!o)return!1;var a=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),l=Qo(e,t);return Math.abs(a/l)<=i}var Of=2;function Tl(e,t){var o=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[a,l]of Object.entries(i))if(Ff(a,o))return l;return!1}function Ff(e,t){const o=t[0];return fl(t,function(i){return Math.abs(o[e]-i[e])<=Of})}function Nl(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}var If=/,?([a-z]),?/gi,$l=parseFloat,je=Math,Ct=je.PI,Qe=je.min,et=je.max,Ml=je.pow,kt=je.abs,zf=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Df=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ll=Array.isArray||function(e){return e instanceof Array};function Hf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wf(e,t){for(var o=0,i=e.length;o<i;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function Uf(e){function t(){var o=Array.prototype.slice.call(arguments,0),i=o.join("␀"),a=t.cache=t.cache||{},l=t.count=t.count||[];return Hf(a,i)?(Wf(l,i),a[i]):(l.length>=1e3&&delete a[l.shift()],l.push(i),a[i]=e(...arguments),a[i])}return t}function Jf(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(zf,function(i,a,l){var r=[],s=a.toLowerCase();for(l.replace(Df,function(d,c){c&&r.push(+c)}),s=="m"&&r.length>2&&(o.push([a,...r.splice(0,2)]),s="l",a=a=="m"?"l":"L");r.length>=t[s]&&(o.push([a,...r.splice(0,t[s])]),!!t[s]););}),o.toString=ti,o}function Yf(e){for(var t=0,o=e.length;t<o;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function qf(e){for(var t=0,o=e.length;t<o;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function ei(e,t,o,i){return arguments.length===1&&(t=e.y,o=e.width,i=e.height,e=e.x),{x:e,y:t,width:o,height:i,x2:e+o,y2:t+i}}function ti(){return this.join(",").replace(If,"$1")}function Gf(e){for(var t=new Array(e.length),o=0,i=e.length;o<i;o++)for(var a=e[o],l=t[o]=new Array(a.length),r=0,s=a.length;r<s;r++)l[r]=a[r];return t.toString=ti,t}function Pl(e,t,o,i,a,l,r,s,d){var c=1-d,f=Ml(c,3),u=Ml(c,2),p=d*d,h=p*d,m=f*e+u*3*d*o+c*3*d*d*a+h*r,g=f*t+u*3*d*i+c*3*d*d*l+h*s;return{x:Jn(m),y:Jn(g)}}function Rl(e){var t=np(...e);return ei(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function xt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function Kf(e,t){return e=ei(e),t=ei(t),xt(t,e.x,e.y)||xt(t,e.x2,e.y)||xt(t,e.x,e.y2)||xt(t,e.x2,e.y2)||xt(e,t.x,t.y)||xt(e,t.x2,t.y)||xt(e,t.x,t.y2)||xt(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 Al(e,t,o,i,a){var l=-3*t+9*o-9*i+3*a,r=e*l+6*t-12*o+6*i;return e*r-3*t+3*o}function Ol(e,t,o,i,a,l,r,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,m=0;m<f;m++){var g=c*u[m]+c,b=Al(g,e,o,a,r),k=Al(g,t,i,l,s),v=b*b+k*k;h+=p[m]*je.sqrt(v)}return c*h}function Xf(e,t,o,i,a,l,r,s){if(!(et(e,o)<Qe(a,r)||Qe(e,o)>et(a,r)||et(t,i)<Qe(l,s)||Qe(t,i)>et(l,s))){var d=(e*i-t*o)*(a-r)-(e-o)*(a*s-l*r),c=(e*i-t*o)*(l-s)-(t-i)*(a*s-l*r),f=(e-o)*(l-s)-(t-i)*(a-r);if(f){var u=Jn(d/f),p=Jn(c/f),h=+u.toFixed(2),m=+p.toFixed(2);if(!(h<+Qe(e,o).toFixed(2)||h>+et(e,o).toFixed(2)||h<+Qe(a,r).toFixed(2)||h>+et(a,r).toFixed(2)||m<+Qe(t,i).toFixed(2)||m>+et(t,i).toFixed(2)||m<+Qe(l,s).toFixed(2)||m>+et(l,s).toFixed(2)))return{x:u,y:p}}}}function Jn(e){return Math.round(e*1e11)/1e11}function Zf(e,t,o){var i=Rl(e),a=Rl(t);if(!Kf(i,a))return[];var l=Ol(...e),r=Ol(...t),s=Fl(e)?1:~~(l/5)||1,d=Fl(t)?1:~~(r/5)||1,c=new Array(s+1),f=new Array(d+1),u={},p=[],h,m;for(h=0;h<s+1;h++){var g=Pl(...e,h/s);c[h]={x:g.x,y:g.y,t:h/s}}for(h=0;h<d+1;h++)g=Pl(...t,h/d),f[h]={x:g.x,y:g.y,t:h/d};for(h=0;h<s;h++)for(m=0;m<d;m++){var b=c[h],k=c[h+1],v=f[m],w=f[m+1],C=kt(k.x-b.x)<.01?"y":"x",S=kt(w.x-v.x)<.01?"y":"x",y=Xf(b.x,b.y,k.x,k.y,v.x,v.y,w.x,w.y),E;if(y){if(E=y.x.toFixed(9)+"#"+y.y.toFixed(9),u[E])continue;u[E]=!0;var B=b.t+kt((y[C]-b[C])/(k[C]-b[C]))*(k.t-b.t),_=v.t+kt((y[S]-v[S])/(w[S]-v[S]))*(w.t-v.t);B>=0&&B<=1&&_>=0&&_<=1&&p.push({x:y.x,y:y.y,t1:B,t2:_})}}return p}function Qf(e,t,o){e=Dl(e),t=Dl(t);for(var i,a,l,r,s,d,c,f,u,p,h=[],m=0,g=e.length;m<g;m++){var b=e[m];if(b[0]=="M")i=s=b[1],a=d=b[2];else{b[0]=="C"?(u=[i,a,...b.slice(1)],i=u[6],a=u[7]):(u=[i,a,i,a,s,d,s,d],i=s,a=d);for(var k=0,v=t.length;k<v;k++){var w=t[k];if(w[0]=="M")l=c=w[1],r=f=w[2];else{w[0]=="C"?(p=[l,r,...w.slice(1)],l=p[6],r=p[7]):(p=[l,r,l,r,c,f,c,f],l=c,r=f);var C=Zf(u,p);{for(var S=0,y=C.length;S<y;S++)C[S].segment1=m,C[S].segment2=k,C[S].bez1=u,C[S].bez2=p;h=h.concat(C)}}}}}return h}function ep(e){return Ll(e)&&Ll(e[0])}function tp(e){if(Yf(e))return e;var t=new Array(e.length),o=0,i=0,a=0,l=0,r=0,s;e[0][0]=="M"&&(o=+e[0][1],i=+e[0][2],a=o,l=i,r++,t[0]=["M",o,i]);for(var d,c,f=r,u=e.length;f<u;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]+i;break;case"V":d[1]=+c[1]+i;break;case"H":d[1]=+c[1]+o;break;case"M":a=+c[1]+o,l=+c[2]+i;default:for(var p=1,h=c.length;p<h;p++)d[p]=+c[p]+(p%2?o:i)}else for(var m=0,g=c.length;m<g;m++)d[m]=c[m];switch(s=s.toUpperCase(),d[0]){case"Z":o=+a,i=+l;break;case"H":o=d[1];break;case"V":i=d[1];break;case"M":a=d[d.length-2],l=d[d.length-1];default:o=d[d.length-2],i=d[d.length-1]}}return t.toString=ti,t}function Fl(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Yn(e,t,o,i){return[e,t,o,i,o,i]}function Il(e,t,o,i,a,l){var r=.3333333333333333,s=2/3;return[r*e+s*o,r*t+s*i,r*a+s*o,r*l+s*i,a,l]}function zl(e,t,o,i,a,l,r,s,d,c){var f=Ct*120/180,u=Ct/180*(+a||0),p=[],h,m=Uf(function(se,xe,Ve){var H=se*je.cos(Ve)-xe*je.sin(Ve),X=se*je.sin(Ve)+xe*je.cos(Ve);return{x:H,y:X}});if(c)E=c[0],B=c[1],S=c[2],y=c[3];else{h=m(e,t,-u),e=h.x,t=h.y,h=m(s,d,-u),s=h.x,d=h.y;var g=(e-s)/2,b=(t-d)/2,k=g*g/(o*o)+b*b/(i*i);k>1&&(k=je.sqrt(k),o=k*o,i=k*i);var v=o*o,w=i*i,C=(l==r?-1:1)*je.sqrt(kt((v*w-v*b*b-w*g*g)/(v*b*b+w*g*g))),S=C*o*b/i+(e+s)/2,y=C*-i*g/o+(t+d)/2,E=je.asin(((t-y)/i).toFixed(9)),B=je.asin(((d-y)/i).toFixed(9));E=e<S?Ct-E:E,B=s<S?Ct-B:B,E<0&&(E=Ct*2+E),B<0&&(B=Ct*2+B),r&&E>B&&(E=E-Ct*2),!r&&B>E&&(B=B-Ct*2)}var _=B-E;if(kt(_)>f){var T=B,j=s,D=d;B=E+f*(r&&B>E?1:-1),s=S+o*je.cos(B),d=y+i*je.sin(B),p=zl(s,d,o,i,a,0,r,j,D,[B,T,S,y])}_=B-E;var A=je.cos(E),R=je.sin(E),V=je.cos(B),x=je.sin(B),L=je.tan(_/4),P=4/3*o*L,G=4/3*i*L,K=[e,t],ne=[e+P*R,t-G*A],pe=[s+P*x,d-G*V],fe=[s,d];if(ne[0]=2*K[0]-ne[0],ne[1]=2*K[1]-ne[1],c)return[ne,pe,fe].concat(p);p=[ne,pe,fe].concat(p).join().split(",");for(var Y=[],he=0,ae=p.length;he<ae;he++)Y[he]=he%2?m(p[he-1],p[he],u).y:m(p[he],p[he+1],u).x;return Y}function np(e,t,o,i,a,l,r,s){for(var d=[],c=[[],[]],f,u,p,h,m,g,b,k,v=0;v<2;++v){if(v==0?(u=6*e-12*o+6*a,f=-3*e+9*o-9*a+3*r,p=3*o-3*e):(u=6*t-12*i+6*l,f=-3*t+9*i-9*l+3*s,p=3*i-3*t),kt(f)<1e-12){if(kt(u)<1e-12)continue;h=-p/u,0<h&&h<1&&d.push(h);continue}b=u*u-4*p*f,k=je.sqrt(b),!(b<0)&&(m=(-u+k)/(2*f),0<m&&m<1&&d.push(m),g=(-u-k)/(2*f),0<g&&g<1&&d.push(g))}for(var w=d.length,C=w,S;w--;)h=d[w],S=1-h,c[0][w]=S*S*S*e+3*S*S*h*o+3*S*h*h*a+h*h*h*r,c[1][w]=S*S*S*t+3*S*S*h*i+3*S*h*h*l+h*h*h*s;return c[0][C]=e,c[1][C]=t,c[0][C+1]=r,c[1][C+1]=s,c[0].length=c[1].length=C+2,{x0:Qe(...c[0]),y0:Qe(...c[1]),x1:et(...c[0]),y1:et(...c[1])}}function Dl(e){if(ep(e)||(e=Jf(e)),qf(e))return e;for(var t=Gf(tp(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,h,m){var g,b;if(!p)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(p[0]in{T:1,Q:1})&&(h.qx=h.qy=null),p[0]){case"M":h.X=p[1],h.Y=p[2];break;case"A":p=["C",...zl(h.x,h.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(g=h.x*2-h.bx,b=h.y*2-h.by):(g=h.x,b=h.y),p=["C",g,b,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),p=["C",...Il(h.x,h.y,h.qx,h.qy,p[1],p[2])];break;case"Q":h.qx=p[1],h.qy=p[2],p=["C",...Il(h.x,h.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Yn(h.x,h.y,p[1],p[2])];break;case"H":p=["C",...Yn(h.x,h.y,p[1],h.y)];break;case"V":p=["C",...Yn(h.x,h.y,h.x,p[1])];break;case"Z":p=["C",...Yn(h.x,h.y,h.X,h.Y)];break}return p},a=function(p,h){if(p[h].length>7){p[h].shift();for(var m=p[h];m.length;)l[h]="A",p.splice(h++,0,["C",...m.splice(0,6)]);p.splice(h,1),c=t.length}},l=[],r="",s="",d=0,c=t.length;d<c;d++){t[d]&&(r=t[d][0]),r!="C"&&(l[d]=r,d&&(s=l[d-1])),t[d]=i(t[d],o,s),l[d]!="A"&&r=="C"&&(l[d]="C"),a(t,d);var f=t[d],u=f.length;o.x=f[u-2],o.y=f[u-1],o.bx=$l(f[u-4])||o.x,o.by=$l(f[u-3])||o.y}return t}function rt(e){return ht(e)&&Fo(e,"waypoints")}function Hl(e){return ht(e)&&Fo(e,"labelTarget")}function yn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qn(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function op(e){return yn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function ip(e){for(var t=e.waypoints,o=t.reduce(function(c,f,u){var p=t[u-1];if(p){var h=c[c.length-1],m=h&&h.endLength||0,g=rp(p,f);c.push({start:p,end:f,startLength:m,endLength:m+g,length:g})}return c},[]),i=o.reduce(function(c,f){return c+f.length},0),a=i/2,l=0,r=o[l];r.endLength<a;)r=o[++l];var s=(a-r.startLength)/r.length,d={x:r.start.x+(r.end.x-r.start.x)*s,y:r.start.y+(r.end.y-r.start.y)*s};return d}function tt(e){return rt(e)?ip(e):op(e)}function bn(e,t,o){o=o||0,ht(o)||(o={x:o,y:o});var i=qn(e),a=qn(t),l=i.bottom+o.y<=a.top,r=i.left-o.x>=a.right,s=i.top-o.y>=a.bottom,d=i.right+o.x<=a.left,c=l?"top":s?"bottom":null,f=d?"left":r?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function ap(e,t,o){var i=lp(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?yn(i[0]):i.length>1?(i=hl(i,function(a){var l=Math.floor(a.t2*100)||1;return l=100-l,l=(l<10?"0":"")+l,a.segment2+"#"+l}),yn(i[o?0:i.length-1])):null}function lp(e,t){return Qf(e,t)}function rp(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gn(e,t){return Math.round(e*t)/t}function Wl(e){return We(e)?e+"px":e}function sp(e){for(;e.parent;)e=e.parent;return e}function cp(e){e=ie({},{width:"100%",height:"100%"},e);const t=e.container||document.body,o=document.createElement("div");return o.setAttribute("class","djs-container djs-parent"),Bl(o,{position:"relative",overflow:"hidden",width:Wl(e.width),height:Wl(e.height)}),t.appendChild(o),o}function Ul(e,t,o){const i=Se("g");Ge(i).add(t);const a=o!==void 0?o:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[a]||null),i}const dp="base",Jl=0,up=1,fp={shape:["x","y","width","height"],connection:["waypoints"]};function ee(e,t,o,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=o,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}ee.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ee.prototype._init=function(e){const t=this._eventBus,o=this._container=cp(e),i=this._svg=Se("svg");ce(i,{width:"100%",height:"100%"}),_f(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,l=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),Ee(o,i);const a=this._viewport=Ul(i,"viewport");e.deferUpdate&&(this._viewboxChanged=nf(Do(this._viewboxChanged,this),300)),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:a})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},ee.prototype._destroy=function(){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},ee.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ee.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const o=Cf(t);o==="root"?this.removeRootElement(t):this._removeElement(t,o)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ee.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ee.prototype.restoreFocus=function(){document.activeElement===document.body&&this.focus()},ee.prototype.isFocused=function(){return this._focused},ee.prototype.getDefaultLayer=function(){return this.getLayer(dp,Jl)},ee.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let o=this._layers[e];if(o||(o=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&o.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return o.group},ee.prototype._getChildIndex=function(e){return en(this._layers,function(t,o){return o.visible&&e>=o.index&&t++,t},0)},ee.prototype._createLayer=function(e,t){typeof t>"u"&&(t=up);const o=this._getChildIndex(t);return{group:Ul(this._viewport,"layer-"+e,o),index:t,visible:!0}},ee.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const o=this._viewport,i=t.group,a=t.index;if(t.visible)return i;const l=this._getChildIndex(a);return o.insertBefore(i,o.childNodes[l]||null),t.visible=!0,i},ee.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const o=t.group;return t.visible&&(Lt(o),t.visible=!1),o},ee.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Lt(t.group))},ee.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ee.prototype.findRoot=function(e){return typeof e=="string"&&(e=this._elementRegistry.get(e)),e?(this._findPlaneForRoot(sp(e))||{}).rootElement:void 0},ee.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ee.prototype._findPlaneForRoot=function(e){return gt(this._planes,function(t){return t.rootElement===e})},ee.prototype.getContainer=function(){return this._container},ee.prototype._updateMarker=function(e,t,o){let i;e.id||(e=this._elementRegistry.get(e)),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(Z([i.gfx,i.secondaryGfx],function(a){a&&(o?(e.markers.add(t),Ge(a).add(t)):(e.markers.delete(t),Ge(a).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!o}))},ee.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ee.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ee.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),e.markers?e.markers.has(t):!1},ee.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ee.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ee.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const o=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(o,Jl);return this.hideLayer(o),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ee.prototype.removeRootElement=function(e){if(typeof e=="string"&&(e=this._elementRegistry.get(e)),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(o){return o.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},ee.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},ee.prototype._removeRoot=function(e){const t=this._elementRegistry,o=this._eventBus;o.fire("root.remove",{element:e}),o.fire("root.removed",{element:e}),t.remove(e)},ee.prototype._addRoot=function(e,t){const o=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),o.add(e,t),i.fire("root.added",{element:e,gfx:t})},ee.prototype._setRoot=function(e,t){const o=this._rootElement;o&&(this._elementRegistry.updateGraphics(o,null,!0),this.hideLayer(o.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},ee.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const o=fp[e];if(!fl(o,function(a){return typeof t[a]<"u"}))throw new Error("must supply { "+o.join(", ")+" } with "+e)},ee.prototype._setParent=function(e,t,o){lt(t.children,e,o),e.parent=t},ee.prototype._addElement=function(e,t,o,i){o=o||this.getRootElement();const a=this._eventBus,l=this._graphicsFactory;this._ensureValid(e,t),a.fire(e+".add",{element:t,parent:o}),this._setParent(t,o,i);const r=l.create(e,t,i);return this._elementRegistry.add(t,r),l.update(e,t,r),a.fire(e+".added",{element:t,gfx:r}),t},ee.prototype.addShape=function(e,t,o){return this._addElement("shape",e,t,o)},ee.prototype.addConnection=function(e,t,o){return this._addElement("connection",e,t,o)},ee.prototype._removeElement=function(e,t){const o=this._elementRegistry,i=this._graphicsFactory,a=this._eventBus;if(e=o.get(e.id||e),!!e)return a.fire(t+".remove",{element:e}),i.remove(e),gn(e.parent&&e.parent.children,e),e.parent=null,a.fire(t+".removed",{element:e}),o.remove(e),e},ee.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ee.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ee.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ee.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ee.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ee.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,o=this.getSize();let i,a,l,r,s,d,c;if(e)this._changeViewbox(function(){s=Math.min(o.width/e.width,o.height/e.height);const f=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Yo(t,f)});else return l=this._rootElement?this.getActiveLayer():null,i=l&&l.getBBox()||{},r=Yo(t),a=r?r.matrix:ff(),s=Gn(a.a,1e3),d=Gn(-a.e||0,1e3),c=Gn(-a.f||0,1e3),e=this._cachedViewbox={x:d?d/s:0,y:c?c/s:0,width:o.width/s,height:o.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:o},e;return e},ee.prototype.scroll=function(e){const t=this._viewport;let o=t.getCTM();return e&&this._changeViewbox(function(){e=ie({dx:0,dy:0},e||{}),o=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(o),Yl(t,o)}),{x:o.e,y:o.f}},ee.prototype.scrollToElement=function(e,t){let o=100;typeof e=="string"&&(e=this._elementRegistry.get(e));const i=this.findRoot(e);if(i!==this.getRootElement()&&this.setRootElement(i),i===e)return;t||(t={}),typeof t=="number"&&(o=t),t={top:t.top||o,right:t.right||o,bottom:t.bottom||o,left:t.left||o};const a=Wn(e),l=qn(a),r=this.viewbox(),s=this.zoom();let d,c;r.y+=t.top/s,r.x+=t.left/s,r.width-=(t.right+t.left)/s,r.height-=(t.bottom+t.top)/s;const f=qn(r);if(!(a.width<r.width&&a.height<r.height))d=a.x-r.x,c=a.y-r.y;else{const p=Math.max(0,l.right-f.right),h=Math.min(0,l.left-f.left),m=Math.max(0,l.bottom-f.bottom),g=Math.min(0,l.top-f.top);d=p||h,c=m||g}this.scroll({dx:-d*s,dy:-c*s})},ee.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let o,i;return this._changeViewbox(function(){typeof t!="object"&&(o=this.viewbox().outer,t={x:o.width/2,y:o.height/2}),i=this._setZoom(e,t)}),Gn(i.a,1e3)};function Yl(e,t){const o="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",o)}ee.prototype._fitViewport=function(e){const t=this.viewbox(),o=t.outer,i=t.inner;let a,l;return i.x>=0&&i.y>=0&&i.x+i.width<=o.width&&i.y+i.height<=o.height&&!e?l={x:0,y:0,width:Math.max(i.width+i.x,o.width),height:Math.max(i.height+i.y,o.height)}:(a=Math.min(1,o.width/i.width,o.height/i.height),l={x:i.x+(e?i.width/2-o.width/a/2:0),y:i.y+(e?i.height/2-o.height/a/2:0),width:o.width/a,height:o.height/a}),this.viewbox(l),this.viewbox(!1).scale},ee.prototype._setZoom=function(e,t){const o=this._svg,i=this._viewport,a=o.createSVGMatrix(),l=o.createSVGPoint();let r,s,d,c,f;d=i.getCTM();const u=d.a;return t?(r=ie(l,t),s=r.matrixTransform(d.inverse()),c=a.translate(s.x,s.y).scale(1/u*e).translate(-s.x,-s.y),f=d.multiply(c)):f=a.scale(e),Yl(this._viewport,f),f},ee.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ee.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let o;e.waypoints?o=this.getGraphics(e).getBBox():o=e;const i=o.x*t.scale-t.x*t.scale,a=o.y*t.scale-t.y*t.scale,l=o.width*t.scale,r=o.height*t.scale;return{x:i,y:a,width:l,height:r}},ee.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var tn="data-element-id";function Ue(e){this._elements={},this._eventBus=e}Ue.$inject=["eventBus"],Ue.prototype.add=function(e,t,o){var i=e.id;this._validateId(i),ce(t,tn,i),o&&ce(o,tn,i),this._elements[i]={element:e,gfx:t,secondaryGfx:o}},Ue.prototype.remove=function(e){var t=this._elements,o=e.id||e,i=o&&t[o];i&&(ce(i.gfx,tn,""),i.secondaryGfx&&ce(i.secondaryGfx,tn,""),delete t[o])},Ue.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var o=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,o,i)},Ue.prototype.updateGraphics=function(e,t,o){var i=e.id||e,a=this._elements[i];return o?a.secondaryGfx=t:a.gfx=t,t&&ce(t,tn,i),t},Ue.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ce(e,tn);var o=this._elements[t];return o&&o.element},Ue.prototype.filter=function(e){var t=[];return this.forEach(function(o,i){e(o,i)&&t.push(o)}),t},Ue.prototype.find=function(e){for(var t=this._elements,o=Object.keys(t),i=0;i<o.length;i++){var a=o[i],l=t[a],r=l.element,s=l.gfx;if(e(r,s))return r}},Ue.prototype.getAll=function(){return this.filter(function(e){return e})},Ue.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(o){var i=t[o],a=i.element,l=i.gfx;return e(a,l)})},Ue.prototype.getGraphics=function(e,t){var o=e.id||e,i=this._elements[o];return i&&(t?i.secondaryGfx:i.gfx)},Ue.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function pp(e,t,o,i){var a=o.inverse;return Object.defineProperty(e,"remove",{value:function(l){var r=this.indexOf(l);return r!==-1&&(this.splice(r,1),t.unset(l,a,i)),l}}),Object.defineProperty(e,"contains",{value:function(l){return this.indexOf(l)!==-1}}),Object.defineProperty(e,"add",{value:function(l,r){var s=this.indexOf(l);if(typeof r>"u"){if(s!==-1)return;r=this.length}s!==-1&&this.splice(s,1),this.splice(r,0,l),s===-1&&t.set(l,a,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function hp(e){return e.__refs_collection===!0}function mp(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ql(e,t,o){var i=pp(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(a){e.set(a,t.inverse,o)})}function gp(e,t,o){var i=t.inverse,a=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return a},set:function(l){if(l!==a){var r=a;a=null,r&&e.unset(r,i,o),a=l,e.set(a,i,o)}}})}function qe(e,t){if(!(this instanceof qe))return new qe(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}qe.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?ql(this,t,e):gp(this,t,e)},qe.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return hp(o)||ql(this,t,e),o},qe.prototype.ensureBound=function(e,t){mp(e,t)||this.bind(e,t)},qe.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},qe.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var ni=new qe({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gl=new qe({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Kl=new qe({name:"attachers",collection:!0},{name:"host"}),Xl=new qe({name:"outgoing",collection:!0},{name:"source"}),Zl=new qe({name:"incoming",collection:!0},{name:"target"});function nn(){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)}}),ni.bind(this,"parent"),Gl.bind(this,"labels"),Xl.bind(this,"outgoing"),Zl.bind(this,"incoming")}function wn(){nn.call(this),ni.bind(this,"children"),Kl.bind(this,"host"),Kl.bind(this,"attachers")}Mt(wn,nn);function Ql(){nn.call(this),ni.bind(this,"children")}Mt(Ql,wn);function er(){wn.call(this),Gl.bind(this,"labelTarget")}Mt(er,wn);function tr(){nn.call(this),Xl.bind(this,"source"),Zl.bind(this,"target")}Mt(tr,nn);var yp={connection:tr,shape:wn,label:er,root:Ql};function bp(e,t){var o=yp[e];if(!o)throw new Error("unknown type: <"+e+">");return ie(new o,t)}function wp(e){return e instanceof nn}function st(){this._uid=12}st.prototype.createRoot=function(e){return this.create("root",e)},st.prototype.createLabel=function(e){return this.create("label",e)},st.prototype.createShape=function(e){return this.create("shape",e)},st.prototype.createConnection=function(e){return this.create("connection",e)},st.prototype.create=function(e,t){return t=ie({},t||{}),t.id||(t.id=e+"_"+this._uid++),bp(e,t)};var Kn="__fn",nr=1e3,vp=Array.prototype.slice;function ze(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ze.prototype.on=function(e,t,o,i){if(e=Ne(e)?e:[e],mt(t)&&(i=o,o=t,t=nr),!We(t))throw new Error("priority must be a number");var a=o;i&&(a=Do(o,i),a[Kn]=o[Kn]||o);var l=this;e.forEach(function(r){l._addListener(r,{priority:t,callback:a,next:null})})},ze.prototype.once=function(e,t,o,i){var a=this;if(mt(t)&&(i=o,o=t,t=nr),!We(t))throw new Error("priority must be a number");function l(){l.__isTomb=!0;var r=o.apply(i,arguments);return a.off(e,l),r}l[Kn]=o,this.on(e,t,l)},ze.prototype.off=function(e,t){e=Ne(e)?e:[e];var o=this;e.forEach(function(i){o._removeListener(i,t)})},ze.prototype.createEvent=function(e){var t=new vn;return t.init(e),t},ze.prototype.fire=function(e,t){var o,i,a,l;if(l=vp.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof vn?o=t:o=this.createEvent(t),l[0]=o;var r=o.type;e!==r&&(o.type=e);try{a=this._invokeListeners(o,l,i)}finally{e!==r&&(o.type=r)}return a===void 0&&o.defaultPrevented&&(a=!1),a}},ze.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ze.prototype._destroy=function(){this._listeners={}},ze.prototype._invokeListeners=function(e,t,o){for(var i;o&&!e.cancelBubble;)i=this._invokeListener(e,t,o),o=o.next;return i},ze.prototype._invokeListener=function(e,t,o){var i;if(o.callback.__isTomb)return i;try{i=Cp(o.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(a){if(!this.handleError(a))throw console.error("unhandled error in event listener",a),a}return i},ze.prototype._addListener=function(e,t){var o=this._getListeners(e),i;if(!o){this._setListeners(e,t);return}for(;o;){if(o.priority<t.priority){t.next=o,i?i.next=t:this._setListeners(e,t);return}i=o,o=o.next}i.next=t},ze.prototype._getListeners=function(e){return this._listeners[e]},ze.prototype._setListeners=function(e,t){this._listeners[e]=t},ze.prototype._removeListener=function(e,t){var o=this._getListeners(e),i,a,l;if(!t){this._setListeners(e,null);return}for(;o;)i=o.next,l=o.callback,(l===t||l[Kn]===t)&&(a?a.next=i:this._setListeners(e,i)),a=o,o=i};function vn(){}vn.prototype.stopPropagation=function(){this.cancelBubble=!0},vn.prototype.preventDefault=function(){this.defaultPrevented=!0},vn.prototype.init=function(e){ie(this,e||{})};function Cp(e,t){return e.apply(null,t)}function Xn(e){return e.childNodes[0]}function kp(e){return e.parentNode.childNodes[1]}function Zn(e,t,o){var i=pf();i.setTranslate(t,o),Yo(e,i)}function Je(e,t){this._eventBus=e,this._elementRegistry=t}Je.$inject=["eventBus","elementRegistry"],Je.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),o;return e.parent?(o=kp(t),o||(o=Se("g"),Ge(o).add("djs-children"),Ee(t.parentNode,o))):o=t,o},Je.prototype._clear=function(e){var t=Xn(e);return Tf(t),t},Je.prototype._createContainer=function(e,t,o,i){var a=Se("g");Ge(a).add("djs-group"),typeof o<"u"?or(a,t,t.childNodes[o]):Ee(t,a);var l=Se("g");Ge(l).add("djs-element"),Ge(l).add("djs-"+e),i&&Ge(l).add("djs-frame"),Ee(a,l);var r=Se("g");return Ge(r).add("djs-visual"),Ee(l,r),l},Je.prototype.create=function(e,t,o){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,o,Sl(t))},Je.prototype.updateContainments=function(e){var t=this,o=this._elementRegistry,i;i=en(e,function(a,l){return l.parent&&(a[l.parent.id]=l.parent),a},{}),Z(i,function(a){var l=a.children;if(l){var r=t._getChildrenContainer(a);Z(l.slice().reverse(),function(s){var d=o.getGraphics(s);or(d.parentNode,r)})}})},Je.prototype.drawShape=function(e,t,o={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:o})},Je.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Je.prototype.drawConnection=function(e,t,o={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:o})},Je.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Je.prototype.update=function(e,t,o){if(t.parent){var i=this._clear(o);if(e==="shape")this.drawShape(i,t),Zn(o,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ce(o,"display","none"):ce(o,"display","block")}},Je.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Lt(t.parentNode)};function or(e,t,o){var i=o||t.firstChild;e!==i&&t.insertBefore(e,i)}const xp={__depends__:[Sf],__init__:["canvas"],canvas:["type",ee],elementRegistry:["type",Ue],elementFactory:["type",st],eventBus:["type",ze],graphicsFactory:["type",Je]};function Sp(e){var t=new ul(e);return t.init(),t}function Bp(e){e=e||{};var t={config:["value",e]},o=[t,xp].concat(e.modules||[]);return Sp(o)}function Cn(e,t){this._injector=t||Bp(e),this.get("eventBus").fire("diagram.init")}Cn.prototype.get=function(e,t){return this._injector.get(e,t)},Cn.prototype.invoke=function(e,t,o){return this._injector.invoke(e,t,o)},Cn.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Cn.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function ir(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Qn(e){return e.originalEvent||e.srcEvent}function oi(e){ir(e),ir(Qn(e))}function kn(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 ar=1500;function lr(e,t,o){var i=this,a=o.get("dragging",!1);function l(r){if(!r.hover){var s=r.originalEvent,d=i._findTargetGfx(s),c=d&&e.get(d);d&&c&&(r.stopPropagation(),a.hover({element:c,gfx:d}),a.move(s))}}a&&t.on("drag.start",function(r){t.once("drag.move",ar,function(s){l(s)})}),(function(){var r,s;t.on("element.hover",function(d){r=d.gfx,s=d.element}),t.on("element.hover",ar,function(d){s&&t.fire("element.out",{element:s,gfx:r})}),t.on("element.out",function(){r=null,s=null})})(),this._findTargetGfx=function(r){var s,d;if(r instanceof MouseEvent)return s=kn(r),d=document.elementFromPoint(s.x,s.y),Ep(d)}}lr.$inject=["elementRegistry","eventBus","injector"];function Ep(e){return Xo(e,"svg, .djs-element",!0)}const _p={__init__:["hoverFix"],hoverFix:["type",lr]};function jp(){return/mac/i.test(navigator.platform)}function rr(e,t){return(Qn(e)||e).button===t}function eo(e){return rr(e,0)}function Vp(e){return rr(e,1)}function Tp(e){var t=Qn(e)||e;return eo(e)&&t.shiftKey}function Np(e){return!0}function to(e){return eo(e)||Vp(e)}var sr=500;function cr(e,t,o){var i=this;function a(B,_,T){if(!s(B,_)){var j,D,A;T?D=t.getGraphics(T):(j=_.delegateTarget||_.target,j&&(D=j,T=t.get(D))),!(!D||!T)&&(A=e.fire(B,{element:T,gfx:D,originalEvent:_}),A===!1&&(_.stopPropagation(),_.preventDefault()))}}var l={};function r(B){return l[B]}function s(B,_){var T=c[B]||eo;return!T(_)}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":Np,"element.mousedown":to,"element.mouseup":to,"element.click":to,"element.dblclick":to};function f(B,_,T){var j=d[B];if(!j)throw new Error("unmapped DOM event name <"+B+">");return a(j,_,T)}var u="svg, .djs-element";function p(B,_,T,j){var D=l[T]=function(A){a(T,A)};j&&(c[T]=j),D.$delegate=Vl.bind(B,u,_,D)}function h(B,_,T){var j=r(T);j&&Vl.unbind(B,_,j.$delegate)}function m(B){Z(d,function(_,T){p(B,T,_)})}function g(B){Z(d,function(_,T){h(B,T,_)})}e.on("canvas.destroy",function(B){g(B.svg)}),e.on("canvas.init",function(B){m(B.svg)}),e.on(["shape.added","connection.added"],function(B){var _=B.element,T=B.gfx;e.fire("interactionEvents.createHit",{element:_,gfx:T})}),e.on(["shape.changed","connection.changed"],sr,function(B){var _=B.element,T=B.gfx;e.fire("interactionEvents.updateHit",{element:_,gfx:T})}),e.on("interactionEvents.createHit",sr,function(B){var _=B.element,T=B.gfx;i.createDefaultHit(_,T)}),e.on("interactionEvents.updateHit",function(B){var _=B.element,T=B.gfx;i.updateDefaultHit(_,T)});var b=S("djs-hit djs-hit-stroke"),k=S("djs-hit djs-hit-click-stroke"),v=S("djs-hit djs-hit-all"),w=S("djs-hit djs-hit-no-move"),C={all:v,"click-stroke":k,stroke:b,"no-move":w};function S(B,_){return _=ie({stroke:"white",strokeWidth:15},_||{}),o.cls(B,["no-fill","no-border"],_)}function y(B,_){var T=C[_];if(!T)throw new Error("invalid hit type <"+_+">");return ce(B,T),B}function E(B,_){Ee(B,_)}this.removeHits=function(B){var _=Rf(".djs-hit",B);Z(_,Lt)},this.createDefaultHit=function(B,_){var T=B.waypoints,j=B.isFrame,D;return T?this.createWaypointsHit(_,T):(D=j?"stroke":"all",this.createBoxHit(_,D,{width:B.width,height:B.height}))},this.createWaypointsHit=function(B,_){var T=Ko(_);return y(T,"stroke"),E(B,T),T},this.createBoxHit=function(B,_,T){T=ie({x:0,y:0},T);var j=Se("rect");return y(j,_),ce(j,T),E(B,j),j},this.updateDefaultHit=function(B,_){var T=mn(".djs-hit",_);if(T)return B.waypoints?Cl(T,B.waypoints):ce(T,{width:B.width,height:B.height}),T},this.fire=a,this.triggerMouseEvent=f,this.mouseHandler=r,this.registerEvent=p,this.unregisterEvent=h}cr.$inject=["eventBus","elementRegistry","styles"];const $p={__init__:["interactionEvents"],interactionEvents:["type",cr]};function on(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(i){var a=i.element;o.deselect(a)}),e.on(["diagram.clear","root.set"],function(i){o.select(null)})}on.$inject=["eventBus","canvas"],on.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var i=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},on.prototype.get=function(){return this._selectedElements},on.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},on.prototype.select=function(e,t){var o=this._selectedElements,i=o.slice();Ne(e)||(e=e?[e]:[]);var a=this._canvas,l=a.getRootElement();e=e.filter(function(r){var s=a.findRoot(r);return l===s}),t?Z(e,function(r){o.indexOf(r)===-1&&o.push(r)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:o})};var dr="hover",ur="selected";function fr(e,t){this._canvas=e;function o(a,l){e.addMarker(a,l)}function i(a,l){e.removeMarker(a,l)}t.on("element.hover",function(a){o(a.element,dr)}),t.on("element.out",function(a){i(a.element,dr)}),t.on("selection.changed",function(a){function l(c){i(c,ur)}function r(c){o(c,ur)}var s=a.oldSelection,d=a.newSelection;Z(s,function(c){d.indexOf(c)===-1&&l(c)}),Z(d,function(c){s.indexOf(c)===-1&&r(c)})})}fr.$inject=["canvas","eventBus"];function pr(e,t,o,i){e.on("create.end",500,function(a){var l=a.context,r=l.canExecute,s=l.elements,d=l.hints||{},c=d.autoSelect;if(r){if(c===!1)return;Ne(c)?t.select(c):t.select(s.filter(Mp))}}),e.on("connect.end",500,function(a){var l=a.context,r=l.connection;r&&t.select(r)}),e.on("shape.move.end",500,function(a){var l=a.previousSelection||[],r=i.get(a.context.shape.id),s=gt(l,function(d){return r.id===d.id});s||t.select(r)}),e.on("element.click",function(a){if(eo(a)){var l=a.element;l===o.getRootElement()&&(l=null);var r=t.isSelected(l),s=t.get().length>1,d=Tp(a);if(r&&s)return d?t.deselect(l):t.select(l);r?t.deselect(l):t.select(l,d)}})}pr.$inject=["eventBus","selection","canvas","elementRegistry"];function Mp(e){return!e.hidden}const no={__init__:["selectionVisuals","selectionBehavior"],__depends__:[$p],selection:["type",on],selectionVisuals:["type",fr],selectionBehavior:["type",pr]};var Lp=/^djs-cursor-.*$/;function ii(e){var t=Vf(document.body);t.removeMatching(Lp),e&&t.add("djs-cursor-"+e)}function hr(){ii(null)}var Pp=5e3;function mr(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Pp,o),function(){e.off(t,o)}}function gr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function an(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rp(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var ln=Math.round,yr="djs-drag-active";function Rt(e){e.preventDefault()}function Ap(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Op(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function br(e,t,o,i){var a={threshold:5,trapClick:!0},l;function r(w){var C=t.viewbox(),S=t._container.getBoundingClientRect();return{x:C.x+(w.x-S.left)/C.scale,y:C.y+(w.y-S.top)/C.scale}}function s(w,C){C=C||l;var S=e.createEvent(ie({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,S)===!1?!1:e.fire(C.prefix+"."+w,S)}function d(w){var C=w.filter(function(S){return i.get(S.id)});C.length&&o.select(C)}function c(w,C){var S=l.payload,y=l.displacement,E=l.globalStart,B=kn(w),_=an(B,E),T=l.localStart,j=r(B),D=an(j,T);if(!l.active&&(C||Op(_)>l.threshold)){if(ie(S,{x:ln(T.x+y.x),y:ln(T.y+y.y),dx:0,dy:0},{originalEvent:w}),s("start")===!1)return b();l.active=!0,l.keepSelection||(S.previousSelection=o.get(),o.select(null)),l.cursor&&ii(l.cursor),t.addMarker(t.getRootElement(),yr)}oi(w),l.active&&(ie(S,{x:ln(j.x+y.x),y:ln(j.y+y.y),dx:ln(D.x),dy:ln(D.y)},{originalEvent:w}),s("move"))}function f(w){var C,S=!0;l.active&&(w&&(l.payload.originalEvent=w,oi(w)),S=s("end")),S===!1&&s("rejected"),C=k(S!==!0),s("ended",C)}function u(w){Rp("Escape",w)&&(Rt(w),b())}function p(w){var C;l.active&&(C=mr(e),setTimeout(C,400),Rt(w)),f(w)}function h(w){c(w)}function m(w){var C=l.payload;C.hoverGfx=w.gfx,C.hover=w.element,s("hover")}function g(w){s("out");var C=l.payload;C.hoverGfx=null,C.hover=null}function b(w){var C;if(l){var S=l.active;S&&s("cancel"),C=k(w),S&&s("canceled",C)}}function k(w){var C,S;s("cleanup"),hr(),l.trapClick?S=p:S=f,ke.unbind(document,"mousemove",c),ke.unbind(document,"dragstart",Rt),ke.unbind(document,"selectstart",Rt),ke.unbind(document,"mousedown",S,!0),ke.unbind(document,"mouseup",S,!0),ke.unbind(document,"keyup",u),ke.unbind(document,"touchstart",h,!0),ke.unbind(document,"touchcancel",b,!0),ke.unbind(document,"touchmove",c,!0),ke.unbind(document,"touchend",f,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),yr);var y=l.payload.previousSelection;return w!==!1&&y&&!o.get().length&&d(y),C=l,l=null,C}function v(w,C,S,y){l&&b(!1),typeof C=="string"&&(y=S,S=C,C=null),y=ie({},a,y||{});var E=y.data||{},B,_,T,j,D;y.trapClick?j=p:j=f,w?(B=Qn(w)||w,_=kn(w),oi(w),B.type==="dragstart"&&Rt(B)):(B=null,_={x:0,y:0}),T=r(_),C||(C=T),D=Ap(B),l=ie({prefix:S,data:E,payload:{},globalStart:_,displacement:an(C,T),localStart:T,isTouch:D},y),y.manual||(D?(ke.bind(document,"touchstart",h,!0),ke.bind(document,"touchcancel",b,!0),ke.bind(document,"touchmove",c,!0),ke.bind(document,"touchend",f,!0)):(ke.bind(document,"mousemove",c),ke.bind(document,"dragstart",Rt),ke.bind(document,"selectstart",Rt),ke.bind(document,"mousedown",j,!0),ke.bind(document,"mouseup",j,!0)),ke.bind(document,"keyup",u),e.on("element.hover",m),e.on("element.out",g)),s("init"),y.autoActivate&&c(w,!0)}e.on("diagram.destroy",b),this.init=v,this.move=c,this.hover=m,this.out=g,this.end=f,this.cancel=b,this.context=function(){return l},this.setOptions=function(w){ie(a,w)}}br.$inject=["eventBus","canvas","selection","elementRegistry"];const wr={__depends__:[_p,no],dragging:["type",br]};function vr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}vr.prototype.next=function(){return this._prefix+ ++this._counter};const Fp=new vr("ps");var Ip=["marker-start","marker-mid","marker-end"],zp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function St(e,t,o,i){this._elementRegistry=e,this._canvas=o,this._styles=i}St.$inject=["elementRegistry","eventBus","canvas","styles"],St.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")},St.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},St.prototype.addDragger=function(e,t,o,i="djs-dragger"){o=o||this.getGfx(e);var a=yl(o),l=o.getBoundingClientRect();return this._cloneMarkers(Xn(a),i),ce(a,this._styles.cls(i,[],{x:l.top,y:l.left})),Ee(t,a),ce(a,"data-preview-support-element-id",e.id),a},St.prototype.addFrame=function(e,t){var o=Se("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ee(t,o),ce(o,"data-preview-support-element-id",e.id),o},St.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var i=this;e.childNodes&&e.childNodes.forEach(a=>{i._cloneMarkers(a,t,o)}),Up(e)&&Ip.forEach(function(a){if(ce(e,a)){var l=Dp(e,a,i._canvas.getContainer());l&&i._cloneMarker(o,e,l,a,t)}})},St.prototype._cloneMarker=function(e,t,o,i,a="djs-dragger"){var l=[o.id,a,Fp.next()].join("-"),r=mn("marker#"+o.id,e);e=e||this._canvas._svg;var s=r||yl(o);s.id=l,Ge(s).add(a);var d=mn(":scope > defs",e);d||(d=Se("defs"),Ee(e,d)),Ee(d,s);var c=Wp(s.id);ce(t,i,c)};function Dp(e,t,o){var i=Hp(ce(e,t));return mn("marker#"+i,o||document)}function Hp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Wp(e){return"url(#"+e+")"}function Up(e){return zp.indexOf(e.nodeName)!==-1}const Jp={__init__:["previewSupport"],previewSupport:["type",St]};function ai(e){this._commandStack=e.get("commandStack",!1)}ai.$inject=["injector"],ai.prototype.allowed=function(e,t){var o=!0,i=this._commandStack;return i&&(o=i.canExecute(e,t)),o===void 0?!0:o};const Cr={__init__:["rules"],rules:["type",ai]};var Yp="drop-ok",kr="drop-not-ok",xr="attach-ok",Sr="new-parent",Br="create",qp=2e3;function Er(e,t,o,i,a){function l(d,c,f,u,p){if(!c)return!1;d=Qt(d,function(v){var w=v.labelTarget;return!v.parent&&!(Hl(v)&&d.indexOf(w)!==-1)});var h=gt(d,function(v){return!rt(v)}),m=!1,g=!1,b=!1;jr(d)&&(m=a.allowed("shape.attach",{position:f,shape:h,target:c})),m||(jr(d)?b=a.allowed("shape.create",{position:f,shape:h,source:u,target:c}):b=a.allowed("elements.create",{elements:d,position:f,target:c}));var k=p.connectionTarget;return b||m?(h&&u&&(g=a.allowed("connection.create",{source:k===u?h:u,target:k===u?u:h,hints:{targetParent:c,targetAttach:m}})),{attach:m,connect:g}):b===null||m===null?null:!1}function r(d,c){[xr,Yp,kr,Sr].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,u=d.hover,p=c.source,h=c.hints||{};if(!u){c.canExecute=!1,c.target=null;return}_r(d);var m={x:d.x,y:d.y},g=c.canExecute=u&&l(f,u,m,p,h);u&&g!==null&&(c.target=u,g&&g.attach?r(u,xr):r(u,g?Sr:kr))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&r(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,u=c.shape,p=c.elements,h=c.target,m=c.canExecute,g=m&&m.attach,b=m&&m.connect,k=c.hints||{};if(m===!1||!h)return!1;_r(d);var v={x:d.x,y:d.y};b?u=i.appendShape(f,u,v,h,{attach:g,connection:b===!0?{}:b,connectionTarget:k.connectionTarget}):(p=i.createElements(p,v,h,ie({},k,{attach:g})),u=gt(p,function(w){return!rt(w)})),ie(c,{elements:p,shape:u}),ie(d,{elements:p,shape:u})});function s(){var d=t.context();d&&d.prefix===Br&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],qp,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){Ne(c)||(c=[c]);var u=gt(c,function(m){return!rt(m)});if(u){f=ie({elements:c,hints:{},shape:u},f||{}),Z(c,function(m){We(m.x)||(m.x=0),We(m.y)||(m.y=0)});var p=Qt(c,function(m){return!m.hidden}),h=Wn(p);Z(c,function(m){rt(m)&&(m.waypoints=yt(m.waypoints,function(g){return{x:g.x-h.x-h.width/2,y:g.y-h.y-h.height/2}})),ie(m,{x:m.x-h.x-h.width/2,y:m.y-h.y-h.height/2})}),t.init(d,Br,{cursor:"grabbing",autoActivate:!0,data:{shape:u,elements:c,context:f}})}}}Er.$inject=["canvas","dragging","eventBus","modeling","rules"];function _r(e){var t=e.context,o=t.createConstraints;o&&(o.left&&(e.x=Math.max(e.x,o.left)),o.right&&(e.x=Math.min(e.x,o.right)),o.top&&(e.y=Math.max(e.y,o.top)),o.bottom&&(e.y=Math.min(e.y,o.bottom)))}function jr(e){return e&&e.length===1&&!rt(e[0])}var Gp=750;function Vr(e,t,o,i,a){function l(r){var s=Se("g");ce(s,a.cls("djs-drag-group",["no-events"]));var d=Se("g");return r.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Xn(f),c)):(f=o._createContainer("shape",d),o.drawShape(Xn(f),c),Zn(f,c.x,c.y)),i.addDragger(c,s,f))}),s}t.on("create.move",Gp,function(r){var s=r.hover,d=r.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=l(c));var u;s?(f.parentNode||(u=e.getActiveLayer(),Ee(u,f)),Zn(f,r.x,r.y)):Lt(f)}),t.on("create.cleanup",function(r){var s=r.context,d=s.dragGroup;d&&Lt(d)})}Vr.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Kp={__depends__:[wr,Jp,Cr,no],__init__:["create","createPreview"],create:["type",Er],createPreview:["type",Vr]};function Tr(e,t,o,i){function a(r,s){return i.allowed("connection.create",{source:r,target:s})}function l(r,s){return a(s,r)}e.on("connect.hover",function(r){var s=r.context,d=s.start,c=r.hover,f;if(s.hover=c,f=s.canExecute=a(d,c),!Oo(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=l(d,c),!Oo(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(r){var s=r.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(r){var s=r.context,d=s.canExecute,c=s.connectionStart,f={x:r.x,y:r.y},u=s.source,p=s.target;if(!d)return!1;var h=null,m={connectionStart:li(s)?f:c,connectionEnd:li(s)?c:f};ht(d)&&(h=d),s.connection=o.connect(u,p,h,m)}),this.start=function(r,s,d,c){ht(d)||(c=d,d=tt(s)),t.init(r,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Tr.$inject=["eventBus","dragging","modeling","rules"];function li(e){var t=e.hover,o=e.source,i=e.target;return t&&o&&t===o&&o!==i}var Xp=1100,Zp=900,Nr="connect-ok",$r="connect-not-ok";function Mr(e,t,o){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(a){var l=a.context,r=l.canExecute,s=l.hover,d=l.source,c=l.start,f=l.startPosition,u=l.target,p=l.connectionStart||f,h=l.connectionEnd||{x:a.x,y:a.y},m=p,g=h;li(l)&&(m=h,g=p),i.drawPreview(l,r,{source:d||c,target:u||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",Zp,function(a){var l=a.context,r=a.hover,s=l.canExecute;s!==null&&o.addMarker(r,s?Nr:$r)}),t.on(["connect.out","connect.cleanup"],Xp,function(a){var l=a.hover;l&&(o.removeMarker(l,Nr),o.removeMarker(l,$r))}),i&&t.on("connect.cleanup",function(a){i.cleanUp(a.context)})}Mr.$inject=["injector","eventBus","canvas"];const Qp={__depends__:[no,Cr,wr],__init__:["connectPreview"],connect:["type",Tr],connectPreview:["type",Mr]};var eh=15;function Lr(e,t){var o;function i(s){return r(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function a(s){var d=o.start,c=o.button,f=kn(s),u=an(f,d);if(!o.dragging&&th(u)>eh&&(o.dragging=!0,c===0&&mr(e),ii("grab")),o.dragging){var p=o.last||o.start;u=an(f,p),t.scroll({dx:u.x,dy:u.y}),o.last=f}s.preventDefault()}function l(s){ke.unbind(document,"mousemove",a),ke.unbind(document,"mouseup",l),o=null,hr()}function r(s){if(!Xo(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:kn(s)},ke.bind(document,"mousemove",a),ke.bind(document,"mouseup",l),!0}}this.isActive=function(){return!!o}}Lr.$inject=["eventBus","canvas"];function th(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const nh={__init__:["moveCanvas"],moveCanvas:["type",Lr]};function ri(e){return Math.log(e)/Math.log(10)}function Pr(e,t){var o=ri(e.min),i=ri(e.max),a=Math.abs(o)+Math.abs(i);return a/t}function oh(e,t){return Math.max(e.min,Math.min(e.max,t))}var ih=Math.sign||function(e){return e>=0?1:-1},si={min:.2,max:4},Rr=10,ah=.1,lh=.75;function nt(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=Do(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||lh;var i=this;t.on("canvas.focus.changed",function(a){i._init(a.focused&&e.enabled!==!1)})}nt.$inject=["config.zoomScroll","eventBus","canvas"],nt.prototype.scroll=function(t){this._canvas.scroll(t)},nt.prototype.reset=function(){this._canvas.zoom("fit-viewport")},nt.prototype.zoom=function(t,o){var i=Pr(si,Rr*2);this._totalDelta+=t,Math.abs(this._totalDelta)>ah&&(this._zoom(t,o,i),this._totalDelta=0)},nt.prototype._handleWheel=function(t){if(this._canvas.isFocused()){var o=this._container;t.preventDefault();var i=t.ctrlKey||jp()&&t.metaKey,a=t.shiftKey,l=-1*this._scale,r;if(i?l*=t.deltaMode===0?.02:.32:l*=t.deltaMode===0?1:16,i){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};r=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*ih(t.deltaY)*l,this.zoom(r,d)}else a?r={dx:l*t.deltaY,dy:0}:r={dx:l*t.deltaX,dy:l*t.deltaY},this.scroll(r)}},nt.prototype.stepZoom=function(t,o){var i=Pr(si,Rr);this._zoom(t,o,i)},nt.prototype._zoom=function(e,t,o){var i=this._canvas,a=e>0?1:-1,l=ri(i.zoom()),r=Math.round(l/o)*o;r+=o*a;var s=Math.pow(10,r);i.zoom(oh(si,s),t)},nt.prototype.toggle=function(t){var o=this._container,i=this._handleWheel,a=this._enabled;return typeof t>"u"&&(t=!a),a!==t&&ke[t?"bind":"unbind"](o,"wheel",i,!1),this._enabled=t,t},nt.prototype._init=function(e){this.toggle(e)};const rh={__init__:["zoomScroll"],zoomScroll:["type",nt]};function Be(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)}Be.$inject=["eventBus","injector"],Be.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()},Be.prototype.canExecute=function(e,t){const o={command:e,context:t},i=this._getHandler(e);let a=this._fire(e,"canExecute",o);if(a===void 0){if(!i)return!1;i.canExecute&&(a=i.canExecute(t))}return a},Be.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Be.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()}},Be.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()}},Be.prototype.register=function(e,t){this._setHandler(e,t)},Be.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)},Be.prototype.canUndo=function(){return!!this._getUndoAction()},Be.prototype.canRedo=function(){return!!this._getRedoAction()},Be.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Be.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Be.prototype._internalUndo=function(e){const t=e.command,o=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const i=t?[e+"."+t,t]:[e];let a;o=this._eventBus.createEvent(o);for(const l of i)if(a=this._eventBus.fire("commandStack."+l,o),o.cancelBubble)break;return a},Be.prototype._createId=function(){return this._uid++},Be.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Be.prototype._internalExecute=function(e,t){const o=e.command,i=e.context,a=this._getHandler(o);if(!a)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),a.preExecute&&a.preExecute(i),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),a.execute&&this._markDirty(a.execute(i)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),a.postExecute&&a.postExecute(i),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,i=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,i=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:Qu("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Be.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},Be.prototype._revertedAction=function(e){this._stackIdx--},Be.prototype._getHandler=function(e){return this._handlerMap[e]},Be.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};const sh={commandStack:["type",Be]};function rn(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 ch=1e3;function Fe(e){this._eventBus=e}Fe.$inject=["eventBus"];function dh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Fe.prototype.on=function(e,t,o,i,a,l){if((mt(t)||We(t))&&(l=a,a=i,i=o,o=t,t=null),mt(o)&&(l=a,a=i,i=o,o=ch),ht(a)&&(l=a,a=!1),!mt(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var r=this._eventBus;Z(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");r.on(d,o,a?dh(i,l):i,l)})},Fe.prototype.canExecute=ct("canExecute"),Fe.prototype.preExecute=ct("preExecute"),Fe.prototype.preExecuted=ct("preExecuted"),Fe.prototype.execute=ct("execute"),Fe.prototype.executed=ct("executed"),Fe.prototype.postExecute=ct("postExecute"),Fe.prototype.postExecuted=ct("postExecuted"),Fe.prototype.revert=ct("revert"),Fe.prototype.reverted=ct("reverted");function ct(e){return function(o,i,a,l,r){(mt(o)||We(o))&&(r=l,l=a,a=i,i=o,o=null),this.on(o,e,i,a,l,r)}}var uh=250,Ar=1400;function ci(e,t,o){Fe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ar,function(a){var l=a.context,r=l.shapes,s=l.validatedShapes;l.shapes=Or(r),l.validatedShapes=Or(s)}),i&&t.on("shape.move.start",uh,function(a){var l=a.context,r=l.shapes,s=[];Z(r,function(d){Z(d.labels,function(c){!c.hidden&&l.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),Z(s,function(d){i.makeDraggable(l,d,!0)})}),this.preExecuted("elements.move",Ar,function(a){var l=a.context,r=l.closure,s=r.enclosedElements,d=[];Z(s,function(c){Z(c.labels,function(f){s[f.id]||d.push(f)})}),r.addAll(d)}),this.preExecute(["connection.delete","shape.delete"],function(a){var l=a.context,r=l.connection||l.shape;rn(r.labels,function(s){o.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(a){var l=a.context,r=l.shape,s=r.labelTarget;s&&(l.labelTargetIndex=Zo(s.labels,r),l.labelTarget=s,r.labelTarget=null)}),this.revert("shape.delete",function(a){var l=a.context,r=l.shape,s=l.labelTarget,d=l.labelTargetIndex;s&&(lt(s.labels,r,d),r.labelTarget=s)})}Mt(ci,Fe),ci.$inject=["injector","eventBus","modeling"];function Or(e){return Qt(e,function(t){return e.indexOf(t.labelTarget)===-1})}const fh={__init__:["labelSupport"],labelSupport:["type",ci]};function Fr(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const o=Math.random()*16|0;return(t==="x"?o:o&3|8).toString(16)})}function Ir(e,t){if(t){let o=e;return Object.keys(t).forEach(i=>{o=o.replace(new RegExp(`{${i}}`,"g"),t[i])}),o}return e}function Ke(e,...t){if(typeof Object.assign=="function")return Object.assign(e,...t);if(e==null)throw new TypeError("Cannot convert undefined or null to object");const o=Object(e);for(let i=0;i<t.length;i++){const a=t[i];if(a!=null)for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&(o[l]=a[l])}return o}function zr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ph(e,t){Array.isArray(e)&&e.forEach(t)}var oo={exports:{}},Dr;function hh(){return Dr||(Dr=1,typeof Object.create=="function"?oo.exports=function(t,o){o&&(t.super_=o,t.prototype=Object.create(o.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:oo.exports=function(t,o){if(o){t.super_=o;var i=function(){};i.prototype=o.prototype,t.prototype=new i,t.prototype.constructor=t}}),oo.exports}var mh=hh();const xn=Bf(mh),gh={width:90,height:20};function At(){st.call(this),this._translate=Ir}xn(At,st),At.$inject=[],At.prototype.baseCreate=st.prototype.create,At.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Ke({type:"label"},gh,t)):this.createFlowElement(e,t)},At.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Fr()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const i=this._getDefaultSize(o.type);return t=Ke({businessObject:o,id:o.id},i,t),this.baseCreate(e,t)},At.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 io(e,t){this._modeling=e,this._canvas=t}io.$inject=["modeling","canvas"],io.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,i=e.alignment;Z(o,function(a){var l={x:0,y:0};Zt(i.left)?l.x=i.left-a.x:Zt(i.right)?l.x=i.right-a.width-a.x:Zt(i.center)?l.x=i.center-Math.round(a.width/2)-a.x:Zt(i.top)?l.y=i.top-a.y:Zt(i.bottom)?l.y=i.bottom-a.height-a.y:Zt(i.middle)&&(l.y=i.middle-Math.round(a.height/2)-a.y),t.moveElements([a],l,a.parent)})},io.prototype.postExecute=function(e){};function ao(e){this._modeling=e}ao.$inject=["modeling"],ao.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,i=e.shape,a=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,o,{attach:a.attach}),e.shape=i},ao.prototype.postExecute=function(e){var t=e.hints||{};yh(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 yh(e,t){return Xu(e.outgoing,function(o){return o.target===t})}function lo(e,t){this._canvas=e,this._layouter=t}lo.$inject=["canvas","layouter"],lo.prototype.execute=function(e){var t=e.connection,o=e.source,i=e.target,a=e.parent,l=e.parentIndex,r=e.hints;if(!o||!i)throw new Error("source and target required");if(!a)throw new Error("parent required");return t.source=o,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,r)),this._canvas.addConnection(t,a,l),t},lo.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ro=Math.round;function di(e){this._modeling=e}di.$inject=["modeling"],di.prototype.preExecute=function(e){var t=e.elements,o=e.parent,i=e.parentIndex,a=e.position,l=e.hints,r=this._modeling;Z(t,function(u){We(u.x)||(u.x=0),We(u.y)||(u.y=0)});var s=Qt(t,function(u){return!u.hidden}),d=Wn(s);Z(t,function(u){rt(u)&&(u.waypoints=yt(u.waypoints,function(p){return{x:ro(p.x-d.x-d.width/2+a.x),y:ro(p.y-d.y-d.height/2+a.y)}})),ie(u,{x:ro(u.x-d.x-d.width/2+a.x),y:ro(u.y-d.y-d.height/2+a.y)})});var c=wf(t),f={};Z(t,function(u){if(rt(u)){f[u.id]=We(i)?r.createConnection(f[u.source.id],f[u.target.id],i,u,u.parent||o,l):r.createConnection(f[u.source.id],f[u.target.id],u,u.parent||o,l);return}var p=ie({},l);c.indexOf(u)===-1&&(p.autoResize=!1),Hl(u)&&(p=of(p,["attach"])),f[u.id]=We(i)?r.createShape(u,Ho(u,["x","y","width","height"]),u.parent||o,i,p):r.createShape(u,Ho(u,["x","y","width","height"]),u.parent||o,p)}),e.elements=Zu(f)};var Hr=Math.round;function Bt(e){this._canvas=e}Bt.$inject=["canvas"],Bt.prototype.execute=function(e){var t=e.shape,o=e.position,i=e.parent,a=e.parentIndex;if(!i)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?ie(t,o):ie(t,{x:o.x-Hr(t.width/2),y:o.y-Hr(t.height/2)}),this._canvas.addShape(t,i,a),t},Bt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Sn(e){Bt.call(this,e)}Mt(Sn,Bt),Sn.$inject=["canvas"];var bh=Bt.prototype.execute;Sn.prototype.execute=function(e){var t=e.shape;return vh(t),t.labelTarget=e.labelTarget,bh.call(this,e)};var wh=Bt.prototype.revert;Sn.prototype.revert=function(e){return e.shape.labelTarget=null,wh.call(this,e)};function vh(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Bn(e,t){this._canvas=e,this._modeling=t}Bn.$inject=["canvas","modeling"],Bn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;rn(o.incoming,function(i){t.removeConnection(i,{nested:!0})}),rn(o.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Bn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Zo(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Bn.prototype.revert=function(e){var t=e.connection,o=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,lt(o.children,t,i),this._canvas.addConnection(t,o),t};function ui(e,t){this._modeling=e,this._elementRegistry=t}ui.$inject=["modeling","elementRegistry"],ui.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,i=e.elements;Z(i,function(a){o.get(a.id)&&(a.waypoints?t.removeConnection(a):t.removeShape(a))})};function En(e,t){this._canvas=e,this._modeling=t}En.$inject=["canvas","modeling"],En.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;rn(o.incoming,function(i){t.removeConnection(i,{nested:!0})}),rn(o.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rn(o.children,function(i){rt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},En.prototype.execute=function(e){var t=this._canvas,o=e.shape,i=o.parent;return e.oldParent=i,e.oldParentIndex=Zo(i.children,o),t.removeShape(o),o},En.prototype.revert=function(e){var t=this._canvas,o=e.shape,i=e.oldParent,a=e.oldParentIndex;return lt(i.children,o,a),t.addShape(o,i),o};function so(e){this._modeling=e}so.$inject=["modeling"];var Wr={x:"y",y:"x"};so.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,i=e.axis,a=e.dimension;function l(b,k){b.range.min=Math.min(k[i],b.range.min),b.range.max=Math.max(k[i]+k[a],b.range.max)}function r(b){return b[i]+b[a]/2}function s(b){return b.length-1}function d(b){return b.max-b.min}function c(b,k){var v={y:0};v[i]=b-r(k),v[i]&&(v[Wr[i]]=0,t.moveElements([k],v,k.parent))}var f=o[0],u=s(o),p=o[u],h,m,g=0;Z(o,function(b,k){var v,w,C;if(b.elements.length<2){k&&k!==o.length-1&&(l(b,b.elements[0]),g+=d(b.range));return}v=hl(b.elements,i),w=v[0],k===u&&(w=v[s(v)]),C=r(w),b.range=null,Z(v,function(S){if(c(C,S),b.range===null){b.range={min:S[i],max:S[i]+S[a]};return}l(b,S)}),k&&k!==o.length-1&&(g+=d(b.range))}),m=Math.abs(p.range.min-f.range.max),h=Math.round((m-g)/(o.length-1)),!(h<o.length-1)&&Z(o,function(b,k){var v={},w;b===f||b===p||(w=o[k-1],b.range.max=0,Z(b.elements,function(C,S){v[Wr[i]]=0,v[i]=w.range.max-C[i]+h,b.range.min!==C[i]&&(v[i]+=C[i]-b.range.min),v[i]&&t.moveElements([C],v,C.parent),b.range.max=Math.max(C[i]+C[a],S?b.range.max:0)}))})},so.prototype.postExecute=function(e){};function co(e,t){this._layouter=e,this._canvas=t}co.$inject=["layouter","canvas"],co.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return ie(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},co.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function fi(){}fi.prototype.execute=function(e){var t=e.connection,o=e.delta,i=e.newParent||t.parent,a=e.newParentIndex,l=t.parent;return e.oldParent=l,e.oldParentIndex=gn(l.children,t),lt(i.children,t,a),t.parent=i,Z(t.waypoints,function(r){r.x+=o.x,r.y+=o.y,r.original&&(r.original.x+=o.x,r.original.y+=o.y)}),t},fi.prototype.revert=function(e){var t=e.connection,o=t.parent,i=e.oldParent,a=e.oldParentIndex,l=e.delta;return gn(o.children,t),lt(i.children,t,a),t.parent=i,Z(t.waypoints,function(r){r.x-=l.x,r.y-=l.y,r.original&&(r.original.x-=l.x,r.original.y-=l.y)}),t};function uo(e,t,o){var i=gr(t),a=gr(o),l=an(e,i),r={x:l.x*(o.width/t.width),y:l.y*(o.height/t.height)};return yn({x:a.x+r.x,y:a.y+r.y})}function pi(e,t,o){var i=fo(e),a=Jr(i,t),l=i[0];return a.length?a[a.length-1]:uo(l.original||l,o,t)}function hi(e,t,o){var i=fo(e),a=Jr(i,t),l=i[i.length-1];return a.length?a[0]:uo(l.original||l,o,t)}function mi(e,t,o){var i=fo(e),a=Ur(t,o),l=i[0];return uo(l.original||l,a,t)}function gi(e,t,o){var i=fo(e),a=Ur(t,o),l=i[i.length-1];return uo(l.original||l,a,t)}function Ur(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Jr(e,t){var o=yt(e,kh);return Qt(o,function(i){return Ch(i,t)})}function Ch(e,t){return bn(t,e,1)==="intersect"}function kh(e){return e.original||e}function yi(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yi.prototype.add=function(e,t){return this.addAll([e],t)},yi.prototype.addAll=function(e,t){var o=vf(e,!!t,this);return ie(this,o),this};function _n(e){this._modeling=e}_n.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},_n.prototype.moveClosure=function(e,t,o,i,a){var l=this._modeling,r=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;a&&a.parent===o&&(f=!0),Z(r,function(u){l.moveShape(u,t,c[u.id]&&!f&&o,{recurse:!1,layout:!1})}),Z(s,function(u){var p=!!r[u.source.id],h=!!r[u.target.id];d[u.id]&&p&&h?l.moveConnection(u,t,c[u.id]&&!f&&o):l.layoutConnection(u,{connectionStart:p&&mi(u,u.source,t),connectionEnd:h&&gi(u,u.target,t)})})},_n.prototype.getClosure=function(e){return new yi().addAll(e,!0)};function po(e){this._helper=new _n(e)}po.$inject=["modeling"],po.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},po.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 Ot(e){this._modeling=e,this._helper=new _n(e)}Ot.$inject=["modeling"],Ot.prototype.execute=function(e){var t=e.shape,o=e.delta,i=e.newParent||t.parent,a=e.newParentIndex,l=t.parent;return e.oldBounds=Ho(t,["x","y","width","height"]),e.oldParent=l,e.oldParentIndex=gn(l.children,t),lt(i.children,t,a),ie(t,{parent:i,x:t.x+o.x,y:t.y+o.y}),t},Ot.prototype.postExecute=function(e){var t=e.shape,o=e.delta,i=e.hints,a=this._modeling;i.layout!==!1&&(Z(t.incoming,function(l){a.layoutConnection(l,{connectionEnd:gi(l,t,o)})}),Z(t.outgoing,function(l){a.layoutConnection(l,{connectionStart:mi(l,t,o)})})),i.recurse!==!1&&this.moveChildren(e)},Ot.prototype.revert=function(e){var t=e.shape,o=e.oldParent,i=e.oldParentIndex,a=e.delta;return lt(o.children,t,i),ie(t,{parent:o,x:t.x-a.x,y:t.y-a.y}),t},Ot.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Ot.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function jn(e){this._modeling=e}jn.$inject=["modeling"],jn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,i=e.connection,a=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return Ne(a)&&(e.oldWaypoints=i.waypoints,i.waypoints=a),t&&(e.oldSource=i.source,i.source=t),o&&(e.oldTarget=i.target,i.target=o),i},jn.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,i=e.newTarget,a=e.dockingOrPoints,l=e.hints||{},r={};l.connectionStart&&(r.connectionStart=l.connectionStart),l.connectionEnd&&(r.connectionEnd=l.connectionEnd),l.layoutConnection!==!1&&(o&&(!i||l.docking==="source")&&(r.connectionStart=r.connectionStart||Yr(Ne(a)?a[0]:a)),i&&(!o||l.docking==="target")&&(r.connectionEnd=r.connectionEnd||Yr(Ne(a)?a[a.length-1]:a)),l.newWaypoints&&(r.waypoints=l.newWaypoints),this._modeling.layoutConnection(t,r))},jn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,i=e.oldWaypoints,a=e.connection;return t&&(a.source=t),o&&(a.target=o),i&&(a.waypoints=i),a};function Yr(e){return e.original||e}function dt(e,t){this._modeling=e,this._rules=t}dt.$inject=["modeling","rules"],dt.prototype.preExecute=function(e){var t=this,o=this._modeling,i=this._rules,a=e.oldShape,l=e.newData,r=e.hints||{},s;function d(m,g,b){return i.allowed("connection.reconnect",{connection:b,source:m,target:g})}var c={x:l.x,y:l.y},f={x:a.x,y:a.y,width:a.width,height:a.height};s=e.newShape=e.newShape||t.createShape(l,c,a.parent,r),a.host&&o.updateAttachment(s,a.host);var u;r.moveChildren!==!1&&(u=a.children.slice(),o.moveElements(u,{x:0,y:0},s,r));var p=a.incoming.slice(),h=a.outgoing.slice();Z(p,function(m){var g=m.source,b=d(g,s,m);b&&t.reconnectEnd(m,s,hi(m,s,f),r)}),Z(h,function(m){var g=m.target,b=d(s,g,m);b&&t.reconnectStart(m,s,pi(m,s,f),r)})},dt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},dt.prototype.execute=function(e){},dt.prototype.revert=function(e){},dt.prototype.createShape=function(e,t,o,i){return this._modeling.createShape(e,t,o,i)},dt.prototype.reconnectStart=function(e,t,o,i){this._modeling.reconnectStart(e,t,o,i)},dt.prototype.reconnectEnd=function(e,t,o,i){this._modeling.reconnectEnd(e,t,o,i)};function Vn(e){this._modeling=e}Vn.$inject=["modeling"],Vn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,i=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(i&&(o.width<i.width||o.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&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},ie(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Vn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,i=e.oldBounds,a=e.hints||{};a.layout!==!1&&(Z(o.incoming,function(l){t.layoutConnection(l,{connectionEnd:hi(l,o,i)})}),Z(o.outgoing,function(l){t.layoutConnection(l,{connectionStart:pi(l,o,i)})}))},Vn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return ie(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function xh(e,t){var o=[];return Z(e.concat(t),function(i){var a=i.incoming,l=i.outgoing;Z(a.concat(l),function(r){var s=r.source,d=r.target;(Tn(e,s)||Tn(e,d)||Tn(t,s)||Tn(t,d))&&(Tn(o,r)||o.push(r))})}),o}function Tn(e,t){return e.indexOf(t)!==-1}function Sh(e,t,o){var i=e.x,a=e.y,l=e.width,r=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:i,y:a+d,width:l,height:r-d};case"s":return{x:i,y:a,width:l,height:r+d};case"w":return{x:i+s,y:a,width:l-s,height:r};case"e":return{x:i,y:a,width:l+s,height:r};default:throw new Error("unknown direction: "+t)}}function Et(e){this._modeling=e}Et.$inject=["modeling"],Et.prototype.preExecute=function(e){var t=e.delta,o=e.direction,i=e.movingShapes,a=e.resizingShapes,l=e.start,r={};this.moveShapes(i,t),Z(a,function(s){r[s.id]=Eh(s)}),this.resizeShapes(a,t,o),this.updateConnectionWaypoints(xh(i,a),t,o,l,i,a,r)},Et.prototype.execute=function(){},Et.prototype.revert=function(){},Et.prototype.moveShapes=function(e,t){var o=this;Z(e,function(i){o._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Et.prototype.resizeShapes=function(e,t,o){var i=this;Z(e,function(a){var l=Sh(a,o,t);i._modeling.resizeShape(a,l,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Et.prototype.updateConnectionWaypoints=function(e,t,o,i,a,l,r){var s=this,d=a.concat(l);Z(e,function(c){var f=c.source,u=c.target,p=Bh(c),h=Gr(o),m={};_t(d,f)&&_t(d,u)?(p=yt(p,function(g){return Kr(g,i,o)&&(g[h]=g[h]+t[h]),g.original&&Kr(g.original,i,o)&&(g.original[h]=g.original[h]+t[h]),g}),s._modeling.updateWaypoints(c,p,{labelBehavior:!1})):(_t(d,f)||_t(d,u))&&(_t(a,f)?m.connectionStart=mi(c,f,t):_t(a,u)?m.connectionEnd=gi(c,u,t):_t(l,f)?m.connectionStart=pi(c,f,r[f.id]):_t(l,u)&&(m.connectionEnd=hi(c,u,r[u.id])),s._modeling.layoutConnection(c,m))})};function qr(e){return ie({},e)}function Bh(e){return yt(e.waypoints,function(t){return t=qr(t),t.original&&(t.original=qr(t.original)),t})}function Gr(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Kr(e,t,o){var i=Gr(o);if(/e|s/.test(o))return e[i]>t;if(/n|w/.test(o))return e[i]<t}function _t(e,t){return e.indexOf(t)!==-1}function Eh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ho(e){this._modeling=e}ho.$inject=["modeling"],ho.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Xr(o),t.collapsed=!t.collapsed;var i=Zr(o,t.collapsed);return[t].concat(i)},ho.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,i=t.children,a=Qr(i,o);return t.collapsed=!t.collapsed,[t].concat(a)};function Xr(e){var t={};return Z(e,function(o){t[o.id]=o.hidden,o.children&&(t=ie({},t,Xr(o.children)))}),t}function Zr(e,t){var o=[];return Z(e,function(i){i.hidden=t,o=o.concat(i),i.children&&(o=o.concat(Zr(i.children,i.collapsed||t)))}),o}function Qr(e,t){var o=[];return Z(e,function(i){i.hidden=t[i.id],o=o.concat(i),i.children&&(o=o.concat(Qr(i.children,t)))}),o}function mo(e){this._modeling=e}mo.$inject=["modeling"],mo.prototype.execute=function(e){var t=e.shape,o=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=es(i,t),ts(o,t),t.host=o,t},mo.prototype.revert=function(e){var t=e.shape,o=e.newHost,i=e.oldHost,a=e.attacherIdx;return t.host=i,es(o,t),ts(i,t,a),t};function es(e,t){return gn(e&&e.attachers,t)}function ts(e,t,o){if(e){var i=e.attachers;i||(e.attachers=i=[]),lt(i,t,o)}}function bi(){}bi.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},bi.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function be(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var i=this;e.on("diagram.init",function(){i.registerHandlers(o)})}be.$inject=["eventBus","elementFactory","commandStack"],be.prototype.getHandlers=function(){return{"shape.append":ao,"shape.create":Bt,"shape.delete":En,"shape.move":Ot,"shape.resize":Vn,"shape.replace":dt,"shape.toggleCollapse":ho,spaceTool:Et,"label.create":Sn,"connection.create":lo,"connection.delete":Bn,"connection.move":fi,"connection.layout":co,"connection.updateWaypoints":bi,"connection.reconnect":jn,"elements.create":di,"elements.move":po,"elements.delete":ui,"elements.distribute":so,"elements.align":io,"element.updateAttachment":mo}},be.prototype.registerHandlers=function(e){Z(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},be.prototype.moveShape=function(e,t,o,i,a){typeof i=="object"&&(a=i,i=null);var l={shape:e,delta:t,newParent:o,newParentIndex:i,hints:a||{}};this._commandStack.execute("shape.move",l)},be.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},be.prototype.moveElements=function(e,t,o,i){i=i||{};var a=i.attach,l=o,r;a===!0?(r=o,l=o.parent):a===!1&&(r=null);var s={shapes:e,delta:t,newParent:l,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},be.prototype.moveConnection=function(e,t,o,i,a){typeof i=="object"&&(a=i,i=void 0);var l={connection:e,delta:t,newParent:o,newParentIndex:i,hints:a||{}};this._commandStack.execute("connection.move",l)},be.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},be.prototype.createConnection=function(e,t,o,i,a,l){typeof o=="object"&&(l=a,a=i,i=o,o=void 0),i=this._create("connection",i);var r={source:e,target:t,parent:a,parentIndex:o,connection:i,hints:l};return this._commandStack.execute("connection.create",r),r.connection},be.prototype.createShape=function(e,t,o,i,a){typeof i!="number"&&(a=i,i=void 0),a=a||{};var l=a.attach,r,s;e=this._create("shape",e),l?(r=o.parent,s=o):r=o;var d={position:t,shape:e,parent:r,parentIndex:i,host:s,hints:a};return this._commandStack.execute("shape.create",d),d.shape},be.prototype.createElements=function(e,t,o,i,a){Ne(e)||(e=[e]),typeof i!="number"&&(a=i,i=void 0),a=a||{};var l={position:t,elements:e,parent:o,parentIndex:i,hints:a};return this._commandStack.execute("elements.create",l),l.elements},be.prototype.createLabel=function(e,t,o,i){o=this._create("label",o);var a={labelTarget:e,position:t,parent:i||e.parent,shape:o};return this._commandStack.execute("label.create",a),a.shape},be.prototype.appendShape=function(e,t,o,i,a){a=a||{},t=this._create("shape",t);var l={source:e,position:o,target:i,shape:t,connection:a.connection,connectionParent:a.connectionParent,hints:a};return this._commandStack.execute("shape.append",l),l.shape},be.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},be.prototype.distributeElements=function(e,t,o){var i={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",i)},be.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},be.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},be.prototype.replaceShape=function(e,t,o){var i={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",i),i.newShape},be.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},be.prototype.resizeShape=function(e,t,o,i){var a={shape:e,newBounds:t,minBounds:o,hints:i};this._commandStack.execute("shape.resize",a)},be.prototype.createSpace=function(e,t,o,i,a){var l={delta:o,direction:i,movingShapes:e,resizingShapes:t,start:a};this._commandStack.execute("spaceTool",l)},be.prototype.updateWaypoints=function(e,t,o){var i={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",i)},be.prototype.reconnect=function(e,t,o,i,a){var l={connection:e,newSource:t,newTarget:o,dockingOrPoints:i,hints:a||{}};this._commandStack.execute("connection.reconnect",l)},be.prototype.reconnectStart=function(e,t,o,i){i||(i={}),this.reconnect(e,t,e.target,o,ie(i,{docking:"source"}))},be.prototype.reconnectEnd=function(e,t,o,i){i||(i={}),this.reconnect(e,e.source,t,o,ie(i,{docking:"target"}))},be.prototype.connect=function(e,t,o,i){return this.createConnection(e,t,o||{},e.parent,i)},be.prototype._create=function(e,t){return wp(t)?t:this._elementFactory.create(e,t)},be.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function wi(e){const t=e.businessObject;if(t)return t.name||""}function _h(e,t){const o=e.businessObject;return o.name=t,e}const jh={height:20},ns=15;function Vh(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Th(e){return go(e.label)}function Nh(e){const t=e.length/2-1,o=e[Math.floor(t)],i=e[Math.ceil(t+.01)],a=$h(e),l=Math.atan((i.y-o.y)/(i.x-o.x));let{x:r,y:s}=a;return Math.abs(l)<Math.PI/2?s-=ns:r+=ns,{x:r,y:s}}function $h(e){const t=e.length/2-1,o=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:o.x+(i.x-o.x)/2,y:o.y+(i.y-o.y)/2}}function Mh(e){return e.waypoints?Nh(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+jh.height/2}}function go(e){return e&&!!e.labelTarget}const Lh={width:0,height:0};function os(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return _h(c,d),[c,f]}function i(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!go(d)&&Vh(d)&&!Th(d)&&!is(c)){let p=Mh(d);p={x:p.x,y:p.y+7},e.createLabel(d,p,{id:f.id+"_label",businessObject:f})}}function a(s){return s.oldLabel=wi(s.element),o(s.element,s.newLabel)}function l(s){return o(s.element,s.oldLabel)}function r(s){const{element:d,newLabel:c}=s,f=d.label||d,u=s.hints||{};let{newBounds:p}=s;if(!go(f))return;if(go(f)&&is(c)){u.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=wi(f);typeof p>"u"&&(p=t.getExternalLabelBounds(f,h)),p&&e.resizeShape(f,p,Lh)}this.preExecute=i,this.execute=a,this.revert=l,this.postExecute=r}os.$inject=["modeling","textRenderer"];function is(e){return!e||!e.trim()}function Nn(e,t,o){be.call(this,e,t,o)}xn(Nn,be),Nn.$inject=["eventBus","elementFactory","commandStack"],Nn.prototype.getHandlers=function(){const e=be.prototype.getHandlers.call(this);return e["element.updateLabel"]=os,e},Nn.prototype.updateLabel=function(e,t,o,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:i||{}})};function vi(e,t){Fe.call(this,e);function o(i){const{context:a}=i,l=a.hints||{};let r;!a.cropped&&l.createElementsBehavior!==!1&&(r=a.connection,r.waypoints=t.getCroppedWaypoints(r),a.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}xn(vi,Fe),vi.$inject=["eventBus","connectionDocking"];function as(){}as.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var yo=20,Ph=5,bo=Math.round,ls=20,Rh={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ah(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Oh(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function rs(e,t,o){var i=bn(t,e,Ph),a=o.split(":")[0],l=bo((t.x-e.x)/2+e.x),r=bo((t.y-e.y)/2+e.y),s,d,c=Oh(a,i),f=/h|r|l/.test(a),u=!1,p=!1;return c?(s=f?{x:l,y:e.y}:{x:e.x,y:r},d=f?"h:h":"v:v"):(u=Ah(i,a),d=f?"h:v":"v:h",u?f?(p=r===e.y,s={x:e.x+yo*(/l/.test(a)?-1:1),y:p?r+yo:r}):(p=l===e.x,s={x:p?l+yo:l,y:e.y+yo*(/t/.test(a)?-1:1)}):s={x:l,y:r}),{waypoints:Ci(e,s,d).concat(s),directions:d,turnNextDirections:p}}function Fh(e,t,o){return rs(e,t,o)}function Ih(e,t,o){var i=rs(t,e,ss(o));return{waypoints:i.waypoints.slice().reverse(),directions:ss(i.directions),turnNextDirections:i.turnNextDirections}}function zh(e,t){var o=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var a=o+":"+i,l=Ci(e.waypoints[e.waypoints.length-1],t.waypoints[0],a);return{waypoints:l,directions:a}}function ss(e){return e.split(":").reverse().join(":")}function Dh(e,t,o){var i=bo((t.x-e.x)/2+e.x),a=bo((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:i,y:e.y},{x:i,y:t.y}];if(o==="v:v")return[{x:e.x,y:a},{x:t.x,y:a}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Ci(e,t,o){if(o=o||"h:h",!Xh(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ds(o)){var i=Fh(e,t,o),a=Ih(e,t,o),l=zh(i,a);return[].concat(i.waypoints,l.waypoints,a.waypoints)}return Dh(e,t,o)}function Hh(e,t,o){var i=Ci(e,t,o);return i.unshift(e),i.push(t),fs(i)}function Wh(e,t,o,i,a){var l=a&&a.preferredLayouts||[],r=Ku(l,"straight")[0]||"h:h",s=Rh[r]||0,d=bn(e,t,s),c=Kh(d,r);o=o||tt(e),i=i||tt(t);var f=c.split(":"),u=us(o,e,f[0],Zh(d)),p=us(i,t,f[1],d);return Hh(u,p,c)}function Uh(e,t,o,i,a,l){Ne(o)&&(a=o,l=i,o=tt(e),i=tt(t)),l=ie({preferredLayouts:[]},l),a=a||[];var r=l.preferredLayouts,s=r.indexOf("straight")!==-1,d;return d=s&&Yh(e,t,o,i,l),d||(d=l.connectionEnd&&Gh(t,e,i,a),d)||(d=l.connectionStart&&qh(e,t,o,a),d)?d:!l.connectionStart&&!l.connectionEnd&&a&&a.length?a:Wh(e,t,o,i,l)}function Jh(e,t,o){return e>=t&&e<=o}function cs(e,t,o){var i={x:"width",y:"height"};return Jh(t[e],o[e],o[e]+o[i[e]])}function Yh(e,t,o,i,a){var l={},r,s;return s=bn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(r="x"),/left|right/.test(s)&&(r="y"),a.preserveDocking==="target"?cs(r,i,e)?(l[r]=i[r],[{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:i.x,y:i.y}]):null:cs(r,o,t)?(l[r]=o[r],[{x:o.x,y:o.y},{x:l.x!==void 0?l.x:i.x,y:l.y!==void 0?l.y:i.y,original:{x:l.x!==void 0?l.x:i.x,y:l.y!==void 0?l.y:i.y}}]):null):null}function qh(e,t,o,i){return ki(e,t,o,i)}function Gh(e,t,o,i){var a=i.slice().reverse();return a=ki(e,t,o,a),a?a.reverse():null}function ki(e,t,o,i){function a(f){return f.length<3?!0:f.length>4?!1:!!gt(f,function(u,p){var h=f[p-1];return h&&Qo(u,h)<3})}function l(f,u,p){var h=Tl(u,f);switch(h){case"v":return{x:p.x,y:f.y};case"h":return{x:f.x,y:p.y}}return{x:f.x,y:f.y}}function r(f,u,p){var h;for(h=f.length-2;h!==0;h--)if(Nl(f[h],u,ls)||Nl(f[h],p,ls))return f.slice(h);return f}if(a(i))return null;var s=i[0],d=i.slice(),c;return d[0]=o,d[1]=l(d[1],s,o),c=r(d,e,t),c!==d&&(d=ki(e,t,o,c)),d&&Tl(d)?null:d}function Kh(e,t){if(ds(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 Xh(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ds(e){return e&&/t|r|b|l/.test(e)}function Zh(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 us(e,t,o,i){if(o==="h"&&(o=/left/.test(i)?"l":"r"),o==="v"&&(o=/top/.test(i)?"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 fs(e){return e.reduce(function(t,o,i){var a=t[t.length-1],l=e[i+1];return Af(a,l,o,0)||t.push(o),t},[])}function xi(){}xn(xi,as);const Ft=(e,t)=>e.type===t;xi.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,i=t.target||e.target,a=t.waypoints||e.waypoints;let{connectionStart:l,connectionEnd:r}=t,s,d;return r===void 0&&(l=wo(a&&a[0],o),r=wo(a&&a[a.length-1],i)),l||(l=wo(a&&a[0],o)),r||(r=wo(a&&a[a.length-1],i)),Ft(e,"myline")&&(o===i?s={preferredLayouts:Qh(o,e)}:Ft(o,"gatewayAnd")||Ft(o,"gatewayXor")||Ft(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Ft(i,"gatewayAnd")||Ft(i,"gatewayXor")||Ft(i,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Ke(s,t),d=fs(Uh(o,i,l,r,a,s))),d||[l,r]};function wo(e,t){return e?e.original||e:tt(t)}function Qh(e,t){const{waypoints:o}=t,i=o&&o.length&&bn(o[0],e);return i==="top"?["t:r"]:i==="right"?["r:b"]:i==="left"?["l:t"]:["b:l"]}function ps(e){return ie({original:e.point.original||e.point},e.actual)}function jt(e,t){this._elementRegistry=e,this._graphicsFactory=t}jt.$inject=["elementRegistry","graphicsFactory"],jt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var i=this.getDockingPoint(e,t,!0),a=this.getDockingPoint(e,o),l=e.waypoints.slice(i.idx+1,a.idx);return l.unshift(ps(i)),l.push(ps(a)),l},jt.prototype.getDockingPoint=function(e,t,o){var i=e.waypoints,a,l,r;return a=o?0:i.length-1,l=i[a],r=this._getIntersection(t,e,o),{point:l,actual:r||l,idx:a}},jt.prototype._getIntersection=function(e,t,o){var i=this._getShapePath(e),a=this._getConnectionPath(t);return ap(i,a,o)},jt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},jt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},jt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const em={__depends__:[sh,fh,no],__init__:["modeling","elementUpdater"],modeling:["type",Nn],layouter:["type",xi],elementUpdater:["type",vi],elementFactory:["type",At],connectionDocking:["type",jt]};function tm(e){return e.businessObject}function vo(e,t){return e.businessObject.strokeWidth||t||1}function Xe(e,t){return e.businessObject.fillColor||t||"var(--color-bg-container)"}function _e(e,t){return e.businessObject.strokeColor||t||"var(--color-text)"}function nm(e){const t=e.x+e.width/2,o=e.y+e.height/2,i=e.width/2,a=[["M",t,o],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Pt(a)}function om(e,t){const{x:o,y:i,width:a,height:l}=e,r=[["M",o+t,i],["l",a-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-a,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-l],["a",t,t,0,0,1,t,-t],["z"]];return Pt(r)}function im(e){const{x:t,y:o,width:i,height:a}=e,l=i/2,r=a/2,s=[["M",t+l,o],["l",l,r],["l",-l,r],["l",-l,-r],["z"]];return Pt(s)}function am(e){const{x:t,y:o,width:i,height:a}=e,l=[["M",t,o],["l",i,0],["l",0,a],["l",-i,0],["z"]];return Pt(l)}const Si=10,Bi=.95,Vt=(e,t)=>e.type===t;function It(e,t,o,i,a,l,r){at.call(this,e,r);const s="var(--color-bg-container)",d="var(--color-text)",c={};Object.keys(l.palette).forEach(V=>{const x=l.palette[V];c[x.type]=x.options});const{computeStyle:f}=t;function u(V){return R[V]}function p(V){return t.computeStyle(V,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(V){return t.computeStyle(V,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function m(V,x,L,P){L=p(L);const G=Ko(x,L,P);return Ee(V,G),G}function g(V,x,L){return m(V,x,L,5)}function b(V,x,L,P,G){zr(P)&&(G=P,P=0),P=P||0,G=f(G,{stroke:d,strokeWidth:2,fill:s}),G.fill==="none"&&delete G.fillOpacity;const K=x/2,ne=L/2,pe=Se("circle");return ce(pe,{cx:K,cy:ne,r:Math.round((x+L)/4-P)}),ce(pe,G),Ee(V,pe),pe}function k(V,x,L,P,G,K){zr(G)&&(K=G,G=0),G=G||0,K=f(K,{stroke:d,strokeWidth:2,fill:s});const ne=Se("rect");return ce(ne,{x:G,y:G,width:x-G*2,height:L-G*2,rx:P,ry:P}),ce(ne,K),Ee(V,ne),ne}function v(V,x,L){L=f(L,["no-fill"],{strokeWidth:2,stroke:d});const P=Se("path");return ce(P,{d:x}),ce(P,L),Ee(V,P),P}function w(V,x,L,P){const G=x/2,K=L/2,pe=[{x:G,y:0},{x,y:K},{x:G,y:L},{x:0,y:K}].map(Y=>Y.x+","+Y.y).join(" ");P=f(P,{stroke:d,strokeWidth:2,fill:s});const fe=Se("polygon");return ce(fe,{points:pe}),ce(fe,P),Ee(V,fe),fe}function C(V,x,L,P){return v(x,L,Ke({"data-marker":V},P))}function S(V,x,L){L=Ke({size:{width:100}},L);const P=a.createText(x||"",L);return Ge(P).add("djs-label"),Ee(V,P),P}function y(V,x,L){const P=tm(x);return S(V,P.name,{box:x,align:L,padding:5,style:{fill:_e(x,d)}})}function E(V,x){const L={width:90,height:30,x:x.width/2+x.x,y:x.height/2+x.y};return S(V,wi(x),{box:L,fitBox:!0,style:Ke({},a.getExternalStyle(),{fill:_e(x,d)})})}function B(V,x,L){const P=L&&L.indexOf("SubProcessMarker")!==-1;let G;P?G={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:G={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},ph(L,K=>{u(K)(V,x,G)})}function _(V){return V.replace(/[^0-9a-zA-z]+/g,"_")}function T(V,x){const{ref:L={x:0,y:0},scale:P=1,element:G,parentGfx:K=i._svg}=x,ne=Se("marker",{id:V,viewBox:"0 0 20 20",refX:L.x,refY:L.y,markerWidth:20*P,markerHeight:20*P,orient:"auto"});Ee(ne,G);let pe=mn(":scope > defs",K);pe||(pe=Se("defs"),Ee(K,pe)),Ee(pe,ne)}function j(V,x,L,P){const G=x+"-"+_(L)+"-"+_(P)+"-"+Fr();return D(V,G,x,L,P),"url(#"+G+")"}function D(V,x,L,P,G){{const K=Se("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:G,stroke:G,strokeWidth:1})});T(x,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:V})}}function A(V,x,L,P){const G=c[x.type]?.icon||x.icon;if(G){const K=o.getScaledPath(G,{abspos:{x:L,y:P}});v(V,K,{strokeWidth:0,fill:_e(x,c[x.type]?.iconFill||x.iconFill)})}}const R={event(V,x,L){return"fillOpacity"in L||(L.fillOpacity=Bi),b(V,x.width,x.height,L)},startEvent(V,x){const L={fill:Xe(x,c.startEvent?.fill||x.fill),stroke:_e(x,c.startEvent?.stroke||x.stroke),strokeWidth:vo(x,c.startEvent?.strokeWidth||x.strokeWidth)},P=u("event")(V,x,L);return A(V,x,18,18),P},endEvent(V,x){const L=u("event")(V,x,{strokeWidth:vo(x,c.endEvent?.strokeWidth||x.strokeWidth||4),fill:Xe(x,c.endEvent?.fill||x.fill),stroke:_e(x,c.endEvent?.stroke||x.stroke)});return A(V,x,18,18),L},gateway(V,x){const L={fillOpacity:Bi,strokeWidth:vo(x,c[x.type]?.strokeWidth||x.strokeWidth||4),fill:Xe(x,c[x.type]?.fill||x.fill),stroke:_e(x,c[x.type]?.stroke||x.stroke)};return w(V,x.width,x.height,L)},gatewayAnd(V,x){const L=u("gateway")(V,x),P=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[x.type]?.width||x.width,containerHeight:c[x.type]?.height||x.height,position:{mx:.47,my:.29}});return v(V,P,{strokeWidth:1,fill:_e(x,c[x.type]?.iconFill||x.iconFill),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},gatewayXor(V,x){const L=u("gateway")(V,x),P=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:x.width,containerHeight:x.height,position:{mx:.32,my:.3}});return v(V,P,{strokeWidth:1,fill:_e(x,c[x.type]?.iconFill||x.iconFill),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},gatewayInclusive(V,x){const L=u("gateway")(V,x);return b(V,x.width,x.height,x.height*.24,{strokeWidth:2.5,fill:_e(x,s),stroke:_e(x,c[x.type]?.iconFill||x.iconFill)}),L},activity(V,x,L){return L=L||{},"fillOpacity"in L||(L.fillOpacity=Bi),k(V,x.width,x.height,Si,L)},task(V,x){const L={fill:Xe(x,s),stroke:_e(x,d)},P=u("activity")(V,x,L);return y(V,x,"center-middle"),B(V,x),P},userTask(V,x){const L=u("task")(V,x),P=15,G=12,K=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:P,y:G}});v(V,K,{strokeWidth:.5,fill:Xe(x,s),stroke:_e(x,d)});const ne=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:P,y:G}});v(V,ne,{strokeWidth:.5,fill:Xe(x,s),stroke:_e(x,d)});const pe=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:P,y:G}});return v(V,pe,{strokeWidth:.5,fill:_e(x,d),stroke:_e(x,d)}),L},scriptTask(V,x){const L=u("task")(V,x),P=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(V,P,{strokeWidth:1,stroke:_e(x,d)}),L},SubProcessMarker(V,x){const L=k(V,14,14,0,{strokeWidth:1,fill:Xe(x,s),stroke:_e(x,d)});Zn(L,x.width/2-7.5,x.height-20);const P=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:x.width,containerHeight:x.height,position:{mx:(x.width/2-7.5)/x.width,my:(x.height-20)/x.height}});C("sub-process",V,P,{fill:Xe(x,s),stroke:_e(x,d)})},subprocess(V,x,L){L=Ke({fill:Xe(x,s),stroke:_e(x,d)},L);const P=u("activity")(V,x,L);return y(V,x,"center-middle"),B(V,x,["SubProcessMarker"]),P},label(V,x){return E(V,x)},myline(V,x){const L=Xe(x,l.lineStroke||s),P=_e(x,l.lineStroke||d);return g(V,x.waypoints,{markerEnd:j(V,"sequenceflow-end",L,P),stroke:P})},default(V,x){const L={strokeWidth:vo(x,c[x.type]?.strokeWidth||x.strokeWidth||1),fill:Xe(x,c[x.type]?.fill||x.fill),stroke:_e(x,c[x.type]?.stroke||x.stroke)},P=k(V,x.width,x.height,x.radius||Si,L);return y(V,x,"center-middle"),B(V,x),A(V,x,x.iconX,x.iconY),P}};this.handlers=R,this._drawPath=v}xn(It,at),It.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],It.prototype.canRender=function(){return!0},It.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},It.prototype.drawConnection=function(e,t){const{type:o}=t,i=this.handlers[o];return i(e,t)},It.prototype.getShapePath=function(e){return Vt(e,"startEvent")||Vt(e,"endEvent")?nm(e):Vt(e,"userTask")||Vt(e,"scriptTask")||Vt(e,"subprocess")?om(e,Si):Vt(e,"gatewayAnd")||Vt(e,"gatewayXor")||Vt(e,"gatewayInclusive")?im(e):am(e)};var lm=0,rm={width:150,height:50};function sm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function cm(e){return ht(e)?ie({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function dm(e,t){t.textContent=e;var o;try{var i,a=e==="";return t.textContent=a?"dummy":e,o=t.getBBox(),i={width:o.width+o.x*2,height:o.height},a&&(i.width=0),i}catch(l){return console.log(l),{width:0,height:0}}}function um(e,t,o){for(var i=e.shift(),a=i,l;;){if(l=dm(a,o),l.width=a?l.width:0,a===" "||a===""||l.width<Math.round(t)||a.length<2)return fm(e,a,i,l);a=hm(a,l.width,t)}}function fm(e,t,o,i){if(t.length<o.length){var a=o.slice(t.length).trim();e.unshift(a)}return{width:i.width,height:i.height,text:t}}var hs="";function pm(e,t){var o=e.split(/(\s|-|\u00AD)/g),i,a=[],l=0;if(o.length>1)for(;i=o.shift();)if(i.length+l<t)a.push(i),l+=i.length;else{(i==="-"||i===hs)&&a.pop();break}var r=a[a.length-1];return r&&r===hs&&(a[a.length-1]="-"),a.join("")}function hm(e,t,o){var i=Math.max(e.length*(o/t),1),a=pm(e,i);return a||(a=e.slice(0,Math.max(Math.round(i-1),1))),a}function mm(){var e=document.getElementById("helper-svg");return e||(e=Se("svg"),ce(e,{id:"helper-svg"}),Bl(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function Co(e){this._config=ie({},{size:rm,padding:lm,style:{},align:"center-top"},e||{})}Co.prototype.createText=function(e,t){return this.layoutText(e,t).element},Co.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Co.prototype.layoutText=function(e,t){var o=ie({},this._config.size,t.box),i=ie({},this._config.style,t.style),a=sm(t.align||this._config.align),l=cm(t.padding!==void 0?t.padding:this._config.padding),r=t.fitBox||!1,s=gm(i),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-l.left-l.right,u=Se("text");ce(u,{x:0,y:0}),ce(u,i);var p=mm();for(Ee(p,u);d.length;)c.push(um(d,f,u));a.vertical==="middle"&&(l.top=l.bottom=0);var h=en(c,function(v,w,C){return v+(s||w.height)},0)+l.top+l.bottom,m=en(c,function(v,w,C){return w.width>v?w.width:v},0),g=l.top;a.vertical==="middle"&&(g+=(o.height-h)/2),g-=(s||c[0].height)/4;var b=Se("text");ce(b,i),Z(c,function(v){var w;switch(g+=s||v.height,a.horizontal){case"left":w=l.left;break;case"right":w=(r?m:f)-l.right-v.width;break;default:w=Math.max(((r?m:f)-v.width)/2+l.left,0)}var C=Se("tspan");ce(C,{x:w,y:g}),C.textContent=v.text,Ee(b,C)}),Lt(u);var k={width:m,height:h};return{dimensions:k,element:b}};function gm(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const ym=12,bm=1.2,wm=30;function ms(e){const t=Ke({fontFamily:"Arial, sans-serif",fontSize:ym,fontWeight:"normal",lineHeight:bm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,i=Ke({},t,{fontSize:o},e&&e.externalStyle||{}),a=new Co({style:t});this.getExternalLabelBounds=function(l,r){const s=a.getDimensions(r,{box:{width:90,height:30,x:l.width/2+l.x,y:l.height/2+l.y},style:i});return{x:Math.round(l.x+l.width/2-s.width/2),y:Math.round(l.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(l,r){const s=a.getDimensions(r,{box:l,style:t,align:"left-top",padding:5});return{x:l.x,y:l.y,width:l.width,height:Math.max(wm,Math.round(s.height))}},this.createText=function(l,r){return a.createText(l,r||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ms.$inject=["config.textRenderer"];function vm(){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 i,a;o.abspos?(i=o.abspos.x,a=o.abspos.y):(i=o.containerWidth*o.position.mx,a=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&&(i-=l.width/2),l.height&&(a-=l.height/2)):l=this.pathMap[t];const r={};if(o.position){const d=o.containerHeight/l.height*o.yScaleFactor,c=o.containerWidth/l.width*o.xScaleFactor;for(let f=0;f<l.heightElements.length;f++)r["y"+f]=l.heightElements[f]*d;for(let f=0;f<l.widthElements.length;f++)r["x"+f]=l.widthElements[f]*c}return Sm(l.d,{mx:i,my:a,e:r})}}const Cm=/\{([^}]+)\}/g,km=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function xm(e,t,o){let i=o;return t.replace(km,(a,l,r,s,d)=>{l=l||s,i&&(l in i&&(i=i[l]),typeof i=="function"&&d&&(i=i()))}),i=(i==null||i===o?e:i)+"",i}function Sm(e,t){return String(e).replace(Cm,(o,i)=>xm(o,i,t))}const Bm={__init__:["myRenderer"],myRenderer:["type",It],textRenderer:["type",ms],pathMap:["type",vm]};function gs(e,t){return Ke({id:e.id,type:e.type,businessObject:e},t)}function Em(e,t,o){const i=e.waypoint;return!i||i.length<2?[tt(t),tt(o)]:i.map(a=>({x:a.x,y:a.y}))}function Tt(e,t,o,i,a,l){this._eventBus=e,this._canvas=o,this._elementFactory=i,this._elementRegistry=a,this._translate=Ir,this._textRenderer=l,this._modeling=t}Tt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Tt.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 i=this._getSource(e),a=this._getTarget(e);t=this._elementFactory.createConnection(gs(e,{source:i,target:a,waypoints:Em(e,i,a)})),this._canvas.addConnection(t)}else{const i=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(gs(e,{x:Math.round(e.x),y:Math.round(e.y),width:i.width,height:i.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Tt.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)},Tt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Ke(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 i=this._elementRegistry.get(e+"_label");if(i)i.businessObject=o.businessObject,this._canvas.removeShape(i),this._canvas.addShape(i,o.parent);else{const{name:a}=t;if(a&&["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:a,id:e},r=this._textRenderer.getExternalLabelBounds(l,t.name);this._modeling.resizeShape(l,r,{width:0,height:0}),o&&this.addLabel(l,o)}}},Tt.prototype._getSource=function(e){return this._getElement(e.from)},Tt.prototype._getTarget=function(e){return this._getElement(e.to)},Tt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const _m={myImporter:["type",Tt]},jm=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const i=o.businessObject;if(o.type==="myline")o.source&&o.target&&(i.from=o.source.id,i.to=o.target.id,i.waypoint=o.waypoints.map(a=>({x:a.x,y:a.y})),t.push(i));else if(o.type!=="label")i.x=o.x,i.y=o.y,t.push(i);else{const a=t.find(l=>l.id===i.id);a&&(a.name=i.name||"",a.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Vm=(e,t)=>{const o=t.get("myImporter"),i=e.filter(l=>l.type!=="myline"),a=e.filter(l=>l.type==="myline");i.forEach(l=>{o.add(l)}),a.forEach(l=>{o.add(l)})},ys=te(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 i=e,a=o,l=n.ref(),r={"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",E=>{a("elementDblclick",E.element.businessObject)}),y.on("element.click",E=>{a("elementClick",E.element.businessObject)})},u=function(){return{palette:i.paletteOptions||r,lineStroke:i.lineStroke}},p=()=>{let y={__init__:["myOptions"],myOptions:["type",u]};s=new Cn({canvas:{container:l.value},modules:[Qp,Kp,em,nh,rh,y,Bm,_m]});const E=s.get("canvas"),B=s.get("elementFactory");c();const _=B.createRoot();E.setRootElement(_),f()};n.onMounted(()=>{p()});const h=y=>{const E=y==null?1:d+y;s.get("canvas").zoom(E),d=E},m=()=>{s.get("canvas").zoom(1);const y=s.get("elementRegistry").getAll();var E=jm(y);return E},g=y=>{s.clear(),c(),Vm(y,s)},b=y=>{s.get("myImporter").update(y.id,y)};return t({reset:()=>{c()},zoom:y=>{h(y)},getData:()=>m(),setData:y=>{g(y)},updateElemet:y=>{b(y)}}),(y,E)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:l,class:"lr-work-flow"},null,512))}})),Tm=[Li,na,oa,ia,aa,la,ra,sa,ca,da,ua,ma,ga,ya,ba,wa,va,Ca,ka,xa,Ba,_a,ja,Oa,Va,Ta,Na,$a,Ma,La,Pa,Ra,Aa,Za,Qa,el,tl,nl,ol,il,Fa,Ga,Xa,al,ll,rl,sl,cl,dl,Fu,ys],Nm={install:e=>{Tm.forEach(t=>{e.component(t.name,t)})}};M.EncryptionFactory=Qi,M.HashingFactory=nc,M.JAutoComplete=da,M.JBarcode=ja,M.JButton=Li,M.JButtonSelect=Za,M.JButtons=na,M.JCascaderSelect=ra,M.JCheckbox=sa,M.JCodeMirror=Oa,M.JCollapse=cl,M.JComp=el,M.JCount=Va,M.JCountUp=Ta,M.JDataPanel=Na,M.JDialog=ga,M.JDialogFull=ya,M.JDivider=$a,M.JDrawer=ba,M.JDynamicLayer=va,M.JEcharts=_a,M.JEditor=dl,M.JForm=tl,M.JFormItem=nl,M.JGuid=il,M.JHpanel=Ma,M.JIcon=ia,M.JInput=oa,M.JInputButton=La,M.JInputCode=Pa,M.JInputColor=Ra,M.JInputRows=al,M.JInputTag=Ca,M.JLayer=wa,M.JLayerForm=ll,M.JLayout=ua,M.JMenu=Ga,M.JNumber=ca,M.JPage=ol,M.JRadio=aa,M.JRate=ka,M.JSelect=la,M.JSlider=xa,M.JSliderCaptcha=Fa,M.JSwitch=rl,M.JTable=ma,M.JTablePanel=Xa,M.JTabs=sl,M.JTitle=Aa,M.JTree=Qa,M.JUpload=Ba,M.JWorkflowViewer=ys,M.buildShortUUID=Pn,M.buildUUID=dn,M.clearJson=cn,M.clone=Ln,M.deepClone=pt,M.default=Nm,M.formatToDate=pn,M.formatToDateTime=qi,M.fullScreenLoading=Ht,M.getCompConfig=$t,M.getCompType=No,M.getFunction=Vo,M.getIsInputComp=Rn,M.getIsTableInputComp=Ji,M.getLabel=Yi,M.getObjType=Pi,M.getTextWidth=fn,M.is=Mi,M.isArray=Mn,M.isNullOrEmpty=it,M.isObject=Ds,M.loadBMap=ta,M.lowerFirst=qs,M.myAesDecrypt=oc,M.numberToChinese=Ai,M.numberToThousandSeparator=Oi,M.pagination=Us,M.paginationEx=Js,M.set=Ri,M.setGroupMap=Ii,M.toArray=Di,M.toDecimal=un,M.toLeafArray=Ui,M.toSimpleTree=Ks,M.toTree=Gs,M.uniqueArray=Ys,M.upFirst=Fi,M.useSortable=ea,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|