@a2simcode/ui 0.0.45 → 0.0.47

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.
Files changed (337) hide show
  1. package/.cursor/skills/ui-component-helper/README.md +43 -0
  2. package/.cursor/skills/ui-component-helper/SKILL.md +81 -0
  3. package/dist/components/index.d.ts +1 -1
  4. package/dist/components/workflow-viewer/index.d.ts +4 -4
  5. package/dist/simcode-ui.es.js +1 -1
  6. package/dist/simcode-ui.umd.js +1 -1
  7. package/dist/stats.html +1 -1
  8. package/docs/components/autocomplete.md +89 -0
  9. package/docs/components/barcode.md +101 -0
  10. package/docs/components/button-select.md +24 -0
  11. package/docs/components/button.md +117 -0
  12. package/docs/components/buttons.md +119 -0
  13. package/docs/components/cascader-select.md +114 -0
  14. package/docs/components/checkbox.md +114 -0
  15. package/docs/components/code-mirror.md +85 -0
  16. package/docs/components/collapse.md +26 -0
  17. package/docs/components/comp.md +71 -0
  18. package/docs/components/count-up.md +24 -0
  19. package/docs/components/count.md +24 -0
  20. package/docs/components/data-panel.md +24 -0
  21. package/docs/components/dialog-full.md +112 -0
  22. package/docs/components/dialog.md +127 -0
  23. package/docs/components/divider.md +24 -0
  24. package/docs/components/drawer.md +127 -0
  25. package/docs/components/dynamic-layer.md +118 -0
  26. package/docs/components/echarts.md +72 -0
  27. package/docs/components/editor.md +24 -0
  28. package/docs/components/form.md +27 -0
  29. package/docs/components/guid.md +39 -0
  30. package/docs/components/hpanel.md +24 -0
  31. package/docs/components/icon.md +56 -0
  32. package/docs/components/input-button.md +24 -0
  33. package/docs/components/input-code.md +24 -0
  34. package/docs/components/input-color.md +114 -0
  35. package/docs/components/input-layer.md +26 -0
  36. package/docs/components/input-rows.md +370 -0
  37. package/docs/components/input-tag.md +50 -0
  38. package/docs/components/input.md +129 -0
  39. package/docs/components/layer-form.md +61 -0
  40. package/docs/components/layer.md +127 -0
  41. package/docs/components/layout.md +132 -0
  42. package/docs/components/map.md +24 -0
  43. package/docs/components/menu.md +121 -0
  44. package/docs/components/meta/autocomplete.ts +335 -0
  45. package/docs/components/meta/barcode.ts +216 -0
  46. package/docs/components/meta/button-select.ts +94 -0
  47. package/docs/components/meta/button.ts +123 -0
  48. package/docs/components/meta/buttons.ts +56 -0
  49. package/docs/components/meta/cascader-select.ts +328 -0
  50. package/docs/components/meta/checkbox.ts +194 -0
  51. package/docs/components/meta/code-mirror.ts +108 -0
  52. package/docs/components/meta/collapse.ts +52 -0
  53. package/docs/components/meta/comp.ts +224 -0
  54. package/docs/components/meta/count-up.ts +126 -0
  55. package/docs/components/meta/count.ts +113 -0
  56. package/docs/components/meta/data-panel.ts +34 -0
  57. package/docs/components/meta/dialog-full.ts +133 -0
  58. package/docs/components/meta/dialog.ts +175 -0
  59. package/docs/components/meta/divider.ts +66 -0
  60. package/docs/components/meta/drawer.ts +158 -0
  61. package/docs/components/meta/dynamic-layer.ts +99 -0
  62. package/docs/components/meta/echarts.ts +64 -0
  63. package/docs/components/meta/editor.ts +67 -0
  64. package/docs/components/meta/form-item.ts +50 -0
  65. package/docs/components/meta/form.ts +160 -0
  66. package/docs/components/meta/guid.ts +42 -0
  67. package/docs/components/meta/hpanel.ts +20 -0
  68. package/docs/components/meta/icon.ts +68 -0
  69. package/docs/components/meta/input-button.ts +165 -0
  70. package/docs/components/meta/input-code.ts +151 -0
  71. package/docs/components/meta/input-color.ts +243 -0
  72. package/docs/components/meta/input-layer.ts +336 -0
  73. package/docs/components/meta/input-rows.ts +113 -0
  74. package/docs/components/meta/input-tag.ts +112 -0
  75. package/docs/components/meta/input.ts +411 -0
  76. package/docs/components/meta/layer-form.ts +56 -0
  77. package/docs/components/meta/layer.ts +122 -0
  78. package/docs/components/meta/layout.ts +101 -0
  79. package/docs/components/meta/map.ts +68 -0
  80. package/docs/components/meta/menu.ts +43 -0
  81. package/docs/components/meta/number.ts +296 -0
  82. package/docs/components/meta/page.ts +67 -0
  83. package/docs/components/meta/radio.ts +55 -0
  84. package/docs/components/meta/rate.ts +124 -0
  85. package/docs/components/meta/select.ts +279 -0
  86. package/docs/components/meta/slider-captcha.ts +70 -0
  87. package/docs/components/meta/slider.ts +270 -0
  88. package/docs/components/meta/switch.ts +272 -0
  89. package/docs/components/meta/table-panel.ts +154 -0
  90. package/docs/components/meta/table.ts +328 -0
  91. package/docs/components/meta/tabs.ts +136 -0
  92. package/docs/components/meta/title.ts +80 -0
  93. package/docs/components/meta/tree.ts +242 -0
  94. package/docs/components/meta/upload.ts +186 -0
  95. package/docs/components/meta/workflow-viewer.ts +55 -0
  96. package/docs/components/meta/workflow.ts +113 -0
  97. package/docs/components/number.md +124 -0
  98. package/docs/components/page.md +42 -0
  99. package/docs/components/radio.md +87 -0
  100. package/docs/components/rate.md +71 -0
  101. package/docs/components/select.md +133 -0
  102. package/docs/components/slider-captcha.md +41 -0
  103. package/docs/components/slider.md +101 -0
  104. package/docs/components/switch.md +90 -0
  105. package/docs/components/table-panel.md +199 -0
  106. package/docs/components/table.md +202 -0
  107. package/docs/components/tabs.md +26 -0
  108. package/docs/components/title.md +24 -0
  109. package/docs/components/tree.md +207 -0
  110. package/docs/components/upload.md +117 -0
  111. package/docs/components/workflow-viewer.md +21 -0
  112. package/docs/components/workflow.md +21 -0
  113. package/docs/examples/autocomplete/advanced.vue +35 -0
  114. package/docs/examples/autocomplete/basic.vue +32 -0
  115. package/docs/examples/autocomplete/clearable.vue +33 -0
  116. package/docs/examples/autocomplete/custom-template.vue +49 -0
  117. package/docs/examples/autocomplete/disabled.vue +33 -0
  118. package/docs/examples/autocomplete/icon.vue +37 -0
  119. package/docs/examples/barcode/all-types.vue +380 -0
  120. package/docs/examples/barcode/basic.vue +14 -0
  121. package/docs/examples/barcode/props-appearance.vue +243 -0
  122. package/docs/examples/barcode/props-geometry.vue +143 -0
  123. package/docs/examples/barcode/props-logic.vue +216 -0
  124. package/docs/examples/barcode/props-symbology.vue +199 -0
  125. package/docs/examples/barcode/props-text.vue +268 -0
  126. package/docs/examples/button/basic.vue +7 -0
  127. package/docs/examples/button/danger-ghost.vue +17 -0
  128. package/docs/examples/button/disabled.vue +10 -0
  129. package/docs/examples/button/loading.vue +6 -0
  130. package/docs/examples/button/shape.vue +7 -0
  131. package/docs/examples/button/size.vue +14 -0
  132. package/docs/examples/button/type.vue +9 -0
  133. package/docs/examples/button-select/basic.vue +19 -0
  134. package/docs/examples/buttons/basic.vue +45 -0
  135. package/docs/examples/buttons/disabled.vue +36 -0
  136. package/docs/examples/buttons/dropdown.vue +63 -0
  137. package/docs/examples/buttons/group.vue +52 -0
  138. package/docs/examples/buttons/link.vue +47 -0
  139. package/docs/examples/buttons/popup.vue +39 -0
  140. package/docs/examples/buttons/size.vue +45 -0
  141. package/docs/examples/cascader-select/basic.vue +28 -0
  142. package/docs/examples/cascader-select/clearable.vue +34 -0
  143. package/docs/examples/cascader-select/disabled.vue +43 -0
  144. package/docs/examples/cascader-select/filterable.vue +37 -0
  145. package/docs/examples/cascader-select/methods.vue +84 -0
  146. package/docs/examples/cascader-select/multiple.vue +38 -0
  147. package/docs/examples/cascader-select/slot.vue +45 -0
  148. package/docs/examples/checkbox/basic.vue +18 -0
  149. package/docs/examples/checkbox/button.vue +19 -0
  150. package/docs/examples/checkbox/color.vue +25 -0
  151. package/docs/examples/checkbox/disabled.vue +17 -0
  152. package/docs/examples/checkbox/min-max.vue +20 -0
  153. package/docs/examples/checkbox/mixed.vue +56 -0
  154. package/docs/examples/checkbox/size.vue +28 -0
  155. package/docs/examples/code-mirror/basic.vue +11 -0
  156. package/docs/examples/code-mirror/events.vue +42 -0
  157. package/docs/examples/code-mirror/height.vue +25 -0
  158. package/docs/examples/code-mirror/mode.vue +33 -0
  159. package/docs/examples/code-mirror/readonly.vue +14 -0
  160. package/docs/examples/collapse/basic.vue +82 -0
  161. package/docs/examples/comp/basic.vue +7 -0
  162. package/docs/examples/comp/collapse.vue +38 -0
  163. package/docs/examples/comp/tabs.vue +38 -0
  164. package/docs/examples/count/basic.vue +54 -0
  165. package/docs/examples/count-up/basic.vue +89 -0
  166. package/docs/examples/data-panel/basic.vue +110 -0
  167. package/docs/examples/dialog/basic.vue +36 -0
  168. package/docs/examples/dialog/custom-buttons.vue +44 -0
  169. package/docs/examples/dialog/fullscreen.vue +23 -0
  170. package/docs/examples/dialog/no-mask.vue +17 -0
  171. package/docs/examples/dialog/size.vue +44 -0
  172. package/docs/examples/dialog/steps.vue +57 -0
  173. package/docs/examples/dialog-full/basic.vue +29 -0
  174. package/docs/examples/dialog-full/custom-buttons.vue +45 -0
  175. package/docs/examples/dialog-full/no-buttons.vue +18 -0
  176. package/docs/examples/dialog-full/no-header.vue +27 -0
  177. package/docs/examples/dialog-full/steps.vue +71 -0
  178. package/docs/examples/divider/basic.vue +52 -0
  179. package/docs/examples/drawer/basic.vue +35 -0
  180. package/docs/examples/drawer/custom-buttons.vue +34 -0
  181. package/docs/examples/drawer/direction.vue +47 -0
  182. package/docs/examples/drawer/mask.vue +36 -0
  183. package/docs/examples/drawer/no-buttons.vue +20 -0
  184. package/docs/examples/drawer/size.vue +28 -0
  185. package/docs/examples/dynamic-layer/basic.vue +33 -0
  186. package/docs/examples/dynamic-layer/custom-buttons.vue +43 -0
  187. package/docs/examples/dynamic-layer/form.vue +73 -0
  188. package/docs/examples/dynamic-layer/steps.vue +52 -0
  189. package/docs/examples/dynamic-layer/types.vue +40 -0
  190. package/docs/examples/echarts/basic.vue +31 -0
  191. package/docs/examples/echarts/dynamic.vue +43 -0
  192. package/docs/examples/echarts/line.vue +46 -0
  193. package/docs/examples/echarts/pie.vue +44 -0
  194. package/docs/examples/editor/basic.vue +15 -0
  195. package/docs/examples/form/basic.vue +224 -0
  196. package/docs/examples/guid/basic.vue +10 -0
  197. package/docs/examples/guid/size.vue +13 -0
  198. package/docs/examples/hpanel/basic.vue +79 -0
  199. package/docs/examples/icon/basic.vue +9 -0
  200. package/docs/examples/icon/rotate-flip.vue +9 -0
  201. package/docs/examples/icon/size.vue +7 -0
  202. package/docs/examples/input/basic.vue +10 -0
  203. package/docs/examples/input/clearable.vue +12 -0
  204. package/docs/examples/input/disabled.vue +6 -0
  205. package/docs/examples/input/icon.vue +23 -0
  206. package/docs/examples/input/password.vue +18 -0
  207. package/docs/examples/input/size.vue +13 -0
  208. package/docs/examples/input/textarea.vue +25 -0
  209. package/docs/examples/input/word-limit.vue +28 -0
  210. package/docs/examples/input-button/basic.vue +33 -0
  211. package/docs/examples/input-code/basic.vue +29 -0
  212. package/docs/examples/input-color/basic.vue +10 -0
  213. package/docs/examples/input-color/disabled.vue +13 -0
  214. package/docs/examples/input-color/format.vue +17 -0
  215. package/docs/examples/input-color/no-alpha.vue +13 -0
  216. package/docs/examples/input-color/only-button.vue +15 -0
  217. package/docs/examples/input-color/predefine.vue +31 -0
  218. package/docs/examples/input-color/size.vue +15 -0
  219. package/docs/examples/input-layer/basic.vue +69 -0
  220. package/docs/examples/input-rows/basic.vue +73 -0
  221. package/docs/examples/input-rows/drag.vue +48 -0
  222. package/docs/examples/input-rows/layer-form.vue +85 -0
  223. package/docs/examples/input-rows/nested.vue +91 -0
  224. package/docs/examples/input-tag/basic.vue +27 -0
  225. package/docs/examples/input-tag/colors.vue +23 -0
  226. package/docs/examples/input-tag/readonly.vue +17 -0
  227. package/docs/examples/layer/basic.vue +43 -0
  228. package/docs/examples/layer/custom-buttons.vue +61 -0
  229. package/docs/examples/layer/drawer.vue +37 -0
  230. package/docs/examples/layer/full.vue +38 -0
  231. package/docs/examples/layer/modal.vue +34 -0
  232. package/docs/examples/layer/steps.vue +46 -0
  233. package/docs/examples/layer-form/basic.vue +76 -0
  234. package/docs/examples/layer-form/config.vue +82 -0
  235. package/docs/examples/layer-form/size.vue +72 -0
  236. package/docs/examples/layout/basic.vue +36 -0
  237. package/docs/examples/layout/custom-size.vue +50 -0
  238. package/docs/examples/layout/disable-move.vue +37 -0
  239. package/docs/examples/layout/hide-mid-when-narrow.vue +96 -0
  240. package/docs/examples/layout/min-size.vue +73 -0
  241. package/docs/examples/layout/percent-size.vue +80 -0
  242. package/docs/examples/layout/simple.vue +22 -0
  243. package/docs/examples/layout/top-side.vue +34 -0
  244. package/docs/examples/map/basic.vue +22 -0
  245. package/docs/examples/menu/basic.vue +58 -0
  246. package/docs/examples/menu/collapsed.vue +49 -0
  247. package/docs/examples/menu/horizontal.vue +44 -0
  248. package/docs/examples/menu/selection-test.vue +104 -0
  249. package/docs/examples/menu/theme.vue +46 -0
  250. package/docs/examples/menu/vertical.vue +46 -0
  251. package/docs/examples/number/advanced.vue +143 -0
  252. package/docs/examples/number/basic.vue +63 -0
  253. package/docs/examples/number/disabled.vue +49 -0
  254. package/docs/examples/number/size.vue +42 -0
  255. package/docs/examples/number/slots.vue +123 -0
  256. package/docs/examples/number/step-strictly.vue +41 -0
  257. package/docs/examples/number/step.vue +47 -0
  258. package/docs/examples/page/basic.vue +41 -0
  259. package/docs/examples/page/init.vue +87 -0
  260. package/docs/examples/radio/basic.vue +17 -0
  261. package/docs/examples/radio/button.vue +17 -0
  262. package/docs/examples/radio/color.vue +18 -0
  263. package/docs/examples/radio/disabled.vue +17 -0
  264. package/docs/examples/radio/size.vue +29 -0
  265. package/docs/examples/rate/basic.vue +24 -0
  266. package/docs/examples/rate/half.vue +24 -0
  267. package/docs/examples/rate/readonly.vue +11 -0
  268. package/docs/examples/rate/text.vue +32 -0
  269. package/docs/examples/select/basic.vue +16 -0
  270. package/docs/examples/select/clearable.vue +22 -0
  271. package/docs/examples/select/disabled.vue +31 -0
  272. package/docs/examples/select/filterable.vue +24 -0
  273. package/docs/examples/select/group.vue +23 -0
  274. package/docs/examples/select/icon.vue +16 -0
  275. package/docs/examples/select/multiple.vue +18 -0
  276. package/docs/examples/select/size.vue +39 -0
  277. package/docs/examples/slider/basic.vue +42 -0
  278. package/docs/examples/slider/disabled.vue +17 -0
  279. package/docs/examples/slider/marks.vue +30 -0
  280. package/docs/examples/slider/size.vue +37 -0
  281. package/docs/examples/slider/tooltip.vue +36 -0
  282. package/docs/examples/slider/vertical.vue +26 -0
  283. package/docs/examples/slider-captcha/basic.vue +44 -0
  284. package/docs/examples/slider-captcha/custom.vue +48 -0
  285. package/docs/examples/switch/basic.vue +16 -0
  286. package/docs/examples/switch/disabled.vue +13 -0
  287. package/docs/examples/switch/loading.vue +13 -0
  288. package/docs/examples/switch/size.vue +15 -0
  289. package/docs/examples/switch/text.vue +13 -0
  290. package/docs/examples/table/actions.vue +116 -0
  291. package/docs/examples/table/add-row.vue +103 -0
  292. package/docs/examples/table/basic.vue +168 -0
  293. package/docs/examples/table/editable.vue +261 -0
  294. package/docs/examples/table/field-selection.vue +87 -0
  295. package/docs/examples/table/frozen-column.vue +140 -0
  296. package/docs/examples/table/height-mode.vue +99 -0
  297. package/docs/examples/table/multiple.vue +178 -0
  298. package/docs/examples/table/pagination.vue +151 -0
  299. package/docs/examples/table/single-selection.vue +64 -0
  300. package/docs/examples/table/tree-column.vue +119 -0
  301. package/docs/examples/table/tree-data.vue +141 -0
  302. package/docs/examples/table-panel/basic.vue +228 -0
  303. package/docs/examples/table-panel/batch-operations.vue +285 -0
  304. package/docs/examples/table-panel/filter.vue +209 -0
  305. package/docs/examples/table-panel/multiple-selection.vue +243 -0
  306. package/docs/examples/table-panel/pagination.vue +133 -0
  307. package/docs/examples/tabs/basic.vue +98 -0
  308. package/docs/examples/title/basic.vue +80 -0
  309. package/docs/examples/tree/accordion.vue +46 -0
  310. package/docs/examples/tree/basic.vue +50 -0
  311. package/docs/examples/tree/buttons.vue +53 -0
  312. package/docs/examples/tree/checkable.vue +52 -0
  313. package/docs/examples/tree/custom-keys.vue +39 -0
  314. package/docs/examples/tree/default-expanded.vue +52 -0
  315. package/docs/examples/tree/draggable.vue +29 -0
  316. package/docs/examples/tree/expand-on-click.vue +39 -0
  317. package/docs/examples/tree/flat-data.vue +20 -0
  318. package/docs/examples/tree/icon.vue +40 -0
  319. package/docs/examples/tree/load-data.vue +37 -0
  320. package/docs/examples/tree/methods.vue +74 -0
  321. package/docs/examples/tree/theme.vue +33 -0
  322. package/docs/examples/upload/accept.vue +31 -0
  323. package/docs/examples/upload/basic.vue +12 -0
  324. package/docs/examples/upload/drag.vue +11 -0
  325. package/docs/examples/upload/image.vue +17 -0
  326. package/docs/examples/upload/limit.vue +20 -0
  327. package/docs/examples/upload/multiple.vue +17 -0
  328. package/docs/examples/upload/readonly.vue +17 -0
  329. package/docs/examples/utils/cipher.vue +160 -0
  330. package/docs/examples/utils/common.vue +153 -0
  331. package/docs/examples/utils/date.vue +56 -0
  332. package/docs/examples/utils/dom.vue +52 -0
  333. package/docs/examples/utils/is.vue +70 -0
  334. package/docs/examples/workflow/basic.vue +265 -0
  335. package/docs/examples/workflow-viewer/basic.vue +248 -0
  336. package/package.json +6 -2
  337. /package/dist/components/workflow-viewer/src/{j-workflow.vue.d.ts → workflow.vue.d.ts} +0 -0
@@ -13,4 +13,4 @@
13
13
  roundFun,
14
14
  sumFun,
15
15
  sumproductFun,
16
- getCompValue)=>{ return ${j} }`;let S;const B=da(j);if(B.res)try{S=B.fn(a,i,r,l,s,c,d,u,f,h,m,p,g,y,w)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(B.msg),"";return Number.isNaN(S)?"":(o.decimal!==void 0&&(S=S.toFixed(o.decimal)),S)}),_=n.computed(()=>{let v=C.value;return o.thousandSeparator&&(v=Li(v)),o.isChinese&&(v=Ai(v)),v});return n.watch(C,v=>{x("update:modelValue",v),x("change",{value:v,data:_.value})}),(v,j)=>{const S=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(S,{modelValue:_.value,"onUpdate:modelValue":j[0]||(j[0]=B=>_.value=B),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),af={key:0},Pr=oe(n.defineComponent({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=n.computed(()=>({...o})),i=n.ref(),r=n.ref(null),l=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&s()}),n.watch(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),n.watch(()=>o.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const s=()=>{r.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,r.value=new pd.CountUp(i.value,Number(o.endValue),l.value),r.value.start(()=>{o.callback?.(r.value)}))};return n.onUnmounted(()=>{r.value=null}),n.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:s,start:h=>{r.value&&r.value.start&&r.value.start(()=>{h?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:h=>{r.value&&r.value.update&&r.value.update(h)}}),(h,m)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",af,n.toDisplayString(e.endValue),1))],512))}})),rf={class:"j-block j-data-panel"},lf={key:0,class:"j-data-panel-header"},sf={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},cf={class:"j-data-panel-header-right"},df={class:"j-data-panel-body"},Nr=oe(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",rf,[e.title?(n.openBlock(),n.createElementBlock("div",lf,[n.createElementVNode("div",sf,n.toDisplayString(e.title),1),n.createElementVNode("div",cf,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",df,[n.renderSlot(t.$slots,"default")])]))}})),uf={class:"j-divider-content"},$r=oe(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 i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=n.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(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(a.value)},null,4),n.createElementVNode("div",uf,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(a.value)},null,4)],6))}})),ff={class:"j-hpanel"},pf={class:"j-hpanel-main"},Or=oe(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",ff,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",pf,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),Rr=oe(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,a=t,i=n.ref(),r=n.ref(),l=async(u,f)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},s=()=>o.beforeClose?o.beforeClose(r.value):!0,c=()=>{o.closed?.()},d=()=>{i.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return n.watch(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(h,n.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),n.createVNode(m,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:n.withCtx(()=>[n.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Ar=oe(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,a=t,i=n.computed({get:()=>o.modelValue,set:f=>{a("update:modelValue",f)}}),r=n.ref(""),l=f=>{r.value=f},s=()=>r.value,c=f=>o.beforeClose?o.beforeClose(f):!0,d=f=>{a("change",f)},u=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(f,h)=>{const m=n.resolveComponent("j-code-mirror"),p=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=y=>i.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:l,onChange:d},{default:n.withCtx(()=>[n.createVNode(p,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(m,{value:r.value,"onUpdate:value":h[0]||(h[0]=y=>r.value=y),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(m,{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"])}}})),Lr=oe(n.defineComponent({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l=n.ref(),s=n.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(g){l.value=g,i("update:modelValue",g),i("input",g)}}),c=g=>{i("input",g)},d=g=>{i("focus",g)},u=g=>{i("blur",g)},f=()=>{i("clear"),i("update:modelValue","")},h=g=>{i("change",g)},m=g=>{i("color-change",g)},p=g=>{i("active-change",g)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(g,y)=>{const x=n.resolveComponent("el-color-picker"),b=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},`j-input-color-${e.size}`])},[n.createVNode(b,n.mergeProps({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=w=>s.value=w),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},g.$attrs,{onInput:c,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:n.withCtx(()=>[n.createVNode(x,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=w=>s.value=w),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:m,onActiveChange:p},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}})),Ir=oe(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||""),a=n.computed(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(a.value)},n.toDisplayString(e.title),7))}})),zr=oe(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 a=e,i=o,r=n.ref(),l=n.ref("");let s=null;const c=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return ln.javascript();case"css":case"text/css":return gd.css();case"html":case"text/html":return yd.html();case"json":case"application/json":return vd.json();case"sql":case"text/x-sql":return bd.sql();case"xml":case"text/xml":return xd.xml();case"python":case"text/x-python":return wd.python();case"markdown":case"text/markdown":return Cd.markdown();case"java":case"text/x-java":return kd.java();case"vue":case"text/x-vue":return ln.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return ln.javascript({jsx:!1,typescript:!0});case"jsx":return ln.javascript({jsx:!0,typescript:!1});case"tsx":return ln.javascript({jsx:!0,typescript:!0});default:return ln.javascript()}},d=()=>{const g=[md.basicSetup,lt.lineNumbers(),lt.highlightActiveLineGutter(),lt.highlightSpecialChars(),ra.history(),lt.drawSelection(),lt.dropCursor(),sn.indentOnInput(),sn.bracketMatching(),ia.closeBrackets(),lt.rectangularSelection(),sn.foldGutter(),lt.keymap.of([...ia.closeBracketsKeymap,...ra.defaultKeymap,...ra.historyKeymap,...sn.foldKeymap]),sn.syntaxHighlighting(sn.defaultHighlightStyle)];return g.push(c(a.mode)),a.readonly&&g.push(aa.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&g.push(ia.autocompletion({override:[y=>{const x=y.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const b=a.handleHint(x.text);return b.length===0?null:{from:x.from,options:b.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(lt.EditorView.updateListener.of(y=>{if(y.docChanged){const x=y.state.doc.toString();l.value=x,i("update:value",x),i("change",{value:x})}})),g},u=async()=>{if(!r.value)return;const g=aa.EditorState.create({doc:a.value,extensions:d()});s=new lt.EditorView({state:g,parent:r.value}),l.value=a.value},f=()=>{if(!s)return;const g=s.state.doc.toString();s&&s.destroy();const y=aa.EditorState.create({doc:g,extensions:d()});r.value&&(s=new lt.EditorView({state:y,parent:r.value}));const x=s.state.doc.toString();x!==a.value&&s.dispatch({changes:{from:0,to:x.length,insert:a.value}})},h=()=>{if(!s)return;const g=s.state.doc.length;s.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},m=()=>{let g=hd.format(a.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,"@"),i("update:value",g),i("change",{value:g})};let p=null;return n.watch(()=>a.value,g=>{g!==l.value&&(l.value=g,s&&f(),setTimeout(()=>{s&&a.isScrollToBottom&&h()}))}),n.watch(()=>a.mode,()=>{s&&f()}),n.onMounted(async()=>{await n.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),n.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:m}),(g,y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),hf=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("actionRef"),i=n.ref("0"),r=n.computed(()=>{const{actionStyle:s,toLeft:c}=o;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=n.computed(()=>Number.parseInt(i.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:a,style:n.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),mf=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("barRef"),i=n.ref("0"),r=n.computed(()=>{const{barStyle:l,toLeft:s}=o;return{...l,width:s?"0":i.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:l=>{i.value=l}}),(l,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:a,style:n.normalizeStyle(r.value)},null,4))}}),gf=n.defineComponent({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("contentRef"),i=n.computed(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:a,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(i.value)},[n.createElementVNode("div",{style:n.normalizeStyle(r.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Fr=oe(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,a=t,i=n.useModel(e,"modelValue"),r=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=n.useTemplateRef("wrapperRef"),s=n.useTemplateRef("barRef"),c=n.useTemplateRef("contentRef"),d=n.useTemplateRef("actionRef");n.watch(()=>r.isPassing,x=>{if(x){const{endTime:b,startTime:w}=r,C=(b-w)/1e3;a("success",{isPassing:x,time:C.toFixed(1)}),i.value=x}}),n.watchEffect(()=>{r.isPassing=!!i.value});function u(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function f(x){r.isPassing||d.value&&(a("start",x),r.moveDistance=u(x)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(x){const b=l.value?.offsetWidth??220,w=x?.offsetWidth??40,C=b-w-6;return{actionWidth:w,offset:C,wrapperWidth:b}}function m(x){const{isMoving:b,moveDistance:w}=r;if(b){const C=n.unref(d),_=n.unref(s);if(!C||!_)return;const{actionWidth:v,offset:j,wrapperWidth:S}=h(C.getEl()),B=u(x)-w;a("move",{event:x,moveDistance:w,moveX:B}),B>0&&B<=j?(C.setLeft(`${B}px`),_.setWidth(`${B+v/2}px`)):B>j&&(C.setLeft(`${S-v}px`),_.setWidth(`${S-v/2}px`),g())}}function p(x){const{isMoving:b,isPassing:w,moveDistance:C}=r;if(b&&!w){a("end",x);const _=d.value,v=n.unref(s);if(!_||!v)return;const j=u(x)-C,{actionWidth:S,offset:B,wrapperWidth:V}=h(_.getEl());j<B?y():(_.setLeft(`${V-S}px`),v.setWidth(`${V-S/2}px`),g()),r.isMoving=!1}}function g(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const x=n.unref(d),b=n.unref(s),w=n.unref(c);!x||!b||!w||(w.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,x.setLeft("0"),b.setWidth("0")},300))}return(x,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:m,onMouseup:p,onTouchend:p,onTouchmove:m},[n.createVNode(mf,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),n.createVNode(gf,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),n.createVNode(hf,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:f,onTouchstart:f},null,8,["action-style","is-passing","to-left"])],38))}})),yf=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Ln(),{getHMoreMenus:c}=qd(),d=n.ref([]);o.pId==="moreId"?d.value=c.value:d.value=r(i()[o.pId||""]||[],[]);const u=p=>{const g=d.value.find(y=>y.active);g?.value!==p.value&&(g&&(g.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:m}=la.useVirtualList(d,{itemHeight:44});return(p,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(h)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(m))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),y=>(n.openBlock(),n.createBlock(yo,{key:y.data.value,"parent-actives":n.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),vf={class:"j-menu-item-label"},bf={class:"j-menu-item-label"},xf={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},wf={class:"j-menu-item-label"},yo=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}=Je(),{activeMenuId:a}=Ln(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),u=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:s[0]||(s[0]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"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(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",vf,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(u,{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.value===n.unref(a),"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(c,{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",bf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",xf)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(yf,{"p-id":e.item.value,onClick:r},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:s[1]||(s[1]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"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(c,{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",wf,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))}}}),Cf=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=f=>{a("click",f)},s=n.computed(()=>o.menuList),{list:c,containerProps:d,wrapperProps:u}=la.useVirtualList(s,{itemHeight:44});return(f,h)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(r)==="dark"}]},n.unref(d)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(u))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(c),m=>(n.openBlock(),n.createBlock(yo,{key:m.data.value,"parent-actives":n.unref(i)?.pid?.split(".")||[],item:m.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":m.data.entering,"menu-item-leaving":m.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),kf=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=n.ref(),s=n.ref(0);let c=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=n.computed(()=>{const m=[];let p=0,g=0;const y=o.menuList.length;return o.menuList.forEach(x=>{g++;const b=(cn(x.label)||0)+32+16+4+8;p+=b,(g===y&&p<=s.value||g<y&&p+56<=s.value)&&m.push(x)}),m.length<o.menuList.length&&m.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),m}),u=n.computed(()=>{const m=[];let p=0;const g=d.value.length;return o.menuList.forEach(y=>{p++,p>=g&&m.push(y)}),m}),f=n.computed(()=>{const m=i.value?.pid?.split(".")||[];return(m.length>1&&u.value.findIndex(p=>p.value===m[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&m.push("moreId"),m}),h=m=>{a("click",m)};return Yd({getHMoreMenus:u}),n.onUnmounted(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(m,p)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:l,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(r)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,g=>(n.openBlock(),n.createBlock(yo,{key:g.value,"parent-actives":f.value,item:g,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),Ef=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=n.computed(()=>(o.menuList.forEach((m,p)=>{m.color=l[p%l.length]}),o.menuList)),c=n.computed(()=>i.value?.pid?.split(".")||[]),d=m=>{a("click",m)},{list:u,containerProps:f,wrapperProps:h}=la.useVirtualList(s,{itemHeight:96});return(m,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(r)==="dark"}]},n.unref(f)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),g=>(n.openBlock(),n.createBlock(yo,{key:g.data.value,"parent-actives":c.value,item:g.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Hr=oe(n.defineComponent({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let i={};const r=n.ref("");r.value=o.activeId||"";const l=(g,y,x,b,w)=>{x=x||[];for(let C=0,_=x.length;C<_;C++){const v=x[C],j={};j.pid=y,j.indent=b,r.value===v.value&&(j.active=!0),Object.keys(v).forEach(B=>{B!=="children"&&(j[B]=v[B])}),w&&w.includes(v.value)&&(j.open=!0),g.push(j);const S=v.children||[];S.length>0&&(j.hasChildren=!0,w||(i[j.value]=S),(!w||j.open&&!o.collapsed)&&l(g,`${y}.${j.value}`,S,b+1,w))}},s=(g,y)=>{const x=[];return l(x,"0",g,0,y),x},c=n.ref([]);let d=[];const u=()=>{i={},d=s(o.menus);const g=[];if(r.value&&o.mode==="inline"){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}c.value=s(o.menus,g)};n.watch(()=>o.menus,()=>{u()},{immediate:!0}),n.watch(()=>o.mode,()=>{u()});const f=()=>{if(c.value.find(y=>y.active)?.value!==r.value){const y=d.find(x=>x.value===r.value);if(y){const x=[];o.mode==="inline"&&x.push(...y.pid.split(".")),c.value=s(o.menus,x)}}},h=n.computed(()=>d.find(g=>g.value===r.value));n.watch(()=>o.activeId,()=>{r.value=o.activeId||"",f()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)c.value=s(o.menus,[]);else{const g=[];if(r.value){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}c.value=s(o.menus,g)}});const m=n.computed(()=>o.theme),p=g=>{if(console.log(g),g.hasChildren){if(o.collapsed)return;const y=[];y.push(...g.pid.split(".")),g.open||y.push(g.value);const x=s(o.menus,y),b=new Set(c.value.map(C=>C.value)),w=new Set(x.map(C=>C.value));x.forEach(C=>{b.has(C.value)||(C.entering=!0)}),c.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),c.value=x,setTimeout(()=>{c.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===g.value)return;r.value=g.value,a("click",g)}};return Dd({getMenuMap:()=>i,toArray:s,activeMenu:h,activeMenuId:r,theme:m}),(g,y)=>e.mode==="inline"?(n.openBlock(),n.createBlock(Cf,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(kf,{key:1,"menu-list":c.value,onClick:p},null,8,["menu-list"])):(n.openBlock(),n.createBlock(Ef,{key:2,"menu-list":c.value,onClick:p},null,8,["menu-list"]))}})),_f={class:"j-keyword-panel"},Sf={key:0},Bf={key:1,class:"columns-wrapper"},jf=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}=Je(),a=e,i=n.useModel(e,"checkAll"),r=n.useModel(e,"checkFields"),l=n.ref(!1),s=n.ref(""),c=n.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?s.value?h.config?.label?.indexOf(s.value)!=-1:!0:!1).map(h=>({label:h.config?.label,value:h.id}))),d=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=h=>{h.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(h,m)=>{const p=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),y=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",_f,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:i.value}]),onClick:d},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),i.value?(n.openBlock(),n.createBlock(p,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:m[0]||(m[0]=x=>l.value=!l.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(n.openBlock(),n.createElementBlock("div",Sf,[n.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":m[1]||(m[1]=x=>s.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createElementBlock("div",Bf,[n.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":m[2]||(m[2]=x=>r.value=x),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):n.createCommentVNode("",!0)])}}}),Tf={key:0,class:"title"},Vf={class:"content"},Mf={class:"relation"},Pf={style:{width:"72px"}},Nf={class:"btn-wrapper"},$f={class:"field-wrapper"},Of={class:"buttons"},Wr=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:a}=Je(),i=e,r=n.useModel(e,"relation"),l=n.useModel(e,"isPin"),s=n.ref([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.value}),config:{appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:l.value?132:160,change:({value:b,row:w})=>{const _=i.columns.find(S=>S.id===b)?.config||{};let v="eq",j="text";["options"].includes(_.dataType||"")?v="in":["dateTime"].includes(_.dataType||"")&&(v="range",j="dateTime"),w.method=v,w.type=_.valueType||j}}},{id:"method",type:"j-select",getCompConfig:({row:b})=>{const C=i.columns.find(_=>_.id===b.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:l.value?120:144,appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:b})=>{b.value=void 0}}},{id:"value",type:"input",getCompType:({row:b})=>{const C=i.columns.find(_=>_.id===b.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(b.method)||["eq","ne"].includes(b.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(b.method)?"j-date-range":["formula"].includes(b.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:b})=>{if(["empty","not_empty"].includes(b.method||""))return{display:!1};const C=i.columns.find(v=>v.id===b.field)?.config||{},_={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(_.collapseTags=!0,_.collapseTagsTooltip=!0,_.dataType=C.dataType,_.dataCode=C.dataCode,_.options=C.options):["switch"].includes(C.dataType||"")?(_.options=[],_.dataType="options",C.activeValue==null?_.options.push({label:"是",value:"1"}):_.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?_.options.push({label:"否",value:"0"}):_.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(b.method)?(_.placeholder="",_.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"}],_.dataType="options"):(_.type="datetime",["range"].includes(b.method)?(_.startPlaceholder="开始时间",_.endPlaceholder="结束时间",_.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):_.placeholder="")),_},config:{width:l.value?234:296,appendTo:l.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{s.value=i.searchFieldList});const u=n.computed(()=>i.columns.filter(b=>!b.children?.length).map(b=>({label:b.config?.label,value:b.id,dataType:b.config?.dataType,options:b.config?.options}))),f=n.computed(()=>s.value.map(b=>b.field)),h=({data:b})=>{if(f.value.includes(b.value))return;const C=i.columns.find(j=>j.id===b.value)?.config||{};let _="eq",v="text";["options","dataItem"].includes(C.dataType||"")?_="in":["dateTime"].includes(C.dataType||"")&&(_="range",v="dateTime"),s.value.push({field:b.value,method:_,type:C.valueType||v})},m=o,p=()=>{s.value.length=0},g=()=>{l.value?m("filter"):m("close",!0)},y=()=>{s.value.forEach(b=>{b.value=void 0}),m("filter")};return t({getSearchFields:()=>s.value}),(b,w)=>{const C=n.resolveComponent("j-icon"),_=n.resolveComponent("j-select"),v=n.resolveComponent("j-button-select"),j=n.resolveComponent("j-button"),S=n.resolveComponent("j-input-rows"),B=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(n.openBlock(),n.createElementBlock("div",Tf,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",Vf,[n.createElementVNode("div",Mf,[n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选出符合以下")),1),n.createElementVNode("div",Pf,[n.createVNode(_,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("条件的数据")),1)]),n.createElementVNode("div",Nf,[n.createVNode(v,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),s.value.length>0?(n.openBlock(),n.createBlock(j,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):n.createCommentVNode("",!0)]),n.createElementVNode("div",$f,[n.createVNode(S,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=V=>s.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),n.createVNode(B,{placement:"bottom",content:l.value?n.unref(a)("取消固定"):n.unref(a)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:c},[n.createVNode(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",Of,[n.createVNode(j,{label:n.unref(a)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(j,{label:n.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),Rf={class:"j-order-panel"},Af={class:"content"},Lf={class:"btn-wrapper"},If={class:"field-wrapper"},zf={class:"buttons"},Ff=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),i=e,r=o,l=n.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),s=n.ref([]),c=n.computed(()=>s.value.map(p=>p.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:p})=>({title:p.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:p})=>{c.value.includes(p.value)||s.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{s.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},m=()=>{s.value=[],r("clear")};return t({init:f}),(p,g)=>{const y=n.resolveComponent("j-button-select"),x=n.resolveComponent("j-input-rows"),b=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Rf,[n.createElementVNode("div",Af,[n.createElementVNode("div",Lf,[n.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),n.createElementVNode("div",If,[n.createVNode(x,{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=w=>s.value=w),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",zf,[n.createVNode(b,{label:n.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),s.value.length>0?(n.openBlock(),n.createBlock(b,{key:0,label:n.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:m},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),Hf={class:"j-column-panel"},Wf={class:"content"},Uf={class:"search-wrapper"},Jf={class:"tree-wrapper"},Df={class:"buttons"},qf=n.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),i=e,r=o,l=n.ref(),s=n.ref(""),c={},d=n.ref([]),u=n.ref([]),f=(v,j)=>{const S=[],B=new Map;v.forEach(T=>{B.set(T.id,T),c[T.id]=T});const V=new Set;return j&&j.length>0&&j.forEach(T=>{const L=B.get(T.id);if(L){V.add(L.id);const F={id:L.id,label:L.config?.label||L.id,type:L.type,display:L.config?.display!==!1};L.children&&L.children.length>0&&(F.children=f(L.children,T.children)),S.push(F)}}),v.forEach(T=>{if(!V.has(T.id)){const L={id:T.id,label:T.config?.label||T.id,type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(L.children=f(T.children)),S.push(L)}}),S},h=(v,j)=>j.length===0?v:v.map(S=>{const B=j.some(T=>S.label.toLowerCase().includes(T.toLowerCase())),V=S.children?h(S.children,j):[];return B||V.length>0?{...S,children:V.length>0?V:S.children}:null}).filter(Boolean),m=n.computed(()=>{if(!s.value)return u.value;const v=s.value.split(/\s+/).filter(Boolean);return h(u.value,v)}),p=n.ref([]),g=n.computed(()=>{const v=new Map;if(i.columnConfig&&i.columnConfig.length>0){const j=S=>{S.forEach(B=>{v.set(B.id,B),B.children&&j(B.children)})};j(i.columnConfig)}return v}),y=()=>{const v=j=>{const S=[];return j.forEach(B=>{let V=!0;if(g.value.size>0){const T=g.value.get(B.id);T?V=T.display:V=B.config?.display!==!1}else V=B.config?.display!==!1;V&&(S.push(B.id),B.children&&S.push(...v(B.children)))}),S};p.value=v(i.columns)},x=(v,{node:j})=>{v.includes(j.id)?p.value.push(j.id):p.value=p.value.filter(B=>B!==j.id)},b=(v,j,S)=>S==="inner"?!1:v.parent===j.parent,w=()=>{const v=j=>j.map(S=>{const B={...S,display:p.value.includes(S.id)};return S.children&&(B.children=v(S.children)),B});r("save",v(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const v=l.value;v.setCheck&&v.setCheck(p.value);const j=v.$refs?.treeRef||v;j?.setCheckedKeys&&j.setCheckedKeys(p.value)}};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(v,j)=>{const S=n.resolveComponent("j-icon"),B=n.resolveComponent("el-input"),V=n.resolveComponent("j-tree"),T=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Hf,[n.createElementVNode("div",Wf,[n.createElementVNode("div",Uf,[n.createVNode(B,{modelValue:s.value,"onUpdate:modelValue":j[0]||(j[0]=L=>s.value=L),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Jf,[n.createVNode(V,{ref_key:"treeRef",ref:l,list:m.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":b,check:x},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",Df,[n.createVNode(T,{label:n.unref(a)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(T,{label:n.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),Yf={class:"j-table-panel-left"},Gf={class:"j-table-panel-top"},Kf={class:"j-table-panel-top-left"},Xf={class:"j-table-panel-top-right"},Zf={key:0,style:{width:"200px"}},Qf={class:"j-table-panel-main"},ep={key:0,class:"j-table-panel-filter-panel"},ya=oe(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,highlightMode:{type:String,default:"row"}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),{openLayer:i}=In(),r=e,l=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=n.ref();let c=[];const d=n.ref(0),u=n.ref(1);let f=r.pageSize||100,h="";const m=n.ref([]),p=n.ref(!1),g=n.computed(()=>r.batchButtons&&r.batchButtons.length>0),y=n.computed(()=>m.value.length>0),x=n.computed(()=>g.value&&y.value&&r.isMultiple||p.value),b=n.computed(()=>r.isPage&&!x.value);g.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const w=K=>r.rowKey?r.rowKey.split(",").map(Ae=>K[Ae.trim()]).join("::"):"",C=(K,Q)=>{if(!Q||Q.length===0)return K.filter(Z=>Z.config?.display!==!1).map(Z=>Z.children&&Z.children.length>0?{...Z,children:C(Z.children)}:Z);const Ae=new Map(K.map(Z=>[Z.id,Z])),Oe=[];return Q.forEach(Z=>{const Re=Ae.get(Z.id);if(Re){if(Z.display){let Nn=Re;Re.children&&Re.children.length>0&&(Nn={...Re,children:C(Re.children,Z.children)}),Oe.push(Nn)}Ae.delete(Z.id)}}),K.forEach(Z=>{if(Ae.has(Z.id)&&Z.config?.display!==!1){let Re=Z;Z.children&&Z.children.length>0&&(Re={...Z,children:C(Z.children)}),Oe.push(Re)}}),Oe},_=n.computed(()=>C(r.columns,ye.value)),v=n.computed(()=>Ji(r.columns,K=>K.config.label)),j=n.ref(""),S=n.computed(()=>v.value.some(K=>K.config?.filter?.isSearchKeyword)),B=n.ref(),V=n.ref(!0),T=n.ref([]),L=n.computed(()=>V.value?"搜索全部":`搜索范围:${v.value.filter(K=>T.value.includes(K.id)).map(K=>K.config?.label).join("、")}`),F=()=>{B.value.init()},z=n.ref(),M=n.ref(!1),E=n.ref(!1),$=n.ref(!1),R=n.ref([]),Y=n.ref("and"),ee=n.ref(),se=n.ref(!1),de=n.ref([]),Me=()=>{ee.value.init(de.value)},D=K=>{de.value=K,se.value=!1,Ge()},fe=()=>{de.value=[],Ge()},ge=n.ref(),re=n.ref(!1),ye=n.ref(),je=n.computed(()=>ye.value!=null),U=()=>{ge.value?.init()},te=K=>{console.log("handleColumnSave:",K),ye.value=K,re.value=!1},ce=n.ref(!1),Ce=()=>{ce.value=!ce.value},He=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),p.value&&(p.value=!1,s.value.setRecords(c)))},Qe=()=>{p.value=!p.value,p.value?s.value?.setRecords(m.value):s.value?.setRecords(c),s.value?.setSelection?.(m.value)},ve=n.computed(()=>{if(m.value.length>0&&r.isMultiple){const K=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:p.value?"全部":"仅选中",config:{type:"text"},click:Qe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:He}],Q=r.batchButtons.map(Ae=>({...Ae,click:()=>{Ae.click&&Ae.click({data:m.value,openLayer:i})}}));return[...K,...Q]}return r.buttons}),it=async()=>{const K={},Q={};Q.rel=Y.value;const Ae=z.value?.getSearchFields?.()||R.value;Q.cond=Ae.filter(Z=>Z.value!==void 0&&Z.value!==null&&Z.value!=="").map(Z=>({field:Z.field,method:Z.method,value:Z.value,type:Z.type})),Q.cond.length>0?$.value=!0:$.value=!1,K.filter=Q;const Oe=de.value.map(Z=>Z.value+" "+Z.sord).join(",");if(j.value&&(K.keyword={value:j.value,fields:V.value?v.value.filter(Z=>Z.config?.filter?.isSearchKeyword).map(Z=>Z.id):n.unref(T)}),r.loadData){if(r.isPage){K.pagination={rows:f,page:u.value,sort:Oe||h||r.sort||r.rowKey};const Z=await r.loadData(K)||{};c=Z.rows||[],d.value=Z.records||0}else K.sort=Oe,c=await r.loadData(K)||[],d.value=c.length;s.value.setRecords(c),g.value?(m.value=[],p.value=!1):r.rowKey&&m.value.length>0&&s.value?.setSelection?.(m.value)}},Ge=async()=>{u.value=1,await it()},ht=({rows:K,page:Q})=>{f=K,u.value=Q,it()},I=async()=>{m.value=[],p.value=!1,u.value=1,await it()},G=async()=>{m.value=[],p.value=!1,await it()},H=async()=>{await I()},W=K=>{l("ready",K)},q=K=>{let Q=[];if(!r.isMultiple){m.value=K,l("select",K);return}if(g.value)Q=K;else if(!r.rowKey)Q=K;else{const Ae=new Map(K.map(Z=>[w(Z),Z])),Oe=new Map(m.value.map(Z=>[w(Z),Z]));c.forEach(Z=>{const Re=w(Z);Ae.has(Re)?Oe.set(Re,Ae.get(Re)):Oe.delete(Re)}),Q=Array.from(Oe.values())}m.value=Q,l("select",Q),p.value&&Q.length===0?(p.value=!1,s.value&&s.value.setRecords(c)):p.value&&Q.length>0&&s.value&&(s.value.setRecords(Q),s.value.setSelection?.(Q))},ie=()=>m.value||[],ue=K=>{m.value=K,s.value?.setSelection?.(K)},he=()=>s.value?.getInstance?.();return n.onMounted(async()=>{r.immediate&&await G()}),t({refreshData:G,resetData:I,getSelection:ie,setSelection:ue,clearSelection:()=>{He()},getInstance:he}),(K,Q)=>{const Ae=n.resolveComponent("j-buttons"),Oe=n.resolveComponent("j-icon"),Z=n.resolveComponent("el-popover"),Re=n.resolveComponent("el-tooltip"),Nn=n.resolveComponent("el-input"),rn=n.resolveComponent("j-button"),_i=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:ce.value,"no-padding":e.noPadding||ce.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":ce.value}])},[n.createElementVNode("div",Yf,[n.createElementVNode("div",Gf,[n.createElementVNode("div",Kf,[n.createVNode(Ae,{list:ve.value},null,8,["list"])]),n.createElementVNode("div",Xf,[S.value&&!x.value?(n.openBlock(),n.createElementBlock("div",Zf,[n.createVNode(Nn,{modelValue:j.value,"onUpdate:modelValue":Q[2]||(Q[2]=O=>j.value=O),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:n.withKeys(Ge,["enter"]),onClear:Ge},{prefix:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(Re,{placement:"bottom",content:L.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:F,onHide:Ge},{reference:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(jf,{ref_key:"keywordPanelRef",ref:B,"check-all":V.value,"onUpdate:checkAll":Q[0]||(Q[0]=O=>V.value=O),"check-fields":T.value,"onUpdate:checkFields":Q[1]||(Q[1]=O=>T.value=O),columns:v.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!M.value&&!x.value?(n.openBlock(),n.createBlock(Z,{key:1,visible:E.value,"onUpdate:visible":Q[6]||(Q[6]=O=>E.value=O),placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,onHide:Ge},{reference:n.withCtx(()=>[n.createVNode(rn,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:$.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Wr,{ref_key:"filterPanelRef",ref:z,"is-pin":M.value,"onUpdate:isPin":Q[3]||(Q[3]=O=>M.value=O),relation:Y.value,"onUpdate:relation":Q[4]||(Q[4]=O=>Y.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ge,onClose:Q[5]||(Q[5]=O=>E.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:2,placement:"bottom",content:n.unref(a)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:se.value,"onUpdate:visible":Q[7]||(Q[7]=O=>se.value=O),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Me},{reference:n.withCtx(()=>[n.createVNode(rn,{class:n.normalizeClass({active:de.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Ff,{ref_key:"orderPanelRef",ref:ee,columns:v.value,onSave:D,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:3,placement:"bottom",content:n.unref(a)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:re.value,"onUpdate:visible":Q[8]||(Q[8]=O=>re.value=O),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:U},{reference:n.withCtx(()=>[n.createVNode(rn,{class:n.normalizeClass({active:je.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(qf,{ref_key:"columnPanelRef",ref:ge,columns:e.columns,"column-config":ye.value,onSave:te},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:4,placement:"bottom",content:n.unref(a)("刷新")},{default:n.withCtx(()=>[n.createVNode(rn,{type:"text",icon:"mdi:refresh",onClick:H})]),_:1},8,["content"])),n.createVNode(Re,{placement:"bottom",content:ce.value?n.unref(a)("退出全屏"):n.unref(a)("全屏")},{default:n.withCtx(()=>[n.createVNode(rn,{type:"text",icon:ce.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Ce},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",Qf,[n.createVNode(_i,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":Q[9]||(Q[9]=O=>u.value=O),columns:_.value,records:n.unref(c),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":b.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,"highlight-mode":e.highlightMode,onLoadPageData:ht,onReady:W,onSelectionChanged:q},null,8,["table-page","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","highlight-mode"])])]),M.value&&!x.value?(n.openBlock(),n.createElementBlock("div",ep,[n.createVNode(Wr,{ref_key:"filterPanelRef",ref:z,"is-pin":M.value,"onUpdate:isPin":Q[10]||(Q[10]=O=>M.value=O),relation:Y.value,"onUpdate:relation":Q[11]||(Q[11]=O=>Y.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ge},null,8,["is-pin","relation","search-field-list","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),tp={class:"j-button-select"},np={class:"search-wraper"},op={class:"options-wraper"},ap=["onClick"],Ur=oe(n.defineComponent({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:i}=Je(),r=n.ref(""),l=n.computed(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),s=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const f=[...s.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=n.resolveComponent("j-button"),h=n.resolveComponent("j-icon"),m=n.resolveComponent("el-input"),p=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(f,{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",tp,[n.createElementVNode("div",np,[n.createVNode(m,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=g=>r.value=g),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",op,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.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(y=>c(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(h,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)(g.label)),1)],10,ap))),128))])])]),_:1},8,["width"])}}})),ip={class:"j-tree-item-text"},rp={key:2,class:"j-tree-item-button-group"},lp={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Jr=oe(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 a=e,i=o,{useData:r,t:l}=Je(),{getTreeData:s,loadData:c}=r(),d=n.ref(),u=n.ref(!1),f=n.ref(""),h=n.ref([]),m={children:"children",label:"label",disabled:"disabled"},p=n.computed(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>a.dataCode||a.dataType?p.value:a.list?n.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,n.nextTick(()=>{a.afterLoadData&&a.afterLoadData(g.value||[])})},x=(z,M=!0)=>{d.value?.setCurrentKey(z,M)},b=()=>d.value?.getCurrentKey(),w=(z,M=!1)=>{d.value?.setCheckedKeys(z,M)},C=(z=!1)=>d.value?.getCheckedKeys(z),_=async(z,M,E,$)=>{if(f.value=z.value,a.nodeClickFlow&&a.runFlow){const R=JSON.parse(a.nodeClickFlow);await a.runFlow(R,{value:z.value})}a.click&&a.click(z.value,z,$)},v=(z,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})=>{a.check&&a.check(M,{node:z,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})},j=(z,M,E,$)=>{i("node-drop",z,M,E,$)},S=z=>{const M=gt(a.treeButtons);return z&&a.filterButton?a.filterButton({buttons:M,node:z}):M},{openLayer:B}=In(),V=(z,M)=>{z.config?.disabled||z.click&&z.click({data:M,openLayer:B})},T=n.ref(""),L=(z,M)=>{T.value=z?M.value:"",console.log(T.value,"row")},F=(z,M,E)=>a.allowDrop?a.allowDrop(z,M,E):!(E=="inner"&&!M.data.canInner);return n.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),n.watch(()=>a.list,()=>{u.value=!0,n.nextTick(()=>{u.value=!1})}),n.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:x,getValue:b,setCheck:w,getCheck:C}),(z,M)=>{const E=n.resolveComponent("j-icon"),$=n.resolveComponent("j-button"),R=n.resolveComponent("el-dropdown-item"),Y=n.resolveComponent("el-dropdown-menu"),ee=n.resolveComponent("el-dropdown"),se=n.resolveComponent("el-tree"),de=n.resolveComponent("el-empty"),Me=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"}},[!u.value&&g.value.length>0?(n.openBlock(),n.createBlock(se,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":f.value,data:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:m,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":F,"expand-on-click-node":e.expandOnClickNode,onNodeClick:_,onCheck:v,onNodeDrop:j},{default:n.withCtx(({node:D})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===D.data.value}])},[D.data.openIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:D.data.openIcon,color:D.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),D.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:D.data[e.iconKey]||e.defaultIcon||"",color:D.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",ip,n.toDisplayString(D.label),1),S(D.data).length?(n.openBlock(),n.createElementBlock("div",rp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S(D.data),(fe,ge)=>(n.openBlock(),n.createBlock(ee,{key:ge,trigger:"click",onVisibleChange:re=>L(re,D.data)},{dropdown:n.withCtx(()=>[n.createVNode(Y,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(fe.children,(re,ye)=>(n.openBlock(),n.createBlock(R,{key:ye,disabled:re.disabled,divided:re.divided,onClick:n.withModifiers(je=>V(re,D.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:re.danger?"var(--j-color-danger)":re.color||e.buttonIconColor||"var(--j-color-text-2)"})},[re.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(E,{key:0,icon:re.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(l)(re.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode($,{icon:fe.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",lp,[n.createVNode(de,{description:n.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Me,u.value]])}}})),Dr=oe(yr),sp=Ed;async function cp(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const i=new sp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function dp(e,t,o){const a=o.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await cp(e,t,r);if(l!=="")return{name:e,errors:l}}}function up(e,t){const o=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let f=u;s&&(f=`${s}.${u}`);const h=l[u],{rules:m,myGridtableId:p}=t(f,s?l:void 0,()=>c,d);if(m.length){const g=a(f,h,m);r.push(g)}p&&h.forEach(g=>{o(r,g,p,h,s?l:void 0)})})},a=(r,l,s)=>dp(r,l,s);return{validateForm:async()=>{const r=n.unref(e),l=[];o(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}const qr=oe(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 a=e,i=o,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:f,info:h,t:m}=Je();let p;r&&(p=r());const g=I=>{f&&f(I)},y=n.ref(!1),x=n.computed(()=>a.config?.gutter||16),b=n.computed(()=>a.config?.span||24),w=n.computed(()=>a.config?.labelWidth),C=n.computed(()=>a.config?.labelPosition||"right"),_=n.computed(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),v=n.reactive({}),j=n.ref({}),S=[],B={},V=n.ref({});let T={},L={},F=[],z={};const M=I=>{i("change",I)},E=I=>ho(B[I]?.type||"")&&!B[I]?.config?.notInput||B[I]?.config?.isInput,$=I=>["j-table","j-input-rows","j-input-cards"].includes(B[I]?.type||"");let R;const Y=(I,G)=>{Object.keys(I).forEach(H=>{const W=I[H];G&&(H=G+"."+H),W!=null&&typeof W=="object"&&!co(W)&&Y(W,H),v[H]=W})},ee=(I,G)=>{let H=I.id;return H||(I.config?.table&&I.config?.field?H=`${I.config.table}.${I.config.field}`:I.config?.table?H=I.config?.table:I.config?.field&&(H=I.config?.field),G&&$(G)&&(H=`${G}.${H}`)),H||po("j")},se=(I,G,H,W="")=>{I.forEach(q=>{q.id=ee(q,W);const ie={id:q.id,slot:q.slot,type:q.type||"",getCompType:q.getCompType,getCompConfig:q.getCompConfig,config:{},children:[]};G.push(ie);const{children:ue}=q;fo(ie,q,["children","config"]),fo(ie.config,q.config||{},[]),B[q.id]&&console.warn("有重复的组件id:"+q.id),B[q.id]=ie,a.readonly===!0&&(ie.config.readonly=!0);let he=!1,We;W!==""&&$(W)&&(he=!0,ie.config=q.config||{},ie.config.parentTableId=W,We=B[W]?.config?.table);const K=ie.config||{};if(E(q.id))!H&&he===!1&&(K?.defaultValue===0?v[q.id]=K?.defaultValue:v[q.id]=K?.defaultValue||void 0),K.table&&K.field?T[`${K.table}_${K.field}`.toLowerCase()]=q.id:K.field&&(he?T[`${We}_${K.field}`.toLowerCase()]=q.id:T[`${K.field}`.toLowerCase()]=q.id);else if(he&&K.field)T[`${We}_${K.field}`.toLowerCase()]=q.id;else if($(q.id))!H&&!K.isSubTable&&(v[q.id]=[]),K.table&&(T[K.table.toLowerCase()||""]=q.id),K.isSubTable||F.push(ie);else if(K?.defaultValue)v[q.id]=K?.defaultValue;else if(q.type==="collapse"&&K?.isExpand){const Q=[];(K?.groups||[]).forEach(Ae=>{Q.push(Ae.i)}),v[q.id]=Q}ue&&ue.length>0&&se(ue,ie.children,H,ie.id)})},de=async(I,G)=>{y.value=!1;const H=!!G;S.splice(0,S.length),T={},L={},F=[],R=G,On(v),V.value={},H&&Y(G,""),se(I,S,H),z=gt(v),n.nextTick(()=>{y.value=!0,n.nextTick(()=>{Ge(a.config?.codeInit,{})})})},Me=(I,G,H)=>{const W=[];return G.forEach(q=>{const ie={};Object.keys(q).forEach(ue=>{if(!H||H(ue,q[ue],I)){const he=ce(ue);if(he?.type==="j-table")ie[he?.id||""]=Me(ue,q[ue],H);else{let We=T[`${I}_${ue}`.toLowerCase()]||ue;We=We.indexOf(".")!==-1?We.split(".")[1]:We,ie[We]=q[ue]}}}),W.push(ie)}),W},D=(I,G)=>{Object.keys(I||{}).forEach(H=>{let W=I[H];const q=ce(H);if(q===void 0)W&&(co(W)&&(W=W[0]||{}),typeof W=="object"?Object.keys(W).forEach(ie=>{if(!G||G(H,W[ie],H)){let ue=ie;H!=="main"&&(ue=`${H}_${ie}`),L[ue]=H,v[T[ue.toLowerCase()]||ie]=W[ie]}}):v[H]=W);else if($(q.id||"")){if(!Array.isArray(W)){console.warn("表格数据不是数组:"+H);return}W?.length>0?v[T[H.toLowerCase()]||H]=Me(H,W,G):v[T[H.toLowerCase()]||H]=[]}else(!G||G(H,W,H))&&(v[T[H.toLowerCase()]||H]=W)}),R&&Object.keys(v).forEach(H=>{const W=ce(H);(W===void 0||!["tabs","collapse"].includes(W.type||""))&&Ri(R,H,v[H])})},fe=(I,G=!1)=>{const H={};return Object.keys(I).forEach(W=>{if(W==="parentRow")return;const q=B[W];if(q){const ie=q.config?.table,ue=q.config?.field;if(G)ue?H[ue]=I[W]:H[W]=I[W];else if($(W)){const he=[];I[W].forEach(We=>{he.push(fe(We,!0))}),H[ie||W]=he}else ie&&ue?(H[ie]=H[ie]||{},H[ie][ue]=I[W]):ue&&(H[ue]=I[W])}else G?W!=="_X_ROW_KEY"&&W!=="_isHover"&&(H[W]=I[W]):L[W]?(H[L[W]]=H[L[W]]||{},H[L[W]][W.replace(`${L[W]}_`,"")]=I[W]):H[W]=I[W]}),H},ge=(I=!0)=>I?fe(v):v,re=(I,G,H,W)=>{let q=B[I];if(q==null){const ue=I.split(".");q=B[ue[ue.length-1]]||{}}if(!q)return{};const ie=Jt({config:{...q.config||{},...V.value[q.id]||{}},getCompConfig:q.getCompConfig,formData:v,getTableData:H,row:G,pRowData:W});return ie._componentId=q?.id,ie},ye=(I,G,H,W)=>{const q=re(I,G,H,W);if(q.isNotRule!==!0&&q.display!==!1){const ie=q.rule||[],ue=ie.find(he=>he.type==="only");return ue&&(ue.validator=async(he,We)=>{if(We){const K={table:he.table,key:he.key,keyName:he.keyName,field:he.field,keyValue:he.getKeyValue?he.getKeyValue():"",value:We,paramNames:he.paramNames,getParams:he.getParams,withProjectId:he.withProjectId,getValue:he.getValue,formData:v};if(!await l(K))throw m(he.message)||m("数据值重复")}}),{rules:ie,myGridtableId:$(q._componentId)?q._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:je}=up(v,ye),U=async()=>{j.value={};const I=await je();return Object.keys(I).length>0?(j.value=I,g(`${m(B[Object.keys(I)[0]]?.config?.label)}:${m(I[Object.keys(I)[0]].msg)}`),!1):!0},te=()=>{j.value={},On(v),Object.keys(z||{}).forEach(I=>{v[I]=z[I]})},ce=I=>{let G=B[I];return G===void 0&&T[I.toLowerCase()]&&(G=B[T[I.toLowerCase()]]),G},Ce=({id:I,i:G,value:H,type:W})=>{if(W==="add")v[I].push(H);else if(W==="delete")v[I].splice(G,1);else{const q=ce(I);q&&(q.config.parentTableId?v[q.config.parentTableId][G][I]=H:v[I]=H)}},He=({id:I,i:G})=>{const H=ce(I);if(H){if(H.config.parentTableId){const W=v[H.config.parentTableId],q=H.id?H.id.replace(`${H.config.parentTableId}.`,""):"";if(G!=null)return(W[G]||{})[q||""];const ie=[];return W&&W.forEach(ue=>{ie.push(ue[q||""])}),ie}if($(H.id||"")){const W=[];return v[H.id||""].forEach(q=>{W.push(fe(q,!0))}),W}return v[H.id||""]}if(v[I])return v[I]},Qe=async({id:I,i:G})=>{const H=He({id:I,i:G}),W=ce(I);if(W&&p?.getLabel)if(G!==void 0){const q=H[G],ie=v[W.config.parentTableId||""][G],ue=Jt({config:W.config,getCompConfig:W.getCompConfig,formData:v,tableData:v[W.config.parentTableId||""],row:ie});return await p?.getLabel({value:q,config:ue,formData:v,tableData:v[W.config.parentTableId||""],row:ie})}else{const q=Jt({config:W.config,getCompConfig:W.getCompConfig,formData:v});return await p?.getLabel({value:H,config:q,formData:v})}return H},ve=async(I,G)=>p?.loadViewDataList?await p?.loadViewDataList(I,G,!1):[],it=I=>(I.set=Ce,I.get=He,I.setFormData=D,I.getFormData=ge,I.getLabel=Qe,I.getViewData=ve,I.getDateNow=G=>Yi(new Date,G||"YYYY-MM-DD HH:mm:ss"),I.httpGet=s||(()=>{console.log("当前状态不支持")}),I.httpPost=c||(()=>{console.log("当前状态不支持")}),I.loading=G=>{dn(G)},I.showMsg=({text:G,type:H})=>{switch(H){case"success":d&&d(G);break;case"warning":u&&u(G);break;case"error":f&&f(G);break;case"info":h&&h(G);break;default:h&&h(G);break}console.log("showMsg",G,H)},I),Ge=async(I,G)=>{if(I&&I.trim()){I=`async (jcode) => {${I}}`;const{res:H,fn:W}=da(I);H&&await W(it(G))}},ht=(I,G)=>{V.value[I]={...V.value[I]||{},...G}};return a.schema&&de(a.schema),nr({formData:v,compsConfig:V,errorFields:j,isAutoWindow:_,gutter:x,span:b,labelWidth:w,labelPosition:C,getValue:He,formChange:M}),or({contextType:"form"}),t({init:de,reset:te,validate:U,setValue:Ce,getValue:He,getLabel:Qe,setFormData:D,getFormData:ge,setCompConfig:ht}),(I,G)=>{const H=n.resolveComponent("j-form-item"),W=n.resolveComponent("el-row"),q=n.resolveComponent("el-form");return y.value?(n.openBlock(),n.createBlock(q,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:G[0]||(G[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[_.value?(n.openBlock(),n.createBlock(H,n.mergeProps({key:0},S[0],{"is-not-col":""}),null,16)):(n.openBlock(),n.createBlock(W,{key:1,gutter:x.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(S,ie=>n.createVNode(H,n.mergeProps({key:ie.id,ref_for:!0},ie),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),Yr=oe(gr),fp={class:"j-page"},Gr=oe(n.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=n.ref(!1),i=n.reactive([]),r={},l=n.reactive({}),s=new pa,c=new Map,d=(p,g,y,...x)=>{const b=`${p}:${g}`;return y?.immediate&&c.set(b,x),s.emit(b,...x)},u=(p,g,y)=>{const x=`${p}:${g}`;s.on(x,y);const b=c.get(x);b&&(c.delete(x),y(...b))},f=(p,g,y)=>{const x=`${p}:${g}`;c.delete(x),s.off(x,y)},h=(p,g)=>{p.forEach(y=>{y.id=y.id||po("c");const x={id:y.id,slot:y.slot,type:y.type,config:{},children:[]},{children:b}=y;r[y.id]=x,fo(x.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l.value[y.id]=y.config.defaultValue),g.push(x),b&&b.length>0&&h(b,x.children)})},m=p=>{a.value=!1,i.splice(0,i.length),On(r),On(l),h(p,i),n.nextTick(()=>{a.value=!0})};return o.schema&&m(o.schema),Qd({registerMethod:(p,g,y)=>(u(p,g,y),()=>{f(p,g,y)})}),or({contextType:"page"}),t({init:m,call:d,on:u,off:f}),(p,g)=>{const y=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",fp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i,x=>(n.openBlock(),n.createBlock(y,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}})),Kr=oe(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,i=n.ref("");return n.watch(()=>o.modelValue,r=>{r?i.value=r:(i.value=Ut(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),pp={class:"j-input-rows"},hp={key:0,class:"j-input-rows-num"},mp={key:1,class:"j-input-rows-char"},Xr=oe(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,a=e,i=t,{formData:r}=mn(),l=n.computed(()=>a.editConfig.isAddBtn!==!1),s=n.computed(()=>a.editConfig.addBtnText||"添加"),c=n.computed(()=>a.editConfig.buttonsAlign||"left"),d=n.computed(()=>a.editConfig.isRemoveBtn!==!1),u=n.computed(()=>a.editConfig.readonly),f=n.computed(()=>a.editConfig.drag),h=n.computed(()=>a.editConfig.isNullValue!==!1),m=n.ref(),p=["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([]);a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(C=>{C._i||(C._i=Ut())})):(g.value=[],i("update:modelValue",g.value)),n.watch(()=>a.modelValue,C=>{g.value=a.modelValue||[],g.value=C||[],g.value.forEach(_=>{_._i||(_._i=Ut())})},{deep:!0});const x=()=>{const C={_i:Ut()};a.columns.forEach(_=>{const v=_.config?.valueRowKey||_.id||"";v&&(C[v]=gt(_.config?.defaultValue))}),g.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:g.value,type:"add"})},b=C=>{const _=g.value[C];g.value.splice(C,1),i("change",{id:a.id,value:_,data:_,formData:r,tableData:g.value,type:"delete"})},w=C=>{i("rowChange",C)};return n.onMounted(()=>{if(!f.value||!m.value)return;const C=m.value,{initSortable:_}=er(C,{handle:".j-input-rows-drag",onEnd:v=>{const{oldIndex:j,newIndex:S}=v;if(o(j)||o(S)||j===S||j<0||S<0)return;const B=g.value.splice(j,1)[0];g.value.splice(S,0,B),i("change",{id:a.id,value:B,data:B,formData:r,tableData:g.value,type:"sort"})}});_()}),ha({getTableData:()=>g.value,rowChange:w}),(C,_)=>{const v=n.resolveComponent("j-comp"),j=n.resolveComponent("j-icon"),S=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",pp,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:m,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(B,V)=>(n.openBlock(),n.createElementBlock("div",{key:B._i+V,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",hp,n.toDisplayString(V+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",mp,n.toDisplayString(p[V%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,T=>(n.openBlock(),n.createBlock(v,n.mergeProps({key:T.id,ref_for:!0},T,{row:B}),null,16,["row"]))),128)),f.value?(n.openBlock(),n.createBlock(j,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),d.value&&(h.value||g.value.length>1)&&!u.value?(n.openBlock(),n.createBlock(j,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>b(V)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?(n.openBlock(),n.createBlock(S,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:x},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),gp={class:"j-input-layer"},Zr=oe(n.defineComponent({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=n.ref(),l=n.ref(),s=n.ref(""),c=n.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=n.computed({get(){return o(c.value)?"":o(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(p){p||f()}});n.watch(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const g=[],y=[];p.forEach(x=>{const b=x[a.labelKey],w=x[a.valueKey];g.push(b!=null?String(b):""),w===0||w?y.push(String(w)):y.push("")}),s.value=g.join(","),c.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const g=p[0],y=g[a.labelKey],x=g[a.valueKey];s.value=y!=null?String(y):"";const b=x!=null?String(x):"";c.value=b,i("change",{value:b,data:g})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},m=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,g)=>{const y=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",gp,[e.onlyButton?(n.openBlock(),n.createBlock(n.unref(uo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(n.openBlock(),n.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=x=>d.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},n.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:n.withCtx(()=>[n.createVNode(n.unref(uo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),n.createVNode(n.unref(ga),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:m},{default:n.withCtx(()=>[n.createVNode(n.unref(ya),{ref_key:"tableRef",ref:l,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}})),Qr=oe(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=mn(),{t:a}=Je(),i=n.computed(()=>t.formConfig?.gutter||16),r=n.computed(()=>t.formConfig?.span||24),l=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),c=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=n.ref(!1),u=()=>{d.value=!0};return nr({...o,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(f,h)=>{const m=n.resolveComponent("j-button"),p=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),y=n.resolveComponent("el-form"),x=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(m,n.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),n.createVNode(x,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=b=>d.value=b),title:n.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(y,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[c.value?(n.openBlock(),n.createBlock(p,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:i.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,b=>(n.openBlock(),n.createBlock(p,n.mergeProps({key:b.id,ref_for:!0},b),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),el=oe(n.defineComponent({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{const l=i.value===o.activeValue?o.inactiveValue:o.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(c,n.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.value=d),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,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:r}),n.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}})),tl=oe(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,a=d=>{o("update:modelValue",d)},i=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},l=d=>{o("tab-remove",d)},s=()=>{o("tab-add")},c=(d,u)=>{o("edit",d,u)};return(d,u)=>{const f=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(f,n.mergeProps(d.$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":a,onTabClick:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:n.withCtx(()=>[n.renderSlot(d.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),nl=oe(n.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},i=r=>{o("change",r)};return(r,l)=>{const s=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(s,n.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:n.withCtx(()=>[n.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),yp={class:"j-editor"},ol=oe(jr(n.defineComponent({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=n.shallowRef(),s=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let c=!1;const d=f=>{if(!f)return"";let h=f;return o.apiUrl&&o.token&&(h=h.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),h},u=f=>{if(!f)return"";let h=f;if(o.apiUrl){const m=`${o.apiUrl}/system/annexesfile/`;h=h.split(m).join("{learun_img_api}"),o.token&&(h=h.split(`token=${o.token}`).join("{learun_img_token}"))}return h};return n.onMounted(()=>{const f={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};f.onChange=m=>{if(c)return;const p=m.getHtml(),g=u(p);a("update:value",g),a("change",{value:g})};const h=Mi.createEditor({selector:i.value,html:d(o.value),config:f,mode:"default"});l.value=h,Mi.createToolbar({editor:h,selector:r.value,mode:"default"})}),n.watch(()=>o.value,f=>{const h=l.value;if(h){const m=h.getHtml(),p=d(f);u(m)!==f&&(c=!0,h.setHtml(p),c=!1)}}),n.watch(()=>o.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),n.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(n.openBlock(),n.createElementBlock("div",yp,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:n.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-179ac616"]])),vp={key:0,class:"j-map-loading"},bp=oe(n.defineComponent({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(!0),l=n.ref();let s=null,c=null,d=null,u=null;const f=async()=>{r.value=!0;try{s=await tr(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),r.value=!1;return}if(c!=null){m(a.lng,a.lat),r.value=!1;return}if(!l.value)return;c=new s.Map(l.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",x=>{h(x.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",x=>{h(x.point)}),u.addEventListener("locationError",x=>{alert(x.message)}),c.addControl(u),c.addEventListener("click",x=>{h(x.point)}),c.enableScrollWheelZoom(!0),m(a.lng,a.lat),r.value=!1},h=y=>{new s.Geocoder().getLocation(y,b=>{d.setPosition(y),c.panTo(y),i("update:address",b.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:b.address,lng:y.lng,lat:y.lat}})})},m=(y,x)=>{if(y&&x&&s){const b=new s.Point(y,x);d&&d.setPosition(b),c&&c.panTo(b)}};let p=null;return t({setPoint:m,querySearchAsync:(y,x)=>{!c||!s||(p||(p=new s.LocalSearch(c,{onSearchComplete:b=>{const w=[];if(b){const C=b.getCurrentNumPois();for(let _=0;_<C;_++)w.push(b.getPoi(_))}x(w)}})),p.search(y))}}),n.onMounted(()=>{f()}),(y,x)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[r.value?(n.openBlock(),n.createElementBlock("div",vp,[n.createVNode(Wt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function al(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function gn(e){return e.originalEvent||e.srcEvent}function va(e){al(e),al(gn(e))}function yn(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 il=1500;function rl(e,t,o){var a=this,i=o.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",il,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",il,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=yn(l),c=document.elementFromPoint(s.x,s.y),xp(c)}}rl.$inject=["elementRegistry","eventBus","injector"];function xp(e){return A.closest(e,"svg, .djs-element",!0)}const wp={__init__:["hoverFix"],hoverFix:["type",rl]};function ll(){return/mac/i.test(navigator.platform)}function sl(e,t){return(gn(e)||e).button===t}function Et(e){return sl(e,0)}function Cp(e){return sl(e,1)}function cl(e){var t=gn(e)||e;return Et(e)?ll()?t.metaKey:t.ctrlKey:!1}function ba(e){var t=gn(e)||e;return Et(e)&&t.shiftKey}function zn(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function kp(e){return["M",e.x,e.y]}function xa(e){return["L",e.x,e.y]}function Ep(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function _p(e,t){const o=e.length,a=[kp(e[0])];for(let i=1;i<o;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(xa(l));continue}const c=Math.min(t,wa(l.x-r.x,l.y-r.y),wa(s.x-l.x,s.y-l.y));if(!c){a.push(xa(l));continue}const d=vo(l,r,c),u=vo(l,r,c*.5),f=vo(l,s,c),h=vo(l,s,c*.5);a.push(xa(d)),a.push(Ep(u,h,f))}return a}function vo(e,t,o){const a=t.x-e.x,i=t.y-e.y,r=wa(a,i),l=o/r;return{x:e.x+a*l,y:e.y+i*l}}function wa(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ca(e,t,o){k.isNumber(t)&&(o=t,t=null),t||(t={});const a=P.create("path",t);return k.isNumber(o)&&(a.dataset.cornerRadius=String(o)),dl(a,e)}function dl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return P.attr(e,{d:zn(_p(t,o))}),e}function Sp(e){return!0}function bo(e){return Et(e)||Cp(e)}var ul=500;function fl(e,t,o){var a=this;function i(S,B,V){if(!s(S,B)){var T,L,F;V?L=t.getGraphics(V):(T=B.delegateTarget||B.target,T&&(L=T,V=t.get(L))),!(!L||!V)&&(F=e.fire(S,{element:V,gfx:L,originalEvent:B}),F===!1&&(B.stopPropagation(),B.preventDefault()))}}var r={};function l(S){return r[S]}function s(S,B){var V=d[S]||Et;return!V(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Sp,"element.mousedown":bo,"element.mouseup":bo,"element.click":bo,"element.dblclick":bo};function u(S,B,V){var T=c[S];if(!T)throw new Error("unmapped DOM event name <"+S+">");return i(T,B,V)}var f="svg, .djs-element";function h(S,B,V,T){var L=r[V]=function(F){i(V,F)};T&&(d[V]=T),L.$delegate=A.delegate.bind(S,f,B,L)}function m(S,B,V){var T=l(V);T&&A.delegate.unbind(S,B,T.$delegate)}function p(S){k.forEach(c,function(B,V){h(S,V,B)})}function g(S){k.forEach(c,function(B,V){m(S,V,B)})}e.on("canvas.destroy",function(S){g(S.svg)}),e.on("canvas.init",function(S){p(S.svg)}),e.on(["shape.added","connection.added"],function(S){var B=S.element,V=S.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:V})}),e.on(["shape.changed","connection.changed"],ul,function(S){var B=S.element,V=S.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:V})}),e.on("interactionEvents.createHit",ul,function(S){var B=S.element,V=S.gfx;a.createDefaultHit(B,V)}),e.on("interactionEvents.updateHit",function(S){var B=S.element,V=S.gfx;a.updateDefaultHit(B,V)});var y=_("djs-hit djs-hit-stroke"),x=_("djs-hit djs-hit-click-stroke"),b=_("djs-hit djs-hit-all"),w=_("djs-hit djs-hit-no-move"),C={all:b,"click-stroke":x,stroke:y,"no-move":w};function _(S,B){return B=k.assign({stroke:"white",strokeWidth:15},B||{}),o.cls(S,["no-fill","no-border"],B)}function v(S,B){var V=C[B];if(!V)throw new Error("invalid hit type <"+B+">");return P.attr(S,V),S}function j(S,B){P.append(S,B)}this.removeHits=function(S){var B=A.queryAll(".djs-hit",S);k.forEach(B,P.remove)},this.createDefaultHit=function(S,B){var V=S.waypoints,T=S.isFrame,L;return V?this.createWaypointsHit(B,V):(L=T?"stroke":"all",this.createBoxHit(B,L,{width:S.width,height:S.height}))},this.createWaypointsHit=function(S,B){var V=Ca(B);return v(V,"stroke"),j(S,V),V},this.createBoxHit=function(S,B,V){V=k.assign({x:0,y:0},V);var T=P.create("rect");return v(T,B),P.attr(T,V),j(S,T),T},this.updateDefaultHit=function(S,B){var V=A.query(".djs-hit",B);if(V)return S.waypoints?dl(V,S.waypoints):P.attr(V,{width:S.width,height:S.height}),V},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=m}fl.$inject=["eventBus","elementRegistry","styles"];const ka={__init__:["interactionEvents"],interactionEvents:["type",fl]};function vn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;o.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}vn.$inject=["eventBus","canvas"],vn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},vn.prototype.get=function(){return this._selectedElements},vn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},vn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var s=i.findRoot(l);return r===s}),t?k.forEach(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var pl="hover",hl="selected";function ml(e,t){this._canvas=e;function o(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){o(i.element,pl)}),t.on("element.out",function(i){a(i.element,pl)}),t.on("selection.changed",function(i){function r(d){a(d,hl)}function l(d){o(d,hl)}var s=i.oldSelection,c=i.newSelection;k.forEach(s,function(d){c.indexOf(d)===-1&&r(d)}),k.forEach(c,function(d){s.indexOf(d)===-1&&l(d)})})}ml.$inject=["canvas","eventBus"];function gl(e,t,o,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=r.hints||{},d=c.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(s.filter(Bp))}}),e.on("connect.end",500,function(i){var r=i.context,l=r.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id),s=k.find(r,function(c){return l.id===c.id});s||t.select(l)}),e.on("element.click",function(i){if(Et(i)){var r=i.element;r===o.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=ba(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}gl.$inject=["eventBus","selection","canvas","elementRegistry"];function Bp(e){return!e.hidden}const bn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ka],selection:["type",vn],selectionVisuals:["type",ml],selectionBehavior:["type",gl]};var jp=/^djs-cursor-.*$/;function Ea(e){var t=A.classes(document.body);t.removeMatching(jp),e&&t.add("djs-cursor-"+e)}function yl(){Ea(null)}var Tp=5e3;function vl(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Tp,o),function(){e.off(t,o)}}function bl(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function xn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xl(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function wl(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var wn=Math.round,Cl="djs-drag-active";function Dt(e){e.preventDefault()}function Vp(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Mp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function kl(e,t,o,a){var i={threshold:5,trapClick:!0},r;function l(w){var C=t.viewbox(),_=t._container.getBoundingClientRect();return{x:C.x+(w.x-_.left)/C.scale,y:C.y+(w.y-_.top)/C.scale}}function s(w,C){C=C||r;var _=e.createEvent(k.assign({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,_)===!1?!1:e.fire(C.prefix+"."+w,_)}function c(w){var C=w.filter(function(_){return a.get(_.id)});C.length&&o.select(C)}function d(w,C){var _=r.payload,v=r.displacement,j=r.globalStart,S=yn(w),B=xn(S,j),V=r.localStart,T=l(S),L=xn(T,V);if(!r.active&&(C||Mp(B)>r.threshold)){if(k.assign(_,{x:wn(V.x+v.x),y:wn(V.y+v.y),dx:0,dy:0},{originalEvent:w}),s("start")===!1)return y();r.active=!0,r.keepSelection||(_.previousSelection=o.get(),o.select(null)),r.cursor&&Ea(r.cursor),t.addMarker(t.getRootElement(),Cl)}va(w),r.active&&(k.assign(_,{x:wn(T.x+v.x),y:wn(T.y+v.y),dx:wn(L.x),dy:wn(L.y)},{originalEvent:w}),s("move"))}function u(w){var C,_=!0;r.active&&(w&&(r.payload.originalEvent=w,va(w)),_=s("end")),_===!1&&s("rejected"),C=x(_!==!0),s("ended",C)}function f(w){wl("Escape",w)&&(Dt(w),y())}function h(w){var C;r.active&&(C=vl(e),setTimeout(C,400),Dt(w)),u(w)}function m(w){d(w)}function p(w){var C=r.payload;C.hoverGfx=w.gfx,C.hover=w.element,s("hover")}function g(w){s("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(w){var C;if(r){var _=r.active;_&&s("cancel"),C=x(w),_&&s("canceled",C)}}function x(w){var C,_;s("cleanup"),yl(),r.trapClick?_=h:_=u,A.event.unbind(document,"mousemove",d),A.event.unbind(document,"dragstart",Dt),A.event.unbind(document,"selectstart",Dt),A.event.unbind(document,"mousedown",_,!0),A.event.unbind(document,"mouseup",_,!0),A.event.unbind(document,"keyup",f),A.event.unbind(document,"touchstart",m,!0),A.event.unbind(document,"touchcancel",y,!0),A.event.unbind(document,"touchmove",d,!0),A.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",g),t.removeMarker(t.getRootElement(),Cl);var v=r.payload.previousSelection;return w!==!1&&v&&!o.get().length&&c(v),C=r,r=null,C}function b(w,C,_,v){r&&y(!1),typeof C=="string"&&(v=_,_=C,C=null),v=k.assign({},i,v||{});var j=v.data||{},S,B,V,T,L;v.trapClick?T=h:T=u,w?(S=gn(w)||w,B=yn(w),va(w),S.type==="dragstart"&&Dt(S)):(S=null,B={x:0,y:0}),V=l(B),C||(C=V),L=Vp(S),r=k.assign({prefix:_,data:j,payload:{},globalStart:B,displacement:xn(C,V),localStart:V,isTouch:L},v),v.manual||(L?(A.event.bind(document,"touchstart",m,!0),A.event.bind(document,"touchcancel",y,!0),A.event.bind(document,"touchmove",d,!0),A.event.bind(document,"touchend",u,!0)):(A.event.bind(document,"mousemove",d),A.event.bind(document,"dragstart",Dt),A.event.bind(document,"selectstart",Dt),A.event.bind(document,"mousedown",T,!0),A.event.bind(document,"mouseup",T,!0)),A.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",g)),s("init"),v.autoActivate&&d(w,!0)}e.on("diagram.destroy",y),this.init=b,this.move=d,this.hover=p,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(w){k.assign(i,w)}}kl.$inject=["eventBus","canvas","selection","elementRegistry"];const qt={__depends__:[wp,bn],dragging:["type",kl]};function _a(e){return e.childNodes[0]}function xo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}xo.prototype.next=function(){return this._prefix+ ++this._counter};const Pp=new xo("ps");var Np=["marker-start","marker-mid","marker-end"],$p=["circle","ellipse","line","path","polygon","polyline","path","rect"];function _t(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}_t.$inject=["elementRegistry","eventBus","canvas","styles"],_t.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")},_t.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},_t.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var i=P.clone(o),r=o.getBoundingClientRect();return this._cloneMarkers(_a(i),a),P.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),P.append(t,i),P.attr(i,"data-preview-support-element-id",e.id),i},_t.prototype.addFrame=function(e,t){var o=P.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return P.append(t,o),P.attr(o,"data-preview-support-element-id",e.id),o},_t.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,o)}),Lp(e)&&Np.forEach(function(i){if(P.attr(e,i)){var r=Op(e,i,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,i,t)}})},_t.prototype._cloneMarker=function(e,t,o,a,i="djs-dragger"){var r=[o.id,i,Pp.next()].join("-"),l=A.query("marker#"+o.id,e);e=e||this._canvas._svg;var s=l||P.clone(o);s.id=r,P.classes(s).add(i);var c=A.query(":scope > defs",e);c||(c=P.create("defs"),P.append(e,c)),P.append(c,s);var d=Ap(s.id);P.attr(t,a,d)};function Op(e,t,o){var a=Rp(P.attr(e,t));return A.query("marker#"+a,o||document)}function Rp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Ap(e){return"url(#"+e+")"}function Lp(e){return $p.indexOf(e.nodeName)!==-1}const Sa={__init__:["previewSupport"],previewSupport:["type",_t]};function Ba(e){this._commandStack=e.get("commandStack",!1)}Ba.$inject=["injector"],Ba.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};const Cn={__init__:["rules"],rules:["type",Ba]};function Ip(e){return k.filter(e,function(t){return!k.find(e,function(o){return o!==t&&El(t,o)})})}function El(e,t){if(t){if(e===t)return t;if(e.parent)return El(e.parent,t)}}function _l(e,t,o){var a=!0;return e.push(t),a}function ja(e,t,o){o=o||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,o);k.isArray(r)&&r.length&&ja(r,t,o+1)})}function zp(e,t,o){var a=[],i=[];return ja(e,function(r,l,s){_l(a,r);var c=r.children;if(c&&_l(i,c))return c}),a}function Fp(e,t){return zp(e)}function Hp(e,t,o){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(o=t,t=!0),o=o||{};var a=Fn(o.allShapes),i=Fn(o.allConnections),r=Fn(o.enclosedElements),l=Fn(o.enclosedConnections),s=Fn(o.topLevel,t&&k.groupBy(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,k.forEach(u.incoming,c),k.forEach(u.outgoing,c),u.children}return ja(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function st(e,t){t=!!t,k.isArray(e)||(e=[e]);var o,a,i,r;return k.forEach(e,function(l){var s=l;l.waypoints&&!t&&(s=st(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,f=s.width||0;(c<o||o===void 0)&&(o=c),(d<a||a===void 0)&&(a=d),(c+f>i||i===void 0)&&(i=c+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:i-o}}function Wp(e,t){var o={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=st(i)),!k.isNumber(t.y)&&i.x>t.x&&(o[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(o[a.id]=a),i.x>t.x&&i.y>t.y&&(k.isNumber(t.width)&&k.isNumber(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!k.isNumber(t.width)||!k.isNumber(t.height))&&(o[a.id]=a)}),o}function Up(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Jp(e){return!!(e&&e.isFrame)}function Fn(e,t){return k.assign({},e||{},t||{})}function Ze(e){return k.isObject(e)&&k.has(e,"waypoints")}function kn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var Dp="drop-ok",Sl="drop-not-ok",Bl="attach-ok",jl="new-parent",Tl="create",qp=2e3;function Vl(e,t,o,a,i){function r(c,d,u,f,h){if(!d)return!1;c=k.filter(c,function(b){var w=b.labelTarget;return!b.parent&&!(kn(b)&&c.indexOf(w)!==-1)});var m=k.find(c,function(b){return!Ze(b)}),p=!1,g=!1,y=!1;Pl(c)&&(p=i.allowed("shape.attach",{position:u,shape:m,target:d})),p||(Pl(c)?y=i.allowed("shape.create",{position:u,shape:m,source:f,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var x=h.connectionTarget;return y||p?(m&&f&&(g=i.allowed("connection.create",{source:x===f?m:f,target:x===f?f:m,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:g}):y===null||p===null?null:!1}function l(c,d){[Bl,Dp,Sl,jl].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}o.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,f=c.hover,h=d.source,m=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}Ml(c);var p={x:c.x,y:c.y},g=d.canExecute=f&&r(u,f,p,h,m);f&&g!==null&&(d.target=f,g&&g.attach?l(f,Bl):l(f,g?jl:Sl))}),o.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),o.on("create.end",function(c){var d=c.context,u=d.source,f=d.shape,h=d.elements,m=d.target,p=d.canExecute,g=p&&p.attach,y=p&&p.connect,x=d.hints||{};if(p===!1||!m)return!1;Ml(c);var b={x:c.x,y:c.y};y?f=a.appendShape(u,f,b,m,{attach:g,connection:y===!0?{}:y,connectionTarget:x.connectionTarget}):(h=a.createElements(h,b,m,k.assign({},x,{attach:g})),f=k.find(h,function(w){return!Ze(w)})),k.assign(d,{elements:h,shape:f}),k.assign(c,{elements:h,shape:f})});function s(){var c=t.context();c&&c.prefix===Tl&&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(c,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!Ze(p)});if(f){u=k.assign({elements:d,hints:{},shape:f},u||{}),k.forEach(d,function(p){k.isNumber(p.x)||(p.x=0),k.isNumber(p.y)||(p.y=0)});var h=k.filter(d,function(p){return!p.hidden}),m=st(h);k.forEach(d,function(p){Ze(p)&&(p.waypoints=k.map(p.waypoints,function(g){return{x:g.x-m.x-m.width/2,y:g.y-m.y-m.height/2}})),k.assign(p,{x:p.x-m.x-m.width/2,y:p.y-m.y-m.height/2})}),t.init(c,Tl,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}Vl.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ml(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 Pl(e){return e&&e.length===1&&!Ze(e[0])}function Yp(e,t,o,a,i){var r=P.createTransform();r.setTranslate(t,o);var l=P.createTransform();l.setRotate(0,0,0);var s=P.createTransform();s.setScale(1,1),P.transform(e,[r,l,s])}function ct(e,t,o){var a=P.createTransform();a.setTranslate(t,o),P.transform(e,a)}function Gp(e,t){var o=P.createTransform();o.setRotate(t,0,0),P.transform(e,o)}var Kp=750;function Nl(e,t,o,a,i){function r(l){var s=P.create("g");P.attr(s,i.cls("djs-drag-group",["no-events"]));var c=P.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",c),o.drawConnection(_a(u),d)):(u=o._createContainer("shape",c),o.drawShape(_a(u),d),ct(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Kp,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var f;s?(u.parentNode||(f=e.getActiveLayer(),P.append(f,u)),ct(u,l.x,l.y)):P.remove(u)}),t.on("create.cleanup",function(l){var s=l.context,c=s.dragGroup;c&&P.remove(c)})}Nl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const $l={__depends__:[qt,Sa,Cn,bn],__init__:["create","createPreview"],create:["type",Vl],createPreview:["type",Nl]};function Hn(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ta(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var i=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=Hn(e,t);return Math.abs(i/r)<=a}var Xp=2;function St(e,t){var o=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(Zp(i,o))return r;return!1}function Zp(e,t){const o=t[0];return k.every(t,function(a){return Math.abs(o[e]-a[e])<=Xp})}function Ol(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Va(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Qp=/,?([a-z]),?/gi,Rl=parseFloat,Pe=Math,Bt=Pe.PI,dt=Pe.min,ut=Pe.max,Al=Pe.pow,jt=Pe.abs,eh=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,th=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ll=Array.isArray||function(e){return e instanceof Array};function nh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function oh(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function ah(e){function t(){var o=Array.prototype.slice.call(arguments,0),a=o.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return nh(i,a)?(oh(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function ih(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(eh,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace(th,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(o.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(o.push([i,...l.splice(0,t[s])]),!!t[s]););}),o.toString=Pa,o}function rh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function lh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Ma(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Pa(){return this.join(",").replace(Qp,"$1")}function sh(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var i=e[o],r=t[o]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=Pa,t}function Il(e,t,o,a,i,r,l,s,c){var d=1-c,u=Al(d,3),f=Al(d,2),h=c*c,m=h*c,p=u*e+f*3*c*o+d*3*c*c*i+m*l,g=u*t+f*3*c*a+d*3*c*c*r+m*s;return{x:wo(p),y:wo(g)}}function zl(e){var t=hh(...e);return Ma(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Tt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function ch(e,t){return e=Ma(e),t=Ma(t),Tt(t,e.x,e.y)||Tt(t,e.x2,e.y)||Tt(t,e.x,e.y2)||Tt(t,e.x2,e.y2)||Tt(e,t.x,t.y)||Tt(e,t.x2,t.y)||Tt(e,t.x,t.y2)||Tt(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 Fl(e,t,o,a,i){var r=-3*t+9*o-9*a+3*i,l=e*r+6*t-12*o+6*a;return e*l-3*t+3*o}function Hl(e,t,o,a,i,r,l,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],m=0,p=0;p<u;p++){var g=d*f[p]+d,y=Fl(g,e,o,i,l),x=Fl(g,t,a,r,s),b=y*y+x*x;m+=h[p]*Pe.sqrt(b)}return d*m}function dh(e,t,o,a,i,r,l,s){if(!(ut(e,o)<dt(i,l)||dt(e,o)>ut(i,l)||ut(t,a)<dt(r,s)||dt(t,a)>ut(r,s))){var c=(e*a-t*o)*(i-l)-(e-o)*(i*s-r*l),d=(e*a-t*o)*(r-s)-(t-a)*(i*s-r*l),u=(e-o)*(r-s)-(t-a)*(i-l);if(u){var f=wo(c/u),h=wo(d/u),m=+f.toFixed(2),p=+h.toFixed(2);if(!(m<+dt(e,o).toFixed(2)||m>+ut(e,o).toFixed(2)||m<+dt(i,l).toFixed(2)||m>+ut(i,l).toFixed(2)||p<+dt(t,a).toFixed(2)||p>+ut(t,a).toFixed(2)||p<+dt(r,s).toFixed(2)||p>+ut(r,s).toFixed(2)))return{x:f,y:h}}}}function wo(e){return Math.round(e*1e11)/1e11}function uh(e,t,o){var a=zl(e),i=zl(t);if(!ch(a,i))return[];var r=Hl(...e),l=Hl(...t),s=Ul(e)?1:~~(r/5)||1,c=Ul(t)?1:~~(l/5)||1,d=new Array(s+1),u=new Array(c+1),f={},h=[],m,p;for(m=0;m<s+1;m++){var g=Il(...e,m/s);d[m]={x:g.x,y:g.y,t:m/s}}for(m=0;m<c+1;m++)g=Il(...t,m/c),u[m]={x:g.x,y:g.y,t:m/c};for(m=0;m<s;m++)for(p=0;p<c;p++){var y=d[m],x=d[m+1],b=u[p],w=u[p+1],C=jt(x.x-y.x)<.01?"y":"x",_=jt(w.x-b.x)<.01?"y":"x",v=dh(y.x,y.y,x.x,x.y,b.x,b.y,w.x,w.y),j;if(v){if(j=v.x.toFixed(9)+"#"+v.y.toFixed(9),f[j])continue;f[j]=!0;var S=y.t+jt((v[C]-y[C])/(x[C]-y[C]))*(x.t-y.t),B=b.t+jt((v[_]-b[_])/(w[_]-b[_]))*(w.t-b.t);S>=0&&S<=1&&B>=0&&B<=1&&h.push({x:v.x,y:v.y,t1:S,t2:B})}}return h}function Wl(e,t,o){e=ql(e),t=ql(t);for(var a,i,r,l,s,c,d,u,f,h,m=o?0:[],p=0,g=e.length;p<g;p++){var y=e[p];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,s,c,s,c],a=s,i=c);for(var x=0,b=t.length;x<b;x++){var w=t[x];if(w[0]=="M")r=d=w[1],l=u=w[2];else{w[0]=="C"?(h=[r,l,...w.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var C=uh(f,h);{for(var _=0,v=C.length;_<v;_++)C[_].segment1=p,C[_].segment2=x,C[_].bez1=f,C[_].bez2=h;m=m.concat(C)}}}}}return m}function fh(e){return Ll(e)&&Ll(e[0])}function ph(e){if(rh(e))return e;var t=new Array(e.length),o=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],i=o,r=a,l++,t[0]=["M",o,a]);for(var c,d,u=l,f=e.length;u<f;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+o,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+o;break;case"M":i=+d[1]+o,r=+d[2]+a;default:for(var h=1,m=d.length;h<m;h++)c[h]=+d[h]+(h%2?o:a)}else for(var p=0,g=d.length;p<g;p++)c[p]=d[p];switch(s=s.toUpperCase(),c[0]){case"Z":o=+i,a=+r;break;case"H":o=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:o=c[c.length-2],a=c[c.length-1]}}return t.toString=Pa,t}function Ul(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Co(e,t,o,a){return[e,t,o,a,o,a]}function Jl(e,t,o,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*o,l*t+s*a,l*i+s*o,l*r+s*a,i,r]}function Dl(e,t,o,a,i,r,l,s,c,d){var u=Bt*120/180,f=Bt/180*(+i||0),h=[],m,p=ah(function(re,ye,je){var U=re*Pe.cos(je)-ye*Pe.sin(je),te=re*Pe.sin(je)+ye*Pe.cos(je);return{x:U,y:te}});if(d)j=d[0],S=d[1],_=d[2],v=d[3];else{m=p(e,t,-f),e=m.x,t=m.y,m=p(s,c,-f),s=m.x,c=m.y;var g=(e-s)/2,y=(t-c)/2,x=g*g/(o*o)+y*y/(a*a);x>1&&(x=Pe.sqrt(x),o=x*o,a=x*a);var b=o*o,w=a*a,C=(r==l?-1:1)*Pe.sqrt(jt((b*w-b*y*y-w*g*g)/(b*y*y+w*g*g))),_=C*o*y/a+(e+s)/2,v=C*-a*g/o+(t+c)/2,j=Pe.asin(((t-v)/a).toFixed(9)),S=Pe.asin(((c-v)/a).toFixed(9));j=e<_?Bt-j:j,S=s<_?Bt-S:S,j<0&&(j=Bt*2+j),S<0&&(S=Bt*2+S),l&&j>S&&(j=j-Bt*2),!l&&S>j&&(S=S-Bt*2)}var B=S-j;if(jt(B)>u){var V=S,T=s,L=c;S=j+u*(l&&S>j?1:-1),s=_+o*Pe.cos(S),c=v+a*Pe.sin(S),h=Dl(s,c,o,a,i,0,l,T,L,[S,V,_,v])}B=S-j;var F=Pe.cos(j),z=Pe.sin(j),M=Pe.cos(S),E=Pe.sin(S),$=Pe.tan(B/4),R=4/3*o*$,Y=4/3*a*$,ee=[e,t],se=[e+R*z,t-Y*F],de=[s+R*E,c-Y*M],Me=[s,c];if(se[0]=2*ee[0]-se[0],se[1]=2*ee[1]-se[1],d)return[se,de,Me].concat(h);h=[se,de,Me].concat(h).join().split(",");for(var D=[],fe=0,ge=h.length;fe<ge;fe++)D[fe]=fe%2?p(h[fe-1],h[fe],f).y:p(h[fe],h[fe+1],f).x;return D}function hh(e,t,o,a,i,r,l,s){for(var c=[],d=[[],[]],u,f,h,m,p,g,y,x,b=0;b<2;++b){if(b==0?(f=6*e-12*o+6*i,u=-3*e+9*o-9*i+3*l,h=3*o-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,h=3*a-3*t),jt(u)<1e-12){if(jt(f)<1e-12)continue;m=-h/f,0<m&&m<1&&c.push(m);continue}y=f*f-4*h*u,x=Pe.sqrt(y),!(y<0)&&(p=(-f+x)/(2*u),0<p&&p<1&&c.push(p),g=(-f-x)/(2*u),0<g&&g<1&&c.push(g))}for(var w=c.length,C=w,_;w--;)m=c[w],_=1-m,d[0][w]=_*_*_*e+3*_*_*m*o+3*_*m*m*i+m*m*m*l,d[1][w]=_*_*_*t+3*_*_*m*a+3*_*m*m*r+m*m*m*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:dt(...d[0]),y0:dt(...d[1]),x1:ut(...d[0]),y1:ut(...d[1])}}function ql(e){if(fh(e)||(e=ih(e)),lh(e))return e;for(var t=sh(ph(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,m,p){var g,y;if(!h)return["C",m.x,m.y,m.x,m.y,m.x,m.y];switch(!(h[0]in{T:1,Q:1})&&(m.qx=m.qy=null),h[0]){case"M":m.X=h[1],m.Y=h[2];break;case"A":h=["C",...Dl(m.x,m.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(g=m.x*2-m.bx,y=m.y*2-m.by):(g=m.x,y=m.y),h=["C",g,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(m.qx=m.x*2-m.qx,m.qy=m.y*2-m.qy):(m.qx=m.x,m.qy=m.y),h=["C",...Jl(m.x,m.y,m.qx,m.qy,h[1],h[2])];break;case"Q":m.qx=h[1],m.qy=h[2],h=["C",...Jl(m.x,m.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...Co(m.x,m.y,h[1],h[2])];break;case"H":h=["C",...Co(m.x,m.y,h[1],m.y)];break;case"V":h=["C",...Co(m.x,m.y,m.x,h[1])];break;case"Z":h=["C",...Co(m.x,m.y,m.X,m.Y)];break}return h},i=function(h,m){if(h[m].length>7){h[m].shift();for(var p=h[m];p.length;)r[m]="A",h.splice(m++,0,["C",...p.splice(0,6)]);h.splice(m,1),d=t.length}},r=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],o,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],f=u.length;o.x=u[f-2],o.y=u[f-1],o.bx=Rl(u[f-4])||o.x,o.by=Rl(u[f-3])||o.y}return t}function mh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Yl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function gh(e){return Wn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function yh(e){for(var t=e.waypoints,o=t.reduce(function(d,u,f){var h=t[f-1];if(h){var m=d[d.length-1],p=m&&m.endLength||0,g=xh(h,u);d.push({start:h,end:u,startLength:p,endLength:p+g,length:g})}return d},[]),a=o.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=o[r];l.endLength<i;)l=o[++r];var s=(i-l.startLength)/l.length,c={x:l.start.x+(l.end.x-l.start.x)*s,y:l.start.y+(l.end.y-l.start.y)*s};return c}function Te(e){return Ze(e)?yh(e):gh(e)}function Vt(e,t,o){o=o||0,k.isObject(o)||(o={x:o,y:o});var a=be(e),i=be(t),r=a.bottom+o.y<=i.top,l=a.left-o.x>=i.right,s=a.top-o.y>=i.bottom,c=a.right+o.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Na(e,t,o){var a=vh(e,t);return a.length===1||a.length===2&&Hn(a[0],a[1])<1?Wn(a[0]):a.length>1?(a=k.sortBy(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),Wn(a[o?0:a.length-1])):null}function vh(e,t){return Wl(e,t)}function bh(e){e=e.slice();for(var t=0,o,a,i;e[t];)o=e[t],a=e[t-1],i=e[t+1],Hn(o,i)===0||Ta(a,i,o)?e.splice(t,1):t++;return e}function xh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gl(e,t,o,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!k.isNil(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!k.isNil(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},f=s.source,h=s.target;if(!c)return!1;var m=null,p={connectionStart:$a(s)?u:d,connectionEnd:$a(s)?d:u};k.isObject(c)&&(m=c),s.connection=o.connect(f,h,m,p)}),this.start=function(l,s,c,d){k.isObject(c)||(d=c,c=Te(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}Gl.$inject=["eventBus","dragging","modeling","rules"];function $a(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var wh=1100,Ch=900,Kl="connect-ok",Xl="connect-not-ok";function Zl(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,m=r.connectionEnd||{x:i.x,y:i.y},p=h,g=m;$a(r)&&(p=m,g=h),a.drawPreview(r,l,{source:c||d,target:f||s,connectionStart:p,connectionEnd:g})}),t.on("connect.hover",Ch,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&o.addMarker(l,s?Kl:Xl)}),t.on(["connect.out","connect.cleanup"],wh,function(i){var r=i.hover;r&&(o.removeMarker(r,Kl),o.removeMarker(r,Xl))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}Zl.$inject=["injector","eventBus","canvas"];const Oa={__depends__:[bn,Cn,qt],__init__:["connectPreview"],connect:["type",Gl],connectPreview:["type",Zl]};var kh=15;function Ql(e,t){var o;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(s){var c=o.start,d=o.button,u=yn(s),f=xn(u,c);if(!o.dragging&&Eh(f)>kh&&(o.dragging=!0,d===0&&vl(e),Ea("grab")),o.dragging){var h=o.last||o.start;f=xn(u,h),t.scroll({dx:f.x,dy:f.y}),o.last=u}s.preventDefault()}function r(s){A.event.unbind(document,"mousemove",i),A.event.unbind(document,"mouseup",r),o=null,yl()}function l(s){if(!A.closest(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:c,start:yn(s)},A.event.bind(document,"mousemove",i),A.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}Ql.$inject=["eventBus","canvas"];function Eh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const es={__init__:["moveCanvas"],moveCanvas:["type",Ql]};function Ra(e){return Math.log(e)/Math.log(10)}function ts(e,t){var o=Ra(e.min),a=Ra(e.max),i=Math.abs(o)+Math.abs(a);return i/t}function _h(e,t){return Math.max(e.min,Math.min(e.max,t))}var Sh=Math.sign||function(e){return e>=0?1:-1},Aa={min:.2,max:4},ns=10,Bh=.1,jh=.75;function ft(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||jh;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}ft.$inject=["config.zoomScroll","eventBus","canvas"],ft.prototype.scroll=function(t){this._canvas.scroll(t)},ft.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ft.prototype.zoom=function(t,o){var a=ts(Aa,ns*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Bh&&(this._zoom(t,o,a),this._totalDelta=0)},ft.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||ll()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Sh(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},ft.prototype.stepZoom=function(t,o){var a=ts(Aa,ns);this._zoom(t,o,a)},ft.prototype._zoom=function(e,t,o){var a=this._canvas,i=e>0?1:-1,r=Ra(a.zoom()),l=Math.round(r/o)*o;l+=o*i;var s=Math.pow(10,l);a.zoom(_h(Aa,s),t)},ft.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&A.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ft.prototype._init=function(e){this.toggle(e)};const os={__init__:["zoomScroll"],zoomScroll:["type",ft]};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},a=this._getHandler(e);let i=this._fire(e,"canExecute",o);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},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,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let i;o=this._eventBus.createEvent(o);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return i},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,a=e.context,i=this._getHandler(o);if(!i)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(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 Th={commandStack:["type",Be]};function Yt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function ko(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function Mt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function La(e,t){return!e||!t?-1:e.indexOf(t)}function En(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 Vh=1e3;function De(e){this._eventBus=e}De.$inject=["eventBus"];function Mh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}De.prototype.on=function(e,t,o,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=o,o=t,t=null),k.isFunction(o)&&(r=i,i=a,a=o,o=Vh),k.isObject(i)&&(r=i,i=!1),!k.isFunction(a))throw new Error("handlerFn must be a function");k.isArray(e)||(e=[e]);var l=this._eventBus;k.forEach(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,o,i?Mh(a,r):a,r)})},De.prototype.canExecute=yt("canExecute"),De.prototype.preExecute=yt("preExecute"),De.prototype.preExecuted=yt("preExecuted"),De.prototype.execute=yt("execute"),De.prototype.executed=yt("executed"),De.prototype.postExecute=yt("postExecute"),De.prototype.postExecuted=yt("postExecuted"),De.prototype.revert=yt("revert"),De.prototype.reverted=yt("reverted");function yt(e){return function(o,a,i,r,l){(k.isFunction(o)||k.isNumber(o))&&(l=r,r=i,i=a,a=o,o=null),this.on(o,e,a,i,r,l)}}var Ph=250,as=1400;function Ia(e,t,o){De.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",as,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=is(l),r.validatedShapes=is(s)}),a&&t.on("shape.move.start",Ph,function(i){var r=i.context,l=r.shapes,s=[];k.forEach(l,function(c){k.forEach(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),k.forEach(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",as,function(i){var r=i.context,l=r.closure,s=l.enclosedElements,c=[];k.forEach(s,function(d){k.forEach(d.labels,function(u){s[u.id]||c.push(u)})}),l.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;En(l.labels,function(s){o.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=La(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(Mt(s.labels,l,c),l.labelTarget=s)})}Yt(Ia,De),Ia.$inject=["injector","eventBus","modeling"];function is(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Nh={__init__:["labelSupport"],labelSupport:["type",Ia]};function rs(){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 ls(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function $h(e,t,o,a){var i=o.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Oh(e){return e.__refs_collection===!0}function Rh(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ss(e,t,o){var a=$h(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,o)})}function Ah(e,t,o){var a=t.inverse,i=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,o),i=r,e.set(i,a,o)}}})}function at(e,t){if(!(this instanceof at))return new at(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}at.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?ss(this,t,e):Ah(this,t,e)},at.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Oh(o)||ss(this,t,e),o},at.prototype.ensureBound=function(e,t){Rh(e,t)||this.bind(e,t)},at.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},at.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var za=new at({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cs=new at({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),ds=new at({name:"attachers",collection:!0},{name:"host"}),us=new at({name:"outgoing",collection:!0},{name:"source"}),fs=new at({name:"incoming",collection:!0},{name:"target"});function _n(){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)}}),za.bind(this,"parent"),cs.bind(this,"labels"),us.bind(this,"outgoing"),fs.bind(this,"incoming")}function Un(){_n.call(this),za.bind(this,"children"),ds.bind(this,"host"),ds.bind(this,"attachers")}Yt(Un,_n);function ps(){_n.call(this),za.bind(this,"children")}Yt(ps,Un);function hs(){Un.call(this),cs.bind(this,"labelTarget")}Yt(hs,Un);function ms(){_n.call(this),us.bind(this,"source"),fs.bind(this,"target")}Yt(ms,_n);var Lh={connection:ms,shape:Un,label:hs,root:ps};function Ih(e,t){var o=Lh[e];if(!o)throw new Error("unknown type: <"+e+">");return k.assign(new o,t)}function zh(e){return e instanceof _n}function Pt(){this._uid=12}Pt.prototype.createRoot=function(e){return this.create("root",e)},Pt.prototype.createLabel=function(e){return this.create("label",e)},Pt.prototype.createShape=function(e){return this.create("shape",e)},Pt.prototype.createConnection=function(e){return this.create("connection",e)},Pt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),Ih(e,t)};const Fh={width:90,height:20};function Gt(){Pt.call(this),this._translate=ls}Ht(Gt,Pt),Gt.$inject=[],Gt.prototype.baseCreate=Pt.prototype.create,Gt.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Se({type:"label"},Fh,t)):this.createFlowElement(e,t)},Gt.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:rs()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Se({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Gt.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 Eo(e,t){this._modeling=e,this._canvas=t}Eo.$inject=["modeling","canvas"],Eo.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;k.forEach(o,function(i){var r={x:0,y:0};k.isDefined(a.left)?r.x=a.left-i.x:k.isDefined(a.right)?r.x=a.right-i.width-i.x:k.isDefined(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:k.isDefined(a.top)?r.y=a.top-i.y:k.isDefined(a.bottom)?r.y=a.bottom-i.height-i.y:k.isDefined(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},Eo.prototype.postExecute=function(e){};function _o(e){this._modeling=e}_o.$inject=["modeling"],_o.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:i.attach}),e.shape=a},_o.prototype.postExecute=function(e){var t=e.hints||{};Hh(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 Hh(e,t){return k.some(e.outgoing,function(o){return o.target===t})}function So(e,t){this._canvas=e,this._layouter=t}So.$inject=["canvas","layouter"],So.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},So.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Bo=Math.round;function Fa(e){this._modeling=e}Fa.$inject=["modeling"],Fa.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;k.forEach(t,function(f){k.isNumber(f.x)||(f.x=0),k.isNumber(f.y)||(f.y=0)});var s=k.filter(t,function(f){return!f.hidden}),c=st(s);k.forEach(t,function(f){Ze(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:Bo(h.x-c.x-c.width/2+i.x),y:Bo(h.y-c.y-c.height/2+i.y)}})),k.assign(f,{x:Bo(f.x-c.x-c.width/2+i.x),y:Bo(f.y-c.y-c.height/2+i.y)})});var d=Ip(t),u={};k.forEach(t,function(f){if(Ze(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||o,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||o,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),kn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,h)}),e.elements=k.values(u)};var gs=Math.round;function Nt(e){this._canvas=e}Nt.$inject=["canvas"],Nt.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?k.assign(t,o):k.assign(t,{x:o.x-gs(t.width/2),y:o.y-gs(t.height/2)}),this._canvas.addShape(t,a,i),t},Nt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Jn(e){Nt.call(this,e)}Yt(Jn,Nt),Jn.$inject=["canvas"];var Wh=Nt.prototype.execute;Jn.prototype.execute=function(e){var t=e.shape;return Jh(t),t.labelTarget=e.labelTarget,Wh.call(this,e)};var Uh=Nt.prototype.revert;Jn.prototype.revert=function(e){return e.shape.labelTarget=null,Uh.call(this,e)};function Jh(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Dn(e,t){this._canvas=e,this._modeling=t}Dn.$inject=["canvas","modeling"],Dn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;En(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),En(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Dn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=La(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Dn.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(o.children,t,a),this._canvas.addConnection(t,o),t};function Ha(e,t){this._modeling=e,this._elementRegistry=t}Ha.$inject=["modeling","elementRegistry"],Ha.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;k.forEach(a,function(i){o.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function qn(e,t){this._canvas=e,this._modeling=t}qn.$inject=["canvas","modeling"],qn.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;En(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),En(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),En(o.children,function(a){Ze(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},qn.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=La(a.children,o),t.removeShape(o),o},qn.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,i=e.oldParentIndex;return Mt(a.children,o,i),t.addShape(o,a),o};function jo(e){this._modeling=e}jo.$inject=["modeling"];var ys={x:"y",y:"x"};jo.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,i=e.dimension;function r(y,x){y.range.min=Math.min(x[a],y.range.min),y.range.max=Math.max(x[a]+x[i],y.range.max)}function l(y){return y[a]+y[i]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,x){var b={y:0};b[a]=y-l(x),b[a]&&(b[ys[a]]=0,t.moveElements([x],b,x.parent))}var u=o[0],f=s(o),h=o[f],m,p,g=0;k.forEach(o,function(y,x){var b,w,C;if(y.elements.length<2){x&&x!==o.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}b=k.sortBy(y.elements,a),w=b[0],x===f&&(w=b[s(b)]),C=l(w),y.range=null,k.forEach(b,function(_){if(d(C,_),y.range===null){y.range={min:_[a],max:_[a]+_[i]};return}r(y,_)}),x&&x!==o.length-1&&(g+=c(y.range))}),p=Math.abs(h.range.min-u.range.max),m=Math.round((p-g)/(o.length-1)),!(m<o.length-1)&&k.forEach(o,function(y,x){var b={},w;y===u||y===h||(w=o[x-1],y.range.max=0,k.forEach(y.elements,function(C,_){b[ys[a]]=0,b[a]=w.range.max-C[a]+m,y.range.min!==C[a]&&(b[a]+=C[a]-y.range.min),b[a]&&t.moveElements([C],b,C.parent),y.range.max=Math.max(C[a]+C[i],_?y.range.max:0)}))})},jo.prototype.postExecute=function(e){};function To(e,t){this._layouter=e,this._canvas=t}To.$inject=["layouter","canvas"],To.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return k.assign(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},To.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wa(){}Wa.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=ko(r.children,t),Mt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Wa.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return ko(o.children,t),Mt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function Vo(e,t,o){var a=bl(t),i=bl(o),r=xn(e,a),l={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return Wn({x:i.x+l.x,y:i.y+l.y})}function Ua(e,t,o){var a=Mo(e),i=bs(a,t),r=a[0];return i.length?i[i.length-1]:Vo(r.original||r,o,t)}function Ja(e,t,o){var a=Mo(e),i=bs(a,t),r=a[a.length-1];return i.length?i[0]:Vo(r.original||r,o,t)}function Da(e,t,o){var a=Mo(e),i=vs(t,o),r=a[0];return Vo(r.original||r,i,t)}function qa(e,t,o){var a=Mo(e),i=vs(t,o),r=a[a.length-1];return Vo(r.original||r,i,t)}function vs(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Mo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bs(e,t){var o=k.map(e,qh);return k.filter(o,function(a){return Dh(a,t)})}function Dh(e,t){return Vt(t,e,1)==="intersect"}function qh(e){return e.original||e}function Ya(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ya.prototype.add=function(e,t){return this.addAll([e],t)},Ya.prototype.addAll=function(e,t){var o=Hp(e,!!t,this);return k.assign(this,o),this};function Yn(e){this._modeling=e}Yn.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Yn.prototype.moveClosure=function(e,t,o,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===o&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&o,{recurse:!1,layout:!1})}),k.forEach(s,function(f){var h=!!l[f.source.id],m=!!l[f.target.id];c[f.id]&&h&&m?r.moveConnection(f,t,d[f.id]&&!u&&o):r.layoutConnection(f,{connectionStart:h&&Da(f,f.source,t),connectionEnd:m&&qa(f,f.target,t)})})},Yn.prototype.getClosure=function(e){return new Ya().addAll(e,!0)};function Po(e){this._helper=new Yn(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 Kt(e){this._modeling=e,this._helper=new Yn(e)}Kt.$inject=["modeling"],Kt.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=k.pick(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=ko(r.children,t),Mt(a.children,t,i),k.assign(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Kt.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:qa(r,t,o)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:Da(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Kt.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,i=e.delta;return Mt(o.children,t,a),k.assign(t,{parent:o,x:t.x-i.x,y:t.y-i.y}),t},Kt.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Kt.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Gn(e){this._modeling=e}Gn.$inject=["modeling"],Gn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return k.isArray(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},Gn.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(o&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||xs(k.isArray(i)?i[0]:i)),a&&(!o||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||xs(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},Gn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),o&&(i.target=o),a&&(i.waypoints=a),i};function xs(e){return e.original||e}function vt(e,t){this._modeling=e,this._rules=t}vt.$inject=["modeling","rules"],vt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},s;function c(p,g,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:g})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&o.updateAttachment(s,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),o.moveElements(f,{x:0,y:0},s,l));var h=i.incoming.slice(),m=i.outgoing.slice();k.forEach(h,function(p){var g=p.source,y=c(g,s,p);y&&t.reconnectEnd(p,s,Ja(p,s,u),l)}),k.forEach(m,function(p){var g=p.target,y=c(s,g,p);y&&t.reconnectStart(p,s,Ua(p,s,u),l)})},vt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},vt.prototype.execute=function(e){},vt.prototype.revert=function(e){},vt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},vt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},vt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Kn(e){this._modeling=e}Kn.$inject=["modeling"],Kn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Kn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ja(r,o,a)})}),k.forEach(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ua(r,o,a)})}))},Kn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function Yh(e,t){var o=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var s=l.source,c=l.target;(Xn(e,s)||Xn(e,c)||Xn(t,s)||Xn(t,c))&&(Xn(o,l)||o.push(l))})}),o}function Xn(e,t){return e.indexOf(t)!==-1}function Gh(e,t,o){var a=e.x,i=e.y,r=e.width,l=e.height,s=o.x,c=o.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function $t(e){this._modeling=e}$t.$inject=["modeling"],$t.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(s){l[s.id]=Xh(s)}),this.resizeShapes(i,t,o),this.updateConnectionWaypoints(Yh(a,i),t,o,r,a,i,l)},$t.prototype.execute=function(){},$t.prototype.revert=function(){},$t.prototype.moveShapes=function(e,t){var o=this;k.forEach(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},$t.prototype.resizeShapes=function(e,t,o){var a=this;k.forEach(e,function(i){var r=Gh(i,o,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},$t.prototype.updateConnectionWaypoints=function(e,t,o,a,i,r,l){var s=this,c=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=Kh(d),m=Cs(o),p={};Ot(c,u)&&Ot(c,f)?(h=k.map(h,function(g){return ks(g,a,o)&&(g[m]=g[m]+t[m]),g.original&&ks(g.original,a,o)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Ot(c,u)||Ot(c,f))&&(Ot(i,u)?p.connectionStart=Da(d,u,t):Ot(i,f)?p.connectionEnd=qa(d,f,t):Ot(r,u)?p.connectionStart=Ua(d,u,l[u.id]):Ot(r,f)&&(p.connectionEnd=Ja(d,f,l[f.id])),s._modeling.layoutConnection(d,p))})};function ws(e){return k.assign({},e)}function Kh(e){return k.map(e.waypoints,function(t){return t=ws(t),t.original&&(t.original=ws(t.original)),t})}function Cs(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function ks(e,t,o){var a=Cs(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Ot(e,t){return e.indexOf(t)!==-1}function Xh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function No(e){this._modeling=e}No.$inject=["modeling"],No.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Es(o),t.collapsed=!t.collapsed;var a=_s(o,t.collapsed);return[t].concat(a)},No.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,i=Ss(a,o);return t.collapsed=!t.collapsed,[t].concat(i)};function Es(e){var t={};return k.forEach(e,function(o){t[o.id]=o.hidden,o.children&&(t=k.assign({},t,Es(o.children)))}),t}function _s(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(_s(a.children,a.collapsed||t)))}),o}function Ss(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Ss(a.children,t)))}),o}function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Bs(a,t),js(o,t),t.host=o,t},$o.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Bs(o,t),js(a,t,i),t};function Bs(e,t){return ko(e&&e.attachers,t)}function js(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),Mt(a,t,o)}}function Ga(){}Ga.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Ga.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function me(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}me.$inject=["eventBus","elementFactory","commandStack"],me.prototype.getHandlers=function(){return{"shape.append":_o,"shape.create":Nt,"shape.delete":qn,"shape.move":Kt,"shape.resize":Kn,"shape.replace":vt,"shape.toggleCollapse":No,spaceTool:$t,"label.create":Jn,"connection.create":So,"connection.delete":Dn,"connection.move":Wa,"connection.layout":To,"connection.updateWaypoints":Ga,"connection.reconnect":Gn,"elements.create":Fa,"elements.move":Po,"elements.delete":Ha,"elements.distribute":jo,"elements.align":Eo,"element.updateAttachment":$o}},me.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},me.prototype.moveShape=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},me.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},me.prototype.moveElements=function(e,t,o,a){a=a||{};var i=a.attach,r=o,l;i===!0?(l=o,r=o.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},me.prototype.moveConnection=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},me.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},me.prototype.createConnection=function(e,t,o,a,i,r){typeof o=="object"&&(r=i,i=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},me.prototype.createShape=function(e,t,o,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=o.parent,s=o):l=o;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},me.prototype.createElements=function(e,t,o,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},me.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var i={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",i),i.shape},me.prototype.appendShape=function(e,t,o,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},me.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},me.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},me.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},me.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},me.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},me.prototype.resizeShape=function(e,t,o,a){var i={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",i)},me.prototype.createSpace=function(e,t,o,a,i){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},me.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},me.prototype.reconnect=function(e,t,o,a,i){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},me.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,k.assign(a,{docking:"source"}))},me.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,k.assign(a,{docking:"target"}))},me.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},me.prototype._create=function(e,t){return zh(t)?t:this._elementFactory.create(e,t)},me.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Ts(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ka(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function Zh(e,t){Array.isArray(e)&&e.forEach(t)}function Oo(e){const t=e.businessObject;if(t)return t.name||""}function Qh(e,t){const o=e.businessObject;return o.name=t,e}const em={height:20},Vs=15;function Xa(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Ms(e){return Zn(e.label)}function tm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=nm(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=Vs:l+=Vs,{x:l,y:s}}function nm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Ps(e){return e.waypoints?tm(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+em.height/2}}function Zn(e){return e&&!!e.labelTarget}const om={width:0,height:0};function Ns(e,t){function o(s,c){const d=s.label||s,u=s.labelTarget||s;return Qh(d,c),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Zn(c)&&Xa(c)&&!Ms(c)&&!$s(d)){let h=Ps(c);h={x:h.x,y:h.y+7},e.createLabel(c,h,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=Oo(s.element),o(s.element,s.newLabel)}function r(s){return o(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,f=s.hints||{};let{newBounds:h}=s;if(!Zn(u))return;if(Zn(u)&&$s(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const m=Oo(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,m)),h&&e.resizeShape(u,h,om)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Ns.$inject=["modeling","textRenderer"];function $s(e){return!e||!e.trim()}function Qn(e,t,o){me.call(this,e,t,o)}Ht(Qn,me),Qn.$inject=["eventBus","elementFactory","commandStack"],Qn.prototype.getHandlers=function(){const e=me.prototype.getHandlers.call(this);return e["element.updateLabel"]=Ns,e},Qn.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function Za(e,t){De.call(this,e);function o(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}Ht(Za,De),Za.$inject=["eventBus","connectionDocking"];function Os(){}Os.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Te(t.source||e.source),t.connectionEnd||Te(t.target||e.target)]};var Ro=20,am=5,Ao=Math.round,Rs=20,im={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function rm(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function lm(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function As(e,t,o){var a=Vt(t,e,am),i=o.split(":")[0],r=Ao((t.x-e.x)/2+e.x),l=Ao((t.y-e.y)/2+e.y),s,c,d=lm(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(f=rm(a,i),c=u?"h:v":"v:h",f?u?(h=l===e.y,s={x:e.x+Ro*(/l/.test(i)?-1:1),y:h?l+Ro:l}):(h=r===e.x,s={x:h?r+Ro:r,y:e.y+Ro*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:Qa(e,s,c).concat(s),directions:c,turnNextDirections:h}}function sm(e,t,o){return As(e,t,o)}function cm(e,t,o){var a=As(t,e,Ls(o));return{waypoints:a.waypoints.slice().reverse(),directions:Ls(a.directions),turnNextDirections:a.turnNextDirections}}function dm(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=o+":"+a,r=Qa(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Ls(e){return e.split(":").reverse().join(":")}function um(e,t,o){var a=Ao((t.x-e.x)/2+e.x),i=Ao((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Qa(e,t,o){if(o=o||"h:h",!xm(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(zs(o)){var a=sm(e,t,o),i=cm(e,t,o),r=dm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return um(e,t,o)}function fm(e,t,o){var a=Qa(e,t,o);return a.unshift(e),a.push(t),Hs(a)}function pm(e,t,o,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",s=im[l]||0,c=Vt(e,t,s),d=bm(c,l);o=o||Te(e),a=a||Te(t);var u=d.split(":"),f=Fs(o,e,u[0],wm(c)),h=Fs(a,t,u[1],c);return fm(f,h,d)}function hm(e,t,o,a,i,r){k.isArray(o)&&(i=o,r=a,o=Te(e),a=Te(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,s=l.indexOf("straight")!==-1,c;return c=s&&gm(e,t,o,a,r),c||(c=r.connectionEnd&&vm(t,e,a,i),c)||(c=r.connectionStart&&ym(e,t,o,i),c)?c:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:pm(e,t,o,a,r)}function mm(e,t,o){return e>=t&&e<=o}function Is(e,t,o){var a={x:"width",y:"height"};return mm(t[e],o[e],o[e]+o[a[e]])}function gm(e,t,o,a,i){var r={},l,s;return s=Vt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Is(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:Is(l,o,t)?(r[l]=o[l],[{x:o.x,y:o.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function ym(e,t,o,a){return ei(e,t,o,a)}function vm(e,t,o,a){var i=a.slice().reverse();return i=ei(e,t,o,i),i?i.reverse():null}function ei(e,t,o,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var m=u[h-1];return m&&Hn(f,m)<3})}function r(u,f,h){var m=St(f,u);switch(m){case"v":return{x:h.x,y:u.y};case"h":return{x:u.x,y:h.y}}return{x:u.x,y:u.y}}function l(u,f,h){var m;for(m=u.length-2;m!==0;m--)if(Ol(u[m],f,Rs)||Ol(u[m],h,Rs))return u.slice(m);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=o,c[1]=r(c[1],s,o),d=l(c,e,t),d!==c&&(c=ei(e,t,o,d)),c&&St(c)?null:c}function bm(e,t){if(zs(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 xm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function zs(e){return e&&/t|r|b|l/.test(e)}function wm(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 Fs(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function Hs(e){return e.reduce(function(t,o,a){var i=t[t.length-1],r=e[a+1];return Ta(i,r,o,0)||t.push(o),t},[])}function ti(){}Ht(ti,Os);const Xt=(e,t)=>e.type===t;ti.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=Lo(i&&i[0],o),l=Lo(i&&i[i.length-1],a)),r||(r=Lo(i&&i[0],o)),l||(l=Lo(i&&i[i.length-1],a)),Xt(e,"myline")&&(o===a?s={preferredLayouts:Cm(o,e)}:Xt(o,"gatewayAnd")||Xt(o,"gatewayXor")||Xt(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Xt(a,"gatewayAnd")||Xt(a,"gatewayXor")||Xt(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Se(s,t),c=Hs(hm(o,a,r,l,i,s))),c||[r,l]};function Lo(e,t){return e?e.original||e:Te(t)}function Cm(e,t){const{waypoints:o}=t,a=o&&o.length&&Vt(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Ws(e){return k.assign({original:e.point.original||e.point},e.actual)}function Rt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rt.$inject=["elementRegistry","graphicsFactory"],Rt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Ws(a)),r.push(Ws(i)),r},Rt.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,i,r,l;return i=o?0:a.length-1,r=a[i],l=this._getIntersection(t,e,o),{point:r,actual:l||r,idx:i}},Rt.prototype._getIntersection=function(e,t,o){var a=this._getShapePath(e),i=this._getConnectionPath(t);return Na(a,i,o)},Rt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Us={__depends__:[Th,Nh,bn],__init__:["modeling","elementUpdater"],modeling:["type",Qn],layouter:["type",ti],elementUpdater:["type",Za],elementFactory:["type",Gt],connectionDocking:["type",Rt]};var km=1e3;function Zt(e,t){var o=this;t=t||km,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(o.canRender(l))return r==="render.shape"?o.drawShape(s,l,c):o.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(o.canRender(i))return a.type==="render.getShapePath"?o.getShapePath(i):o.getConnectionPath(i)})}Zt.prototype.canRender=function(e){},Zt.prototype.drawShape=function(e,t){},Zt.prototype.drawConnection=function(e,t){},Zt.prototype.getShapePath=function(e){},Zt.prototype.getConnectionPath=function(e){};function Em(e){return e.businessObject}function Io(e,t){return e.businessObject.strokeWidth||t||1}function rt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ve(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function _m(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2,i=[["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return zn(i)}function Sm(e,t){const{x:o,y:a,width:i,height:r}=e,l=[["M",o+t,a],["l",i-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return zn(l)}function Bm(e){const{x:t,y:o,width:a,height:i}=e,r=a/2,l=i/2,s=[["M",t+r,o],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return zn(s)}function jm(e){const{x:t,y:o,width:a,height:i}=e,r=[["M",t,o],["l",a,0],["l",0,i],["l",-a,0],["z"]];return zn(r)}const ni=10,oi=.95,At=(e,t)=>e.type===t;function Qt(e,t,o,a,i,r,l){Zt.call(this,e,l);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const E=r.palette[M];d[E.type]=E.options});const{computeStyle:u}=t;function f(M){return z[M]}function h(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function m(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function p(M,E,$,R){$=h($);const Y=Ca(E,$,R);return P.append(M,Y),Y}function g(M,E,$){return p(M,E,$,5)}function y(M,E,$,R,Y){Ts(R)&&(Y=R,R=0),R=R||0,Y=u(Y,{stroke:c,strokeWidth:2,fill:s}),Y.fill==="none"&&delete Y.fillOpacity;const ee=E/2,se=$/2,de=P.create("circle");return P.attr(de,{cx:ee,cy:se,r:Math.round((E+$)/4-R)}),P.attr(de,Y),P.append(M,de),de}function x(M,E,$,R,Y,ee){Ts(Y)&&(ee=Y,Y=0),Y=Y||0,ee=u(ee,{stroke:c,strokeWidth:2,fill:s});const se=P.create("rect");return P.attr(se,{x:Y,y:Y,width:E-Y*2,height:$-Y*2,rx:R,ry:R}),P.attr(se,ee),P.append(M,se),se}function b(M,E,$){$=u($,["no-fill"],{strokeWidth:2,stroke:c});const R=P.create("path");return P.attr(R,{d:E}),P.attr(R,$),P.append(M,R),R}function w(M,E,$,R){const Y=E/2,ee=$/2,de=[{x:Y,y:0},{x:E,y:ee},{x:Y,y:$},{x:0,y:ee}].map(D=>D.x+","+D.y).join(" ");R=u(R,{stroke:c,strokeWidth:2,fill:s});const Me=P.create("polygon");return P.attr(Me,{points:de}),P.attr(Me,R),P.append(M,Me),Me}function C(M,E,$,R){return b(E,$,Se({"data-marker":M},R))}function _(M,E,$){$=Se({size:{width:100}},$);const R=i.createText(E||"",$);return P.classes(R).add("djs-label"),P.append(M,R),R}function v(M,E,$){const R=Em(E);return _(M,R.name,{box:E,align:$,padding:5,style:{fill:Ve(E,c)}})}function j(M,E){const $={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return _(M,Oo(E),{box:$,fitBox:!0,style:Se({},i.getExternalStyle(),{fill:Ve(E,c)})})}function S(M,E,$){const R=$&&$.indexOf("SubProcessMarker")!==-1;let Y;R?Y={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Y={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},Zh($,ee=>{f(ee)(M,E,Y)})}function B(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,E){const{ref:$={x:0,y:0},scale:R=1,element:Y,parentGfx:ee=a._svg}=E,se=P.create("marker",{id:M,viewBox:"0 0 20 20",refX:$.x,refY:$.y,markerWidth:20*R,markerHeight:20*R,orient:"auto"});P.append(se,Y);let de=A.query(":scope > defs",ee);de||(de=P.create("defs"),P.append(ee,de)),P.append(de,se)}function T(M,E,$,R){const Y=E+"-"+B($)+"-"+B(R)+"-"+rs();return L(M,Y,E,$,R),"url(#"+Y+")"}function L(M,E,$,R,Y){{const ee=P.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...m({fill:Y,stroke:Y,strokeWidth:1})});V(E,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:M})}}function F(M,E,$,R){const Y=d[E.type]?.icon||E.icon;if(Y){const ee=o.getScaledPath(Y,{abspos:{x:$,y:R}});b(M,ee,{strokeWidth:0,fill:Ve(E,d[E.type]?.iconFill||E.iconFill)})}}const z={event(M,E,$){return"fillOpacity"in $||($.fillOpacity=oi),y(M,E.width,E.height,$)},startEvent(M,E){const $={fill:rt(E,d.startEvent?.fill||E.fill),stroke:Ve(E,d.startEvent?.stroke||E.stroke),strokeWidth:Io(E,d.startEvent?.strokeWidth||E.strokeWidth)},R=f("event")(M,E,$);return F(M,E,18,18),R},endEvent(M,E){const $=f("event")(M,E,{strokeWidth:Io(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:rt(E,d.endEvent?.fill||E.fill),stroke:Ve(E,d.endEvent?.stroke||E.stroke)});return F(M,E,18,18),$},gateway(M,E){const $={fillOpacity:oi,strokeWidth:Io(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)};return w(M,E.width,E.height,$)},gatewayAnd(M,E){const $=f("gateway")(M,E),R=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}});return b(M,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayXor(M,E){const $=f("gateway")(M,E),R=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}});return b(M,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayInclusive(M,E){const $=f("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ve(E,s),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},activity(M,E,$){return $=$||{},"fillOpacity"in $||($.fillOpacity=oi),x(M,E.width,E.height,ni,$)},task(M,E){const $={fill:rt(E,s),stroke:Ve(E,c)},R=f("activity")(M,E,$);return v(M,E,"center-middle"),S(M,E),R},userTask(M,E){const $=f("task")(M,E),R=15,Y=12,ee=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:R,y:Y}});b(M,ee,{strokeWidth:.5,fill:rt(E,s),stroke:Ve(E,c)});const se=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:R,y:Y}});b(M,se,{strokeWidth:.5,fill:rt(E,s),stroke:Ve(E,c)});const de=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:R,y:Y}});return b(M,de,{strokeWidth:.5,fill:Ve(E,c),stroke:Ve(E,c)}),$},scriptTask(M,E){const $=f("task")(M,E),R=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(M,R,{strokeWidth:1,stroke:Ve(E,c)}),$},SubProcessMarker(M,E){const $=x(M,14,14,0,{strokeWidth:1,fill:rt(E,s),stroke:Ve(E,c)});ct($,E.width/2-7.5,E.height-20);const R=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",M,R,{fill:rt(E,s),stroke:Ve(E,c)})},subprocess(M,E,$){$=Se({fill:rt(E,s),stroke:Ve(E,c)},$);const R=f("activity")(M,E,$);return v(M,E,"center-middle"),S(M,E,["SubProcessMarker"]),R},label(M,E){return j(M,E)},myline(M,E){const $=rt(E,r.lineStroke||s),R=Ve(E,r.lineStroke||c);return g(M,E.waypoints,{markerEnd:T(M,"sequenceflow-end",$,R),stroke:R})},default(M,E){const $={strokeWidth:Io(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)},R=x(M,E.width,E.height,E.radius||ni,$);return v(M,E,"center-middle"),S(M,E),F(M,E,E.iconX,E.iconY),R}};this.handlers=z,this._drawPath=b}Ht(Qt,Zt),Qt.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Qt.prototype.canRender=function(){return!0},Qt.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},Qt.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},Qt.prototype.getShapePath=function(e){return At(e,"startEvent")||At(e,"endEvent")?_m(e):At(e,"userTask")||At(e,"scriptTask")||At(e,"subprocess")?Sm(e,ni):At(e,"gatewayAnd")||At(e,"gatewayXor")||At(e,"gatewayInclusive")?Bm(e):jm(e)};var Tm=0,Vm={width:150,height:50};function Mm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Pm(e){return k.isObject(e)?k.assign({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Nm(e,t){t.textContent=e;var o;try{var a,i=e==="";return t.textContent=i?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function $m(e,t,o){for(var a=e.shift(),i=a,r;;){if(r=Nm(i,o),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Om(e,i,a,r);i=Am(i,r.width,t)}}function Om(e,t,o,a){if(t.length<o.length){var i=o.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Js="­";function Rm(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Js)&&i.pop();break}var l=i[i.length-1];return l&&l===Js&&(i[i.length-1]="-"),i.join("")}function Am(e,t,o){var a=Math.max(e.length*(o/t),1),i=Rm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Lm(){var e=document.getElementById("helper-svg");return e||(e=P.create("svg"),P.attr(e,{id:"helper-svg"}),A.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function zo(e){this._config=k.assign({},{size:Vm,padding:Tm,style:{},align:"center-top"},e||{})}zo.prototype.createText=function(e,t){return this.layoutText(e,t).element},zo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},zo.prototype.layoutText=function(e,t){var o=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=Mm(t.align||this._config.align),r=Pm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Im(a),c=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,f=P.create("text");P.attr(f,{x:0,y:0}),P.attr(f,a);var h=Lm();for(P.append(h,f);c.length;)d.push($m(c,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var m=k.reduce(d,function(b,w,C){return b+(s||w.height)},0)+r.top+r.bottom,p=k.reduce(d,function(b,w,C){return w.width>b?w.width:b},0),g=r.top;i.vertical==="middle"&&(g+=(o.height-m)/2),g-=(s||d[0].height)/4;var y=P.create("text");P.attr(y,a),k.forEach(d,function(b){var w;switch(g+=s||b.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?p:u)-r.right-b.width;break;default:w=Math.max(((l?p:u)-b.width)/2+r.left,0)}var C=P.create("tspan");P.attr(C,{x:w,y:g}),C.textContent=b.text,P.append(y,C)}),P.remove(f);var x={width:p,height:m};return{dimensions:x,element:y}};function Im(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const zm=12,Fm=1.2,Hm=30;function Ds(e){const t=Se({fontFamily:"Arial, sans-serif",fontSize:zm,fontWeight:"normal",lineHeight:Fm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,a=Se({},t,{fontSize:o},e&&e.externalStyle||{}),i=new zo({style:t});this.getExternalLabelBounds=function(r,l){const s=i.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:a});return{x:Math.round(r.x+r.width/2-s.width/2),y:Math.round(r.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(r,l){const s=i.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(Hm,Math.round(s.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}Ds.$inject=["config.textRenderer"];function Wm(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,i;o.abspos?(a=o.abspos.x,i=o.abspos.y):(a=o.containerWidth*o.position.mx,i=o.containerHeight*o.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(o.position){const c=o.containerHeight/r.height*o.yScaleFactor,d=o.containerWidth/r.width*o.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*c;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return qm(r.d,{mx:a,my:i,e:l})}}const Um=/\{([^}]+)\}/g,Jm=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Dm(e,t,o){let a=o;return t.replace(Jm,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function qm(e,t){return String(e).replace(Um,(o,a)=>Dm(o,a,t))}const qs={__init__:["myRenderer"],myRenderer:["type",Qt],textRenderer:["type",Ds],pathMap:["type",Wm]};function Ys(e,t){return Se({id:e.id,type:e.type,businessObject:e},t)}function Ym(e,t,o){const a=e.waypoint;return!a||a.length<2?[Te(t),Te(o)]:a.map(i=>({x:i.x,y:i.y}))}function Lt(e,t,o,a,i,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=i,this._translate=ls,this._textRenderer=r,this._modeling=t}Lt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Lt.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(Ys(e,{source:a,target:i,waypoints:Ym(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Ys(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Lt.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)},Lt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Se(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:i}=t;if(i&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),o&&this.addLabel(r,o)}}},Lt.prototype._getSource=function(e){return this._getElement(e.from)},Lt.prototype._getTarget=function(e){return this._getElement(e.to)},Lt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const Gs={myImporter:["type",Lt]},Ks=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Xs=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),i.forEach(r=>{o.add(r)})},Gm=n.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const v=s.get("eventBus");v.on("element.dblclick",j=>{i("elementDblclick",j.element.businessObject)}),v.on("element.click",j=>{i("elementClick",j.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let v={__init__:["myOptions"],myOptions:["type",f]};s=new Pi({canvas:{container:r.value},modules:[Oa,$l,Us,es,os,v,qs,Gs]});const j=s.get("canvas"),S=s.get("elementFactory");d();const B=S.createRoot();j.setRootElement(B),u()};n.onMounted(()=>{h()});const m=v=>{const j=v==null?1:c+v;s.get("canvas").zoom(j),c=j},p=()=>{s.get("canvas").zoom(1);const v=s.get("elementRegistry").getAll();var j=Ks(v);return j},g=v=>{s.clear(),d(),Xs(v,s)},y=v=>{s.get("myImporter").update(v.id,v)};return t({reset:()=>{d()},zoom:v=>{m(v)},getData:()=>p(),setData:v=>{g(v)},updateElemet:v=>{y(v)}}),(v,j)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ai(e){return e&&e[e.length-1]}function Zs(e){return e.y}function Qs(e){return e.x}var Km={left:Qs,center:Qs,right:function(e){return e.x+e.width},top:Zs,middle:Zs,bottom:function(e){return e.y+e.height}};function Sn(e,t){this._modeling=e,this._rules=t}Sn.$inject=["modeling","rules"],Sn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},Sn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Sn.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,i=o.dimension,r={},l={},s=!1,c,d,u;function f(h,m){return Math.round((h[a]+m[a]+m[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ai(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var m=h[a]+Math.round(h[i]/2);l[m]?l[m].elements.push(h):l[m]={elements:[h],center:m}}),c=k.sortBy(l,function(h){return h.elements.length>1&&(s=!0),h.elements.length}),s)return r[e]=ai(c).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ai(t),r[e]=f(d,u)}return r},Sn.prototype.trigger=function(e,t){var o=this._modeling,a,i=k.filter(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=Km[t],l=k.sortBy(i,r),s=this._alignmentPosition(t,l);o.alignElements(l,s)}};const Xm={__init__:["alignElements"],alignElements:["type",Sn]};var Fo=Math.round,Zm=Math.max;function Qm(e,t){var o=e.x,a=e.y;return[["M",o,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function eg(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var ec=10;function tg(e,t){var o,a;for(o=0;a=e[o];o++)if(Hn(a,t)<=ec)return{point:e[o],bendpoint:!0,index:o};return null}function ng(e,t){var o=Wl(Qm(t,ec),eg(e)),a=o[0],i=o[o.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=Zm(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Fo(a.x+i.x)/2,y:Fo(a.y+i.y)/2},index:a.segment2}:{point:{x:Fo(a.x),y:Fo(a.y)},index:a.segment2}:null}function og(e,t){return tg(e,t)||ng(e,t)}function ag(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ig(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function tc(e,t){var o=t[0],a=t[1],i={x:a.x-o.x,y:a.y-o.y},r=ig([o.x,o.y],[i.x,i.y],[e.x,e.y]);return{x:o.x+r*i.x,y:o.y+r*i.y}}function rg(e,t){var o=tc(e,t),a={x:o.x-e.x,y:o.y-e.y};return ag(a)}var nc="djs-bendpoint",oc="djs-segment-dragger";function lg(e,t){var o=yn(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(o.x-i.x)/r.scale,y:r.y+(o.y-i.y)/r.scale}}function ii(e,t,o){var a=lg(e,o),i=og(t,a);return i}function ri(e,t){var o=P.create("g");P.classes(o).add(nc),P.append(e,o);var a=P.create("circle");P.attr(a,{cx:0,cy:0,r:4}),P.classes(a).add("djs-visual"),P.append(o,a);var i=P.create("circle");return P.attr(i,{cx:0,cy:0,r:10}),P.classes(i).add("djs-hit"),P.append(o,i),t&&P.classes(o).add(t),o}function sg(e,t,o,a){var i=P.create("g");P.append(e,i);var r=18,l=6,s=11,c=dg(t,o,a),d=l+s,u=P.create("rect");P.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),P.classes(u).add("djs-visual"),P.append(i,u);var f=P.create("rect");return P.attr(f,{x:-c/2,y:-d/2,width:c,height:d}),P.classes(f).add("djs-hit"),P.append(i,f),Gp(i,a==="v"?90:0),i}function ac(e,t,o){var a=P.create("g"),i=Va(t,o),r=St(t,o);return P.append(e,a),sg(a,t,o,r),P.classes(a).add(oc),P.classes(a).add(r==="h"?"horizontal":"vertical"),ct(a,i.x,i.y),a}function li(e){return Math.abs(Math.round(e*2/3))}function cg(e,t){var o=ug(e,t);return tc(e,o)}function dg(e,t,o){var a=t.x-e.x,i=t.y-e.y;return li(o==="h"?a:i)}function ug(e,t){for(var o=t.waypoints,a=1/0,i,r=0;r<o.length-1;r++){var l=o[r],s=o[r+1],c=rg(e,[l,s]);c<a&&(a=c,i=r)}return[o[i],o[i+1]]}function si(e){return CSS.escape(e)}function ic(e,t,o,a,i){function r(w,C,_){var v=w.index,j=w.point,S,B,V,T,L,F;return v<=0||w.bendpoint?!1:(S=C[v-1],B=C[v],V=Va(S,B),T=St(S,B),L=Math.abs(j.x-V.x),F=Math.abs(j.y-V.y),T&&L<=_&&F<=_)}function l(w,C){var _=w.waypoints,v,j,S,B;return C.index<=0||C.bendpoint||(v={start:_[C.index-1],end:_[C.index]},j=St(v.start,v.end),!j)?null:(j==="h"?S=v.end.x-v.start.x:S=v.end.y-v.start.y,B=li(S)/2,B)}function s(w,C){var _=C.waypoints,v=ii(t,_,w),j;if(v)return j=l(C,v),r(v,_,j)?i.start(w,C,v.index):a.start(w,C,v.index,!v.bendpoint),!0}function c(w,C,_){A.event.bind(w,C,function(v){o.triggerMouseEvent(C,v,_),v.stopPropagation()})}function d(w,C){var _=t.getLayer("overlays"),v=A.query('.djs-bendpoints[data-element-id="'+si(w.id)+'"]',_);return!v&&C&&(v=P.create("g"),P.attr(v,{"data-element-id":w.id}),P.classes(v).add("djs-bendpoints"),P.append(_,v),c(v,"mousedown",w),c(v,"click",w),c(v,"dblclick",w)),v}function u(w,C){return A.query('.djs-segment-dragger[data-segment-idx="'+w+'"]',C)}function f(w,C){C.waypoints.forEach(function(_,v){var j=ri(w);P.append(w,j),ct(j,_.x,_.y)}),ri(w,"floating")}function h(w,C){for(var _=C.waypoints,v,j,S,B=1;B<_.length;B++)v=_[B-1],j=_[B],St(v,j)&&(S=ac(w,v,j),P.attr(S,{"data-segment-idx":B}),c(S,"mousemove",C))}function m(w){k.forEach(A.queryAll("."+nc,w),function(C){P.remove(C)})}function p(w){k.forEach(A.queryAll("."+oc,w),function(C){P.remove(C)})}function g(w){var C=d(w);return C||(C=d(w,!0),f(C,w),h(C,w)),C}function y(w){var C=d(w);C&&(p(C),m(C),h(C,w),f(C,w))}function x(w,C){var _=A.query(".floating",w),v=C.point;_&&ct(_,v.x,v.y)}function b(w,C,_){var v=u(C.index,w),j=_[C.index-1],S=_[C.index],B=C.point,V=Va(j,S),T=St(j,S),L,F;v&&(L=fg(v),F={x:B.x-V.x,y:B.y-V.y},T==="v"&&(F={x:F.y,y:F.x}),ct(L,F.x,F.y))}e.on("connection.changed",function(w){y(w.element)}),e.on("connection.remove",function(w){var C=d(w.element);C&&P.remove(C)}),e.on("element.marker.update",function(w){var C=w.element,_;C.waypoints&&(_=g(C),w.add?P.classes(_).add(w.marker):P.classes(_).remove(w.marker))}),e.on("element.mousemove",function(w){var C=w.element,_=C.waypoints,v,j;if(_){if(v=d(C,!0),j=ii(t,_,w.originalEvent),!j)return;x(v,j),j.bendpoint||b(v,j,_)}}),e.on("element.mousedown",function(w){if(Et(w)){var C=w.originalEvent,_=w.element;if(_.waypoints)return s(C,_)}}),e.on("selection.changed",function(w){var C=w.newSelection,_=C[0];_&&_.waypoints&&g(_)}),e.on("element.hover",function(w){var C=w.element;C.waypoints&&(g(C),o.registerEvent(w.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(w){o.unregisterEvent(w.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(w){var C=w.element,_=w.newId;if(C.waypoints){var v=d(C);v&&P.attr(v,{"data-element-id":_})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}ic.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function fg(e){return A.query(".djs-visual",e)}var rc=Math.round,en="reconnectStart",tn="reconnectEnd",eo="updateWaypoints";function ci(e,t,o,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=o.getGraphics(s),f=s.source,h=s.target,m=s.waypoints,p;!d&&c===0?p=en:!d&&c===m.length-1?p=tn:p=eo;var g=p===eo?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(g,{connection:s,source:f,target:h});y===!1&&(y=i.allowed(g,{connection:s,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,c=s.connection,d=c.source,u=c.target,f=l.hover,h=s.type;s.hover=f;var m;if(f){var p=h===eo?"connection.updateWaypoints":"connection.reconnect";if(m=s.allowed=i.allowed(p,{connection:c,source:h===en?f:d,target:h===tn?f:u}),m){s.source=h===en?f:d,s.target=h===tn?f:u;return}m===!1&&(m=s.allowed=i.allowed(p,{connection:c,source:h===tn?f:u,target:h===en?f:d})),m&&(s.source=h===tn?f:u,s.target=h===en?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==eo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,f=s.insert,h=u.waypoints.slice(),m=s.source,p=s.target,g=s.type,y=s.hints||{},x={x:rc(l.x),y:rc(l.y)};if(!c)return!1;g===eo?(f?h.splice(d,0,x):h[d]=x,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,bh(h),y)):(g===en?(y.docking="source",Ho(s)&&(y.docking="target",y.newWaypoints=h.reverse())):g===tn&&(y.docking="target",Ho(s)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,m,p,x,y))},this)}ci.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ci.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Ho(e){var t=e.hover,o=e.source,a=e.target,i=e.type;if(i===en)return t&&a&&t===a&&o!==a;if(i===tn)return t&&o&&t===o&&o!==a}var pg="reconnectStart",hg="reconnectEnd",lc="updateWaypoints",to="connect-ok",Wo="connect-not-ok",sc="connect-hover",cc="djs-updating",dc="djs-dragging",uc=1100;function fc(e,t,o,a){this._injector=t;var i=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(s,0,{x:r.x,y:r.y}),c.waypoints=f;var h=l.draggerGfx=ri(a.getLayer("overlays"));P.classes(h).add("djs-dragging"),a.addMarker(c,dc),a.addMarker(c,cc)}),o.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,sc),d===lc)return;s?(a.removeMarker(c,Wo),a.addMarker(c,to)):s===!1&&(a.removeMarker(c,to),a.addMarker(c,Wo))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],uc,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,sc),a.removeMarker(s,c?to:Wo))}),o.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,m=h.source,p=h.target,g=h.waypoints.slice(),y={x:r.x,y:r.y},x=l.hints||{},b={};i&&(x.connectionStart&&(b.connectionStart=x.connectionStart),x.connectionEnd&&(b.connectionEnd=x.connectionEnd),f===pg?Ho(l)?(b.connectionEnd=b.connectionEnd||y,b.source=p,b.target=u||m,g=g.reverse()):(b.connectionStart=b.connectionStart||y,b.source=u||m,b.target=p):f===hg?Ho(l)?(b.connectionStart=b.connectionStart||y,b.source=u||p,b.target=m,g=g.reverse()):(b.connectionEnd=b.connectionEnd||y,b.source=m,b.target=u||p):(b.noCropping=!0,b.noLayout=!0,g[c]=y),f===lc&&(g=e.cropWaypoints(h,g)),b.waypoints=g,i.drawPreview(l,s,b)),ct(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],uc,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;s.waypoints=f,P.remove(c),a.removeMarker(s,cc),a.removeMarker(s,dc),d&&(a.removeMarker(d,to),a.removeMarker(d,u?to:Wo)),i&&i.cleanUp(l)})}fc.$inject=["bendpointMove","injector","eventBus","canvas"];var pc="connect-hover",hc="djs-updating";function mc(e,t,o){return di(e,t,e[t]+o)}function di(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function mg(e,t,o,a){var i=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),l=20,s=Math.min(Math.max(r+l,e[a]),i-l);return di(t,a,s)}function gc(e){return e==="x"?"y":"x"}function yc(e,t,o){var a,i;return e.original?e.original:(a=Te(t),i=gc(o),di(e,i,a[i]))}function vc(e,t,o,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,m){var p,g=o.getGraphics(h),y=m-1,x=m,b=h.waypoints,w=b[y],C=b[x],_=ii(o,b,f),v,j,S;v=St(w,C),v&&(j=v==="v"?"x":"y",y===0&&(w=yc(w,h.source,j)),x===b.length-1&&(C=yc(C,h.target,j)),_?S=_.point:S={x:(w.x+C.x)/2,y:(w.y+C.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:x,segmentStart:w,segmentEnd:C,axis:j,dragPosition:S},a.init(f,S,"connectionSegment.move",{cursor:j==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:g,context:p}}))};function s(f,h){if(!l)return h;var m=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=m,p}function c(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,m){var p=f.newWaypoints,g=f.segmentStartIndex+h,y=p[g],x=f.segmentEndIndex+h,b=p[x],w=gc(f.axis),C=mg(m,y,b,w);ct(f.draggerGfx,C.x,C.y)}function u(f,h){var m=0,p=f.filter(function(g,y){return Ta(f[y-1],f[y+1],g)?(m=y<=h?m-1:m,!1):!0});return{waypoints:p,segmentOffset:m}}t.on("connectionSegment.move.start",function(f){var h=f.context,m=f.connection,p=o.getLayer("overlays");h.originalWaypoints=m.waypoints.slice(),h.draggerGfx=ac(p,h.segmentStart,h.segmentEnd),P.classes(h.draggerGfx).add("djs-dragging"),o.addMarker(m,hc)}),t.on("connectionSegment.move.move",function(f){var h=f.context,m=h.connection,p=h.segmentStartIndex,g=h.segmentEndIndex,y=h.segmentStart,x=h.segmentEnd,b=h.axis,w=h.originalWaypoints.slice(),C=mc(y,b,f["d"+b]),_=mc(x,b,f["d"+b]),v=w.length,j=0;w[p]=C,w[g]=_;var S,B;p<2&&(S=Vt(m.source,C),p===1?S==="intersect"&&(w.shift(),w[0]=C,j--):S!=="intersect"&&(w.unshift(y),j++)),g>v-3&&(B=Vt(m.target,_),g===v-2?B==="intersect"&&(w.pop(),w[w.length-1]=_):B!=="intersect"&&w.push(x)),h.newWaypoints=m.waypoints=s(m,w),d(h,j,f),h.newSegmentStartIndex=p+j,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,o.addMarker(f.hover,pc)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&o.removeMarker(h,pc)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,m=h.connection;h.draggerGfx&&P.remove(h.draggerGfx),o.removeMarker(m,hc)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,m=h.connection;m.waypoints=h.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,m=h.connection,p=h.newWaypoints,g=h.newSegmentStartIndex;p=p.map(function(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.y)}});var y=u(p,g),x=y.waypoints,b=s(m,x),w=y.segmentOffset,C={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:g+w}};r.updateWaypoints(m,b,C)})}vc.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var gg=Math.abs,bc=Math.round;function yg(e,t,o){o=o===void 0?10:o;var a,i;for(a=0;a<t.length;a++)if(i=t[a],gg(i-e)<=o)return i}function vg(e){return{x:e.x,y:e.y}}function bg(e){return{x:e.x+e.width,y:e.y+e.height}}function Bn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:bc(e.x+e.width/2),y:bc(e.y+e.height/2)}}function Uo(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function bt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-i,e[t]+=a,e["d"+t]+=a),i}function xc(e){return e.children||[]}var xg=Math.abs,wc=Math.round,ui=10;function Cc(e){function t(r,l){if(k.isArray(r)){for(var s=r.length;s--;)if(xg(r[s]-l)<=ui)return r[s]}else{r=+r;var c=l%r;if(c<ui)return l-c;if(c>r-ui)return l-c+r}return l}function o(r,l){if(r.waypoints)return cg(l,r);if(r.width)return{x:wc(r.width/2+r.x),y:wc(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,m=l.segmentEndIndex,p=l.axis;if(s)return s;var g=[d[f-1],u,h,d[m+1]];return f<2&&g.unshift(o(c.source,r)),m>d.length-3&&g.unshift(o(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},k.forEach(g,function(y){y&&(y=y.original||y,p==="y"&&s.horizontal.push(y.y),p==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var f=s-d,h=c-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(s)!==-1)&&bt(r,"x",d),(h||l.horizontal.indexOf(c)!==-1)&&bt(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},k.forEach(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context,s=l.hover,c=s&&o(s,r);!Ze(s)||!c||!c.x||!c.y||(bt(r,"x",c.x),bt(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&o(c,r),u=r.x,f=r.y,h,m;if(s){h=t(d?s.vertical.concat([d.x]):s.vertical,u),m=t(d?s.horizontal.concat([d.y]):s.horizontal,f);var p=u-h,g=f-m;k.assign(r,{dx:r.dx-p,dy:r.dy-g,x:r.x-p,y:r.y-g}),(p||s.vertical.indexOf(u)!==-1)&&bt(r,"x",h),(g||s.horizontal.indexOf(f)!==-1)&&bt(r,"y",m)}})}Cc.$inject=["eventBus"];const wg={__depends__:[qt,Cn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ic],bendpointMove:["type",ci],bendpointMovePreview:["type",fc],connectionSegmentMove:["type",vc],bendpointSnapping:["type",Cc]};var Cg="djs-dragger";function xt(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}xt.$inject=["injector","canvas","graphicsFactory","elementFactory"],xt.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=o.source,l=o.target,s=o.waypoints,c=o.connectionStart,d=o.connectionEnd,u=o.noLayout,f=o.noCropping,h=o.noNoop,m,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),P.clear(a),i||(i=e.getConnection=kg(function(g,y,x){return p.getConnection(g,y,x)})),t&&(m=i(t,r,l)),!m){!h&&this.drawNoopPreview(a,o);return}m.waypoints=s||[],this._layouter&&!u&&(m.waypoints=this._layouter.layoutConnection(m,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:o.waypoints||m.waypoints})),(!m.waypoints||!m.waypoints.length)&&(m.waypoints=[r?Te(r):c,l?Te(l):d]),this._connectionDocking&&(r||l)&&!f&&(m.waypoints=this._connectionDocking.getCroppedWaypoints(m,r,l)),this._graphicsFactory.drawConnection(a,m,{stroke:"var(--element-dragger-color)"})},xt.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,i=t.connectionStart||Te(o),r=t.connectionEnd||Te(a),l=this.cropWaypoints(i,r,o,a),s=this.createNoopConnection(l[0],l[1]);P.append(e,s)},xt.prototype.cropWaypoints=function(e,t,o,a){var i=this._graphicsFactory,r=o&&i.getShapePath(o),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=o&&Na(r,s,!0)||e,t=a&&Na(l,s,!1)||t,[e,t]},xt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&P.remove(e.connectionPreviewGfx)},xt.prototype.getConnection=function(e){var t=Eg(e);return this._elementFactory.createConnection(t)},xt.prototype.createConnectionPreviewGfx=function(){var e=P.create("g");return P.attr(e,{pointerEvents:"none"}),P.classes(e).add(Cg),P.append(this._canvas.getActiveLayer(),e),e},xt.prototype.createNoopConnection=function(e,t){return Ca([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kg(e){var t={};return function(o){var a=JSON.stringify(o),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function Eg(e){return k.isObject(e)?e:{}}const _g={__init__:["connectionPreview"],connectionPreview:["type",xt]};var Sg=new xo("ov"),Bg=500;function Ie(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Sg,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=jg(o.getContainer()),this._init()}Ie.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ie.prototype.get=function(e){if(k.isString(e)&&(e={id:e}),k.isString(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k.filter(t.overlays,k.matchPattern({type:e.type})):t.overlays.slice():[]}else return e.type?k.filter(this._overlays,k.matchPattern({type:e.type})):e.id?this._overlays[e.id]:null},Ie.prototype.add=function(e,t,o){if(k.isObject(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=k.assign({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},Ie.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var o=this;k.forEach(t,function(a){var i=o._getOverlayContainer(a.element,!0);if(a&&(A.remove(a.html),A.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},Ie.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ie.prototype.show=function(){Jo(this._overlayRoot)},Ie.prototype.hide=function(){Jo(this._overlayRoot,!1)},Ie.prototype.clear=function(){this._overlays={},this._overlayContainers=[],A.clear(this._overlayRoot)},Ie.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,i=t.y;if(t.waypoints){var r=st(t);a=r.x,i=r.y}kc(o,a,i),A.attr(e.html,"data-container-id",t.id)},Ie.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=st(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=st(a).height:s=a.height,r=t.bottom*-1+s}kc(o,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ie.prototype._createOverlayContainer=function(e){var t=A.domify('<div class="djs-overlays" />');A.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},Ie.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Ec(this._overlayRoot,o)},Ie.prototype._getOverlayContainer=function(e,t){var o=k.find(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},Ie.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=A.domify(a)),r=this._getOverlayContainer(o),i=A.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),A.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&A.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),s=this._canvas.getRootElement();Jo(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ie.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),i=o&&o.minZoom,r=o&&o.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||o&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(c=!1),Jo(l,c),this._updateOverlayScale(e,t)},Ie.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,i,r=e.htmlContainer,l,s="";o!==!0&&(o===!1?(a=1,i=1):(a=o.min,i=o.max),k.isDefined(a)&&t.scale<a&&(l=(1/t.scale||1)*a),k.isDefined(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),k.isDefined(l)&&(s="scale("+l+","+l+")"),Ec(r,s)},Ie.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},Ie.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(c){t.remove(c.id)});var l=t._getOverlayContainer(i);if(l){A.remove(l.html);var s=t._overlayContainers.indexOf(l);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Bg,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&(k.forEach(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&A.classes(i.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function jg(e){var t=A.domify('<div class="djs-overlay-container" />');return A.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function kc(e,t,o){A.assignStyle(e,{left:t+"px",top:o+"px"})}function Jo(e,t){e.style.display=t===!1?"none":""}function Ec(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}const Tg={__init__:["overlays"],overlays:["type",Ie]},Vg=new xo;function jn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}jn.$inject=["eventBus"],jn.prototype.schedule=function(e,t=Vg.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},jn.prototype._schedule=function(e,t){const o=Mg();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(i){o.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:o.promise}},jn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},jn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Mg(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}const Pg={scheduler:["type",jn]};var Ng="djs-element-hidden",Do=".entry",$g=1e3,_c=8,Og=300;function Ne(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}Ne.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ne.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(c){return o.includes(c)});if(l.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},Ne.prototype._createContainer=function(){var e=A.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ne.prototype.registerProvider=function(e,t){t||(t=e,e=$g),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},Ne.prototype.getEntries=function(e){var t=this._getProviders(),o=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[o])){var r=i[o](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,s){a[s]=l})}}),a},Ne.prototype.trigger=function(e,t,o){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=A.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,o)},Og);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,o)},Ne.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var s=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if(k.isFunction(s)){if(t==="click")return s(o,i,a)}else if(s[t])return s[t](o,i,a);o.preventDefault()}}}},Ne.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ne.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ne.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",s=A.domify(i.html||'<div class="entry" draggable="true"></div>'),c;A.attr(s,"data-action",r),c=A.query("[data-group="+si(l)+"]",o),c||(c=A.domify('<div class="group"></div>'),A.attr(c,"data-group",l),o.appendChild(c)),c.appendChild(s),i.className&&Rg(s,i.className),i.title&&A.attr(s,"title",i.title),i.imageUrl&&(a=A.domify("<img>"),A.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),A.classes(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ne.prototype._createHtml=function(e){var t=this,o=A.domify('<div class="djs-context-pad"></div>');return A.delegate.bind(o,Do,"click",function(a){t.trigger("click",a)}),A.delegate.bind(o,Do,"dragstart",function(a){t.trigger("dragstart",a)}),A.delegate.bind(o,Do,"mouseover",function(a){t.trigger("mouseover",a)}),A.delegate.bind(o,Do,"mouseout",function(a){t.trigger("mouseout",a)}),A.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},Ne.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Lg(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ne.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ne.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return k.isArray(e)!==k.isArray(o)?!1:k.isArray(e)?e.length===o.length&&k.every(e,function(a){return o.includes(a)}):o===e},Ne.prototype.isShown=function(){return this.isOpen()&&A.classes(this._current.html).has("open")},Ne.prototype.show=function(){this.isOpen()&&(A.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ne.prototype.hide=function(){this.isOpen()&&(A.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ne.prototype._getPosition=function(e){if(!k.isArray(e)&&Ze(e)){var t=this._canvas.viewbox(),o=Ag(e),a=o.x*t.scale-t.x*t.scale,i=o.y*t.scale-t.y*t.scale;return{left:a+_c*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-l.left+_c*this._canvas.zoom(),top:s.top-l.top}},Ne.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ne.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target,a=k.isArray(o)?o:[o],i=a.some(function(r){return t._canvas.hasMarker(r,Ng)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ne.prototype._getTargetBounds=function(e){var t=this,o=k.isArray(e)?e:[e],a=o.map(function(i){return t._canvas.getGraphics(i)});return a.reduce(function(i,r){const l=r.getBoundingClientRect();return i.top=Math.min(i.top,l.top),i.right=Math.max(i.right,l.right),i.bottom=Math.max(i.bottom,l.bottom),i.left=Math.min(i.left,l.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Rg(e,t){var o=A.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function Ag(e){return e.waypoints[e.waypoints.length-1]}function Lg(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(o){return t.includes(o)})}const Ig={__depends__:[ka,Pg,Tg],contextPad:["type",Ne]};var zg=250;function nn(e){this._eventBus=e,this._tools=[],this._active=null}nn.$inject=["eventBus"],nn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},nn.prototype.isActive=function(e){return e&&this._active===e},nn.prototype.length=function(e){return this._tools.length},nn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},nn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(i){var r=i.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k.forEach(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),o.on(a,zg,function(i){this._active&&(Fg(i)||this.setActive(null))},this)};function Fg(e){var t=e.originalEvent&&e.originalEvent.target;return t&&A.closest(t,'.group[data-group="tools"]')}const fi={__depends__:[qt],__init__:["toolManager"],toolManager:["type",nn]};function pi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}pi.$inject=["eventBus"],pi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Hg(0,0)};function Hg(e,t){var o=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),o}const hi={__init__:["mouse"],mouse:["type",pi]};var mi=1500,Sc="grab";function Tn(e,t,o,a,i,r){this._dragging=o,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",mi,function(c){if(cl(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(mi,function(c){if(!(!Bc(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(mi,function(c){!Bc(c.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context,u=d.reactivate;return!cl(c)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Tn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Tn.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Sc,data:{context:o||{}}})},Tn.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Sc,data:{context:{reactivate:o}}})},Tn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Tn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Bc(e){return wl("Space",e)}const Wg={__depends__:[fi,hi],__init__:["handTool"],handTool:["type",Tn]};var jc="crosshair";function on(e,t,o,a,i,r,l){this._selection=i,this._dragging=o,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=P.create("rect"),P.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),P.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;P.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&P.remove(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=gi(d),h=a.filter(function(p){return p}),m=ba(d);s.select(h,f,m?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=gi(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=gi(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(ba(d))return s.activateLasso(d.originalEvent),!0})}on.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],on.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:jc,data:{context:{}}})},on.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:jc,data:{context:{}},keepSelection:!0})},on.prototype.select=function(e,t,o=[]){var a=Wp(e,t);this._selection.select([...o,...k.values(a)])},on.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},on.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function gi(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}const Ug={__depends__:[fi,hi],__init__:["lassoTool"],lassoTool:["type",on]};var Tc="connect-ok",Vc="connect-not-ok";function Vn(e,t,o,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,f=d.canStartConnect=s.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?Tc:Vc))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Tc:Vc)}),e.on(["global-connect.ended"],function(c){var d=c.context,u=d.startTarget,f={x:c.x,y:c.y},h=s.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,u,f)}),!1})}Vn.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Vn.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Vn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Vn.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Jg={__depends__:[Oa,Cn,qt,fi,hi],globalConnect:["type",Vn]};var Dg=500,qg=1e3;function an(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=P.create("rect");return P.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],Dg,function(r){var l=r.element,s=r.gfx,c=A.query(".djs-outline",s);c||(c=a.getOutline(l)||i(),P.append(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=A.query(".djs-outline",s);c||(c=i(),P.append(s,c)),a.updateConnectionOutline(c,l)})}an.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){o=o||i.updateOutline(t,e)}),o||P.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},an.prototype.updateConnectionOutline=function(e,t){var o=st(t);P.attr(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},an.prototype.registerProvider=function(e,t){t||(t=e,e=qg),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},an.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},an.prototype.getOutline=function(e){var t,o=this._getProviders();return k.forEach(o,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},an.$inject=["eventBus","styles","elementRegistry"];var qo=6;function yi(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(i){o.isSelected(i.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}yi.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");P.clear(t);var o=e.length>1,a=this._canvas.getContainer();if(P.classes(a)[o?"add":"remove"]("djs-multi-select"),!!o){var i=Yg(st(e)),r=P.create("rect");P.attr(r,k.assign({rx:3},i)),P.classes(r).add("djs-selection-outline"),P.append(t,r)}},yi.$inject=["eventBus","canvas","selection"];function Yg(e){return{x:e.x-qo,y:e.y-qo,width:e.width+qo*2,height:e.height+qo*2}}const Mc={__depends__:[bn],__init__:["outline","multiSelectionOutline"],outline:["type",an],multiSelectionOutline:["type",yi]};var Gg=500,Kg=1250,Xg=1500,Yo=Math.round;function Zg(e){return{x:e.x+Yo(e.width/2),y:e.y+Yo(e.height/2)}}function Pc(e,t,o,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",Xg,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Qg(u),k.assign(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Kg,function(s){var c=s.context,d=c.validatedShapes,u;if(u=c.canExecute=r(d),!u)return!1}),e.on("shape.move.move",Gg,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},h={x:s.x,y:s.y},m;if(m=r(d,f,h,u),c.delta=f,c.canExecute=m,m===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,f=u==="attach",h=c.shapes;if(u===!1)return!1;d.x=Yo(d.x),d.y=Yo(d.y),!(d.x===0&&d.y===0)&&o.moveElements(h,d,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(Et(s)){var c=gn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if(k.isObject(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!P.classes(s.target).has("djs-hit-no-move")){var f=Zg(c);return t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}Pc.$inject=["eventBus","dragging","modeling","selection","rules"];function Qg(e){var t=k.groupBy(e,"id");return k.filter(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Nc=499,vi="djs-dragging",$c="drop-ok",Oc="drop-not-ok",Rc="new-parent",Ac="attach-ok";function Lc(e,t,o,a){function i(c){var d=r(c),u=ey(d);return u}function r(c){var d=Fp(c),u=d.flatMap(m=>(m.incoming||[]).concat(m.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(c,d){[Ac,$c,Oc,Rc].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,vi),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Nc,function(c){var d=c.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var m=P.create("g");P.attr(m,o.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();P.append(p,m),d.dragGroup=m}h.forEach(function(g){a.addDragger(g,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(g){t.addMarker(g,vi)}),d.allDraggedElements=f,d.differentParents=ty(u)}),e.on("shape.move.move",Nc,function(c){var d=c.context,u=d.dragGroup,f=d.target,h=d.shape.parent,m=d.canExecute;f&&(m==="attach"?l(f,Ac):d.canExecute&&h&&f.id!==h.id?l(f,Rc):l(f,d.canExecute?$c:Oc)),ct(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,vi)}),f&&P.remove(f)}),this.makeDraggable=s}Lc.$inject=["eventBus","canvas","styles","previewSupport"];function ey(e){var t=k.filter(e,function(o){return Ze(o)?k.find(e,k.matchPattern({id:o.source.id}))&&k.find(e,k.matchPattern({id:o.target.id})):!0});return t}function ty(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const ny={__depends__:[ka,bn,Mc,Cn,qt,Sa],__init__:["move","movePreview"],move:["type",Pc],movePreview:["type",Lc]};var Ic=".djs-palette-toggle",zc=".entry",oy=Ic+", "+zc,bi="djs-palette-",ay="shown",xi="open",Fc="two-column",iy=1e3;function $e(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var i=a.tool;o.updateToolHighlight(i)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}$e.$inject=["eventBus","canvas"],$e.prototype.registerProvider=function(e,t){t||(t=e,e=iy),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},$e.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(ly,{})},$e.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},$e.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=A.domify($e.HTML_MARKUP);o.appendChild(a),A.classes(o).add(bi+ay),A.delegate.bind(a,oy,"click",function(i){var r=i.delegateTarget;if(A.matches(r,Ic))return e.toggle();e.trigger("click",i)}),A.event.bind(a,"mousedown",function(i){i.stopPropagation()}),A.delegate.bind(a,zc,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},$e.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},$e.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,i,r=A.classes(o),l=A.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Fc,i),l.toggle(bi+Fc,i),"open"in e&&(r.toggle(xi,e.open),l.toggle(bi+xi,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},$e.prototype._update=function(){var e=A.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();A.clear(e),k.forEach(t,function(o,a){var i=o.group||"default",r=A.query("[data-group="+si(i)+"]",e);r||(r=A.domify('<div class="group"></div>'),A.attr(r,"data-group",i),e.appendChild(r));var l=o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=A.domify(l);if(r.appendChild(s),!o.separator&&(A.attr(s,"data-action",a),o.title&&A.attr(s,"title",o.title),o.className&&ry(s,o.className),o.imageUrl)){var c=A.domify("<img>");A.attr(c,"src",o.imageUrl),s.appendChild(c)}}),this.open()},$e.prototype.trigger=function(e,t,o){var a,i,r=t.delegateTarget||t.target;return r?(a=A.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,o)):t.preventDefault()},$e.prototype.triggerEntry=function(e,t,o,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if(k.isFunction(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},$e.prototype._layoutChanged=function(){this._toggleState({})},$e.prototype._needsCollapse=function(e,t){var o=50,a=Object.keys(t).length*46;return e<a+o},$e.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},$e.prototype.open=function(){this._toggleState({open:!0})},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isActiveTool=function(e){return e&&this._activeTool===e},$e.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=A.query(".djs-palette-entries",this._container),this._toolsContainer=A.query("[data-group=tools]",t)),o=this._toolsContainer,k.forEach(o.children,function(a){var i=a.getAttribute("data-action");if(i){var r=A.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},$e.prototype.isOpen=function(){return A.classes(this._container).has(xi)},$e.prototype._getParentContainer=function(){return this._canvas.getContainer()},$e.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function ry(e,t){var o=A.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){o.add(i)})}function ly(e,t){var o=t.getPaletteEntries();return k.isFunction(o)?o(e):(k.forEach(o,function(a,i){e[i]=a}),e)}const sy={__init__:["palette"],palette:["type",$e]};function Hc(e,t,o,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=o.getGraphics(r)),i.gfx&&e.fire(Up(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}Hc.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const cy={__init__:["changeSupport"],changeSupport:["type",Hc]};var Go=Math.max,Ko=Math.min,dy=20;function uy(e,t,o){var a=o.x,i=o.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Xo(e,t,o){var a=t[e],i=o.min&&o.min[e],r=o.max&&o.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?Ko:Go)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?Go:Ko)(a,r)),a}function fy(e,t){if(!t)return e;var o=be(e);return Yl({top:Xo("top",o,t),right:Xo("right",o,t),bottom:Xo("bottom",o,t),left:Xo("left",o,t)})}function py(e,t,o,a){var i=be(t),r={top:/n/.test(e)?i.bottom-o.height:i.top,left:/w/.test(e)?i.right-o.width:i.left,bottom:/s/.test(e)?i.top+o.height:i.bottom,right:/e/.test(e)?i.left+o.width:i.right},l=a?be(a):r,s={top:Ko(r.top,l.top),left:Ko(r.left,l.left),bottom:Go(r.bottom,l.bottom),right:Go(r.right,l.right)};return Yl(s)}function no(e,t){return typeof e<"u"?e:dy}function hy(e,t){var o,a,i,r;return typeof t=="object"?(o=no(t.left),a=no(t.right),i=no(t.top),r=no(t.bottom)):o=a=i=r=no(t),{x:e.x-o,y:e.y-i,width:e.width+o+a,height:e.height+i+r}}function my(e){return!(e.waypoints||e.type==="label")}function gy(e,t){var o;if(e.length===void 0?o=k.filter(e.children,my):o=e,o.length)return hy(st(o),t)}var Wc=10;function oo(e,t,o,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,f=c.direction,h=c.resizeConstraints,m;c.delta=d,m=uy(u,f,d),c.newBounds=fy(m,h),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:be(u)})}function s(c){var d=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=mh(f),!yy(d,f))return;o.resizeShape(d,f)}}e.on("resize.start",function(c){l(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}oo.prototype.canResize=function(e){var t=this._rules,o=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},oo.prototype.activate=function(e,t,o){var a=this._dragging,i,r;if(typeof o=="string"&&(o={direction:o}),i=k.assign({shape:t},o),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Uc(t,r),"resize",{autoActivate:!0,cursor:vy(r),data:{shape:t,context:i}})},oo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction,a,i;return a=e.minDimensions||{width:Wc,height:Wc},i=gy(t,e.childrenBoxPadding),py(o,t,a,i)},oo.$inject=["eventBus","rules","modeling","dragging"];function yy(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Uc(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function vy(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var Jc="djs-resizing",Dc="resize-not-ok",by=500;function qc(e,t,o){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,Jc)),s.width>5&&P.attr(c,{x:s.x,width:s.width}),s.height>5&&P.attr(c,{y:s.y,height:s.height}),r.canExecute?P.classes(c).remove(Dc):P.classes(c).add(Dc)}function i(r){var l=r.shape,s=r.frame;s&&P.remove(r.frame),t.removeMarker(l,Jc)}e.on("resize.move",by,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}qc.$inject=["eventBus","canvas","previewSupport"];var Zo=-6,Qo=8,ea=20,ao="djs-resizer",xy=["n","w","s","e","nw","ne","se","sw"];function It(e,t,o,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&k.forEach(l,k.bind(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;o.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}It.prototype.makeDraggable=function(e,t,o){var a=this._resize;function i(r){Et(r)&&a.activate(r,e,o)}A.event.bind(t,"mousedown",i),A.event.bind(t,"touchstart",i)},It.prototype._createResizer=function(e,t,o,a){var i=this._getResizersParent(),r=wy(a),l=P.create("g");P.classes(l).add(ao),P.classes(l).add(ao+"-"+e.id),P.classes(l).add(ao+"-"+a),P.append(i,l);var s=P.create("rect");P.attr(s,{x:-Qo/2+r.x,y:-Qo/2+r.y,width:Qo,height:Qo}),P.classes(s).add(ao+"-visual"),P.append(l,s);var c=P.create("rect");return P.attr(c,{x:-ea/2+r.x,y:-ea/2+r.y,width:ea,height:ea}),P.classes(c).add(ao+"-hit"),P.append(l,c),Yp(l,t,o),l},It.prototype.createResizer=function(e,t){var o=Uc(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},It.prototype.addResizer=function(e){var t=this;Ze(e)||!this._resize.canResize({shape:e})||k.forEach(xy,function(o){t.createResizer(e,o)})},It.prototype.removeResizers=function(){var e=this._getResizersParent();P.clear(e)},It.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},It.$inject=["eventBus","canvas","selection","resize"];function wy(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Zo:e.indexOf("w")!==-1&&(t.x=Zo),e.indexOf("s")!==-1?t.y=-Zo:e.indexOf("n")!==-1&&(t.y=Zo),t}const Cy={__depends__:[Cn,qt,Sa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",oo],resizePreview:["type",qc],resizeHandles:["type",It]};function io(e,t,o,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:f}=s.context;d||f&&(c.hints&&c.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Ka(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}io.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],io.prototype.activate=function(e){const t=Oo(e);if(t===void 0)return;const o={text:t},a=this.getEditingBBox(e);Se(o,a);const i={};return(Ka(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Se(i,{centerVertically:!0}),Xa(e)&&Se(i,{autoResize:!0}),Se(o,{options:i}),o},io.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,f=s.fontSize*l,h=s.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ka(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Se(r,{width:a.width,height:a.height}),Se(m,{fontSize:f+"px",lineHeight:h,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const p=90*l,g=7*l,y=4*l;if(o.labelTarget&&(Se(r,{width:p,height:a.height+g+y,x:i.x-p/2,y:a.y-g}),Se(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})),Xa(o)&&!Ms(o)&&!Zn(o)){const x=Ps(e),b=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),w=d+g+y;Se(r,{width:p,height:w,x:b.x-p/2,y:b.y-w/2}),Se(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})}return{bounds:r,style:m}},io.prototype.update=function(e,t){let o;ky(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function ky(e){return!e||!e.trim()}const Ey={__depends__:[cy,Cy,_d],__init__:["labelEditingProvider"],labelEditingProvider:["type",io]};function zt(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}zt.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zt.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},zt.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},zt.prototype.getSnapLocations=function(){return this._snapLocations},zt.prototype.setSnapLocations=function(e){this._snapLocations=e},zt.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new ta,o.initDefaults(this._defaultSnaps)),o};function ta(){this._snapValues={}}ta.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},ta.prototype.snap=function(e,t,o,a){var i=this._snapValues[t];return i&&yg(e[o],i[o],a)},ta.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(o,a){k.forEach(o,function(i){t.add(a,i)})})};var _y=1250;function pt(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],_y,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&xl(i.originalEvent))&&!(Uo(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),o.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}pt.$inject=["elementRegistry","eventBus","snapping"],pt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,i=o.snapContext;i||(i=o.snapContext=new zt);var r;t.get(a.id)?r=Bn(a,e):r={x:e.x+Bn(a).x,y:e.y+Bn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),kn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},pt.prototype.addSnapTargetPoints=function(e,t,o){var a=this.getSnapTargets(t,o);return k.forEach(a,function(i){if(kn(i)){kn(t)&&e.add("mid",Bn(i));return}if(Ze(i)){if(i.waypoints.length<3)return;var r=i.waypoints.slice(1,-1);k.forEach(r,function(l){e.add("mid",l)});return}e.add("mid",Bn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Bn(t)),e},pt.prototype.getSnapTargets=function(e,t){return xc(t).filter(function(o){return!Sy(o)})};function Sy(e){return!!e.hidden}function Mn(e){e.invoke(pt,this)}Ht(Mn,pt),Mn.$inject=["injector"],Mn.prototype.initSnap=function(e){return pt.prototype.initSnap.call(this,e)},Mn.prototype.addSnapTargetPoints=function(e,t,o){return pt.prototype.addSnapTargetPoints.call(this,e,t,o)},Mn.prototype.getSnapTargets=function(e,t){return pt.prototype.getSnapTargets.call(this,e,t)};var By=1250;function ro(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],By,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&xl(a.originalEvent))&&!Uo(a)){var d=c.pointsForTarget(l);d.initialized||(d=o.addSnapTargetPoints(d,r,l,s),d.initialized=!0),Vy(s)&&bt(a,"x",a.x),My(s)&&bt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}ro.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new zt);var r=Yc(o,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},ro.prototype.addSnapTargetPoints=function(e,t,o,a){var i=this.getSnapTargets(t,o);return k.forEach(i,function(r){e.add("corner",bg(r)),e.add("corner",vg(r))}),e.add("corner",Yc(t,a)),e},ro.$inject=["eventBus","snapping"],ro.prototype.getSnapTargets=function(e,t){return xc(t).filter(function(o){return!jy(o,e)&&!Ze(o)&&!Ty(o)&&!kn(o)})};function Yc(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function jy(e,t){return e.host===t}function Ty(e){return!!e.hidden}function Vy(e){return e==="n"||e==="s"}function My(e){return e==="e"||e==="w"}var Py=7,Ny=1e3;function Ft(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Ny)}Ft.$inject=["canvas"],Ft.prototype.snap=function(e,t){var o=e.context,a=o.snapContext,i=a.getSnapLocations(),r={x:Uo(e,"x"),y:Uo(e,"y")};k.forEach(i,function(l){var s=a.getSnapOrigin(l),c={x:e.x+s.x,y:e.y+s.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(c,l,d,Py),u!==void 0&&(r[d]={value:u,originValue:u-s[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),k.forEach(["x","y"],function(l){var s=r[l];k.isObject(s)&&bt(e,l,s.originValue)})},Ft.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=P.create("path");return P.attr(o,{d:"M0,0 L0,0"}),P.classes(o).add("djs-snap-line"),P.append(t,o),{update:function(a){k.isNumber(a)?e==="horizontal"?P.attr(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):P.attr(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):P.attr(o,{display:"none"})}}},Ft.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ft.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Ft.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ft.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const $y={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",pt],resizeSnapping:["type",ro],snapping:["type",Ft]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",Mn]};function Pn(e){De.call(this,e),this.init()}Pn.$inject=["eventBus"],Yt(Pn,De),Pn.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return o(r)},!0)})},Pn.prototype.init=function(){};function lo(e){Pn.call(this,e)}lo.$inject=["eventBus"],Ht(lo,Pn),lo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(o.parent=i);try{return wi(t,o)}finally{i&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,o=e.target;return wi(t,o)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Jp(t)})},lo.prototype.canConnect=wi;function wi(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Oy={__init__:["myRuleProvider"],myRuleProvider:["type",lo]};function Ci(e,t,o,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}Ci.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Ci.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,f,h){function m(p){const g=t.createShape(Se({type:c},h));e.start(p,g)}return{group:d,className:u,title:f,action:{dragstart:m,click:m}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){o.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};const Ry={__init__:["paletteProvider"],paletteProvider:["type",Ci]};var Gc=50,Ay=250;function Ly(e,t){t||(t={});function o(p){return p.source===e?1:-1}var a=t.defaultDistance||Gc,i=t.direction||"e",r=t.filter,l=t.getWeight||o,s=t.maxDistance||Ay,c=t.reference||"start";r||(r=Iy);function d(p,g){return i==="n"?c==="start"?be(p).top-be(g).bottom:c==="center"?be(p).top-Te(g).y:be(p).top-be(g).top:i==="w"?c==="start"?be(p).left-be(g).right:c==="center"?be(p).left-Te(g).x:be(p).left-be(g).left:i==="s"?c==="start"?be(g).top-be(p).bottom:c==="center"?Te(g).y-be(p).bottom:be(g).bottom-be(p).bottom:c==="start"?be(g).left-be(p).right:c==="center"?Te(g).x-be(p).right:be(g).right-be(p).right}var u=e.incoming.filter(r).map(function(p){var g=l(p),y=g<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:g}}),f=e.outgoing.filter(r).map(function(p){var g=l(p),y=g>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:g}}),h=u.concat(f).reduce(function(p,g){return p[g.id+"__weight_"+g.weight]=g,p},{}),m=k.reduce(h,function(p,g){var y=g.distance,x=g.weight;return y<0||y>s||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*x,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return m.distance||a}function Iy(){return!0}var zy=100;function Kc(e,t,o){e.on("autoPlace",zy,function(a){var i=a.shape,r=a.source;return Fy(r,i)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Kc.$inject=["eventBus","modeling","canvas"];function Fy(e,t,o){o||(o={});var a=o.defaultDistance||Gc,i=Te(e),r=be(e);return{x:r.right+a+t.width/2,y:i.y}}function Xc(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Xc.$inject=["eventBus","selection"];const Hy={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Kc],autoPlaceSelectionBehavior:["type",Xc]},Wy=10,Uy=(e,t)=>e.type===t;function Jy(e){return e.incoming.map(t=>t.source)}function Dy(e){return e.outgoing.map(t=>t.target)}function ki(e){return Dy(e).concat(Jy(e))}function qy(e){let t=ki(e);return e.host&&(t=t.concat(ki(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(ki(a)),[]))),t.filter(o=>o.type!=="myline")}function Yy(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height},i=qy(e);return k.find(i,r=>r===o?!1:Vt(r,a,Wy)==="intersect")}function Gy(e,t,o,a){let i;for(;i=Yy(e,o,t);)o=a(t,o,i);return o}function Ky(e){return function(t,o,a){const i={x:o.x,y:o.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,o[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,o[r]+d+c)}),i}}function Xy(e,t){return Zy(e,t)}function Zy(e,t){const o=be(e),a=Te(e),i=Ly(e,{filter:u=>Uy(u,"myline")}),r=30,l=80,c={x:o.right+i+t.width/2,y:a.y+Qy("left",l)};return Gy(e,t,c,Ky({y:{margin:r,minDistance:l}}))}function Qy(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Zc(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return Xy(a,o)})}Zc.$inject=["eventBus"];const ev={__depends__:[Hy],__init__:["myAutoPlace"],myAutoPlace:["type",Zc]};function Ei(e,t,o,a,i,r,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Ei.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ei.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){o.removeElements([e])}function c(f,h,m){t.start(f,h,m)}function d(f,h,m,p){typeof m!="string"&&(p=m);function g(x,b){const w=a.createShape(Se({type:f},p));r.start(x,w,{source:b})}function y(x,b){const w=a.createShape(Se({type:f},p));i.append(b,w)}return{group:"model",className:h,title:m,action:{dragstart:g,click:y}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const u={};for(const f in l.palette)if(f!=="create.start-event"){const h=l.palette[f];u[f]=d(h.type,h.className,h.title,h.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};const tv={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ei]},nv=n.defineComponent({name:"JWorkflow",__name:"j-workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{i("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{i("elementClick",T.element.businessObject)}),V.on("create.end",T=>{i("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{i("elementCreate",T.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let V={__init__:["myOptions"],myOptions:["type",f]};s=new Pi({canvas:{container:r.value},modules:[wg,Oa,_g,Ig,$l,Xm,Wg,Ug,Jg,Us,es,ny,Mc,sy,os,V,ev,qs,Ey,tv,Ry,Oy,$y,Gs]});const T=s.get("canvas"),L=s.get("elementFactory");d();const F=L.createRoot();T.setRootElement(F),u()};n.onMounted(()=>{h()});const m=V=>{const T=V==null?1:c+V;s.get("canvas").zoom(T),c=T},p=()=>{s.get("commandStack").redo()},g=()=>{s.get("commandStack").undo()},y=()=>{s.get("canvas").zoom(1);const V=s.get("elementRegistry").getAll();var T=Ks(V);return T},x=V=>{s.clear(),d(),Xs(V,s)},b=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{m(V)},redo:()=>{p()},undo:()=>{g()},getData:()=>y(),setData:V=>{x(V)},updateElemet:V=>{b(V)}}),(V,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Qc=oe(Gm),ed=oe(nv),ov=[uo,rr,lr,sr,cr,dr,ur,fr,pr,hr,mr,br,xr,wr,Cr,ga,ir,kr,Er,_r,Br,Tr,Vr,zr,Mr,Pr,Nr,$r,Or,Rr,Ar,Lr,Ir,Ur,Jr,Dr,qr,Yr,Gr,Kr,Fr,Hr,ya,Xr,Zr,Qr,el,tl,nl,ol,bp,Qc,ed],av={install:e=>{ov.forEach(t=>{e.component(t.name,t)})}};N.EncryptionFactory=Qi,N.EventBus=pa,N.HashingFactory=Fd,N.JAutoComplete=hr,N.JBarcode=Vr,N.JButton=uo,N.JButtonSelect=Ur,N.JButtons=rr,N.JCascaderSelect=ur,N.JCheckbox=fr,N.JCodeMirror=zr,N.JCollapse=nl,N.JComp=Dr,N.JCount=Mr,N.JCountUp=Pr,N.JDataPanel=Nr,N.JDialog=xr,N.JDialogFull=wr,N.JDivider=$r,N.JDrawer=Cr,N.JDynamicLayer=ir,N.JEcharts=Tr,N.JEditor=ol,N.JForm=qr,N.JFormItem=Yr,N.JGuid=Kr,N.JHpanel=Or,N.JIcon=sr,N.JInput=lr,N.JInputButton=Rr,N.JInputCode=Ar,N.JInputColor=Lr,N.JInputLayer=Zr,N.JInputRows=Xr,N.JInputTag=kr,N.JLayer=ga,N.JLayerForm=Qr,N.JLayout=mr,N.JMenu=Hr,N.JNumber=pr,N.JPage=Gr,N.JRadio=cr,N.JRate=Er,N.JSelect=dr,N.JSlider=_r,N.JSliderCaptcha=Fr,N.JSwitch=el,N.JTable=br,N.JTablePanel=ya,N.JTabs=tl,N.JTitle=Ir,N.JTree=Jr,N.JUpload=Br,N.JWorkflow=ed,N.JWorkflowViewer=Qc,N.assign=Se,N.buildShortUUID=po,N.buildUUID=Ut,N.clearJson=On,N.clone=fo,N.deepClone=gt,N.default=av,N.eventBus=Wd,N.formatToDate=An,N.formatToDateTime=Yi,N.fullScreenLoading=dn,N.getCompConfig=Jt,N.getCompType=fa,N.getFunction=da,N.getIsInputComp=ho,N.getIsTableInputComp=Di,N.getLabel=qi,N.getObjType=Oi,N.getTextWidth=cn,N.is=$i,N.isArray=co,N.isNullOrEmpty=mt,N.isObject=Bd,N.loadBMap=tr,N.lowerFirst=Nd,N.myAesDecrypt=Hd,N.numberToChinese=Ai,N.numberToThousandSeparator=Li,N.pagination=Vd,N.paginationEx=Md,N.set=Ri,N.setGroupMap=zi,N.toArray=Hi,N.toDecimal=Rn,N.toLeafArray=Ji,N.toSimpleTree=Od,N.toTree=$d,N.uniqueArray=Pd,N.upFirst=Ii,N.useLayer=In,N.useSortable=er,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
16
+ getCompValue)=>{ return ${j} }`;let S;const B=da(j);if(B.res)try{S=B.fn(a,i,r,l,s,c,d,u,f,h,m,p,g,y,w)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(B.msg),"";return Number.isNaN(S)?"":(o.decimal!==void 0&&(S=S.toFixed(o.decimal)),S)}),_=n.computed(()=>{let v=C.value;return o.thousandSeparator&&(v=Li(v)),o.isChinese&&(v=Ai(v)),v});return n.watch(C,v=>{x("update:modelValue",v),x("change",{value:v,data:_.value})}),(v,j)=>{const S=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(S,{modelValue:_.value,"onUpdate:modelValue":j[0]||(j[0]=B=>_.value=B),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),af={key:0},Pr=oe(n.defineComponent({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=n.computed(()=>({...o})),i=n.ref(),r=n.ref(null),l=n.computed(()=>o.options);n.onMounted(()=>{o.animation&&s()}),n.watch(()=>o.decimals,()=>{r.value&&r.value.update&&(r.value.options.decimalPlaces=o.decimals,r.value.reset(),r.value.update(o.endValue))},{deep:!0}),n.watch(()=>o.endValue,h=>{r.value&&r.value.update&&r.value.update(h)});const s=()=>{r.value||(l.value.startVal=o.startValue,l.value.decimalPlaces=o.decimals,l.value.duration=o.duration,r.value=new pd.CountUp(i.value,Number(o.endValue),l.value),r.value.start(()=>{o.callback?.(r.value)}))};return n.onUnmounted(()=>{r.value=null}),n.onBeforeUnmount(()=>{r.value=null}),t({myProps:a,el:i,init:s,start:h=>{r.value&&r.value.start&&r.value.start(()=>{h?.(r.value)})},pauseResume:()=>{r.value&&r.value.pauseResume&&r.value.pauseResume()},reset:()=>{r.value&&r.value.reset&&r.value.reset()},update:h=>{r.value&&r.value.update&&r.value.update(h)}}),(h,m)=>(n.openBlock(),n.createElementBlock("span",{ref_key:"el",ref:i},[e.animation?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("span",af,n.toDisplayString(e.endValue),1))],512))}})),rf={class:"j-block j-data-panel"},lf={key:0,class:"j-data-panel-header"},sf={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},cf={class:"j-data-panel-header-right"},df={class:"j-data-panel-body"},Nr=oe(n.defineComponent({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",rf,[e.title?(n.openBlock(),n.createElementBlock("div",lf,[n.createElementVNode("div",sf,n.toDisplayString(e.title),1),n.createElementVNode("div",cf,[n.renderSlot(t.$slots,"titleRight")])])):n.createCommentVNode("",!0),n.createElementVNode("div",df,[n.renderSlot(t.$slots,"default")])]))}})),uf={class:"j-divider-content"},$r=oe(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 i={color:t.color};return t.size&&Number(t.size)&&(i.fontSize=`${t.size}px`),i}),a=n.computed(()=>({borderTopStyle:t.borderStyle}));return(i,r)=>(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(a.value)},null,4),n.createElementVNode("div",uf,[n.createElementVNode("span",null,n.toDisplayString(e.content||""),1)]),n.createElementVNode("div",{class:"j-divider-line j-divider-line-right",style:n.normalizeStyle(a.value)},null,4)],6))}})),ff={class:"j-hpanel"},pf={class:"j-hpanel-main"},Or=oe(n.defineComponent({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",ff,[n.renderSlot(t.$slots,"left"),n.createElementVNode("div",pf,[n.renderSlot(t.$slots,"default")]),n.renderSlot(t.$slots,"right")]))}})),Rr=oe(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,a=t,i=n.ref(),r=n.ref(),l=async(u,f)=>{o.ok&&(u("保存数据中..."),r.value=await o.ok(),a("update:modelValue",r.value),a("change",{value:r.value}),f(),i.value.close())},s=()=>o.beforeClose?o.beforeClose(r.value):!0,c=()=>{o.closed?.()},d=()=>{i.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(r.value)},200)};return n.watch(()=>o.modelValue,u=>{r.value=u},{immediate:!0}),(u,f)=>{const h=n.resolveComponent("j-button"),m=n.resolveComponent("j-layer");return n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(h,n.mergeProps({style:{width:"auto"}},u.$attrs,{type:e.type,label:e.btnText,size:e.size,onClick:d}),null,16,["type","label","size"]),n.createVNode(m,{ref_key:"layerRef",ref:i,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:l,onClosed:c},{default:n.withCtx(()=>[n.renderSlot(u.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}})),Ar=oe(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,a=t,i=n.computed({get:()=>o.modelValue,set:f=>{a("update:modelValue",f)}}),r=n.ref(""),l=f=>{r.value=f},s=()=>r.value,c=f=>o.beforeClose?o.beforeClose(f):!0,d=f=>{a("change",f)},u=n.computed(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(f,h)=>{const m=n.resolveComponent("j-code-mirror"),p=n.resolveComponent("j-layout"),g=n.resolveComponent("j-input-button");return n.openBlock(),n.createBlock(g,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=y=>i.value=y),type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":c,ok:s,open:l,onChange:d},{default:n.withCtx(()=>[n.createVNode(p,{"right-move":!1,right:560},n.createSlots({default:n.withCtx(()=>[n.createVNode(m,{value:r.value,"onUpdate:value":h[0]||(h[0]=y=>r.value=y),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(m,{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"])}}})),Lr=oe(n.defineComponent({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l=n.ref(),s=n.computed({get(){return a.modelValue===null||a.modelValue===void 0?l.value:a.modelValue},set(g){l.value=g,i("update:modelValue",g),i("input",g)}}),c=g=>{i("input",g)},d=g=>{i("focus",g)},u=g=>{i("blur",g)},f=()=>{i("clear"),i("update:modelValue","")},h=g=>{i("change",g)},m=g=>{i("color-change",g)},p=g=>{i("active-change",g)};return t({focus:()=>{r.value?.focus()},blur:()=>{r.value?.blur()},select:()=>{r.value?.select()}}),(g,y)=>{const x=n.resolveComponent("el-color-picker"),b=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},`j-input-color-${e.size}`])},[n.createVNode(b,n.mergeProps({ref_key:"inputRef",ref:r,modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=w=>s.value=w),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},g.$attrs,{onInput:c,onFocus:d,onBlur:u,onClear:f,onChange:h}),{[e.inputType]:n.withCtx(()=>[n.createVNode(x,{modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=w=>s.value=w),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:m,onActiveChange:p},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}})),Ir=oe(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||""),a=n.computed(()=>{const i={...t.style};return t.color&&(i.color=t.color),t.size&&(typeof t.size=="number"?i.fontSize=`${t.size}px`:i.fontSize=t.size),t.weight&&(i.fontWeight=t.weight),i});return(i,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-title",o.value]),style:n.normalizeStyle(a.value)},n.toDisplayString(e.title),7))}})),zr=oe(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 a=e,i=o,r=n.ref(),l=n.ref("");let s=null;const c=g=>{switch(g){case"application/javascript":case"javascript":case"text/javascript":return ln.javascript();case"css":case"text/css":return gd.css();case"html":case"text/html":return yd.html();case"json":case"application/json":return vd.json();case"sql":case"text/x-sql":return bd.sql();case"xml":case"text/xml":return xd.xml();case"python":case"text/x-python":return wd.python();case"markdown":case"text/markdown":return Cd.markdown();case"java":case"text/x-java":return kd.java();case"vue":case"text/x-vue":return ln.javascript({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return ln.javascript({jsx:!1,typescript:!0});case"jsx":return ln.javascript({jsx:!0,typescript:!1});case"tsx":return ln.javascript({jsx:!0,typescript:!0});default:return ln.javascript()}},d=()=>{const g=[md.basicSetup,lt.lineNumbers(),lt.highlightActiveLineGutter(),lt.highlightSpecialChars(),ra.history(),lt.drawSelection(),lt.dropCursor(),sn.indentOnInput(),sn.bracketMatching(),ia.closeBrackets(),lt.rectangularSelection(),sn.foldGutter(),lt.keymap.of([...ia.closeBracketsKeymap,...ra.defaultKeymap,...ra.historyKeymap,...sn.foldKeymap]),sn.syntaxHighlighting(sn.defaultHighlightStyle)];return g.push(c(a.mode)),a.readonly&&g.push(aa.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&g.push(ia.autocompletion({override:[y=>{const x=y.matchBefore(/\w*/);if(!x||x.from===x.to)return null;const b=a.handleHint(x.text);return b.length===0?null:{from:x.from,options:b.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(lt.EditorView.updateListener.of(y=>{if(y.docChanged){const x=y.state.doc.toString();l.value=x,i("update:value",x),i("change",{value:x})}})),g},u=async()=>{if(!r.value)return;const g=aa.EditorState.create({doc:a.value,extensions:d()});s=new lt.EditorView({state:g,parent:r.value}),l.value=a.value},f=()=>{if(!s)return;const g=s.state.doc.toString();s&&s.destroy();const y=aa.EditorState.create({doc:g,extensions:d()});r.value&&(s=new lt.EditorView({state:y,parent:r.value}));const x=s.state.doc.toString();x!==a.value&&s.dispatch({changes:{from:0,to:x.length,insert:a.value}})},h=()=>{if(!s)return;const g=s.state.doc.length;s.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),setTimeout(()=>{if(s){const y=s.state.doc.length;s.dispatch({selection:{anchor:y,head:y},scrollIntoView:!0})}},100)},m=()=>{let g=hd.format(a.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,"@"),i("update:value",g),i("change",{value:g})};let p=null;return n.watch(()=>a.value,g=>{g!==l.value&&(l.value=g,s&&f(),setTimeout(()=>{s&&a.isScrollToBottom&&h()}))}),n.watch(()=>a.mode,()=>{s&&f()}),n.onMounted(async()=>{await n.nextTick(),await u(),typeof window<"u"&&window.ResizeObserver&&r.value&&(p=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),p.observe(r.value))}),n.onUnmounted(()=>{p&&r.value&&(p.unobserve(r.value),p.disconnect(),p=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:m}),(g,y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"codeWraperRef",ref:r,class:"j-code-mirror",style:n.normalizeStyle({height:e.height?`${e.height}px`:""})},null,4))}})),hf=n.defineComponent({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("actionRef"),i=n.ref("0"),r=n.computed(()=>{const{actionStyle:s,toLeft:c}=o;return{...s,left:c?"0":i.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:l.value?"6px":void 0,transition:c?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),l=n.computed(()=>Number.parseInt(i.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{i.value=s}}),(s,c)=>{const d=n.resolveComponent("j-icon");return n.openBlock(),n.createElementBlock("div",{ref_key:"actionRef",ref:a,style:n.normalizeStyle(r.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?(n.openBlock(),n.createBlock(d,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):(n.openBlock(),n.createBlock(d,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),mf=n.defineComponent({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("barRef"),i=n.ref("0"),r=n.computed(()=>{const{barStyle:l,toLeft:s}=o;return{...l,width:s?"0":i.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:l=>{i.value=l}}),(l,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"barRef",ref:a,style:n.normalizeStyle(r.value)},null,4))}}),gf=n.defineComponent({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=n.useTemplateRef("contentRef"),i=n.computed(()=>{const{contentStyle:l}=o;return{...l,fontSize:"12px"}});t({getEl:()=>a.value});const r=n.computed(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(l,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"contentRef",ref:a,class:n.normalizeClass([{success:e.isPassing},"j-slider-captcha-content"]),style:n.normalizeStyle(i.value)},[n.createElementVNode("div",{style:n.normalizeStyle(r.value),class:"j-spine-text"},n.toDisplayString(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),Fr=oe(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,a=t,i=n.useModel(e,"modelValue"),r=n.reactive({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),l=n.useTemplateRef("wrapperRef"),s=n.useTemplateRef("barRef"),c=n.useTemplateRef("contentRef"),d=n.useTemplateRef("actionRef");n.watch(()=>r.isPassing,x=>{if(x){const{endTime:b,startTime:w}=r,C=(b-w)/1e3;a("success",{isPassing:x,time:C.toFixed(1)}),i.value=x}}),n.watchEffect(()=>{r.isPassing=!!i.value});function u(x){return"pageX"in x?x.pageX:"touches"in x&&x.touches[0]?x.touches[0].pageX:0}function f(x){r.isPassing||d.value&&(a("start",x),r.moveDistance=u(x)-Number.parseInt(d.value.getStyle().left.replace("px","")||"0",10),r.startTime=Date.now(),r.isMoving=!0)}function h(x){const b=l.value?.offsetWidth??220,w=x?.offsetWidth??40,C=b-w-6;return{actionWidth:w,offset:C,wrapperWidth:b}}function m(x){const{isMoving:b,moveDistance:w}=r;if(b){const C=n.unref(d),_=n.unref(s);if(!C||!_)return;const{actionWidth:v,offset:j,wrapperWidth:S}=h(C.getEl()),B=u(x)-w;a("move",{event:x,moveDistance:w,moveX:B}),B>0&&B<=j?(C.setLeft(`${B}px`),_.setWidth(`${B+v/2}px`)):B>j&&(C.setLeft(`${S-v}px`),_.setWidth(`${S-v/2}px`),g())}}function p(x){const{isMoving:b,isPassing:w,moveDistance:C}=r;if(b&&!w){a("end",x);const _=d.value,v=n.unref(s);if(!_||!v)return;const j=u(x)-C,{actionWidth:S,offset:B,wrapperWidth:V}=h(_.getEl());j<B?y():(_.setLeft(`${V-S}px`),v.setWidth(`${V-S/2}px`),g()),r.isMoving=!1}}function g(){r.endTime=Date.now(),r.isPassing=!0,r.isMoving=!1}function y(){r.isMoving=!1,r.isPassing=!1,r.moveDistance=0,r.toLeft=!1,r.startTime=0,r.endTime=0;const x=n.unref(d),b=n.unref(s),w=n.unref(c);!x||!b||!w||(w.getEl().style.width="100%",r.toLeft=!0,setTimeout(()=>{r.toLeft=!1,x.setLeft("0"),b.setWidth("0")},300))}return(x,b)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"wrapperRef",ref:l,class:n.normalizeClass(["j-slider-captcha slider-border",o.class]),style:n.normalizeStyle([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:p,onMousemove:m,onMouseup:p,onTouchend:p,onTouchmove:m},[n.createVNode(mf,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":r.toLeft},null,8,["bar-style","to-left"]),n.createVNode(gf,{ref_key:"contentRef",ref:c,"content-style":e.contentStyle,"is-passing":r.isPassing},null,8,["content-style","is-passing"]),n.createVNode(hf,{ref_key:"actionRef",ref:d,"action-style":e.actionStyle,"is-passing":r.isPassing,"to-left":r.toLeft,onMousedown:f,onTouchstart:f},null,8,["action-style","is-passing","to-left"])],38))}})),yf=n.defineComponent({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:i,toArray:r,activeMenu:l,theme:s}=Ln(),{getHMoreMenus:c}=qd(),d=n.ref([]);o.pId==="moreId"?d.value=c.value:d.value=r(i()[o.pId||""]||[],[]);const u=p=>{const g=d.value.find(y=>y.active);g?.value!==p.value&&(g&&(g.active=!1),a("click",p))},{list:f,containerProps:h,wrapperProps:m}=la.useVirtualList(d,{itemHeight:44});return(p,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(h)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(m))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(f),y=>(n.openBlock(),n.createBlock(yo,{key:y.data.value,"parent-actives":n.unref(l)?.pid?.split(".")||[],item:y.data,"is-sub":"",onClick:u},null,8,["parent-actives","item"]))),128))],16)],16))}}),vf={class:"j-menu-item-label"},bf={class:"j-menu-item-label"},xf={key:1,class:n.normalizeClass(["j-menu-item-arrow","sub"])},wf={class:"j-menu-item-label"},yo=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}=Je(),{activeMenuId:a}=Ln(),i=t,r=l=>{i("click",l)};return(l,s)=>{const c=n.resolveComponent("j-icon"),d=n.resolveComponent("el-tooltip"),u=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:s[0]||(s[0]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"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(c,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",vf,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(u,{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.value===n.unref(a),"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(c,{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",bf,n.toDisplayString(n.unref(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?(n.openBlock(),n.createElementBlock("div",xf)):n.createCommentVNode("",!0)],6)],2)]),default:n.withCtx(()=>[n.createVNode(yf,{"p-id":e.item.value,onClick:r},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:s[1]||(s[1]=n.withModifiers(f=>r(e.item),["stop"]))},[n.createElementVNode("div",{class:n.normalizeClass(["j-menu-item-content",{active:e.item.value===n.unref(a),"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(c,{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",wf,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))}}}),Cf=n.defineComponent({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=f=>{a("click",f)},s=n.computed(()=>o.menuList),{list:c,containerProps:d,wrapperProps:u}=la.useVirtualList(s,{itemHeight:44});return(f,h)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":n.unref(r)==="dark"}]},n.unref(d)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(u))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(c),m=>(n.openBlock(),n.createBlock(yo,{key:m.data.value,"parent-actives":n.unref(i)?.pid?.split(".")||[],item:m.data,collapsed:e.collapsed,class:n.normalizeClass({"menu-item-entering":m.data.entering,"menu-item-leaving":m.data.leaving}),onClick:l},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),kf=n.defineComponent({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=n.ref(),s=n.ref(0);let c=null;n.onMounted(()=>{typeof window<"u"&&window.ResizeObserver&&l.value&&(c=new ResizeObserver(()=>{l.value&&(s.value=l.value.offsetWidth)}),c.observe(l.value))});const d=n.computed(()=>{const m=[];let p=0,g=0;const y=o.menuList.length;return o.menuList.forEach(x=>{g++;const b=(cn(x.label)||0)+32+16+4+8;p+=b,(g===y&&p<=s.value||g<y&&p+56<=s.value)&&m.push(x)}),m.length<o.menuList.length&&m.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),m}),u=n.computed(()=>{const m=[];let p=0;const g=d.value.length;return o.menuList.forEach(y=>{p++,p>=g&&m.push(y)}),m}),f=n.computed(()=>{const m=i.value?.pid?.split(".")||[];return(m.length>1&&u.value.findIndex(p=>p.value===m[1])>-1||u.value.findIndex(p=>p.value===i.value?.value)>-1)&&m.push("moreId"),m}),h=m=>{a("click",m)};return Yd({getHMoreMenus:u}),n.onUnmounted(()=>{c&&l.value&&(c.unobserve(l.value),c.disconnect(),c=null)}),(m,p)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuRef",ref:l,class:n.normalizeClass(["j-menu-horizontal",{"j-menu-dark":n.unref(r)==="dark"}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,g=>(n.openBlock(),n.createBlock(yo,{key:g.value,"parent-actives":f.value,item:g,"is-horizontal":"",onClick:h},null,8,["parent-actives","item"]))),128))],2))}}),Ef=n.defineComponent({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:i,theme:r}=Ln(),l=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=n.computed(()=>(o.menuList.forEach((m,p)=>{m.color=l[p%l.length]}),o.menuList)),c=n.computed(()=>i.value?.pid?.split(".")||[]),d=m=>{a("click",m)},{list:u,containerProps:f,wrapperProps:h}=la.useVirtualList(s,{itemHeight:96});return(m,p)=>(n.openBlock(),n.createElementBlock("div",n.mergeProps({class:["j-menu-vertical",{"j-menu-dark":n.unref(r)==="dark"}]},n.unref(f)),[n.createElementVNode("div",n.normalizeProps(n.guardReactiveProps(n.unref(h))),[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(u),g=>(n.openBlock(),n.createBlock(yo,{key:g.data.value,"parent-actives":c.value,item:g.data,"is-vertical":"",onClick:d},null,8,["parent-actives","item"]))),128))],16)],16))}}),Hr=oe(n.defineComponent({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let i={};const r=n.ref("");r.value=o.activeId||"";const l=(g,y,x,b,w)=>{x=x||[];for(let C=0,_=x.length;C<_;C++){const v=x[C],j={};j.pid=y,j.indent=b,r.value===v.value&&(j.active=!0),Object.keys(v).forEach(B=>{B!=="children"&&(j[B]=v[B])}),w&&w.includes(v.value)&&(j.open=!0),g.push(j);const S=v.children||[];S.length>0&&(j.hasChildren=!0,w||(i[j.value]=S),(!w||j.open&&!o.collapsed)&&l(g,`${y}.${j.value}`,S,b+1,w))}},s=(g,y)=>{const x=[];return l(x,"0",g,0,y),x},c=n.ref([]);let d=[];const u=()=>{i={},d=s(o.menus);const g=[];if(r.value&&o.mode==="inline"){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}c.value=s(o.menus,g)};n.watch(()=>o.menus,()=>{u()},{immediate:!0}),n.watch(()=>o.mode,()=>{u()});const f=()=>{if(c.value.find(y=>y.active)?.value!==r.value){const y=d.find(x=>x.value===r.value);if(y){const x=[];o.mode==="inline"&&x.push(...y.pid.split(".")),c.value=s(o.menus,x)}}},h=n.computed(()=>d.find(g=>g.value===r.value));n.watch(()=>o.activeId,()=>{r.value=o.activeId||"",f()}),n.watch(()=>o.collapsed,()=>{if(o.collapsed)c.value=s(o.menus,[]);else{const g=[];if(r.value){const y=d.find(x=>x.value===r.value);y&&g.push(...y.pid.split("."))}c.value=s(o.menus,g)}});const m=n.computed(()=>o.theme),p=g=>{if(console.log(g),g.hasChildren){if(o.collapsed)return;const y=[];y.push(...g.pid.split(".")),g.open||y.push(g.value);const x=s(o.menus,y),b=new Set(c.value.map(C=>C.value)),w=new Set(x.map(C=>C.value));x.forEach(C=>{b.has(C.value)||(C.entering=!0)}),c.value.forEach(C=>{w.has(C.value)||(C.leaving=!0)}),c.value=x,setTimeout(()=>{c.value.forEach(C=>{C.entering=!1,C.leaving=!1})},300)}else{if(r.value===g.value)return;r.value=g.value,a("click",g)}};return Dd({getMenuMap:()=>i,toArray:s,activeMenu:h,activeMenuId:r,theme:m}),(g,y)=>e.mode==="inline"?(n.openBlock(),n.createBlock(Cf,{key:0,"menu-list":c.value,collapsed:e.collapsed,onClick:p},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?(n.openBlock(),n.createBlock(kf,{key:1,"menu-list":c.value,onClick:p},null,8,["menu-list"])):(n.openBlock(),n.createBlock(Ef,{key:2,"menu-list":c.value,onClick:p},null,8,["menu-list"]))}})),_f={class:"j-keyword-panel"},Sf={key:0},Bf={key:1,class:"columns-wrapper"},jf=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}=Je(),a=e,i=n.useModel(e,"checkAll"),r=n.useModel(e,"checkFields"),l=n.ref(!1),s=n.ref(""),c=n.computed(()=>a.columns.filter(h=>h.config?.filter?.isSearchKeyword?s.value?h.config?.label?.indexOf(s.value)!=-1:!0:!1).map(h=>({label:h.config?.label,value:h.id}))),d=()=>{i.value||(i.value=!0,l.value=!1,r.value=[])},u=h=>{h.length>0?i.value=!1:i.value=!0};return t({init:()=>{i.value?l.value=!1:l.value=!0}}),(h,m)=>{const p=n.resolveComponent("j-icon"),g=n.resolveComponent("el-input"),y=n.resolveComponent("j-checkbox");return n.openBlock(),n.createElementBlock("div",_f,[n.createElementVNode("div",{class:n.normalizeClass(["range-item",{active:i.value}]),onClick:d},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索全部")),1),i.value?(n.openBlock(),n.createBlock(p,{key:0,icon:"mdi:check"})):n.createCommentVNode("",!0)],2),n.createElementVNode("div",{class:"range-item",onClick:m[0]||(m[0]=x=>l.value=!l.value)},[n.createElementVNode("div",null,n.toDisplayString(n.unref(o)("搜索特定字段")),1),n.createVNode(p,{icon:l.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),l.value?(n.openBlock(),n.createElementBlock("div",Sf,[n.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":m[1]||(m[1]=x=>s.value=x),modelModifiers:{trim:!0},class:"no-border background",placeholder:n.unref(o)("搜索"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(p,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createElementBlock("div",Bf,[n.createVNode(y,{modelValue:r.value,"onUpdate:modelValue":m[2]||(m[2]=x=>r.value=x),options:c.value,style:{display:"flex","flex-direction":"column"},onChange:u},null,8,["modelValue","options"])])):n.createCommentVNode("",!0)])}}}),Tf={key:0,class:"title"},Vf={class:"content"},Mf={class:"relation"},Pf={style:{width:"72px"}},Nf={class:"btn-wrapper"},$f={class:"field-wrapper"},Of={class:"buttons"},Wr=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:a}=Je(),i=e,r=n.useModel(e,"relation"),l=n.useModel(e,"isPin"),s=n.ref([]),c=()=>{l.value=!l.value},d=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:f.value.join(","),options:u.value}),config:{appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,width:l.value?132:160,change:({value:b,row:w})=>{const _=i.columns.find(S=>S.id===b)?.config||{};let v="eq",j="text";["options"].includes(_.dataType||"")?v="in":["dateTime"].includes(_.dataType||"")&&(v="range",j="dateTime"),w.method=v,w.type=_.valueType||j}}},{id:"method",type:"j-select",getCompConfig:({row:b})=>{const C=i.columns.find(_=>_.id===b.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:l.value?120:144,appendTo:l.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:b})=>{b.value=void 0}}},{id:"value",type:"input",getCompType:({row:b})=>{const C=i.columns.find(_=>_.id===b.field)?.config||{};if(["options","dataItem","switch"].includes(C.dataType||"")){if(["in","nin"].includes(b.method)||["eq","ne"].includes(b.method))return"j-select"}else if(["dateTime"].includes(C.dataType||""))return["range"].includes(b.method)?"j-date-range":["formula"].includes(b.method)?"j-select":"j-date";return"j-input"},getCompConfig:({row:b})=>{if(["empty","not_empty"].includes(b.method||""))return{display:!1};const C=i.columns.find(v=>v.id===b.field)?.config||{},_={display:!0,placeholder:"",clearable:!0,filterable:!0};return["options","dataItem"].includes(C.dataType||"")?(_.collapseTags=!0,_.collapseTagsTooltip=!0,_.dataType=C.dataType,_.dataCode=C.dataCode,_.options=C.options):["switch"].includes(C.dataType||"")?(_.options=[],_.dataType="options",C.activeValue==null?_.options.push({label:"是",value:"1"}):_.options.push({label:"是",value:C.activeValue}),C.inactiveValue==null?_.options.push({label:"否",value:"0"}):_.options.push({label:"否",value:C.inactiveValue})):["dateTime"].includes(C.dataType||"")&&(["formula"].includes(b.method)?(_.placeholder="",_.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"}],_.dataType="options"):(_.type="datetime",["range"].includes(b.method)?(_.startPlaceholder="开始时间",_.endPlaceholder="结束时间",_.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):_.placeholder="")),_},config:{width:l.value?234:296,appendTo:l.value?void 0:".j-filter-panel"}}];n.onMounted(()=>{s.value=i.searchFieldList});const u=n.computed(()=>i.columns.filter(b=>!b.children?.length).map(b=>({label:b.config?.label,value:b.id,dataType:b.config?.dataType,options:b.config?.options}))),f=n.computed(()=>s.value.map(b=>b.field)),h=({data:b})=>{if(f.value.includes(b.value))return;const C=i.columns.find(j=>j.id===b.value)?.config||{};let _="eq",v="text";["options","dataItem"].includes(C.dataType||"")?_="in":["dateTime"].includes(C.dataType||"")&&(_="range",v="dateTime"),s.value.push({field:b.value,method:_,type:C.valueType||v})},m=o,p=()=>{s.value.length=0},g=()=>{l.value?m("filter"):m("close",!0)},y=()=>{s.value.forEach(b=>{b.value=void 0}),m("filter")};return t({getSearchFields:()=>s.value}),(b,w)=>{const C=n.resolveComponent("j-icon"),_=n.resolveComponent("j-select"),v=n.resolveComponent("j-button-select"),j=n.resolveComponent("j-button"),S=n.resolveComponent("j-input-rows"),B=n.resolveComponent("el-tooltip");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-filter-panel",{"is-pin":l.value}])},[l.value?(n.openBlock(),n.createElementBlock("div",Tf,[n.createVNode(C,{icon:"mdi:filter-outline"}),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选")),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",Vf,[n.createElementVNode("div",Mf,[n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("筛选出符合以下")),1),n.createElementVNode("div",Pf,[n.createVNode(_,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=V=>r.value=V),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),n.createElementVNode("div",null,n.toDisplayString(n.unref(a)("条件的数据")),1)]),n.createElementVNode("div",Nf,[n.createVNode(v,{label:"添加过滤条件",options:u.value,"model-value":f.value.join(","),onChange:h},null,8,["options","model-value"]),s.value.length>0?(n.openBlock(),n.createBlock(j,{key:0,type:"text",danger:"",label:"删除全部",onClick:p})):n.createCommentVNode("",!0)]),n.createElementVNode("div",$f,[n.createVNode(S,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=V=>s.value=V),columns:d,"edit-config":{isAddBtn:!1},"is-wrap":l.value},null,8,["modelValue","is-wrap"])]),n.createVNode(B,{placement:"bottom",content:l.value?n.unref(a)("取消固定"):n.unref(a)("固定显示")},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"pin-btn",onClick:c},[n.createVNode(C,{rotate:45,icon:l.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),n.createElementVNode("div",Of,[n.createVNode(j,{label:n.unref(a)("筛选"),type:"primary",onClick:g},null,8,["label"]),n.createVNode(j,{label:n.unref(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:y},null,8,["label"])])],2)}}}),Rf={class:"j-order-panel"},Af={class:"content"},Lf={class:"btn-wrapper"},If={class:"field-wrapper"},zf={class:"buttons"},Ff=n.defineComponent({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),i=e,r=o,l=n.computed(()=>i.columns.filter(p=>!p.children?.length&&p.config?.sorter?.isNot!==!0).map(p=>({label:p.config?.label,value:p.id}))),s=n.ref([]),c=n.computed(()=>s.value.map(p=>p.value)),d=[{id:"label",type:"j-title",getCompConfig:({row:p})=>({title:p.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],u=({data:p})=>{c.value.includes(p.value)||s.value.push({label:p.label,value:p.value,sord:"ASC"})},f=p=>{s.value=JSON.parse(JSON.stringify(p))},h=()=>{r("save",JSON.parse(JSON.stringify(s.value)))},m=()=>{s.value=[],r("clear")};return t({init:f}),(p,g)=>{const y=n.resolveComponent("j-button-select"),x=n.resolveComponent("j-input-rows"),b=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Rf,[n.createElementVNode("div",Af,[n.createElementVNode("div",Lf,[n.createVNode(y,{label:"添加排序规则",options:l.value,"model-value":c.value.join(","),onChange:u},null,8,["options","model-value"])]),n.createElementVNode("div",If,[n.createVNode(x,{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=w=>s.value=w),columns:d,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),n.createElementVNode("div",zf,[n.createVNode(b,{label:n.unref(a)("排序"),type:"primary",onClick:h},null,8,["label"]),s.value.length>0?(n.openBlock(),n.createBlock(b,{key:0,label:n.unref(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:m},null,8,["label"])):n.createCommentVNode("",!0)])])}}}),Hf={class:"j-column-panel"},Wf={class:"content"},Uf={class:"search-wrapper"},Jf={class:"tree-wrapper"},Df={class:"buttons"},qf=n.defineComponent({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),i=e,r=o,l=n.ref(),s=n.ref(""),c={},d=n.ref([]),u=n.ref([]),f=(v,j)=>{const S=[],B=new Map;v.forEach(T=>{B.set(T.id,T),c[T.id]=T});const V=new Set;return j&&j.length>0&&j.forEach(T=>{const L=B.get(T.id);if(L){V.add(L.id);const F={id:L.id,label:L.config?.label||L.id,type:L.type,display:L.config?.display!==!1};L.children&&L.children.length>0&&(F.children=f(L.children,T.children)),S.push(F)}}),v.forEach(T=>{if(!V.has(T.id)){const L={id:T.id,label:T.config?.label||T.id,type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(L.children=f(T.children)),S.push(L)}}),S},h=(v,j)=>j.length===0?v:v.map(S=>{const B=j.some(T=>S.label.toLowerCase().includes(T.toLowerCase())),V=S.children?h(S.children,j):[];return B||V.length>0?{...S,children:V.length>0?V:S.children}:null}).filter(Boolean),m=n.computed(()=>{if(!s.value)return u.value;const v=s.value.split(/\s+/).filter(Boolean);return h(u.value,v)}),p=n.ref([]),g=n.computed(()=>{const v=new Map;if(i.columnConfig&&i.columnConfig.length>0){const j=S=>{S.forEach(B=>{v.set(B.id,B),B.children&&j(B.children)})};j(i.columnConfig)}return v}),y=()=>{const v=j=>{const S=[];return j.forEach(B=>{let V=!0;if(g.value.size>0){const T=g.value.get(B.id);T?V=T.display:V=B.config?.display!==!1}else V=B.config?.display!==!1;V&&(S.push(B.id),B.children&&S.push(...v(B.children)))}),S};p.value=v(i.columns)},x=(v,{node:j})=>{v.includes(j.id)?p.value.push(j.id):p.value=p.value.filter(B=>B!==j.id)},b=(v,j,S)=>S==="inner"?!1:v.parent===j.parent,w=()=>{const v=j=>j.map(S=>{const B={...S,display:p.value.includes(S.id)};return S.children&&(B.children=v(S.children)),B});r("save",v(u.value))},C=()=>{if(y(),u.value=JSON.parse(JSON.stringify(d.value)),s.value="",l.value){const v=l.value;v.setCheck&&v.setCheck(p.value);const j=v.$refs?.treeRef||v;j?.setCheckedKeys&&j.setCheckedKeys(p.value)}};return t({init:()=>{y(),d.value=f(i.columns,i.columnConfig),u.value=JSON.parse(JSON.stringify(d.value))}}),(v,j)=>{const S=n.resolveComponent("j-icon"),B=n.resolveComponent("el-input"),V=n.resolveComponent("j-tree"),T=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",Hf,[n.createElementVNode("div",Wf,[n.createElementVNode("div",Uf,[n.createVNode(B,{modelValue:s.value,"onUpdate:modelValue":j[0]||(j[0]=L=>s.value=L),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:n.withCtx(()=>[n.createVNode(S,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",Jf,[n.createVNode(V,{ref_key:"treeRef",ref:l,list:m.value,"is-tree-data":!0,"default-checked-keys":p.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":b,check:x},null,8,["list","default-checked-keys","draggable"])])]),n.createElementVNode("div",Df,[n.createVNode(T,{label:n.unref(a)("确定"),type:"primary",onClick:w},null,8,["label"]),n.createVNode(T,{label:n.unref(a)("重置"),icon:"mdi:restore",type:"text",onClick:C},null,8,["label"])])])}}}),Yf={class:"j-table-panel-left"},Gf={class:"j-table-panel-top"},Kf={class:"j-table-panel-top-left"},Xf={class:"j-table-panel-top-right"},Zf={key:0,style:{width:"200px"}},Qf={class:"j-table-panel-main"},ep={key:0,class:"j-table-panel-filter-panel"},ya=oe(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,highlightMode:{type:String,default:"row"}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=Je(),{openLayer:i}=In(),r=e,l=o;r.isMultiple&&!r.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=n.ref();let c=[];const d=n.ref(0),u=n.ref(1);let f=r.pageSize||100,h="";const m=n.ref([]),p=n.ref(!1),g=n.computed(()=>r.batchButtons&&r.batchButtons.length>0),y=n.computed(()=>m.value.length>0),x=n.computed(()=>g.value&&y.value&&r.isMultiple||p.value),b=n.computed(()=>r.isPage&&!x.value);g.value&&!r.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const w=K=>r.rowKey?r.rowKey.split(",").map(Ae=>K[Ae.trim()]).join("::"):"",C=(K,Q)=>{if(!Q||Q.length===0)return K.filter(Z=>Z.config?.display!==!1).map(Z=>Z.children&&Z.children.length>0?{...Z,children:C(Z.children)}:Z);const Ae=new Map(K.map(Z=>[Z.id,Z])),Oe=[];return Q.forEach(Z=>{const Re=Ae.get(Z.id);if(Re){if(Z.display){let Nn=Re;Re.children&&Re.children.length>0&&(Nn={...Re,children:C(Re.children,Z.children)}),Oe.push(Nn)}Ae.delete(Z.id)}}),K.forEach(Z=>{if(Ae.has(Z.id)&&Z.config?.display!==!1){let Re=Z;Z.children&&Z.children.length>0&&(Re={...Z,children:C(Z.children)}),Oe.push(Re)}}),Oe},_=n.computed(()=>C(r.columns,ye.value)),v=n.computed(()=>Ji(r.columns,K=>K.config.label)),j=n.ref(""),S=n.computed(()=>v.value.some(K=>K.config?.filter?.isSearchKeyword)),B=n.ref(),V=n.ref(!0),T=n.ref([]),L=n.computed(()=>V.value?"搜索全部":`搜索范围:${v.value.filter(K=>T.value.includes(K.id)).map(K=>K.config?.label).join("、")}`),F=()=>{B.value.init()},z=n.ref(),M=n.ref(!1),E=n.ref(!1),$=n.ref(!1),R=n.ref([]),Y=n.ref("and"),ee=n.ref(),se=n.ref(!1),de=n.ref([]),Me=()=>{ee.value.init(de.value)},D=K=>{de.value=K,se.value=!1,Ge()},fe=()=>{de.value=[],Ge()},ge=n.ref(),re=n.ref(!1),ye=n.ref(),je=n.computed(()=>ye.value!=null),U=()=>{ge.value?.init()},te=K=>{console.log("handleColumnSave:",K),ye.value=K,re.value=!1},ce=n.ref(!1),Ce=()=>{ce.value=!ce.value},He=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),p.value&&(p.value=!1,s.value.setRecords(c)))},Qe=()=>{p.value=!p.value,p.value?s.value?.setRecords(m.value):s.value?.setRecords(c),s.value?.setSelection?.(m.value)},ve=n.computed(()=>{if(m.value.length>0&&r.isMultiple){const K=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:p.value?"全部":"仅选中",config:{type:"text"},click:Qe},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:He}],Q=r.batchButtons.map(Ae=>({...Ae,click:()=>{Ae.click&&Ae.click({data:m.value,openLayer:i})}}));return[...K,...Q]}return r.buttons}),it=async()=>{const K={},Q={};Q.rel=Y.value;const Ae=z.value?.getSearchFields?.()||R.value;Q.cond=Ae.filter(Z=>Z.value!==void 0&&Z.value!==null&&Z.value!=="").map(Z=>({field:Z.field,method:Z.method,value:Z.value,type:Z.type})),Q.cond.length>0?$.value=!0:$.value=!1,K.filter=Q;const Oe=de.value.map(Z=>Z.value+" "+Z.sord).join(",");if(j.value&&(K.keyword={value:j.value,fields:V.value?v.value.filter(Z=>Z.config?.filter?.isSearchKeyword).map(Z=>Z.id):n.unref(T)}),r.loadData){if(r.isPage){K.pagination={rows:f,page:u.value,sort:Oe||h||r.sort||r.rowKey};const Z=await r.loadData(K)||{};c=Z.rows||[],d.value=Z.records||0}else K.sort=Oe,c=await r.loadData(K)||[],d.value=c.length;s.value.setRecords(c),g.value?(m.value=[],p.value=!1):r.rowKey&&m.value.length>0&&s.value?.setSelection?.(m.value)}},Ge=async()=>{u.value=1,await it()},ht=({rows:K,page:Q})=>{f=K,u.value=Q,it()},I=async()=>{m.value=[],p.value=!1,u.value=1,await it()},G=async()=>{m.value=[],p.value=!1,await it()},H=async()=>{await I()},W=K=>{l("ready",K)},q=K=>{let Q=[];if(!r.isMultiple){m.value=K,l("select",K);return}if(g.value)Q=K;else if(!r.rowKey)Q=K;else{const Ae=new Map(K.map(Z=>[w(Z),Z])),Oe=new Map(m.value.map(Z=>[w(Z),Z]));c.forEach(Z=>{const Re=w(Z);Ae.has(Re)?Oe.set(Re,Ae.get(Re)):Oe.delete(Re)}),Q=Array.from(Oe.values())}m.value=Q,l("select",Q),p.value&&Q.length===0?(p.value=!1,s.value&&s.value.setRecords(c)):p.value&&Q.length>0&&s.value&&(s.value.setRecords(Q),s.value.setSelection?.(Q))},ie=()=>m.value||[],ue=K=>{m.value=K,s.value?.setSelection?.(K)},he=()=>s.value?.getInstance?.();return n.onMounted(async()=>{r.immediate&&await G()}),t({refreshData:G,resetData:I,getSelection:ie,setSelection:ue,clearSelection:()=>{He()},getInstance:he}),(K,Q)=>{const Ae=n.resolveComponent("j-buttons"),Oe=n.resolveComponent("j-icon"),Z=n.resolveComponent("el-popover"),Re=n.resolveComponent("el-tooltip"),Nn=n.resolveComponent("el-input"),rn=n.resolveComponent("j-button"),_i=n.resolveComponent("j-table");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["j-table-panel-wrapper",{fullscreen:ce.value,"no-padding":e.noPadding||ce.value}])},[n.createElementVNode("div",{class:n.normalizeClass(["j-table-panel",{"j-table-panel-fullscreen":ce.value}])},[n.createElementVNode("div",Yf,[n.createElementVNode("div",Gf,[n.createElementVNode("div",Kf,[n.createVNode(Ae,{list:ve.value},null,8,["list"])]),n.createElementVNode("div",Xf,[S.value&&!x.value?(n.openBlock(),n.createElementBlock("div",Zf,[n.createVNode(Nn,{modelValue:j.value,"onUpdate:modelValue":Q[2]||(Q[2]=O=>j.value=O),modelModifiers:{trim:!0},placeholder:n.unref(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:n.withKeys(Ge,["enter"]),onClear:Ge},{prefix:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:search"})]),suffix:n.withCtx(()=>[n.createVNode(Re,{placement:"bottom",content:L.value},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:F,onHide:Ge},{reference:n.withCtx(()=>[n.createVNode(Oe,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:n.withCtx(()=>[n.createVNode(jf,{ref_key:"keywordPanelRef",ref:B,"check-all":V.value,"onUpdate:checkAll":Q[0]||(Q[0]=O=>V.value=O),"check-fields":T.value,"onUpdate:checkFields":Q[1]||(Q[1]=O=>T.value=O),columns:v.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):n.createCommentVNode("",!0),!M.value&&!x.value?(n.openBlock(),n.createBlock(Z,{key:1,visible:E.value,"onUpdate:visible":Q[6]||(Q[6]=O=>E.value=O),placement:"bottom","popper-style":"padding: 0",width:644,trigger:"click",persistent:!1,onHide:Ge},{reference:n.withCtx(()=>[n.createVNode(rn,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:n.normalizeClass({active:$.value})},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Wr,{ref_key:"filterPanelRef",ref:z,"is-pin":M.value,"onUpdate:isPin":Q[3]||(Q[3]=O=>M.value=O),relation:Y.value,"onUpdate:relation":Q[4]||(Q[4]=O=>Y.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ge,onClose:Q[5]||(Q[5]=O=>E.value=!1)},null,8,["is-pin","relation","search-field-list","columns"])]),_:1},8,["visible"])):n.createCommentVNode("",!0),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:2,placement:"bottom",content:n.unref(a)("排序")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:se.value,"onUpdate:visible":Q[7]||(Q[7]=O=>se.value=O),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Me},{reference:n.withCtx(()=>[n.createVNode(rn,{class:n.normalizeClass({active:de.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(Ff,{ref_key:"orderPanelRef",ref:ee,columns:v.value,onSave:D,onClear:fe},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:3,placement:"bottom",content:n.unref(a)("显示字段")},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(Z,{visible:re.value,"onUpdate:visible":Q[8]||(Q[8]=O=>re.value=O),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:U},{reference:n.withCtx(()=>[n.createVNode(rn,{class:n.normalizeClass({active:je.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:n.withCtx(()=>[n.createVNode(qf,{ref_key:"columnPanelRef",ref:ge,columns:e.columns,"column-config":ye.value,onSave:te},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])),x.value?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:4,placement:"bottom",content:n.unref(a)("刷新")},{default:n.withCtx(()=>[n.createVNode(rn,{type:"text",icon:"mdi:refresh",onClick:H})]),_:1},8,["content"])),n.createVNode(Re,{placement:"bottom",content:ce.value?n.unref(a)("退出全屏"):n.unref(a)("全屏")},{default:n.withCtx(()=>[n.createVNode(rn,{type:"text",icon:ce.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Ce},null,8,["icon"])]),_:1},8,["content"])])]),n.createElementVNode("div",Qf,[n.createVNode(_i,{ref_key:"tableRef",ref:s,"table-page":u.value,"onUpdate:tablePage":Q[9]||(Q[9]=O=>u.value=O),columns:_.value,records:n.unref(c),"is-tree":e.isTree,"is-show-number":e.isShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"is-page":b.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,"highlight-mode":e.highlightMode,onLoadPageData:ht,onReady:W,onSelectionChanged:q},null,8,["table-page","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","highlight-mode"])])]),M.value&&!x.value?(n.openBlock(),n.createElementBlock("div",ep,[n.createVNode(Wr,{ref_key:"filterPanelRef",ref:z,"is-pin":M.value,"onUpdate:isPin":Q[10]||(Q[10]=O=>M.value=O),relation:Y.value,"onUpdate:relation":Q[11]||(Q[11]=O=>Y.value=O),"search-field-list":R.value,columns:v.value,onFilter:Ge},null,8,["is-pin","relation","search-field-list","columns"])])):n.createCommentVNode("",!0)],2)],2)}}})),tp={class:"j-button-select"},np={class:"search-wraper"},op={class:"options-wraper"},ap=["onClick"],Ur=oe(n.defineComponent({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:i}=Je(),r=n.ref(""),l=n.computed(()=>r.value===""?o.options:o.options.filter(d=>(d.label||"").includes(r.value))),s=n.computed(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),c=d=>{if(d.disabled||s.value.includes(d.value))return;const f=[...s.value,d.value].join(",");a("update:modelValue",f),a("change",{value:f,data:d})};return(d,u)=>{const f=n.resolveComponent("j-button"),h=n.resolveComponent("j-icon"),m=n.resolveComponent("el-input"),p=n.resolveComponent("el-popover");return n.openBlock(),n.createBlock(p,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:n.withCtx(()=>[n.createVNode(f,{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",tp,[n.createElementVNode("div",np,[n.createVNode(m,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=g=>r.value=g),modelModifiers:{trim:!0},placeholder:n.unref(i)("搜索"),class:"no-border",clearable:""},{prefix:n.withCtx(()=>[n.createVNode(h,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),n.createElementVNode("div",op,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.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(y=>c(g),["stop"])},[g.icon?(n.openBlock(),n.createBlock(h,{key:0,class:"j-button-select-icon",icon:g.icon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(i)(g.label)),1)],10,ap))),128))])])]),_:1},8,["width"])}}})),ip={class:"j-tree-item-text"},rp={key:2,class:"j-tree-item-button-group"},lp={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Jr=oe(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 a=e,i=o,{useData:r,t:l}=Je(),{getTreeData:s,loadData:c}=r(),d=n.ref(),u=n.ref(!1),f=n.ref(""),h=n.ref([]),m={children:"children",label:"label",disabled:"disabled"},p=n.computed(()=>s?s({dataType:a.dataType,dataCode:a.dataCode,labelKey:a.labelKey,valueKey:a.valueKey,pidKey:a.pidKey,idKey:a.idKey,notLoad:!0})||[]:[]),g=n.computed(()=>a.dataCode||a.dataType?p.value:a.list?n.unref(a.list):h.value),y=async()=>{u.value=!0,a.loadData&&(h.value=await a.loadData()||[]),c&&await c(a.dataType,a.dataCode),u.value=!1,n.nextTick(()=>{a.afterLoadData&&a.afterLoadData(g.value||[])})},x=(z,M=!0)=>{d.value?.setCurrentKey(z,M)},b=()=>d.value?.getCurrentKey(),w=(z,M=!1)=>{d.value?.setCheckedKeys(z,M)},C=(z=!1)=>d.value?.getCheckedKeys(z),_=async(z,M,E,$)=>{if(f.value=z.value,a.nodeClickFlow&&a.runFlow){const R=JSON.parse(a.nodeClickFlow);await a.runFlow(R,{value:z.value})}a.click&&a.click(z.value,z,$)},v=(z,{checkedKeys:M,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})=>{a.check&&a.check(M,{node:z,checkedNodes:E,halfCheckedKeys:$,halfCheckedNodes:R})},j=(z,M,E,$)=>{i("node-drop",z,M,E,$)},S=z=>{const M=gt(a.treeButtons);return z&&a.filterButton?a.filterButton({buttons:M,node:z}):M},{openLayer:B}=In(),V=(z,M)=>{z.config?.disabled||z.click&&z.click({data:M,openLayer:B})},T=n.ref(""),L=(z,M)=>{T.value=z?M.value:"",console.log(T.value,"row")},F=(z,M,E)=>a.allowDrop?a.allowDrop(z,M,E):!(E=="inner"&&!M.data.canInner);return n.onMounted(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await y()}),n.watch(()=>a.list,()=>{u.value=!0,n.nextTick(()=>{u.value=!1})}),n.watch(()=>a.dataCode||a.dataType,()=>{y()}),t({refreshData:y,setValue:x,getValue:b,setCheck:w,getCheck:C}),(z,M)=>{const E=n.resolveComponent("j-icon"),$=n.resolveComponent("j-button"),R=n.resolveComponent("el-dropdown-item"),Y=n.resolveComponent("el-dropdown-menu"),ee=n.resolveComponent("el-dropdown"),se=n.resolveComponent("el-tree"),de=n.resolveComponent("el-empty"),Me=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"}},[!u.value&&g.value.length>0?(n.openBlock(),n.createBlock(se,{key:0,ref_key:"treeRef",ref:d,"node-key":e.idKey||e.valueKey,"default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":f.value,data:g.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:m,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":F,"expand-on-click-node":e.expandOnClickNode,onNodeClick:_,onCheck:v,onNodeDrop:j},{default:n.withCtx(({node:D})=>[n.createElementVNode("div",{class:n.normalizeClass(["j-tree-item-wraper",{"is-focus":T.value===D.data.value}])},[D.data.openIcon?(n.openBlock(),n.createBlock(E,{key:0,class:"j-tree-item-open-icon",size:18,icon:D.data.openIcon,color:D.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),D.data[e.iconKey]||e.defaultIcon?(n.openBlock(),n.createBlock(E,{key:1,class:"j-tree-item-default-icon",size:18,icon:D.data[e.iconKey]||e.defaultIcon||"",color:D.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):n.createCommentVNode("",!0),n.createElementVNode("div",ip,n.toDisplayString(D.label),1),S(D.data).length?(n.openBlock(),n.createElementBlock("div",rp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S(D.data),(fe,ge)=>(n.openBlock(),n.createBlock(ee,{key:ge,trigger:"click",onVisibleChange:re=>L(re,D.data)},{dropdown:n.withCtx(()=>[n.createVNode(Y,null,{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(fe.children,(re,ye)=>(n.openBlock(),n.createBlock(R,{key:ye,disabled:re.disabled,divided:re.divided,onClick:n.withModifiers(je=>V(re,D.data),["stop"])},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"j-flex-item",style:n.normalizeStyle({color:re.danger?"var(--j-color-danger)":re.color||e.buttonIconColor||"var(--j-color-text-2)"})},[re.icon||e.buttonDefaultIcon?(n.openBlock(),n.createBlock(E,{key:0,icon:re.icon||e.buttonDefaultIcon},null,8,["icon"])):n.createCommentVNode("",!0),n.createElementVNode("div",null,n.toDisplayString(n.unref(l)(re.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:n.withCtx(()=>[n.createVNode($,{icon:fe.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",lp,[n.createVNode(de,{description:n.unref(l)(e.emptyDes)},null,8,["description"])]))],2)),[[Me,u.value]])}}})),Dr=oe(yr),sp=Ed;async function cp(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const i=new sp({[e]:[a]});let r=[];try{await i.validate({[e]:t})}catch(l){l.errors?r=l.errors.map(({message:s})=>s):r=[a.message||"校验错误"]}return r.length>0?r[0]:""}async function dp(e,t,o){const a=o.map((i,r)=>({...i,ruleIndex:r})).sort(({warningOnly:i,ruleIndex:r},{warningOnly:l,ruleIndex:s})=>!!i==!!l?r-s:i?1:-1);for(let i=0;i<a.length;i+=1){const r=a[i];"pattern"in r&&(t+="");const l=await cp(e,t,r);if(l!=="")return{name:e,errors:l}}}function up(e,t){const o=(r,l,s,c,d)=>{Object.keys(l).forEach(u=>{let f=u;s&&(f=`${s}.${u}`);const h=l[u],{rules:m,myGridtableId:p}=t(f,s?l:void 0,()=>c,d);if(m.length){const g=a(f,h,m);r.push(g)}p&&h.forEach(g=>{o(r,g,p,h,s?l:void 0)})})},a=(r,l,s)=>dp(r,l,s);return{validateForm:async()=>{const r=n.unref(e),l=[];o(l,r,"");const s=await Promise.all(l),c={};return s.forEach(d=>{d&&(c[d.name]={msg:d.errors})}),c},validateField:a}}const qr=oe(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 a=e,i=o,{useData:r,existField:l,httpGet:s,httpPost:c,success:d,warning:u,error:f,info:h,t:m}=Je();let p;r&&(p=r());const g=I=>{f&&f(I)},y=n.ref(!1),x=n.computed(()=>a.config?.gutter||16),b=n.computed(()=>a.config?.span||24),w=n.computed(()=>a.config?.labelWidth),C=n.computed(()=>a.config?.labelPosition||"right"),_=n.computed(()=>S.length===1&&(S[0].type==="j-tabs"||S[0].type==="j-layout"||S[0].config?.isAutoWindow)),v=n.reactive({}),j=n.ref({}),S=[],B={},V=n.ref({});let T={},L={},F=[],z={};const M=I=>{i("change",I)},E=I=>ho(B[I]?.type||"")&&!B[I]?.config?.notInput||B[I]?.config?.isInput,$=I=>["j-table","j-input-rows","j-input-cards"].includes(B[I]?.type||"");let R;const Y=(I,G)=>{Object.keys(I).forEach(H=>{const W=I[H];G&&(H=G+"."+H),W!=null&&typeof W=="object"&&!co(W)&&Y(W,H),v[H]=W})},ee=(I,G)=>{let H=I.id;return H||(I.config?.table&&I.config?.field?H=`${I.config.table}.${I.config.field}`:I.config?.table?H=I.config?.table:I.config?.field&&(H=I.config?.field),G&&$(G)&&(H=`${G}.${H}`)),H||po("j")},se=(I,G,H,W="")=>{I.forEach(q=>{q.id=ee(q,W);const ie={id:q.id,slot:q.slot,type:q.type||"",getCompType:q.getCompType,getCompConfig:q.getCompConfig,config:{},children:[]};G.push(ie);const{children:ue}=q;fo(ie,q,["children","config"]),fo(ie.config,q.config||{},[]),B[q.id]&&console.warn("有重复的组件id:"+q.id),B[q.id]=ie,a.readonly===!0&&(ie.config.readonly=!0);let he=!1,We;W!==""&&$(W)&&(he=!0,ie.config=q.config||{},ie.config.parentTableId=W,We=B[W]?.config?.table);const K=ie.config||{};if(E(q.id))!H&&he===!1&&(K?.defaultValue===0?v[q.id]=K?.defaultValue:v[q.id]=K?.defaultValue||void 0),K.table&&K.field?T[`${K.table}_${K.field}`.toLowerCase()]=q.id:K.field&&(he?T[`${We}_${K.field}`.toLowerCase()]=q.id:T[`${K.field}`.toLowerCase()]=q.id);else if(he&&K.field)T[`${We}_${K.field}`.toLowerCase()]=q.id;else if($(q.id))!H&&!K.isSubTable&&(v[q.id]=[]),K.table&&(T[K.table.toLowerCase()||""]=q.id),K.isSubTable||F.push(ie);else if(K?.defaultValue)v[q.id]=K?.defaultValue;else if(q.type==="collapse"&&K?.isExpand){const Q=[];(K?.groups||[]).forEach(Ae=>{Q.push(Ae.i)}),v[q.id]=Q}ue&&ue.length>0&&se(ue,ie.children,H,ie.id)})},de=async(I,G)=>{y.value=!1;const H=!!G;S.splice(0,S.length),T={},L={},F=[],R=G,On(v),V.value={},H&&Y(G,""),se(I,S,H),z=gt(v),n.nextTick(()=>{y.value=!0,n.nextTick(()=>{Ge(a.config?.codeInit,{})})})},Me=(I,G,H)=>{const W=[];return G.forEach(q=>{const ie={};Object.keys(q).forEach(ue=>{if(!H||H(ue,q[ue],I)){const he=ce(ue);if(he?.type==="j-table")ie[he?.id||""]=Me(ue,q[ue],H);else{let We=T[`${I}_${ue}`.toLowerCase()]||ue;We=We.indexOf(".")!==-1?We.split(".")[1]:We,ie[We]=q[ue]}}}),W.push(ie)}),W},D=(I,G)=>{Object.keys(I||{}).forEach(H=>{let W=I[H];const q=ce(H);if(q===void 0)W&&(co(W)&&(W=W[0]||{}),typeof W=="object"?Object.keys(W).forEach(ie=>{if(!G||G(H,W[ie],H)){let ue=ie;H!=="main"&&(ue=`${H}_${ie}`),L[ue]=H,v[T[ue.toLowerCase()]||ie]=W[ie]}}):v[H]=W);else if($(q.id||"")){if(!Array.isArray(W)){console.warn("表格数据不是数组:"+H);return}W?.length>0?v[T[H.toLowerCase()]||H]=Me(H,W,G):v[T[H.toLowerCase()]||H]=[]}else(!G||G(H,W,H))&&(v[T[H.toLowerCase()]||H]=W)}),R&&Object.keys(v).forEach(H=>{const W=ce(H);(W===void 0||!["tabs","collapse"].includes(W.type||""))&&Ri(R,H,v[H])})},fe=(I,G=!1)=>{const H={};return Object.keys(I).forEach(W=>{if(W==="parentRow")return;const q=B[W];if(q){const ie=q.config?.table,ue=q.config?.field;if(G)ue?H[ue]=I[W]:H[W]=I[W];else if($(W)){const he=[];I[W].forEach(We=>{he.push(fe(We,!0))}),H[ie||W]=he}else ie&&ue?(H[ie]=H[ie]||{},H[ie][ue]=I[W]):ue&&(H[ue]=I[W])}else G?W!=="_X_ROW_KEY"&&W!=="_isHover"&&(H[W]=I[W]):L[W]?(H[L[W]]=H[L[W]]||{},H[L[W]][W.replace(`${L[W]}_`,"")]=I[W]):H[W]=I[W]}),H},ge=(I=!0)=>I?fe(v):v,re=(I,G,H,W)=>{let q=B[I];if(q==null){const ue=I.split(".");q=B[ue[ue.length-1]]||{}}if(!q)return{};const ie=Jt({config:{...q.config||{},...V.value[q.id]||{}},getCompConfig:q.getCompConfig,formData:v,getTableData:H,row:G,pRowData:W});return ie._componentId=q?.id,ie},ye=(I,G,H,W)=>{const q=re(I,G,H,W);if(q.isNotRule!==!0&&q.display!==!1){const ie=q.rule||[],ue=ie.find(he=>he.type==="only");return ue&&(ue.validator=async(he,We)=>{if(We){const K={table:he.table,key:he.key,keyName:he.keyName,field:he.field,keyValue:he.getKeyValue?he.getKeyValue():"",value:We,paramNames:he.paramNames,getParams:he.getParams,withProjectId:he.withProjectId,getValue:he.getValue,formData:v};if(!await l(K))throw m(he.message)||m("数据值重复")}}),{rules:ie,myGridtableId:$(q._componentId)?q._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:je}=up(v,ye),U=async()=>{j.value={};const I=await je();return Object.keys(I).length>0?(j.value=I,g(`${m(B[Object.keys(I)[0]]?.config?.label)}:${m(I[Object.keys(I)[0]].msg)}`),!1):!0},te=()=>{j.value={},On(v),Object.keys(z||{}).forEach(I=>{v[I]=z[I]})},ce=I=>{let G=B[I];return G===void 0&&T[I.toLowerCase()]&&(G=B[T[I.toLowerCase()]]),G},Ce=({id:I,i:G,value:H,type:W})=>{if(W==="add")v[I].push(H);else if(W==="delete")v[I].splice(G,1);else{const q=ce(I);q&&(q.config.parentTableId?v[q.config.parentTableId][G][I]=H:v[I]=H)}},He=({id:I,i:G})=>{const H=ce(I);if(H){if(H.config.parentTableId){const W=v[H.config.parentTableId],q=H.id?H.id.replace(`${H.config.parentTableId}.`,""):"";if(G!=null)return(W[G]||{})[q||""];const ie=[];return W&&W.forEach(ue=>{ie.push(ue[q||""])}),ie}if($(H.id||"")){const W=[];return v[H.id||""].forEach(q=>{W.push(fe(q,!0))}),W}return v[H.id||""]}if(v[I])return v[I]},Qe=async({id:I,i:G})=>{const H=He({id:I,i:G}),W=ce(I);if(W&&p?.getLabel)if(G!==void 0){const q=H[G],ie=v[W.config.parentTableId||""][G],ue=Jt({config:W.config,getCompConfig:W.getCompConfig,formData:v,tableData:v[W.config.parentTableId||""],row:ie});return await p?.getLabel({value:q,config:ue,formData:v,tableData:v[W.config.parentTableId||""],row:ie})}else{const q=Jt({config:W.config,getCompConfig:W.getCompConfig,formData:v});return await p?.getLabel({value:H,config:q,formData:v})}return H},ve=async(I,G)=>p?.loadViewDataList?await p?.loadViewDataList(I,G,!1):[],it=I=>(I.set=Ce,I.get=He,I.setFormData=D,I.getFormData=ge,I.getLabel=Qe,I.getViewData=ve,I.getDateNow=G=>Yi(new Date,G||"YYYY-MM-DD HH:mm:ss"),I.httpGet=s||(()=>{console.log("当前状态不支持")}),I.httpPost=c||(()=>{console.log("当前状态不支持")}),I.loading=G=>{dn(G)},I.showMsg=({text:G,type:H})=>{switch(H){case"success":d&&d(G);break;case"warning":u&&u(G);break;case"error":f&&f(G);break;case"info":h&&h(G);break;default:h&&h(G);break}console.log("showMsg",G,H)},I),Ge=async(I,G)=>{if(I&&I.trim()){I=`async (jcode) => {${I}}`;const{res:H,fn:W}=da(I);H&&await W(it(G))}},ht=(I,G)=>{V.value[I]={...V.value[I]||{},...G}};return a.schema&&de(a.schema),nr({formData:v,compsConfig:V,errorFields:j,isAutoWindow:_,gutter:x,span:b,labelWidth:w,labelPosition:C,getValue:He,formChange:M}),or({contextType:"form"}),t({init:de,reset:te,validate:U,setValue:Ce,getValue:He,getLabel:Qe,setFormData:D,getFormData:ge,setCompConfig:ht}),(I,G)=>{const H=n.resolveComponent("j-form-item"),W=n.resolveComponent("el-row"),q=n.resolveComponent("el-form");return y.value?(n.openBlock(),n.createBlock(q,{key:0,class:n.normalizeClass([{"j-block":e.isAutoSize},{"j-form-auto":e.isAutoSize},"j-form"]),"label-position":C.value,"label-width":w.value,size:e.config?.size,onSubmit:G[0]||(G[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[_.value?(n.openBlock(),n.createBlock(H,n.mergeProps({key:0},S[0],{"is-not-col":""}),null,16)):(n.openBlock(),n.createBlock(W,{key:1,gutter:x.value},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(S,ie=>n.createVNode(H,n.mergeProps({key:ie.id,ref_for:!0},ie),null,16)),64))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):n.createCommentVNode("",!0)}}})),Yr=oe(gr),fp={class:"j-page"},Gr=oe(n.defineComponent({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=n.ref(!1),i=n.reactive([]),r={},l=n.reactive({}),s=new pa,c=new Map,d=(p,g,y,...x)=>{const b=`${p}:${g}`;return y?.immediate&&c.set(b,x),s.emit(b,...x)},u=(p,g,y)=>{const x=`${p}:${g}`;s.on(x,y);const b=c.get(x);b&&(c.delete(x),y(...b))},f=(p,g,y)=>{const x=`${p}:${g}`;c.delete(x),s.off(x,y)},h=(p,g)=>{p.forEach(y=>{y.id=y.id||po("c");const x={id:y.id,slot:y.slot,type:y.type,config:{},children:[]},{children:b}=y;r[y.id]=x,fo(x.config,y.config||{},["defaultValue"]),y?.config?.defaultValue!==void 0&&(l.value[y.id]=y.config.defaultValue),g.push(x),b&&b.length>0&&h(b,x.children)})},m=p=>{a.value=!1,i.splice(0,i.length),On(r),On(l),h(p,i),n.nextTick(()=>{a.value=!0})};return o.schema&&m(o.schema),Qd({registerMethod:(p,g,y)=>(u(p,g,y),()=>{f(p,g,y)})}),or({contextType:"page"}),t({init:m,call:d,on:u,off:f}),(p,g)=>{const y=n.resolveComponent("j-comp");return n.openBlock(),n.createElementBlock("div",fp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i,x=>(n.openBlock(),n.createBlock(y,{key:x.id,id:x.id,type:x.type,config:x.config,children:x.children},null,8,["id","type","config","children"]))),128))])}}})),Kr=oe(n.defineComponent({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,i=n.ref("");return n.watch(()=>o.modelValue,r=>{r?i.value=r:(i.value=Ut(),a("update:modelValue",i.value))},{immediate:!0}),(r,l)=>{const s=n.resolveComponent("el-input");return n.openBlock(),n.createBlock(s,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=c=>i.value=c),readonly:"",size:e.size},null,8,["modelValue","size"])}}})),pp={class:"j-input-rows"},hp={key:0,class:"j-input-rows-num"},mp={key:1,class:"j-input-rows-char"},Xr=oe(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,a=e,i=t,{formData:r}=mn(),l=n.computed(()=>a.editConfig.isAddBtn!==!1),s=n.computed(()=>a.editConfig.addBtnText||"添加"),c=n.computed(()=>a.editConfig.buttonsAlign||"left"),d=n.computed(()=>a.editConfig.isRemoveBtn!==!1),u=n.computed(()=>a.editConfig.readonly),f=n.computed(()=>a.editConfig.drag),h=n.computed(()=>a.editConfig.isNullValue!==!1),m=n.ref(),p=["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([]);a.modelValue&&a.modelValue.length>0?(g.value=a.modelValue||[],g.value.forEach(C=>{C._i||(C._i=Ut())})):(g.value=[],i("update:modelValue",g.value)),n.watch(()=>a.modelValue,C=>{g.value=a.modelValue||[],g.value=C||[],g.value.forEach(_=>{_._i||(_._i=Ut())})},{deep:!0});const x=()=>{const C={_i:Ut()};a.columns.forEach(_=>{const v=_.config?.valueRowKey||_.id||"";v&&(C[v]=gt(_.config?.defaultValue))}),g.value.push(C),i("change",{id:a.id,value:C,data:C,formData:r,tableData:g.value,type:"add"})},b=C=>{const _=g.value[C];g.value.splice(C,1),i("change",{id:a.id,value:_,data:_,formData:r,tableData:g.value,type:"delete"})},w=C=>{i("rowChange",C)};return n.onMounted(()=>{if(!f.value||!m.value)return;const C=m.value,{initSortable:_}=er(C,{handle:".j-input-rows-drag",onEnd:v=>{const{oldIndex:j,newIndex:S}=v;if(o(j)||o(S)||j===S||j<0||S<0)return;const B=g.value.splice(j,1)[0];g.value.splice(S,0,B),i("change",{id:a.id,value:B,data:B,formData:r,tableData:g.value,type:"sort"})}});_()}),ha({getTableData:()=>g.value,rowChange:w}),(C,_)=>{const v=n.resolveComponent("j-comp"),j=n.resolveComponent("j-icon"),S=n.resolveComponent("j-button");return n.openBlock(),n.createElementBlock("div",pp,[n.createElementVNode("div",{ref_key:"inputRowsRef",ref:m,class:"j-input-rows-container"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(B,V)=>(n.openBlock(),n.createElementBlock("div",{key:B._i+V,class:n.normalizeClass([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?(n.openBlock(),n.createElementBlock("div",hp,n.toDisplayString(V+1),1)):n.createCommentVNode("",!0),e.showChar?(n.openBlock(),n.createElementBlock("div",mp,n.toDisplayString(p[V%26]),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.columns,T=>(n.openBlock(),n.createBlock(v,n.mergeProps({key:T.id,ref_for:!0},T,{row:B}),null,16,["row"]))),128)),f.value?(n.openBlock(),n.createBlock(j,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):n.createCommentVNode("",!0),d.value&&(h.value||g.value.length>1)&&!u.value?(n.openBlock(),n.createBlock(j,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:T=>b(V)},null,8,["onClick"])):n.createCommentVNode("",!0)],2))),128))],512),!u.value&&l.value?(n.openBlock(),n.createElementBlock("div",{key:0,style:n.normalizeStyle({"text-align":c.value}),class:"j-input-rows-actions"},[l.value?(n.openBlock(),n.createBlock(S,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:x},null,8,["label"])):n.createCommentVNode("",!0)],4)):n.createCommentVNode("",!0)])}}})),gp={class:"j-input-layer"},Zr=oe(n.defineComponent({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchInputList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=p=>!!(p==null||typeof p=="string"&&p.trim()===""||Array.isArray(p)&&p.length===0),a=e,i=t,r=n.ref(),l=n.ref(),s=n.ref(""),c=n.computed({get(){return a.modelValue},set(p){i("update:modelValue",p)}}),d=n.computed({get(){return o(c.value)?"":o(s.value)?a.getText?a.getText(c.value):c.value:s.value},set(p){p||f()}});n.watch(()=>a.modelValue,()=>{s.value=""});const u=async()=>{a.readonly||a.beforeOpen&&await a.beforeOpen()===!1||r.value.open()},f=()=>{s.value="",c.value="",i("change",{value:"",data:void 0})},h=async()=>{if(!l.value)return;const p=l.value.getSelection();if(a.isMultiSelect){const g=[],y=[];p.forEach(x=>{const b=x[a.labelKey],w=x[a.valueKey];g.push(b!=null?String(b):""),w===0||w?y.push(String(w)):y.push("")}),s.value=g.join(","),c.value=y.join(","),i("change",{value:y.join(","),data:p})}else if(p.length>0){const g=p[0],y=g[a.labelKey],x=g[a.valueKey];s.value=y!=null?String(y):"";const b=x!=null?String(x):"";c.value=b,i("change",{value:b,data:g})}else s.value="",c.value="",i("change",{value:"",data:void 0});console.log(r.value.close,"layerRef.value.close"),r.value.close()},m=()=>{l.value&&l.value.clearSelection&&l.value.clearSelection()};return(p,g)=>{const y=n.resolveComponent("el-input");return n.openBlock(),n.createElementBlock("div",gp,[e.onlyButton?(n.openBlock(),n.createBlock(n.unref(uo),{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,onClick:u},null,8,["type","size","label","icon"])):(n.openBlock(),n.createBlock(y,{key:0,modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=x=>d.value=x),placeholder:e.placeholder,readonly:!0,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:f},n.createSlots({_:2},[e.readonly?void 0:{name:"append",fn:n.withCtx(()=>[n.createVNode(n.unref(uo),{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","size","clearable"])),n.createVNode(n.unref(ga),{ref_key:"layerRef",ref:r,title:e.title||e.placeholder,width:e.width,height:e.height,"btn-text":"确定",onOk:h,onClosed:m},{default:n.withCtx(()=>[n.createVNode(n.unref(ya),{ref_key:"tableRef",ref:l,columns:e.columns,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,immediate:!0},null,8,["columns","row-key","is-tree","is-page","sort","is-multiple","load-data"])]),_:1},8,["title","width","height"])])}}})),Qr=oe(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=mn(),{t:a}=Je(),i=n.computed(()=>t.formConfig?.gutter||16),r=n.computed(()=>t.formConfig?.span||24),l=n.computed(()=>t.formConfig?.labelWidth||o.labelWidth?.value),s=n.computed(()=>t.formConfig?.labelPosition||o.labelPosition?.value||"right"),c=n.computed(()=>t.schema?.length===1&&(t.schema?.[0]?.type==="j-tabs"||t.schema?.[0]?.type==="j-layout"||t.schema?.[0]?.config?.isAutoWindow)),d=n.ref(!1),u=()=>{d.value=!0};return nr({...o,isAutoWindow:c,gutter:i,span:r,labelWidth:l}),(f,h)=>{const m=n.resolveComponent("j-button"),p=n.resolveComponent("j-form-item"),g=n.resolveComponent("el-row"),y=n.resolveComponent("el-form"),x=n.resolveComponent("j-dialog");return n.openBlock(),n.createElementBlock("div",null,[n.createVNode(m,n.mergeProps(f.$attrs,{type:e.type,size:e.size,icon:e.icon,onClick:u}),null,16,["type","size","icon"]),n.createVNode(x,{visible:d.value,"onUpdate:visible":h[1]||(h[1]=b=>d.value=b),title:n.unref(a)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:n.withCtx(()=>[n.createVNode(y,{class:n.normalizeClass(["j-block","j-layer-form"]),"label-position":s.value,"label-width":l.value,size:e.formConfig?.size,onSubmit:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},{default:n.withCtx(()=>[c.value?(n.openBlock(),n.createBlock(p,n.normalizeProps(n.mergeProps({key:0},e.schema[0])),null,16)):(n.openBlock(),n.createBlock(g,{key:1,gutter:i.value},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.schema,b=>(n.openBlock(),n.createBlock(p,n.mergeProps({key:b.id,ref_for:!0},b),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["label-position","label-width","size"])]),_:1},8,["visible","title","height","width"])])}}})),el=oe(n.defineComponent({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,i=n.computed({get(){return o.modelValue},set(l){a("update:modelValue",l)}}),r=l=>{a("change",l)};return n.onMounted(()=>{o.autoFocus&&setTimeout(()=>{const l=i.value===o.activeValue?o.inactiveValue:o.activeValue;i.value=l,r(l)},100)}),(l,s)=>{const c=n.resolveComponent("el-switch");return n.openBlock(),n.createBlock(c,n.mergeProps(l.$attrs,{id:e.id,modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=d=>i.value=d),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,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:r}),n.createSlots({_:2},[l.$slots["active-action"]?{name:"active-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active-action")]),key:"0"}:void 0,l.$slots["inactive-action"]?{name:"inactive-action",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive-action")]),key:"1"}:void 0,l.$slots.active?{name:"active",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"active")]),key:"2"}:void 0,l.$slots.inactive?{name:"inactive",fn:n.withCtx(()=>[n.renderSlot(l.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}})),tl=oe(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,a=d=>{o("update:modelValue",d)},i=(d,u)=>{o("tab-click",d,u)},r=d=>{o("tab-change",d)},l=d=>{o("tab-remove",d)},s=()=>{o("tab-add")},c=(d,u)=>{o("edit",d,u)};return(d,u)=>{const f=n.resolveComponent("el-tabs");return n.openBlock(),n.createBlock(f,n.mergeProps(d.$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":a,onTabClick:i,onTabChange:r,onTabRemove:l,onTabAdd:s,onEdit:c}),{default:n.withCtx(()=>[n.renderSlot(d.$slots,"default")]),_:3},16,["model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}})),nl=oe(n.defineComponent({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=r=>{o("update:modelValue",r)},i=r=>{o("change",r)};return(r,l)=>{const s=n.resolveComponent("el-collapse");return n.openBlock(),n.createBlock(s,n.mergeProps(r.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:i,"onUpdate:modelValue":a}),{default:n.withCtx(()=>[n.renderSlot(r.$slots,"default")]),_:3},16,["model-value","accordion"])}}})),yp={class:"j-editor"},ol=oe(jr(n.defineComponent({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,i=n.ref(),r=n.ref(),l=n.shallowRef(),s=n.computed(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let c=!1;const d=f=>{if(!f)return"";let h=f;return o.apiUrl&&o.token&&(h=h.replace(/{learun_img_api}/g,`${o.apiUrl}/system/annexesfile/`).replace(/{learun_img_token}/g,`token=${o.token}`)),h},u=f=>{if(!f)return"";let h=f;if(o.apiUrl){const m=`${o.apiUrl}/system/annexesfile/`;h=h.split(m).join("{learun_img_api}"),o.token&&(h=h.split(`token=${o.token}`).join("{learun_img_token}"))}return h};return n.onMounted(()=>{const f={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};f.onChange=m=>{if(c)return;const p=m.getHtml(),g=u(p);a("update:value",g),a("change",{value:g})};const h=Mi.createEditor({selector:i.value,html:d(o.value),config:f,mode:"default"});l.value=h,Mi.createToolbar({editor:h,selector:r.value,mode:"default"})}),n.watch(()=>o.value,f=>{const h=l.value;if(h){const m=h.getHtml(),p=d(f);u(m)!==f&&(c=!0,h.setHtml(p),c=!1)}}),n.watch(()=>o.readonly,f=>{const h=l.value;h&&(f?h.disable():h.enable())}),n.onBeforeUnmount(()=>{const f=l.value;f?.destroy()}),(f,h)=>(n.openBlock(),n.createElementBlock("div",yp,[n.createElementVNode("div",{ref_key:"toolbarRef",ref:r,class:"j-editor-toolbar"},null,512),n.createElementVNode("div",{ref_key:"editorRef",ref:i,class:"j-editor-content",style:n.normalizeStyle(s.value)},null,4)]))}}),[["__scopeId","data-v-179ac616"]])),vp={key:0,class:"j-map-loading"},bp=oe(n.defineComponent({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(!0),l=n.ref();let s=null,c=null,d=null,u=null;const f=async()=>{r.value=!0;try{s=await tr(a.mapKey)}catch(x){console.error("Failed to load Baidu Map:",x),r.value=!1;return}if(c!=null){m(a.lng,a.lat),r.value=!1;return}if(!l.value)return;c=new s.Map(l.value,{enableMapClick:!1});const y=new s.Point(121.480248,31.236276);c.centerAndZoom(y,17),d=new s.Marker(y,{enableDragging:!0}),c.addOverlay(d),d.addEventListener("dragend",x=>{h(x.point)}),c.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),u=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),u.addEventListener("locationSuccess",x=>{h(x.point)}),u.addEventListener("locationError",x=>{alert(x.message)}),c.addControl(u),c.addEventListener("click",x=>{h(x.point)}),c.enableScrollWheelZoom(!0),m(a.lng,a.lat),r.value=!1},h=y=>{new s.Geocoder().getLocation(y,b=>{d.setPosition(y),c.panTo(y),i("update:address",b.address),i("update:lng",y.lng),i("update:lat",y.lat),i("change",{value:{address:b.address,lng:y.lng,lat:y.lat}})})},m=(y,x)=>{if(y&&x&&s){const b=new s.Point(y,x);d&&d.setPosition(b),c&&c.panTo(b)}};let p=null;return t({setPoint:m,querySearchAsync:(y,x)=>{!c||!s||(p||(p=new s.LocalSearch(c,{onSearchComplete:b=>{const w=[];if(b){const C=b.getCurrentNumPois();for(let _=0;_<C;_++)w.push(b.getPoi(_))}x(w)}})),p.search(y))}}),n.onMounted(()=>{f()}),(y,x)=>(n.openBlock(),n.createElementBlock("div",{class:"j-map",style:n.normalizeStyle({height:e.height})},[r.value?(n.openBlock(),n.createElementBlock("div",vp,[n.createVNode(Wt,{icon:"mdi:loading",class:"is-loading",size:30})])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref_key:"mapRef",ref:l,class:"j-map-container"},null,512)],4))}}));function al(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function gn(e){return e.originalEvent||e.srcEvent}function va(e){al(e),al(gn(e))}function yn(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 il=1500;function rl(e,t,o){var a=this,i=o.get("dragging",!1);function r(l){if(!l.hover){var s=l.originalEvent,c=a._findTargetGfx(s),d=c&&e.get(c);c&&d&&(l.stopPropagation(),i.hover({element:d,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(l){t.once("drag.move",il,function(s){r(s)})}),(function(){var l,s;t.on("element.hover",function(c){l=c.gfx,s=c.element}),t.on("element.hover",il,function(c){s&&t.fire("element.out",{element:s,gfx:l})}),t.on("element.out",function(){l=null,s=null})})(),this._findTargetGfx=function(l){var s,c;if(l instanceof MouseEvent)return s=yn(l),c=document.elementFromPoint(s.x,s.y),xp(c)}}rl.$inject=["elementRegistry","eventBus","injector"];function xp(e){return A.closest(e,"svg, .djs-element",!0)}const wp={__init__:["hoverFix"],hoverFix:["type",rl]};function ll(){return/mac/i.test(navigator.platform)}function sl(e,t){return(gn(e)||e).button===t}function Et(e){return sl(e,0)}function Cp(e){return sl(e,1)}function cl(e){var t=gn(e)||e;return Et(e)?ll()?t.metaKey:t.ctrlKey:!1}function ba(e){var t=gn(e)||e;return Et(e)&&t.shiftKey}function zn(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function kp(e){return["M",e.x,e.y]}function xa(e){return["L",e.x,e.y]}function Ep(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function _p(e,t){const o=e.length,a=[kp(e[0])];for(let i=1;i<o;i++){const r=e[i-1],l=e[i],s=e[i+1];if(!s||!t){a.push(xa(l));continue}const c=Math.min(t,wa(l.x-r.x,l.y-r.y),wa(s.x-l.x,s.y-l.y));if(!c){a.push(xa(l));continue}const d=vo(l,r,c),u=vo(l,r,c*.5),f=vo(l,s,c),h=vo(l,s,c*.5);a.push(xa(d)),a.push(Ep(u,h,f))}return a}function vo(e,t,o){const a=t.x-e.x,i=t.y-e.y,r=wa(a,i),l=o/r;return{x:e.x+a*l,y:e.y+i*l}}function wa(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ca(e,t,o){k.isNumber(t)&&(o=t,t=null),t||(t={});const a=P.create("path",t);return k.isNumber(o)&&(a.dataset.cornerRadius=String(o)),dl(a,e)}function dl(e,t){const o=parseInt(e.dataset.cornerRadius,10)||0;return P.attr(e,{d:zn(_p(t,o))}),e}function Sp(e){return!0}function bo(e){return Et(e)||Cp(e)}var ul=500;function fl(e,t,o){var a=this;function i(S,B,V){if(!s(S,B)){var T,L,F;V?L=t.getGraphics(V):(T=B.delegateTarget||B.target,T&&(L=T,V=t.get(L))),!(!L||!V)&&(F=e.fire(S,{element:V,gfx:L,originalEvent:B}),F===!1&&(B.stopPropagation(),B.preventDefault()))}}var r={};function l(S){return r[S]}function s(S,B){var V=d[S]||Et;return!V(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},d={"element.contextmenu":Sp,"element.mousedown":bo,"element.mouseup":bo,"element.click":bo,"element.dblclick":bo};function u(S,B,V){var T=c[S];if(!T)throw new Error("unmapped DOM event name <"+S+">");return i(T,B,V)}var f="svg, .djs-element";function h(S,B,V,T){var L=r[V]=function(F){i(V,F)};T&&(d[V]=T),L.$delegate=A.delegate.bind(S,f,B,L)}function m(S,B,V){var T=l(V);T&&A.delegate.unbind(S,B,T.$delegate)}function p(S){k.forEach(c,function(B,V){h(S,V,B)})}function g(S){k.forEach(c,function(B,V){m(S,V,B)})}e.on("canvas.destroy",function(S){g(S.svg)}),e.on("canvas.init",function(S){p(S.svg)}),e.on(["shape.added","connection.added"],function(S){var B=S.element,V=S.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:V})}),e.on(["shape.changed","connection.changed"],ul,function(S){var B=S.element,V=S.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:V})}),e.on("interactionEvents.createHit",ul,function(S){var B=S.element,V=S.gfx;a.createDefaultHit(B,V)}),e.on("interactionEvents.updateHit",function(S){var B=S.element,V=S.gfx;a.updateDefaultHit(B,V)});var y=_("djs-hit djs-hit-stroke"),x=_("djs-hit djs-hit-click-stroke"),b=_("djs-hit djs-hit-all"),w=_("djs-hit djs-hit-no-move"),C={all:b,"click-stroke":x,stroke:y,"no-move":w};function _(S,B){return B=k.assign({stroke:"white",strokeWidth:15},B||{}),o.cls(S,["no-fill","no-border"],B)}function v(S,B){var V=C[B];if(!V)throw new Error("invalid hit type <"+B+">");return P.attr(S,V),S}function j(S,B){P.append(S,B)}this.removeHits=function(S){var B=A.queryAll(".djs-hit",S);k.forEach(B,P.remove)},this.createDefaultHit=function(S,B){var V=S.waypoints,T=S.isFrame,L;return V?this.createWaypointsHit(B,V):(L=T?"stroke":"all",this.createBoxHit(B,L,{width:S.width,height:S.height}))},this.createWaypointsHit=function(S,B){var V=Ca(B);return v(V,"stroke"),j(S,V),V},this.createBoxHit=function(S,B,V){V=k.assign({x:0,y:0},V);var T=P.create("rect");return v(T,B),P.attr(T,V),j(S,T),T},this.updateDefaultHit=function(S,B){var V=A.query(".djs-hit",B);if(V)return S.waypoints?dl(V,S.waypoints):P.attr(V,{width:S.width,height:S.height}),V},this.fire=i,this.triggerMouseEvent=u,this.mouseHandler=l,this.registerEvent=h,this.unregisterEvent=m}fl.$inject=["eventBus","elementRegistry","styles"];const ka={__init__:["interactionEvents"],interactionEvents:["type",fl]};function vn(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var i=a.element;o.deselect(i)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}vn.$inject=["eventBus","canvas"],vn.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},vn.prototype.get=function(){return this._selectedElements},vn.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},vn.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();k.isArray(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(l){var s=i.findRoot(l);return r===s}),t?k.forEach(e,function(l){o.indexOf(l)===-1&&o.push(l)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var pl="hover",hl="selected";function ml(e,t){this._canvas=e;function o(i,r){e.addMarker(i,r)}function a(i,r){e.removeMarker(i,r)}t.on("element.hover",function(i){o(i.element,pl)}),t.on("element.out",function(i){a(i.element,pl)}),t.on("selection.changed",function(i){function r(d){a(d,hl)}function l(d){o(d,hl)}var s=i.oldSelection,c=i.newSelection;k.forEach(s,function(d){c.indexOf(d)===-1&&r(d)}),k.forEach(c,function(d){s.indexOf(d)===-1&&l(d)})})}ml.$inject=["canvas","eventBus"];function gl(e,t,o,a){e.on("create.end",500,function(i){var r=i.context,l=r.canExecute,s=r.elements,c=r.hints||{},d=c.autoSelect;if(l){if(d===!1)return;k.isArray(d)?t.select(d):t.select(s.filter(Bp))}}),e.on("connect.end",500,function(i){var r=i.context,l=r.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(i){var r=i.previousSelection||[],l=a.get(i.context.shape.id),s=k.find(r,function(c){return l.id===c.id});s||t.select(l)}),e.on("element.click",function(i){if(Et(i)){var r=i.element;r===o.getRootElement()&&(r=null);var l=t.isSelected(r),s=t.get().length>1,c=ba(i);if(l&&s)return c?t.deselect(r):t.select(r);l?t.deselect(r):t.select(r,c)}})}gl.$inject=["eventBus","selection","canvas","elementRegistry"];function Bp(e){return!e.hidden}const bn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ka],selection:["type",vn],selectionVisuals:["type",ml],selectionBehavior:["type",gl]};var jp=/^djs-cursor-.*$/;function Ea(e){var t=A.classes(document.body);t.removeMatching(jp),e&&t.add("djs-cursor-"+e)}function yl(){Ea(null)}var Tp=5e3;function vl(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Tp,o),function(){e.off(t,o)}}function bl(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function xn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xl(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function wl(e,t){return e=k.isArray(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var wn=Math.round,Cl="djs-drag-active";function Dt(e){e.preventDefault()}function Vp(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Mp(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function kl(e,t,o,a){var i={threshold:5,trapClick:!0},r;function l(w){var C=t.viewbox(),_=t._container.getBoundingClientRect();return{x:C.x+(w.x-_.left)/C.scale,y:C.y+(w.y-_.top)/C.scale}}function s(w,C){C=C||r;var _=e.createEvent(k.assign({},C.payload,C.data,{isTouch:C.isTouch}));return e.fire("drag."+w,_)===!1?!1:e.fire(C.prefix+"."+w,_)}function c(w){var C=w.filter(function(_){return a.get(_.id)});C.length&&o.select(C)}function d(w,C){var _=r.payload,v=r.displacement,j=r.globalStart,S=yn(w),B=xn(S,j),V=r.localStart,T=l(S),L=xn(T,V);if(!r.active&&(C||Mp(B)>r.threshold)){if(k.assign(_,{x:wn(V.x+v.x),y:wn(V.y+v.y),dx:0,dy:0},{originalEvent:w}),s("start")===!1)return y();r.active=!0,r.keepSelection||(_.previousSelection=o.get(),o.select(null)),r.cursor&&Ea(r.cursor),t.addMarker(t.getRootElement(),Cl)}va(w),r.active&&(k.assign(_,{x:wn(T.x+v.x),y:wn(T.y+v.y),dx:wn(L.x),dy:wn(L.y)},{originalEvent:w}),s("move"))}function u(w){var C,_=!0;r.active&&(w&&(r.payload.originalEvent=w,va(w)),_=s("end")),_===!1&&s("rejected"),C=x(_!==!0),s("ended",C)}function f(w){wl("Escape",w)&&(Dt(w),y())}function h(w){var C;r.active&&(C=vl(e),setTimeout(C,400),Dt(w)),u(w)}function m(w){d(w)}function p(w){var C=r.payload;C.hoverGfx=w.gfx,C.hover=w.element,s("hover")}function g(w){s("out");var C=r.payload;C.hoverGfx=null,C.hover=null}function y(w){var C;if(r){var _=r.active;_&&s("cancel"),C=x(w),_&&s("canceled",C)}}function x(w){var C,_;s("cleanup"),yl(),r.trapClick?_=h:_=u,A.event.unbind(document,"mousemove",d),A.event.unbind(document,"dragstart",Dt),A.event.unbind(document,"selectstart",Dt),A.event.unbind(document,"mousedown",_,!0),A.event.unbind(document,"mouseup",_,!0),A.event.unbind(document,"keyup",f),A.event.unbind(document,"touchstart",m,!0),A.event.unbind(document,"touchcancel",y,!0),A.event.unbind(document,"touchmove",d,!0),A.event.unbind(document,"touchend",u,!0),e.off("element.hover",p),e.off("element.out",g),t.removeMarker(t.getRootElement(),Cl);var v=r.payload.previousSelection;return w!==!1&&v&&!o.get().length&&c(v),C=r,r=null,C}function b(w,C,_,v){r&&y(!1),typeof C=="string"&&(v=_,_=C,C=null),v=k.assign({},i,v||{});var j=v.data||{},S,B,V,T,L;v.trapClick?T=h:T=u,w?(S=gn(w)||w,B=yn(w),va(w),S.type==="dragstart"&&Dt(S)):(S=null,B={x:0,y:0}),V=l(B),C||(C=V),L=Vp(S),r=k.assign({prefix:_,data:j,payload:{},globalStart:B,displacement:xn(C,V),localStart:V,isTouch:L},v),v.manual||(L?(A.event.bind(document,"touchstart",m,!0),A.event.bind(document,"touchcancel",y,!0),A.event.bind(document,"touchmove",d,!0),A.event.bind(document,"touchend",u,!0)):(A.event.bind(document,"mousemove",d),A.event.bind(document,"dragstart",Dt),A.event.bind(document,"selectstart",Dt),A.event.bind(document,"mousedown",T,!0),A.event.bind(document,"mouseup",T,!0)),A.event.bind(document,"keyup",f),e.on("element.hover",p),e.on("element.out",g)),s("init"),v.autoActivate&&d(w,!0)}e.on("diagram.destroy",y),this.init=b,this.move=d,this.hover=p,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(w){k.assign(i,w)}}kl.$inject=["eventBus","canvas","selection","elementRegistry"];const qt={__depends__:[wp,bn],dragging:["type",kl]};function _a(e){return e.childNodes[0]}function xo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}xo.prototype.next=function(){return this._prefix+ ++this._counter};const Pp=new xo("ps");var Np=["marker-start","marker-mid","marker-end"],$p=["circle","ellipse","line","path","polygon","polyline","path","rect"];function _t(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}_t.$inject=["elementRegistry","eventBus","canvas","styles"],_t.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")},_t.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},_t.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var i=P.clone(o),r=o.getBoundingClientRect();return this._cloneMarkers(_a(i),a),P.attr(i,this._styles.cls(a,[],{x:r.top,y:r.left})),P.append(t,i),P.attr(i,"data-preview-support-element-id",e.id),i},_t.prototype.addFrame=function(e,t){var o=P.create("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return P.append(t,o),P.attr(o,"data-preview-support-element-id",e.id),o},_t.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(i=>{a._cloneMarkers(i,t,o)}),Lp(e)&&Np.forEach(function(i){if(P.attr(e,i)){var r=Op(e,i,a._canvas.getContainer());r&&a._cloneMarker(o,e,r,i,t)}})},_t.prototype._cloneMarker=function(e,t,o,a,i="djs-dragger"){var r=[o.id,i,Pp.next()].join("-"),l=A.query("marker#"+o.id,e);e=e||this._canvas._svg;var s=l||P.clone(o);s.id=r,P.classes(s).add(i);var c=A.query(":scope > defs",e);c||(c=P.create("defs"),P.append(e,c)),P.append(c,s);var d=Ap(s.id);P.attr(t,a,d)};function Op(e,t,o){var a=Rp(P.attr(e,t));return A.query("marker#"+a,o||document)}function Rp(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Ap(e){return"url(#"+e+")"}function Lp(e){return $p.indexOf(e.nodeName)!==-1}const Sa={__init__:["previewSupport"],previewSupport:["type",_t]};function Ba(e){this._commandStack=e.get("commandStack",!1)}Ba.$inject=["injector"],Ba.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};const Cn={__init__:["rules"],rules:["type",Ba]};function Ip(e){return k.filter(e,function(t){return!k.find(e,function(o){return o!==t&&El(t,o)})})}function El(e,t){if(t){if(e===t)return t;if(e.parent)return El(e.parent,t)}}function _l(e,t,o){var a=!0;return e.push(t),a}function ja(e,t,o){o=o||0,k.isArray(e)||(e=[e]),k.forEach(e,function(a,i){var r=t(a,i,o);k.isArray(r)&&r.length&&ja(r,t,o+1)})}function zp(e,t,o){var a=[],i=[];return ja(e,function(r,l,s){_l(a,r);var c=r.children;if(c&&_l(i,c))return c}),a}function Fp(e,t){return zp(e)}function Hp(e,t,o){k.isUndefined(t)&&(t=!0),k.isObject(t)&&(o=t,t=!0),o=o||{};var a=Fn(o.allShapes),i=Fn(o.allConnections),r=Fn(o.enclosedElements),l=Fn(o.enclosedConnections),s=Fn(o.topLevel,t&&k.groupBy(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),a[u.source.id]&&a[u.target.id]&&(l[u.id]=r[u.id]=u),i[u.id]=u}function d(u){if(r[u.id]=u,u.waypoints)l[u.id]=i[u.id]=u;else return a[u.id]=u,k.forEach(u.incoming,c),k.forEach(u.outgoing,c),u.children}return ja(e,d),{allShapes:a,allConnections:i,topLevel:s,enclosedConnections:l,enclosedElements:r}}function st(e,t){t=!!t,k.isArray(e)||(e=[e]);var o,a,i,r;return k.forEach(e,function(l){var s=l;l.waypoints&&!t&&(s=st(l.waypoints,!0));var c=s.x,d=s.y,u=s.height||0,f=s.width||0;(c<o||o===void 0)&&(o=c),(d<a||a===void 0)&&(a=d),(c+f>i||i===void 0)&&(i=c+f),(d+u>r||r===void 0)&&(r=d+u)}),{x:o,y:a,height:r-a,width:i-o}}function Wp(e,t){var o={};return k.forEach(e,function(a){var i=a;i.waypoints&&(i=st(i)),!k.isNumber(t.y)&&i.x>t.x&&(o[a.id]=a),!k.isNumber(t.x)&&i.y>t.y&&(o[a.id]=a),i.x>t.x&&i.y>t.y&&(k.isNumber(t.width)&&k.isNumber(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y||!k.isNumber(t.width)||!k.isNumber(t.height))&&(o[a.id]=a)}),o}function Up(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Jp(e){return!!(e&&e.isFrame)}function Fn(e,t){return k.assign({},e||{},t||{})}function Ze(e){return k.isObject(e)&&k.has(e,"waypoints")}function kn(e){return k.isObject(e)&&k.has(e,"labelTarget")}var Dp="drop-ok",Sl="drop-not-ok",Bl="attach-ok",jl="new-parent",Tl="create",qp=2e3;function Vl(e,t,o,a,i){function r(c,d,u,f,h){if(!d)return!1;c=k.filter(c,function(b){var w=b.labelTarget;return!b.parent&&!(kn(b)&&c.indexOf(w)!==-1)});var m=k.find(c,function(b){return!Ze(b)}),p=!1,g=!1,y=!1;Pl(c)&&(p=i.allowed("shape.attach",{position:u,shape:m,target:d})),p||(Pl(c)?y=i.allowed("shape.create",{position:u,shape:m,source:f,target:d}):y=i.allowed("elements.create",{elements:c,position:u,target:d}));var x=h.connectionTarget;return y||p?(m&&f&&(g=i.allowed("connection.create",{source:x===f?m:f,target:x===f?f:m,hints:{targetParent:d,targetAttach:p}})),{attach:p,connect:g}):y===null||p===null?null:!1}function l(c,d){[Bl,Dp,Sl,jl].forEach(function(u){u===d?e.addMarker(c,u):e.removeMarker(c,u)})}o.on(["create.move","create.hover"],function(c){var d=c.context,u=d.elements,f=c.hover,h=d.source,m=d.hints||{};if(!f){d.canExecute=!1,d.target=null;return}Ml(c);var p={x:c.x,y:c.y},g=d.canExecute=f&&r(u,f,p,h,m);f&&g!==null&&(d.target=f,g&&g.attach?l(f,Bl):l(f,g?jl:Sl))}),o.on(["create.end","create.out","create.cleanup"],function(c){var d=c.hover;d&&l(d,null)}),o.on("create.end",function(c){var d=c.context,u=d.source,f=d.shape,h=d.elements,m=d.target,p=d.canExecute,g=p&&p.attach,y=p&&p.connect,x=d.hints||{};if(p===!1||!m)return!1;Ml(c);var b={x:c.x,y:c.y};y?f=a.appendShape(u,f,b,m,{attach:g,connection:y===!0?{}:y,connectionTarget:x.connectionTarget}):(h=a.createElements(h,b,m,k.assign({},x,{attach:g})),f=k.find(h,function(w){return!Ze(w)})),k.assign(d,{elements:h,shape:f}),k.assign(c,{elements:h,shape:f})});function s(){var c=t.context();c&&c.prefix===Tl&&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(c,d,u){k.isArray(d)||(d=[d]);var f=k.find(d,function(p){return!Ze(p)});if(f){u=k.assign({elements:d,hints:{},shape:f},u||{}),k.forEach(d,function(p){k.isNumber(p.x)||(p.x=0),k.isNumber(p.y)||(p.y=0)});var h=k.filter(d,function(p){return!p.hidden}),m=st(h);k.forEach(d,function(p){Ze(p)&&(p.waypoints=k.map(p.waypoints,function(g){return{x:g.x-m.x-m.width/2,y:g.y-m.y-m.height/2}})),k.assign(p,{x:p.x-m.x-m.width/2,y:p.y-m.y-m.height/2})}),t.init(c,Tl,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:d,context:u}})}}}Vl.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ml(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 Pl(e){return e&&e.length===1&&!Ze(e[0])}function Yp(e,t,o,a,i){var r=P.createTransform();r.setTranslate(t,o);var l=P.createTransform();l.setRotate(0,0,0);var s=P.createTransform();s.setScale(1,1),P.transform(e,[r,l,s])}function ct(e,t,o){var a=P.createTransform();a.setTranslate(t,o),P.transform(e,a)}function Gp(e,t){var o=P.createTransform();o.setRotate(t,0,0),P.transform(e,o)}var Kp=750;function Nl(e,t,o,a,i){function r(l){var s=P.create("g");P.attr(s,i.cls("djs-drag-group",["no-events"]));var c=P.create("g");return l.forEach(function(d){var u;d.hidden||(d.waypoints?(u=o._createContainer("connection",c),o.drawConnection(_a(u),d)):(u=o._createContainer("shape",c),o.drawShape(_a(u),d),ct(u,d.x,d.y)),a.addDragger(d,s,u))}),s}t.on("create.move",Kp,function(l){var s=l.hover,c=l.context,d=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(d));var f;s?(u.parentNode||(f=e.getActiveLayer(),P.append(f,u)),ct(u,l.x,l.y)):P.remove(u)}),t.on("create.cleanup",function(l){var s=l.context,c=s.dragGroup;c&&P.remove(c)})}Nl.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const $l={__depends__:[qt,Sa,Cn,bn],__init__:["create","createPreview"],create:["type",Vl],createPreview:["type",Nl]};function Hn(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ta(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var i=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),r=Hn(e,t);return Math.abs(i/r)<=a}var Xp=2;function St(e,t){var o=Array.from(arguments).flat();const a={x:"v",y:"h"};for(const[i,r]of Object.entries(a))if(Zp(i,o))return r;return!1}function Zp(e,t){const o=t[0];return k.every(t,function(a){return Math.abs(o[e]-a[e])<=Xp})}function Ol(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Va(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Qp=/,?([a-z]),?/gi,Rl=parseFloat,Pe=Math,Bt=Pe.PI,dt=Pe.min,ut=Pe.max,Al=Pe.pow,jt=Pe.abs,eh=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,th=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ll=Array.isArray||function(e){return e instanceof Array};function nh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function oh(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function ah(e){function t(){var o=Array.prototype.slice.call(arguments,0),a=o.join("␀"),i=t.cache=t.cache||{},r=t.count=t.count||[];return nh(i,a)?(oh(r,a),i[a]):(r.length>=1e3&&delete i[r.shift()],r.push(a),i[a]=e(...arguments),i[a])}return t}function ih(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(eh,function(a,i,r){var l=[],s=i.toLowerCase();for(r.replace(th,function(c,d){d&&l.push(+d)}),s=="m"&&l.length>2&&(o.push([i,...l.splice(0,2)]),s="l",i=i=="m"?"l":"L");l.length>=t[s]&&(o.push([i,...l.splice(0,t[s])]),!!t[s]););}),o.toString=Pa,o}function rh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function lh(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Ma(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Pa(){return this.join(",").replace(Qp,"$1")}function sh(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var i=e[o],r=t[o]=new Array(i.length),l=0,s=i.length;l<s;l++)r[l]=i[l];return t.toString=Pa,t}function Il(e,t,o,a,i,r,l,s,c){var d=1-c,u=Al(d,3),f=Al(d,2),h=c*c,m=h*c,p=u*e+f*3*c*o+d*3*c*c*i+m*l,g=u*t+f*3*c*a+d*3*c*c*r+m*s;return{x:wo(p),y:wo(g)}}function zl(e){var t=hh(...e);return Ma(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Tt(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function ch(e,t){return e=Ma(e),t=Ma(t),Tt(t,e.x,e.y)||Tt(t,e.x2,e.y)||Tt(t,e.x,e.y2)||Tt(t,e.x2,e.y2)||Tt(e,t.x,t.y)||Tt(e,t.x2,t.y)||Tt(e,t.x,t.y2)||Tt(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 Fl(e,t,o,a,i){var r=-3*t+9*o-9*a+3*i,l=e*r+6*t-12*o+6*a;return e*l-3*t+3*o}function Hl(e,t,o,a,i,r,l,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var d=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],m=0,p=0;p<u;p++){var g=d*f[p]+d,y=Fl(g,e,o,i,l),x=Fl(g,t,a,r,s),b=y*y+x*x;m+=h[p]*Pe.sqrt(b)}return d*m}function dh(e,t,o,a,i,r,l,s){if(!(ut(e,o)<dt(i,l)||dt(e,o)>ut(i,l)||ut(t,a)<dt(r,s)||dt(t,a)>ut(r,s))){var c=(e*a-t*o)*(i-l)-(e-o)*(i*s-r*l),d=(e*a-t*o)*(r-s)-(t-a)*(i*s-r*l),u=(e-o)*(r-s)-(t-a)*(i-l);if(u){var f=wo(c/u),h=wo(d/u),m=+f.toFixed(2),p=+h.toFixed(2);if(!(m<+dt(e,o).toFixed(2)||m>+ut(e,o).toFixed(2)||m<+dt(i,l).toFixed(2)||m>+ut(i,l).toFixed(2)||p<+dt(t,a).toFixed(2)||p>+ut(t,a).toFixed(2)||p<+dt(r,s).toFixed(2)||p>+ut(r,s).toFixed(2)))return{x:f,y:h}}}}function wo(e){return Math.round(e*1e11)/1e11}function uh(e,t,o){var a=zl(e),i=zl(t);if(!ch(a,i))return[];var r=Hl(...e),l=Hl(...t),s=Ul(e)?1:~~(r/5)||1,c=Ul(t)?1:~~(l/5)||1,d=new Array(s+1),u=new Array(c+1),f={},h=[],m,p;for(m=0;m<s+1;m++){var g=Il(...e,m/s);d[m]={x:g.x,y:g.y,t:m/s}}for(m=0;m<c+1;m++)g=Il(...t,m/c),u[m]={x:g.x,y:g.y,t:m/c};for(m=0;m<s;m++)for(p=0;p<c;p++){var y=d[m],x=d[m+1],b=u[p],w=u[p+1],C=jt(x.x-y.x)<.01?"y":"x",_=jt(w.x-b.x)<.01?"y":"x",v=dh(y.x,y.y,x.x,x.y,b.x,b.y,w.x,w.y),j;if(v){if(j=v.x.toFixed(9)+"#"+v.y.toFixed(9),f[j])continue;f[j]=!0;var S=y.t+jt((v[C]-y[C])/(x[C]-y[C]))*(x.t-y.t),B=b.t+jt((v[_]-b[_])/(w[_]-b[_]))*(w.t-b.t);S>=0&&S<=1&&B>=0&&B<=1&&h.push({x:v.x,y:v.y,t1:S,t2:B})}}return h}function Wl(e,t,o){e=ql(e),t=ql(t);for(var a,i,r,l,s,c,d,u,f,h,m=o?0:[],p=0,g=e.length;p<g;p++){var y=e[p];if(y[0]=="M")a=s=y[1],i=c=y[2];else{y[0]=="C"?(f=[a,i,...y.slice(1)],a=f[6],i=f[7]):(f=[a,i,a,i,s,c,s,c],a=s,i=c);for(var x=0,b=t.length;x<b;x++){var w=t[x];if(w[0]=="M")r=d=w[1],l=u=w[2];else{w[0]=="C"?(h=[r,l,...w.slice(1)],r=h[6],l=h[7]):(h=[r,l,r,l,d,u,d,u],r=d,l=u);var C=uh(f,h);{for(var _=0,v=C.length;_<v;_++)C[_].segment1=p,C[_].segment2=x,C[_].bez1=f,C[_].bez2=h;m=m.concat(C)}}}}}return m}function fh(e){return Ll(e)&&Ll(e[0])}function ph(e){if(rh(e))return e;var t=new Array(e.length),o=0,a=0,i=0,r=0,l=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],i=o,r=a,l++,t[0]=["M",o,a]);for(var c,d,u=l,f=e.length;u<f;u++){if(d=e[u],s=d[0],t[u]=c=new Array(d.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=+d[6]+o,c[7]=+d[7]+a;break;case"V":c[1]=+d[1]+a;break;case"H":c[1]=+d[1]+o;break;case"M":i=+d[1]+o,r=+d[2]+a;default:for(var h=1,m=d.length;h<m;h++)c[h]=+d[h]+(h%2?o:a)}else for(var p=0,g=d.length;p<g;p++)c[p]=d[p];switch(s=s.toUpperCase(),c[0]){case"Z":o=+i,a=+r;break;case"H":o=c[1];break;case"V":a=c[1];break;case"M":i=c[c.length-2],r=c[c.length-1];default:o=c[c.length-2],a=c[c.length-1]}}return t.toString=Pa,t}function Ul(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Co(e,t,o,a){return[e,t,o,a,o,a]}function Jl(e,t,o,a,i,r){var l=.3333333333333333,s=2/3;return[l*e+s*o,l*t+s*a,l*i+s*o,l*r+s*a,i,r]}function Dl(e,t,o,a,i,r,l,s,c,d){var u=Bt*120/180,f=Bt/180*(+i||0),h=[],m,p=ah(function(re,ye,je){var U=re*Pe.cos(je)-ye*Pe.sin(je),te=re*Pe.sin(je)+ye*Pe.cos(je);return{x:U,y:te}});if(d)j=d[0],S=d[1],_=d[2],v=d[3];else{m=p(e,t,-f),e=m.x,t=m.y,m=p(s,c,-f),s=m.x,c=m.y;var g=(e-s)/2,y=(t-c)/2,x=g*g/(o*o)+y*y/(a*a);x>1&&(x=Pe.sqrt(x),o=x*o,a=x*a);var b=o*o,w=a*a,C=(r==l?-1:1)*Pe.sqrt(jt((b*w-b*y*y-w*g*g)/(b*y*y+w*g*g))),_=C*o*y/a+(e+s)/2,v=C*-a*g/o+(t+c)/2,j=Pe.asin(((t-v)/a).toFixed(9)),S=Pe.asin(((c-v)/a).toFixed(9));j=e<_?Bt-j:j,S=s<_?Bt-S:S,j<0&&(j=Bt*2+j),S<0&&(S=Bt*2+S),l&&j>S&&(j=j-Bt*2),!l&&S>j&&(S=S-Bt*2)}var B=S-j;if(jt(B)>u){var V=S,T=s,L=c;S=j+u*(l&&S>j?1:-1),s=_+o*Pe.cos(S),c=v+a*Pe.sin(S),h=Dl(s,c,o,a,i,0,l,T,L,[S,V,_,v])}B=S-j;var F=Pe.cos(j),z=Pe.sin(j),M=Pe.cos(S),E=Pe.sin(S),$=Pe.tan(B/4),R=4/3*o*$,Y=4/3*a*$,ee=[e,t],se=[e+R*z,t-Y*F],de=[s+R*E,c-Y*M],Me=[s,c];if(se[0]=2*ee[0]-se[0],se[1]=2*ee[1]-se[1],d)return[se,de,Me].concat(h);h=[se,de,Me].concat(h).join().split(",");for(var D=[],fe=0,ge=h.length;fe<ge;fe++)D[fe]=fe%2?p(h[fe-1],h[fe],f).y:p(h[fe],h[fe+1],f).x;return D}function hh(e,t,o,a,i,r,l,s){for(var c=[],d=[[],[]],u,f,h,m,p,g,y,x,b=0;b<2;++b){if(b==0?(f=6*e-12*o+6*i,u=-3*e+9*o-9*i+3*l,h=3*o-3*e):(f=6*t-12*a+6*r,u=-3*t+9*a-9*r+3*s,h=3*a-3*t),jt(u)<1e-12){if(jt(f)<1e-12)continue;m=-h/f,0<m&&m<1&&c.push(m);continue}y=f*f-4*h*u,x=Pe.sqrt(y),!(y<0)&&(p=(-f+x)/(2*u),0<p&&p<1&&c.push(p),g=(-f-x)/(2*u),0<g&&g<1&&c.push(g))}for(var w=c.length,C=w,_;w--;)m=c[w],_=1-m,d[0][w]=_*_*_*e+3*_*_*m*o+3*_*m*m*i+m*m*m*l,d[1][w]=_*_*_*t+3*_*_*m*a+3*_*m*m*r+m*m*m*s;return d[0][C]=e,d[1][C]=t,d[0][C+1]=l,d[1][C+1]=s,d[0].length=d[1].length=C+2,{x0:dt(...d[0]),y0:dt(...d[1]),x1:ut(...d[0]),y1:ut(...d[1])}}function ql(e){if(fh(e)||(e=ih(e)),lh(e))return e;for(var t=sh(ph(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(h,m,p){var g,y;if(!h)return["C",m.x,m.y,m.x,m.y,m.x,m.y];switch(!(h[0]in{T:1,Q:1})&&(m.qx=m.qy=null),h[0]){case"M":m.X=h[1],m.Y=h[2];break;case"A":h=["C",...Dl(m.x,m.y,...h.slice(1))];break;case"S":p=="C"||p=="S"?(g=m.x*2-m.bx,y=m.y*2-m.by):(g=m.x,y=m.y),h=["C",g,y,...h.slice(1)];break;case"T":p=="Q"||p=="T"?(m.qx=m.x*2-m.qx,m.qy=m.y*2-m.qy):(m.qx=m.x,m.qy=m.y),h=["C",...Jl(m.x,m.y,m.qx,m.qy,h[1],h[2])];break;case"Q":m.qx=h[1],m.qy=h[2],h=["C",...Jl(m.x,m.y,h[1],h[2],h[3],h[4])];break;case"L":h=["C",...Co(m.x,m.y,h[1],h[2])];break;case"H":h=["C",...Co(m.x,m.y,h[1],m.y)];break;case"V":h=["C",...Co(m.x,m.y,m.x,h[1])];break;case"Z":h=["C",...Co(m.x,m.y,m.X,m.Y)];break}return h},i=function(h,m){if(h[m].length>7){h[m].shift();for(var p=h[m];p.length;)r[m]="A",h.splice(m++,0,["C",...p.splice(0,6)]);h.splice(m,1),d=t.length}},r=[],l="",s="",c=0,d=t.length;c<d;c++){t[c]&&(l=t[c][0]),l!="C"&&(r[c]=l,c&&(s=r[c-1])),t[c]=a(t[c],o,s),r[c]!="A"&&l=="C"&&(r[c]="C"),i(t,c);var u=t[c],f=u.length;o.x=u[f-2],o.y=u[f-1],o.bx=Rl(u[f-4])||o.x,o.by=Rl(u[f-3])||o.y}return t}function mh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Wn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Yl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function gh(e){return Wn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function yh(e){for(var t=e.waypoints,o=t.reduce(function(d,u,f){var h=t[f-1];if(h){var m=d[d.length-1],p=m&&m.endLength||0,g=xh(h,u);d.push({start:h,end:u,startLength:p,endLength:p+g,length:g})}return d},[]),a=o.reduce(function(d,u){return d+u.length},0),i=a/2,r=0,l=o[r];l.endLength<i;)l=o[++r];var s=(i-l.startLength)/l.length,c={x:l.start.x+(l.end.x-l.start.x)*s,y:l.start.y+(l.end.y-l.start.y)*s};return c}function Te(e){return Ze(e)?yh(e):gh(e)}function Vt(e,t,o){o=o||0,k.isObject(o)||(o={x:o,y:o});var a=be(e),i=be(t),r=a.bottom+o.y<=i.top,l=a.left-o.x>=i.right,s=a.top-o.y>=i.bottom,c=a.right+o.x<=i.left,d=r?"top":s?"bottom":null,u=c?"left":l?"right":null;return u&&d?d+"-"+u:u||d||"intersect"}function Na(e,t,o){var a=vh(e,t);return a.length===1||a.length===2&&Hn(a[0],a[1])<1?Wn(a[0]):a.length>1?(a=k.sortBy(a,function(i){var r=Math.floor(i.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,i.segment2+"#"+r}),Wn(a[o?0:a.length-1])):null}function vh(e,t){return Wl(e,t)}function bh(e){e=e.slice();for(var t=0,o,a,i;e[t];)o=e[t],a=e[t-1],i=e[t+1],Hn(o,i)===0||Ta(a,i,o)?e.splice(t,1):t++;return e}function xh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gl(e,t,o,a){function i(l,s){return a.allowed("connection.create",{source:l,target:s})}function r(l,s){return i(s,l)}e.on("connect.hover",function(l){var s=l.context,c=s.start,d=l.hover,u;if(s.hover=d,u=s.canExecute=i(c,d),!k.isNil(u)){if(u!==!1){s.source=c,s.target=d;return}u=s.canExecute=r(c,d),!k.isNil(u)&&u!==!1&&(s.source=d,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(l){var s=l.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(l){var s=l.context,c=s.canExecute,d=s.connectionStart,u={x:l.x,y:l.y},f=s.source,h=s.target;if(!c)return!1;var m=null,p={connectionStart:$a(s)?u:d,connectionEnd:$a(s)?d:u};k.isObject(c)&&(m=c),s.connection=o.connect(f,h,m,p)}),this.start=function(l,s,c,d){k.isObject(c)||(d=c,c=Te(s)),t.init(l,"connect",{autoActivate:d,data:{shape:s,context:{start:s,connectionStart:c}}})}}Gl.$inject=["eventBus","dragging","modeling","rules"];function $a(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var wh=1100,Ch=900,Kl="connect-ok",Xl="connect-not-ok";function Zl(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(i){var r=i.context,l=r.canExecute,s=r.hover,c=r.source,d=r.start,u=r.startPosition,f=r.target,h=r.connectionStart||u,m=r.connectionEnd||{x:i.x,y:i.y},p=h,g=m;$a(r)&&(p=m,g=h),a.drawPreview(r,l,{source:c||d,target:f||s,connectionStart:p,connectionEnd:g})}),t.on("connect.hover",Ch,function(i){var r=i.context,l=i.hover,s=r.canExecute;s!==null&&o.addMarker(l,s?Kl:Xl)}),t.on(["connect.out","connect.cleanup"],wh,function(i){var r=i.hover;r&&(o.removeMarker(r,Kl),o.removeMarker(r,Xl))}),a&&t.on("connect.cleanup",function(i){a.cleanUp(i.context)})}Zl.$inject=["injector","eventBus","canvas"];const Oa={__depends__:[bn,Cn,qt],__init__:["connectPreview"],connect:["type",Gl],connectPreview:["type",Zl]};var kh=15;function Ql(e,t){var o;function a(s){return l(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function i(s){var c=o.start,d=o.button,u=yn(s),f=xn(u,c);if(!o.dragging&&Eh(f)>kh&&(o.dragging=!0,d===0&&vl(e),Ea("grab")),o.dragging){var h=o.last||o.start;f=xn(u,h),t.scroll({dx:f.x,dy:f.y}),o.last=u}s.preventDefault()}function r(s){A.event.unbind(document,"mousemove",i),A.event.unbind(document,"mouseup",r),o=null,yl()}function l(s){if(!A.closest(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:c,start:yn(s)},A.event.bind(document,"mousemove",i),A.event.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!o}}Ql.$inject=["eventBus","canvas"];function Eh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const es={__init__:["moveCanvas"],moveCanvas:["type",Ql]};function Ra(e){return Math.log(e)/Math.log(10)}function ts(e,t){var o=Ra(e.min),a=Ra(e.max),i=Math.abs(o)+Math.abs(a);return i/t}function _h(e,t){return Math.max(e.min,Math.min(e.max,t))}var Sh=Math.sign||function(e){return e>=0?1:-1},Aa={min:.2,max:4},ns=10,Bh=.1,jh=.75;function ft(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=k.bind(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||jh;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}ft.$inject=["config.zoomScroll","eventBus","canvas"],ft.prototype.scroll=function(t){this._canvas.scroll(t)},ft.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ft.prototype.zoom=function(t,o){var a=ts(Aa,ns*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Bh&&(this._zoom(t,o,a),this._totalDelta=0)},ft.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||ll()&&t.metaKey,i=t.shiftKey,r=-1*this._scale,l;if(a?r*=t.deltaMode===0?.02:.32:r*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};l=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*Sh(t.deltaY)*r,this.zoom(l,c)}else i?l={dx:r*t.deltaY,dy:0}:l={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(l)}},ft.prototype.stepZoom=function(t,o){var a=ts(Aa,ns);this._zoom(t,o,a)},ft.prototype._zoom=function(e,t,o){var a=this._canvas,i=e>0?1:-1,r=Ra(a.zoom()),l=Math.round(r/o)*o;l+=o*i;var s=Math.pow(10,l);a.zoom(_h(Aa,s),t)},ft.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,i=this._enabled;return typeof t>"u"&&(t=!i),i!==t&&A.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ft.prototype._init=function(e){this.toggle(e)};const os={__init__:["zoomScroll"],zoomScroll:["type",ft]};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},a=this._getHandler(e);let i=this._fire(e,"canExecute",o);if(i===void 0){if(!a)return!1;a.canExecute&&(i=a.canExecute(t))}return i},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,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},Be.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let i;o=this._eventBus.createEvent(o);for(const r of a)if(i=this._eventBus.fire("commandStack."+r,o),o.cancelBubble)break;return i},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,a=e.context,i=this._getHandler(o);if(!i)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),i.preExecute&&i.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),i.execute&&this._markDirty(i.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),i.postExecute&&i.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},Be.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},Be.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:k.uniqueBy("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Be.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=k.isArray(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 Th={commandStack:["type",Be]};function Yt(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function ko(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function Mt(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function La(e,t){return!e||!t?-1:e.indexOf(t)}function En(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 Vh=1e3;function De(e){this._eventBus=e}De.$inject=["eventBus"];function Mh(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}De.prototype.on=function(e,t,o,a,i,r){if((k.isFunction(t)||k.isNumber(t))&&(r=i,i=a,a=o,o=t,t=null),k.isFunction(o)&&(r=i,i=a,a=o,o=Vh),k.isObject(i)&&(r=i,i=!1),!k.isFunction(a))throw new Error("handlerFn must be a function");k.isArray(e)||(e=[e]);var l=this._eventBus;k.forEach(e,function(s){var c=["commandStack",s,t].filter(function(d){return d}).join(".");l.on(c,o,i?Mh(a,r):a,r)})},De.prototype.canExecute=yt("canExecute"),De.prototype.preExecute=yt("preExecute"),De.prototype.preExecuted=yt("preExecuted"),De.prototype.execute=yt("execute"),De.prototype.executed=yt("executed"),De.prototype.postExecute=yt("postExecute"),De.prototype.postExecuted=yt("postExecuted"),De.prototype.revert=yt("revert"),De.prototype.reverted=yt("reverted");function yt(e){return function(o,a,i,r,l){(k.isFunction(o)||k.isNumber(o))&&(l=r,r=i,i=a,a=o,o=null),this.on(o,e,a,i,r,l)}}var Ph=250,as=1400;function Ia(e,t,o){De.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",as,function(i){var r=i.context,l=r.shapes,s=r.validatedShapes;r.shapes=is(l),r.validatedShapes=is(s)}),a&&t.on("shape.move.start",Ph,function(i){var r=i.context,l=r.shapes,s=[];k.forEach(l,function(c){k.forEach(c.labels,function(d){!d.hidden&&r.shapes.indexOf(d)===-1&&s.push(d),c.labelTarget&&s.push(c)})}),k.forEach(s,function(c){a.makeDraggable(r,c,!0)})}),this.preExecuted("elements.move",as,function(i){var r=i.context,l=r.closure,s=l.enclosedElements,c=[];k.forEach(s,function(d){k.forEach(d.labels,function(u){s[u.id]||c.push(u)})}),l.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var r=i.context,l=r.connection||r.shape;En(l.labels,function(s){o.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var r=i.context,l=r.shape,s=l.labelTarget;s&&(r.labelTargetIndex=La(s.labels,l),r.labelTarget=s,l.labelTarget=null)}),this.revert("shape.delete",function(i){var r=i.context,l=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(Mt(s.labels,l,c),l.labelTarget=s)})}Yt(Ia,De),Ia.$inject=["injector","eventBus","modeling"];function is(e){return k.filter(e,function(t){return e.indexOf(t.labelTarget)===-1})}const Nh={__init__:["labelSupport"],labelSupport:["type",Ia]};function rs(){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 ls(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function $h(e,t,o,a){var i=o.inverse;return Object.defineProperty(e,"remove",{value:function(r){var l=this.indexOf(r);return l!==-1&&(this.splice(l,1),t.unset(r,i,a)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,l){var s=this.indexOf(r);if(typeof l>"u"){if(s!==-1)return;l=this.length}s!==-1&&this.splice(s,1),this.splice(l,0,r),s===-1&&t.set(r,i,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Oh(e){return e.__refs_collection===!0}function Rh(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ss(e,t,o){var a=$h(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(i){e.set(i,t.inverse,o)})}function Ah(e,t,o){var a=t.inverse,i=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return i},set:function(r){if(r!==i){var l=i;i=null,l&&e.unset(l,a,o),i=r,e.set(i,a,o)}}})}function at(e,t){if(!(this instanceof at))return new at(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}at.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?ss(this,t,e):Ah(this,t,e)},at.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Oh(o)||ss(this,t,e),o},at.prototype.ensureBound=function(e,t){Rh(e,t)||this.bind(e,t)},at.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},at.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var za=new at({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cs=new at({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),ds=new at({name:"attachers",collection:!0},{name:"host"}),us=new at({name:"outgoing",collection:!0},{name:"source"}),fs=new at({name:"incoming",collection:!0},{name:"target"});function _n(){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)}}),za.bind(this,"parent"),cs.bind(this,"labels"),us.bind(this,"outgoing"),fs.bind(this,"incoming")}function Un(){_n.call(this),za.bind(this,"children"),ds.bind(this,"host"),ds.bind(this,"attachers")}Yt(Un,_n);function ps(){_n.call(this),za.bind(this,"children")}Yt(ps,Un);function hs(){Un.call(this),cs.bind(this,"labelTarget")}Yt(hs,Un);function ms(){_n.call(this),us.bind(this,"source"),fs.bind(this,"target")}Yt(ms,_n);var Lh={connection:ms,shape:Un,label:hs,root:ps};function Ih(e,t){var o=Lh[e];if(!o)throw new Error("unknown type: <"+e+">");return k.assign(new o,t)}function zh(e){return e instanceof _n}function Pt(){this._uid=12}Pt.prototype.createRoot=function(e){return this.create("root",e)},Pt.prototype.createLabel=function(e){return this.create("label",e)},Pt.prototype.createShape=function(e){return this.create("shape",e)},Pt.prototype.createConnection=function(e){return this.create("connection",e)},Pt.prototype.create=function(e,t){return t=k.assign({},t||{}),t.id||(t.id=e+"_"+this._uid++),Ih(e,t)};const Fh={width:90,height:20};function Gt(){Pt.call(this),this._translate=ls}Ht(Gt,Pt),Gt.$inject=[],Gt.prototype.baseCreate=Pt.prototype.create,Gt.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,Se({type:"label"},Fh,t)):this.createFlowElement(e,t)},Gt.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:rs()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=Se({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Gt.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 Eo(e,t){this._modeling=e,this._canvas=t}Eo.$inject=["modeling","canvas"],Eo.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;k.forEach(o,function(i){var r={x:0,y:0};k.isDefined(a.left)?r.x=a.left-i.x:k.isDefined(a.right)?r.x=a.right-i.width-i.x:k.isDefined(a.center)?r.x=a.center-Math.round(i.width/2)-i.x:k.isDefined(a.top)?r.y=a.top-i.y:k.isDefined(a.bottom)?r.y=a.bottom-i.height-i.y:k.isDefined(a.middle)&&(r.y=a.middle-Math.round(i.height/2)-i.y),t.moveElements([i],r,i.parent)})},Eo.prototype.postExecute=function(e){};function _o(e){this._modeling=e}_o.$inject=["modeling"],_o.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,i=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:i.attach}),e.shape=a},_o.prototype.postExecute=function(e){var t=e.hints||{};Hh(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 Hh(e,t){return k.some(e.outgoing,function(o){return o.target===t})}function So(e,t){this._canvas=e,this._layouter=t}So.$inject=["canvas","layouter"],So.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,i=e.parent,r=e.parentIndex,l=e.hints;if(!o||!a)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,l)),this._canvas.addConnection(t,i,r),t},So.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Bo=Math.round;function Fa(e){this._modeling=e}Fa.$inject=["modeling"],Fa.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,i=e.position,r=e.hints,l=this._modeling;k.forEach(t,function(f){k.isNumber(f.x)||(f.x=0),k.isNumber(f.y)||(f.y=0)});var s=k.filter(t,function(f){return!f.hidden}),c=st(s);k.forEach(t,function(f){Ze(f)&&(f.waypoints=k.map(f.waypoints,function(h){return{x:Bo(h.x-c.x-c.width/2+i.x),y:Bo(h.y-c.y-c.height/2+i.y)}})),k.assign(f,{x:Bo(f.x-c.x-c.width/2+i.x),y:Bo(f.y-c.y-c.height/2+i.y)})});var d=Ip(t),u={};k.forEach(t,function(f){if(Ze(f)){u[f.id]=k.isNumber(a)?l.createConnection(u[f.source.id],u[f.target.id],a,f,f.parent||o,r):l.createConnection(u[f.source.id],u[f.target.id],f,f.parent||o,r);return}var h=k.assign({},r);d.indexOf(f)===-1&&(h.autoResize=!1),kn(f)&&(h=k.omit(h,["attach"])),u[f.id]=k.isNumber(a)?l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,a,h):l.createShape(f,k.pick(f,["x","y","width","height"]),f.parent||o,h)}),e.elements=k.values(u)};var gs=Math.round;function Nt(e){this._canvas=e}Nt.$inject=["canvas"],Nt.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,i=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?k.assign(t,o):k.assign(t,{x:o.x-gs(t.width/2),y:o.y-gs(t.height/2)}),this._canvas.addShape(t,a,i),t},Nt.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Jn(e){Nt.call(this,e)}Yt(Jn,Nt),Jn.$inject=["canvas"];var Wh=Nt.prototype.execute;Jn.prototype.execute=function(e){var t=e.shape;return Jh(t),t.labelTarget=e.labelTarget,Wh.call(this,e)};var Uh=Nt.prototype.revert;Jn.prototype.revert=function(e){return e.shape.labelTarget=null,Uh.call(this,e)};function Jh(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Dn(e,t){this._canvas=e,this._modeling=t}Dn.$inject=["canvas","modeling"],Dn.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;En(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),En(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Dn.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=La(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Dn.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(o.children,t,a),this._canvas.addConnection(t,o),t};function Ha(e,t){this._modeling=e,this._elementRegistry=t}Ha.$inject=["modeling","elementRegistry"],Ha.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;k.forEach(a,function(i){o.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function qn(e,t){this._canvas=e,this._modeling=t}qn.$inject=["canvas","modeling"],qn.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;En(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),En(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),En(o.children,function(a){Ze(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},qn.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=La(a.children,o),t.removeShape(o),o},qn.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,i=e.oldParentIndex;return Mt(a.children,o,i),t.addShape(o,a),o};function jo(e){this._modeling=e}jo.$inject=["modeling"];var ys={x:"y",y:"x"};jo.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,i=e.dimension;function r(y,x){y.range.min=Math.min(x[a],y.range.min),y.range.max=Math.max(x[a]+x[i],y.range.max)}function l(y){return y[a]+y[i]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function d(y,x){var b={y:0};b[a]=y-l(x),b[a]&&(b[ys[a]]=0,t.moveElements([x],b,x.parent))}var u=o[0],f=s(o),h=o[f],m,p,g=0;k.forEach(o,function(y,x){var b,w,C;if(y.elements.length<2){x&&x!==o.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}b=k.sortBy(y.elements,a),w=b[0],x===f&&(w=b[s(b)]),C=l(w),y.range=null,k.forEach(b,function(_){if(d(C,_),y.range===null){y.range={min:_[a],max:_[a]+_[i]};return}r(y,_)}),x&&x!==o.length-1&&(g+=c(y.range))}),p=Math.abs(h.range.min-u.range.max),m=Math.round((p-g)/(o.length-1)),!(m<o.length-1)&&k.forEach(o,function(y,x){var b={},w;y===u||y===h||(w=o[x-1],y.range.max=0,k.forEach(y.elements,function(C,_){b[ys[a]]=0,b[a]=w.range.max-C[a]+m,y.range.min!==C[a]&&(b[a]+=C[a]-y.range.min),b[a]&&t.moveElements([C],b,C.parent),y.range.max=Math.max(C[a]+C[i],_?y.range.max:0)}))})},jo.prototype.postExecute=function(e){};function To(e,t){this._layouter=e,this._canvas=t}To.$inject=["layouter","canvas"],To.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return k.assign(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},To.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wa(){}Wa.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=ko(r.children,t),Mt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x+=o.x,l.y+=o.y,l.original&&(l.original.x+=o.x,l.original.y+=o.y)}),t},Wa.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,i=e.oldParentIndex,r=e.delta;return ko(o.children,t),Mt(a.children,t,i),t.parent=a,k.forEach(t.waypoints,function(l){l.x-=r.x,l.y-=r.y,l.original&&(l.original.x-=r.x,l.original.y-=r.y)}),t};function Vo(e,t,o){var a=bl(t),i=bl(o),r=xn(e,a),l={x:r.x*(o.width/t.width),y:r.y*(o.height/t.height)};return Wn({x:i.x+l.x,y:i.y+l.y})}function Ua(e,t,o){var a=Mo(e),i=bs(a,t),r=a[0];return i.length?i[i.length-1]:Vo(r.original||r,o,t)}function Ja(e,t,o){var a=Mo(e),i=bs(a,t),r=a[a.length-1];return i.length?i[0]:Vo(r.original||r,o,t)}function Da(e,t,o){var a=Mo(e),i=vs(t,o),r=a[0];return Vo(r.original||r,i,t)}function qa(e,t,o){var a=Mo(e),i=vs(t,o),r=a[a.length-1];return Vo(r.original||r,i,t)}function vs(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Mo(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function bs(e,t){var o=k.map(e,qh);return k.filter(o,function(a){return Dh(a,t)})}function Dh(e,t){return Vt(t,e,1)==="intersect"}function qh(e){return e.original||e}function Ya(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ya.prototype.add=function(e,t){return this.addAll([e],t)},Ya.prototype.addAll=function(e,t){var o=Hp(e,!!t,this);return k.assign(this,o),this};function Yn(e){this._modeling=e}Yn.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},Yn.prototype.moveClosure=function(e,t,o,a,i){var r=this._modeling,l=e.allShapes,s=e.allConnections,c=e.enclosedConnections,d=e.topLevel,u=!1;i&&i.parent===o&&(u=!0),k.forEach(l,function(f){r.moveShape(f,t,d[f.id]&&!u&&o,{recurse:!1,layout:!1})}),k.forEach(s,function(f){var h=!!l[f.source.id],m=!!l[f.target.id];c[f.id]&&h&&m?r.moveConnection(f,t,d[f.id]&&!u&&o):r.layoutConnection(f,{connectionStart:h&&Da(f,f.source,t),connectionEnd:m&&qa(f,f.target,t)})})},Yn.prototype.getClosure=function(e){return new Ya().addAll(e,!0)};function Po(e){this._helper=new Yn(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 Kt(e){this._modeling=e,this._helper=new Yn(e)}Kt.$inject=["modeling"],Kt.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,i=e.newParentIndex,r=t.parent;return e.oldBounds=k.pick(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=ko(r.children,t),Mt(a.children,t,i),k.assign(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Kt.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,i=this._modeling;a.layout!==!1&&(k.forEach(t.incoming,function(r){i.layoutConnection(r,{connectionEnd:qa(r,t,o)})}),k.forEach(t.outgoing,function(r){i.layoutConnection(r,{connectionStart:Da(r,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Kt.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,i=e.delta;return Mt(o.children,t,a),k.assign(t,{parent:o,x:t.x-i.x,y:t.y-i.y}),t},Kt.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Kt.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Gn(e){this._modeling=e}Gn.$inject=["modeling"],Gn.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,i=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return k.isArray(i)&&(e.oldWaypoints=a.waypoints,a.waypoints=i),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},Gn.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,i=e.dockingOrPoints,r=e.hints||{},l={};r.connectionStart&&(l.connectionStart=r.connectionStart),r.connectionEnd&&(l.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(o&&(!a||r.docking==="source")&&(l.connectionStart=l.connectionStart||xs(k.isArray(i)?i[0]:i)),a&&(!o||r.docking==="target")&&(l.connectionEnd=l.connectionEnd||xs(k.isArray(i)?i[i.length-1]:i)),r.newWaypoints&&(l.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,l))},Gn.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,i=e.connection;return t&&(i.source=t),o&&(i.target=o),a&&(i.waypoints=a),i};function xs(e){return e.original||e}function vt(e,t){this._modeling=e,this._rules=t}vt.$inject=["modeling","rules"],vt.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,i=e.oldShape,r=e.newData,l=e.hints||{},s;function c(p,g,y){return a.allowed("connection.reconnect",{connection:y,source:p,target:g})}var d={x:r.x,y:r.y},u={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(r,d,i.parent,l),i.host&&o.updateAttachment(s,i.host);var f;l.moveChildren!==!1&&(f=i.children.slice(),o.moveElements(f,{x:0,y:0},s,l));var h=i.incoming.slice(),m=i.outgoing.slice();k.forEach(h,function(p){var g=p.source,y=c(g,s,p);y&&t.reconnectEnd(p,s,Ja(p,s,u),l)}),k.forEach(m,function(p){var g=p.target,y=c(s,g,p);y&&t.reconnectStart(p,s,Ua(p,s,u),l)})},vt.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},vt.prototype.execute=function(e){},vt.prototype.revert=function(e){},vt.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},vt.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},vt.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function Kn(e){this._modeling=e}Kn.$inject=["modeling"],Kn.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},Kn.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds,i=e.hints||{};i.layout!==!1&&(k.forEach(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ja(r,o,a)})}),k.forEach(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ua(r,o,a)})}))},Kn.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return k.assign(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function Yh(e,t){var o=[];return k.forEach(e.concat(t),function(a){var i=a.incoming,r=a.outgoing;k.forEach(i.concat(r),function(l){var s=l.source,c=l.target;(Xn(e,s)||Xn(e,c)||Xn(t,s)||Xn(t,c))&&(Xn(o,l)||o.push(l))})}),o}function Xn(e,t){return e.indexOf(t)!==-1}function Gh(e,t,o){var a=e.x,i=e.y,r=e.width,l=e.height,s=o.x,c=o.y;switch(t){case"n":return{x:a,y:i+c,width:r,height:l-c};case"s":return{x:a,y:i,width:r,height:l+c};case"w":return{x:a+s,y:i,width:r-s,height:l};case"e":return{x:a,y:i,width:r+s,height:l};default:throw new Error("unknown direction: "+t)}}function $t(e){this._modeling=e}$t.$inject=["modeling"],$t.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,i=e.resizingShapes,r=e.start,l={};this.moveShapes(a,t),k.forEach(i,function(s){l[s.id]=Xh(s)}),this.resizeShapes(i,t,o),this.updateConnectionWaypoints(Yh(a,i),t,o,r,a,i,l)},$t.prototype.execute=function(){},$t.prototype.revert=function(){},$t.prototype.moveShapes=function(e,t){var o=this;k.forEach(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},$t.prototype.resizeShapes=function(e,t,o){var a=this;k.forEach(e,function(i){var r=Gh(i,o,t);a._modeling.resizeShape(i,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},$t.prototype.updateConnectionWaypoints=function(e,t,o,a,i,r,l){var s=this,c=i.concat(r);k.forEach(e,function(d){var u=d.source,f=d.target,h=Kh(d),m=Cs(o),p={};Ot(c,u)&&Ot(c,f)?(h=k.map(h,function(g){return ks(g,a,o)&&(g[m]=g[m]+t[m]),g.original&&ks(g.original,a,o)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(d,h,{labelBehavior:!1})):(Ot(c,u)||Ot(c,f))&&(Ot(i,u)?p.connectionStart=Da(d,u,t):Ot(i,f)?p.connectionEnd=qa(d,f,t):Ot(r,u)?p.connectionStart=Ua(d,u,l[u.id]):Ot(r,f)&&(p.connectionEnd=Ja(d,f,l[f.id])),s._modeling.layoutConnection(d,p))})};function ws(e){return k.assign({},e)}function Kh(e){return k.map(e.waypoints,function(t){return t=ws(t),t.original&&(t.original=ws(t.original)),t})}function Cs(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function ks(e,t,o){var a=Cs(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Ot(e,t){return e.indexOf(t)!==-1}function Xh(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function No(e){this._modeling=e}No.$inject=["modeling"],No.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=Es(o),t.collapsed=!t.collapsed;var a=_s(o,t.collapsed);return[t].concat(a)},No.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,i=Ss(a,o);return t.collapsed=!t.collapsed,[t].concat(i)};function Es(e){var t={};return k.forEach(e,function(o){t[o.id]=o.hidden,o.children&&(t=k.assign({},t,Es(o.children)))}),t}function _s(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(_s(a.children,a.collapsed||t)))}),o}function Ss(e,t){var o=[];return k.forEach(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(Ss(a.children,t)))}),o}function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=Bs(a,t),js(o,t),t.host=o,t},$o.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,i=e.attacherIdx;return t.host=a,Bs(o,t),js(a,t,i),t};function Bs(e,t){return ko(e&&e.attachers,t)}function js(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),Mt(a,t,o)}}function Ga(){}Ga.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},Ga.prototype.revert=function(e){var t=e.connection,o=e.oldWaypoints;return t.waypoints=o,t};function me(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}me.$inject=["eventBus","elementFactory","commandStack"],me.prototype.getHandlers=function(){return{"shape.append":_o,"shape.create":Nt,"shape.delete":qn,"shape.move":Kt,"shape.resize":Kn,"shape.replace":vt,"shape.toggleCollapse":No,spaceTool:$t,"label.create":Jn,"connection.create":So,"connection.delete":Dn,"connection.move":Wa,"connection.layout":To,"connection.updateWaypoints":Ga,"connection.reconnect":Gn,"elements.create":Fa,"elements.move":Po,"elements.delete":Ha,"elements.distribute":jo,"elements.align":Eo,"element.updateAttachment":$o}},me.prototype.registerHandlers=function(e){k.forEach(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},me.prototype.moveShape=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=null);var r={shape:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("shape.move",r)},me.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},me.prototype.moveElements=function(e,t,o,a){a=a||{};var i=a.attach,r=o,l;i===!0?(l=o,r=o.parent):i===!1&&(l=null);var s={shapes:e,delta:t,newParent:r,newHost:l,hints:a};this._commandStack.execute("elements.move",s)},me.prototype.moveConnection=function(e,t,o,a,i){typeof a=="object"&&(i=a,a=void 0);var r={connection:e,delta:t,newParent:o,newParentIndex:a,hints:i||{}};this._commandStack.execute("connection.move",r)},me.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},me.prototype.createConnection=function(e,t,o,a,i,r){typeof o=="object"&&(r=i,i=a,a=o,o=void 0),a=this._create("connection",a);var l={source:e,target:t,parent:i,parentIndex:o,connection:a,hints:r};return this._commandStack.execute("connection.create",l),l.connection},me.prototype.createShape=function(e,t,o,a,i){typeof a!="number"&&(i=a,a=void 0),i=i||{};var r=i.attach,l,s;e=this._create("shape",e),r?(l=o.parent,s=o):l=o;var c={position:t,shape:e,parent:l,parentIndex:a,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape},me.prototype.createElements=function(e,t,o,a,i){k.isArray(e)||(e=[e]),typeof a!="number"&&(i=a,a=void 0),i=i||{};var r={position:t,elements:e,parent:o,parentIndex:a,hints:i};return this._commandStack.execute("elements.create",r),r.elements},me.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var i={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",i),i.shape},me.prototype.appendShape=function(e,t,o,a,i){i=i||{},t=this._create("shape",t);var r={source:e,position:o,target:a,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",r),r.shape},me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},me.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},me.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},me.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},me.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},me.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},me.prototype.resizeShape=function(e,t,o,a){var i={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",i)},me.prototype.createSpace=function(e,t,o,a,i){var r={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",r)},me.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},me.prototype.reconnect=function(e,t,o,a,i){var r={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:i||{}};this._commandStack.execute("connection.reconnect",r)},me.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,k.assign(a,{docking:"source"}))},me.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,k.assign(a,{docking:"target"}))},me.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},me.prototype._create=function(e,t){return zh(t)?t:this._elementFactory.create(e,t)},me.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function Ts(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ka(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function Zh(e,t){Array.isArray(e)&&e.forEach(t)}function Oo(e){const t=e.businessObject;if(t)return t.name||""}function Qh(e,t){const o=e.businessObject;return o.name=t,e}const em={height:20},Vs=15;function Xa(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function Ms(e){return Zn(e.label)}function tm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],i=nm(e),r=Math.atan((a.y-o.y)/(a.x-o.x));let{x:l,y:s}=i;return Math.abs(r)<Math.PI/2?s-=Vs:l+=Vs,{x:l,y:s}}function nm(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function Ps(e){return e.waypoints?tm(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+em.height/2}}function Zn(e){return e&&!!e.labelTarget}const om={width:0,height:0};function Ns(e,t){function o(s,c){const d=s.label||s,u=s.labelTarget||s;return Qh(d,c),[d,u]}function a(s){const{element:c,newLabel:d}=s,{businessObject:u}=c;if(!Zn(c)&&Xa(c)&&!Ms(c)&&!$s(d)){let h=Ps(c);h={x:h.x,y:h.y+7},e.createLabel(c,h,{id:u.id+"_label",businessObject:u})}}function i(s){return s.oldLabel=Oo(s.element),o(s.element,s.newLabel)}function r(s){return o(s.element,s.oldLabel)}function l(s){const{element:c,newLabel:d}=s,u=c.label||c,f=s.hints||{};let{newBounds:h}=s;if(!Zn(u))return;if(Zn(u)&&$s(d)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}const m=Oo(u);typeof h>"u"&&(h=t.getExternalLabelBounds(u,m)),h&&e.resizeShape(u,h,om)}this.preExecute=a,this.execute=i,this.revert=r,this.postExecute=l}Ns.$inject=["modeling","textRenderer"];function $s(e){return!e||!e.trim()}function Qn(e,t,o){me.call(this,e,t,o)}Ht(Qn,me),Qn.$inject=["eventBus","elementFactory","commandStack"],Qn.prototype.getHandlers=function(){const e=me.prototype.getHandlers.call(this);return e["element.updateLabel"]=Ns,e},Qn.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function Za(e,t){De.call(this,e);function o(a){const{context:i}=a,r=i.hints||{};let l;!i.cropped&&r.createElementsBehavior!==!1&&(l=i.connection,l.waypoints=t.getCroppedWaypoints(l),i.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}Ht(Za,De),Za.$inject=["eventBus","connectionDocking"];function Os(){}Os.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Te(t.source||e.source),t.connectionEnd||Te(t.target||e.target)]};var Ro=20,am=5,Ao=Math.round,Rs=20,im={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function rm(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function lm(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function As(e,t,o){var a=Vt(t,e,am),i=o.split(":")[0],r=Ao((t.x-e.x)/2+e.x),l=Ao((t.y-e.y)/2+e.y),s,c,d=lm(i,a),u=/h|r|l/.test(i),f=!1,h=!1;return d?(s=u?{x:r,y:e.y}:{x:e.x,y:l},c=u?"h:h":"v:v"):(f=rm(a,i),c=u?"h:v":"v:h",f?u?(h=l===e.y,s={x:e.x+Ro*(/l/.test(i)?-1:1),y:h?l+Ro:l}):(h=r===e.x,s={x:h?r+Ro:r,y:e.y+Ro*(/t/.test(i)?-1:1)}):s={x:r,y:l}),{waypoints:Qa(e,s,c).concat(s),directions:c,turnNextDirections:h}}function sm(e,t,o){return As(e,t,o)}function cm(e,t,o){var a=As(t,e,Ls(o));return{waypoints:a.waypoints.slice().reverse(),directions:Ls(a.directions),turnNextDirections:a.turnNextDirections}}function dm(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var i=o+":"+a,r=Qa(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:r,directions:i}}function Ls(e){return e.split(":").reverse().join(":")}function um(e,t,o){var a=Ao((t.x-e.x)/2+e.x),i=Ao((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Qa(e,t,o){if(o=o||"h:h",!xm(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(zs(o)){var a=sm(e,t,o),i=cm(e,t,o),r=dm(a,i);return[].concat(a.waypoints,r.waypoints,i.waypoints)}return um(e,t,o)}function fm(e,t,o){var a=Qa(e,t,o);return a.unshift(e),a.push(t),Hs(a)}function pm(e,t,o,a,i){var r=i&&i.preferredLayouts||[],l=k.without(r,"straight")[0]||"h:h",s=im[l]||0,c=Vt(e,t,s),d=bm(c,l);o=o||Te(e),a=a||Te(t);var u=d.split(":"),f=Fs(o,e,u[0],wm(c)),h=Fs(a,t,u[1],c);return fm(f,h,d)}function hm(e,t,o,a,i,r){k.isArray(o)&&(i=o,r=a,o=Te(e),a=Te(t)),r=k.assign({preferredLayouts:[]},r),i=i||[];var l=r.preferredLayouts,s=l.indexOf("straight")!==-1,c;return c=s&&gm(e,t,o,a,r),c||(c=r.connectionEnd&&vm(t,e,a,i),c)||(c=r.connectionStart&&ym(e,t,o,i),c)?c:!r.connectionStart&&!r.connectionEnd&&i&&i.length?i:pm(e,t,o,a,r)}function mm(e,t,o){return e>=t&&e<=o}function Is(e,t,o){var a={x:"width",y:"height"};return mm(t[e],o[e],o[e]+o[a[e]])}function gm(e,t,o,a,i){var r={},l,s;return s=Vt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(l="x"),/left|right/.test(s)&&(l="y"),i.preserveDocking==="target"?Is(l,a,e)?(r[l]=a[l],[{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y,original:{x:r.x!==void 0?r.x:o.x,y:r.y!==void 0?r.y:o.y}},{x:a.x,y:a.y}]):null:Is(l,o,t)?(r[l]=o[l],[{x:o.x,y:o.y},{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y,original:{x:r.x!==void 0?r.x:a.x,y:r.y!==void 0?r.y:a.y}}]):null):null}function ym(e,t,o,a){return ei(e,t,o,a)}function vm(e,t,o,a){var i=a.slice().reverse();return i=ei(e,t,o,i),i?i.reverse():null}function ei(e,t,o,a){function i(u){return u.length<3?!0:u.length>4?!1:!!k.find(u,function(f,h){var m=u[h-1];return m&&Hn(f,m)<3})}function r(u,f,h){var m=St(f,u);switch(m){case"v":return{x:h.x,y:u.y};case"h":return{x:u.x,y:h.y}}return{x:u.x,y:u.y}}function l(u,f,h){var m;for(m=u.length-2;m!==0;m--)if(Ol(u[m],f,Rs)||Ol(u[m],h,Rs))return u.slice(m);return u}if(i(a))return null;var s=a[0],c=a.slice(),d;return c[0]=o,c[1]=r(c[1],s,o),d=l(c,e,t),d!==c&&(c=ei(e,t,o,d)),c&&St(c)?null:c}function bm(e,t){if(zs(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 xm(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function zs(e){return e&&/t|r|b|l/.test(e)}function wm(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 Fs(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function Hs(e){return e.reduce(function(t,o,a){var i=t[t.length-1],r=e[a+1];return Ta(i,r,o,0)||t.push(o),t},[])}function ti(){}Ht(ti,Os);const Xt=(e,t)=>e.type===t;ti.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,i=t.waypoints||e.waypoints;let{connectionStart:r,connectionEnd:l}=t,s,c;return l===void 0&&(r=Lo(i&&i[0],o),l=Lo(i&&i[i.length-1],a)),r||(r=Lo(i&&i[0],o)),l||(l=Lo(i&&i[i.length-1],a)),Xt(e,"myline")&&(o===a?s={preferredLayouts:Cm(o,e)}:Xt(o,"gatewayAnd")||Xt(o,"gatewayXor")||Xt(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:Xt(a,"gatewayAnd")||Xt(a,"gatewayXor")||Xt(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=Se(s,t),c=Hs(hm(o,a,r,l,i,s))),c||[r,l]};function Lo(e,t){return e?e.original||e:Te(t)}function Cm(e,t){const{waypoints:o}=t,a=o&&o.length&&Vt(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Ws(e){return k.assign({original:e.point.original||e.point},e.actual)}function Rt(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rt.$inject=["elementRegistry","graphicsFactory"],Rt.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,o),r=e.waypoints.slice(a.idx+1,i.idx);return r.unshift(Ws(a)),r.push(Ws(i)),r},Rt.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,i,r,l;return i=o?0:a.length-1,r=a[i],l=this._getIntersection(t,e,o),{point:r,actual:l||r,idx:i}},Rt.prototype._getIntersection=function(e,t,o){var a=this._getShapePath(e),i=this._getConnectionPath(t);return Na(a,i,o)},Rt.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rt.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rt.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Us={__depends__:[Th,Nh,bn],__init__:["modeling","elementUpdater"],modeling:["type",Qn],layouter:["type",ti],elementUpdater:["type",Za],elementFactory:["type",Gt],connectionDocking:["type",Rt]};var km=1e3;function Zt(e,t){var o=this;t=t||km,e.on(["render.shape","render.connection"],t,function(a,i){var r=a.type,l=i.element,s=i.gfx,c=i.attrs;if(o.canRender(l))return r==="render.shape"?o.drawShape(s,l,c):o.drawConnection(s,l,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,i){if(o.canRender(i))return a.type==="render.getShapePath"?o.getShapePath(i):o.getConnectionPath(i)})}Zt.prototype.canRender=function(e){},Zt.prototype.drawShape=function(e,t){},Zt.prototype.drawConnection=function(e,t){},Zt.prototype.getShapePath=function(e){},Zt.prototype.getConnectionPath=function(e){};function Em(e){return e.businessObject}function Io(e,t){return e.businessObject.strokeWidth||t||1}function rt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function Ve(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function _m(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2,i=[["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]];return zn(i)}function Sm(e,t){const{x:o,y:a,width:i,height:r}=e,l=[["M",o+t,a],["l",i-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-i,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return zn(l)}function Bm(e){const{x:t,y:o,width:a,height:i}=e,r=a/2,l=i/2,s=[["M",t+r,o],["l",r,l],["l",-r,l],["l",-r,-l],["z"]];return zn(s)}function jm(e){const{x:t,y:o,width:a,height:i}=e,r=[["M",t,o],["l",a,0],["l",0,i],["l",-a,0],["z"]];return zn(r)}const ni=10,oi=.95,At=(e,t)=>e.type===t;function Qt(e,t,o,a,i,r,l){Zt.call(this,e,l);const s="var(--j-color-bg-container)",c="var(--j-color-text)",d={};Object.keys(r.palette).forEach(M=>{const E=r.palette[M];d[E.type]=E.options});const{computeStyle:u}=t;function f(M){return z[M]}function h(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2})}function m(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:c,strokeWidth:2,fill:"white"})}function p(M,E,$,R){$=h($);const Y=Ca(E,$,R);return P.append(M,Y),Y}function g(M,E,$){return p(M,E,$,5)}function y(M,E,$,R,Y){Ts(R)&&(Y=R,R=0),R=R||0,Y=u(Y,{stroke:c,strokeWidth:2,fill:s}),Y.fill==="none"&&delete Y.fillOpacity;const ee=E/2,se=$/2,de=P.create("circle");return P.attr(de,{cx:ee,cy:se,r:Math.round((E+$)/4-R)}),P.attr(de,Y),P.append(M,de),de}function x(M,E,$,R,Y,ee){Ts(Y)&&(ee=Y,Y=0),Y=Y||0,ee=u(ee,{stroke:c,strokeWidth:2,fill:s});const se=P.create("rect");return P.attr(se,{x:Y,y:Y,width:E-Y*2,height:$-Y*2,rx:R,ry:R}),P.attr(se,ee),P.append(M,se),se}function b(M,E,$){$=u($,["no-fill"],{strokeWidth:2,stroke:c});const R=P.create("path");return P.attr(R,{d:E}),P.attr(R,$),P.append(M,R),R}function w(M,E,$,R){const Y=E/2,ee=$/2,de=[{x:Y,y:0},{x:E,y:ee},{x:Y,y:$},{x:0,y:ee}].map(D=>D.x+","+D.y).join(" ");R=u(R,{stroke:c,strokeWidth:2,fill:s});const Me=P.create("polygon");return P.attr(Me,{points:de}),P.attr(Me,R),P.append(M,Me),Me}function C(M,E,$,R){return b(E,$,Se({"data-marker":M},R))}function _(M,E,$){$=Se({size:{width:100}},$);const R=i.createText(E||"",$);return P.classes(R).add("djs-label"),P.append(M,R),R}function v(M,E,$){const R=Em(E);return _(M,R.name,{box:E,align:$,padding:5,style:{fill:Ve(E,c)}})}function j(M,E){const $={width:90,height:30,x:E.width/2+E.x,y:E.height/2+E.y};return _(M,Oo(E),{box:$,fitBox:!0,style:Se({},i.getExternalStyle(),{fill:Ve(E,c)})})}function S(M,E,$){const R=$&&$.indexOf("SubProcessMarker")!==-1;let Y;R?Y={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:Y={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},Zh($,ee=>{f(ee)(M,E,Y)})}function B(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,E){const{ref:$={x:0,y:0},scale:R=1,element:Y,parentGfx:ee=a._svg}=E,se=P.create("marker",{id:M,viewBox:"0 0 20 20",refX:$.x,refY:$.y,markerWidth:20*R,markerHeight:20*R,orient:"auto"});P.append(se,Y);let de=A.query(":scope > defs",ee);de||(de=P.create("defs"),P.append(ee,de)),P.append(de,se)}function T(M,E,$,R){const Y=E+"-"+B($)+"-"+B(R)+"-"+rs();return L(M,Y,E,$,R),"url(#"+Y+")"}function L(M,E,$,R,Y){{const ee=P.create("path",{d:"M 1 5 L 11 10 L 1 15 Z",...m({fill:Y,stroke:Y,strokeWidth:1})});V(E,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:M})}}function F(M,E,$,R){const Y=d[E.type]?.icon||E.icon;if(Y){const ee=o.getScaledPath(Y,{abspos:{x:$,y:R}});b(M,ee,{strokeWidth:0,fill:Ve(E,d[E.type]?.iconFill||E.iconFill)})}}const z={event(M,E,$){return"fillOpacity"in $||($.fillOpacity=oi),y(M,E.width,E.height,$)},startEvent(M,E){const $={fill:rt(E,d.startEvent?.fill||E.fill),stroke:Ve(E,d.startEvent?.stroke||E.stroke),strokeWidth:Io(E,d.startEvent?.strokeWidth||E.strokeWidth)},R=f("event")(M,E,$);return F(M,E,18,18),R},endEvent(M,E){const $=f("event")(M,E,{strokeWidth:Io(E,d.endEvent?.strokeWidth||E.strokeWidth||4),fill:rt(E,d.endEvent?.fill||E.fill),stroke:Ve(E,d.endEvent?.stroke||E.stroke)});return F(M,E,18,18),$},gateway(M,E){const $={fillOpacity:oi,strokeWidth:Io(E,d[E.type]?.strokeWidth||E.strokeWidth||4),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)};return w(M,E.width,E.height,$)},gatewayAnd(M,E){const $=f("gateway")(M,E),R=o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:d[E.type]?.width||E.width,containerHeight:d[E.type]?.height||E.height,position:{mx:.47,my:.29}});return b(M,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayXor(M,E){const $=f("gateway")(M,E),R=o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}});return b(M,R,{strokeWidth:1,fill:Ve(E,d[E.type]?.iconFill||E.iconFill),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},gatewayInclusive(M,E){const $=f("gateway")(M,E);return y(M,E.width,E.height,E.height*.24,{strokeWidth:2.5,fill:Ve(E,s),stroke:Ve(E,d[E.type]?.iconFill||E.iconFill)}),$},activity(M,E,$){return $=$||{},"fillOpacity"in $||($.fillOpacity=oi),x(M,E.width,E.height,ni,$)},task(M,E){const $={fill:rt(E,s),stroke:Ve(E,c)},R=f("activity")(M,E,$);return v(M,E,"center-middle"),S(M,E),R},userTask(M,E){const $=f("task")(M,E),R=15,Y=12,ee=o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:R,y:Y}});b(M,ee,{strokeWidth:.5,fill:rt(E,s),stroke:Ve(E,c)});const se=o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:R,y:Y}});b(M,se,{strokeWidth:.5,fill:rt(E,s),stroke:Ve(E,c)});const de=o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:R,y:Y}});return b(M,de,{strokeWidth:.5,fill:Ve(E,c),stroke:Ve(E,c)}),$},scriptTask(M,E){const $=f("task")(M,E),R=o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(M,R,{strokeWidth:1,stroke:Ve(E,c)}),$},SubProcessMarker(M,E){const $=x(M,14,14,0,{strokeWidth:1,fill:rt(E,s),stroke:Ve(E,c)});ct($,E.width/2-7.5,E.height-20);const R=o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",M,R,{fill:rt(E,s),stroke:Ve(E,c)})},subprocess(M,E,$){$=Se({fill:rt(E,s),stroke:Ve(E,c)},$);const R=f("activity")(M,E,$);return v(M,E,"center-middle"),S(M,E,["SubProcessMarker"]),R},label(M,E){return j(M,E)},myline(M,E){const $=rt(E,r.lineStroke||s),R=Ve(E,r.lineStroke||c);return g(M,E.waypoints,{markerEnd:T(M,"sequenceflow-end",$,R),stroke:R})},default(M,E){const $={strokeWidth:Io(E,d[E.type]?.strokeWidth||E.strokeWidth||1),fill:rt(E,d[E.type]?.fill||E.fill),stroke:Ve(E,d[E.type]?.stroke||E.stroke)},R=x(M,E.width,E.height,E.radius||ni,$);return v(M,E,"center-middle"),S(M,E),F(M,E,E.iconX,E.iconY),R}};this.handlers=z,this._drawPath=b}Ht(Qt,Zt),Qt.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],Qt.prototype.canRender=function(){return!0},Qt.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},Qt.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},Qt.prototype.getShapePath=function(e){return At(e,"startEvent")||At(e,"endEvent")?_m(e):At(e,"userTask")||At(e,"scriptTask")||At(e,"subprocess")?Sm(e,ni):At(e,"gatewayAnd")||At(e,"gatewayXor")||At(e,"gatewayInclusive")?Bm(e):jm(e)};var Tm=0,Vm={width:150,height:50};function Mm(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Pm(e){return k.isObject(e)?k.assign({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}function Nm(e,t){t.textContent=e;var o;try{var a,i=e==="";return t.textContent=i?"dummy":e,o=t.getBBox(),a={width:o.width+o.x*2,height:o.height},i&&(a.width=0),a}catch(r){return console.log(r),{width:0,height:0}}}function $m(e,t,o){for(var a=e.shift(),i=a,r;;){if(r=Nm(i,o),r.width=i?r.width:0,i===" "||i===""||r.width<Math.round(t)||i.length<2)return Om(e,i,a,r);i=Am(i,r.width,t)}}function Om(e,t,o,a){if(t.length<o.length){var i=o.slice(t.length).trim();e.unshift(i)}return{width:a.width,height:a.height,text:t}}var Js="­";function Rm(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,i=[],r=0;if(o.length>1)for(;a=o.shift();)if(a.length+r<t)i.push(a),r+=a.length;else{(a==="-"||a===Js)&&i.pop();break}var l=i[i.length-1];return l&&l===Js&&(i[i.length-1]="-"),i.join("")}function Am(e,t,o){var a=Math.max(e.length*(o/t),1),i=Rm(e,a);return i||(i=e.slice(0,Math.max(Math.round(a-1),1))),i}function Lm(){var e=document.getElementById("helper-svg");return e||(e=P.create("svg"),P.attr(e,{id:"helper-svg"}),A.assignStyle(e,{visibility:"hidden",position:"fixed",width:0,height:0}),document.body.appendChild(e)),e}function zo(e){this._config=k.assign({},{size:Vm,padding:Tm,style:{},align:"center-top"},e||{})}zo.prototype.createText=function(e,t){return this.layoutText(e,t).element},zo.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},zo.prototype.layoutText=function(e,t){var o=k.assign({},this._config.size,t.box),a=k.assign({},this._config.style,t.style),i=Mm(t.align||this._config.align),r=Pm(t.padding!==void 0?t.padding:this._config.padding),l=t.fitBox||!1,s=Im(a),c=e.split(/\u00AD?\r?\n/),d=[],u=o.width-r.left-r.right,f=P.create("text");P.attr(f,{x:0,y:0}),P.attr(f,a);var h=Lm();for(P.append(h,f);c.length;)d.push($m(c,u,f));i.vertical==="middle"&&(r.top=r.bottom=0);var m=k.reduce(d,function(b,w,C){return b+(s||w.height)},0)+r.top+r.bottom,p=k.reduce(d,function(b,w,C){return w.width>b?w.width:b},0),g=r.top;i.vertical==="middle"&&(g+=(o.height-m)/2),g-=(s||d[0].height)/4;var y=P.create("text");P.attr(y,a),k.forEach(d,function(b){var w;switch(g+=s||b.height,i.horizontal){case"left":w=r.left;break;case"right":w=(l?p:u)-r.right-b.width;break;default:w=Math.max(((l?p:u)-b.width)/2+r.left,0)}var C=P.create("tspan");P.attr(C,{x:w,y:g}),C.textContent=b.text,P.append(y,C)}),P.remove(f);var x={width:p,height:m};return{dimensions:x,element:y}};function Im(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}const zm=12,Fm=1.2,Hm=30;function Ds(e){const t=Se({fontFamily:"Arial, sans-serif",fontSize:zm,fontWeight:"normal",lineHeight:Fm},e&&e.defaultStyle||{}),o=parseInt(t.fontSize,10)-1,a=Se({},t,{fontSize:o},e&&e.externalStyle||{}),i=new zo({style:t});this.getExternalLabelBounds=function(r,l){const s=i.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:a});return{x:Math.round(r.x+r.width/2-s.width/2),y:Math.round(r.y),width:Math.ceil(s.width),height:Math.ceil(s.height)}},this.getTextAnnotationBounds=function(r,l){const s=i.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(Hm,Math.round(s.height))}},this.createText=function(r,l){return i.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return a}}Ds.$inject=["config.textRenderer"];function Wm(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,i;o.abspos?(a=o.abspos.x,i=o.abspos.y):(a=o.containerWidth*o.position.mx,i=o.containerHeight*o.position.my);let r={};typeof t=="object"?(r=t,r.d.indexOf("{mx},{my}")===-1&&(r.d="m {mx},{my}"+r.d),r.width&&(a-=r.width/2),r.height&&(i-=r.height/2)):r=this.pathMap[t];const l={};if(o.position){const c=o.containerHeight/r.height*o.yScaleFactor,d=o.containerWidth/r.width*o.xScaleFactor;for(let u=0;u<r.heightElements.length;u++)l["y"+u]=r.heightElements[u]*c;for(let u=0;u<r.widthElements.length;u++)l["x"+u]=r.widthElements[u]*d}return qm(r.d,{mx:a,my:i,e:l})}}const Um=/\{([^}]+)\}/g,Jm=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Dm(e,t,o){let a=o;return t.replace(Jm,(i,r,l,s,c)=>{r=r||s,a&&(r in a&&(a=a[r]),typeof a=="function"&&c&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function qm(e,t){return String(e).replace(Um,(o,a)=>Dm(o,a,t))}const qs={__init__:["myRenderer"],myRenderer:["type",Qt],textRenderer:["type",Ds],pathMap:["type",Wm]};function Ys(e,t){return Se({id:e.id,type:e.type,businessObject:e},t)}function Ym(e,t,o){const a=e.waypoint;return!a||a.length<2?[Te(t),Te(o)]:a.map(i=>({x:i.x,y:i.y}))}function Lt(e,t,o,a,i,r){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=i,this._translate=ls,this._textRenderer=r,this._modeling=t}Lt.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Lt.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),i=this._getTarget(e);t=this._elementFactory.createConnection(Ys(e,{source:a,target:i,waypoints:Ym(e,a,i)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Ys(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Lt.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)},Lt.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=Se(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:i}=t;if(i&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const r={x:t.x+12,y:t.y+42,width:10,height:10,name:i,id:e},l=this._textRenderer.getExternalLabelBounds(r,t.name);this._modeling.resizeShape(r,l,{width:0,height:0}),o&&this.addLabel(r,o)}}},Lt.prototype._getSource=function(e){return this._getElement(e.from)},Lt.prototype._getTarget=function(e){return this._getElement(e.to)},Lt.prototype._getElement=function(e){return this._elementRegistry.get(e)};const Gs={myImporter:["type",Lt]},Ks=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(i=>({x:i.x,y:i.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const i=t.find(r=>r.id===a.id);i&&(i.name=a.name||"",i.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Xs=(e,t)=>{const o=t.get("myImporter"),a=e.filter(r=>r.type!=="myline"),i=e.filter(r=>r.type==="myline");a.forEach(r=>{o.add(r)}),i.forEach(r=>{o.add(r)})},Gm=n.defineComponent({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const v=s.get("eventBus");v.on("element.dblclick",j=>{i("elementDblclick",j.element.businessObject)}),v.on("element.click",j=>{i("elementClick",j.element.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let v={__init__:["myOptions"],myOptions:["type",f]};s=new Pi({canvas:{container:r.value},modules:[Oa,$l,Us,es,os,v,qs,Gs]});const j=s.get("canvas"),S=s.get("elementFactory");d();const B=S.createRoot();j.setRootElement(B),u()};n.onMounted(()=>{h()});const m=v=>{const j=v==null?1:c+v;s.get("canvas").zoom(j),c=j},p=()=>{s.get("canvas").zoom(1);const v=s.get("elementRegistry").getAll();var j=Ks(v);return j},g=v=>{s.clear(),d(),Xs(v,s)},y=v=>{s.get("myImporter").update(v.id,v)};return t({reset:()=>{d()},zoom:v=>{m(v)},getData:()=>p(),setData:v=>{g(v)},updateElemet:v=>{y(v)}}),(v,j)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}});function ai(e){return e&&e[e.length-1]}function Zs(e){return e.y}function Qs(e){return e.x}var Km={left:Qs,center:Qs,right:function(e){return e.x+e.width},top:Zs,middle:Zs,bottom:function(e){return e.y+e.height}};function Sn(e,t){this._modeling=e,this._rules=t}Sn.$inject=["modeling","rules"],Sn.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},Sn.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Sn.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,i=o.dimension,r={},l={},s=!1,c,d,u;function f(h,m){return Math.round((h[a]+m[a]+m[i])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][a];else if(this._isType(e,["right","bottom"]))u=ai(t),r[e]=u[a]+u[i];else if(this._isType(e,["center","middle"])){if(k.forEach(t,function(h){var m=h[a]+Math.round(h[i]/2);l[m]?l[m].elements.push(h):l[m]={elements:[h],center:m}}),c=k.sortBy(l,function(h){return h.elements.length>1&&(s=!0),h.elements.length}),s)return r[e]=ai(c).center,r;d=t[0],t=k.sortBy(t,function(h){return h[a]+h[i]}),u=ai(t),r[e]=f(d,u)}return r},Sn.prototype.trigger=function(e,t){var o=this._modeling,a,i=k.filter(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:i}),k.isArray(a)&&(i=a),!(i.length<2||!a)){var r=Km[t],l=k.sortBy(i,r),s=this._alignmentPosition(t,l);o.alignElements(l,s)}};const Xm={__init__:["alignElements"],alignElements:["type",Sn]};var Fo=Math.round,Zm=Math.max;function Qm(e,t){var o=e.x,a=e.y;return[["M",o,a],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function eg(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var ec=10;function tg(e,t){var o,a;for(o=0;a=e[o];o++)if(Hn(a,t)<=ec)return{point:e[o],bendpoint:!0,index:o};return null}function ng(e,t){var o=Wl(Qm(t,ec),eg(e)),a=o[0],i=o[o.length-1],r;return a?a!==i?a.segment2!==i.segment2?(r=Zm(a.segment2,i.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Fo(a.x+i.x)/2,y:Fo(a.y+i.y)/2},index:a.segment2}:{point:{x:Fo(a.x),y:Fo(a.y)},index:a.segment2}:null}function og(e,t){return tg(e,t)||ng(e,t)}function ag(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ig(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],i=a[0].n*t[0]+a[1].n*t[1],r=a[0].lambda*t[0]+a[1].lambda*t[1];return-i/r}function tc(e,t){var o=t[0],a=t[1],i={x:a.x-o.x,y:a.y-o.y},r=ig([o.x,o.y],[i.x,i.y],[e.x,e.y]);return{x:o.x+r*i.x,y:o.y+r*i.y}}function rg(e,t){var o=tc(e,t),a={x:o.x-e.x,y:o.y-e.y};return ag(a)}var nc="djs-bendpoint",oc="djs-segment-dragger";function lg(e,t){var o=yn(t),a=e._container.getBoundingClientRect(),i;i={x:a.left,y:a.top};var r=e.viewbox();return{x:r.x+(o.x-i.x)/r.scale,y:r.y+(o.y-i.y)/r.scale}}function ii(e,t,o){var a=lg(e,o),i=og(t,a);return i}function ri(e,t){var o=P.create("g");P.classes(o).add(nc),P.append(e,o);var a=P.create("circle");P.attr(a,{cx:0,cy:0,r:4}),P.classes(a).add("djs-visual"),P.append(o,a);var i=P.create("circle");return P.attr(i,{cx:0,cy:0,r:10}),P.classes(i).add("djs-hit"),P.append(o,i),t&&P.classes(o).add(t),o}function sg(e,t,o,a){var i=P.create("g");P.append(e,i);var r=18,l=6,s=11,c=dg(t,o,a),d=l+s,u=P.create("rect");P.attr(u,{x:-r/2,y:-l/2,width:r,height:l}),P.classes(u).add("djs-visual"),P.append(i,u);var f=P.create("rect");return P.attr(f,{x:-c/2,y:-d/2,width:c,height:d}),P.classes(f).add("djs-hit"),P.append(i,f),Gp(i,a==="v"?90:0),i}function ac(e,t,o){var a=P.create("g"),i=Va(t,o),r=St(t,o);return P.append(e,a),sg(a,t,o,r),P.classes(a).add(oc),P.classes(a).add(r==="h"?"horizontal":"vertical"),ct(a,i.x,i.y),a}function li(e){return Math.abs(Math.round(e*2/3))}function cg(e,t){var o=ug(e,t);return tc(e,o)}function dg(e,t,o){var a=t.x-e.x,i=t.y-e.y;return li(o==="h"?a:i)}function ug(e,t){for(var o=t.waypoints,a=1/0,i,r=0;r<o.length-1;r++){var l=o[r],s=o[r+1],c=rg(e,[l,s]);c<a&&(a=c,i=r)}return[o[i],o[i+1]]}function si(e){return CSS.escape(e)}function ic(e,t,o,a,i){function r(w,C,_){var v=w.index,j=w.point,S,B,V,T,L,F;return v<=0||w.bendpoint?!1:(S=C[v-1],B=C[v],V=Va(S,B),T=St(S,B),L=Math.abs(j.x-V.x),F=Math.abs(j.y-V.y),T&&L<=_&&F<=_)}function l(w,C){var _=w.waypoints,v,j,S,B;return C.index<=0||C.bendpoint||(v={start:_[C.index-1],end:_[C.index]},j=St(v.start,v.end),!j)?null:(j==="h"?S=v.end.x-v.start.x:S=v.end.y-v.start.y,B=li(S)/2,B)}function s(w,C){var _=C.waypoints,v=ii(t,_,w),j;if(v)return j=l(C,v),r(v,_,j)?i.start(w,C,v.index):a.start(w,C,v.index,!v.bendpoint),!0}function c(w,C,_){A.event.bind(w,C,function(v){o.triggerMouseEvent(C,v,_),v.stopPropagation()})}function d(w,C){var _=t.getLayer("overlays"),v=A.query('.djs-bendpoints[data-element-id="'+si(w.id)+'"]',_);return!v&&C&&(v=P.create("g"),P.attr(v,{"data-element-id":w.id}),P.classes(v).add("djs-bendpoints"),P.append(_,v),c(v,"mousedown",w),c(v,"click",w),c(v,"dblclick",w)),v}function u(w,C){return A.query('.djs-segment-dragger[data-segment-idx="'+w+'"]',C)}function f(w,C){C.waypoints.forEach(function(_,v){var j=ri(w);P.append(w,j),ct(j,_.x,_.y)}),ri(w,"floating")}function h(w,C){for(var _=C.waypoints,v,j,S,B=1;B<_.length;B++)v=_[B-1],j=_[B],St(v,j)&&(S=ac(w,v,j),P.attr(S,{"data-segment-idx":B}),c(S,"mousemove",C))}function m(w){k.forEach(A.queryAll("."+nc,w),function(C){P.remove(C)})}function p(w){k.forEach(A.queryAll("."+oc,w),function(C){P.remove(C)})}function g(w){var C=d(w);return C||(C=d(w,!0),f(C,w),h(C,w)),C}function y(w){var C=d(w);C&&(p(C),m(C),h(C,w),f(C,w))}function x(w,C){var _=A.query(".floating",w),v=C.point;_&&ct(_,v.x,v.y)}function b(w,C,_){var v=u(C.index,w),j=_[C.index-1],S=_[C.index],B=C.point,V=Va(j,S),T=St(j,S),L,F;v&&(L=fg(v),F={x:B.x-V.x,y:B.y-V.y},T==="v"&&(F={x:F.y,y:F.x}),ct(L,F.x,F.y))}e.on("connection.changed",function(w){y(w.element)}),e.on("connection.remove",function(w){var C=d(w.element);C&&P.remove(C)}),e.on("element.marker.update",function(w){var C=w.element,_;C.waypoints&&(_=g(C),w.add?P.classes(_).add(w.marker):P.classes(_).remove(w.marker))}),e.on("element.mousemove",function(w){var C=w.element,_=C.waypoints,v,j;if(_){if(v=d(C,!0),j=ii(t,_,w.originalEvent),!j)return;x(v,j),j.bendpoint||b(v,j,_)}}),e.on("element.mousedown",function(w){if(Et(w)){var C=w.originalEvent,_=w.element;if(_.waypoints)return s(C,_)}}),e.on("selection.changed",function(w){var C=w.newSelection,_=C[0];_&&_.waypoints&&g(_)}),e.on("element.hover",function(w){var C=w.element;C.waypoints&&(g(C),o.registerEvent(w.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(w){o.unregisterEvent(w.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(w){var C=w.element,_=w.newId;if(C.waypoints){var v=d(C);v&&P.attr(v,{"data-element-id":_})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=d,this.getSegmentDragger=u}ic.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function fg(e){return A.query(".djs-visual",e)}var rc=Math.round,en="reconnectStart",tn="reconnectEnd",eo="updateWaypoints";function ci(e,t,o,a,i,r){this._injector=e,this.start=function(l,s,c,d){var u=o.getGraphics(s),f=s.source,h=s.target,m=s.waypoints,p;!d&&c===0?p=en:!d&&c===m.length-1?p=tn:p=eo;var g=p===eo?"connection.updateWaypoints":"connection.reconnect",y=i.allowed(g,{connection:s,source:f,target:h});y===!1&&(y=i.allowed(g,{connection:s,source:h,target:f})),y!==!1&&a.init(l,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:h,insert:d,type:p}}})},t.on("bendpoint.move.hover",function(l){var s=l.context,c=s.connection,d=c.source,u=c.target,f=l.hover,h=s.type;s.hover=f;var m;if(f){var p=h===eo?"connection.updateWaypoints":"connection.reconnect";if(m=s.allowed=i.allowed(p,{connection:c,source:h===en?f:d,target:h===tn?f:u}),m){s.source=h===en?f:d,s.target=h===tn?f:u;return}m===!1&&(m=s.allowed=i.allowed(p,{connection:c,source:h===tn?f:u,target:h===en?f:d})),m&&(s.source=h===tn?f:u,s.target=h===en?f:d)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(l){var s=l.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==eo&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(l){var s=l.context,c=s.allowed,d=s.bendpointIndex,u=s.connection,f=s.insert,h=u.waypoints.slice(),m=s.source,p=s.target,g=s.type,y=s.hints||{},x={x:rc(l.x),y:rc(l.y)};if(!c)return!1;g===eo?(f?h.splice(d,0,x):h[d]=x,y.bendpointMove={insert:f,bendpointIndex:d},h=this.cropWaypoints(u,h),r.updateWaypoints(u,bh(h),y)):(g===en?(y.docking="source",Ho(s)&&(y.docking="target",y.newWaypoints=h.reverse())):g===tn&&(y.docking="target",Ho(s)&&(y.docking="source",y.newWaypoints=h.reverse())),r.reconnect(u,m,p,x,y))},this)}ci.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ci.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function Ho(e){var t=e.hover,o=e.source,a=e.target,i=e.type;if(i===en)return t&&a&&t===a&&o!==a;if(i===tn)return t&&o&&t===o&&o!==a}var pg="reconnectStart",hg="reconnectEnd",lc="updateWaypoints",to="connect-ok",Wo="connect-not-ok",sc="connect-hover",cc="djs-updating",dc="djs-dragging",uc=1100;function fc(e,t,o,a){this._injector=t;var i=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(r){var l=r.context,s=l.bendpointIndex,c=l.connection,d=l.insert,u=c.waypoints,f=u.slice();l.waypoints=u,d&&f.splice(s,0,{x:r.x,y:r.y}),c.waypoints=f;var h=l.draggerGfx=ri(a.getLayer("overlays"));P.classes(h).add("djs-dragging"),a.addMarker(c,dc),a.addMarker(c,cc)}),o.on("bendpoint.move.hover",function(r){var l=r.context,s=l.allowed,c=l.hover,d=l.type;if(c){if(a.addMarker(c,sc),d===lc)return;s?(a.removeMarker(c,Wo),a.addMarker(c,to)):s===!1&&(a.removeMarker(c,to),a.addMarker(c,Wo))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],uc,function(r){var l=r.context,s=l.hover,c=l.target;s&&(a.removeMarker(s,sc),a.removeMarker(s,c?to:Wo))}),o.on("bendpoint.move.move",function(r){var l=r.context,s=l.allowed,c=l.bendpointIndex,d=l.draggerGfx,u=l.hover,f=l.type,h=l.connection,m=h.source,p=h.target,g=h.waypoints.slice(),y={x:r.x,y:r.y},x=l.hints||{},b={};i&&(x.connectionStart&&(b.connectionStart=x.connectionStart),x.connectionEnd&&(b.connectionEnd=x.connectionEnd),f===pg?Ho(l)?(b.connectionEnd=b.connectionEnd||y,b.source=p,b.target=u||m,g=g.reverse()):(b.connectionStart=b.connectionStart||y,b.source=u||m,b.target=p):f===hg?Ho(l)?(b.connectionStart=b.connectionStart||y,b.source=u||p,b.target=m,g=g.reverse()):(b.connectionEnd=b.connectionEnd||y,b.source=m,b.target=u||p):(b.noCropping=!0,b.noLayout=!0,g[c]=y),f===lc&&(g=e.cropWaypoints(h,g)),b.waypoints=g,i.drawPreview(l,s,b)),ct(d,r.x,r.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],uc,function(r){var l=r.context,s=l.connection,c=l.draggerGfx,d=l.hover,u=l.target,f=l.waypoints;s.waypoints=f,P.remove(c),a.removeMarker(s,cc),a.removeMarker(s,dc),d&&(a.removeMarker(d,to),a.removeMarker(d,u?to:Wo)),i&&i.cleanUp(l)})}fc.$inject=["bendpointMove","injector","eventBus","canvas"];var pc="connect-hover",hc="djs-updating";function mc(e,t,o){return di(e,t,e[t]+o)}function di(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function mg(e,t,o,a){var i=Math.max(t[a],o[a]),r=Math.min(t[a],o[a]),l=20,s=Math.min(Math.max(r+l,e[a]),i-l);return di(t,a,s)}function gc(e){return e==="x"?"y":"x"}function yc(e,t,o){var a,i;return e.original?e.original:(a=Te(t),i=gc(o),di(e,i,a[i]))}function vc(e,t,o,a,i,r){var l=e.get("connectionDocking",!1);this.start=function(f,h,m){var p,g=o.getGraphics(h),y=m-1,x=m,b=h.waypoints,w=b[y],C=b[x],_=ii(o,b,f),v,j,S;v=St(w,C),v&&(j=v==="v"?"x":"y",y===0&&(w=yc(w,h.source,j)),x===b.length-1&&(C=yc(C,h.target,j)),_?S=_.point:S={x:(w.x+C.x)/2,y:(w.y+C.y)/2},p={connection:h,segmentStartIndex:y,segmentEndIndex:x,segmentStart:w,segmentEnd:C,axis:j,dragPosition:S},a.init(f,S,"connectionSegment.move",{cursor:j==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:g,context:p}}))};function s(f,h){if(!l)return h;var m=f.waypoints,p;return f.waypoints=h,p=l.getCroppedWaypoints(f),f.waypoints=m,p}function c(f){i.update("connection",f.connection,f.connectionGfx)}function d(f,h,m){var p=f.newWaypoints,g=f.segmentStartIndex+h,y=p[g],x=f.segmentEndIndex+h,b=p[x],w=gc(f.axis),C=mg(m,y,b,w);ct(f.draggerGfx,C.x,C.y)}function u(f,h){var m=0,p=f.filter(function(g,y){return Ta(f[y-1],f[y+1],g)?(m=y<=h?m-1:m,!1):!0});return{waypoints:p,segmentOffset:m}}t.on("connectionSegment.move.start",function(f){var h=f.context,m=f.connection,p=o.getLayer("overlays");h.originalWaypoints=m.waypoints.slice(),h.draggerGfx=ac(p,h.segmentStart,h.segmentEnd),P.classes(h.draggerGfx).add("djs-dragging"),o.addMarker(m,hc)}),t.on("connectionSegment.move.move",function(f){var h=f.context,m=h.connection,p=h.segmentStartIndex,g=h.segmentEndIndex,y=h.segmentStart,x=h.segmentEnd,b=h.axis,w=h.originalWaypoints.slice(),C=mc(y,b,f["d"+b]),_=mc(x,b,f["d"+b]),v=w.length,j=0;w[p]=C,w[g]=_;var S,B;p<2&&(S=Vt(m.source,C),p===1?S==="intersect"&&(w.shift(),w[0]=C,j--):S!=="intersect"&&(w.unshift(y),j++)),g>v-3&&(B=Vt(m.target,_),g===v-2?B==="intersect"&&(w.pop(),w[w.length-1]=_):B!=="intersect"&&w.push(x)),h.newWaypoints=m.waypoints=s(m,w),d(h,j,f),h.newSegmentStartIndex=p+j,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,o.addMarker(f.hover,pc)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&o.removeMarker(h,pc)}),t.on("connectionSegment.move.cleanup",function(f){var h=f.context,m=h.connection;h.draggerGfx&&P.remove(h.draggerGfx),o.removeMarker(m,hc)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,m=h.connection;m.waypoints=h.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var h=f.context,m=h.connection,p=h.newWaypoints,g=h.newSegmentStartIndex;p=p.map(function(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.y)}});var y=u(p,g),x=y.waypoints,b=s(m,x),w=y.segmentOffset,C={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:g+w}};r.updateWaypoints(m,b,C)})}vc.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var gg=Math.abs,bc=Math.round;function yg(e,t,o){o=o===void 0?10:o;var a,i;for(a=0;a<t.length;a++)if(i=t[a],gg(i-e)<=o)return i}function vg(e){return{x:e.x,y:e.y}}function bg(e){return{x:e.x+e.width,y:e.y+e.height}}function Bn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:bc(e.x+e.width/2),y:bc(e.y+e.height/2)}}function Uo(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function bt(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,i=e[t],r=e.snapped=e.snapped||{};return o===!1?r[t]=!1:(r[t]=!0,a=o-i,e[t]+=a,e["d"+t]+=a),i}function xc(e){return e.children||[]}var xg=Math.abs,wc=Math.round,ui=10;function Cc(e){function t(r,l){if(k.isArray(r)){for(var s=r.length;s--;)if(xg(r[s]-l)<=ui)return r[s]}else{r=+r;var c=l%r;if(c<ui)return l-c;if(c>r-ui)return l-c+r}return l}function o(r,l){if(r.waypoints)return cg(l,r);if(r.width)return{x:wc(r.width/2+r.x),y:wc(r.height/2+r.y)}}function a(r){var l=r.context,s=l.snapPoints,c=l.connection,d=c.waypoints,u=l.segmentStart,f=l.segmentStartIndex,h=l.segmentEnd,m=l.segmentEndIndex,p=l.axis;if(s)return s;var g=[d[f-1],u,h,d[m+1]];return f<2&&g.unshift(o(c.source,r)),m>d.length-3&&g.unshift(o(c.target,r)),l.snapPoints=s={horizontal:[],vertical:[]},k.forEach(g,function(y){y&&(y=y.original||y,p==="y"&&s.horizontal.push(y.y),p==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var l=a(r),s=r.x,c=r.y,d,u;if(l){d=t(l.vertical,s),u=t(l.horizontal,c);var f=s-d,h=c-u;k.assign(r,{dx:r.dx-f,dy:r.dy-h,x:d,y:u}),(f||l.vertical.indexOf(s)!==-1)&&bt(r,"x",d),(h||l.horizontal.indexOf(c)!==-1)&&bt(r,"y",u)}});function i(r){var l=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(l)return l;var d=[s[c-1],s[c+1]];return r.snapPoints=l={horizontal:[],vertical:[]},k.forEach(d,function(u){u&&(u=u.original||u,l.horizontal.push(u.y),l.vertical.push(u.x))}),l}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var l=r.context,s=l.hover,c=s&&o(s,r);!Ze(s)||!c||!c.x||!c.y||(bt(r,"x",c.x),bt(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var l=r.context,s=i(l),c=l.hover,d=c&&o(c,r),u=r.x,f=r.y,h,m;if(s){h=t(d?s.vertical.concat([d.x]):s.vertical,u),m=t(d?s.horizontal.concat([d.y]):s.horizontal,f);var p=u-h,g=f-m;k.assign(r,{dx:r.dx-p,dy:r.dy-g,x:r.x-p,y:r.y-g}),(p||s.vertical.indexOf(u)!==-1)&&bt(r,"x",h),(g||s.horizontal.indexOf(f)!==-1)&&bt(r,"y",m)}})}Cc.$inject=["eventBus"];const wg={__depends__:[qt,Cn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ic],bendpointMove:["type",ci],bendpointMovePreview:["type",fc],connectionSegmentMove:["type",vc],bendpointSnapping:["type",Cc]};var Cg="djs-dragger";function xt(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}xt.$inject=["injector","canvas","graphicsFactory","elementFactory"],xt.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,i=e.getConnection,r=o.source,l=o.target,s=o.waypoints,c=o.connectionStart,d=o.connectionEnd,u=o.noLayout,f=o.noCropping,h=o.noNoop,m,p=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),P.clear(a),i||(i=e.getConnection=kg(function(g,y,x){return p.getConnection(g,y,x)})),t&&(m=i(t,r,l)),!m){!h&&this.drawNoopPreview(a,o);return}m.waypoints=s||[],this._layouter&&!u&&(m.waypoints=this._layouter.layoutConnection(m,{source:r,target:l,connectionStart:c,connectionEnd:d,waypoints:o.waypoints||m.waypoints})),(!m.waypoints||!m.waypoints.length)&&(m.waypoints=[r?Te(r):c,l?Te(l):d]),this._connectionDocking&&(r||l)&&!f&&(m.waypoints=this._connectionDocking.getCroppedWaypoints(m,r,l)),this._graphicsFactory.drawConnection(a,m,{stroke:"var(--element-dragger-color)"})},xt.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,i=t.connectionStart||Te(o),r=t.connectionEnd||Te(a),l=this.cropWaypoints(i,r,o,a),s=this.createNoopConnection(l[0],l[1]);P.append(e,s)},xt.prototype.cropWaypoints=function(e,t,o,a){var i=this._graphicsFactory,r=o&&i.getShapePath(o),l=a&&i.getShapePath(a),s=i.getConnectionPath({waypoints:[e,t]});return e=o&&Na(r,s,!0)||e,t=a&&Na(l,s,!1)||t,[e,t]},xt.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&P.remove(e.connectionPreviewGfx)},xt.prototype.getConnection=function(e){var t=Eg(e);return this._elementFactory.createConnection(t)},xt.prototype.createConnectionPreviewGfx=function(){var e=P.create("g");return P.attr(e,{pointerEvents:"none"}),P.classes(e).add(Cg),P.append(this._canvas.getActiveLayer(),e),e},xt.prototype.createNoopConnection=function(e,t){return Ca([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kg(e){var t={};return function(o){var a=JSON.stringify(o),i=t[a];return i||(i=t[a]=e.apply(null,arguments)),i}}function Eg(e){return k.isObject(e)?e:{}}const _g={__init__:["connectionPreview"],connectionPreview:["type",xt]};var Sg=new xo("ov"),Bg=500;function Ie(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Sg,this._overlayDefaults=k.assign({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=jg(o.getContainer()),this._init()}Ie.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ie.prototype.get=function(e){if(k.isString(e)&&(e={id:e}),k.isString(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k.filter(t.overlays,k.matchPattern({type:e.type})):t.overlays.slice():[]}else return e.type?k.filter(this._overlays,k.matchPattern({type:e.type})):e.id?this._overlays[e.id]:null},Ie.prototype.add=function(e,t,o){if(k.isObject(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=k.assign({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},Ie.prototype.remove=function(e){var t=this.get(e)||[];k.isArray(t)||(t=[t]);var o=this;k.forEach(t,function(a){var i=o._getOverlayContainer(a.element,!0);if(a&&(A.remove(a.html),A.remove(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),i){var r=i.overlays.indexOf(a);r!==-1&&i.overlays.splice(r,1)}})},Ie.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ie.prototype.show=function(){Jo(this._overlayRoot)},Ie.prototype.hide=function(){Jo(this._overlayRoot,!1)},Ie.prototype.clear=function(){this._overlays={},this._overlayContainers=[],A.clear(this._overlayRoot)},Ie.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,i=t.y;if(t.waypoints){var r=st(t);a=r.x,i=r.y}kc(o,a,i),A.attr(e.html,"data-container-id",t.id)},Ie.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,i=t.left,r=t.top;if(t.right!==void 0){var l;a.waypoints?l=st(a).width:l=a.width,i=t.right*-1+l}if(t.bottom!==void 0){var s;a.waypoints?s=st(a).height:s=a.height,r=t.bottom*-1+s}kc(o,i||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ie.prototype._createOverlayContainer=function(e){var t=A.domify('<div class="djs-overlays" />');A.assignStyle(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},Ie.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Ec(this._overlayRoot,o)},Ie.prototype._getOverlayContainer=function(e,t){var o=k.find(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},Ie.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,i,r;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),k.isString(a)&&(a=A.domify(a)),r=this._getOverlayContainer(o),i=A.domify('<div class="djs-overlay" data-overlay-id="'+t+'">'),A.assignStyle(i,{position:"absolute"}),i.appendChild(a),e.type&&A.classes(i).add("djs-overlay-"+e.type);var l=this._canvas.findRoot(o),s=this._canvas.getRootElement();Jo(i,l===s),e.htmlContainer=i,r.overlays.push(e),r.html.appendChild(i),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ie.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),i=o&&o.minZoom,r=o&&o.maxZoom,l=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(a!==s||o&&(k.isDefined(i)&&i>t.scale||k.isDefined(r)&&r<t.scale))&&(c=!1),Jo(l,c),this._updateOverlayScale(e,t)},Ie.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,i,r=e.htmlContainer,l,s="";o!==!0&&(o===!1?(a=1,i=1):(a=o.min,i=o.max),k.isDefined(a)&&t.scale<a&&(l=(1/t.scale||1)*a),k.isDefined(i)&&t.scale>i&&(l=(1/t.scale||1)*i)),k.isDefined(l)&&(s="scale("+l+","+l+")"),Ec(r,s)},Ie.prototype._updateOverlaysVisibilty=function(e){var t=this;k.forEach(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},Ie.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var i=a.element,r=t.get({element:i});k.forEach(r,function(c){t.remove(c.id)});var l=t._getOverlayContainer(i);if(l){A.remove(l.html);var s=t._overlayContainers.indexOf(l);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Bg,function(a){var i=a.element,r=t._getOverlayContainer(i,!0);r&&(k.forEach(r.overlays,function(l){t._updateOverlay(l)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(a){var i=t._getOverlayContainer(a.element,!0);i&&A.classes(i.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function jg(e){var t=A.domify('<div class="djs-overlay-container" />');return A.assignStyle(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function kc(e,t,o){A.assignStyle(e,{left:t+"px",top:o+"px"})}function Jo(e,t){e.style.display=t===!1?"none":""}function Ec(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}const Tg={__init__:["overlays"],overlays:["type",Ie]},Vg=new xo;function jn(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}jn.$inject=["eventBus"],jn.prototype.schedule=function(e,t=Vg.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},jn.prototype._schedule=function(e,t){const o=Mg();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(i){o.reject(i)}}catch(i){console.error("Scheduler#_schedule execution failed",i)}}),promise:o.promise}},jn.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},jn.prototype._cancel=function(e){clearTimeout(e.executionId)};function Mg(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}const Pg={scheduler:["type",jn]};var Ng="djs-element-hidden",Do=".entry",$g=1e3,_c=8,Og=300;function Ne(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}Ne.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ne.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var i=a.target,r=k.isArray(i)?i:[i],l=r.filter(function(c){return o.includes(c)});if(l.length){e.close();var s=r.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current,i=k.isArray(a.target)?a.target:[a.target];i.includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},Ne.prototype._createContainer=function(){var e=A.domify('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ne.prototype.registerProvider=function(e,t){t||(t=e,e=$g),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},Ne.prototype.getEntries=function(e){var t=this._getProviders(),o=k.isArray(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return k.forEach(t,function(i){if(k.isFunction(i[o])){var r=i[o](e);k.isFunction(r)?a=r(a):k.forEach(r,function(l,s){a[s]=l})}}),a},Ne.prototype.trigger=function(e,t,o){var a=this,i,r,l=t.delegateTarget||t.target;if(!l)return t.preventDefault();if(i=A.attr(l,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(i,"hover",r,o)},Og);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(i,e,r,o)},Ne.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var i=this._current.target,r=this._current.entries,l=r[e];if(l){var s=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if(k.isFunction(s)){if(t==="click")return s(o,i,a)}else if(s[t])return s[t](o,i,a);o.preventDefault()}}}},Ne.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Ne.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ne.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;k.forEach(t,function(i,r){var l=i.group||"default",s=A.domify(i.html||'<div class="entry" draggable="true"></div>'),c;A.attr(s,"data-action",r),c=A.query("[data-group="+si(l)+"]",o),c||(c=A.domify('<div class="group"></div>'),A.attr(c,"data-group",l),o.appendChild(c)),c.appendChild(s),i.className&&Rg(s,i.className),i.title&&A.attr(s,"title",i.title),i.imageUrl&&(a=A.domify("<img>"),A.attr(a,"src",i.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),A.classes(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ne.prototype._createHtml=function(e){var t=this,o=A.domify('<div class="djs-context-pad"></div>');return A.delegate.bind(o,Do,"click",function(a){t.trigger("click",a)}),A.delegate.bind(o,Do,"dragstart",function(a){t.trigger("dragstart",a)}),A.delegate.bind(o,Do,"mouseover",function(a){t.trigger("mouseover",a)}),A.delegate.bind(o,Do,"mouseout",function(a){t.trigger("mouseout",a)}),A.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},Ne.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Lg(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ne.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ne.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return k.isArray(e)!==k.isArray(o)?!1:k.isArray(e)?e.length===o.length&&k.every(e,function(a){return o.includes(a)}):o===e},Ne.prototype.isShown=function(){return this.isOpen()&&A.classes(this._current.html).has("open")},Ne.prototype.show=function(){this.isOpen()&&(A.classes(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ne.prototype.hide=function(){this.isOpen()&&(A.classes(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ne.prototype._getPosition=function(e){if(!k.isArray(e)&&Ze(e)){var t=this._canvas.viewbox(),o=Ag(e),a=o.x*t.scale-t.x*t.scale,i=o.y*t.scale-t.y*t.scale;return{left:a+_c*this._canvas.zoom(),top:i}}var r=this._canvas.getContainer(),l=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-l.left+_c*this._canvas.zoom(),top:s.top-l.top}},Ne.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ne.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target,a=k.isArray(o)?o:[o],i=a.some(function(r){return t._canvas.hasMarker(r,Ng)});i?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ne.prototype._getTargetBounds=function(e){var t=this,o=k.isArray(e)?e:[e],a=o.map(function(i){return t._canvas.getGraphics(i)});return a.reduce(function(i,r){const l=r.getBoundingClientRect();return i.top=Math.min(i.top,l.top),i.right=Math.max(i.right,l.right),i.bottom=Math.max(i.bottom,l.bottom),i.left=Math.min(i.left,l.left),i.x=i.left,i.y=i.top,i.width=i.right-i.left,i.height=i.bottom-i.top,i},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Rg(e,t){var o=A.classes(e);t=k.isArray(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function Ag(e){return e.waypoints[e.waypoints.length-1]}function Lg(e,t){return e=k.isArray(e)?e:[e],t=k.isArray(t)?t:[t],e.length===t.length&&k.every(e,function(o){return t.includes(o)})}const Ig={__depends__:[ka,Pg,Tg],contextPad:["type",Ne]};var zg=250;function nn(e){this._eventBus=e,this._tools=[],this._active=null}nn.$inject=["eventBus"],nn.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},nn.prototype.isActive=function(e){return e&&this._active===e},nn.prototype.length=function(e){return this._tools.length},nn.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},nn.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(i){var r=i.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k.forEach(t,function(i){a.push(i+".ended"),a.push(i+".canceled")}),o.on(a,zg,function(i){this._active&&(Fg(i)||this.setActive(null))},this)};function Fg(e){var t=e.originalEvent&&e.originalEvent.target;return t&&A.closest(t,'.group[data-group="tools"]')}const fi={__depends__:[qt],__init__:["toolManager"],toolManager:["type",nn]};function pi(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){var i=t._svg=a.svg;i.addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}pi.$inject=["eventBus"],pi.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Hg(0,0)};function Hg(e,t){var o=document.createEvent("MouseEvent"),a=e,i=t,r=e,l=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,i,r,l,!1,!1,!1,!1,0,null),o}const hi={__init__:["mouse"],mouse:["type",pi]};var mi=1500,Sc="grab";function Tn(e,t,o,a,i,r){this._dragging=o,this._mouse=r;var l=this,s=a.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",mi,function(c){if(cl(c))return l.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(mi,function(c){if(!(!Bc(c.keyEvent)||l.isActive())){var d=l._mouse.getLastMoveEvent();l.activateMove(d,!!d)}},"keyboard.keydown"),s&&s.addListener(mi,function(c){!Bc(c.keyEvent)||!l.isActive()||l.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var d=c.originalEvent.target;if(!c.hover&&!(d instanceof SVGElement))return!1;e.once("hand.ended",function(){l.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var d=t.viewbox().scale;t.scroll({dx:c.dx*d,dy:c.dy*d})}),e.on("hand.move.end",function(c){var d=c.context,u=d.reactivate;return!cl(c)&&u&&e.once("hand.move.ended",function(f){l.activateHand(f.originalEvent,!0,!0)}),!1})}Tn.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Tn.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Sc,data:{context:o||{}}})},Tn.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Sc,data:{context:{reactivate:o}}})},Tn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Tn.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Bc(e){return wl("Space",e)}const Wg={__depends__:[fi,hi],__init__:["handTool"],handTool:["type",Tn]};var jc="crosshair";function on(e,t,o,a,i,r,l){this._selection=i,this._dragging=o,this._mouse=l;var s=this,c={create:function(d){var u=t.getActiveLayer(),f;f=d.frame=P.create("rect"),P.attr(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),P.append(u,f)},update:function(d){var u=d.frame,f=d.bbox;P.attr(u,{x:f.x,y:f.y,width:f.width,height:f.height})},remove:function(d){d.frame&&P.remove(d.frame)}};r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(d){var u=d.originalEvent.target;!d.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(d.originalEvent,!0)})}),e.on("lasso.end",0,function(d){var u=d.context,f=gi(d),h=a.filter(function(p){return p}),m=ba(d);s.select(h,f,m?u.selection:[])}),e.on("lasso.start",function(d){var u=d.context;u.bbox=gi(d),c.create(u),u.selection=i.get()}),e.on("lasso.move",function(d){var u=d.context;u.bbox=gi(d),c.update(u)}),e.on("lasso.cleanup",function(d){var u=d.context;c.remove(u)}),e.on("element.mousedown",1500,function(d){if(ba(d))return s.activateLasso(d.originalEvent),!0})}on.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],on.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:jc,data:{context:{}}})},on.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:jc,data:{context:{}},keepSelection:!0})},on.prototype.select=function(e,t,o=[]){var a=Wp(e,t);this._selection.select([...o,...k.values(a)])},on.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},on.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function gi(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}const Ug={__depends__:[fi,hi],__init__:["lassoTool"],lassoTool:["type",on]};var Tc="connect-ok",Vc="connect-not-ok";function Vn(e,t,o,a,i,r,l){var s=this;this._dragging=t,this._rules=r,this._mouse=l,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var d=c.context,u=c.hover,f=d.canStartConnect=s.canStartConnect(u);f!==null&&(d.startTarget=u,a.addMarker(u,f?Tc:Vc))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var d=c.context.startTarget,u=c.context.canStartConnect;d&&a.removeMarker(d,u?Tc:Vc)}),e.on(["global-connect.ended"],function(c){var d=c.context,u=d.startTarget,f={x:c.x,y:c.y},h=s.canStartConnect(u);if(h)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,u,f)}),!1})}Vn.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Vn.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Vn.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Vn.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Jg={__depends__:[Oa,Cn,qt,fi,hi],globalConnect:["type",Vn]};var Dg=500,qg=1e3;function an(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function i(r){var l=P.create("rect");return P.attr(l,k.assign({x:0,y:0,rx:4,width:100,height:100},o)),l}e.on(["shape.added","shape.changed"],Dg,function(r){var l=r.element,s=r.gfx,c=A.query(".djs-outline",s);c||(c=a.getOutline(l)||i(),P.append(s,c)),a.updateShapeOutline(c,l)}),e.on(["connection.added","connection.changed"],function(r){var l=r.element,s=r.gfx,c=A.query(".djs-outline",s);c||(c=i(),P.append(s,c)),a.updateConnectionOutline(c,l)})}an.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&k.forEach(a,function(i){o=o||i.updateOutline(t,e)}),o||P.attr(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},an.prototype.updateConnectionOutline=function(e,t){var o=st(t);P.attr(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},an.prototype.registerProvider=function(e,t){t||(t=e,e=qg),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},an.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},an.prototype.getOutline=function(e){var t,o=this._getProviders();return k.forEach(o,function(a){k.isFunction(a.getOutline)&&(t=t||a.getOutline(e))}),t},an.$inject=["eventBus","styles","elementRegistry"];var qo=6;function yi(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(i){o.isSelected(i.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(i){var r=i.newSelection;a._updateMultiSelectionOutline(r)})}yi.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");P.clear(t);var o=e.length>1,a=this._canvas.getContainer();if(P.classes(a)[o?"add":"remove"]("djs-multi-select"),!!o){var i=Yg(st(e)),r=P.create("rect");P.attr(r,k.assign({rx:3},i)),P.classes(r).add("djs-selection-outline"),P.append(t,r)}},yi.$inject=["eventBus","canvas","selection"];function Yg(e){return{x:e.x-qo,y:e.y-qo,width:e.width+qo*2,height:e.height+qo*2}}const Mc={__depends__:[bn],__init__:["outline","multiSelectionOutline"],outline:["type",an],multiSelectionOutline:["type",yi]};var Gg=500,Kg=1250,Xg=1500,Yo=Math.round;function Zg(e){return{x:e.x+Yo(e.width/2),y:e.y+Yo(e.height/2)}}function Pc(e,t,o,a,i){function r(s,c,d,u){return i.allowed("elements.move",{shapes:s,delta:c,position:d,target:u})}e.on("shape.move.start",Xg,function(s){var c=s.context,d=s.shape,u=a.get().slice();u.indexOf(d)===-1&&(u=[d]),u=Qg(u),k.assign(c,{shapes:u,validatedShapes:u,shape:d})}),e.on("shape.move.start",Kg,function(s){var c=s.context,d=c.validatedShapes,u;if(u=c.canExecute=r(d),!u)return!1}),e.on("shape.move.move",Gg,function(s){var c=s.context,d=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},h={x:s.x,y:s.y},m;if(m=r(d,f,h,u),c.delta=f,c.canExecute=m,m===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,d=c.delta,u=c.canExecute,f=u==="attach",h=c.shapes;if(u===!1)return!1;d.x=Yo(d.x),d.y=Yo(d.y),!(d.x===0&&d.y===0)&&o.moveElements(h,d,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(Et(s)){var c=gn(s);if(!c)throw new Error("must supply DOM mousedown event");return l(c,s.element)}});function l(s,c,d,u){if(k.isObject(d)&&(u=d,d=!1),!(c.waypoints||!c.parent)&&!P.classes(s.target).has("djs-hit-no-move")){var f=Zg(c);return t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:d,data:{shape:c,context:u||{}}}),!0}}this.start=l}Pc.$inject=["eventBus","dragging","modeling","selection","rules"];function Qg(e){var t=k.groupBy(e,"id");return k.filter(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Nc=499,vi="djs-dragging",$c="drop-ok",Oc="drop-not-ok",Rc="new-parent",Ac="attach-ok";function Lc(e,t,o,a){function i(c){var d=r(c),u=ey(d);return u}function r(c){var d=Fp(c),u=d.flatMap(m=>(m.incoming||[]).concat(m.outgoing||[])),f=d.concat(u),h=[...new Set(f)];return h}function l(c,d){[Ac,$c,Oc,Rc].forEach(function(u){u===d?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,d,u){a.addDragger(d,c.dragGroup),u&&t.addMarker(d,vi),c.allDraggedElements?c.allDraggedElements.push(d):c.allDraggedElements=[d]}e.on("shape.move.start",Nc,function(c){var d=c.context,u=d.shapes,f=d.allDraggedElements,h=i(u);if(!d.dragGroup){var m=P.create("g");P.attr(m,o.cls("djs-drag-group",["no-events"]));var p=t.getActiveLayer();P.append(p,m),d.dragGroup=m}h.forEach(function(g){a.addDragger(g,d.dragGroup)}),f?f=k.flatten([f,r(u)]):f=r(u),k.forEach(f,function(g){t.addMarker(g,vi)}),d.allDraggedElements=f,d.differentParents=ty(u)}),e.on("shape.move.move",Nc,function(c){var d=c.context,u=d.dragGroup,f=d.target,h=d.shape.parent,m=d.canExecute;f&&(m==="attach"?l(f,Ac):d.canExecute&&h&&f.id!==h.id?l(f,Rc):l(f,d.canExecute?$c:Oc)),ct(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var d=c.context,u=d.target;u&&l(u,null)}),e.on("shape.move.cleanup",function(c){var d=c.context,u=d.allDraggedElements,f=d.dragGroup;k.forEach(u,function(h){t.removeMarker(h,vi)}),f&&P.remove(f)}),this.makeDraggable=s}Lc.$inject=["eventBus","canvas","styles","previewSupport"];function ey(e){var t=k.filter(e,function(o){return Ze(o)?k.find(e,k.matchPattern({id:o.source.id}))&&k.find(e,k.matchPattern({id:o.target.id})):!0});return t}function ty(e){return k.size(k.groupBy(e,function(t){return t.parent&&t.parent.id}))!==1}const ny={__depends__:[ka,bn,Mc,Cn,qt,Sa],__init__:["move","movePreview"],move:["type",Pc],movePreview:["type",Lc]};var Ic=".djs-palette-toggle",zc=".entry",oy=Ic+", "+zc,bi="djs-palette-",ay="shown",xi="open",Fc="two-column",iy=1e3;function $e(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var i=a.tool;o.updateToolHighlight(i)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}$e.$inject=["eventBus","canvas"],$e.prototype.registerProvider=function(e,t){t||(t=e,e=iy),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},$e.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(ly,{})},$e.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},$e.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=A.domify($e.HTML_MARKUP);o.appendChild(a),A.classes(o).add(bi+ay),A.delegate.bind(a,oy,"click",function(i){var r=i.delegateTarget;if(A.matches(r,Ic))return e.toggle();e.trigger("click",i)}),A.event.bind(a,"mousedown",function(i){i.stopPropagation()}),A.delegate.bind(a,zc,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},$e.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},$e.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,i,r=A.classes(o),l=A.classes(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(Fc,i),l.toggle(bi+Fc,i),"open"in e&&(r.toggle(xi,e.open),l.toggle(bi+xi,e.open)),a.fire("palette.changed",{twoColumn:i,open:this.isOpen()})},$e.prototype._update=function(){var e=A.query(".djs-palette-entries",this._container),t=this._entries=this.getEntries();A.clear(e),k.forEach(t,function(o,a){var i=o.group||"default",r=A.query("[data-group="+si(i)+"]",e);r||(r=A.domify('<div class="group"></div>'),A.attr(r,"data-group",i),e.appendChild(r));var l=o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=A.domify(l);if(r.appendChild(s),!o.separator&&(A.attr(s,"data-action",a),o.title&&A.attr(s,"title",o.title),o.className&&ry(s,o.className),o.imageUrl)){var c=A.domify("<img>");A.attr(c,"src",o.imageUrl),s.appendChild(c)}}),this.open()},$e.prototype.trigger=function(e,t,o){var a,i,r=t.delegateTarget||t.target;return r?(a=A.attr(r,"data-action"),i=t.originalEvent||t,this.triggerEntry(a,e,i,o)):t.preventDefault()},$e.prototype.triggerEntry=function(e,t,o,a){var i=this._entries,r,l;if(r=i[e],!!r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if(k.isFunction(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},$e.prototype._layoutChanged=function(){this._toggleState({})},$e.prototype._needsCollapse=function(e,t){var o=50,a=Object.keys(t).length*46;return e<a+o},$e.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},$e.prototype.open=function(){this._toggleState({open:!0})},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isActiveTool=function(e){return e&&this._activeTool===e},$e.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=A.query(".djs-palette-entries",this._container),this._toolsContainer=A.query("[data-group=tools]",t)),o=this._toolsContainer,k.forEach(o.children,function(a){var i=a.getAttribute("data-action");if(i){var r=A.classes(a);i=i.replace("-tool",""),r.contains("entry")&&i===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},$e.prototype.isOpen=function(){return A.classes(this._container).has(xi)},$e.prototype._getParentContainer=function(){return this._canvas.getContainer()},$e.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function ry(e,t){var o=A.classes(e),a=k.isArray(t)?t:t.split(/\s+/g);a.forEach(function(i){o.add(i)})}function ly(e,t){var o=t.getPaletteEntries();return k.isFunction(o)?o(e):(k.forEach(o,function(a,i){e[i]=a}),e)}const sy={__init__:["palette"],palette:["type",$e]};function Hc(e,t,o,a){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=o.getGraphics(r)),i.gfx&&e.fire(Up(r)+".changed",i)}),e.on("elements.changed",function(i){var r=i.elements;r.forEach(function(l){e.fire("element.changed",{element:l})}),a.updateContainments(r)}),e.on("shape.changed",function(i){a.update("shape",i.element,i.gfx)}),e.on("connection.changed",function(i){a.update("connection",i.element,i.gfx)})}Hc.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const cy={__init__:["changeSupport"],changeSupport:["type",Hc]};var Go=Math.max,Ko=Math.min,dy=20;function uy(e,t,o){var a=o.x,i=o.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+i,r.height=e.height-i):t.indexOf("s")!==-1&&(r.height=e.height+i),t.indexOf("e")!==-1?r.width=e.width+a:t.indexOf("w")!==-1&&(r.x=e.x+a,r.width=e.width-a),r}function Xo(e,t,o){var a=t[e],i=o.min&&o.min[e],r=o.max&&o.max[e];return k.isNumber(i)&&(a=(/top|left/.test(e)?Ko:Go)(a,i)),k.isNumber(r)&&(a=(/top|left/.test(e)?Go:Ko)(a,r)),a}function fy(e,t){if(!t)return e;var o=be(e);return Yl({top:Xo("top",o,t),right:Xo("right",o,t),bottom:Xo("bottom",o,t),left:Xo("left",o,t)})}function py(e,t,o,a){var i=be(t),r={top:/n/.test(e)?i.bottom-o.height:i.top,left:/w/.test(e)?i.right-o.width:i.left,bottom:/s/.test(e)?i.top+o.height:i.bottom,right:/e/.test(e)?i.left+o.width:i.right},l=a?be(a):r,s={top:Ko(r.top,l.top),left:Ko(r.left,l.left),bottom:Go(r.bottom,l.bottom),right:Go(r.right,l.right)};return Yl(s)}function no(e,t){return typeof e<"u"?e:dy}function hy(e,t){var o,a,i,r;return typeof t=="object"?(o=no(t.left),a=no(t.right),i=no(t.top),r=no(t.bottom)):o=a=i=r=no(t),{x:e.x-o,y:e.y-i,width:e.width+o+a,height:e.height+i+r}}function my(e){return!(e.waypoints||e.type==="label")}function gy(e,t){var o;if(e.length===void 0?o=k.filter(e.children,my):o=e,o.length)return hy(st(o),t)}var Wc=10;function oo(e,t,o,a){this._dragging=a,this._rules=t;var i=this;function r(c,d){var u=c.shape,f=c.direction,h=c.resizeConstraints,m;c.delta=d,m=uy(u,f,d),c.newBounds=fy(m,h),c.canExecute=i.canResize(c)}function l(c){var d=c.resizeConstraints,u=c.minBounds;d===void 0&&(u===void 0&&(u=i.computeMinResizeBox(c)),c.resizeConstraints={min:be(u)})}function s(c){var d=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=mh(f),!yy(d,f))return;o.resizeShape(d,f)}}e.on("resize.start",function(c){l(c.context)}),e.on("resize.move",function(c){var d={x:c.dx,y:c.dy};r(c.context,d)}),e.on("resize.end",function(c){s(c.context)})}oo.prototype.canResize=function(e){var t=this._rules,o=k.pick(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},oo.prototype.activate=function(e,t,o){var a=this._dragging,i,r;if(typeof o=="string"&&(o={direction:o}),i=k.assign({shape:t},o),r=i.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Uc(t,r),"resize",{autoActivate:!0,cursor:vy(r),data:{shape:t,context:i}})},oo.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction,a,i;return a=e.minDimensions||{width:Wc,height:Wc},i=gy(t,e.childrenBoxPadding),py(o,t,a,i)},oo.$inject=["eventBus","rules","modeling","dragging"];function yy(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Uc(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function vy(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var Jc="djs-resizing",Dc="resize-not-ok",by=500;function qc(e,t,o){function a(r){var l=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=o.addFrame(l,t.getActiveLayer()),t.addMarker(l,Jc)),s.width>5&&P.attr(c,{x:s.x,width:s.width}),s.height>5&&P.attr(c,{y:s.y,height:s.height}),r.canExecute?P.classes(c).remove(Dc):P.classes(c).add(Dc)}function i(r){var l=r.shape,s=r.frame;s&&P.remove(r.frame),t.removeMarker(l,Jc)}e.on("resize.move",by,function(r){a(r.context)}),e.on("resize.cleanup",function(r){i(r.context)})}qc.$inject=["eventBus","canvas","previewSupport"];var Zo=-6,Qo=8,ea=20,ao="djs-resizer",xy=["n","w","s","e","nw","ne","se","sw"];function It(e,t,o,a){this._resize=a,this._canvas=t;var i=this;e.on("selection.changed",function(r){var l=r.newSelection;i.removeResizers(),l.length===1&&k.forEach(l,k.bind(i.addResizer,i))}),e.on("shape.changed",function(r){var l=r.element;o.isSelected(l)&&(i.removeResizers(),i.addResizer(l))})}It.prototype.makeDraggable=function(e,t,o){var a=this._resize;function i(r){Et(r)&&a.activate(r,e,o)}A.event.bind(t,"mousedown",i),A.event.bind(t,"touchstart",i)},It.prototype._createResizer=function(e,t,o,a){var i=this._getResizersParent(),r=wy(a),l=P.create("g");P.classes(l).add(ao),P.classes(l).add(ao+"-"+e.id),P.classes(l).add(ao+"-"+a),P.append(i,l);var s=P.create("rect");P.attr(s,{x:-Qo/2+r.x,y:-Qo/2+r.y,width:Qo,height:Qo}),P.classes(s).add(ao+"-visual"),P.append(l,s);var c=P.create("rect");return P.attr(c,{x:-ea/2+r.x,y:-ea/2+r.y,width:ea,height:ea}),P.classes(c).add(ao+"-hit"),P.append(l,c),Yp(l,t,o),l},It.prototype.createResizer=function(e,t){var o=Uc(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},It.prototype.addResizer=function(e){var t=this;Ze(e)||!this._resize.canResize({shape:e})||k.forEach(xy,function(o){t.createResizer(e,o)})},It.prototype.removeResizers=function(){var e=this._getResizersParent();P.clear(e)},It.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},It.$inject=["eventBus","canvas","selection","resize"];function wy(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Zo:e.indexOf("w")!==-1&&(t.x=Zo),e.indexOf("s")!==-1?t.y=-Zo:e.indexOf("n")!==-1&&(t.y=Zo),t}const Cy={__depends__:[Cn,qt,Sa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",oo],resizePreview:["type",qc],resizeHandles:["type",It]};function io(e,t,o,a,i,r){this._canvas=t,this._modeling=a,this._textRenderer=r,o.registerProvider(this),e.on("element.dblclick",s=>{l(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{i.removeResizers()}),e.on("create.end",500,s=>{const{context:c,isTouch:d}=s,u=c.shape,{canExecute:f}=s.context;d||f&&(c.hints&&c.hints.createElementsBehavior===!1||l(u))}),e.on("autoPlace.end",500,s=>{l(s.shape)});function l(s,c){(c||Ka(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}io.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],io.prototype.activate=function(e){const t=Oo(e);if(t===void 0)return;const o={text:t},a=this.getEditingBBox(e);Se(o,a);const i={};return(Ka(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&Se(i,{centerVertically:!0}),Xa(e)&&Se(i,{autoResize:!0}),Se(o,{options:i}),o},io.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),i={x:a.x+a.width/2,y:a.y+a.height/2},r={x:a.x,y:a.y},l=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),d=c.fontSize*l,u=c.lineHeight,f=s.fontSize*l,h=s.lineHeight,m={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ka(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(Se(r,{width:a.width,height:a.height}),Se(m,{fontSize:f+"px",lineHeight:h,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));const p=90*l,g=7*l,y=4*l;if(o.labelTarget&&(Se(r,{width:p,height:a.height+g+y,x:i.x-p/2,y:a.y-g}),Se(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})),Xa(o)&&!Ms(o)&&!Zn(o)){const x=Ps(e),b=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),w=d+g+y;Se(r,{width:p,height:w,x:b.x-p/2,y:b.y-w/2}),Se(m,{fontSize:d+"px",lineHeight:u,paddingTop:g+"px",paddingBottom:y+"px"})}return{bounds:r,style:m}},io.prototype.update=function(e,t){let o;ky(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function ky(e){return!e||!e.trim()}const Ey={__depends__:[cy,Cy,_d],__init__:["labelEditingProvider"],labelEditingProvider:["type",io]};function zt(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}zt.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zt.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},zt.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},zt.prototype.getSnapLocations=function(){return this._snapLocations},zt.prototype.setSnapLocations=function(e){this._snapLocations=e},zt.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new ta,o.initDefaults(this._defaultSnaps)),o};function ta(){this._snapValues={}}ta.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},ta.prototype.snap=function(e,t,o,a){var i=this._snapValues[t];return i&&yg(e[o],i[o],a)},ta.prototype.initDefaults=function(e){var t=this;k.forEach(e||{},function(o,a){k.forEach(o,function(i){t.add(a,i)})})};var _y=1250;function pt(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){a.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],_y,function(i){var r=i.context,l=r.shape,s=r.snapContext,c=r.target;if(!(i.originalEvent&&xl(i.originalEvent))&&!(Uo(i)||!c)){var d=s.pointsForTarget(c);d.initialized||(d=a.addSnapTargetPoints(d,l,c),d.initialized=!0),o.snap(i,d)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}pt.$inject=["elementRegistry","eventBus","snapping"],pt.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,i=o.snapContext;i||(i=o.snapContext=new zt);var r;t.get(a.id)?r=Bn(a,e):r={x:e.x+Bn(a).x,y:e.y+Bn(a).y};var l={x:r.x-a.width/2,y:r.y-a.height/2},s={x:r.x+a.width/2,y:r.y+a.height/2};return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),kn(a)||(i.setSnapOrigin("top-left",{x:l.x-e.x,y:l.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i},pt.prototype.addSnapTargetPoints=function(e,t,o){var a=this.getSnapTargets(t,o);return k.forEach(a,function(i){if(kn(i)){kn(t)&&e.add("mid",Bn(i));return}if(Ze(i)){if(i.waypoints.length<3)return;var r=i.waypoints.slice(1,-1);k.forEach(r,function(l){e.add("mid",l)});return}e.add("mid",Bn(i))}),!k.isNumber(t.x)||!k.isNumber(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Bn(t)),e},pt.prototype.getSnapTargets=function(e,t){return xc(t).filter(function(o){return!Sy(o)})};function Sy(e){return!!e.hidden}function Mn(e){e.invoke(pt,this)}Ht(Mn,pt),Mn.$inject=["injector"],Mn.prototype.initSnap=function(e){return pt.prototype.initSnap.call(this,e)},Mn.prototype.addSnapTargetPoints=function(e,t,o){return pt.prototype.addSnapTargetPoints.call(this,e,t,o)},Mn.prototype.getSnapTargets=function(e,t){return pt.prototype.getSnapTargets.call(this,e,t)};var By=1250;function ro(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],By,function(a){var i=a.context,r=i.shape,l=r.parent,s=i.direction,c=i.snapContext;if(!(a.originalEvent&&xl(a.originalEvent))&&!Uo(a)){var d=c.pointsForTarget(l);d.initialized||(d=o.addSnapTargetPoints(d,r,l,s),d.initialized=!0),Vy(s)&&bt(a,"x",a.x),My(s)&&bt(a,"y",a.y),t.snap(a,d)}}),e.on(["resize.cleanup"],function(){t.hide()})}ro.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,i=t.snapContext;i||(i=t.snapContext=new zt);var r=Yc(o,a);return i.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),i},ro.prototype.addSnapTargetPoints=function(e,t,o,a){var i=this.getSnapTargets(t,o);return k.forEach(i,function(r){e.add("corner",bg(r)),e.add("corner",vg(r))}),e.add("corner",Yc(t,a)),e},ro.$inject=["eventBus","snapping"],ro.prototype.getSnapTargets=function(e,t){return xc(t).filter(function(o){return!jy(o,e)&&!Ze(o)&&!Ty(o)&&!kn(o)})};function Yc(e,t){var o=Te(e),a=be(e),i={x:o.x,y:o.y};return t.indexOf("n")!==-1?i.y=a.top:t.indexOf("s")!==-1&&(i.y=a.bottom),t.indexOf("e")!==-1?i.x=a.right:t.indexOf("w")!==-1&&(i.x=a.left),i}function jy(e,t){return e.host===t}function Ty(e){return!!e.hidden}function Vy(e){return e==="n"||e==="s"}function My(e){return e==="e"||e==="w"}var Py=7,Ny=1e3;function Ft(e){this._canvas=e,this._asyncHide=k.debounce(k.bind(this.hide,this),Ny)}Ft.$inject=["canvas"],Ft.prototype.snap=function(e,t){var o=e.context,a=o.snapContext,i=a.getSnapLocations(),r={x:Uo(e,"x"),y:Uo(e,"y")};k.forEach(i,function(l){var s=a.getSnapOrigin(l),c={x:e.x+s.x,y:e.y+s.y};if(k.forEach(["x","y"],function(d){var u;r[d]||(u=t.snap(c,l,d,Py),u!==void 0&&(r[d]={value:u,originValue:u-s[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),k.forEach(["x","y"],function(l){var s=r[l];k.isObject(s)&&bt(e,l,s.originValue)})},Ft.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=P.create("path");return P.attr(o,{d:"M0,0 L0,0"}),P.classes(o).add("djs-snap-line"),P.append(t,o),{update:function(a){k.isNumber(a)?e==="horizontal"?P.attr(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):P.attr(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):P.attr(o,{display:"none"})}}},Ft.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ft.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Ft.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ft.prototype.hide=function(){k.forEach(this._snapLines,function(e){e.update()})};const $y={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",pt],resizeSnapping:["type",ro],snapping:["type",Ft]}],__init__:["createMoveSnapping"],createMoveSnapping:["type",Mn]};function Pn(e){De.call(this,e),this.init()}Pn.$inject=["eventBus"],Yt(Pn,De),Pn.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){a.canExecute(i,t,function(r,l,s){return o(r)},!0)})},Pn.prototype.init=function(){};function lo(e){Pn.call(this,e)}lo.$inject=["eventBus"],Ht(lo,Pn),lo.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},i=a.targetParent,r=a.targetAttach;if(r)return!1;i&&(o.parent=i);try{return wi(t,o)}finally{i&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){e.connection;var t=e.source,o=e.target;return wi(t,o)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return Jp(t)})},lo.prototype.canConnect=wi;function wi(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}const Oy={__init__:["myRuleProvider"],myRuleProvider:["type",lo]};function Ci(e,t,o,a,i,r,l){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=i,this._palette=r,this._myOptions=l,r.registerProvider(this)}Ci.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Ci.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,i=this._globalConnect,r=this._myOptions;function l(c,d,u,f,h){function m(p){const g=t.createShape(Se({type:c},h));e.start(p,g)}return{group:d,className:u,title:f,action:{dragstart:m,click:m}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(c){o.activateHand(c)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(c){a.activateSelection(c)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(c){i.toggle(c)}}},"tool-separator":{group:"tools",separator:!0}};for(const c in r.palette){const d=r.palette[c];s[c]=l(d.type,d.group,d.className,d.title,d.options)}return s};const Ry={__init__:["paletteProvider"],paletteProvider:["type",Ci]};var Gc=50,Ay=250;function Ly(e,t){t||(t={});function o(p){return p.source===e?1:-1}var a=t.defaultDistance||Gc,i=t.direction||"e",r=t.filter,l=t.getWeight||o,s=t.maxDistance||Ay,c=t.reference||"start";r||(r=Iy);function d(p,g){return i==="n"?c==="start"?be(p).top-be(g).bottom:c==="center"?be(p).top-Te(g).y:be(p).top-be(g).top:i==="w"?c==="start"?be(p).left-be(g).right:c==="center"?be(p).left-Te(g).x:be(p).left-be(g).left:i==="s"?c==="start"?be(g).top-be(p).bottom:c==="center"?Te(g).y-be(p).bottom:be(g).bottom-be(p).bottom:c==="start"?be(g).left-be(p).right:c==="center"?Te(g).x-be(p).right:be(g).right-be(p).right}var u=e.incoming.filter(r).map(function(p){var g=l(p),y=g<0?d(p.source,e):d(e,p.source);return{id:p.source.id,distance:y,weight:g}}),f=e.outgoing.filter(r).map(function(p){var g=l(p),y=g>0?d(e,p.target):d(p.target,e);return{id:p.target.id,distance:y,weight:g}}),h=u.concat(f).reduce(function(p,g){return p[g.id+"__weight_"+g.weight]=g,p},{}),m=k.reduce(h,function(p,g){var y=g.distance,x=g.weight;return y<0||y>s||(p[String(y)]||(p[String(y)]=0),p[String(y)]+=1*x,(!p.distance||p[p.distance]<p[String(y)])&&(p.distance=y)),p},{});return m.distance||a}function Iy(){return!0}var zy=100;function Kc(e,t,o){e.on("autoPlace",zy,function(a){var i=a.shape,r=a.source;return Fy(r,i)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,i,r){e.fire("autoPlace.start",{source:a,shape:i});var l=e.fire("autoPlace",{source:a,shape:i}),s=t.appendShape(a,i,l,a.parent,r);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Kc.$inject=["eventBus","modeling","canvas"];function Fy(e,t,o){o||(o={});var a=o.defaultDistance||Gc,i=Te(e),r=be(e);return{x:r.right+a+t.width/2,y:i.y}}function Xc(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Xc.$inject=["eventBus","selection"];const Hy={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Kc],autoPlaceSelectionBehavior:["type",Xc]},Wy=10,Uy=(e,t)=>e.type===t;function Jy(e){return e.incoming.map(t=>t.source)}function Dy(e){return e.outgoing.map(t=>t.target)}function ki(e){return Dy(e).concat(Jy(e))}function qy(e){let t=ki(e);return e.host&&(t=t.concat(ki(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(ki(a)),[]))),t.filter(o=>o.type!=="myline")}function Yy(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height},i=qy(e);return k.find(i,r=>r===o?!1:Vt(r,a,Wy)==="intersect")}function Gy(e,t,o,a){let i;for(;i=Yy(e,o,t);)o=a(t,o,i);return o}function Ky(e){return function(t,o,a){const i={x:o.x,y:o.y};return["x","y"].forEach(r=>{const l=e[r];if(!l)return;const s=r==="x"?"width":"height",{margin:c,minDistance:d}=l;c<0?i[r]=Math.min(a[r]+c-t[s]/2,o[r]-d+c):i[r]=Math.max(a[r]+a[s]+c+t[s]/2,o[r]+d+c)}),i}}function Xy(e,t){return Zy(e,t)}function Zy(e,t){const o=be(e),a=Te(e),i=Ly(e,{filter:u=>Uy(u,"myline")}),r=30,l=80,c={x:o.right+i+t.width/2,y:a.y+Qy("left",l)};return Gy(e,t,c,Ky({y:{margin:r,minDistance:l}}))}function Qy(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Zc(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return Xy(a,o)})}Zc.$inject=["eventBus"];const ev={__depends__:[Hy],__init__:["myAutoPlace"],myAutoPlace:["type",Zc]};function Ei(e,t,o,a,i,r,l){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=i,this._create=r,this._myOptions=l,t.registerProvider(this)}Ei.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ei.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,i=this._autoPlace,r=this._create,l=this._myOptions;function s(){o.removeElements([e])}function c(f,h,m){t.start(f,h,m)}function d(f,h,m,p){typeof m!="string"&&(p=m);function g(x,b){const w=a.createShape(Se({type:f},p));r.start(x,w,{source:b})}function y(x,b){const w=a.createShape(Se({type:f},p));i.append(b,w)}return{group:"model",className:h,title:m,action:{dragstart:g,click:y}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const u={};for(const f in l.palette)if(f!=="create.start-event"){const h=l.palette[f];u[f]=d(h.type,h.className,h.title,h.options)}return u.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:c,dragstart:c}},u.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},u};const tv={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ei]},nv=n.defineComponent({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,i=o,r=n.ref(),l={"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,c=1;const d=()=>{c=1,s.get("canvas").zoom("fit-viewport")},u=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{i("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{i("elementClick",T.element.businessObject)}),V.on("create.end",T=>{i("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{i("elementCreate",T.shape.businessObject)})},f=function(){return{palette:a.paletteOptions||l,lineStroke:a.lineStroke}},h=()=>{let V={__init__:["myOptions"],myOptions:["type",f]};s=new Pi({canvas:{container:r.value},modules:[wg,Oa,_g,Ig,$l,Xm,Wg,Ug,Jg,Us,es,ny,Mc,sy,os,V,ev,qs,Ey,tv,Ry,Oy,$y,Gs]});const T=s.get("canvas"),L=s.get("elementFactory");d();const F=L.createRoot();T.setRootElement(F),u()};n.onMounted(()=>{h()});const m=V=>{const T=V==null?1:c+V;s.get("canvas").zoom(T),c=T},p=()=>{s.get("commandStack").redo()},g=()=>{s.get("commandStack").undo()},y=()=>{s.get("canvas").zoom(1);const V=s.get("elementRegistry").getAll();var T=Ks(V);return T},x=V=>{s.clear(),d(),Xs(V,s)},b=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{d()},zoom:V=>{m(V)},redo:()=>{p()},undo:()=>{g()},getData:()=>y(),setData:V=>{x(V)},updateElemet:V=>{b(V)}}),(V,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:r,class:"j-work-flow"},null,512))}}),Qc=oe(Gm),ed=oe(nv),ov=[uo,rr,lr,sr,cr,dr,ur,fr,pr,hr,mr,br,xr,wr,Cr,ga,ir,kr,Er,_r,Br,Tr,Vr,zr,Mr,Pr,Nr,$r,Or,Rr,Ar,Lr,Ir,Ur,Jr,Dr,qr,Yr,Gr,Kr,Fr,Hr,ya,Xr,Zr,Qr,el,tl,nl,ol,bp,Qc,ed],av={install:e=>{ov.forEach(t=>{e.component(t.name,t)})}};N.EncryptionFactory=Qi,N.EventBus=pa,N.HashingFactory=Fd,N.JAutoComplete=hr,N.JBarcode=Vr,N.JButton=uo,N.JButtonSelect=Ur,N.JButtons=rr,N.JCascaderSelect=ur,N.JCheckbox=fr,N.JCodeMirror=zr,N.JCollapse=nl,N.JComp=Dr,N.JCount=Mr,N.JCountUp=Pr,N.JDataPanel=Nr,N.JDialog=xr,N.JDialogFull=wr,N.JDivider=$r,N.JDrawer=Cr,N.JDynamicLayer=ir,N.JEcharts=Tr,N.JEditor=ol,N.JForm=qr,N.JFormItem=Yr,N.JGuid=Kr,N.JHpanel=Or,N.JIcon=sr,N.JInput=lr,N.JInputButton=Rr,N.JInputCode=Ar,N.JInputColor=Lr,N.JInputLayer=Zr,N.JInputRows=Xr,N.JInputTag=kr,N.JLayer=ga,N.JLayerForm=Qr,N.JLayout=mr,N.JMenu=Hr,N.JNumber=pr,N.JPage=Gr,N.JRadio=cr,N.JRate=Er,N.JSelect=dr,N.JSlider=_r,N.JSliderCaptcha=Fr,N.JSwitch=el,N.JTable=br,N.JTablePanel=ya,N.JTabs=tl,N.JTitle=Ir,N.JTree=Jr,N.JUpload=Br,N.JWorkflow=ed,N.JWorkflowViewer=Qc,N.assign=Se,N.buildShortUUID=po,N.buildUUID=Ut,N.clearJson=On,N.clone=fo,N.deepClone=gt,N.default=av,N.eventBus=Wd,N.formatToDate=An,N.formatToDateTime=Yi,N.fullScreenLoading=dn,N.getCompConfig=Jt,N.getCompType=fa,N.getFunction=da,N.getIsInputComp=ho,N.getIsTableInputComp=Di,N.getLabel=qi,N.getObjType=Oi,N.getTextWidth=cn,N.is=$i,N.isArray=co,N.isNullOrEmpty=mt,N.isObject=Bd,N.loadBMap=tr,N.lowerFirst=Nd,N.myAesDecrypt=Hd,N.numberToChinese=Ai,N.numberToThousandSeparator=Li,N.pagination=Vd,N.paginationEx=Md,N.set=Ri,N.setGroupMap=zi,N.toArray=Hi,N.toDecimal=Rn,N.toLeafArray=Ji,N.toSimpleTree=Od,N.toTree=$d,N.uniqueArray=Pd,N.upFirst=Ii,N.useLayer=In,N.useSortable=er,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));