@agent-spaces/server 0.3.64 → 0.3.67

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 (332) hide show
  1. package/dist/adapters/agent-runtime.js +4 -0
  2. package/dist/adapters/claude-code-runtime/index.js +68 -2
  3. package/dist/adapters/claude-code-runtime/message-format.js +26 -0
  4. package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
  5. package/dist/adapters/codex-function-tool-bridge.js +144 -0
  6. package/dist/adapters/codex-runtime.js +23 -4
  7. package/dist/adapters/git.js +25 -7
  8. package/dist/adapters/hermes-runtime.js +210 -0
  9. package/dist/agents/agent-message-parts.js +1 -1
  10. package/dist/agents/commit-agent.js +4 -2
  11. package/dist/agents/issue-task-controller.js +75 -4
  12. package/dist/agents/pull-request-agent.js +115 -0
  13. package/dist/agents/scheduler-agent.js +1 -1
  14. package/dist/app.js +12 -70
  15. package/dist/middleware/auth.js +1 -1
  16. package/dist/package.json +2 -1
  17. package/dist/routes/agent-sse.js +2 -0
  18. package/dist/routes/agent.js +3 -0
  19. package/dist/routes/database.js +1 -0
  20. package/dist/routes/git.js +197 -317
  21. package/dist/routes/issue.js +1 -1
  22. package/dist/routes/notification.js +10 -0
  23. package/dist/routes/robot-account.js +68 -0
  24. package/dist/routes/version.js +94 -0
  25. package/dist/routes/worktree.js +93 -0
  26. package/dist/services/agent.js +37 -3
  27. package/dist/services/builtin-tools/kanban-tools.js +4 -0
  28. package/dist/services/git-operation-log.js +40 -0
  29. package/dist/services/global-wechat-qr.js +72 -0
  30. package/dist/services/hook-engine.js +175 -17
  31. package/dist/services/notification-center.js +9 -0
  32. package/dist/services/notification-hub/bot-agent.js +3 -1
  33. package/dist/services/notification-hub/service.js +12 -2
  34. package/dist/services/robot-account.js +34 -0
  35. package/dist/services/version.js +59 -0
  36. package/dist/services/workflow-command-runner.js +23 -0
  37. package/dist/services/workflow.js +25 -8
  38. package/dist/services/workspace.js +25 -1
  39. package/dist/services/worktree.js +207 -0
  40. package/dist/storage/robot-account-store.js +39 -0
  41. package/dist/storage/worktree-store.js +33 -0
  42. package/dist/web/404.html +1 -1
  43. package/dist/web/__next.__PAGE__.txt +4 -4
  44. package/dist/web/__next._full.txt +23 -25
  45. package/dist/web/__next._head.txt +4 -4
  46. package/dist/web/__next._index.txt +13 -13
  47. package/dist/web/__next._tree.txt +2 -2
  48. package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
  49. package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
  50. package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
  51. package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
  52. package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
  53. package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
  54. package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
  55. package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
  56. package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
  57. package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
  58. package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
  59. package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
  60. package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
  61. package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
  62. package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
  63. package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
  64. package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
  65. package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
  66. package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
  67. package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
  68. package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
  69. package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
  70. package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
  71. package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
  72. package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
  73. package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
  74. package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
  75. package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
  76. package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
  77. package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
  78. package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
  79. package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
  80. package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
  81. package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
  82. package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
  83. package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
  84. package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
  85. package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
  86. package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
  87. package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
  88. package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
  89. package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
  90. package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
  91. package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
  92. package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
  93. package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
  94. package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
  95. package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
  96. package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
  97. package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
  98. package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
  99. package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
  100. package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
  101. package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
  102. package/dist/web/_not-found/__next._full.txt +30 -29
  103. package/dist/web/_not-found/__next._head.txt +4 -4
  104. package/dist/web/_not-found/__next._index.txt +13 -13
  105. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  106. package/dist/web/_not-found/__next._not-found.txt +3 -3
  107. package/dist/web/_not-found/__next._tree.txt +2 -2
  108. package/dist/web/_not-found.html +1 -1
  109. package/dist/web/_not-found.txt +30 -29
  110. package/dist/web/index.html +1 -1
  111. package/dist/web/index.txt +23 -25
  112. package/dist/web/login/__next._full.txt +28 -28
  113. package/dist/web/login/__next._head.txt +4 -4
  114. package/dist/web/login/__next._index.txt +13 -13
  115. package/dist/web/login/__next._tree.txt +2 -2
  116. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  117. package/dist/web/login/__next.login.txt +3 -3
  118. package/dist/web/login.html +1 -1
  119. package/dist/web/login.txt +28 -28
  120. package/dist/web/settings/__next._full.txt +33 -32
  121. package/dist/web/settings/__next._head.txt +4 -4
  122. package/dist/web/settings/__next._index.txt +13 -13
  123. package/dist/web/settings/__next._tree.txt +2 -2
  124. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  125. package/dist/web/settings/__next.settings.txt +5 -5
  126. package/dist/web/settings/agents/__next._full.txt +24 -24
  127. package/dist/web/settings/agents/__next._head.txt +4 -4
  128. package/dist/web/settings/agents/__next._index.txt +13 -13
  129. package/dist/web/settings/agents/__next._tree.txt +2 -2
  130. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  131. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  132. package/dist/web/settings/agents/__next.settings.txt +5 -5
  133. package/dist/web/settings/agents.html +1 -1
  134. package/dist/web/settings/agents.txt +24 -24
  135. package/dist/web/settings/mcps/__next._full.txt +24 -24
  136. package/dist/web/settings/mcps/__next._head.txt +4 -4
  137. package/dist/web/settings/mcps/__next._index.txt +13 -13
  138. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  139. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  140. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  141. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  142. package/dist/web/settings/mcps.html +1 -1
  143. package/dist/web/settings/mcps.txt +24 -24
  144. package/dist/web/settings/models/__next._full.txt +24 -24
  145. package/dist/web/settings/models/__next._head.txt +4 -4
  146. package/dist/web/settings/models/__next._index.txt +13 -13
  147. package/dist/web/settings/models/__next._tree.txt +2 -2
  148. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  149. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  150. package/dist/web/settings/models/__next.settings.txt +5 -5
  151. package/dist/web/settings/models.html +1 -1
  152. package/dist/web/settings/models.txt +24 -24
  153. package/dist/web/settings/output-styles/__next._full.txt +24 -24
  154. package/dist/web/settings/output-styles/__next._head.txt +4 -4
  155. package/dist/web/settings/output-styles/__next._index.txt +13 -13
  156. package/dist/web/settings/output-styles/__next._tree.txt +2 -2
  157. package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
  158. package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
  159. package/dist/web/settings/output-styles/__next.settings.txt +5 -5
  160. package/dist/web/settings/output-styles.html +1 -1
  161. package/dist/web/settings/output-styles.txt +24 -24
  162. package/dist/web/settings/prompts/__next._full.txt +24 -24
  163. package/dist/web/settings/prompts/__next._head.txt +4 -4
  164. package/dist/web/settings/prompts/__next._index.txt +13 -13
  165. package/dist/web/settings/prompts/__next._tree.txt +2 -2
  166. package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
  167. package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
  168. package/dist/web/settings/prompts/__next.settings.txt +5 -5
  169. package/dist/web/settings/prompts.html +1 -1
  170. package/dist/web/settings/prompts.txt +24 -24
  171. package/dist/web/settings/providers/__next._full.txt +24 -24
  172. package/dist/web/settings/providers/__next._head.txt +4 -4
  173. package/dist/web/settings/providers/__next._index.txt +13 -13
  174. package/dist/web/settings/providers/__next._tree.txt +2 -2
  175. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  176. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  177. package/dist/web/settings/providers/__next.settings.txt +5 -5
  178. package/dist/web/settings/providers.html +1 -1
  179. package/dist/web/settings/providers.txt +24 -24
  180. package/dist/web/settings/skills/__next._full.txt +24 -24
  181. package/dist/web/settings/skills/__next._head.txt +4 -4
  182. package/dist/web/settings/skills/__next._index.txt +13 -13
  183. package/dist/web/settings/skills/__next._tree.txt +2 -2
  184. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  185. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  186. package/dist/web/settings/skills/__next.settings.txt +5 -5
  187. package/dist/web/settings/skills.html +1 -1
  188. package/dist/web/settings/skills.txt +24 -24
  189. package/dist/web/settings/tools/__next._full.txt +24 -24
  190. package/dist/web/settings/tools/__next._head.txt +4 -4
  191. package/dist/web/settings/tools/__next._index.txt +13 -13
  192. package/dist/web/settings/tools/__next._tree.txt +2 -2
  193. package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
  194. package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
  195. package/dist/web/settings/tools/__next.settings.txt +5 -5
  196. package/dist/web/settings/tools.html +1 -1
  197. package/dist/web/settings/tools.txt +24 -24
  198. package/dist/web/settings.html +1 -1
  199. package/dist/web/settings.txt +33 -32
  200. package/dist/web/workflows/__next._full.txt +31 -33
  201. package/dist/web/workflows/__next._head.txt +4 -4
  202. package/dist/web/workflows/__next._index.txt +13 -13
  203. package/dist/web/workflows/__next._tree.txt +2 -2
  204. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  205. package/dist/web/workflows/__next.workflows.txt +3 -3
  206. package/dist/web/workflows.html +1 -1
  207. package/dist/web/workflows.txt +31 -33
  208. package/dist/web/workspace/_/__next._full.txt +28 -29
  209. package/dist/web/workspace/_/__next._head.txt +4 -4
  210. package/dist/web/workspace/_/__next._index.txt +13 -13
  211. package/dist/web/workspace/_/__next._tree.txt +2 -2
  212. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  213. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  214. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  215. package/dist/web/workspace/_.html +1 -1
  216. package/dist/web/workspace/_.txt +28 -29
  217. package/dist/web/workspaces/__next._full.txt +29 -31
  218. package/dist/web/workspaces/__next._head.txt +4 -4
  219. package/dist/web/workspaces/__next._index.txt +13 -13
  220. package/dist/web/workspaces/__next._tree.txt +2 -2
  221. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  222. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  223. package/dist/web/workspaces.html +1 -1
  224. package/dist/web/workspaces.txt +29 -31
  225. package/dist/ws/agent-prompt.js +32 -3
  226. package/dist/ws/agent-runner.js +83 -6
  227. package/package.json +11 -11
  228. package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
  229. package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
  230. package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
  231. package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
  232. package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
  233. package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
  234. package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
  235. package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
  236. package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
  237. package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
  238. package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
  239. package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
  240. package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
  241. package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
  242. package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
  243. package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
  244. package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
  245. package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
  246. package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
  247. package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
  248. package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
  249. package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
  250. package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
  251. package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
  252. package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
  253. package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
  254. package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
  255. package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
  256. package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
  257. package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
  258. package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
  259. package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
  260. package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
  261. package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
  262. package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
  263. package/public/output-styles/carmack-mode.md +0 -381
  264. package/public/output-styles/codex-rigor-mode.md +0 -114
  265. package/public/output-styles/dhh-mode.md +0 -265
  266. package/public/output-styles/evan-you-mode.md +0 -539
  267. package/public/output-styles/index.json +0 -37
  268. package/public/output-styles/jobs-mode.md +0 -369
  269. package/public/output-styles/linus-mode.md +0 -135
  270. package/public/output-styles/uncle-bob-mode.md +0 -221
  271. package/public/prompt/andrej-karpathy-skills.md +0 -65
  272. package/public/prompt/claude-token-efficient-coding.md +0 -35
  273. package/public/prompt/index.json +0 -12
  274. package/public/skills/index.json +0 -92
  275. package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
  276. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
  277. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
  278. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
  279. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
  280. package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
  281. package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
  282. package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
  283. package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
  284. package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
  285. package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
  286. package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
  287. package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
  288. package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
  289. package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
  290. package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
  291. package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
  292. package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
  293. package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
  294. package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
  295. package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
  296. package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
  297. package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
  298. package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
  299. package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
  300. package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
  301. package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
  302. package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
  303. package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
  304. package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
  305. package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
  306. package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
  307. package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
  308. package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
  309. package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
  310. package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
  311. package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
  312. package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
  313. package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
  314. package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
  315. package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
  316. package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
  317. package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
  318. package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
  319. package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
  320. package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
  321. package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
  322. package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
  323. package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
  324. package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
  325. package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  326. package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
  327. package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
  328. package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
  329. package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
  330. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
  331. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
  332. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
1
  (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,161316,t=>{"use strict";var e,i,o,a,s,n=t.i(344180),r=t.i(887836),l=t.i(764556),d=l,h=t.i(106206),u=t.i(51190),c=class t{static HORZ=new t("horz");static VERT=new t("vert");static flip(e){return e===t.HORZ?t.VERT:t.HORZ}_name;constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}},g=class t{static empty(){return new t(0,0,0,0)}static fromJson(e){return new t(e.x,e.y,e.width,e.height)}x;y;width;height;constructor(t,e,i,o){this.x=t,this.y=e,this.width=i,this.height=o}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}snap(t){this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this.width=Math.round(this.width/t)*t,this.height=Math.round(this.height/t)*t}static getBoundingClientRect(e){let{x:i,y:o,width:a,height:s}=e.getBoundingClientRect();return new t(i,o,a,s)}static getContentRect(e){let i=e.getBoundingClientRect(),o=window.getComputedStyle(e),a=parseFloat(o.paddingLeft),s=parseFloat(o.paddingRight),n=parseFloat(o.paddingTop),r=parseFloat(o.paddingBottom),l=parseFloat(o.borderLeftWidth),d=parseFloat(o.borderRightWidth),h=parseFloat(o.borderTopWidth),u=parseFloat(o.borderBottomWidth),c=i.width-l-a-s-d,g=i.height-h-n-r-u;return new t(i.left+l+a,i.top+h+n,c,g)}static fromDomRect(e){return new t(e.x,e.y,e.width,e.height)}relativeTo(e){return new t(this.x-e.x,this.y-e.y,this.width,this.height)}clone(){return new t(this.x,this.y,this.width,this.height)}equals(t){return this.x===t?.x&&this.y===t?.y&&this.width===t?.width&&this.height===t?.height}equalsWhenRounded(t){return!!t&&.5>Math.abs(this.x-t.x)&&.5>Math.abs(this.y-t.y)&&.5>Math.abs(this.width-t.width)&&.5>Math.abs(this.height-t.height)}equalSize(t){return this.width===t?.width&&this.height===t?.height}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}get bottom(){return this.y+this.height}get right(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(t,e){this.styleWithPosition(t.style,e)}styleWithPosition(t,e="absolute"){return t.left=this.x+"px",t.top=this.y+"px",t.width=Math.max(0,this.width)+"px",t.height=Math.max(0,this.height)+"px",t.position=e,t}contains(t,e){return!!(this.x<=t&&t<=this.getRight()&&this.y<=e&&e<=this.getBottom())}removeInsets(e){return new t(this.x+e.left,this.y+e.top,Math.max(0,this.width-e.left-e.right),Math.max(0,this.height-e.top-e.bottom))}centerInRect(t){this.x=(t.width-this.width)/2,this.y=(t.height-this.height)/2}clamp(t){this.width>t.width&&(this.width=t.width),this.height>t.height&&(this.height=t.height),this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.getRight()>t.getRight()&&(this.x=t.getRight()-this.width),this.getBottom()>t.getBottom()&&(this.y=t.getBottom()-this.height),this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y)}_getSize(t){let e=this.width;return t===c.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}},_=class t{static values=new Map;static TOP=new t("top",c.VERT,0);static BOTTOM=new t("bottom",c.VERT,1);static LEFT=new t("left",c.HORZ,0);static RIGHT=new t("right",c.HORZ,1);static CENTER=new t("center",c.VERT,0);static getByName(e){return t.values.get(e)}static getLocation(e,i,o){if(i=(i-e.x)/e.width,o=(o-e.y)/e.height,i>=.25&&i<.75&&o>=.25&&o<.75)return t.CENTER;let a=o>=i,s=o>=1-i;return a?s?t.BOTTOM:t.LEFT:s?t.RIGHT:t.TOP}name;orientation;indexPlus;constructor(e,i,o){this.name=e,this.orientation=i,this.indexPlus=o,t.values.set(this.name,this)}getName(){return this.name}getOrientation(){return this.orientation}getDockRect(e){return this===t.TOP?new g(e.x,e.y,e.width,e.height/2):this===t.BOTTOM?new g(e.x,e.getBottom()-e.height/2,e.width,e.height/2):this===t.LEFT?new g(e.x,e.y,e.width/2,e.height):this===t.RIGHT?new g(e.getRight()-e.width/2,e.y,e.width/2,e.height):e.clone()}split(e,i){return this===t.TOP?{start:new g(e.x,e.y,e.width,i),end:new g(e.x,e.y+i,e.width,e.height-i)}:this===t.LEFT?{start:new g(e.x,e.y,i,e.height),end:new g(e.x+i,e.y,e.width-i,e.height)}:this===t.RIGHT?{start:new g(e.getRight()-i,e.y,i,e.height),end:new g(e.x,e.y,e.width-i,e.height)}:{start:new g(e.x,e.getBottom()-i,e.width,i),end:new g(e.x,e.y,e.width,e.height-i)}}reflect(){return this===t.TOP?t.BOTTOM:this===t.LEFT?t.RIGHT:this===t.RIGHT?t.LEFT:t.TOP}toString(){return"(DockLocation: name="+this.name+", orientation="+this.orientation+")"}},T=((e={}).FLEXLAYOUT__BORDER="flexlayout__border",e.FLEXLAYOUT__BORDER_="flexlayout__border_",e.FLEXLAYOUT__BORDER_TAB_CONTENTS="flexlayout__border_tab_contents",e.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",e.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",e.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",e.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",e.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",e.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",e.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",e.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",e.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",e.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",e.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",e.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",e.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",e.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",e.FLEXLAYOUT__BORDER_LEADING="flexlayout__border_leading",e.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",e.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",e.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",e.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",e.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",e.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",e.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",e.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",e.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",e.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",e.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",e.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",e.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",e.FLEXLAYOUT__FLOAT_WINDOW="flexlayout__float_window",e.FLEXLAYOUT__FLOAT_WINDOW_HEADER="flexlayout__float_window_header",e.FLEXLAYOUT__FLOAT_WINDOW_CONTENT="flexlayout__float_window_content",e.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",e.FLEXLAYOUT__LAYOUT="flexlayout__layout",e.FLEXLAYOUT__LAYOUT_MOVEABLES="flexlayout__layout_moveables",e.FLEXLAYOUT__LAYOUT_OVERLAY="flexlayout__layout_overlay",e.FLEXLAYOUT__LAYOUT_TAB_STAMPS="flexlayout__layout_tab_stamps",e.FLEXLAYOUT__LAYOUT_MAIN="flexlayout__layout_main",e.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER="flexlayout__layout_border_container",e.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER="flexlayout__layout_border_container_inner",e.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",e.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",e.FLEXLAYOUT__SPLITTER="flexlayout__splitter",e.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",e.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",e.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",e.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",e.FLEXLAYOUT__SPLITTER_HANDLE="flexlayout__splitter_handle",e.FLEXLAYOUT__SPLITTER_HANDLE_HORZ="flexlayout__splitter_handle_horz",e.FLEXLAYOUT__SPLITTER_HANDLE_VERT="flexlayout__splitter_handle_vert",e.FLEXLAYOUT__ROW="flexlayout__row",e.FLEXLAYOUT__TAB="flexlayout__tab",e.FLEXLAYOUT__TAB_POSITION="flexlayout__tab_position",e.FLEXLAYOUT__TAB_MOVEABLE="flexlayout__tab_moveable",e.FLEXLAYOUT__TAB_OVERLAY="flexlayout__tab_overlay",e.FLEXLAYOUT__TAB_LAYOUT_CONTAINER="flexlayout__tab_layout_container",e.FLEXLAYOUT__TAB_LAYOUT_CONTAINER_USER="flexlayout__tab_layout_container_user",e.FLEXLAYOUT__TABSET="flexlayout__tabset",e.FLEXLAYOUT__TABSET_CONTAINER="flexlayout__tabset_container",e.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",e.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",e.FLEXLAYOUT__TABSET_TAB_SPACER="flexlayout__tabset_tab_spacer",e.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",e.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE="flexlayout__tabset_tab_divider_selected_before",e.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER="flexlayout__tabset_tab_divider_selected_after",e.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER="flexlayout__tabset_tab_divider_inner",e.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",e.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",e.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",e.FLEXLAYOUT__TABSET_LEADING="flexlayout__tabset_leading",e.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",e.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",e.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",e.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",e.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",e.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",e.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",e.FLEXLAYOUT__TAB_BUTTON_STRETCH="flexlayout__tab_button_stretch",e.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",e.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",e.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",e.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",e.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",e.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",e.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",e.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",e.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",e.FLEXLAYOUT__TAB_TOOLBAR_ICON="flexlayout__tab_toolbar_icon",e.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",e.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",e.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",e.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",e.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",e.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",e.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED="flexlayout__popup_menu_item--selected",e.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu",e.FLEXLAYOUT__MINI_SCROLLBAR="flexlayout__mini_scrollbar",e.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER="flexlayout__mini_scrollbar_container",e),p=class t{static ADD_TAB="FlexLayout_AddTab";static DELETE_TAB="FlexLayout_DeleteTab";static RENAME_TAB="FlexLayout_RenameTab";static SELECT_TAB="FlexLayout_SelectTab";static MOVE_NODE="FlexLayout_MoveNode";static DELETE_TABSET="FlexLayout_DeleteTabset";static SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset";static ADJUST_WEIGHTS="FlexLayout_AdjustWeights";static ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit";static MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle";static UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes";static UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes";static POPOUT_TAB="FlexLayout_PopoutTab";static POPOUT_TABSET="FlexLayout_PopoutTabset";static CLOSE_POPOUT="FlexLayout_ClosePopout";static MOVE_POPOUT_TO_FRONT="FlexLayout_MoveFloatToFront";static CREATE_SUBLAYOUT="FlexLayout_CreateSubLayout";static addTab(e,i,o,a,s){return new b(t.ADD_TAB,{json:e,toNode:i,location:o.getName(),index:a,select:s})}static addNode(t,e,i,o,a){return this.addTab(t,e,i,o,a)}static moveNode(e,i,o,a,s){return new b(t.MOVE_NODE,{fromNode:e,toNode:i,location:o.getName(),index:a,select:s})}static deleteTab(e){return new b(t.DELETE_TAB,{node:e})}static deleteTabset(e){return new b(t.DELETE_TABSET,{node:e})}static renameTab(e,i){return new b(t.RENAME_TAB,{node:e,text:i})}static selectTab(e){return new b(t.SELECT_TAB,{tabNode:e})}static setActiveTabset(e,i){return new b(t.SET_ACTIVE_TABSET,{tabsetNode:e,layoutId:i})}static adjustWeights(e,i){return new b(t.ADJUST_WEIGHTS,{nodeId:e,weights:i})}static adjustBorderSplit(e,i){return new b(t.ADJUST_BORDER_SPLIT,{node:e,size:i})}static maximizeToggle(e,i){return new b(t.MAXIMIZE_TOGGLE,{node:e,layoutId:i})}static updateModelAttributes(e){return new b(t.UPDATE_MODEL_ATTRIBUTES,{json:e})}static updateNodeAttributes(e,i){return new b(t.UPDATE_NODE_ATTRIBUTES,{node:e,json:i})}static popoutTab(e,i="window"){return new b(t.POPOUT_TAB,{node:e,type:i})}static popoutTabset(e,i="window"){return new b(t.POPOUT_TABSET,{node:e,type:i})}static closePopout(e){return new b(t.CLOSE_POPOUT,{layoutId:e})}static movePopoutToFront(e){return new b(t.MOVE_POPOUT_TO_FRONT,{layoutId:e})}static createPopout(t,e,i){return this.createSubLayout(t,e,i)}static createSubLayout(e,i,o){return new b(t.CREATE_SUBLAYOUT,{layout:e,rect:i,type:o})}},b=class{type;data;constructor(t,e){this.type=t,this.data=e}},E=class{attributes;nameToAttribute;constructor(){this.attributes=[],this.nameToAttribute=new Map}addWithAll(t,e,i,o){let a=new f(t,e,i,o);return this.attributes.push(a),this.nameToAttribute.set(t,a),a}addInherited(t,e){return this.addWithAll(t,e,void 0,!1)}add(t,e,i){return this.addWithAll(t,void 0,e,i)}getAttributes(){return this.attributes}getModelName(t){let e=this.nameToAttribute.get(t);if(void 0!==e)return e.modelName}toJson(t,e){for(let i of this.attributes){let o=e[i.name];(i.alwaysWriteJson||o!==i.defaultValue)&&(t[i.name]=o)}}fromJson(t,e){for(let i of this.attributes){let o=t[i.name];void 0===o&&i.alias&&(o=t[i.alias]),void 0===o?e[i.name]=i.defaultValue:e[i.name]=o}}update(t,e){for(let i of this.attributes)if(Object.prototype.hasOwnProperty.call(t,i.name)){let o=t[i.name];void 0===o?delete e[i.name]:e[i.name]=o}}setDefaults(t){for(let e of this.attributes)t[e.name]=e.defaultValue}pairAttributes(t,e){for(let i of e.attributes)if(i.modelName&&this.nameToAttribute.has(i.modelName)){let e=this.nameToAttribute.get(i.modelName);e.setpairedAttr(i),i.setpairedAttr(e),e.setPairedType(t)}}toTypescriptInterface(t,e){let i=[],o=this.attributes.sort((t,e)=>t.name.localeCompare(e.name));i.push("export interface I"+t+"Attributes {");for(let t=0;t<o.length;t++){let a,s,n=o[t],r=n.type,l=n;void 0!==l.defaultValue?a=l.defaultValue:void 0!==l.modelName&&void 0!==e&&void 0!==e.nameToAttribute.get(l.modelName)&&(s=l.modelName,a=(l=e.nameToAttribute.get(s)).defaultValue,r=l.type);let d=JSON.stringify(a),h=l.required?"":"?",u=" /**\n ";n.description?u+=n.description:n.pairedType&&n.pairedAttr?.description&&(u+=`Value for ${n.pairedType} attribute ${n.pairedAttr.name} if not overridden`,u+="\n\n ",u+=n.pairedAttr?.description),u+="\n\n ",n.fixed?u+=`Fixed value: ${d}`:s?u+=`Default: inherited from Global attribute ${n.modelName} (default ${d})`:u+=`Default: ${d}`,u+="\n */",i.push(u),i.push(" "+n.name+h+": "+r+";\n")}return i.push("}"),i.join("\n")}},f=class{static NUMBER="number";static STRING="string";static BOOLEAN="boolean";name;alias;modelName;pairedAttr;pairedType;defaultValue;alwaysWriteJson;type;required;fixed;description;constructor(t,e,i,o){this.name=t,this.alias=void 0,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=o,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setAlias(t){return this.alias=t,this}setDescription(t){this.description=t}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}setpairedAttr(t){this.pairedAttr=t}setPairedType(t){this.pairedType=t}},m=class{node;rect;location;index;className;constructor(t,e,i,o,a){this.node=t,this.rect=e,this.location=i,this.index=o,this.className=a}},L=class{model;attributes;parent;children;rect;path;listeners;constructor(t){this.model=t,this.attributes={},this.children=[],this.rect=g.empty(),this.listeners=new Map,this.path=""}getId(){let t=this.attributes.id;return void 0!==t||(t=this.model.nextUniqueId(),this.setId(t)),t}getModel(){return this.model}getType(){return this.attributes.type}getParent(){return this.parent}getChildren(){return this.children}getRect(){return this.rect}getPath(){return this.path}isCloseable(){for(let t=0;t<this.children.length;t++)if(!this.children[t].isCloseable())return!1;return!0}isAllowedInWindow(){for(let t=0;t<this.children.length;t++)if(!this.children[t].isAllowedInWindow())return!1;return!0}getOrientation(){return void 0===this.parent?this.model.isRootOrientationVertical()?c.VERT:c.HORZ:c.flip(this.parent.getOrientation())}getLayoutId(){return this.getLayout().getLayoutId()}getLayout(){return this.parent?this.parent.getLayout():this.model.getMainLayout()}setEventListener(t,e){this.listeners.set(t,e)}removeEventListener(t){this.listeners.delete(t)}setId(t){this.attributes.id=t}fireEvent(t,e){this.listeners.has(t)&&this.listeners.get(t)(e)}getAttr(t){let e=this.attributes[t];if(void 0===e){let i=this.getAttributeDefinitions().getModelName(t);void 0!==i&&(e=this.model.getAttribute(i))}return e}forEachNode(t,e){for(let i of(t(this,e),e++,this.children))i.forEachNode(t,e)}setPaths(t){let e=0;for(let i of this.children){let o=t;"row"===i.getType()?o+="/r"+e:"tabset"===i.getType()?o+="/ts"+e:"tab"===i.getType()&&(o+="/t"+e),i.path=o,i.setPaths(o),e++}}setParent(t){this.parent=t}setRect(t){this.rect=t}setPath(t){this.path=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}findDropTargetNode(t,e,i,o){let a;if(this.rect.contains(i,o)){if(void 0!==this.model.getMaximizedTabset(t))a=this.model.getMaximizedTabset(t).canDrop(e,i,o);else if(void 0===(a=this.canDrop(e,i,o))&&0!==this.children.length){for(let s of this.children)if(void 0!==(a=s.findDropTargetNode(t,e,i,o)))break}}return a}canDrop(t,e,i){}canDockInto(t,e){if(null!=e){if(e.location===_.CENTER&&!1===e.node.isEnableDrop()||e.location===_.CENTER&&"tabset"===t.getType()&&!1===t.isEnableClose()||e.location!==_.CENTER&&!1===e.node.isEnableDivide())return!1;if(this.model.getOnAllowDrop())return this.model.getOnAllowDrop()(t,e)}return!0}removeChild(t){let e=this.children.indexOf(t);return -1!==e&&this.children.splice(e,1),e}addChild(t,e){return null!=e?this.children.splice(e,0,t):(this.children.push(t),e=this.children.length-1),t.parent=this,e}removeAll(){this.children=[]}styleWithPosition(t){return null==t&&(t={}),this.rect.styleWithPosition(t)}isEnableDivide(){return!0}toAttributeString(){return JSON.stringify(this.attributes,void 0," ")}},y=class t extends L{static TYPE="tab";static fromJson(e,i,o=!0){return new t(i,e,o)}tabRect=g.empty();moveableElement;renderedName;extra;visible;rendered;scrollTop;scrollLeft;tabStamp;constructor(e,i,o=!0){super(e),this.extra={},this.moveableElement=null,this.tabStamp=null,this.rendered=!1,this.visible=!1,t.attributeDefinitions.fromJson(i,this.attributes),!0===o&&e.addNode(this)}getName(){return this.getAttr("name")}getIcon(){return this.getAttr("icon")}getSubLayoutId(){return this.getAttr("subLayoutId")}getHelpText(){return this.getAttr("helpText")}getComponent(){return this.getAttr("component")}getWindowId(){let t=this.getLayout();if(t)return t.getWindowId()}getConfig(){return this.attributes.config}getExtraData(){return this.extra}isPoppedOut(){return this.getLayoutId()!==W.MAIN_LAYOUT_ID}isSelected(){return this.getParent().getSelectedNode()===this}isCloseable(){let t=this.isEnableClose();return t&&this.getSubLayoutId()&&(t=this.model.getLayouts().get(this.getSubLayoutId()).getRootRow().isCloseable()),t}isAllowedInWindow(){let t=this.isEnablePopout();return t&&this.getSubLayoutId()&&(t=this.model.getLayouts().get(this.getSubLayoutId()).getRootRow().isAllowedInWindow()),t}isEnableClose(){return this.getAttr("enableClose")}getCloseType(){return this.getAttr("closeType")}isEnablePopout(){return this.getAttr("enablePopout")}isEnablePopoutIcon(){return this.getAttr("enablePopoutIcon")}isEnablePopoutFloatIcon(){return this.getAttr("enablePopoutFloatIcon")}isEnablePopoutOverlay(){return this.getAttr("enablePopoutOverlay")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableRename(){return this.getAttr("enableRename")}isEnableWindowReMount(){return this.getAttr("enableWindowReMount")}getClassName(){return this.getAttr("className")}getContentClassName(){return this.getAttr("contentClassName")}getTabSetClassName(){return this.getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this.getAttr("enableRenderOnDemand")}getMinWidth(){return this.getAttr("minWidth")}getMinHeight(){return this.getAttr("minHeight")}getMaxWidth(){return this.getAttr("maxWidth")}getMaxHeight(){return this.getAttr("maxHeight")}isVisible(){return this.visible}toJson(){let e={};return t.attributeDefinitions.toJson(e,this.attributes),e}saveScrollPosition(){this.moveableElement&&(this.scrollLeft=this.moveableElement.scrollLeft,this.scrollTop=this.moveableElement.scrollTop)}restoreScrollPosition(){this.scrollTop&&requestAnimationFrame(()=>{this.moveableElement&&this.scrollTop&&(this.moveableElement.scrollTop=this.scrollTop,this.moveableElement.scrollLeft=this.scrollLeft)})}setRect(t){t.equals(this.rect)||(this.fireEvent("resize",{rect:t}),this.rect=t)}setVisible(t){t!==this.visible&&(this.visible=t,this.fireEvent("visibility",{visible:t}))}getScrollTop(){return this.scrollTop}setScrollTop(t){this.scrollTop=t}getScrollLeft(){return this.scrollLeft}setScrollLeft(t){this.scrollLeft=t}isRendered(){return this.rendered}setRendered(t){this.rendered=t}getTabRect(){return this.tabRect}setTabRect(t){this.tabRect=t}getTabStamp(){return this.tabStamp}setTabStamp(t){this.tabStamp=t}getMoveableElement(){return this.moveableElement}setMoveableElement(t){this.moveableElement=t}setRenderedName(t){this.renderedName=t}getNameForOverflowMenu(){let t=this.getAttr("altName");return void 0!==t?t:this.renderedName}setName(t){this.attributes.name=t}delete(){this.parent.remove(this),this.getSubLayoutId()&&this.model.getLayouts().delete(this.getSubLayoutId()),this.fireEvent("close",{})}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}getAttributeDefinitions(){return t.attributeDefinitions}setBorderWidth(t){this.attributes.borderWidth=t}setBorderHeight(t){this.attributes.borderHeight=t}static getAttributeDefinitions(){return t.attributeDefinitions}static attributeDefinitions=t.createAttributeDefinitions();static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("id",void 0).setType(f.STRING).setDescription("the unique id of the tab, if left undefined a uuid will be assigned"),e.add("name","[Unnamed Tab]").setType(f.STRING).setDescription("name of tab to be displayed in the tab button"),e.add("component",void 0).setType(f.STRING).setDescription("string identifying which component to render in this tab (used in the layout factory function)"),e.add("subLayoutId",void 0).setType(f.STRING).setDescription(`the Id of the sub layout to render in this tab, defined in the subLayouts section of the model json (if
2
2
  component is also defined then use the <TabLayout> component in the factory to render the sublayout)`),e.add("altName",void 0).setType(f.STRING).setDescription("if there is no name specifed then this value will be used in the overflow menu"),e.add("helpText",void 0).setType(f.STRING).setDescription("help text for the tab to be displayed upon tab hover."),e.add("config",void 0).setType("any").setDescription("a place to hold json config for the hosted component"),e.add("tabsetClassName",void 0).setType(f.STRING).setDescription("class applied to parent tabset when this is the only tab and it is stretched to fill the tabset"),e.add("enableWindowReMount",!1).setType(f.BOOLEAN).setDescription("if enabled the tab will re-mount when popped out/in"),e.addInherited("enableClose","tabEnableClose").setType(f.BOOLEAN).setDescription("allow user to close tab via close button"),e.addInherited("closeType","tabCloseType").setType("ICloseType").setDescription("see values in ICloseType"),e.addInherited("enableDrag","tabEnableDrag").setType(f.BOOLEAN).setDescription("allow user to drag tab to new location"),e.addInherited("enableRename","tabEnableRename").setType(f.BOOLEAN).setDescription("allow user to rename tabs by double clicking"),e.addInherited("className","tabClassName").setType(f.STRING).setDescription("class applied to tab button"),e.addInherited("contentClassName","tabContentClassName").setType(f.STRING).setDescription("class applied to tab content"),e.addInherited("icon","tabIcon").setType(f.STRING).setDescription("the tab icon"),e.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(f.BOOLEAN).setDescription("whether to avoid rendering component until tab is visible"),e.addInherited("enablePopout","tabEnablePopout").setType(f.BOOLEAN).setAlias("enableFloat").setDescription("enable popout (in popout capable browser)"),e.addInherited("enablePopoutIcon","tabEnablePopoutIcon").setType(f.BOOLEAN).setDescription("whether to show the popout icon in the tabset header if this tab enables popouts"),e.addInherited("enablePopoutFloatIcon","tabEnablePopoutFloatIcon").setType(f.BOOLEAN).setDescription("whether to show the popout float icon in the tabset header if this tab enables floating popouts"),e.addInherited("enablePopoutOverlay","tabEnablePopoutOverlay").setType(f.BOOLEAN).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
3
- then enabling this option will gray out this tab`),e.addInherited("borderWidth","tabBorderWidth").setType(f.NUMBER).setDescription("width when added to border, -1 will use border size"),e.addInherited("borderHeight","tabBorderHeight").setType(f.NUMBER).setDescription("height when added to border, -1 will use border size"),e.addInherited("minWidth","tabMinWidth").setType(f.NUMBER).setDescription("the min width of this tab"),e.addInherited("minHeight","tabMinHeight").setType(f.NUMBER).setDescription("the min height of this tab"),e.addInherited("maxWidth","tabMaxWidth").setType(f.NUMBER).setDescription("the max width of this tab"),e.addInherited("maxHeight","tabMaxHeight").setType(f.NUMBER).setDescription("the max height of this tab"),e}};function A(){return window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function R(t,e,i){let o,a=e.getName(),s=e.getName();void 0===i&&(i=0),void 0===o&&void 0!==e.getIcon()&&(o=0!==i?(0,n.jsx)("img",{style:{width:"1em",height:"1em",transform:"rotate("+i+"deg)"},src:e.getIcon(),alt:"leadingContent"}):(0,n.jsx)("img",{style:{width:"1em",height:"1em"},src:e.getIcon(),alt:"leadingContent"}));let r={leading:o,content:a,name:s,buttons:[]};return t.customizeTab(e,r),e.setRenderedName(r.name),r}function O(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}function v(t,e){for(let i of[...x("iframe",e),...x("webview",e)])i.style.pointerEvents=t?"auto":"none"}function x(t,e){return[...e.getElementsByTagName(t)]}var w=!1;function N(t,e,i,o,a){w=!0,e.preventDefault();let s=t=>{t.preventDefault(),i(t.clientX,t.clientY)},n=t=>{t.preventDefault(),w=!1,a()},r=()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",r),t.removeEventListener("pointercancel",n),w=!1,o()};t.addEventListener("pointermove",s),t.addEventListener("pointerup",r),t.addEventListener("pointercancel",n)}function D(t,e){let i=e.getType();if("window"===i)return t.isAllowedInWindow();if("float"===i)return!0;if("tab"===i){let i,o=(e.getController().getModel().visitNodes(t=>{t instanceof y&&t.getSubLayoutId()===e.getLayoutId()&&(i=t.getLayout())}),i);if(o&&"window"===o.getType()&&!o.isMainLayout()&&!t.isAllowedInWindow())return!1;if(t instanceof y){if(void 0!==t.getSubLayoutId())return!1}else if(t instanceof C){for(let e of t.getChildren())if(void 0!==e.getSubLayoutId())return!1}return!0}return!1}function S(t,e){let i=t.getAttribute("style");return i!==e.getAttribute("style")&&(i?e.setAttribute("style",i):e.removeAttribute("style"),!0)}var I=class t extends L{static TYPE="row";static fromJson(e,i,o){let a=new t(i,e);if(null!=e.children){for(let s of e.children)if(s.type===C.TYPE){let t=C.fromJson(s,i,o);a.addChild(t)}else if(s.type===t.TYPE){let e=t.fromJson(s,i,o);a.addChild(e)}}return a}static attributeDefinitions=t.createAttributeDefinitions();layout;minHeight;minWidth;maxHeight;maxWidth;constructor(e,i){super(e),this.minHeight=1,this.minWidth=1,this.maxHeight=Y,this.maxWidth=Y,t.attributeDefinitions.fromJson(i,this.attributes),this.normalizeWeights(),e.addNode(this)}getWeight(){return this.attributes.weight}toJson(){let e={};for(let i of(t.attributeDefinitions.toJson(e,this.attributes),e.children=[],this.children))e.children.push(i.toJson());return e}getLayout(){return this.layout?this.layout:super.getLayout()}setLayout(t){this.layout=t}setWeight(t){this.attributes.weight=t}getSplitterBounds(t){let e=this.getOrientation()===c.HORZ,i=this.getChildren(),o=this.model.getSplitterSize(),a=i[0].getRect(),s=i[i.length-1].getRect(),n=e?[a.x,s.getRight()]:[a.y,s.getBottom()],r=e?[a.x,s.getRight()]:[a.y,s.getBottom()];for(let a=0;a<t;a++){let t=i[a];n[0]+=e?t.getMinWidth():t.getMinHeight(),r[0]+=e?t.getMaxWidth():t.getMaxHeight(),a>0&&(n[0]+=o,r[0]+=o)}for(let a=i.length-1;a>=t;a--){let t=i[a];n[1]-=(e?t.getMinWidth():t.getMinHeight())+o,r[1]-=(e?t.getMaxWidth():t.getMaxHeight())+o}return[Math.max(r[1],n[0]),Math.min(r[0],n[1])]}getSplitterInitials(t){let e=this.getOrientation()===c.HORZ,i=this.getChildren(),o=this.model.getSplitterSize(),a=[],s=0;for(let t=0;t<i.length;t++){let o=i[t].getRect(),n=e?o.width:o.height;a.push(n),s+=n}let n=i[t].getRect();return{initialSizes:a,sum:s,startPosition:(e?n.x:n.y)-o}}calculateSplit(t,e,i,o,a){let s=this.getOrientation()===c.HORZ,n=this.getChildren(),r=n[t],l=s?r.getMaxWidth():r.getMaxHeight(),d=[...i];if(e<a){let i=a-e,o=0;d[t]+i>l?(o=d[t]+i-l,d[t]=l):d[t]+=i;for(let e=t-1;e>=0;e--){let t=n[e],o=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>o){d[e]-=i;break}i-=d[e]-o,d[e]=o}for(let e=t+1;e<n.length;e++){let t=n[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+o<i){d[e]+=o;break}o-=i-d[e],d[e]=i}}else{let i=e-a,o=0;d[t-1]+i>l?(o=d[t-1]+i-l,d[t-1]=l):d[t-1]+=i;for(let e=t;e<n.length;e++){let t=n[e],o=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>o){d[e]-=i;break}i-=d[e]-o,d[e]=o}for(let e=t-1;e>=0;e--){let t=n[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+o<i){d[e]+=o;break}o-=i-d[e],d[e]=i}}return d.map(t=>100*Math.max(.1,t)/o)}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=1,this.minWidth=1,this.maxHeight=Y,this.maxWidth=Y;let t=!0;for(let e of this.children)e.calcMinMaxSize(),this.getOrientation()===c.VERT?(this.minHeight+=e.getMinHeight(),this.maxHeight+=e.getMaxHeight(),t||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,e.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,e.getMaxWidth())):(this.minWidth+=e.getMinWidth(),this.maxWidth+=e.getMaxWidth(),t||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,e.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,e.getMaxHeight())),t=!1}tidy(){let e=0;for(;e<this.children.length;){let i=this.children[e];if(i instanceof t){i.tidy();let o=i.getChildren();if(0===o.length)this.removeChild(i);else if(1===o.length){let a=o[0];if(this.removeChild(i),a instanceof t){let t=0,o=a.getChildren();for(let e of o)t+=e.getWeight();for(let a=0;a<o.length;a++){let s=o[a];s.setWeight(i.getWeight()*s.getWeight()/t),this.addChild(s,e+a)}}else a.setWeight(i.getWeight()),this.addChild(a,e)}else e++}else i instanceof C&&0===i.getChildren().length&&i.isEnableDeleteWhenEmpty()&&i.isEnableClose()?(this.removeChild(i),i===this.model.getMaximizedTabset(this.getLayoutId())&&this.model.setMaximizedTabset(void 0,this.getLayoutId())):e++}if(this===this.model.getRootRow(this.getLayoutId())&&0===this.children.length)if(this.getLayout()?.getType()!=="tab"&&this.getLayoutId()!==W.MAIN_LAYOUT_ID)this.model.getLayouts().delete(this.getLayoutId());else{let t=this.model.getOnCreateTabSet(),e=t?t():{};e={...e,selected:-1};let i=new C(this.model,e);this.model.setActiveTabset(i,this.getLayoutId()),this.addChild(i)}}canDrop(t,e,i){let o,a=i-this.rect.y,s=e-this.rect.x,n=this.rect.width,r=this.rect.height,l=this.model.isEnableEdgeDockIndicators()?50:9999,d=this.getLayout();if(this.getLayoutId()===W.MAIN_LAYOUT_ID||D(t,d)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(e<this.rect.x+10&&a>r/2-l&&a<r/2+l){let t=_.LEFT,e=t.getDockRect(this.rect);e.width=e.width/2,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this.rect.getRight()-10&&a>r/2-l&&a<r/2+l){let t=_.RIGHT,e=t.getDockRect(this.rect);e.width=e.width/2,e.x+=e.width,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this.rect.y+10&&s>n/2-l&&s<n/2+l){let t=_.TOP,e=t.getDockRect(this.rect);e.height=e.height/2,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getBottom()-10&&s>n/2-l&&s<n/2+l){let t=_.BOTTOM,e=t.getDockRect(this.rect);e.height=e.height/2,e.y+=e.height,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==o&&!t.canDockInto(t,o))return}return o}}drop(e,i,o){let a,s=e.getParent();if(s&&s.removeChild(e),void 0!==s&&s instanceof C&&s.setSelected(0),void 0!==s&&s instanceof U&&s.setSelected(-1),e instanceof C||e instanceof t)(a=e)instanceof t&&a.getOrientation()===this.getOrientation()&&(i.getOrientation()===this.getOrientation()||i===_.CENTER)&&(a=new t(this.model,{})).addChild(e);else{let t=this.model.getOnCreateTabSet(),i=t?t(e):{};(a=new C(this.model,i)).addChild(e)}let n=this.children.reduce((t,e)=>t+e.getWeight(),0);0===n&&(n=100),a.setWeight(n/3);let r=!this.model.isRootOrientationVertical();if(i===_.CENTER)-1===o?this.addChild(a,this.children.length):this.addChild(a,o);else if(r&&i===_.LEFT||!r&&i===_.TOP)this.addChild(a,0);else if(r&&i===_.RIGHT||!r&&i===_.BOTTOM)this.addChild(a);else if(r&&i===_.TOP||!r&&i===_.LEFT){let e=new t(this.model,{}),i=new t(this.model,{});for(let t of(i.setWeight(75),a.setWeight(25),this.children))i.addChild(t);this.removeAll(),e.addChild(a),e.addChild(i),this.addChild(e)}else if(r&&i===_.BOTTOM||!r&&i===_.RIGHT){let e=new t(this.model,{}),i=new t(this.model,{});for(let t of(i.setWeight(75),a.setWeight(25),this.children))i.addChild(t);this.removeAll(),e.addChild(i),e.addChild(a),this.addChild(e)}a instanceof C&&this.model.setActiveTabset(a,this.getLayoutId()),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return t.attributeDefinitions}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}static getAttributeDefinitions(){return t.attributeDefinitions}normalizeWeights(){let t=0;for(let e of this.children)t+=e.getWeight();for(let e of(0===t&&(t=1),this.children))e.setWeight(Math.max(.001,100*e.getWeight()/t))}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("id",void 0).setType(f.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),e.add("weight",100).setType(f.NUMBER).setDescription("relative weight for sizing of this row in parent row"),e}},C=class t extends L{static TYPE="tabset";static fromJson(e,i,o){let a=new t(i,e);if(null!=e.children)for(let t of e.children){let e=y.fromJson(t,i);a.addChild(e)}return 0===a.children.length&&a.setSelected(-1),e.maximized&&!0===e.maximized&&o.setMaximizedTabSet(a),e.active&&!0===e.active&&o.setActiveTabSet(a),a}static attributeDefinitions=t.createAttributeDefinitions();tabStripRect=g.empty();contentRect=g.empty();calculatedMinHeight;calculatedMinWidth;calculatedMaxHeight;calculatedMaxWidth;constructor(e,i){super(e),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,t.attributeDefinitions.fromJson(i,this.attributes),e.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}getSelected(){let t=this.attributes.selected;return void 0!==t?t:-1}getSelectedNode(){let t=this.getSelected();if(-1!==t)return this.children[t]}getWeight(){return this.getAttr("weight")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}isCloseable(){let t=this.isEnableClose();return t&&(t=super.isCloseable()),t}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getLayoutId())===this}isActive(){return this.model.getActiveTabset(this.getLayoutId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableDivide(){return this.getAttr("enableDivide")}isEnableMaximize(){return this.getAttr("enableMaximize")}isEnableClose(){return this.getAttr("enableClose")}isEnableCloseButton(){return this.getAttr("enableCloseButton")}isEnableSingleTabStretch(){return this.getAttr("enableSingleTabStretch")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){let e={};return t.attributeDefinitions.toJson(e,this.attributes),e.children=this.children.map(t=>t.toJson()),this.isActive()&&(e.active=!0),this.isMaximized()&&(e.maximized=!0),e}calcMinMaxSize(){for(let t of(this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth(),this.children))this.calculatedMinWidth=Math.max(this.calculatedMinWidth,t.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,t.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,t.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,t.getMaxHeight());this.calculatedMinHeight+=this.tabStripRect.height,this.calculatedMaxHeight+=this.tabStripRect.height}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getLayoutId())===this||this.getParent()!==this.getModel().getRootRow(this.getLayoutId())||1!==this.getModel().getRootRow(this.getLayoutId()).getChildren().length)}setContentRect(t){this.contentRect=t}getContentRect(){return this.contentRect}setTabStripRect(t){this.tabStripRect=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}canDrop(t,e,i){let o,a=this.getLayout();if(t===this){let t=_.CENTER;o=new m(this,this.tabStripRect,t,-1,T.FLEXLAYOUT__OUTLINE_RECT)}else if(this.getLayoutId()!==W.MAIN_LAYOUT_ID&&!D(t,a))return;else if(this.contentRect.contains(e,i)){let t=_.CENTER;void 0===this.model.getMaximizedTabset(this.getLayoutId())&&(t=_.getLocation(this.contentRect,e,i)),o=new m(this,t.getDockRect(this.rect),t,-1,T.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(e,i)){let t,a,s;if(0===this.children.length)a=(t=this.tabStripRect.clone()).y+3,s=t.height-4,t.width=2;else{let n=this.children[0];a=(t=n.getTabRect()).y,s=t.height;let r=this.tabStripRect.x;for(let s=0;s<this.children.length;s++){(t=(n=this.children[s]).getTabRect()).y!==a&&(a=t.y,r=this.tabStripRect.x);let l=t.x+t.width/2;if(r<=e&&e<l&&t.y<i&&i<t.getBottom()){let e=_.CENTER,i=new g(t.x-2,t.y,3,t.height);if(!(this.rect.x<t.x&&t.x<this.rect.getRight()))return;o=new m(this,i,e,s,T.FLEXLAYOUT__OUTLINE_RECT);break}r=l}}if(null==o&&t.getRight()<this.rect.getRight()){let e=_.CENTER;o=new m(this,new g(t.getRight()-2,a,3,s),e,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT)}}if(t.canDockInto(t,o))return o}delete(){this.parent.removeChild(this)}remove(t){let e=this.removeChild(t);this.model.tidy(),B(this,e)}drop(e,i,o,a){if(this===e)return;let s=e.getParent(),n=0;if(void 0!==s&&(n=s.removeChild(e),s instanceof U&&s.getSelected()===n?s.setSelected(-1):B(s,n)),e instanceof y&&s===this&&n<o&&o>0&&o--,i===_.CENTER){let t=o;if(-1===t&&(t=this.children.length),e instanceof y)this.addChild(e,t),(a||!1!==a&&this.isAutoSelectTab())&&this.setSelected(t);else if(e instanceof I)e.forEachNode((e,i)=>{e instanceof y&&(this.addChild(e,t),t++)},0);else{for(let i=0;i<e.getChildren().length;i++){let o=e.getChildren()[i];this.addChild(o,t),t++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getLayoutId())}else{let o=e;if(e instanceof y){let i=this.model.getOnCreateTabSet();(o=new t(this.model,i?i(e):{})).addChild(e)}else if(e instanceof I){let t=this.getParent();if(e.getOrientation()===t.getOrientation()&&(i.getOrientation()===t.getOrientation()||i===_.CENTER)){let t=new I(this.model,{});t.addChild(e),o=t}}else o=e;let a=this.parent,s=a.getChildren().indexOf(this);if(a.getOrientation()===i.orientation)o.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),a.addChild(o,s+i.indexPlus);else{let t=new I(this.model,{});t.setWeight(this.getWeight()),t.addChild(this),this.setWeight(50),o.setWeight(50),t.addChild(o,i.indexPlus),a.removeChild(this),a.addChild(t,s)}o instanceof t&&this.model.setActiveTabset(o,this.getLayoutId())}this.model.tidy()}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}getAttributeDefinitions(){return t.attributeDefinitions}static getAttributeDefinitions(){return t.attributeDefinitions}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("id",void 0).setType(f.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),e.add("weight",100).setType(f.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),e.add("selected",0).setType(f.NUMBER).setDescription("index of selected/visible tab in tabset"),e.add("name",void 0).setType(f.STRING),e.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),e.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),e.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),e.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),e.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),e.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),e.addInherited("enableClose","tabSetEnableClose").setDescription("can this tabset be closed"),e.addInherited("enableCloseButton","tabSetEnableCloseButton").setDescription("if the tabset can be closed then show a close button"),e.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),e.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),e.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),e.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),e.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),e.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),e.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),e.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("wrap tabs onto multiple lines"),e.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),e.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),e.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(f.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),e.addInherited("enableTabScrollbar","tabSetEnableTabScrollbar").setType(f.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),e}};function B(t,e){if(void 0!==t&&(t instanceof C||t instanceof U)){let i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t.setSelected(t.getChildren().length-1):e<i?t.setSelected(i-1):e>i||t.setSelected(-1))}}function M(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}var U=class t extends L{static TYPE="border";static fromJson(e,i){let o=new t(_.getByName(e.location),e,i);return e.children&&(o.children=e.children.map(t=>{let e=y.fromJson(t,i);return e.setParent(o),e})),o}static attributeDefinitions=t.createAttributeDefinitions();contentRect=g.empty();tabHeaderRect=g.empty();location;constructor(e,i,o){super(o),this.location=e,this.attributes.id=`border_${e.getName()}`,t.attributeDefinitions.fromJson(i,this.attributes),o.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===c.HORZ}getSize(){let t=this.getAttr("size"),e=this.getSelected();if(-1===e)return t;{let i=this.children[e],o=this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight");return -1===o?t:o}}getMinSize(){let t=this.getSelectedNode(),e=this.getAttr("minSize");return t&&(e=Math.max(e,this.isHorizontal()?t.getMinWidth():t.getMinHeight())),e}getMaxSize(){let t=this.getSelectedNode(),e=this.getAttr("maxSize");return t&&(e=Math.min(e,this.isHorizontal()?t.getMaxWidth():t.getMaxHeight())),e}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}getSelectedNode(){if(-1!==this.getSelected())return this.children[this.getSelected()]}getOrientation(){return this.location.getOrientation()}getConfig(){return this.attributes.config}isMaximized(){return!1}isShowing(){return this.attributes.show}toJson(){let e={location:"bottom"};return t.attributeDefinitions.toJson(e,this.attributes),e.location=this.location.getName(),e.children=this.children.map(t=>t.toJson()),e}isAutoSelectTab(t){return(null==t&&(t=-1!==this.getSelected()),t)?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}setSelected(t){this.attributes.selected=t}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(t){this.tabHeaderRect=t}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(t){this.contentRect=t}isEnableDrop(){return this.getAttr("enableDrop")}setSize(t){let e=this.getSelected();if(-1===e)this.attributes.size=t;else{let i=this.children[e];(this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight"))===-1?this.attributes.size=t:this.isHorizontal()?i.setBorderWidth(t):i.setBorderHeight(t)}}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}remove(t){let e=this.removeChild(t);-1!==this.getSelected()&&B(this,e)}canDrop(t,e,i){let o;if(!(t instanceof y))return;let a=_.CENTER;if(this.tabHeaderRect.contains(e,i)){if(this.location.orientation===c.VERT)if(this.children.length>0){let t=this.children[0],i=t.getTabRect(),s=i.y,n=i.height,r=this.tabHeaderRect.x;for(let l=0;l<this.children.length;l++){let d=(i=(t=this.children[l]).getTabRect()).x+i.width/2;if(e>=r&&e<d){o=new m(this,new g(i.x-2,s,3,n),a,l,T.FLEXLAYOUT__OUTLINE_RECT);break}r=d}null==o&&(o=new m(this,new g(i.getRight()-2,s,3,n),a,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT))}else o=new m(this,new g(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18),a,0,T.FLEXLAYOUT__OUTLINE_RECT);else if(this.children.length>0){let t=this.children[0],e=t.getTabRect(),s=e.x,n=e.width,r=this.tabHeaderRect.y;for(let l=0;l<this.children.length;l++){let d=(e=(t=this.children[l]).getTabRect()).y+e.height/2;if(i>=r&&i<d){o=new m(this,new g(s,e.y-2,n,3),a,l,T.FLEXLAYOUT__OUTLINE_RECT);break}r=d}null==o&&(o=new m(this,new g(s,e.getBottom()-2,n,3),a,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT))}else o=new m(this,new g(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3),a,0,T.FLEXLAYOUT__OUTLINE_RECT);if(!t.canDockInto(t,o))return}else if(-1!==this.getSelected()&&this.contentRect.contains(e,i)&&(o=new m(this,this.contentRect,a,-1,T.FLEXLAYOUT__OUTLINE_RECT),!t.canDockInto(t,o)))return;return o}drop(e,i,o,a){let s=0,n=e.getParent();void 0!==n&&(s=n.removeChild(e),n!==this&&n instanceof t&&n.getSelected()===s?n.setSelected(-1):B(n,s)),e instanceof y&&n===this&&s<o&&o>0&&o--;let r=o;-1===r&&(r=this.children.length),e instanceof y&&this.addChild(e,r),(a||!1!==a&&this.isAutoSelectTab())&&this.setSelected(r),this.model.tidy()}getSplitterBounds(t,e=!1){let i=[0,0],o=e?this.getMinSize():0,a=e?this.getMaxSize():99999,s=this.model.getRootRow(W.MAIN_LAYOUT_ID),n=s.getRect(),r=this.model.getSplitterSize();if(this.location===_.TOP){i[0]=this.tabHeaderRect.getBottom()+o;let t=this.tabHeaderRect.getBottom()+a;i[1]=Math.max(i[0],n.getBottom()-s.getMinHeight()-r),i[1]=Math.min(i[1],t)}else if(this.location===_.LEFT){i[0]=this.tabHeaderRect.getRight()+o;let t=this.tabHeaderRect.getRight()+a;i[1]=Math.max(i[0],n.getRight()-s.getMinWidth()-r),i[1]=Math.min(i[1],t)}else if(this.location===_.BOTTOM){i[1]=this.tabHeaderRect.y-o-r;let t=this.tabHeaderRect.y-a-r;i[0]=Math.min(i[1],n.y+s.getMinHeight()),i[0]=Math.max(i[0],t)}else if(this.location===_.RIGHT){i[1]=this.tabHeaderRect.x-o-r;let t=this.tabHeaderRect.x-a-r;i[0]=Math.min(i[1],n.x+s.getMinWidth()),i[0]=Math.max(i[0],t)}return i}calculateSplit(t,e){let i=this.getSplitterBounds(e);return this.location===_.BOTTOM||this.location===_.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}getAttributeDefinitions(){return t.attributeDefinitions}static getAttributeDefinitions(){return t.attributeDefinitions}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("selected",-1).setType(f.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),e.add("show",!0).setType(f.BOOLEAN).setDescription("show/hide this border"),e.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),e.addInherited("enableDrop","borderEnableDrop").setType(f.BOOLEAN).setDescription("whether tabs can be dropped into this border"),e.addInherited("className","borderClassName").setType(f.STRING).setDescription("class applied to tab button"),e.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),e.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),e.addInherited("size","borderSize").setType(f.NUMBER).setDescription("size of the tab area when selected"),e.addInherited("minSize","borderMinSize").setType(f.NUMBER).setDescription("the minimum size of the tab area"),e.addInherited("maxSize","borderMaxSize").setType(f.NUMBER).setDescription("the maximum size of the tab area"),e.addInherited("enableAutoHide","borderEnableAutoHide").setType(f.BOOLEAN).setDescription("hide border if it has zero tabs"),e.addInherited("enableTabScrollbar","borderEnableTabScrollbar").setType(f.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),e}},F=class t{static fromJson(e,i){let o=new t(i);for(let t of(o.borders=e.map(t=>U.fromJson(t,i)),o.borders))o.borderMap.set(t.getLocation(),t);return o}borders;borderMap;layoutHorizontal;constructor(t){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map(t=>t.toJson())}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(t){for(let e of this.borders)for(let i of(t(e,0),e.getChildren()))i.forEachNode(t,1)}setPaths(){for(let t of this.borders){let e="/border/"+t.getLocation().getName();t.setPath(e);let i=0;for(let o of t.getChildren())o.setPath(e+"/t"+i),i++}}findDropTargetNode(t,e,i){for(let o of this.borders)if(o.isShowing()){let a=o.canDrop(t,e,i);if(void 0!==a)return a}}},P=class t{_layoutId;_type;_rect;_controller;_rootRow;_maximizedTabSet;_activeTabSet;_toExportRectFunction;constructor(t,e,i){this._layoutId=t,this._type=e,this._rect=i,this._toExportRectFunction=(t,e)=>t}visitNodes(t){this.getRootRow()?.forEachNode(t,0)}isMainLayout(){return this._layoutId===W.MAIN_LAYOUT_ID}getLayoutId(){return this._layoutId}getType(){return this._type}setType(t){this._type=t}getRect(){return this._rect}getController(){return this._controller}getWindow(){return this._controller?.getCurrentWindow()}getRootRow(){return this._rootRow}getMaximizedTabSet(){return this._maximizedTabSet}getActiveTabSet(){return this._activeTabSet}setRect(t){this._rect=t}setController(t){this._controller=t}getWindowId(){return this._controller?.getWindowId()}setRootRow(t){t?.setLayout(this),this._rootRow=t}setMaximizedTabSet(t){this._maximizedTabSet=t}setActiveTabSet(t){this._activeTabSet=t}getToExportRectFunction(){return this._toExportRectFunction}setToExportRectFunction(t){this._toExportRectFunction=t}toJson(){return"window"===this.getType()&&this.getWindow()&&this.getWindow().screenTop>-1e4&&this.setRect(new g(this.getWindow().screenLeft,this.getWindow().screenTop,this.getWindow().outerWidth,this.getWindow().outerHeight)),{type:this.getType(),layout:this.getRootRow().toJson(),rect:"tab"===this.getType()?void 0:this.getRect().toJson()}}static fromJson(e,i,o){let a=i.getLayouts().size,s=e.rect?g.fromJson(e.rect):new g(50+50*a,50+50*a,600,400);s.snap(10);let n=new t(o,e.type||"window",s);return n.setRootRow(I.fromJson(e.layout,i,n)),n}},Y=99999,W=class t{static MAIN_LAYOUT_ID="__main_layout_id__";static attributeDefinitions=t.createAttributeDefinitions();attributes;layouts;borders;changeListeners;idMap;mainLayout;splitterSize;onAllowDrop;onCreateTabSet;constructor(){this.attributes={},this.layouts=new Map,this.borders=new F(this),this.idMap=new Map,this.changeListeners=[],this.mainLayout=new P(t.MAIN_LAYOUT_ID,"window",g.empty()),this.layouts.set(t.MAIN_LAYOUT_ID,this.mainLayout),this.splitterSize=8}doAction(e){let i;switch(e.type){case p.ADD_TAB:{let t=new y(this,e.data.json,!0),o=this.idMap.get(e.data.toNode);(o instanceof C||o instanceof U||o instanceof I)&&(o.drop(t,_.getByName(e.data.location),e.data.index,e.data.select),i=t);break}case p.MOVE_NODE:{let t=this.idMap.get(e.data.fromNode);if(t instanceof y||t instanceof C||t instanceof I){t===this.getMaximizedTabset(t.getLayoutId())&&this.layouts.get(t.getLayoutId()).setMaximizedTabSet(void 0);let i=this.idMap.get(e.data.toNode);(i instanceof C||i instanceof U||i instanceof I)&&i.drop(t,_.getByName(e.data.location),e.data.index,e.data.select)}break}case p.DELETE_TAB:{let t=this.idMap.get(e.data.node);t instanceof y&&t.delete();break}case p.DELETE_TABSET:{let t=this.idMap.get(e.data.node);if(t instanceof C){let e=[...t.getChildren()];for(let t=0;t<e.length;t++){let i=e[t];i.isEnableClose()&&i.delete()}0===t.getChildren().length&&t.delete(),this.tidy()}break}case p.POPOUT_TABSET:{let t=this.idMap.get(e.data.node);if(t instanceof C){let i=t.isMaximized(),o=t.getLayout(),a=M(),s=e.data.type||"window",n=new P(a,s,o.getToExportRectFunction()(t.getRect(),s)),r=I.fromJson({type:"row"},this,n);n.setRootRow(r),this.layouts.set(a,n),r.drop(t,_.CENTER,0),i&&this.mainLayout.setMaximizedTabSet(void 0)}break}case p.POPOUT_TAB:{let t=this.idMap.get(e.data.node);if(t instanceof y){let i=M(),o=t.getParent().getContentRect(),a=t.getLayout(),s=e.data.type||"window",n=new P(i,s,a.getToExportRectFunction()(o,s)),r=M(),l=I.fromJson({type:"row",children:[{type:"tabset",id:r}]},this,n);n.setRootRow(l),this.layouts.set(i,n),this.idMap.get(r).drop(t,_.CENTER,0,!0)}break}case p.SELECT_TAB:{let t=this.idMap.get(e.data.tabNode);if(t instanceof y){let e=t.getParent(),i=e.getChildren().indexOf(t);e instanceof U?e.getSelected()===i?e.setSelected(-1):e.setSelected(i):e instanceof C&&(e.getSelected()!==i&&e.setSelected(i),t.getLayout().setActiveTabSet(e))}break}case p.SET_ACTIVE_TABSET:{let i=e.data.layoutId?e.data.layoutId:t.MAIN_LAYOUT_ID,o=this.layouts.get(i);if(void 0===e.data.tabsetNode)o.setActiveTabSet(void 0);else{let t=this.idMap.get(e.data.tabsetNode);t instanceof C&&o.setActiveTabSet(t)}break}case p.ADJUST_WEIGHTS:{let t=this.idMap.get(e.data.nodeId).getChildren();for(let i=0;i<t.length;i++)t[i].setWeight(e.data.weights[i]);break}case p.ADJUST_BORDER_SPLIT:{let t=this.idMap.get(e.data.node);t instanceof U&&t.setSize(e.data.size);break}case p.MAXIMIZE_TOGGLE:{let i=e.data.layoutId?e.data.layoutId:t.MAIN_LAYOUT_ID,o=this.layouts.get(i),a=this.idMap.get(e.data.node);a instanceof C&&(a===o.getMaximizedTabSet()?o.setMaximizedTabSet(void 0):(o.setMaximizedTabSet(a),o.setActiveTabSet(a)));break}case p.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(e.data.json);break;case p.UPDATE_NODE_ATTRIBUTES:this.idMap.get(e.data.node).updateAttrs(e.data.json);break;case p.RENAME_TAB:{let t=this.idMap.get(e.data.node);t instanceof y&&t.setName(e.data.text);break}case p.CREATE_SUBLAYOUT:{let t=M(),o=new P(t,e.data.type||"window",g.fromJson(e.data.rect)),a=I.fromJson(e.data.layout,this,o);o.setRootRow(a),this.layouts.set(t,o),i=t;break}case p.CLOSE_POPOUT:{let t=this.layouts.get(e.data.layoutId);if(t){t.setType("float");let e=this.mainLayout.getController().getDomRect();t.setRect(new g(e.width/4,e.height/4,e.width/2,e.height/2))}break}case p.MOVE_POPOUT_TO_FRONT:{let t=e.data.layoutId,i=this.layouts.get(t);i&&(this.layouts.delete(t),this.layouts.set(t,i))}}for(let t of(this.updateIdMap(),this.changeListeners))t(e);return i}getActiveTabset(e=t.MAIN_LAYOUT_ID){let i=this.layouts.get(e);return i&&i.getActiveTabSet()&&this.getNodeById(i.getActiveTabSet().getId())?i.getActiveTabSet():void 0}getMaximizedTabset(e=t.MAIN_LAYOUT_ID){return this.layouts.get(e).getMaximizedTabSet()}getRootRow(e=t.MAIN_LAYOUT_ID){return this.layouts.get(e).getRootRow()}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}visitNodes(t){for(let[e,i]of(this.borders.forEachNode(t),this.layouts))i.getRootRow().forEachNode(t,0)}visitLayoutNodes(e,i){this.layouts.has(e)&&(e===t.MAIN_LAYOUT_ID&&this.borders.forEachNode(i),this.layouts.get(e).visitNodes(i))}getNodeById(t){return this.idMap.get(t)}getFirstTabSet(e=this.layouts.get(t.MAIN_LAYOUT_ID).getRootRow()){let i=e.getChildren()[0];return i instanceof C?i:this.getFirstTabSet(i)}static fromJson(e){let i=new t;t.attributeDefinitions.fromJson(e.global,i.attributes),e.borders&&(i.borders=F.fromJson(e.borders,i));let o=e.subLayouts||e.popouts;if(o)for(let t in o){let e=o[t],a=P.fromJson(e,i,t);i.layouts.set(t,a)}return i.mainLayout.setRootRow(I.fromJson(e.layout,i,i.mainLayout)),i.tidy(),i}toJson(){let e={};t.attributeDefinitions.toJson(e,this.attributes),this.visitNodes(t=>{t.fireEvent("save",{})});let i={};for(let[e,o]of this.layouts)e!==t.MAIN_LAYOUT_ID&&(i[e]=o.toJson());return{global:e,borders:this.borders.toJson(),layout:this.mainLayout.getRootRow().toJson(),subLayouts:i}}getSplitterSize(){return this.splitterSize}setSplitterSize(t){this.splitterSize=t}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isEnableEdgeDockIndicators(){return this.attributes.enableEdgeDockIndicators}setOnAllowDrop(t){this.onAllowDrop=t}setOnCreateTabSet(t){this.onCreateTabSet=t}addChangeListener(t){this.changeListeners.push(t)}removeChangeListener(t){let e=this.changeListeners.findIndex(e=>e===t);-1!==e&&this.changeListeners.splice(e,1)}toString(){return JSON.stringify(this.toJson())}getMainLayout(){return this.mainLayout}getLayouts(){return this.layouts}sortLayouts(){let t={window:1,tab:2,float:3},e=Array.from(this.getLayouts().values()).sort((e,i)=>t[e.getType()]-t[i.getType()]);this.layouts.clear(),e.forEach(t=>this.layouts.set(t.getLayoutId(),t))}setActiveTabset(t,e){let i=this.layouts.get(e);i&&(t?i.setActiveTabSet(t):i.setActiveTabSet(void 0))}setMaximizedTabset(t,e){let i=this.layouts.get(e);i&&(t?i.setMaximizedTabSet(t):i.setMaximizedTabSet(void 0))}updateIdMap(){this.idMap.clear(),this.visitNodes(t=>{this.idMap.set(t.getId(),t)})}addNode(t){let e=t.getId();if(this.idMap.has(e))throw Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);this.idMap.set(e,t)}findDropTargetNode(e,i,o,a){let s=this.layouts.get(e).getRootRow().findDropTargetNode(e,i,o,a);return void 0===s&&e===t.MAIN_LAYOUT_ID&&(s=this.borders.findDropTargetNode(i,o,a)),s}tidy(){for(let[t,e]of this.layouts)e.getRootRow().tidy()}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}nextUniqueId(){return"#"+M()}getAttribute(t){return this.attributes[t]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){t.attributeDefinitions.pairAttributes("RowNode",I.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("TabSetNode",C.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("TabNode",y.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("BorderNode",U.getAttributeDefinitions());let e=[];e.push(t.attributeDefinitions.toTypescriptInterface("Global",void 0)),e.push(I.getAttributeDefinitions().toTypescriptInterface("Row",t.attributeDefinitions)),e.push(C.getAttributeDefinitions().toTypescriptInterface("TabSet",t.attributeDefinitions)),e.push(y.getAttributeDefinitions().toTypescriptInterface("Tab",t.attributeDefinitions)),e.push(U.getAttributeDefinitions().toTypescriptInterface("Border",t.attributeDefinitions)),console.log(e.join("\n"))}static createAttributeDefinitions(){let t=new E;return t.add("enableEdgeDock",!0).setType(f.BOOLEAN).setDescription("enable docking to the edges of the layout"),t.add("enableEdgeDockIndicators",!0).setType(f.BOOLEAN).setDescription("show the edge indicators when dragging"),t.add("rootOrientationVertical",!1).setType(f.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),t.add("enableRotateBorderIcons",!0).setType(f.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),t.add("tabEnableClose",!0).setType(f.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnablePopout",!1).setType(f.BOOLEAN).setAlias("tabEnableFloat"),t.add("tabEnablePopoutIcon",!0).setType(f.BOOLEAN),t.add("tabEnablePopoutFloatIcon",!1).setType(f.BOOLEAN),t.add("tabEnablePopoutOverlay",!1).setType(f.BOOLEAN),t.add("tabEnableDrag",!0).setType(f.BOOLEAN),t.add("tabEnableRename",!0).setType(f.BOOLEAN),t.add("tabContentClassName",void 0).setType(f.STRING),t.add("tabClassName",void 0).setType(f.STRING),t.add("tabIcon",void 0).setType(f.STRING),t.add("tabEnableRenderOnDemand",!0).setType(f.BOOLEAN),t.add("tabBorderWidth",-1).setType(f.NUMBER),t.add("tabBorderHeight",-1).setType(f.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(f.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(f.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(f.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(f.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(f.BOOLEAN),t.add("tabSetEnableClose",!0).setType(f.BOOLEAN),t.add("tabSetEnableCloseButton",!1).setType(f.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(f.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(f.BOOLEAN),t.add("tabSetEnableActiveIcon",!1).setType(f.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(f.STRING),t.add("tabSetEnableTabStrip",!0).setType(f.BOOLEAN),t.add("tabSetEnableTabWrap",!1).setType(f.BOOLEAN),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabMinWidth",1).setType(f.NUMBER),t.add("tabMinHeight",1).setType(f.NUMBER),t.add("tabSetMinWidth",1).setType(f.NUMBER),t.add("tabSetMinHeight",1).setType(f.NUMBER),t.add("tabMaxWidth",Y).setType(f.NUMBER),t.add("tabMaxHeight",Y).setType(f.NUMBER),t.add("tabSetMaxWidth",Y).setType(f.NUMBER),t.add("tabSetMaxHeight",Y).setType(f.NUMBER),t.add("tabSetEnableTabScrollbar",!1).setType(f.BOOLEAN),t.add("borderSize",200).setType(f.NUMBER),t.add("borderMinSize",1).setType(f.NUMBER),t.add("borderMaxSize",Y).setType(f.NUMBER),t.add("borderEnableDrop",!0).setType(f.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(f.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(f.BOOLEAN),t.add("borderClassName",void 0).setType(f.STRING),t.add("borderEnableAutoHide",!1).setType(f.BOOLEAN),t.add("borderEnableTabScrollbar",!1).setType(f.BOOLEAN),t}},X={width:"1em",height:"1em",display:"flex",alignItems:"center"},j=()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]}),H=t=>{let{controller:e,show:i}=t;return(0,n.jsx)("div",{className:e.getClassName(T.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:i?"flex":"none"}})},z=((i={}).Close_Tab="Close",i.Close_Tabset="Close tab set",i.Active_Tabset="Active tab set",i.Move_Tabset="Move tab set",i.Move_Tabs="Move tabs(?)",i.Maximize="Maximize tab set",i.Restore="Restore tab set",i.Popout_Tab="Popout selected tab",i.Popout_Tab_Float="Float selected tab",i.Overflow_Menu_Tooltip="Hidden tabs",i.Error_rendering_component="Error rendering component",i.Error_rendering_component_retry="Retry",i),k=t=>{let{controller:e,tabNode:i}=t,o=e.getClassName,a=o(T.FLEXLAYOUT__TAB_BUTTON_STAMP),s=R(e,i),r=s.content?(0,n.jsx)("div",{className:o(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:s.content}):i.getNameForOverflowMenu(),l=s.leading?(0,n.jsx)("div",{className:o(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:s.leading}):null;return(0,n.jsxs)("div",{className:a,title:i.getHelpText(),children:[l,r]})};function G(t,e,i,o,a){let s=a.getRootDiv(),r=a.getClassName,l=t.ownerDocument,d=t.getBoundingClientRect(),h=s?.getBoundingClientRect()??new DOMRect(0,0,100,100),u=l.createElement("div");u.className=r(T.FLEXLAYOUT__POPUP_MENU_CONTAINER),d.left<h.left+h.width/2?u.style.left=d.left-h.left+"px":u.style.right=h.right-d.right+"px",d.top<h.top+h.height/2?u.style.top=d.top-h.top+"px":u.style.bottom=h.bottom-d.bottom+"px",a.showOverlayOnAllWindows(!0),s&&s.appendChild(u);let c=()=>{a.hideControlInPortal(),a.showOverlayOnAllWindows(!1),s&&s.removeChild(u),u.removeEventListener("pointerdown",g),l.removeEventListener("pointerdown",_)},g=t=>{t.stopPropagation()},_=t=>{c()};u.addEventListener("pointerdown",g),l.addEventListener("pointerdown",_),a.showControlInPortal((0,n.jsx)(V,{currentDocument:l,parentNode:e,onSelect:o,onHide:c,items:i,classNameMapper:r,controller:a}),u)}var V=t=>{let{parentNode:e,items:i,onHide:o,onSelect:a,classNameMapper:s,controller:r}=t,l=(0,d.useRef)(null);(0,d.useEffect)(()=>{l.current&&l.current.focus()},[]);let h=t=>{r.getDragDropManager().clearDragMain()},u=i.map((t,i)=>{let l=s(T.FLEXLAYOUT__POPUP_MENU_ITEM);return e.getSelected()===t.index&&(l+=" "+s(T.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED)),(0,n.jsx)("div",{className:l,"data-layout-path":"/popup-menu/tb"+i,onClick:e=>{a(t),o(),e.stopPropagation()},draggable:!0,onDragStart:e=>{var i;return i=t.node,void(e.stopPropagation(),r.getDragDropManager().setDragNode(e.nativeEvent,i),setTimeout(()=>{o()},0))},onDragEnd:h,title:t.node.getHelpText(),children:(0,n.jsx)(k,{tabNode:t.node,controller:r})},t.index)});return(0,n.jsx)("div",{className:s(T.FLEXLAYOUT__POPUP_MENU),ref:l,tabIndex:0,onKeyDown:t=>{"Escape"===t.key&&o()},"data-layout-path":"/popup-menu",children:u})},J=((o={})[o.Visible=1]="Visible",o[o.Always=2]="Always",o[o.Selected=3]="Selected",o),Z=t=>{let{controller:e,tabNode:i,selected:o,path:a}=t,s=d.useRef(null),r=d.useRef(null),l=e.getIcons();d.useLayoutEffect(()=>{i.setTabRect(e.getBoundingClientRect(s.current)),e.getEditingTab()===i&&r.current.select()});let h=t=>{t.target!==r.current&&(e.getCurrentDocument().body.removeEventListener("pointerdown",h),e.setEditingTab(void 0))},u=e.getClassName,c=i.getParent(),g=c.isEnableSingleTabStretch()&&1===c.getChildren().length,_=g?T.FLEXLAYOUT__TAB_BUTTON_STRETCH:T.FLEXLAYOUT__TAB_BUTTON,b=u(_);b+=" "+u(_+"_"+c.getTabLocation()),g||(o?b+=" "+u(_+"--selected"):b+=" "+u(_+"--unselected")),void 0!==i.getClassName()&&(b+=" "+i.getClassName());let E=R(e,i),f=E.content?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:E.content}):null,m=E.leading?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:E.leading}):null;if(e.getEditingTab()===i&&(f=(0,n.jsx)("input",{ref:r,className:u(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":a+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):("Enter"===t.code||"NumpadEnter"===t.code)&&(e.setEditingTab(void 0),e.doAction(p.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isCloseable()&&!g){let t=e.i18nName(z.Close_Tab);E.buttons.push((0,n.jsx)("div",{"data-layout-path":a+"/button/close",title:t,className:u(T.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:t=>{t.stopPropagation()},onClick:t=>{let a;a=i.getCloseType(),(o||a===J.Always||a===J.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(e.doAction(p.deleteTab(i.getId())),t.stopPropagation())},children:"function"==typeof l.close?l.close(i):l.close},"close"))}return(0,n.jsxs)("div",{ref:s,"data-layout-path":a,className:b,onClick:()=>{e.doAction(p.selectTab(i.getId()))},onAuxClick:t=>{O(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.getDragDropManager().setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{e.getDragDropManager().clearDragMain()},onDoubleClick:t=>{i.isEnableRename()&&(e.setEditingTab(i),e.getCurrentDocument().body.addEventListener("pointerdown",h),t.stopPropagation())},children:[m,f,E.buttons]})},$=(t,e,i,o,a,s)=>{let[n,r]=d.useState([]),[l,h]=d.useState(!1),[u,g]=d.useState(!1),_=d.useRef(null),T=d.useRef(!1),p=d.useRef(void 0),b=d.useRef([]),E=d.useRef(0),f=d.useRef(!1);b.current=n,d.useLayoutEffect(()=>{o.current&&B(0)},[e.getId()]),d.useLayoutEffect(()=>{T.current=!1},[e.getSelectedNode(),e.getRect().width,e.getRect().height]),d.useLayoutEffect(()=>{v(),!1===T.current&&function(){let i=e.getSelectedNode();if(i&&o.current){let e=t.getBoundingClientRect(o.current),a=i.getTabRect(),s=w(e)-w(a);s>0||I(a)>I(e)?(B(M(o.current)-s),f.current=!0):(s=D(a)-D(e))>0&&(B(M(o.current)+s),f.current=!0)}}(),L(),y()}),d.useEffect(()=>(_.current?.addEventListener("wheel",m,{passive:!1}),()=>{_.current?.removeEventListener("wheel",m)}),[_.current]);let m=t=>{t.preventDefault()},L=()=>{if(o.current&&a.current){let t=o.current,e=a.current,s=S(t),n=C(t),r=M(t);if(n>s&&n>0){let t=s*s/n,o=0;t<20&&(o=20-t,t=20);let a=r*(s-o)/n;i===c.HORZ?(e.style.width=t+"px",e.style.left=a+"px"):(e.style.height=t+"px",e.style.top=a+"px"),e.style.display="block"}else e.style.display="none";i===c.HORZ?e.style.bottom="0px":e.style.right="0px"}},y=()=>{let t=x().length>0;t!==l&&h(t),void 0===p.current&&(p.current=setTimeout(()=>{var t,e;let i=x();t=i,e=b.current,t.length===e.length&&t.every((t,i)=>t===e[i])||r(i),p.current=void 0},100))},A=(t,e)=>{if(o.current&&a.current){let s,n=o.current,r=a.current,l=S(n),d=C(n),h=S(r),u=n.getBoundingClientRect();s=Math.max(0,Math.min(d-h,s=i===c.HORZ?t-u.x-E.current:e-u.y-E.current)),l>0&&B(s*d/l)}},R=()=>{},O=()=>{},v=()=>{if(o.current){let t=S(o.current.firstElementChild)+10*!!u>S(o.current);t!==u&&g(t)}},x=()=>{let t=[];if(o.current){let e=o.current,i=e.getBoundingClientRect(),a=w(i)-1,n=D(i)+1,r=e.firstElementChild,l=0;Array.from(r.children).forEach(e=>{let i=e.getBoundingClientRect();e.classList.contains(s)&&((w(i)<a||D(i)>n)&&t.push(l),l++)})}return t},w=t=>i===c.HORZ?t.x:t.y,D=t=>i===c.HORZ?t.right:t.bottom,S=t=>i===c.HORZ?t.clientWidth:t.clientHeight,I=t=>i===c.HORZ?t.width:t.height,C=t=>i===c.HORZ?t.scrollWidth:t.scrollHeight,B=t=>{i===c.HORZ?o.current.scrollLeft=t:o.current.scrollTop=t},M=t=>i===c.HORZ?t.scrollLeft:t.scrollTop;return{selfRef:_,userControlledPositionRef:T,onScroll:()=>{f.current||(T.current=!0),f.current=!1,L(),y()},onScrollPointerDown:t=>{t.stopPropagation(),a.current.setPointerCapture(t.pointerId);let e=a.current.getBoundingClientRect();i===c.HORZ?E.current=t.clientX-e.x:E.current=t.clientY-e.y,N(t.currentTarget.ownerDocument,t,A,R,O)},hiddenTabs:n,onMouseWheel:t=>{if(o.current){let i;if(0!==e.getChildren().length&&Math.abs(t.deltaY)>0){i=-t.deltaY,1===t.deltaMode&&(i*=40);let e=M(o.current)-i;B(Math.max(0,Math.min(C(o.current)-S(o.current),e))),t.stopPropagation()}}},isDockStickyButtons:u,isShowHiddenTabs:l}},q=t=>{let{tabsetNode:e,controller:i}=t,o=d.useRef(null),a=d.useRef(null),s=d.useRef(null),r=d.useRef(null),l=d.useRef(null),u=d.useRef(null),g=d.useRef(null),_=i.getIcons();d.useLayoutEffect(()=>{e.setRect(i.getBoundingClientRect(b.current)),o.current&&e.setTabStripRect(i.getBoundingClientRect(o.current));let t=i.getBoundingClientRect(r.current);e.getContentRect().equalsWhenRounded(t)||isNaN(t.x)||(e.setContentRect(t),i.setReLayout(!0))});let{selfRef:b,userControlledPositionRef:E,onScroll:f,onScrollPointerDown:m,hiddenTabs:L,onMouseWheel:y,isDockStickyButtons:A,isShowHiddenTabs:R}=$(i,e,c.HORZ,s,a,i.getClassName(T.FLEXLAYOUT__TAB_BUTTON)),v=t=>{let o=i.getShowOverflowMenu(),a=L.map(t=>({index:t,node:e.getChildren()[t]}));void 0!==o?o(e,t,a,x):G(u.current,e,a,x,i),t.stopPropagation()},x=t=>{i.doAction(p.selectTab(t.node.getId())),E.current=!1},w=t=>{i.getEditingTab()?t.preventDefault():e.isEnableDrag()?(t.stopPropagation(),i.getDragDropManager().setDragNode(t.nativeEvent,e)):t.preventDefault()},N=t=>{O(t)||i.doAction(p.setActiveTabset(e.getId(),i.getLayoutId()))},D=t=>{O(t)&&i.auxMouseClick(e,t)},S=t=>{i.showContextMenu(e,t)},I=t=>{t.stopPropagation()},C=t=>{e.canMaximize()&&i.maximize(e),t.stopPropagation()},B=t=>{i.doAction(p.deleteTabset(e.getId())),t.stopPropagation()},M=t=>{i.doAction(p.deleteTab(e.getChildren()[0].getId())),t.stopPropagation()},U=t=>{void 0!==W&&i.doAction(p.popoutTab(W.getId(),"window")),t.stopPropagation()},F=t=>{void 0!==W&&i.doAction(p.popoutTab(W.getId(),"float")),t.stopPropagation()},P=t=>{e.canMaximize()&&i.maximize(e)},Y=i.getClassName,W=e.getSelectedNode(),X=e.getPath(),j=(()=>{let t=[],o=!1;if(e.isEnableTabStrip()){let a=e.isEnableSingleTabStretch()&&1===e.getChildren().length;for(let s=0;s<e.getChildren().length;s++){let r=e.getChildren()[s],l=e.getSelected()===s,d=Y(T.FLEXLAYOUT__TABSET_TAB_SPACER);0!==s&&(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER)),e.isEnableTabWrap()||a||(l?d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):o&&(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),t.push((0,n.jsx)("div",{className:d,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+s)),t.push((0,n.jsx)(Z,{controller:i,tabNode:r,path:X+"/tb"+s,selected:l},r.getId())),s===e.getChildren().length-1&&(d=Y(T.FLEXLAYOUT__TABSET_TAB_SPACER),e.isEnableTabWrap()||a||!l||(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),t.push((0,n.jsx)("div",{className:d,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+(s+1)))),o=l}}return t})(),{leading:H,buttonbar:k}=(t=>{let o,a=[],s=[],r={leading:o,stickyButtons:a,buttons:s,overflowPosition:void 0};i.customizeTabSet(e,r),o=r.leading,a=r.stickyButtons,s=r.buttons;let d=e.isEnableSingleTabStretch()&&1===e.getChildren().length,h=d&&e.getChildren()[0].isCloseable()||e.isCloseable();if(h=h&&e.isEnableCloseButton(),void 0===r.overflowPosition&&(r.overflowPosition=a.length),a.length>0&&(!e.isEnableTabWrap()&&(A||d)?s=[...a,...s]:t.push((0,n.jsx)("div",{ref:g,onPointerDown:I,onDragStart:t=>{t.preventDefault()},className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:a},"sticky_buttons_container"))),!e.isEnableTabWrap()&&R){let t,o=i.i18nName(z.Overflow_Menu_Tooltip);if("function"==typeof _.more){let i=L.map(t=>({index:t,node:e.getChildren()[t]}));t=_.more(e,i)}else t=(0,n.jsxs)(n.Fragment,{children:[_.more,(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:L.length>0?L.length:""})]});s.splice(Math.min(r.overflowPosition,s.length),0,(0,n.jsx)("button",{"data-layout-path":X+"/button/overflow",ref:u,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:o,onClick:v,onPointerDown:I,children:t},"overflowbutton"))}if(void 0!==W){if(W.isEnablePopoutFloatIcon()){let t=i.i18nName(z.Popout_Tab_Float);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/popout-float",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:F,onPointerDown:I,children:"function"==typeof _.popoutFloat?_.popoutFloat(W):_.popoutFloat},"popout-float"))}if(i.isSupportsPopout()&&W.isAllowedInWindow()&&W.isEnablePopout()){let t=i.i18nName(z.Popout_Tab);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/popout",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:U,onPointerDown:I,children:"function"==typeof _.popout?_.popout(W):_.popout},"popout"))}}if(e.canMaximize()){let t=i.i18nName(z.Restore),o=i.i18nName(z.Maximize);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/max",title:e.isMaximized()?t:o,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(e.isMaximized()?"max":"min")),onClick:C,onPointerDown:I,children:e.isMaximized()?"function"==typeof _.restore?_.restore(e):_.restore:"function"==typeof _.maximize?_.maximize(e):_.maximize},"max"))}if(!e.isMaximized()&&h){let t=d?i.i18nName(z.Close_Tab):i.i18nName(z.Close_Tabset);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/close",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:d?M:B,onPointerDown:I,children:"function"==typeof _.closeTabset?_.closeTabset(e):_.closeTabset},"close"))}if(e.isActive()&&e.isEnableActiveIcon()){let t=i.i18nName(z.Active_Tabset);s.push((0,n.jsx)("div",{"data-layout-path":X+"/button/active",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:"function"==typeof _.activeTabset?_.activeTabset(e):_.activeTabset},"active"))}return{leading:o,buttonbar:(0,n.jsx)("div",{ref:l,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:I,onDragStart:t=>{t.preventDefault()},children:s},"buttonbar")}})(j),V=(t=>{let o;if(0===e.getChildren().length){let t=i.getTabSetPlaceHolderCallback();t&&(o=t(e))}let a=(0,n.jsx)("div",{ref:r,className:Y(T.FLEXLAYOUT__TABSET_CONTENT),children:o});return"top"===e.getTabLocation()?(0,n.jsxs)(n.Fragment,{children:[t,a]}):(0,n.jsxs)(n.Fragment,{children:[a,t]})})(((t,i,r)=>{let l,d,h=Y(T.FLEXLAYOUT__TABSET_TABBAR_OUTER);void 0!==e.getClassNameTabStrip()&&(h+=" "+e.getClassNameTabStrip()),h+=" "+T.FLEXLAYOUT__TABSET_TABBAR_OUTER_+e.getTabLocation(),e.isActive()&&(h+=" "+Y(T.FLEXLAYOUT__TABSET_SELECTED)),e.isMaximized()&&(h+=" "+Y(T.FLEXLAYOUT__TABSET_MAXIMIZED));let u=e.isEnableSingleTabStretch()&&1===e.getChildren().length;if(u){let t=e.getChildren()[0];void 0!==t.getTabSetClassName()&&(h+=" "+t.getTabSetClassName())}if(i&&(l=(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_LEADING),children:i})),e.isEnableTabWrap())e.isEnableTabStrip()&&(d=(0,n.jsxs)("div",{className:h,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:o,"data-layout-path":X+"/tabstrip",onPointerDown:N,onDoubleClick:P,onContextMenu:S,onClick:D,onAuxClick:D,draggable:!0,onDragStart:w,children:[l,t,(0,n.jsx)("div",{style:{flexGrow:1}}),r]}));else if(e.isEnableTabStrip()){let i;e.isEnableTabScrollbar()&&(i=(0,n.jsx)("div",{ref:a,className:Y(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:m})),d=(0,n.jsxs)("div",{className:h,ref:o,"data-layout-path":X+"/tabstrip",onPointerDown:N,onDoubleClick:P,onContextMenu:S,onClick:D,onAuxClick:D,draggable:!0,onWheel:y,onDragStart:w,children:[l,(0,n.jsxs)("div",{className:Y(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,n.jsx)("div",{ref:s,className:Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_+e.getTabLocation()),style:{overflowX:"auto",overflowY:"hidden"},onScroll:f,children:(0,n.jsx)("div",{style:{width:u?"100%":"none"},className:Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+e.getTabLocation()),children:t})}),i]}),r]})}return d})(j,H,k)),J={flexGrow:Math.max(1,1e3*e.getWeight()),minWidth:e.getMinWidth(),minHeight:e.getMinHeight(),maxWidth:e.getMaxWidth(),maxHeight:e.getMaxHeight()};void 0===e.getModel().getMaximizedTabset(i.getLayoutId())||e.isMaximized()||(J.display="none");let q=(0,n.jsx)("div",{ref:b,className:Y(T.FLEXLAYOUT__TABSET_CONTAINER),style:J,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET),"data-layout-path":X,children:V})});return e.isMaximized()&&i.getMainElement()?(0,h.createPortal)((0,n.jsx)("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0},children:q}),i.getMainElement()):q},K=t=>{let{controller:e,node:i,index:o,horizontal:a}=t,s=d.useRef(null),r=d.useRef(null),l=d.useRef([]),h=d.useRef(void 0),u=d.useRef(void 0),_=d.useRef(0),b=d.useRef(0),E=d.useRef({initialSizes:[],sum:0,startPosition:0});d.useEffect(()=>(s.current?.addEventListener("touchstart",f,{passive:!1}),r.current?.addEventListener("touchstart",f,{passive:!1}),()=>{s.current?.removeEventListener("touchstart",f),r.current?.removeEventListener("touchstart",f)}),[]);let f=t=>{t.preventDefault(),t.stopImmediatePropagation()},m=()=>{let t=e.getRootDiv();t&&h.current&&t.removeChild(h.current),h.current=void 0},L=(t,o)=>{if(h.current){let a=e.getDomRect();a&&(i.getOrientation()===c.VERT?h.current.style.top=O(o-a.y-b.current)+"px":h.current.style.left=O(t-a.x-_.current)+"px",e.isRealtimeResize()&&R(!0))}},y=()=>{if(h.current){R(!1);let t=e.getRootDiv();t&&h.current&&t.removeChild(h.current),h.current=void 0}v(!0,e.getCurrentDocument())},R=t=>{if(h.current){let t;if(t=i.getOrientation()===c.VERT?h.current.offsetTop:h.current.offsetLeft,i instanceof U){let o=i.calculateSplit(i,t);e.doAction(p.adjustBorderSplit(i.getId(),o))}else{let a=E.current,s=i.calculateSplit(o,t,a.initialSizes,a.sum,a.startPosition);e.doAction(p.adjustWeights(i.getId(),s))}}},O=t=>{let e=l.current,i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},x=e.getClassName,w={cursor:a?"ew-resize":"ns-resize",flexDirection:a?"column":"row"},D=x(T.FLEXLAYOUT__SPLITTER)+" "+x(T.FLEXLAYOUT__SPLITTER_+i.getOrientation().getName());return i instanceof U?D+=" "+x(T.FLEXLAYOUT__SPLITTER_BORDER):void 0!==i.getModel().getMaximizedTabset(e.getLayoutId())&&(w.display="none"),A()||(w["--splitter-active-size"]="30px"),(0,n.jsx)("div",{className:D,style:w,ref:s,"data-layout-path":i.getPath()+"/s"+(o-1),onPointerDown:t=>{t.stopPropagation(),i instanceof I&&(E.current=i.getSplitterInitials(o)),v(!1,e.getCurrentDocument()),N(t.currentTarget.ownerDocument,t,L,y,m),l.current=i.getSplitterBounds(o,!0);let n=e.getRootDiv();h.current=e.getCurrentDocument().createElement("div"),h.current.style.flexDirection=a?"row":"column",h.current.className=e.getClassName(T.FLEXLAYOUT__SPLITTER_DRAG)+(i instanceof U?" "+e.getClassName(T.FLEXLAYOUT__SPLITTER_BORDER):""),h.current.style.cursor=i.getOrientation()===c.VERT?"ns-resize":"ew-resize",u.current=e.getCurrentDocument().createElement("div"),u.current.className=x(T.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(a?x(T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):x(T.FLEXLAYOUT__SPLITTER_HANDLE_VERT)),h.current.appendChild(u.current);let r=s.current.getBoundingClientRect(),d=new g(r.x-e.getDomRect().x,r.y-e.getDomRect().y,r.width,r.height);_.current=t.clientX-r.x,b.current=t.clientY-r.y,d.positionElement(h.current),n&&n.appendChild(h.current)},children:(0,n.jsx)("div",{className:x(T.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(a?x(T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):x(T.FLEXLAYOUT__SPLITTER_HANDLE_VERT))})})},Q=t=>{let{controller:e,rowNode:i}=t,o=d.useRef(null),a=i.getOrientation()===c.HORZ;d.useLayoutEffect(()=>{i.setRect(e.getBoundingClientRect(o.current))});let s=[],r=0;for(let t of i.getChildren())r>0&&s.push((0,n.jsx)(K,{controller:e,node:i,index:r,horizontal:a},"splitter"+r)),t instanceof I?s.push((0,n.jsx)(Q,{controller:e,rowNode:t},t.getId())):t instanceof C&&s.push((0,n.jsx)(q,{controller:e,tabsetNode:t},t.getId())),r++;let l={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};return a?l.flexDirection="row":l.flexDirection="column",(0,n.jsx)("div",{ref:o,className:e.getClassName(T.FLEXLAYOUT__ROW),style:l,children:s})},tt=t=>{let{controller:e,selected:i,tabNode:o}=t,a=d.useRef(null),s=d.useRef(!0),r=o.getParent(),l=r.getContentRect();d.useLayoutEffect(()=>{let t=()=>{o.saveScrollPosition()},i=o.getMoveableElement();return i&&(a.current.appendChild(i),i.addEventListener("scroll",t)),a.current.addEventListener("pointerdown",h),()=>{a.current&&a.current.removeEventListener("pointerdown",h),i&&(o.isEnableWindowReMount()||e.getMainController()?.getMoveablesDiv()?.appendChild(i),i.removeEventListener("scroll",t)),o.setVisible(!1)}},[o.getMoveableElement()]),d.useEffect(()=>{o.isSelected()&&s.current&&(o.restoreScrollPosition(),s.current=!1)});let h=()=>{let t=o.getParent();t instanceof C&&!t.isActive()&&e.doAction(p.setActiveTabset(t.getId(),e.getLayoutId()))};o.setRect(l);let u=e.getClassName,c={};l.styleWithPosition(c);let g=null;if(i){if(o.setVisible(!0),document.hidden&&o.isEnablePopoutOverlay()){let t={};l.styleWithPosition(t),g=(0,n.jsx)("div",{style:t,className:u(T.FLEXLAYOUT__TAB_OVERLAY)})}}else c.display="none",o.setVisible(!1);r instanceof C&&void 0!==o.getModel().getMaximizedTabset(e.getLayoutId())&&!r.isMaximized()&&(c.display="none"),r instanceof U&&!r.isShowing()&&(c.display="none");let _=u(T.FLEXLAYOUT__TAB);return r instanceof U&&(_+=" "+u(T.FLEXLAYOUT__TAB_BORDER),_+=" "+u(T.FLEXLAYOUT__TAB_BORDER_+r.getLocation().getName())),void 0!==o.getContentClassName()&&(_+=" "+o.getContentClassName()),(0,n.jsxs)(n.Fragment,{children:[g,(0,n.jsx)("div",{ref:a,style:c,className:_,"data-layout-path":o.getPath()})]})},te=class extends d.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,n.jsx)("div",{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,n.jsx)("div",{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[this.props.message,(0,n.jsx)("p",{children:(0,n.jsx)("button",{onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},ti=d.memo(({controller:t,tabNode:e})=>{let i;return ti.displayName="TabContentRenderer",e.getComponent()?i=t.getFactory()(e):e.getSubLayoutId()&&(i=(0,n.jsxs)("div",{className:t.getClassName(T.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:[(0,n.jsx)(tb,{...t.getProps(),layoutId:e.getSubLayoutId(),mainLayoutController:t.getMainController()}),";"]})),(0,n.jsx)(te,{message:t.i18nName(z.Error_rendering_component),retryText:t.i18nName(z.Error_rendering_component_retry),children:i})},function(t,e){return!(e.visible&&(t.windowId!==e.windowId||t.fullRedrawRevision!==e.fullRedrawRevision||t.parentRedrawRevision!==e.parentRedrawRevision||void 0!==e.tabNode.getSubLayoutId()))}),to=class t{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(t){this._controller=t,this._mainController=t.getMainController()}addTabWithDragAndDrop(e,i,o){let a=y.fromJson(i,this._controller.getModel(),!1);t.dragState=new ts(this._controller.getMainController(),ta.Add,a,i,o)}moveTabWithDragAndDrop(t,e){this.setDragNode(t,e)}setDragNode=(e,i)=>{if(t.dragState=new ts(this._controller.getMainController(),ta.Internal,i,void 0,void 0),e.dataTransfer.setData("text/plain","--flexlayout--"),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.dropEffect="move",this._dragEnterCount=0,i instanceof C){let t=!1,o=this._controller.i18nName(z.Move_Tabset);if(i.getChildren().length>0&&(o=this._controller.i18nName(z.Move_Tabs).replace("?",String(i.getChildren().length))),this._controller.getProps().onRenderDragRect){let a=this._controller.getProps().onRenderDragRect(o,i,void 0);a&&(this.setDragComponent(e,a,10,10),t=!0)}t||this.setDragComponent(e,o,10,10)}else{let t=e.target;if(t&&"function"==typeof t.getBoundingClientRect){let o=t.getBoundingClientRect(),a=e.clientX-o.left,s=e.clientY-o.top,r=i?.getParent(),l=r instanceof U&&r.getOrientation()===c.HORZ,d=l?10:a,h=l?10:s,u=!1;if(this._controller.getProps().onRenderDragRect){let t=(0,n.jsx)(k,{controller:this._controller,tabNode:i},i.getId()),o=this._controller.getProps().onRenderDragRect(t,i,void 0);o&&(this.setDragComponent(e,o,d,h),u=!0)}if(!u){let t;!(t=navigator.userAgent).includes("Safari")||t.includes("Chrome")||t.includes("Chromium")?e.dataTransfer.setDragImage(i.getTabStamp(),d,h):this.setDragComponent(e,(0,n.jsx)(k,{tabNode:i,controller:this._controller}),d,h)}}}};setDragComponent(t,e,i,o){let a=(0,n.jsx)("div",{style:{position:"unset"},className:this._controller.getClassName(T.FLEXLAYOUT__LAYOUT)+" "+this._controller.getClassName(T.FLEXLAYOUT__DRAG_RECT),children:e});this._controller.getModel().sortLayouts();let s=this._controller.getCurrentDocument(),r=s.createElement("div");r.setAttribute("data-layout-path","/drag-rectangle"),r.style.position="absolute",r.style.left="-10000px",r.style.top="-10000px",s.body.appendChild(r),(0,u.createRoot)(r).render(a),t.dataTransfer.setDragImage(r,i,o),setTimeout(()=>{s.body.removeChild(r)},0)}updateActive(t){let e=Array.from(this._controller.getModel().getLayouts().values()),i=!1;for(let o=e.length-1;o>=0;o--){let a=e[o].getController()?.getDragDropManager();if(a){let e=!i&&a.getDragEnterCount()>0;e&&(i=!0),a.setActive(e,t)}}}setActive(t,e){this._active!==t&&(this._active=t,this._active?this.onDragEnter(e):this.onDragLeave(e))}onDragEnterRaw=t=>{this._dragEnterCount++,this.updateActive(t)};onDragLeaveRaw=t=>{this._dragEnterCount--,this.updateActive(t)};clearDragMain(){for(let[,t]of(this._controller.showOverlayOnAllWindows(!1),this._controller.getModel().getLayouts()))t.getController()&&t.getController().getDragDropManager().clearDragLocal()}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&(this._controller.getRootDiv().removeChild(this._outlineDiv),this._outlineDiv=void 0)}onDragEnter=e=>{if(!t.dragState&&this._controller.getProps().onExternalDrag){let i=this._controller.getProps().onExternalDrag(e);if(i){let e=y.fromJson(i.json,this._controller.getModel(),!1);t.dragState=new ts(this._controller.getMainController(),ta.External,e,i.json,i.onDrop)}}if(this._mainController===t.dragState?.mainLayoutController&&t.dragState){e.preventDefault(),this._dropInfo=void 0;let t=this._controller.getRootDiv();this._outlineDiv=this._controller.getCurrentDocument().createElement("div"),this._outlineDiv.className=this._controller.getClassName(T.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility="hidden";let i=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${i}s, left ${i}s, width ${i}s, height ${i}s`,t.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),void 0===this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let o=this._controller.getRootDiv().getBoundingClientRect();new g(e.clientX-o.left,e.clientY-o.top,1,1).positionElement(this._outlineDiv)}};onDragOver=e=>{if(this._mainController===t.dragState?.mainLayoutController&&this._active){let i=this._controller.getRootDiv()?.getBoundingClientRect(),o={x:e.clientX-(i?.left??0),y:e.clientY-(i?.top??0)};this._controller.checkForBorderToShow(o.x,o.y);let a=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),t.dragState.dragNode,o.x,o.y);a&&(e.preventDefault(),this._dropInfo=a,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(a.className),a.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility="visible"))}};onDragLeave=e=>{if(this._mainController===t.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let t=!1;for(let[,e]of this._controller.getModel().getLayouts())if(e.getController()&&e.getController().getDragDropManager().isDragging()){t=!0;break}!1===t&&this.clearDragMain()}};onDrop=e=>{if(this._mainController===t.dragState?.mainLayoutController){if(this._active){e.preventDefault();let i=t.dragState;if(this._dropInfo)if(void 0!==i.dragJson){let t=this._controller.doAction(p.addNode(i.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));void 0!==i.fnNewNodeDropped&&i.fnNewNodeDropped(t,e)}else void 0!==i.dragNode&&this._controller.doAction(p.moveNode(i.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));this.clearDragMain(),t.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},ta=((a={}).Internal="internal",a.External="external",a.Add="add",a),ts=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;constructor(t,e,i,o,a){this.mainLayoutController=t,this.dragSource=e,this.dragNode=i,this.dragJson=o,this.fnNewNodeDropped=a}},tn=({controller:t})=>{let e=[],i=t.getIcons().edgeArrow;if(t.getState().showEdges&&t.getModel().isEnableEdgeDockIndicators()){let o=t.getModel().getRootRow(t.getLayoutId()).getRect(),a=t.getClassName(T.FLEXLAYOUT__EDGE_RECT);e.push((0,n.jsx)("div",{style:{top:0,left:o.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,n.jsx)("div",{style:{transform:"rotate(180deg)"},children:i})},"North")),e.push((0,n.jsx)("div",{style:{top:o.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,n.jsx)("div",{style:{transform:"rotate(90deg)"},children:i})},"West")),e.push((0,n.jsx)("div",{style:{top:o.height-10,left:o.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,n.jsx)("div",{children:i})},"South")),e.push((0,n.jsx)("div",{style:{top:o.height/2-50,left:o.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,n.jsx)("div",{style:{transform:"rotate(-90deg)"},children:i})},"East"))}return(0,n.jsx)(n.Fragment,{children:e})},tr=t=>{let{title:e,controller:i,layout:o,url:a,onCloseLayout:s,onSetWindow:n,children:r}=t,l=d.useRef(null),[u,c]=d.useState(void 0),[g,_]=d.useState(!0),p=new Map;return(d.useLayoutEffect(()=>{if(!l.current){let t=o.getLayoutId(),i=o.getRect();l.current=window.open(a,t,`left=${i.x},top=${i.y},width=${i.width},height=${i.height}`),l.current?(n(o,l.current),window.addEventListener("beforeunload",()=>{if(l.current){let t=l.current;l.current=null,t.close()}}),l.current.addEventListener("load",()=>{if(l.current){l.current.focus(),l.current.resizeTo(i.width,i.height),l.current.moveTo(i.x,i.y);let t=l.current.document;t.title=e;let a=t.createElement("div");a.className=T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(a),(function(t,e){let i=[];for(let o of document.querySelectorAll('style, link[rel="stylesheet"]'))tl(t,o,e,i);return Promise.all(i)})(t,p).then(()=>{c(a)});let n=new MutationObserver(e=>(function(t,e,i){for(let o of t)if("childList"===o.type){for(let t of o.addedNodes)(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement)&&tl(e,t,i);for(let t of o.removedNodes)if(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement){let o=i.get(t);o&&e.head.removeChild(o)}}})(e,t,p));n.observe(document.head,{childList:!0}),l.current.addEventListener("beforeunload",()=>{l.current&&(s(o),l.current=null,n.disconnect())})}})):(console.warn(`Unable to open window ${a}`),s(o))}return()=>{i.getModel().getLayouts().has(o.getLayoutId())||(l.current?.close(),l.current=null)}},[]),d.useEffect(()=>{void 0!==u&&g&&(i.redrawLayout(),_(!1))},[u,g,i]),void 0!==u)?(0,h.createPortal)(r,u):null};function tl(t,e,i,o){if(e instanceof HTMLLinkElement){let a=e.cloneNode(!0);t.head.appendChild(a),i.set(e,a),o&&o.push(new Promise(t=>{a.onload=()=>t(!0)}))}else if(e instanceof HTMLStyleElement)try{let o=e.cloneNode(!0);t.head.appendChild(o),i.set(e,o)}catch(t){}}var td=((s=td||{}).North="n",s.South="s",s.East="e",s.West="w",s.NorthWest="nw",s.NorthEast="ne",s.SouthWest="sw",s.SouthEast="se",s),th=t=>{let{controller:e,layout:i,children:o}=t,[a,s]=d.useState(i.getRect()),r=e.getClassName,l=d.useRef(null),h=d.useRef(null),u=d.useRef(null),c=d.useRef(null),_=d.useRef(null),p=d.useRef(null),b=d.useRef(null),E=d.useRef(null),f=d.useRef(null),m=d.useRef(null),L=d.useRef(!1);d.useEffect(()=>(h.current?.addEventListener("touchstart",y,{passive:!1}),u.current?.addEventListener("touchstart",y,{passive:!1}),c.current?.addEventListener("touchstart",y,{passive:!1}),_.current?.addEventListener("touchstart",y,{passive:!1}),p.current?.addEventListener("touchstart",y,{passive:!1}),b.current?.addEventListener("touchstart",y,{passive:!1}),E.current?.addEventListener("touchstart",y,{passive:!1}),f.current?.addEventListener("touchstart",y,{passive:!1}),m.current?.addEventListener("touchstart",y,{passive:!1}),()=>{h.current?.removeEventListener("touchstart",y),u.current?.removeEventListener("touchstart",y),c.current?.removeEventListener("touchstart",y),_.current?.removeEventListener("touchstart",y),p.current?.removeEventListener("touchstart",y),b.current?.removeEventListener("touchstart",y),E.current?.removeEventListener("touchstart",y),f.current?.removeEventListener("touchstart",y),m.current?.removeEventListener("touchstart",y)}),[]);let y=t=>{t.preventDefault(),t.stopImmediatePropagation()};d.useEffect(()=>{let t=()=>{let t=[...e.getModel().getLayouts()];i!==t[t.length-1][1]&&(L.current=!0)},o=()=>{L.current&&(setTimeout(()=>{e.moveWindowToFront(i.getLayoutId())},10),L.current=!1)},a=l.current;return a&&(a.addEventListener("pointerdown",t,{capture:!0}),a.addEventListener("pointerup",o)),()=>{a&&(a.removeEventListener("pointerdown",t,{capture:!0}),a.removeEventListener("pointerup",o))}},[e,i.getLayoutId()]);let A=(t,o)=>{let n={x:t.clientX,y:t.clientY},r=e.getRootDiv(),l=r?r.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};N(document,t,(t,r)=>{e.showOverlayOnAllWindows(!0);let d=t-n.x,h=r-n.y,u=a.x,c=a.y,_=a.width,T=a.height;o.includes("n")&&(c+=h,T-=h),o.includes("s")&&(T+=h),o.includes("w")&&(u+=d,_-=d),o.includes("e")&&(_+=d),_<150&&(o.includes("w")&&(u=a.x+a.width-150),_=150),T<25&&(o.includes("n")&&(c=a.y+a.height-25),T=25),u<0&&(_+=u,u=0),c<0&&(T+=c,c=0),u+_>l.width&&(_=l.width-u),c+T>l.height&&(T=l.height-c),_<150&&(_=150),T<25&&(T=25);let p=new g(u,c,_,T);s(p),i.setRect(p)},()=>{e.redrawLayout(),e.showOverlayOnAllWindows(!1)},()=>{}),t.stopPropagation()},R=e.getRootDiv(),O=R?R.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};return a.clamp(new g(0,0,O.width,O.height)),(0,n.jsxs)("div",{ref:l,className:r(T.FLEXLAYOUT__FLOAT_WINDOW),style:{left:a.x,top:a.y,width:a.width,height:a.height,position:"absolute"},children:[(0,n.jsx)("div",{ref:h,className:r(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:t=>{t.stopPropagation();let o={x:t.clientX-a.x,y:t.clientY-a.y},n=e.getRootDiv(),r=n?n.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};N(document,t,(t,n)=>{e.showOverlayOnAllWindows(!0),L.current&&(e.moveWindowToFront(i.getLayoutId()),L.current=!1);let l=new g(t-o.x,n-o.y,a.width,a.height);l.clamp(new g(0,0,r.width,r.height)),s(l),i.setRect(l)},()=>{e.redrawLayout(),e.showOverlayOnAllWindows(!1)},()=>{})},children:(0,n.jsx)("div",{style:{flexGrow:1,display:"flex",justifyContent:"center"},children:(0,n.jsx)("div",{style:{width:50,height:8,display:"flex",flexDirection:"column",justifyContent:"space-around",opacity:.5},children:(0,n.jsx)("div",{style:{height:2,backgroundColor:"gray",borderRadius:1}})})})}),(0,n.jsx)("div",{className:r(T.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:o}),(0,n.jsx)("div",{ref:u,style:{position:"absolute",zIndex:10,top:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:t=>A(t,td.North)}),(0,n.jsx)("div",{ref:b,style:{position:"absolute",zIndex:10,bottom:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:t=>A(t,td.South)}),(0,n.jsx)("div",{ref:_,style:{position:"absolute",zIndex:10,top:8,bottom:8,right:-4,width:8,cursor:"ew-resize"},onPointerDown:t=>A(t,td.East)}),(0,n.jsx)("div",{ref:f,style:{position:"absolute",zIndex:10,top:8,bottom:8,left:-4,width:8,cursor:"ew-resize"},onPointerDown:t=>A(t,td.West)}),(0,n.jsx)("div",{ref:m,style:{position:"absolute",zIndex:10,top:-4,left:-4,width:12,height:12,cursor:"nwse-resize"},onPointerDown:t=>A(t,td.NorthWest)}),(0,n.jsx)("div",{ref:c,style:{position:"absolute",zIndex:10,top:-4,right:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:t=>A(t,td.NorthEast)}),(0,n.jsx)("div",{ref:E,style:{position:"absolute",zIndex:10,bottom:-4,left:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:t=>A(t,td.SouthWest)}),(0,n.jsx)("div",{ref:p,style:{position:"absolute",zIndex:10,bottom:0,right:0,width:12,height:12,cursor:"nwse-resize"},onPointerDown:t=>A(t,td.SouthEast)})]})},tu=({controller:t})=>{let e=[],i=t.getModel().getLayouts(),o=0;for(let[a,s]of i)!s.isMainLayout()&&("window"===s.getType()&&t.isSupportsPopout()?(e.push((0,n.jsx)(tr,{controller:t,layout:s,title:t.getPopoutWindowName()+" "+o,url:t.getPopoutURL()+"?id="+a,onSetWindow:t.onSetWindow,onCloseLayout:t.onCloseLayout,children:(0,n.jsx)("div",{className:t.getProps().popoutClassName,children:(0,n.jsx)(tb,{...t.getProps(),layoutId:a,mainLayoutController:t})})},a)),o++):"float"===s.getType()&&e.push((0,n.jsx)(th,{controller:t,layout:s,onCloseLayout:t.onCloseLayout,children:(0,n.jsx)(tb,{...t.getProps(),layoutId:a,mainLayoutController:t})},a+"float")));return(0,n.jsx)(n.Fragment,{children:e})},tc=t=>{let{controller:e,tabNode:i,selected:o,border:a,icons:s,path:r}=t,l=d.useRef(null),h=d.useRef(null);d.useLayoutEffect(()=>{i.setTabRect(e.getBoundingClientRect(l.current)),e.getEditingTab()===i&&h.current.select()});let u=e.getClassName,c=u(T.FLEXLAYOUT__BORDER_BUTTON)+" "+u(T.FLEXLAYOUT__BORDER_BUTTON_+a);o?c+=" "+u(T.FLEXLAYOUT__BORDER_BUTTON__SELECTED):c+=" "+u(T.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==i.getClassName()&&(c+=" "+i.getClassName());let g=0;!1===i.getModel().isEnableRotateBorderIcons()&&("left"===a?g=90:"right"===a&&(g=-90));let _=R(e,i,g),b=_.content?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:_.content}):null,E=_.leading?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:_.leading}):null;if(e.getEditingTab()===i&&(b=(0,n.jsx)("input",{ref:h,className:u(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":r+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):("Enter"===t.code||"NumpadEnter"===t.code)&&(e.setEditingTab(void 0),e.doAction(p.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isCloseable()){let t=e.i18nName(z.Close_Tab);_.buttons.push((0,n.jsx)("div",{"data-layout-path":r+"/button/close",title:t,className:u(T.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:t=>{t.stopPropagation()},onClick:t=>{let a;a=i.getCloseType(),(o||a===J.Always||a===J.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(e.doAction(p.deleteTab(i.getId())),t.stopPropagation())},children:"function"==typeof s.close?s.close(i):s.close},"close"))}return(0,n.jsxs)("div",{ref:l,"data-layout-path":r,className:c,onClick:()=>{e.doAction(p.selectTab(i.getId()))},onAuxClick:t=>{O(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.getDragDropManager().setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{t.stopPropagation(),e.getDragDropManager().clearDragMain()},children:[E,b,_.buttons]})},tg=t=>{let e,i,o,a,{borderNode:s,controller:r,size:l}=t,h=d.useRef(null),u=d.useRef(null),g=d.useRef(null),b=d.useRef(null),E=d.useRef(null),f=r.getIcons();d.useLayoutEffect(()=>{s.setTabHeaderRect(r.getBoundingClientRect(m.current))});let{selfRef:m,userControlledPositionRef:L,onScroll:y,onScrollPointerDown:A,hiddenTabs:R,onMouseWheel:v,isDockStickyButtons:x,isShowHiddenTabs:w}=$(r,s,c.flip(s.getOrientation()),E,u,r.getClassName(T.FLEXLAYOUT__BORDER_BUTTON)),N=t=>{O(t)&&r.auxMouseClick(s,t)},D=t=>{t.stopPropagation()},S=t=>{let e=r.getShowOverflowMenu(),i=R.map(t=>({index:t,node:s.getChildren()[t]}));void 0!==e?e(s,t,i,I):G(g.current,s,i,I,r),t.stopPropagation()},I=t=>{r.doAction(p.selectTab(t.node.getId())),L.current=!1},C=t=>{let e=s.getChildren()[s.getSelected()];void 0!==e&&r.doAction(p.popoutTab(e.getId(),"window")),t.stopPropagation()},B=t=>{let e=s.getChildren()[s.getSelected()];void 0!==e&&r.doAction(p.popoutTab(e.getId(),"float")),t.stopPropagation()},M=r.getClassName,U=(()=>{let t=[];for(let e=0;e<s.getChildren().length;e++){let i=s.getSelected()===e,o=s.getChildren()[e];t.push((0,n.jsx)(tc,{controller:r,border:s.getLocation().getName(),tabNode:o,path:s.getPath()+"/tb"+e,selected:i,icons:f},o.getId())),e<s.getChildren().length-1&&t.push((0,n.jsx)("div",{className:M(T.FLEXLAYOUT__BORDER_TAB_DIVIDER)},"divider"+e))}return t})(),{leading:F,toolbar:P}=(t=>{let e,i=[],o=[],a={leading:e,buttons:i,stickyButtons:o,overflowPosition:void 0};if(r.customizeTabSet(s,a),e=a.leading,o=a.stickyButtons,i=a.buttons,void 0===a.overflowPosition&&(a.overflowPosition=o.length),o.length>0&&(x?i=[...o,...i]:t.push((0,n.jsx)("div",{ref:b,onPointerDown:D,onDragStart:t=>{t.preventDefault()},className:M(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:o},"sticky_buttons_container"))),w){let t,e=r.i18nName(z.Overflow_Menu_Tooltip);if("function"==typeof f.more){let e=R.map(t=>({index:t,node:s.getChildren()[t]}));t=f.more(s,e)}else t=(0,n.jsxs)(n.Fragment,{children:[f.more,(0,n.jsx)("div",{className:M(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:R.length>0?R.length:""})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,n.jsx)("button",{ref:g,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+s.getLocation().getName()),title:e,onClick:S,onPointerDown:D,children:t},"overflowbutton"))}let l=s.getSelected();if(-1!==l){let t=s.getChildren()[l];if(void 0!==t&&r.isMainLayout()){if(t.isEnablePopoutFloatIcon()){let e=r.i18nName(z.Popout_Tab_Float);i.push((0,n.jsx)("button",{title:e,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:B,onPointerDown:D,children:"function"==typeof f.popoutFloat?f.popoutFloat(t):f.popoutFloat},"popout-float"))}if(r.isSupportsPopout()&&t.isEnablePopoutIcon()&&t.isAllowedInWindow()){let e=r.i18nName(z.Popout_Tab);i.push((0,n.jsx)("button",{title:e,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:C,onPointerDown:D,children:"function"==typeof f.popout?f.popout(t):f.popout},"popout"))}}}return{leading:e,toolbar:(0,n.jsx)("div",{ref:h,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_+s.getLocation().getName()),children:i},"toolbar")}})(U),Y=M(T.FLEXLAYOUT__BORDER)+" "+M(T.FLEXLAYOUT__BORDER_+s.getLocation().getName());void 0!==s.getClassName()&&(Y+=" "+s.getClassName());let W=l-1;return s.getLocation()===_.LEFT?(e={right:"100%",top:0},i={width:W,overflowY:"auto"}):s.getLocation()===_.RIGHT?(e={left:"100%",top:0},i={width:W,overflowY:"auto"}):(e={left:0},i={height:W,overflowX:"auto"}),s.isEnableTabScrollbar()&&(o=(0,n.jsx)("div",{ref:u,className:M(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:A})),F&&(a=(0,n.jsx)("div",{className:M(T.FLEXLAYOUT__BORDER_LEADING),children:F})),(0,n.jsxs)("div",{ref:m,style:{display:"flex",flexDirection:s.getOrientation()===c.VERT?"row":"column"},className:Y,"data-layout-path":s.getPath(),onClick:N,onAuxClick:N,onContextMenu:t=>{r.showContextMenu(s,t)},onWheel:v,children:[a,(0,n.jsxs)("div",{className:M(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,n.jsx)("div",{ref:E,className:M(T.FLEXLAYOUT__BORDER_INNER)+" "+M(T.FLEXLAYOUT__BORDER_INNER_+s.getLocation().getName()),style:i,onScroll:y,children:(0,n.jsx)("div",{style:e,className:M(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+M(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+s.getLocation().getName()),children:U})}),o]}),P]})};function t_(t){let{controller:e,borderNode:i,show:o}=t,a=d.useRef(null);d.useLayoutEffect(()=>{let t=e.getBoundingClientRect(a.current);isNaN(t.x)||!(t.width>0)||i.getContentRect().equalsWhenRounded(t)||(i.setContentRect(t),e.setReLayout(!0))});let s=!0,r={};i.getOrientation()===c.HORZ?(r.width=i.getSize(),r.minWidth=i.getMinSize(),r.maxWidth=i.getMaxSize()):(r.height=i.getSize(),r.minHeight=i.getMinSize(),r.maxHeight=i.getMaxSize(),s=!1),r.display=o?"flex":"none";let l=e.getClassName(T.FLEXLAYOUT__BORDER_TAB_CONTENTS);return i.getLocation()===_.LEFT||i.getLocation()===_.TOP?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:a,style:r,className:l}),o&&(0,n.jsx)(K,{controller:e,node:i,index:0,horizontal:s})]}):(0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsx)(K,{controller:e,node:i,index:0,horizontal:s}),(0,n.jsx)("div",{ref:a,style:r,className:l})]})}var tT=({controller:t,inner:e})=>{let i=t.getClassName(T.FLEXLAYOUT__LAYOUT_MAIN),o=t.getModel().getBorderSet().getBorderMap();if(!t.isMainLayout()||!(o.size>0))return(0,n.jsx)("div",{className:i,ref:t.getMainRef(),style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"},children:e});{let a=(0,n.jsx)("div",{className:i,ref:t.getMainRef(),children:e}),s=new Map,r=new Map;for(let[e,i]of _.values){let e=o.get(i);e&&e.isShowing()&&(!e.isAutoHide()||e.isAutoHide()&&(e.getChildren().length>0||t.getState().showHiddenBorder===i))&&(s.set(i,(0,n.jsx)(tg,{controller:t,borderNode:e,size:t.getState().calculatedBorderBarSize})),r.set(i,(0,n.jsx)(t_,{controller:t,borderNode:e,show:-1!==e.getSelected()})))}let l=t.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),d=t.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(t.getModel().getBorderSet().getLayoutHorizontal()){let t=(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[r.get(_.TOP),(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[r.get(_.LEFT),a,r.get(_.RIGHT)]}),r.get(_.BOTTOM)]});return(0,n.jsxs)("div",{className:l,style:{flexDirection:"column"},children:[s.get(_.TOP),(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[s.get(_.LEFT),t,s.get(_.RIGHT)]}),s.get(_.BOTTOM)]})}{let t=(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[r.get(_.LEFT),(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[r.get(_.TOP),a,r.get(_.BOTTOM)]}),r.get(_.RIGHT)]});return(0,n.jsxs)("div",{className:l,style:{flexDirection:"row"},children:[s.get(_.LEFT),(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[s.get(_.TOP),t,s.get(_.BOTTOM)]}),s.get(_.RIGHT)]})}}},tp=d.memo(t=>{tp.displayName="DragContainer";let{controller:e,tabNode:i}=t,o=d.useRef(null);d.useEffect(()=>{i.setTabStamp(o.current)},[i,o.current]);let a=e.getClassName;return(0,n.jsx)("div",{ref:o,className:a(T.FLEXLAYOUT__DRAG_RECT),children:(0,n.jsx)(k,{controller:e,tabNode:i},i.getId())})},function(t,e){return e.dragging}),tb=d.forwardRef((t,e)=>{tb.displayName="LayoutInternal";let[i,o]=d.useState({rect:g.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:_.CENTER,splitterSize:8}),a=d.useCallback(e=>{o(i=>({...i,..."function"==typeof e?e(i,t):e}))},[t]),s=d.useRef(null),r=d.useRef(null),l=d.useRef(null),h=d.useRef(null),u=d.useMemo(()=>new tE(t,i,a),[]);if(u.setProps(t),u.setStateRaw(i),u.setSetState(a),u.setLayoutRef(s),u.setMoveablesRef(r),u.setFindBorderBarSizeRef(l),u.setMainRef(h),d.useImperativeHandle(e,()=>u,[u]),d.useLayoutEffect(()=>{u.isMainLayout()&&u.updateLayoutMetrics(),u.isReLayout()&&(u.redrawLayout(),u.setReLayout(!1))}),d.useEffect(()=>{let t=s.current.ownerDocument,e=t.defaultView;u.setCurrentDocument(t),u.setCurrentWindow(e);let i=new e.ResizeObserver(()=>{e.requestAnimationFrame(()=>{u.updateRect()})});i.observe(s.current);let o=()=>{u.updateRect()};e.addEventListener("resize",o);let a=()=>{for(let[t,e]of u.getProps().model.getLayouts())e.getController()&&u.redrawLayout()};return document.addEventListener("visibilitychange",a),()=>{i.disconnect(),e.removeEventListener("resize",o),document.removeEventListener("visibilitychange",a)}},[u,s.current?.ownerDocument]),d.useEffect(()=>{let t;if(!u.isMainLayout()&&"window"===u.getLayout().getType()){let e=u.getProps().mainLayoutController?.getRootDiv();if(e){let i=s.current;S(e,i),(t=new MutationObserver(()=>{S(e,i)&&u.redrawLayout()})).observe(e,{attributeFilter:["style"]})}}return()=>{t&&t.disconnect()}},[u]),d.useEffect(()=>{let e=t.model,o=e.getLayouts().get(u.getLayoutId());if(o.setController(u),o.setToExportRectFunction((t,e)=>"window"===e?u.getScreenRect(t):u.getRelativeRect(t)),u.setLayout(o),u.isMainLayout()){e.addChangeListener(u.onModelChange);let o=()=>{let e=parseInt(getComputedStyle(s.current).getPropertyValue("--splitter-size"));Number.isFinite(e)&&(t.model.setSplitterSize(e),i.splitterSize!==e&&a({splitterSize:e}))};o();let n=setInterval(o,1e3);return()=>{e.removeChangeListener(u.onModelChange),clearInterval(n),u.tidyMoveablesMap()}}},[t.model,u]),!s.current)return(0,n.jsxs)("div",{ref:s,className:u.getClassName(T.FLEXLAYOUT__LAYOUT),children:[(0,n.jsx)("div",{ref:r,className:u.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),(0,n.jsx)("div",{ref:l,className:u.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")]});let c=t.model,p=u.getLayoutId();c.getRootRow(p).calcMinMaxSize(),c.getRootRow(p).setPaths(""),u.isMainLayout()&&(c.getBorderSet().setPaths(),u.createMoveableDivs());let b=(0,n.jsx)(tT,{controller:u,inner:u.renderLayout()}),E=u.renderTabContainers(),f=u.reorderComponents(E,u.getOrderedTabIds()),m=null,L=null,y=null,A=null;if(u.isMainLayout()){m=u.renderMetricsElements(),L=(0,n.jsx)(tu,{controller:u});let t=u.renderTabContents();y=u.reorderComponents(t,u.getOrderedTabMoveableIds()),A=(0,n.jsx)("div",{className:u.getClassName(T.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:u.renderTabStamps()},"__tabStamps__")}return(0,n.jsxs)("div",{ref:s,className:u.getClassName(T.FLEXLAYOUT__LAYOUT),onDragEnter:u.getDragDropManager().onDragEnterRaw,onDragLeave:u.getDragDropManager().onDragLeaveRaw,onDragOver:u.getDragDropManager().onDragOver,onDrop:u.getDragDropManager().onDrop,children:[(0,n.jsx)("div",{ref:r,className:u.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),m,(0,n.jsx)(H,{controller:u,show:i.showOverlay},"__overlay__"),b,f,y,i.portal,L,A]})}),tE=class t{static Windows=new Map;_props;_state;_setState;_layoutRef;_moveablesRef;_findBorderBarSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_moveableElementMap=new Map;_currentDocument;_currentWindow;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;constructor(t,e,i){this._props=t,this._state=e,this._setState=i,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=void 0!==t.supportsPopout?t.supportsPopout:tm,this._popoutURL=t.popoutURL?t.popoutURL:"popout.html",this._icons={...tf,...t.icons},this._layoutId=t.layoutId?t.layoutId:W.MAIN_LAYOUT_ID,this._mainController=t.mainLayoutController?t.mainLayoutController:this,this._dragDropManager=new to(this),this._layout=t.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=t.popoutWindowName||"Popout Window",this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},"__row__"),(0,n.jsx)(tn,{controller:this})]})}renderTabContainers(){let t=new Map;return this._props.model.visitLayoutNodes(this._layoutId,e=>{if(e instanceof y){let i=e.isSelected(),o=e.isRendered(),a=e.isEnableRenderOnDemand();(o||i||!a)&&t.set(e.getId(),(0,n.jsx)(tt,{controller:this,tabNode:e,selected:i},e.getId()))}}),t}renderTabContents(){let t=new Map;for(let[e,i]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(e,e=>{if(e instanceof y){let o=e.isSelected(),a=e.isRendered(),s=e.isEnableRenderOnDemand(),r=e.getParent().getContentRect(),l=o||!s;if(a||l&&r.width>0&&r.height>0){let o=e.getMoveableElement(),a=i.getWindowId()||"",s=e.getId()+(e.isEnableWindowReMount()?a:"");t.set(e.getId(),(0,h.createPortal)((0,n.jsx)(ti,{controller:this,tabNode:e,rect:r,windowId:a,visible:l,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},s),o,s)),e.setRendered(!0)}}});return t}renderMetricsElements(){return(0,n.jsx)("div",{ref:this._findBorderBarSizeRef,className:this.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")}renderTabStamps(){let t=[];return this._props.model.visitNodes(e=>{e instanceof y&&t.push((0,n.jsx)(tp,{controller:this,tabNode:e,dragging:w},e.getId()))}),t}createMoveableDivs(){this._props.model.visitNodes(t=>{if(t instanceof y){let e=this.getMoveableElement(t.getId());t.setMoveableElement(e)}})}getMoveablesDiv(){return this._moveablesRef.current}getMoveableElement(t){let e=this._moveableElementMap.get(t);return void 0===e&&(e=document.createElement("div"),this._moveablesRef.current.appendChild(e),e.className=T.FLEXLAYOUT__TAB_MOVEABLE,this._moveableElementMap.set(t,e)),e}tidyMoveablesMap(){let t=new Map;for(let[e,i]of(this._props.model.visitNodes((e,i)=>{e instanceof y&&t.set(e.getId(),e)}),this._moveableElementMap))t.has(e)||(i.remove(),this._moveableElementMap.delete(e))}redrawLayout(){this._mainController?.setState(t=>({layoutRedrawRevision:t.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(t=!0){this._mainController?.setState(t=>({fullRedrawRevision:t.fullRedrawRevision+1}))}doAction(t){if(void 0===this._props.onAction)return this._props.model.doAction(t);{let e=this._props.onAction(t);return void 0!==e?this._props.model.doAction(e):void 0}}updateRect=()=>{if(this._layoutRef.current){let t=this._layoutRef.current;if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let e=t.closest("."+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW));e instanceof HTMLDivElement&&(t=e)}let e=g.fromDomRect(t.getBoundingClientRect());if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let t=this._mainController.getDomRect();e=e.relativeTo(t)}!e.equalsWhenRounded(this._state.rect)&&0!==e.width&&0!==e.height&&(this.setState({rect:e}),this._layout.setRect(e),this._layout.isMainLayout()||this.redrawLayout())}};onModelChange=t=>{t.type==p.DELETE_TAB&&this._state.showHiddenBorder!==_.CENTER&&0===this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder).getChildren().length&&this._setState({showHiddenBorder:_.CENTER}),this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,t)};reorderComponents(t,e){let i=e.filter(e=>t.has(e)),o=new Set(i);for(let e of t.keys())o.has(e)||i.push(e);return e.splice(0,e.length,...i),e.map(e=>t.get(e))}checkForBorderToShow(t,e){let i=this.getBoundingClientRect(this._mainRef.current),o=i.getCenter(),a=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===_.CENTER&&(e>o.y-50&&e<o.y+50||t>o.x-50&&t<o.x+50)&&(a=!0);let s=_.CENTER;!a&&(t<=i.x+10?s=_.LEFT:t>=i.getRight()-10?s=_.RIGHT:e<=i.y+10?s=_.TOP:e>=i.getBottom()-10&&(s=_.BOTTOM)),s!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:s})}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let t=this._findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this._state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}};addTabWithDragAndDrop(t,e,i){this._dragDropManager.addTabWithDragAndDrop(t,e,i)}moveTabWithDragAndDrop(t,e){this._dragDropManager.moveTabWithDragAndDrop(t,e)}setDragComponent(t,e,i,o){this._dragDropManager.setDragComponent(t,e,i,o)}getProps(){return this._props}setProps(t){this._props=t}getState(){return this._state}setStateRaw(t){this._state=t}setState(t){this._setState(t)}setSetState(t){this._setState=t}getLayoutRef(){return this._layoutRef}setLayoutRef(t){this._layoutRef=t}getMoveablesRef(){return this._moveablesRef}setMoveablesRef(t){this._moveablesRef=t}getFindBorderBarSizeRef(){return this._findBorderBarSizeRef}setFindBorderBarSizeRef(t){this._findBorderBarSizeRef=t}getMainRef(){return this._mainRef}setMainRef(t){this._mainRef=t}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(t){this._currentDocument=t}getCurrentWindow(){return this._currentWindow}setCurrentWindow(e){this._currentWindow=e,e&&!t.Windows.has(e)&&t.Windows.set(e,M())}getWindowId(){if(this.getCurrentWindow())return t.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(t){this._layout=t}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName}isReLayout(){return this._reLayout}setReLayout(t){this._reLayout=t}getBoundingClientRect(t){let e=this.getDomRect();return e?g.getBoundingClientRect(t).relativeTo(e):g.empty()}getMoveableContainer(){return this._moveablesRef.current}getClassName=t=>void 0===this._props.classNameMapper?t:this._props.classNameMapper(t);getDomRect(){return void 0!==this._cachedLayoutDOMRect?this._cachedLayoutDOMRect:this._layoutRef.current?(this._cachedLayoutDOMRect=g.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):g.empty()}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!1}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=t=>{this.doAction(p.closePopout(t.getLayoutId()))};onSetWindow=(t,e)=>{};getScreenRect(t){let e=t.clone(),i=this.getDomRect();return e.x=this._currentWindow.screenX+this._currentWindow.scrollX+1+i.x+e.x,e.y=this._currentWindow.screenY+this._currentWindow.scrollY+59+i.y+e.y,e.height+=60,e.width+=2,e}getRelativeRect(t){let e=t.clone();if(!this._layout.isMainLayout()){let t=this._layout.getRect();e.x+=t.x,e.y+=t.y}return e}moveWindowToFront(t){this.doAction(p.movePopoutToFront(t))}addTabToTabSet(t,e){if(void 0!==this._props.model.getNodeById(t))return this.doAction(p.addNode(e,t,_.CENTER,-1))}addTabToActiveTabSet(t){let e=this._props.model.getActiveTabset(this._layoutId);if(void 0!==e)return this.doAction(p.addNode(t,e.getId(),_.CENTER,-1))}showControlInPortal=(t,e)=>{let i=(0,h.createPortal)(t,e);this.setState({portal:i})};hideControlInPortal=()=>{this.setState({portal:void 0})};maximize(t){this.doAction(p.maximizeToggle(t.getId(),this.getLayoutId()))}customizeTab(t,e){this._props.onRenderTab&&this._props.onRenderTab(t,e)}customizeTabSet(t,e){this._props.onRenderTabSet&&this._props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this._props.i18nMapper&&(i=this._props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(t,e){this._props.onContextMenu&&this._props.onContextMenu(t,e)}auxMouseClick(t,e){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(t,e)}showOverlay(t){this.setState({showOverlay:t}),v(!t,this._currentDocument)}showOverlayOnAllWindows(t){for(let[,e]of this._props.model.getLayouts())e.getController()&&e.getController().showOverlay(t)}},tf={close:(0,n.jsx)(j,{}),closeTabset:(0,n.jsx)(j,{}),closeFloatPopout:(0,n.jsx)(j,{}),popout:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,n.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]}),{}),popoutFloat:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,n.jsx)("rect",{x:"3",y:"10",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,n.jsx)("rect",{x:"10",y:"3",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M6 14 L14 6",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M10 6 h4 v4",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),{}),maximize:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})]}),{}),restore:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"})]}),{}),more:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"})]}),{}),edgeArrow:(0,n.jsx)(()=>(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100",children:(0,n.jsx)("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"})}),{}),activeTabset:(0,n.jsx)(()=>(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,height:"24px",viewBox:"0 -960 960 960",width:"24px",children:(0,n.jsx)("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"})}),{})},tm=A(),tL=d.forwardRef((t,e)=>{let i=(0,d.useRef)(null),o=(0,d.useRef)(0);return tL.displayName="Layout",(0,d.useImperativeHandle)(e,()=>({redraw:()=>{i.current?.redrawLayoutAndTabContent()},addTabToTabSet:(t,e)=>i.current?.addTabToTabSet(t,e),addTabWithDragAndDrop:(t,e,o)=>{i.current?.addTabWithDragAndDrop(t,e,o)},moveTabWithDragAndDrop:(t,e)=>{i.current?.moveTabWithDragAndDrop(t,e)},addTabToActiveTabSet:t=>i.current?.addTabToActiveTabSet(t),setDragComponent:(t,e,o,a)=>{i.current?.setDragComponent(t,e,o,a)},getRootDiv:()=>i.current.getRootDiv()})),(0,n.jsx)(tb,{ref:i,...t,parentRedrawRevision:o.current++})}),ty=t.i(404175),tA=t.i(157408),tR=t.i(327964),tO=t.i(873111),tv=t.i(691223),tx=t.i(31807),tw=t.i(363156),tN=t.i(250226),tD=t.i(564822),tS=t.i(361031),tI=t.i(524360),tC=t.i(515104),tB=t.i(506037),tM=t.i(835829);let tU=()=>(0,n.jsx)(t$,{}),tF=(0,r.default)(()=>t.A(202411).then(t=>t.EditorPanel),{loadableGenerated:{modules:[388576]},ssr:!1,loading:tU}),tP=(0,r.default)(()=>t.A(136450).then(t=>t.CodeEditor),{loadableGenerated:{modules:[538691]},ssr:!1,loading:tU}),tY=(0,r.default)(()=>t.A(58872).then(t=>t.TerminalPanel),{loadableGenerated:{modules:[608745]},ssr:!1,loading:tU}),tW=(0,r.default)(()=>t.A(329052).then(t=>t.ChannelList),{loadableGenerated:{modules:[878166]},ssr:!1,loading:tU}),tX=(0,r.default)(()=>t.A(126861).then(t=>t.ChatPanel),{loadableGenerated:{modules:[773354]},ssr:!1,loading:tU}),tj=(0,r.default)(()=>t.A(124383).then(t=>t.IssueList),{loadableGenerated:{modules:[783481]},ssr:!1,loading:tU}),tH=(0,r.default)(()=>t.A(318599).then(t=>t.IssueDetail),{loadableGenerated:{modules:[706304]},ssr:!1,loading:tU}),tz=(0,r.default)(()=>t.A(222445).then(t=>t.GitCommitsPanel),{loadableGenerated:{modules:[514669]},ssr:!1,loading:tU}),tk=(0,r.default)(()=>t.A(78906).then(t=>t.ProjectSettingsPanel),{loadableGenerated:{modules:[985646]},ssr:!1,loading:tU}),tG=(0,r.default)(()=>t.A(857328).then(t=>t.CodeFavoritesPanel),{loadableGenerated:{modules:[306649]},ssr:!1,loading:tU}),tV=(0,r.default)(()=>t.A(3725).then(t=>t.AddFavoriteDialog),{loadableGenerated:{modules:[722705]},ssr:!1,loading:()=>null}),tJ=(0,r.default)(()=>t.A(823528),{loadableGenerated:{modules:[394896]},ssr:!1,loading:tU}),tZ=(0,r.default)(()=>t.A(903135).then(t=>t.default),{loadableGenerated:{modules:[683223]},ssr:!1,loading:tU});function t$(){return(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading..."})}let tq={global:{tabSetEnableTabStrip:!0,borderEnableDrop:!0,tabEnableClose:!1,tabEnableRename:!1,tabSetEnableMaximize:!1},borders:[{type:"border",location:"bottom",children:[{type:"tab",name:"Terminal",component:"terminal"},{type:"tab",name:"Commits",component:"git-commits"},{type:"tab",name:"Favorites",component:"code-favorites",id:"code-favorites"}]}],layout:{type:"row",children:[{type:"tabset",weight:.25,children:[{type:"tab",name:"Settings",component:"project-settings",id:"project-settings"},{type:"tab",name:"Channels",component:"channel-list",id:"channel-list"},{type:"tab",name:"Issues",component:"issue-list",id:"issue-list"},{type:"tab",name:"Workfolder",component:"workfolder",id:"workfolder"}]},{type:"tabset",weight:.75,children:[{type:"tab",name:"Code Editor",component:"code-editor",id:"code-editor"},{type:"tab",name:"Chat",component:"chat",id:"chat"},{type:"tab",name:"Issue Detail",component:"issue-detail",id:"issue-detail"},{type:"tab",name:"Database",component:"database",id:"database"},{type:"tab",name:"Kanban",component:"kanban",id:"kanban"}]}]}};function tK({panel:t,workspaceId:e,boundDirs:i}){switch(t){case"channel-list":default:return(0,n.jsx)(tW,{workspaceId:e});case"chat":return(0,n.jsx)(tX,{workspaceId:e});case"issue-list":return(0,n.jsx)(tj,{workspaceId:e});case"issue-detail":return(0,n.jsx)(tH,{workspaceId:e});case"workfolder":return(0,n.jsx)(tF,{workspaceId:e});case"code-editor":return(0,n.jsx)(tP,{workspaceId:e});case"terminal":return(0,n.jsx)(tY,{workspaceId:e,boundDirs:i});case"git-commits":return(0,n.jsx)(tz,{workspaceId:e});case"project-settings":return(0,n.jsx)(tk,{workspaceId:e});case"code-favorites":return(0,n.jsx)(tG,{workspaceId:e});case"database":return(0,n.jsx)(tJ,{workspaceId:e});case"kanban":return(0,n.jsx)(tZ,{workspaceId:e})}}function tQ({name:t}){return(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[t," (coming soon)"]})}t.s(["WorkspaceShell",0,function({workspaceId:t,boundDirs:e}){let i=(0,tD.useIsMobile)(),o=(0,tR.useIssueStore)(),a=(0,tO.useTaskStore)(),s=(0,tR.useIssueStore)(t=>t.activeIssueId),r=(0,tR.useIssueStore)(t=>t.issueSelectSeq),d=(0,tv.useEditorStore)(t=>t.activeFilePath),h=(0,tx.useChannelStore)(t=>t.activeChannelId),u=(0,tx.useChannelStore)(t=>t.channelSelectSeq),c=(0,tw.useGitStore)(t=>t.status),g=(0,tI.useTerminalStore)(t=>t.sessions),_=(0,tx.useChannelStore)(t=>t.messages),{activePanel:T,setActivePanel:b,handleBackAction:E}=(0,tN.useMobilePanelStore)(),f=(0,tv.useEditorStore)(t=>t.loadEditorState),m=(0,tv.useEditorStore)(t=>t.revealPath);(0,tv.useEditorStore)(t=>t.clearRevealPath);let[L,A]=(0,l.useState)(()=>{let e;try{let i=localStorage.getItem(`flexlayout-${t}`);if(i){let t=JSON.parse(i),o=t.borders,a=o?.find(t=>"bottom"===t.location);a&&!a.children.some(t=>"code-favorites"===t.id||"code-favorites"===t.component)&&a.children.push({type:"tab",name:"Favorites",component:"code-favorites",id:"code-favorites"}),e=W.fromJson(t)}else e=W.fromJson(tq)}catch{e=W.fromJson(tq)}return e});(0,l.useEffect)(()=>{let e=()=>{localStorage.removeItem(`flexlayout-${t}`),A(W.fromJson(tq))};return window.addEventListener("reset-layout",e),()=>window.removeEventListener("reset-layout",e)},[t]),(0,l.useEffect)(()=>{f(t)},[t,f]),(0,l.useEffect)(()=>{if(!i)return;let e=e=>{E()&&(e.preventDefault(),window.history.pushState({workspaceId:t,mobileBackGuard:!0},""))};return window.history.replaceState({workspaceId:t,mobileBackGuard:!0},""),window.history.pushState({workspaceId:t,mobileBackGuard:!0},""),window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[E,i,t]),(0,l.useEffect)(()=>{if(s)if(i)b("issue-detail");else{let t=L.getNodeById("issue-detail");t&&t instanceof y&&L.doAction(p.selectTab(t.getId()))}},[r,s,L,i,b]),(0,l.useEffect)(()=>{if(h)if(i)b("chat");else{let t=L.getNodeById("chat");t&&t instanceof y&&L.doAction(p.selectTab(t.getId()))}},[u,h,L,i,b]),(0,l.useEffect)(()=>{if(d)if(i)b("code-editor");else{let t=L.getNodeById("code-editor");t&&t instanceof y&&L.doAction(p.selectTab(t.getId()))}else if(0===tv.useEditorStore.getState().openFiles.length)if(i)b("workfolder");else{let t=L.getNodeById("workfolder");t&&t instanceof y&&L.doAction(p.selectTab(t.getId()))}},[d,L,i,b]),(0,l.useEffect)(()=>{if(m)if(i)b("workfolder");else{let t=L.getNodeById("workfolder");t&&t instanceof y&&L.doAction(p.selectTab(t.getId()))}},[m,L,i,b]),(0,l.useEffect)(()=>{tw.useGitStore.getState().loadStatus(t);let e=setInterval(()=>{tw.useGitStore.getState().loadStatus(t)},3e4);return()=>clearInterval(e)},[t]),(0,l.useEffect)(()=>{if(!i)return;let e=tw.useGitStore.getState();"git-commits"===T&&e.loadLog(t)},[T,t,i]);let R=(0,l.useCallback)(()=>{let e=tS.useWorkspaceStore.getState().workspaces.find(e=>e.id===t),i=e?.notificationSettings;return i?.enabled&&"native"===i.provider&&i.native?.permissionGranted?i:null},[t]),O=(0,l.useCallback)(t=>{let e=t.status.replace(/_/g," ");return t.result?.summary?`${t.title}: ${e} - ${t.result.summary}`:`${t.title}: ${e}`},[]);(0,l.useEffect)(()=>{let e=(0,tA.getWS)(t),i=tB.useNotificationStore.getState();i.load(t);let s=[e.on("issue.created",t=>o.upsertIssue(t)),e.on("issue.updated",t=>o.upsertIssue(t)),e.on("issue.status_changed",t=>{let e=R();if(e){let{from:i,to:o}=t,a=e.events??[];if("in_progress"===o&&a.includes("issue_started")||"completed"===o&&a.includes("issue_completed")){let t=`Status changed: ${i} → ${o}`;(0,tC.sendNativeNotification)("Issue Status Updated",t)}}}),e.on("task.created",t=>{a.upsertTask(t);let e=R();e?.native?.androidOngoingTaskNotification&&(0,tC.sendAndroidOngoingTaskNotification)(O(t))}),e.on("task.updated",t=>{a.upsertTask(t);let e=R();e?.native?.androidOngoingTaskNotification&&(0,tC.sendAndroidOngoingTaskNotification)(O(t))}),e.on("task.status_changed",e=>{let i=tR.useIssueStore.getState().activeIssueId;i&&a.loadTasks(t,i);let o=R();if(o){let{from:t,to:i}=e,a=o.events??[];if("completed"===i&&a.includes("issue_task_completed")){let e=`Status changed: ${t} → ${i}`;(0,tC.sendNativeNotification)("Task Status Updated",e)}}}),e.on("notification.created",t=>{i.addNotification(t),R()&&(0,tC.sendNativeNotification)(t.title,t.description||"")}),e.on("notification.cleared",()=>{i.reset()}),e.on("inspector.jump",e=>{let i,{path:o,name:a,line:s,column:n,timestamp:r}=e,l=n??1;tM.useInspectorHistoryStore.getState().addEntry(t,{path:o,name:a,line:s,column:l,timestamp:r??Date.now()}),tv.useEditorStore.getState().jumpToPosition(t,o,s,n),i=window.__flutterBridge,i?.emit?.("inspector.jump",{path:o,line:s,column:l})})];return()=>s.forEach(t=>t())},[o,a,t,R,O]);let v=(0,l.useCallback)(i=>{switch(i.getComponent()){case"channel-list":return(0,n.jsx)(tW,{workspaceId:t});case"issue-list":return(0,n.jsx)(tj,{workspaceId:t});case"workfolder":return(0,n.jsx)(tF,{workspaceId:t});case"code-editor":return(0,n.jsx)(tP,{workspaceId:t});case"chat":return(0,n.jsx)(tX,{workspaceId:t});case"issue-detail":return(0,n.jsx)(tH,{workspaceId:t});case"terminal":return(0,n.jsx)(tY,{workspaceId:t,boundDirs:e});case"git-commits":return(0,n.jsx)(tz,{workspaceId:t});case"project-settings":return(0,n.jsx)(tk,{workspaceId:t});case"code-favorites":return(0,n.jsx)(tG,{workspaceId:t});case"database":return(0,n.jsx)(tJ,{workspaceId:t});case"kanban":return(0,n.jsx)(tZ,{workspaceId:t});default:return(0,n.jsx)(tQ,{name:i.getName()})}},[e,t]),x=(0,tO.useTaskStore)(t=>t.tasks),w=(0,l.useCallback)((t,e)=>{let i=t.getComponent();if(!i)return;let o=(0,ty.renderTabIcon)(i,t.getName(),c,g,_,x);o&&(e.content=o)},[c,g,_,x]),N=(0,l.useCallback)((e,i)=>{if(i.type!==p.SELECT_TAB)try{localStorage.setItem(`flexlayout-${t}`,JSON.stringify(e.toJson()))}catch{}if(i.type!==p.SELECT_TAB)return;let o=e.getNodeById(i.data.tabNode);if(!o||!(o instanceof y))return;let a=o.getComponent(),s=ty.RIGHT_TO_LEFT_TAB_MAP[a??""];if(s){let t=e.getNodeById(s);t&&t instanceof y&&e.doAction(p.selectTab(t.getId()))}let n=tw.useGitStore.getState();"git-commits"===a&&(n.loadStatus(t),n.loadDiffs(t),n.loadLog(t))},[t]);return i?(0,n.jsxs)("div",{className:"relative h-full w-full",children:[(0,n.jsx)(tK,{panel:T,workspaceId:t,boundDirs:e}),(0,n.jsx)(tV,{})]}):(0,n.jsxs)("div",{className:"relative h-full w-full",children:[(0,n.jsx)(tL,{model:L,factory:v,onRenderTab:w,onModelChange:N}),(0,n.jsx)(tV,{})]})}],161316)},817465,t=>{t.n(t.i(161316))}]);
3
+ then enabling this option will gray out this tab`),e.addInherited("borderWidth","tabBorderWidth").setType(f.NUMBER).setDescription("width when added to border, -1 will use border size"),e.addInherited("borderHeight","tabBorderHeight").setType(f.NUMBER).setDescription("height when added to border, -1 will use border size"),e.addInherited("minWidth","tabMinWidth").setType(f.NUMBER).setDescription("the min width of this tab"),e.addInherited("minHeight","tabMinHeight").setType(f.NUMBER).setDescription("the min height of this tab"),e.addInherited("maxWidth","tabMaxWidth").setType(f.NUMBER).setDescription("the max width of this tab"),e.addInherited("maxHeight","tabMaxHeight").setType(f.NUMBER).setDescription("the max height of this tab"),e}};function A(){return window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function R(t,e,i){let o,a=e.getName(),s=e.getName();void 0===i&&(i=0),void 0===o&&void 0!==e.getIcon()&&(o=0!==i?(0,n.jsx)("img",{style:{width:"1em",height:"1em",transform:"rotate("+i+"deg)"},src:e.getIcon(),alt:"leadingContent"}):(0,n.jsx)("img",{style:{width:"1em",height:"1em"},src:e.getIcon(),alt:"leadingContent"}));let r={leading:o,content:a,name:s,buttons:[]};return t.customizeTab(e,r),e.setRenderedName(r.name),r}function O(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}function v(t,e){for(let i of[...x("iframe",e),...x("webview",e)])i.style.pointerEvents=t?"auto":"none"}function x(t,e){return[...e.getElementsByTagName(t)]}var w=!1;function N(t,e,i,o,a){w=!0,e.preventDefault();let s=t=>{t.preventDefault(),i(t.clientX,t.clientY)},n=t=>{t.preventDefault(),w=!1,a()},r=()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",r),t.removeEventListener("pointercancel",n),w=!1,o()};t.addEventListener("pointermove",s),t.addEventListener("pointerup",r),t.addEventListener("pointercancel",n)}function D(t,e){let i=e.getType();if("window"===i)return t.isAllowedInWindow();if("float"===i)return!0;if("tab"===i){let i,o=(e.getController().getModel().visitNodes(t=>{t instanceof y&&t.getSubLayoutId()===e.getLayoutId()&&(i=t.getLayout())}),i);if(o&&"window"===o.getType()&&!o.isMainLayout()&&!t.isAllowedInWindow())return!1;if(t instanceof y){if(void 0!==t.getSubLayoutId())return!1}else if(t instanceof C){for(let e of t.getChildren())if(void 0!==e.getSubLayoutId())return!1}return!0}return!1}function S(t,e){let i=t.getAttribute("style");return i!==e.getAttribute("style")&&(i?e.setAttribute("style",i):e.removeAttribute("style"),!0)}var I=class t extends L{static TYPE="row";static fromJson(e,i,o){let a=new t(i,e);if(null!=e.children){for(let s of e.children)if(s.type===C.TYPE){let t=C.fromJson(s,i,o);a.addChild(t)}else if(s.type===t.TYPE){let e=t.fromJson(s,i,o);a.addChild(e)}}return a}static attributeDefinitions=t.createAttributeDefinitions();layout;minHeight;minWidth;maxHeight;maxWidth;constructor(e,i){super(e),this.minHeight=1,this.minWidth=1,this.maxHeight=Y,this.maxWidth=Y,t.attributeDefinitions.fromJson(i,this.attributes),this.normalizeWeights(),e.addNode(this)}getWeight(){return this.attributes.weight}toJson(){let e={};for(let i of(t.attributeDefinitions.toJson(e,this.attributes),e.children=[],this.children))e.children.push(i.toJson());return e}getLayout(){return this.layout?this.layout:super.getLayout()}setLayout(t){this.layout=t}setWeight(t){this.attributes.weight=t}getSplitterBounds(t){let e=this.getOrientation()===c.HORZ,i=this.getChildren(),o=this.model.getSplitterSize(),a=i[0].getRect(),s=i[i.length-1].getRect(),n=e?[a.x,s.getRight()]:[a.y,s.getBottom()],r=e?[a.x,s.getRight()]:[a.y,s.getBottom()];for(let a=0;a<t;a++){let t=i[a];n[0]+=e?t.getMinWidth():t.getMinHeight(),r[0]+=e?t.getMaxWidth():t.getMaxHeight(),a>0&&(n[0]+=o,r[0]+=o)}for(let a=i.length-1;a>=t;a--){let t=i[a];n[1]-=(e?t.getMinWidth():t.getMinHeight())+o,r[1]-=(e?t.getMaxWidth():t.getMaxHeight())+o}return[Math.max(r[1],n[0]),Math.min(r[0],n[1])]}getSplitterInitials(t){let e=this.getOrientation()===c.HORZ,i=this.getChildren(),o=this.model.getSplitterSize(),a=[],s=0;for(let t=0;t<i.length;t++){let o=i[t].getRect(),n=e?o.width:o.height;a.push(n),s+=n}let n=i[t].getRect();return{initialSizes:a,sum:s,startPosition:(e?n.x:n.y)-o}}calculateSplit(t,e,i,o,a){let s=this.getOrientation()===c.HORZ,n=this.getChildren(),r=n[t],l=s?r.getMaxWidth():r.getMaxHeight(),d=[...i];if(e<a){let i=a-e,o=0;d[t]+i>l?(o=d[t]+i-l,d[t]=l):d[t]+=i;for(let e=t-1;e>=0;e--){let t=n[e],o=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>o){d[e]-=i;break}i-=d[e]-o,d[e]=o}for(let e=t+1;e<n.length;e++){let t=n[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+o<i){d[e]+=o;break}o-=i-d[e],d[e]=i}}else{let i=e-a,o=0;d[t-1]+i>l?(o=d[t-1]+i-l,d[t-1]=l):d[t-1]+=i;for(let e=t;e<n.length;e++){let t=n[e],o=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>o){d[e]-=i;break}i-=d[e]-o,d[e]=o}for(let e=t-1;e>=0;e--){let t=n[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+o<i){d[e]+=o;break}o-=i-d[e],d[e]=i}}return d.map(t=>100*Math.max(.1,t)/o)}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=1,this.minWidth=1,this.maxHeight=Y,this.maxWidth=Y;let t=!0;for(let e of this.children)e.calcMinMaxSize(),this.getOrientation()===c.VERT?(this.minHeight+=e.getMinHeight(),this.maxHeight+=e.getMaxHeight(),t||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,e.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,e.getMaxWidth())):(this.minWidth+=e.getMinWidth(),this.maxWidth+=e.getMaxWidth(),t||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,e.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,e.getMaxHeight())),t=!1}tidy(){let e=0;for(;e<this.children.length;){let i=this.children[e];if(i instanceof t){i.tidy();let o=i.getChildren();if(0===o.length)this.removeChild(i);else if(1===o.length){let a=o[0];if(this.removeChild(i),a instanceof t){let t=0,o=a.getChildren();for(let e of o)t+=e.getWeight();for(let a=0;a<o.length;a++){let s=o[a];s.setWeight(i.getWeight()*s.getWeight()/t),this.addChild(s,e+a)}}else a.setWeight(i.getWeight()),this.addChild(a,e)}else e++}else i instanceof C&&0===i.getChildren().length&&i.isEnableDeleteWhenEmpty()&&i.isEnableClose()?(this.removeChild(i),i===this.model.getMaximizedTabset(this.getLayoutId())&&this.model.setMaximizedTabset(void 0,this.getLayoutId())):e++}if(this===this.model.getRootRow(this.getLayoutId())&&0===this.children.length)if(this.getLayout()?.getType()!=="tab"&&this.getLayoutId()!==W.MAIN_LAYOUT_ID)this.model.getLayouts().delete(this.getLayoutId());else{let t=this.model.getOnCreateTabSet(),e=t?t():{};e={...e,selected:-1};let i=new C(this.model,e);this.model.setActiveTabset(i,this.getLayoutId()),this.addChild(i)}}canDrop(t,e,i){let o,a=i-this.rect.y,s=e-this.rect.x,n=this.rect.width,r=this.rect.height,l=this.model.isEnableEdgeDockIndicators()?50:9999,d=this.getLayout();if(this.getLayoutId()===W.MAIN_LAYOUT_ID||D(t,d)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(e<this.rect.x+10&&a>r/2-l&&a<r/2+l){let t=_.LEFT,e=t.getDockRect(this.rect);e.width=e.width/2,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this.rect.getRight()-10&&a>r/2-l&&a<r/2+l){let t=_.RIGHT,e=t.getDockRect(this.rect);e.width=e.width/2,e.x+=e.width,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this.rect.y+10&&s>n/2-l&&s<n/2+l){let t=_.TOP,e=t.getDockRect(this.rect);e.height=e.height/2,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getBottom()-10&&s>n/2-l&&s<n/2+l){let t=_.BOTTOM,e=t.getDockRect(this.rect);e.height=e.height/2,e.y+=e.height,o=new m(this,e,t,-1,T.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==o&&!t.canDockInto(t,o))return}return o}}drop(e,i,o){let a,s=e.getParent();if(s&&s.removeChild(e),void 0!==s&&s instanceof C&&s.setSelected(0),void 0!==s&&s instanceof U&&s.setSelected(-1),e instanceof C||e instanceof t)(a=e)instanceof t&&a.getOrientation()===this.getOrientation()&&(i.getOrientation()===this.getOrientation()||i===_.CENTER)&&(a=new t(this.model,{})).addChild(e);else{let t=this.model.getOnCreateTabSet(),i=t?t(e):{};(a=new C(this.model,i)).addChild(e)}let n=this.children.reduce((t,e)=>t+e.getWeight(),0);0===n&&(n=100),a.setWeight(n/3);let r=!this.model.isRootOrientationVertical();if(i===_.CENTER)-1===o?this.addChild(a,this.children.length):this.addChild(a,o);else if(r&&i===_.LEFT||!r&&i===_.TOP)this.addChild(a,0);else if(r&&i===_.RIGHT||!r&&i===_.BOTTOM)this.addChild(a);else if(r&&i===_.TOP||!r&&i===_.LEFT){let e=new t(this.model,{}),i=new t(this.model,{});for(let t of(i.setWeight(75),a.setWeight(25),this.children))i.addChild(t);this.removeAll(),e.addChild(a),e.addChild(i),this.addChild(e)}else if(r&&i===_.BOTTOM||!r&&i===_.RIGHT){let e=new t(this.model,{}),i=new t(this.model,{});for(let t of(i.setWeight(75),a.setWeight(25),this.children))i.addChild(t);this.removeAll(),e.addChild(i),e.addChild(a),this.addChild(e)}a instanceof C&&this.model.setActiveTabset(a,this.getLayoutId()),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return t.attributeDefinitions}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}static getAttributeDefinitions(){return t.attributeDefinitions}normalizeWeights(){let t=0;for(let e of this.children)t+=e.getWeight();for(let e of(0===t&&(t=1),this.children))e.setWeight(Math.max(.001,100*e.getWeight()/t))}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("id",void 0).setType(f.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),e.add("weight",100).setType(f.NUMBER).setDescription("relative weight for sizing of this row in parent row"),e}},C=class t extends L{static TYPE="tabset";static fromJson(e,i,o){let a=new t(i,e);if(null!=e.children)for(let t of e.children){let e=y.fromJson(t,i);a.addChild(e)}return 0===a.children.length&&a.setSelected(-1),e.maximized&&!0===e.maximized&&o.setMaximizedTabSet(a),e.active&&!0===e.active&&o.setActiveTabSet(a),a}static attributeDefinitions=t.createAttributeDefinitions();tabStripRect=g.empty();contentRect=g.empty();calculatedMinHeight;calculatedMinWidth;calculatedMaxHeight;calculatedMaxWidth;constructor(e,i){super(e),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,t.attributeDefinitions.fromJson(i,this.attributes),e.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}getSelected(){let t=this.attributes.selected;return void 0!==t?t:-1}getSelectedNode(){let t=this.getSelected();if(-1!==t)return this.children[t]}getWeight(){return this.getAttr("weight")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}isCloseable(){let t=this.isEnableClose();return t&&(t=super.isCloseable()),t}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getLayoutId())===this}isActive(){return this.model.getActiveTabset(this.getLayoutId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableDivide(){return this.getAttr("enableDivide")}isEnableMaximize(){return this.getAttr("enableMaximize")}isEnableClose(){return this.getAttr("enableClose")}isEnableCloseButton(){return this.getAttr("enableCloseButton")}isEnableSingleTabStretch(){return this.getAttr("enableSingleTabStretch")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){let e={};return t.attributeDefinitions.toJson(e,this.attributes),e.children=this.children.map(t=>t.toJson()),this.isActive()&&(e.active=!0),this.isMaximized()&&(e.maximized=!0),e}calcMinMaxSize(){for(let t of(this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth(),this.children))this.calculatedMinWidth=Math.max(this.calculatedMinWidth,t.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,t.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,t.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,t.getMaxHeight());this.calculatedMinHeight+=this.tabStripRect.height,this.calculatedMaxHeight+=this.tabStripRect.height}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getLayoutId())===this||this.getParent()!==this.getModel().getRootRow(this.getLayoutId())||1!==this.getModel().getRootRow(this.getLayoutId()).getChildren().length)}setContentRect(t){this.contentRect=t}getContentRect(){return this.contentRect}setTabStripRect(t){this.tabStripRect=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}canDrop(t,e,i){let o,a=this.getLayout();if(t===this){let t=_.CENTER;o=new m(this,this.tabStripRect,t,-1,T.FLEXLAYOUT__OUTLINE_RECT)}else if(this.getLayoutId()!==W.MAIN_LAYOUT_ID&&!D(t,a))return;else if(this.contentRect.contains(e,i)){let t=_.CENTER;void 0===this.model.getMaximizedTabset(this.getLayoutId())&&(t=_.getLocation(this.contentRect,e,i)),o=new m(this,t.getDockRect(this.rect),t,-1,T.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(e,i)){let t,a,s;if(0===this.children.length)a=(t=this.tabStripRect.clone()).y+3,s=t.height-4,t.width=2;else{let n=this.children[0];a=(t=n.getTabRect()).y,s=t.height;let r=this.tabStripRect.x;for(let s=0;s<this.children.length;s++){(t=(n=this.children[s]).getTabRect()).y!==a&&(a=t.y,r=this.tabStripRect.x);let l=t.x+t.width/2;if(r<=e&&e<l&&t.y<i&&i<t.getBottom()){let e=_.CENTER,i=new g(t.x-2,t.y,3,t.height);if(!(this.rect.x<t.x&&t.x<this.rect.getRight()))return;o=new m(this,i,e,s,T.FLEXLAYOUT__OUTLINE_RECT);break}r=l}}if(null==o&&t.getRight()<this.rect.getRight()){let e=_.CENTER;o=new m(this,new g(t.getRight()-2,a,3,s),e,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT)}}if(t.canDockInto(t,o))return o}delete(){this.parent.removeChild(this)}remove(t){let e=this.removeChild(t);this.model.tidy(),B(this,e)}drop(e,i,o,a){if(this===e)return;let s=e.getParent(),n=0;if(void 0!==s&&(n=s.removeChild(e),s instanceof U&&s.getSelected()===n?s.setSelected(-1):B(s,n)),e instanceof y&&s===this&&n<o&&o>0&&o--,i===_.CENTER){let t=o;if(-1===t&&(t=this.children.length),e instanceof y)this.addChild(e,t),(a||!1!==a&&this.isAutoSelectTab())&&this.setSelected(t);else if(e instanceof I)e.forEachNode((e,i)=>{e instanceof y&&(this.addChild(e,t),t++)},0);else{for(let i=0;i<e.getChildren().length;i++){let o=e.getChildren()[i];this.addChild(o,t),t++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getLayoutId())}else{let o=e;if(e instanceof y){let i=this.model.getOnCreateTabSet();(o=new t(this.model,i?i(e):{})).addChild(e)}else if(e instanceof I){let t=this.getParent();if(e.getOrientation()===t.getOrientation()&&(i.getOrientation()===t.getOrientation()||i===_.CENTER)){let t=new I(this.model,{});t.addChild(e),o=t}}else o=e;let a=this.parent,s=a.getChildren().indexOf(this);if(a.getOrientation()===i.orientation)o.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),a.addChild(o,s+i.indexPlus);else{let t=new I(this.model,{});t.setWeight(this.getWeight()),t.addChild(this),this.setWeight(50),o.setWeight(50),t.addChild(o,i.indexPlus),a.removeChild(this),a.addChild(t,s)}o instanceof t&&this.model.setActiveTabset(o,this.getLayoutId())}this.model.tidy()}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}getAttributeDefinitions(){return t.attributeDefinitions}static getAttributeDefinitions(){return t.attributeDefinitions}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("id",void 0).setType(f.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),e.add("weight",100).setType(f.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),e.add("selected",0).setType(f.NUMBER).setDescription("index of selected/visible tab in tabset"),e.add("name",void 0).setType(f.STRING),e.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),e.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),e.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),e.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),e.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),e.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),e.addInherited("enableClose","tabSetEnableClose").setDescription("can this tabset be closed"),e.addInherited("enableCloseButton","tabSetEnableCloseButton").setDescription("if the tabset can be closed then show a close button"),e.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),e.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),e.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),e.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),e.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),e.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),e.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),e.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("wrap tabs onto multiple lines"),e.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),e.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),e.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(f.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),e.addInherited("enableTabScrollbar","tabSetEnableTabScrollbar").setType(f.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),e}};function B(t,e){if(void 0!==t&&(t instanceof C||t instanceof U)){let i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t.setSelected(t.getChildren().length-1):e<i?t.setSelected(i-1):e>i||t.setSelected(-1))}}function M(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}var U=class t extends L{static TYPE="border";static fromJson(e,i){let o=new t(_.getByName(e.location),e,i);return e.children&&(o.children=e.children.map(t=>{let e=y.fromJson(t,i);return e.setParent(o),e})),o}static attributeDefinitions=t.createAttributeDefinitions();contentRect=g.empty();tabHeaderRect=g.empty();location;constructor(e,i,o){super(o),this.location=e,this.attributes.id=`border_${e.getName()}`,t.attributeDefinitions.fromJson(i,this.attributes),o.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===c.HORZ}getSize(){let t=this.getAttr("size"),e=this.getSelected();if(-1===e)return t;{let i=this.children[e],o=this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight");return -1===o?t:o}}getMinSize(){let t=this.getSelectedNode(),e=this.getAttr("minSize");return t&&(e=Math.max(e,this.isHorizontal()?t.getMinWidth():t.getMinHeight())),e}getMaxSize(){let t=this.getSelectedNode(),e=this.getAttr("maxSize");return t&&(e=Math.min(e,this.isHorizontal()?t.getMaxWidth():t.getMaxHeight())),e}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}getSelectedNode(){if(-1!==this.getSelected())return this.children[this.getSelected()]}getOrientation(){return this.location.getOrientation()}getConfig(){return this.attributes.config}isMaximized(){return!1}isShowing(){return this.attributes.show}toJson(){let e={location:"bottom"};return t.attributeDefinitions.toJson(e,this.attributes),e.location=this.location.getName(),e.children=this.children.map(t=>t.toJson()),e}isAutoSelectTab(t){return(null==t&&(t=-1!==this.getSelected()),t)?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}setSelected(t){this.attributes.selected=t}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(t){this.tabHeaderRect=t}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(t){this.contentRect=t}isEnableDrop(){return this.getAttr("enableDrop")}setSize(t){let e=this.getSelected();if(-1===e)this.attributes.size=t;else{let i=this.children[e];(this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight"))===-1?this.attributes.size=t:this.isHorizontal()?i.setBorderWidth(t):i.setBorderHeight(t)}}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}remove(t){let e=this.removeChild(t);-1!==this.getSelected()&&B(this,e)}canDrop(t,e,i){let o;if(!(t instanceof y))return;let a=_.CENTER;if(this.tabHeaderRect.contains(e,i)){if(this.location.orientation===c.VERT)if(this.children.length>0){let t=this.children[0],i=t.getTabRect(),s=i.y,n=i.height,r=this.tabHeaderRect.x;for(let l=0;l<this.children.length;l++){let d=(i=(t=this.children[l]).getTabRect()).x+i.width/2;if(e>=r&&e<d){o=new m(this,new g(i.x-2,s,3,n),a,l,T.FLEXLAYOUT__OUTLINE_RECT);break}r=d}null==o&&(o=new m(this,new g(i.getRight()-2,s,3,n),a,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT))}else o=new m(this,new g(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18),a,0,T.FLEXLAYOUT__OUTLINE_RECT);else if(this.children.length>0){let t=this.children[0],e=t.getTabRect(),s=e.x,n=e.width,r=this.tabHeaderRect.y;for(let l=0;l<this.children.length;l++){let d=(e=(t=this.children[l]).getTabRect()).y+e.height/2;if(i>=r&&i<d){o=new m(this,new g(s,e.y-2,n,3),a,l,T.FLEXLAYOUT__OUTLINE_RECT);break}r=d}null==o&&(o=new m(this,new g(s,e.getBottom()-2,n,3),a,this.children.length,T.FLEXLAYOUT__OUTLINE_RECT))}else o=new m(this,new g(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3),a,0,T.FLEXLAYOUT__OUTLINE_RECT);if(!t.canDockInto(t,o))return}else if(-1!==this.getSelected()&&this.contentRect.contains(e,i)&&(o=new m(this,this.contentRect,a,-1,T.FLEXLAYOUT__OUTLINE_RECT),!t.canDockInto(t,o)))return;return o}drop(e,i,o,a){let s=0,n=e.getParent();void 0!==n&&(s=n.removeChild(e),n!==this&&n instanceof t&&n.getSelected()===s?n.setSelected(-1):B(n,s)),e instanceof y&&n===this&&s<o&&o>0&&o--;let r=o;-1===r&&(r=this.children.length),e instanceof y&&this.addChild(e,r),(a||!1!==a&&this.isAutoSelectTab())&&this.setSelected(r),this.model.tidy()}getSplitterBounds(t,e=!1){let i=[0,0],o=e?this.getMinSize():0,a=e?this.getMaxSize():99999,s=this.model.getRootRow(W.MAIN_LAYOUT_ID),n=s.getRect(),r=this.model.getSplitterSize();if(this.location===_.TOP){i[0]=this.tabHeaderRect.getBottom()+o;let t=this.tabHeaderRect.getBottom()+a;i[1]=Math.max(i[0],n.getBottom()-s.getMinHeight()-r),i[1]=Math.min(i[1],t)}else if(this.location===_.LEFT){i[0]=this.tabHeaderRect.getRight()+o;let t=this.tabHeaderRect.getRight()+a;i[1]=Math.max(i[0],n.getRight()-s.getMinWidth()-r),i[1]=Math.min(i[1],t)}else if(this.location===_.BOTTOM){i[1]=this.tabHeaderRect.y-o-r;let t=this.tabHeaderRect.y-a-r;i[0]=Math.min(i[1],n.y+s.getMinHeight()),i[0]=Math.max(i[0],t)}else if(this.location===_.RIGHT){i[1]=this.tabHeaderRect.x-o-r;let t=this.tabHeaderRect.x-a-r;i[0]=Math.min(i[1],n.x+s.getMinWidth()),i[0]=Math.max(i[0],t)}return i}calculateSplit(t,e){let i=this.getSplitterBounds(e);return this.location===_.BOTTOM||this.location===_.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}getAttributeDefinitions(){return t.attributeDefinitions}static getAttributeDefinitions(){return t.attributeDefinitions}static createAttributeDefinitions(){let e=new E;return e.add("type",t.TYPE,!0).setType(f.STRING).setFixed(),e.add("selected",-1).setType(f.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),e.add("show",!0).setType(f.BOOLEAN).setDescription("show/hide this border"),e.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),e.addInherited("enableDrop","borderEnableDrop").setType(f.BOOLEAN).setDescription("whether tabs can be dropped into this border"),e.addInherited("className","borderClassName").setType(f.STRING).setDescription("class applied to tab button"),e.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),e.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(f.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),e.addInherited("size","borderSize").setType(f.NUMBER).setDescription("size of the tab area when selected"),e.addInherited("minSize","borderMinSize").setType(f.NUMBER).setDescription("the minimum size of the tab area"),e.addInherited("maxSize","borderMaxSize").setType(f.NUMBER).setDescription("the maximum size of the tab area"),e.addInherited("enableAutoHide","borderEnableAutoHide").setType(f.BOOLEAN).setDescription("hide border if it has zero tabs"),e.addInherited("enableTabScrollbar","borderEnableTabScrollbar").setType(f.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),e}},F=class t{static fromJson(e,i){let o=new t(i);for(let t of(o.borders=e.map(t=>U.fromJson(t,i)),o.borders))o.borderMap.set(t.getLocation(),t);return o}borders;borderMap;layoutHorizontal;constructor(t){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map(t=>t.toJson())}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(t){for(let e of this.borders)for(let i of(t(e,0),e.getChildren()))i.forEachNode(t,1)}setPaths(){for(let t of this.borders){let e="/border/"+t.getLocation().getName();t.setPath(e);let i=0;for(let o of t.getChildren())o.setPath(e+"/t"+i),i++}}findDropTargetNode(t,e,i){for(let o of this.borders)if(o.isShowing()){let a=o.canDrop(t,e,i);if(void 0!==a)return a}}},P=class t{_layoutId;_type;_rect;_controller;_rootRow;_maximizedTabSet;_activeTabSet;_toExportRectFunction;constructor(t,e,i){this._layoutId=t,this._type=e,this._rect=i,this._toExportRectFunction=(t,e)=>t}visitNodes(t){this.getRootRow()?.forEachNode(t,0)}isMainLayout(){return this._layoutId===W.MAIN_LAYOUT_ID}getLayoutId(){return this._layoutId}getType(){return this._type}setType(t){this._type=t}getRect(){return this._rect}getController(){return this._controller}getWindow(){return this._controller?.getCurrentWindow()}getRootRow(){return this._rootRow}getMaximizedTabSet(){return this._maximizedTabSet}getActiveTabSet(){return this._activeTabSet}setRect(t){this._rect=t}setController(t){this._controller=t}getWindowId(){return this._controller?.getWindowId()}setRootRow(t){t?.setLayout(this),this._rootRow=t}setMaximizedTabSet(t){this._maximizedTabSet=t}setActiveTabSet(t){this._activeTabSet=t}getToExportRectFunction(){return this._toExportRectFunction}setToExportRectFunction(t){this._toExportRectFunction=t}toJson(){return"window"===this.getType()&&this.getWindow()&&this.getWindow().screenTop>-1e4&&this.setRect(new g(this.getWindow().screenLeft,this.getWindow().screenTop,this.getWindow().outerWidth,this.getWindow().outerHeight)),{type:this.getType(),layout:this.getRootRow().toJson(),rect:"tab"===this.getType()?void 0:this.getRect().toJson()}}static fromJson(e,i,o){let a=i.getLayouts().size,s=e.rect?g.fromJson(e.rect):new g(50+50*a,50+50*a,600,400);s.snap(10);let n=new t(o,e.type||"window",s);return n.setRootRow(I.fromJson(e.layout,i,n)),n}},Y=99999,W=class t{static MAIN_LAYOUT_ID="__main_layout_id__";static attributeDefinitions=t.createAttributeDefinitions();attributes;layouts;borders;changeListeners;idMap;mainLayout;splitterSize;onAllowDrop;onCreateTabSet;constructor(){this.attributes={},this.layouts=new Map,this.borders=new F(this),this.idMap=new Map,this.changeListeners=[],this.mainLayout=new P(t.MAIN_LAYOUT_ID,"window",g.empty()),this.layouts.set(t.MAIN_LAYOUT_ID,this.mainLayout),this.splitterSize=8}doAction(e){let i;switch(e.type){case p.ADD_TAB:{let t=new y(this,e.data.json,!0),o=this.idMap.get(e.data.toNode);(o instanceof C||o instanceof U||o instanceof I)&&(o.drop(t,_.getByName(e.data.location),e.data.index,e.data.select),i=t);break}case p.MOVE_NODE:{let t=this.idMap.get(e.data.fromNode);if(t instanceof y||t instanceof C||t instanceof I){t===this.getMaximizedTabset(t.getLayoutId())&&this.layouts.get(t.getLayoutId()).setMaximizedTabSet(void 0);let i=this.idMap.get(e.data.toNode);(i instanceof C||i instanceof U||i instanceof I)&&i.drop(t,_.getByName(e.data.location),e.data.index,e.data.select)}break}case p.DELETE_TAB:{let t=this.idMap.get(e.data.node);t instanceof y&&t.delete();break}case p.DELETE_TABSET:{let t=this.idMap.get(e.data.node);if(t instanceof C){let e=[...t.getChildren()];for(let t=0;t<e.length;t++){let i=e[t];i.isEnableClose()&&i.delete()}0===t.getChildren().length&&t.delete(),this.tidy()}break}case p.POPOUT_TABSET:{let t=this.idMap.get(e.data.node);if(t instanceof C){let i=t.isMaximized(),o=t.getLayout(),a=M(),s=e.data.type||"window",n=new P(a,s,o.getToExportRectFunction()(t.getRect(),s)),r=I.fromJson({type:"row"},this,n);n.setRootRow(r),this.layouts.set(a,n),r.drop(t,_.CENTER,0),i&&this.mainLayout.setMaximizedTabSet(void 0)}break}case p.POPOUT_TAB:{let t=this.idMap.get(e.data.node);if(t instanceof y){let i=M(),o=t.getParent().getContentRect(),a=t.getLayout(),s=e.data.type||"window",n=new P(i,s,a.getToExportRectFunction()(o,s)),r=M(),l=I.fromJson({type:"row",children:[{type:"tabset",id:r}]},this,n);n.setRootRow(l),this.layouts.set(i,n),this.idMap.get(r).drop(t,_.CENTER,0,!0)}break}case p.SELECT_TAB:{let t=this.idMap.get(e.data.tabNode);if(t instanceof y){let e=t.getParent(),i=e.getChildren().indexOf(t);e instanceof U?e.getSelected()===i?e.setSelected(-1):e.setSelected(i):e instanceof C&&(e.getSelected()!==i&&e.setSelected(i),t.getLayout().setActiveTabSet(e))}break}case p.SET_ACTIVE_TABSET:{let i=e.data.layoutId?e.data.layoutId:t.MAIN_LAYOUT_ID,o=this.layouts.get(i);if(void 0===e.data.tabsetNode)o.setActiveTabSet(void 0);else{let t=this.idMap.get(e.data.tabsetNode);t instanceof C&&o.setActiveTabSet(t)}break}case p.ADJUST_WEIGHTS:{let t=this.idMap.get(e.data.nodeId).getChildren();for(let i=0;i<t.length;i++)t[i].setWeight(e.data.weights[i]);break}case p.ADJUST_BORDER_SPLIT:{let t=this.idMap.get(e.data.node);t instanceof U&&t.setSize(e.data.size);break}case p.MAXIMIZE_TOGGLE:{let i=e.data.layoutId?e.data.layoutId:t.MAIN_LAYOUT_ID,o=this.layouts.get(i),a=this.idMap.get(e.data.node);a instanceof C&&(a===o.getMaximizedTabSet()?o.setMaximizedTabSet(void 0):(o.setMaximizedTabSet(a),o.setActiveTabSet(a)));break}case p.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(e.data.json);break;case p.UPDATE_NODE_ATTRIBUTES:this.idMap.get(e.data.node).updateAttrs(e.data.json);break;case p.RENAME_TAB:{let t=this.idMap.get(e.data.node);t instanceof y&&t.setName(e.data.text);break}case p.CREATE_SUBLAYOUT:{let t=M(),o=new P(t,e.data.type||"window",g.fromJson(e.data.rect)),a=I.fromJson(e.data.layout,this,o);o.setRootRow(a),this.layouts.set(t,o),i=t;break}case p.CLOSE_POPOUT:{let t=this.layouts.get(e.data.layoutId);if(t){t.setType("float");let e=this.mainLayout.getController().getDomRect();t.setRect(new g(e.width/4,e.height/4,e.width/2,e.height/2))}break}case p.MOVE_POPOUT_TO_FRONT:{let t=e.data.layoutId,i=this.layouts.get(t);i&&(this.layouts.delete(t),this.layouts.set(t,i))}}for(let t of(this.updateIdMap(),this.changeListeners))t(e);return i}getActiveTabset(e=t.MAIN_LAYOUT_ID){let i=this.layouts.get(e);return i&&i.getActiveTabSet()&&this.getNodeById(i.getActiveTabSet().getId())?i.getActiveTabSet():void 0}getMaximizedTabset(e=t.MAIN_LAYOUT_ID){return this.layouts.get(e).getMaximizedTabSet()}getRootRow(e=t.MAIN_LAYOUT_ID){return this.layouts.get(e).getRootRow()}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}visitNodes(t){for(let[e,i]of(this.borders.forEachNode(t),this.layouts))i.getRootRow().forEachNode(t,0)}visitLayoutNodes(e,i){this.layouts.has(e)&&(e===t.MAIN_LAYOUT_ID&&this.borders.forEachNode(i),this.layouts.get(e).visitNodes(i))}getNodeById(t){return this.idMap.get(t)}getFirstTabSet(e=this.layouts.get(t.MAIN_LAYOUT_ID).getRootRow()){let i=e.getChildren()[0];return i instanceof C?i:this.getFirstTabSet(i)}static fromJson(e){let i=new t;t.attributeDefinitions.fromJson(e.global,i.attributes),e.borders&&(i.borders=F.fromJson(e.borders,i));let o=e.subLayouts||e.popouts;if(o)for(let t in o){let e=o[t],a=P.fromJson(e,i,t);i.layouts.set(t,a)}return i.mainLayout.setRootRow(I.fromJson(e.layout,i,i.mainLayout)),i.tidy(),i}toJson(){let e={};t.attributeDefinitions.toJson(e,this.attributes),this.visitNodes(t=>{t.fireEvent("save",{})});let i={};for(let[e,o]of this.layouts)e!==t.MAIN_LAYOUT_ID&&(i[e]=o.toJson());return{global:e,borders:this.borders.toJson(),layout:this.mainLayout.getRootRow().toJson(),subLayouts:i}}getSplitterSize(){return this.splitterSize}setSplitterSize(t){this.splitterSize=t}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isEnableEdgeDockIndicators(){return this.attributes.enableEdgeDockIndicators}setOnAllowDrop(t){this.onAllowDrop=t}setOnCreateTabSet(t){this.onCreateTabSet=t}addChangeListener(t){this.changeListeners.push(t)}removeChangeListener(t){let e=this.changeListeners.findIndex(e=>e===t);-1!==e&&this.changeListeners.splice(e,1)}toString(){return JSON.stringify(this.toJson())}getMainLayout(){return this.mainLayout}getLayouts(){return this.layouts}sortLayouts(){let t={window:1,tab:2,float:3},e=Array.from(this.getLayouts().values()).sort((e,i)=>t[e.getType()]-t[i.getType()]);this.layouts.clear(),e.forEach(t=>this.layouts.set(t.getLayoutId(),t))}setActiveTabset(t,e){let i=this.layouts.get(e);i&&(t?i.setActiveTabSet(t):i.setActiveTabSet(void 0))}setMaximizedTabset(t,e){let i=this.layouts.get(e);i&&(t?i.setMaximizedTabSet(t):i.setMaximizedTabSet(void 0))}updateIdMap(){this.idMap.clear(),this.visitNodes(t=>{this.idMap.set(t.getId(),t)})}addNode(t){let e=t.getId();if(this.idMap.has(e))throw Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);this.idMap.set(e,t)}findDropTargetNode(e,i,o,a){let s=this.layouts.get(e).getRootRow().findDropTargetNode(e,i,o,a);return void 0===s&&e===t.MAIN_LAYOUT_ID&&(s=this.borders.findDropTargetNode(i,o,a)),s}tidy(){for(let[t,e]of this.layouts)e.getRootRow().tidy()}updateAttrs(e){t.attributeDefinitions.update(e,this.attributes)}nextUniqueId(){return"#"+M()}getAttribute(t){return this.attributes[t]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){t.attributeDefinitions.pairAttributes("RowNode",I.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("TabSetNode",C.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("TabNode",y.getAttributeDefinitions()),t.attributeDefinitions.pairAttributes("BorderNode",U.getAttributeDefinitions());let e=[];e.push(t.attributeDefinitions.toTypescriptInterface("Global",void 0)),e.push(I.getAttributeDefinitions().toTypescriptInterface("Row",t.attributeDefinitions)),e.push(C.getAttributeDefinitions().toTypescriptInterface("TabSet",t.attributeDefinitions)),e.push(y.getAttributeDefinitions().toTypescriptInterface("Tab",t.attributeDefinitions)),e.push(U.getAttributeDefinitions().toTypescriptInterface("Border",t.attributeDefinitions)),console.log(e.join("\n"))}static createAttributeDefinitions(){let t=new E;return t.add("enableEdgeDock",!0).setType(f.BOOLEAN).setDescription("enable docking to the edges of the layout"),t.add("enableEdgeDockIndicators",!0).setType(f.BOOLEAN).setDescription("show the edge indicators when dragging"),t.add("rootOrientationVertical",!1).setType(f.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),t.add("enableRotateBorderIcons",!0).setType(f.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),t.add("tabEnableClose",!0).setType(f.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnablePopout",!1).setType(f.BOOLEAN).setAlias("tabEnableFloat"),t.add("tabEnablePopoutIcon",!0).setType(f.BOOLEAN),t.add("tabEnablePopoutFloatIcon",!1).setType(f.BOOLEAN),t.add("tabEnablePopoutOverlay",!1).setType(f.BOOLEAN),t.add("tabEnableDrag",!0).setType(f.BOOLEAN),t.add("tabEnableRename",!0).setType(f.BOOLEAN),t.add("tabContentClassName",void 0).setType(f.STRING),t.add("tabClassName",void 0).setType(f.STRING),t.add("tabIcon",void 0).setType(f.STRING),t.add("tabEnableRenderOnDemand",!0).setType(f.BOOLEAN),t.add("tabBorderWidth",-1).setType(f.NUMBER),t.add("tabBorderHeight",-1).setType(f.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(f.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(f.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(f.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(f.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(f.BOOLEAN),t.add("tabSetEnableClose",!0).setType(f.BOOLEAN),t.add("tabSetEnableCloseButton",!1).setType(f.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(f.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(f.BOOLEAN),t.add("tabSetEnableActiveIcon",!1).setType(f.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(f.STRING),t.add("tabSetEnableTabStrip",!0).setType(f.BOOLEAN),t.add("tabSetEnableTabWrap",!1).setType(f.BOOLEAN),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabMinWidth",1).setType(f.NUMBER),t.add("tabMinHeight",1).setType(f.NUMBER),t.add("tabSetMinWidth",1).setType(f.NUMBER),t.add("tabSetMinHeight",1).setType(f.NUMBER),t.add("tabMaxWidth",Y).setType(f.NUMBER),t.add("tabMaxHeight",Y).setType(f.NUMBER),t.add("tabSetMaxWidth",Y).setType(f.NUMBER),t.add("tabSetMaxHeight",Y).setType(f.NUMBER),t.add("tabSetEnableTabScrollbar",!1).setType(f.BOOLEAN),t.add("borderSize",200).setType(f.NUMBER),t.add("borderMinSize",1).setType(f.NUMBER),t.add("borderMaxSize",Y).setType(f.NUMBER),t.add("borderEnableDrop",!0).setType(f.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(f.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(f.BOOLEAN),t.add("borderClassName",void 0).setType(f.STRING),t.add("borderEnableAutoHide",!1).setType(f.BOOLEAN),t.add("borderEnableTabScrollbar",!1).setType(f.BOOLEAN),t}},X={width:"1em",height:"1em",display:"flex",alignItems:"center"},j=()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]}),H=t=>{let{controller:e,show:i}=t;return(0,n.jsx)("div",{className:e.getClassName(T.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:i?"flex":"none"}})},z=((i={}).Close_Tab="Close",i.Close_Tabset="Close tab set",i.Active_Tabset="Active tab set",i.Move_Tabset="Move tab set",i.Move_Tabs="Move tabs(?)",i.Maximize="Maximize tab set",i.Restore="Restore tab set",i.Popout_Tab="Popout selected tab",i.Popout_Tab_Float="Float selected tab",i.Overflow_Menu_Tooltip="Hidden tabs",i.Error_rendering_component="Error rendering component",i.Error_rendering_component_retry="Retry",i),k=t=>{let{controller:e,tabNode:i}=t,o=e.getClassName,a=o(T.FLEXLAYOUT__TAB_BUTTON_STAMP),s=R(e,i),r=s.content?(0,n.jsx)("div",{className:o(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:s.content}):i.getNameForOverflowMenu(),l=s.leading?(0,n.jsx)("div",{className:o(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:s.leading}):null;return(0,n.jsxs)("div",{className:a,title:i.getHelpText(),children:[l,r]})};function G(t,e,i,o,a){let s=a.getRootDiv(),r=a.getClassName,l=t.ownerDocument,d=t.getBoundingClientRect(),h=s?.getBoundingClientRect()??new DOMRect(0,0,100,100),u=l.createElement("div");u.className=r(T.FLEXLAYOUT__POPUP_MENU_CONTAINER),d.left<h.left+h.width/2?u.style.left=d.left-h.left+"px":u.style.right=h.right-d.right+"px",d.top<h.top+h.height/2?u.style.top=d.top-h.top+"px":u.style.bottom=h.bottom-d.bottom+"px",a.showOverlayOnAllWindows(!0),s&&s.appendChild(u);let c=()=>{a.hideControlInPortal(),a.showOverlayOnAllWindows(!1),s&&s.removeChild(u),u.removeEventListener("pointerdown",g),l.removeEventListener("pointerdown",_)},g=t=>{t.stopPropagation()},_=t=>{c()};u.addEventListener("pointerdown",g),l.addEventListener("pointerdown",_),a.showControlInPortal((0,n.jsx)(V,{currentDocument:l,parentNode:e,onSelect:o,onHide:c,items:i,classNameMapper:r,controller:a}),u)}var V=t=>{let{parentNode:e,items:i,onHide:o,onSelect:a,classNameMapper:s,controller:r}=t,l=(0,d.useRef)(null);(0,d.useEffect)(()=>{l.current&&l.current.focus()},[]);let h=t=>{r.getDragDropManager().clearDragMain()},u=i.map((t,i)=>{let l=s(T.FLEXLAYOUT__POPUP_MENU_ITEM);return e.getSelected()===t.index&&(l+=" "+s(T.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED)),(0,n.jsx)("div",{className:l,"data-layout-path":"/popup-menu/tb"+i,onClick:e=>{a(t),o(),e.stopPropagation()},draggable:!0,onDragStart:e=>{var i;return i=t.node,void(e.stopPropagation(),r.getDragDropManager().setDragNode(e.nativeEvent,i),setTimeout(()=>{o()},0))},onDragEnd:h,title:t.node.getHelpText(),children:(0,n.jsx)(k,{tabNode:t.node,controller:r})},t.index)});return(0,n.jsx)("div",{className:s(T.FLEXLAYOUT__POPUP_MENU),ref:l,tabIndex:0,onKeyDown:t=>{"Escape"===t.key&&o()},"data-layout-path":"/popup-menu",children:u})},J=((o={})[o.Visible=1]="Visible",o[o.Always=2]="Always",o[o.Selected=3]="Selected",o),Z=t=>{let{controller:e,tabNode:i,selected:o,path:a}=t,s=d.useRef(null),r=d.useRef(null),l=e.getIcons();d.useLayoutEffect(()=>{i.setTabRect(e.getBoundingClientRect(s.current)),e.getEditingTab()===i&&r.current.select()});let h=t=>{t.target!==r.current&&(e.getCurrentDocument().body.removeEventListener("pointerdown",h),e.setEditingTab(void 0))},u=e.getClassName,c=i.getParent(),g=c.isEnableSingleTabStretch()&&1===c.getChildren().length,_=g?T.FLEXLAYOUT__TAB_BUTTON_STRETCH:T.FLEXLAYOUT__TAB_BUTTON,b=u(_);b+=" "+u(_+"_"+c.getTabLocation()),g||(o?b+=" "+u(_+"--selected"):b+=" "+u(_+"--unselected")),void 0!==i.getClassName()&&(b+=" "+i.getClassName());let E=R(e,i),f=E.content?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:E.content}):null,m=E.leading?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__TAB_BUTTON_LEADING),children:E.leading}):null;if(e.getEditingTab()===i&&(f=(0,n.jsx)("input",{ref:r,className:u(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":a+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):("Enter"===t.code||"NumpadEnter"===t.code)&&(e.setEditingTab(void 0),e.doAction(p.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isCloseable()&&!g){let t=e.i18nName(z.Close_Tab);E.buttons.push((0,n.jsx)("div",{"data-layout-path":a+"/button/close",title:t,className:u(T.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:t=>{t.stopPropagation()},onClick:t=>{let a;a=i.getCloseType(),(o||a===J.Always||a===J.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(e.doAction(p.deleteTab(i.getId())),t.stopPropagation())},children:"function"==typeof l.close?l.close(i):l.close},"close"))}return(0,n.jsxs)("div",{ref:s,"data-layout-path":a,className:b,onClick:()=>{e.doAction(p.selectTab(i.getId()))},onAuxClick:t=>{O(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.getDragDropManager().setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{e.getDragDropManager().clearDragMain()},onDoubleClick:t=>{i.isEnableRename()&&(e.setEditingTab(i),e.getCurrentDocument().body.addEventListener("pointerdown",h),t.stopPropagation())},children:[m,f,E.buttons]})},$=(t,e,i,o,a,s)=>{let[n,r]=d.useState([]),[l,h]=d.useState(!1),[u,g]=d.useState(!1),_=d.useRef(null),T=d.useRef(!1),p=d.useRef(void 0),b=d.useRef([]),E=d.useRef(0),f=d.useRef(!1);b.current=n,d.useLayoutEffect(()=>{o.current&&B(0)},[e.getId()]),d.useLayoutEffect(()=>{T.current=!1},[e.getSelectedNode(),e.getRect().width,e.getRect().height]),d.useLayoutEffect(()=>{v(),!1===T.current&&function(){let i=e.getSelectedNode();if(i&&o.current){let e=t.getBoundingClientRect(o.current),a=i.getTabRect(),s=w(e)-w(a);s>0||I(a)>I(e)?(B(M(o.current)-s),f.current=!0):(s=D(a)-D(e))>0&&(B(M(o.current)+s),f.current=!0)}}(),L(),y()}),d.useEffect(()=>(_.current?.addEventListener("wheel",m,{passive:!1}),()=>{_.current?.removeEventListener("wheel",m)}),[_.current]);let m=t=>{t.preventDefault()},L=()=>{if(o.current&&a.current){let t=o.current,e=a.current,s=S(t),n=C(t),r=M(t);if(n>s&&n>0){let t=s*s/n,o=0;t<20&&(o=20-t,t=20);let a=r*(s-o)/n;i===c.HORZ?(e.style.width=t+"px",e.style.left=a+"px"):(e.style.height=t+"px",e.style.top=a+"px"),e.style.display="block"}else e.style.display="none";i===c.HORZ?e.style.bottom="0px":e.style.right="0px"}},y=()=>{let t=x().length>0;t!==l&&h(t),void 0===p.current&&(p.current=setTimeout(()=>{var t,e;let i=x();t=i,e=b.current,t.length===e.length&&t.every((t,i)=>t===e[i])||r(i),p.current=void 0},100))},A=(t,e)=>{if(o.current&&a.current){let s,n=o.current,r=a.current,l=S(n),d=C(n),h=S(r),u=n.getBoundingClientRect();s=Math.max(0,Math.min(d-h,s=i===c.HORZ?t-u.x-E.current:e-u.y-E.current)),l>0&&B(s*d/l)}},R=()=>{},O=()=>{},v=()=>{if(o.current){let t=S(o.current.firstElementChild)+10*!!u>S(o.current);t!==u&&g(t)}},x=()=>{let t=[];if(o.current){let e=o.current,i=e.getBoundingClientRect(),a=w(i)-1,n=D(i)+1,r=e.firstElementChild,l=0;Array.from(r.children).forEach(e=>{let i=e.getBoundingClientRect();e.classList.contains(s)&&((w(i)<a||D(i)>n)&&t.push(l),l++)})}return t},w=t=>i===c.HORZ?t.x:t.y,D=t=>i===c.HORZ?t.right:t.bottom,S=t=>i===c.HORZ?t.clientWidth:t.clientHeight,I=t=>i===c.HORZ?t.width:t.height,C=t=>i===c.HORZ?t.scrollWidth:t.scrollHeight,B=t=>{i===c.HORZ?o.current.scrollLeft=t:o.current.scrollTop=t},M=t=>i===c.HORZ?t.scrollLeft:t.scrollTop;return{selfRef:_,userControlledPositionRef:T,onScroll:()=>{f.current||(T.current=!0),f.current=!1,L(),y()},onScrollPointerDown:t=>{t.stopPropagation(),a.current.setPointerCapture(t.pointerId);let e=a.current.getBoundingClientRect();i===c.HORZ?E.current=t.clientX-e.x:E.current=t.clientY-e.y,N(t.currentTarget.ownerDocument,t,A,R,O)},hiddenTabs:n,onMouseWheel:t=>{if(o.current){let i;if(0!==e.getChildren().length&&Math.abs(t.deltaY)>0){i=-t.deltaY,1===t.deltaMode&&(i*=40);let e=M(o.current)-i;B(Math.max(0,Math.min(C(o.current)-S(o.current),e))),t.stopPropagation()}}},isDockStickyButtons:u,isShowHiddenTabs:l}},q=t=>{let{tabsetNode:e,controller:i}=t,o=d.useRef(null),a=d.useRef(null),s=d.useRef(null),r=d.useRef(null),l=d.useRef(null),u=d.useRef(null),g=d.useRef(null),_=i.getIcons();d.useLayoutEffect(()=>{e.setRect(i.getBoundingClientRect(b.current)),o.current&&e.setTabStripRect(i.getBoundingClientRect(o.current));let t=i.getBoundingClientRect(r.current);e.getContentRect().equalsWhenRounded(t)||isNaN(t.x)||(e.setContentRect(t),i.setReLayout(!0))});let{selfRef:b,userControlledPositionRef:E,onScroll:f,onScrollPointerDown:m,hiddenTabs:L,onMouseWheel:y,isDockStickyButtons:A,isShowHiddenTabs:R}=$(i,e,c.HORZ,s,a,i.getClassName(T.FLEXLAYOUT__TAB_BUTTON)),v=t=>{let o=i.getShowOverflowMenu(),a=L.map(t=>({index:t,node:e.getChildren()[t]}));void 0!==o?o(e,t,a,x):G(u.current,e,a,x,i),t.stopPropagation()},x=t=>{i.doAction(p.selectTab(t.node.getId())),E.current=!1},w=t=>{i.getEditingTab()?t.preventDefault():e.isEnableDrag()?(t.stopPropagation(),i.getDragDropManager().setDragNode(t.nativeEvent,e)):t.preventDefault()},N=t=>{O(t)||i.doAction(p.setActiveTabset(e.getId(),i.getLayoutId()))},D=t=>{O(t)&&i.auxMouseClick(e,t)},S=t=>{i.showContextMenu(e,t)},I=t=>{t.stopPropagation()},C=t=>{e.canMaximize()&&i.maximize(e),t.stopPropagation()},B=t=>{i.doAction(p.deleteTabset(e.getId())),t.stopPropagation()},M=t=>{i.doAction(p.deleteTab(e.getChildren()[0].getId())),t.stopPropagation()},U=t=>{void 0!==W&&i.doAction(p.popoutTab(W.getId(),"window")),t.stopPropagation()},F=t=>{void 0!==W&&i.doAction(p.popoutTab(W.getId(),"float")),t.stopPropagation()},P=t=>{e.canMaximize()&&i.maximize(e)},Y=i.getClassName,W=e.getSelectedNode(),X=e.getPath(),j=(()=>{let t=[],o=!1;if(e.isEnableTabStrip()){let a=e.isEnableSingleTabStretch()&&1===e.getChildren().length;for(let s=0;s<e.getChildren().length;s++){let r=e.getChildren()[s],l=e.getSelected()===s,d=Y(T.FLEXLAYOUT__TABSET_TAB_SPACER);0!==s&&(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER)),e.isEnableTabWrap()||a||(l?d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):o&&(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),t.push((0,n.jsx)("div",{className:d,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+s)),t.push((0,n.jsx)(Z,{controller:i,tabNode:r,path:X+"/tb"+s,selected:l},r.getId())),s===e.getChildren().length-1&&(d=Y(T.FLEXLAYOUT__TABSET_TAB_SPACER),e.isEnableTabWrap()||a||!l||(d+=" "+Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),t.push((0,n.jsx)("div",{className:d,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+(s+1)))),o=l}}return t})(),{leading:H,buttonbar:k}=(t=>{let o,a=[],s=[],r={leading:o,stickyButtons:a,buttons:s,overflowPosition:void 0};i.customizeTabSet(e,r),o=r.leading,a=r.stickyButtons,s=r.buttons;let d=e.isEnableSingleTabStretch()&&1===e.getChildren().length,h=d&&e.getChildren()[0].isCloseable()||e.isCloseable();if(h=h&&e.isEnableCloseButton(),void 0===r.overflowPosition&&(r.overflowPosition=a.length),a.length>0&&(!e.isEnableTabWrap()&&(A||d)?s=[...a,...s]:t.push((0,n.jsx)("div",{ref:g,onPointerDown:I,onDragStart:t=>{t.preventDefault()},className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:a},"sticky_buttons_container"))),!e.isEnableTabWrap()&&R){let t,o=i.i18nName(z.Overflow_Menu_Tooltip);if("function"==typeof _.more){let i=L.map(t=>({index:t,node:e.getChildren()[t]}));t=_.more(e,i)}else t=(0,n.jsxs)(n.Fragment,{children:[_.more,(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:L.length>0?L.length:""})]});s.splice(Math.min(r.overflowPosition,s.length),0,(0,n.jsx)("button",{"data-layout-path":X+"/button/overflow",ref:u,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:o,onClick:v,onPointerDown:I,children:t},"overflowbutton"))}if(void 0!==W){if(W.isEnablePopoutFloatIcon()){let t=i.i18nName(z.Popout_Tab_Float);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/popout-float",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:F,onPointerDown:I,children:"function"==typeof _.popoutFloat?_.popoutFloat(W):_.popoutFloat},"popout-float"))}if(i.isSupportsPopout()&&W.isAllowedInWindow()&&W.isEnablePopout()){let t=i.i18nName(z.Popout_Tab);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/popout",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:U,onPointerDown:I,children:"function"==typeof _.popout?_.popout(W):_.popout},"popout"))}}if(e.canMaximize()){let t=i.i18nName(z.Restore),o=i.i18nName(z.Maximize);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/max",title:e.isMaximized()?t:o,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(e.isMaximized()?"max":"min")),onClick:C,onPointerDown:I,children:e.isMaximized()?"function"==typeof _.restore?_.restore(e):_.restore:"function"==typeof _.maximize?_.maximize(e):_.maximize},"max"))}if(!e.isMaximized()&&h){let t=d?i.i18nName(z.Close_Tab):i.i18nName(z.Close_Tabset);s.push((0,n.jsx)("button",{"data-layout-path":X+"/button/close",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+Y(T.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:d?M:B,onPointerDown:I,children:"function"==typeof _.closeTabset?_.closeTabset(e):_.closeTabset},"close"))}if(e.isActive()&&e.isEnableActiveIcon()){let t=i.i18nName(z.Active_Tabset);s.push((0,n.jsx)("div",{"data-layout-path":X+"/button/active",title:t,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:"function"==typeof _.activeTabset?_.activeTabset(e):_.activeTabset},"active"))}return{leading:o,buttonbar:(0,n.jsx)("div",{ref:l,className:Y(T.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:I,onDragStart:t=>{t.preventDefault()},children:s},"buttonbar")}})(j),V=(t=>{let o;if(0===e.getChildren().length){let t=i.getTabSetPlaceHolderCallback();t&&(o=t(e))}let a=(0,n.jsx)("div",{ref:r,className:Y(T.FLEXLAYOUT__TABSET_CONTENT),children:o});return"top"===e.getTabLocation()?(0,n.jsxs)(n.Fragment,{children:[t,a]}):(0,n.jsxs)(n.Fragment,{children:[a,t]})})(((t,i,r)=>{let l,d,h=Y(T.FLEXLAYOUT__TABSET_TABBAR_OUTER);void 0!==e.getClassNameTabStrip()&&(h+=" "+e.getClassNameTabStrip()),h+=" "+T.FLEXLAYOUT__TABSET_TABBAR_OUTER_+e.getTabLocation(),e.isActive()&&(h+=" "+Y(T.FLEXLAYOUT__TABSET_SELECTED)),e.isMaximized()&&(h+=" "+Y(T.FLEXLAYOUT__TABSET_MAXIMIZED));let u=e.isEnableSingleTabStretch()&&1===e.getChildren().length;if(u){let t=e.getChildren()[0];void 0!==t.getTabSetClassName()&&(h+=" "+t.getTabSetClassName())}if(i&&(l=(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET_LEADING),children:i})),e.isEnableTabWrap())e.isEnableTabStrip()&&(d=(0,n.jsxs)("div",{className:h,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:o,"data-layout-path":X+"/tabstrip",onPointerDown:N,onDoubleClick:P,onContextMenu:S,onClick:D,onAuxClick:D,draggable:!0,onDragStart:w,children:[l,t,(0,n.jsx)("div",{style:{flexGrow:1}}),r]}));else if(e.isEnableTabStrip()){let i;e.isEnableTabScrollbar()&&(i=(0,n.jsx)("div",{ref:a,className:Y(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:m})),d=(0,n.jsxs)("div",{className:h,ref:o,"data-layout-path":X+"/tabstrip",onPointerDown:N,onDoubleClick:P,onContextMenu:S,onClick:D,onAuxClick:D,draggable:!0,onWheel:y,onDragStart:w,children:[l,(0,n.jsxs)("div",{className:Y(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,n.jsx)("div",{ref:s,className:Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_+e.getTabLocation()),style:{overflowX:"auto",overflowY:"hidden"},onScroll:f,children:(0,n.jsx)("div",{style:{width:u?"100%":"none"},className:Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+Y(T.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+e.getTabLocation()),children:t})}),i]}),r]})}return d})(j,H,k)),J={flexGrow:Math.max(1,1e3*e.getWeight()),minWidth:e.getMinWidth(),minHeight:e.getMinHeight(),maxWidth:e.getMaxWidth(),maxHeight:e.getMaxHeight()};void 0===e.getModel().getMaximizedTabset(i.getLayoutId())||e.isMaximized()||(J.display="none");let q=(0,n.jsx)("div",{ref:b,className:Y(T.FLEXLAYOUT__TABSET_CONTAINER),style:J,children:(0,n.jsx)("div",{className:Y(T.FLEXLAYOUT__TABSET),"data-layout-path":X,children:V})});return e.isMaximized()&&i.getMainElement()?(0,h.createPortal)((0,n.jsx)("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0},children:q}),i.getMainElement()):q},K=t=>{let{controller:e,node:i,index:o,horizontal:a}=t,s=d.useRef(null),r=d.useRef(null),l=d.useRef([]),h=d.useRef(void 0),u=d.useRef(void 0),_=d.useRef(0),b=d.useRef(0),E=d.useRef({initialSizes:[],sum:0,startPosition:0});d.useEffect(()=>(s.current?.addEventListener("touchstart",f,{passive:!1}),r.current?.addEventListener("touchstart",f,{passive:!1}),()=>{s.current?.removeEventListener("touchstart",f),r.current?.removeEventListener("touchstart",f)}),[]);let f=t=>{t.preventDefault(),t.stopImmediatePropagation()},m=()=>{let t=e.getRootDiv();t&&h.current&&t.removeChild(h.current),h.current=void 0},L=(t,o)=>{if(h.current){let a=e.getDomRect();a&&(i.getOrientation()===c.VERT?h.current.style.top=O(o-a.y-b.current)+"px":h.current.style.left=O(t-a.x-_.current)+"px",e.isRealtimeResize()&&R(!0))}},y=()=>{if(h.current){R(!1);let t=e.getRootDiv();t&&h.current&&t.removeChild(h.current),h.current=void 0}v(!0,e.getCurrentDocument())},R=t=>{if(h.current){let t;if(t=i.getOrientation()===c.VERT?h.current.offsetTop:h.current.offsetLeft,i instanceof U){let o=i.calculateSplit(i,t);e.doAction(p.adjustBorderSplit(i.getId(),o))}else{let a=E.current,s=i.calculateSplit(o,t,a.initialSizes,a.sum,a.startPosition);e.doAction(p.adjustWeights(i.getId(),s))}}},O=t=>{let e=l.current,i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},x=e.getClassName,w={cursor:a?"ew-resize":"ns-resize",flexDirection:a?"column":"row"},D=x(T.FLEXLAYOUT__SPLITTER)+" "+x(T.FLEXLAYOUT__SPLITTER_+i.getOrientation().getName());return i instanceof U?D+=" "+x(T.FLEXLAYOUT__SPLITTER_BORDER):void 0!==i.getModel().getMaximizedTabset(e.getLayoutId())&&(w.display="none"),A()||(w["--splitter-active-size"]="30px"),(0,n.jsx)("div",{className:D,style:w,ref:s,"data-layout-path":i.getPath()+"/s"+(o-1),onPointerDown:t=>{t.stopPropagation(),i instanceof I&&(E.current=i.getSplitterInitials(o)),v(!1,e.getCurrentDocument()),N(t.currentTarget.ownerDocument,t,L,y,m),l.current=i.getSplitterBounds(o,!0);let n=e.getRootDiv();h.current=e.getCurrentDocument().createElement("div"),h.current.style.flexDirection=a?"row":"column",h.current.className=e.getClassName(T.FLEXLAYOUT__SPLITTER_DRAG)+(i instanceof U?" "+e.getClassName(T.FLEXLAYOUT__SPLITTER_BORDER):""),h.current.style.cursor=i.getOrientation()===c.VERT?"ns-resize":"ew-resize",u.current=e.getCurrentDocument().createElement("div"),u.current.className=x(T.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(a?x(T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):x(T.FLEXLAYOUT__SPLITTER_HANDLE_VERT)),h.current.appendChild(u.current);let r=s.current.getBoundingClientRect(),d=new g(r.x-e.getDomRect().x,r.y-e.getDomRect().y,r.width,r.height);_.current=t.clientX-r.x,b.current=t.clientY-r.y,d.positionElement(h.current),n&&n.appendChild(h.current)},children:(0,n.jsx)("div",{className:x(T.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(a?x(T.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):x(T.FLEXLAYOUT__SPLITTER_HANDLE_VERT))})})},Q=t=>{let{controller:e,rowNode:i}=t,o=d.useRef(null),a=i.getOrientation()===c.HORZ;d.useLayoutEffect(()=>{i.setRect(e.getBoundingClientRect(o.current))});let s=[],r=0;for(let t of i.getChildren())r>0&&s.push((0,n.jsx)(K,{controller:e,node:i,index:r,horizontal:a},"splitter"+r)),t instanceof I?s.push((0,n.jsx)(Q,{controller:e,rowNode:t},t.getId())):t instanceof C&&s.push((0,n.jsx)(q,{controller:e,tabsetNode:t},t.getId())),r++;let l={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};return a?l.flexDirection="row":l.flexDirection="column",(0,n.jsx)("div",{ref:o,className:e.getClassName(T.FLEXLAYOUT__ROW),style:l,children:s})},tt=t=>{let{controller:e,selected:i,tabNode:o}=t,a=d.useRef(null),s=d.useRef(!0),r=o.getParent(),l=r.getContentRect();d.useLayoutEffect(()=>{let t=()=>{o.saveScrollPosition()},i=o.getMoveableElement();return i&&(a.current.appendChild(i),i.addEventListener("scroll",t)),a.current.addEventListener("pointerdown",h),()=>{a.current&&a.current.removeEventListener("pointerdown",h),i&&(o.isEnableWindowReMount()||e.getMainController()?.getMoveablesDiv()?.appendChild(i),i.removeEventListener("scroll",t)),o.setVisible(!1)}},[o.getMoveableElement()]),d.useEffect(()=>{o.isSelected()&&s.current&&(o.restoreScrollPosition(),s.current=!1)});let h=()=>{let t=o.getParent();t instanceof C&&!t.isActive()&&e.doAction(p.setActiveTabset(t.getId(),e.getLayoutId()))};o.setRect(l);let u=e.getClassName,c={};l.styleWithPosition(c);let g=null;if(i){if(o.setVisible(!0),document.hidden&&o.isEnablePopoutOverlay()){let t={};l.styleWithPosition(t),g=(0,n.jsx)("div",{style:t,className:u(T.FLEXLAYOUT__TAB_OVERLAY)})}}else c.display="none",o.setVisible(!1);r instanceof C&&void 0!==o.getModel().getMaximizedTabset(e.getLayoutId())&&!r.isMaximized()&&(c.display="none"),r instanceof U&&!r.isShowing()&&(c.display="none");let _=u(T.FLEXLAYOUT__TAB);return r instanceof U&&(_+=" "+u(T.FLEXLAYOUT__TAB_BORDER),_+=" "+u(T.FLEXLAYOUT__TAB_BORDER_+r.getLocation().getName())),void 0!==o.getContentClassName()&&(_+=" "+o.getContentClassName()),(0,n.jsxs)(n.Fragment,{children:[g,(0,n.jsx)("div",{ref:a,style:c,className:_,"data-layout-path":o.getPath()})]})},te=class extends d.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,n.jsx)("div",{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,n.jsx)("div",{className:T.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[this.props.message,(0,n.jsx)("p",{children:(0,n.jsx)("button",{onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},ti=d.memo(({controller:t,tabNode:e})=>{let i;return ti.displayName="TabContentRenderer",e.getComponent()?i=t.getFactory()(e):e.getSubLayoutId()&&(i=(0,n.jsxs)("div",{className:t.getClassName(T.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:[(0,n.jsx)(tb,{...t.getProps(),layoutId:e.getSubLayoutId(),mainLayoutController:t.getMainController()}),";"]})),(0,n.jsx)(te,{message:t.i18nName(z.Error_rendering_component),retryText:t.i18nName(z.Error_rendering_component_retry),children:i})},function(t,e){return!(e.visible&&(t.windowId!==e.windowId||t.fullRedrawRevision!==e.fullRedrawRevision||t.parentRedrawRevision!==e.parentRedrawRevision||void 0!==e.tabNode.getSubLayoutId()))}),to=class t{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(t){this._controller=t,this._mainController=t.getMainController()}addTabWithDragAndDrop(e,i,o){let a=y.fromJson(i,this._controller.getModel(),!1);t.dragState=new ts(this._controller.getMainController(),ta.Add,a,i,o)}moveTabWithDragAndDrop(t,e){this.setDragNode(t,e)}setDragNode=(e,i)=>{if(t.dragState=new ts(this._controller.getMainController(),ta.Internal,i,void 0,void 0),e.dataTransfer.setData("text/plain","--flexlayout--"),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.dropEffect="move",this._dragEnterCount=0,i instanceof C){let t=!1,o=this._controller.i18nName(z.Move_Tabset);if(i.getChildren().length>0&&(o=this._controller.i18nName(z.Move_Tabs).replace("?",String(i.getChildren().length))),this._controller.getProps().onRenderDragRect){let a=this._controller.getProps().onRenderDragRect(o,i,void 0);a&&(this.setDragComponent(e,a,10,10),t=!0)}t||this.setDragComponent(e,o,10,10)}else{let t=e.target;if(t&&"function"==typeof t.getBoundingClientRect){let o=t.getBoundingClientRect(),a=e.clientX-o.left,s=e.clientY-o.top,r=i?.getParent(),l=r instanceof U&&r.getOrientation()===c.HORZ,d=l?10:a,h=l?10:s,u=!1;if(this._controller.getProps().onRenderDragRect){let t=(0,n.jsx)(k,{controller:this._controller,tabNode:i},i.getId()),o=this._controller.getProps().onRenderDragRect(t,i,void 0);o&&(this.setDragComponent(e,o,d,h),u=!0)}if(!u){let t;!(t=navigator.userAgent).includes("Safari")||t.includes("Chrome")||t.includes("Chromium")?e.dataTransfer.setDragImage(i.getTabStamp(),d,h):this.setDragComponent(e,(0,n.jsx)(k,{tabNode:i,controller:this._controller}),d,h)}}}};setDragComponent(t,e,i,o){let a=(0,n.jsx)("div",{style:{position:"unset"},className:this._controller.getClassName(T.FLEXLAYOUT__LAYOUT)+" "+this._controller.getClassName(T.FLEXLAYOUT__DRAG_RECT),children:e});this._controller.getModel().sortLayouts();let s=this._controller.getCurrentDocument(),r=s.createElement("div");r.setAttribute("data-layout-path","/drag-rectangle"),r.style.position="absolute",r.style.left="-10000px",r.style.top="-10000px",s.body.appendChild(r),(0,u.createRoot)(r).render(a),t.dataTransfer.setDragImage(r,i,o),setTimeout(()=>{s.body.removeChild(r)},0)}updateActive(t){let e=Array.from(this._controller.getModel().getLayouts().values()),i=!1;for(let o=e.length-1;o>=0;o--){let a=e[o].getController()?.getDragDropManager();if(a){let e=!i&&a.getDragEnterCount()>0;e&&(i=!0),a.setActive(e,t)}}}setActive(t,e){this._active!==t&&(this._active=t,this._active?this.onDragEnter(e):this.onDragLeave(e))}onDragEnterRaw=t=>{this._dragEnterCount++,this.updateActive(t)};onDragLeaveRaw=t=>{this._dragEnterCount--,this.updateActive(t)};clearDragMain(){for(let[,t]of(this._controller.showOverlayOnAllWindows(!1),this._controller.getModel().getLayouts()))t.getController()&&t.getController().getDragDropManager().clearDragLocal()}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&(this._controller.getRootDiv().removeChild(this._outlineDiv),this._outlineDiv=void 0)}onDragEnter=e=>{if(!t.dragState&&this._controller.getProps().onExternalDrag){let i=this._controller.getProps().onExternalDrag(e);if(i){let e=y.fromJson(i.json,this._controller.getModel(),!1);t.dragState=new ts(this._controller.getMainController(),ta.External,e,i.json,i.onDrop)}}if(this._mainController===t.dragState?.mainLayoutController&&t.dragState){e.preventDefault(),this._dropInfo=void 0;let t=this._controller.getRootDiv();this._outlineDiv=this._controller.getCurrentDocument().createElement("div"),this._outlineDiv.className=this._controller.getClassName(T.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility="hidden";let i=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${i}s, left ${i}s, width ${i}s, height ${i}s`,t.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),void 0===this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let o=this._controller.getRootDiv().getBoundingClientRect();new g(e.clientX-o.left,e.clientY-o.top,1,1).positionElement(this._outlineDiv)}};onDragOver=e=>{if(this._mainController===t.dragState?.mainLayoutController&&this._active){let i=this._controller.getRootDiv()?.getBoundingClientRect(),o={x:e.clientX-(i?.left??0),y:e.clientY-(i?.top??0)};this._controller.checkForBorderToShow(o.x,o.y);let a=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),t.dragState.dragNode,o.x,o.y);a&&(e.preventDefault(),this._dropInfo=a,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(a.className),a.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility="visible"))}};onDragLeave=e=>{if(this._mainController===t.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let t=!1;for(let[,e]of this._controller.getModel().getLayouts())if(e.getController()&&e.getController().getDragDropManager().isDragging()){t=!0;break}!1===t&&this.clearDragMain()}};onDrop=e=>{if(this._mainController===t.dragState?.mainLayoutController){if(this._active){e.preventDefault();let i=t.dragState;if(this._dropInfo)if(void 0!==i.dragJson){let t=this._controller.doAction(p.addNode(i.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));void 0!==i.fnNewNodeDropped&&i.fnNewNodeDropped(t,e)}else void 0!==i.dragNode&&this._controller.doAction(p.moveNode(i.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));this.clearDragMain(),t.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},ta=((a={}).Internal="internal",a.External="external",a.Add="add",a),ts=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;constructor(t,e,i,o,a){this.mainLayoutController=t,this.dragSource=e,this.dragNode=i,this.dragJson=o,this.fnNewNodeDropped=a}},tn=({controller:t})=>{let e=[],i=t.getIcons().edgeArrow;if(t.getState().showEdges&&t.getModel().isEnableEdgeDockIndicators()){let o=t.getModel().getRootRow(t.getLayoutId()).getRect(),a=t.getClassName(T.FLEXLAYOUT__EDGE_RECT);e.push((0,n.jsx)("div",{style:{top:0,left:o.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,n.jsx)("div",{style:{transform:"rotate(180deg)"},children:i})},"North")),e.push((0,n.jsx)("div",{style:{top:o.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,n.jsx)("div",{style:{transform:"rotate(90deg)"},children:i})},"West")),e.push((0,n.jsx)("div",{style:{top:o.height-10,left:o.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,n.jsx)("div",{children:i})},"South")),e.push((0,n.jsx)("div",{style:{top:o.height/2-50,left:o.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:a+" "+t.getClassName(T.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,n.jsx)("div",{style:{transform:"rotate(-90deg)"},children:i})},"East"))}return(0,n.jsx)(n.Fragment,{children:e})},tr=t=>{let{title:e,controller:i,layout:o,url:a,onCloseLayout:s,onSetWindow:n,children:r}=t,l=d.useRef(null),[u,c]=d.useState(void 0),[g,_]=d.useState(!0),p=new Map;return(d.useLayoutEffect(()=>{if(!l.current){let t=o.getLayoutId(),i=o.getRect();l.current=window.open(a,t,`left=${i.x},top=${i.y},width=${i.width},height=${i.height}`),l.current?(n(o,l.current),window.addEventListener("beforeunload",()=>{if(l.current){let t=l.current;l.current=null,t.close()}}),l.current.addEventListener("load",()=>{if(l.current){l.current.focus(),l.current.resizeTo(i.width,i.height),l.current.moveTo(i.x,i.y);let t=l.current.document;t.title=e;let a=t.createElement("div");a.className=T.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(a),(function(t,e){let i=[];for(let o of document.querySelectorAll('style, link[rel="stylesheet"]'))tl(t,o,e,i);return Promise.all(i)})(t,p).then(()=>{c(a)});let n=new MutationObserver(e=>(function(t,e,i){for(let o of t)if("childList"===o.type){for(let t of o.addedNodes)(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement)&&tl(e,t,i);for(let t of o.removedNodes)if(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement){let o=i.get(t);o&&e.head.removeChild(o)}}})(e,t,p));n.observe(document.head,{childList:!0}),l.current.addEventListener("beforeunload",()=>{l.current&&(s(o),l.current=null,n.disconnect())})}})):(console.warn(`Unable to open window ${a}`),s(o))}return()=>{i.getModel().getLayouts().has(o.getLayoutId())||(l.current?.close(),l.current=null)}},[]),d.useEffect(()=>{void 0!==u&&g&&(i.redrawLayout(),_(!1))},[u,g,i]),void 0!==u)?(0,h.createPortal)(r,u):null};function tl(t,e,i,o){if(e instanceof HTMLLinkElement){let a=e.cloneNode(!0);t.head.appendChild(a),i.set(e,a),o&&o.push(new Promise(t=>{a.onload=()=>t(!0)}))}else if(e instanceof HTMLStyleElement)try{let o=e.cloneNode(!0);t.head.appendChild(o),i.set(e,o)}catch(t){}}var td=((s=td||{}).North="n",s.South="s",s.East="e",s.West="w",s.NorthWest="nw",s.NorthEast="ne",s.SouthWest="sw",s.SouthEast="se",s),th=t=>{let{controller:e,layout:i,children:o}=t,[a,s]=d.useState(i.getRect()),r=e.getClassName,l=d.useRef(null),h=d.useRef(null),u=d.useRef(null),c=d.useRef(null),_=d.useRef(null),p=d.useRef(null),b=d.useRef(null),E=d.useRef(null),f=d.useRef(null),m=d.useRef(null),L=d.useRef(!1);d.useEffect(()=>(h.current?.addEventListener("touchstart",y,{passive:!1}),u.current?.addEventListener("touchstart",y,{passive:!1}),c.current?.addEventListener("touchstart",y,{passive:!1}),_.current?.addEventListener("touchstart",y,{passive:!1}),p.current?.addEventListener("touchstart",y,{passive:!1}),b.current?.addEventListener("touchstart",y,{passive:!1}),E.current?.addEventListener("touchstart",y,{passive:!1}),f.current?.addEventListener("touchstart",y,{passive:!1}),m.current?.addEventListener("touchstart",y,{passive:!1}),()=>{h.current?.removeEventListener("touchstart",y),u.current?.removeEventListener("touchstart",y),c.current?.removeEventListener("touchstart",y),_.current?.removeEventListener("touchstart",y),p.current?.removeEventListener("touchstart",y),b.current?.removeEventListener("touchstart",y),E.current?.removeEventListener("touchstart",y),f.current?.removeEventListener("touchstart",y),m.current?.removeEventListener("touchstart",y)}),[]);let y=t=>{t.preventDefault(),t.stopImmediatePropagation()};d.useEffect(()=>{let t=()=>{let t=[...e.getModel().getLayouts()];i!==t[t.length-1][1]&&(L.current=!0)},o=()=>{L.current&&(setTimeout(()=>{e.moveWindowToFront(i.getLayoutId())},10),L.current=!1)},a=l.current;return a&&(a.addEventListener("pointerdown",t,{capture:!0}),a.addEventListener("pointerup",o)),()=>{a&&(a.removeEventListener("pointerdown",t,{capture:!0}),a.removeEventListener("pointerup",o))}},[e,i.getLayoutId()]);let A=(t,o)=>{let n={x:t.clientX,y:t.clientY},r=e.getRootDiv(),l=r?r.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};N(document,t,(t,r)=>{e.showOverlayOnAllWindows(!0);let d=t-n.x,h=r-n.y,u=a.x,c=a.y,_=a.width,T=a.height;o.includes("n")&&(c+=h,T-=h),o.includes("s")&&(T+=h),o.includes("w")&&(u+=d,_-=d),o.includes("e")&&(_+=d),_<150&&(o.includes("w")&&(u=a.x+a.width-150),_=150),T<25&&(o.includes("n")&&(c=a.y+a.height-25),T=25),u<0&&(_+=u,u=0),c<0&&(T+=c,c=0),u+_>l.width&&(_=l.width-u),c+T>l.height&&(T=l.height-c),_<150&&(_=150),T<25&&(T=25);let p=new g(u,c,_,T);s(p),i.setRect(p)},()=>{e.redrawLayout(),e.showOverlayOnAllWindows(!1)},()=>{}),t.stopPropagation()},R=e.getRootDiv(),O=R?R.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};return a.clamp(new g(0,0,O.width,O.height)),(0,n.jsxs)("div",{ref:l,className:r(T.FLEXLAYOUT__FLOAT_WINDOW),style:{left:a.x,top:a.y,width:a.width,height:a.height,position:"absolute"},children:[(0,n.jsx)("div",{ref:h,className:r(T.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:t=>{t.stopPropagation();let o={x:t.clientX-a.x,y:t.clientY-a.y},n=e.getRootDiv(),r=n?n.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};N(document,t,(t,n)=>{e.showOverlayOnAllWindows(!0),L.current&&(e.moveWindowToFront(i.getLayoutId()),L.current=!1);let l=new g(t-o.x,n-o.y,a.width,a.height);l.clamp(new g(0,0,r.width,r.height)),s(l),i.setRect(l)},()=>{e.redrawLayout(),e.showOverlayOnAllWindows(!1)},()=>{})},children:(0,n.jsx)("div",{style:{flexGrow:1,display:"flex",justifyContent:"center"},children:(0,n.jsx)("div",{style:{width:50,height:8,display:"flex",flexDirection:"column",justifyContent:"space-around",opacity:.5},children:(0,n.jsx)("div",{style:{height:2,backgroundColor:"gray",borderRadius:1}})})})}),(0,n.jsx)("div",{className:r(T.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:o}),(0,n.jsx)("div",{ref:u,style:{position:"absolute",zIndex:10,top:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:t=>A(t,td.North)}),(0,n.jsx)("div",{ref:b,style:{position:"absolute",zIndex:10,bottom:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:t=>A(t,td.South)}),(0,n.jsx)("div",{ref:_,style:{position:"absolute",zIndex:10,top:8,bottom:8,right:-4,width:8,cursor:"ew-resize"},onPointerDown:t=>A(t,td.East)}),(0,n.jsx)("div",{ref:f,style:{position:"absolute",zIndex:10,top:8,bottom:8,left:-4,width:8,cursor:"ew-resize"},onPointerDown:t=>A(t,td.West)}),(0,n.jsx)("div",{ref:m,style:{position:"absolute",zIndex:10,top:-4,left:-4,width:12,height:12,cursor:"nwse-resize"},onPointerDown:t=>A(t,td.NorthWest)}),(0,n.jsx)("div",{ref:c,style:{position:"absolute",zIndex:10,top:-4,right:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:t=>A(t,td.NorthEast)}),(0,n.jsx)("div",{ref:E,style:{position:"absolute",zIndex:10,bottom:-4,left:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:t=>A(t,td.SouthWest)}),(0,n.jsx)("div",{ref:p,style:{position:"absolute",zIndex:10,bottom:0,right:0,width:12,height:12,cursor:"nwse-resize"},onPointerDown:t=>A(t,td.SouthEast)})]})},tu=({controller:t})=>{let e=[],i=t.getModel().getLayouts(),o=0;for(let[a,s]of i)!s.isMainLayout()&&("window"===s.getType()&&t.isSupportsPopout()?(e.push((0,n.jsx)(tr,{controller:t,layout:s,title:t.getPopoutWindowName()+" "+o,url:t.getPopoutURL()+"?id="+a,onSetWindow:t.onSetWindow,onCloseLayout:t.onCloseLayout,children:(0,n.jsx)("div",{className:t.getProps().popoutClassName,children:(0,n.jsx)(tb,{...t.getProps(),layoutId:a,mainLayoutController:t})})},a)),o++):"float"===s.getType()&&e.push((0,n.jsx)(th,{controller:t,layout:s,onCloseLayout:t.onCloseLayout,children:(0,n.jsx)(tb,{...t.getProps(),layoutId:a,mainLayoutController:t})},a+"float")));return(0,n.jsx)(n.Fragment,{children:e})},tc=t=>{let{controller:e,tabNode:i,selected:o,border:a,icons:s,path:r}=t,l=d.useRef(null),h=d.useRef(null);d.useLayoutEffect(()=>{i.setTabRect(e.getBoundingClientRect(l.current)),e.getEditingTab()===i&&h.current.select()});let u=e.getClassName,c=u(T.FLEXLAYOUT__BORDER_BUTTON)+" "+u(T.FLEXLAYOUT__BORDER_BUTTON_+a);o?c+=" "+u(T.FLEXLAYOUT__BORDER_BUTTON__SELECTED):c+=" "+u(T.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==i.getClassName()&&(c+=" "+i.getClassName());let g=0;!1===i.getModel().isEnableRotateBorderIcons()&&("left"===a?g=90:"right"===a&&(g=-90));let _=R(e,i,g),b=_.content?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:_.content}):null,E=_.leading?(0,n.jsx)("div",{className:u(T.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:_.leading}):null;if(e.getEditingTab()===i&&(b=(0,n.jsx)("input",{ref:h,className:u(T.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":r+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):("Enter"===t.code||"NumpadEnter"===t.code)&&(e.setEditingTab(void 0),e.doAction(p.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isCloseable()){let t=e.i18nName(z.Close_Tab);_.buttons.push((0,n.jsx)("div",{"data-layout-path":r+"/button/close",title:t,className:u(T.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:t=>{t.stopPropagation()},onClick:t=>{let a;a=i.getCloseType(),(o||a===J.Always||a===J.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(e.doAction(p.deleteTab(i.getId())),t.stopPropagation())},children:"function"==typeof s.close?s.close(i):s.close},"close"))}return(0,n.jsxs)("div",{ref:l,"data-layout-path":r,className:c,onClick:()=>{e.doAction(p.selectTab(i.getId()))},onAuxClick:t=>{O(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.getDragDropManager().setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{t.stopPropagation(),e.getDragDropManager().clearDragMain()},children:[E,b,_.buttons]})},tg=t=>{let e,i,o,a,{borderNode:s,controller:r,size:l}=t,h=d.useRef(null),u=d.useRef(null),g=d.useRef(null),b=d.useRef(null),E=d.useRef(null),f=r.getIcons();d.useLayoutEffect(()=>{s.setTabHeaderRect(r.getBoundingClientRect(m.current))});let{selfRef:m,userControlledPositionRef:L,onScroll:y,onScrollPointerDown:A,hiddenTabs:R,onMouseWheel:v,isDockStickyButtons:x,isShowHiddenTabs:w}=$(r,s,c.flip(s.getOrientation()),E,u,r.getClassName(T.FLEXLAYOUT__BORDER_BUTTON)),N=t=>{O(t)&&r.auxMouseClick(s,t)},D=t=>{t.stopPropagation()},S=t=>{let e=r.getShowOverflowMenu(),i=R.map(t=>({index:t,node:s.getChildren()[t]}));void 0!==e?e(s,t,i,I):G(g.current,s,i,I,r),t.stopPropagation()},I=t=>{r.doAction(p.selectTab(t.node.getId())),L.current=!1},C=t=>{let e=s.getChildren()[s.getSelected()];void 0!==e&&r.doAction(p.popoutTab(e.getId(),"window")),t.stopPropagation()},B=t=>{let e=s.getChildren()[s.getSelected()];void 0!==e&&r.doAction(p.popoutTab(e.getId(),"float")),t.stopPropagation()},M=r.getClassName,U=(()=>{let t=[];for(let e=0;e<s.getChildren().length;e++){let i=s.getSelected()===e,o=s.getChildren()[e];t.push((0,n.jsx)(tc,{controller:r,border:s.getLocation().getName(),tabNode:o,path:s.getPath()+"/tb"+e,selected:i,icons:f},o.getId())),e<s.getChildren().length-1&&t.push((0,n.jsx)("div",{className:M(T.FLEXLAYOUT__BORDER_TAB_DIVIDER)},"divider"+e))}return t})(),{leading:F,toolbar:P}=(t=>{let e,i=[],o=[],a={leading:e,buttons:i,stickyButtons:o,overflowPosition:void 0};if(r.customizeTabSet(s,a),e=a.leading,o=a.stickyButtons,i=a.buttons,void 0===a.overflowPosition&&(a.overflowPosition=o.length),o.length>0&&(x?i=[...o,...i]:t.push((0,n.jsx)("div",{ref:b,onPointerDown:D,onDragStart:t=>{t.preventDefault()},className:M(T.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:o},"sticky_buttons_container"))),w){let t,e=r.i18nName(z.Overflow_Menu_Tooltip);if("function"==typeof f.more){let e=R.map(t=>({index:t,node:s.getChildren()[t]}));t=f.more(s,e)}else t=(0,n.jsxs)(n.Fragment,{children:[f.more,(0,n.jsx)("div",{className:M(T.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:R.length>0?R.length:""})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,n.jsx)("button",{ref:g,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+s.getLocation().getName()),title:e,onClick:S,onPointerDown:D,children:t},"overflowbutton"))}let l=s.getSelected();if(-1!==l){let t=s.getChildren()[l];if(void 0!==t&&r.isMainLayout()){if(t.isEnablePopoutFloatIcon()){let e=r.i18nName(z.Popout_Tab_Float);i.push((0,n.jsx)("button",{title:e,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:B,onPointerDown:D,children:"function"==typeof f.popoutFloat?f.popoutFloat(t):f.popoutFloat},"popout-float"))}if(r.isSupportsPopout()&&t.isEnablePopoutIcon()&&t.isAllowedInWindow()){let e=r.i18nName(z.Popout_Tab);i.push((0,n.jsx)("button",{title:e,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:C,onPointerDown:D,children:"function"==typeof f.popout?f.popout(t):f.popout},"popout"))}}}return{leading:e,toolbar:(0,n.jsx)("div",{ref:h,className:M(T.FLEXLAYOUT__BORDER_TOOLBAR)+" "+M(T.FLEXLAYOUT__BORDER_TOOLBAR_+s.getLocation().getName()),children:i},"toolbar")}})(U),Y=M(T.FLEXLAYOUT__BORDER)+" "+M(T.FLEXLAYOUT__BORDER_+s.getLocation().getName());void 0!==s.getClassName()&&(Y+=" "+s.getClassName());let W=l-1;return s.getLocation()===_.LEFT?(e={right:"100%",top:0},i={width:W,overflowY:"auto"}):s.getLocation()===_.RIGHT?(e={left:"100%",top:0},i={width:W,overflowY:"auto"}):(e={left:0},i={height:W,overflowX:"auto"}),s.isEnableTabScrollbar()&&(o=(0,n.jsx)("div",{ref:u,className:M(T.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:A})),F&&(a=(0,n.jsx)("div",{className:M(T.FLEXLAYOUT__BORDER_LEADING),children:F})),(0,n.jsxs)("div",{ref:m,style:{display:"flex",flexDirection:s.getOrientation()===c.VERT?"row":"column"},className:Y,"data-layout-path":s.getPath(),onClick:N,onAuxClick:N,onContextMenu:t=>{r.showContextMenu(s,t)},onWheel:v,children:[a,(0,n.jsxs)("div",{className:M(T.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,n.jsx)("div",{ref:E,className:M(T.FLEXLAYOUT__BORDER_INNER)+" "+M(T.FLEXLAYOUT__BORDER_INNER_+s.getLocation().getName()),style:i,onScroll:y,children:(0,n.jsx)("div",{style:e,className:M(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+M(T.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+s.getLocation().getName()),children:U})}),o]}),P]})};function t_(t){let{controller:e,borderNode:i,show:o}=t,a=d.useRef(null);d.useLayoutEffect(()=>{let t=e.getBoundingClientRect(a.current);isNaN(t.x)||!(t.width>0)||i.getContentRect().equalsWhenRounded(t)||(i.setContentRect(t),e.setReLayout(!0))});let s=!0,r={};i.getOrientation()===c.HORZ?(r.width=i.getSize(),r.minWidth=i.getMinSize(),r.maxWidth=i.getMaxSize()):(r.height=i.getSize(),r.minHeight=i.getMinSize(),r.maxHeight=i.getMaxSize(),s=!1),r.display=o?"flex":"none";let l=e.getClassName(T.FLEXLAYOUT__BORDER_TAB_CONTENTS);return i.getLocation()===_.LEFT||i.getLocation()===_.TOP?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:a,style:r,className:l}),o&&(0,n.jsx)(K,{controller:e,node:i,index:0,horizontal:s})]}):(0,n.jsxs)(n.Fragment,{children:[o&&(0,n.jsx)(K,{controller:e,node:i,index:0,horizontal:s}),(0,n.jsx)("div",{ref:a,style:r,className:l})]})}var tT=({controller:t,inner:e})=>{let i=t.getClassName(T.FLEXLAYOUT__LAYOUT_MAIN),o=t.getModel().getBorderSet().getBorderMap();if(!t.isMainLayout()||!(o.size>0))return(0,n.jsx)("div",{className:i,ref:t.getMainRef(),style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"},children:e});{let a=(0,n.jsx)("div",{className:i,ref:t.getMainRef(),children:e}),s=new Map,r=new Map;for(let[e,i]of _.values){let e=o.get(i);e&&e.isShowing()&&(!e.isAutoHide()||e.isAutoHide()&&(e.getChildren().length>0||t.getState().showHiddenBorder===i))&&(s.set(i,(0,n.jsx)(tg,{controller:t,borderNode:e,size:t.getState().calculatedBorderBarSize})),r.set(i,(0,n.jsx)(t_,{controller:t,borderNode:e,show:-1!==e.getSelected()})))}let l=t.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),d=t.getClassName(T.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(t.getModel().getBorderSet().getLayoutHorizontal()){let t=(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[r.get(_.TOP),(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[r.get(_.LEFT),a,r.get(_.RIGHT)]}),r.get(_.BOTTOM)]});return(0,n.jsxs)("div",{className:l,style:{flexDirection:"column"},children:[s.get(_.TOP),(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[s.get(_.LEFT),t,s.get(_.RIGHT)]}),s.get(_.BOTTOM)]})}{let t=(0,n.jsxs)("div",{className:d,style:{flexDirection:"row"},children:[r.get(_.LEFT),(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[r.get(_.TOP),a,r.get(_.BOTTOM)]}),r.get(_.RIGHT)]});return(0,n.jsxs)("div",{className:l,style:{flexDirection:"row"},children:[s.get(_.LEFT),(0,n.jsxs)("div",{className:d,style:{flexDirection:"column"},children:[s.get(_.TOP),t,s.get(_.BOTTOM)]}),s.get(_.RIGHT)]})}}},tp=d.memo(t=>{tp.displayName="DragContainer";let{controller:e,tabNode:i}=t,o=d.useRef(null);d.useEffect(()=>{i.setTabStamp(o.current)},[i,o.current]);let a=e.getClassName;return(0,n.jsx)("div",{ref:o,className:a(T.FLEXLAYOUT__DRAG_RECT),children:(0,n.jsx)(k,{controller:e,tabNode:i},i.getId())})},function(t,e){return e.dragging}),tb=d.forwardRef((t,e)=>{tb.displayName="LayoutInternal";let[i,o]=d.useState({rect:g.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:_.CENTER,splitterSize:8}),a=d.useCallback(e=>{o(i=>({...i,..."function"==typeof e?e(i,t):e}))},[t]),s=d.useRef(null),r=d.useRef(null),l=d.useRef(null),h=d.useRef(null),u=d.useMemo(()=>new tE(t,i,a),[]);if(u.setProps(t),u.setStateRaw(i),u.setSetState(a),u.setLayoutRef(s),u.setMoveablesRef(r),u.setFindBorderBarSizeRef(l),u.setMainRef(h),d.useImperativeHandle(e,()=>u,[u]),d.useLayoutEffect(()=>{u.isMainLayout()&&u.updateLayoutMetrics(),u.isReLayout()&&(u.redrawLayout(),u.setReLayout(!1))}),d.useEffect(()=>{let t=s.current.ownerDocument,e=t.defaultView;u.setCurrentDocument(t),u.setCurrentWindow(e);let i=new e.ResizeObserver(()=>{e.requestAnimationFrame(()=>{u.updateRect()})});i.observe(s.current);let o=()=>{u.updateRect()};e.addEventListener("resize",o);let a=()=>{for(let[t,e]of u.getProps().model.getLayouts())e.getController()&&u.redrawLayout()};return document.addEventListener("visibilitychange",a),()=>{i.disconnect(),e.removeEventListener("resize",o),document.removeEventListener("visibilitychange",a)}},[u,s.current?.ownerDocument]),d.useEffect(()=>{let t;if(!u.isMainLayout()&&"window"===u.getLayout().getType()){let e=u.getProps().mainLayoutController?.getRootDiv();if(e){let i=s.current;S(e,i),(t=new MutationObserver(()=>{S(e,i)&&u.redrawLayout()})).observe(e,{attributeFilter:["style"]})}}return()=>{t&&t.disconnect()}},[u]),d.useEffect(()=>{let e=t.model,o=e.getLayouts().get(u.getLayoutId());if(o.setController(u),o.setToExportRectFunction((t,e)=>"window"===e?u.getScreenRect(t):u.getRelativeRect(t)),u.setLayout(o),u.isMainLayout()){e.addChangeListener(u.onModelChange);let o=()=>{let e=parseInt(getComputedStyle(s.current).getPropertyValue("--splitter-size"));Number.isFinite(e)&&(t.model.setSplitterSize(e),i.splitterSize!==e&&a({splitterSize:e}))};o();let n=setInterval(o,1e3);return()=>{e.removeChangeListener(u.onModelChange),clearInterval(n),u.tidyMoveablesMap()}}},[t.model,u]),!s.current)return(0,n.jsxs)("div",{ref:s,className:u.getClassName(T.FLEXLAYOUT__LAYOUT),children:[(0,n.jsx)("div",{ref:r,className:u.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),(0,n.jsx)("div",{ref:l,className:u.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")]});let c=t.model,p=u.getLayoutId();c.getRootRow(p).calcMinMaxSize(),c.getRootRow(p).setPaths(""),u.isMainLayout()&&(c.getBorderSet().setPaths(),u.createMoveableDivs());let b=(0,n.jsx)(tT,{controller:u,inner:u.renderLayout()}),E=u.renderTabContainers(),f=u.reorderComponents(E,u.getOrderedTabIds()),m=null,L=null,y=null,A=null;if(u.isMainLayout()){m=u.renderMetricsElements(),L=(0,n.jsx)(tu,{controller:u});let t=u.renderTabContents();y=u.reorderComponents(t,u.getOrderedTabMoveableIds()),A=(0,n.jsx)("div",{className:u.getClassName(T.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:u.renderTabStamps()},"__tabStamps__")}return(0,n.jsxs)("div",{ref:s,className:u.getClassName(T.FLEXLAYOUT__LAYOUT),onDragEnter:u.getDragDropManager().onDragEnterRaw,onDragLeave:u.getDragDropManager().onDragLeaveRaw,onDragOver:u.getDragDropManager().onDragOver,onDrop:u.getDragDropManager().onDrop,children:[(0,n.jsx)("div",{ref:r,className:u.getClassName(T.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),m,(0,n.jsx)(H,{controller:u,show:i.showOverlay},"__overlay__"),b,f,y,i.portal,L,A]})}),tE=class t{static Windows=new Map;_props;_state;_setState;_layoutRef;_moveablesRef;_findBorderBarSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_moveableElementMap=new Map;_currentDocument;_currentWindow;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;constructor(t,e,i){this._props=t,this._state=e,this._setState=i,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=void 0!==t.supportsPopout?t.supportsPopout:tm,this._popoutURL=t.popoutURL?t.popoutURL:"popout.html",this._icons={...tf,...t.icons},this._layoutId=t.layoutId?t.layoutId:W.MAIN_LAYOUT_ID,this._mainController=t.mainLayoutController?t.mainLayoutController:this,this._dragDropManager=new to(this),this._layout=t.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=t.popoutWindowName||"Popout Window",this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Q,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},"__row__"),(0,n.jsx)(tn,{controller:this})]})}renderTabContainers(){let t=new Map;return this._props.model.visitLayoutNodes(this._layoutId,e=>{if(e instanceof y){let i=e.isSelected(),o=e.isRendered(),a=e.isEnableRenderOnDemand();(o||i||!a)&&t.set(e.getId(),(0,n.jsx)(tt,{controller:this,tabNode:e,selected:i},e.getId()))}}),t}renderTabContents(){let t=new Map;for(let[e,i]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(e,e=>{if(e instanceof y){let o=e.isSelected(),a=e.isRendered(),s=e.isEnableRenderOnDemand(),r=e.getParent().getContentRect(),l=o||!s;if(a||l&&r.width>0&&r.height>0){let o=e.getMoveableElement(),a=i.getWindowId()||"",s=e.getId()+(e.isEnableWindowReMount()?a:"");t.set(e.getId(),(0,h.createPortal)((0,n.jsx)(ti,{controller:this,tabNode:e,rect:r,windowId:a,visible:l,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},s),o,s)),e.setRendered(!0)}}});return t}renderMetricsElements(){return(0,n.jsx)("div",{ref:this._findBorderBarSizeRef,className:this.getClassName(T.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")}renderTabStamps(){let t=[];return this._props.model.visitNodes(e=>{e instanceof y&&t.push((0,n.jsx)(tp,{controller:this,tabNode:e,dragging:w},e.getId()))}),t}createMoveableDivs(){this._props.model.visitNodes(t=>{if(t instanceof y){let e=this.getMoveableElement(t.getId());t.setMoveableElement(e)}})}getMoveablesDiv(){return this._moveablesRef.current}getMoveableElement(t){let e=this._moveableElementMap.get(t);return void 0===e&&(e=document.createElement("div"),this._moveablesRef.current.appendChild(e),e.className=T.FLEXLAYOUT__TAB_MOVEABLE,this._moveableElementMap.set(t,e)),e}tidyMoveablesMap(){let t=new Map;for(let[e,i]of(this._props.model.visitNodes((e,i)=>{e instanceof y&&t.set(e.getId(),e)}),this._moveableElementMap))t.has(e)||(i.remove(),this._moveableElementMap.delete(e))}redrawLayout(){this._mainController?.setState(t=>({layoutRedrawRevision:t.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(t=!0){this._mainController?.setState(t=>({fullRedrawRevision:t.fullRedrawRevision+1}))}doAction(t){if(void 0===this._props.onAction)return this._props.model.doAction(t);{let e=this._props.onAction(t);return void 0!==e?this._props.model.doAction(e):void 0}}updateRect=()=>{if(this._layoutRef.current){let t=this._layoutRef.current;if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let e=t.closest("."+this.getClassName(T.FLEXLAYOUT__FLOAT_WINDOW));e instanceof HTMLDivElement&&(t=e)}let e=g.fromDomRect(t.getBoundingClientRect());if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let t=this._mainController.getDomRect();e=e.relativeTo(t)}!e.equalsWhenRounded(this._state.rect)&&0!==e.width&&0!==e.height&&(this.setState({rect:e}),this._layout.setRect(e),this._layout.isMainLayout()||this.redrawLayout())}};onModelChange=t=>{t.type==p.DELETE_TAB&&this._state.showHiddenBorder!==_.CENTER&&0===this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder).getChildren().length&&this._setState({showHiddenBorder:_.CENTER}),this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,t)};reorderComponents(t,e){let i=e.filter(e=>t.has(e)),o=new Set(i);for(let e of t.keys())o.has(e)||i.push(e);return e.splice(0,e.length,...i),e.map(e=>t.get(e))}checkForBorderToShow(t,e){let i=this.getBoundingClientRect(this._mainRef.current),o=i.getCenter(),a=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===_.CENTER&&(e>o.y-50&&e<o.y+50||t>o.x-50&&t<o.x+50)&&(a=!0);let s=_.CENTER;!a&&(t<=i.x+10?s=_.LEFT:t>=i.getRight()-10?s=_.RIGHT:e<=i.y+10?s=_.TOP:e>=i.getBottom()-10&&(s=_.BOTTOM)),s!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:s})}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let t=this._findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this._state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}};addTabWithDragAndDrop(t,e,i){this._dragDropManager.addTabWithDragAndDrop(t,e,i)}moveTabWithDragAndDrop(t,e){this._dragDropManager.moveTabWithDragAndDrop(t,e)}setDragComponent(t,e,i,o){this._dragDropManager.setDragComponent(t,e,i,o)}getProps(){return this._props}setProps(t){this._props=t}getState(){return this._state}setStateRaw(t){this._state=t}setState(t){this._setState(t)}setSetState(t){this._setState=t}getLayoutRef(){return this._layoutRef}setLayoutRef(t){this._layoutRef=t}getMoveablesRef(){return this._moveablesRef}setMoveablesRef(t){this._moveablesRef=t}getFindBorderBarSizeRef(){return this._findBorderBarSizeRef}setFindBorderBarSizeRef(t){this._findBorderBarSizeRef=t}getMainRef(){return this._mainRef}setMainRef(t){this._mainRef=t}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(t){this._currentDocument=t}getCurrentWindow(){return this._currentWindow}setCurrentWindow(e){this._currentWindow=e,e&&!t.Windows.has(e)&&t.Windows.set(e,M())}getWindowId(){if(this.getCurrentWindow())return t.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(t){this._layout=t}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName}isReLayout(){return this._reLayout}setReLayout(t){this._reLayout=t}getBoundingClientRect(t){let e=this.getDomRect();return e?g.getBoundingClientRect(t).relativeTo(e):g.empty()}getMoveableContainer(){return this._moveablesRef.current}getClassName=t=>void 0===this._props.classNameMapper?t:this._props.classNameMapper(t);getDomRect(){return void 0!==this._cachedLayoutDOMRect?this._cachedLayoutDOMRect:this._layoutRef.current?(this._cachedLayoutDOMRect=g.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):g.empty()}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!1}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=t=>{this.doAction(p.closePopout(t.getLayoutId()))};onSetWindow=(t,e)=>{};getScreenRect(t){let e=t.clone(),i=this.getDomRect();return e.x=this._currentWindow.screenX+this._currentWindow.scrollX+1+i.x+e.x,e.y=this._currentWindow.screenY+this._currentWindow.scrollY+59+i.y+e.y,e.height+=60,e.width+=2,e}getRelativeRect(t){let e=t.clone();if(!this._layout.isMainLayout()){let t=this._layout.getRect();e.x+=t.x,e.y+=t.y}return e}moveWindowToFront(t){this.doAction(p.movePopoutToFront(t))}addTabToTabSet(t,e){if(void 0!==this._props.model.getNodeById(t))return this.doAction(p.addNode(e,t,_.CENTER,-1))}addTabToActiveTabSet(t){let e=this._props.model.getActiveTabset(this._layoutId);if(void 0!==e)return this.doAction(p.addNode(t,e.getId(),_.CENTER,-1))}showControlInPortal=(t,e)=>{let i=(0,h.createPortal)(t,e);this.setState({portal:i})};hideControlInPortal=()=>{this.setState({portal:void 0})};maximize(t){this.doAction(p.maximizeToggle(t.getId(),this.getLayoutId()))}customizeTab(t,e){this._props.onRenderTab&&this._props.onRenderTab(t,e)}customizeTabSet(t,e){this._props.onRenderTabSet&&this._props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this._props.i18nMapper&&(i=this._props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(t,e){this._props.onContextMenu&&this._props.onContextMenu(t,e)}auxMouseClick(t,e){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(t,e)}showOverlay(t){this.setState({showOverlay:t}),v(!t,this._currentDocument)}showOverlayOnAllWindows(t){for(let[,e]of this._props.model.getLayouts())e.getController()&&e.getController().showOverlay(t)}},tf={close:(0,n.jsx)(j,{}),closeTabset:(0,n.jsx)(j,{}),closeFloatPopout:(0,n.jsx)(j,{}),popout:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,n.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]}),{}),popoutFloat:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,n.jsx)("rect",{x:"3",y:"10",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,n.jsx)("rect",{x:"10",y:"3",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,n.jsx)("path",{d:"M6 14 L14 6",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M10 6 h4 v4",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),{}),maximize:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})]}),{}),restore:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"})]}),{}),more:(0,n.jsx)(()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,n.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,n.jsx)("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"})]}),{}),edgeArrow:(0,n.jsx)(()=>(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100",children:(0,n.jsx)("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"})}),{}),activeTabset:(0,n.jsx)(()=>(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:X,height:"24px",viewBox:"0 -960 960 960",width:"24px",children:(0,n.jsx)("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"})}),{})},tm=A(),tL=d.forwardRef((t,e)=>{let i=(0,d.useRef)(null),o=(0,d.useRef)(0);return tL.displayName="Layout",(0,d.useImperativeHandle)(e,()=>({redraw:()=>{i.current?.redrawLayoutAndTabContent()},addTabToTabSet:(t,e)=>i.current?.addTabToTabSet(t,e),addTabWithDragAndDrop:(t,e,o)=>{i.current?.addTabWithDragAndDrop(t,e,o)},moveTabWithDragAndDrop:(t,e)=>{i.current?.moveTabWithDragAndDrop(t,e)},addTabToActiveTabSet:t=>i.current?.addTabToActiveTabSet(t),setDragComponent:(t,e,o,a)=>{i.current?.setDragComponent(t,e,o,a)},getRootDiv:()=>i.current.getRootDiv()})),(0,n.jsx)(tb,{ref:i,...t,parentRedrawRevision:o.current++})}),ty=t.i(404175),tA=t.i(157408),tR=t.i(327964),tO=t.i(873111),tv=t.i(691223),tx=t.i(31807),tw=t.i(363156),tN=t.i(250226),tD=t.i(564822),tS=t.i(361031),tI=t.i(524360),tC=t.i(355819),tB=t.i(515104),tM=t.i(506037),tU=t.i(835829),tF=t.i(141889);let tP=()=>(0,n.jsx)(t4,{}),tY=(0,r.default)(()=>t.A(202411).then(t=>t.EditorPanel),{loadableGenerated:{modules:[388576]},ssr:!1,loading:tP}),tW=(0,r.default)(()=>t.A(136450).then(t=>t.CodeEditor),{loadableGenerated:{modules:[538691]},ssr:!1,loading:tP}),tX=(0,r.default)(()=>t.A(58872).then(t=>t.TerminalPanel),{loadableGenerated:{modules:[608745]},ssr:!1,loading:tP}),tj=(0,r.default)(()=>t.A(329052).then(t=>t.ChannelList),{loadableGenerated:{modules:[878166]},ssr:!1,loading:tP}),tH=(0,r.default)(()=>t.A(126861).then(t=>t.ChatPanel),{loadableGenerated:{modules:[773354]},ssr:!1,loading:tP}),tz=(0,r.default)(()=>t.A(124383).then(t=>t.IssueList),{loadableGenerated:{modules:[783481]},ssr:!1,loading:tP}),tk=(0,r.default)(()=>t.A(318599).then(t=>t.IssueDetail),{loadableGenerated:{modules:[706304]},ssr:!1,loading:tP}),tG=(0,r.default)(()=>t.A(222445).then(t=>t.GitCommitsPanel),{loadableGenerated:{modules:[514669]},ssr:!1,loading:tP}),tV=(0,r.default)(()=>t.A(78906).then(t=>t.ProjectSettingsPanel),{loadableGenerated:{modules:[985646]},ssr:!1,loading:tP}),tJ=(0,r.default)(()=>t.A(857328).then(t=>t.CodeFavoritesPanel),{loadableGenerated:{modules:[306649]},ssr:!1,loading:tP}),tZ=(0,r.default)(()=>t.A(3725).then(t=>t.AddFavoriteDialog),{loadableGenerated:{modules:[722705]},ssr:!1,loading:()=>null}),t$=(0,r.default)(()=>t.A(145098).then(t=>t.SendToChannelDialog),{loadableGenerated:{modules:[648944]},ssr:!1,loading:()=>null}),tq=(0,r.default)(()=>t.A(951923).then(t=>t.SendToIssueDialog),{loadableGenerated:{modules:[264223]},ssr:!1,loading:()=>null}),tK=(0,r.default)(()=>t.A(422720).then(t=>t.InspectorActionDialog),{loadableGenerated:{modules:[319727]},ssr:!1,loading:()=>null}),tQ=(0,r.default)(()=>t.A(823528),{loadableGenerated:{modules:[394896]},ssr:!1,loading:tP}),t0=(0,r.default)(()=>t.A(173820).then(t=>t.DatabaseSidebarPanel),{loadableGenerated:{modules:[115133]},ssr:!1,loading:tP}),t1=(0,r.default)(()=>t.A(903135).then(t=>t.default),{loadableGenerated:{modules:[683223]},ssr:!1,loading:tP}),t2=(0,r.default)(()=>t.A(907400).then(t=>t.WorktreePanel),{loadableGenerated:{modules:[882130]},ssr:!1,loading:tP}),t5=(0,r.default)(()=>t.A(622168).then(t=>t.ChannelDialog),{loadableGenerated:{modules:[694205]},ssr:!1,loading:()=>null}),t8=(0,r.default)(()=>t.A(185682).then(t=>t.CreateIssueDialog),{loadableGenerated:{modules:[217832]},ssr:!1,loading:()=>null});function t4(){return(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Loading..."})}let t3={global:{tabSetEnableTabStrip:!0,borderEnableDrop:!0,tabEnableClose:!1,tabEnableRename:!1,tabSetEnableMaximize:!1},borders:[{type:"border",location:"bottom",children:[{type:"tab",name:"Terminal",component:"terminal"},{type:"tab",name:"Commits",component:"git-commits"},{type:"tab",name:"Favorites",component:"code-favorites",id:"code-favorites"},{type:"tab",name:"Worktrees",component:"worktree-panel",id:"worktree-panel"}]}],layout:{type:"row",children:[{type:"tabset",weight:.25,children:[{type:"tab",name:"Settings",component:"project-settings",id:"project-settings"},{type:"tab",name:"Channels",component:"channel-list",id:"channel-list"},{type:"tab",name:"Issues",component:"issue-list",id:"issue-list"},{type:"tab",name:"Workfolder",component:"workfolder",id:"workfolder"},{type:"tab",name:"Database",component:"database-list",id:"database-list"}]},{type:"tabset",weight:.75,children:[{type:"tab",name:"Code Editor",component:"code-editor",id:"code-editor"},{type:"tab",name:"Chat",component:"chat",id:"chat"},{type:"tab",name:"Issue Detail",component:"issue-detail",id:"issue-detail"},{type:"tab",name:"Database",component:"database",id:"database"},{type:"tab",name:"Kanban",component:"kanban",id:"kanban"}]}]}};function t6({panel:t,workspaceId:e,boundDirs:i}){switch(t){case"channel-list":default:return(0,n.jsx)(tj,{workspaceId:e});case"chat":return(0,n.jsx)(tH,{workspaceId:e});case"issue-list":return(0,n.jsx)(tz,{workspaceId:e});case"issue-detail":return(0,n.jsx)(tk,{workspaceId:e});case"workfolder":return(0,n.jsx)(tY,{workspaceId:e});case"code-editor":return(0,n.jsx)(tW,{workspaceId:e});case"terminal":return(0,n.jsx)(tX,{workspaceId:e,boundDirs:i});case"git-commits":return(0,n.jsx)(tG,{workspaceId:e});case"project-settings":return(0,n.jsx)(tV,{workspaceId:e});case"code-favorites":return(0,n.jsx)(tJ,{workspaceId:e});case"database":return(0,n.jsx)(tQ,{workspaceId:e});case"database-list":return(0,n.jsx)(t0,{workspaceId:e});case"kanban":return(0,n.jsx)(t1,{workspaceId:e})}}function t7({name:t}){return(0,n.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[t," (coming soon)"]})}t.s(["WorkspaceShell",0,function({workspaceId:t,boundDirs:e}){let i=(0,tD.useIsMobile)(),o=(0,tR.useIssueStore)(),a=(0,tO.useTaskStore)(),s=(0,tR.useIssueStore)(t=>t.activeIssueId),r=(0,tR.useIssueStore)(t=>t.issueSelectSeq),d=(0,tv.useEditorStore)(t=>t.activeFilePath),h=(0,tx.useChannelStore)(t=>t.activeChannelId),u=(0,tx.useChannelStore)(t=>t.channelSelectSeq),c=(0,tx.useChannelStore)(t=>t.loadChannels),g=(0,tw.useGitStore)(t=>t.status),_=(0,tI.useTerminalStore)(t=>t.sessions),T=(0,tx.useChannelStore)(t=>t.messages),{activePanel:b,setActivePanel:E,handleBackAction:f}=(0,tN.useMobilePanelStore)(),m=(0,tv.useEditorStore)(t=>t.loadEditorState),L=(0,tv.useEditorStore)(t=>t.revealPath);(0,tv.useEditorStore)(t=>t.clearRevealPath);let A=(0,tx.useChannelStore)(t=>t.createDialogOpen),R=(0,tx.useChannelStore)(t=>t.setCreateDialogOpen),O=(0,tR.useIssueStore)(t=>t.createDialogOpen),v=(0,tR.useIssueStore)(t=>t.setCreateDialogOpen),x=(0,tC.useAgentStore)(t=>t.agents),w=(0,tx.useChannelStore)(t=>t.createChannel),N=(0,tR.useIssueStore)(t=>t.createIssue),[D,S]=(0,l.useState)(()=>{let e;try{let i=localStorage.getItem(`flexlayout-${t}`);if(i){let t=JSON.parse(i),o=t.borders,a=o?.find(t=>"bottom"===t.location);a&&!a.children.some(t=>"code-favorites"===t.id||"code-favorites"===t.component)&&a.children.push({type:"tab",name:"Favorites",component:"code-favorites",id:"code-favorites"}),a&&!a.children.some(t=>"worktree-panel"===t.id||"worktree-panel"===t.component)&&a.children.push({type:"tab",name:"Worktrees",component:"worktree-panel",id:"worktree-panel"}),e=W.fromJson(t)}else e=W.fromJson(t3)}catch{e=W.fromJson(t3)}return e});(0,l.useEffect)(()=>{let e=()=>{localStorage.removeItem(`flexlayout-${t}`),S(W.fromJson(t3))};return window.addEventListener("reset-layout",e),()=>window.removeEventListener("reset-layout",e)},[t]),(0,l.useEffect)(()=>{m(t),c(t)},[t,m,c]),(0,l.useEffect)(()=>{if(!i)return;let e=e=>{f()&&(e.preventDefault(),window.history.pushState({workspaceId:t,mobileBackGuard:!0},""))};return window.history.replaceState({workspaceId:t,mobileBackGuard:!0},""),window.history.pushState({workspaceId:t,mobileBackGuard:!0},""),window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[f,i,t]),(0,l.useEffect)(()=>{if(s)if(i)E("issue-detail");else{let t=D.getNodeById("issue-detail");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}},[r,s,D,i,E]),(0,l.useEffect)(()=>{if(h)if(i)E("chat");else{let t=D.getNodeById("chat");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}},[u,h,D,i,E]),(0,l.useEffect)(()=>{if(d)if(i)E("code-editor");else{let t=D.getNodeById("code-editor");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}else if(0===tv.useEditorStore.getState().openFiles.length)if(i)E("workfolder");else{let t=D.getNodeById("workfolder");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}},[d,D,i,E]),(0,l.useEffect)(()=>{if(L)if(i)E("workfolder");else{let t=D.getNodeById("workfolder");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}},[L,D,i,E]);let I=(0,tF.useDatabaseStore)(t=>t.activeId);(0,l.useEffect)(()=>{if(I)if(i)E("database");else{let t=D.getNodeById("database");t&&t instanceof y&&D.doAction(p.selectTab(t.getId()))}},[I,D,i,E]),(0,l.useEffect)(()=>{tw.useGitStore.getState().loadStatus(t);let e=setInterval(()=>{tw.useGitStore.getState().loadStatus(t)},3e4);return()=>clearInterval(e)},[t]),(0,l.useEffect)(()=>{if(!i)return;let e=tw.useGitStore.getState();"git-commits"===b&&e.loadLog(t)},[b,t,i]);let C=(0,l.useCallback)(()=>{let e=tS.useWorkspaceStore.getState().workspaces.find(e=>e.id===t),i=e?.notificationSettings;return i?.enabled&&"native"===i.provider&&i.native?.permissionGranted?i:null},[t]),B=(0,l.useCallback)(t=>{let e=t.status.replace(/_/g," ");return t.result?.summary?`${t.title}: ${e} - ${t.result.summary}`:`${t.title}: ${e}`},[]);(0,l.useEffect)(()=>{let e=(0,tA.getWS)(t),i=tM.useNotificationStore.getState();i.load(t);let s=[e.on("issue.created",t=>o.upsertIssue(t)),e.on("issue.updated",t=>o.upsertIssue(t)),e.on("issue.status_changed",t=>{let e=C();if(e){let{from:i,to:o}=t,a=e.events??[];if("in_progress"===o&&a.includes("issue_started")||"completed"===o&&a.includes("issue_completed")){let t=`Status changed: ${i} → ${o}`;(0,tB.sendNativeNotification)("Issue Status Updated",t)}}}),e.on("task.created",t=>{a.upsertTask(t);let e=C();e?.native?.androidOngoingTaskNotification&&(0,tB.sendAndroidOngoingTaskNotification)(B(t))}),e.on("task.updated",t=>{a.upsertTask(t);let e=C();e?.native?.androidOngoingTaskNotification&&(0,tB.sendAndroidOngoingTaskNotification)(B(t))}),e.on("task.status_changed",e=>{let i=tR.useIssueStore.getState().activeIssueId;i&&a.loadTasks(t,i);let o=C();if(o){let{from:t,to:i}=e,a=o.events??[];if("completed"===i&&a.includes("issue_task_completed")){let e=`Status changed: ${t} → ${i}`;(0,tB.sendNativeNotification)("Task Status Updated",e)}}}),e.on("notification.created",t=>{i.addNotification(t),C()&&(0,tB.sendNativeNotification)(t.title,t.description||"")}),e.on("notification.cleared",()=>{i.reset()}),e.on("inspector.jump",e=>{let{path:i,name:o,line:a,column:s,timestamp:n}=e,r=s??1;tU.useInspectorHistoryStore.getState().addEntry(t,{path:i,name:o,line:a,column:r,timestamp:n??Date.now()}),tU.useInspectorHistoryStore.getState().setPendingJump({workspaceId:t,path:i,line:a,column:r})})];return()=>s.forEach(t=>t())},[o,a,t,C,B]);let M=(0,l.useCallback)(i=>{switch(i.getComponent()){case"channel-list":return(0,n.jsx)(tj,{workspaceId:t});case"issue-list":return(0,n.jsx)(tz,{workspaceId:t});case"workfolder":return(0,n.jsx)(tY,{workspaceId:t});case"code-editor":return(0,n.jsx)(tW,{workspaceId:t});case"chat":return(0,n.jsx)(tH,{workspaceId:t});case"issue-detail":return(0,n.jsx)(tk,{workspaceId:t});case"terminal":return(0,n.jsx)(tX,{workspaceId:t,boundDirs:e});case"git-commits":return(0,n.jsx)(tG,{workspaceId:t});case"project-settings":return(0,n.jsx)(tV,{workspaceId:t});case"code-favorites":return(0,n.jsx)(tJ,{workspaceId:t});case"worktree-panel":return(0,n.jsx)(t2,{workspaceId:t});case"database":return(0,n.jsx)(tQ,{workspaceId:t});case"database-list":return(0,n.jsx)(t0,{workspaceId:t});case"kanban":return(0,n.jsx)(t1,{workspaceId:t});default:return(0,n.jsx)(t7,{name:i.getName()})}},[e,t]),U=(0,tO.useTaskStore)(t=>t.tasks),F=(0,l.useCallback)((t,e)=>{let i=t.getComponent();if(!i)return;let o=(0,ty.renderTabIcon)(i,t.getName(),g,_,T,U);o&&(e.content=o)},[g,_,T,U]),P=(0,l.useCallback)((e,i)=>{if(i.type!==p.SELECT_TAB)try{localStorage.setItem(`flexlayout-${t}`,JSON.stringify(e.toJson()))}catch{}if(i.type!==p.SELECT_TAB)return;let o=e.getNodeById(i.data.tabNode);if(!o||!(o instanceof y))return;let a=o.getComponent(),s=ty.RIGHT_TO_LEFT_TAB_MAP[a??""];if(s){let t=e.getNodeById(s);t&&t instanceof y&&e.doAction(p.selectTab(t.getId()))}let n=tw.useGitStore.getState();"git-commits"===a&&(n.loadStatus(t),n.loadDiffs(t),n.loadLog(t))},[t]);return i?(0,n.jsxs)("div",{className:"relative h-full w-full",children:[(0,n.jsx)(t6,{panel:b,workspaceId:t,boundDirs:e}),(0,n.jsx)(tZ,{}),(0,n.jsx)(t$,{}),(0,n.jsx)(tq,{}),(0,n.jsx)(tK,{}),(0,n.jsx)(t5,{open:A,onOpenChange:t=>{t||R(!1)},workspaceId:t,agents:x,onSubmit:e=>w(t,e.name,e.type,e.members)}),(0,n.jsx)(t8,{open:O,onOpenChange:t=>{t||v(!1)},agents:x,onSubmit:e=>N(t,e.title,e.description,e.members,e.workflowId)})]}):(0,n.jsxs)("div",{className:"relative h-full w-full",children:[(0,n.jsx)(tL,{model:D,factory:M,onRenderTab:F,onModelChange:P}),(0,n.jsx)(tZ,{}),(0,n.jsx)(t$,{}),(0,n.jsx)(tq,{}),(0,n.jsx)(tK,{}),(0,n.jsx)(t5,{open:A,onOpenChange:t=>{t||R(!1)},workspaceId:t,agents:x,onSubmit:e=>w(t,e.name,e.type,e.members)}),(0,n.jsx)(t8,{open:O,onOpenChange:t=>{t||v(!1)},agents:x,onSubmit:e=>N(t,e.title,e.description,e.members,e.workflowId)})]})}],161316)},817465,t=>{t.n(t.i(161316))}]);