@wildo-ai/application-creation-workbench 1.1.13 → 1.1.15

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 (180) hide show
  1. package/dist/.vite/manifest.json +552 -551
  2. package/dist/assets/{ChartEmptyState-bpvSJ-cb.js → ChartEmptyState-ZXRcbrLV.js} +1 -1
  3. package/dist/assets/ChartLoadingSkeleton-BRWWLwJE.js +1 -0
  4. package/dist/assets/{ChartView-Qqvf_azZ.js → ChartView-B6f1J6Er.js} +2 -2
  5. package/dist/assets/ChartWidget-29BcqLsQ.js +5 -0
  6. package/dist/assets/{abnfDiagram-VCTEODGH-RkKb7ovy.js → abnfDiagram-VCTEODGH-BuQmdgCH.js} +1 -1
  7. package/dist/assets/{af-Bk6Hmdgu.js → af-CBNa7AYn.js} +1 -1
  8. package/dist/assets/{ar-BjZAek7V.js → ar-RghUrw-U.js} +1 -1
  9. package/dist/assets/{architectureDiagram-5GKGNRK7-Cpy0QsiS.js → architectureDiagram-5GKGNRK7-BVyAQs-b.js} +1 -1
  10. package/dist/assets/badge-tone-Ci8vno_R.js +5 -0
  11. package/dist/assets/{bg-DwzfvwBN.js → bg-D_WdYZi3.js} +1 -1
  12. package/dist/assets/{blockDiagram-I7D4REHJ-DPWa_xRc.js → blockDiagram-I7D4REHJ-R2VdOZ1H.js} +1 -1
  13. package/dist/assets/{bn-Ja9jaMTl.js → bn-Do7unCCm.js} +1 -1
  14. package/dist/assets/{c4Diagram-7LVT6UL2-Bw5u3oez.js → c4Diagram-7LVT6UL2-Bslw228e.js} +1 -1
  15. package/dist/assets/{ca-DcbVfECQ.js → ca-CRZTbRqC.js} +1 -1
  16. package/dist/assets/channel-DxaB-rRG.js +1 -0
  17. package/dist/assets/{chunk-4HAMMTFA-C1vaphAY.js → chunk-4HAMMTFA-DUDg3eHK.js} +1 -1
  18. package/dist/assets/{chunk-75Z2AOVW-20u1rKqW.js → chunk-75Z2AOVW-DaeXzHyk.js} +1 -1
  19. package/dist/assets/{chunk-DU6HZSFF-CU7JHG0o.js → chunk-DU6HZSFF-B3UMRfg8.js} +2 -2
  20. package/dist/assets/{chunk-F27PBJKO-DiphvwD7.js → chunk-F27PBJKO-BEX6D1-n.js} +1 -1
  21. package/dist/assets/{chunk-GMAD6QVW-Dq2XOoJg.js → chunk-GMAD6QVW-ZsbK8Hyz.js} +1 -1
  22. package/dist/assets/{chunk-GVQU2GXP-CBXRxA1C.js → chunk-GVQU2GXP-CFgk1428.js} +1 -1
  23. package/dist/assets/{chunk-IMKFNOWR-CfysfMZ8.js → chunk-IMKFNOWR-Bl09s7a_.js} +1 -1
  24. package/dist/assets/{chunk-L3NEJ4N5-ByuBfdXC.js → chunk-L3NEJ4N5-zKVzE7OW.js} +1 -1
  25. package/dist/assets/{chunk-OSK3NFVY-SIWGDFJo.js → chunk-OSK3NFVY-BmuNqHzQ.js} +1 -1
  26. package/dist/assets/{chunk-P2QGCYS3-DCiOi1YZ.js → chunk-P2QGCYS3-C2tydC-M.js} +1 -1
  27. package/dist/assets/{chunk-POPQ4Y6H-BdHV60NS.js → chunk-POPQ4Y6H-DNak0l6w.js} +1 -1
  28. package/dist/assets/{chunk-PWAF6VOD-BsKqezYC.js → chunk-PWAF6VOD-D95y-mRG.js} +1 -1
  29. package/dist/assets/{chunk-SHT3W25Y-NnS-qlZ0.js → chunk-SHT3W25Y-BK0XKr9M.js} +1 -1
  30. package/dist/assets/{chunk-SVP7TREG-DHHk5-nb.js → chunk-SVP7TREG-CD0633UP.js} +1 -1
  31. package/dist/assets/{chunk-TICWLB2K-BsfGmrb3.js → chunk-TICWLB2K-C_TN_qXz.js} +1 -1
  32. package/dist/assets/classDiagram-ZZMXUADV-Cb5NNOFP.js +1 -0
  33. package/dist/assets/classDiagram-v2-VYDZK3BY-Cb5NNOFP.js +1 -0
  34. package/dist/assets/cm6-editor-CsI0AZDl.js +13 -0
  35. package/dist/assets/{code-block-IT6T5CEO-Bephdl7e.js → code-block-IT6T5CEO-rh8d07_F.js} +1 -1
  36. package/dist/assets/{context-T13XYDZY.js → context-9KbckYZi.js} +1 -1
  37. package/dist/assets/{cs-tnBN9HbI.js → cs-LJwt8LR2.js} +1 -1
  38. package/dist/assets/{cy-DJqxjV0d.js → cy-BlvpCYgb.js} +1 -1
  39. package/dist/assets/{cynefinDiagram-5FMLGOSQ-BkjZtE8s.js → cynefinDiagram-5FMLGOSQ-DxRmh9t5.js} +1 -1
  40. package/dist/assets/{da-Ca05BK_3.js → da-BUvDMABw.js} +1 -1
  41. package/dist/assets/{dagre-GXQ25YYZ-DzDsrai8.js → dagre-GXQ25YYZ-w2hLzSss.js} +1 -1
  42. package/dist/assets/{de-AT-BX1jIQXB.js → de-AT-CMYX-FSX.js} +1 -1
  43. package/dist/assets/{de-C9jUnjyM.js → de-Cg_5asH4.js} +1 -1
  44. package/dist/assets/{diagram-S7CK7UJ4-Cwa24pyR.js → diagram-S7CK7UJ4-CNrSaCrT.js} +1 -1
  45. package/dist/assets/{diagram-UQ7AKVKN-C0onRf4Z.js → diagram-UQ7AKVKN-BEoR36FG.js} +1 -1
  46. package/dist/assets/{diagram-VSXAHHWV-B8xjjT13.js → diagram-VSXAHHWV-Dy8S8rIp.js} +1 -1
  47. package/dist/assets/{diagram-VX7I27RA-CHFg3ge_.js → diagram-VX7I27RA-BC8Xf9f0.js} +1 -1
  48. package/dist/assets/{diagram-Z3DM3KII-BTt-uk0J.js → diagram-Z3DM3KII-CKiC1nrY.js} +1 -1
  49. package/dist/assets/{dist-C-bJB-2H.js → dist-1-HCT6qM.js} +1 -1
  50. package/dist/assets/{dist-Cl5h6dau.js → dist-BQ8k61qr.js} +1 -1
  51. package/dist/assets/{dist-CIX5O8MF.js → dist-BYbvqYeK.js} +1 -1
  52. package/dist/assets/{dist-CKL3Vsb1.js → dist-Bi-7RiEi.js} +1 -1
  53. package/dist/assets/{dist-rySWqc-_.js → dist-Ble3IUnd.js} +1 -1
  54. package/dist/assets/{dist-Cjqmi1vD.js → dist-BuE0_QYF.js} +1 -1
  55. package/dist/assets/{dist-CD-6W0UW.js → dist-C2PLdFfo.js} +1 -1
  56. package/dist/assets/{dist-QhFPi3vQ.js → dist-CSrdLN_Y.js} +1 -1
  57. package/dist/assets/{dist-B4XHlUdM.js → dist-CY9MvaM1.js} +1 -1
  58. package/dist/assets/{dist-26ViD93u.js → dist-CgVofDKX.js} +1 -1
  59. package/dist/assets/{dist-uyPo4CC0.js → dist-Ciqde0Ol.js} +1 -1
  60. package/dist/assets/{dist-BMz3c4XD.js → dist-Cj_xL7Es.js} +1 -1
  61. package/dist/assets/{dist-C9IE-VSa.js → dist-D7MnPcGE.js} +1 -1
  62. package/dist/assets/{dist-GFkidrN0.js → dist-DBEagOph.js} +1 -1
  63. package/dist/assets/{dist-BSK9ZFAB.js → dist-DCP6b5Yp.js} +1 -1
  64. package/dist/assets/{dist-DBD6m0JS.js → dist-DChuQCpL.js} +1 -1
  65. package/dist/assets/{dist-y9EDIi1P.js → dist-DOFuKjhK.js} +1 -1
  66. package/dist/assets/{dist-DdyVsEPF.js → dist-DXUYhDMM.js} +1 -1
  67. package/dist/assets/{dist-UoPuPrUB.js → dist-Dek2gQIT.js} +1 -1
  68. package/dist/assets/{dist-DxRnokOu.js → dist-ddtYIZHC.js} +1 -1
  69. package/dist/assets/{dist-DmRe1vI4.js → dist-jCSCdtJ7.js} +1 -1
  70. package/dist/assets/{dist-BrKATYI_.js → dist-ngz3bapC.js} +1 -1
  71. package/dist/assets/{dist-DTDoXkKw.js → dist-ssfnxGX1.js} +1 -1
  72. package/dist/assets/{dropbox-picker-DKjSUSy7.js → dropbox-picker-YaUvIgU1.js} +1 -1
  73. package/dist/assets/{ebnfDiagram-PWID7BFC-D7axqFSr.js → ebnfDiagram-PWID7BFC-CBnxtxcg.js} +1 -1
  74. package/dist/assets/{el-DiE5RiPH.js → el-5l_HfQh-.js} +1 -1
  75. package/dist/assets/{en-AU-BWrv-wCE.js → en-AU-DIy7kJ-6.js} +1 -1
  76. package/dist/assets/{en-CA-H-IdnQXN.js → en-CA-BY8gTlj5.js} +1 -1
  77. package/dist/assets/{en-GB-D84jH8wH.js → en-GB-BGqFfEzK.js} +1 -1
  78. package/dist/assets/{erDiagram-RLTQ6QDP-BhfvT_iW.js → erDiagram-RLTQ6QDP-ZW5EDEeK.js} +1 -1
  79. package/dist/assets/{es-vrQFTnXZ.js → es-Bb0Mmwm4.js} +1 -1
  80. package/dist/assets/{esm-CoNe2i-j.js → esm-CfFZhCCl.js} +1 -1
  81. package/dist/assets/esm-DDY4jF6a.js +46 -0
  82. package/dist/assets/{et-Bw_JuPH8.js → et-BSa6lvqX.js} +1 -1
  83. package/dist/assets/{eu-C5I3pguf.js → eu-9Yfh6o5v.js} +1 -1
  84. package/dist/assets/{fa-IR-C4oEKL13.js → fa-IR-BlqDoYrh.js} +1 -1
  85. package/dist/assets/{fi-BcLdAiF0.js → fi-Cj9cD91h.js} +1 -1
  86. package/dist/assets/flowDiagram-HODETNUW-Br3H18HF.js +1 -0
  87. package/dist/assets/{flows-actors-graph-runtime-DI3n8jVc.js → flows-actors-graph-runtime-YwzVDPst.js} +1 -1
  88. package/dist/assets/{fr-CGyuQ4Gm.js → fr-B0qYMnPX.js} +1 -1
  89. package/dist/assets/{fr-CA-C3AJ7JuM.js → fr-CA-C2acOTEv.js} +1 -1
  90. package/dist/assets/{ganttDiagram-EL5Y4UJY-DLhOm_Zc.js → ganttDiagram-EL5Y4UJY-D0NWXhSy.js} +1 -1
  91. package/dist/assets/{gitGraphDiagram-WWUBYQGX-01OzLEYx.js → gitGraphDiagram-WWUBYQGX-C16HvgtP.js} +1 -1
  92. package/dist/assets/{gl-ClWJq0NN.js → gl-Ce_1v5yA.js} +1 -1
  93. package/dist/assets/{google-drive-picker-Ds6m-aGn.js → google-drive-picker-DL6kxOGz.js} +1 -1
  94. package/dist/assets/{graph-runtime-DFxhReh6.js → graph-runtime-BDCDECWS.js} +1 -1
  95. package/dist/assets/{he-DtPc9727.js → he-fssXNSLh.js} +1 -1
  96. package/dist/assets/{hi-Cxklbhrz.js → hi-wjit_WaO.js} +1 -1
  97. package/dist/assets/{hr-CJI_0dF1.js → hr-CZcH_ib_.js} +1 -1
  98. package/dist/assets/{hu-DEsMSN-h.js → hu-DmApBwDg.js} +1 -1
  99. package/dist/assets/{id-Av8sk-t7.js → id-CaQxvUk5.js} +1 -1
  100. package/dist/assets/index-CZ5sv4PP.css +2 -0
  101. package/dist/assets/index-Da7nRw0z.js +202 -0
  102. package/dist/assets/{infoDiagram-27XIBGKW-w-KKxZud.js → infoDiagram-27XIBGKW-BB9zejj7.js} +1 -1
  103. package/dist/assets/{is-Y2NB-lkJ.js → is-C7YkCQSO.js} +1 -1
  104. package/dist/assets/isSameWeek-B-QyK2gA.js +1 -0
  105. package/dist/assets/{ishikawaDiagram-5VMMS53U-bMzgiKpZ.js → ishikawaDiagram-5VMMS53U-D0VdeBWj.js} +1 -1
  106. package/dist/assets/{it-CQvYk9FM.js → it--OaDSi8G.js} +1 -1
  107. package/dist/assets/{ja-BUQZbvab.js → ja-BZII__KN.js} +1 -1
  108. package/dist/assets/{journeyDiagram-3NMN7TZE-Ds4WwsuL.js → journeyDiagram-3NMN7TZE-BAlcsabK.js} +1 -1
  109. package/dist/assets/{kanban-definition-UXKFOSKX-BrYusAP6.js → kanban-definition-UXKFOSKX-DpR1bfHx.js} +1 -1
  110. package/dist/assets/katex-CHQwrTZL.js +1 -0
  111. package/dist/assets/{ko-DFCJZSJ5.js → ko-RpFeRS3z.js} +1 -1
  112. package/dist/assets/{line-CbGUUIqn.js → line-sQ28MnTc.js} +1 -1
  113. package/dist/assets/{linear-CZlw_kAt.js → linear-B5bg3HtL.js} +1 -1
  114. package/dist/assets/{lt-SSNzpl4l.js → lt-Mb4LqnAa.js} +1 -1
  115. package/dist/assets/{lv-ChFDzo6N.js → lv-D333_Qfx.js} +1 -1
  116. package/dist/assets/{markdown-stream-runtime-B_LlW3_g.js → markdown-stream-runtime-kB8TMEpF.js} +4 -4
  117. package/dist/assets/{match-BSxRnzW7.js → match-BwzNbvxk.js} +1 -1
  118. package/dist/assets/{match-DR_vZ1pS.js → match-DQpkdx9H.js} +1 -1
  119. package/dist/assets/mermaid-VLURNSYL-DUd6jtzD.js +1 -0
  120. package/dist/assets/{mermaid.core-DfG79j_h.js → mermaid.core-DY7EfcRK.js} +4 -4
  121. package/dist/assets/{mindmap-definition-YA3MSWOX-BAoreBgb.js → mindmap-definition-YA3MSWOX-DAHZInIk.js} +1 -1
  122. package/dist/assets/{ms-CudItD7-.js → ms-CLbOeyRX.js} +1 -1
  123. package/dist/assets/{mt-JcjtZ6VF.js → mt-PLOofk2t.js} +1 -1
  124. package/dist/assets/{nb-C6brsbnR.js → nb-DxwrcYvh.js} +1 -1
  125. package/dist/assets/{nl-B0Pe8Tqa.js → nl-CzRLOR7M.js} +1 -1
  126. package/dist/assets/node-YCCWYXNI.js +2 -0
  127. package/dist/assets/{onedrive-picker-0mB1UsJj.js → onedrive-picker-B79jNUe8.js} +1 -1
  128. package/dist/assets/{pdf-viewer-CJ-YXdjU.js → pdf-viewer-CslUZhU5.js} +1 -1
  129. package/dist/assets/{pegDiagram-XKGWAZYB-DoKc8_Wl.js → pegDiagram-XKGWAZYB-Dq7UThjR.js} +1 -1
  130. package/dist/assets/{pieDiagram-E7YTZNPT-CehZeN4E.js → pieDiagram-E7YTZNPT-Dl3n9rSp.js} +1 -1
  131. package/dist/assets/{pl-EL8a3tlp.js → pl-gbLhckq3.js} +1 -1
  132. package/dist/assets/{pt-BR-Dsdazh3s.js → pt-BR-R1rW_1OL.js} +1 -1
  133. package/dist/assets/{pt-DGtOJAQd.js → pt-BwcWNQjq.js} +1 -1
  134. package/dist/assets/{public-runtime-D-EeE8cv.js → public-runtime-8slf2C-u.js} +2 -2
  135. package/dist/assets/{quadrantDiagram-AXDQQJYC-jliIzJvq.js → quadrantDiagram-AXDQQJYC-_GKiRjuD.js} +1 -1
  136. package/dist/assets/{railroadDiagram-O6MQD6OU-DCWwFine.js → railroadDiagram-O6MQD6OU-6CUNSmGg.js} +1 -1
  137. package/dist/assets/{requirementDiagram-BXWQKSXE-CNJsk6WA.js → requirementDiagram-BXWQKSXE-BPl-usp2.js} +1 -1
  138. package/dist/assets/{ro-BiQPz_H9.js → ro-DdDjuWNa.js} +1 -1
  139. package/dist/assets/{ru-JNyRQsbW.js → ru-BawxQnYH.js} +1 -1
  140. package/dist/assets/{sankeyDiagram-P5KCCOFB-BzRe86bg.js → sankeyDiagram-P5KCCOFB-DZKA85RO.js} +1 -1
  141. package/dist/assets/{sequenceDiagram-WJ2MYXX4-Vn8b-vQE.js → sequenceDiagram-WJ2MYXX4-BJQcyiuO.js} +1 -1
  142. package/dist/assets/{sk-BcYdCgZc.js → sk-MRZEZ2K_.js} +1 -1
  143. package/dist/assets/{sl-C9qbM-iW.js → sl-BBub_-u1.js} +1 -1
  144. package/dist/assets/{stateDiagram-D77RDMKH-NvwN6uqL.js → stateDiagram-D77RDMKH-B-0Pxnb4.js} +1 -1
  145. package/dist/assets/stateDiagram-v2-MP3YSRHH-Ctzs0iNL.js +1 -0
  146. package/dist/assets/{sv-CKhM__fc.js → sv-C4z9pgWx.js} +1 -1
  147. package/dist/assets/{swimlanes-42K2YHIH-C-3fXu5i.js → swimlanes-42K2YHIH-oICSfvZv.js} +1 -1
  148. package/dist/assets/swimlanesDiagram-VR7AAH4N-Bhf7f3Wn.js +8 -0
  149. package/dist/assets/{ta-BUOrrGS2.js → ta-1G1MUVAA.js} +1 -1
  150. package/dist/assets/{th-D9u0kyJy.js → th-CbVjLGeK.js} +1 -1
  151. package/dist/assets/{timeline-definition-24CTP7MA-P-CvBruH.js → timeline-definition-24CTP7MA-DmKkaTSI.js} +1 -1
  152. package/dist/assets/{tr-YPFOc1ew.js → tr-CL1-pTfR.js} +1 -1
  153. package/dist/assets/useI18n-DcSZnYEx.js +171 -0
  154. package/dist/assets/{vennDiagram-4TSXK5OY-B3bTjEC-.js → vennDiagram-4TSXK5OY-CnK77vBm.js} +1 -1
  155. package/dist/assets/{vi-ChXhbB_B.js → vi-1ZMJLve8.js} +1 -1
  156. package/dist/assets/{wardleyDiagram-VM6X3IG4-Dypi6Z9c.js → wardleyDiagram-VM6X3IG4-DkkVnAra.js} +1 -1
  157. package/dist/assets/{xychartDiagram-S5SC5T6Z-BTlV8gMe.js → xychartDiagram-S5SC5T6Z-DXVlr43t.js} +1 -1
  158. package/dist/assets/{zh-CN-BdicaTVy.js → zh-CN-uOTSXSf7.js} +1 -1
  159. package/dist/assets/{zh-HK-CJnlVP26.js → zh-HK-CNYirMD2.js} +1 -1
  160. package/dist/assets/{zh-TW-DxRFH8WI.js → zh-TW-DB-dAf15.js} +1 -1
  161. package/dist/index.html +10 -10
  162. package/package.json +10 -10
  163. package/dist/assets/ChartLoadingSkeleton-njpdx6Xq.js +0 -1
  164. package/dist/assets/ChartWidget-BfFSlmcK.js +0 -5
  165. package/dist/assets/badge-tone-C1lf98-p.js +0 -5
  166. package/dist/assets/channel-DNblg53t.js +0 -1
  167. package/dist/assets/classDiagram-ZZMXUADV-BFJaoqij.js +0 -1
  168. package/dist/assets/classDiagram-v2-VYDZK3BY-BFJaoqij.js +0 -1
  169. package/dist/assets/cm6-editor-2ff9P4C4.js +0 -13
  170. package/dist/assets/esm-GhLumFjl.js +0 -46
  171. package/dist/assets/flowDiagram-HODETNUW-392dI3Z6.js +0 -1
  172. package/dist/assets/index-Bcdys-EF.css +0 -2
  173. package/dist/assets/index-tbQuFgg9.js +0 -202
  174. package/dist/assets/isSameWeek-DD3c86C9.js +0 -1
  175. package/dist/assets/katex-B49ulZim.js +0 -1
  176. package/dist/assets/mermaid-VLURNSYL-uoY3A_2r.js +0 -1
  177. package/dist/assets/node-Cq1VMMYg.js +0 -2
  178. package/dist/assets/stateDiagram-v2-MP3YSRHH-CtrY6mXm.js +0 -1
  179. package/dist/assets/swimlanesDiagram-VR7AAH4N-I2Ys-udk.js +0 -8
  180. package/dist/assets/useI18n-DqSBcroP.js +0 -171
@@ -1,46 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChartView-Qqvf_azZ.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/jsx-runtime-lTuChwRC.js","assets/react-9WV3M1gM.js","assets/useI18n-DqSBcroP.js","assets/public-runtime-D-EeE8cv.js","assets/bundle-mjs-H9shJLym.js","assets/badge-tone-C1lf98-p.js","assets/ChartEmptyState-bpvSJ-cb.js","assets/ChartLoadingSkeleton-njpdx6Xq.js","assets/ChartWidget-BfFSlmcK.js","assets/react-dom-DQGBdIds.js","assets/preload-helper-7y9sWmk5.js","assets/flows-actors-graph-runtime-DI3n8jVc.js","assets/node-Cq1VMMYg.js","assets/esm-CoNe2i-j.js","assets/index-tbQuFgg9.js","assets/src-C_gRsKqw.js","assets/index-Bcdys-EF.css"])))=>i.map(i=>d[i]);
2
- import{a as e,r as t,t as n}from"./rolldown-runtime-BWaJ3C7D.js";import{t as r}from"./react-9WV3M1gM.js";import{t as i}from"./react-dom-DQGBdIds.js";import{$C as a,$E as o,$T as s,$a as c,$c as l,$i as u,$l as d,$n as f,$o as p,$r as m,$t as h,$w as g,$y as _,A as v,AS as y,AT as b,A_ as x,Aa as S,Ab as C,Af as w,Ah as T,Ai as E,Am as D,An as O,Ao as k,Ap as A,Ar as j,At as M,Au as N,Av as P,Aw as F,Ax as I,Ay as ee,B as L,BC as R,BE as z,BT as te,B_ as ne,Ba as re,Bf as ie,Bg as ae,Bh as oe,Bi as se,Bm as ce,Bn as le,Bp as ue,Br as de,Bt as fe,Bv as pe,Bw as me,Bx as he,By as ge,C as _e,CD as ve,CT as ye,C_ as be,Ca as xe,Cb as Se,Cd as Ce,Cg as we,Ci as Te,Cm as Ee,Cn as De,Cp as Oe,Cr as ke,Ct as Ae,Cv as je,Cw as Me,Cy as Ne,D as Pe,DC as Fe,DD as B,DE as Ie,DS as Le,DT as Re,Da as ze,Db as Be,Df as Ve,Dg as He,Dh as Ue,Di as We,Dn as Ge,Do as Ke,Dr as qe,Dt as Je,Du as Ye,Dv as Xe,Dw as Ze,E as Qe,EC as $e,ED as et,EE as tt,ES as nt,ET as rt,Ea as it,Eb as at,Ec as ot,Ef as st,Em as ct,En as lt,Eo as ut,Ep as dt,Er as ft,Et as pt,Eu as mt,Ev as ht,Ew as gt,Ey as _t,F as vt,FC as yt,FE as bt,FT as xt,Fa as St,Fb as Ct,Fd as wt,Fg as Tt,Fi as Et,Fm as Dt,Fn as Ot,Fp as kt,Fr as At,Ft as V,Fw as jt,Fx as Mt,G as Nt,GC as Pt,GT as Ft,G_ as It,Ga as Lt,Gb as Rt,Gg as zt,Gi as Bt,Gl as Vt,Gn as Ht,Gp as Ut,Gr as Wt,Gt,Gu as Kt,Gw as qt,Gx as Jt,Gy as Yt,H as Xt,HE as Zt,HT as Qt,H_ as $t,Ha as en,Hb as tn,Hg as nn,Hh as rn,Hi as an,Hn as on,Hp as sn,Hr as cn,Ht as ln,Hw as un,Hx as dn,Hy as fn,I as pn,IC as mn,IE as hn,IT as gn,Ia as _n,Id as vn,If as yn,Ig as bn,Ih as xn,Ii as Sn,Il as Cn,Im as wn,In as Tn,Ip as En,Ir as Dn,It as On,Iu as kn,Iw as An,Ix as jn,Iy as Mn,J as Nn,JC as Pn,JE as Fn,JS as In,Ja as Ln,Jb as Rn,Ji as zn,Jn as Bn,Jo as Vn,Jp as Hn,Jr as Un,Jt as Wn,Ju as Gn,Jw as Kn,Jx as qn,Jy as Jn,K as Yn,KC as Xn,KE as Zn,KT as Qn,Ka as H,Kb as $n,Kh as er,Ki as tr,Kn as nr,Kr as rr,Kt as eee,Kv as ir,Kw as ar,Kx as or,L as sr,LE as cr,LT as lr,La as ur,Lf as tee,Lg as dr,Li as fr,Lm as nee,Ln as ree,Lp as iee,Lr as pr,Ls as mr,Lt as hr,Lw as aee,Lx as oee,Ly as gr,M as _r,MC as vr,ME as yr,MS as see,MT as cee,Ma as lee,Mb as uee,Mf as br,Mg as xr,Mh as dee,Mi as Sr,Mm as Cr,Mn as fee,Mo as pee,Mr as mee,Mt as hee,Mu as gee,Mv as _ee,Mw as vee,Mx as wr,My as Tr,N as Er,NC as Dr,NE as Or,NT as kr,N_ as yee,Na as bee,Nf as Ar,Nh as xee,Ni as See,Nm as Cee,Nn as jr,No as Mr,Np as Nr,Nr as wee,Nt as U,Nu as Pr,Nv as Tee,Nw as Eee,Nx as Fr,O as Ir,OC as Lr,OE as Rr,OS as zr,OT as Br,Oa as Dee,Ob as Vr,Od as Oee,Og as Hr,Oh as kee,Oi as Ur,Ol as Aee,Om as Wr,On as jee,Or as Mee,Ot as Gr,Ou as Kr,Ov as Nee,Ow as qr,Ox as Pee,Oy as Jr,P as Yr,PC as Xr,PS as Zr,PT as Qr,Pa as $r,Pb as ei,Pd as Fee,Pf as Iee,Pg as ti,Ph as ni,Pi as Lee,Pm as Ree,Pn as ri,Pp as zee,Pr as Bee,Pt as ii,Pv as Vee,Pw as Hee,Py as Uee,Q as Wee,QE as ai,QT as Gee,Qa as oi,Qi as si,Ql as ci,Qn as li,Qo as ui,Qr as Kee,Qt as di,Qv as qee,Qw as Jee,Qx as Yee,Qy as Xee,R as fi,RC as pi,RT as Zee,Ra as Qee,Rb as $ee,Rd as mi,Rg as hi,Rh as gi,Ri as ete,Rn as _i,Rp as tte,Rr as nte,Rt as rte,Rw as vi,Rx as yi,Ry as ite,S as bi,SD as xi,ST as Si,Sa as Ci,Sb as wi,Sd as Ti,Sg as Ei,Si as Di,Sl as Oi,Sm as ki,Sn as Ai,So as ji,Sr as Mi,St as ate,Sv as Ni,Sw as Pi,Sy as ote,T as Fi,TC as ste,TD as Ii,TE as Li,TT as Ri,Ta as cte,Tb as zi,Td as Bi,Tf as lte,Tg as Vi,Th as Hi,Tn as Ui,To as ute,Tp as dte,Tr as fte,Tt as Wi,Tv as Gi,Tw as pte,U as Ki,UC as qi,UE as mte,UT as Ji,U_ as Yi,Ua as hte,Ub as gte,Ug as Xi,Uh as Zi,Ui as _te,Um as vte,Un as yte,Ur as Qi,Ut as bte,Uu as xte,Ux as $i,V as Ste,VC as ea,VE as ta,Va as Cte,Vb as na,Vg as wte,Vi as Tte,Vn as Ete,Vo as Dte,Vr as ra,Vt as Ote,Vv as ia,Vw as kte,Vx as Ate,Vy as aa,W as oa,WC as sa,Wa as ca,Wf as jte,Wg as la,Wh as Mte,Wi as ua,Wn as Nte,Wo as da,Wp as fa,Wr as pa,Wt as ma,Wu as ha,Ww as Pte,Wx as ga,X as _a,XC as va,XE as ya,XT as ba,Xa as xa,Xb as Sa,Xf as Fte,Xi as Ca,Xl as Ite,Xn as wa,Xo as Ta,Xr as Ea,Xt as Da,Xv as Oa,Xw as ka,Xx as Aa,Xy as ja,Y as Lte,YC as Ma,YE as Na,YS as Pa,YT as Fa,Ya as Rte,Yi as zte,Yl as Ia,Yn as Bte,Yo as Vte,Yp as Hte,Yr as La,Yt as Ra,Yw as za,Yx as Ba,Yy as Va,Z as Ha,ZC as Ua,ZE as Wa,ZS as Ga,ZT as Ka,Z_ as qa,Za as Ute,Zb as Wte,Zi as Gte,Zl as Kte,Zm as qte,Zn as Jte,Zo as Yte,Zp as Ja,Zr as Xte,Zt as Ya,Zv as Zte,Zw as Xa,Zx as Za,Zy as Qte,_ as $te,_D as Qa,_E as $a,_T as eo,_a as ene,_b as tne,_d as to,_g as no,_h as ro,_i as nne,_m as io,_n as ao,_o as oo,_r as rne,_s as so,_t as co,_w as ine,_x as ane,a as one,aC as lo,aD as uo,aT as sne,a_ as fo,aa as po,ab as mo,ad as cne,ai as ho,al as lne,am as go,an as _o,ar as une,at as dne,au as vo,ax as W,ay as yo,b as bo,bD as xo,bE as So,bT as Co,b_ as wo,ba as To,bd as Eo,bg as Do,bh as Oo,bi as ko,bl as Ao,bm as jo,bn as fne,bo as pne,br as mne,bs as hne,bt as Mo,bu as gne,bw as No,by as Po,c as Fo,cC as _ne,cE as vne,cT as Io,ca as yne,cg as Lo,ci as bne,cl as Ro,cm as zo,cn as xne,co as Bo,cp as Vo,cr as Sne,ct as Ho,cu as Cne,cv as Uo,cw as wne,cy as Wo,d as Tne,dD as Go,dT as Ko,da as Ene,dg as Dne,dh as One,di as qo,dm as Jo,dn as kne,do as Yo,dr as Ane,dt as jne,du as Mne,dv as Nne,dw as Xo,dx as Zo,eC as Qo,eD as $o,eE as es,eT as Pne,e_ as ts,ea as Fne,eg as Ine,ei as ns,em as rs,en as is,eo as as,ep as Lne,er as Rne,eu as zne,ew as Bne,f as os,fD as ss,fE as cs,fT as Vne,fa as Hne,fd as ls,fh as us,fi as ds,fm as fs,fn as ps,fo as Une,fr as Wne,ft as ms,fu as hs,fv as gs,fy as _s,g as vs,gD as ys,gE as bs,gS as xs,gT as Ss,g_ as Cs,ga as ws,gb as Ts,gg as Es,gi as Ds,gl as Os,gm as ks,gn as As,gr as js,gt as Ms,gu as Ns,gw as Ps,gx as Fs,gy as Is,h as Ls,hD as Rs,hE as zs,hT as Bs,ha as Vs,hg as Hs,hi as Us,hl as Ws,hn as Gs,ho as Ks,hp as qs,hr as Js,ht as Ys,hw as Xs,hy as Zs,i as Qs,iC as $s,iD as ec,iE as tc,iT as Gne,i_ as Kne,ia as qne,ii as nc,il as Jne,im as Yne,in as rc,ip as ic,ir as Xne,it as Zne,iy as Qne,j as ac,jC as oc,jE as sc,jS as cc,jT as $ne,ja as ere,jf as tre,jg as lc,jh as nre,ji as uc,jm as dc,jn as fc,jo as rre,jp as pc,jr as mc,jt as hc,ju as gc,jv as _c,jw as vc,jx as yc,k as bc,kC as xc,kE as Sc,kT as ire,k_ as Cc,ka as wc,kb as are,kg as Tc,kh as ore,ki as sre,km as cre,ko as lre,kp as ure,kr as Ec,kt as Dc,ku as Oc,kv as kc,kw as Ac,kx as jc,ky as Mc,l as Nc,lC as Pc,lD as Fc,lE as Ic,lT as Lc,la as dre,lb as Rc,lg as fre,li as pre,lm as zc,ln as Bc,lo as mre,lp as hre,lr as gre,lt as _re,lu as vre,lv as Vc,lw as yre,lx as bre,m as Hc,mD as Uc,mE as Wc,mT as xre,ma as Sre,mg as Gc,mh as Cre,mi as Kc,ml as qc,mn as Jc,mo as wre,mp as Tre,mr as Ere,mt as Dre,mv as Yc,mw as Xc,my as Zc,n as G,nC as Qc,nD as $c,nT as el,na as Ore,nb as kre,ni as tl,nn as nl,no as rl,nr as Are,nt as jre,nu as Mre,nx as Nre,ny as il,o as al,oC as ol,oD as sl,oE as Pre,oT as Fre,oa as Ire,ob as Lre,og as cl,oi as Rre,ol as zre,on as Bre,or as Vre,ot as ll,ou as Hre,ow as Ure,ox as ul,oy as dl,p as fl,pD as pl,pE as ml,pS as hl,pT as Wre,pa as Gre,pg as Kre,ph as qre,pi as gl,pm as _l,pn as vl,po as Jre,pp as Yre,pr as Xre,pt as Zre,pv as Qre,pw as yl,py as $re,q as eie,qC as tie,qE as bl,qS as xl,qT as Sl,qa as nie,qb as Cl,qf as wl,qi as Tl,qm as rie,qn as iie,qp as El,qr as Dl,qt as Ol,qu as kl,qv as Al,qw as aie,qx as jl,qy as Ml,r as Nl,rD as Pl,rT as oie,r_ as sie,ra as Fl,rb as Il,ri as Ll,rm as cie,rn as Rl,ro as lie,rp as uie,rr as die,rt as zl,ru as Bl,rw as Vl,rx as Hl,ry as Ul,s as Wl,sC as Gl,sE as Kl,sS as ql,sT as Jl,sa as Yl,sb as Xl,sg as Zl,sh as Ql,si as $l,sl as eu,sm as tu,sn as nu,sr as fie,su as ru,sw as pie,sx as iu,sy as mie,t as K,tC as hie,tD as au,tE as ou,tT as su,t_ as cu,ta as gie,tb as lu,ti as uu,tm as _ie,tn as vie,to as yie,tr as bie,tt as xie,tu as Sie,tx as du,u as fu,uD as pu,uE as mu,uT as Cie,ua as hu,ug as gu,uh as wie,ui as _u,un as Tie,uo as Eie,up as Die,ur as Oie,ut as kie,uu as Aie,ux as jie,v as Mie,vD as Nie,vE as vu,vT as yu,va as Pie,vb as Fie,vc as bu,vd as xu,vg as Su,vi as Cu,vm as wu,vn as Tu,vr as Eu,vw as Du,w as Ou,wC as ku,wD as Au,wE as ju,wT as Mu,wa as Nu,wb as Pu,wd as Fu,wf as Iu,wg as Lu,wh as Ru,wi as zu,wm as Bu,wn as Vu,wp as Iie,wr as Lie,wt as Hu,wv as Rie,ww as zie,wy as Uu,x as Bie,xD as Wu,xE as Vie,xS as Gu,xT as Hie,xa as Ku,xb as Uie,xd as qu,xf as Ju,xi as Yu,xm as Wie,xn as Xu,xo as Gie,xr as Kie,xt as qie,xw as Jie,xy as Yie,y as Xie,yD as q,yE as Zu,yT as Qu,y_ as Zie,ya as Qie,yb as $u,yg as $ie,yh as ed,yi as eae,ym as tae,yn as nae,yr as rae,yw as iae,z as td,zC as aae,zE as nd,zT as oae,z_ as rd,za as id,zd as sae,zg as ad,zh as od,zi as cae,zn as lae,zr as sd,zt as uae,zv as dae,zw as cd,zx as ld}from"./useI18n-DqSBcroP.js";import{B as ud,C as dd,Cr as fae,Ct as pae,E as fd,Et as mae,F as pd,Hr as hae,I as md,J as gae,M as hd,N as gd,O as _d,P as vd,S as yd,Si as bd,T as _ae,Tn as vae,Ts as yae,U as xd,W as Sd,X as Cd,Y as bae,Yr as wd,_ as xae,at as Td,ci as Ed,ct as Dd,dr as Od,er as kd,et as Sae,g as Cae,h as wae,it as Ad,j as jd,li as Md,m as Tae,ot as Nd,p as Eae,q as Dae,rt as Oae,sr as Pd,st as Fd,ta as Id,tt as Ld,u as kae,v as Aae,w as Rd,wt as zd,x as jae,xi as Bd}from"./public-runtime-D-EeE8cv.js";import{$ as Mae,B as Nae,C as Pae,Ct as J,Dt as Y,E as Vd,Et as Hd,F as Ud,G as Wd,H as Gd,I as Kd,J as qd,K as Jd,M as Yd,N as Xd,Ot as Zd,P as Qd,Q as $d,S as ef,St as tf,T as nf,Tt as rf,U as af,V as of,W as sf,X as cf,Y as lf,Z as uf,_ as df,_t as ff,a as pf,at as mf,b as hf,bt as gf,c as _f,ct as vf,d as yf,dt as bf,et as xf,f as Sf,ft as Cf,g as wf,gt as Tf,h as Ef,ht as Df,i as Of,it as kf,kt as Af,l as jf,lt as Mf,m as Nf,mt as Pf,n as Ff,nt as If,o as Lf,ot as Rf,p as zf,pt as Bf,q as Vf,r as Hf,rt as Uf,s as Wf,st as Gf,t as Kf,tt as qf,u as Jf,ut as Yf,v as Xf,vt as Zf,w as Qf,wt as $f,x as ep,xt as X,y as tp,yt as np,z as Fae}from"./node-Cq1VMMYg.js";import{$ as rp,$n as Iae,A as ip,An as Lae,At as ap,B as Rae,Bn as zae,Bt as Bae,C as op,Cn as sp,Ct as Vae,D as cp,Dn as lp,Dt as Hae,E as up,En as Uae,Et as dp,F as fp,Fn as pp,Ft as mp,G as hp,Gn as Wae,Gt as gp,H as Gae,Hn as _p,Ht as Kae,I as qae,In as vp,It as Jae,J as yp,Jn as Yae,Jt as Xae,K as Zae,Kn as bp,Kt as xp,L as Qae,Ln as Sp,Lt as $ae,M as eoe,Mn as Cp,Mt as wp,N as Tp,Nn as Ep,Nt as Dp,O as toe,On as noe,Ot as roe,P as Op,Pn as kp,Pt as ioe,Q as Ap,Qn as jp,Qt as Mp,R as Np,Rn as Pp,Rt as Fp,S as aoe,Sn as Ip,St as ooe,T as soe,Tn as coe,Tt as Lp,U as loe,Un as uoe,Ut as doe,V as Rp,Vn as zp,Vt as foe,W as poe,Wn as Bp,Wt as Vp,X as Hp,Xn as moe,Xt as Up,Y as Wp,Yn as hoe,Yt as Gp,Z as Kp,Zn as goe,Zt as qp,_ as _oe,_n as Jp,_t as voe,a as Yp,an as yoe,at as Xp,b as boe,bn as xoe,bt as Soe,c as Zp,cn as Coe,ct as Qp,d as woe,dn as Toe,dt as $p,er as em,et as Eoe,f as tm,fn as Doe,ft as Ooe,g as nm,gn as koe,gt as Aoe,h as rm,hn as im,ht as am,i as joe,in as om,it as sm,j as cm,jn as Moe,jt as Noe,k as Poe,kn as Foe,kt as lm,l as Ioe,ln as Loe,lt as um,m as Roe,mn as zoe,mt as Boe,n as dm,nn as Voe,nt as fm,o as pm,on as mm,ot as Hoe,p as hm,pn as Uoe,pt as Woe,q as gm,qn as Goe,qt as Koe,r as _m,rn as vm,rt as ym,s as bm,sn as qoe,st as xm,t as Sm,tn as Cm,tr as Joe,tt as wm,u as Tm,un as Yoe,ut as Em,v as Xoe,vn as Zoe,vt as Qoe,w as $oe,wn as Dm,wt as ese,x as Om,xn as tse,xt as km,y as Am,yn as nse,yt as jm,z as rse,zn as ise,zt as Mm}from"./ChartLoadingSkeleton-njpdx6Xq.js";import{$ as ase,$t as Nm,A as ose,At as Pm,B as Fm,Bt as Im,C as Lm,Ct as Rm,D as sse,Dt as zm,E as cse,Et as lse,F as Bm,Ft as Vm,G as use,Gt as dse,H as Hm,Ht as Um,I as fse,It as Wm,J as pse,Jt as Gm,K as mse,Kt as Km,L as hse,Lt as gse,M as qm,Mt as Jm,N as Ym,Nt as Xm,O as Zm,Ot as Qm,P as $m,Pt as eh,Q as th,Qt as nh,R as rh,Rt as ih,S as ah,St as oh,T as sh,Tt as ch,U as _se,Ut as lh,V as uh,Vt as vse,W as yse,Wt as dh,X as fh,Xt as bse,Yt as ph,Z as mh,Zt as hh,_ as gh,_t as xse,a as _h,an as Sse,at as vh,b as yh,bt as bh,c as xh,ct as Sh,d as Ch,dt as wh,en as Th,et as Eh,f as Dh,ft as Oh,g as kh,gt as Ah,h as jh,ht as Mh,i as Nh,in as Ph,it as Fh,j as Ih,jt as Lh,k as Rh,kt as zh,l as Bh,lt as Vh,m as Hh,mt as Uh,nn as Wh,nt as Gh,o as Kh,on as qh,ot as Jh,p as Yh,pt as Xh,q as Zh,qt as Qh,r as $h,rn as eg,rt as tg,s as ng,st as rg,t as ig,tn as ag,tt as og,u as sg,ut as cg,v as lg,vt as ug,w as dg,wt as fg,x as pg,xt as mg,y as hg,yt as gg,z as _g,zt as vg}from"./ChartWidget-BfFSlmcK.js";import{t as yg}from"./jsx-runtime-lTuChwRC.js";import{A as bg,B as xg,C as Sg,D as Cg,E as wg,F as Tg,G as Eg,H as Dg,I as Og,J as kg,K as Ag,L as jg,M as Mg,N as Ng,O as Pg,P as Fg,R as Ig,S as Lg,T as Rg,U as zg,V as Bg,W as Vg,Y as Hg,_ as Ug,a as Wg,b as Gg,c as Kg,d as qg,f as Jg,g as Yg,h as Xg,i as Zg,j as Qg,k as $g,l as e_,m as t_,n as n_,o as r_,p as i_,q as a_,r as o_,s as s_,t as c_,u as l_,v as u_,w as d_,x as f_,y as p_,z as m_}from"./badge-tone-C1lf98-p.js";import{t as h_}from"./preload-helper-7y9sWmk5.js";import{a as g_,c as __,d as v_,f as y_,g as b_,h as x_,i as S_,l as C_,m as w_,n as T_,o as E_,p as Z,r as D_,s as O_,t as k_,u as A_}from"./ChartEmptyState-bpvSJ-cb.js";function j_(e,t){return e!==void 0||t!==void 0}var M_=`frontend_sdk`,N_=function(e){return e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e}({});function P_(e){return{declaredKeys:Object.freeze(Object.keys(e)),requiredKeys:Object.freeze(Object.entries(e).filter(([,e])=>e.required===!0).map(([e])=>e)),"~standard":{version:1,vendor:`wildo`,validate(t){if(typeof t!=`object`||!t||Array.isArray(t))return{issues:[{message:`public configuration must be an object`}]};let n=t,r=[];for(let t of Object.keys(n))t in e||r.push({message:`unknown key`,path:[t]});for(let[t,i]of Object.entries(e)){let e=n[t];e===void 0?i.required===!0&&r.push({message:`required`,path:[t]}):typeof e!==i.kind&&r.push({message:`expected a ${i.kind}, got ${typeof e}`,path:[t]})}return r.length>0?{issues:r}:{value:n}}}}}function F_(e){if(typeof e!=`object`||!e)return;let t=e;if(Array.isArray(t.declaredKeys)&&t.declaredKeys.every(e=>typeof e==`string`))return t.declaredKeys;if(typeof t.shape==`object`&&t.shape!==null)return Object.keys(t.shape)}function I_(e){if(typeof e!=`object`||!e)return[];let t=e;return Array.isArray(t.requiredKeys)&&t.requiredKeys.every(e=>typeof e==`string`)?t.requiredKeys:typeof t.shape==`object`&&t.shape!==null?Object.entries(t.shape).filter(([,e])=>{let t=e?.isOptional;return typeof t==`function`&&!t.call(e)}).map(([e])=>e):[]}function L_(e,t){return(e??[]).filter(e=>{let n=t?.[e];return n==null||typeof n==`string`&&n.trim()===``})}function R_(e){let t=e.missingKeys.map(e=>`"${e}"`).join(`, `),n=e.serviceKey===void 0?``:` on service "${e.serviceKey}"`;return`Frontend provider "${e.providerRef}"${n} is declared but not configured: it requires ${t}, so it will not run. Supply ${e.missingKeys.length>1?`them`:`it`} under providerConfigurations.${e.providerRef}.${M_} in the application's configuration (per environment in its infrastructure configuration), then run \`wildo config sync\`.`}var z_=class extends Error{facet;conflicts;constructor(e,t){let n=t.map(({ref:e,fragmentIndexes:t})=>` - ref "${e}" declared by fragments [${t.join(`, `)}]`);super(`[compose${e}Providers] conflicting provider refs across fragments:\n${n.join(`
3
- `)}\nResolution: pick a different ref OR drop the conflicting fragment from the composition call.`),this.name=`ProviderCompositionConflictError`,this.facet=e,this.conflicts=t}};function B_(e,t){let n=new Map;for(let e=0;e<t.length;e+=1)for(let r of t[e].modules.keys()){let t=n.get(r);t?t.push(e):n.set(r,[e])}let r=[];for(let[e,t]of n)t.length>1&&r.push({ref:e,fragmentIndexes:t});if(r.length>0)throw new z_(e,r);let i=new Map,a=new Map;for(let e of t)for(let[t,n]of e.modules){i.set(t,n);for(let e of n.providerCapabilities){let t=a.get(e);t?t.push(n):a.set(e,[n])}}return Object.freeze({modules:i,getProviderByRef(e){return i.get(e)},getProvidersByProviderCapability(e){return a.get(e)??[]},findProviderByProviderCapability(e){let t=a.get(e);return t&&t.length>0?t[0]:void 0}})}var V_=[];function H_(e){let t={...e.callContext};if(!e.row)return t;let n=e.operations.flatMap(e=>(e.initiatorInfos??[]).flatMap(e=>e.parameters??[])),r=new Map;for(let e of n)r.set(e.fieldIdentifier,String(e.resourceType));for(let t of Object.keys(e.callContext))if(!r.has(t)){let n=e.typeOfFieldIdentifier?.(t);n!==void 0&&r.set(t,n)}let i=new Map;for(let t of n){let n=t.fieldIdentifier;if(n===e.ownFieldIdentifier||n in e.callContext||t.scopeViaJunction)continue;let r=e.row[t.relationshipField??t.fieldIdentifier],a=Array.isArray(r)?void 0:e.normalizeId(r);if(a===void 0)continue;let o=i.get(n);i.set(n,o===void 0||o===a?a:null)}for(let[n,a]of i){if(a===null)continue;let o=r.get(n),s=new Set([a]);for(let[t,a]of[...Object.entries(e.callContext),...i])t!==n&&t!==e.ownFieldIdentifier&&a!==null&&r.get(t)===o&&s.add(a);s.size===1&&(t[n]=a)}return t}function U_(e){let{previousRow:t,isStoredRow:n,...r}=e;if(!e.row||!t)return{contextResourceIdentifiers:H_(r)};let i=n(e.row)?e.row:{...t,...e.row},a=e.operations.flatMap(e=>(e.initiatorInfos??[]).flatMap(e=>e.parameters??[])),o=(t,n)=>{let r=new Set;for(let i of a){if(i.fieldIdentifier!==n||i.scopeViaJunction)continue;let a=t[i.relationshipField??i.fieldIdentifier];r.add(Array.isArray(a)?void 0:e.normalizeId(a))}return r.size===1?[...r][0]:void 0},s=Object.keys(e.callContext).filter(n=>{if(n===e.ownFieldIdentifier||!a.some(e=>e.fieldIdentifier===n&&!e.scopeViaJunction))return!1;let r=o(t,n);return r!==void 0&&r===e.callContext[n]&&o(i,n)!==r}),c=Object.fromEntries(Object.entries(e.callContext).filter(([e])=>!s.includes(e))),l=H_({...r,row:i,callContext:c}),u=H_({...r,row:t});return[...new Set([...Object.keys(l),...Object.keys(u)])].some(e=>l[e]!==u[e])?{contextResourceIdentifiers:l,previousContextResourceIdentifiers:u}:{contextResourceIdentifiers:l}}function W_(e,t){if(Object.is(e,t))return!0;if(typeof e==`function`||typeof t==`function`||typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>W_(e,t[n]));let n=e,r=t,i=Object.keys(n).filter(e=>e!==`resolvedSemantics`),a=Object.keys(r).filter(e=>e!==`resolvedSemantics`);return i.length===a.length&&i.every(e=>Object.prototype.hasOwnProperty.call(r,e)&&W_(n[e],r[e]))}function G_(e){let t=new Map;for(let n of e){let e=`${String(n.resourceType1)}→${String(n.resourceType2)}`,r=t.get(e);r?r.push(n):t.set(e,[n])}let n=[];for(let e of t.values()){if(e.length<2)continue;let t=[];for(let n of e){let e=t.find(e=>W_(e.representative,n));e?e.occurrences+=1:t.push({representative:n,occurrences:1})}for(let e of t){if(e.occurrences<2)continue;let{representative:t,occurrences:r}=e;n.push({parentResourceType:t.resourceType1,childResourceType:t.resourceType2,occurrences:r,relationship:t,message:`Relationship '${String(t.resourceType1)}' → '${String(t.resourceType2)}' is registered ${r} times with an identical declaration. The registry buckets relationships by filtering the assembled list, so this edge lands ${r} times in the child's parentRelationships and in the parent's childRelationships — composition seeding would create ${r} child rows per parent create, the onParentDelete cascade would dispatch ${r} times, and every startup guard reports it ${r} times. This is almost always a list COMPOSITION mistake in the application/platform host: the same relationship array reaching the registry through two of its slots (e.g. the shared list folded into the bundle passed as the backend list, while it also still flows through the shared slot). Pass each list through exactly one slot. To declare two genuinely different edges between the same pair, make them differ (distinct foreignKeyField, discriminator/condition, or jointResourceType).`})}}return n}function K_(e){let t=new Map;for(let n of e){if(n.isDisabled)continue;let e=n.resourceType1,r=n.resourceType2,i=t.get(e);i||(i=new Set,t.set(e,i)),i.add(r)}return t}function q_(e,t){let n=new Set,r=[e];for(;r.length>0;){let i=r.pop(),a=t.get(i);if(a)for(let t of a)t!==e&&(n.has(t)||(n.add(t),r.push(t)))}return n}function J_(e){let t=K_(e),n=new Map,r=new Set(t.keys());for(let e of r)n.set(e,q_(e,t));return n}var Y_=function(e){return e.UTF8=`UTF8`,e.BASE64=`BASE64`,e}({}),X_=function(e){return e.NEXT_ACTIONS=`next_actions`,e.SUMMARY=`summary`,e.FLAT=`flat`,e.DETAILED=`detailed`,e}({}),Z_=`summary`;function Q_(e,t,n){let r=new Map;for(let e of t)r.set(n(e),e);let i=[],a=new Set;for(let t of e){let e=n(t);a.has(e)||(a.add(e),r.has(e)?i.push(r.get(e)):i.push(t))}for(let e of t){let t=n(e);a.has(t)||(a.add(t),i.push(e))}return i}function $_(e,t){if(!e&&!t)return{};if(!e)return{...t};if(!t)return{...e};let n=e.fields??[],r=t.fields??[];return n.length===0&&r.length===0?{}:{fields:Q_(n,r,e=>e.fieldIdentifier)}}function ev(e,t){return!e&&!t?[]:e?t?Q_(e,t,e=>e.ref):[...e??[]]:[...t??[]]}function tv(e,t){return!e&&!t?[]:rv(e?t?Q_(e,t,e=>e.ref):[...e??[]]:[...t??[]])}function nv(e,t){if(!t?.length)return e;let n=[...e];for(let e of t){let t=n.findIndex(t=>t.ref===e.ref);t===-1?n.push(e):n[t].contentKind===ze.NAVIGATION_LIST&&e.contentKind===ze.NAVIGATION_LIST?n=av(n,e.ref,e.children):n[t]=e}return rv(n)}function rv(e){let t;try{t=xa.isDevelopment()}catch{t=!1}if(!t)return e;let n=new Map,r=(e,t)=>{for(let i of e??[]){let e=iv(i),a=n.get(e)??[];a.push(t),n.set(e,a),r(i.children,t)}};for(let t of e)t.contentKind===ze.NAVIGATION_LIST&&r(t.children,t.ref);for(let[e,t]of n)t.length>1&&console.warn(`[sidebar sections] Launcher target "${e}" appears ${t.length} times in the merged sidebar (sections: ${t.join(`, `)}). Only one occurrence will highlight as active. If this duplication is unintentional, remove the extra item from one of the contributing configs.`);return e}function Cse(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.fieldIdentifier)||(n.add(i.fieldIdentifier),r.push(i));return r}function iv(e){switch(e.kind){case hu.RESOURCE_OPERATION:return`resource_operation:${e.resourceType}:${e.operation}:${e.operationVariant??`default`}`;case hu.VIEW:return`${e.kind}:${e.viewRef}`;case hu.RESOURCE_VIEW:return`${e.kind}:${e.resourceType}:${e.viewRef}`;case hu.ENGINE_PAGE:return`engine_page:${e.pageRef}`;case hu.CUSTOM_COMPONENT:return`custom_component:${e.componentRef}`;case hu.SETTINGS_SECTION:return`settings_section:${e.sectionRef??`default`}`;default:throw Error(`launcherItemRefKey: no key for launcher item kind ${e.kind}`)}}function av(e,t,n){return e?.length?n.length?e.map(e=>{if(e.ref!==t||e.contentKind!==ze.NAVIGATION_LIST)return e;let r=e,i=new Set(r.children.map(iv)),a=n.filter(e=>!i.has(iv(e)));return a.length===0?e:{...r,children:[...r.children,...a]}}):[...e]:e??[]}function ov(e,t){return e?.length?t?.length?Q_(e,t,iv):[...e]:[...t??[]]}function sv(e,t){return e?.length?t?.length?Q_(e,t,e=>`${iv(e)}:${e.group??`default`}`):[...e]:[...t??[]]}function cv(e,t){return e?.length?t?.length?Q_(e,t,e=>e.ref):[...e]:[...t??[]]}function wse(...e){return{resourceConfigurations:Object.assign({},...e.map(e=>e.resourceConfigurations).filter(Boolean)),resourceFieldIdentifiers:Object.assign({},...e.map(e=>e.resourceFieldIdentifiers).filter(Boolean)),resourceRelationships:e.flatMap(e=>e.resourceRelationships??[])}}function lv(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.fieldIdentifier,r);return Array.from(n.values())}function uv(e,t,n){let r=new Map;for(let t of e)r.set(n(t),t);for(let e of t)r.set(n(e),e);return Array.from(r.values())}function dv(e){let t=new Map,n=[];for(let r of e)for(let e of r.componentRegistrations??[]){let i=e.preset??q.DEFAULT,a=`${e.componentRef}\u0000${i}`,o=t.get(a);o&&n.push({componentRef:e.componentRef,preset:i,replacedModuleId:o.moduleId,byModuleId:r.moduleId}),t.set(a,{registration:e,moduleId:r.moduleId})}return{registrations:Array.from(t.values(),e=>e.registration),replaced:n}}function Tse(...e){return{moduleIds:e.map(e=>e.moduleId),resourceUIBehavior:Object.assign({},...e.map(e=>e.resourceUIBehavior??{})),sidebarSections:e.reduce((e,t)=>nv(e,t.sidebarSections),[]),quickSwitcherFields:e.reduce((e,t)=>lv(e,t.quickSwitcherFields??[]),[]),compositeViews:e.flatMap(e=>Cp(e.compositeViews))}}function fv(...e){return{...Tse(...e),menubarItems:e.flatMap(e=>e.menubarItems??[]),commandMenuItems:e.reduce((e,t)=>ov(e,t.commandMenuItems),[]),sidebarSectionItems:e.flatMap(e=>e.sidebarSectionItems??[]),appScope:e.reduce((e,t)=>({...e,...t.appScope,fields:lv(e.fields??[],t.appScope?.fields??[])}),{}),fullCustomViews:e.reduce((e,t)=>cv(e,t.fullCustomViews),[]),onboardingViews:uv([],e.flatMap(e=>e.onboardingViews??[]),e=>e.ref),guidanceFlows:uv([],e.flatMap(e=>e.guidanceFlows??[]),e=>e.ref),flowsActorsViews:uv([],e.flatMap(e=>e.flowsActorsViews??[]),e=>e.ref),componentRegistrations:Ese(e)}}function Ese(e){let{registrations:t,replaced:n}=dv(e);for(let e of n)as.getLogger().warn(`[frontend-modules] module '${e.byModuleId}' replaces module '${e.replacedModuleId}''s registration of ${e.componentRef} (${e.preset}); only the later one is registered.`,{...e});return t}function pv(e){let t=lv(e.appScope.fields??[],e.quickSwitcherFields);return t.length===0?e.appScope:{...e.appScope,fields:t}}function mv(e,t){let n=tv(e,t.sidebarSections);return t.sidebarSectionItems.reduce((e,t)=>av(e,t.sectionRef,t.items),n)}function hv(e,t){let n=e[Fr.MENUBAR],r=e[Fr.SIDEBAR],i=e[Fr.COMMAND_MENU];return{...e,[Fr.MENUBAR]:n&&typeof n==`object`&&!Array.isArray(n)?{...n,items:sv(n.items,t.menubarItems)}:n,[Fr.SIDEBAR]:r&&typeof r==`object`?{...r,contentSections:mv(r.contentSections,t)}:r,[Fr.COMMAND_MENU]:i&&typeof i==`object`?{...i,commands:ov(i.commands,t.commandMenuItems)}:i}}var Q=e(r(),1),gv;(function(e){e.ENGINE_PANEL=`engine_panel`,e.RESOURCE_OPERATION=`resource_operation`,e.CUSTOM_COMPONENT=`custom_component`,e.SUB_TABS=`sub_tabs`})(gv||={});var _v;(function(e){e.SECURITY=`security`,e.APPEARANCE=`appearance`,e.INVITATIONS=`invitations`,e.BILLING=`billing`,e.CONNECTED_ACCOUNTS=`connected-accounts`,e.ORGANIZATION_CONNECTED_ACCOUNTS=`organization-connected-accounts`,e.APPLICATION_CONNECTED_ACCOUNTS=`application-connected-accounts`,e.AGENT_WORK_OVERRIDE_RATE=`agent-work-override-rate`,e.AUTONOMOUS_AGENTS=`autonomous-agents`,e.MODEL_COST_BREAKDOWN=`model-cost-breakdown`,e.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN=`representing-organization-model-cost-breakdown`,e.REPRESENTATIVE_ACTIVITY=`representative-activity`,e.AGENT_WORK_EVALUATION_EXPORT=`agent-work-evaluation-export`})(_v||={});var vv;(function(e){e.REPRESENTS=`relationshipRepresents`,e.GRANTS=`relationshipGrants`,e.INVITES=`relationshipInvites`,e.LENDS=`relationshipLends`})(vv||={});function yv(e){return e.currentOrganizationId?e.organizations?.find(t=>t._id===e.currentOrganizationId)?.type:void 0}function bv(e){let t=yv(e),n=Yc(e.organizationRelationships,e.organizationTypes,t),r=n.some(e=>e.side===Vc.REPRESENTING);return{[vv.REPRESENTS]:r,[vv.GRANTS]:n.some(e=>e.side===Vc.GRANTING),[vv.INVITES]:r&&Qre(e.organizationRelationships,t??void 0).length>0,[vv.LENDS]:n.some(t=>t.side===Vc.GRANTING&&gs(e.organizationRelationships,t.kind))}}var xv;(function(e){e.ASKS_THE_OPERATOR=`relationshipAsksTheOperator`,e.NAMES_THE_OTHER_ORGANIZATION=`relationshipNamesTheOtherOrganization`})(xv||={});function Sv(e){let t=Yc(e.organizationRelationships,e.organizationTypes,yv(e)),n=Su(e.organizationTypes),r=t=>{let r=e.organizationRelationships?.[t];return r?Nne(r,n).standing:void 0};return{[xv.ASKS_THE_OPERATOR]:t.some(e=>e.side===Vc.GRANTING&&r(e.kind)===Uo.OPERATOR_IS_PARTY),[xv.NAMES_THE_OTHER_ORGANIZATION]:t.some(e=>r(e.kind)===Uo.INDEPENDENT_PARTIES)}}var Cv;(function(e){e.ENABLED=`scimEnabled`,e.ORGANIZATION_TYPE_ADMITS=`scimOrganizationTypeAdmitsDirectory`,e.SETTINGS_REACHABLE=`scimSettingsReachable`})(Cv||={});function wv(e){return e.organizationTypeKnown&&!(e.featureOffered&&e.organizationTypeDirectoryProvisioned)}function Tv(e){let t=e.featureOffered&&e.organizationTypeDirectoryProvisioned;return{[Cv.ENABLED]:t,[Cv.ORGANIZATION_TYPE_ADMITS]:e.organizationTypeDirectoryProvisioned,[Cv.SETTINGS_REACHABLE]:t||e.holdsUnrevokedToken}}var Ev=[Al.ORG_OWNER,Al.ORG_ADMIN],Dv=[ir.APP_ADMIN_SUPER_ADMIN],Ov=`billingEnabled`,kv=`professionalQualificationsDeclared`,Av=[{ref:ic.PROFILE,icon:H.PROFILE,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.USER_SELF_PROFILES,operation:W.READ}},{ref:ic.SECURITY,icon:H.LOCK,target:{kind:gv.ENGINE_PANEL,panelRef:_v.SECURITY}},{ref:ic.APPEARANCE,icon:H.PALETTE,target:{kind:gv.ENGINE_PANEL,panelRef:_v.APPEARANCE}},{ref:ic.PREFERENCES,icon:H.SLIDERS,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.USER_SELF_PREFERENCES,operation:W.READ}},{ref:ic.MY_INVITATIONS,icon:H.MAIL,target:{kind:gv.ENGINE_PANEL,panelRef:_v.INVITATIONS}},{ref:ic.DEACTIVATE_ACCOUNT,icon:H.USER_COG,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.USER_SELF,operation:Cn.DEACTIVATE_ACCOUNT}},{ref:ic.MY_PROVIDER_CREDENTIALS,icon:H.PLUG,target:{kind:gv.ENGINE_PANEL,panelRef:_v.CONNECTED_ACCOUNTS}},{ref:ic.AUTHORIZED_APPS,icon:H.THIRD_PARTY_APP,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.OAUTH_CONSENT_GRANTS,operation:W.LIST}},{ref:ic.MY_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.DATA_SUBJECT_REQUESTS,operation:W.LIST}},{ref:ic.MY_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.USER_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ic.ORGANIZATION_GENERAL,icon:H.ORGANIZATION,requiredRoles:Ev,target:{kind:gv.SUB_TABS,subTabs:[{ref:`organization-general-record`,label:`Organization`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATIONS,operation:W.READ}},{ref:`organization-general-profile`,label:`Profile`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_PROFILES,operation:W.READ}},{ref:`organization-general-preferences`,label:`Preferences`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_PREFERENCES,operation:W.READ}},{ref:`organization-general-notifications`,label:`Notifications`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_NOTIFICATIONS,operation:W.READ}}]}},{ref:ic.MEMBERS,icon:H.USERS,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_MEMBERS,operation:W.LIST}},{ref:ic.ORGANIZATION_UNITS,icon:H.HIERARCHY,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_UNITS,operation:W.LIST}},{ref:ic.BILLING,icon:H.CREDIT_CARD,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[Ov]},target:{kind:gv.ENGINE_PANEL,panelRef:_v.BILLING}},{ref:ic.API_KEYS,icon:H.KEY,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORG_API_KEYS,operation:W.LIST}},{ref:ic.ORGANIZATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.OAUTH_CLIENTS_ORGANIZATION,operation:W.LIST}},{ref:ic.PROVIDER_CREDENTIALS,icon:H.PLUG,requiredRoles:Ev,target:{kind:gv.ENGINE_PANEL,panelRef:_v.ORGANIZATION_CONNECTED_ACCOUNTS}},{ref:ic.SSO,icon:H.LOGIN,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[`ssoEnabled`]},entitlementFeatureId:ks.SINGLE_SIGN_ON,target:{kind:gv.SUB_TABS,subTabs:[{ref:`sso-configuration`,label:`Configuration`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SSO_CONFIG,operation:W.READ}},{ref:`sso-connections`,label:`Connections`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:ic.SCIM,icon:H.USER_COG,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[Cv.SETTINGS_REACHABLE]},entitlementFeatureId:ks.DIRECTORY_PROVISIONING,target:{kind:gv.SUB_TABS,subTabs:[{ref:`scim-provisioning`,label:`Provisioning`,runtimeAvailability:{requiredCapabilities:[Cv.ENABLED]},target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:`scim-tokens`,label:`Tokens`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SCIM_TOKENS,operation:W.LIST}}]}},{ref:ic.SIEM,icon:H.ACTIVITY,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[`siemEnabled`]},entitlementFeatureId:ks.SECURITY_EVENT_EXPORT,target:{kind:gv.SUB_TABS,subTabs:[{ref:`siem-export`,label:`Export`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:ic.WEBHOOKS,icon:H.WEBHOOK,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[`webhooksEnabled`]},entitlementFeatureId:ks.M2M_WEBHOOK_DELIVERY,target:{kind:gv.SUB_TABS,subTabs:[{ref:`webhooks-endpoints`,label:`Endpoints`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`webhooks-delivery-log`,label:`Delivery log`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:ic.INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:ic.AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ic.RELATIONSHIPS,icon:H.HANDSHAKE,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[vv.GRANTS]},target:{kind:gv.SUB_TABS,subTabs:[{ref:`relationships-organizations`,label:`Organizations`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_RELATIONSHIPS,operation:W.LIST}},{ref:`relationships-delegated-capabilities`,label:`Delegated capabilities`,runtimeAvailability:{requiredCapabilities:[vv.LENDS]},target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.RELATIONSHIP_CAPABILITY_GRANTS,operation:W.LIST}}]}},{ref:ic.REPRESENTATIONS,icon:H.BRIEFCASE,requiredRoles:Ev,runtimeAvailability:{requiredCapabilities:[vv.REPRESENTS]},target:{kind:gv.SUB_TABS,subTabs:[{ref:`representations-organizations`,label:`Organizations`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_REPRESENTATIONS,operation:W.LIST}},{ref:`representations-invitations`,label:`Invitations`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.RELATIONSHIP_INVITATIONS,operation:W.LIST}},{ref:`representations-model-cost`,label:`Model cost`,target:{kind:gv.ENGINE_PANEL,panelRef:_v.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN}},{ref:`representations-activity`,label:`Activity`,target:{kind:gv.ENGINE_PANEL,panelRef:_v.REPRESENTATIVE_ACTIVITY}}]}},{ref:ic.AUDIT_LOGS,icon:H.SCROLL,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.AUDIT_LOGS,operation:W.LIST}},{ref:ic.OPERATOR_ACCESS,icon:H.SHIELD,requiredRoles:[...Ev,Al.ORG_DELEGATED_APPROVE_ACCESS_GRANTS],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.PLATFORM_ACCESS_GRANTS,operation:W.LIST}},{ref:ic.ORGANIZATION_ENTITLEMENTS,icon:H.BADGE_CHECK,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_FEATURES,operation:W.READ}},{ref:ic.ORGANIZATION_REFERRALS,icon:H.GIFT,requiredRoles:[Al.ORG_OWNER],runtimeAvailability:{requiredCapabilities:[Ov]},target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.REFERRALS,operation:W.LIST}},{ref:ic.ORGANIZATION_LEGAL_HOLDS,icon:H.SCALE,requiredRoles:[Al.ORG_OWNER],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.LEGAL_HOLDS,operation:W.LIST}},{ref:ic.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,icon:H.BADGE_CHECK,requiredRoles:[Al.ORG_ADMIN],runtimeAvailability:{requiredCapabilities:[kv]},target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.PROFESSIONAL_QUALIFICATIONS,operation:W.LIST}},{ref:ic.EMAIL_DOMAINS,icon:H.GLOBE,requiredRoles:Ev,requiredEngineCapabilities:[Fd.EMAIL_INBOUND],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_EMAIL_DOMAINS,operation:W.LIST}},{ref:ic.CUSTOM_DOMAINS,icon:H.GLOBE,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_CUSTOM_DOMAINS,operation:W.LIST}},{ref:ic.RELATIONSHIP_MAILBOXES,icon:H.MAILBOX,requiredRoles:Ev,requiredEngineCapabilities:[Fd.EMAIL_INBOUND],runtimeAvailability:{requiredCapabilities:[vv.REPRESENTS]},target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.RELATIONSHIP_MAILBOXES,operation:W.LIST}},{ref:ic.CHAT_ACCOUNTS,icon:H.CHAT,requiredRoles:Ev,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.CHAT_IDENTITY_LINKS,operation:W.LIST}},{ref:ic.MY_CHAT_ACCOUNTS,icon:H.CHAT,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.CHAT_IDENTITY_LINKS,operation:W.LIST,operationVariant:`own`}},{ref:ic.AGENT_RUNS,icon:H.BRAIN,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:ic.AUTONOMOUS_AGENTS,icon:H.CLOCK,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.ENGINE_PANEL,panelRef:_v.AUTONOMOUS_AGENTS}},{ref:ic.CHAT_AGENTS,icon:H.CHAT,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_CHAT_SETTINGS,operation:W.LIST}},{ref:ic.AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.SUB_TABS,subTabs:[{ref:`agent-work-override-rate`,label:`Override rate`,target:{kind:gv.ENGINE_PANEL,panelRef:_v.AGENT_WORK_OVERRIDE_RATE}},{ref:`agent-work-decisions`,label:`Decisions`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:`agent-behavior-reports`,label:`Reports`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.AGENT_BEHAVIOR_REPORTS,operation:W.LIST}},{ref:`agent-work-content-capture`,label:`Content capture`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.AGENT_WORK_CAPTURE_SETTINGS,operation:W.READ}},{ref:`agent-work-export-authorization`,label:`Export authorisation`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.EVALUATION_EXPORT_AUTHORIZATIONS,operation:W.READ}},{ref:`agent-work-run-export`,label:`Run an export`,target:{kind:gv.ENGINE_PANEL,panelRef:_v.AGENT_WORK_EVALUATION_EXPORT}},{ref:`agent-work-exports`,label:`Exports`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.EVALUATION_DATASET_EXPORTS,operation:W.LIST}}]}},{ref:ic.AGENT_POLICY,icon:H.BRAIN,requiredRoles:Ev,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_AGENT_POLICIES,operation:W.READ}},{ref:ic.APPLICATION_GENERAL,icon:H.APP_WINDOW,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_METADATA,operation:W.READ}},{ref:ic.APPLICATION_VERSIONS,icon:H.HISTORY,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_VERSIONS,operation:W.LIST}},{ref:ic.APPLICATION_ENTITLEMENTS,icon:H.BADGE_CHECK,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_FEATURES,operation:W.READ}},{ref:ic.APPLICATION_API_KEYS,icon:H.KEY,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_API_KEYS,operation:W.LIST}},{ref:ic.APPLICATION_SSO,icon:H.LOGIN,requiredRoles:Dv,target:{kind:gv.SUB_TABS,subTabs:[{ref:`application-sso-configuration`,label:`Configuration`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_SSO_CONFIG,operation:W.READ}},{ref:`application-sso-connections`,label:`Connections`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:ic.APPLICATION_SCIM,icon:H.USER_COG,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:ic.APPLICATION_SIEM,icon:H.ACTIVITY,requiredRoles:Dv,target:{kind:gv.SUB_TABS,subTabs:[{ref:`application-siem-export`,label:`Export`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`application-siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:ic.APPLICATION_WEBHOOKS,icon:H.WEBHOOK,requiredRoles:Dv,target:{kind:gv.SUB_TABS,subTabs:[{ref:`application-webhooks-endpoints`,label:`Endpoints`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`application-webhooks-delivery-log`,label:`Delivery log`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:ic.BILLING_CATALOG,icon:H.PACKAGE,requiredRoles:Dv,runtimeAvailability:{requiredCapabilities:[Ov]},target:{kind:gv.SUB_TABS,subTabs:[{ref:`billing-catalog-products`,label:`Products`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.PRODUCTS,operation:W.LIST}},{ref:`billing-catalog-promotions`,label:`Promotions`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.PROMOTIONS,operation:W.LIST}}]}},{ref:ic.APPLICATION_PROVIDER_CONNECTIONS,icon:H.PLUG,requiredRoles:Dv,target:{kind:gv.ENGINE_PANEL,panelRef:_v.APPLICATION_CONNECTED_ACCOUNTS}},{ref:ic.APPLICATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.OAUTH_CLIENTS_APPLICATION,operation:W.LIST}},{ref:ic.APPLICATION_ACCESS_GRANTS,icon:H.SHIELD,requiredRoles:Dv,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_ACCESS_GRANTS,operation:W.LIST}},{ref:ic.APPLICATION_ORGANIZATIONS,icon:H.ORGANIZATION,requiredRoles:Dv,target:{kind:gv.SUB_TABS,subTabs:[{ref:`application-organizations-directory`,label:`All organizations`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.ORGANIZATIONS,operation:W.LIST,operationVariant:qte.DIRECTORY}},{ref:`application-organizations-access-grants`,label:`Access windows`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:ic.APPLICATION_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:gv.SUB_TABS,subTabs:[{ref:`application-data-subject-requests-queue`,label:`Requests to answer`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.DATA_SUBJECT_REQUESTS,operation:Vt.OPERATOR_QUEUE}},{ref:`application-data-subject-requests-access-grants`,label:`Access windows`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:ic.APPLICATION_INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:ic.APPLICATION_SMS_NUMBERS,icon:H.SMARTPHONE,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Fd.SMS],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.SMS_NUMBER_ASSIGNMENTS,operation:W.LIST}},{ref:ic.APPLICATION_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ic.APPLICATION_AGENT_RUNS,icon:H.BRAIN,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:ic.APPLICATION_AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:ic.APPLICATION_AGENT_POLICY,icon:H.BRAIN,requiredRoles:Dv,requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_AGENT_POLICIES,operation:W.READ}},{ref:ic.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,icon:H.ORGANIZATION,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.SYSTEM_OF_RECORD_PARTITION_ASSIGNMENTS,operation:W.LIST}},{ref:ic.APPLICATION_MODEL_COSTS,icon:H.RECEIPT,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_ADMIN_BILLING_MANAGER],requiredEngineCapabilities:[Fd.AI_LLM],target:{kind:gv.SUB_TABS,subTabs:[{ref:`model-costs-by-month`,label:`By month`,target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.MODEL_COST_PERIOD_AGGREGATES,operation:W.LIST}},{ref:`model-costs-breakdown`,label:`Breakdown`,target:{kind:gv.ENGINE_PANEL,panelRef:_v.MODEL_COST_BREAKDOWN}}]}},{ref:ic.APPLICATION_RETENTION_ENFORCEMENT,icon:H.CLOCK,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_AUDIT_EVIDENCE_READER],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.RETENTION_ENFORCEMENT_RECORDS,operation:W.LIST}},{ref:ic.APPLICATION_AUDIT_LOGS,icon:H.SCROLL,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_AUDIT_EVIDENCE_READER],target:{kind:gv.RESOURCE_OPERATION,resourceType:ul.APPLICATION_AUDIT_LOGS,operation:W.LIST}}],jv=[{ref:`people`,label:`People`,order:0},{ref:`billing`,label:`Billing & entitlements`,order:1},{ref:`security`,label:`Security & access`,order:2},{ref:`integrations`,label:`Integrations`,order:3},{ref:`compliance`,label:`Compliance`,order:4},{ref:`ai`,label:`AI`,order:5}],Dse={categories:[{ref:`account`,label:`Account`,scope:Vr.USER_SELF,order:0},{ref:`organization`,label:`Organization`,scope:Vr.ORGANIZATIONS,order:1,groups:jv},{ref:`administration`,label:`Administration`,scope:Vr.APPLICATION,order:2,groups:jv}],placements:[{destinationRef:ic.PROFILE,categoryRef:`account`,label:`Profile`,order:0},{destinationRef:ic.SECURITY,categoryRef:`account`,label:`Security`,order:1},{destinationRef:ic.APPEARANCE,categoryRef:`account`,label:`Appearance`,order:2},{destinationRef:ic.PREFERENCES,categoryRef:`account`,label:`Preferences`,order:3},{destinationRef:ic.MY_INVITATIONS,categoryRef:`account`,label:`Invitations`,order:4},{destinationRef:ic.MY_PROVIDER_CREDENTIALS,categoryRef:`account`,label:`Integrations`,order:5},{destinationRef:ic.AUTHORIZED_APPS,categoryRef:`account`,label:`Authorized apps`,order:6},{destinationRef:ic.MY_AGENT_PUSH_DELIVERIES,categoryRef:`account`,label:`Agent push deliveries`,order:7},{destinationRef:ic.MY_DATA_SUBJECT_REQUESTS,categoryRef:`account`,label:`Data requests`,order:8},{destinationRef:ic.DEACTIVATE_ACCOUNT,categoryRef:`account`,label:`Deactivate account`,order:9},{destinationRef:ic.ORGANIZATION_GENERAL,categoryRef:`organization`,label:`General`,order:0},{destinationRef:ic.MEMBERS,categoryRef:`organization`,groupRef:`people`,label:`Members`,order:1},{destinationRef:ic.ORGANIZATION_UNITS,categoryRef:`organization`,groupRef:`people`,label:`Organization units`,order:2},{destinationRef:ic.ORGANIZATION_ENTITLEMENTS,categoryRef:`organization`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:ic.BILLING,categoryRef:`organization`,groupRef:`billing`,label:`Billing`,order:4},{destinationRef:ic.ORGANIZATION_REFERRALS,categoryRef:`organization`,groupRef:`billing`,label:`Referrals`,order:5},{destinationRef:ic.API_KEYS,categoryRef:`organization`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:ic.ORGANIZATION_OAUTH_CLIENTS,categoryRef:`organization`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:ic.PROVIDER_CREDENTIALS,categoryRef:`organization`,groupRef:`integrations`,label:`Integrations`,order:8},{destinationRef:ic.SSO,categoryRef:`organization`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:9},{destinationRef:ic.SCIM,categoryRef:`organization`,groupRef:`security`,label:`SCIM provisioning`,order:10},{destinationRef:ic.SIEM,categoryRef:`organization`,groupRef:`compliance`,label:`SIEM export`,order:11},{destinationRef:ic.WEBHOOKS,categoryRef:`organization`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:ic.AGENT_PUSH_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:ic.AUDIT_LOGS,categoryRef:`organization`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:ic.OPERATOR_ACCESS,categoryRef:`organization`,groupRef:`security`,label:`Operator access`,order:15},{destinationRef:ic.INBOUND_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Inbound deliveries`,order:16},{destinationRef:ic.RELATIONSHIPS,categoryRef:`organization`,groupRef:`people`,label:`Relationships`,order:17},{destinationRef:ic.REPRESENTATIONS,categoryRef:`organization`,groupRef:`people`,label:`Representations`,order:18},{destinationRef:ic.ORGANIZATION_LEGAL_HOLDS,categoryRef:`organization`,groupRef:`compliance`,label:`Legal holds`,order:19},{destinationRef:ic.EMAIL_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Email domains`,order:20},{destinationRef:ic.RELATIONSHIP_MAILBOXES,categoryRef:`organization`,groupRef:`integrations`,label:`Relationship mailboxes`,order:21},{destinationRef:ic.MY_CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`My chat accounts`,order:22},{destinationRef:ic.CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`Chat accounts`,order:23},{destinationRef:ic.AGENT_WORK_REVIEW,categoryRef:`organization`,groupRef:`ai`,label:`Agent work review`,order:24},{destinationRef:ic.AGENT_RUNS,categoryRef:`organization`,groupRef:`ai`,label:`Agent runs`,order:25},{destinationRef:ic.AUTONOMOUS_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Autonomous agents`,order:26},{destinationRef:ic.CHAT_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Chat agents`,order:27},{destinationRef:ic.AGENT_POLICY,categoryRef:`organization`,groupRef:`ai`,label:`Agent policy`,order:28},{destinationRef:ic.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,categoryRef:`organization`,groupRef:`people`,label:`Professional qualifications`,order:29},{destinationRef:ic.CUSTOM_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Custom domains`,order:30},{destinationRef:ic.APPLICATION_GENERAL,categoryRef:`administration`,label:`General`,order:0},{destinationRef:ic.APPLICATION_ORGANIZATIONS,categoryRef:`administration`,label:`Organizations`,order:1},{destinationRef:ic.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,categoryRef:`administration`,label:`System-of-record partitions`,order:2},{destinationRef:ic.APPLICATION_ENTITLEMENTS,categoryRef:`administration`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:ic.BILLING_CATALOG,categoryRef:`administration`,groupRef:`billing`,label:`Plans & pricing`,order:4},{destinationRef:ic.APPLICATION_MODEL_COSTS,categoryRef:`administration`,groupRef:`billing`,label:`Model costs`,order:5},{destinationRef:ic.APPLICATION_API_KEYS,categoryRef:`administration`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:ic.APPLICATION_OAUTH_CLIENTS,categoryRef:`administration`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:ic.APPLICATION_SSO,categoryRef:`administration`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:8},{destinationRef:ic.APPLICATION_SCIM,categoryRef:`administration`,groupRef:`security`,label:`SCIM provisioning`,order:9},{destinationRef:ic.APPLICATION_SIEM,categoryRef:`administration`,groupRef:`compliance`,label:`SIEM export`,order:10},{destinationRef:ic.APPLICATION_PROVIDER_CONNECTIONS,categoryRef:`administration`,groupRef:`integrations`,label:`Integrations`,order:11},{destinationRef:ic.APPLICATION_WEBHOOKS,categoryRef:`administration`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:ic.APPLICATION_AGENT_PUSH_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:ic.APPLICATION_AUDIT_LOGS,categoryRef:`administration`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:ic.APPLICATION_ACCESS_GRANTS,categoryRef:`administration`,groupRef:`security`,label:`Access grants`,order:15},{destinationRef:ic.APPLICATION_VERSIONS,categoryRef:`administration`,label:`Versions`,order:16},{destinationRef:ic.APPLICATION_INBOUND_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Inbound deliveries`,order:17},{destinationRef:ic.APPLICATION_RETENTION_ENFORCEMENT,categoryRef:`administration`,groupRef:`compliance`,label:`Retention enforcement`,order:18},{destinationRef:ic.APPLICATION_AGENT_WORK_REVIEW,categoryRef:`administration`,groupRef:`ai`,label:`Agent work review`,order:19},{destinationRef:ic.APPLICATION_AGENT_RUNS,categoryRef:`administration`,groupRef:`ai`,label:`Agent runs`,order:20},{destinationRef:ic.APPLICATION_AGENT_POLICY,categoryRef:`administration`,groupRef:`ai`,label:`Agent policy`,order:21},{destinationRef:ic.APPLICATION_DATA_SUBJECT_REQUESTS,categoryRef:`administration`,groupRef:`compliance`,label:`Data subject requests`,order:22},{destinationRef:ic.APPLICATION_SMS_NUMBERS,categoryRef:`administration`,groupRef:`integrations`,label:`SMS numbers`,order:23}],defaultSectionRef:`profile`},Mv=new Map(Av.map(e=>[e.ref,e]));function Nv(e){let t=new Map(Mv),n=new Set,r=[],i=[];for(let a of e?.destinations??[])Mv.has(a.ref)?r.push(a.ref):n.has(a.ref)?i.push(a.ref):(t.set(a.ref,a),n.add(a.ref));return{byRef:t,applicationDestinationRefs:n,refsShadowingEngineDestinations:r,duplicateApplicationDestinationRefs:i}}function Pv(e){if(e===void 0)return{categories:[],sections:[]};let t=Nv(e),n=[];for(let r of e.placements){let e=t.byRef.get(r.destinationRef);e!==void 0&&n.push({ref:e.ref,categoryRef:r.categoryRef,...r.groupRef===void 0?{}:{groupRef:r.groupRef},label:r.label??e.ref,icon:r.icon??e.icon,order:r.order,target:e.target,runtimeAvailability:e.runtimeAvailability,requiredFeatures:e.requiredFeatures,requiredRoles:e.requiredRoles,entitlementFeatureId:e.entitlementFeatureId,requiredEngineCapabilities:e.requiredEngineCapabilities})}return{categories:e.categories,sections:n,defaultSectionRef:e.defaultSectionRef}}function Fv(e){if(e===void 0)return[];let t=Nv(e);return e.placements.map(e=>e.destinationRef).filter(e=>!t.byRef.has(e))}function Iv(){let{settingsHub:e}=Wg();return(0,Q.useMemo)(()=>Pv(e),[e])}var Lv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Lv||={});var Rv;(function(e){e.RESOURCE_NOT_FOUND=`RESOURCE_NOT_FOUND`,e.OPERATION_NOT_FOUND=`OPERATION_NOT_FOUND`,e.VIEW_NOT_FOUND=`VIEW_NOT_FOUND`,e.VIEW_REF_COLLISION=`VIEW_REF_COLLISION`,e.ENGINE_PAGE_NOT_FOUND=`ENGINE_PAGE_NOT_FOUND`,e.RESOURCE_BROWSER_RESOURCE_NOT_FOUND=`RESOURCE_BROWSER_RESOURCE_NOT_FOUND`,e.RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND=`RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND`,e.RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND=`RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND`,e.RESOURCE_BROWSER_MISSING_LABEL_CONFIG=`RESOURCE_BROWSER_MISSING_LABEL_CONFIG`,e.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES=`ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES`,e.HOSTED_COMPONENT_NOT_CONFIGURED=`HOSTED_COMPONENT_NOT_CONFIGURED`,e.VISIBLE_IN_MODES_ORPHAN=`VISIBLE_IN_MODES_ORPHAN`,e.NOTIFICATION_BADGE_REF_NOT_FOUND=`NOTIFICATION_BADGE_REF_NOT_FOUND`,e.APP_SCOPE_DUPLICATE_RESOURCE_TYPE=`APP_SCOPE_DUPLICATE_RESOURCE_TYPE`,e.VIEW_NOT_LAUNCHABLE=`VIEW_NOT_LAUNCHABLE`,e.UNKNOWN_TARGET_KIND=`UNKNOWN_TARGET_KIND`,e.SETTINGS_SECTION_NOT_PLACED=`SETTINGS_SECTION_NOT_PLACED`,e.REQUIRED_ROLES_UNKNOWN_ROLE=`REQUIRED_ROLES_UNKNOWN_ROLE`})(Rv||={});function Ose(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Map,o=(e,r)=>{e.scope===em.APPLICATION&&(t.has(e.ref)?n.add(e.ref):t.set(e.ref,{family:r}))};for(let t of e.compositeViews??[])r.set(t.ref,t),o(t,`composite`);for(let t of e.fullCustomViews??[])i.set(t.ref,t),o(t,`fullCustom`);for(let t of e.flowsActorsViews??[])a.set(t.ref,t),o(t,`flowsActors`);return{applicationViewsByRef:t,duplicateApplicationViewRefs:n,compositeViewsByRef:r,fullCustomViewsByRef:i,flowsActorsViewsByRef:a}}function zv(e,t,n,r,i,a,o){let s=a===`application`?kse(e.viewRef,r,t,i,e):Ase(e,n,t,i);if(s)switch(s.family){case`fullCustom`:{let n=r.fullCustomViewsByRef.get(e.viewRef);n&&o&&!o(n.componentRef)&&i.push({severity:Lv.ERROR,code:Rv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Full custom view "${e.viewRef}" references component "${n.componentRef}" which is not registered in ComponentRegistryService`,item:e});break}}}function kse(e,t,n,r,i){return t.duplicateApplicationViewRefs.has(e)?(r.push({severity:Lv.ERROR,code:Rv.VIEW_REF_COLLISION,context:n,message:`Application view ref "${e}" is declared by multiple special-view families in the same launcher scope`,item:i}),null):t.applicationViewsByRef.get(e)||(r.push({severity:Lv.ERROR,code:Rv.VIEW_NOT_FOUND,context:n,message:`Application view "${e}" not found in any compatible special-view definition`,item:i}),null)}function Ase(e,t,n,r){if(!t.resourceConfigurations[e.resourceType])return r.push({severity:Lv.ERROR,code:Rv.RESOURCE_NOT_FOUND,context:n,message:`Resource type "${e.resourceType}" not found in registry`,item:e}),null;if(Ph({resourceType:e.resourceType,viewRef:e.viewRef,registry:t}).length>1)return r.push({severity:Lv.ERROR,code:Rv.VIEW_REF_COLLISION,context:n,message:`Resource view ref "${e.viewRef}" is declared multiple times on resource "${e.resourceType}". RESOURCE_VIEW refs must be unique per resource-owned view namespace.`,item:e}),null;let i=qh({resourceType:e.resourceType,viewRef:e.viewRef,registry:t});return i?i.scope===em.RESOURCE?{family:i.family}:(r.push({severity:Lv.ERROR,code:Rv.VIEW_NOT_LAUNCHABLE,context:n,message:`Resource view "${e.viewRef}" on resource "${e.resourceType}" must be declared with RESOURCE scope to be targeted by RESOURCE_VIEW launchers`,item:e}),null):(r.push({severity:Lv.ERROR,code:Rv.VIEW_NOT_FOUND,context:n,message:`Resource view "${e.viewRef}" is not declared on resource "${e.resourceType}"`,item:e}),null)}function Bv(e,t,n,r,i,a,o){switch(e.kind){case hu.RESOURCE_OPERATION:{let r=n.resourceConfigurations[e.resourceType];if(!r){i.push({severity:Lv.ERROR,code:Rv.RESOURCE_NOT_FOUND,context:t,message:`Resource type "${e.resourceType}" not found in registry`,item:e});return}let a=r.operations.filter(t=>t.operationIdentifier===e.operation);if(!(e.operationVariant?a.some(t=>t.variantKey===e.operationVariant):a.length>0))i.push({severity:Lv.ERROR,code:Rv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}"${e.operationVariant?` (variant: ${e.operationVariant})`:``} not found on resource "${e.resourceType}"`,item:e});else if(!e.operationVariant){let n=a.filter(e=>e.isOperationDefault===!0);a.length>1&&n.length!==1&&i.push({severity:Lv.ERROR,code:Rv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}" on resource "${e.resourceType}" is ambiguous without an explicit launcher operationVariant`,item:e})}break}case hu.VIEW:zv(e,t,n,r,i,`application`,o);break;case hu.RESOURCE_VIEW:zv(e,t,n,r,i,`resource`,o);break;case hu.ENGINE_PAGE:e.pageRef in Fl||i.push({severity:Lv.ERROR,code:Rv.ENGINE_PAGE_NOT_FOUND,context:t,message:`Engine page ref "${e.pageRef}" has no entry in ENGINE_PAGE_METADATA`,item:e});break;case hu.CUSTOM_COMPONENT:o&&!o(e.componentRef)&&i.push({severity:Lv.ERROR,code:Rv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Custom launcher component "${e.componentRef}" is not registered in ComponentRegistryService`,item:e});break;case hu.SETTINGS_SECTION:e.sectionRef!==void 0&&!a.has(e.sectionRef)&&i.push({severity:Lv.ERROR,code:Rv.SETTINGS_SECTION_NOT_PLACED,context:t,message:`Launcher opens Settings Hub section "${e.sectionRef}", which this application does not place in its settings rail (\`settingsHub.placements\`); the hub would silently open its default section instead.`,item:e});break;default:i.push({severity:Lv.ERROR,code:Rv.UNKNOWN_TARGET_KIND,context:t,message:`Unknown LauncherItemTargetKind: "${e.kind}"`,item:e})}}function Vv(e,t,n,r){e.notificationBadgeRef&&!n.notificationBadgeDefinitions.some(t=>qu(t)===e.notificationBadgeRef)&&r.push({severity:Lv.ERROR,code:Rv.NOTIFICATION_BADGE_REF_NOT_FOUND,context:t,message:`notificationBadgeRef "${e.notificationBadgeRef}" does not resolve to a registered notification badge definition. A ref is a badge key ("<scope>:<identifier>"); registered keys are: ${n.notificationBadgeDefinitions.map(qu).join(`, `)||`(none)`}`,item:e})}function Hv(e,t,n,r,i,a,o){for(let s of e)Bv(s,t,n,r,i,a,o),Vv(s,t,n,i),s.children&&Hv(s.children,`${t}.children`,n,r,i,a,o)}function jse(e,t,n,r,i,a,o){let s=`sidebar.contentSections[${e.ref}]`;if(e.visibleInModes&&e.visibleInModes.length>0){if(r.size===0)i.push({severity:Lv.WARNING,code:Rv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`Section has visibleInModes but no appModes are declared — section will always be hidden`,item:e});else for(let t of e.visibleInModes)r.has(t)||i.push({severity:Lv.WARNING,code:Rv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`visibleInModes ref "${t}" does not match any declared appMode`,item:e})}switch(e.contentKind){case ze.NAVIGATION_LIST:Hv(e.children,s,t,n,i,a,o);break;case ze.RESOURCE_BROWSER:{let n=e,r=t.resourceConfigurations[n.resourceType];if(!r){i.push({severity:Lv.ERROR,code:Rv.RESOURCE_BROWSER_RESOURCE_NOT_FOUND,context:s,message:`RESOURCE_BROWSER resourceType "${n.resourceType}" not found in registry`,item:e});break}n.operation&&(r.operations.some(e=>e.operationIdentifier===n.operation&&(!n.operationVariant||e.variantKey===n.operationVariant))||i.push({severity:Lv.ERROR,code:Rv.RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND,context:s,message:`RESOURCE_BROWSER bound operation "${n.operation}"${n.operationVariant?` (variant: ${n.operationVariant})`:``} not found on "${n.resourceType}"`,item:e})),n.navigateOperation&&(r.operations.some(e=>e.operationIdentifier===n.navigateOperation&&(!n.navigateOperationVariant||e.variantKey===n.navigateOperationVariant))||i.push({severity:Lv.ERROR,code:Rv.RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND,context:s,message:`RESOURCE_BROWSER navigation operation "${n.navigateOperation}"${n.navigateOperationVariant?` (variant: ${n.navigateOperationVariant})`:``} not found on "${n.resourceType}"`,item:e})),V.frontendResourceLabelDefinitionOf(r)||i.push({severity:Lv.WARNING,code:Rv.RESOURCE_BROWSER_MISSING_LABEL_CONFIG,context:s,message:`RESOURCE_BROWSER for "${n.resourceType}" has no record label configured (recordLabelFields on the resource, or getFrontendResourceLabel in its frontendConfiguration) — instance labels will fall back to the record's summary fields, then its id`,item:e});break}case ze.GUIDANCE_WIDGET:case ze.CUSTOM_COMPONENT:}}function Uv(e,t,n,r){let i=[],a=t.appComponentsConfiguration,o=Ose(t),s=new Set(Pv(t.settingsHub).sections.map(e=>e.ref)),c=new Set,l=t.appModes??[];for(let e of l)c.add(e.ref);let u=t.appScope?.fields??[],d=Dm(u);for(let e of d)i.push({severity:Lv.ERROR,code:Rv.APP_SCOPE_DUPLICATE_RESOURCE_TYPE,context:`appScope.fields`,message:`Duplicate app-scope resourceType "${e.resourceType}" is not allowed in appScope.fields. Conflicting fieldIdentifiers: ${e.fieldIdentifiers.join(`, `)}`,item:e});for(let e of o.duplicateApplicationViewRefs)i.push({severity:Lv.ERROR,code:Rv.VIEW_REF_COLLISION,context:`applicationViews`,message:`Application view ref "${e}" is declared by multiple special-view families. View refs must be unique per launcher scope.`,item:e});let f=a[Fr.SIDEBAR];if(typeof f==`object`&&f&&`contentSections`in f){let t=f.contentSections;if(t)for(let r of t)jse(r,e,o,c,i,s,n)}let p=a[Fr.COMMAND_MENU];if(typeof p==`object`&&p&&`commands`in p){let t=p.commands;if(t)for(let r of t)Bv(r,`command_menu.commands`,e,o,i,s,n)}let m=a[Fr.HOTKEY];if(typeof m==`object`&&m&&`bindings`in m){let t=m.bindings;if(t)for(let r of t)Bv(r,`hotkey.bindings`,e,o,i,s,n)}let h=a[Fr.QUICK_ACTION_BUTTON];if(typeof h==`object`&&h&&`actions`in h){let t=h.actions;if(t)for(let r of t)Bv(r,`quick_action_button.actions`,e,o,i,s,n)}let g=a[Fr.CONTROL_PANEL];if(typeof g==`object`&&g&&`items`in g){let t=g.items;if(t)for(let r of t)Bv(r,`control_panel.items`,e,o,i,s,n)}let _=a[Fr.TOOLBAR];if(typeof _==`object`&&_&&`tools`in _){let t=_.tools;if(t)for(let r of t)Bv(r,`toolbar.tools`,e,o,i,s,n)}let v=a[Fr.MENUBAR];if(typeof v==`object`&&v){if(`hostedComponents`in v){let e=v.hostedComponents;if(e)for(let t of e)t.componentType in a||i.push({severity:Lv.ERROR,code:Rv.HOSTED_COMPONENT_NOT_CONFIGURED,context:`menubar.hostedComponents`,message:`Hosted component "${t.componentType}" is not configured in appComponentsConfiguration`,item:t})}if(`items`in v){let t=v.items;if(t)for(let r of t)Bv(r,`menubar.items`,e,o,i,s,n),Vv(r,`menubar.items`,e,i)}}let y=a[Fr.ACTIVITY_BAR];return typeof y==`object`&&y?l.length===0&&i.push({severity:Lv.WARNING,code:Rv.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES,context:`activity_bar`,message:`ACTIVITY_BAR is configured but no appModes are declared — the mode selector will have nothing to render`,item:y}):y===!0&&l.length===0&&i.push({severity:Lv.WARNING,code:Rv.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES,context:`activity_bar`,message:`ACTIVITY_BAR is enabled but no appModes are declared — the mode selector will have nothing to render`,item:y}),Mse(a,r?.organizationRoles,i),{errors:i,isValid:i.length===0}}function Mse(e,t,n){if(!t?.length)return;let r=new Set([...Object.values(ir),...Object.values(Al),...t]),i=(e,t)=>{if(typeof e!=`object`||!e)return;let a=e,o=a.runtimeAvailability?.requiredRoles;if(Array.isArray(o))for(let i of o)typeof i==`string`&&!r.has(i)&&n.push({severity:Lv.WARNING,code:Rv.REQUIRED_ROLES_UNKNOWN_ROLE,context:t,message:`requiredRoles names "${i}", which is neither a core role nor one of the application's organization roles: nobody holds it, so the entry is shown to none of the roles meant by it. Check the spelling (a custom application-level role is also reported here).`,item:e});Array.isArray(a.children)&&a.children.forEach((e,n)=>i(e,`${t}.children[${n}]`))},a=(t,n)=>{let r=e[t];if(typeof r!=`object`||!r)return[];let i=r[n];return Array.isArray(i)?i:[]};a(Fr.SIDEBAR,`contentSections`).forEach((e,t)=>i(e,`sidebar.contentSections[${t}]`)),a(Fr.COMMAND_MENU,`commands`).forEach((e,t)=>i(e,`command_menu.commands[${t}]`)),a(Fr.HOTKEY,`bindings`).forEach((e,t)=>i(e,`hotkey.bindings[${t}]`)),a(Fr.QUICK_ACTION_BUTTON,`actions`).forEach((e,t)=>i(e,`quick_action_button.actions[${t}]`)),a(Fr.CONTROL_PANEL,`items`).forEach((e,t)=>i(e,`control_panel.items[${t}]`)),a(Fr.TOOLBAR,`tools`).forEach((e,t)=>i(e,`toolbar.tools[${t}]`)),a(Fr.MENUBAR,`items`).forEach((e,t)=>i(e,`menubar.items[${t}]`))}function Wv(e){if(e.isValid){console.log(`[LauncherVerification] ✓ All launcher content declarations are valid`);return}let t=e.errors.filter(e=>e.severity===Lv.ERROR).length,n=e.errors.filter(e=>e.severity===Lv.WARNING).length;console.group(`[LauncherVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Lv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}var Gv;(function(e){e.ANSWERER=`decisionInboxAnswerer`})(Gv||={});function Kv(e){let t=e.offer?.answeringRoles??[];if(t.length===0)return!1;let n=e.effectiveRoles,r=n.accessProfile;if(!r)return Im(t,n);let i=new Set;for(let e of r.roleEntries)if(e.relatedPrimaryScope===Vr.ORGANIZATIONS&&e.relatedResourceId)for(let t of e.roles)i.add(t);return Im(t,{...n,organizationRoles:[...i]})}function qv(e){return{[Gv.ANSWERER]:Kv(e)}}var Jv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Jv||={});var Yv;(function(e){e.DUPLICATE_SECTION_REF=`DUPLICATE_SECTION_REF`,e.DUPLICATE_CATEGORY_REF=`DUPLICATE_CATEGORY_REF`,e.SECTION_UNKNOWN_CATEGORY_REF=`SECTION_UNKNOWN_CATEGORY_REF`,e.SECTION_UNKNOWN_GROUP_REF=`SECTION_UNKNOWN_GROUP_REF`,e.DUPLICATE_GROUP_REF=`DUPLICATE_GROUP_REF`,e.DUPLICATE_SUB_TAB_REF=`DUPLICATE_SUB_TAB_REF`,e.DEFAULT_SECTION_REF_UNKNOWN=`DEFAULT_SECTION_REF_UNKNOWN`,e.PLACEMENT_UNKNOWN_DESTINATION_REF=`PLACEMENT_UNKNOWN_DESTINATION_REF`,e.APPLICATION_DESTINATION_SHADOWS_ENGINE=`APPLICATION_DESTINATION_SHADOWS_ENGINE`,e.DUPLICATE_APPLICATION_DESTINATION_REF=`DUPLICATE_APPLICATION_DESTINATION_REF`,e.SETTINGS_HUB_EMPTY=`SETTINGS_HUB_EMPTY`})(Yv||={});var Nse={refsShadowingEngineDestinations:[],duplicateApplicationDestinationRefs:[]};function Xv(e){let t=new Set,n=new Set;for(let r of e)t.has(r)?n.add(r):t.add(r);return[...n]}function Zv(e,t=[],n=Nse){let r=[];e.sections.length===0&&r.push({severity:Jv.ERROR,code:Yv.SETTINGS_HUB_EMPTY,context:`settingsHub`,message:"The Settings Hub places no section, so Settings opens as an empty dialog. Pass the application's rail as `settingsHub` in its frontend configuration (`frontendBaseConfig` in `modules-registry.frontend.ts`), with at least one placement."});for(let e of n.refsShadowingEngineDestinations)r.push({severity:Jv.ERROR,code:Yv.APPLICATION_DESTINATION_SHADOWS_ENGINE,context:`settingsHub.destinations`,message:`Settings Hub destination "${e}" reuses the ref of an engine destination; the engine destination is the one that renders, so this declaration is unused. Give it a ref of its own.`,item:e});for(let e of n.duplicateApplicationDestinationRefs)r.push({severity:Jv.ERROR,code:Yv.DUPLICATE_APPLICATION_DESTINATION_REF,context:`settingsHub.destinations`,message:`Settings Hub destination "${e}" is declared more than once; only the first declaration renders.`,item:e});for(let e of t)r.push({severity:Jv.ERROR,code:Yv.PLACEMENT_UNKNOWN_DESTINATION_REF,context:`settingsHub.placements`,message:`Settings Hub placement references destinationRef "${e}", which neither the engine destination catalog nor the application's own destinations declare; the placement is dropped and the section will not render.`,item:e});for(let t of Xv(e.categories.map(e=>e.ref)))r.push({severity:Jv.ERROR,code:Yv.DUPLICATE_CATEGORY_REF,context:`settingsHub.categories`,message:`Settings Hub category ref "${t}" is declared more than once; category refs must be unique (each is a rail group + the join key for its sections).`,item:t});for(let t of Xv(e.sections.map(e=>e.ref)))r.push({severity:Jv.ERROR,code:Yv.DUPLICATE_SECTION_REF,context:`settingsHub.sections`,message:`Settings Hub section ref "${t}" is declared more than once; section refs must be unique across the whole hub (they are the URL segment + Tabs value).`,item:t});let i=new Set(e.categories.map(e=>e.ref));for(let t of e.sections)i.has(t.categoryRef)||r.push({severity:Jv.ERROR,code:Yv.SECTION_UNKNOWN_CATEGORY_REF,context:`settingsHub.sections[${t.ref}]`,message:`Settings Hub section "${t.ref}" references categoryRef "${t.categoryRef}" which is not declared in categories; the section would render a content panel with no rail entry.`,item:t});for(let t of e.categories)for(let e of Xv((t.groups??[]).map(e=>e.ref)))r.push({severity:Jv.ERROR,code:Yv.DUPLICATE_GROUP_REF,context:`settingsHub.categories[${t.ref}].groups`,message:`Settings Hub group ref "${e}" is declared more than once in category "${t.ref}"; group refs must be unique within their category.`,item:e});let a=new Map(e.categories.map(e=>[e.ref,e]));for(let t of e.sections){if(t.groupRef===void 0)continue;let e=a.get(t.categoryRef);e!==void 0&&((e.groups??[]).some(e=>e.ref===t.groupRef)||r.push({severity:Jv.ERROR,code:Yv.SECTION_UNKNOWN_GROUP_REF,context:`settingsHub.sections[${t.ref}]`,message:`Settings Hub section "${t.ref}" references groupRef "${t.groupRef}", which category "${t.categoryRef}" does not declare in its groups; the rail draws it above the groups, with no heading.`,item:t}))}for(let t of e.sections)if(t.target.kind===gv.SUB_TABS)for(let e of Xv(t.target.subTabs.map(e=>e.ref)))r.push({severity:Jv.ERROR,code:Yv.DUPLICATE_SUB_TAB_REF,context:`settingsHub.sections[${t.ref}].subTabs`,message:`Settings Hub sub-tab ref "${e}" is declared more than once within section "${t.ref}"; sub-tab refs must be unique within their section (they are the inner Tabs value).`,item:t});return e.defaultSectionRef&&!e.sections.some(t=>t.ref===e.defaultSectionRef)&&r.push({severity:Jv.WARNING,code:Yv.DEFAULT_SECTION_REF_UNKNOWN,context:`settingsHub.defaultSectionRef`,message:`Settings Hub defaultSectionRef "${e.defaultSectionRef}" does not match any declared section; the hub will fall back to the first section.`,item:e.defaultSectionRef}),{errors:r,isValid:r.length===0}}function Qv(e){if(e.isValid){console.log(`[SettingsHubVerification] ✓ Settings Hub configuration is valid`);return}let t=e.errors.filter(e=>e.severity===Jv.ERROR).length,n=e.errors.filter(e=>e.severity===Jv.WARNING).length;console.group(`[SettingsHubVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Jv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}function Pse(e){return typeof e==`object`&&!!e&&typeof e.reportCrash==`function`}function Fse(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.track==`function`&&typeof t.page==`function`&&typeof t.identify==`function`&&typeof t.reset==`function`}function Ise(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.signInSucceeded==`function`&&typeof t.signInFailed==`function`}function $v(e){let t=e.operation.initiatorInfos??[];return t.length===0||t.some(t=>{let n=t.parameters??[];return n.length===0||n.every(t=>{let n=[t.fieldIdentifier,t.relationshipField,t.resourceType].filter(e=>typeof e==`string`&&e.length>0);return n.length!==0&&n.some(t=>{if(On.getResourceId(e.contextResourceIdentifiers[t]).length>0)return!0;let n=e.contextualParameters[t];return n!==void 0&&String(n).length>0})})})}function ey(e,t,n){let r=Hu(t),i=Object.fromEntries(Object.entries(r).flatMap(([e,t])=>{let r=n.fieldIdentifierToResourceType?.[e]??e;return r===e?[[e,t]]:[[e,t],[r,t]]}));return delete i[e],i}function ty(e){let t=e.registry.resourceConfigurations[e.resourceType]?.operations??[],n=t=>{let n=V.buildContextualParameters(t,e.registry);return e=>$v({operation:e,contextResourceIdentifiers:t,contextualParameters:n})},r=n(e.scopes.contextResourceIdentifiers),i=e.scopes.previousContextResourceIdentifiers?n(e.scopes.previousContextResourceIdentifiers):void 0;return Ra(t,W.LIST).filter(e=>r(e)||(i?.(e)??!1))}function Lse(e){if(typeof e==`string`)return e.length>0?e:void 0;if(typeof e==`object`&&e&&typeof e._id==`string`){let t=e._id;return t.length>0?t:void 0}}function Rse(e){let t=e._version;return typeof t==`number`||typeof t==`string`&&/^\d+$/.test(t)}function ny(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function ry(e){let{resourceType:t,registry:n}=e,r=Hu(e.callContext),i=n.resourceConfigurations[t]?.operations??[],a=new Map;for(let e of i)for(let t of e.initiatorInfos??[])for(let e of t.parameters??[])a.set(e.fieldIdentifier,String(e.resourceType));let o=U_({callContext:Object.fromEntries(Object.entries(r).filter(([e,t])=>![...a].some(([n,i])=>i===e&&n!==e&&r[n]===t))),operations:i,ownFieldIdentifier:n.resourceConfigurations[t]?.resourceFieldIdentifier||n.allResourceFieldIdentifiers?.[t],row:ny(e.row)??ny(e.previousRow),previousRow:ny(e.row)?ny(e.previousRow):void 0,normalizeId:Lse,isStoredRow:Rse,typeOfFieldIdentifier:e=>n.fieldIdentifierToResourceType?.[e]}),s=ey(t,o.contextResourceIdentifiers,n);return o.previousContextResourceIdentifiers?{contextResourceIdentifiers:s,previousContextResourceIdentifiers:ey(t,o.previousContextResourceIdentifiers,n)}:{contextResourceIdentifiers:s}}function zse(e){let{emit:t,resourceConfig:n,registry:r,resourceType:i,operation:a,resourceContext:o,isWebSocketConnected:s,result:c}=e,l=Bc(o.additionalContext),u=di(a),d=Hu(o.contextResourceIdentifiers),f=Ae({contextResourceIdentifiers:o.contextResourceIdentifiers,resourceType:i,result:c,isBulkOperation:a.isBulkOperation===!0});if(!Ai(a,s)&&Tu(a)){let e=n?.operations?[...n.operations]:[],{[i]:s,...p}=d,m=r?ry({resourceType:i,registry:r,callContext:o.contextResourceIdentifiers,...a.isBulkOperation===!0?{}:{row:c}}).contextResourceIdentifiers:p,h=r?V.buildContextualParameters(m,r):{},g=Ra(e,W.LIST).filter(e=>$v({operation:e,contextResourceIdentifiers:r?m:o.contextResourceIdentifiers,contextualParameters:h})),_=g.length>0?g:[null];for(let e of _){let n=e??{operationIdentifier:W.LIST};t(Ec.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:m,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}})}if(u){let a=Ra(e,W.READ,{requireAddressable:!0}).filter(e=>n&&r?Km({resourceConfig:n,operation:e,registry:r,hasResourceId:f[i]!==void 0,contextResourceIdentifiers:f,contextualParameters:r?V.buildContextualParameters(f,r):h}):!0),s=a.length>0?a:[null],c=new Set;for(let e of s){let n=e??{operationIdentifier:W.READ},r=[V.getInstance().getResourceId(f[i]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);c.has(r)||(c.add(r),t(Ec.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:f,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}}))}}}t(Ec.RESOURCE_OPERATION_EXECUTED,{resourceType:i,operationIdentifier:String(a.operationIdentifier),operation:a,variantType:a.variantType,isOperationDefault:a.isOperationDefault??!0,isBulkOperation:a.isBulkOperation??!1,variantKey:a.variantKey,contextResourceIdentifiers:f,parentResourcesRequirements:o.parentResourcesRequirements,resultSummary:Xu(c),...l?{optionalDiscriminator:l}:{}})}var $=yg(),iy;(function(e){e.PARENT_RESOURCE_REQUIREMENT=`parent-resource-requirement`,e.ADDITIONAL_RESOURCE_REQUIREMENT=`additional-resource-requirement`})(iy||={});var ay;(function(e){e.INITIAL=`initial`,e.REFRESH=`refresh`})(ay||={});function oy(e){if(!Array.isArray(e.participationRefs)||e.participationRefs.length===0)throw Error(`[ExecutionView] ExecutionPendingPrefetch must carry at least one participation ref. A prefetch with no refs cannot be narrowed to per-ref UX. If the work is not tied to any participation, do not register it as a participation prefetch.`);if(typeof e.resourceType!=`string`||e.resourceType.length===0)throw Error("[ExecutionView] ExecutionPendingPrefetch must carry a non-empty `resourceType` so per-resource UI filtering composes uniformly with the pending-action tier.");if(e.intent!==ay.INITIAL&&e.intent!==ay.REFRESH)throw Error("[ExecutionView] ExecutionPendingPrefetch.intent must be one of `INITIAL` | `REFRESH` so renderers can distinguish full-screen vs background hydration UX without a side-channel flag.")}var sy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`})(sy||={});function cy(e){if(e.scope===sy.LOCAL_PANE){let t=e;if(typeof t.paneId!=`string`||t.paneId.length===0)throw Error("[ExecutionView] LOCAL_PANE-scoped dirty marker must carry a non-empty `paneId` so the shell can auto-clear it on pane transitions. Use scope=CUSTOM for markers that should outlive any single pane.")}}function ly(e){if(typeof e==`object`&&e&&e.contentType===sd.RESOURCE_OPERATION)throw Error(`[ExecutionView] localPane payload must not be an ExecutionEmbeddableContent. Resource-operation content belongs in the embedded-content slot. Use openEmbeddedContent() or execution.actions.operation(...).embed() instead.`)}function uy(e){if(!e||e.contentType!==sd.RESOURCE_OPERATION)throw Error(`[ExecutionView] embeddedContent.content must be a NavigationContent.RESOURCE_OPERATION. Non-resource-operation navigation content must go through delegateToParent() (the app router), not the execution shell's embed slot.`)}var dy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`,e.PARTICIPATION_PREFETCH=`participation-prefetch`})(dy||={});function fy(e){if(e.scope===dy.LOCAL_PANE){let t=e;if(typeof t.paneId!=`string`||t.paneId.length===0)throw Error("[ExecutionView] LOCAL_PANE-scoped failed action must carry a non-empty `paneId` so the shell can auto-clear it on pane transitions. Use scope=CUSTOM for failures that should outlive any single pane.")}if(e.scope===dy.PARTICIPATION_PREFETCH){let t=e;if(typeof t.prefetchKey!=`string`||t.prefetchKey.length===0)throw Error("[ExecutionView] PARTICIPATION_PREFETCH-scoped failed action must carry a non-empty `prefetchKey` so the shell can auto-clear it on the next successful prefetch settle for the same key. Use scope=CUSTOM for failures that should outlive any single prefetch unit.")}}var py=(0,Q.createContext)(void 0);function my(e){if(!e)throw Error(`Execution runtime context must be used within an ExecutionRuntimeProvider.`);return e}var hy=({children:e,viewDefinition:t,contextResourceIdentifiers:n,runtimeInstanceId:r,navigationZone:i,doOperation:a,navigation:o,anchor:s,participations:c,runtimeState:l})=>{let u=(0,Q.useMemo)(()=>({viewDefinition:t,contextResourceIdentifiers:n,runtimeInstanceId:r,navigationZone:i,doOperation:a,navigation:o,anchor:s,participations:c,runtimeState:l}),[t,n,r,i,a,o,s,c,l]);return(0,$.jsx)(py.Provider,{value:u,children:e})};function gy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===t?n=!0:r[i]=a;return n?r:e}function _y(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===dy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function vy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.wildoError==`object`&&t.wildoError!==null}function yy(e){let t=e.markedByHttpClient??vy(e.error),n=e.bridgedByExecutionShell??!1,r={failureRuntimeId:e.failureRuntimeId,error:e.error,originatingActionRuntimeId:e.originatingActionRuntimeId,operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,capturedAt:e.capturedAt??Date.now(),startedAt:e.startedAt,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===dy.LOCAL_PANE?{...r,scope:e.scope,paneId:e.paneId}:e.scope===dy.EMBEDDED_CONTENT?{...r,scope:e.scope}:e.scope===dy.PARTICIPATION_PREFETCH?{...r,scope:e.scope,prefetchKey:e.prefetchKey}:{...r,scope:dy.CUSTOM},fy(i),i}function by(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===dy.PARTICIPATION_PREFETCH&&a.prefetchKey===t?n=!0:r[i]=a;return n?r:e}var xy;(function(e){e.SINGLE=`single`,e.ARRAY=`array`})(xy||={});function Bse(e){return e.foreignKeyField??e.resourceType}function Sy(e){let t=(e.requirements??[]).filter(t=>Bse(t)===e.bindingKey);return t.length===1?t[0]:void 0}function Vse(e,t){let n=t.resourceConfigurations[e]?.resourceRelationships;if(!n)return[];let r=(e,t)=>Ul.ensureCompiledRelationship.call(Ul,e,t);return[...n.parentRelationships,...n.childRelationships,...n.selfRelationships].map(e=>r(e,t.allResourceFieldIdentifiers))}function Cy(e){let t=Sy({bindingKey:e.bindingKey,requirements:e.requirements});if(t)return{ref:e.ref,source:e.source,requirement:t,contextValue:e.contextResourceIdentifiers?.[e.bindingKey]}}function Hse(e){let t=Ty(e.sourceParticipation);if(t===e.definition.targetResourceType)return;let n=Vse(t,e.registry).filter(n=>{if(n.resourceType1!==e.definition.targetResourceType&&n.resourceType2!==e.definition.targetResourceType||e.definition.foreignKeyField&&Ul.tryResolveRelationshipForeignKeyIdentity(n,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==e.definition.foreignKeyField)return!1;let r=n.resourceType1===t?e.sourceResourceData:void 0;return Ul.isRelationshipActiveForParent(n,r,{onMissingParentResource:`exclude`,onConditionError:`exclude`})});if(n.length===1)return{ref:e.ref,source:jm.RELATIONSHIP_PROJECTION,fromParticipationRef:e.definition.fromParticipationRef,relationship:n[0],currentResourceType:t}}function Use(e){let t=e.viewDefinition.participations??{},n=new Map,r=new Set,i=a=>{let o=n.get(a);if(o)return o;let s=t[a];if(!s||r.has(a))return;r.add(a);let c;switch(s.source){case jm.ANCHOR:if(e.anchor){let t=e.explicitContextResourceIdentifiers?.[e.anchor.bindingKey];if(t){let n=e.viewDefinition.anchor?.source===km.PARENT_RESOURCE_REQUIREMENT?e.viewDefinition.parentResourcesRequirements:e.viewDefinition.additionalResourceRequirements;c={ref:a,source:jm.ANCHOR,resourceType:e.anchor.mainResourceType,bindingKey:e.anchor.bindingKey,requirement:Sy({bindingKey:e.anchor.bindingKey,requirements:n}),contextValue:t}}}break;case jm.PARENT_RESOURCE_REQUIREMENT:c=Cy({ref:a,source:jm.PARENT_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.parentResourcesRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case jm.ADDITIONAL_RESOURCE_REQUIREMENT:c=Cy({ref:a,source:jm.ADDITIONAL_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.additionalResourceRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case jm.RELATIONSHIP_PROJECTION:{let t=i(s.fromParticipationRef);t&&(c=Hse({ref:a,definition:s,sourceParticipation:t,sourceResourceData:e.sourceResourceDataByParticipationRef?.[s.fromParticipationRef],registry:e.registry}));break}}return r.delete(a),c&&n.set(a,c),c};for(let e of Object.keys(t))i(e);return Object.fromEntries(n.entries())}function wy(e){if(e.source===jm.ANCHOR||e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.contextValue}function Ty(e){if(e.source===jm.ANCHOR)return e.resourceType;if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.resourceType;if(e.source===jm.RELATIONSHIP_PROJECTION){let t=e.relationship;return t.resourceType1===e.currentResourceType?t.resourceType2:t.resourceType1}throw Error(`Unknown execution participation source`)}function Wse(e){let t=wy(e),n=On.getResourceId(t);return n.length>0?n:void 0}function Ey(e){if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement}function Dy(e){return e.source===jm.RELATIONSHIP_PROJECTION?e.relationship:void 0}function Gse(e){let t=Dy(e);return t?Ul.getResolvedRelationshipSemantics(t):void 0}function Kse(e,t){let n=Dy(e);return n?Ul.tryResolveRelationshipForeignKeyIdentity(n,t):void 0}function qse(e,t){if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.relationshipEdgeKey;if(e.source!==jm.RELATIONSHIP_PROJECTION)return;let n=Kse(e,t.allResourceFieldIdentifiers);return V.buildRelationshipEdgeKey({parentResourceType:e.relationship.resourceType1,childResourceType:e.relationship.resourceType2,foreignKeyField:n?.fieldIdentifier??e.relationship.foreignKeyField})}function Jse(e){if(e.source!==jm.RELATIONSHIP_PROJECTION)return xy.SINGLE;let t=e.relationship.resourceType1===e.currentResourceType?e.relationship.cardinality2:e.relationship.cardinality1;return Ct(t)?xy.SINGLE:xy.ARRAY}function Oy(e){let t=wy(e.participation);if(!t)return;let n=On.getResourceId(t);if(!n)return;let r=Ty(e.participation),i=V.getResourceFieldIdentifierForType(r,e.registry),a=On.getFieldIdentifier(t),o=e.participation.source===jm.ANCHOR?e.participation.requirement?.foreignKeyField:Ey(e.participation)?.foreignKeyField,s=a??o;return s&&s!==i?{fieldIdentifier:s,resourceId:n}:n}function Yse(e){let t={};for(let n of e.participationRefs){let r=e.participations[n];if(!r)throw V.buildConfigurationError(Xl.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Unknown execution participation ref "${n}".`,participationRef:n});let i=Oy({participation:r,registry:e.registry});if(!i)continue;let a=On.getResourceId(i);if(!a)continue;let o=On.getFieldIdentifier(i)??V.getResourceFieldIdentifierForType(Ty(r),e.registry),s=t[o];if(s!==void 0&&s!==a)throw V.buildConfigurationError(Xl.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Execution participations resolved conflicting contextual values for "${o}".`,fieldIdentifier:o,previousValue:s,nextValue:a,participationRef:n});t[o]=a}return t}function Xse(e){return{participation:e.participation,resourceType:Ty(e.participation),resourceId:Wse(e.participation),valueShape:Jse(e.participation),contextValue:wy(e.participation),contextIdentifier:Oy({participation:e.participation,registry:e.registry}),requirement:Ey(e.participation),relationship:Gse(e.participation),rawRelationship:Dy(e.participation),edgeKey:qse(e.participation,e.registry)}}function ky(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{message:e,component:`useExecutionResourceOperationContextBuilder`,...t})}function Zse(e){return`operationIdentifier`in e}function Qse(e,t,n){let r=(e.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation));if(r.length===1)return r[0];let i=r.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(n.variantKey===void 0&&n.variantType===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&i.length===1)return i[0];throw ky(r.length===0?`Execution resource-operation builder cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Execution resource-operation builder found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:r.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))})}function $se(e,t,n,r,i,a){if(!e)throw ky(`Execution resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(Zse(n)){let o=Qse(e,t,n),s=vl(o);if((s===W.READ||s===W.UPDATE||s===W.DELETE)&&o.isBulkOperation!==!0&&!Km({resourceConfig:e,operation:o,registry:r,hasResourceId:On.getResourceId(i[t])!==``,contextResourceIdentifiers:i,contextualParameters:a}))throw ky(`Execution resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but the current context cannot address it.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return o}let o=n.operationLike===W.READ||n.operationLike===W.UPDATE||n.operationLike===W.DELETE,s=n.requireAddressable||o?ph({resourceConfig:e,operations:e.operations??[],coreOperation:n.operationLike,registry:r,hasResourceId:On.getResourceId(i[t])!==``,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a}):nu(e.operations??[],n.operationLike,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw ky(`Execution resource-operation builder cannot resolve a preferred ${String(n.operationLike)}-like operation on resource "${t}".`,{resourceType:t,operationLike:n.operationLike,requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});return s}function ece(e){let t=e.currentValue?On.getFieldIdentifier(e.currentValue):void 0;return t?{fieldIdentifier:t,resourceId:e.resourceId}:e.resourceId}function tce(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function nce(e){let t=tce(e.additionalContext),n=t?._id??(e.resourceConfig?.resourceFieldIdentifier?t?.[e.resourceConfig.resourceFieldIdentifier]:void 0);return typeof n==`string`&&n.length>0?n:void 0}function Ay(){let{registry:e}=fm(),t=my((0,Q.useContext)(py));return{buildResourceOperationContext:(0,Q.useCallback)(n=>{let r=n.participationRef?t.participations[n.participationRef]:void 0;if(n.participationRef&&!r)throw ky(`Execution resource-operation builder cannot resolve participation "${n.participationRef}".`,{participationRef:n.participationRef});let i=n.resourceType??(r?Ty(r):void 0);if(!i)throw ky("Execution resource-operation builder requires either `resourceType` or `participationRef`.",{target:n});let a={...t.contextResourceIdentifiers??{},...n.contextResourceIdentifiers??{}};if(r){let t=Oy({participation:r,registry:e});if(!t&&!n.resourceId)throw ky(`Execution resource-operation builder cannot derive a concrete resource identifier from participation "${n.participationRef}".`,{participationRef:n.participationRef,resourceType:i});t&&(a[i]=t)}let o=e.resourceConfigurations[i],s=nce({additionalContext:n.additionalContext,resourceConfig:o}),c=n.resourceId??s;if(c&&!r){let r=t.contextResourceIdentifiers??{};a={...zm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:i,id:On.getResourceId(r[i])},targetResourceType:i,targetId:c,registry:e}).identifiers,...n.contextResourceIdentifiers??{}}}c&&(a[i]=ece({currentValue:a[i],resourceId:c}));let l=V.buildContextualParameters(a,e),u=$se(o,i,n,e,a,l),d=On.buildParentResourcesRequirements(i,a,e,n.relationshipFieldOverrides);return On.createFrontendResourceOperationContextFromOperation({resourceType:i,operation:u,contextResourceIdentifiers:a,additionalContext:n.additionalContext,parentResourcesRequirements:d})},[t.contextResourceIdentifiers,t.participations,e])}}function rce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-action-${crypto.randomUUID()}`:`execution-action-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function jy(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ice(){let e=my((0,Q.useContext)(py)),{registry:t}=fm(),{buildResourceOperationContext:n}=Ay(),{emit:r}=Mo(),i=(0,Q.useContext)(um)?.isConnected??!1,a=(0,Q.useRef)(r),o=(0,Q.useRef)(i);a.current=r,o.current=i;let s=(0,Q.useRef)(e.runtimeState);s.current=e.runtimeState;let c=(0,Q.useMemo)(()=>Object.fromEntries(Object.entries(e.participations).map(([e,n])=>[e,Xse({participation:n,registry:t})])),[e.participations,t]),l=(0,Q.useCallback)(e=>c[e],[c]),u=(0,Q.useCallback)(t=>{let n=c[t];if(!n)throw Error(`Execution participation "${t}" is required by view "${e.viewDefinition.ref}" but was not resolved.`);return n},[e.viewDefinition.ref,c]),d=(0,Q.useCallback)(e=>Object.fromEntries(e.map(e=>[e,u(e)])),[u]),f=(0,Q.useCallback)(e=>Array.isArray(e)?d(e):u(e),[u,d]),p=(0,Q.useCallback)(n=>n.length===0?{}:Yse({participationRefs:n,participations:e.participations,registry:t}),[e.participations,t]),m=(0,Q.useCallback)(r=>{let i=(r.contextParticipationRefs??[]).reduce((n,r)=>{let i=e.participations[r];if(!i)throw Error(`Execution action target references unknown context participation "${r}" on view "${e.viewDefinition.ref}".`);let a=Oy({participation:i,registry:t});if(!a)return n;let o=Ty(i),s=n[o];if(s){let t=On.getResourceId(s),n=On.getResourceId(a),i=On.getFieldIdentifier(s),c=On.getFieldIdentifier(a);if(t!==n||i!==c)throw V.buildConfigurationError(Xl.CONFIGURATION,{component:`useExecution.actions.operation`,message:`Execution action target resolved conflicting context participations for "${o}".`,contextKey:o,existingContextIdentifier:s,nextContextIdentifier:a,participationRef:r,executionViewRef:e.viewDefinition.ref})}return n[o]=a,n},{}),c={...r,contextResourceIdentifiers:{...i,...r.contextResourceIdentifiers??{}}},l=n(c),{resourceType:u,operation:d}=l,f=String(d.operationIdentifier),p=t.resourceConfigurations[u],h=V.buildContextualParameters(l.contextResourceIdentifiers,t),g=wp({viewDefinition:e.viewDefinition,resourceType:u,operation:d}),_={...dh.createOperationInitiator(e.navigationZone,d),...r.navigationInitiator??{}},v={contentType:sd.RESOURCE_OPERATION,resourceContext:l},y=()=>(e.navigation.openEmbeddedContent({content:v,navigationInitiator:_}),!0),b=()=>{if(g===am.EMBED_LOCALLY)return y();let n=p?Vn.buildOperationFrontendRoutePaths(p,d,t.allResourceFieldIdentifiers):[],i=p&&n.length>0?On.selectMatchingRoutePath(n,l.contextResourceIdentifiers,u,p.resourceFieldIdentifier,l.parentResourcesRequirements).url:void 0;return e.navigation.delegateToParent({content:v,urlPath:i,relationshipTransition:r.relationshipTransition,initiator:{...r.navigationInitiator,sourceOperation:_.sourceOperation,..._.sourceRelationship?{sourceRelationship:_.sourceRelationship}:{},..._.launcher?{launcher:_.launcher}:{}}}),!0},x=Ta.createOperationPathKeyFromOperation(d),S=async n=>{let i=rc({operation:d,requestData:n,additionalContext:l.additionalContext}),s={actionRuntimeId:rce(),operationPathKey:x,resourceType:u,operationId:f,startedAt:Date.now()};e.navigation.beginPendingAction(s);try{let n=await e.doOperation(x,{contextualParameters:h,parentResourcesRequirements:l.parentResourcesRequirements,...i?{requestData:i}:{}});return zse({emit:a.current,resourceConfig:p,registry:t,resourceType:u,operation:d,resourceContext:l,isWebSocketConnected:o.current,result:n}),n}catch(t){let n=vy(t),i=!n;i&&lt.handleError(t,{source:`promise`,resourceType:u,operationIdentifier:f,additionalContext:{executionRuntimeInstanceId:e.runtimeInstanceId,executionViewRef:e.viewDefinition.ref,operationPathKey:x}});let a={failureRuntimeId:jy(),originatingActionRuntimeId:s.actionRuntimeId,operationPathKey:x,resourceType:u,operationId:f,startedAt:s.startedAt,error:t,markedByHttpClient:n,bridgedByExecutionShell:i},o;o=r.failureScope?.scope===dy.LOCAL_PANE?{...a,scope:r.failureScope.scope,paneId:r.failureScope.paneId}:r.failureScope?.scope===dy.EMBEDDED_CONTENT?{...a,scope:r.failureScope.scope}:{...a,scope:dy.CUSTOM};let c=yy(o);throw e.navigation.captureFailedAction(c),t}finally{e.navigation.endPendingAction(s.actionRuntimeId)}},C=()=>{try{return m({resourceType:r.resourceType,resourceId:r.resourceId,participationRef:r.participationRef,contextParticipationRefs:r.contextParticipationRefs,contextResourceIdentifiers:r.contextResourceIdentifiers,relationshipFieldOverrides:r.relationshipFieldOverrides,additionalContext:r.additionalContext,navigationInitiator:r.navigationInitiator,relationshipTransition:r.relationshipTransition,operationLike:W.READ,requireAddressable:!0}).navigate()}catch{return!1}},w=null,T=null,E=()=>{let e=s.current;if(w===e&&T!==null)return T;let t=[];for(let n of Object.values(e.pendingActions))n.operationPathKey===x&&t.push(n);let n=[];for(let t of Object.values(e.failedActions))t.operationPathKey===x&&n.push(t);let i=[];if(r.dirtyPredicate)for(let t of Object.values(e.dirtyMarkers))r.dirtyPredicate(t)&&i.push(t);let a;for(let e of n)(!a||e.capturedAt>a.capturedAt)&&(a=e);return T={pendingActions:t,failedActions:n,dirtyMarkers:i,isPending:t.length>0,isErrored:n.length>0,isDirty:i.length>0,latestFailure:a},w=e,T},D=()=>{let t=s.current;for(let n of Object.values(t.failedActions))n.operationPathKey===x&&e.navigation.clearFailedAction(n.failureRuntimeId)};return{target:c,resourceContext:l,resourceType:u,operation:d,operationId:f,operationPathKey:x,contextualParameters:h,navigationHandlingMode:g,get status(){return E()},execute:S,embed:y,navigate:b,navigateToRead:C,retry:async e=>(D(),S(e)),clearMyFailures:D,clearMyDirty:()=>{if(!r.dirtyPredicate)return;let t=s.current;for(let n of Object.values(t.dirtyMarkers))r.dirtyPredicate(n)&&e.navigation.clearDirty(n.markerId)}}},[n,e.doOperation,e.navigation,e.participations,e.viewDefinition,t]),h=(0,Q.useMemo)(()=>({all:c,get:l,require:f}),[l,c,f]),g=(0,Q.useCallback)(e=>Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=e=>{let n={...t,...e,contextResourceIdentifiers:{...t.contextResourceIdentifiers??{},...e?.contextResourceIdentifiers??{}},additionalContext:{...t.additionalContext??{},...e?.additionalContext??{}},navigationInitiator:{...t.navigationInitiator??{},...e?.navigationInitiator??{}}};return m(n)};return[e,{execute:(e,t)=>n(e).execute(t),embed:e=>n(e).embed(),navigate:e=>n(e).navigate(),navigateToRead:e=>n(e).navigateToRead(),bind:e=>n(e)}]})),[m]),_=(0,Q.useMemo)(()=>({operation:m,dictionary:g}),[g,m]),v=(0,Q.useMemo)(()=>({open:e.navigation.openEmbeddedContent,close:e.navigation.closeEmbeddedContent,openResource:e=>m(e).embed()}),[m,e.navigation.closeEmbeddedContent,e.navigation.openEmbeddedContent]),y=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.pendingActions),n=Object.values(e.runtimeState.participationPrefetchActions),r=t.length>0,i=n.length>0;return{pendingActions:t,participationPrefetchActions:n,isBusy:r||i,isAnyPending:r,isPending:e=>e?t.some(e):r,isAnyParticipationPrefetching:i,isParticipationPrefetching:e=>e?n.some(e):i}},[e.runtimeState.pendingActions,e.runtimeState.participationPrefetchActions]),b=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.dirtyMarkers),n=t.length>0;return{markers:t,isAnyDirty:n,isDirty:e=>e?t.some(e):n,mark:e.navigation.markDirty,clear:e.navigation.clearDirty,clearAll:e.navigation.clearAllDirty}},[e.navigation.clearAllDirty,e.navigation.clearDirty,e.navigation.markDirty,e.runtimeState.dirtyMarkers]),x=(0,Q.useRef)(e.navigation.captureFailedAction),S=(0,Q.useRef)(e.runtimeInstanceId),C=(0,Q.useRef)(e.viewDefinition.ref);x.current=e.navigation.captureFailedAction,S.current=e.runtimeInstanceId,C.current=e.viewDefinition.ref;let w=(0,Q.useCallback)(e=>{let t=vy(e.error),n=(e.bridgeToCanonicalBus??!0)&&!t;n&&lt.handleError(e.error,{source:`manual`,resourceType:e.resourceType,operationIdentifier:e.operationId,additionalContext:{executionRuntimeInstanceId:S.current,executionViewRef:C.current,...e.operationPathKey?{operationPathKey:e.operationPathKey}:{}}});let r={failureRuntimeId:jy(),operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,error:e.error,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===dy.LOCAL_PANE?yy({...r,scope:e.scope,paneId:e.paneId}):e.scope===dy.EMBEDDED_CONTENT?yy({...r,scope:e.scope}):e.scope===dy.PARTICIPATION_PREFETCH?yy({...r,scope:e.scope,prefetchKey:e.prefetchKey}):yy({...r,scope:dy.CUSTOM}),x.current(i),i},[]),T=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.failedActions),n=t.length>0;return{failedActions:t,isAnyErrored:n,isErrored:e=>e?t.some(e):n,capture:w,clear:e.navigation.clearFailedAction,clearAll:e.navigation.clearAllFailedActions}},[w,e.navigation.clearAllFailedActions,e.navigation.clearFailedAction,e.runtimeState.failedActions]);return(0,Q.useMemo)(()=>({view:e.viewDefinition,anchor:e.anchor,state:e.runtimeState,contextResourceIdentifiers:e.contextResourceIdentifiers,runtimeInstanceId:e.runtimeInstanceId,navigationZone:e.navigationZone,doOperation:e.doOperation,delegateToParent:e.navigation.delegateToParent,localPane:{open:e.navigation.openLocalPane,close:e.navigation.closeLocalPane},embeddedContent:v,loading:y,dirty:b,errors:T,participations:c,participation:l,requireParticipation:u,subjects:h,buildContextualParameters:p,buildResourceOperationContext:n,actions:_}),[_,p,n,e.anchor,e.contextResourceIdentifiers,e.doOperation,e.navigation,e.navigationZone,e.runtimeInstanceId,e.runtimeState,e.viewDefinition,v,y,b,T,l,c,u,h])}var My=(0,Q.createContext)(null);function Ny({scope:e,children:t}){let n=(0,Q.useMemo)(()=>e.scope===sy.LOCAL_PANE?{scope:sy.LOCAL_PANE,paneId:e.paneId}:e.scope===sy.EMBEDDED_CONTENT?{scope:sy.EMBEDDED_CONTENT}:{scope:sy.CUSTOM},[e.scope,e.paneId]);return(0,$.jsx)(My.Provider,{value:n,children:t})}function ace(){return(0,Q.useContext)(My)}function Py(e){let t=(0,Q.useContext)(py),n=(0,Q.useContext)(My),{markerId:r,isDirty:i,label:a,scopeOverride:o}=e,s=o??n??null,c=t?.navigation;(0,Q.useEffect)(()=>{if(!c)return;let e=s??{scope:sy.CUSTOM};if(!i){c.clearDirty(r);return}let t;return t=e.scope===sy.LOCAL_PANE?{markerId:r,scope:sy.LOCAL_PANE,paneId:e.paneId,label:a,markedAt:Date.now()}:e.scope===sy.EMBEDDED_CONTENT?{markerId:r,scope:sy.EMBEDDED_CONTENT,label:a,markedAt:Date.now()}:{markerId:r,scope:sy.CUSTOM,label:a,markedAt:Date.now()},c.markDirty(t),()=>{c.clearDirty(r)}},[c,r,i,s?.scope,s?.paneId])}function oce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-prefetch-${crypto.randomUUID()}`:`execution-prefetch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function sce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function cce(e){return!e||typeof e!=`object`?!1:e.name===`AbortError`}function Fy(e){let t=my((0,Q.useContext)(py)),n=(0,Q.useRef)(e);n.current=e;let r=(0,Q.useRef)(t.navigation);r.current=t.navigation;let i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(void 0),[u,d]=(0,Q.useState)(!1),f=(0,Q.useCallback)(()=>{let e=i.current,t=a.current;i.current=null,a.current=null,e&&!e.signal.aborted&&e.abort(),t!==null&&r.current.endParticipationPrefetch(t)},[]),p=(0,Q.useCallback)(async()=>{let e=n.current,t=oce(),o=new AbortController;f(),i.current=o,a.current=t;let c={prefetchRuntimeId:t,participationRefs:e.participationRefs,resourceType:e.resourceType,intent:e.intent,startedAt:Date.now(),...e.label===void 0?{}:{label:e.label}};r.current.beginParticipationPrefetch(c),d(!0);try{let t=await e.run({signal:o.signal});return i.current===o?(s(t),l(void 0),r.current.clearFailedActionsForPrefetchKey(e.prefetchKey),t):void 0}catch(t){if(i.current!==o||cce(t))return;if(l(t),e.bridgeFailuresToShellAggregator===!0){let n=yy({failureRuntimeId:sce(),error:t,resourceType:e.resourceType,startedAt:c.startedAt,...e.label===void 0?{}:{label:e.label},scope:dy.PARTICIPATION_PREFETCH,prefetchKey:e.prefetchKey});r.current.captureFailedAction(n)}return}finally{a.current===t&&(a.current=null,i.current=null,r.current.endParticipationPrefetch(t),d(!1))}},[f]),m=(0,Q.useCallback)(()=>{i.current!==null&&(f(),d(!1))},[f]);return(0,Q.useEffect)(()=>()=>{f()},[f]),(0,Q.useMemo)(()=>({data:o,isLoading:u,error:c,prefetchKey:e.prefetchKey,refetch:p,abort:m}),[m,o,c,e.prefetchKey,u,p])}function lce(e,t){return`participation-prefetch:${e}:${t}`}function uce(e){let t=my((0,Q.useContext)(py)),{registry:n}=fm(),{buildResourceOperationContext:r}=Ay(),i=t.participations[e.participationRef];if(!i)throw Error(`useExecutionParticipationDataPrefetch: participation "${e.participationRef}" is not declared on view "${t.viewDefinition.ref}". Add it to the view's \`participations\` map or correct the ref.`);let a=Ty(i),{operationPathKey:o,contextualParameters:s,parentResourcesRequirements:c,label:l}=(0,Q.useMemo)(()=>{let t=r({participationRef:e.participationRef,operationLike:W.READ,requireAddressable:!0}),i=V.buildContextualParameters(t.contextResourceIdentifiers,n);return{operationPathKey:Ta.createOperationPathKeyFromOperation(t.operation),contextualParameters:i,parentResourcesRequirements:t.parentResourcesRequirements,label:e.label}},[r,e.label,e.participationRef,n]),u=e.prefetchKey??lce(a,e.participationRef),d=e.bridgeFailuresToShellAggregator??e.intent===ay.INITIAL,f=t.doOperation,p=(0,Q.useCallback)(async({signal:e})=>f(o,{contextualParameters:s,parentResourcesRequirements:c,dataMode:Hl.RAW},{signal:e}),[s,f,o,c]);return Fy({prefetchKey:u,participationRefs:[e.participationRef],resourceType:a,intent:e.intent,run:p,...l===void 0?{}:{label:l},bridgeFailuresToShellAggregator:d})}function Iy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===t?n=!0:r[i]=a;return n?r:e}function Ly(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===sy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function dce(e){let t={markerId:e.markerId,markedAt:e.markedAt??Date.now(),label:e.label},n;return n=e.scope===sy.LOCAL_PANE?{...t,scope:e.scope,paneId:e.paneId}:{...t,scope:e.scope},cy(n),n}function Ry(e){return{navigationLayout:()=>e.navigationLayout,designSystemConfiguration:()=>e.designSystemConfiguration,appComponentsConfiguration:()=>hv(e.baseAppComponentsConfiguration,e.moduleRegistry),appScope:()=>pv(e.moduleRegistry),compositeViews:()=>e.moduleRegistry.compositeViews,fullCustomViews:()=>e.moduleRegistry.fullCustomViews,onboardingViews:()=>e.moduleRegistry.onboardingViews,guidanceFlows:()=>e.moduleRegistry.guidanceFlows,flowsActorsViews:()=>e.moduleRegistry.flowsActorsViews,homeDefinition:()=>e.homeDefinition,errorPageConfig:()=>e.errorPageConfig,...e.shellIdentity===void 0?{}:{shellIdentity:()=>e.shellIdentity},...e.publicShellIdentityMode===void 0?{}:{publicShellIdentityMode:()=>e.publicShellIdentityMode}}}function zy(e,t){let n={...e};for(let r of Object.keys(t)){let i=t[r];n[r]=typeof i==`function`?i():i!==void 0&&typeof i==`object`&&!Array.isArray(i)?{...e[r],...i}:i}return n}var By;(function(e){e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.TABLET=`tablet`,e.API=`api`})(By||={});var Vy;(function(e){e.STRICT=`strict`,e.LAX=`lax`,e.NONE=`none`})(Vy||={});var fce=Md({userAgent:bd().min(1,`User agent is required`),ipAddress:hae(),deviceType:kd(By).default(By.DESKTOP),location:bd().optional(),fingerprint:bd().optional()});function Hy(e,t){let n=URL.createObjectURL(e);try{Uy(n,t)}finally{URL.revokeObjectURL(n)}}function Uy(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n);try{n.click()}finally{n.remove()}}function Wy({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ERROR_DISPLAY,`ErrorDisplay`)(e);return(0,$.jsx)(n,{...t})}var Gy=({error:e,errorInfo:t,resetError:n,navigateHome:r})=>{let i=xa.isDevelopment(),{tComponent:a,makeTrComponent:o,isReady:s}=K({component:B.APP_LAYOUTS_ERROR_BOUNDARY}),c=o(B.APP_LAYOUTS_ERROR_BOUNDARY);if(!s)return null;let l=[{label:c(`tryAgain`),onClick:n,variant:`destructive`,iconRef:H.TRY_AGAIN},{label:c(`goHome`),onClick:()=>{n(),r?.()},variant:`secondary`,iconRef:H.HOME}],u=[];return i&&(u.push({label:c(`errorMessageLabel`),content:e.message,variant:`error`}),e.stack&&u.push({label:c(`stackTraceLabel`),content:e.stack,variant:`default`}),t.componentStack&&u.push({label:c(`componentStackLabel`),content:t.componentStack,variant:`info`})),(0,$.jsx)(Wy,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:c(`title`),message:c(`message`),actions:l,showDevInfo:i,devInfoTitle:c(`devInfoTitle`),devInfoSubtitle:c(`devInfoSubtitle`),devInfoSections:u})};function Ky({preset:e=q.DEFAULT,...t}){let n=G(B.APP_LAYOUTS_ERROR_BOUNDARY,`AppLayout_ErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var qy=as.getLogger();qy.debugByType(`ErrorBoundary`),qy.setDebugTypeLogging(`ErrorBoundary`,!1);function pce(e){let t=oh(),{emit:n}=Mo();return(0,$.jsx)(Ky,{...e,navigateHome:()=>Vh({emit:n,routerNavigate:t})})}var Jy=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t}),qy.error(`ErrorBoundary caught an error:`,{error:e,errorInfo:t});let n=Vu.buildReactError(e,t);try{_i.emit(Ec.ERROR_OCCURED,{error:n})}catch(e){qy.warn(`Failed to emit error event:`,{dispatchError:e})}if(this.props.onError)try{this.props.onError(e,t)}catch(e){qy.warn(`Error in custom error handler:`,e)}}resetError=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(this.state.hasError&&this.state.error&&this.state.errorInfo){if(this.props.fallback){let e=this.props.fallback;return(0,$.jsx)(e,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return(0,$.jsx)(pce,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return this.props.children}};function mce(e,t){let n=n=>(0,$.jsx)(Jy,{...t,children:(0,$.jsx)(e,{...n})});return n.displayName=`withErrorBoundary(${e.displayName||e.name})`,n}function hce(e){if(typeof e==`string`)return e;try{let t=JSON.stringify(e,null,2);if(t!==void 0)return t}catch{}return String(e)}function gce(e){switch(e){case 404:return H.ERROR_NOT_FOUND;case 403:return H.ERROR_ACCESS_DENIED;case 500:case 502:case 503:case 504:return H.ERROR_SERVER;default:return H.ERROR}}var Yy=({errorType:e,routeError:t,jsError:n,unknownError:r,navigate:i,navigateAction:a,navigateBack:o,navigateHome:s,errorPageConfig:c,userGuidance:l})=>{let u=xa.isDevelopment(),{tComponent:d,makeTrComponent:f,isReady:p}=K({component:B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY}),m=f(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY),h=e=>Wp({tComponent:d,componentType:B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,key:e}),g=s??(()=>i(`/`));return p?e===`route`&&t?yce(t,i,a,o??g,g,m,h,u,c,l):e===`javascript`&&n?bce(n,g,m,u):xce(r,g,m,u):null};function _ce(e,t,n,r,i,a){if(!e)return a;let o=[];if(e.primaryAction){let a=e.primaryAction;o.push({label:i(`errorPage_action_${a.type}`),onClick:()=>{switch(a.type){case`navigate`:if(n){n(a);break}a.target===`/`?r():t(a.target??`/`);break;case`retry`:window.location.reload();break;case`external`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`);break;case`support`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`)}},variant:`primary`})}if(e.secondaryActions)for(let a of e.secondaryActions)o.push({label:i(`errorPage_action_${a.type}`),onClick:()=>{switch(a.type){case`navigate`:if(n){n(a);break}a.target===`/`?r():t(a.target??`/`);break;case`retry`:window.location.reload();break;case`external`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`);break;case`support`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`)}},variant:`secondary`});return o.length>0?o:a}function vce(e){return{type:mm.NAVIGATE,target:e.target,resourceOperationPath:e.resourceOperationPath,compositeViewReference:e.compositeViewReference}}function yce(e,t,n,r,i,a,o,s,c,l){let{status:u}=e,d,f,p;switch(u){case 404:d=a(`title404`),f=a(`message404`),p=a(`suggestion404`);break;case 403:d=a(`title403`),f=a(`message403`),p=a(`suggestion403`);break;case 500:case 502:case 503:case 504:d=a(`title500`),f=a(`message500`),p=a(`suggestion500`);break;default:d=a(`titleDefault`,{status:u}),f=a(`messageDefault`),p=a(`suggestionDefault`)}let m=_ce(c,t,n,i,a,[{label:a(`goBack`),onClick:r,variant:`primary`,iconRef:H.BACK},{label:a(`goHome`),onClick:i,variant:`secondary`,iconRef:H.HOME}]),h;c?.featureGuide&&c.featureGuide.length>0&&(h=c.featureGuide.map(e=>({label:o(`errorPage_feature_${e.ref}`)??e.ref,onClick:()=>{let r=vce(e);n?n(r):r.target===`/`?i():r.target?t(r.target):i()},iconRef:e.icon})));let g;c?.supportAccess&&(g={label:a(`errorPage_contactSupport`),onClick:()=>{let e=c.supportAccess;e.type===`email`?window.location.href=`mailto:${e.target}`:window.open(e.target,`_blank`,`noopener,noreferrer`)}});let _;return c?.leadMagnet&&(_={label:a(`errorPage_leadMagnet`),onClick:()=>{window.open(c.leadMagnet.target,`_blank`,`noopener,noreferrer`)}}),(0,$.jsx)(Wy,{variant:`default`,iconRef:gce(u),statusCode:u,title:d,message:f,suggestion:p,actions:m,featureGuide:h,supportAccess:g,leadMagnet:_,userGuidance:l})}function bce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`destructive`,iconRef:H.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:H.HOME}],a=[];return r&&(a.push({label:n(`errorMessageLabel`),content:e.message,variant:`error`}),e.stack&&a.push({label:n(`stackTraceLabel`),content:e.stack,variant:`default`})),(0,$.jsx)(Wy,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:n(`titleApplication`),message:n(`messageApplication`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function xce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`primary`,iconRef:H.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:H.HOME}],a=[];return r&&a.push({label:n(`debugInfoLabel`),content:hce(e),variant:`default`}),(0,$.jsx)(Wy,{variant:`default`,iconRef:H.ERROR_UNKNOWN,title:n(`titleUnknown`),message:n(`messageUnknown`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function Xy({preset:e=q.DEFAULT,...t}){let n=G(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,`AppLayout_RouterErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Zy=as.getLogger();function Sce(e){return e?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}var Qy=()=>{let e=fg(),t=oh(),{emit:n}=Mo(),r=(0,Q.useContext)(sm),i=Zp(),a=(0,Q.useContext)(mh),o=(0,Q.useContext)(Fi),s=(0,Q.useContext)(Nc),c=bh(e)?e.status:404,l=(0,Q.useMemo)(()=>{if(!o?.frontendConfiguration)return;let e=o.frontendConfiguration;if(e.errorPageConfig)switch(c){case 404:return e.errorPageConfig.notFound;case 401:return e.errorPageConfig.unauthorized;case 403:return e.errorPageConfig.forbidden;case 503:return e.errorPageConfig.maintenance;default:return c>=500?e.errorPageConfig.serverError:void 0}},[o,c]),{wildoError:u,userGuidance:d}=(0,Q.useMemo)(()=>{if(!e)return{wildoError:void 0,userGuidance:void 0};let t=bh(e)?Vu.buildRouterError(e,e.status):Vu.buildRouterError(e);return{wildoError:t,userGuidance:t.userGuidance}},[e]);Q.useEffect(()=>{if(u){Zy.error(`RouterErrorBoundary caught error:`,{wildoError:u,error:e});try{_i.emit(Ec.ERROR_OCCURED,{error:u})}catch(e){Zy.warn(`Failed to dispatch error event:`,{dispatchError:e})}}},[u,e]);let f=(0,Q.useMemo)(()=>{let e={...i?.buildContextResourceIdentifiers?.()??{},...Sce(u?.context)};return u?.organizationId&&(e.organizationId=u.organizationId),e},[i,u]),p=Q.useCallback(()=>{Vh({emit:n,routerNavigate:t})},[n,t]),m=Q.useCallback(e=>{if(!e.content)p();else if(a)n(Ec.NAVIGATION_REQUEST,{content:e.content,initiator:{sourceZone:Dn},urlPath:e.urlPath,replaceBrowserHistory:!0});else{if(!e.urlPath){p();return}t(e.urlPath,{replace:!0})}},[n,t,p,a]),h=Q.useCallback(e=>{if(e.type===`navigate`){if(e.resourceOperationPath){if(!r){p();return}let{registry:t}=r,n=e.resourceOperationPath,i=t.resourceConfigurations[n.resourceType];if(!i){p();return}let a=i.operations.find(e=>String(e.operationIdentifier)===String(n.operationIdentifier)&&!!(e.isOperationDefault??!0)===n.isOperationDefault&&!!(e.isBulkOperation??!1)===n.isBulkOperation&&String(e.variantKey??``)===String(n.variantKey??``));if(!a){p();return}let o=dh.resolveResourceUrl(i,a,f,t.allResourceFieldIdentifiers,n.parentResourcesRequirements)?.resolvedUrl;if(!o){p();return}m({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:n.resourceType,operation:a,contextResourceIdentifiers:f,parentResourcesRequirements:n.parentResourcesRequirements})},urlPath:o})}else if(e.compositeViewReference){let t=Object.keys(f).length>0?f:void 0;m({content:{contentType:sd.COMPOSITE_VIEW,viewRef:e.compositeViewReference,contextResourceIdentifiers:t},urlPath:kp(e.compositeViewReference,t)})}else!e.target||e.target===`/`?p():a?cg({emit:n,routerNavigate:t,path:e.target}):t(e.target,{replace:!0})}},[n,m,t,p,a,f,r]),g=(0,Q.useMemo)(()=>{if(!d)return;let e=d.guidanceKey??u?.customMessageReference,t=(t,n)=>{if(e&&s){let n=s.tErrorGuidance(e,t,d.params);if(n)return n}return n};return{explanation:t(`explanation`,d.explanation),resolution:t(`resolution`,d.resolution),completedSteps:d.completedSteps,retryAfterSeconds:d.retryAfterSeconds,nextAction:d.nextAction?{label:t(`nextActionLabel`,d.nextAction.label)??d.nextAction.label,onClick:()=>{if(d.nextAction.type===`url`)window.open(d.nextAction.ref,`_blank`,`noopener,noreferrer`);else{let e=d.nextAction.ref;if(!r){Zy.warn(`Cannot navigate to operation: resource registry not available`,{ref:e}),p();return}let{registry:t}=r,n=dh.resolveOperationRef(e,f,t);if(!n||n.contentType!==sd.RESOURCE_OPERATION){p();return}let{resourceContext:i}=n,a=t.resourceConfigurations[i.resourceType];if(!a){p();return}let o=dh.resolveResourceUrl(a,i.operation,f,t.allResourceFieldIdentifiers,i.parentResourcesRequirements);if(o?.resolvedUrl){m({content:n,urlPath:o.resolvedUrl});return}p()}}}:void 0}},[m,s,p,f,r,d,u]),_=Q.useCallback(()=>{if(a){let e=dh.resolveGoBackTarget({currentBrowserUrl:dh.buildBrowserUrl(window.location.pathname,window.location.search),getZoneState:a.getZoneState});if(e?.browserUrl){n(Ec.NAVIGATION_POP,{zone:e.zone}),t(e.browserUrl,{replace:!0});return}}window.history.length>1?t(-1):p()},[t,p,a]);return e?bh(e)?(0,$.jsx)(Xy,{errorType:`route`,routeError:{status:e.status,statusText:e.statusText,data:e.data},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):e instanceof Error?(0,$.jsx)(Xy,{errorType:`javascript`,jsError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Xy,{errorType:`generic`,unknownError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Xy,{errorType:`route`,routeError:{status:404,statusText:`Not Found`,data:{pathname:window.location.pathname}},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l})},Cce=4e3,$y=as.getLogger(),eb=$y.debugByType(`GlobalErrorHandler`);$y.setDebugTypeLogging(`GlobalErrorHandler`,!1);function wce(e){switch(e){case Jn.CRITICAL:case Jn.HIGH:return`error`;case Jn.MEDIUM:return`warning`;case Jn.LOW:return`info`;default:return`error`}}function tb({onError:e}){let{on:t}=Mo(),{handleWildoError:n}=rp(),{endSession:r,isAuthenticated:i,getEndedSessionReason:a}=hm(),{notifyError:o,notifyWarning:s,notifyInfo:c}=Fm(),{tErrorMessage:l,tErrorGuidance:u,isKeySettled:d}=K(),f=(0,Q.useRef)({tErrorMessage:l,tErrorGuidance:u});f.current={tErrorMessage:l,tErrorGuidance:u};let p=d(ai.ERRORS_MESSAGES),m=(0,Q.useRef)(p);m.current=p;let h=(0,Q.useRef)([]),g=(0,Q.useRef)(null),_=(0,Q.useCallback)(e=>{i()?(eb(`triggerLogout requested - logging out via AuthSession`),r(jre(e))):eb(`triggerLogout requested but not authenticated - skipping logout`)},[r,i]),v=(0,Q.useCallback)(e=>{let t=Oee[e.type],n=e.severity||t?.severity||Jn.MEDIUM,r=fp(e,{translators:f.current}),i=wce(n),a={errorType:e.type,severity:n,context:e.context};switch(i){case`error`:o(r,{data:a});break;case`warning`:s(r,{data:a});break;case`info`:c(r,{data:a})}eb(`Error notification displayed via NotificationContext`,{errorType:e.type,severity:n,notificationType:i,message:r})},[o,s,c]),y=(0,Q.useCallback)(()=>{g.current&&=(clearTimeout(g.current),null);let e=h.current;h.current=[];for(let t of e)v(t)},[v]),b=(0,Q.useCallback)(e=>{m.current?v(e):(h.current.push(e),g.current??=setTimeout(y,Cce))},[v,y]);(0,Q.useEffect)(()=>{p&&h.current.length>0&&y()},[p,y]),(0,Q.useEffect)(()=>()=>{g.current&&clearTimeout(g.current),g.current=null},[]);let x=(0,Q.useCallback)(t=>{let r=t.error;if(eb(`Received ERROR_OCCURED event`,{errorType:r.type,customMessageReference:r.customMessageReference,triggerLogout:r.triggerLogout}),lt.shouldSuppress(r)){eb(`Error suppressed (duplicate)`,{errorType:r.type,customMessageReference:r.customMessageReference});return}let i=r.triggerLogout===!0;if(i){eb(`triggerLogout=true - calling AuthSession logout handler`),_(r);let e=r.frontendActions||[];e.includes(Ml.DISCONNECT)&&(r={...r,frontendActions:e.filter(e=>e!==Ml.DISCONNECT)})}eb(`Error occurred`,{errorType:r.type,customMessageReference:r.customMessageReference});let o=r.suppressUserDisplay===!0,s=Tn(r),c=r.frontendActions||[],l=r;o||i&&a()!==null?l={...r,frontendActions:c.filter(e=>e!==Ml.NOTIFY&&e!==Ml.SHOW_TOAST&&e!==Ml.SHOW_MODAL)}:s&&(b(r),l={...r,frontendActions:c.filter(e=>e!==Ml.NOTIFY&&e!==Ml.SHOW_TOAST)}),e&&e(r),n(l)},[n,e,_,b,a]);return(0,Q.useEffect)(()=>{eb(`Subscribing to ERROR_OCCURED events`,{eventName:Ec.ERROR_OCCURED});let e=t(Ec.ERROR_OCCURED,x);return()=>{eb(`Unsubscribing from ERROR_OCCURED events`),e()}},[t,x]),null}var Tce=()=>{let e=(0,Q.useContext)($m);if(!e)throw Error(`useLoading must be used within a LoadingProvider`);return e};function nb(){let e=(0,Q.useContext)($m);if(!e)throw Error(`useAppLoading must be used within a LoadingProvider`);return{isAppLoading:e.isAppLoading,sources:e.appLoadingSources}}function rb(e,t){let n=(0,Q.useContext)($m);if(!n)throw Error(`useComponentLoading must be used within a LoadingProvider`);let r=rh(e),i=n.getComponentLoadingState(r)?.isLoading??!1,a=n.hasLoadedOnce(r,t?.refreshThresholdMs),o=n.markRendered,s=(0,Q.useCallback)(()=>{o(r)},[o,r]);return{isInitialLoad:i&&!a,isRefreshing:i&&a,isLoading:i,markRendered:s}}function Ece({size:e=24,className:t,...n}){return(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:t??`inline-flex items-center justify-center text-primary`,...n,children:(0,$.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,style:{animation:`spin 0.9s linear infinite`},children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeOpacity:`0.25`,strokeWidth:`3`,fill:`none`}),(0,$.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})})}function ib({preset:e=q.DEFAULT,...t}){let n=Fo.resolve(B.LOW_LEVEL_LOADING_SPINNER,e);return n?(0,$.jsx)(n,{...t}):(0,$.jsx)(Ece,{...t})}function ab({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LOADING_OVERLAY,`LoadingOverlay`)(e);return(0,$.jsx)(n,{...t})}function Dce(e){switch(e){case`overlay`:return{initialLoad:Ll.OPACITY_OVERLAY,refresh:Ll.OPACITY_OVERLAY};case`spinner-only`:return{initialLoad:Ll.SPINNER,refresh:Ll.SPINNER};case`skeleton-children`:return{initialLoad:Ll.SKELETON,refresh:Ll.OPACITY_OVERLAY};default:return}}var Oce=`contents [:where([class*='space-y-'])>&]:block`,ob=new Set([Ll.OPACITY_OVERLAY,Ll.HIDDEN,Ll.INVISIBLE]);function sb({loadingScopes:e,i18nKeys:t,readiness:n,policy:r,renderLoading:i,renderError:a,timeoutMs:o,children:s}){let c=(0,Q.useContext)($m);if(!c)throw Error(`LoadingGate must be used within a LoadingProvider`);let l=hc(),u=r??Dce(l.interactiveState?.loadingDisplay),d=(0,Q.useMemo)(()=>({keys:t??[]}),[t]),{requestKeys:f,isKeySettled:p,isReady:m}=K(d),h=(0,Q.useMemo)(()=>e?.length?e.map(e=>{let t=rh(e);return{scope:e,key:t,isLoading:c.getComponentLoadingState(t)?.isLoading??!1,hasLoadedOnce:c.hasLoadedOnce(t)}}):[],[e,c]),g=h.length===0||h.every(e=>!e.isLoading);(0,Q.useEffect)(()=>{t?.length&&f(t).catch(()=>void 0)},[t,f]);let _=!t?.length||t.every(e=>p(e)),v=!n?.length||n.every(e=>e.isReady),y=g&&_&&v,b=(0,Q.useMemo)(()=>h.some(e=>e.isLoading&&!e.hasLoadedOnce)?uu.INITIAL:h.some(e=>e.isLoading&&e.hasLoadedOnce)?uu.REFRESH:uu.INITIAL,[h]),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(y){C.current=null,S(!1);return}if(C.current||=Date.now(),!o)return;let e=o-(Date.now()-C.current);if(e<=0){S(!0);return}let t=setTimeout(()=>S(!0),e);return()=>clearTimeout(t)},[y,o]);let w=(0,Q.useRef)(!1);if((0,Q.useEffect)(()=>{if(y&&!w.current&&e?.length){w.current=!0;for(let t of e)c.markRendered(rh(t))}y||(w.current=!1)},[y,e,c]),x&&a){let e=h.filter(e=>e.isLoading).map(e=>e.scope);return(0,$.jsx)($.Fragment,{children:a({failedScopes:e,reason:`timeout`,retry:()=>{S(!1),C.current=Date.now()}})})}let T=u?.refresh??Ll.OPACITY_OVERLAY,E=u?.initialLoad??Ll.SKELETON,D=ob.has(T)||ob.has(E);if(y)return D?(0,$.jsx)(`div`,{className:Oce,"data-loading-gate":`ready`,children:s}):(0,$.jsx)($.Fragment,{children:s});let O=b===uu.REFRESH?T:E,k={phase:b,scope:h[0]?.scope??{customIdentifier:`loading-gate`}};switch(O){case Ll.CUSTOM:return(0,$.jsx)($.Fragment,{children:i?.(k)??s});case Ll.SKELETON:return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading`}),i?i(k):(0,$.jsx)(pm,{template:`auto`,density:`auto`,"aria-hidden":`true`})]});case Ll.SPINNER:return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(ib,{size:32})});case Ll.OPACITY_OVERLAY:return(0,$.jsxs)(`div`,{className:`relative`,"data-loading-gate":`loading`,children:[s,(0,$.jsx)(ab,{})]});case Ll.HIDDEN:return(0,$.jsx)(`div`,{style:{display:`none`},"data-loading-gate":`loading`,children:s});case Ll.INVISIBLE:return(0,$.jsx)(`div`,{style:{visibility:`hidden`},"data-loading-gate":`loading`,children:s});case Ll.FULL_SCREEN:return(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background/80`,children:(0,$.jsx)(ib,{size:48})});default:return(0,$.jsx)($.Fragment,{children:s})}}var cb;(function(e){e.PENDING=`pending`,e.READY=`ready`,e.ERROR=`error`})(cb||={});var lb=(0,Q.createContext)(null);function kce(){let e=(0,Q.useContext)(lb);if(!e)throw Error(`useBarrierParticipant must be used within a LoadingBarrier`);return e}function Ace({renderLoading:e,renderError:t,timeoutMs:n,children:r}){let i=(0,Q.useRef)(new Map),[,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(0),u=(0,Q.useRef)(Date.now()),d=(0,Q.useCallback)(e=>(i.current.has(e)||(i.current.set(e,{status:cb.PENDING}),a(e=>e+1)),{markReady:()=>{let t=i.current.get(e);t&&t.status!==cb.READY&&(i.current.set(e,{status:cb.READY}),a(e=>e+1))},markError:t=>{let n=i.current.get(e);n&&n.status!==cb.ERROR&&(i.current.set(e,{status:cb.ERROR,error:t}),a(e=>e+1))},unregister:()=>{i.current.has(e)&&(i.current.delete(e),a(e=>e+1))}}),[]),f=i.current,p=f.size>0&&Array.from(f.values()).every(e=>e.status===cb.READY),m=Array.from(f.values()).some(e=>e.status===cb.ERROR);(0,Q.useEffect)(()=>{if(p||!n)return;let e=n-(Date.now()-u.current);if(e<=0){s(!0);return}let t=setTimeout(()=>s(!0),e);return()=>clearTimeout(t)},[p,n]),(0,Q.useEffect)(()=>{p&&s(!1)},[p]);let h=(0,Q.useMemo)(()=>({register:d,retryCounter:c}),[d,c]);if((o||m)&&t){let e=Array.from(f.entries()).filter(([,e])=>e.status!==cb.READY),n=e.map(([e])=>({customIdentifier:e})),r=e.find(([,e])=>e.error)?.[1]?.error;return(0,$.jsx)(lb.Provider,{value:h,children:t({failedScopes:n,reason:m?`error`:`timeout`,error:r,retry:()=>{s(!1),u.current=Date.now();for(let[e]of f)f.set(e,{status:cb.PENDING});l(e=>e+1),a(e=>e+1)}})})}let g=!p;return(0,$.jsx)(lb.Provider,{value:h,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{style:{opacity:+!g,pointerEvents:g?`none`:`auto`,transition:`opacity 200ms ease-out`},"aria-hidden":g,children:r}),g&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:e?e():(0,$.jsx)(ib,{size:32})})]})})}var ub={[et.RESOURCES_LAYOUTS]:{initialLoad:Ll.SKELETON,refresh:Ll.OPACITY_OVERLAY},[et.RESOURCES_FIELDS]:{initialLoad:Ll.SKELETON,refresh:Ll.OPACITY_OVERLAY},[et.HIGH_LEVEL_VIEWS]:{initialLoad:Ll.SKELETON,refresh:Ll.OPACITY_OVERLAY},[et.APPLICATION_LEVEL_COMPONENTS]:{initialLoad:Ll.SKELETON,refresh:Ll.HIDDEN},[et.PUBLIC_LAYOUTS]:{initialLoad:Ll.SPINNER,refresh:Ll.SPINNER}};function jce(e,t){let n=ub[e]??{};return{initialLoad:t?.initialLoad??n.initialLoad??Ll.SKELETON,refresh:t?.refresh??n.refresh??Ll.OPACITY_OVERLAY,customRenderer:t?.customRenderer??n.customRenderer,disableInteraction:t?.disableInteraction??n.disableInteraction,skeletonSchema:t?.skeletonSchema??n.skeletonSchema}}var db=as.getLogger(),Mce=db.debugByType(`AppLoadingGate`);db.setDebugTypeLogging(`AppLoadingGate`,!1);function fb({renderLoading:e,children:t}){let{isAppLoading:n,sources:r}=nb(),i=(0,Q.useRef)(!1),[a,o]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{n?i.current=!0:i.current&&o(!0)},[n]),(0,Q.useEffect)(()=>{Mce(`Gate render state: ${n?`loading`:`ready`} [${r.map(e=>e.identifier).join(`, `)||`none`}]`)},[n,r]),(0,$.jsxs)($.Fragment,{children:[t,n&&(e?e(r):a?(0,$.jsx)(`div`,{className:`fixed top-4 end-4 z-(--z-critical) pointer-events-none flex items-center justify-center rounded-full bg-background/80 p-2 shadow-md`,role:`status`,"aria-live":`polite`,"data-app-loading-indicator":`non-blocking`,children:(0,$.jsx)(ib,{size:20})}):(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background`,role:`status`,"aria-live":`polite`,children:(0,$.jsx)(ib,{size:48})}))]})}function pb(e){return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))}function mb(e){let t=e.displayNameLabelKey??vd(e.providerRef),n=e.translate?.(t);return n&&n!==t?n:e.displayName??e.fallbackLabel??e.providerRef}function hb(...e){let t=B_(`FrontendApp`,e);return wae(`FrontendApp`,t.modules.values()),t}var gb=`@wildo-ai/external-connectors-public`,Nce={metadata:md({ref:`dropbox`,packageName:gb,tier:jd.MAIN,origin:fd}),providerCapabilities:[Dd.FRONTEND_FILE_PICKER],protocols:[cl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:P_({appKey:{kind:N_.STRING,description:`Dropbox app key the Chooser is registered under; public by design.`}}),scripts:[{src:`https://www.dropbox.com/static/api/2/dropins.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://www.dropbox.com`],frameOrigins:[`https://www.dropbox.com`],connectOrigins:[`https://dl.dropboxusercontent.com`]},components:{[Dd.FRONTEND_FILE_PICKER]:{selectionDelivery:dd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[xd.VENDOR_HOSTED],processingRegions:[`United States`,`Australia`,`European Union`,`Japan`,`United Kingdom`],processingRegionReach:Object.fromEntries([`United States`,`Australia`,`European Union`,`Japan`,`United Kingdom`].map(e=>[e,{kind:Sd.ACCOUNT_RESIDENCY}])),vendorLegalEntityName:`Dropbox, Inc.`,evidence:[{facts:[ud.PROCESSING_REGIONS,ud.PROCESSING_REGION_REACH],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-10`}]}},Pce={metadata:md({ref:`google-drive`,packageName:gb,tier:jd.MAIN,origin:fd}),providerCapabilities:[Dd.FRONTEND_FILE_PICKER],protocols:[cl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:P_({appId:{kind:N_.STRING,description:`Google Cloud project NUMBER the Drive Picker is registered under.`},developerKey:{kind:N_.STRING,description:`Optional API key for the Picker; public by design.`}}),scripts:[{src:`https://apis.google.com/js/api.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://apis.google.com`],frameOrigins:[`https://docs.google.com`],connectOrigins:[`https://content.googleapis.com`]},components:{[Dd.FRONTEND_FILE_PICKER]:{selectionDelivery:dd.REMOTE_REFERENCE}},fileStorage:Aae.GOOGLE_DRIVE,complianceProfile:{deploymentModels:[xd.VENDOR_HOSTED],processingRegions:[`United States`,`European Union`,`No preference`,`Servers around the world (personal Google account)`],processingRegionReach:Object.fromEntries([`United States`,`European Union`,`No preference`,`Servers around the world (personal Google account)`].map(e=>[e,{kind:Sd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[ud.DEPLOYMENT_MODELS,ud.PROCESSING_REGIONS],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-06`},{facts:[ud.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`},{facts:[ud.PROCESSING_REGION_REACH],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-10`}]}},Fce=`Google Maps`,Ice=[Nce,Pce,{metadata:md({ref:`google-places`,packageName:gb,tier:jd.MAIN,origin:fd}),providerCapabilities:[Dd.FRONTEND_ADDRESS_LOOKUP],protocols:[],publicConfig:{},publicConfigSchema:P_({}),components:{[Dd.FRONTEND_ADDRESS_LOOKUP]:{placeIdRetention:yd.NONE,addressLookup:{suggestOperationId:`address_suggest`,retrieveOperationId:`address_retrieve`,sessionTokenInput:`sessionToken`,attributionMark:Fce}}},complianceProfile:{deploymentModels:[xd.VENDOR_HOSTED],processingRegions:[`Servers around the world`],evidence:[{facts:[ud.DEPLOYMENT_MODELS,ud.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`}]}},{metadata:md({ref:`microsoft-onedrive`,packageName:gb,tier:jd.MAIN,origin:fd}),providerCapabilities:[Dd.FRONTEND_FILE_PICKER],protocols:[cl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:P_({clientId:{kind:N_.STRING,description:`Azure application (client) id the OneDrive picker is registered under.`},pickerRedirectUri:{kind:N_.STRING,description:`Optional redirect URI for the picker popup.`}}),scripts:[{src:`https://js.live.net/v7.2/OneDrive.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://js.live.net`],frameOrigins:[`https://onedrive.live.com`]},components:{[Dd.FRONTEND_FILE_PICKER]:{selectionDelivery:dd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[xd.VENDOR_HOSTED],processingRegions:`European Union.United States.Australia.Austria.Brazil.Canada.Chile.Denmark.France.Germany.India.Indonesia.Israel.Italy.Japan.Malaysia.Mexico.New Zealand.Norway.Poland.Qatar.South Africa.South Korea.Spain.Sweden.Switzerland.Taiwan.United Arab Emirates.United Kingdom.Your region or the United States (personal Microsoft account)`.split(`.`),processingRegionReach:Object.fromEntries(`European Union.United States.Australia.Austria.Brazil.Canada.Chile.Denmark.France.Germany.India.Indonesia.Israel.Italy.Japan.Malaysia.Mexico.New Zealand.Norway.Poland.Qatar.South Africa.South Korea.Spain.Sweden.Switzerland.Taiwan.United Arab Emirates.United Kingdom.Your region or the United States (personal Microsoft account)`.split(`.`).map(e=>[e,{kind:Sd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[ud.DEPLOYMENT_MODELS,ud.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-06`},{facts:[ud.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/o365-data-locations`,verifiedAt:`2026-11-06`},{facts:[ud.PROCESSING_REGIONS],source:`https://www.microsoft.com/en-us/privacy/privacystatement`,verifiedAt:`2026-11-06`},{facts:[ud.PROCESSING_REGION_REACH],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-10`}]}}];hb({modules:new Map(Ice.map(e=>[e.metadata.ref,e]))});var _b=function(e){return e.AT_SURFACE_START=`at_surface_start`,e.ON_DEMAND=`on_demand`,e}({});function vb(e){return{selectionDelivery:e.selectionDelivery,...e.placeIdRetention===void 0?{}:{placeIdRetention:e.placeIdRetention},...e.addressLookup===void 0?{}:{addressLookup:{suggestOperationId:e.addressLookup.suggestOperationId,retrieveOperationId:e.addressLookup.retrieveOperationId,...e.addressLookup.sessionTokenInput===void 0?{}:{sessionTokenInput:e.addressLookup.sessionTokenInput},...e.addressLookup.attributionMark===void 0?{}:{attributionMark:e.addressLookup.attributionMark}}}}}var yb=Object.freeze({browserHosted:!1}),bb=Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([])}),xb=Object.freeze({FRONTEND_PRODUCT_ANALYTICS:Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([Ld.ANALYTICS])}),FRONTEND_ERROR_MONITORING:bb,FRONTEND_CAPTCHA:bb,FRONTEND_SEARCH:bb,FRONTEND_FILE_PICKER:bb,FRONTEND_ADDRESS_LOOKUP:bb,FRONTEND_CHAT_SIGN_IN_COMPLETION:bb,SSO_OAUTH2:bb,BILLING:yb,EMAIL_TRANSACTIONAL:yb,EMAIL_MARKETING:yb,EMAIL_INBOUND:yb,SMS:yb,ELECTRONIC_SIGNATURE:yb,SSO_SAML:yb,LLM_CHAT:yb,LLM_EMBEDDINGS:yb,DOCUMENT_TEXT_EXTRACTION:yb,PROMPT_INJECTION_SCREENING:yb,OUTPUT_MODERATION:yb,CODING_AGENT:yb,IMAGE_GENERATION:yb,LLM_OBSERVABILITY:yb,OBSERVABILITY_TELEMETRY:yb,COMPLIANCE_AUDIT_TRAIL:yb,KEY_MANAGEMENT:yb});function Sb(e){return Object.prototype.hasOwnProperty.call(xb,e)?xb[e]:void 0}function Cb(e){return(e.providerCapabilities??[]).filter(e=>Sb(e)?.browserHosted!==!0)}function wb(e){let t=new Set(Sae);return(e.consentPurposes??[]).filter(e=>!t.has(e))}function Tb(e){let t=[...e.consentPurposes??[]];for(let n of e.providerCapabilities??[]){let e=Sb(n);e?.browserHosted===!0&&t.push(...e.consentPurposes)}return Nd(t)}function Eb(e,t){return Cb(e).length>0||wb(e).length>0?!1:Td(t,Tb(e)).length===0}function Db(e,t){return Td(t,Tb(e))}function Ob(e,t,n){let r=Cb(t);if(r.length>0)return`Provider "${e}" declares ${r.join(`, `)}, which no browser surface may host, so it never starts. Remove the capability from its frontend module.`;let i=wb(t);return i.length>0?`Provider "${e}" declares consent purposes ${i.join(`, `)}, which are not consent purposes, so it never starts. Declare members of ConsentPurpose.`:`Provider "${e}" rests on consent to ${Db(t,n).join(`, `)}, which has not been granted on this surface.`}function kb(e,t){let n=Tb(t);if(n.length!==0){if((t.scripts?.length??0)>0)return`Provider "${e}" rests on consent to ${n.join(`, `)} and declares <script> tags, which cannot be stopped when that consent is withdrawn. Load the script from inside its sdk.activate and return a deactivate instead (#1704).`;if(t.sdk!==void 0&&t.sdk.stoppable!==!0)return`Provider "${e}" rests on consent to ${n.join(`, `)} and its SDK does not declare stoppable: true, so a withdrawal could not stop it. Return a deactivate from sdk.activate that fully stops the vendor, and declare stoppable: true (#1704).`}}function Ab(e){let t=e=>typeof e!=`object`||!e||Array.isArray(e)?e:Object.fromEntries(Object.keys(e).sort().map(n=>[n,t(e[n])]));return JSON.stringify(t(e))}function jb(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])}function Lce(e,t){if(e===void 0||t===void 0)return e===t;let n=_ae(t);return jae.every(t=>jb(e[t]??[],n[t]))}function Rce(e){return e.issues!==void 0}function zce(e,t,n,r,i){let a=xae({providerCapabilities:r,publicConfig:t});if(a.issues.length>0){i({kind:`PUBLIC_CONFIG_INVALID`,providerRef:e,message:`Provider "${e}" was served a publicConfig its own schema rejects, so none of its code will run. `+a.issues.map(e=>`${e.path.map(String).join(`.`)||`(root)`}: ${e.message}`).join(`; `)});return}let o=n[`~standard`].validate(a.providerConfig);if(o instanceof Promise)i({kind:`PUBLIC_CONFIG_SCHEMA_ASYNC`,providerRef:e,message:`Provider "${e}" declares an asynchronous publicConfigSchema. Frontend provider hydration is synchronous, so the schema cannot be awaited; declare a synchronous validator (a Zod schema is one).`});else if(Rce(o))i({kind:`PUBLIC_CONFIG_INVALID`,providerRef:e,message:`Provider "${e}" was served a publicConfig its own schema rejects, so none of its code will run. ${o.issues.map(e=>{let t=(e.path??[]).map(e=>String(typeof e==`object`?e.key:e)).join(`.`);return t.length>0?`${t}: ${e.message}`:e.message}).join(`; `)}`});else return{...a.capabilityConfig,...o.value}}function Bce(e){let t=t=>{e.onDiagnostic?.(t)},n=e.modules??{},r=new Map,i=Object.keys(e.entries?.providers??{}),a=Object.keys(n);i.length===0&&a.length>0&&t({kind:`DATA_MISSING_FOR_BUNDLED_PROVIDERS`,providerRef:``,message:`This bundle carries code for ${a.length} provider(s) — ${a.join(`, `)} — and the backend declared none for this service, so every provider-backed surface will render as though none exists. Usually a backend older than this bundle, or a frontend service whose provider scope was never authored; \`wildo config sync\` settles the second.`});for(let[i,a]of Object.entries(e.entries?.providers??{})){let e=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0,o=e;if(o!==void 0&&o.metadata.ref!==i&&(t({kind:`GENERATED_MODULE_REF_MISMATCH`,providerRef:i,message:`The generated frontend provider module map lists "${i}" but the module it points at declares ref "${o.metadata.ref}". Its code is ignored rather than bound to another provider's configuration; regenerate with \`wildo config sync\`.`}),o=void 0),o!==void 0&&!Lce(a.csp,o.csp)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares a CSP footprint that differs from the one its served entry carries, so the service's Content-Security-Policy was composed from a stale footprint. That surfaces in production only, because CSP is report-only in development. Regenerate with \`wildo config sync\`.`}),o!==void 0&&Rd(a.sdk)!==Rd(o.sdk?.descriptor)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares ${Rd(o.sdk?.descriptor)} but its served entry says ${Rd(a.sdk)}. Regenerate with \`wildo config sync\`.`}),o!==void 0){for(let[e,n]of Object.entries(o.components??{})){let r=Ab(vb(n)),o=a.components?.[e],s=o===void 0?void 0:Ab(vb(o));s!==r&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares its "${e}" component as ${r} but its served entry says ${s??`(none)`}. The framework enforces the CODE side, so the manifest a reviewer reads and the contract actually held would disagree. Regenerate with \`wildo config sync\`.`})}o.fileStorage!==a.fileStorage&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares its file picker fronts the "${o.fileStorage??`(none)`}" storage but its served entry says "${a.fileStorage??`(none)`}". Regenerate with \`wildo config sync\`.`})}let s=[...new Set(a.consentPurposes??[])],c=[...new Set(o?.consentPurposes??[])];o!==void 0&&!jb(s,c)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares consent purposes [${c.join(`, `)}] but its served entry says [${s.join(`, `)}]. It is held to both until the artifact is regenerated with \`wildo config sync\`.`});let l=[...new Set([...s,...c])],u=a.publicConfig??{};o!==void 0&&F_(o.publicConfigSchema)===void 0&&(t({kind:`PUBLIC_CONFIG_SCHEMA_MISSING`,providerRef:i,message:`Provider "${i}" declares no publicConfigSchema whose keys can be read, so nothing holds what it is served to a key list and none of its code will run. Declare one with \`defineFrontendPublicConfigSchema\` (#1705).`}),o=void 0);let d=a.scripts,f=kb(i,{providerCapabilities:a.providerCapabilities,consentPurposes:l,scripts:a.scripts,sdk:o?.sdk});if(f!==void 0&&(t({kind:`CONSENT_BASED_PROVIDER_NOT_STOPPABLE`,providerRef:i,message:`${f} Its code and scripts are withheld on this surface.`}),o=void 0,d=void 0),o!==void 0||d!==void 0){let e=L_([...new Set([...I_(o?.publicConfigSchema),...a.requiredPublicConfigKeys??[]])],u);e.length>0&&(t({kind:`PUBLIC_CONFIG_NOT_SUPPLIED`,providerRef:i,message:R_({providerRef:i,missingKeys:e})}),o=void 0,d=void 0)}if(o?.publicConfigSchema!==void 0){let e=zce(i,u,o.publicConfigSchema,a.providerCapabilities,t);e===void 0?o=void 0:u=e}o===void 0&&e===void 0&&t({kind:`CODE_MISSING_FOR_DECLARED_PROVIDER`,providerRef:i,message:`Frontend provider "${i}" is declared for this service but the bundle carries no code for it, so its SDK and components are unavailable. Run \`wildo config sync\` to regenerate frontend-providers.generated.ts.`}),r.set(i,{metadata:a.metadata,providerCapabilities:[...a.providerCapabilities],protocols:[...a.protocols],publicConfig:u,csp:a.csp,scripts:d,sdk:o?.sdk,components:o?.components,publicConfigSchema:o?.publicConfigSchema,...l.length>0?{consentPurposes:l}:{}})}return r}function Vce(e){let t=Bce(e);return hb({modules:new Map([...t].map(([e,t])=>[e,{...t,providerCapabilities:t.providerCapabilities,protocols:t.protocols,consentPurposes:t.consentPurposes}]))})}var Mb=function(e){return e.SERVES=`serves`,e.DOES_NOT_SERVE=`does_not_serve`,e.NO_PREDICATE=`no_predicate`,e.PREDICATE_FAILED=`predicate_failed`,e}({});function Nb(e,t){let n=e.sdk;if(n?.activation!==_b.ON_DEMAND||!(e.providerCapabilities??[]).includes(t.capability))return{verdict:`does_not_serve`};if(n.servesOnDemandContext===void 0)return{verdict:`no_predicate`};try{return{verdict:n.servesOnDemandContext(t)===!0?`serves`:`does_not_serve`}}catch(e){return{verdict:`predicate_failed`,cause:e}}}function Pb(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function Hce(){return typeof globalThis<`u`&&globalThis.window!==void 0}async function Fb(e){let t=t=>{e.onDiagnostic?.(t)},n=new Map,r=e.isBrowser??Hce;for(let i of e.modules){let a=i.sdk;if(a===void 0)continue;let o=i.metadata.ref,s=(a.activation??_b.AT_SURFACE_START)===_b.ON_DEMAND;if(e.onDemand===void 0){if(s)continue}else{let{verdict:n,cause:r}=Nb(i,e.onDemand);if(n===Mb.NO_PREDICATE?t({kind:`ON_DEMAND_WITHOUT_PREDICATE`,providerRef:o,message:`Provider "${o}" declares an on-demand SDK for ${e.onDemand.capability} with no servesOnDemandContext, so it cannot say it serves this call and its SDK was not loaded. Declare the predicate (#2790).`}):n===Mb.PREDICATE_FAILED&&t({kind:`ON_DEMAND_PREDICATE_FAILED`,providerRef:o,message:`Provider "${o}"'s servesOnDemandContext threw: ${Pb(mo(r))} Its SDK was not loaded.`,cause:r}),n!==Mb.SERVES)continue}if(!Eb(i,e.grantedConsentPurposes??[])){t({kind:`WITHHELD_PENDING_CONSENT`,providerRef:o,message:`${Ob(o,i,e.grantedConsentPurposes??[])} Its SDK was not loaded.`});continue}let c=kb(o,i);if(c!==void 0)t({kind:`WITHHELD_NOT_STOPPABLE`,providerRef:o,message:`${c} Its SDK was not loaded.`});else if(!r())t({kind:`SKIPPED_OFF_BROWSER`,providerRef:o,message:`Provider "${o}" declares ${Rd(a.descriptor)} but activation was requested outside a browser, so nothing was loaded. Activate again on the client.`});else try{let r=await a.activate({providerRef:o,surface:e.surface,publicConfig:i.publicConfig??{}});n.set(o,r),Tb(i).length>0&&r.deactivate===void 0&&t({kind:`STOP_PROMISE_BROKEN`,providerRef:o,message:`Provider "${o}" declares a stoppable SDK but its activation returned no deactivate, so a withdrawal of the consent it rests on will not stop it. Return a deactivate from sdk.activate (#1704).`})}catch(e){t({kind:`ACTIVATION_FAILED`,providerRef:o,message:`Provider "${o}" did not activate (it loads ${Rd(a.descriptor)}): ${Pb(mo(e))} Its capability is unavailable on this surface; every other provider was still activated.`,cause:e})}}return{activations:n,async deactivateAll(){for(let[e,r]of n)if(r.deactivate!==void 0)try{await r.deactivate()}catch(n){t({kind:`DEACTIVATION_FAILED`,providerRef:e,message:`Provider "${e}" failed to deactivate its SDK; it may still be running.`,cause:n})}n.clear()}}}function Uce(){let e=Promise.resolve();return{start(t,n){let r=!1,i=e.then(()=>r?void 0:t()).catch(()=>void 0).then(e=>{if(e!==void 0&&!r)try{n?.(e)}catch{}return e});return()=>{r=!0,e=i.then(e=>e?.deactivateAll()).catch(()=>void 0)}}}}var Ib=`data-wildo-provider-script`,Lb=`data-wildo-provider-script-state`;function Wce(e){if(e===void 0)return[];let t=[];for(let n of e)if(!(Tb(n).length>0)&&Eb(n,[]))for(let e of n.scripts??[])t.push({providerRef:n.metadata.ref,declaration:e});return t}function Gce(e,t){return[...e.querySelectorAll(`script[${Ib}]`)].find(e=>e.getAttribute(`src`)===t)}function Kce(e,t){let{providerRef:n,declaration:r}=t,i=e.createElement(`script`);return i.src=r.src,i.setAttribute(Ib,n),i.setAttribute(Lb,`loading`),i.addEventListener(`load`,()=>i.setAttribute(Lb,`loaded`),{once:!0}),i.addEventListener(`error`,()=>i.setAttribute(Lb,`failed`),{once:!0}),r.integrity!==void 0&&(i.integrity=r.integrity),r.crossOrigin!==void 0&&(i.crossOrigin=r.crossOrigin),i.async=r.async??r.defer!==!0,i.defer=r.defer??!1,e.head.appendChild(i),i}function qce(e){return{providerRef:e.providerRef,src:e.declaration.src,message:`Provider "${e.providerRef}" declares the script "${e.declaration.src}" and it failed to load (network failure, a Content-Security-Policy refusal, or an integrity mismatch). Whatever it installs is not present on this surface.`}}function Jce(e){let t=e.getAttribute(Lb);return t===`failed`?Promise.resolve(`failed`):t===`loading`?new Promise(t=>{let n=()=>{e.removeEventListener(`error`,r),t(`loaded`)},r=()=>{e.removeEventListener(`load`,n),t(`failed`)};e.addEventListener(`load`,n,{once:!0}),e.addEventListener(`error`,r,{once:!0})}):Promise.resolve(`loaded`)}async function Rb(e,t){let n=await Promise.all(e.map(async e=>({script:e,state:await Jce(Gce(t,e.declaration.src)??Kce(t,e))})));return{loaded:n.filter(e=>e.state===`loaded`).map(e=>e.script),failed:n.filter(e=>e.state===`failed`).map(e=>qce(e.script))}}function Yce(){return typeof document<`u`}var Xce=e=>Rb(e,document);function Zce(e){return typeof e==`object`&&!!e&&e[Symbol.toStringTag]===`Module`}function Qce(e){return typeof e==`function`||typeof e==`object`&&!!e}function $ce(e){let t=t=>{e?.onDiagnostic?.(t)},n=new Map,r=new Map,i=e?.loadScripts??Xce,a=e?.hasBrowserDocument??Yce,o=new Map,s=new Map,c=new Map,l=new Map,u=(e,t)=>`${e}:${t}`;for(let i of e?.registrations??[]){let e=u(i.capability,i.providerRef);if(n.has(e)){t({kind:`DUPLICATE_REGISTRATION`,capability:i.capability,providerRef:i.providerRef,message:`Provider "${i.providerRef}" registered a component for "${i.capability}" more than once. The first registration is kept.`});continue}let a=kb(i.providerRef,{...i.consent,...i.scripts===void 0?{}:{scripts:i.scripts}});if(a!==void 0){t({kind:`CONSENT_BASED_PROVIDER_NOT_STOPPABLE`,capability:i.capability,providerRef:i.providerRef,message:`${a} Its "${i.capability}" component is not offered.`});continue}n.set(e,i.load),i.scripts!==void 0&&i.scripts.length>0&&r.set(e,i.scripts),o.set(e,i.descriptor),s.set(e,i.consent);let l=c.get(i.capability)??[];l.push(i.providerRef),c.set(i.capability,l)}return{listProviders(e){return c.get(e)??[]},has(e,t){return n.has(u(e,t))},providersWithComponents(){return new Set([...c.values()].flat())},describe(e,t){return o.get(u(e,t))},consentRequirement(e,t,n){let r=s.get(u(e,t));if(r===void 0)return;let i=Eb(r,n);return{permitted:i,missingPurposes:i?[]:Db(r,n)}},resolve(e,o,c=[]){let d=u(e,o),f=n.get(d);if(f===void 0)return Promise.resolve(null);if(!a())return t({kind:`NOT_IN_A_BROWSER`,capability:e,providerRef:o,message:`Provider "${o}"'s "${e}" component was requested where there is no browser document (a server render or a build-time prerender). Nothing was loaded; resolve it from an effect.`}),Promise.resolve(null);let p=s.get(d)??{};if(!Eb(p,c))return t({kind:`WITHHELD_PENDING_CONSENT`,capability:e,providerRef:o,message:`${Ob(o,p,c)} Its "${e}" component and scripts were not loaded.`}),Promise.resolve(null);let m=l.get(d);if(m!==void 0)return m;let h=r.get(d)??[],g=(async()=>{let n=h.map(e=>({providerRef:o,declaration:e})),[r,a]=await Promise.all([Promise.resolve().then(f).then(e=>({ok:!0,value:e}),e=>({ok:!1,cause:e})),n.length===0?Promise.resolve(void 0):Promise.resolve().then(()=>i(n)).catch(e=>({loaded:[],failed:n.map(({declaration:t})=>({providerRef:o,src:t.src,message:`The script loader failed before reporting an outcome: ${Lre(e)}`}))}))]);for(let n of a?.failed??[])t({kind:`SCRIPT_LOAD_FAILED`,capability:e,providerRef:o,message:`Provider "${o}" cannot offer its "${e}" component: a script it declares did not load. `+n.message});if(r.ok===!1)return t({kind:`LOAD_FAILED`,capability:e,providerRef:o,message:`Provider "${o}" failed to load its "${e}" component.`,cause:r.cause}),null;if((a?.failed.length??0)>0)return null;let s=r.value;return Zce(s)?(t({kind:`LOADED_VALUE_IS_NOT_A_COMPONENT`,capability:e,providerRef:o,message:`Provider "${o}" returned a MODULE for its "${e}" component instead of the component itself. Return the named export from the loader — \`async () => (await import(…)).Picker\` — rather than the module namespace \`() => import(…)\`.`}),null):Qce(s)?s:(t({kind:`LOADED_VALUE_IS_NOT_A_COMPONENT`,capability:e,providerRef:o,message:`Provider "${o}" returned a ${typeof s} for its "${e}" component. A React component is a function, or an object for memo / forwardRef / lazy.`}),null)})();return l.set(d,g),g}}}function zb(e,t){return`${e}:${t}`}function ele(e){let t=new Map;for(let n of e??[])t.set(zb(n.capability,n.providerRef),n);return t}function tle(e,t){let n=[],r=t?.contributedLoaders??new Map;for(let i of e)for(let[e,a]of Object.entries(i.components??{})){let o=i.metadata.ref,s=r.get(zb(e,o));a.load!==void 0&&s!==void 0&&t?.onDiagnostic?.({kind:`LOADER_SUPPLIED_TWICE`,capability:e,providerRef:o,message:`Provider "${o}" carries its own loader for "${e}" AND the facet library contributed one. The module's is used; remove one of the two.`});let c=a.load??s?.load;c===void 0?t?.onDiagnostic?.({kind:`DECLARED_WITHOUT_LOADER`,capability:e,providerRef:o,message:`Provider "${o}" declares a "${e}" component and nothing supplies its loader — neither the module nor the facet library. It is not offered. An engine-shipped component is registered by the surface's facet library (presets-components for the application, the page bridge's \`providerComponentLoaders\` for the website, \`DocsFrontendProviders\`' \`providerComponentLoaders\` for the documentation site); a provider package supplies \`components[capability].load\`.`}):n.push({capability:e,providerRef:o,load:c,descriptor:vb(a),consent:{providerCapabilities:[...i.providerCapabilities??[]],...i.consentPurposes===void 0?{}:{consentPurposes:[...i.consentPurposes]}},...i.scripts!==void 0&&i.scripts.length>0?{scripts:i.scripts}:{}})}return n}function nle(e,t){let n=new Set;for(let e of t)n.add(e.providerRef);return Wce([...e].filter(e=>!n.has(e.metadata.ref)))}var Bb=function(e){return e.NONE=`NONE`,e.LOADING=`LOADING`,e.READY=`READY`,e.UNAVAILABLE=`UNAVAILABLE`,e.CONSENT_REQUIRED=`CONSENT_REQUIRED`,e}({}),Vb=Object.freeze([]);function Hb(){return{status:`NONE`,Component:null,missingConsentPurposes:Vb}}function rle(e){let{registry:t,capability:n,providerRef:r,grantedConsentPurposes:i,onState:a}=e;if(t===void 0||r===void 0||!t.has(n,r))return a(Hb()),()=>void 0;let o=t.consentRequirement(n,r,i);if(o!==void 0&&!o.permitted&&o.missingPurposes.length>0)return a({status:`CONSENT_REQUIRED`,Component:null,missingConsentPurposes:o.missingPurposes}),()=>void 0;let s=!0;return a({status:`LOADING`,Component:null,missingConsentPurposes:Vb}),t.resolve(n,r,i).then(e=>{s&&a(e===null?{status:`UNAVAILABLE`,Component:null,missingConsentPurposes:Vb}:{status:`READY`,Component:e,missingConsentPurposes:Vb})}),()=>{s=!1}}var Ub=class{registry=hb({modules:new Map});initialize(e){this.registry=Vce({entries:e?.entries,modules:e?.modules,onDiagnostic:e?.onDiagnostic})}getProviderByRef(e){return this.registry.getProviderByRef(e)}listByProviderCapability(e){return this.registry.getProvidersByProviderCapability(e)}findByProviderCapability(e){return this.registry.findProviderByProviderCapability(e)}findByProviderCapabilityAndProtocol(e,t){return this.registry.getProvidersByProviderCapability(e).find(e=>e.protocols.some(e=>e===t))}listAll(){return[...this.registry.modules.values()]}activateOnDemand(e,t){return Fb({surface:Zo.SAAS_APP,modules:this.registry.getProvidersByProviderCapability(e.capability),onDemand:e,onDiagnostic:t})}providersServingOnDemand(e){return this.registry.getProvidersByProviderCapability(e.capability).filter(t=>Nb(t,e).verdict===Mb.SERVES).map(e=>e.metadata.ref)}};function Wb(e){let t=new Ub;return t.initialize(e),t}var Gb=as.getLogger(),Kb;(function(e){e.SUCCEEDED=`succeeded`,e.FAILED=`failed`})(Kb||={});function qb(e,t){let n=0;for(let[r,i]of e.activations)if(!Ise(i.handle))Gb.warn(`A chat sign-in completion provider returned a handle that is not a FrontendChatSignInCompletionSink`,{providerRef:r});else try{t===Kb.SUCCEEDED?i.handle.signInSucceeded():i.handle.signInFailed(),n+=1}catch(e){Gb.warn(`A chat sign-in completion provider failed to tell its host`,{providerRef:r,error:e})}return n}function Jb(e){let t=(0,Q.useContext)(Fi)?.frontendProviderRegistry,n=(0,Q.useMemo)(()=>e===void 0?void 0:{capability:Dd.FRONTEND_CHAT_SIGN_IN_COMPLETION,host:e},[e]),r=(0,Q.useMemo)(()=>n!==void 0&&t!==void 0&&t.providersServingOnDemand(n).length>0,[n,t]),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useCallback)(async(e,o)=>{if(n===void 0||t===void 0||!r||i.current===Kb.SUCCEEDED&&e===Kb.FAILED||i.current===e&&o?.repeat!==!0)return 0;i.current=e,a.current??=t.activateOnDemand(n,e=>Gb.warn(`Chat sign-in completion provider diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message}));try{let t=qb(await a.current,e);return t===0&&(a.current=null),t}catch(e){return Gb.warn(`Chat sign-in completion could not be called`,{error:e}),a.current=null,0}},[n,t,r]);return(0,Q.useMemo)(()=>({hostServed:r,tell:o}),[r,o])}var Yb=new Map;function Xb(e){Yb=ele([...Yb.values(),...e])}function Zb(){return Yb}function ile(){Yb=new Map}var Qb;(function(e){e.NOT_APPLICABLE=`notApplicable`,e.REQUIRED=`required`,e.PROMPT=`prompt`,e.SATISFIED=`satisfied`})(Qb||={});function $b(e){let t=Nd(e.serviceConsentRequirement?.requiredPurposes),n=Nd(e.privacy?.consentedPurposes),r=Td(n,t),i=Oae({requiredPurposes:t,analyticsEnabled:e.analyticsEnabled,analyticsRequiresConsent:e.analyticsRequiresConsent,capabilityDeclaredPurposes:e.capabilityDeclaredConsentPurposes}).filter(e=>!t.includes(e)),a={requiredPurposes:t,missingRequiredPurposes:r,optionalPurposes:i,grantedPurposes:n,gatedProcessing:t.length>0?e.serviceConsentRequirement?.gatedProcessing:void 0};return r.length>0?{...a,status:Qb.REQUIRED}:e.privacy===null||e.privacy===void 0||t.length===0&&i.length===0?{...a,status:Qb.NOT_APPLICABLE}:i.length>0&&e.privacy?.consentDecidedAt===void 0?{...a,status:Qb.PROMPT}:{...a,status:Qb.SATISFIED}}function ex(e,t,n){let r=e.filter(e=>!t.includes(e)),i=t.filter(e=>n.includes(e));return Nd([...r,...i])}function tx(e,t,n){let r=ex(e.grantedPurposes,t,n);return Td(r,e.requiredPurposes)}function nx(){let e=(0,Q.useContext)(ah),t=e?.privacy?.consentedPurposes,n=(0,Q.useMemo)(()=>Nd(t),[t]),r=e?.recordConsentDecision,i=e?.user!==null&&e?.user!==void 0&&r!==void 0,a=(0,Q.useCallback)(async e=>{r!==void 0&&await r(ex(n,e,e))},[n,r]);return{granted:n,grant:i?a:void 0}}function rx(e){let{frontendProviderRegistry:t,providerComponentRegistry:n}=Ou();return n===void 0?[]:n.listProviders(e).map(e=>{let n=t?.getProviderByRef(e);return{providerRef:e,displayNameLabelKey:n?.metadata.displayNameLabelKey??vd(e),displayName:n?.metadata.displayName,fileStorage:n?.fileStorage}})}function ix(e,t){let{providerComponentRegistry:n}=Ou(),{granted:r}=nx(),i=r.join(`,`),[a,o]=(0,Q.useState)(()=>Hb());return(0,Q.useEffect)(()=>rle({registry:n,capability:e,providerRef:t,grantedConsentPurposes:r,onState:o}),[e,t,n,i]),a}var ax;(function(e){e.PROVIDER_DECLARED_NO_DELIVERY=`PROVIDER_DECLARED_NO_DELIVERY`,e.DELIVERY_CONTRADICTS_DECLARATION=`DELIVERY_CONTRADICTS_DECLARATION`})(ax||={});function ox(e){let t=e.descriptor?.selectionDelivery;if(t===void 0)return{accepted:[],rejections:[{kind:ax.PROVIDER_DECLARED_NO_DELIVERY,providerRef:e.providerRef,message:`Provider "${e.providerRef}" contributes a file picker but declares no \`selectionDelivery\`, so the framework cannot tell whether a selection is a backend reference or bytes the browser already holds — and therefore cannot route it. Declare one on the component: \`components: { FRONTEND_FILE_PICKER: { load, selectionDelivery } }\`.`}]};let n=[];for(let r of e.selections)r.kind!==t&&n.push({kind:ax.DELIVERY_CONTRADICTS_DECLARATION,providerRef:e.providerRef,declared:t,received:r.kind,message:`Provider "${e.providerRef}" declared its file picker delivers "${t}" and returned a "${r.kind}" selection. Which one a provider emits is a declaration, not a runtime choice (issue #383): a surface routes a selection before it mounts the picker, so a picker that contradicts its own declaration is refused rather than guessed at.`});return n.length>0?{accepted:[],rejections:n}:{accepted:e.selections,rejections:[]}}var sx;(function(e){e.PLACE_ID_CONTRADICTS_DECLARATION=`PLACE_ID_CONTRADICTS_DECLARATION`,e.ADDRESS_REFUSED_BY_FIELD=`ADDRESS_REFUSED_BY_FIELD`})(sx||={});function cx(e){let t=e.descriptor?.placeIdRetention??yd.NONE,{address:n,placeId:r}=e.selection;return r!==void 0&&t===yd.NONE?{rejection:{kind:sx.PLACE_ID_CONTRADICTS_DECLARATION,providerRef:e.providerRef,message:`Provider "${e.providerRef}" declared its address lookup returns no place id and returned one. Whether a vendor place id is returned is a declaration (\`placeIdRetention\`), not a runtime choice, so the selection is refused rather than guessed at.`}}:e.addressSchema!==void 0&&!e.addressSchema.safeParse(n).success?{rejection:{kind:sx.ADDRESS_REFUSED_BY_FIELD,providerRef:e.providerRef,message:`Provider "${e.providerRef}" returned an address the field's own schema refuses (a country outside the ones it accepts, or a missing required part). The lookup is a suggestion; the field decides.`}}:{accepted:{address:n,...r===void 0?{}:{placeId:r}}}}var lx=Dd.FRONTEND_FILE_PICKER;function ux(e){let{providerComponentRegistry:t,frontendProviderRegistry:n}=Ou(),r=rx(lx),i=e.acceptedStorages,a=(0,Q.useMemo)(()=>r.filter(e=>e.fileStorage===void 0||(i?.includes(e.fileStorage)??!1)),[r,i]),[o,s]=(0,Q.useState)(()=>a.length===1?a[0]?.providerRef:void 0),c=a.length===1?a[0]?.providerRef:void 0;(0,Q.useEffect)(()=>{c!==void 0&&o===void 0&&s(c)},[c,o]);let{status:l,Component:u,missingConsentPurposes:d}=ix(lx,o),{grant:f}=nx(),p=(0,Q.useMemo)(()=>o===void 0?{}:n?.getProviderByRef(o)?.publicConfig??{},[o,n]),m=e.constraints,h=e.multiple,g=(0,Q.useMemo)(()=>Cae({base:m,multiple:h,publicConfig:p}),[m,h,p]),{onSelect:_,onCancel:v,onProviderFailure:y}=e,b=(0,Q.useCallback)(e=>{if(o===void 0)return;let n=ox({providerRef:o,descriptor:t?.describe(lx,o),selections:e});n.rejections.length>0?y?.({providerRef:o,rejections:n.rejections}):_(o,n.accepted)},[o,t,_,y]),x=(0,Q.useCallback)(e=>{o!==void 0&&y?.({providerRef:o,error:e})},[o,y]),S=(0,Q.useCallback)(()=>v?.(),[v]),C=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{l!==Bb.UNAVAILABLE||o===void 0?C.current=void 0:C.current!==o&&(C.current=o,y?.({providerRef:o,error:Error(`Provider "${o}" cannot open its file picker: its component or a script it declares did not load. The provider component registry logged the cause.`)}))},[l,o,y]);let w=(0,Q.useCallback)(async()=>{if(o!==void 0)return(await bc().getProviderConnectionAccessToken(o))?.accessToken},[o]);if(a.length===0)return null;let T=e.renderChooser?.({choices:a,chosen:o,choose:s})??ale({choices:a,chosen:o,choose:s}),E=a.find(e=>e.providerRef===o),D=l===Bb.CONSENT_REQUIRED&&E!==void 0?(e.renderConsentRequired??ole)({choice:E,missingPurposes:d,grant:f===void 0?void 0:()=>f(d)}):null,O=u;return(0,$.jsxs)($.Fragment,{children:[a.length>1?T:null,D,l===Bb.READY&&O!==null&&o!==void 0?(0,$.jsx)(O,{providerRef:o,publicConfig:p,constraints:g,getAccessToken:w,onSelect:b,onCancel:S,onError:x}):null]})}function ale(e){return(0,$.jsx)(`div`,{role:`group`,children:e.choices.map(t=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t.providerRef===e.chosen,onClick:()=>e.choose(t.providerRef),children:t.displayName??t.providerRef},t.providerRef))})}function ole(e){let t=e.missingPurposes.join(`, `);return(0,$.jsxs)(`div`,{role:`status`,"data-provider-consent-required":e.choice.providerRef,children:[(0,$.jsx)(`span`,{children:t}),e.grant===void 0?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>void e.grant?.(),children:t})]})}var dx;(function(e){e.VERTICAL=`vertical`,e.HORIZONTAL=`horizontal`,e.RESPONSIVE=`responsive`})(dx||={});function fx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD,`Field`)(e);return(0,$.jsx)(n,{...t})}function px({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_LABEL,`FieldLabel`)(e);return(0,$.jsx)(n,{...t})}function mx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_TITLE,`FieldTitle`)(e);return(0,$.jsx)(n,{...t})}function hx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_CONTENT,`FieldContent`)(e);return(0,$.jsx)(n,{...t})}function gx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_DESCRIPTION,`FieldDescription`)(e);return(0,$.jsx)(n,{...t})}function _x({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_ERROR,`FieldError`)(e);return(0,$.jsx)(n,{...t})}function sle({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_SEPARATOR,`FieldSeparator`)(e);return(0,$.jsx)(n,{...t})}var vx=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(B.LOW_LEVEL_COMBOBOX,`Combobox`)(e);return(0,$.jsx)(r,{...t,ref:n})});vx.displayName=`Combobox`;var yx=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(B.LOW_LEVEL_COMBOBOX_MULTIPLE,`ComboboxMultiple`)(e);return(0,$.jsx)(r,{...t,ref:n})});yx.displayName=`ComboboxMultiple`;var cle=bd(),bx=class extends Error{constructor(){super(`The chosen place has no postal address the field can hold.`),this.name=`ProviderAddressLookupPlaceWithoutAddressError`}};function xx({attribution:e}){return(0,$.jsxs)(`span`,{"data-address-lookup-attribution":``,className:`inline-flex`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:e.accessibleLabel}),(0,$.jsx)(`span`,{"aria-hidden":`true`,translate:`no`,className:`whitespace-nowrap rounded-sm px-1 text-xs font-normal tracking-normal`,style:{color:`#1F1F1F`,backgroundColor:`#FFFFFF`},children:e.mark})]})}function Sx(e){return e instanceof Error?e:Error(String(e))}function Cx(e){let{adapter:t,suggest:n,retrieve:r,onSelect:i,onCancel:a,onError:o,countriesAllowed:s,defaultCountry:c,languageCode:l,disabled:u,name:d,attribution:f}=e,{tComponent:p}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),m=(e,t)=>p(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(0),S=(0,Q.useRef)(!1),C=h.trim(),w=C.length>=3;(0,Q.useEffect)(()=>{let e=++x.current;if(!w||u){v([]),b(!1);return}b(!0);let r=setTimeout(()=>{let r;try{r=t.buildSuggestInput({query:C,countriesAllowed:s,defaultCountry:c,languageCode:l})}catch(e){b(!1),o(Sx(e));return}n(r).then(n=>{e===x.current&&v(t.readSuggestions(n))}).catch(t=>{e===x.current&&(v([]),o(Sx(t)))}).finally(()=>{e===x.current&&b(!1)})},300);return()=>clearTimeout(r)},[C,w,u,t,n,o,l,c,(s??[]).join(`,`)]);let T=(0,Q.useMemo)(()=>_.map((e,t)=>({value:`suggestion-${t}`,label:e.primaryText,data:e})),[_]),E=(0,Q.useCallback)(()=>{x.current+=1,g(``),v([]),b(!1)},[]),D=(0,Q.useCallback)(e=>{let n=T.find(t=>t.value===e)?.data;if(n===void 0)return;S.current=!0;let a;try{a=t.buildRetrieveInput({suggestion:n,languageCode:l})}catch(e){S.current=!1,o(Sx(e));return}r(a).then(e=>{let n=t.readAddress(e);n===void 0?o(new bx):i({address:n})}).catch(e=>o(Sx(e))).finally(()=>{S.current=!1,E()})},[t,l,o,i,T,E,r]),O=(0,Q.useCallback)(e=>{e||S.current||(E(),a())},[a,E]),k=w?m(Wa.LOOKUP_NO_RESULTS):m(Wa.LOOKUP_TYPE_MORE,{minimum:3});return(0,$.jsx)(vx,{schema:cle,name:d,value:``,options:T,onChange:D,onSearchChange:g,onOpenChange:O,shouldFilter:!1,isLoading:y,disabled:u,placeholder:m(Wa.LOOKUP_PLACEHOLDER),searchPlaceholder:m(Wa.LOOKUP_SEARCH_PLACEHOLDER),emptyMessage:k,listFooter:f===void 0?void 0:(0,$.jsx)(xx,{attribution:f}),renderOption:e=>{let t=e.data;return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:t?.primaryText??e.label}),t?.secondaryText?(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t.secondaryText}):null]})}})}var wx=Dd.FRONTEND_ADDRESS_LOOKUP,lle=ka(rd).consentedPurposes,Tx;(function(e){e.UNAVAILABLE=`UNAVAILABLE`,e.ADDRESS_REFUSED=`ADDRESS_REFUSED`})(Tx||={});function ule(){return globalThis.crypto.randomUUID()}function Ex({host:e,addressSchema:t,fieldName:n}){let{providerComponentRegistry:r,frontendProviderRegistry:i}=Ou(),{t:a,tComponent:o,tResourceFieldEnumValue:s,currentLanguage:c}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),l=(e,t)=>o(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),u=rx(wx),d=(0,Q.useMemo)(()=>u.filter(e=>r?.describe(wx,e.providerRef)?.addressLookup!==void 0),[u,r]),[f,p]=(0,Q.useState)(void 0),m=f??(d.length===1?d[0]?.providerRef:void 0),{status:h,Component:g,missingConsentPurposes:_}=ix(wx,m),{grant:v}=nx(),[y,b]=(0,Q.useState)(void 0),x=m===void 0?void 0:r?.describe(wx,m),S=x?.addressLookup,C=(0,Q.useRef)(void 0),w=(0,Q.useCallback)(()=>{C.current=void 0},[]),T=(0,Q.useCallback)(async(e,t)=>{if(m===void 0)throw Error(`No address lookup provider is chosen.`);let n=S?.sessionTokenInput,r={...t};return n!==void 0&&(C.current??=ule(),r={...r,[n]:C.current}),(await bc().executeProviderOperation(m,e,{input:r})).output},[m,S?.sessionTokenInput]),E=(0,Q.useCallback)(e=>S===void 0?Promise.reject(Error(`The address lookup declares no operations.`)):T(S.suggestOperationId,e),[S,T]),D=(0,Q.useCallback)(e=>S===void 0?Promise.reject(Error(`The address lookup declares no operations.`)):T(S.retrieveOperationId,e).finally(w),[S,w,T]),O=(0,Q.useCallback)(n=>{if(m===void 0)return;w();let r=cx({providerRef:m,descriptor:x,selection:n,addressSchema:t});r.accepted===void 0?b(Tx.ADDRESS_REFUSED):(b(void 0),e.applyAddress(r.accepted.address))},[t,m,x,w,e]),k=(0,Q.useCallback)(()=>w(),[w]),A=(0,Q.useCallback)(e=>{w(),b(e instanceof bx?Tx.ADDRESS_REFUSED:Tx.UNAVAILABLE)},[w]);if(d.length===0)return null;let j=d.find(e=>e.providerRef===m),M=e=>a(e.displayNameLabelKey)??e.displayName??e.providerRef,N=`${n}.lookup`,P=g,F=h===Bb.UNAVAILABLE?Tx.UNAVAILABLE:y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-address-lookup":m??``,children:[(0,$.jsx)(px,{htmlFor:`field-${N}`,className:`text-sm text-muted-foreground`,children:l(Wa.LOOKUP_LABEL)}),d.length>1?(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs`,children:d.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.providerRef===m?J.DEFAULT:J.OUTLINE,"aria-pressed":e.providerRef===m,onClick:()=>{b(void 0),w(),p(e.providerRef)},children:M(e)},e.providerRef))}):null,h===Bb.CONSENT_REQUIRED&&j!==void 0?(0,$.jsx)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-item-xs text-sm text-muted-foreground`,children:(()=>{let e=_.map(e=>s(ul.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,lle)).join(`, `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:l(Wa.LOOKUP_CONSENT_REQUIRED,{provider:M(j),purposes:e})}),v===void 0?null:(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.OUTLINE,onClick:()=>void v(_),children:l(Wa.LOOKUP_CONSENT_GRANT,{purposes:e})})]})})()}):null,h===Bb.READY&&P!==null&&m!==void 0&&S!==void 0?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(P,{providerRef:m,publicConfig:i?.getProviderByRef(m)?.publicConfig??{},...e.countriesAllowed===void 0?{}:{countriesAllowed:e.countriesAllowed},...e.defaultCountry===void 0?{}:{defaultCountry:e.defaultCountry},languageCode:c,disabled:e.disabled,name:N,...S.attributionMark===void 0?{}:{attribution:{mark:S.attributionMark,accessibleLabel:l(Wa.LOOKUP_ATTRIBUTION,{mark:S.attributionMark})}},suggest:E,retrieve:D,onSelect:O,onCancel:k,onError:A})}):null,F===void 0?null:(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:l(F===Tx.UNAVAILABLE?Wa.LOOKUP_UNAVAILABLE:Wa.LOOKUP_ADDRESS_REFUSED)})]})}function Dx(){return(0,Q.useContext)(Ox)}var Ox=(0,Q.createContext)([]),dle=as.getLogger();function fle(e){return[...e].sort().join(`,`)}var kx=({children:e})=>{let t=(0,Q.useContext)(Fi),n=t?.frontendProviderRegistry,{on:r}=Mo(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),c=(0,Q.useRef)(Uce());(0,Q.useEffect)(()=>r(Ec.USER_PREFERENCES_CHANGED,e=>{if(e.privacy===null){a([]);return}let t=e.privacy?.consentedPurposes;t!==void 0&&a(Nd(t))}),[r]);let l=t?.appConfig?.analytics?.enabled===!0,u=(0,Q.useMemo)(()=>(n?.listAll()??[]).filter(e=>Tb(e).length>0&&(l||!e.providerCapabilities.includes(Dd.FRONTEND_PRODUCT_ANALYTICS))),[n,l]),d=(0,Q.useMemo)(()=>{let e=i??[],t=new Set(u.flatMap(e=>Tb(e)));return e.filter(e=>t.has(e))},[u,i]),f=fle(d);return(0,Q.useEffect)(()=>{if(u.length===0||d.length===0){s([]);return}let e=c.current.start(()=>Fb({surface:Zo.SAAS_APP,modules:u,grantedConsentPurposes:d,onDiagnostic:e=>{dle.warn(`Consent-based frontend provider activation diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}}),e=>{s(u.flatMap(t=>{let n=e.activations.get(t.metadata.ref);return n===void 0?[]:[{providerRef:t.metadata.ref,providerCapabilities:[...t.providerCapabilities],activation:n}]}))});return()=>{s([]),e()}},[u,f]),(0,$.jsx)(Ox.Provider,{value:o,children:e})},Ax=as.getLogger(),jx=Ax.debugByType(`ResourceReadCache`);Ax.setDebugTypeLogging(`ResourceReadCache`,!1);var ple=200,mle=class{applicationId=null;organizationId=null;entries=new Map;authority=null;enabled=!0;setApplicationId(e){this.applicationId=e}getApplicationId(){return this.applicationId}setOrganizationId(e){this.organizationId=e}getOrganizationId(){return this.organizationId}setCoverageAuthority(e){this.authority=e,this.entries.clear(),jx(`coverage authority changed`,{hasAuthority:e!==null})}setEnabled(e){this.enabled=e,e||this.entries.clear()}get size(){return this.entries.size}read(e){if(!this.enabled)return;let t=this.entries.get(e);if(t){if(!this.authority?.covers(t.resourceType,t.scopes))this.entries.delete(e),jx(`entry dropped: no live coverage`,{resourceType:t.resourceType});else return t.lastReadAt=Date.now(),t.value}}store(e,t,n,r){if(!this.enabled||!this.authority||r.length===0)return;this.authority.requestCoverage(n,r);let i=Date.now();this.entries.set(e,{value:t,resourceType:n,scopes:r,storedAt:i,lastReadAt:i}),this.evictIfOverCapacity()}invalidateResourceType(e){let t=0;for(let[n,r]of this.entries)r.resourceType===e&&(this.entries.delete(n),t+=1);t>0&&jx(`invalidated by resource type`,{resourceType:e,dropped:t})}clear(){let e=this.entries.size;this.entries.clear(),e>0&&jx(`cleared`,{dropped:e})}evictIfOverCapacity(){if(this.entries.size<=ple)return;let e,t=1/0;for(let[n,r]of this.entries)r.lastReadAt<t&&(t=r.lastReadAt,e=n);e!==void 0&&this.entries.delete(e)}};function hle(e,t){let n=new WeakSet,r=e=>{if(e===void 0)return`u`;if(e===null)return`n`;if(typeof e==`function`||typeof e==`bigint`)throw Error(`not renderable`);if(typeof e!=`object`)return JSON.stringify(e)??`u`;if(n.has(e))throw Error(`not renderable`);return n.add(e),Array.isArray(e)?`[${e.map(r).join(`,`)}]`:`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${r(t)}`).join(`,`)}}`};try{return`${e}${r(t)}`}catch{return null}}function Mx(e,t){let n=t?.[ul.USERS];return e?.primaryKeyIdentifiesInitiator===!0&&n!==void 0&&e.resourceFieldIdentifier===n}function Nx(e,t){return e?.timeout===void 0?t.clientRequestTimeoutMs===void 0?{}:{timeout:t.clientRequestTimeoutMs}:{}}function gle(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`ik-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}-${Math.random().toString(36).slice(2,12)}`}function Px(e,t){return t.idempotencyKey===void 0||Object.keys(e?.headers??{}).some(e=>e.toLowerCase()===Ju.IDEMPOTENCY_KEY)?{}:{headers:{...e?.headers,[Ju.IDEMPOTENCY_KEY]:ue(gle())}}}function _le(e){return typeof e==`string`||typeof e==`number`}function Fx(e){let t=vl(e);return t===W.READ||t===W.LIST||t===W.SEARCH}function vle(e){return!Fx(e)&&vl(e)!==W.COUNT&&e.httpVerb!==pc.GET}function Ix(e){return Fx(e)&&e.hasCustomResponseDto!==!0}var Lx=class e extends oa{resourcesRegistry;errorBuilder;constructor(e,t={}){super(t),this.resourcesRegistry=e,this.errorBuilder=new De}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(Va.INTERNAL,{customMessageReference:e,operationPathKey:t,context:n}),i=Error(e);return i.wildoError=r,i}readCache=new mle;getReadCache(){return this.readCache}resolveCacheableRead(e,t,n){let r=t.resourceIdentifier,i=hle(e,n);if(i===null)return null;let a=t.resourcePrimaryScope;if(!a)return null;let o={};for(let[e,t]of Object.entries(n.contextualParameters??{}))typeof t==`string`?o[e]=t:typeof t==`number`&&(o[e]=String(t));if(a===Vr.APPLICATION){let e=this.readCache.getApplicationId();e&&(o.applicationId=e)}if(a===Vr.ORGANIZATIONS&&!o.organizationId){let e=this.readCache.getOrganizationId();e&&(o.organizationId=e)}return{key:i,resourceType:r,scopes:_ie(o,a)}}async doOperation(e,t,n){let r=Ta.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(Xl.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e});Fx(i)||this.readCache.invalidateResourceType(i.resourceIdentifier);let a=Ix(i)?this.resolveCacheableRead(e,i,t):null;if(a){let e=this.readCache.read(a.key);if(e!==void 0)return structuredClone(e)}switch(i.variantType){case at.API_CALL:return this.executeApiCallOperation(i,t,n).then(e=>(a&&this.readCache.store(a.key,e,a.resourceType,a.scopes),vle(i)&&Mx(this.resourcesRegistry.resourceConfigurations[i.resourceIdentifier],this.resourcesRegistry.allResourceFieldIdentifiers)&&this.revalidateSession(),e));default:throw i.variantType,this.buildError(Xl.FRONTEND_RESOURCE_UNSUPPORTED_OPERATION_TYPE,e,{operationPathKey:e})}}async executeSearchOperation(e,t,n){let r=Ta.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(Xl.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e,operationType:`search`});if(vl(i)!==W.SEARCH)throw this.buildError(Xl.FRONTEND_RESOURCE_SEARCH_OPERATION_INVALID,e,{operationPathKey:e,actualOperationIdentifier:i.operationIdentifier});let a=Ix(i)?this.resolveCacheableRead(e,i,t):null;if(a){let e=this.readCache.read(a.key);if(e!==void 0)return structuredClone(e)}let o=await this.executeSearchOperationInternal(i,t,n);return a&&this.readCache.store(a.key,o,a.resourceType,a.scopes),o}validateOperationAnswer(e,t,n){if(qre(e,n))return this.validateResponseData(n,xee,void 0,!1);if(Dt(e,n))return this.validateResponseData(n,Ree,void 0,!1);let r=this.selectResponseDto(e,t);return this.validateResponseData(n,r,void 0,$ee(e))}selectResponseDto(e,t){let n=us.selectResponseDto(e,t);return!n||typeof n!=`object`||typeof n.parse!=`function`?null:n}validateResponseData(t,n,r,i=!1){if(!n)return t;try{let r=i&&Array.isArray(t)?t.map(e=>n.parse(e)):n.parse(t);return e.reattachEngineMetadata(t,r),r}catch(e){throw e instanceof Id?this.buildError(Xl.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{validationErrors:e.issues,responseData:t}):e}}static reattachEngineMetadata(t,n){if(!t||typeof t!=`object`||!n||typeof n!=`object`)return;if(Array.isArray(t)&&Array.isArray(n)){for(let r=0;r<n.length;r++)e.reattachEngineMetadata(t[r],n[r]);return}let r=t,i=n;if(Array.isArray(r.data)&&Array.isArray(i.data)){let t=r.data,n=i.data;for(let r=0;r<n.length;r++)e.reattachEngineMetadata(t[r],n[r])}for(let e of[`_field_meta`,`_version`])r[e]!==void 0&&i[e]===void 0&&(i[e]=r[e])}findOperation(e){let t=this.resourcesRegistry.resourceConfigurations[e.resourceIdentifier];return t&&t.operations.find(t=>{let n=Ta.extractOperationPath(t);if(n.operationIdentifier!==e.operationIdentifier||n.variantType!==e.variantType)return!1;if(e.isOperationDefault){if(!n.isOperationDefault)return!1}else{let t=e.variantKey;if((n.variantKey??void 0)!==(t??void 0))return!1}return n.variantType!==at.API_CALL||n.isBulkOperation===!0==(e.isBulkOperation===!0)})||null}async executeApiCallOperation(e,t,n){let r=this.resourcesRegistry.resourceConfigurations[e.resourceIdentifier]?.resourceFieldIdentifier??``,{url:i,missingParameters:a}=this.buildUrlFromInitiatorInfos(e.initiatorInfos||[],t.contextualParameters,e.resourceIdentifier,r,t.parentResourcesRequirements,t.parentChainIsExact);if(a.length>0)throw this.buildError(Xl.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`Missing required URL parameters`,missingParameters:a,availableParameters:Object.keys(t.contextualParameters),url:i});let o={...t.queryParameters};t.dataMode&&(o.dataMode=t.dataMode);let s={...n,...Nx(n,e),...Px(n,e),params:o,riskLevel:e.riskLevel||zi.MEDIUM,resourceType:e.resourceIdentifier,operationIdentifier:String(e.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:tl.COMPONENT,phase:uu.INITIAL}},c;switch(e.httpVerb){case pc.GET:c=await this.get(i,s);break;case pc.POST:c=await this.post(i,t.requestData,s);break;case pc.PUT:c=await this.put(i,t.requestData,s);break;case pc.DELETE:c=await this.delete(i,t.requestData===void 0?s:{...s,data:t.requestData});break;case pc.PATCH:c=await this.patch(i,t.requestData,s);break;default:throw this.buildError(Xl.FRONTEND_RESOURCE_UNSUPPORTED_HTTP_METHOD,void 0,{httpMethod:e.httpVerb,url:i})}return this.validateOperationAnswer(e,t.dataMode,c)}async executeSearchOperationInternal(e,t,n){let r=e,i=String(r.resourceIdentifier),a=this.resourcesRegistry.resourceConfigurations[i]?.resourceFieldIdentifier??``,{url:o,missingParameters:s}=this.buildUrlFromInitiatorInfos(r.initiatorInfos||[],t.contextualParameters,i,a,t.parentResourcesRequirements,t.parentChainIsExact);if(s.length>0)throw this.buildError(Xl.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`Missing required URL parameters`,missingParameters:s,availableParameters:Object.keys(t.contextualParameters),url:o});let c={...t.queryParameters};if(t.dataMode&&t.dataMode!==Hl.RAW&&(c.dataMode=t.dataMode),t.searchQuery&&(c.q=t.searchQuery),t.filters&&r.filterFields&&Object.entries(t.filters).forEach(([e,t])=>{r.filterFields[e]&&(c[e]=t)}),t.sort&&t.sort.length>0&&(c.sort=t.sort.map(e=>`${e.field}:${e.direction}`).join(`,`)),t.pagination){c.page=t.pagination.page;let e=r.maxPaginatedResultPerPageLimit??50;c.limit=Math.min(t.pagination.limit,e)}let l={...n,...Nx(n,r),params:c,riskLevel:r.riskLevel||zi.MEDIUM,resourceType:r.resourceIdentifier,operationIdentifier:String(r.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:tl.COMPONENT,phase:uu.INITIAL}},u=await this.get(o,l);return this.validateOperationAnswer(e,t.dataMode,u)}selectInitiatorInfo(e,t,n,r,i,a){if(e.length===0)throw this.buildError(Xl.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`No initiator infos available for this operation`});let o=V.selectOperationUrlInitiatorInfo({initiatorInfos:e,contextualParameters:t,targetResourceType:n,targetDefaultFieldIdentifier:r,parentResourcesRequirements:i,parentChainIsExact:a});if(!o){let n=Object.keys(t).join(`, `),r=e.map(e=>e.parameters.map(e=>e.fieldIdentifier).join(`, `)).join(` OR `);throw this.buildError(Xl.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{availableParams:n,requiredParams:r})}return o}buildUrlFromInitiatorInfos(e,t,n,r,i,a){let o=this.selectInitiatorInfo(e,t,n,r,i,a);return this.buildUrlFromInitiatorInfo(o,t)}buildUrlFromInitiatorInfo(e,t){let n=e.url,r=[];for(let i of e.parameters){let e=t[i.fieldIdentifier];if(_le(e)){let t=encodeURIComponent(String(e));n=n.replace(`{${i.fieldIdentifier}}`,t);let r=RegExp(`:${i.fieldIdentifier.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}(?=[/\\?]|$)`,`g`);n=n.replace(r,t)}else r.push(i.fieldIdentifier)}return{url:n,missingParameters:r}}getAvailableOperationPaths(){let e=[];for(let[t,n]of Object.entries(this.resourcesRegistry.resourceConfigurations)){let t=n;for(let n of t.operations){let t=Ta.extractOperationPath(n),r=Ta.createOperationPathKey(t);e.push(r)}}return e}getOperationDetails(e){let t=Ta.parseOperationPathKey(e);return this.findOperation(t)}},Rx=as.getLogger();Rx.debugByType(`useNavigationState`),Rx.setDebugTypeLogging(`useNavigationState`,!1);function zx(){let e=(0,Q.useContext)(mh);if(!e)throw Error(`useNavigationState must be used within a NavigationProvider`);return e}var Bx;(function(e){e.ELEMENT=`element`,e.CREATE=`create`})(Bx||={});var Vx=(0,Q.createContext)({isAvailable:!1,target:null,open:()=>void 0,close:()=>void 0,isElementActive:()=>!1,isCreateActive:!1});function Hx({resourceType:e,children:t}){let[n,r]=(0,Q.useState)(null),i=(0,Q.useCallback)(t=>{t.resourceContext.resourceType===e&&r(t)},[e]),a=(0,Q.useCallback)(()=>r(null),[]),o=(0,Q.useCallback)(e=>e?n?.kind===Bx.ELEMENT&&n.elementId===e:!1,[n]),s=(0,Q.useMemo)(()=>({isAvailable:!0,target:n,open:i,close:a,isElementActive:o,isCreateActive:n?.kind===Bx.CREATE}),[n,i,a,o]);return(0,$.jsx)(Vx.Provider,{value:s,children:t})}function Ux(){return(0,Q.useContext)(Vx)}var Wx=as.getLogger(),Gx=Wx.debugByType(`useNavigationController`);Wx.setDebugTypeLogging(`useNavigationController`,!1);function Kx(e){let t=e?.operationFrontendConfig?.surface;return t!==Pu.EMBEDDED&&t!==Pu.API_ONLY}function qx(e,t,n=!1){dh.isInTransaction()||dh.beginTransaction(`controller_url_update`),e(t,{replace:n})}function Jx(e){if(!dh.isResourceOperationContent(e))return{operation:W.LIST,effectiveOperation:W.LIST,actionPresentationIsAuthored:!1};let t=e.resourceContext.operation;return{operation:t?.operationIdentifier??W.LIST,effectiveOperation:vl(t),resourceType:e.resourceContext.resourceType,operationSurface:t?.operationFrontendConfig?.surface,operationOverrides:t?.operationFrontendConfig?.navigationOverrides,actionPresentationTransition:kne(Jc(t)),actionPresentationIsAuthored:t?.operationFrontendConfig?.actionPresentation!==void 0}}var yle={[Cl.SECONDARY]:Cl.PRIMARY,[Cl.COMPANION]:Cl.SECONDARY};function ble(e){let t=yle[e.paneZone];if(!e.layout||!t)return!1;let n=dh.isResourceOperationContent(e.content)?xle(e.content.resourceContext,e.registry,e.viewport):void 0,r={[Cl.PRIMARY]:!0};t===Cl.SECONDARY&&(r[Cl.SECONDARY]=!0);let i=Nm.resolve({...Jx(e.content),relationshipTransition:n,sourceZone:t,focusedZone:t,viewport:e.viewport,contentAreaWidth:e.contentAreaWidth,zoneOccupancy:r,zoneDepth:{}},e.layout);return i.persistent===!0&&i.targetZone===e.placedZone}function xle(e,t,n){let r=(e.parentResourcesRequirements??[]).filter(e=>!e.isPrimaryScope),i=r[r.length-1];if(!i)return;let a=dh.findRelationshipBetween(i.resourceType,e.resourceType,t,i.foreignKeyField);return Th(a?.display?.inParentNavigation?.transition,n??Sl.DESKTOP)}function Yx(e,t,n,r){let i=t.foreignKeyField,a=r.allResourceFieldIdentifiers?.[t.resourceType]??r.resourceConfigurations?.[t.resourceType]?.resourceFieldIdentifier;!i||i===a?e[t.resourceType]=n:On.selfReferenceForeignKeysOf(t.resourceType,r).includes(i)?e[i]={fieldIdentifier:i,resourceId:n}:e[t.resourceType]={fieldIdentifier:i,resourceId:n}}function Xx(e){let{resourceType:t,contextResourceIdentifiers:n,parentResourcesRequirements:r,registry:i,emit:a,getZoneState:o}=e;if(!e.replaceExisting&&o(Cl.PRIMARY).stack.length>0)return;let s=i.resourceConfigurations?.[t];if(!s)return;let c={...n};delete c[t];let l=nu(Ra(s.operations??[],W.LIST,{allowBulk:!0}).filter(e=>Sn(e.operationFrontendConfig)),W.LIST,{allowBulk:!0});if(!l)return;let u=dh.resolveResourceUrl(s,l,Hu(c),i.allResourceFieldIdentifiers,r)?.resolvedUrl;a(Ec.NAVIGATION_REPLACE,{zone:Cl.PRIMARY,content:{contentType:sd.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:l,contextResourceIdentifiers:c,parentResourcesRequirements:r})},...u?{urlPath:u}:{},stackEntryId:dh.generateStackEntryId(),initiator:{sourceZone:Cl.PRIMARY},navigationSource:e.navigationSource??Qi.URL_SYNC,transition:Rt.REPLACE})}function Zx(e,t,n){return e?.admitsCrossTenantPlatformAdministration!==!0||n?.({...e,resourceType:t})===!0}function Qx(e,t,n,r,i,a,o,s){let c=e.resourceContext.parentResourcesRequirements;if(!c||c.length===0)return;let l=[];if(t===Cl.SECONDARY?l.push(Cl.PRIMARY):t===Cl.COMPANION&&l.push(Cl.SECONDARY,Cl.PRIMARY),l.length===0)return;let u=[...c].reverse(),d=e.resourceContext.resourceType;for(let e=0;e<l.length&&e<u.length;e++){let t=l[e],f=u[e];if(f.isPrimaryScope)continue;let p=o(t);if(!s?.overwriteExisting&&p.stack.length>0)continue;let m=f.resourceType,h=n.resourceConfigurations?.[m];if(!h)continue;let g=f.childResourceType??(e===0?d:u[e-1].resourceType),_=dh.findRelationshipBetween(m,g,n,f.foreignKeyField),v=c.length-1-e,y=v>0?c.slice(0,v):[],b={};for(let e of y){let t=r[e.foreignKeyField??e.resourceType]??r[e.resourceType];t&&Yx(b,e,t,n)}let x=(f.foreignKeyField?r[f.foreignKeyField]:void 0)??(m===d?void 0:r[m]),S=x?{...b,[m]:x}:b,C=dh.resolveAncestorOperationConfig(_,h,{registry:n,contextResourceIdentifiers:S,contextualParameters:V.buildContextualParameters(S,n)}),w=Zx(C,m,s?.viewerMayPerform)?C:null;if(t===Cl.PRIMARY&&(!w||dh.isCollectionOperationContext({operation:w})&&m!==g)){let e=c.slice(0,v+1),t={};for(let i of e){let e=r[i.foreignKeyField??i.resourceType]??r[i.resourceType];e&&Yx(t,i,e,n)}Xx({resourceType:g,contextResourceIdentifiers:t,parentResourcesRequirements:e,registry:n,emit:i,getZoneState:o,navigationSource:Qi.CONTROLLER,replaceExisting:!!s?.overwriteExisting});continue}if(!w)continue;let T=vl(w);x&&T===W.READ&&(b[m]=x);let E=On.createFrontendResourceOperationContextFromOperation({resourceType:m,operation:w,contextResourceIdentifiers:b,parentResourcesRequirements:y}),D={contentType:sd.RESOURCE_OPERATION,resourceContext:E},O;if(Kx(w)){let e=dh.resolveResourceUrl(h,w,Hu(b),n.allResourceFieldIdentifiers,y);e?.resolvedUrl&&(O=e.resolvedUrl)}let k=dh.generateStackEntryId();Gx(`cascadeAncestorZones: populating ancestor zone`,{zone:t,ancestorResourceType:m,ancestorOp:T,ancestorUrl:O}),i(Ec.NAVIGATION_REPLACE,{zone:t,content:D,urlPath:O,stackEntryId:k,initiator:{sourceZone:t},navigationSource:Qi.CONTROLLER,transition:Rt.REPLACE}),t===Cl.PRIMARY&&O&&a&&qx(a,O,!0)}}function Sle(e,t){if(!t)return null;let n=t[e];if(!n?.usersManagement)return null;let r=Object.entries(n.usersManagement),i=r.find(([,e])=>e.isDefault),a=r[0];return(i??a)?.[0]??null}function Cle(e,t,n){if(!t?.length||!n)return null;let r=n[e]?.usersManagement;if(!r)return null;for(let e of t)if(r[e])return e;return null}var wle={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0};function $x(){let{auth:e,appConfig:t}=Ou(),n=(0,Q.useContext)(ah),r=xa.loadEnvironmentConfig().frontendServiceName;return(0,Q.useMemo)(()=>{let i=Sle(r,t.frontendServices),a=Cle(r,n?.user?.userTypes,t.frontendServices)??i,o=(a?t.userTypes?.[a]:null)?.auth??null,s=o?.passwordPolicy??wle,c=o?.registration,l=Es.safeParse(c),u=!!(a&&t.frontendServices?.[r]?.usersManagement?.[a]?.register===!0),d=l.success?{mode:l.data.mode,allowedMethods:l.data.allowedMethods,frontendServiceAllowsRegistration:u,publicRegistrationAvailable:u&&Dte(l.data.mode,Hs.PUBLIC_SELF_SERVICE),additionalProfileQuestions:l.data.additionalProfileQuestions??[],profileNamesCollectedAt:we(l.data)}:{mode:no.DISABLED,allowedMethods:[],frontendServiceAllowsRegistration:!1,publicRegistrationAvailable:!1,additionalProfileQuestions:[],profileNamesCollectedAt:Gc.REGISTRATION};return{resolvedUserType:a,userTypeAuth:o,globalAuth:e,passwordPolicy:s,registrationConfig:d}},[r,t,e,n?.user?.userTypes])}var eS=(0,Q.createContext)(void 0),Tle=`wildo:appMode:`;function Ele(e,t){return`${Tle}${e??`default`}:${t??`anon`}`}function Dle(e){try{return localStorage.getItem(e)}catch{return null}}function Ole(e,t){try{localStorage.setItem(e,t)}catch{}}function tS(e,t){if(e.length===0)return null;let n=new Set(e.map(e=>e.ref)),r=Dle(t);if(r&&n.has(r))return r;let i=e.find(e=>e.isDefault);return i?i.ref:e[0].ref}var nS=({children:e})=>{let{frontendConfiguration:t,appConfig:n}=Ou(),{resolvedUserType:r}=$x(),i=(0,Q.useMemo)(()=>t?.appModes??[],[t?.appModes]),a=(0,Q.useMemo)(()=>r?i.filter(e=>!e.visibleToUserTypes||e.visibleToUserTypes.length===0||e.visibleToUserTypes.includes(r)):i,[i,r]),o=(0,Q.useMemo)(()=>Ele(n?.appIdentity?.appName,void 0),[n?.appIdentity?.appName]),[s,c]=(0,Q.useState)(()=>tS(a,o));(0,Q.useEffect)(()=>{if(a.length===0){c(null);return}let e=new Set(a.map(e=>e.ref));if(s&&e.has(s))return;let t=tS(a,o);c(t)},[a,o]);let l=(0,Q.useCallback)(e=>{a.some(t=>t.ref===e)&&(c(e),Ole(o,e))},[a,o]),u=(0,Q.useMemo)(()=>({allModes:i,availableModes:a,activeMode:s,setActiveMode:l,hasModes:a.length>0}),[i,a,s,l]);return(0,$.jsx)(eS.Provider,{value:u,children:e})};function kle(){let e=(0,Q.useContext)(eS);if(!e)throw Error(`useAppMode must be used within an AppModeProvider`);return e}function rS(){return(0,Q.useContext)(eS)??null}var Ale=as.getLogger(),jle=100,iS;(function(e){e.PENDING=`pending`,e.HELD=`held`,e.NONE=`none`,e.UNKNOWN=`unknown`,e.STALE=`stale`})(iS||={});function aS(e){return e?e.state===iS.HELD||(e.state===iS.PENDING||e.state===iS.STALE)&&e.previouslyHeld===!0:!1}var oS=new Map,sS=new Set;function Mle(e){return sS.add(e),()=>{sS.delete(e)}}function cS(){for(let e of sS)e()}function lS(e){let t=oS.get(e);t&&t.state!==iS.STALE&&(oS.set(e,{state:iS.STALE,previouslyHeld:aS(t)}),cS())}function Nle(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function Ple(e){if(Array.isArray(e))return{rows:e,totalPages:1};let t=e;return{rows:Array.isArray(t?.data)?t.data:[],totalPages:typeof t?.pagination?.totalPages==`number`?t.pagination.totalPages:1}}function Fle(e){let t=e;return t?.wildoError?.type===Va.NOT_FOUND||t?.wildoError?.context?.httpStatus===404||t?.response?.status===404||t?.status===404}function Ile(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.data;return t&&typeof t==`object`&&!Array.isArray(t)?t:e}function uS(e,t,n){let r=(0,Q.useContext)(sm),i=Zp(),a=(0,Q.useContext)(Wi),o=i?.currentUserId??null,s=i?.currentOrganizationId??null,c=r?.registry,l=(0,Q.useMemo)(()=>Nle(c?.resourceConfigurations[e.resourceType]?.operations,e.operation),[c,e.resourceType,e.operation]),u=c?.resourceConfigurations[ul.ORGANIZATIONS]?.resourceFieldIdentifier,d=!!l&&Um({...l,resourceType:e.resourceType},n),f=t&&d&&o&&s&&u?`${e.key}|${o}|${s}`:null,p=(0,Q.useRef)(r?.doOperation);p.current=r?.doOperation;let m=(0,Q.useRef)(e.matches);m.current=e.matches;let h=(0,Q.useSyncExternalStore)(Mle,()=>f?oS.get(f):void 0,()=>void 0);(0,Q.useEffect)(()=>{let t=f?oS.get(f):void 0;if(!f||t&&t.state!==iS.STALE||!l||!u||!s)return;let n=p.current;if(!n)return;let r={state:iS.PENDING,previouslyHeld:aS(t)};oS.set(f,r),cS();let i=e=>{oS.get(f)===r&&(oS.set(f,{state:e}),cS())},a=Ta.buildOperationPathKeyFromOperation(l),o={[u]:s};(async()=>{try{if(e.operation===W.READ){let e=Ile(await n(a,{contextualParameters:o},{silent:!0}));i(e&&m.current(e)?iS.HELD:iS.NONE);return}for(let e=1;;e+=1){let{rows:t,totalPages:r}=Ple(await n(a,{contextualParameters:o,queryParameters:{page:e,limit:jle}},{silent:!0}));if(t.some(e=>m.current(e))){i(iS.HELD);return}if(e>=r||t.length===0){i(iS.NONE);return}}}catch(t){if(e.operation===W.READ&&Fle(t)){i(iS.NONE);return}Ale.warn(`Could not read whether the organization holds this configuration`,{probe:e.key,organizationId:s,error:t}),i(iS.UNKNOWN)}})()},[f,h,l,u,s,e.key,e.operation]);let g=(0,Q.useRef)(f);return(0,Q.useEffect)(()=>{let e=g.current;g.current=f,e&&e!==f&&lS(e)},[f]),(0,Q.useEffect)(()=>{if(f)return a.on(Ec.RESOURCE_OPERATION_EXECUTED,()=>lS(f),t=>t.resourceType===e.resourceType&&!da(t.operation??{operationIdentifier:t.operationIdentifier}))},[a,f,e.resourceType]),aS(h)}var Lle={key:`scim-unrevoked-token`,resourceType:ul.ORGANIZATION_SCIM_TOKENS,operation:W.LIST,matches:e=>e.isActive===!0};function Rle(e,t){return uS(Lle,e,t)}function dS(){return fS(void 0)}function fS(e){let t=(0,Q.useContext)(ah)?.permissions??null,n=Zp()?.currentOrganizationId??null,r=hg(),i=e??n;return(0,Q.useMemo)(()=>({applicationRoles:t?.appLevel??[],organizationRoles:i&&t?.organizations?.[i]||[],roleTables:r,organizationId:i,accessProfile:t?.accessProfile??null}),[t,i,r])}function pS(){let e=fS(void 0),t=(0,Q.useRef)(e);return t.current=e,(0,Q.useCallback)(e=>Um(e,t.current),[])}function mS(){let e=(0,Q.useContext)(Fi)?.appConfig,t=e?.organizationRelationships,n=e?.organizationTypes,r=(0,Q.useContext)(ah)?.organizations,i=Zp()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>({organizationRelationships:t,organizationTypes:n,organizations:r,currentOrganizationId:i}),[t,n,r,i])}function hS(){let e=mS();return(0,Q.useMemo)(()=>bv(e),[e])}function zle(){let e=mS();return(0,Q.useMemo)(()=>Sv(e),[e])}function gS(){let e=(0,Q.useContext)(ah)?.organizations,t=Zp()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>{if(!t)return;let n=e?.find(e=>e._id===t)?.type;return typeof n==`string`&&n.length>0?n:void 0},[e,t])}function Ble(){let e=(0,Q.useContext)(Fi)?.appConfig?.organizationTypes,t=gS();return(0,Q.useMemo)(()=>Ei(e,t),[e,t])}var Vle={key:`sso-connection`,resourceType:ul.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST,matches:()=>!0},_S=e=>Array.isArray(e)&&e.length>0,vS=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Hle={key:`sso-policy`,resourceType:ul.ORGANIZATION_SSO_CONFIG,operation:W.READ,matches:e=>{let t=vS(e.enforcement),n=vS(e.domains),r=vS(e.emergencyAccess),i=vS(e.oauth2ProviderRestrictions);return t.requireSSO===!0||_S(n.verifiedDomains)||_S(n.ssoEnabledDomains)||_S(r.breakGlassAccounts)||_S(i.allowedProviders)||_S(i.blockedProviders)||i.requireEnterpriseSSOOnly===!0||_S(e.socialCredentialOverrides)}},Ule={key:`siem-export-enabled`,resourceType:ul.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ,matches:e=>e.enabled===!0},Wle={key:`webhook-config-configured`,resourceType:ul.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ,matches:e=>e.enabled===!0||_S(e.endpoints)},Gle=e=>!1;function yS(){let e=rS(),t=Zp(),n=dS(),r=(0,Q.useContext)(gh),i=r?.resolvedFeatures,a=r?.isFeatureOffered??Gle,o=Yh(),s=!!r&&r.isLoading!==!0&&(t?.currentOrganizationId??null)===r.resolvedForOrganizationId,c=a(ks.SINGLE_SIGN_ON),l=s&&!c,u=uS(Vle,l,n),d=uS(Hle,l,n),f=c||u||d,p=a(ks.DIRECTORY_PROVISIONING),m=gS(),h=Ble(),g=Rle(s&&wv({featureOffered:p,organizationTypeKnown:m!==void 0,organizationTypeDirectoryProvisioned:h}),n),_=(0,Q.useMemo)(()=>Tv({featureOffered:p,organizationTypeDirectoryProvisioned:h,holdsUnrevokedToken:g}),[p,h,g]),v=a(ks.SECURITY_EVENT_EXPORT),y=uS(Ule,s&&!v,n),b=v||y,x=a(ks.M2M_WEBHOOK_DELIVERY),S=uS(Wle,s&&!x,n),C=x||S,w=hS(),T=zle(),E=(0,Q.useContext)(Fi)?.appConfig?.decisionInbox,D=Object.keys((0,Q.useContext)(Fi)?.appConfig?.professionalQualificationKinds??{}).length>0,O=(0,Q.useMemo)(()=>qv({offer:E,effectiveRoles:n}),[E,n]);return(0,Q.useMemo)(()=>({activeMode:e?.activeMode??null,availableModes:e?.availableModes??[],allScopeValues:t?.allScopeValues??{},effectiveRoles:n,resolvedFeatures:i?.features??[],runtimeCapabilities:{billingEnabled:!!o?.isEnabled,ssoEnabled:f,..._,siemEnabled:b,webhooksEnabled:C,...w,...T,...O,[kv]:D}}),[e?.activeMode,e?.availableModes,t?.allScopeValues,n,i?.features,o?.isEnabled,f,_,b,C,w,T,O,D])}function bS(e,t){return(e?.requiredCapabilities??[]).every(e=>!!t.runtimeCapabilities[e])&&Im(e?.requiredRoles,t.effectiveRoles)}function xS(e,t){return e.flatMap(e=>bS(e.runtimeAvailability,t)?e.children?.length?[{...e,children:xS(e.children,t)}]:[e]:[])}function Kle(e,t){return{...e,children:xS(e.children,t)}}function qle(e,t){if(!e?.length)return e;let n=[];for(let r of e)bS(r.runtimeAvailability,t)&&(r.contentKind===ze.NAVIGATION_LIST?n.push(Kle(r,t)):n.push(r));return n}function Jle(e,t){return SS(e,t)}function SS(e,t){return e?.length?e.filter(e=>bS(e.runtimeAvailability,t)):e}function Yle(e,t){return SS(e,t)}function Xle(e,t){return SS(e,t)}function Zle(e,t){return SS(e,t)}function Qle(e,t){return SS(e,t)}function $le(e,t){return SS(e,t)}var CS=as.getLogger(),wS=new Set,TS=(0,Q.createContext)(null);function ES(){let{emit:e}=Mo(),{resourceRelationshipDepth:t,getZoneDepth:n,getZoneState:r,contentAreaWidth:i}=zx(),{navigationLayout:a,currentBreakpoint:o,compositeViews:s,fullCustomViews:c,flowsActorsViews:l}=Wg(),{user:u}=pg(),d=Zp(),{registry:f,getOperationContextNeeds:p}=fm(),m=oh(),h=pS(),g=(0,Q.useRef)(0),_=mg(),v=(0,Q.useRef)(dh.buildBrowserUrl(_.pathname,_.search));v.current=dh.buildBrowserUrl(_.pathname,_.search);let y=Ux(),b=(0,Q.useCallback)((t=Cl.PRIMARY)=>{if(r(t).stack.length===0)return;if(t===rr.OVERLAY){e(Ec.NAVIGATION_POP,{zone:t});return}let n=dh.resolveGoBackTarget({zone:t,currentBrowserUrl:v.current,getZoneState:r});n&&(e(Ec.NAVIGATION_POP,{zone:t}),n.browserUrl&&qx(m,n.browserUrl,!0))},[e,r,m]),x=(0,Q.useCallback)(t=>{let n=++g.current;(async()=>{let{content:_,initiator:x,urlPath:S,contextResourceIdentifiers:C,relationshipTransition:w,relationshipMaxDepth:T,replaceBrowserHistory:E}=t;try{if(Gx(`navigate() called`,{contentType:_.contentType,sourceZone:x.sourceZone,urlPath:S}),_.contentType===sd.SETTINGS_HUB){m(S??Ln.settings);return}if(!a){Gx(`navigate() aborted: no navigationLayout`);return}let t=tm.extractPrimaryScopeFromContent(_,f,s,c,l),D=tm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId}),O=tm.primaryScopeToContextIdentifiers(D,t),k=d?.buildContextResourceIdentifiers()??{},A=dh.isResourceOperationContent(_)?_.resourceContext.contextResourceIdentifiers??{}:{},j={...O,...k,...A,...C},M={};for(let[e,t]of Object.entries(j)){let n=On.getResourceId(t);if(n){M[e]=n;let r=On.getFieldIdentifier(t);r&&(M[r]=n)}}let N=!1,P=Jx(_),F=P.operationSurface,I,ee,L=_;if(dh.isResourceOperationContent(_)){let e=_.resourceContext.operation;if(F===Pu.API_ONLY){CS.error(`[useNavigationController] refused navigation to API_ONLY (headless) operation — it has no rendered interface`,{resourceType:_.resourceContext.resourceType,operationIdentifier:String(e?.operationIdentifier),sourceZone:x.sourceZone});return}let t=_.resourceContext.resourceType,r=f.resourceConfigurations?.[t];if(r){let n=Eh({initiatorInfos:e.initiatorInfos,targetResourceType:t,registry:f,ownIdentifiers:{...A,...C},tenancyIdentifiers:O,parentResourcesRequirements:_.resourceContext.parentResourcesRequirements}),i=dh.resolveResourceUrl(r,e,M,f.allResourceFieldIdentifiers,n??_.resourceContext.parentResourcesRequirements,n!==void 0);i&&(i.templateUrl,I=i.routePathParameters,ee=i.resolvedUrl)}N=Kx(e)&&!!(ee??S);let i=new Set((I??[]).map(e=>e.resourceType));if(`enabledCondition`in e&&e.enabledCondition&&p(e).needsUserContext&&!u){console.warn(`[useNavigationController] Navigation blocked: enabledCondition requires user context but user is missing`,{resourceType:t,operationIdentifier:e.operationIdentifier});return}if(n!==g.current){Gx(`navigate() aborted: superseded before state mutation`,{requestId:n,latestRequestId:g.current,sourceZone:x.sourceZone});return}let a={};for(let[e,t]of Object.entries({...O,...k}))(i.size===0||i.has(e))&&(a[e]=t);let o=_.resourceContext.contextResourceIdentifiers?.[t];L={..._,resourceContext:{..._.resourceContext,contextResourceIdentifiers:{...a,...C,...o?{[t]:o}:{},..._.resourceContext.contextResourceIdentifiers}}}}else if(_.contentType===sd.COMPOSITE_VIEW||_.contentType===sd.CHART_VIEW||_.contentType===sd.FULL_CUSTOM_VIEW||_.contentType===sd.EXECUTION_VIEW||_.contentType===sd.FLOWS_ACTORS_VIEW){let e={..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}else if(_.contentType===sd.CUSTOM_COMPONENT){let e={...O,...k,..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}x.sourceZone===`appLevel`&&(rg(e,`app_level_navigation`),Gx(`APP_LEVEL clean break: cleared SECONDARY + COMPANION + OVERLAY`)),dh.isResourceOperationContent(L)&&dh.calculateResourceRelationshipDepth(L.resourceContext.parentResourcesRequirements);let R={},z={};for(let e of pr){let t=r(e).stack.length;z[e]=t,R[e]=t>0}let te=x.sourceZone,ne=P.operation,re=P.effectiveOperation,ie=P.resourceType,ae=te!==`appLevel`&&te!==rr.OVERLAY?te:void 0,oe={sourceZone:te,...P,relationshipTransition:w,relationshipMaxDepth:T,viewport:o,contentAreaWidth:i,zoneOccupancy:R,zoneDepth:z,focusedZone:ae},se=Nm.resolve(oe,a),ce=se.provenance.adjustments.includes(cn.PERSISTENT_SPLIT_ESCALATED_NO_COMPANION);if(ce||se.provenance.adjustments.includes(cn.SPLIT_ESCALATED_NO_ADJACENT_ZONE)){let e=`${ie??`view`}:${ne}`;wS.has(e)||(wS.add(e),CS.warn(ce?"Navigation: a PERSISTENT split was declared for this operation and the layout declares no `companion` zone — a persistent split targets `companion` specifically and does not fall back to `secondary`, so it opened as an overlay.":"Navigation: a SPLIT was declared for this operation and the layout declares no `secondary` or `companion` zone — it opened as an overlay instead of beside its source.",{resourceType:ie,operation:ne,decidedBy:se.provenance.transitionSource,remedy:ce?"Declare `zones.companion` in the navigation layout, or drop `persistent` so the split may use `secondary`.":"Declare `zones.secondary` in the navigation layout, or change this operation's transition to PUSH, REPLACE or OVERLAY."}))}if(Gx(`Policy resolved`,{targetZone:se.targetZone,transition:se.transition,decidedBy:se.provenance.transitionSource,authoredAs:se.provenance.authoredTransition,adjustments:se.provenance.adjustments,appearance:se.appearance,collapsed:se.collapsed,collapsedFromZone:se.collapsedFromZone,ephemeral:se.ephemeral,persistent:se.persistent}),se.transition===Rt.INPLACE){let e=dh.isResourceOperationContent(L)?eue(L,re):void 0;if(e&&y.isAvailable){Gx(`INPLACE resolved to the element-level host`,{kind:e.kind}),y.open(e);return}Gx(`INPLACE has no element-level host here — degrading to overlay`,{hasTarget:!!e,hostAvailable:y.isAvailable}),se=Nm.degradeInPlaceToOverlay(oe,a,se)}se.transition===Rt.PROMOTE&&(rg(e,`promote_navigation`),Gx(`PROMOTE clean break: cleared SECONDARY + COMPANION + OVERLAY`)),x.sourceZone===rr.OVERLAY&&se.targetZone!==rr.OVERLAY&&se.transition!==Rt.PROMOTE&&(Sh(e,`overlay_breakout_navigation`),Gx(`OVERLAY breakout: closed the overlay it was launched from`,{targetZone:se.targetZone,transition:se.transition})),(se.targetZone===Cl.SECONDARY||se.targetZone===Cl.COMPANION)&&dh.isResourceOperationContent(L)&&Qx(L,se.targetZone,f,M,e,m,r,{viewerMayPerform:h});let le=dh.generateStackEntryId(),ue=ee??S,de=se.targetZone!==rr.OVERLAY,fe=L.contentType===sd.EXECUTION_VIEW&&Dp({viewRef:L.viewRef,registry:f})?.isAddressable===!0,pe=L.contentType===sd.COMPOSITE_VIEW||L.contentType===sd.CHART_VIEW||L.contentType===sd.FULL_CUSTOM_VIEW||fe||L.contentType===sd.FLOWS_ACTORS_VIEW||L.contentType===sd.ENGINE_PAGE,me=de&&!!ue&&(N||pe),he=me?L.contentType===sd.COMPOSITE_VIEW?kp(L.viewRef,L.contextResourceIdentifiers):L.contentType===sd.CHART_VIEW?Vp(L.viewRef,L.contextResourceIdentifiers,L.urlParamValues):L.contentType===sd.EXECUTION_VIEW?Lp(L.viewRef,L.contextResourceIdentifiers):ue:void 0,ge=dh.getTopEntry(r(Cl.PRIMARY)),_e=se.targetZone===Cl.SECONDARY&&me&&he!==void 0&&dh.hostedPaneApplies({paneContent:L,primaryTop:ge}),ve={zone:se.targetZone,content:L,urlPath:he,stackEntryId:le,initiator:x,navigationSource:Qi.CONTROLLER,transition:se.transition,appearance:se.appearance,overlayBehavior:se.overlayBehavior,ephemeral:se.ephemeral,persistent:se.persistent,..._e?{hostedPane:!0}:{},...se.collapsedFromZone?{collapsedFromZone:se.collapsedFromZone}:{}},ye=se.targetZone===rr.OVERLAY&&x.sourceZone===rr.OVERLAY,be=se.transition===Rt.PUSH||ye,xe=de?r(se.targetZone):void 0,Se=xe&&xe.activeTabId===void 0?xe.stack[xe.stack.length-2]:void 0;if(se.transition===Rt.PUSH&&he!==void 0&&Se?.urlPath&&dh.urlsAddressSameDestination(Se.urlPath,he)){Gx(`PUSH names the entry beneath — going back instead`,{zone:se.targetZone,finalUrlPath:he}),b(se.targetZone);return}Gx(`Emitting navigation event`,{event:be?`PUSH`:`REPLACE`,zone:se.targetZone,finalUrlPath:he,hostedPane:_e,stacksOnOverlay:ye}),Jh(()=>{if(e(be?Ec.NAVIGATION_PUSH:Ec.NAVIGATION_REPLACE,ve),me&&he){let e=E===!0||se.transition===Rt.REPLACE||se.transition===Rt.PROMOTE,t=_e||se.targetZone===Cl.COMPANION?dh.resolveBrowserUrlForZoneEntry({zone:se.targetZone,entryUrlPath:he,paneContent:L,currentBrowserUrl:v.current,getZoneState:r})??he:he;qx(m,t,e)}},{zone:se.targetZone})}catch(e){CS.error(`useNavigationController navigation failed`,{error:e,requestId:n,sourceZone:x.sourceZone,contentType:_.contentType,urlPath:S,resourceType:dh.isResourceOperationContent(_)?_.resourceContext.resourceType:void 0,operationIdentifier:dh.isResourceOperationContent(_)?_.resourceContext.operation?.operationIdentifier:void 0})}})()},[e,a,o,u,d,f,s,c,l,p,m,r,i,y,b]),S=(0,Q.useCallback)((e,t,n,r)=>{let i={contentType:sd.RESOURCE_OPERATION,resourceContext:e};x({content:i,initiator:t,urlPath:n,relationshipTransition:r})},[x]),C=(0,Q.useCallback)(()=>{let t=dh.getTopEntry(r(rr.OVERLAY));t&&e(Ec.NAVIGATION_CLOSE,{zone:rr.OVERLAY,stackEntryId:t.id})},[e,r]),w=(0,Q.useCallback)(t=>{if(t===Cl.PRIMARY||r(t).stack.length===0)return;let n=dh.resolveZoneDismissUrl({zone:t,currentBrowserUrl:v.current,getZoneState:r});e(Ec.NAVIGATION_CLEAR_ZONE,{zone:t}),n&&qx(m,n,!0)},[e,r,m]),T=(0,Q.useCallback)(e=>n(e)>1,[n]);return(0,Q.useMemo)(()=>({navigate:x,navigateToResource:S,goBack:b,closeOverlay:C,dismissZone:w,canGoBack:T,resourceRelationshipDepth:t}),[x,S,b,C,w,T,t])}function eue(e,t){let n=e.resourceContext,r=n.operation;if(!r)return;if(t===W.CREATE||t===W.CREATE_MANY)return{kind:Bx.CREATE,operation:r,resourceContext:n};let i=On.getAddressedRecordId(n);return i?{kind:Bx.ELEMENT,elementId:i,operation:r,resourceContext:n}:void 0}function DS(){let e=(0,Q.useContext)(TS),t=ES();return e??t}function OS(){let{registry:e}=fm(),{navigateToResource:t}=DS(),n=(0,Q.useCallback)(n=>{let{resourceType:r,resourceId:i,contextResourceIdentifiers:a={},sourceZone:o=Cl.PRIMARY}=n;if(!i)return!1;let s=e.resourceConfigurations[r];if(!s)return!1;let c=On.buildRecordIdentifiersFromCollection(a,r,i),l=tue(s,e,c);return l?(t(On.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:l,contextResourceIdentifiers:c}),{sourceZone:o,sourceOperation:W.READ}),!0):!1},[e,t]);return(0,Q.useMemo)(()=>({navigateToResourceRead:n}),[n])}function tue(e,t,n){let r=r=>ph({resourceConfig:e,operations:e?.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:r,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,t)}),i=r(!0);if(i)return i;let a=r(!1);return a?.operationFrontendConfig?.surface===Pu.EMBEDDED?a:void 0}function kS(e,t){let n=e.filterFields;return n&&Object.keys(n).length>0||vl(e)!==W.LIST?n:t.find(e=>String(e.operationIdentifier)===W.SEARCH&&e.isOperationDefault===!0)?.filterFields}function nue(e,t){if(typeof t==`string`)return e.some(e=>String(e.operationIdentifier)===t);let[n,r]=t;return e.some(e=>String(e.operationIdentifier)===n&&e.variantKey===r)}function rue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a,board:o}=t;if(i===_u.BOARD&&!o)return`displayMode BOARD requires collectionDisplayConfig.board: { groupByField } naming the enum field its columns come from`;if(!o)return;if(i!==_u.BOARD&&a!==!0)return`collectionDisplayConfig.board is read only when displayMode is BOARD or userSwitchableDisplayMode offers it; declare one of them or remove board`;let s=kS(n,r);if(!s||!Object.hasOwn(s,o.groupByField))return`board.groupByField "${o.groupByField}" is not a filter field of this operation; the columns come from that filter field's enum values`;if(o.transitionOperation!==void 0&&!nue(r,o.transitionOperation))return`board.transitionOperation ${JSON.stringify(o.transitionOperation)} names no operation this resource's frontend registry holds`}var iue=[{mode:_u.CALENDAR,configKey:`calendar`,shape:`{ dateField }`,fields:e=>e.calendar?[[`calendar.dateField`,e.calendar.dateField]]:void 0},{mode:_u.TIMELINE,configKey:`timeline`,shape:`{ startField, endField }`,fields:e=>e.timeline?[[`timeline.startField`,e.timeline.startField],[`timeline.endField`,e.timeline.endField]]:void 0}];function aue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a}=t;for(let e of iue){let o=e.fields(t);if(i===e.mode&&!o)return`displayMode ${e.mode.toUpperCase()} requires collectionDisplayConfig.${e.configKey}: ${e.shape}`;if(!o)continue;if(i!==e.mode&&a!==!0)return`collectionDisplayConfig.${e.configKey} is read only when displayMode is ${e.mode.toUpperCase()} or userSwitchableDisplayMode offers it; declare one of them or remove ${e.configKey}`;if(e.mode===_u.TIMELINE&&o[0][1]===o[1][1])return`timeline.startField and timeline.endField both name "${o[0][1]}"; a bar runs from one date field to ANOTHER, and one field holds a day, not a span (show it on a calendar)`;let s=kS(n,r);for(let[t,n]of o)if(!s||!Object.hasOwn(s,n))return`${t} "${n}" is not a filter field of this operation; the ${e.configKey} asks for its visible dates as a window on that filter field`}}function AS(e){return e?._zod?.def?.type===`object`}function jS(e,t){let n=t[hn]??{},r=e[hn]??{};return Object.fromEntries(Object.entries(n).filter(([e,t])=>r[e]!==t))}function MS(e,t){let n=Fa(e,[]);return n[hn]={...n[hn]??{},...t},n}function NS(e,t,n,r={}){if(n===t)return e;if(!AS(e)||!AS(t)||!AS(n))return n;let i=ka(e),a=ka(t),o=ka(n),s={};for(let[e,t]of Object.entries(o)){let n=a[e],r=i[e];if(n===void 0||r===void 0||t===n||r===t)continue;if(r===n){s[e]=t;continue}let o=jS(n,t);Object.keys(o).length>0&&(s[e]=MS(r,o))}let c=Object.keys(s).length===0?e:Ka(e,s);if(r.objectLevel){let r=jS(t,n);if(Object.keys(r).length>0){if(c===e)c=MS(e,r);else{let e=c;e[hn]={...e[hn]??{},...r}}}}return c}function oue(e,t){try{let n=ka(e),r=ka(t);return Object.entries(n).some(([e,t])=>{let n=r[e];return n?t===n||lr(t)===n:!1})}catch{return!1}}function PS(e,t,n){if(!e)return;let r=hr.getObjectLikeFieldShape(e,{commonOnly:!1}),i=hr.getObjectLikeFieldShape(t,{commonOnly:!1});if(r&&i)for(let[e,t]of Object.entries(r)){let r=i[e];if(!r||!t||t===r||n.has(t))continue;let a=Vl(r);if(Object.keys(a).length===0)continue;let o=Vl(t);Object.keys(a).some(e=>!(e in o)||o[e]!==a[e])&&(t[hn]={...o,...a})}}var sue=[Zt.IS_FOREIGN_KEY,Zt.FOREIGN_KEY_UI];function cue(e,t){if(!e||!t)return e;let n=hr.getObjectLikeFieldShape(e,{commonOnly:!1}),r=hr.getObjectLikeFieldShape(t,{commonOnly:!1});if(!n||!r)return e;let i=new Map;for(let[e,t]of Object.entries(n)){let n=r[e];if(!t||!n||!Lc(n)||Lc(t)||me(t)===vu.ARRAY!=(me(n)===vu.ARRAY))continue;let a=Vl(n),o={};for(let e of sue)e in a&&(o[e]=a[e]);let s=Fa(t,[]);s[hn]={...Vl(t),...o},i.set(t,s)}return i.size===0?e:lue(e,i)}function lue(e,t){let n=new Map,r=new Set,i=e=>{let a=t.get(e);if(a)return a;let o=n.get(e);if(o)return o;if(r.has(e))return e;r.add(e);let s=ba(e,i);return r.delete(e),n.set(e,s),s};return i(e)}function uue(e){let t=yae.get(e)?.[dee];return typeof t==`string`?t:void 0}function due(e,t,n){let r=new Map,i=new Map,a=new Map,o=(e,t)=>{let s=uue(e)??t,c=(n.get(s)??r).get(e);if(c)return c;let l=i.get(s);l||i.set(s,l=new Map);let u=l.get(e);if(u)return u;let d=a.get(s);if(d||a.set(s,d=new Set),d.has(e))return e;d.add(e);let f=ba(e,e=>o(e,s));return d.delete(e),l.set(e,f),f};return o(e,t)}function FS(e,t,n){if(!e||!t||e===t||typeof e!=`object`||typeof t!=`object`)return;let r=e._zod?.def,i=t._zod?.def;if(!r||!i||r.type!==i.type||n.has(e))return;if(n.set(e,t),r.type===`object`){let e=r.shape,t=i.shape;for(let r of Object.keys(e))FS(e[r],t[r],n);return}for(let e of[`innerType`,`element`,`valueType`,`in`,`out`])FS(r[e],i[e],n);let a=r.options,o=i.options;Array.isArray(a)&&Array.isArray(o)&&a.length===o.length&&a.forEach((e,t)=>FS(e,o[t],n))}function IS(e,t){if(e===void 0)return;let n=!1,r=e.inheritedSchemas.map(e=>{let r=t(e.schema),i=IS(e.inheritenceSchemaDefinition,t);return r===e.schema&&i===e.inheritenceSchemaDefinition?e:(n=!0,{...e,schema:r,...i===void 0?{}:{inheritenceSchemaDefinition:i}})});return n?{...e,inheritedSchemas:r}:e}function LS(e,t,n){for(let t of Object.values(ka(e)??{}))n.add(t);for(let e of t?.inheritedSchemas??[])LS(e.schema,e.inheritenceSchemaDefinition,n)}function fue(e,t,n){if(e===void 0||n===t)return e;let r=e=>e._zod?.def?.type===`object`;return!r(t)||!r(n)?e:IS(e,e=>r(e)?NS(e,t,n):e)}var RS=class{httpClient;registry=null;isInitialized=!1;declaredFieldInstancesByResource=new Map;presentationSubstitutionsByResource=new Map;resourcesHttpClient=null;constructor(e){this.httpClient=e}buildConfigurationError(e,t){let n=Vu.buildWildoError_Frontend(Va.CONFIGURATION,{customMessageReference:e,context:t}),r=Error(e);return r.wildoError=n,r}async initializeResources(e,t,n,r,i,a){if(!this.isInitialized)try{let o={...t,...bre},s=[...n||[],...Yte],c=G_(s);if(c.length>0)throw this.buildConfigurationError(Xl.CONFIGURATION,{message:`${c.length} relationship edge(s) registered more than once:\n`+c.map(e=>` • ${e.message}`).join(`
4
- `),duplicatedEdges:c.map(e=>`${String(e.parentResourceType)} → ${String(e.childResourceType)} (×${e.occurrences})`)});let l=Ul.ensureCompiledRelationships.call(Ul,s,o),u=[...r??[]].filter(e=>iu.has(e));u.length>0&&console.warn(`[ResourcesRepository] Refusing to exclude ${u.join(`, `)}: the engine's own runtime reads these to restore an authenticated session, so honouring the exclusion would make login succeed and then immediately bounce back to the login form. They stay registered.`);let d=u.length>0?new Set([...r??[]].filter(e=>!iu.has(e))):r,f={};e&&Object.keys(e).length>0&&Object.entries(e).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(f[e]=t(l))});let p={};ui&&Object.keys(ui).length>0&&Object.entries(ui).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(p[e]=t(l))});let m={...p,...f};if(d&&d.size>0){m=Object.fromEntries(Object.entries(m).filter(([e])=>!d.has(e))),l=l.filter(e=>!d.has(e.resourceType1)&&!d.has(e.resourceType2));for(let e of d)delete o[e]}this.normalizeResourceConfigurationRelationships(m,o);let h=this.buildFrontendResourceConfigurations(m,o,i);Iie(h,l,o),us.rebuildResourceConfigurationsOperationDtos(h),this.overlayUiBehaviorDtoDecorators(h,i),this.substitutePresentationIntoCustomDtos(h),this.carryReferenceIdentityOntoCustomRequestDtos(h);let g=Ul.buildFieldIdentifierToResourceTypeMap({allResourceFieldIdentifiers:o,allResourceRelationships:l,getMainSchema:e=>h[e]?.mainSchema,fieldIdentifierPriority:jie,onForeignKeyCollision:({foreignKeyField:e,existingType:t,referencedResourceType:n})=>{console.error(`[ResourcesRegistry] FK field "${e}" is reused by different holders referencing "${t}" and "${n}". Keeping "${t}". Use distinct foreignKeyField names to disambiguate.`)}}),_=Ul.buildManyToManyScopeJunctionMap(l,o);this.registry={allResourceFieldIdentifiers:o,fieldIdentifierToResourceType:g,manyToManyScopeJunctions:_,notificationBadgeDefinitions:[...V_,...a??[]],additionalUserNotificationDefinitions:[],resourceRelationships:l,resourceConfigurations:h,subtreeMap:J_(l)},this.generateUrlsForApiCallOperations(h,o),this.resourcesHttpClient=new Lx(this.registry,{baseURL:this.httpClient.getBaseURL(),timeout:3e4,enableNetworkQueue:!0}),this.validateForeignKeyResolution(h,g),this.validateResourceOwnedViewRefUniqueness(h),this.validateFileDisplayPolicyCoherence(h),this.isInitialized=!0}catch(e){throw e?.wildoError?e:this.buildConfigurationError(Xl.CONFIGURATION,{message:`Failed to initialize frontend resources: ${mo(e)}`})}}normalizeResourceConfigurationRelationships(e,t){for(let n of Object.values(e))n.resourceRelationships={parentRelationships:Ul.ensureCompiledRelationships.call(Ul,n.resourceRelationships.parentRelationships,t),childRelationships:Ul.ensureCompiledRelationships.call(Ul,n.resourceRelationships.childRelationships,t),selfRelationships:Ul.ensureCompiledRelationships.call(Ul,n.resourceRelationships.selfRelationships,t)}}carryReferenceIdentityOntoCustomRequestDtos(e){for(let t of Object.values(e))for(let e of t.operations??[])e.hasCustomRequestDto&&(e.requestDto=cue(e.requestDto,t.mainSchema))}presentSchemas(e,t,n){let r=t.mainSchema,i=t.inheritenceSchemaDefinition;if(n.mainSchema===r&&n.inheritenceSchemaDefinition===i)return;let a=t;a.mainSchema=n.mainSchema,a.inheritenceSchemaDefinition=n.inheritenceSchemaDefinition;for(let e of t.operations??[])e.mainSchema===r&&(e.mainSchema=n.mainSchema);let o=new Map;FS(r,n.mainSchema,o);let s=(e,t)=>{e?.inheritedSchemas.forEach((e,n)=>{let r=t?.inheritedSchemas[n];FS(e.schema,r?.schema,o),s(e.inheritenceSchemaDefinition,r?.inheritenceSchemaDefinition)})};if(s(i,n.inheritenceSchemaDefinition),o.size===0)return;let c=new Map;for(let[t,n]of this.presentationSubstitutionsByResource.get(e)??[])c.set(t,o.get(n)??n);for(let[e,t]of o)c.has(e)||c.set(e,t);this.presentationSubstitutionsByResource.set(e,c)}substitutePresentationIntoCustomDtos(e){if(this.presentationSubstitutionsByResource.size!==0){for(let[t,n]of Object.entries(e))if(n?.operations)for(let e of n.operations)for(let[n,r]of[[`hasCustomResponseDto`,`responseDto`],[`hasCustomResponseDto`,`contextDto`],[`hasCustomRequestDto`,`requestDto`]]){let i=e[r];e[n]&&i&&(e[r]=due(i,t,this.presentationSubstitutionsByResource))}}}overlayUiBehaviorDtoDecorators(e,t){if(t)for(let[n,r]of Object.entries(t)){let t=r[Di];if(!t)continue;let i=this.declaredFieldInstancesByResource.get(n)??new Set,a=e[n];if(a?.operations)for(let e of a.operations)e.hasCustomResponseDto||(PS(e.responseDto,t,i),PS(e.contextDto,t,i)),e.hasCustomRequestDto||PS(e.requestDto,t,i),PS(e.summaryDto,t,i)}}buildFrontendResourceConfigurations(e,t,n){let r={};for(let[t,n]of Object.entries(e))r[t]={...n,operations:(n.operations??[]).filter(e=>e.variantType===at.API_CALL).map(e=>({...e,operationFrontendConfig:void 0})),frontendConfiguration:void 0};if(n)for(let[e,i]of Object.entries(n)){let n=r[e];if(!n){console.warn(`[ResourcesRegistry] Frontend preset references resource "${e}" which has no backend configuration. Skipping.`);continue}let{views:a,relationshipOverrides:o,compositeViews:s,executionViews:c,...l}=i,u=i[Di],d=new Set;if(LS(n.mainSchema,n.inheritenceSchemaDefinition,d),this.declaredFieldInstancesByResource.set(e,d),u&&u!==n.mainSchema){let t=n.mainSchema,r=NS(t,i[Yu]??t,u,{objectLevel:!0});if(this.presentSchemas(e,n,{mainSchema:r,inheritenceSchemaDefinition:fue(n.inheritenceSchemaDefinition,t,r)}),r!==t)for(let e of n.operations){if(!e.requestDto)continue;let n=e.resourceOperationLike?String(e.resourceOperationLike):String(e.operationIdentifier);(n===W.CREATE||n===W.UPDATE)&&!e.hasCustomRequestDto&&oue(e.requestDto,t)&&(e.requestDto=Oe(n,r,void 0))}}if((n.recordLabelFields?.length??0)>0&&l.getFrontendResourceLabel!==void 0)throw Error(`[ResourcesRegistry] Resource "${e}" names its records twice: \`recordLabelFields\` (${n.recordLabelFields.join(`, `)}) and its ui-behavior's getFrontendResourceLabel. A record has one name, which a chat shows too: remove getFrontendResourceLabel (the application names it by recordLabelFields), or remove recordLabelFields if the resource has no chat command that names its records.`);let f=this.buildResourceCompositeViewDefinitions(e,n.resourcePrimaryScope??Vr.ORGANIZATIONS,s),p=this.buildResourceExecutionViewDefinitions(n.resourcePrimaryScope??Vr.ORGANIZATIONS,c);if(n.frontendConfiguration={...l,...f.length>0&&{compositeViews:f},...p.length>0&&{executionViews:p}},a)for(let[e,t]of a){let r=this.findOperationByPresetKey(n.operations,e);r&&(r.operationFrontendConfig=t)}o&&o.length>0&&this.resolveRelationshipDisplayOverrides(e,n.resourceRelationships,o,t)}for(let[e,t]of Object.entries(r))for(let n of t.operations){if(n.operationFrontendConfig===void 0){n.operationFrontendConfig={surface:n.defaultFrontendPosture??(n.isBulkOperation?Pu.EMBEDDED:Pu.API_ONLY)};continue}if(n.operationFrontendConfig.surface===Pu.API_ONLY){let t=n.operationFrontendConfig;if(t.actionVisibility!==void 0||t.runtimeAvailability!==void 0||t.actionPlacement!==void 0||t.actionPresentation!==void 0||t.actionVariant!==void 0||t.customView!==void 0||t.displayPresetOverride!==void 0||(t.navigationOverrides?.length??0)>0||t.displayPriority!==void 0||t.iconOverride!==void 0||t.collectionDisplayConfig!==void 0||t.hasDescription!==void 0)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}" declares surface API_ONLY (headless) but carries view-only frontend config (action/layout/icon/customView). A headless operation has no UI surface — drop the view fields, or change its surface to ADDRESSABLE/EMBEDDED.`)}let r=rue({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(r)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${r}.`);let i=aue({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(i)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${i}.`)}for(let[e,n]of Object.entries(r))this.deriveForeignKeyDisplayFromRelationships(e,n,t);return console.info(`[ResourcesRegistry] Frontend registry built: ${Object.keys(r).length} resource(s) total, ${n?Object.keys(n).length:0} with UI behavior.`),r}buildResourceCompositeViewDefinitions(e,t,n){return n?Object.entries(n).map(([n,r])=>({ref:n,translationRef:pp(e,n),scope:em.RESOURCE,isAddressable:!0,operationLike:r.operationLike??W.READ,primaryScope:t,sectionRefs:r.sectionRefs,viewComponent:r.viewComponent,icon:r.icon})):[]}buildResourceExecutionViewDefinitions(e,t){return t?Object.entries(t).map(([t,n])=>({ref:t,scope:em.RESOURCE,isAddressable:n.isAddressable??!0,primaryScope:n.primaryScope??e,parentResourcesRequirements:n.parentResourcesRequirements,additionalResourceRequirements:n.additionalResourceRequirements,anchor:n.anchor,surfaceInOperations:n.surfaceInOperations,participations:n.participations,viewComponent:n.viewComponent,requiredFeatures:n.requiredFeatures,labels:n.labels,icon:n.icon,launcher:n.launcher,zoneContentMaxWidth:n.zoneContentMaxWidth,zoneContentFillsHeight:n.zoneContentFillsHeight})):[]}resolveRelationshipDisplayOverrides(e,t,n,r){for(let i of n){let n=[];for(let e=0;e<t.childRelationships.length;e++){let r=t.childRelationships[e];r.resourceType2===i.target&&n.push({bucket:t.childRelationships,index:e,rel:r,bucketName:`childRelationships`})}for(let e=0;e<t.parentRelationships.length;e++){let r=t.parentRelationships[e];r.resourceType1===i.target&&n.push({bucket:t.parentRelationships,index:e,rel:r,bucketName:`parentRelationships`})}for(let e=0;e<t.selfRelationships.length;e++){let r=t.selfRelationships[e];r.resourceType1===i.target&&n.push({bucket:t.selfRelationships,index:e,rel:r,bucketName:`selfRelationships`})}if(n.length>1){let e=n.filter(({rel:e})=>e.accessScopeStrategy!==are.STANDALONE);e.length>0&&(n.length=0,n.push(...e))}if(i.foreignKeyField&&n.length>0){let e=n.filter(({rel:e})=>Ul.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier===i.foreignKeyField);n.length=0,n.push(...e)}if(n.length===0){if(xa.isDevelopment()){let n=[...t.childRelationships.map(e=>`${e.resourceType2} (FK: ${Ul.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.parentRelationships.map(e=>`${e.resourceType1} (FK: ${Ul.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.selfRelationships.map(e=>`${e.resourceType1} (FK: ${Ul.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`)];console.warn(`[RelationshipDisplay] Resource "${e}" has no relationship with "${i.target}"${i.foreignKeyField?` (FK: ${i.foreignKeyField})`:``}. Available relationships: [${n.join(`, `)}]. Override ignored.`)}continue}if(n.length>1&&!i.foreignKeyField){if(xa.isDevelopment()){let t=n.map(({rel:e})=>Ul.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`);console.warn(`[RelationshipDisplay] Resource "${e}" has ${n.length} relationships with "${i.target}" (FK fields: [${t.join(`, `)}]). Provide foreignKeyField to disambiguate. Override ignored.`)}continue}n.length>1&&i.foreignKeyField&&xa.isDevelopment()&&console.warn(`[RelationshipDisplay] Resource "${e}" has ${n.length} relationships with "${i.target}" even after FK field "${i.foreignKeyField}" filtering. Applying to first match.`);let{bucket:a,index:o,rel:s}=n[0],c={...s,display:s.display?{...s.display}:void 0};i.inParentNavigation&&(c.display={...c.display,inParentNavigation:{...c.display?.inParentNavigation,...i.inParentNavigation}}),i.inChildView&&(c.display={...c.display,inChildView:{...c.display?.inChildView,...i.inChildView}}),c.display&&=tn.parse(c.display),a[o]=c}}deriveForeignKeyDisplayFromRelationships(e,t,n){let{parentRelationships:r,selfRelationships:i}=t.resourceRelationships,a=[...r,...i];for(let r of a){if(r.resourceType1===r.resourceType2&&!r.foreignKeyField)continue;let i=Ul.tryResolveRelationshipForeignKeyIdentity(r,n)?.fieldIdentifier;if(!i)continue;let a=r.display?.inChildView?.parentDisplay??na.CONTEXT,o,s;switch(a){case na.CONTEXT:o=tt.LABEL,s=!0;break;case na.BREADCRUMB:o=tt.LABEL,s=!1;break;case na.BADGE:o=tt.LABEL,s=!1;break;case na.SUMMARY:o=tt.SUMMARY,s=!0;break;case na.NONE:o=tt.ID,s=!1;break;default:o=tt.LABEL,s=!0}let c={display:{mode:o,linkable:s}},l=e=>{let t=ka(e)?.[i];if(!t||!Lc(t)||Vl(t)[Zt.FOREIGN_KEY_UI]!==void 0)return e;let n=Fa(t,[{ref:Zt.FOREIGN_KEY_UI,params:c}]);return Ka(e,{[i]:n})};this.presentSchemas(e,t,{mainSchema:l(t.mainSchema),inheritenceSchemaDefinition:IS(t.inheritenceSchemaDefinition,l)})}}findOperationByPresetKey(e,t){if(Array.isArray(t)){let[n,r]=t;return e.find(e=>e.operationIdentifier===n&&e.variantKey===r)}let n=e.filter(e=>e.operationIdentifier===t),r=n.filter(e=>e.isOperationDefault===!0),i=r.length>0?r:n.filter(e=>!e.variantKey);if(i.length===0)return;if(i.length===1)return i[0];let a=i.filter(e=>e.isBulkOperation!==!0);if(a.length===1)return a[0];throw this.buildConfigurationError(Xl.CONFIGURATION,{operationIdentifier:t,candidateVariants:i.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation})),message:`Frontend preset operation key resolves to multiple URL-bearing variants. Use an explicit [operationIdentifier, variantKey] tuple or make the default operation identity unique.`})}generateUrlsForApiCallOperations(e,t){for(let[n,r]of Object.entries(e))try{Vn.updateOperationUrls(r,t)}catch(e){console.error(`Failed to generate URLs for resource type ${n}:`,e)}}getResourcesRegistry(){if(!this.isInitialized)throw this.buildConfigurationError(Xl.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesRegistry`});return this.registry}getAvailableResourceTypes(){return this.isInitialized?Object.keys(this.registry.resourceConfigurations):[]}getRegistryInfo(){return this.isInitialized?{registeredResourceTypes:Object.keys(this.registry.resourceConfigurations)}:{registeredResourceTypes:[]}}getResourcesHttpClient(){if(!this.isInitialized||!this.resourcesHttpClient)throw this.buildConfigurationError(Xl.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesHttpClient`});return this.resourcesHttpClient}getApplicationHttpClient(){return this.httpClient}validateForeignKeyResolution(e,t){let n=Ul.collectUnresolvableForeignKeyFields({mainSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.mainSchema])),variantSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,il(t.inheritenceSchemaDefinition)])),fieldIdentifierToResourceType:t});if(n.length>0){let e=n.map(({resourceType:e,fieldName:t})=>` - ${e}.${t}`).join(`
5
- `),t=`[ResourcesRegistry] ${n.length} FK field(s) cannot be resolved to a resource type:\n${e}\nFix: Declare a relationship with the corresponding foreignKeyField.`;if(console.error(t),xa.isDevelopment())throw this.buildConfigurationError(Xl.FRONTEND_FK_RESOLUTION_FAILED,{unresolvedFKFields:n,message:t})}}validateFileDisplayPolicyCoherence(e){let t=[];for(let[n,r]of Object.entries(e)){let e=[r.mainSchema,...il(r.inheritenceSchemaDefinition)].flatMap(e=>Object.entries(ka(e)??{})),i=new Set;for(let[r,a]of e){if(i.has(r))continue;let e=a,o=Ps(e);if(!o?.nature)continue;let s=yl(e);if(!s)continue;let c=s.presentation!==void 0&&s.presentation!==Vie.CARD,l=s.activation?.policy===Zu.OVERLAY;(c||l)&&$e(o.nature)===!1&&(i.add(r),t.push({resourceType:n,fieldName:r,nature:String(o.nature),requested:c?`presentation ${s.presentation}`:`activation overlay`}))}}if(t.length===0)return;let n=t.map(({resourceType:e,fieldName:t,nature:n,requested:r})=>` - ${e}.${t} (nature ${n}) requests ${r}`).join(`
6
- `),r=`[ResourcesRegistry] ${t.length} file field(s) request a display no displayer can satisfy:\n${n}\nFix: use presentation CARD (with a DOWNLOAD/NEW_TAB activation) for natures that have no viewer, or widen the declared FileNature if the field genuinely holds displayable files.`;if(console.error(r),xa.isDevelopment())throw this.buildConfigurationError(Xl.FRONTEND_FK_RESOLUTION_FAILED,{offendingFields:t,message:r})}validateResourceOwnedViewRefUniqueness(e){for(let t of Object.keys(e)){let n=new Map;for(let r of Sse({resourceType:t,registry:{resourceConfigurations:e}})){let e=n.get(r.viewRef)??[];e.push(r),n.set(r.viewRef,e)}for(let[e,r]of n.entries()){if(r.length<=1)continue;let n=r.map(e=>e.family).join(`, `);throw this.buildConfigurationError(Xl.CONFIGURATION,{component:`ResourcesRepositoryFrontendService.validateResourceOwnedViewRefUniqueness`,message:`Resource "${t}" declares resource-owned view ref "${e}" multiple times (${n}). RESOURCE_VIEW refs must be unique per resource-owned view namespace.`})}}}};function zS(e){return Ta.createOperationPathKeyFromOperation(e)}function BS(e){let t=e?.requiredFeatures;return t?Array.isArray(t)||!t.appliesWhen:!1}function VS(e){return!!(e.enabledCondition||e.requiredFeatures)}function HS(e,t,n){return(0,Q.useMemo)(()=>{let r={};return e&&(r.userId=e),t&&(r.organizationId=t),n&&(r.applicationId=n),Object.keys(r).length>0?r:void 0},[e,t,n])}function US(e){let{operation:t,currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0}=e,{getResourcesRegistry:s,doOperation:c}=fm(),{user:l,permissions:u}=pg(),d=Zp(),f=Yh(),p=s(),{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,isLoading:v}=Ch(),y=(0,Q.useMemo)(()=>Qp(t),[t]),b=HS(l?._id,d?.primaryScopeValues?.organizationId,d?.primaryScopeValues?.applicationId),x=(0,Q.useMemo)(()=>{if(v)return BS(t)?{isAvailable:!1,behavior:Jo.DISABLE}:void 0;let e=Bh(u,d?.currentOrganizationId??null);return ng(t,{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,userRoles:e,billingEnabled:f?.isEnabled??!1})},[t,v,m,h,g,_,u,d?.currentOrganizationId,f?.isEnabled]),[S,C]=(0,Q.useState)(()=>!VS(t)),[w,T]=(0,Q.useState)(()=>VS(t)),[E,D]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{!o||!t?(C(!0),T(!1)):x&&!x.isAvailable?(C(!1),T(!1)):!(`enabledCondition`in t)||!t.enabledCondition?(C(!0),T(!1)):y.needsUserContext&&!l?(C(!1),T(!1)):(T(!0),D(null),xm({operation:t,currentObject:n,inputDto:r,userContext:l||void 0,initiatorIds:b,objectContext:i,resourcesRegistry:p,resourceType:a,doOperation:c}).then(e=>{C(e),T(!1)}).catch(e=>{D(e instanceof Error?e:Error(`Unknown error`)),C(!1),T(!1)}))},[o,t,n,r,i,l,b,p,a,y.needsUserContext,c,x]),{isEnabled:S,isLoading:w,error:E,contextNeeds:y,featureAvailability:x}}function pue(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function WS(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||r.isEnabled!==e.isEnabled||(r.ineligibleSelectionIndices??[]).join(`,`)!==(e.ineligibleSelectionIndices??[]).join(`,`)||!pue(r.featureAvailability,e.featureAvailability))return!1}return!0}function GS(e,t={}){let{currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0,selectionObjects:s,organizationId:c,subjectDataMode:l}=t,{getResourcesRegistry:u,doOperation:d}=fm(),{user:f,permissions:p}=pg(),m=Zp(),h=Yh(),g=u(),{resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,isLoading:x}=Ch(),S=HS(f?._id,c??m?.primaryScopeValues?.organizationId,m?.primaryScopeValues?.applicationId),[C,w]=(0,Q.useState)(new Map);return(0,Q.useEffect)(()=>{if(!o){let t=new Map;e.forEach(e=>{t.set(zS(e),{isEnabled:!0})}),w(e=>WS(e,t)?e:t);return}if(!e.length||!a){w(e=>e.size===0?e:new Map);return}let t=!1,c=Bh(p,m?.currentOrganizationId??null),u={resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,userRoles:c,billingEnabled:h?.isEnabled??!1};return(async()=>{let o=new Map;await Promise.all(e.map(async e=>{let t=zS(e),c=x?BS(e)?{isAvailable:!1,behavior:Jo.DISABLE}:void 0:ng(e,u);if(c&&!c.isAvailable)o.set(t,{isEnabled:!1,featureAvailability:c});else if(!(`enabledCondition`in e)||!e.enabledCondition)o.set(t,{isEnabled:!0,featureAvailability:c});else if(Qp(e).needsUserContext&&!f)o.set(t,{isEnabled:!1,featureAvailability:c});else try{let u=t=>xm({operation:e,currentObject:t,inputDto:r,userContext:f||void 0,initiatorIds:S,objectContext:i,resourcesRegistry:g,resourceType:a,doOperation:d,...l?{subjectDataMode:l}:{}});if(e.isBulkOperation===!0&&s&&s.length>0){let n=await Promise.all(s.map(e=>u(e))),r=n.flatMap((e,t)=>e?[]:[t]);o.set(t,{isEnabled:Ru(e)?r.length<n.length:r.length===0,featureAvailability:c,...r.length>0?{ineligibleSelectionIndices:r}:{}})}else o.set(t,{isEnabled:await u(n),featureAvailability:c})}catch{o.set(t,{isEnabled:!1,featureAvailability:c})}})),t||w(e=>WS(e,o)?e:o)})(),()=>{t=!0}},[o,e,n,s,l,r,i,f,S,p,m?.currentOrganizationId,g,a,d,_,v,y,b,x,h?.isEnabled]),C}function KS(e,t,n){let r=e(t,n,`title`);return r&&!r.startsWith(`resources.`)?r:n}function mue(e){let{registry:t,resourceConfig:n,exportOperation:r,resourceType:i,contextResourceIdentifiers:a,contextualParameters:o,parentResourcesRequirements:s,apiBaseUrl:c,format:l,rowScope:u,listingQuery:d}=e;if(!n?.resourceFieldIdentifier||!r)return null;try{let e=Vn.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let i=On.selectMatchingRoutePath(e,a,n.resourceIdentifier,n.resourceFieldIdentifier,s,t.allResourceFieldIdentifiers),f=dh.resolveUrlPath(i.url,o);if(dh.hasUnresolvedPlaceholders(f))return null;let p=new URLSearchParams;p.set(k,l),p.set(rre,u);for(let[e,t]of Object.entries(d??{}))t!==void 0&&t!==``&&e!==`format`&&e!==`rowScope`&&qS(p,e,t);return`${c}${br}${f}?${p.toString()}`}catch{return null}}function qS(e,t,n){if(n!=null&&n!==``){if(n instanceof Date)e.append(t,n.toISOString());else if(Array.isArray(n))e.append(t,String(n));else if(typeof n==`object`)for(let[r,i]of Object.entries(n))qS(e,`${t}[${r}]`,i);else e.append(t,String(n))}}async function hue(e){Hy(await e.getBlob(e.url),pee(String(e.resourceType),e.format,new Date))}function JS(e,t){if(!e)return[];let n=hr.getObjectLikeFieldShape(e,{commonOnly:!1});if(!n)return[];let r=[];for(let[e,i]of Object.entries(n))Jl(i)&&t[e]&&r.push({fieldName:e,value:t[e],schema:i});return r}var YS;(function(e){e.PANEL=`panel`,e.LIST=`list`})(YS||={});function XS(e){return e.type===`separator`?!1:e.type===`subgroup`?e.disabled===!0:e.disabled===!0||e.unavailability!==void 0}function ZS(e,t){let n=new Set(e.slice(0,t)),r=new Set,i=[],a=()=>{let e=i.filter(e=>n.has(e)).length;for(let t of[...i.filter(e=>!XS(e)),...i.filter(XS)].slice(0,e))r.add(t);i=[]};for(let t of e)t.type===`separator`?(a(),n.has(t)&&r.add(t)):i.push(t);a();let o=e=>e.filter((t,n)=>t.type!==`separator`||n>0&&n<e.length-1&&e[n-1].type!==`separator`);return{displayedItems:o(e.filter(e=>r.has(e))),overflowItems:o(e.filter(e=>!r.has(e)))}}function QS({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ACTION_BAR,`ActionBar`)(e);return(0,$.jsx)(n,{...t})}var $S=(0,Q.createContext)(!1);function eC({children:e}){return(0,$.jsx)($S.Provider,{value:!0,children:e})}function tC(){return(0,Q.useContext)($S)}function nC(e,t,n,r){return V.buildConfigurationError(Xl.CONFIGURATION,{component:e,message:`${e}() requires a ${t}-like operation host, but received "${n}" for operation "${r}".`,expectedKind:t,actualKind:n,operationIdentifier:r})}function rC(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function iC(e,t,n){if(!n)return e;let r=e[t];if(On.getResourceId(r)===n)return e;let i=r?On.getFieldIdentifier(r):void 0;return{...e,[t]:i?{fieldIdentifier:i,resourceId:n}:n}}function aC({resourceContext:e,navigationZone:t,navigationInitiator:n,updateLikeMutationFallbackMode:r}){let{registry:i,doOperation:a}=fm(),{navigateToResource:o,goBack:s}=DS(),{handleError:c}=rp(),{resourceType:l,operation:u}=e,d=r??Tl(u,i.resourceConfigurations[l]?.operations),f=String(u.operationIdentifier),p=(0,Q.useMemo)(()=>i.resourceConfigurations[l],[i,l]),m=(0,Q.useMemo)(()=>vl(u),[u]),h=(0,Q.useMemo)(()=>vie(u),[u]),g=(0,Q.useMemo)(()=>dh.createOperationInitiator(t,u),[t,u]),_=(0,Q.useMemo)(()=>rC(e.additionalContext),[e.additionalContext]),v=(0,Q.useMemo)(()=>{let e=_?._id??(p?.resourceFieldIdentifier?_?.[p.resourceFieldIdentifier]:void 0);return typeof e==`string`&&e.length>0?e:void 0},[_,p?.resourceFieldIdentifier]),y=(0,Q.useMemo)(()=>iC(e.contextResourceIdentifiers,l,v),[v,e.contextResourceIdentifiers,l]),b=(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:y}),[y,e]),x=(0,Q.useMemo)(()=>V.buildContextualParameters(y,i),[y,i]),S=(0,Q.useCallback)(e=>!!On.getResourceId(e[l]),[l]),C=(0,Q.useCallback)(()=>{s(t)},[s,t]),w=(0,Q.useCallback)((e,n,r)=>{c(e,n,{resourceType:l,operationId:f,navigationZone:t,component:r})},[c,t,f,l]),T=(0,Q.useCallback)(async e=>{if(nl(u)&&!tr(d))throw new ua({surfaceName:`useResourceOperationSurface.executeCurrentOperation()`,resourceType:l,operationIdentifier:f});let t=Ta.createOperationPathKeyFromOperation(u),n=rc({operation:u,requestData:e,additionalContext:b.additionalContext});return a(t,{contextualParameters:x,parentResourcesRequirements:b.parentResourcesRequirements,...n?{requestData:n}:{}})},[x,a,u,f,b.additionalContext,b.parentResourcesRequirements,l,d]),E=(0,Q.useCallback)((e,t)=>{if(p)return e===W.READ||e===W.UPDATE||e===W.DELETE?ph({resourceConfig:p,operations:p.operations??[],coreOperation:e,registry:i,hasResourceId:S(y),allowBulk:t?.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:y,contextualParameters:x}):nu(p.operations??[],e,t)},[x,S,i,p,y]),D=(0,Q.useCallback)(({operation:e,contextResourceIdentifiers:t=b.contextResourceIdentifiers,parentResourcesRequirements:n=b.parentResourcesRequirements,initiatorOverride:r,transitionOverride:a})=>{if(!p)return!1;let s=iC(t,l,v),c=V.buildContextualParameters(s,i);if(nh({operation:e,resourceType:l,resourceConfig:p})&&e.isBulkOperation!==!0&&!Km({resourceConfig:p,operation:e,registry:i,hasResourceId:S(s),contextResourceIdentifiers:s,contextualParameters:c}))return!1;let u=On.createFrontendResourceOperationContextFromOperation({resourceType:l,operation:e,contextResourceIdentifiers:s,parentResourcesRequirements:n}),d=Vn.buildOperationFrontendRoutePaths(p,e,i.allResourceFieldIdentifiers),f=d.length>0?On.selectMatchingRoutePath(d,u.contextResourceIdentifiers,l,p.resourceFieldIdentifier,n,i.allResourceFieldIdentifiers).url:void 0;return o(u,r??g,f,a),!0},[o,g,i,p,b.contextResourceIdentifiers,b.parentResourcesRequirements,l,S,v]);return{resourceContext:b,navigationZone:t,navigationInitiator:n,resourceType:l,operation:u,operationId:f,resourceConfig:p,effectiveCoreOperation:m,isSemanticCustomOperation:h,operationInitiator:g,contextualParameters:x,goBackWithinZone:C,reportError:w,executeCurrentOperation:T,resolvePreferredOperation:E,navigateToResourceOperation:D,navigateToPreferredRead:(0,Q.useCallback)(e=>{if(!p)return e?.fallbackToGoBack!==!1&&C(),!1;let t=iC(e?.contextResourceIdentifiers??b.contextResourceIdentifiers,l,v),n=e?.parentResourcesRequirements??b.parentResourcesRequirements,r=V.buildContextualParameters(t,i),a=ph({resourceConfig:p,operations:p.operations??[],coreOperation:W.READ,registry:i,hasResourceId:S(t),requireFrontendAddressable:!0,contextResourceIdentifiers:t,contextualParameters:r});return a?D({operation:a,contextResourceIdentifiers:t,parentResourcesRequirements:n,initiatorOverride:e?.initiatorOverride,transitionOverride:e?.transitionOverride}):(e?.fallbackToGoBack!==!1&&C(),!1)},[v,C,S,D,i,p,l,b.contextResourceIdentifiers,b.parentResourcesRequirements])}}function oC(e,t,n){let r=aC(e),i=As(r.operation);if(i!==t)throw nC(n,t,i,r.operationId);return r}function gue(e){return oC(e,`read`,`useReadOperationSurface`)}function _ue(e){return oC(e,`list`,`useListOperationSurface`)}function vue(e){return oC(e,`create`,`useCreateOperationSurface`)}function yue(e){return oC(e,`update`,`useUpdateOperationSurface`)}function bue(e){return oC(e,`search`,`useSearchOperationSurface`)}function xue(e){return oC(e,`action`,`useActionOperationSurface`)}var sC=(0,Q.createContext)(null);function cC(){let e=(0,Q.useContext)(sC);if(!e)throw Error(`useResourceOperationViewContext() must be used within a <ResourceOperationViewProvider>. This is provided automatically for routed resource operation layouts.`);return e}function lC(){return(0,Q.useContext)(sC)}function uC({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i}){let a=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),o=(0,Q.useMemo)(()=>({...a,inlineParentContext:r}),[r,a]);return(0,$.jsx)(sC.Provider,{value:o,children:i})}var dC=e(zte(),1),fC=e=>e.type===`checkbox`,pC=e=>e instanceof Date,mC=e=>e==null,hC=e=>typeof e==`object`,gC=e=>!mC(e)&&!Array.isArray(e)&&hC(e)&&!pC(e),_C=e=>gC(e)&&e.target?fC(e.target)?e.target.checked:e.target.value:e,Sue=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,vC=(e,t)=>e.has(Sue(t)),Cue=e=>{let t=e.constructor&&e.constructor.prototype;return gC(t)&&t.hasOwnProperty(`isPrototypeOf`)},yC=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function bC(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(yC&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(gC(e)&&Cue(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=bC(e[t]));return r}var xC=e=>/^\w*$/.test(e),SC=e=>e===void 0,CC=e=>Array.isArray(e)?e.filter(Boolean):[],wC=e=>CC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),TC=(e,t,n)=>{if(!t||!gC(e))return n;let r=(xC(t)?[t]:wC(t)).reduce((e,t)=>mC(e)?e:e[t],e);return SC(r)||r===e?SC(e[t])?n:e[t]:r},EC=e=>typeof e==`boolean`,DC=e=>typeof e==`function`,OC=(e,t,n)=>{let r=-1,i=xC(t)?[t]:wC(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=gC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},kC={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},AC={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},jC={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},MC=Q.createContext(null);MC.displayName=`HookFormControlContext`;var NC=()=>Q.useContext(MC),PC=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==AC.all&&(t._proxyFormState[i]=!r||AC.all),n&&(n[i]=!0),e[i]}});return i},FC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function IC(e){let t=NC(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=Q.useState(n._formState),c=Q.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return FC(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),Q.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),Q.useMemo(()=>PC(o,n,c.current,!1),[o,n])}var LC=e=>typeof e==`string`,RC=(e,t,n,r,i)=>LC(e)?(r&&t.watch.add(e),TC(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),TC(n,e))):(r&&(t.watchAll=!0),n),zC=e=>mC(e)||!hC(e);function BC(e,t,n=new WeakSet){if(zC(e)||zC(t))return Object.is(e,t);if(pC(e)&&pC(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let a of r){let r=e[a];if(!i.includes(a))return!1;if(a!==`ref`){let e=t[a];if(pC(r)&&pC(e)||gC(r)&&gC(e)||Array.isArray(r)&&Array.isArray(e)?!BC(r,e,n):!Object.is(r,e))return!1}}return!0}function VC(e){let t=NC(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=Q.useRef(i),l=Q.useRef(s),u=Q.useRef(void 0),d=Q.useRef(n),f=Q.useRef(r);l.current=s;let[p,m]=Q.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=Q.useCallback(e=>{let t=RC(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=Q.useCallback(e=>{if(!a){let t=RC(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);BC(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);FC(()=>(d.current===n&&BC(f.current,r)||(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),Q.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=Q.useMemo(()=>{if(a)return null;let e=!_&&!BC(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function HC(e){let t=NC(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=vC(i._names.array,n),l=VC({control:i,name:n,defaultValue:Q.useMemo(()=>TC(i._formValues,n,TC(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=IC({control:i,name:n,exact:s}),d=Q.useRef(e),f=Q.useRef(void 0),p=Q.useRef(i.register(n,{...e.rules,value:l,...EC(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!TC(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!TC(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!TC(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!TC(u.validatingFields,n)},error:{enumerable:!0,get:()=>TC(u.errors,n)}}),[u,n]),h=Q.useCallback(e=>p.current.onChange({target:{value:_C(e),name:n},type:kC.CHANGE}),[n]),g=Q.useCallback(()=>p.current.onBlur({target:{value:TC(i._formValues,n),name:n},type:kC.BLUR}),[n,i._formValues]),_=Q.useCallback(e=>{let t=TC(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>DC(e.focus)&&e.focus(),select:()=>DC(e.select)&&e.select(),setCustomValidity:t=>DC(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>DC(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),v=Q.useMemo(()=>({name:n,value:l,...EC(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return Q.useEffect(()=>{let e=i._options.shouldUnregister||a,t=f.current;t&&t!==n&&!c&&i.unregister(t),i.register(n,{...d.current.rules,...EC(d.current.disabled)?{disabled:d.current.disabled}:{}});let r=(e,t)=>{let n=TC(i._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){let e=bC(TC(i._options.defaultValues,n,d.current.defaultValue));OC(i._defaultValues,n,e),SC(TC(i._formValues,n))&&OC(i._formValues,n,e)}return!c&&i.register(n),f.current=n,()=>{(c?e&&!i._state.action:e)?i.unregister(n):r(n,!1)}},[n,i,c,a]),Q.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Q.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var UC=e=>e.render(HC(e)),WC=Q.createContext(null);WC.displayName=`HookFormContext`;var GC=()=>Q.useContext(WC),KC=e=>{let{children:t,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}=e;return Q.createElement(WC.Provider,{value:Q.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[o,m,l,i,r,f,h,d,u,a,g,s,_,c,p,n])},Q.createElement(MC.Provider,{value:m},t))},wue=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},qC=e=>Array.isArray(e)?e:[e],JC=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function YC(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&gC(i)&&a){let e=YC(i,a);gC(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var XC=e=>gC(e)&&!Object.keys(e).length,ZC=e=>e.type===`file`,QC=e=>{if(!yC)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$C=e=>e.type===`select-multiple`,ew=e=>e.type===`radio`,Tue=e=>ew(e)||fC(e),tw=e=>QC(e)&&e.isConnected;function Eue(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=SC(e)?r++:e[t[r++]];return e}function Due(e){for(let t in e)if(e.hasOwnProperty(t)&&!SC(e[t]))return!1;return!0}function nw(e,t){let n=Array.isArray(t)?t:xC(t)?[t]:wC(t),r=n.length===1?e:Eue(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(gC(r)&&XC(r)||Array.isArray(r)&&Due(r))&&nw(e,n.slice(0,-1)),e}var Oue=e=>{for(let t in e)if(DC(e[t]))return!0;return!1};function rw(e){return Array.isArray(e)||gC(e)&&!Oue(e)}function iw(e,t={}){for(let n in e){let r=e[n];rw(r)?(t[n]=Array.isArray(r)?[]:{},iw(r,t[n])):SC(r)||(t[n]=!0)}return t}function aw(e,t,n){n||=iw(t);for(let r in e){let i=e[r];if(rw(i))SC(t)||zC(n[r])?n[r]=iw(i,Array.isArray(i)?[]:{}):aw(i,mC(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!BC(i,e)}}return n}var ow={value:!1,isValid:!1},sw={value:!0,isValid:!0},cw=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!SC(e[0].attributes.value)?SC(e[0].value)||e[0].value===``?sw:{value:e[0].value,isValid:!0}:sw:ow}return ow},lw=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>SC(e)?e:t?e===``?NaN:e&&+e:n&&LC(e)?new Date(e):r?r(e):e,uw={isValid:!1,value:null},dw=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,uw):uw;function fw(e){let t=e.ref;return ZC(t)?t.files:ew(t)?dw(e.refs).value:$C(t)?[...t.selectedOptions].map(({value:e})=>e):fC(t)?cw(e.refs).value:lw(SC(t.value)?e.ref.value:t.value,e)}var kue=(e,t,n,r)=>{let i={};for(let n of e){let e=TC(t,n);e&&OC(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},pw=e=>e instanceof RegExp,mw=e=>SC(e)?e:pw(e)?e.source:gC(e)?pw(e.value)?e.value.source:e.value:e,hw=e=>({isOnSubmit:!e||e===AC.onSubmit,isOnBlur:e===AC.onBlur,isOnChange:e===AC.onChange,isOnAll:e===AC.all,isOnTouch:e===AC.onTouched}),gw=`AsyncFunction`,Aue=e=>!!e&&!!e.validate&&!!(DC(e.validate)&&e.validate.constructor.name===gw||gC(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===gw)),jue=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),_w=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),vw=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=TC(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(vw(a,t))break}else if(gC(a)&&vw(a,t))break}}};function yw(e,t,n){let r=TC(e,n);if(r||xC(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=TC(t,r),o=TC(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Mue=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return XC(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||AC.all))},Nue=(e,t,n)=>!e||!t||e===t||qC(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),Pue=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,Fue=(e,t)=>!CC(TC(e,t)).length&&nw(e,t),bw=(e,t,n)=>{let r=qC(TC(e,n));return OC(r,`root`,t[n]),OC(e,n,r),e};function xw(e,t,n=`validate`){if(LC(e)||Array.isArray(e)&&e.every(LC)||EC(e)&&!e)return{type:n,message:LC(e)?e:``,ref:t}}var Sw=e=>gC(e)&&!pw(e)?e:{value:e,message:``},Cw=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=TC(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(EC(e)?``:e||``),y.reportValidity())},x={},S=ew(o),C=fC(o),w=S||C,T=(g||ZC(o))&&SC(o.value)&&SC(v)||QC(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=wue.bind(null,h,r,x),D=(e,t,n,r=jC.maxLength,i=jC.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||mC(v))||EC(v)&&!v||C&&!cw(s).isValid||S&&!dw(s).isValid)){let{value:e,message:t}=LC(c)?{value:!!c,message:c}:Sw(c);if(e&&(x[h]={type:jC.required,message:t,ref:y,...E(jC.required,t)},!r))return b(t),x}if(!T&&(!mC(d)||!mC(f))){let e,t,n=Sw(f),i=Sw(d);if(!mC(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;mC(n.value)||(e=r>n.value),mC(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;LC(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),LC(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,jC.max,jC.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(LC(v)||a&&Array.isArray(v))){let e=Sw(l),t=Sw(u),n=!mC(e.value)&&v.length>+e.value,i=!mC(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&LC(v)){let{value:e,message:t}=Sw(p);if(pw(e)&&!v.match(e)&&(x[h]={type:jC.pattern,message:t,ref:o,...E(jC.pattern,t)},!r))return b(t),x}if(m){if(DC(m)){let e=xw(await m(v,n),y);if(e&&(x[h]={...e,...E(jC.validate,e.message)},!r))return b(e.message),x}else if(gC(m)){let e={};for(let t in m){if(!XC(e)&&!r)break;let i=xw(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!XC(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},Iue={mode:AC.onSubmit,reValidateMode:AC.onChange,shouldFocusError:!0};function Lue(e={}){let t={...Iue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:DC(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(gC(t.defaultValues)||gC(t.values))&&bC(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:bC(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:JC(),state:JC()},m=t.criteriaMode===AC.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=XC((await w()).errors),_()):e=await E(r,!0),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?OC(n.validatingFields,e,r):nw(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!XC(n.validatingFields)}))},v=(e,s=[],c,l,u=!0,m=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,m&&Array.isArray(TC(r,e))){let t=c(TC(r,e),l.argA,l.argB);u&&OC(r,e,t)}if(m&&Array.isArray(TC(n.errors,e))){let t=c(TC(n.errors,e),l.argA,l.argB);u&&OC(n.errors,e,t),Fue(n.errors,e)}if((d.touchedFields||f.touchedFields)&&m&&Array.isArray(TC(n.touchedFields,e))){let t=c(TC(n.touchedFields,e),l.argA,l.argB);u&&OC(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=aw(i,a)),p.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else OC(a,e,s)},y=(e,t)=>{OC(n.errors,e,t),p.state.next({errors:n.errors})},b=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},x=(e,t,n,s)=>{let c=TC(r,e);if(c){let r=TC(a,e,SC(n)?TC(i,e):n);SC(r)||s&&s.defaultChecked||t?OC(a,e,t?r:fw(c._f)):j(e,r),o.mount&&!o.action&&g()}},S=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=O(),c=l!==u.isDirty);let t=BC(TC(i,e),r);l=!!TC(n.dirtyFields,e),t?nw(n.dirtyFields,e):OC(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=TC(n.touchedFields,e);t||(OC(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},C=(e,r,i,a)=>{let o=TC(n.errors,e),s=(d.isValid||f.isValid)&&EC(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?OC(n.errors,e,i):nw(n.errors,e)),(i?!BC(o,i):o)||!XC(a)||s){let t={...a,...s&&EC(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>(_(e,!0),await t.resolver(a,t.context,kue(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),T=async e=>{let{errors:t}=await w(e);if(_(e),e)for(let r of e){let e=TC(t,r);e?OC(n.errors,r,e):nw(n.errors,r)}else n.errors=t;return t},E=async(r,i,o={valid:!0})=>{for(let c in r){let l=r[c];if(l){let{_f:r,...c}=l;if(r){let c=s.array.has(r.name),u=l._f&&Aue(l._f);u&&d.validatingFields&&_([r.name],!0);let f=await Cw(l,s.disabled,a,m,t.shouldUseNativeValidation&&!i,c);if(u&&d.validatingFields&&_([r.name]),f[r.name]&&(o.valid=!1,i||e.shouldUseNativeValidation))break;!i&&(TC(f,r.name)?c?bw(n.errors,f,r.name):OC(n.errors,r.name,f[r.name]):nw(n.errors,r.name))}!XC(c)&&await E(c,i,o)}}return o.valid},D=()=>{for(let e of s.unMount){let t=TC(r,e);t&&(t._f.refs?t._f.refs.every(e=>!tw(e)):!tw(t._f.ref))&&ie(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&OC(a,e,n),!BC(ee(),i)),k=(e,t,n)=>RC(e,s,{...o.mount?a:SC(t)?i:LC(e)?{[e]:t}:t},n,t),A=e=>CC(TC(o.mount?a:i,e,t.shouldUnregister?TC(i,e,[]):[])),j=(e,t,n={})=>{let i=TC(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&OC(a,e,lw(t,n)),o=QC(n.ref)&&mC(t)?``:t,$C(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?fC(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):ZC(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:bC(a)})))}(n.shouldDirty||n.shouldTouch)&&S(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&I(e)},M=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=TC(r,o);(s.array.has(e)||gC(a)||c&&!c._f)&&!pC(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=TC(r,e),u=s.array.has(e),m=bC(t);OC(a,e,m),u?(p.array.next({name:e,values:bC(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&p.state.next({name:e,dirtyFields:aw(i,a),isDirty:O(e,m)})):l&&!l._f&&!mC(m)?M(e,m,c):j(e,m,c),_w(e,s)?p.state.next({...n,name:e,values:bC(a)}):p.state.next({name:o.mount?e:void 0,values:bC(a)})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,u=!0,h=TC(r,l),v=e=>{u=Number.isNaN(e)||pC(e)&&isNaN(e.getTime())||BC(e,TC(a,l,e))},y=hw(t.mode),b=hw(t.reValidateMode);if(h){let o,x,T=i.type?fw(h._f):_C(e),D=e.type===kC.BLUR||e.type===kC.FOCUS_OUT,O=!jue(h._f)&&!t.resolver&&!TC(n.errors,l)&&!h._f.deps||Pue(D,TC(n.touchedFields,l),n.isSubmitted,b,y),k=_w(l,s,D);OC(a,l,T),D?i&&i.readOnly||(h._f.onBlur&&h._f.onBlur(e),c&&c(0)):h._f.onChange&&h._f.onChange(e);let A=S(l,T,D),j=!XC(A)||k;if(!D&&p.state.next({name:l,type:e.type,values:bC(a)}),O)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?D&&g():D||g()),j&&p.state.next({name:l,...k?{}:A});if(!D&&k&&p.state.next({...n}),t.resolver){let{errors:e}=await w([l]);if(_([l]),v(T),u){let t=yw(n.errors,r,l),i=yw(e,r,t.name||l);o=i.error,l=i.name,x=XC(e)}}else _([l],!0),o=(await Cw(h,s.disabled,a,m,t.shouldUseNativeValidation))[l],_([l]),v(T),u&&(o?x=!1:(d.isValid||f.isValid)&&(x=await E(r,!0)));u&&(h._f.deps&&(!Array.isArray(h._f.deps)||h._f.deps.length>0)&&I(h._f.deps),C(l,x,o,A))}},F=(e,t)=>{if(TC(n.errors,t)&&e.focus)return e.focus(),1},I=async(e,i={})=>{let a,o,c=qC(e);if(t.resolver){let t=await T(SC(e)?e:c);a=XC(t),o=e?!c.some(e=>TC(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=TC(r,e);return await E(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&g()):o=a=await E(r);return p.state.next({...!LC(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&vw(r,F,e?c:s.mount),o},ee=(e,t)=>{let r={...o.mount?a:i};return t&&(r=YC(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),SC(e)?r:LC(e)?TC(r,e):e.map(e=>TC(r,e))},L=(e,t)=>({invalid:!!TC((t||n).errors,e),isDirty:!!TC((t||n).dirtyFields,e),error:TC((t||n).errors,e),isValidating:!!TC(n.validatingFields,e),isTouched:!!TC((t||n).touchedFields,e)}),R=e=>{let t=e?qC(e):void 0;t?.forEach(e=>nw(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},z=(e,t,i)=>{let a=(TC(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=TC(n.errors,e)||{};OC(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},te=(e,t)=>DC(e)?p.state.subscribe({next:n=>`values`in n&&e(k(void 0,t),n)}):k(e,t,!0),ne=e=>p.state.subscribe({next:t=>{Nue(e.name,t.name,e.exact)&&Mue(t,e.formState||d,me,e.reRenderRoot)&&e.callback({values:{...a},...n,...t,defaultValues:i})}}).unsubscribe,re=e=>(o.mount=!0,f={...f,...e.formState},ne({...e,formState:{...u,...e.formState}})),ie=(e,o={})=>{for(let c of e?qC(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(nw(r,c),nw(a,c)),!o.keepError&&nw(n.errors,c),!o.keepDirty&&nw(n.dirtyFields,c),!o.keepTouched&&nw(n.touchedFields,c),!o.keepIsValidating&&nw(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&nw(i,c);p.state.next({values:bC(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},ae=({disabled:e,name:t})=>{if(EC(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},oe=(e,n={})=>{let a=TC(r,e),c=EC(n.disabled)||EC(t.disabled);return OC(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?ae({disabled:EC(n.disabled)?n.disabled:t.disabled,name:e}):x(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:mw(n.min),max:mw(n.max),minLength:mw(n.minLength),maxLength:mw(n.maxLength),pattern:mw(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){oe(e,n),a=TC(r,e);let t=SC(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Tue(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;OC(r,e,{_f:{...a._f,...o?{refs:[...s.filter(tw),t,...Array.isArray(TC(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=TC(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(vC(s.array,e)&&o.action)&&s.unMount.add(e)}}},se=()=>t.shouldFocusError&&vw(r,F,s.mount),ce=e=>{EC(e)&&(p.state.next({disabled:e}),vw(r,(t,n)=>{let i=TC(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},le=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=bC(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=bC(t)}else await E(r);if(s.disabled.size)for(let e of s.disabled)nw(l,e);if(nw(n.errors,`root`),XC(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),se(),setTimeout(se);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:XC(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ue=(e,t={})=>{TC(r,e)&&(SC(t.defaultValue)?N(e,bC(TC(i,e))):(N(e,t.defaultValue),OC(i,e,bC(t.defaultValue))),t.keepTouched||nw(n.touchedFields,e),t.keepDirty||(nw(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,bC(TC(i,e))):O()),t.keepError||(nw(n.errors,e),d.isValid&&g()),p.state.next({...n}))},de=(e,c={})=>{let l=e?bC(e):i,u=bC(l),f=XC(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(aw(i,a))]);for(let t of Array.from(e)){let e=TC(n.dirtyFields,t),r=TC(a,t),i=TC(m,t);e&&!SC(r)?OC(m,t,r):!e&&!SC(i)&&N(t,i)}}else{if(yC&&SC(e))for(let e of s.mount){let t=TC(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(QC(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,TC(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?bC(i):{}:bC(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!XC(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!(!c.keepDefaultValues||BC(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?aw(i,a):n.dirtyFields:c.keepDefaultValues&&e?aw(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},fe=(e,n)=>de(DC(e)?e(a):e,{...t.resetOptions,...n}),pe=(e,t={})=>{let n=TC(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&DC(e.select)&&e.select()})}},me=e=>{n={...n,...e}},he={control:{register:oe,unregister:ie,getFieldState:L,handleSubmit:le,setError:z,_subscribe:ne,_runSchema:w,_updateIsValidating:_,_focusError:se,_getWatch:k,_getDirty:O,_setValid:g,_setFieldArray:v,_setDisabledField:ae,_setErrors:b,_getFieldArray:A,_reset:de,_resetDefaultValues:()=>DC(t.defaultValues)&&t.defaultValues().then(e=>{fe(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:ce,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:re,trigger:I,register:oe,handleSubmit:le,watch:te,setValue:N,getValues:ee,reset:fe,resetField:ue,clearErrors:R,unregister:ie,setError:z,setFocus:pe,getFieldState:L};return{...he,formControl:he}}var ww=()=>{if(typeof crypto<`u`&&crypto.randomUUID)return crypto.randomUUID();let e=typeof performance>`u`?Date.now():performance.now()*1e3;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(Math.random()*16+e)%16|0;return(t==`x`?n:n&3|8).toString(16)})},Tw=(e,t,n={})=>n.shouldFocus||SC(n.shouldFocus)?n.focusName||`${e}.${SC(n.focusIndex)?t:n.focusIndex}.`:``,Ew=(e,t)=>[...e,...qC(t)],Dw=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function Ow(e,t,n){return[...e.slice(0,t),...qC(n),...e.slice(t)]}var kw=(e,t,n)=>Array.isArray(e)?(SC(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Aw=(e,t)=>[...qC(t),...qC(e)];function Rue(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return CC(r).length?r:[]}var jw=(e,t)=>SC(t)?[]:Rue(e,qC(t).sort((e,t)=>e-t)),Mw=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Nw=(e,t,n)=>(e[t]=n,e);function Pw(e){let t=NC(),{control:n=t,name:r,keyName:i=`id`,shouldUnregister:a,rules:o}=e,[s,c]=Q.useState(n._getFieldArray(r)),l=Q.useRef(n._getFieldArray(r).map(ww)),u=Q.useRef(!1);n._names.array.add(r),Q.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),FC(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=TC(e,r);Array.isArray(t)&&(c(t),l.current=t.map(ww))}}}).unsubscribe,[n,r]);let d=Q.useCallback(e=>{u.current=!0,n._setFieldArray(r,e)},[n,r]);return Q.useEffect(()=>{if(n._state.action=!1,_w(r,n._names)&&n._subjects.state.next({...n._formState}),u.current&&(!hw(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!hw(n._options.reValidateMode).isOnSubmit){if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=TC(e.errors,r),i=TC(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?OC(n._formState.errors,r,t):nw(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=TC(n._fields,r);e&&e._f&&!(hw(n._options.reValidateMode).isOnSubmit&&hw(n._options.mode).isOnSubmit)&&Cw(e,n._names.disabled,n._formValues,n._options.criteriaMode===AC.all,n._options.shouldUseNativeValidation,!0).then(e=>!XC(e)&&n._subjects.state.next({errors:bw(n._formState.errors,e,r)}))}}n._subjects.state.next({name:r,values:bC(n._formValues)}),n._names.focus&&vw(n._fields,(e,t)=>{if(n._names.focus&&t.startsWith(n._names.focus)&&e.focus)return e.focus(),1}),n._names.focus=``,n._setValid(),u.current=!1},[s,r,n]),Q.useEffect(()=>(!TC(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=TC(n._fields,e);r&&r._f&&(r._f.mount=t)})(r,!1)}),[r,n,i,a]),{swap:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Mw(i,e,t),Mw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Mw,{argA:e,argB:t},!1)},[d,r,n]),move:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);kw(i,e,t),kw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,kw,{argA:e,argB:t},!1)},[d,r,n]),prepend:Q.useCallback((e,t)=>{let i=qC(bC(e)),a=Aw(n._getFieldArray(r),i);n._names.focus=Tw(r,0,t),l.current=Aw(l.current,i.map(ww)),d(a),c(a),n._setFieldArray(r,a,Aw,{argA:Dw(e)})},[d,r,n]),append:Q.useCallback((e,t)=>{let i=qC(bC(e)),a=Ew(n._getFieldArray(r),i);n._names.focus=Tw(r,a.length-1,t),l.current=Ew(l.current,i.map(ww)),d(a),c(a),n._setFieldArray(r,a,Ew,{argA:Dw(e)})},[d,r,n]),remove:Q.useCallback(e=>{let t=jw(n._getFieldArray(r),e);l.current=jw(l.current,e),d(t),c(t),!Array.isArray(TC(n._fields,r))&&OC(n._fields,r,void 0),n._setFieldArray(r,t,jw,{argA:e})},[d,r,n]),insert:Q.useCallback((e,t,i)=>{let a=qC(bC(t)),o=Ow(n._getFieldArray(r),e,a);n._names.focus=Tw(r,e,i),l.current=Ow(l.current,e,a.map(ww)),d(o),c(o),n._setFieldArray(r,o,Ow,{argA:e,argB:Dw(t)})},[d,r,n]),update:Q.useCallback((e,t)=>{let i=bC(t),a=Nw(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?ww():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,Nw,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:Q.useCallback(e=>{let t=qC(bC(e));l.current=t.map(ww),d([...t]),c([...t]),n._setFieldArray(r,[...t],e=>e,{},!0,!1)},[d,r,n]),fields:Q.useMemo(()=>s.map((e,t)=>({...e,[i]:l.current[t]||ww()})),[s,i])}}function Fw(e={}){let t=Q.useRef(void 0),n=Q.useRef(void 0),[r,i]=Q.useState({isDirty:!1,isValidating:!1,isLoading:DC(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:DC(e.defaultValues)?void 0:e.defaultValues});if(!t.current){if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!DC(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=Lue(e);t.current={...i,formState:r}}}let a=t.current.control;return a._options=e,FC(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),Q.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),Q.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),Q.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),Q.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),Q.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),Q.useEffect(()=>{e.values&&!BC(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),Q.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Q.useMemo(()=>PC(r,a),[a,r]),t.current}function Iw({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_OPERATIONS_CONFIRM_CRITICAL,`OperationsConfirmCritical`)(e);return(0,$.jsx)(n,{...t})}function zue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,organizationUnitNarrowing:i}=e;return!r||!Object.prototype.hasOwnProperty.call(r,Nr)||n?.persistenceAdapter!==ro.HTTP_API||!i?!1:i[t]?.unitFieldName!==Nr}function Bue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,readThroughCreateOrganizationUnits:i}=e;if(r&&Object.prototype.hasOwnProperty.call(r,Nr)&&n?.persistenceAdapter===ro.HTTP_API)return i?.[t]}function Lw(e){if(!e.registry.manyToManyScopeJunctions)return;let t=Ul.findScopeJunctionForTargetInContext(e.registry.manyToManyScopeJunctions,e.resourceType,new Set(Object.keys(e.contextualParameters)));if(!t)return;let n=e.contextualParameters[t.scopeFkField];if(!(typeof n!=`string`&&typeof n!=`number`||String(n).trim()===``))return{[t.scopeFkField]:n}}function Rw(e){return e==null||e===``?[]:Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[e]}function Vue(e){let t=V.getResourceFieldIdentifierForType(e.resourceType,e.registry);return e.items.flatMap(n=>{let r=V.getResourceObjectId(n,t);return r?[{value:r,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:n,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??r,data:n}]:[]})}function zw(e){if(!e.operation)return;let t=V.selectOperationUrlInitiatorInfo({initiatorInfos:e.operation.initiatorInfos??[],contextualParameters:e.contextualParameters,targetResourceType:e.resourceType,targetDefaultFieldIdentifier:e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]??``});if(t)return On.buildParentResourcesRequirementsFromRouteParams(t.parameters,e.resourceType,e.registry)}async function Bw(e){let t=Lw({resourceType:e.resourceType,registry:e.registry,contextualParameters:e.contextualParameters??{}});if(t){let n=zw({operation:V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.SEARCH)??V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.LIST),resourceType:e.resourceType,registry:e.registry,contextualParameters:t}),r=await e.doOperation(V.buildForeignKeySearchOperationPath(e.resourceType,e.registry),{contextualParameters:t,...n?{parentResourcesRequirements:n,parentChainIsExact:!0}:{},queryParameters:{_id:e.id,limit:1},dataMode:V.foreignKeyReferenceDataMode(e.resourceType,e.registry)},{silent:!0,riskLevel:zi.LOW}),i=(Array.isArray(r)?r:r?.data??r?.items??[]).find(t=>t._id===e.id);if(!i)throw Error(`Reference ${e.resourceType}:${e.id} is not reachable within its scope.`);return{record:i,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:i,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}let n=V.buildForeignKeyFetchParams(e.resourceType,e.id,e.registry),r=e.registry.resourceConfigurations[e.resourceType],i={[e.resourceType]:e.id},a={...e.contextualParameters??{},...n.contextualParameters||{}},o=r?e.readOperation&&Km({resourceConfig:r,operation:e.readOperation,registry:e.registry,hasResourceId:On.getResourceId(i[e.resourceType]).length>0,contextResourceIdentifiers:i,contextualParameters:a})?e.readOperation:ph({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:e.registry,hasResourceId:!0,contextResourceIdentifiers:i,contextualParameters:a}):e.readOperation,s=V.buildForeignKeyReadOperationPath(e.resourceType,e.registry,o),c=e.parentResourcesRequirements??zw({operation:V.resolveSingleResourceReadOperation(e.resourceType,e.registry,o),resourceType:e.resourceType,registry:e.registry,contextualParameters:a}),l=await e.doOperation(s,{contextualParameters:a,...c?{parentResourcesRequirements:c,parentChainIsExact:!0}:{}},{silent:!0,riskLevel:zi.LOW});return{record:l,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:l,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}function Hue(e){let{resourceType:t,ids:n,hostContextualParameters:r}=e,{registry:i,doOperation:a}=fm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=(0,Q.useRef)({registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r});l.current={registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r};let[u,d]=(0,Q.useState)({}),f=(n??[]).join(`|`);return(0,Q.useEffect)(()=>{let e=!1,r=(e,n)=>console.warn(`[useReferenceRecordLabels] The ${t} "${e}" could not be read; the choice shows its id.`,n),i=async e=>{let n=l.current,r=nu(n.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null,{label:i}=await Bw({resourceType:t,id:e,registry:n.registry,doOperation:n.doOperation,contextualParameters:zm({hostIdentifiers:{},hostContextualParameters:n.hostContextualParameters,targetResourceType:t,targetId:e,registry:n.registry}).contextualParameters,readOperation:r,t:n.t,formatDate:n.formatDate,formatDateTime:n.formatDateTime});return typeof i==`string`&&i.length>0?i:void 0};for(let t of n??[])u[t]===void 0&&i(t).then(n=>{!e&&n!==void 0&&d(e=>({...e,[t]:n}))}).catch(e=>r(t,e));return()=>{e=!0}},[t,f]),(0,Q.useMemo)(()=>u,[u])}function Uue(e){if(!e.roleEntries||e.roleTables.unresolvableRoles!==wre.INERT)return;let{appRolesConfig:t,orgRolesConfig:n}=e.roleTables;return Une({roleEntries:e.roleEntries,organizationId:e.organizationId,resolveHierarchy:(e,r)=>Ks(e,r===Vr.APPLICATION?t:n),resolveRolesWithinAuthority:Jre(e.rolesWithinAuthority)})}function Wue(e){let t=me(e)===vu.ARRAY?Ma(e):e;return t&&me(t)===vu.ENUM?Xo(t):[]}function Vw(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]}function Gue(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n)return;let i={};for(let[e,a]of Object.entries(t)){if(!Bs(a))continue;let t=Wue(a);t.length!==0&&(i[e]={values:Yo(n,t,Vw(r?.[e]))})}return Object.keys(i).length>0?i:void 0}function Kue(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n||n.kind===Eie.UNBOUNDED)return;let i={};for(let[e,a]of Object.entries(t))Bs(a)&&me(a)===vu.STRING&&xt(a)===z.ORGANIZATION_ROLE&&(i[e]=Yo(n,[...n.grantableRoles],Vw(r?.[e])));return Object.keys(i).length>0?i:void 0}var Hw=Qs(B.LOW_LEVEL_ALERT_DIALOG,`AlertDialog`,[`Trigger`,`Content`,`Header`,`Footer`,`Title`,`Description`,`Action`,`Cancel`]);function Uw({preset:e=q.DEFAULT,...t}){let n=Hw(e);return(0,$.jsx)(n,{...t})}var Ww=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Hw(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});Ww.displayName=`AlertDialogTrigger`;var Gw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Hw(e);return(0,$.jsx)(r.Content,{...t,ref:n})});Gw.displayName=`AlertDialogContent`;function Kw({preset:e=q.DEFAULT,...t}){let n=Hw(e);return(0,$.jsx)(n.Header,{...t})}function qw({preset:e=q.DEFAULT,...t}){let n=Hw(e);return(0,$.jsx)(n.Footer,{...t})}var Jw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Hw(e);return(0,$.jsx)(r.Title,{...t,ref:n})});Jw.displayName=`AlertDialogTitle`;var Yw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Hw(e);return(0,$.jsx)(r.Description,{...t,ref:n})});Yw.displayName=`AlertDialogDescription`;function Xw({preset:e=q.DEFAULT,...t}){let n=Hw(e);return(0,$.jsx)(n.Action,{...t})}function Zw({preset:e=q.DEFAULT,...t}){let n=Hw(e);return(0,$.jsx)(n.Cancel,{...t})}var Qw=(0,Q.createContext)(void 0);function $w({formChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({formChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(Qw.Provider,{value:r,children:n})}function eT(){return(0,Q.useContext)(Qw)??{}}function tT(e){if(e.path?.length){let t=``;for(let n of e.path){let e=typeof n==`object`?n.key:n;if(typeof e==`string`||typeof e==`number`)t+=t?`.${e}`:e;else return null}return t}return null}var nT;(function(e){e.REQUEST_DTO=`request-dto`,e.MAIN_SCHEMA=`main-schema`})(nT||={});var rT;(function(e){e.IDLE=`idle`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(rT||={});var iT=(0,Q.createContext)(null);function aT({schema:e,schemaKind:t=nT.REQUEST_DTO,form:n,resourceType:r,validationMode:i,validateFieldUrl:a,resourceId:o,operationType:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u,children:d}){let f=c?JSON.stringify(Object.entries(c).sort(([e],[t])=>e.localeCompare(t))):void 0,p=l?JSON.stringify(l):void 0,m=(0,Q.useMemo)(()=>({schema:e,schemaKind:t,form:n,resourceType:r,validationMode:i,validateFieldUrl:a,resourceId:o,operationType:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u}),[e,t,n,r,i,a,o,s,f,p,u]);return(0,$.jsx)(iT.Provider,{value:m,children:(0,$.jsx)(KC,{...n,children:d})})}var oT=`server`,sT=`server-unique`,cT=`_root`,lT=`record-duplicate-key`,uT=(e,t,n)=>{if(e&&`reportValidity`in e){let r=TC(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},dT=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?uT(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>uT(t,n,e))}},fT=(e,t)=>{t.shouldUseNativeValidation&&dT(e,t);let n={};for(let r in e){let i=TC(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(pT(t.names||Object.keys(e),r)){let e=Object.assign({},TC(n,r));OC(e,`root`,a),OC(n,r,e)}else OC(n,r,a)}return n},pT=(e,t)=>{let n=hT(t);return e.some(e=>mT(e).match(`^${n}\\.\\d+`))};function mT(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function hT(e){return mT(e).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var gT=new Set([`code`,`message`,`path`,`input`]);function _T(e){let t={};for(let[n,r]of Object.entries(e))gT.has(n)||(t[n]=r);return Object.keys(t).length>0?t:void 0}function vT(e,t){let n={};for(let r of e){let e=tT(r)||`_root`,i=r.code,a=typeof i==`string`?i:``;if(!n[e]){let t=_T(r);n[e]={message:r.message,type:a,...t?{params:t}:{}}}if(t){let t=n[e].types||{};n[e].types={...t,[a||Object.keys(t).length]:r.message}}}return n}function yT(e){return vT(e,!1)}function bT(e,t={}){return async(n,r,i)=>{let a=e[`~standard`].validate(n);if(a instanceof Promise&&(a=await a),a.issues)return{values:{},errors:fT(vT(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};let o=a.value;return i.shouldUseNativeValidation&&dT({},i),{values:t.raw?Object.assign({},n):o,errors:{}}}}function xT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function ST(e){try{return e.safeParse(void 0).success&&!e.safeParse([]).success}catch{return!1}}function CT(e){if(F(e)!==null)return!0;let t=lr(e);return Xa(t)===`union`&&(t.options??[]).some(e=>F(e)!==null)}function wT(e,t){if(!t||!xT(e)||!CT(t))return e;let n=Ri(t),r;for(let i of Object.keys(e)){let a=Ac(t,i);if(!a)continue;let o=e[i],s=o;if(Array.isArray(o)){if(o.length===0){if(!n&&ST(a)){r??={...e},delete r[i];continue}}else{let e=Ma(a);if(e&&CT(e)){let t=o.map(t=>wT(t,e));t.some((e,t)=>e!==o[t])&&(s=t)}}}else xT(o)&&CT(a)&&(s=wT(o,a));s!==o&&(r??={...e},r[i]=s)}return r??e}function TT(e){(0,Q.useEffect)(()=>{let t=e.watch((t,{name:n,type:r})=>{if(r!==`change`&&n===void 0)return;let i=e.getFieldState(cT).error;i&&i.type!==`server`&&i.type!==`server-unique`&&e.trigger(cT)});return()=>t.unsubscribe()},[e])}var ET=Q.createContext(void 0);function DT(e,t){return async(n,r,i)=>{let a=await e(n,r,i),o={};Object.assign(o,a.errors);for(let{name:e,message:n}of t.values())TC(o,e)||OC(o,e,{type:`file-validation`,message:n});return Object.keys(o).length>0?{values:{},errors:o}:a}}function OT({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION,`ContentSection`)(e);return(0,$.jsx)(n,{...t})}function kT({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION_GROUP,`ContentSectionGroup`)(e);return(0,$.jsx)(n,{...t})}function AT({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION_LEGEND,`ContentSectionLegend`)(e);return(0,$.jsx)(n,{...t})}var jT=ta.ON_BLUR,MT;(function(e){e.FORM=`form`,e.DISPLAY=`display`})(MT||={});var NT;(function(e){e.DISPLAY=`display`,e.EDITING=`editing`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(NT||={});function PT({schema:e,schemaKind:t,validationSchema:n,defaultValues:r,onSubmit:i,onError:a,validationMode:o,children:s,className:c,disabled:l,id:u,resourceType:d,onFormReady:f,warnOnUnsavedChanges:p=!1,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y}){let b=o??jT,x=n??e,S=Q.useRef(new Map).current,C=bT(x),w=Fw({resolver:DT(((e,t,n)=>C(wT(e,x),t,n)),S),defaultValues:r,mode:b,disabled:l});TT(w),(0,Q.useEffect)(()=>{if(!p)return;let e=e=>{w.formState.isDirty&&e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[p,w.formState.isDirty]),(0,Q.useEffect)(()=>{f&&f({setError:(e,t)=>w.setError(e,t),clearErrors:e=>w.clearErrors(e),watch:w.watch,reset:w.reset,getValues:w.getValues,setValue:w.setValue,trigger:w.trigger,handleSubmit:w.handleSubmit,formState:w.formState,getFieldState:w.getFieldState,resetField:w.resetField})},[f,w]);let T=w.handleSubmit(async e=>{await i(e)},e=>{a?.(e)});return(0,$.jsx)(aT,{schema:e,schemaKind:t,form:w,resourceType:d,validationMode:o,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y,children:(0,$.jsx)(ET.Provider,{value:S,children:(0,$.jsx)(`form`,{id:u,onSubmit:T,className:c,noValidate:!0,"data-testid":`form`,children:(0,$.jsx)(OT,{disabled:l,className:`contents`,children:s})})})})}PT.displayName=`Form`;var FT=PT,IT=(0,Q.createContext)(null);function LT({value:e,children:t}){return(0,$.jsx)(IT.Provider,{value:e,children:t})}function RT(){let e=(0,Q.useContext)(IT);if(!e)throw Error(`useFormTemplateContext() must be used within a <FormTemplateProvider>. This is provided automatically by AutomatedForm.`);return e}function zT(){return(0,Q.useContext)(IT)}function BT(e,t){return e===void 0?t!==`update`:!Rl(e)}function VT(e){return e.match(/[^.[\]]+/g)??[]}function HT(e,t){if(t.length===0||typeof e!=`object`||!e)return e;let[n,...r]=t;if(Array.isArray(e)){let t=Number(n);if(!Number.isInteger(t)||t<0||t>=e.length)return e;let i=[...e];return r.length===0?(i.splice(t,1),i):(i[t]=HT(i[t],r),i)}let i=e;if(!Object.prototype.hasOwnProperty.call(i,n))return e;let a={...i};return r.length===0?(delete a[n],a):(a[n]=HT(a[n],r),a)}function UT(e,t){if(t.length===0)return e;if(typeof e!=`object`||!e)return;let[n,...r]=t;if(Array.isArray(e)){let t=Number(n);return!Number.isInteger(t)||t<0||t>=e.length?void 0:UT(e[t],r)}let i=e;if(Object.prototype.hasOwnProperty.call(i,n))return UT(i[n],r)}function WT(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(Number.isInteger(Number(r))){let t=Number(r),a=Array.isArray(e)?[...e]:[];return a[t]=WT(a[t],i,n),a}let a=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{...a,[r]:WT(a[r],i,n)}}function GT(e,t){let n={};for(let r of t){let t=VT(r);if(t.length===0)continue;let i=UT(e,t);i!==void 0&&(n=WT(n,t,i))}return n}function que(e,t,n){let r=VT(t);return r.length===0?e:WT(e,r,n)}function Jue(e,t,n){if(!n)return e;let r=new Set(t.map(VT).filter(e=>e.length===1).map(e=>e[0])),i=new Set,a=e;for(let o of t){let t=VT(o);if(t.length<2)continue;let s=t[0];if(r.has(s))continue;let c=UT(e,t);if(c!==void 0){if(!i.has(s)){i.add(s);let e=n[s];typeof e==`object`&&e&&(a={...a,[s]:e})}a=WT(a,t,c)}}return a}function Yue(e,t){let n={};for(let[r,i]of Object.entries(e))(i!==null||Xue(t,r))&&(n[r]=i);return n}function Xue(e,t){if(!e)return!1;let n=Ac(e,t);return n?n.safeParse(null).success:!1}function KT(e,t){let n=t.omitClearedFields?Yue(e,t.schema):e;for(let e of t.hiddenFieldNames??[]){let t=VT(e);t.length!==0&&(n=HT(n,t))}if(t.contextFieldValues&&Object.keys(t.contextFieldValues).length>0)for(let[e,r]of Object.entries(t.contextFieldValues)){let t=VT(e);t.length!==0&&(n=WT(n,t,r))}return n}function qT(e){return e!==void 0&&oie(e)}function JT(e,t){let n=F(e);return n&&Object.hasOwn(n,t)?n[t]:void 0}function YT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function XT(e,t){let n=new Set;for(let r of e){let[e,...i]=VT(r);if(e===void 0)continue;let a=e,o=t?Ac(t,e):void 0;if(o!==void 0&&!o.safeParse(void 0).success)n.add(a);else{for(let e of i){if(!qT(o))break;a=`${a}.${e}`,o=JT(o,e)}n.add(a)}}let r=[...n];return r.filter(e=>!r.some(t=>t!==e&&e.startsWith(`${t}.`)))}function Zue(e,t){let n=e=>e==null||e===``||e===!1||Array.isArray(e)&&e.length===0;return n(e)?!n(t):!(0,dC.default)(e,t)}function Que(e){let t=new Set(e.writtenAsHeld??[]),n=new Set(e.variantFields??[]),r={},i=(e,t,n,a)=>{if(qT(n)&&YT(e))for(let[r,o]of Object.entries(e))i(o,YT(t)?t[r]:void 0,JT(n,r),`${a}.${r}`);else Zue(e,t)&&(r[a]=e===void 0||e===``?null:e)};for(let[a,o]of Object.entries(e.values)){let s=e.schema?Ac(e.schema,a):void 0,c=s!==void 0&&!n.has(a)&&!s.safeParse(void 0).success;t.has(a)||c?o!==void 0&&(r[a]=o):i(o,e.seed?.[a],s,a)}let a=Object.keys(e.clears??{});for(let t of a)if(!a.some(e=>t.startsWith(`${e}.`))){for(let e of Object.keys(r))(e===t||e.startsWith(`${t}.`))&&delete r[e];r[t]=e.clears[t]}return r}function ZT(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`))))}var QT;(function(e){e.CLEAR=`clear`,e.EMPTY=`empty`,e.TURN_OFF=`turn_off`})(QT||={});function $ue(e,t,n,r=[]){if(!t||!n||r.includes(e))return;let i=XT([e],n);if(i.length!==1||i[0]!==e)return;let a;if(e.includes(`.`)){let n=pte(t,e);a=n?gn(n):void 0}else if(a=Ac(t,e),a&&!a.safeParse(void 0).success)return;if(!a)return;let o=a,s=Xa(lr(o)),c=s===`boolean`?{kind:QT.TURN_OFF,value:!1}:s===`array`?{kind:QT.EMPTY,value:[]}:{kind:QT.CLEAR,value:null};return o.safeParse(c.value).success?c:void 0}function ede(e){return e.writesRecordFields||e.hasCallerSectionHandler}function $T(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`||typeof r==`number`?t[n]=r:r!=null&&typeof r!=`object`&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function eE(e,t,n,r){if(e)for(let[i,a]of Object.entries(e)){if(a.title)n[i]=a.title;else if(a.titleKey){let e=t(a.titleKey);e!==a.titleKey&&(n[i]=e)}if(a.description)r[i]=a.description;else if(a.descriptionKey){let e=t(a.descriptionKey);e!==a.descriptionKey&&(r[i]=e)}}}function tE(e,t,n){return e===t?n:n===hr.unresolvedFieldLabel(e)?hr.unresolvedFieldLabel(t):n}function nE(e,t,n,r=`display`,i={}){let{t:a,tResourceFieldDisplay:o,tResourceFieldEdit:s,tResourceFieldEnumValue:c,tResourceSection:l,tResourceWizardStep:u,isReady:d}=K({resource:t?.resourceType}),{layoutRefs:f,overrides:p,fieldPathPrefix:m}=i,h=(0,Q.useCallback)(e=>m?`${m}.${e}`:e,[m]),g=(0,Q.useMemo)(()=>{let i={},a=$T(n),c;try{c=fl(e)}catch{return p?.fields??{}}if(c.length===0)return p?.fields??{};for(let{path:e,leaf:n}of c){if(p?.fields?.[e]){i[e]=p.fields[e];continue}let c=h(e);i[e]=t?tE(c,n,(r===`edit`?s:o)(t.resourceType,c,`label`,a)):tE(c,n,o(``,c,`label`,a))}return i},[e,t,n,r,p?.fields,h,o,s]),_=(0,Q.useMemo)(()=>{let i={},a=$T(n),c;try{c=fl(e)}catch{return p?.descriptions??{}}for(let{path:e}of c)if(p?.descriptions?.[e])i[e]=p.descriptions[e];else if(t){let n=(r===`edit`?s:o)(t.resourceType,h(e),`description`,a);n&&(i[e]=n)}return i},[e,t,n,r,p?.descriptions,h,o,s]),v=(0,Q.useMemo)(()=>{let n={},i;try{i=hr.getObjectLikeFieldShape(e,{commonOnly:!1})}catch{return{}}if(!i)return{};for(let[e,a]of Object.entries(i))if((r===`display`?yl(a)?.tooltip===!0:Xc(a)?.tooltip===!0)&&t){let i=(r===`edit`?s:o)(t.resourceType,h(e),`tooltip`);i&&(n[e]=i)}return n},[e,t,r,h,o,s]),y=(0,Q.useMemo)(()=>{let n={},r;try{r=fl(e)}catch{return p?.enums??{}}for(let{path:e,schema:i}of r){let r=Hc(i);if(r){if(p?.enums?.[e])n[e]=p.enums[e];else if(t){let a=Xo(r);if(a.length>0){let r={};for(let n of a)r[n]=c(t.resourceType,h(e),n,i);n[e]=r}}}}return n},[e,t,p?.enums,h,c]),b=(0,Q.useMemo)(()=>{let e={},n={};if(eE(p?.sections,a,e,n),t&&f?.sections){let{resourceType:r}=t;for(let t of f.sections)if(e[t]||(e[t]=l(r,t,`title`)),!n[t]){let e=l(r,t,`description`);e&&(n[t]=e)}}return{labels:e,descriptions:n}},[t,f?.sections,p?.sections,a,l]),x=b.labels,S=b.descriptions,C=(0,Q.useMemo)(()=>{let e={},n={};if(eE(p?.wizardSteps,a,e,n),t&&f?.wizardSteps){let{resourceType:r}=t;for(let t of f.wizardSteps)if(e[t]||(e[t]=u(r,t,`title`)),!n[t]){let e=u(r,t,`description`);e&&(n[t]=e)}}return{labels:e,descriptions:n}},[t,f?.wizardSteps,p?.wizardSteps,a,u]);return{fieldLabels:g,fieldDescriptions:_,fieldTooltips:v,enumLabels:y,sectionLabels:x,sectionDescriptions:S,wizardStepLabels:C.labels,wizardStepDescriptions:C.descriptions,groupLabels:(0,Q.useMemo)(()=>{let e={};if(t&&f?.groups){let{resourceType:n}=t;for(let t of f.groups){let r=`resources.${n}.groups.${t}.title`,i=a(r);i&&i!==r&&(e[t]=i)}}return e},[t,f?.groups,a]),isReady:d}}function rE({schema:e,defaultValues:t,onSubmit:n,onError:r,validationMode:i,className:a,disabled:o,readOnly:s,id:c,warnOnUnsavedChanges:l=!1,labels:u,operationRef:d,operationType:f,operationLike:p,coreOperation:m,layoutRefs:h,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,inheritanceConfig:w,chromeMode:T,onSectionSave:E,onFormReady:D,validateFieldUrl:O,resourceType:k,hostResolvesRelationshipRoots:A,resourceId:j,contextResourceIdentifiers:M,parentResourcesRequirements:N,navigationZone:P,layoutTemplate:F}){let{tComponent:I,isReady:ee}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),{fieldLabels:L,fieldDescriptions:R,fieldTooltips:z,enumLabels:te,sectionLabels:ne,sectionDescriptions:re,wizardStepLabels:ie,wizardStepDescriptions:ae,groupLabels:oe,isReady:se}=nE(e,u?.resourceContext,t,`edit`,{layoutRefs:h,overrides:{fields:u?.fields,descriptions:u?.descriptions,enums:u?.enums,sections:u?.sections,wizardSteps:u?.wizardSteps}}),ce=(0,Q.useMemo)(()=>!_||Object.keys(_).length===0?t:{...t,..._},[t,_]),le=BT(m,p||f),ue=(0,Q.useContext)(Fi)?.appConfig,de=(0,Q.useRef)(new Map),fe=(0,Q.useCallback)((e,t)=>{de.current.set(e,t)},[]),pe=(0,Q.useCallback)(e=>{if(!S)return e;let t=Object.fromEntries(Object.entries(S).map(([t,n])=>[t,(n.readsReferences?de.current.get(t):void 0)??Ro(n,{appConfig:ue,currentObject:C,values:e,references:{}})]));return zre(e,t)},[S,C,ue]),me=(0,Q.useMemo)(()=>t=>n(KT(pe(t),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:le,schema:e})),[n,_,v,le,pe]),he=(0,Q.useMemo)(()=>{if(E)return(t,n,r)=>{let i=n.length>0?GT(r,n):r;return E(t,n,KT(pe(i),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:le,schema:e}))}},[E,_,v,le,pe]),ge=(0,Q.useMemo)(()=>({schema:e,fieldLabels:L,fieldDescriptions:R,fieldTooltips:z,enumLabels:te,sectionLabels:ne,sectionDescriptions:re,groupLabels:oe,wizardStepLabels:ie,wizardStepDescriptions:ae,readOnly:s,disabled:o,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,reportRequestFieldOffer:fe,onSectionSave:he,operationType:p||f,operationRef:d,isExisting:(p||f)===`update`,inheritanceConfig:w,hostResolvesRelationshipRoots:A}),[e,L,R,z,te,ne,re,oe,ie,ae,s,o,g,_,v,y,b,x,S,C,fe,w,A,he,p,f,d]);if(!ee||!se){let e=Math.min(Math.max(Object.keys(L??{}).length,1),8);return(0,$.jsx)(`div`,{className:U(`space-y-section`,a),role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:Array.from({length:e}).map((e,t)=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(pm,{className:`h-4 w-28`}),(0,$.jsx)(pm,{className:`h-9 w-full`})]},t))})}return(0,$.jsx)(FT,{schema:e,defaultValues:ce,onSubmit:me,onError:r,validationMode:i,className:a,disabled:o,id:c,onFormReady:D,warnOnUnsavedChanges:l,validateFieldUrl:O,resourceType:k,resourceId:j,operationType:p||f,contextResourceIdentifiers:M,parentResourcesRequirements:N,navigationZone:P,children:(0,$.jsx)(LT,{value:ge,children:(0,$.jsx)($w,{formChromeMode:T,children:(0,$.jsx)(F,{})})})})}rE.displayName=`AutomatedForm`;var iE=rE,aE=(0,Q.createContext)(null);function oE({value:e,children:t}){return(0,$.jsx)(aE.Provider,{value:e,children:t})}function sE(){return(0,Q.useContext)(aE)}function cE(){let e=sE();return!e||e.footerClaimed?null:(0,$.jsxs)(`div`,{className:`mt-section flex flex-col gap-element`,children:[e.submissionNotice,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[e.cancelButton,e.draftSaveButton,e.submitButton]})]})}var lE;(function(e){e.IDLE=`IDLE`,e.QUEUED=`QUEUED`,e.SAVING=`SAVING`,e.ERROR=`ERROR`,e.CONFLICT=`CONFLICT`,e.DELETED=`DELETED`})(lE||={});var uE;(function(e){e.MUTATION_RESULT=`mutation_result`,e.REMOTE_UPDATE=`remote_update`,e.CONFLICT_RESET=`conflict_reset`,e.RESOURCE_DELETED=`resource_deleted`})(uE||={});var dE;(function(e){e.AUTOSAVE=`autosave`,e.SUBMIT=`submit`,e.DRAFT=`draft`,e.PUBLISH=`publish`,e.SECTION=`section`,e.INLINE=`inline`,e.CUSTOM=`custom`})(dE||={});var fE;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.ORCHESTRATOR=`orchestrator`,e.CUSTOM=`custom`})(fE||={});var pE;(function(e){e.VALIDATION=`validation`,e.CONFLICT=`conflict`,e.NOT_FOUND=`not_found`,e.TRANSIENT=`transient`,e.SERVER=`server`,e.ABORT=`abort`,e.REFUSED=`refused`})(pE||={});var mE;(function(e){e.SUCCESS=`success`,e.ERROR=`error`})(mE||={});var hE;(function(e){e.ACCEPT_REMOTE=`accept-remote`,e.LAST_WRITE_WINS=`last-write-wins`})(hE||={});var gE;(function(e){e.VERSION_CONFLICT=`version_conflict`,e.REMOTE_UPDATE=`remote_update`})(gE||={});var _E;(function(e){e.LOCAL=`local`,e.REMOTE=`remote`})(_E||={});var vE;(function(e){e[e.LOW=0]=`LOW`,e[e.NORMAL=1]=`NORMAL`,e[e.HIGH=2]=`HIGH`,e[e.IMMEDIATE=3]=`IMMEDIATE`})(vE||={});var yE=class extends Error{name=`MutationCancelledError`;source;constructor(e){super(`Mutation cancelled`),this.source=e}},bE=class extends Error{name=`ResourceDeletedError`;constructor(){super(`Resource has been deleted`)}},xE=class extends Error{name=`BackpressureRejectedError`;constructor(){super(`Queue at maximum depth — mutation rejected`)}},SE=as.getLogger(),tde=SE.debugByType(`AutosaveContext`);SE.setDebugTypeLogging(`AutosaveContext`,!1);var CE={enabled:!1,defaultTrigger:ou.DEBOUNCE,debounceMs:500,savedStateDurationMs:2e3},wE={state:rT.IDLE},TE=(0,Q.createContext)(null);function EE(){return(0,Q.useContext)(TE)}function DE({children:e,labels:t,validateField:n,onSave:r,rmm:i,config:a,onSaveSuccess:o,onSaveError:s}){let c=(0,Q.useMemo)(()=>({...CE,...a}),[a]),[l,u]=(0,Q.useState)({}),d=(0,Q.useRef)({}),f=(0,Q.useRef)({}),p=(0,Q.useRef)({}),m=(0,Q.useRef)({}),h=(0,Q.useMemo)(()=>Object.values(l).some(e=>e.state===rT.SAVING),[l]),g=GC();(0,Q.useEffect)(()=>()=>{Object.values(d.current).forEach(({timeoutId:e,abortController:t})=>{clearTimeout(e),t.abort()}),Object.values(f.current).forEach(e=>e.abort()),Object.values(m.current).forEach(e=>clearTimeout(e))},[]);let _=(0,Q.useCallback)((e,t)=>{u(n=>({...n,[e]:{...n[e]??wE,...t}}))},[]),v=(0,Q.useCallback)(e=>{m.current[e]&&(clearTimeout(m.current[e]),delete m.current[e])},[]),y=(0,Q.useCallback)(e=>{v(e),_(e,{state:rT.SAVED,lastSavedAt:Date.now()}),m.current[e]=setTimeout(()=>{_(e,{state:rT.IDLE}),delete m.current[e]},c.savedStateDurationMs)},[v,_,c.savedStateDurationMs]),b=(0,Q.useCallback)(e=>{let t=d.current[e];t&&(clearTimeout(t.timeoutId),t.abortController.abort(),delete d.current[e])},[]),x=(0,Q.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`);Object.keys(d.current).filter(t).forEach(e=>b(e));for(let[e,n]of Object.entries(f.current))t(e)&&(n.abort(),delete f.current[e],_(e,{state:rT.IDLE}))},[b,_]),S=(0,Q.useCallback)(()=>{Object.keys(d.current).forEach(e=>{b(e)}),Object.values(f.current).forEach(e=>e.abort()),f.current={},i?.cancelPendingMutations()},[b,i]),C=(0,Q.useCallback)(()=>{S(),u({}),Object.values(m.current).forEach(e=>clearTimeout(e)),m.current={},p.current={}},[S]),w=(0,Q.useCallback)(async(e,a,c)=>{f.current[e]=c;try{let l=n?await n(e):!g||await g.trigger(e);if((n||g)&&!l){_(e,{state:rT.IDLE});return}if(c.signal.aborted)return;_(e,{state:rT.SAVING});try{if(r)await r(e,a,c.signal);else if(i){let n=await i.queueMutation({[e]:a},{type:dE.AUTOSAVE,priority:vE.LOW});if(!n.success)throw n.error??Error(t.errorGeneric)}else return;if(c.signal.aborted)return;y(e),o?.(e)}catch(n){if(c.signal.aborted||n instanceof Error&&n.name===`AbortError`)return;let r=n&&typeof n==`object`&&`type`in n?n:null,i;if(r?.type===pE.TRANSIENT)i=t.errorNetwork;else if(r?.type===pE.VALIDATION)i=t.errorValidation;else if(r?.type===pE.CONFLICT)i=t.errorConflict;else if(n instanceof xE){tde(`executeSave: backpressure rejection — resetting field to idle`,{fieldName:e}),_(e,{state:rT.IDLE});return}else if(n instanceof yE){_(e,{state:rT.IDLE});return}else if(n instanceof bE){_(e,{state:rT.ERROR,lastError:t.errorResourceDeleted});return}else i=t.errorGeneric;_(e,{state:rT.ERROR,lastError:i}),s?.(e,n instanceof Error?n:Error(i))}}finally{f.current[e]===c&&delete f.current[e]}},[g,t,r,s,o,i,y,_,n]),T=(0,Q.useCallback)((e,t,n)=>{if(!c.enabled||n===ou.NONE)return;p.current[e]={value:t,trigger:n},b(e);let r=new AbortController;if(n===ou.BLUR)w(e,t,r);else if(n===ou.DEBOUNCE){let n=c.debounceMs??CE.debounceMs,i=setTimeout(()=>{delete d.current[e],w(e,t,r)},n);d.current[e]={timeoutId:i,abortController:r}}},[c.enabled,c.debounceMs,b,w]),E=(0,Q.useCallback)(e=>{if(!c.enabled)return;let t=p.current[e];if(!t)return;b(e);let n=new AbortController;w(e,t.value,n)},[c.enabled,b,w]),D=(0,Q.useCallback)(e=>l[e]?.state??rT.IDLE,[l]),O=(0,Q.useCallback)(e=>l[e]??wE,[l]),k=(0,Q.useMemo)(()=>({config:c,triggerSave:T,retryFieldSave:E,getFieldState:D,getFieldStateInfo:O,cancelAllPending:S,cancelFieldPending:b,cancelPendingUnder:x,clearAllState:C,isSaving:h}),[c,T,E,D,O,S,b,x,C,h]);return(0,$.jsx)(TE.Provider,{value:k,children:e})}function OE(e,t=ou.DEBOUNCE,n=!1){return e===void 0?t:e===!0?n?ou.DEBOUNCE:ou.BLUR:typeof e==`object`?e.enabled===!1?ou.NONE:e.trigger?e.trigger:n?ou.DEBOUNCE:ou.BLUR:t}var kE=(0,Q.createContext)(null);function nde(){return(0,Q.useContext)(kE)}var rde={[QT.CLEAR]:{action:`bulkClearField`,pending:`bulkFieldWillBeCleared`,pendingUncounted:`bulkFieldWillBeClearedOnSelection`},[QT.EMPTY]:{action:`bulkEmptyField`,pending:`bulkFieldWillBeEmptied`,pendingUncounted:`bulkFieldWillBeEmptiedOnSelection`},[QT.TURN_OFF]:{action:`bulkTurnOffField`,pending:`bulkFieldWillBeTurnedOff`,pendingUncounted:`bulkFieldWillBeTurnedOffOnSelection`}};function AE({fieldName:e,label:t,disabled:n,onSaveFieldNow:r,children:i}){let a=nde(),o=EE(),{tComponent:s}=K({component:B.LOW_LEVEL_FORM_FIELD}),c=a&&e&&!n?a.clearFor(e):void 0,l=c&&e?a?.registerField:void 0;if((0,Q.useEffect)(()=>l&&e?l(e):void 0,[l,e]),!a||!e||!c)return(0,$.jsx)($.Fragment,{children:i});let u=rde[c.kind],d=a.isCleared(e),f=a.selectionCount,p=t?`bulk-clear-${e}-label`:void 0;return(0,$.jsxs)(`div`,{"data-slot":`bulk-field-clear`,"data-bulk-clear-kind":c.kind,"data-bulk-cleared":d||void 0,className:`flex flex-col gap-1`,children:[p&&(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:t}),!d&&i,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{role:`status`,className:`text-sm text-muted-foreground empty:sr-only`,children:d?f===void 0?s(B.LOW_LEVEL_FORM_FIELD,u.pendingUncounted):s(B.LOW_LEVEL_FORM_FIELD,u.pending,{count:f}):null}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-describedby":p,onClick:()=>{d?a.setCleared(e,!1):(o?.cancelPendingUnder(e),a.setCleared(e,!0),r?.(void 0))},children:s(B.LOW_LEVEL_FORM_FIELD,d?`bulkFieldUndoClear`:u.action)})]})]})}function jE(e){if(!e)return[];try{let t=hr.getObjectLikeFieldShape(e,{commonOnly:!0})??{};return Object.entries(t).filter(([,e])=>sne(e)).map(([e])=>e)}catch{return[]}}function ME(e,t,n){if(t.length===0||!n)return e;let r=t.filter(t=>!(t in e)&&n[t]!==void 0);if(r.length===0)return e;let i={...e};for(let e of r)i[e]=n[e];return i}function ide(e){let{formFieldShape:t,inheritanceConfig:n,defaultValuesOverride:r}=e,i={};if(t)for(let[e,n]of Object.entries(t)){let t=Ure(n);t!==void 0&&(i[e]=t)}let a=n?.discriminatorField;if(a&&i[a]===void 0){let e=n?.withoutInheritanceDiscriminatorFieldValues?.[0];e!==void 0&&(i[a]=e)}let o={...i,...r??{}};return Object.keys(o).length>0?o:void 0}function NE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function PE(...e){return t=>{let n=!1,r=e.map(e=>{let r=NE(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():NE(e[t],null)}}}}function FE(...e){return Q.useCallback(PE(...e),e)}var ade=Symbol.for(`react.lazy`),IE=Q.use;function ode(e){return typeof e==`object`&&!!e&&`then`in e}function LE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ade&&`_payload`in e&&ode(e._payload)}function RE(e){let t=sde(e),n=Q.forwardRef((e,n)=>{let{children:r,...i}=e;LE(r)&&typeof IE==`function`&&(r=IE(r._payload));let a=Q.Children.toArray(r),o=a.find(lde);if(o){let e=o.props.children,r=a.map(t=>t===o?Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null:t);return(0,$.jsx)(t,{...i,ref:n,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,$.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var zE=RE(`Slot`);function sde(e){let t=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(LE(n)&&typeof IE==`function`&&(n=IE(n._payload)),Q.isValidElement(n)){let e=dde(n),i=ude(r,n.props);return n.type!==Q.Fragment&&(i.ref=t?PE(t,e):e),Q.cloneElement(n,i)}return Q.Children.count(n)>1?Q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BE=Symbol(`radix.slottable`);function cde(e){let t=({children:e})=>(0,$.jsx)($.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=BE,t}function lde(e){return Q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===BE}function ude(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function dde(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fde=as.getLogger(),VE=B.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,HE=class extends Q.Component{state={error:null,errorInfo:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){fde.error(`[SurfaceErrorBoundary] Surface child crashed`,{error:e,errorInfo:t}),this.setState({error:e,errorInfo:t})}resetError=()=>{this.setState({error:null,errorInfo:null})};render(){return this.state.error?(0,$.jsx)(pde,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.resetError,titleAs:this.props.titleAs}):this.props.children}};function pde(e){return(0,Q.useContext)(Nc)?(0,$.jsx)(mde,{...e}):(0,$.jsx)(UE,{...e,label:e=>`components.${VE}.${e}`})}function mde(e){let{makeTrComponent:t,isReady:n}=K({component:VE});return n?(0,$.jsx)(UE,{...e,label:t(VE)}):e.titleAs?(0,$.jsx)(e.titleAs,{className:`sr-only`}):null}function UE({error:e,errorInfo:t,onRetry:n,titleAs:r,label:i}){let a=xa.isDevelopment(),o=[];return a&&(o.push({label:i(`errorMessageLabel`),content:e.message,variant:`error`}),t?.componentStack&&o.push({label:i(`componentStackLabel`),content:t.componentStack,variant:`info`})),(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(r,{className:`sr-only`,children:i(`title`)}):null,(0,$.jsx)(Wy,{variant:`error`,title:i(`title`),message:i(`message`),actions:[{label:i(`tryAgain`),onClick:n,variant:`primary`}],showDevInfo:a,devInfoTitle:i(`devInfoTitle`),devInfoSections:o})]})}var WE=`data-surface-scroll-lock-count`,GE,hde=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`,KE={a11y:{landmarkRole:`none`}};function qE(e){return Array.from(e.querySelectorAll(hde)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function JE(){return typeof document>`u`?0:Number(document.body.getAttribute(WE)??0)}function YE(e){typeof document<`u`&&(e<=0?(document.body.removeAttribute(WE),document.body.style.overflow=GE??``,GE=void 0):(JE()===0&&(GE=document.body.style.overflow),document.body.setAttribute(WE,String(e)),document.body.style.overflow=`hidden`))}function XE(e){Q.useEffect(()=>{if(e&&typeof document<`u`)return YE(JE()+1),()=>YE(JE()-1)},[e])}function ZE(e,t){Q.useEffect(()=>{if(!t||typeof document>`u`)return;let n=e.current;if(!n)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null;(qE(n)[0]??n).focus({preventScroll:!0});let i=e=>{if(e.key!==`Tab`)return;let t=qE(n);if(t.length===0){e.preventDefault(),n.focus({preventScroll:!0});return}let r=t[0],i=t[t.length-1],a=document.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`keydown`,i),r&&document.body.contains(r)&&r.focus({preventScroll:!0})}},[t,e])}var gde=as.getLogger();function QE(e){switch(e){case`none`:return`0px`;case`field`:return`var(--sp-field)`;case`card-sm`:return`var(--spacing-card-sm)`;case`card`:return`var(--sp-card)`;case`container`:return`var(--sp-container)`;default:return}}function $E(e){switch(e){case`none`:return`0px`;case`item`:return`var(--sp-item)`;case`field`:return`var(--sp-field)`;case`section`:return`var(--sp-section)`;case`lane`:return`var(--sp-region)`;default:return}}function _de(e){switch(e){case`nowrap`:return`nowrap`;case`balance`:return`balance`;case`pretty`:return`pretty`;case`wrap`:return`wrap`;default:return}}function vde(e){switch(e){case`tabular`:return`tabular-nums`;case`lining`:return`lining-nums`;case`inherit`:return`inherit`;default:return}}function yde(e){switch(e){case`break-word`:return`break-word`;case`break-anywhere`:return`anywhere`;case`overflow`:return`normal`;case`inherit`:return`inherit`;default:return}}function bde(e){switch(e){case`content`:return`var(--z-content)`;case`overlay`:return`var(--z-overlay)`;case`transient`:return`var(--z-transient)`;case`guidance`:return`var(--z-guidance)`;case`critical`:return`var(--z-critical)`;default:return}}function eD(e){switch(e){case`stack`:return`column`;case`row`:case`inherit`:return e;case`column-reverse-on-mobile`:return`row`;default:return}}function tD(e){switch(e){case`column-reverse-on-mobile`:return`column-reverse`;case`stack`:return`column`;case`row`:case`inherit`:return e;default:return}}function nD(e){switch(e){case`full`:return`100%`;case`sm`:return`24rem`;case`md`:return`28rem`;case`lg`:return`32rem`;case`xl`:return`36rem`;case`measure`:return`var(--measure-max-width, 42rem)`;case`centered-readable`:return`72ch`;case`content`:return`var(--content-max-width, 80rem)`;default:return`none`}}function xde(e){switch(e){case`sm`:case`md`:case`lg`:case`xl`:case`measure`:case`centered-readable`:case`content`:return`auto`;default:return`0px`}}function Sde(e){switch(e){case`strip`:return`0px`;default:return`var(--surface-policy-padding-inline)`}}function rD(e){switch(e){case`always`:case`when-orphan`:case`never`:return e;default:return}}function iD(e){switch(e){case`inherit`:case`one-tier-tighter`:case`fixed`:return e;default:return}}function aD(e){switch(e){case`collapse`:case`preserve`:return e;default:return}}function oD(e){switch(e){case`border`:case`gap`:case`rule`:case`none`:return e;default:return}}function Cde(e,t){if(t)switch(e){case`inherit`:return`inherit`;case`one-tier-tighter`:return`var(--surface-nested-radius-one-tier-tighter, var(--radius-lg, 0.5rem))`;default:return}}function sD(e){switch(e){case`wrap-children`:case`self-selectable`:case`forbidden`:return e;default:return}}function cD(e){switch(e){case`self`:case`children`:case`none`:return e;default:return}}function wde(e){switch(e){case`region`:case`dialog`:case`alertdialog`:case`complementary`:case`navigation`:case`status`:case`main`:return e;default:return}}function lD(e){return!!(e&&e!==`none`)}function uD(e){return e?`flex`:`block`}function dD(e){return e?`column`:`row`}function Tde(e){let t=e.containment,n=e.nesting,r=e.content,i=e.interactiveState,a=e.geometry,o=e.stacking,s=e.composition,c=lD(t?.gap);return{"--surface-policy-display":uD(c),"--surface-policy-flex-direction":dD(c),"--surface-policy-padding-block":QE(t?.paddingBlock),"--surface-policy-padding-inline":QE(t?.paddingInline),"--surface-policy-overflow":t?.overflow,"--surface-policy-max-height":t?.maxHeight===`none`?`none`:t?.maxHeight,"--surface-policy-gap":$E(t?.gap),"--surface-policy-header-gap":$E(t?.slotGap?.header??t?.gap),"--surface-policy-body-gap":$E(t?.slotGap?.body??t?.gap),"--surface-policy-footer-gap":$E(t?.slotGap?.footer??t?.gap),"--surface-policy-framing-mode":rD(n?.framingMode),"--surface-policy-nested-radius-strategy":iD(n?.nestedRadiusStrategy),"--surface-policy-first-child-edge-strategy":aD(n?.firstChildEdgeStrategy),"--surface-policy-divider-strategy":oD(n?.dividerStrategy),"--surface-policy-z-tier":bde(o?.stackingTier),"--surface-policy-numeric-align":vde(r?.numericAlignment),"--surface-policy-text-wrap":_de(r?.wrapStrategy),"--surface-policy-overflow-wrap":yde(r?.overlongTokenStrategy),"--surface-policy-safe-area":a?.safeAreaPadding?`env(safe-area-inset-bottom)`:`0px`,"--surface-policy-action-alignment":eD(a?.actionAlignment),"--surface-policy-action-alignment-mobile":tD(a?.actionAlignment),"--surface-policy-responsive-max-width":nD(a?.responsiveMaxWidth),"--surface-policy-responsive-max-width-margin":xde(a?.responsiveMaxWidth),"--surface-policy-embedded-table-padding-inline":Sde(s?.embeddedTablePadding),"--surface-policy-child-adaptive-gap":s?.childAdaptiveDensity?`var(--sp-field)`:void 0,"--surface-policy-selectable-semantics":sD(i?.selectableSemantics),"--surface-policy-gesture-opt-in":cD(i?.gestureOptIn)}}function Ede(e,t,n,r){Q.useRef(!1),r&&[e,t].filter(Boolean).join(` `)}function Dde(e,t,n,r,i,a){return r?{...Tde(e),"--surface-policy-nested-radius":a,borderWidth:i?void 0:`0px`,boxShadow:i?void 0:`none`,borderRadius:a?`var(--surface-policy-nested-radius)`:void 0,...t,...n}:{...t,...n}}var fD=Q.forwardRef(function({variant:e=nt.BASE,materialRoleOverride:t,policyOverride:n,asChild:r=!1,emitPolicyVars:i=!0,modal:a=!1,a11yManagedByHost:o=!1,errorFallbackTitleAs:s,className:c,style:l,children:u,role:d,"aria-label":f,"aria-labelledby":p,"data-slot":m,"data-surface":h,tabIndex:g,..._},v){let{getComposedClasses:y,getMaterialProfile:b,getRecipe:x,getSurfacePolicy:S}=Wg(),C=x?.(cc.SURFACE,e),w=y?.(cc.SURFACE,e),T=b?.(t??C?.material),E=Q.useContext(Je),D=Q.useMemo(()=>S?S(e,n,E?.policy):Dc(Zr[e],void 0,void 0,n,{variant:e,parentPolicy:E?.policy,logger:gde}),[S,E?.policy,n,e]),[O,k]=Q.useState(),A=Q.useCallback(e=>{k(e)},[]),j=Q.useCallback(e=>{k(t=>t===e?void 0:t)},[]),M=Q.useMemo(()=>({headerId:O,registerHeaderId:A,unregisterHeaderId:j}),[O,A,j]),N=Q.useMemo(()=>Gr(e,D,E,M),[M,E,D,e]),P=!!E?.isInFramedAncestor,F=P?E?.nearestFramedAncestorVariant??void 0:void 0,I=Cde(D.nesting?.nestedRadiusStrategy,P);Ede(c,r&&Q.isValidElement(u)?u.props.className:void 0,n,i);let ee=r?zE:`div`,L=Q.useRef(null),R=f_(T,L),z=Q.useCallback(e=>{L.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]),te=d??wde(D.a11y?.landmarkRole),ne=p??(D.a11y?.labelStrategy===`from-header`?O:void 0),re={...d===void 0?{}:{role:d},...f===void 0?{}:{"aria-label":f},...p===void 0?{}:{"aria-labelledby":p}},ie=o?re:{...te===void 0?{}:{role:te},...f===void 0?{}:{"aria-label":f},...ne===void 0?{}:{"aria-labelledby":ne}},ae=!o&&(D.a11y?.focusTrap===`on-mount`||a&&D.a11y?.focusTrap===`when-modal`),oe=!o&&a&&D.a11y?.scrollContainment===`lock-body`,se=ae&&g==null?-1:g,ce=se===void 0?{}:{tabIndex:se};ZE(L,ae),XE(oe),Q.useEffect(()=>{},[o,f,p,O,D.a11y?.labelStrategy,te,e]);let le=i?{"data-slot":`surface`,"data-surface":``,"data-inline-size-tier":D.geometry?.responsiveMaxWidth}:{},ue=D.interactiveState?.errorBoundary===`self`,de=ue?Ode(u,r,s):{children:u,boundsContent:!1},fe=(0,$.jsx)(ee,{ref:z,..._,...le,"data-material-kind":R[`data-material-kind`],"data-material-tier":R[`data-material-tier`],"data-material-variant":R[`data-material-variant`],"data-material-depth":R[`data-material-depth`],"data-material-composition":R[`data-material-composition`],"data-material-group":R[`data-material-group`],"data-material-refractive-budget":R[`data-material-refractive-budget`],...ce,"data-surface-focus-trap":ae?``:void 0,"data-surface-scroll-containment":oe?``:void 0,"data-surface-framing-mode":i?rD(D.nesting?.framingMode):void 0,"data-surface-frame":i?N.rendersOwnFrame?`rendered`:`suppressed`:void 0,"data-surface-in-framed-ancestor":i&&P?``:void 0,"data-surface-nearest-framed-ancestor":i?F:void 0,"data-surface-nested-radius-strategy":i?iD(D.nesting?.nestedRadiusStrategy):void 0,"data-surface-first-child-edge-strategy":i?aD(D.nesting?.firstChildEdgeStrategy):void 0,"data-surface-divider-strategy":i?oD(D.nesting?.dividerStrategy):void 0,"data-surface-selectable-semantics":i?sD(D.interactiveState?.selectableSemantics):void 0,"data-surface-gesture-opt-in":i?cD(D.interactiveState?.gestureOptIn):void 0,"data-surface-child-adaptive-density":i&&D.composition?.childAdaptiveDensity===!0?``:void 0,"data-surface-selection-column-aware":i&&D.composition?.selectionColumnAware===!0?``:void 0,...ie,"data-surface-variant":e,className:U(w,c),style:Dde(D,R.style,l,i,N.rendersOwnFrame,I),children:de.children});return(0,$.jsx)(Je.Provider,{value:N,children:ue&&!de.boundsContent?(0,$.jsx)(HE,{children:fe}):fe})});function Ode(e,t,n){if(!t)return{children:(0,$.jsx)(HE,{children:e}),boundsContent:!0};if(!Q.isValidElement(e))return{children:e,boundsContent:!1};let r=e.props.children;return r==null||typeof r==`function`?{children:e,boundsContent:!1}:{children:Q.cloneElement(e,void 0,(0,$.jsx)(HE,{titleAs:n,children:r})),boundsContent:!0}}fD.displayName=`Surface`;function pD(e,t,n){let r=t.containment?.slotGap?.[e]??t.containment?.gap,i=lD(r);return{"--surface-policy-slot-display":uD(i),"--surface-policy-slot-flex-direction":dD(i),[`--surface-policy-${e}-gap`]:$E(r),...n}}var mD=Q.forwardRef(function({className:e,id:t,style:n,...r},i){let a=hc(),o=Q.useContext(Je),s=o?.registerHeaderId,c=o?.unregisterHeaderId,l=Q.useId(),u=t??l;return Q.useEffect(()=>(s?.(u),()=>c?.(u)),[s,u,c]),(0,$.jsx)(`div`,{ref:i,id:u,"data-slot":`surface-header`,className:U(e),style:pD(`header`,a,n),...r})});mD.displayName=`Surface.Header`;var hD=Q.forwardRef(function({className:e,style:t,...n},r){let i=hc();return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-body`,className:U(e),style:pD(`body`,i,t),...n})});hD.displayName=`Surface.Body`;var gD=Q.forwardRef(function({className:e,style:t,...n},r){let i=hc(),a=i.containment?.slotGap?.footer??i.containment?.gap,o=lD(a),s=!!(i.geometry?.actionAlignment&&i.geometry.actionAlignment!==`inherit`);return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-footer`,className:U(e),style:{"--surface-policy-slot-display":uD(o||s),"--surface-policy-slot-flex-direction":dD(o),"--surface-policy-footer-gap":$E(a),"--surface-policy-action-alignment":s?eD(i.geometry?.actionAlignment):void 0,"--surface-policy-action-alignment-mobile":s?tD(i.geometry?.actionAlignment):void 0,...t},...n})});gD.displayName=`Surface.Footer`;var _D=Q.forwardRef(function({className:e,...t},n){return(0,$.jsx)(`div`,{ref:n,"data-slot":`surface-action`,className:U(e),...t})});_D.displayName=`Surface.Action`;var vD=Object.assign(fD,{Header:mD,Body:hD,Footer:gD,Action:_D}),yD=Q.createContext(void 0);function kde(e){return e===y.EYEBROW?y.EYEBROW:y.LABEL}function bD(){return Q.useContext(yD)}function xD({voice:e,children:t}){return Q.createElement(yD.Provider,{value:e},t)}function SD({children:e}){let t=bD();return Q.createElement(yD.Provider,{value:kde(t)},e)}var Ade=`text-base`;function CD(e){return U(e(cc.TYPOGRAPHY,y.HEADING).base,Ade)}var wD=(0,Q.createContext)({pathPrefix:``});function TD({pathPrefix:e,children:t}){return(0,$.jsx)(wD.Provider,{value:{pathPrefix:e},children:t})}function ED(){return(0,Q.useContext)(wD)}function DD(e){let{pathPrefix:t}=ED();return t?`${t}.${e}`:e}var OD=(0,Q.createContext)(null);function kD(e){let t=(0,Q.useContext)(OD);(0,Q.useLayoutEffect)(()=>{t?.registerSlot(e)},[e,t])}function jde(){let e=(0,Q.useContext)(OD);(0,Q.useLayoutEffect)(()=>{e?.registerWizardRoot()},[e])}var AD=Qs(B.LOW_LEVEL_ALERT,`Alert`,[`Title`,`Description`]);function jD({preset:e=q.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n,{...t})}function MD({preset:e=q.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n.Title,{...t})}function ND({preset:e=q.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n.Description,{...t})}function PD(){let e=(0,Q.useContext)(iT);if(!e)throw Error(`useFormSchemaContext must be used within a FormSchemaProvider`);return e}function FD(){return(0,Q.useContext)(iT)}var Mde=as.getLogger().debugByType(`FormErrorCategorization`),ID=class e{constructor(){}static ROOT_ERROR_PATHS=new Set([``,`root`,`_`]);static ROOT_ERROR_PREFIX=cT;static isCrossFieldErrorPath(t){return e.isFormLevelErrorPath(t)}static isFormLevelErrorPath(t){return!t||e.ROOT_ERROR_PATHS.has(t)||t.startsWith(e.ROOT_ERROR_PREFIX)}static flattenErrors(t,n=``){let r=[];for(let[i,a]of Object.entries(t)){let t=n?`${n}.${i}`:i;a?.message&&typeof a.message==`string`?r.push({path:t,message:a.message,type:a.type}):typeof a==`object`&&a&&r.push(...e.flattenErrors(a,t))}return r}static categorizeErrors(t){let n=e.flattenErrors(t),r=[],i=[],a=[];for(let t of n)t.type===`server`||t.type===`server-unique`?a.push(t):e.isCrossFieldErrorPath(t.path)?i.push(t):r.push(t);return Mde(`categorizeErrors`,{totalErrors:n.length,fieldErrors:r.length,crossFieldErrors:i.length,serverErrors:a.length,serverFields:a.map(e=>e.path),crossFieldPaths:i.map(e=>e.path)}),{fieldErrors:r,crossFieldErrors:i,serverErrors:a}}},LD=`wildo:reveal-field`,RD=`data-reveal-container`,zD=`data-reveal-panel`;function BD(e){let t={revealed:!1};return e.dispatchEvent(new CustomEvent(LD,{bubbles:!0,detail:t})),t.revealed}function VD(e,t,n=20){let r=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),i=0,a=()=>{e.getClientRects().length>0||i>=n?t():(i+=1,r(a))};r(a)}function HD(e){let t=(0,Q.useId)(),n=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{n.current=e}),(0,Q.useEffect)(()=>{if(typeof document>`u`)return;let e=e=>{let r=e.detail;for(let i=e.target instanceof Element?e.target:null;i;i=i.parentElement){if(i.getAttribute(RD)!==t)continue;let e=i.getAttribute(zD);e!==null&&n.current(e)&&r&&(r.revealed=!0);return}};return document.addEventListener(LD,e),()=>document.removeEventListener(LD,e)},[t]),t}function UD(e,t){return{[RD]:e,[zD]:t}}function WD(){return GC()!=null}var GD=`data-form-error-summary`;function KD(e){let t=[],n=(e,r)=>{if(!e||typeof e!=`object`)return;let i=e;if(typeof i.message==`string`||typeof i.type==`string`)r&&t.push(r);else for(let[e,t]of Object.entries(i))e===`root`?n(t,r):n(t,r?`${r}.${e}`:e)};return n(e,``),t}function Nde(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function qD(e){if(typeof document>`u`||e.length===0)return!1;let t=new Set(e),n=null,r=document.querySelectorAll(`[data-field]`);for(let i of r){let r=i.getAttribute(`data-field`);if(r&&(t.has(r)||e.some(e=>e.startsWith(`${r}.`)))){n=i;break}}if(!n)for(let t of e){let e=document.querySelector(`[name="${Nde(t)}"]`);if(e){n=e;break}}if(!n)return e.some(e=>ID.isFormLevelErrorPath(e))?(Pde(),!0):!1;let i=n;return BD(i)?VD(i,()=>JD(i)):JD(i),!0}function Pde(e=20){let t=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),n=0,r=()=>{let i=document.querySelector(`[${GD}]`);i?(i.scrollIntoView({behavior:`smooth`,block:`center`}),i.focus({preventScroll:!0})):n<e&&(n+=1,t(r))};r()}function JD(e){e.scrollIntoView({behavior:`smooth`,block:`center`});let t=e;setTimeout(()=>{if(!document.body.contains(t))return;let e=t.matches(`input, textarea, select, button, [tabindex]:not([tabindex="-1"])`)?t:t.querySelector(`input, textarea, select, button, [tabindex]:not([tabindex="-1"])`);if(e&&document.body.contains(e))try{e.focus({preventScroll:!0})}catch{e.focus()}},100)}var YD=as.getLogger(),Fde=YD.debugByType(`FormErrorSummary`);YD.setDebugTypeLogging(`FormErrorSummary`,!1);function XD({title:e,className:t,maxErrors:n=10,stepFieldNames:r}){let{formState:i}=GC(),{renderIcon:a}=Mf(),o=hc(),s=FD(),c=s?.resourceType,{tResourceFieldEdit:l,tComponent:u,isReady:d}=K({component:B.LOW_LEVEL_FORM_MESSAGE,...c?{resource:c}:{}}),f=e??u(B.LOW_LEVEL_FORM_MESSAGE,`formErrorsTitle`),{fieldErrors:p,crossFieldErrors:m,serverErrors:h}=ID.categorizeErrors(i.errors),g=o.autoRender?.autoErrorPlacement===`summary-at-surface-top`,_=(0,Q.useMemo)(()=>r?e=>r.some(t=>e===t||e.startsWith(`${t}.`)):()=>!0,[r]),v=(0,Q.useMemo)(()=>h.filter(e=>ID.isFormLevelErrorPath(e.path)||_(e.path)),[h,_]),y=(0,Q.useMemo)(()=>g?p.filter(e=>_(e.path)):[],[p,g,_]),b=[...m,...v,...y],x=zT()?.fieldLabels,S=(0,Q.useMemo)(()=>hr.createFieldLabelResolver(c,l,s?.schema,x),[c,l,s?.schema,x]);if(b.length===0||!d)return null;Fde(`rendering error summary`,{fieldCount:y.length,crossFieldCount:m.length,serverCount:v.length,totalServerErrors:h.length,isWizardFiltered:!!r,errors:b.map(e=>({path:e.path,type:e.type,message:e.message}))});let C=b.slice(0,n),w=b.length>n;return(0,$.jsx)(jD,{variant:`destructive`,className:U(t),role:`alert`,"data-testid":`form-error-summary`,[GD]:``,tabIndex:-1,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[a(H.ERROR,{size:ca.SM,className:`mt-0.5`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(MD,{className:`mb-element`,children:f}),(0,$.jsxs)(ND,{children:[(0,$.jsx)(`ul`,{className:`list-disc list-inside space-y-item-xs text-sm`,children:C.map(({path:e,message:t},n)=>(0,$.jsxs)(`li`,{children:[ID.isFormLevelErrorPath(e)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[S(e),`:`]}),` `]}),t]},`${e}-${n}`))}),w&&(0,$.jsx)(`p`,{className:`mt-item text-sm opacity-[var(--opacity-hover)]`,children:u(B.LOW_LEVEL_FORM_MESSAGE,`moreErrors`,{count:b.length-n})})]})]})]})})}XD.displayName=`FormErrorSummary`;var ZD=XD,QD=(0,Q.createContext)(null),$D=(0,Q.createContext)(null);function eO(){return(0,Q.useContext)(QD)}function tO({className:e}){kD(`errorSummary`);let t=eO();return(0,$.jsx)(ZD,{className:e,stepFieldNames:t?.getCurrentStepFieldNames()})}function nO({loading:e,children:t,width:n=`4em`,className:r}){return e?(0,$.jsx)(pm,{"aria-hidden":`true`,className:U(`inline-block h-[1em] align-[-0.125em] rounded-sm`,r),style:{width:n}}):t}nO.displayName=`SkeletonText`;function rO({className:e,label:t,submittingLabel:n,fullWidth:r,disabled:i}){kD(`submitButton`);let{formState:a}=GC(),o=zT(),{tComponent:s,isReady:c}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),l=t===void 0&&!c,u=t??(c?s(B.LOW_LEVEL_FORM_MESSAGE,`submitSave`):void 0),d=a.isSubmitting||!!o?.disabled||l||i===!0,f=a.isSubmitting&&n?n:u;return(0,$.jsx)(`div`,{className:e,children:(0,$.jsx)(X,{type:`submit`,disabled:d,className:r?`w-full`:void 0,children:(0,$.jsx)(nO,{loading:l,width:`5em`,children:f})})})}rO.displayName=`SubmitButton`;var iO;(function(e){e.AUTOMATIC=`automatic`,e.MANUAL=`manual`})(iO||={});var aO;(function(e){e.PRIMARY=`primary`,e.SECONDARY=`secondary`})(aO||={});var oO=Q.createContext(null),sO=Qs(B.LOW_LEVEL_TABS,`Tabs`,[`List`,`Trigger`,`Content`]);function cO({preset:e=q.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n,{...t})}function lO({preset:e=q.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.List,{...t})}function uO({preset:e=q.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.Trigger,{...t})}function dO({preset:e=q.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.Content,{...t})}var fO=Qs(B.LOW_LEVEL_ACCORDION,`Accordion`,[`Item`,`Trigger`,`Content`]);function pO({preset:e=q.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n,{...t})}function mO({preset:e=q.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n.Item,{...t})}function hO({preset:e=q.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n.Trigger,{...t})}function gO({preset:e=q.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n.Content,{...t})}var _O;(function(e){e.SINGLE=`single`,e.MULTIPLE=`multiple`})(_O||={});var vO;(function(e){e.SEGMENTED=`segmented`,e.CHIPS=`chips`})(vO||={});var yO=Qs(B.LOW_LEVEL_TOGGLE_GROUP,`ToggleGroup`,[`Item`]),bO=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=yO(e);return(0,$.jsx)(r,{...t,ref:n})});bO.displayName=`ToggleGroup`;function xO({preset:e=q.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Item,{...t})}var SO=Qs(B.LOW_LEVEL_COLLAPSIBLE,`Collapsible`,[`Trigger`,`Content`]);function CO({preset:e=q.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n,{...t})}function wO({preset:e=q.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n.Trigger,{...t})}function TO({preset:e=q.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n.Content,{...t})}var EO=Qs(B.LOW_LEVEL_STEPPER,`Stepper`,[`Item`,`Indicator`,`Separator`,`Title`,`Description`]);function DO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n,{...t})}function OO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Item,{...t})}function kO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Indicator,{...t})}function AO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Separator,{...t})}function jO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Title,{...t})}function MO({preset:e=q.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Description,{...t})}var NO;(function(e){e.REACHED=`reached`,e.CURRENT=`current`,e.NOT_REACHED=`not_reached`})(NO||={});var PO=class extends Error{constructor(e){super(`[Section STAGES] ${e}`),this.name=`SectionStageBindingError`}};function FO(e,t,n){let r=t.join(`, `);if(e===void 0)throw new PO(`the group (${r}) declares no stageBinding. Declare it on the group's first section: which record field holds the stage, and which section each of its values is.`);if(n===void 0||n.length===0)throw new PO(`stageBinding.field "${e.field}" of the group (${r}) is not an enum field of the record. A stage is one value of a closed vocabulary.`);let i=new Set(n),a=new Set(t),o=Object.keys(e.stageOfValue).filter(e=>!i.has(e));if(o.length>0)throw new PO(`stageBinding.stageOfValue maps ${o.map(e=>`"${e}"`).join(`, `)}, which ${o.length===1?`is not a value`:`are not values`} of "${e.field}" (${n.join(`, `)}).`);let s=n.filter(t=>!Object.prototype.hasOwnProperty.call(e.stageOfValue,t));if(s.length>0)throw new PO(`stageBinding.stageOfValue places no stage for ${s.map(e=>`"${e}"`).join(`, `)} of "${e.field}". Every value must name the stage a record holding it is at, or that record would show as having reached nothing.`);let c=[...new Set(Object.values(e.stageOfValue))].filter(e=>!a.has(e));if(c.length>0)throw new PO(`stageBinding.stageOfValue names ${c.map(e=>`"${e}"`).join(`, `)}, which ${c.length===1?`is not a section`:`are not sections`} of the group (${r}).`)}function IO(e,t){return typeof t==`string`&&Object.prototype.hasOwnProperty.call(e.stageOfValue,t)?e.stageOfValue[t]:null}function LO(e,t){let n=t===null?-1:e.indexOf(t);return e.map((e,t)=>n<0||t>n?NO.NOT_REACHED:t===n?NO.CURRENT:NO.REACHED)}var Ide=new Set([cr.DEFAULT,cr.CARD,cr.GHOST,cr.COLLAPSIBLE]);function RO(e){return Ide.has(e)}function Lde(e,t,n){let r=Q.Children.toArray(e),i=[];for(let e=0;e<r.length;e++){let a=r[e];if(!t(a)){i.push({type:`node`,node:a});continue}let o=a.props.appearance??n??cr.DEFAULT;if(RO(o)){i.push({type:`node`,node:a});continue}let s=o,c=Rde(s,a.props),l=i[i.length-1];if(l?.type===`group`&&l.group.groupingKey===c){l.group.sections.push(a);continue}let u={mode:s,sections:[a],insertionIndex:e,groupingKey:c};i.push({type:`group`,group:u})}return{items:i}}function Rde(e,t){switch(e){case cr.INLINE:return JSON.stringify({mode:e,gap:t.gap});case cr.GRID:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth});case cr.COLUMNS:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap});case cr.VERTICAL_TABS:return JSON.stringify({mode:e,navWidth:t.navWidth});case cr.ACCORDION:return JSON.stringify({mode:e,allowMultiple:t.allowMultiple});case cr.EXPANDABLE:return JSON.stringify({mode:e,initialVisibleCount:t.initialVisibleCount});case cr.STEPPER:return JSON.stringify({mode:e,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation});case cr.TABS:case cr.PILLS:case cr.TIMELINE:case cr.STAGES:return JSON.stringify({mode:e});default:return JSON.stringify({mode:e})}}function zde(e){let t=e.sections[0].props,n=e.mode,r={mode:n,ariaLabel:void 0,ariaLabelledBy:void 0};switch(n){case cr.INLINE:return{...r,mode:n,gap:t.gap};case cr.GRID:return{...r,mode:n,columnCount:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth};case cr.COLUMNS:return{...r,mode:n,columnCount:t.columns,gap:t.gap};case cr.TABS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case cr.VERTICAL_TABS:{let i=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:i?.props.name??e.sections[0].props.name,navWidth:t.navWidth}}case cr.PILLS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case cr.ACCORDION:{let i=e.sections.filter(e=>e.props.defaultFocus).map(e=>e.props.name);return{...r,mode:n,allowMultiple:t.allowMultiple,defaultExpanded:i.length>0?i:[e.sections[0].props.name]}}case cr.EXPANDABLE:return{...r,mode:n,initialVisibleCount:t.initialVisibleCount};case cr.STEPPER:return{...r,mode:n,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation??mu.VERTICAL};case cr.TIMELINE:return{...r,mode:n};case cr.STAGES:return{...r,mode:n};default:return{mode:cr.INLINE}}}function Bde(e){switch(e){case`grouped`:case`flat`:case`separator-only`:return e;default:return`card-each`}}function zO(e){switch(e){case`flat`:return{appearance:cr.DEFAULT};case`separator-only`:return{appearance:cr.DEFAULT,className:`border-b pb-field last:border-b-0 last:pb-0`};default:return{appearance:cr.CARD}}}var BO=({sections:e,className:t})=>{let{getRecipe:n}=Wg(),r=n(cc.SURFACE,nt.CARD),i=n(cc.TYPOGRAPHY,y.EYEBROW),a=JO();return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.CARD,policyOverride:{nesting:{framingMode:`always`}},children:(0,$.jsx)(`div`,{role:`region`,"aria-label":a(`contentSectionsRegion`),className:U(r.base,`divide-y divide-border`,t),children:e.map(e=>(0,$.jsxs)(`section`,{"data-slot":`content-group`,className:`space-y-field p-card`,children:[(e.title!=null||e.icon!=null)&&(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-xs`,i.base),children:[e.icon!=null&&(0,$.jsx)(`span`,{className:`inline-flex items-center`,children:e.icon}),e.title]}),e.description!=null&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,$.jsx)(OT,{appearance:cr.DEFAULT,disabled:e.disabled,children:e.content})]},e.id))})})};function VO(e,t){let{appearance:n,className:r}=zO(t?.wrapMode??`card-each`);return(0,$.jsx)(OT,{panel:!0,appearance:n,headingTag:t?.titleTag,legend:e.title,icon:e.icon,description:e.description,disabled:e.disabled,className:r,children:e.content},e.id)}function HO(e,t=e.content,n=`card-each`){let{appearance:r,className:i}=zO(n);return(0,$.jsx)(OT,{panel:!0,appearance:r,className:i,children:t},e.id)}function UO({section:e}){let{getRecipe:t}=Wg();return e.description==null?e.content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:U(`mb-field`,t(cc.TYPOGRAPHY,y.DESCRIPTION).base),children:e.description}),e.content]})}var WO=({sections:e,config:t,className:n,onSectionChange:r})=>{let i=Bde(hc().autoRender?.autoSectionWrap);if(e.length===0)return t.emptyStateMessage?(0,$.jsx)(dm,{title:t.emptyStateMessage,variant:`compact`,className:n}):null;if(e.length===1&&!t.showSingleSectionNav)return i===`grouped`?(0,$.jsx)(BO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:n,children:VO(e[0],{wrapMode:i})});switch(t.mode){case cr.DEFAULT:case cr.CARD:case cr.GHOST:case cr.INLINE:return(0,$.jsx)(YO,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.GRID:return(0,$.jsx)(Hde,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.COLUMNS:return(0,$.jsx)(Ude,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.TABS:return(0,$.jsx)(Wde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.VERTICAL_TABS:return(0,$.jsx)(qde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.PILLS:return(0,$.jsx)(Jde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.ACCORDION:return(0,$.jsx)(Yde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.COLLAPSIBLE:return(0,$.jsx)(Zde,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.EXPANDABLE:return(0,$.jsx)($de,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.STEPPER:return(0,$.jsx)(efe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.TIMELINE:return(0,$.jsx)(tfe,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.STAGES:return(0,$.jsx)(nfe,{sections:e,config:t,className:n,sectionWrapMode:i});default:return(0,$.jsx)(YO,{sections:e,config:{mode:cr.INLINE},className:n,sectionWrapMode:i})}},GO={sm:`gap-element`,md:`gap-field`,lg:`gap-section`},Vde={sm:`var(--spacing-element)`,md:`var(--spacing-field)`,lg:`var(--spacing-section)`},KO=`300px`,qO=B.LOW_LEVEL_CONTENT_SECTION_CONTAINER;function JO(){let{tComponent:e}=K({component:qO});return(0,Q.useCallback)((t,n)=>{let r=e(qO,t,n);return r===`${ai.COMPONENTS}.${qO}.${t}`?``:r},[e])}var YO=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=GO[(`gap`in t?t.gap:void 0)??`md`],a=JO();return r===`grouped`?(0,$.jsx)(BO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:U(`flex flex-col`,i,n),role:`region`,"aria-label":t.ariaLabel??a(`contentSectionsRegion`),children:e.map(e=>VO(e,{wrapMode:r}))})},Hde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.columnCount===`auto`||t.columnCount===void 0?void 0:t.columnCount,a=t.gap??`md`,o=t.minColumnWidth??`300px`,s=GO[a],c=JO(),l=i?`max(${o}, calc((100% - ${i-1} * ${Vde[a]}) / ${i}))`:o,u={gridTemplateColumns:`repeat(${i?`auto-fill`:`auto-fit`}, minmax(min(100%, ${l}), 1fr))`};return(0,$.jsx)(`div`,{className:U(`grid`,s,n),style:u,role:`region`,"aria-label":t.ariaLabel??c(`contentGridRegion`),children:e.map(e=>VO(e,{wrapMode:r}))})},Ude=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=GO[t.gap??`md`],a=JO(),o=t.columnCount===`auto`||t.columnCount===void 0?KO:`${t.columnCount} ${KO}`;return(0,$.jsx)(`div`,{className:U(i,n),style:{columns:o},role:`region`,"aria-label":t.ariaLabel??a(`contentColumnsRegion`),children:e.map(e=>(0,$.jsx)(`div`,{className:U(`break-inside-avoid mb-field`,r===`separator-only`&&`border-b pb-field last:border-b-0 last:pb-0`),children:VO(e,{wrapMode:r===`separator-only`?`flat`:r})},e.id))})};function XO(e,t,n){let[r,i]=(0,Q.useState)(e.defaultActive??t[0]?.id),a=e.activeSection??r,o=e=>{i(e),n?.(e)};return{active:a,select:o,revealContainerId:HD(e=>e!==a&&(o(e),!0))}}var Wde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=JO(),o=WD(),{active:s,select:c,revealContainerId:l}=XO(t,e,i);return(0,$.jsxs)(cO,{value:s,className:n,onValueChange:c,children:[(0,$.jsx)(lO,{"aria-label":t.ariaLabel??a(`sectionTabsNav`),children:e.map(e=>(0,$.jsxs)(uO,{value:e.id,disabled:e.disabled,...e.count===void 0?{}:{count:e.count},...e.countTone===void 0?{}:{countTone:e.countTone},children:[e.icon&&(0,$.jsx)(`span`,{className:`me-element`,children:e.icon}),e.title]},e.id))}),e.map(e=>(0,$.jsx)(dO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...UD(l,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:HO(e,(0,$.jsx)(UO,{section:e}),r)},e.id))]})},Gde=36;function Kde(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!t||typeof ResizeObserver>`u`)return;let n=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,r=t=>i(t>0&&t<e*n);r(t.getBoundingClientRect().width);let a=new ResizeObserver(([e])=>{e&&r(e.contentRect.width)});return a.observe(t),()=>a.disconnect()},[t,e]),[n,r]}var qde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=JO(),o=WD(),{active:s,select:c,revealContainerId:l}=XO(t,e,i),u=t.navWidth??`w-48`,[d,f]=Kde(Gde);return(0,$.jsx)(`div`,{ref:d,className:`min-w-0`,"data-vertical-tabs-stacked":f||void 0,children:(0,$.jsxs)(cO,{value:s,orientation:f?mu.HORIZONTAL:mu.VERTICAL,className:U(`mt-field`,n),onValueChange:c,children:[(0,$.jsx)(lO,{className:f?void 0:U(u,`shrink-0 self-start border-e pe-card`),"aria-label":t.ariaLabel??a(`verticalTabsRegion`),children:e.map(e=>(0,$.jsxs)(uO,{value:e.id,disabled:e.disabled,...e.count===void 0?{}:{count:e.count},...e.countTone===void 0?{}:{countTone:e.countTone},children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id))}),e.map(e=>(0,$.jsx)(dO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...UD(l,e.id),className:`min-w-0 flex-1 animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:HO(e,(0,$.jsx)(UO,{section:e}),r)},e.id))]})})},Jde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(t.defaultActive??e[0]?.id),s=t.activeSection??a,c=o,{getRecipe:l}=Wg(),u=JO(),d=(0,Q.useId)(),f=(0,Q.useRef)(null),p=l(cc.SELECTABLE,Pa.FILLED),m=WD(),h=e=>`${d}-tab-${e}`,g=e=>`${d}-panel-${e}`,_=e=>{c(e),i?.(e)},v=HD(e=>e!==s&&(_(e),!0)),y=t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key))return;let n=e.filter(e=>!e.disabled).map(e=>e.id);if(n.length===0)return;t.preventDefault();let r=n.indexOf(s),i=r<0?0:r;t.key===`ArrowRight`?i=(r+1)%n.length:t.key===`ArrowLeft`?i=(r-1+n.length)%n.length:t.key===`Home`?i=0:t.key===`End`&&(i=n.length-1);let a=n[i];_(a),f.current?.querySelector(`#${CSS.escape(h(a))}`)?.focus()},b=e.find(e=>e.id===s),x=e=>(0,$.jsx)(`div`,{role:`tabpanel`,id:g(e.id),"aria-labelledby":h(e.id),tabIndex:0,hidden:e.id!==s,...UD(v,e.id),className:U(`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,Rg(d_.INSET)),children:HO(e,(0,$.jsx)(UO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`space-y-field`,n),role:`region`,"aria-label":t.ariaLabel??u(`pillNavigationRegion`),children:[(0,$.jsx)(`div`,{ref:f,className:`flex flex-wrap items-center gap-item`,role:`tablist`,"aria-label":t.ariaLabel??u(`sectionTabsNav`),onKeyDown:y,children:e.map(e=>{let t=s===e.id;return(0,$.jsxs)(`button`,{id:h(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":g(e.id),"data-state":t?`active`:`inactive`,tabIndex:t?0:-1,disabled:e.disabled,className:U(`inline-flex items-center gap-element rounded-md px-card-sm py-item font-medium`,p.base,p.motion?.transition,p.states.focus,!t&&p.states.hover,t&&p.states.selected,e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),onClick:()=>_(e.id),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id)})}),m?e.map(x):b&&x(b)]})},Yde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=t.defaultExpanded??[e[0]?.id],o=t.allowMultiple??!1,s=WD(),{getRecipe:c}=Wg(),l=CD(c),[u,d]=(0,Q.useState)(o?a:a.slice(0,1)),f=e=>{d(e),i?.(o?e:e[0]??``)},p=HD(e=>!u.includes(e)&&(f(o?[...u,e]:[e]),!0)),m=e.map(e=>(0,$.jsxs)(mO,{value:e.id,disabled:e.disabled,children:[(0,$.jsx)(hO,{className:U(e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:(0,$.jsxs)(`span`,{className:U(`flex items-center gap-element`,l),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]})}),(0,$.jsx)(gO,{...s?{forceMount:!0,hidden:!u.includes(e.id)}:{},...UD(p,e.id),children:HO(e,(0,$.jsx)(UO,{section:e}),`flat`)})]},e.id));return o?(0,$.jsx)(pO,{type:_O.MULTIPLE,value:u,className:n,onValueChange:e=>f(e),children:m}):(0,$.jsx)(pO,{type:_O.SINGLE,value:u[0]??``,className:n,collapsible:!0,onValueChange:e=>f(e?[e]:[]),children:m})},Xde=`all`,Zde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let[i,a]=(0,Q.useState)(!0),o=JO(),s=t.triggerLabel?.open??o(`accordionCollapseAll`),c=t.triggerLabel?.closed??o(`accordionExpandAll`),l=o(`accordionSectionCount`,{count:e.length}),u=WD(),d=HD(()=>!i&&(a(!0),!0));return(0,$.jsxs)(CO,{open:i,onOpenChange:a,className:n,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l}),(0,$.jsx)(wO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-expanded":i,children:i?s:c})})]}),(0,$.jsx)(TO,{className:`space-y-field mt-field`,...u?{forceMount:!0,hidden:!i}:{},...UD(d,Xde),children:e.map(e=>VO(e,{titleTag:`h4`,wrapMode:r}))})]})},Qde=`folded`,$de=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.initialVisibleCount??3,[a,o]=(0,Q.useState)(!1),s=JO(),c=a?e:e.slice(0,i),l=e.length-i,u=t.showMoreLabel??s(`expandableShowMore`,{count:l}),d=t.showLessLabel??s(`expandableShowLess`),f=WD(),{renderIcon:p}=Mf(),m=HD(()=>!a&&(o(!0),!0));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,n),children:[f?(0,$.jsxs)($.Fragment,{children:[e.slice(0,i).map(e=>VO(e,{wrapMode:r})),l>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,hidden:!a,...UD(m,Qde),children:e.slice(i).map(e=>VO(e,{wrapMode:r}))})]}):c.map(e=>VO(e,{wrapMode:r})),l>0&&(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,onClick:()=>o(!a),"aria-expanded":a,children:[a?d:u,p(a?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.SM})]})]})},efe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(0),s=JO(),c=(0,Q.useId)(),l=t.orientation??mu.HORIZONTAL,u=t.showProgress??!1,d=t.allowSkip??!1,f=t.nextLabel??s(`stepperNext`),p=t.previousLabel??s(`stepperPrevious`),m=e=>d||e<=a+1,h=t=>{t<0||t>=e.length||m(t)&&(o(t),i?.(e[t].id))},g=WD(),_=HD(t=>{let n=e.findIndex(e=>e.id===t);return n<0||n===a?!1:(o(n),i?.(t),!0)}),v=e[a],y=(e,t)=>(0,$.jsx)(`div`,{hidden:t!==a,...UD(_,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:HO(e,(0,$.jsx)(UO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-section`,n),children:[(0,$.jsx)(`nav`,{id:c,"aria-label":t.ariaLabel??s(`stepperProgressNav`),children:(0,$.jsx)(DO,{currentStep:a,totalSteps:e.length,orientation:l,onStepSelect:h,isStepSelectable:e=>e!==a&&m(e),...t.completedIcon===void 0?{}:{completedIcon:t.completedIcon},role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(OO,{step:n,role:`listitem`,"aria-current":n===a?`step`:void 0,children:[(0,$.jsx)(kO,{step:n,"aria-hidden":`true`}),(0,$.jsx)(jO,{step:n,children:t.title})]}),n<e.length-1&&(0,$.jsx)(AO,{step:n,"aria-hidden":`true`})]},t.id))})}),u&&(0,$.jsx)(`div`,{className:`w-full bg-muted rounded-full h-2`,children:(0,$.jsx)(`div`,{className:`bg-primary h-2 rounded-full transition-[width]`,style:{width:`${(a+1)/e.length*100}%`},role:`progressbar`,"aria-labelledby":c,"aria-valuenow":a+1,"aria-valuemin":1,"aria-valuemax":e.length})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-field`,children:[g?e.map(y):v&&y(v,a),(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>h(a-1),disabled:a===0,children:p}),a<e.length-1&&(0,$.jsx)(X,{type:`button`,onClick:()=>h(a+1),children:f})]})]})]})},tfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=JO();return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`timelineRegion`),children:(0,$.jsx)(Uf,{className:`gap-section`,children:e.map((e,t)=>(0,$.jsx)(Rf,{children:(0,$.jsx)(mf,{children:HO(e,(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element mb-element`,children:[e.icon,(0,$.jsx)(`h3`,{className:`font-semibold`,children:e.title}),(0,$.jsx)(If,{variant:`outline`,className:`ms-auto`,children:i(`timelineStep`,{step:t+1})})]}),e.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-element`,children:e.description}),e.content]}),r)})},e.id))})})},nfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=JO(),a=t.currentStage;if(a===void 0)return e.map(e=>e.id).join(`|`),(0,$.jsx)(YO,{sections:e,config:{mode:cr.INLINE},className:n,sectionWrapMode:r});let o=LO(e.map(e=>e.id),a),s=o.indexOf(NO.CURRENT);return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`stagesRegion`),"data-current-stage":a??void 0,children:(0,$.jsx)(DO,{currentStep:s,totalSteps:e.length,orientation:mu.VERTICAL,role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(OO,{step:n,role:`listitem`,"data-stage":t.id,"data-stage-state":o[n],"aria-current":o[n]===NO.CURRENT?`step`:void 0,children:[(0,$.jsx)(kO,{step:n,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(jO,{step:n,children:t.title}),t.description!=null&&(0,$.jsx)(MO,{step:n,children:t.description}),(0,$.jsx)(`div`,{className:`mt-field`,children:t.content})]})]}),n<e.length-1&&(0,$.jsx)(AO,{step:n,"aria-hidden":`true`,className:`ms-[calc(1rem-1px)] my-element`})]},t.id))})})};WO.displayName=`ContentSectionContainer`;function ZO(e,t,n){if(!e||typeof e!=`object`)return;let r=e;if(typeof r.type==`string`||typeof r.message==`string`)n.push({path:t,error:r});else for(let[e,i]of Object.entries(r))ZO(i,e===`root`?t:`${t}.${e}`,n)}function QO(e,t){let n=[];for(let r of t)ZO(e.getFieldState(r).error,r,n);return n}var $O=e=>e.type===`server`||e.type===`server-unique`;async function ek(e,t){if(t.length===0)return!0;let n=QO(e,t).filter(e=>$O(e.error)),r=await e.trigger(t);for(let{path:t,error:r}of n)e.getFieldState(t).error||e.setError(t,{type:r.type,message:r.message});if(r&&n.length===0)return!0;let i=QO(e,t),a=e,o=rfe(a);for(let e of i)$O(e.error)||o.has(e.path)||a.setValue(e.path,a.getValues(e.path),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1});return qD(i.map(e=>e.path)),!1}function rfe(e){let t=e.control._names?.array;return t instanceof Set?t:new Set}var tk=(0,Q.createContext)(null);function nk({value:e,children:t}){return(0,$.jsx)(tk.Provider,{value:e,children:t})}function rk(){let e=(0,Q.useContext)(tk);if(!e)throw Error(`useDisplayTemplateContext() must be used within a <DisplayTemplateProvider>. This is provided automatically by AutomaticDisplayer / ResourceAutomaticDisplayer.`);return e}function ik(){return(0,Q.useContext)(tk)}var ak=(0,Q.createContext)(void 0);function ok({displayChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({displayChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(ak.Provider,{value:r,children:n})}function sk(){return(0,Q.useContext)(ak)??{}}function ck({children:e}){let{displayChromeMode:t}=sk();return(0,$.jsx)(ok,{displayChromeMode:t,sectionChromeMode:void 0,children:e})}var lk;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.COMPOSITE=`composite`})(lk||={});var uk=new Set(Object.values(Ic));function dk(e){if(typeof e==`string`)return uk.has(e)?e:Ic.STACKED;let t={};for(let[n,r]of Object.entries(e))t[n]=r&&uk.has(r)?r:Ic.STACKED;return t}function fk(e){return RO(e)}var pk=(0,Q.createContext)(null);function mk(){let[e]=(0,Q.useState)(()=>{let e=[],t=new Map,n=!1,r=new Set,i=()=>{for(let e of r)e()},a=()=>{let e=t.size>0&&![...t.values()].some(Boolean);e!==n&&(n=e,i())};return{registerField:t=>{e.includes(t)||(e=[...e,t],i())},unregisterField:t=>{e.includes(t)&&(e=e.filter(e=>e!==t),i())},getRegisteredFields:()=>e,reportSlotPresence:(e,n)=>{t.set(e,n),a()},clearSlotPresence:e=>{t.delete(e)&&a()},showsNoField:()=>n,subscribeToRegisteredFields:e=>(r.add(e),()=>{r.delete(e)})}});return e}function hk(e){let t=(0,Q.useContext)(pk);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[t,e])}var gk=[],_k=()=>()=>{};function vk(){let e=(0,Q.useContext)(pk);return(0,Q.useSyncExternalStore)(e?e.subscribeToRegisteredFields:_k,e?e.getRegisteredFields:()=>gk)}function yk(e){let t=(0,Q.useContext)(pk),[n]=(0,Q.useState)(()=>({}));(0,Q.useLayoutEffect)(()=>()=>{t?.clearSlotPresence(n)},[t,n]),(0,Q.useLayoutEffect)(()=>{t?.reportSlotPresence(n,e)},[t,n,e])}function bk(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useLayoutEffect)(()=>{let t=()=>n(e.showsNoField());return t(),e.subscribeToRegisteredFields(t)},[e]),t}var xk;(function(e){e.FIELD_SLOT=`field_slot`,e.FIELD_SLOT_CONTAINER=`field_slot_container`})(xk||={});var Sk=Symbol.for(`wildo.sectionContentRole`);function Ck(e){return e!==null&&(typeof e==`function`||typeof e==`object`)?e[Sk]:void 0}function wk(e,t){Object.defineProperty(e,Sk,{value:t,enumerable:!1})}var Tk;(function(e){e.FIELD_SLOTS=`field_slots`,e.NOTHING=`nothing`,e.CONTENT=`content`})(Tk||={});function Ek(e,t,n){let r=!1;for(let i of Q.Children.toArray(e)){if(!(0,Q.isValidElement)(i))return Tk.CONTENT;let e=i.props,a;if(i.type===Q.Fragment)a=Ek(e.children,t,n);else if(typeof i.type==`string`)a=!i.type.includes(`-`)&&Ek(e.children,t,n)===Tk.FIELD_SLOTS?Tk.FIELD_SLOTS:Tk.CONTENT;else{let r=i.type[Sk],o=typeof e.name==`string`?e.name:void 0,s=o?t?`${t}.${o}`:o:t;r===xk.FIELD_SLOT?(n.push({path:s,hasOwnSchema:e.schema!==void 0}),a=Tk.FIELD_SLOTS):a=r===xk.FIELD_SLOT_CONTAINER?Ek(e.children,s,n):Tk.CONTENT}if(a===Tk.CONTENT)return Tk.CONTENT;a===Tk.FIELD_SLOTS&&(r=!0)}return r?Tk.FIELD_SLOTS:Tk.NOTHING}function Dk(e){return Ek(e,``,[])===Tk.FIELD_SLOTS}function Ok(e,t=``){let n=[];return Ek(e,t,n)===Tk.FIELD_SLOTS?n:null}var kk=(0,Q.createContext)(null);function Ak(){let[e]=(0,Q.useState)(()=>{let e=new Map;return{place:t=>(e.set(t,(e.get(t)??0)+1),()=>{let n=(e.get(t)??1)-1;n>0?e.set(t,n):e.delete(t)}),placedFields:()=>new Set(e.keys())}});return e}function jk(e){return e.match(/^[^.[\]]+/)?.[0]??e}var Mk=Symbol.for(`wildo.placesNamedField`);function Nk(e){Object.defineProperty(e,Mk,{value:!0,enumerable:!1})}var Pk=1e4,Fk=5e4,Ik=200;function Lk(e,t=``){let n=[],r=(e,t)=>typeof e==`string`&&e!==``?t?`${t}.${e}`:e:t,i=new Set,a=0,o=(e,t)=>{try{if((0,Q.isValidElement)(e)){let t=e.type,n=e.props??{};return{element:{type:t,props:n,keys:Object.keys(n)}}}let n=e[Symbol.iterator];if(typeof n==`function`){let t=n.call(e);if(t===e)return null;let r=[],i=t.next();for(;!i.done&&r.length<Pk;)r.push(i.value),i=t.next();return i.done||t.return?.(),{entries:r,isCollection:!0}}if(t&&Object.getPrototypeOf(e)===Object.prototype)return{entries:Object.values(e),isCollection:!1}}catch{}return null},s=(e,t,n,r)=>{if(typeof e!=`object`||!e||i.has(e)||r>Ik||++a>Fk)return;let l=o(e,n>0);if(l){if(i.add(e),`element`in l)c(l.element,t,r);else{let e=l.isCollection?n:n-1;for(let n of l.entries)s(n,t,e,r+1)}i.delete(e)}},c=({type:e,props:t,keys:i},a,o)=>{if(e===Q.Fragment){s(Bk(t,`children`),a,0,o+1);return}let c=Rk(e);if(c===xk.FIELD_SLOT||zk(e)){n.push(r(Bk(t,`name`),a));return}let l=c===xk.FIELD_SLOT_CONTAINER?r(Bk(t,`name`),a):a;for(let e of i)s(Bk(t,e),l,e===`children`?0:1,o+1)};return s(e,t,0,0),n.filter(e=>e!==``)}function Rk(e){try{return Ck(e)}catch{return}}function zk(e){try{return e!==null&&(typeof e==`function`||typeof e==`object`)&&e[Mk]===!0}catch{return!1}}function Bk(e,t){try{return e[t]}catch{return}}function Vk(e){let t=(0,Q.useContext)(kk),n=e.map(jk).join(`\0`);(0,Q.useLayoutEffect)(()=>{if(!t||n===``)return;let e=n.split(`\0`).map(e=>t.place(e));return()=>e.forEach(e=>e())},[t,n])}function Hk(e,t){let n=(0,Q.useContext)(kk);Vk((0,Q.useMemo)(()=>n?Lk(e,t):[],[n,e,t]))}var Uk=(0,Q.createContext)(null);function Wk({value:e,children:t}){let n=(0,Q.useMemo)(()=>e,[e]);return(0,$.jsx)(Uk.Provider,{value:n,children:t})}function Gk(){return(0,Q.useContext)(Uk)}var Kk=(0,Q.createContext)(!1);function qk(){return(0,Q.useContext)(Kk)}var Jk=as.getLogger();function Yk(e){let{name:t,className:n,saveable:r,chromeMode:i,children:a,defaultFocus:o=!0,hideTitle:s=!1,hideDescription:c=!1}=e,l=e.appearance??cr.DEFAULT,u=zT(),d=ik(),f=Gk(),p=f?.sectionEntries?.[t],m=p?.icon?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`me-element inline-flex items-center`,children:p.icon}),p.title??``]}):p?.title,h=u?.sectionLabels?.[t]??d?.sectionLabels?.[t]??m,g=u?.sectionDescriptions?.[t]??d?.sectionDescriptions?.[t]??p?.description,_=s?void 0:h,v=c?void 0:g,y=e.disabled??u?.disabled,b=u?.onSectionSave,x=!!(r&&b),S=u?lk.FORM:d?lk.DISPLAY:f?lk.COMPOSITE:lk.DISPLAY;if(S===lk.COMPOSITE&&i)throw V.buildConfigurationError(Xl.CONFIGURATION,{component:`Section`,message:`Section chromeMode is only supported inside form/display section hosts. Composite-hosted sections must not declare chromeMode until a dedicated composite chrome contract exists.`,sectionName:t});let C=mk(),w=bk(C),{pathPrefix:T}=ED();Hk(a,T);let E=w&&Dk(a);if(!fk(l))return(0,$.jsx)($.Fragment,{children:a});let D=(0,$.jsx)(Kk.Provider,{value:!!_,children:(0,$.jsxs)(pk.Provider,{value:C,children:[(0,$.jsx)(Zk,{hostKind:S,chromeMode:i,children:a}),x&&(0,$.jsx)(Qk,{sectionName:t,disabled:y})]})});return(0,$.jsx)(OT,{appearance:l,legend:_,description:v,disabled:y,defaultOpen:o,className:n,"data-guidance-section":t,"data-composite-section":S===lk.COMPOSITE?t:void 0,hidden:E||void 0,children:D})}Yk.displayName=`Section`;function Xk({hostKind:e,sectionProps:t,providesHeading:n=!1}){let{children:r,chromeMode:i,saveable:a,name:o,className:s,disabled:c}=t,l=mk(),u=r;return u=e===lk.FORM?(0,$.jsxs)(pk.Provider,{value:l,children:[(0,$.jsx)(Zk,{hostKind:e,chromeMode:i,children:r}),a&&(0,$.jsx)(Qk,{sectionName:o,disabled:c})]}):(0,$.jsx)(Zk,{hostKind:e,chromeMode:i,children:r}),(0,$.jsx)(Kk.Provider,{value:n,children:(0,$.jsx)(`div`,{className:s?`space-y-field ${s}`:`space-y-field`,"data-guidance-section":o,"data-composite-section":e===lk.COMPOSITE?o:void 0,children:u})})}function Zk({hostKind:e,chromeMode:t,children:n}){let{displayChromeMode:r}=sk(),{formChromeMode:i}=eT();return t?e===lk.FORM?(0,$.jsx)($w,{formChromeMode:i,sectionChromeMode:t,children:n}):e===lk.DISPLAY?(0,$.jsx)(ok,{displayChromeMode:r,sectionChromeMode:dk(t),children:n}):n:n}function Qk({sectionName:e,disabled:t}){let n=GC(),r=zT(),i=vk(),[a,o]=(0,Q.useState)(!1),{tComponent:s,isReady:c}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),l=r?.onSectionSave;if(!l||!c)return null;let u=async()=>{if(i.length!==0&&await ek(n,i)){o(!0);try{let t=n.getValues();await l(e,i,t)}catch(t){Jk.error(`[SectionSaveButton] The section save handler threw.`,{sectionName:e,error:t})}finally{o(!1)}}},d=s(B.LOW_LEVEL_FORM_MESSAGE,`sectionSaving`),f=s(B.LOW_LEVEL_FORM_MESSAGE,`sectionSave`);return(0,$.jsx)(`div`,{className:`flex justify-end pt-item`,children:(0,$.jsx)(X,{type:`button`,variant:J.SECONDARY,size:Y.SM,onClick:u,disabled:t||a||i.length===0,children:a?d:f})})}function $k(e){return(0,Q.isValidElement)(e)&&e.type===Yk}as.getLogger();function eA(e,t){return Lde(e,$k,t)}function tA(e){return zde(e)}function nA({className:e,children:t,contextFieldValues:n,autoInjectSubmitButton:r=!0,responsiveMaxWidth:i=`measure`}){let a=(0,Q.useRef)(new Set),o=(0,Q.useRef)(!1),[s,c]=(0,Q.useState)({errorSummary:!1,submitButton:!1}),l=sE()!==null,u=(0,Q.useCallback)(e=>{a.current.add(e)},[]),d=(0,Q.useCallback)(()=>{o.current=!0},[]),f=(0,Q.useMemo)(()=>({registerSlot:u,registerWizardRoot:d}),[u,d]);(0,Q.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>{let e={errorSummary:!a.current.has(`errorSummary`),submitButton:r&&!l&&!o.current&&!a.current.has(`submitButton`)};(e.errorSummary||e.submitButton)&&c(e)});return()=>cancelAnimationFrame(e)},[r,l]);let p=zT();Hk(t,``);let m=(0,Q.useMemo)(()=>iA(t,p),[t,p]);return(0,$.jsx)(OD.Provider,{value:f,children:(0,$.jsx)(xD,{voice:void 0,children:(0,$.jsx)(TD,{pathPrefix:``,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full`,e),style:{maxInlineSize:nD(i)},"data-inline-size-tier":i,"data-guidance-form":``,"data-slot":`form-layout`,children:(0,$.jsxs)(Jy,{children:[s.errorSummary?(0,$.jsx)(tO,{className:`mb-4`}):null,(0,$.jsx)(`div`,{className:`space-y-section [&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0`,children:m}),s.submitButton?(0,$.jsx)(rO,{className:`mt-6`}):null]})})})})})}function rA(e,t){if(!t)return!1;let n=Ok(e);return n!==null&&n.length>0&&n.every(e=>!e.hasOwnSchema&&hr.resolveFieldSchemaPath(t,e.path)===void 0)}function iA(e,t){let n=eA(e);return(0,$.jsx)($.Fragment,{children:n.items.map((e,n)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},n);let r=e.group.sections.filter(e=>!rA(e.props.children,t?.schema));if(r.length===0)return null;let i={...e.group,sections:r},a=tA(i),o=t?.sectionLabels??{},s=t?.sectionDescriptions??{},c=i.sections.map(e=>({id:e.props.name,title:o[e.props.name],description:s[e.props.name],content:(0,$.jsx)(aA,{sectionProps:e.props,providesHeading:!!o[e.props.name]})}));return(0,$.jsx)(WO,{sections:c,config:a},`group-${i.mode}-${n}`)})})}function aA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Xk,{hostKind:lk.FORM,sectionProps:e,providesHeading:t})}function oA(e){let t=e.match(/^(.+)\[(\d+)]$/);return t?{key:t[1],index:parseInt(t[2],10)}:{key:e}}function sA(e,t){return Array.isArray(e)?[...e]:typeof e==`object`&&e?{...e}:t?.index==null?{}:[]}function cA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let{key:t,index:n}=oA(e),i=hr.getObjectLikeFieldShape(r,{commonOnly:!1})??null;if(!i||!(t in i))return;if(r=i[t],n!=null){let e=lr(r).element;if(!e)return;r=e}}return r}function lA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let{key:t,index:n}=oA(e);if(r=r[t],n!=null){if(!Array.isArray(r))return;r=r[n]}}return r}function uA(e,t){if(!t||!e)return e;let n=lA(e,t);if(typeof n==`object`&&n&&!Array.isArray(n))return n}function dA(e,t,n){let r=oA(t.split(`.`)[0]).key,i=fA(e??{},t,n);return{[r]:i[r]}}function fA(e,t,n){let r=t.split(`.`).map(oA),i={...e},a=i;return r.forEach((e,t)=>{let i=t===r.length-1,o=r[t+1];if(e.index!=null){let t=a[e.key],r=Array.isArray(t)?[...t]:[];if(a[e.key]=r,i){r[e.index]=n;return}let s=sA(r[e.index],o);r[e.index]=s,a=s;return}if(i){a[e.key]=n;return}let s=sA(a[e.key],o);a[e.key]=s,a=s}),i}function pA(e,t){if(e==null)return;if(typeof e!=`object`||Array.isArray(e)||!Object.keys(e).some(e=>e===Sl.MOBILE||e===Sl.VERT_TABLET||e===Sl.DESKTOP))return e;let n=e;return n[t]??n[Sl.DESKTOP]??n[Sl.VERT_TABLET]??n[Sl.MOBILE]}var mA=`data-collection-surface`;function hA({className:e,children:t,responsiveMaxWidth:n}){let r=ik(),i=(0,Q.useMemo)(()=>gA(t,r),[t,r]);return(0,$.jsx)(TD,{pathPrefix:``,children:(0,$.jsx)(xD,{voice:y.EYEBROW,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full space-y-section`,`[&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0`,n===void 0&&`[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]`,e),style:n===void 0?void 0:{maxInlineSize:nD(n)},"data-inline-size-tier":n??`derived`,"data-guidance-display":!0,children:i})})})}function gA(e,t){let n=eA(e,t?.defaultSectionAppearance);return(0,$.jsx)($.Fragment,{children:n.items.map((e,n)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},n);let{group:r}=e,i=_A(tA(r),r,t),a=t?.sectionLabels??{},o=t?.sectionDescriptions??{},s=r.sections.map(e=>({id:e.props.name,title:a[e.props.name],description:o[e.props.name],content:(0,$.jsx)(vA,{sectionProps:e.props,providesHeading:!!a[e.props.name]})}));return(0,$.jsx)(WO,{sections:s,config:i},`group-${r.mode}-${n}`)})})}function _A(e,t,n){if(e.mode!==cr.STAGES||n===null)return e;let[r,...i]=t.sections,a=t.sections.map(e=>e.props.name),o=e=>`stageBinding`in e?e.stageBinding:void 0,s=i.find(e=>o(e.props)!==void 0);if(s!==void 0)throw new PO(`section "${s.props.name}" declares a stageBinding, but a group's binding is read from its FIRST section ("${r.props.name}"). Declare it there, once.`);let c=o(r.props),l=c?cA(n.schema,c.field):void 0;FO(c,a,l?Xo(l):void 0);let u=n.isLoading?null:IO(c,lA(n.data,c.field));return{...e,currentStage:u}}function vA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Xk,{hostKind:lk.DISPLAY,sectionProps:e,providesHeading:t})}var yA=(0,Q.createContext)(!1);function bA(){return(0,Q.useContext)(yA)}var xA=new Set([vu.ARRAY,vu.SET,vu.TUPLE,vu.RECORD,vu.MAP,vu.OBJECT,vu.VERSIONED_OBJECT,vu.CODE,vu.FILE,vu.ADDRESS]),SA=new Set([nd.MULTILINE,nd.MARKDOWN,nd.UNTRUSTED_HTML]);function CA(e,t,n){return n===tt.SUMMARY?!0:e?xA.has(e)?!0:e===vu.STRING&&!!t&&SA.has(t):!1}function wA({className:e,children:t}){let{displayChromeMode:n}=sk();return(0,$.jsx)(yA.Provider,{value:!0,children:(0,$.jsx)(ok,{displayChromeMode:n,sectionChromeMode:Ic.TILE,children:(0,$.jsx)(`dl`,{"data-slot":`field-tiles`,className:U(`m-0 grid gap-field-sm grid-cols-[repeat(auto-fill,minmax(min(100%,9rem),1fr))] [&>[data-tile-span=full]]:col-span-full empty:hidden`,e),children:t})})})}wA.displayName=`FieldTiles`;function TA({className:e,children:t}){let{displayChromeMode:n}=sk();return(0,$.jsx)(ok,{displayChromeMode:n,sectionChromeMode:Ic.HIDDEN,children:(0,$.jsx)(`div`,{"data-slot":`record-state`,className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item [&>*]:w-auto empty:hidden`,e),children:t})})}TA.displayName=`RecordState`;function EA({className:e,children:t}){let{displayChromeMode:n}=sk();return(0,$.jsx)(ok,{displayChromeMode:n,sectionChromeMode:Ic.INLINE,children:(0,$.jsx)(`div`,{"data-slot":`record-keeping-facts`,className:U(`flex min-w-0 flex-wrap items-baseline gap-x-group gap-y-item border-t border-border pt-element text-xs text-foreground-subtle [&_*]:text-xs [&_*]:text-foreground-subtle [&>*]:w-auto [&:not(:has(*))]:hidden`,e),children:t})})}EA.displayName=`RecordKeepingFacts`;var DA;(function(e){e.STATE=`state`,e.CONTENT=`content`,e.FACT=`fact`,e.RECORD_KEEPING=`record_keeping`,e.IDENTITY_PLUMBING=`identity_plumbing`})(DA||={});var OA=zs.BADGE,kA=new Set([Ic.HIDDEN,Ic.COMPACT]);function AA(e){let t=yl(e)?.chromeMode;return me(e)!==vu.OBJECT&&typeof t==`string`&&kA.has(t)}var jA=new Set([...Ts.filter(e=>!tne.includes(e)),...uee]);function MA(e,t,n){if(V.isIdentityOnlySummaryField(e,n))return DA.IDENTITY_PLUMBING;let r=me(t),i=yl(t);return r===vu.ENUM&&i?.displayMode===OA?DA.STATE:jA.has(e)?DA.RECORD_KEEPING:AA(t)?DA.CONTENT:DA.FACT}function NA(e){if(!e.data||typeof e.data!=`object`)return[];let t=e.registry.resourceConfigurations?.[e.resourceType];if(!V.frontendResourceLabelDefinitionOf(t))return[];let n=V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:e.data,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime});if(!n)return[];let r=e.data,i=Object.entries(r).filter(([,e])=>typeof e==`string`&&e===n).map(([e])=>e),a=V.frontendResourceLabelDefinitionOf(t);if(Array.isArray(a))return i.filter(e=>a.includes(e));if(typeof a!=`function`)return[];let o=a,s=t=>{try{return o({currentObject:t,objectContext:{},t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime,resourceType:e.resourceType})}catch{return}},c=s(r);return i.filter(e=>s({...r,[e]:void 0})!==c)}var PA;(function(e){e.DISPLAY=`display`,e.SUMMARY=`summary`})(PA||={});var FA=(0,Q.createContext)(PA.DISPLAY);function IA({kind:e,children:t}){return(0,$.jsx)(FA.Provider,{value:e,children:t})}function LA(){return(0,Q.useContext)(FA)}function RA(e){return zA(e,(0,Q.useContext)(FA))}function zA(e,t){if(t!==PA.SUMMARY)return e?.display;if(e?.display||e?.summaryOverride)return{...e?.display,...e?.summaryOverride}}function BA(e){if(e==null)return!0;if(typeof e==`string`)return e.trim()===``;if(Array.isArray(e))return e.length===0;if(typeof e==`object`){let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null)return Object.keys(e).length===0}return!1}function VA({children:e}){let{displayChromeMode:t}=sk();return(0,$.jsx)(yA.Provider,{value:!1,children:(0,$.jsx)(ok,{displayChromeMode:t,sectionChromeMode:void 0,children:e})})}function HA({active:e,name:t,label:n,termAnnounced:r=!1,children:i}){return e?(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`tile`,"data-tile-row":``,"data-tile-span":`full`,"data-field":t,className:`min-w-0`,children:[n&&(0,$.jsx)(`dt`,{className:`sr-only`,"aria-hidden":r?void 0:`true`,children:n}),(0,$.jsx)(`dd`,{className:`m-0 min-w-0`,children:(0,$.jsx)(VA,{children:i})})]}):(0,$.jsx)($.Fragment,{children:i})}function UA(e,t){if(e!=null)return typeof e==`string`?e:e[t]??e[Sl.DESKTOP]}var WA=(0,Q.createContext)(!1);function GA(){return(0,Q.useContext)(WA)}var KA=new Set([vu.BOOLEAN,vu.NUMBER,vu.BIGINT,vu.BIGDECIMAL,vu.RANGE_NUMBER,vu.RANGE_BIGDECIMAL]),qA=new Set([vu.DATE,vu.DATETIME,vu.TIME,vu.RANGE_DATE,vu.RANGE_DATETIME,vu.RANGE_TIME]),JA=new Set([Ic.COMPACT,Ic.HIDDEN]);function YA(e){return e!==void 0&&KA.has(e)}function XA(e){return!BA(e)}function ZA(e){let t=0;return e.map(({schemaType:e,present:n})=>!n||e===void 0||!qA.has(e)?!1:(t+=1,t>1))}function QA(e){let t=ZA(e);return e.map(({schemaType:e,present:n},r)=>n&&(YA(e)||t[r]))}function $A(e,t){let n=QA(t);return t.map(({present:t,declaredChrome:r},i)=>{if(!t)return!1;let a=r??e;return a===void 0?n[i]:!JA.has(a)})}var ej=Qs(B.LOW_LEVEL_TOOLTIP,`Tooltip`,[`Trigger`,`Content`,`Provider`]);function tj({preset:e=q.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n,{...t})}function nj({preset:e=q.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Trigger,{...t})}function rj({preset:e=q.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Content,{...t})}function ij({preset:e=q.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Provider,{...t})}function aj({provenance:e,className:t}){let n=Tre(e.system),r=(0,Q.useMemo)(()=>[n],[n]),{tComponent:i,t:a,formatDateTimeForDisplayMode:o,isReady:s}=K({component:B.LOW_LEVEL_FORM_FIELD,keys:r});if(!s)return null;let c=a(n),l=o(e.currentAsOf,vne.AUTO);return(0,$.jsx)(gx,{className:t,"data-field-provenance":``,children:i(B.LOW_LEVEL_FORM_FIELD,`syncedFromAsOf`,{system:c,asOf:l})})}aj.displayName=`DisplayFieldProvenanceNote`;function oj(e,t){return UA(e,t)??Ic.STACKED}function sj({text:e}){let{renderIcon:t}=Mf(),{tComponent:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(B.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:ca.XS})})}),(0,$.jsx)(rj,{children:e})]}):null}function cj({mode:e,label:t,labelStyle:n,description:r,tooltip:i,name:a,labelPlacement:o,hideLabel:s,hideDescription:c,provenance:l,wide:u,announceName:d=!1,className:f,children:p}){let{currentBreakpoint:m,isMobile:h,getRecipe:g}=Wg(),_=bA(),v=g(cc.TYPOGRAPHY,y.DESCRIPTION),b=g(cc.TYPOGRAPHY,y.EYEBROW),x=(0,Q.useMemo)(()=>oj(e,m),[e,m]),S=o??(x===Ic.INLINE?`start`:`top`),C=!s&&!!t&&S!==`hidden`&&x!==Ic.COMPACT&&x!==Ic.HIDDEN,w=!c&&!!r&&x!==Ic.COMPACT&&x!==Ic.HIDDEN,T=!!l,E=T?(0,$.jsx)(aj,{provenance:l}):null,D=!C&&!s&&t&&(S===`hidden`||d)?(0,$.jsx)(`span`,{className:`sr-only`,children:d?`${t}: `:t}):null;if(x===Ic.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[D,p]});if(x===Ic.TILE){let e=_?`dt`:`div`,n=_?`dd`:`div`,o=C?t:t?(0,$.jsx)(`span`,{className:`sr-only`,children:t}):null,s=[i,w?r:void 0].filter(e=>!!e).join(` — `)||void 0;return(0,$.jsx)(vD,{asChild:!0,variant:nt.TILE,children:(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`tile`,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,"data-tile-span":u?`full`:void 0,className:U(`flex min-w-0 flex-col gap-item`,f),children:[o&&(0,$.jsxs)(e,{className:U(`flex min-w-0 items-center`,C&&b.base),children:[o,C&&s&&(0,$.jsx)(sj,{text:s})]}),(0,$.jsxs)(n,{className:`m-0 min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,$.jsx)(VA,{children:p}),E]})]})})}if(x===Ic.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,p]});if(x===Ic.INLINE)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex flex-wrap items-baseline gap-x-1.5 gap-y-element-xs`,f),children:[D,C&&(0,$.jsxs)(`span`,{className:U(`shrink-0`,v.base),children:[t,`:`,i&&(0,$.jsx)(sj,{text:i})]}),(0,$.jsx)(`div`,{className:`min-w-0`,children:p}),w&&(0,$.jsx)(gx,{className:`w-full`,children:r}),T&&(0,$.jsx)(aj,{provenance:l,className:`w-full`})]});if(x===Ic.SETTINGS_ROW)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":h?`stacked`:void 0,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,h?`flex-col gap-element-xs`:U(`flex-row gap-section`,w?`items-start`:`items-center`),f),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!h&&`flex-1`),children:[D,C&&(0,$.jsxs)(px,{children:[t,i&&(0,$.jsx)(sj,{text:i})]}),w&&(0,$.jsx)(gx,{children:r})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs font-medium`,`[&>[data-list-shape=primitive]]:flex-row [&>[data-list-shape=primitive]]:flex-wrap [&>[data-list-shape=primitive]]:gap-x-element`,h?`w-full items-start text-start`:`w-72 max-w-[55%] shrink items-end text-end [&>[data-list-shape=primitive]]:justify-end`),children:[p,E]})]});if(S===`start`||S===`inline`){let e=S===`inline`;return(0,$.jsxs)(fx,{orientation:dx.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(e&&`flex-row-reverse`,f),children:[D,(0,$.jsxs)(hx,{children:[C&&(0,$.jsx)(mx,{children:(0,$.jsxs)(px,{className:v.base,children:[t,i&&(0,$.jsx)(sj,{text:i})]})}),w&&(0,$.jsx)(gx,{children:r}),E]}),p]})}return(0,$.jsxs)(fx,{orientation:dx.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,C&&(n===cs.TITLE?(0,$.jsxs)(`div`,{className:U(`pt-item-xs`,b.base),children:[t,i&&(0,$.jsx)(sj,{text:i})]}):(0,$.jsxs)(px,{className:v.base,children:[t,i&&(0,$.jsx)(sj,{text:i})]})),p,w&&(0,$.jsx)(gx,{children:r}),E]})}cj.displayName=`DisplayFieldChrome`;function lj(e){let t=e.parentReferenceConfig,n=[...e.referencedIds];if(!t||t.displayMode!==na.NONE||!e.referencedResourceType||e.referencedResourceType!==t.parentResourceType)return{hidesWholeReference:!1,visibleIds:n};if(t.parentResourceId===void 0)return{hidesWholeReference:!0,visibleIds:[]};let r=n.filter(e=>String(e)!==t.parentResourceId);return{hidesWholeReference:n.length>0&&r.length===0,visibleIds:r}}var uj=(0,Q.createContext)({resourceType:void 0,resourceId:void 0,doInlineUpdate:async()=>{},canInlineEdit:!1,fileUploadContext:void 0,contextualParameters:void 0,contextResourceIdentifiers:void 0,navigationZone:void 0,parentReferenceConfig:void 0});function dj(){return(0,Q.useContext)(uj)}var fj=class extends Error{name=`InlineEditMutationError`;mutationError;constructor(e,t){super(e),this.mutationError=t}};function pj(e,t){return e!==wi.REFERENCE&&e!==wi.ASSOCIATION?!1:t??!0}function mj(e,t){let n=t.resourceConfigurations?.[e];return n?[...n.resourceRelationships.parentRelationships,...n.resourceRelationships.childRelationships,...n.resourceRelationships.selfRelationships]:[]}function hj(e){let t=e.registry.resourceConfigurations?.[e.relatedResourceType];if(!t)return;let n=(t.operations??[]).filter(e=>!e.isBulkOperation&&(e.operationIdentifier===W.CREATE||e.resourceOperationLike===W.CREATE));return n.find(e=>e.variantKey===`quick-add`)??nu(n,W.CREATE)??n[0]}function gj(e,t){let n=pj(e.semantics.nature,e.relationship.display?.interaction?.allowQuickCreate);return{sourceKind:`relationshipObject`,relatedResourceType:e.relatedResourceType,relationshipNature:e.semantics.nature,allowQuickCreate:n,relatedCreateOperation:hj({relatedResourceType:e.relatedResourceType,registry:t})}}function _j(e){let t=e.fieldName.split(`.`)[0],n=mj(e.resourceType,e.registry).flatMap(n=>{if(n.resourceType1!==e.resourceType&&n.resourceType2!==e.resourceType)return[];let r=Ul.ensureCompiledRelationship.call(Ul,n,e.registry.allResourceFieldIdentifiers);if(Ul.tryResolveRelationshipForeignKeyIdentity(r,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==t)return[];let i=Ul.getResolvedRelationshipSemantics(r),a=r.resourceType1===e.resourceType?r.resourceType2:r.resourceType1;return e.relatedResourceType&&a!==e.relatedResourceType?[]:[{sourceKind:`foreignKey`,relatedResourceType:a,relationshipNature:i.nature,allowQuickCreate:pj(i.nature,r.display?.interaction?.allowQuickCreate),relatedCreateOperation:hj({relatedResourceType:a,registry:e.registry})}]});if(n.length<=1)return n[0];if(xa.isDevelopment())throw V.buildConfigurationError(Xl.CONFIGURATION,{resourceType:e.resourceType,fieldName:e.fieldName,reason:`Ambiguous FK relationship quick-create mapping.`,matchCount:n.length})}function vj(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,quickCreate:gj(t,e.registry)}}function yj(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,objectIdentity:Ul.resolveRelationshipObjectIdentityForResource(t.relationship,e.resourceType,e.registry.allResourceFieldIdentifiers)}}function bj(e){let t=vj(e);if(t)return e.relatedResourceType&&t.relatedResourceType!==e.relatedResourceType?void 0:{sourceFieldName:e.fieldName,quickCreate:t.quickCreate};let n=_j({resourceType:e.resourceType,fieldName:e.fieldName,relatedResourceType:e.relatedResourceType,registry:e.registry});if(n)return{sourceFieldName:e.fieldName,quickCreate:n}}function xj(e){let t=e.resolvedSemantics?.handling?.dtoModelMode;return t?t===Uie.NESTED_RESOURCE:Ul.resolveRelationshipNature(e).nature===wi.COMPOSITION}function Sj(e){if(!Ul.isRelationshipActiveForParent(e.relationship,e.parentData,{onMissingParentResource:`exclude`,onConditionError:`exclude`})||!xj(e.relationship))return;let t=e.relationship.resourceType1===e.parentResourceType?e.relationship.resourceType2:e.relationship.resourceType1,n=Ul.tryResolveRelationshipForeignKeyIdentity(e.relationship,e.registry.allResourceFieldIdentifiers);if(!n?.fieldIdentifier)return;let r=e.relationship.display?.inParentNavigation,i=Ct(e.relationship.cardinality2),a=e.viewport??Sl.DESKTOP,o=Cj(i),s=Th(r?.transition,a),c=e.registry.resourceConfigurations[t]?.resourceRelationships,l=c?[...c.parentRelationships,...c.selfRelationships].find(t=>t.resourceType1===e.parentResourceType&&Ul.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier===n.fieldIdentifier):void 0;return{relationship:e.relationship,childResourceType:t,foreignKeyField:n.fieldIdentifier,inChildView:l?.display?.inChildView??e.relationship.display?.inChildView,relationshipEdgeKey:V.buildRelationshipEdgeKey({parentResourceType:e.parentResourceType,childResourceType:t,foreignKeyField:n.fieldIdentifier}),navigationConfig:r,transition:s,contentSectionConfig:o,isOneToOne:i}}function Cj(e){return e?{mode:cr.INLINE}:{mode:cr.TABS}}function wj(e){if(!e.navigationZone||!dh.shouldShowParentReference(e.inlineParentContext,e.navigationZone,e.navigationInitiator,e.getZoneState))return;let t=e.navigationInitiator?.sourceRelationship;if(!t?.parentResourceType)return;let n=t.inChildView;return{parentReference:{parentResourceType:t.parentResourceType,parentResourceId:t.parentResourceId,parentDisplay:n?.parentDisplay??na.CONTEXT,showParentLink:n?.showParentLink??!0}}}function Tj(e){let t=e.schema?ka(e.schema):void 0;if(!t)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let n=new Set,r=new Set;for(let i of Object.keys(t)){let a=yj({resourceType:e.resourceType,fieldName:i,registry:e.registry});if(!a)continue;if(r.add(a.rootFieldName),Sj({parentResourceType:e.resourceType,relationship:a.relationship,parentData:e.parentData,registry:e.registry})){n.add(a.rootFieldName);continue}if(a.semantics.nature===wi.COMPOSITION)continue;let o=a.foreignKeyIdentity?.fieldIdentifier;o&&o!==a.rootFieldName&&Object.prototype.hasOwnProperty.call(t,o)&&n.add(a.rootFieldName)}return{hiddenFieldNames:[...n],inlineEditDisabledFieldNames:[...r]}}function Ej(e){let t={};return e.resourceType&&e.fieldName&&(t.writeSurface=vj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry}),t.readSurface=yj({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry}),t.inlineEditSurface=bj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:e.registry})),t.navigationSurface=wj({inlineParentContext:e.inlineParentContext,navigationZone:e.navigationZone,navigationInitiator:e.navigationInitiator,getZoneState:e.getZoneState}),t}function Dj(e,t){if(!e)return;if(!t)return e;if(!e.startsWith(t.pathPrefix))return;let n=e.slice(t.pathPrefix.length).replace(/^(\[\d+\])*\.?/,``);return n===``?void 0:n}function Oj(e){if(e)return e.includes(`.`)?e.split(`.`).pop():e}function kj(e){let t=pie(e.schema);if(!t||!e.parentData||!e.currentResourceType||!e.registry)return;let n=Oj(e.fieldName);if(!n)return;let r=Ul.getForeignKeyCandidateReferencedTypes(n,e.currentResourceType,e.registry.resourceRelationships);if(r.length!==0)return Ul.resolveDiscriminatedPolymorphicForeignKeyTarget({record:e.parentData,discriminatorField:t.discriminatorField,variants:t.variants,candidateReferencedTypes:r,getResourcePrimaryScope:t=>e.registry?.resourceConfigurations[t]?.resourcePrimaryScope})}function Aj(e){return e.explicitResourceType||(e.schema?Du(e.schema)?.referencedResourceType:void 0)||(e.fieldName?e.registry?.fieldIdentifierToResourceType?.[e.fieldName]:void 0)||void 0}function jj(e,t){if(Array.isArray(e)){let n=e.flatMap(e=>{if(typeof e==`string`&&e!==``)return[e];if(!e||typeof e!=`object`)return[];let n=e[t]??e._id??e.id;return typeof n==`string`&&n!==``?[n]:[]});return n.length>0?n:void 0}if(typeof e==`string`&&e!==``)return e;if(!e||typeof e!=`object`)return;let n=e[t]??e._id??e.id;return typeof n==`string`&&n!==``?n:void 0}function Mj(e){let t=e.resourceLinkTrail?.resourceType??e.currentResourceType,n=Dj(e.fieldName,e.resourceLinkTrail);if(t&&n&&e.registry)return yj({resourceType:t,fieldName:n,registry:e.registry})}function Nj(e){return Rw(e)}function Pj(e){if(e.schema&&Io(e.schema))return{referencedResourceType:Aj({explicitResourceType:kj({schema:e.schema,fieldName:e.fieldName,parentData:e.parentData,currentResourceType:e.currentResourceType,registry:e.registry}),schema:e.schema,fieldName:e.fieldName,registry:e.registry}),referencedIds:Nj(e.value)};let t=Mj(e);if(t&&t.semantics.nature!==wi.COMPOSITION&&t.objectIdentity)return{referencedResourceType:t.relatedResourceType,referencedIds:Nj(jj(e.value,t.objectIdentity.relationshipIdentifierField))}}function Fj({noValueLabel:e,typography:t,className:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{typography:t,className:U(`text-muted-foreground italic`,n),"aria-hidden":`true`,children:`—`}),(0,$.jsx)(`span`,{className:`sr-only`,children:e})]})}var Ij=new Set([vu.NUMBER,vu.BIGDECIMAL,vu.MONEY,vu.DURATION,vu.DATE,vu.TIME,vu.DATETIME,vu.RANGE_NUMBER,vu.RANGE_BIGDECIMAL,vu.RANGE_MONEY,vu.RANGE_DATE,vu.RANGE_TIME,vu.RANGE_DATETIME]);function Lj(e){return e&&Ij.has(e)?y.DATA:void 0}function Rj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_BOOLEAN,`DisplayFieldBoolean`)(e);return(0,$.jsx)(n,{...t})}function zj({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldDisplay_ResourceReference`,Ii.DISPLAY)(e);return(0,$.jsx)(n,{...t})}function Bj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_STRING,`DisplayFieldString`)(e);return(0,$.jsx)(n,{...t})}function Vj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_NUMBER,`DisplayFieldNumber`)(e);return(0,$.jsx)(n,{...t})}function Hj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_ENUM,`DisplayFieldEnum`)(e);return(0,$.jsx)(n,{...t})}function Uj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_MONEY,`DisplayFieldMoney`)(e);return(0,$.jsx)(n,{...t})}function Wj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DURATION,`DisplayFieldDuration`)(e);return(0,$.jsx)(n,{...t})}function Gj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_PHONE,`DisplayFieldPhone`)(e);return(0,$.jsx)(n,{...t})}function Kj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_ADDRESS,`DisplayFieldAddress`)(e);return(0,$.jsx)(n,{...t})}function qj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL,`DisplayFieldBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function Jj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_CODE,`DisplayFieldCode`)(e);return(0,$.jsx)(n,{...t})}function ife(e){if(e===void 0)return``;let t=e;if(typeof e==`string`){let n=e.trim();if(n.startsWith(`{`)||n.startsWith(`[`))try{t=JSON.parse(n)}catch{}}try{return JSON.stringify(t,(e,t)=>typeof t==`bigint`?t.toString():t,2)??String(t)}catch{return String(t)}}function Yj({value:e,maxHeight:t,...n}){let r=(0,Q.useMemo)(()=>{let t=ife(e);return t?{content:t,language:`json`}:null},[e]);return(0,$.jsx)(Jj,{...n,value:r,maxHeight:t,wordWrap:!0})}var Xj=ul.APPROVAL_SEALS,Zj;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(Zj||={});var Qj;(function(e){e.IDLE=`idle`,e.CHECKING=`checking`,e.DONE=`done`,e.FAILED=`failed`})(Qj||={});function $j({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_APPROVAL_SEAL,`ApprovalSeal`)(e);return(0,$.jsx)(n,{...t})}function afe(e){return typeof e==`string`&&e.length>0?e:void 0}var ofe=3e3,sfe=20;function cfe(e){return jr(e)&&e.errorType===Va.NOT_FOUND}function eM(e){let[t,n]=(0,Q.useState)({state:Zj.LOADING}),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)({state:Qj.IDLE}),[s,c]=(0,Q.useState)(!1),l=e?.key;(0,Q.useEffect)(()=>{if(!e)return;let t=!0,r=0,a;n({state:Zj.LOADING}),i(!1),o({state:Qj.IDLE});let s=()=>{Promise.resolve().then(e.load).then(i=>{t&&(n({state:Zj.READY,view:i}),e.pollWhilePending&&i.state===Bo.PENDING&&r<sfe&&(r+=1,a=setTimeout(s,ofe)))}).catch(r=>{t&&(e.notFoundIsNone&&cfe(r)?i(!0):n({state:Zj.FAILED}))})};return s(),()=>{t=!1,a&&clearTimeout(a)}},[l]);let u=t.view?.jws;return{read:t,none:r,check:a,onCheck:(0,Q.useCallback)(()=>{u&&(o({state:Qj.CHECKING}),bc().checkApprovalSeal(u).then(e=>o({state:Qj.DONE,outcome:mre(e)})).catch(()=>o({state:Qj.FAILED})))},[u]),onDownloadManifestedCopy:(0,Q.useCallback)(()=>{e?.download&&(c(!0),e.download().then(t=>Hy(t,e.downloadName)).catch(()=>void 0).finally(()=>c(!1)))},[l]),downloading:s}}function tM({state:e,offersCopy:t=!0,movedFieldLabels:n,description:r,className:i}){let{tResourceFieldEnumValue:a}=K(),{read:o,check:s,onCheck:c,onDownloadManifestedCopy:l,downloading:u}=e,d=o.view,f=qee.shape;return(0,$.jsx)($j,{readState:o.state,...d?{view:d}:{},...n?{movedFieldLabels:n}:{},...r?{description:r}:{},...d?.meaning?{meaningLabel:a(Xj,`meaning`,d.meaning,f.meaning)}:{},...d?.outcome?{outcomeLabel:a(Xj,`outcome`,d.outcome,f.outcome)}:{},checkState:s.state,...s.outcome?{checkOutcome:s.outcome}:{},...d?.jws?{onCheck:c}:{},...t&&d?.deliverable?.manifestedCopyAvailable?{onDownloadManifestedCopy:l,downloadingManifestedCopy:u}:{},...i?{className:i}:{}})}function lfe({field:e,hideWhenNone:t,className:n}){let{resourceType:r,resourceId:i}=dj(),a=ik(),o=a?.data,s=afe(o?.[e]),c=ufe(o),l=s&&r&&i?{sealId:s,resourceType:String(r),resourceId:String(i),field:e}:void 0,u=eM(l?{key:`${l.sealId}|${l.resourceType}|${l.resourceId}|${e}|${c}`,load:()=>bc().readApprovalSealOnRecord(l),download:()=>bc().downloadApprovalSealManifestedCopy(l),downloadName:`approval-${l.sealId}.pdf`}:void 0);if(!o)return null;if(!l)return t||!r?null:(0,$.jsx)($j,{readState:Zj.READY,view:{sealId:``,state:Bo.NO_SEAL},...n?{className:n}:{}});let d=u.read.view?.currency?.movedFields.map(e=>a?.fieldLabels?.[e]??e);return(0,$.jsx)(tM,{state:u,...d?{movedFieldLabels:d}:{},...n?{className:n}:{}})}function ufe(e){let t=e?.updatedAt,n=t instanceof Date?t.toISOString():typeof t==`string`?t:``,[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{a.current!==e&&(a.current=e,n||i(e=>e+1))},[e,n]),n||String(r)}function nM({fileId:e,className:t}){let n=eM({key:e,load:()=>bc().readApprovalSealOnFile(e),download:()=>bc().downloadApprovalSealFileManifestedCopy(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0});return n.none||n.read.state===Zj.LOADING?null:(0,$.jsx)(tM,{state:n,...t?{className:t}:{}})}function rM({decisionRef:e,description:t,className:n}){let r=eM({key:e,load:()=>bc().readApprovalSealOfDecision(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0,pollWhilePending:!0});return r.none?null:(0,$.jsx)(tM,{state:r,offersCopy:!1,...t?{description:t}:{},...n?{className:n}:{}})}function iM({preset:e=q.DEFAULT,...t}){let{httpClient:n}=Ou(),r=(0,Q.useMemo)(()=>({get:async e=>n.get(e),getBlob:(e,t)=>n.fetchFileBlob(e,t)}),[n]),i=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE,`DisplayFieldFile`)(e),a=LA(),o=ik(),s=a===PA.DISPLAY&&o!==null,c=t.value&&`fileId`in t.value?t.value.fileId:void 0,l=typeof c==`string`&&c.length>0?c:void 0;return!s||!l?(0,$.jsx)(i,{...t,httpOperations:r}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{...t,httpOperations:r}),(0,$.jsx)(nM,{fileId:l})]})}function aM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL,`DisplayFieldRangeBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function oM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY,`DisplayFieldRangeMoney`)(e);return(0,$.jsx)(n,{...t})}function sM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DATE,`DisplayFieldDate`)(e);return(0,$.jsx)(n,{...t})}function cM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DATETIME,`DisplayFieldDateTime`)(e);return(0,$.jsx)(n,{...t})}function lM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_TIME,`DisplayFieldTime`)(e);return(0,$.jsx)(n,{...t})}function uM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER,`DisplayFieldRangeNumber`)(e);return(0,$.jsx)(n,{...t})}function dM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATE,`DisplayFieldRangeDate`)(e);return(0,$.jsx)(n,{...t})}function fM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATETIME,`DisplayFieldRangeDateTime`)(e);return(0,$.jsx)(n,{...t})}function pM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_TIME,`DisplayFieldRangeTime`)(e);return(0,$.jsx)(n,{...t})}var mM=as.getLogger(),dfe=mM.debugByType(`DisplayValueDispatcher`);mM.setDebugTypeLogging(`DisplayValueDispatcher`,!1);function ffe(e){return e?[...e.parentRelationships??[],...e.childRelationships??[],...e.selfRelationships??[]]:[]}function hM(e){if(!e.registry)return typeof e.record._id==`string`?e.record._id:typeof e.record.id==`string`?e.record.id:void 0;let t=e.resourceType?e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]:void 0,n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}function gM(e,t,n,r){if(!e||!t||!r)return null;let i=Oj(e);if(!i)return null;if(n){let e=r.resourceConfigurations[n]?.resourceRelationships;for(let a of ffe(e))try{let e=Ul.resolveRelationshipObjectIdentityForResource(a,n,r.allResourceFieldIdentifiers);if(e.relationshipIdentifierField!==i)continue;let o=t[e.objectFieldName],s=a.resourceType1===n?a.resourceType2:a.resourceType1;if(o&&typeof o==`object`&&!Array.isArray(o)&&hM({record:o,resourceType:s,registry:r}))return o}catch{}}let a=Qne.extractBaseName(i);if(!a||a===i)return null;let o=t[a];return o&&typeof o==`object`&&!Array.isArray(o)&&hM({record:o,resourceType:r.fieldIdentifierToResourceType?.[i],registry:r})?o:null}function _M(e){let t=e.value,n=t?.fileIds?.length??+!!t?.fileId;return n>0?(0,$.jsx)(Z,{className:e.className,children:e.tComponent(B.LOW_LEVEL_FORM_FIELD,`fileCount`,{count:n})}):(0,$.jsx)(Z,{className:U(`text-muted-foreground italic`,e.className),children:e.tComponent(B.LOW_LEVEL_FORM_FIELD,`noFile`)})}function vM(e){return typeof e?.getMetadata==`string`&&e.getMetadata.trim()!==``}var pfe=5;function yM(e,t,n){switch(e){case`hidden`:return null;case`placeholder`:return(0,$.jsx)(Z,{className:`text-muted-foreground italic`,children:t});case`skeleton`:return(0,$.jsx)(pm,{className:`h-5 w-full`});default:return(0,$.jsx)(Fj,{noValueLabel:t,typography:Lj(n)})}}function bM({schema:e,schemaType:t,value:n,fieldName:r,label:i,className:a,enumLabels:o,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:f,fileUploadContext:p,showAllArrayItems:m,onExpandArrayItems:h,showAllObjectFields:g,onExpandObjectFields:_}){let{tComponent:v,t:x,isReady:S}=K({component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_BUTTON]}),C=Q.useContext(sm)?.registry,{resourceType:w}=dj(),{getRecipe:T}=Wg(),{renderIcon:E}=Mf(),D=T(cc.INDICATOR,xl.ERROR),O=T(cc.TYPOGRAPHY,y.LABEL),k=T(cc.TYPOGRAPHY,y.BODY),A=T(cc.DIVIDER),j={schema:e,label:i,className:a,forceDisplayLabel:!1,forceDisplayDescription:!1,forceHideLabel:!0,forceHideDescription:!0},M=LA(),N=u?.resourceType,P=u?.pathPrefix,I=Q.useMemo(()=>Mj({fieldName:r,resourceLinkTrail:u,currentResourceType:w,registry:C}),[r,N,P,w,C]),ee=I?.objectIdentity,L=Q.useMemo(()=>{if(ee)return jj(n,ee.relationshipIdentifierField)},[ee,n]);if(!S)return null;if((u?.linkDepth??0)>=pfe)return(0,$.jsx)(Z,{className:`text-muted-foreground italic text-sm`,children:v(B.LOW_LEVEL_FORM_FIELD,`resourceLinkLimitReached`)});let R=t=>v(B.LOW_LEVEL_FORM_FIELD,Xn[b(e,t)]),z=t===vu.UNKNOWN?Pne(n)??vu.UNKNOWN:t;if(n==null||z===vu.STRING&&n===``)return yM(f,R(!1),z);if(c){let t={schema:e,className:a};switch(c){case`string`:return(0,$.jsx)(Bj,{...t,value:n});case`number`:return(0,$.jsx)(Vj,{...t,value:n});case`boolean`:return(0,$.jsx)(Rj,{...t,value:n});case`enum`:return(0,$.jsx)(Hj,{...t,value:n,labels:o});case`code`:return(0,$.jsx)(Jj,{...t,value:n});case`money`:return(0,$.jsx)(Uj,{...t,value:n});case`duration`:return(0,$.jsx)(Wj,{...t,value:n});case`phone`:return(0,$.jsx)(Gj,{...t,value:n});case`address`:return(0,$.jsx)(Kj,{...t,value:n});case`bigdecimal`:return(0,$.jsx)(qj,{...t,value:n});case`file`:{let e=r?hr.normalizeSchemaFieldPath(r):void 0,i=e&&p?.[e];return vM(i)?(0,$.jsx)(iM,{...t,fieldName:r,value:n,endpoints:{getMetadata:i.getMetadata,serve:i.serve}}):_M({value:n,className:t.className,tComponent:v})}case`date`:return(0,$.jsx)(sM,{...t,value:n});case`time`:return(0,$.jsx)(lM,{...t,value:n});case`datetime`:return(0,$.jsx)(cM,{...t,value:n});case`range-number`:return(0,$.jsx)(uM,{...t,value:n});case`range-date`:return(0,$.jsx)(dM,{...t,value:n});case`range-time`:return(0,$.jsx)(pM,{...t,value:n});case`range-datetime`:return(0,$.jsx)(fM,{...t,value:n});case`range-bigdecimal`:return(0,$.jsx)(aM,{...t,value:n});case`range-money`:return(0,$.jsx)(oM,{...t,value:n});case`simple-text`:break;default:dfe(`Unrecognized displayComponent — falling back to schema-type dispatch`,{displayComponent:c,fieldName:r})}}if(z===vu.VERSIONED_FOREIGN_KEY){let t=gM(r,l,w,C);return(0,$.jsx)(zj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:kr(e,l),displayParams:No(e),schema:e,className:a})}if(Io(e)){let t=gM(r,l,w,C),i=kj({schema:e,fieldName:r,parentData:l,currentResourceType:w,registry:C});return(0,$.jsx)(zj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:kr(e,l),resourceType:i,displayParams:No(e),schema:e,className:a})}if(I&&I.semantics.nature!==wi.COMPOSITION&&ee)return(0,$.jsx)(zj,{fieldName:r||``,value:L??null,data:!Array.isArray(n)&&n&&typeof n==`object`?n:void 0,resourceType:I.relatedResourceType,className:a});let te=I&&r?{resourceType:I.relatedResourceType,pathPrefix:r,linkDepth:(u?.linkDepth??0)+1}:u;if(z===vu.ARRAY&&Array.isArray(n)){if(n.length===0)return yM(f,R(!0));let t=lr(e).element,c=t?me(t):vu.UNKNOWN,l=va(e),u=zA(l,M),p=u?.displayMode||`vertical`,g=n,_=u?.maxItems||void 0,y=_&&!m?g.slice(0,_):g,b=_?g.length-_:0;if(u?.listStyle===s.CHIPS&&c===vu.STRING&&!d)return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`list`),"data-list-style":`chips`,className:U(`flex flex-row flex-wrap gap-item`,a),children:[y.map((e,t)=>(0,$.jsx)(If,{role:`listitem`,variant:`secondary`,children:String(e)},t)),b>0&&!m&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b}),onClick:h,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b})})]});let x=l?.objectItemLayout??es.CARD,S=c===vu.OBJECT&&t?F(t):null,C=x===es.ROW&&!!S,w=c!==vu.OBJECT&&!d&&p!==`horizontal`&&(u?.listStyle===void 0||u.listStyle===s.PLAIN);return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`list`),"data-list-shape":w?`primitive`:void 0,className:U(C?`flex w-full min-w-0 flex-col gap-element`:p===`horizontal`||u?.listStyle===s.CHIPS?`flex flex-row gap-element flex-wrap`:u?.listStyle===s.SEPARATED?`flex flex-col divide-y divide-border`:c===vu.OBJECT?`flex flex-col gap-field`:`flex flex-col gap-item-xs`,a),children:[d?y.map((n,i)=>{let a=d(r?`${r}[${i}]`:`[${i}]`,t??e);return(0,$.jsx)(`div`,{role:`listitem`,className:U(c===vu.OBJECT&&`py-item-xs`,u?.listStyle===s.SEPARATED&&`py-card-sm first:pt-0 last:pb-0`),children:a??(0,$.jsx)(yR,{schema:t??e,schemaType:c,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:te})},i)}):C&&S?y.map((e,n)=>{let i=e&&typeof e==`object`?e:{},a=qr(t),o=hr.getArrayItemPrimaryField(t).name,s=[...a.filter(e=>me(S[e])===vu.BOOLEAN),...a.filter(e=>me(S[e])!==vu.BOOLEAN)];return(0,$.jsx)(`div`,{role:`listitem`,className:`flex w-full min-w-0 items-center gap-element`,children:(0,$.jsx)(ok,{displayChromeMode:Ic.COMPACT,sectionChromeMode:void 0,children:s.map(e=>(0,$.jsx)(yR,{schema:S[e],schemaType:me(S[e]),value:i[e],hideLabel:e===o,labelPlacement:e===o?void 0:`hidden`,name:r?`${r}[${n}].${e}`:void 0,className:U(`w-auto`,e===o?`min-w-0 flex-1 [overflow-wrap:anywhere]`:me(S[e])===vu.STRING?`min-w-0 [overflow-wrap:anywhere]`:`shrink-0`),resourceLinkTrail:te},e))})},n)}):y.map((n,i)=>(0,$.jsx)(`div`,{role:`listitem`,className:U(u?.listStyle===s.BULLETS&&c!==vu.OBJECT&&p!==`horizontal`&&`ms-4 list-item list-disc marker:text-muted-foreground/60`,c===vu.OBJECT&&!C&&p!==`horizontal`&&`py-item-xs`),children:(0,$.jsx)(yR,{schema:t??e,schemaType:c,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:te})},i)),b>0&&!m&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b}),onClick:h,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b})})]})}if((z===vu.OBJECT||z===vu.VERSIONED_OBJECT)&&typeof n==`object`){let t=ire(e,n),o=t??e,s=F(o),c=qr(o),l=(t?vc(t):void 0)??vc(e),u=l?.display?.displayMode||`vertical`,d=l?.display?.maxItems||void 0;if(!s||c.length===0)return yM(f,R(!0));let p=l?.display?.primaryField,m=p&&c.includes(p)?[p,...c.filter(e=>e!==p)]:c,h=d&&!g?m.slice(0,d):m,y=d?c.length-d:0,b=p&&c.includes(p)?h.filter(e=>e!==p&&yl(s[e])?.chromeMode===Ic.COMPACT):[];return(0,$.jsxs)(`div`,{role:`group`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`object`),className:U(`ps-card relative`,u===`horizontal`?`flex flex-row gap-field flex-wrap`:`flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),(0,$.jsx)(ck,{children:h.map(e=>{let t=s[e],i=me(t),a=n[e],o=r?`${r}.${e}`:e,c=e===p;return b.includes(e)?null:c?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1 font-medium`,children:(0,$.jsx)(yR,{schema:t,schemaType:i,value:a,name:o,hideLabel:!0,parentData:n,resourceLinkTrail:te})}),b.map(e=>(0,$.jsx)(yR,{schema:s[e],schemaType:me(s[e]),value:n[e],name:r?`${r}.${e}`:e,parentData:n,resourceLinkTrail:te},e))]},e):(0,$.jsx)(yR,{schema:t,schemaType:i,value:a,name:o,className:u===`horizontal`?`w-auto`:void 0,parentData:n,resourceLinkTrail:te},e)})}),y>0&&!g&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:_,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if(z===vu.BOOLEAN)return(0,$.jsx)(Rj,{...j,value:n});if(z===vu.ENUM)return(0,$.jsx)(Hj,{...j,value:n,labels:o});if(z===vu.STRING)return(0,$.jsx)(Bj,{...j,value:n});if(z===vu.NUMBER||z===vu.BIGINT)return(0,$.jsx)(Vj,{...j,value:n});if(z===vu.MONEY)return(0,$.jsx)(Uj,{...j,value:n});if(z===vu.DURATION)return(0,$.jsx)(Wj,{...j,value:n});if(z===vu.PHONE)return(0,$.jsx)(Gj,{...j,value:n});if(z===vu.ADDRESS)return(0,$.jsx)(Kj,{...j,value:n});if(z===vu.BIGDECIMAL)return(0,$.jsx)(qj,{...j,value:n});if(z===vu.CODE)return(0,$.jsx)(Jj,{...j,value:n});if(z===vu.FILE){let e=r?hr.normalizeSchemaFieldPath(r):void 0,t=e&&p?.[e];return vM(t)?(0,$.jsx)(iM,{...j,fieldName:r,value:n,endpoints:{getMetadata:t.getMetadata,serve:t.serve}}):_M({value:n,className:a,tComponent:v})}if(z===vu.RANGE_BIGDECIMAL)return(0,$.jsx)(aM,{...j,value:n});if(z===vu.RANGE_MONEY)return(0,$.jsx)(oM,{...j,value:n});if(z===vu.DATE)return(0,$.jsx)(sM,{...j,value:n});if(z===vu.DATETIME)return(0,$.jsx)(cM,{...j,value:n});if(z===vu.TIME)return(0,$.jsx)(lM,{...j,value:n});if(z===vu.RANGE_NUMBER)return(0,$.jsx)(uM,{...j,value:n});if(z===vu.RANGE_DATE)return(0,$.jsx)(dM,{...j,value:n});if(z===vu.RANGE_DATETIME)return(0,$.jsx)(fM,{...j,value:n});if(z===vu.RANGE_TIME)return(0,$.jsx)(pM,{...j,value:n});if(z===vu.RECORD&&typeof n==`object`&&n){let t=Object.entries(n);if(t.length===0)return yM(f,R(!0));let i=vi(e),o=aee(e),s=o?ar(o):void 0,c=e=>{if(!s)return e;let t=Pc(s,e),n=x(t);return n===t?e:n};return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),t.map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(Z,{className:U(O.base,`shrink-0`),children:c(e)}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(yR,{schema:i??void 0,schemaType:i?me(i):void 0,value:t,name:r?`${r}.${e}`:e,hideLabel:!0,parentData:n,resourceLinkTrail:te})})]},e))]})}if(z===vu.SET&&(n instanceof Set||Array.isArray(n))){let t=Array.from(n);if(t.length===0)return yM(f,R(!0));let i=kte(e);return(0,$.jsx)(`div`,{className:U(`flex flex-col gap-element-xs`,a),children:t.map((e,t)=>(0,$.jsx)(yR,{schema:i??void 0,schemaType:i?me(i):void 0,value:e,name:r?`${r}.${t}`:String(t),hideLabel:!0,resourceLinkTrail:te},`${r??`set`}-${t}`))})}if(z===vu.TUPLE&&Array.isArray(n)){if(n.length===0)return yM(f,R(!0));let t=aie(e);return(0,$.jsx)(`div`,{className:U(`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,a),children:n.map((e,n)=>{let i=t?.[n];return(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(yR,{schema:i??void 0,schemaType:i?me(i):void 0,value:e,name:r?`${r}.${n}`:String(n),hideLabel:!0,resourceLinkTrail:te})},`${r??`tuple`}-${n}`)})})}if(z===vu.MAP&&(n instanceof Map||typeof n==`object`&&n)){let t=n instanceof Map?Array.from(n.entries()):Object.entries(n);if(t.length===0)return yM(f,R(!0));let i=Pi(e);return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),t.map(([e,t],n)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:U(O.base,`shrink-0`),children:(0,$.jsx)(yR,{schema:i?.keySchema??void 0,schemaType:i?.keySchema?me(i.keySchema):void 0,value:e,name:r?`${r}.${n}.key`:`${n}.key`,hideLabel:!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(yR,{schema:i?.valueSchema??void 0,schemaType:i?.valueSchema?me(i.valueSchema):void 0,value:t,name:r?`${r}.${n}.value`:`${n}.value`,hideLabel:!0,resourceLinkTrail:te})})]},`${r??`map`}-${n}`))]})}return z===vu.UNKNOWN?(0,$.jsx)(Yj,{...j,value:n}):(0,$.jsxs)(`div`,{className:U(k.base,k.sizes?.sm||k.sizes?.md,D.base,`flex items-center gap-element px-card-sm py-item-xs rounded-md`,a),children:[(0,$.jsx)(Z,{className:O.base,children:v(B.LOW_LEVEL_FORM_FIELD,`unsupportedDisplayType`)}),(0,$.jsx)(v_,{className:U(`px-item-xs rounded`,D.states.hover),children:z})]})}bM.displayName=`DisplayValueDispatcher`;function xM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,className:m,hideLabel:h,hideDescription:g,resolvedChromeMode:_,resolvedLabelPlacement:v,resolvedLabelStyle:y,resolvedEmptyValue:b,fileUploadContext:x,wideValue:S,announceName:C}=e,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(r);return(0,Q.useEffect)(()=>{O.current!==r&&(T(!1),D(!1),O.current=r)},[r]),(0,$.jsx)(cj,{mode:_,label:a,labelStyle:y,description:o,tooltip:s,provenance:c,name:i,labelPlacement:v,hideLabel:h,hideDescription:g,wide:S,announceName:C,className:m,children:(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:m,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,emptyValue:b,fileUploadContext:x,showAllArrayItems:w,onExpandArrayItems:()=>T(!0),showAllObjectFields:E,onExpandObjectFields:()=>D(!0)})})}xM.displayName=`DisplayFieldReadOnly`;function SM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,className:f,hideLabel:p,hideDescription:m,resolvedLabelPlacement:h,resolvedLabelStyle:g,resolvedEmptyValue:_,fileUploadContext:v,sectionAppearance:b}=e,{getRecipe:x}=Wg(),S=x(cc.TYPOGRAPHY,y.EYEBROW),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{D.current!==r&&(w(!1),E(!1),D.current=r)},[r]);let O=h===`hidden`;return(0,$.jsxs)(OT,{appearance:b,className:f,"data-field":i,children:[a!=null&&!p&&O&&(0,$.jsx)(AT,{className:`sr-only`,children:a}),a!=null&&!p&&!O&&(g===cs.TITLE?(0,$.jsx)(`div`,{className:U(`pt-item-xs`,S.base),children:a}):(0,$.jsx)(AT,{children:a})),o!=null&&!m&&(0,$.jsx)(gx,{children:o}),(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:_,fileUploadContext:v,showAllArrayItems:C,onExpandArrayItems:()=>w(!0),showAllObjectFields:T,onExpandObjectFields:()=>E(!0)})]})}SM.displayName=`DisplayFieldReadOnlyArraySection`;function CM(e){return e.replace(/\[(\d+)\]/g,`.$1`)}function wM(e,t){let n=CM(e),r=CM(t);return r===n||r.startsWith(n+`.`)}function TM(e,t){return wM(e,t)||wM(t,e)}function EM(e,t){return t?CM(t).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}var DM=()=>()=>{},mfe={lastEvent:null},OM=()=>mfe,kM=as.getLogger(),AM=kM.debugByType(`FormErrorExtraction`);kM.setDebugTypeLogging(`FormErrorExtraction`,!1);function jM(e){if(!e||typeof e!=`object`)return AM(`extractServerValidationErrors: not an object, skipping`,{errorType:typeof e}),null;let t=e;if(t.customMessageReference===Xl.VERSION_CONFLICT)return AM(`extractServerValidationErrors: version conflict, not a validation error`),null;AM(`extractServerValidationErrors: inspecting error shape`,{httpStatus:t.httpStatus,hasValidationErrors:!!t.validationErrors,errorType:t.errorType,hasResponse:!!t.response,message:t.message});let n=t.httpStatus,r=t.validationErrors;if(MM(n)&&hfe(r))return AM(`extractServerValidationErrors: MATCHED via interceptor properties`,{httpStatus:n,fieldCount:Object.keys(r).length,fields:Object.keys(r)}),{httpStatus:n,validationErrors:r};let i=t.response;if(i){let e=i.status,t=i.data;if(MM(e)&&t){let n=Xee(t);if(n&&Object.keys(n).length>0)return AM(`extractServerValidationErrors: MATCHED via raw response`,{httpStatus:e,fieldCount:Object.keys(n).length,fields:Object.keys(n)}),{httpStatus:e,validationErrors:n}}}return AM(`extractServerValidationErrors: NO validation errors found`),null}function MM(e){return e===400||e===409||e===422}function hfe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}var gfe=Object.freeze([]);function _fe(e){let{declaration:t,record:n,appConfig:r,fieldName:i}=e,a=t?.readsFields??gfe,o=VC({name:a}),s=JSON.stringify(o??null),c=(0,Q.useMemo)(()=>{let e=Array.isArray(o)?o:[o];return Object.fromEntries(a.map((t,n)=>[t,e[n]]))},[a,s]),l=vfe(t?.readsReferences);return(0,Q.useMemo)(()=>t?Ro(t,{appConfig:r,currentObject:n,values:c,references:l},e=>console.warn(`[requestFieldOffers] The offer for "${i}" threw; every value is offered and the operation decides.`,e)):Jne,[t,r,n,c,l,i])}function vfe(e){let t=(0,Q.useMemo)(()=>Object.keys(e??{}),[e]),n=VC({name:t}),r=(0,Q.useMemo)(()=>{let r=Array.isArray(n)?n:[n];return t.map((t,n)=>{let i=r[n];return{field:t,resourceType:e[t],id:typeof i==`string`&&i.length>0?i:void 0}})},[t,e,JSON.stringify(n??null)]),{registry:i,doOperation:a}=fm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=FD(),u=lC(),d=(0,Q.useMemo)(()=>l?.contextResourceIdentifiers?V.buildContextualParameters(l.contextResourceIdentifiers,i):u?.contextualParameters??{},[l?.contextResourceIdentifiers,u?.contextualParameters,i]),f=l?{resourceType:l.resourceType,id:l.resourceId}:void 0,p=(0,Q.useRef)({registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,contextualParameters:d,hostRecord:f});p.current={registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,contextualParameters:d,hostRecord:f};let[m,h]=(0,Q.useState)({}),g=r.map(({resourceType:e,id:t})=>`${e}:${t??``}`).join(`|`);return(0,Q.useEffect)(()=>{let e=!1;for(let{resourceType:t,id:n}of r){let r=`${t}:${n}`;if(!n||m[r])continue;let i=p.current,a=nu(i.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null;Bw({resourceType:t,id:n,registry:i.registry,doOperation:i.doOperation,contextualParameters:zm({hostIdentifiers:{},hostContextualParameters:i.contextualParameters,hostRecord:i.hostRecord,targetResourceType:t,targetId:n,registry:i.registry}).contextualParameters,readOperation:a,t:i.t,formatDate:i.formatDate,formatDateTime:i.formatDateTime}).then(({record:t})=>{e||h(e=>({...e,[r]:t}))}).catch(e=>{console.warn(`[requestFieldOffers] The ${t} "${n}" a request field references could not be read; its offer narrows nothing by it.`,e)})}return()=>{e=!0}},[g]),(0,Q.useMemo)(()=>Object.fromEntries(r.map(({field:e,resourceType:t,id:n})=>[e,n?m[`${t}:${n}`]:void 0])),[r,m])}var NM=(0,Q.createContext)(null);function PM(e){let t=(0,Q.useContext)(NM);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[e,t])}var FM=as.getLogger(),IM=FM.debugByType(`FieldUniquenessValidation`);FM.setDebugTypeLogging(`FieldUniquenessValidation`,!1);function yfe({fieldName:e,fieldSchema:t}){let n=FD(),r=GC(),{httpClient:i}=Ou(),{tErrorValidation:a}=K(),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=t?yu(t):!1,l=n?.validateFieldUrl,u=n?.resourceId;return{validateUniqueness:(0,Q.useCallback)(async()=>{if(!c||!l||!i)return;let t=r.getValues(e);if(t==null||t===``){r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e);return}IM(`Starting uniqueness check`,{fieldName:e,value:t,validateFieldUrl:l,resourceId:u}),o.current&&o.current.abort();let n=new AbortController;o.current=n,s.current=!0;try{let o=await i.post(l,{fieldName:e,value:t,excludeId:u},{signal:n.signal,silent:!0});return IM(`Uniqueness check response`,{fieldName:e,valid:o.valid,error:o.error}),!o.valid&&o.error?(r.setError(e,{type:sT,message:a(o.error.code,`msg`,o.error.params)}),!1):(r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e),!0)}catch(t){if(t?.name===`AbortError`||t?.code===`ERR_CANCELED`){IM(`Uniqueness check aborted (superseded)`,{fieldName:e});return}FM.warn(`Uniqueness pre-validation failed`,{fieldName:e,error:t?.message});return}finally{s.current=!1,o.current===n&&(o.current=null)}},[e,c,l,u,i,r,a]),isChecking:s.current}}function bfe(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function LM(e){let t=GC(),n=(0,Q.useRef)(!1);return{handleFieldBlur:(0,Q.useCallback)(r=>{let i=t.getFieldState(e),a=t.getValues(e);return!i.error&&!n.current&&bfe(a)?(t.setValue(e,a,{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),!0):(r(),!1)},[t,e]),noteInputReceived:(0,Q.useCallback)(()=>{n.current=!0},[])}}var RM=(0,Q.createContext)({});function zM({invalid:e,describedBy:t,children:n}){let r=t.filter(Boolean).join(` `),i=(0,Q.useMemo)(()=>({...e?{"aria-invalid":!0}:{},...r?{"aria-describedby":r}:{}}),[e,r]);return(0,$.jsx)(RM.Provider,{value:i,children:n})}function BM(){return(0,Q.useContext)(RM)}function VM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AUTOSAVE_INDICATOR,`AutosaveIndicator`)(e);return(0,$.jsx)(n,{...t})}function HM(e,t){let{saveState:n,saveErrorMessage:r,onRetrySave:i,variant:a=`block`}=t;return!n||n===rT.IDLE?e:a===`inline`?(0,$.jsxs)(`div`,{className:`relative inline-flex`,children:[e,(0,$.jsx)(VM,{state:n,errorMessage:r,onRetry:i,position:`inline`,className:`ml-element`})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[e,(0,$.jsx)(VM,{state:n,errorMessage:r,onRetry:i,position:`absolute-right`,className:i?void 0:`pointer-events-none`})]})}function UM(e,t,n){return e==null?Wc.STACKED:typeof e==`string`?e:e[t]??e[Sl.DESKTOP]??Wc.STACKED}function WM({text:e}){let{renderIcon:t}=Mf(),{tComponent:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(B.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:ca.XS})})}),(0,$.jsx)(rj,{children:e})]}):null}function GM({mode:e,label:t,description:n,error:r,required:i,labelPlacement:a,hideLabel:o,hideDescription:s,hideError:c,saveState:l,saveErrorMessage:u,onRetrySave:d,onSaveFieldNow:f,fieldName:p,disabled:m,tooltip:h,wideControl:g,className:_,children:v}){let{currentBreakpoint:y,isMobile:b}=Wg(),x=(0,Q.useMemo)(()=>UM(e,y,b),[e,y,b]),S=p?`field-${p}`:void 0,C=p?`field-${p}-description`:void 0,w=p?`field-${p}-error`:void 0,T=p?`field-${p}-label`:void 0,E=a??(x===Wc.INLINE?`inline`:`top`),D=!o&&!!t&&E!==`hidden`&&x!==Wc.COMPACT&&x!==Wc.HIDDEN,O=!s&&!!n&&x!==Wc.COMPACT&&x!==Wc.HIDDEN,k=!c&&!!r&&x!==Wc.HIDDEN,A=!o&&t&&E===`hidden`?(0,$.jsx)(px,{id:T,htmlFor:S,className:`sr-only`,children:t}):null,j=E===`start`||E===`inline`?`inline`:`block`,M=HM((0,$.jsx)(zM,{invalid:!!r,describedBy:[O?C:void 0,k?w:void 0],children:(0,$.jsx)(AE,{fieldName:p,label:t,disabled:m,onSaveFieldNow:f,children:v})}),{saveState:l,saveErrorMessage:u,onRetrySave:d,variant:j});if(x===Wc.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[A,M]});if(x===Wc.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-disabled":m||void 0,className:_,children:[A,M,k&&(0,$.jsx)(_x,{id:w,children:r})]});if(E===`start`||E===`inline`){let e=(0,$.jsxs)(hx,{children:[D&&(0,$.jsx)(mx,{children:(0,$.jsxs)(px,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(WM,{text:h})]})}),O&&(0,$.jsx)(gx,{id:C,children:n}),k&&(0,$.jsx)(_x,{id:w,children:r})]});return(0,$.jsxs)(fx,{orientation:dx.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:_,children:[E===`start`&&e,M,E===`inline`&&e]})}if(x===Wc.RELAXED)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`relaxed`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex flex-col gap-field`,_),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-lg font-semibold leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-1`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(WM,{text:h})]}),O&&(0,$.jsx)(`p`,{id:C,className:`text-base text-muted-foreground leading-normal -mt-1`,children:n}),(0,$.jsx)(`div`,{className:`py-1`,children:M}),k&&(0,$.jsx)(`div`,{id:w,role:`alert`,className:`text-base text-destructive font-normal`,children:r})]});if(x===Wc.SETTINGS_ROW){let e=!!g||b;return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":g?`wide`:b?`stacked`:void 0,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,e?`flex-col gap-element-xs`:U(`flex-row gap-section`,O?`items-start`:`items-center has-[textarea]:items-start`),_),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!e&&`flex-1`),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-sm font-medium leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(WM,{text:h})]}),O&&(0,$.jsx)(gx,{id:C,children:n})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,e?`w-full`:`w-72 max-w-[55%] shrink items-end`),children:[M,k&&(0,$.jsx)(_x,{id:w,children:r})]})]})}return(0,$.jsxs)(fx,{orientation:dx.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:_,children:[A,D&&(0,$.jsxs)(px,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(WM,{text:h})]}),M,O&&(0,$.jsx)(gx,{id:C,children:n}),k&&(0,$.jsx)(_x,{id:w,children:r})]})}GM.displayName=`FormFieldChrome`;var KM=Qs(B.LOW_LEVEL_SLIDER,`Slider`,[`Root`]),xfe=Nl(B.LOW_LEVEL_RANGE_SLIDER,`RangeSlider`),qM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=KM(e);return(0,$.jsx)(r,{...t,ref:n})});qM.displayName=`Slider`;var JM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=KM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});JM.displayName=`SliderRoot`;var YM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=xfe(e);return(0,$.jsx)(r,{...t,ref:n})});YM.displayName=`RangeSlider`;var XM=Qs(B.LOW_LEVEL_INPUT,`Input`,[`Root`]),ZM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XM(e);return(0,$.jsx)(r,{...t,ref:n})});ZM.displayName=`Input`;var QM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});QM.displayName=`InputRoot`;var $M=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_DATEPICKER,`DatePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});$M.displayName=`DatePicker`;var eN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_DATE}),i=n?.dateFormat;return(0,$.jsx)($M,{ref:t,...e,dateFormat:i,calendarDate:e.schema?el(e.schema):!1,timeZone:n?.timezone})}),tN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_DATE,`FormFieldDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});tN.displayName=`FormFieldDate`;var nN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_DATETIME_PICKER,`DateTimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});nN.displayName=`DateTimePicker`;var rN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_DATETIME});return(0,$.jsx)(nN,{ref:t,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone})}),iN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_DATETIME,`FormFieldDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});iN.displayName=`FormFieldDateTime`;var aN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_TIMEPICKER,`TimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});aN.displayName=`TimePicker`;var oN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_TIME});return(0,$.jsx)(aN,{ref:t,...e,timeFormat:n?.timeFormat})}),sN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_TIME,`FormFieldTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});sN.displayName=`FormFieldTime`;var cN=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,fromPlaceholder:l=`From`,toPlaceholder:u=`To`,fromLabel:d=`From`,toLabel:f=`To`,step:p=1,min:m,max:h,required:g,autoFocus:_,controlSize:v=Zd.MD},y)=>{let{tComponent:b,isReady:x}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER}),S=jt(e),C=m??S?.min,w=h??S?.max,T=S?.fromOptional??!0,E=S?.toOptional??!0,[D,O]=Q.useState(c??{from:void 0,to:void 0}),k=j_(a,o),A=a??D,j=Q.useMemo(()=>A.from==null||A.to==null?!1:A.from>A.to,[A.from,A.to]),M=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,from:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),N=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,to:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),P=Q.useCallback(()=>{s?.()},[s]),F=t??`range-number-field`,I=`${F}-from`,ee=`${F}-to`;return x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:I,className:`sr-only`,children:d}),(0,$.jsx)(QM,{ref:y,id:I,type:`number`,value:A.from??``,onChange:M,onBlur:P,disabled:n,readOnly:r,placeholder:l,"aria-invalid":j,"aria-required":!T,step:p,min:C,max:w,className:`tabular-nums`,autoFocus:_,controlSize:v})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(QM,{id:ee,type:`number`,value:A.to??``,onChange:N,onBlur:P,disabled:n,readOnly:r,placeholder:u,"aria-invalid":j,"aria-required":!E,step:p,min:C,max:w,className:`tabular-nums`,controlSize:v})]})]}),j&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:b(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),lN=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,`FormFieldRangeNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});lN.displayName=`FormFieldRangeNumber`;var uN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_DATE_RANGE_PICKER,`DateRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});uN.displayName=`DateRangePicker`;var dN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_DATE}),i=e.schema?jt(e.schema):void 0,a=e.minDate??ii(i?.min),o=e.maxDate??ii(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(uN,{ref:t,schema:e.schema,name:e.name,...e,dateFormat:n?.dateFormat,timeZone:n?.timezone,minDate:a,maxDate:o,"aria-required":s||c||void 0,"data-from-required":s||void 0,"data-to-required":c||void 0})}),fN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_DATE,`FormFieldRangeDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});fN.displayName=`FormFieldRangeDate`;var pN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_DATETIME_RANGE_PICKER,`DateTimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});pN.displayName=`DateTimeRangePicker`;var mN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME}),i=e.schema?jt(e.schema):void 0,a=e.minDate??ii(i?.min),o=e.maxDate??ii(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(pN,{ref:t,schema:e.schema,name:e.name,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone,minDate:a,maxDate:o,"aria-required":s||c||void 0,"data-from-required":s||void 0,"data-to-required":c||void 0})}),hN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,`FormFieldRangeDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});hN.displayName=`FormFieldRangeDateTime`;var gN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_TIME_RANGE_PICKER,`TimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});gN.displayName=`TimeRangePicker`;var _N=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_TIME});return(0,$.jsx)(gN,{ref:t,schema:e.schema,name:e.name,...e,timeFormat:n?.timeFormat})}),vN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_TIME,`FormFieldRangeTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});vN.displayName=`FormFieldRangeTime`;function yN({name:e,schema:t,label:n,hideLabel:r,description:i,disabled:a,className:o,renderField:s,fieldLabels:c={},excludedChildKeys:l}){let u=F(t),d=qr(t),f=zT();if(!u||d.length===0)return null;let p=l?new Set(l):null,m=p?d.filter(e=>!p.has(e)):d;return m.length===0?null:s?(0,$.jsxs)(OT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(SD,{children:(0,$.jsx)(AT,{children:n})}),i&&(0,$.jsx)(gx,{children:i}),(0,$.jsx)(kT,{children:m.map(t=>(0,$.jsx)(Q.Fragment,{children:s(`${e}.${t}`,u[t])},t))})]}):(0,$.jsxs)(OT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(SD,{children:(0,$.jsx)(AT,{children:n})}),i&&(0,$.jsx)(gx,{children:i}),(0,$.jsx)(kT,{children:m.map(t=>{let n=u[t],r=`${e}.${t}`,i=c[t]??f?.fieldLabels?.[hr.labelDictionaryPath(r)]??hr.unresolvedFieldLabel(t);return(0,$.jsx)(XL,{name:r,schema:n,label:i,disabled:a},t)})})]})}yN.displayName=`FormFieldComposite`;var bN=yN,Sfe=0;function xN(){return`kv-${++Sfe}-${Date.now()}`}function Cfe(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e])=>({id:xN(),key:e,pendingValue:void 0}))}function wfe(e,t,n,r){let i={};for(let a of e){let e=a.key.trim();if(e!==``){if(r?.has(a.id))i[e]=r.get(a.id);else{let r=n(`${t}.${e}`);i[e]=r===void 0?a.pendingValue:r}}}return i}function Tfe({entry:e,index:t,valueSchema:n,parentName:r,disabled:i,canRemove:a,keyError:o,onKeyChange:s,onRemove:c,keyLabel:l,valueLabel:u,emptyKeyPlaceholder:d,renderIcon:f}){let{getRecipe:p}=Wg(),m=p(cc.TYPOGRAPHY,y.DESCRIPTION),{formChromeMode:h,sectionChromeMode:g}=eT(),_=hc(),v=g??h??UL(_.autoRender?.autoFieldChrome),b=WL(_.autoRender?.autoLabelPlacement),x=GL(_.autoRender?.autoFieldDensity),S=_.autoRender?.autoErrorPlacement===`summary-at-surface-top`,C=(0,Q.useCallback)(t=>{s(e.id,t)},[e.id,s]),w=e.key.trim()!==``;return(0,$.jsxs)(`div`,{className:`relative rounded-lg border border-border p-card`,"data-testid":`record-entry-${t}`,children:[a&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>c(e.id),disabled:i,className:`absolute -top-3 end-3 h-6 w-6 bg-background`,"aria-label":`Remove entry ${e.key||t+1}`,children:f(H.CLOSE,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`pt-item space-y-field`,children:[(0,$.jsx)(GM,{mode:v,label:l,error:o,labelPlacement:b,hideError:S,fieldName:`${r}.__key_${e.id}`,disabled:i,children:(0,$.jsx)(ZM,{schema:bd(),name:`${r}.__key_${e.id}`,value:e.key,onChange:e=>C(String(e)),disabled:i,controlSize:x})}),w?(0,$.jsx)(XL,{name:`${r}.${e.key}`,schema:n,label:u,disabled:i}):(0,$.jsx)(`p`,{className:U(m.base,`py-card-sm px-card-sm rounded-md border border-dashed border-border`),children:d})]})]})}function SN({name:e,schema:t,label:n,description:r,disabled:i,className:a,valueSchema:o,keySchema:s}){let{setValue:c,getValues:l,trigger:u,setError:d,clearErrors:f,getFieldState:p,formState:m}=GC(),{renderIcon:h}=Mf(),g=EE(),_=g!==null&&OE(Xc(t)?.autosave,g.config.defaultTrigger,!0)!==ou.NONE?g:null,{tComponent:v,isReady:b,resolvedRegionalPreferences:x}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),S=x?.timezone,{getRecipe:C}=Wg(),w=C(cc.TYPOGRAPHY,y.DESCRIPTION),T=v(B.LOW_LEVEL_FORM_MESSAGE,`recordAddEntry`),E=v(B.LOW_LEVEL_FORM_MESSAGE,`recordKeyLabel`),D=v(B.LOW_LEVEL_FORM_MESSAGE,`recordValueLabel`),O=v(B.LOW_LEVEL_FORM_MESSAGE,`recordEmptyMessage`),k=v(B.LOW_LEVEL_FORM_MESSAGE,`recordDuplicateKey`),A=v(B.LOW_LEVEL_FORM_MESSAGE,`recordEnterKeyFirst`),j=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>()=>{j.current=!1},[]);let[M,N]=(0,Q.useState)(()=>Cfe(l(e))),P=(0,Q.useMemo)(()=>{let e=new Map;for(let t of M){let n=t.key.trim();n!==``&&e.set(n,(e.get(n)||0)+1)}let t=new Set;for(let[n,r]of e)r>1&&t.add(n);return t},[M]);(0,Q.useEffect)(()=>{P.size>0?d(e,{type:lT,message:k}):p(e,m).error?.type===`record-duplicate-key`&&f(e)},[P,e,d,f,p,m,k]);let F=(0,Q.useCallback)((t,n)=>{let r=wfe(t,e,l,n);c(e,r,{shouldDirty:!0,shouldValidate:!0}),_&&_.triggerSave(e,r,ou.DEBOUNCE),setTimeout(()=>{j.current&&u(e)},0)},[e,c,l,u,_]),I=(0,Q.useCallback)((t,n)=>{N(r=>{let i=r.find(e=>e.id===t);if(!i)return r;let a=i.key.trim(),o=a===``?i.pendingValue:l(`${e}.${a}`),s=r.map(e=>e.id===t?{...e,key:n,pendingValue:o}:e);return F(s,new Map([[t,o]])),s})},[e,l,F]),ee=(0,Q.useCallback)(()=>{if(i)return;let e={id:xN(),key:``,pendingValue:hr.getDefaultValueForSchema(o,{timeZone:S})};N(t=>[...t,e])},[i,o,S]),L=(0,Q.useCallback)(e=>{i||N(t=>{let n=t.filter(t=>t.id!==e);return F(n),n})},[i,F]);return b?(0,$.jsxs)(OT,{disabled:i,className:a,"data-field":e,"data-testid":`field-record-${e}`,children:[(0,$.jsx)(SD,{children:(0,$.jsx)(AT,{children:n})}),r&&(0,$.jsx)(gx,{children:r}),(0,$.jsxs)(kT,{className:`space-y-field`,children:[M.map((t,n)=>{let r=t.key.trim(),a=r!==``&&P.has(r)?k:void 0;return(0,$.jsx)(Tfe,{entry:t,index:n,valueSchema:o,parentName:e,disabled:i,canRemove:!i,keyError:a,onKeyChange:I,onRemove:L,keyLabel:E,valueLabel:D,emptyKeyPlaceholder:A,renderIcon:h},t.id)}),(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,onClick:ee,disabled:i,className:`w-full`,children:[h(H.PLUS,{size:ca.SM,className:`me-element`}),T]}),M.length===0&&(0,$.jsx)(`p`,{className:U(w.base,`text-center py-card`),children:O})]})]}):null}SN.displayName=`FormFieldRecord`;var CN=SN,wN=e(i());function Efe(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var TN=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function EN(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function DN(e){return`nodeType`in e}function ON(e){return e?EN(e)?e:DN(e)?e.ownerDocument?.defaultView??window:window:window}function kN(e){let{Document:t}=ON(e);return e instanceof t}function AN(e){return!EN(e)&&e instanceof ON(e).HTMLElement}function jN(e){return e instanceof ON(e).SVGElement}function MN(e){return e?EN(e)?e.document:DN(e)?kN(e)?e:AN(e)||jN(e)?e.ownerDocument:document:document:document}var NN=TN?Q.useLayoutEffect:Q.useEffect;function PN(e){let t=(0,Q.useRef)(e);return NN(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Dfe(){let e=(0,Q.useRef)(null);return[(0,Q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function FN(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return NN(()=>{n.current!==e&&(n.current=e)},t),n}function IN(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function LN(e){let t=PN(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function RN(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var zN={};function BN(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=zN[e]==null?0:zN[e]+1;return zN[e]=n,e+`-`+n},[e,t])}function VN(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var HN=VN(1),UN=VN(-1);function Ofe(e){return`clientX`in e&&`clientY`in e}function WN(e){if(!e)return!1;let{KeyboardEvent:t}=ON(e.target);return t&&e instanceof t}function kfe(e){if(!e)return!1;let{TouchEvent:t}=ON(e.target);return t&&e instanceof t}function GN(e){if(kfe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ofe(e)?{x:e.clientX,y:e.clientY}:null}var KN=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[KN.Translate.toString(e),KN.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),qN=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Afe(e){return e.matches(qN)?e:e.querySelector(qN)}var jfe={display:`none`};function Mfe(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:jfe},n)}function Nfe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Pfe(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var JN=(0,Q.createContext)(null);function Ffe(e){let t=(0,Q.useContext)(JN);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ife(){let[e]=(0,Q.useState)(()=>new Set),t=(0,Q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Lfe={draggable:`
7
- To pick up a draggable item, press the space bar.
8
- While dragging, use the arrow keys to move the item.
9
- Press space again to drop the item in its new position, or press escape to cancel.
10
- `},Rfe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function zfe(e){let{announcements:t=Rfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Lfe}=e,{announce:a,announcement:o}=Pfe(),s=BN(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),Ffe((0,Q.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Q.createElement(Q.Fragment,null,Q.createElement(Mfe,{id:r,value:i.draggable}),Q.createElement(Nfe,{id:s,announcement:o}));return n?(0,wN.createPortal)(u,n):u}var YN;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(YN||={});function XN(){}function ZN(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function QN(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var $N=Object.freeze({x:0,y:0});function eP(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function tP(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Bfe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function nP(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function rP(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function iP(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var aP=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=iP(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=eP(iP(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(tP)},Vfe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=nP(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=nP(r),o=i.reduce((e,t,r)=>e+eP(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(tP)};function Hfe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Ufe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Hfe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Bfe)};function Wfe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function oP(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$N}function Gfe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Kfe=Gfe(1);function qfe(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jfe(e,t,n){let r=qfe(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Yfe={ignoreTransform:!1};function sP(e,t){t===void 0&&(t=Yfe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=ON(e).getComputedStyle(e);t&&(n=Jfe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function cP(e){return sP(e,{ignoreTransform:!0})}function Xfe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Zfe(e,t){return t===void 0&&(t=ON(e).getComputedStyle(e)),t.position===`fixed`}function Qfe(e,t){t===void 0&&(t=ON(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function lP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(kN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!AN(i)||jN(i)||n.includes(i))return n;let a=ON(e).getComputedStyle(i);return i!==e&&Qfe(i,a)&&n.push(i),Zfe(i,a)?n:r(i.parentNode)}return e?r(e):n}function uP(e){let[t]=lP(e,1);return t??null}function dP(e){return!TN||!e?null:EN(e)?e:DN(e)?kN(e)||e===MN(e).scrollingElement?window:AN(e)?e:null:null}function fP(e){return EN(e)?e.scrollX:e.scrollLeft}function pP(e){return EN(e)?e.scrollY:e.scrollTop}function mP(e){return{x:fP(e),y:pP(e)}}var hP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(hP||={});function gP(e){return!TN||!e?!1:e===document.scrollingElement}function _P(e){let t={x:0,y:0},n=gP(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var $fe={x:.2,y:.2};function epe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=$fe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=_P(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=hP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=hP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=hP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=hP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function tpe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function vP(e){return e.reduce((e,t)=>HN(e,mP(t)),$N)}function npe(e){return e.reduce((e,t)=>e+fP(t),0)}function rpe(e){return e.reduce((e,t)=>e+pP(t),0)}function ipe(e,t){if(t===void 0&&(t=sP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);uP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ape=[[`x`,[`left`,`right`],npe],[`y`,[`top`,`bottom`],rpe]],yP=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=lP(t),r=vP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ape)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},bP=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function ope(e){let{EventTarget:t}=ON(e);return e instanceof t?e:MN(e)}function xP(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var SP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(SP||={});function CP(e){e.preventDefault()}function spe(e){e.stopPropagation()}var wP;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(wP||={});var TP={start:[wP.Space,wP.Enter],cancel:[wP.Esc],end:[wP.Space,wP.Enter,wP.Tab]},cpe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case wP.Right:return{...n,x:n.x+25};case wP.Left:return{...n,x:n.x-25};case wP.Down:return{...n,y:n.y+25};case wP.Up:return{...n,y:n.y-25}}},EP=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new bP(MN(t)),this.windowListeners=new bP(ON(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(SP.Resize,this.handleCancel),this.windowListeners.add(SP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(SP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&ipe(n),t($N)}handleKeyDown(e){if(WN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=TP,coordinateGetter:a=cpe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:$N;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=UN(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=_P(n),p=tpe(n),m={x:Math.min(i===wP.Right?p.right-p.width/2:p.right,Math.max(i===wP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===wP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===wP.Down?p.top:p.top+p.height/2,u.y))},h=i===wP.Right&&!s||i===wP.Left&&!c,g=i===wP.Down&&!l||i===wP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===wP.Right&&e<=d.x||i===wP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===wP.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===wP.Down&&e<=d.y||i===wP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===wP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,HN(UN(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};EP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=TP,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function DP(e){return!!(e&&`distance`in e)}function OP(e){return!!(e&&`delay`in e)}var kP=class{constructor(e,t,n){n===void 0&&(n=ope(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=MN(i),this.documentListeners=new bP(this.document),this.listeners=new bP(n),this.windowListeners=new bP(ON(i)),this.initialCoordinates=GN(r)??$N,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(SP.Resize,this.handleCancel),this.windowListeners.add(SP.DragStart,CP),this.windowListeners.add(SP.VisibilityChange,this.handleCancel),this.windowListeners.add(SP.ContextMenu,CP),this.documentListeners.add(SP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(OP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(DP(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(SP.Click,spe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(SP.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=GN(e)??$N,s=UN(n,o);if(!t&&a){if(DP(a)){if(a.tolerance!=null&&xP(s,a.tolerance))return this.handleCancel();if(xP(s,a.distance))return this.handleStart()}if(OP(a)&&xP(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===wP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},lpe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},AP=class extends kP{constructor(e){let{event:t}=e,n=MN(t.target);super(e,lpe,n)}};AP.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var upe={move:{name:`mousemove`},end:{name:`mouseup`}},jP;(function(e){e[e.RightClick=2]=`RightClick`})(jP||={});var dpe=class extends kP{constructor(e){super(e,upe,MN(e.event.target))}};dpe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==jP.RightClick&&(r?.({event:n}),!0)}}];var MP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},fpe=class extends kP{constructor(e){super(e,MP)}static setup(){return window.addEventListener(MP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(MP.move.name,e)};function e(){}}};fpe.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var NP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(NP||={});var PP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(PP||={});function ppe(e){let{acceleration:t,activator:n=NP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=PP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=hpe({delta:d,disabled:!a}),[m,h]=Dfe(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case NP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case NP.DraggableRect:return i}},[n,i,c]),y=(0,Q.useRef)(null),b=(0,Q.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Q.useMemo)(()=>s===PP.TreeOrder?[...l].reverse():l,[s,l]);(0,Q.useEffect)(()=>{if(!a||!l.length||!v)h();else{for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=epe(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()}},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var mpe={x:{[hP.Backward]:!1,[hP.Forward]:!1},y:{[hP.Backward]:!1,[hP.Forward]:!1}};function hpe(e){let{delta:t,disabled:n}=e,r=RN(t);return IN(e=>{if(n||!r||!e)return mpe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hP.Backward]:e.x[hP.Backward]||i.x===-1,[hP.Forward]:e.x[hP.Forward]||i.x===1},y:{[hP.Backward]:e.y[hP.Backward]||i.y===-1,[hP.Forward]:e.y[hP.Forward]||i.y===1}}},[n,t,r])}function gpe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return IN(e=>t==null?null:r??e??null,[r,t])}function _pe(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var FP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(FP||={});var IP;(function(e){e.Optimized=`optimized`})(IP||={});var LP=new Map;function vpe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Q.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Q.useRef)(e),d=g(),f=FN(d),p=(0,Q.useCallback)(function(e){e===void 0&&(e=[]),f.current||o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Q.useRef)(null),h=IN(t=>{if(d&&!n)return LP;if(!t||t===LP||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new yP(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Q.useEffect)(()=>{u.current=e},[e]),(0,Q.useEffect)(()=>{d||p()},[n,d]),(0,Q.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Q.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case FP.Always:return!1;case FP.BeforeDragging:return n;default:return!n}}}function RP(e,t){return IN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function ype(e,t){return RP(e,t)}function bpe(e){let{callback:t,disabled:n}=e,r=PN(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function zP(e){let{callback:t,disabled:n}=e,r=PN(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function xpe(e){return new yP(sP(e),e)}function BP(e,t,n){t===void 0&&(t=xpe);let[r,i]=(0,Q.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=bpe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=zP({callback:a});return NN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Spe(e){return oP(e,RP(e))}var VP=[];function Cpe(e){let t=(0,Q.useRef)(e),n=IN(n=>e?n&&n!==VP&&e&&t.current&&e.parentNode===t.current.parentNode?n:lP(e):VP,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function wpe(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=dP(e.target);t&&n(e=>e?(e.set(t,mP(t)),new Map(e)):null)},[]);return(0,Q.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mP(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>HN(e,t),$N):vP(e):$N,[e,t])}function HP(e,t){t===void 0&&(t=[]);let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{n.current=null},t),(0,Q.useEffect)(()=>{let t=e!==$N;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?UN(e,n.current):$N}function Tpe(e){(0,Q.useEffect)(()=>{if(!TN)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Epe(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function UP(e){return(0,Q.useMemo)(()=>e?Xfe(e):null,[e])}var WP=[];function Dpe(e,t){t===void 0&&(t=sP);let[n]=e,r=UP(n?ON(n):null),[i,a]=(0,Q.useState)(WP);function o(){a(()=>e.length?e.map(e=>gP(e)?r:new yP(t(e),e)):WP)}let s=zP({callback:o});return NN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ope(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return AN(t)?t:e}function kpe(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=zP({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(AN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=LN((0,Q.useCallback)(e=>{let n=Ope(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Q.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ape=[{sensor:AP,options:{}},{sensor:EP,options:{}}],jpe={current:{}},GP={draggable:{measure:cP},droppable:{measure:cP,strategy:FP.WhileDragging,frequency:IP.Optimized},dragOverlay:{measure:sP}},KP=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Mpe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new KP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:XN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:GP,measureDroppableContainers:XN,windowRect:null,measuringScheduled:!1},Npe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:XN,draggableNodes:new Map,over:null,measureDroppableContainers:XN},qP=(0,Q.createContext)(Npe),JP=(0,Q.createContext)(Mpe);function Ppe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new KP}}}function Fpe(e,t){switch(t.type){case YN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case YN.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case YN.DragEnd:case YN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case YN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new KP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case YN.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new KP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case YN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new KP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ipe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(qP),a=RN(r),o=RN(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!WN(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Afe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Lpe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Rpe(e){return(0,Q.useMemo)(()=>({draggable:{...GP.draggable,...e?.draggable},droppable:{...GP.droppable,...e?.droppable},dragOverlay:{...GP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zpe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Q.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;NN(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=oP(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=uP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var YP=(0,Q.createContext)({...$N,scaleX:1,scaleY:1}),XP;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(XP||={});var ZP=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ape,collisionDetection:o=Ufe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(Fpe,void 0,Ppe),[f,p]=Ife(),[m,h]=(0,Q.useState)(XP.Uninitialized),g=m===XP.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Q.useRef)({initial:null,translated:null}),C=(0,Q.useMemo)(()=>_==null?null:{id:_,data:x?.data??jpe,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=FN(l,Object.values(l)),A=BN(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=Rpe(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=vpe(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=gpe(v,_),ee=(0,Q.useMemo)(()=>D?GN(D):null,[D]),L=ke(),R=ype(I,M.draggable.measure);zpe({activeNode:_==null?null:v.get(_),config:L.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let z=BP(I,M.draggable.measure,R),te=BP(I?I.parentElement:null),ne=(0,Q.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=b.getNodeFor(ne.current.over?.id),ie=kpe({measure:M.dragOverlay.measure}),ae=ie.nodeRef.current??I,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=Spe(se?null:z),le=UP(ae?ON(ae):null),ue=Cpe(g?re??I:null),de=Dpe(ue),fe=Lpe(c,{transform:{x:y.x-ce.x,y:y.y-ce.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:oe,over:ne.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ee?HN(ee,y):null,me=wpe(ue),he=HP(me),ge=HP(me,[z]),_e=HN(fe,he),ve=oe?Kfe(oe,fe):null,ye=C&&ve?o({active:C,collisionRect:ve,droppableRects:N,droppableContainers:j,pointerCoordinates:pe}):null,be=rP(ye,`id`),[xe,Se]=(0,Q.useState)(null),Ce=Wfe(se?fe:HN(fe,ge),xe?.rect??null,z),we=(0,Q.useRef)(null),Te=(0,Q.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:ne,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,wN.unstable_batchedUpdates)(()=>{r?.(i),h(XP.Initializing),d({type:YN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:YN.DragMove,coordinates:e})},onEnd:s(YN.DragEnd),onCancel:s(YN.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ne.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===YN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=YN.DragCancel)}w.current=null,(0,wN.unstable_batchedUpdates)(()=>{d({type:e}),h(XP.Uninitialized),Se(null),E(null),O(null),we.current=null;let t=e===YN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=_pe(a,(0,Q.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));Tpe(a),NN(()=>{z&&m===XP.Initializing&&h(XP.Initialized)},[z,m]),(0,Q.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=ne.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:_e.x,y:_e.y},over:i};(0,wN.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ne.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,wN.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),NN(()=>{ne.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ve,collisions:ye,droppableRects:N,draggableNodes:v,draggingNode:ae,draggingNodeRect:oe,droppableContainers:b,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},S.current={initial:oe,translated:ve}},[C,I,ye,ve,v,ae,oe,N,b,xe,ue,_e]),ppe({...L,delta:y,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:z,activatorEvent:D,collisions:ye,containerNodeRect:te,dragOverlay:ie,draggableNodes:v,droppableContainers:b,droppableRects:N,over:xe,measureDroppableContainers:P,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:M,measuringScheduled:F,windowRect:le}),[C,I,z,D,ye,te,ie,v,b,N,xe,P,ue,de,M,F,le]),Oe=(0,Q.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:xe,measureDroppableContainers:P}),[D,Ee,C,z,d,A,v,xe,P]);return Q.createElement(JN.Provider,{value:p},Q.createElement(qP.Provider,{value:Oe},Q.createElement(JP.Provider,{value:De},Q.createElement(YP.Provider,{value:Ce},i)),Q.createElement(Ipe,{disabled:n?.restoreFocus===!1})),Q.createElement(zfe,{...n,hiddenTextDescribedById:A}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Bpe=(0,Q.createContext)(null),QP=`button`,Vpe=`Draggable`;function Hpe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=BN(Vpe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(qP),{role:p=QP,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?YP:Bpe),[v,y]=LN(),[b,x]=LN(),S=Epe(o,t),C=FN(n);return NN(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Q.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===QP?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Upe(){return(0,Q.useContext)(JP)}var Wpe=`Droppable`,Gpe={timeout:25};function Kpe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=BN(Wpe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(qP),u=(0,Q.useRef)({disabled:n}),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Gpe,...i},_=FN(h??r),v=zP({callback:(0,Q.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)):d.current=!0},[g]),disabled:m||!o}),[y,b]=LN((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=FN(t);return(0,Q.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:YN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:YN.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:YN.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function $P(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function qpe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function eF(e){return e!==null&&e>=0}function Jpe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ype(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var tF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=$P(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},nF={scaleX:1,scaleY:1},rF=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...nF}:null}let s=Xpe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...nF}:r<t&&r>=a?{x:0,y:o.height+s,...nF}:{x:0,y:0,...nF}};function Xpe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var iF=`Sortable`,aF=Q.createContext({activeIndex:-1,containerId:iF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tF,disabled:{draggable:!1,droppable:!1}});function oF(e){let{children:t,id:n,items:r,strategy:i=tF,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Upe(),d=BN(iF,n),f=s.rect!==null,p=(0,Q.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Q.useRef)(p),v=!Jpe(p,_.current),y=g!==-1&&h===-1||v,b=Ype(a);NN(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Q.useEffect)(()=>{_.current=p},[p]);let x=(0,Q.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:qpe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(aF.Provider,{value:x},t)}var Zpe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return $P(n,r,i).indexOf(t)},Qpe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},$pe={duration:200,easing:`ease`},sF=`transform`,eme=KN.Transition.toString({property:sF,duration:0,easing:`linear`}),tme={roleDescription:`sortable`};function nme(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return NN(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=sP(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Q.useEffect)(()=>{a&&o(null)},[a]),a}function cF(e){let{animateLayoutChanges:t=Qpe,attributes:n,disabled:r,data:i,getNewIndex:a=Zpe,id:o,strategy:s,resizeObserverConfig:c,transition:l=$pe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(aF),y=rme(r,p),b=u.indexOf(o),x=(0,Q.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Q.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=Kpe({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=Hpe({id:o,data:x,attributes:{...tme,...n},disabled:y.draggable}),ee=Efe(E,j),L=!!D,R=L&&!m&&eF(f)&&eF(g),z=!_&&N,te=R?(z&&R?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,ne=eF(f)&&eF(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,re=D?.id,ie=(0,Q.useRef)({activeId:re,items:u,newIndex:ne,containerId:d}),ae=u!==ie.current.items,oe=t({active:D,containerId:d,isDragging:N,isSorting:L,id:o,index:b,items:u,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:l,wasDragging:ie.current.activeId!=null}),se=nme({disabled:!oe,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{L&&ie.current.newIndex!==ne&&(ie.current.newIndex=ne),d!==ie.current.containerId&&(ie.current.containerId=d),u!==ie.current.items&&(ie.current.items=u)},[L,ne,d,u]),(0,Q.useEffect)(()=>{if(re===ie.current.activeId)return;if(re!=null&&ie.current.activeId==null){ie.current.activeId=re;return}let e=setTimeout(()=>{ie.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:ne,items:u,isOver:T,isSorting:L,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:se??te,transition:ce()};function ce(){if(se||ae&&ie.current.newIndex===b)return eme;if(!(z&&!WN(O)||!l)&&(L||oe))return KN.Transition.toString({...l,property:sF})}}function rme(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function lF(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var ime=[wP.Down,wP.Right,wP.Up,wP.Left],uF=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(ime.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case wP.Down:r.top<a.top&&t.push(n);break;case wP.Up:r.top>a.top&&t.push(n);break;case wP.Left:r.left>a.left&&t.push(n);break;case wP.Right:r.left<a.left&&t.push(n)}});let c=Vfe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=rP(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=lP(c).some((e,t)=>s[t]!==e),i=dF(e,t),a=ame(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:UN(u,l)}}}};function dF(e,t){return!lF(e)||!lF(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ame(e,t){return!lF(e)||!lF(t)||!dF(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var fF;(function(e){e.POPPER=`popper`,e.ITEM_ALIGNED=`item-aligned`})(fF||={});var pF=Qs(B.LOW_LEVEL_SELECT,`Select`,[`Root`,`Trigger`,`Content`,`Value`,`Item`,`Group`,`Label`,`Separator`,`ScrollUpButton`,`ScrollDownButton`]),mF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=pF(e);return(0,$.jsx)(r,{...t,ref:n})});mF.displayName=`Select`;function hF({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.Root,{...t})}var gF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=pF(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});gF.displayName=`SelectTrigger`;var _F=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=pF(e);return(0,$.jsx)(r.Content,{...t,ref:n})});_F.displayName=`SelectContent`;function vF({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.Value,{...t})}var yF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=pF(e);return(0,$.jsx)(r.Item,{...t,ref:n})});yF.displayName=`SelectItem`;function ome({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.Group,{...t})}function sme({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.Label,{...t})}function cme({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.Separator,{...t})}function lme({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.ScrollUpButton,{...t})}function ume({preset:e=q.DEFAULT,...t}){let n=pF(e);return(0,$.jsx)(n.ScrollDownButton,{...t})}var bF=Qs(B.LOW_LEVEL_RADIO_GROUP,`RadioGroup`,[`Root`]),xF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bF(e);return(0,$.jsx)(r,{...t,ref:n})});xF.displayName=`RadioGroup`;function SF({preset:e=q.DEFAULT,...t}){let n=bF(e);return(0,$.jsx)(n.Root,{...t})}function CF({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_RADIO,`RadioGroupItem`)(e);return(0,$.jsx)(n,{...t})}var wF;(function(e){e.ABSENT=`absent`})(wF||={});var TF=Qs(B.LOW_LEVEL_CARD,`Card`,[`Listbox`,`Header`,`Footer`,`Title`,`Action`,`Description`,`Content`]);function EF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n,{...t})}function DF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Listbox,{...t})}function OF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Header,{...t})}function kF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Footer,{...t})}function AF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Title,{...t})}function jF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Action,{...t})}function MF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Description,{...t})}function NF({preset:e=q.DEFAULT,...t}){let n=TF(e);return(0,$.jsx)(n.Content,{...t})}var dme=Nl(B.LOW_LEVEL_SELECT_MULTIPLE,`SelectMultiple`),PF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=dme(e);return(0,$.jsx)(r,{...t,ref:n})});PF.displayName=`SelectMultiple`;function fme(e,t){let n=Q.createContext(t),r=e=>{let{children:t,...r}=e,i=Q.useMemo(()=>r,Object.values(r));return(0,$.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=Q.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function FF(e,t=[]){let n=[];function r(t,r){let i=Q.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Q.useMemo(()=>o,Object.values(o));return(0,$.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Q.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Q.createContext(e));return function(n){let r=n?.[e]||t;return Q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,pme(i,...t)]}function pme(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function IF(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var LF=globalThis?.document?Q.useLayoutEffect:()=>{},mme=Q.useInsertionEffect||LF;function RF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=hme({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=Q.useRef(e!==void 0);Q.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,Q.useCallback(t=>{if(s){let n=gme(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function hme({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),a=Q.useRef(t);return mme(()=>{a.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function gme(e){return typeof e==`function`}function zF(e){let t=Q.useRef({value:e,previous:e});return Q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function BF(e){let[t,n]=Q.useState(void 0);return LF(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}function _me(e,t){return Q.useReducer((e,n)=>t[e][n]??e,e)}var VF=e=>{let{present:t,children:n}=e,r=vme(t),i=typeof n==`function`?n({present:r.isPresent}):Q.Children.only(n),a=FE(r.ref,yme(i));return typeof n==`function`||r.isPresent?Q.cloneElement(i,{ref:a}):null};VF.displayName=`Presence`;function vme(e){let[t,n]=Q.useState(),r=Q.useRef(null),i=Q.useRef(e),a=Q.useRef(`none`),[o,s]=_me(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Q.useEffect(()=>{let e=HF(r.current);a.current=o===`mounted`?e:`none`},[o]),LF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=HF(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),LF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=HF(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=HF(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function HF(e){return e?.animationName||`none`}function yme(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var UF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=RE(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,$.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function bme(e,t){e&&wN.flushSync(()=>e.dispatchEvent(t))}var WF=`Checkbox`,[xme,Sme]=FF(WF),[Cme,GF]=xme(WF);function wme(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=RF({prop:n,defaultProp:i??!1,onChange:c,caller:WF}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useRef(!1),y=!m||!!o||!!m.closest(`form`),b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!$F(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(Cme,{scope:t,...b,children:Tme(d)?d(b):r})}var KF=`CheckboxTrigger`,qF=Q.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=GF(KF,e),h=FE(i,u),g=Q.useRef(c);return Q.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,$.jsx)(UF.button,{type:`button`,role:`checkbox`,"aria-checked":$F(c)?`mixed`:c,"aria-required":l,"data-state":eI(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:IF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:IF(n,e=>{d(e=>$F(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});qF.displayName=KF;var JF=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,$.jsx)(wme,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qF,{...d,ref:t,__scopeCheckbox:n}),e&&(0,$.jsx)(QF,{__scopeCheckbox:n})]})})});JF.displayName=WF;var YF=`CheckboxIndicator`,XF=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=GF(YF,n);return(0,$.jsx)(VF,{present:r||$F(a.checked)||a.checked===!0,children:(0,$.jsx)(UF.span,{"data-state":eI(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});XF.displayName=YF;var ZF=`CheckboxBubbleInput`,QF=Q.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=GF(ZF,e),m=FE(n,p),h=zF(a),g=BF(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=$F(a),n.call(e,!$F(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(!$F(a)&&a);return(0,$.jsx)(UF.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});QF.displayName=ZF;function Tme(e){return typeof e==`function`}function $F(e){return e===`indeterminate`}function eI(e){return $F(e)?`indeterminate`:e?`checked`:`unchecked`}var Eme=Object.freeze([]),tI=Q.forwardRef(({schema:e,name:t,disabled:n,className:r,value:i,onChange:a,onBlur:o,defaultValue:s,validationMode:c,options:l,orientation:u,columns:d,required:f,autoFocus:p},m)=>{let{tErrorValidation:h,tComponent:g,isReady:_}=K({keys:[`errors_validation`],component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_FORM_MESSAGE]}),{renderIcon:v}=Mf(),{getRecipe:y}=Wg(),b=y(cc.FORM_CONTROL,Gu.CHECKBOX),x=Ma(e),S=x?A_(x):void 0,C=u??S?.edit?.editDirection??`vertical`,w=d??S?.edit?.editColumnsCount??1,T=x?Xo(x):[],E=l??T.map(e=>({value:e,label:e})),[D,O]=Q.useState(s??[]),k=j_(i,a),A=k?i??Eme:D,j=Q.useCallback((e,t)=>{let n=t?[...A,e]:A.filter(t=>t!==e);k?a?.(n):O(n)},[A,k,a]),M=Q.useRef(null),N=Q.useCallback(e=>{M.current=e,typeof m==`function`?m(e):m&&(m.current=e)},[m]),P=Q.useRef(null),F=Q.useCallback(()=>{P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{M.current&&!M.current.contains(document.activeElement)&&o?.()},0)},[o]);Q.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);let I=t??`checkbox-group-field`;return E.length===0?l===void 0?(0,$.jsx)(`div`,{className:`text-sm text-destructive`,children:`CHECKBOX_GROUP requires an array of enum values. No enum options found.`}):_?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g(B.LOW_LEVEL_FORM_FIELD,`noResults`)}):null:_?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{ref:N,role:`group`,className:U(C===`horizontal`?`flex flex-wrap gap-field`:w>1?`grid gap-group`:`flex flex-col gap-group`,r),style:C===`vertical`&&w>1?{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`}:void 0,children:E.map(e=>{let t=A.includes(e.value),r=`${I}-${e.value}`,i=n===!0||e.disabled===!0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(JF,{id:r,checked:t,onCheckedChange:t=>j(e.value,t===!0),onBlur:F,disabled:i,"data-slot":`checkbox`,className:U(`peer size-4 shrink-0 rounded-sm outline-none`,b.base,b.states.focus,b.states.selected,b.states.disabled,b.states.invalid,b.motion.transition),children:(0,$.jsx)(XF,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:v(H.CHECK,{size:ca.SM})})}),(0,$.jsx)(`label`,{htmlFor:r,className:U(`text-sm font-normal cursor-pointer select-none`,i&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:e.label})]},e.value)})})}):null});tI.displayName=`FormFieldCheckboxGroup`;var Dme={[bs.SELECT]:!1,[bs.RADIO]:!1,[bs.RADIO_ICON_ONLY]:!0,[bs.TOGGLE]:!1,[bs.TOGGLE_ICON_ONLY]:!0,[bs.CARD]:!1,[bs.CARD_ICON_ONLY]:!0,[bs.COMBOBOX]:!1},Ome={[bs.SELECT]:Sc.VERTICAL,[bs.RADIO]:Sc.VERTICAL,[bs.RADIO_ICON_ONLY]:Sc.HORIZONTAL,[bs.TOGGLE]:Sc.HORIZONTAL,[bs.TOGGLE_ICON_ONLY]:Sc.HORIZONTAL,[bs.CARD]:Sc.VERTICAL,[bs.CARD_ICON_ONLY]:Sc.VERTICAL,[bs.COMBOBOX]:Sc.VERTICAL},kme={[$a.CHECKBOX]:!1,[$a.SELECT]:!1,[$a.TOGGLE]:!1,[$a.TOGGLE_ICON_ONLY]:!0,[$a.CARD]:!1,[$a.CARD_ICON_ONLY]:!0,[$a.COMBOBOX]:!1},Ame={[$a.CHECKBOX]:Sc.VERTICAL,[$a.SELECT]:Sc.VERTICAL,[$a.TOGGLE]:Sc.HORIZONTAL,[$a.TOGGLE_ICON_ONLY]:Sc.HORIZONTAL,[$a.CARD]:Sc.VERTICAL,[$a.CARD_ICON_ONLY]:Sc.VERTICAL,[$a.COMBOBOX]:Sc.VERTICAL},jme=2,Mme=4,nI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,options:u,placeholder:d,required:f,autoFocus:p,clearable:m,multiple:h,controlSize:g=Zd.MD},_)=>{let{renderIcon:v}=Mf(),{tComponent:y,isReady:b}=K({component:B.LOW_LEVEL_FORM_FIELD}),x=a??c,S=h===!0||Array.isArray(x),C=(S?Ma(e):void 0)??e,w=A_(C),T=$ne(C),E=cee(C),D=S?kme[E]??!1:Dme[T]??!1,O=S?Ame[E]:Ome[T],k=w?.edit?.editDirection??O??Sc.VERTICAL,A=w?.edit?.editColumnsCount??(D?Mme:jme),j=w?.values,M=w?.defaultIcon,N=!!(j&&Object.values(j).some(e=>e.icon))||!!M,P=!!(j&&Object.values(j).some(e=>e.color))||!!w?.defaultColor,F=g===Zd.SM?`sm`:`md`,I=g===Zd.SM?Y.SM:Y.MD,ee=Xo(C)??[],L=u??ee.map(e=>({value:e,label:e})),R=Q.useCallback((e,t)=>{if(typeof e==`string`)return v(e,{size:ca.SM,className:t});let n=id[ca.SM];return Q.createElement(e,{size:n,className:t})},[v]),z=Q.useCallback(e=>{if(!N)return null;let t=j?.[e]?.icon??M;return t?R(t,`shrink-0`):null},[j,M,N,R]),te=Q.useCallback(e=>{let t=z(e.value);if(D&&t!==null)return(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsxs)(`span`,{className:`inline-flex items-center justify-center`,children:[t,(0,$.jsx)(`span`,{className:`sr-only`,children:e.label})]})}),(0,$.jsx)(rj,{children:e.label})]});if(t===null){let t=j?.[e.value]?.color??w?.defaultColor;return!t||D?e.label:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U($d,qf[o_(t)])}),e.label]})}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[t,e.label]})},[D,z,j,w?.defaultColor]),ne=Q.useMemo(()=>N||D||P?te:void 0,[N,D,P,te]),[re,ie]=Q.useState(c??(S?[]:``)),ae=j_(a,o),oe=a??re,se=Q.useCallback(e=>{r||(ae?o?.(e):ie(e))},[ae,o,r]),ce=Q.useCallback(()=>{s?.()},[s]),le={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:p,controlSize:g},ue=k===Sc.HORIZONTAL?mu.HORIZONTAL:mu.VERTICAL;if(!b)return null;if(S){let t=Array.isArray(oe)?oe:oe?[oe]:[],a=Pn(e),o=a.maxLength!==void 0&&t.length>=a.maxLength,s=a.minLength!==void 0&&t.length<=a.minLength,c=a.minLength===void 0&&a.maxLength===void 0?L:L.map(e=>({...e,disabled:e.disabled===!0||(t.includes(e.value)?s:o)})),l=e=>{a.maxLength!==void 0&&e.length>a.maxLength||a.minLength!==void 0&&e.length<a.minLength&&e.length<t.length||se(e)},u=e=>{l(t.includes(e)?t.filter(t=>t!==e):[...t,e])},m=a.minLength===void 0&&a.maxLength===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-slot":`enum-multiple-bound`,children:[a.minLength!==void 0&&a.maxLength!==void 0?a.minLength===a.maxLength?y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectExactly`,{count:a.minLength}):y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectRange`,{min:a.minLength,max:a.maxLength}):a.minLength===void 0?y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectUpTo`,{count:a.maxLength}):y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectAtLeast`,{count:a.minLength}),` `,`(`,y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectedCount`,{count:t.length}),`)`]}),h=e=>m===null?e:(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-item-sm`,children:[e,m]});switch(E){case $a.CHECKBOX:return h((0,$.jsx)(tI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}));case $a.SELECT:return h((0,$.jsx)(PF,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne}));case $a.TOGGLE:case $a.TOGGLE_ICON_ONLY:return h((0,$.jsx)(bO,{ref:_,type:_O.MULTIPLE,appearance:vO.CHIPS,value:t,onValueChange:e=>l(Array.isArray(e)?e:e?[e]:[]),disabled:n||r,size:I,orientation:ue,className:i,children:c.map(e=>(0,$.jsx)(xO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:te(e)},e.value))}));case $a.CARD:case $a.CARD_ICON_ONLY:return h((0,$.jsx)(DF,{ref:_,"aria-multiselectable":!0,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:c.map(e=>{let i=t.includes(e.value),a=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(EF,{"data-option":e.value,"aria-disabled":a?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,a&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{a||u(e.value)}},selected:i,...a?{tabIndex:-1}:{},children:te(e)},e.value)})}));case $a.COMBOBOX:return h((0,$.jsx)(yx,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,showSelectAll:!0,emptyMessage:y(B.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0}));default:return h((0,$.jsx)(tI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}))}}switch(T){case bs.SELECT:return(0,$.jsx)(mF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne});case bs.RADIO:case bs.RADIO_ICON_ONLY:return(0,$.jsx)(xF,{ref:_,...le,options:L,value:oe,onValueChange:se,onBlur:ce,orientation:ue,renderOptionLabel:te});case bs.TOGGLE:case bs.TOGGLE_ICON_ONLY:return(0,$.jsx)(bO,{ref:_,type:_O.SINGLE,value:oe,onValueChange:e=>{(e||m)&&se(e)},disabled:n||r,size:I,orientation:ue,className:i,children:L.map(e=>(0,$.jsx)(xO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:te(e)},e.value))});case bs.CARD:case bs.CARD_ICON_ONLY:return(0,$.jsx)(DF,{ref:_,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:L.map(e=>{let t=oe===e.value,i=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(EF,{"data-option":e.value,"aria-disabled":i?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,i&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{i||se(e.value)}},selected:t,...i?{tabIndex:-1}:{},children:te(e)},e.value)})});case bs.COMBOBOX:return(0,$.jsx)(vx,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,emptyMessage:y(B.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0,renderSelectedValue:ne});default:return(0,$.jsx)(mF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g})}}),rI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_ENUM,`FormFieldEnum`)(e);return(0,$.jsx)(r,{...t,ref:n})});rI.displayName=`FormFieldEnum`;var iI=`file-validation`,Nme=/received (undefined|null)\b/i,Pme=/expected .+, received (undefined|null)/i;function aI(e){return Nme.test(e)||Pme.test(e)}function oI(e,t,n,r){if(!(e.error?.type===`server`||e.error?.type===`server-unique`||e.isTouched||t||(n===ta.ON_CHANGE||n===ta.ON_TOUCHED)&&e.isDirty)||!e.error)return;if(aI(e.error.message||``))return r(`required`,`msg`);let i=e.error.type;if(i===`too_small`&&e.error.params?.origin===`string`&&e.error.params?.minimum===1)return r(`required`,`msg`);if(!i||i.trim()===``)return e.error.message?e.error.message:r(`custom`,`msg`);if(i===`file-validation`||i===`server-unique`)return e.error.message||r(`custom`,`msg`);let a=r(i,`msg`,{...e.error.params??{},...e.error.message?{message:e.error.message}:{}});return a===`errors_validation.${i}.msg`||a.includes(`..`)?e.error.message?e.error.message:r(`custom`,`msg`):a}function sI({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CHIPS_INPUT,`ChipsInput`)(e);return(0,$.jsx)(n,{...t})}sI.displayName=`ChipsInput`;var cI=(0,Q.createContext)(!0);function lI(e){let{setValue:t}=GC(),n=VC({name:e}),r=EE(),i=(0,Q.useContext)(cI)?r:null;return{value:n,setValue:(0,Q.useCallback)(n=>{t(e,n,{shouldDirty:!0,shouldTouch:!0}),i?.triggerSave(e,n,ou.DEBOUNCE)},[t,e,i])}}function uI(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var Fme={activationConstraint:{distance:8}},Ime={coordinateGetter:uF};function dI({listeners:e,attributes:t,disabled:n,ariaLabel:r,renderIcon:i}){return(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:text-muted-foreground hover:bg-accent/50`,Rg(d_.OFFSET),`active:cursor-grabbing`,n&&`pointer-events-none opacity-0`),"aria-label":r,tabIndex:n?-1:0,...t,...e,children:i(H.GRIP_VERTICAL,{size:ca.SM})})}function Lme({id:e,fieldName:t,fieldLabel:n,itemSchema:r,disabled:i,canRemove:a,isValidating:o,reorderable:s,showUpDownIcons:c,isFirst:l,isLast:u,dragHandleAriaLabel:d,moveUpAriaLabel:f,moveDownAriaLabel:p,removeAriaLabel:m,renderField:h,onRemove:g,onMoveUp:_,onMoveDown:v,index:y,renderIcon:b}){let{attributes:x,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=cF({id:e,disabled:!s||i}),D={transform:uI(w),transition:T,opacity:E?.5:void 0,zIndex:E?10:void 0,position:`relative`};return(0,$.jsxs)(`div`,{ref:C,style:D,className:`flex items-end gap-element`,children:[s&&(0,$.jsx)(dI,{listeners:S,attributes:x,disabled:i,ariaLabel:d,renderIcon:b}),c&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5 mb-element`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>_(y),disabled:i||o||l,className:`h-5 w-5`,"aria-label":f,children:b(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(y),disabled:i||o||u,className:`h-5 w-5`,"aria-label":p,children:b(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:h?h(t,r):(0,$.jsx)(XL,{name:t,schema:r,label:n,disabled:i})}),a&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>g(y),disabled:i||o,className:`shrink-0 mb-element`,"aria-label":m,children:b(H.DELETE,{size:ca.SM})})]})}var fI=`w-12`,pI=`opacity-0 transition-opacity duration-[var(--motion-duration-fast)] group-hover/array-row:opacity-100 group-focus-within/array-row:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100`;function mI({fieldName:e,itemSchema:t,primaryFieldName:n,disabled:r,only:i}){let a=zT(),o=F(t),s=qr(t);if(!o||s.length===0)return null;if(cd(t))return i===`boolean`?null:(0,$.jsx)($w,{formChromeMode:Wc.COMPACT,sectionChromeMode:void 0,children:(0,$.jsx)(XL,{name:e,schema:t,labelPlacement:`hidden`,disabled:r,className:`min-w-0 flex-1`})});let c=s.filter(e=>me(o[e])===vu.BOOLEAN),l=s.filter(e=>me(o[e])!==vu.BOOLEAN),u=i===`boolean`?c:i===`body`?l:[...c,...l];return(0,$.jsx)($w,{formChromeMode:Wc.COMPACT,sectionChromeMode:void 0,children:u.map(t=>{let i=`${e}.${t}`,s=a?.fieldLabels?.[hr.labelDictionaryPath(i)]??hr.unresolvedFieldLabel(t);return(0,$.jsx)(XL,{name:i,schema:o[t],label:s,labelPlacement:`hidden`,disabled:r,className:U(`w-auto`,t===n?`min-w-0 flex-1`:`shrink-0`)},t)})})}function Rme({id:e,fieldName:t,fieldLabel:n,layout:r,primaryFieldName:i,itemSchema:a,disabled:o,canRemove:s,isValidating:c,reorderable:l,showUpDownIcons:u,isFirst:d,isLast:f,dragHandleAriaLabel:p,moveUpAriaLabel:m,moveDownAriaLabel:h,removeAriaLabel:g,renderField:_,onRemove:v,onMoveUp:y,onMoveDown:b,index:x,renderIcon:S}){let{attributes:C,listeners:w,setNodeRef:T,transform:E,transition:D,isDragging:O}=cF({id:e,disabled:!l||o}),k={transform:uI(E),transition:D,opacity:O?.5:void 0,zIndex:O?10:void 0,position:`relative`},A=VC({name:i?`${t}.${i}`:t}),j=typeof A==`string`&&A.trim()!==``?A.trim():typeof A==`number`?String(A):n;return r===es.ROW?(0,$.jsxs)(`div`,{ref:T,style:k,className:`group/array-row relative flex items-center gap-element`,children:[l&&!u&&(0,$.jsx)(`div`,{className:U(`absolute -left-5 top-1/2 -translate-y-1/2`,pI),children:(0,$.jsx)(dI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S})}),u&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:ca.XS})})]}),!_&&(0,$.jsx)(`div`,{className:U(`flex shrink-0 items-center`,fI),children:(0,$.jsx)(mI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`boolean`})}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-element`,children:_?_(t,a):(0,$.jsx)(mI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`body`})}),s&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(x),disabled:o||c,className:U(`shrink-0`,pI),"aria-label":g,children:S(H.DELETE,{size:ca.SM})})]}):(0,$.jsxs)(`div`,{ref:T,style:k,className:`relative mt-3 rounded-lg border border-border p-card`,children:[(0,$.jsxs)(`div`,{className:`absolute -top-3 start-card-sm z-10 flex max-w-[calc(100%-4.5rem)] items-center gap-1 overflow-hidden bg-background px-card-sm text-sm font-medium text-muted-foreground`,children:[l&&(0,$.jsx)(dI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S}),u&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),s&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(x),disabled:o||c,className:`absolute -top-3 end-3 z-10 h-6 w-6 bg-background`,"aria-label":g,children:S(H.CLOSE,{size:ca.SM})}),(0,$.jsx)(`div`,{className:`pt-item`,children:_?_(t,a):(0,$.jsx)(XL,{name:t,schema:a,label:n,hideLabel:!0,disabled:o})})]})}function zme({primaryField:e,itemSchema:t,onAdd:n,disabled:r,addLabel:i,placeholder:a,leadingGutterClassName:o}){let{renderIcon:s}=Mf(),{resolvedRegionalPreferences:c}=K(),l=c?.timezone,u=me(e.schema)===vu.NUMBER,[d,f]=(0,Q.useState)(``),p=d.trim(),m=u?Number(p):p,h=!r&&p!==``&&e.schema.safeParse(m).success,g=(0,Q.useCallback)(()=>{if(r)return;let i=d.trim();if(i===``)return;let a=u?Number(i):i;e.schema.safeParse(a).success&&(n(e.name===null?a:{...hr.getDefaultValueForSchema(t,{timeZone:l}),[e.name]:a}),f(``))},[r,d,u,e,t,n,l]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,"data-testid":`array-quick-add-row`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},children:[o&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`shrink-0`,o)}),(0,$.jsx)(QM,{type:u?`number`:`text`,value:d,onChange:e=>f(e.target.value),placeholder:a??i,disabled:r,wrapperClassName:`flex-1`,"aria-label":i}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:g,disabled:!h,"aria-label":i,children:s(H.PLUS,{size:ca.SM})})]})}function Bme({name:e,schema:t,label:n,description:r,disabled:i,className:a,renderField:o,addLabel:c,itemLabel:l,reorderable:u=!0,sectionAppearance:d,chromeMode:f,hideLabel:p=!1,objectItemLayout:m,enumLabels:h,allowedValues:g}){let{control:_,getFieldState:v,getValues:b,formState:x,trigger:S}=GC(),C=LM(e),{renderIcon:w}=Mf(),{tComponent:T,tErrorValidation:E,isReady:D,resolvedRegionalPreferences:O}=K({component:B.LOW_LEVEL_FORM_MESSAGE,keys:[`errors_validation`]}),k=O?.timezone,{getRecipe:A}=Wg(),j=A(cc.TYPOGRAPHY,y.DESCRIPTION),{formChromeMode:M,sectionChromeMode:N}=eT(),P=hc(),F=Xc(t),I=F?.chromeMode??f??N??M??UL(P.autoRender?.autoFieldChrome),ee=WL(P.autoRender?.autoLabelPlacement),L=GL(P.autoRender?.autoFieldDensity),R=P.autoRender?.autoErrorPlacement===`summary-at-surface-top`,z=EE(),te=(0,Q.useContext)(cI)?z:null,ne=te?t=>te.triggerSave(e,t,ou.BLUR):void 0,re=c??T(B.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),ie=l??T(B.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`),ae=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayEmptyMessage`),oe=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(oe.current=!0,()=>{oe.current=!1}),[]);let[se,ce]=(0,Q.useState)(!1),{fields:le,append:ue,remove:de,move:fe}=Pw({control:_,name:e}),pe=Ma(t),he=Pn(t),ge=pe?me(pe):`unknown`,_e=g!==void 0&&ge===vu.STRING,ve=ge===vu.ENUM||_e,ye=va(t)?.edit,be=m??va(t)?.objectItemLayout??es.CARD,xe=ye?.isSortable,Se=xe==null||!!xe&&ye?.dnd!==!1,Ce=xe?ye?.upDownIcons??!1:!1,we=u&&Se&&!i&&le.length>1,Te=QN(ZN(AP,Fme),ZN(EP,Ime)),Ee=(0,Q.useMemo)(()=>le.map(e=>e.id),[le]),De=he.maxLength===void 0||le.length<he.maxLength,Oe=he.minLength===void 0||le.length>he.minLength,ke=(0,Q.useCallback)(()=>{ce(!0),setTimeout(async()=>{if(oe.current&&(await S(e),oe.current&&(ce(!1),te))){let t=b(e);te.triggerSave(e,t,ou.DEBOUNCE)}},0)},[S,e,te,b]),Ae=(0,Q.useCallback)(()=>{if(!De||i||se)return;let e=hr.getDefaultValueForSchema(pe,{timeZone:k});ue(e),ke()},[De,i,se,pe,ue,ke,k]),je=(0,Q.useCallback)(e=>{!De||i||se||(ue(e),ke())},[De,i,se,ue,ke]),Me=(0,Q.useCallback)(e=>{!Oe||i||se||(de(e),ke())},[Oe,i,se,de,ke]),Ne=(0,Q.useCallback)(e=>{e>0&&!i&&!se&&(fe(e,e-1),ke())},[fe,i,se,ke]),Pe=(0,Q.useCallback)(e=>{e<le.length-1&&!i&&!se&&(fe(e,e+1),ke())},[le.length,fe,i,se,ke]),Fe=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=le.findIndex(e=>e.id===t.id),r=le.findIndex(e=>e.id===n.id);e!==-1&&r!==-1&&(fe(e,r),ke())}},[le,fe,ke]);if(!pe||!D)return null;if(ve){let o=F?.validationMode??ta.ON_BLUR,s=!_e&&g!==void 0?Xo(pe).filter(e=>g.includes(e)):void 0,c=_e?g.map(e=>({value:e,label:h?.[e]??e})):s?s.map(e=>({value:e,label:h?.[e]??e})):h?Xo(pe).map(e=>({value:e,label:h[e]??e})):void 0;return(0,$.jsx)(UC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:l})=>(0,$.jsx)(GM,{mode:I,label:n,description:r,error:oI(l,x.isSubmitted,o,E),labelPlacement:ee,hideError:R,saveState:te?.getFieldState(e),saveErrorMessage:te?.getFieldStateInfo(e).lastError,onRetrySave:te?()=>te.retryFieldSave(e):void 0,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(rI,{multiple:!0,schema:t,options:c,name:e,disabled:i,value:Array.isArray(s.value)?s.value:[],onChange:t=>{C.noteInputReceived(),s.onChange(t),te?.triggerSave(e,t,ou.DEBOUNCE)},onBlur:()=>{C.handleFieldBlur(s.onBlur)},controlSize:L})})})}if(ge===vu.STRING&&va(t)?.display?.listStyle===s.CHIPS){let t=F?.validationMode??ta.ON_BLUR,o=e=>{let n=pe.safeParse(e);if(n.success)return;let r=n.error.issues[0];return oI({isTouched:!0,error:{type:r?.code??`custom`,message:r?.message,params:r?_T(r):void 0}},!0,t,E)};return(0,$.jsx)(UC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:c})=>(0,$.jsx)(GM,{mode:I,label:n,description:r,error:oI(c,x.isSubmitted,t,E),labelPlacement:ee,hideError:R,saveState:te?.getFieldState(e),saveErrorMessage:te?.getFieldStateInfo(e).lastError,onRetrySave:te?()=>te.retryFieldSave(e):void 0,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(sI,{id:`field-${e}`,value:Array.isArray(s.value)?s.value.filter(e=>typeof e==`string`):[],onChange:t=>{C.noteInputReceived(),s.onChange(t),te?.triggerSave(e,t,ou.DEBOUNCE)},onBlur:()=>{C.handleFieldBlur(s.onBlur)},validateItem:o,maxItems:he.maxLength,disabled:i,invalid:!!c.error,controlSize:L})})})}let Ie=te?.getFieldStateInfo(e),Le=te&&Ie&&Ie.state!==rT.IDLE?(0,$.jsx)(VM,{state:Ie.state,errorMessage:Ie.lastError,onRetry:()=>te.retryFieldSave(e),position:`inline`,size:`sm`,className:`ms-element align-middle`}):null,Re=v(e,x),ze=Re.error?.root?.message||Re.error?.message,Be=!(!ze||R),Ve=hr.resolveArrayAddMode(t,pe),He=hr.getArrayItemPrimaryField(pe),Ue=Ve===Gee.QUICK_ADD?He:null,We=ge!==`object`&&ge!==`array`,Ge=(0,$.jsxs)($.Fragment,{children:[Be&&(0,$.jsx)(`p`,{id:`${e}-error`,className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:ze}),(0,$.jsxs)(kT,{className:U(be===es.ROW?void 0:`space-y-field`),style:be===es.ROW?{rowGap:`var(--spacing-element)`}:void 0,children:[(0,$.jsx)(ZP,{sensors:Te,collisionDetection:aP,onDragEnd:Fe,children:(0,$.jsx)(oF,{items:Ee,strategy:rF,children:le.map((t,n)=>{let r=`${e}.${n}`,a=`${ie} ${n+1}`,s=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayDragHandle`,{label:a}),c=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayMoveUp`,{label:a}),l=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayMoveDown`,{label:a}),u=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:a});return We?(0,$.jsx)(Lme,{id:t.id,fieldName:r,fieldLabel:a,itemSchema:pe,disabled:i,canRemove:Oe,isValidating:se,reorderable:we,showUpDownIcons:Ce,isFirst:n===0,isLast:n===le.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:Me,onMoveUp:Ne,onMoveDown:Pe,index:n,renderIcon:w},t.id):(0,$.jsx)(Rme,{id:t.id,fieldName:r,fieldLabel:a,layout:be,primaryFieldName:He.name,itemSchema:pe,disabled:i,canRemove:Oe,isValidating:se,reorderable:we,showUpDownIcons:Ce,isFirst:n===0,isLast:n===le.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:Me,onMoveUp:Ne,onMoveDown:Pe,index:n,renderIcon:w},t.id)})})}),De&&Ue?(0,$.jsx)(zme,{primaryField:Ue,itemSchema:pe,onAdd:je,disabled:i||se,addLabel:re,leadingGutterClassName:be===es.ROW&&!We?o?`w-7`:fI:void 0}):De?(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,onClick:Ae,disabled:i||se,className:`w-full`,children:[w(H.PLUS,{size:ca.SM,className:`me-element`}),re]}):null,le.length===0&&(i||!De)&&(0,$.jsx)(`p`,{className:U(j.base,`text-center py-card`),children:ae})]})]});if(I===Wc.SETTINGS_ROW&&d===void 0)return(0,$.jsx)(GM,{mode:Wc.SETTINGS_ROW,label:n,description:r,labelPlacement:ee,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,error:ze,hideError:!0,hideLabel:p,wideControl:!0,children:(0,$.jsxs)(`div`,{id:`field-${e}`,role:`group`,"aria-labelledby":n&&!p?`field-${e}-label`:void 0,"aria-label":n&&p?n:void 0,className:`flex flex-col`,style:{rowGap:`var(--spacing-element)`},"data-testid":`field-array-${e}`,"aria-describedby":Be?`${e}-error`:void 0,children:[Le,Ge]})});let Ke=!p&&(d===cr.CARD||d===cr.COLLAPSIBLE),qe=d!==cr.COLLAPSIBLE;return(0,$.jsxs)(OT,{appearance:d??cr.GHOST,legend:Ke?(0,$.jsxs)($.Fragment,{children:[n,qe&&Le]}):void 0,description:Ke?r:void 0,disabled:i,className:U(a,ze&&`border-destructive`),"data-field":e,"data-testid":`field-array-${e}`,"aria-invalid":!!ze,"aria-describedby":Be?`${e}-error`:void 0,children:[Ke?!qe&&Le:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(SD,{children:(0,$.jsx)(AT,{className:`sr-only`,children:n})}),Le]}):(0,$.jsx)(SD,{children:(0,$.jsxs)(AT,{children:[n,Le]})}),!Ke&&r&&!p&&(0,$.jsx)(gx,{children:r}),(0,$.jsx)(AE,{fieldName:e,label:n,disabled:i,onSaveFieldNow:ne,children:Ge})]})}function hI(e){let t=EE(),n=t!==null&&OE(Xc(e.schema)?.autosave,t.config.defaultTrigger,!0)!==ou.NONE;return(0,$.jsx)(cI.Provider,{value:n,children:(0,$.jsx)(Bme,{...e})})}hI.displayName=`AutomatedArrayField`;var gI=hI,_I=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldEdit_ResourceReference`,Ii.EDIT)(e);return(0,$.jsx)(r,{...t,ref:n})});_I.displayName=`ResourceFieldEdit_ResourceReference`;function Vme(e,t){let n=e?.resourceReferenceTargets;if(n)return n[t]??[]}function Hme(e,t){if(t)return e?.resourceType===t?e:{resourceType:t}}function Ume(e,t){return e?.resourceType?t?{resourceType:e.resourceType,resourceId:t}:{resourceType:e.resourceType}:e}function Wme(e,t,n){let r=e.map(e=>({value:e,label:n(e)}));return t&&!e.includes(t)&&r.unshift({value:t,label:n(t)}),r}var Gme=[ai.RESOURCES];function vI(e,t){return F(lr(e))?.[t]??e}var yI=Q.forwardRef(({types:e,value:t,onChange:n,schema:r,name:i,...a},o)=>{let{tComponent:s,tResourceHeader:c}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,keys:Gme}),l=Q.useMemo(()=>Wme(e,t?.resourceType,e=>c(e,`title`)),[e,t?.resourceType,c]);return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-element`,children:[(0,$.jsx)(mF,{ref:o,...a,schema:vI(r,`resourceType`),name:`${i}.resourceType`,options:l,value:t?.resourceType||void 0,onChange:e=>n?.(Hme(t,e)),placeholder:s(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,l.length>0?`selectTypePlaceholder`:`noTypesAvailable`)}),t?.resourceType?(0,$.jsx)(_I,{...a,schema:vI(r,`resourceId`),name:`${i}.resourceId`,targetResourceType:t.resourceType,value:t.resourceId,onChange:e=>n?.(Ume(t,Array.isArray(e)?e[0]:e))}):null]})});yI.displayName=`FormFieldResourceReference`;var bI=Qs(B.LOW_LEVEL_SWITCH,`Switch`,[`Root`]),xI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bI(e);return(0,$.jsx)(r,{...t,ref:n})});xI.displayName=`Switch`;var SI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});SI.displayName=`SwitchRoot`;var CI=Qs(B.LOW_LEVEL_CHECKBOX,`Checkbox`,[`Root`]),wI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=CI(e);return(0,$.jsx)(r,{...t,ref:n})});wI.displayName=`Checkbox`;var TI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=CI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});TI.displayName=`CheckboxRoot`;var EI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_TOGGLE_GROUP_BOOLEAN,`ToggleGroupBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});EI.displayName=`ToggleGroupBoolean`;var DI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,checked:a,onCheckedChange:o,onBlur:s,defaultChecked:c,validationMode:l,autoFocus:u,controlSize:d},f)=>{let{tComponent:p,isReady:m}=K({component:B.LOW_LEVEL_FORM_FIELD_BOOLEAN}),h=Bne(e),g=Br(e),_=h?.labellingValue??`yes/no`,[v,y]=Q.useState(c??!1),b=j_(a,o),x=a??v,S=Q.useCallback(e=>{r||(b?o?.(e):y(e))},[b,o,r]),C=Q.useCallback(()=>{s?.()},[s]),w={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:u,controlSize:d},T=typeof _==`object`&&!!_&&_.mode===`custom`,[E,D]=T?[void 0,void 0]:_.split(`/`),O=()=>T?_.trueValue:p(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,E),k=()=>T?_.falseValue:p(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,D);if(!m)return null;switch(g){case tc.TOGGLE:return(0,$.jsx)(EI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case tc.SWITCH:return(0,$.jsx)(xI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case tc.CHECKBOX:return(0,$.jsx)(wI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case tc.RADIO:let e=[{value:`true`,label:O()},{value:`false`,label:k()}];return(0,$.jsx)(xF,{ref:f,...w,options:e,value:x?`true`:`false`,onValueChange:e=>S(e===`true`),onBlur:C});default:return(0,$.jsx)(xI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C})}}),OI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,`FormFieldBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});OI.displayName=`FormFieldBoolean`;var kI=Qs(B.LOW_LEVEL_TEXTAREA,`Textarea`,[`Root`]),AI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=kI(e);return(0,$.jsx)(r,{...t,ref:n})});AI.displayName=`Textarea`;var jI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=kI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});jI.displayName=`TextareaRoot`;function MI({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_MARKDOWN_EDITOR,`MarkdownEditor`)(e);return(0,$.jsx)(n,{...t})}MI.displayName=`MarkdownEditor`;var NI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_COLOR_INPUT,`ColorInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});NI.displayName=`ColorInput`;var PI=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,disabled:i,readOnly:a,className:o,autoFocus:s,controlSize:c=Zd.MD,clearable:l,labelledBy:u,controlId:d,monthPlaceholder:f},p)=>{let{tComponent:m,resolvedRegionalPreferences:h}=K({component:B.LOW_LEVEL_FORM_FIELD_STRING}),g=Pt(t),[_,v]=Q.useState(g?.month),[y,b]=Q.useState(String(g?g.year:new Date().getUTCFullYear()));Q.useEffect(()=>{let e=Pt(t);e?(v(e.month),b(String(e.year))):(t===void 0||t===``)&&(v(void 0),b(String(new Date().getUTCFullYear())))},[t]);let x=Q.useRef(null),S=Q.useCallback(e=>{x.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),C=Q.useMemo(()=>jl.monthNames(h),[h]),w=(e,r)=>{if(e===void 0||!/^\d{4}$/.test(r))return;let i=qi(Number(r),e);i!==t&&n?.(i)},T=()=>{let e=Pt(t);e&&!/^\d{4}$/.test(y)&&b(String(e.year)),r?.()},E=i||a,D=l===!0&&Pt(t)!==void 0;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,o),role:`group`,"aria-labelledby":u??`field-${e}-label`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(hF,{value:_===void 0?``:String(_),onValueChange:e=>{let t=Number(e);v(t),w(t,y)},onOpenChange:e=>{e||r?.()},disabled:E,name:`${e}.month`,children:[(0,$.jsx)(gF,{ref:S,id:d??`field-${e}`,size:c,className:`w-full`,"aria-label":m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonth`),autoFocus:s,children:(0,$.jsx)(vF,{placeholder:f??m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonthPlaceholder`)})}),(0,$.jsx)(_F,{children:C.map((e,t)=>(0,$.jsx)(yF,{value:String(t+1),textValue:e,children:e},t+1))})]})}),(0,$.jsx)(`div`,{className:`w-28 shrink-0`,children:(0,$.jsx)(QM,{type:`number`,inputMode:`numeric`,min:1,max:9999,step:1,name:`${e}.year`,controlSize:c,"aria-label":m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthYear`),value:y,disabled:i,readOnly:a,onChange:e=>{let t=e.target.value;b(t),w(_,t)},onBlur:T})}),D&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:c===Zd.SM?Y.SM:Y.MD,disabled:E,onClick:()=>{n?.(``),x.current?.focus()},children:m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthClear`)})]})});PI.displayName=`YearMonthInput`;var FI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_PASSWORD_INPUT,`PasswordInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});FI.displayName=`PasswordInput`;var II=Qs(B.LOW_LEVEL_INPUT_OTP,`InputOTP`,[`Group`,`Slot`,`Separator`]),LI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=II(e);return(0,$.jsx)(r,{...t,ref:n})});LI.displayName=`InputOTP`;function RI({preset:e=q.DEFAULT,...t}){let n=II(e);return(0,$.jsx)(n.Group,{...t})}function zI({preset:e=q.DEFAULT,...t}){let n=II(e);return(0,$.jsx)(n.Slot,{...t})}function Kme({preset:e=q.DEFAULT,...t}){let n=II(e);return(0,$.jsx)(n.Separator,{...t})}function qme(e,t){let n=e?.organizationRoles;if(!n||n.length===0)return;let r=e?.organizationTypes;return!t||!r?n:n.filter(e=>Do(r,t,e))}function Jme(e,t,n){let r=e.map(e=>({value:e,label:n(e)}));return t&&!e.includes(t)&&r.unshift({value:t,label:n(t)}),r}var Yme=[ai.ROLES],BI=Q.forwardRef(({roles:e,value:t,onChange:n,clearable:r,...i},a)=>{let{tComponent:o,tRole:s}=K({component:B.LOW_LEVEL_FORM_FIELD_STRING,keys:Yme}),c=Q.useMemo(()=>Jme(e,t,e=>s(e,`label`)),[e,t,s]),l=(0,$.jsx)(mF,{ref:a,...i,options:c,value:t||void 0,onChange:e=>n?.(e),placeholder:o(B.LOW_LEVEL_FORM_FIELD_STRING,`organizationRolePlaceholder`)});return!r||!t?l:(0,$.jsxs)(`span`,{className:`flex items-center gap-element`,children:[l,(0,$.jsx)(X,{type:`button`,variant:J.GHOST,disabled:i.disabled||i.readOnly,onClick:()=>n?.(``),children:o(B.LOW_LEVEL_FORM_FIELD_STRING,`organizationRoleClear`)})]})});BI.displayName=`FormFieldStringOrganizationRole`;function Xme(){let{appConfig:e}=Ou(),{organizations:t,currentOrganizationId:n}=pg(),r=t.find(e=>e._id===n)?.type;return qme(e,r)}function Zme(e){if(e.roleTable===yr.ANOTHER_ORGANIZATION)return e.offeredRoles;if(e.table)return e.offeredRoles?e.table.filter(t=>e.offeredRoles.includes(t)):e.table}var VI=Q.forwardRef(({fallback:e,roleTable:t=yr.CURRENT_ORGANIZATION,offeredRoles:n,...r},i)=>{let a=Zme({table:Xme(),roleTable:t,offeredRoles:n});return a?(0,$.jsx)(BI,{ref:i,roles:a,...r}):(0,$.jsx)($.Fragment,{children:e})});VI.displayName=`FormFieldStringOrganizationRoleOrFallback`;var HI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,autoComplete:d,autoFocus:f,controlSize:p=Zd.MD,type:m,clearable:h,offeredValues:g},_)=>{let v=m??`text`,y=qt(e);Pte(e);let b=xt(e),x=y?.edit?.textareaRows??4,[S,C]=Q.useState(c??``),w=j_(a,o),T=a??S,E=Q.useCallback(e=>{w?o?.(e):C(e)},[w,o]),D=Q.useCallback(()=>{s?.()},[s]),O={schema:e,name:t,disabled:n,readOnly:r,className:i,validationMode:l,autoFocus:f,controlSize:p};switch(b){case z.INPUT:return(0,$.jsx)(ZM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});case z.TEXTAREA:return(0,$.jsx)(AI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,rows:x,autoComplete:d});case z.MARKDOWN:return(0,$.jsx)(MI,{value:T,onChange:E,onBlur:D,placeholder:u,disabled:n,readOnly:r,autoFocus:f,minRows:x,ariaLabel:t,className:i});case z.COLOR:return(0,$.jsx)(NI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u});case z.YEAR_MONTH:return(0,$.jsx)(PI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h});case z.PASSWORD:return(0,$.jsx)(FI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d});case z.OTP:{let r=vee(e)?.maxLength??6;return(0,$.jsx)(LI,{ref:_,name:t,className:i,maxLength:r,value:T,onChange:E,onBlur:D,disabled:n,autoComplete:d,autoFocus:f,controlSize:p,children:(0,$.jsx)(RI,{children:Array.from({length:r},(e,t)=>(0,$.jsx)(zI,{index:t},t))})})}case z.ORGANIZATION_ROLE:{let e=(0,$.jsx)(ZM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});return(0,$.jsx)(VI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h,fallback:e,roleTable:y?.edit?.organizationRoleTable??yr.CURRENT_ORGANIZATION,...g?{offeredRoles:g}:{}})}default:return(0,$.jsx)(ZM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v})}}),UI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_STRING,`FormFieldString`)(e);return(0,$.jsx)(r,{...t,ref:n})});UI.displayName=`FormFieldString`;var WI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,step:d,min:f,max:p,autoFocus:m,clearable:h,controlSize:g=Zd.MD},_)=>{let{renderIcon:v}=Mf(),y=g===Zd.SM?Y.ICON_SM:Y.ICON;Ze(e);let b=Qr(e),x=gt(e),S=f??x.min,C=p??x.max,w=d??x.step??1,[T,E]=Q.useState(c??0),D=j_(a,o),O=a??T,k=D&&a==null?``:O,A=Q.useCallback(e=>{D?o?.(e):E(e)},[D,o]),j=Q.useCallback(()=>{s?.()},[s]),M=()=>{let e=O+w;(C===void 0||e<=C)&&A(e)},N=()=>{let e=O-w;(S===void 0||e>=S)&&A(e)},P={schema:e,name:t,disabled:n,readOnly:r,className:i,validationMode:l,autoFocus:m,controlSize:g};switch(b){case sc.INPUT:return(0,$.jsx)(ZM,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C});case sc.SLIDER:return(0,$.jsx)(qM,{ref:_,...P,value:[O],onValueChange:e=>A(e[0]),onBlur:j,min:S??0,max:C??100,step:w,showValue:!0});case sc.STEPPER:let e=t??`stepper-field`;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:y,onClick:N,disabled:n||S!==void 0&&O<=S,children:v(H.MINUS,{size:ca.SM})}),(0,$.jsx)(QM,{ref:_,id:e,type:`number`,value:k,onChange:e=>{let t=e.target.value;if(t===``)A(h?``:S??0);else{let e=parseFloat(t);isNaN(e)||A(e)}},onBlur:j,disabled:n,readOnly:r,min:S,max:C,step:w,className:`w-20 text-center`,autoFocus:m,controlSize:g}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:y,onClick:M,disabled:n||C!==void 0&&O>=C,children:v(H.PLUS,{size:ca.SM})})]});default:return(0,$.jsx)(ZM,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C})}}),GI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_NUMBER,`FormFieldNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});GI.displayName=`FormFieldNumber`;var KI=Q.forwardRef(({controlSize:e,className:t,wrapperClassName:n,children:r,disabled:i,...a},o)=>{let{getRecipe:s,fieldVariant:c}=Wg(),{renderIcon:l}=Mf(),u=s(cc.FORM_CONTROL,Hg(c));return(0,$.jsxs)(`div`,{"data-slot":`native-select`,className:U(`relative flex`,n),children:[(0,$.jsx)(`select`,{ref:o,disabled:i,"data-size":e,className:U(`w-full cursor-pointer rounded-md bg-transparent text-sm disabled:cursor-default`,u.base,u.states.focus,u.states.disabled,e?u.sizes?.[e]:void 0,u.motion.transition,`appearance-none pe-8`,t),...a,children:r}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 end-0 flex items-center pe-3 text-muted-foreground`,children:l(H.CHEVRON_DOWN,{size:ca.SM,className:`opacity-[var(--opacity-muted)]`})})]})});KI.displayName=`ThemedNativeSelect`;function Qme(e,t,n){return fe(e,t).map(e=>{let t=Ba[e],r=n(e);return{value:e,label:`${t.symbol} ${r}`}}).sort((e,t)=>{let n=Ba[e.value],r=Ba[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var qI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,required:d,autoFocus:f,clearable:p,controlSize:m=Zd.MD},h)=>{let{tSystemEnum:g,tComponent:_,isReady:v}=K({component:B.LOW_LEVEL_FORM_FIELD_MONEY,keys:[`system_enums`]}),{getRecipe:y,fieldVariant:b}=Wg(),x=y(cc.FORM_CONTROL,Hg(b)),S=Q.useCallback(e=>g(Go.AVAILABLE_CURRENCY,e),[g]),C=Me(e),w=C?.currenciesAllowed,T=C?.appEnabledOnly??!0,E=C?.allowCurrencyChange??!0,D=Q.useMemo(()=>Qme(w,T,S),[w,T,S]),O=Q.useCallback(e=>Za(e)?.decimals??2,[]),k=Q.useCallback(()=>uae(e),[e]),[A,j]=Q.useState(c??k()),M=j_(a,o),N=a??A,P=Q.useMemo(()=>N.amount===0n?``:Qt(N.amount,N.decimals).toFixed(N.decimals),[N.amount,N.decimals]),F=Q.useCallback(e=>{let t=e.target.value;if(!t||t===``){if(M&&p){o?.(void 0);return}let e={...N,amount:0n};M?o?.(e):j(e);return}let n=Ji(t,N.decimals);if(n===null)return;let r={...N,amount:n};M?o?.(r):j(r)},[N,M,o,p]),I=Q.useCallback(e=>{let t=O(e),n={amount:te(N.amount,N.decimals,t),currency:e,decimals:t};M?o?.(n):j(n)},[N,M,o,O]),ee=Q.useCallback(()=>{s?.()},[s]),L=`field-${t}`,R=Za(N.currency)?.symbol??N.currency;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(QM,{ref:h,id:L,type:`number`,step:10**-N.decimals,min:C?.minAmount===void 0?void 0:Qt(C.minAmount,N.decimals),max:C?.maxAmount===void 0?void 0:Qt(C.maxAmount,N.decimals),value:P,onChange:F,onBlur:ee,disabled:n,readOnly:r,placeholder:u??`0.00`,prefix:R,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:f,controlSize:m}),E?(0,$.jsx)(KI,{value:N.currency,onChange:e=>I(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-32`,"aria-label":_(B.LOW_LEVEL_FORM_FIELD_MONEY,`currency`),children:D.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,x.sizes?.[m]),children:S(N.currency)})]})}),JI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_MONEY,`FormFieldMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});JI.displayName=`FormFieldMoney`;var $me=[ml.SECONDS,ml.MINUTES,ml.HOURS,ml.DAYS,ml.WEEKS],YI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,placeholder:l,required:u,autoFocus:d,clearable:f,controlSize:p=Zd.MD},m)=>{let{tSystemEnum:h,tComponent:g,isReady:_}=K({component:B.LOW_LEVEL_FORM_FIELD_DURATION,keys:[`system_enums`]}),v=yre(e),y=v?.allowedUnits&&v.allowedUnits.length>0?v.allowedUnits:$me,b=v?.minValue,x=v?.maxValue,S=Q.useCallback(e=>h(Go.DURATION_UNIT,e),[h]),C=Q.useCallback(()=>rte(e),[e]),[w,T]=Q.useState(c??C()),E=j_(a,o),D=a??w,O=D.value===0?``:String(D.value),k=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===void 0){if(E&&f){o?.(void 0);return}let e={...D,value:0};E?o?.(e):T(e);return}let n=parseInt(t,10);if(Number.isNaN(n)||n<0)return;let r={...D,value:n};E?o?.(r):T(r)},[D,E,o,f]),A=Q.useCallback(e=>{let t={...D,unit:e};E?o?.(t):T(t)},[D,E,o]),j=Q.useCallback(()=>{s?.()},[s]),M=`field-${t}`;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(QM,{ref:m,id:M,type:`number`,step:1,min:b,max:x,value:O,onChange:k,onBlur:j,disabled:n,readOnly:r,placeholder:l??`0`,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:d,controlSize:p}),(0,$.jsx)(KI,{value:D.unit,onChange:e=>A(e.target.value),disabled:n||r,controlSize:p,wrapperClassName:`w-32`,"aria-label":g(B.LOW_LEVEL_FORM_FIELD_DURATION,`unit`),children:y.map(e=>(0,$.jsx)(`option`,{value:e,children:S(e)},e))})]})});YI.displayName=`FormFieldDuration_Preset_Default`;var XI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_DURATION,`FormFieldDuration`)(e);return(0,$.jsx)(r,{...t,ref:n})});XI.displayName=`FormFieldDuration`;var ZI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_INPUT_GROUP,`InputGroup`)(e);return(0,$.jsx)(r,{...t,ref:n})});ZI.displayName=`InputGroup`;function QI({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_ADDON,`InputGroupAddon`)(e);return(0,$.jsx)(n,{...t})}function $I({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_BUTTON,`InputGroupButton`)(e);return(0,$.jsx)(n,{...t})}function ehe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_TEXT,`InputGroupText`)(e);return(0,$.jsx)(n,{...t})}function eL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_INPUT,`InputGroupInput`)(e);return(0,$.jsx)(n,{...t})}function tL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_TEXTAREA,`InputGroupTextarea`)(e);return(0,$.jsx)(n,{...t})}var the=`US`;function nhe(e){if(!/^[A-Za-z]{2}$/.test(e))return``;let t=e.toUpperCase().split(``).map(e=>127462+(e.charCodeAt(0)-65));return String.fromCodePoint(...t)}function rhe(e){let t;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{t=void 0}let n=new Intl.Collator(e);return pi().map(e=>({code:e,name:t?.of(e)??e,dialCode:R(e)})).sort((e,t)=>n.compare(e.name,t.name))}function ihe(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)e[r]>=`0`&&e[r]<=`9`&&n++;return n}function ahe(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(e[r]>=`0`&&e[r]<=`9`&&(n++,n>=t))return r+1;return e.length}var nL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,placeholder:l,autoFocus:u,autoComplete:d,controlSize:f=Zd.MD},p)=>{let{tComponent:m,currentLanguage:h}=K({component:[B.LOW_LEVEL_FORM_FIELD_PHONE]}),g=Eee(e)?.defaultCountry??the,_=Q.useMemo(()=>rhe(h),[h]),[v,y]=Q.useState(g),[b,x]=Q.useState(``),S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(null),T=Q.useRef(``),E=Q.useCallback(e=>{w.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),D=a??c??``;Q.useEffect(()=>{if(D===S.current)return;if(S.current=D,C.current=null,!D.trim()){x(``),T.current=``;return}let e=ea(D,g),t=e?e.formatNational():D;e?.country&&y(e.country),x(t),T.current=t},[D,g]),Q.useLayoutEffect(()=>{let e=C.current;C.current=null;let t=w.current;if(e===null||!t||document.activeElement!==t)return;let n=ahe(t.value,e);t.setSelectionRange(n,n)},[b]);let O=Q.useCallback((e,t)=>{let n=t.replace(/\D/g,``);if(!n)return``;let r=ea(n,e);return r?r.format(`E.164`):`+${R(e)}${n}`},[]),k=Q.useCallback((e,t)=>{let n=O(e,t);S.current=n,o?.(n)},[o,O]),A=Q.useCallback(e=>{let t=e.target.value;y(t);let n=T.current.replace(/\D/g,``),r=n?mn(n,t):``;x(r),T.current=r,n&&k(t,r)},[k]),j=Q.useCallback(e=>{let t=e.target.value,n=e.target.selectionStart??t.length;if(t.trim().startsWith(`+`)){let e=yt(t);if(e){let n=R(e),r=t.replace(/\D/g,``),i=r.startsWith(n)?r.slice(n.length):r,a=O(e,i),s=ea(a),c=s?s.formatNational():mn(i,e);y(e),x(c),T.current=c,C.current=null,S.current=a,o?.(a);return}x(t),T.current=t;let n=`+${t.replace(/\D/g,``)}`;S.current=n,o?.(n);return}let r=T.current,i=t.length===r.length-1,a=i?t:mn(t,v);C.current=i?null:ihe(t,n),x(a),T.current=a,k(v,a)},[v,k,o,O]),M=Q.useCallback(()=>{s?.()},[s]),N=Q.useMemo(()=>l||aae(v)||``,[l,v]),P=R(v),F=`field-${t}`,I=m(B.LOW_LEVEL_FORM_FIELD_PHONE,`country`);return(0,$.jsxs)(ZI,{className:U(`w-full`,i),"data-disabled":n||void 0,"data-size":f,children:[(0,$.jsxs)(`div`,{className:`relative flex shrink-0 items-stretch self-stretch border-e border-border`,children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,className:U(`pointer-events-none flex select-none items-center gap-1.5 ps-3 pe-2 text-sm text-muted-foreground`,n&&`opacity-[var(--opacity-disabled)]`),children:[(0,$.jsx)(`span`,{className:`text-base leading-none`,children:nhe(v)}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`+`,P]}),(0,$.jsx)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 opacity-60`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,$.jsx)(`path`,{d:`M3 4.5 6 7.5 9 4.5`})})]}),(0,$.jsx)(`select`,{value:v,onChange:A,disabled:n||r,"aria-label":I,"data-slot":`input-group-control`,className:`absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-default`,children:_.map(e=>(0,$.jsxs)(`option`,{value:e.code,children:[e.name,` (+`,e.dialCode,`)`]},e.code))})]}),(0,$.jsx)(eL,{ref:E,id:F,name:t,type:`tel`,inputMode:`tel`,value:b,onChange:j,onBlur:M,disabled:n,readOnly:r,placeholder:N,autoFocus:u,autoComplete:d??`tel`,className:`ps-2`})]})});nL.displayName=`FormFieldPhone_Preset_Default`;var rL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_PHONE,`FormFieldPhone`)(e);return(0,$.jsx)(r,{...t,ref:n})});rL.displayName=`FormFieldPhone`;var iL=[{part:Dr.LINE1,autoComplete:`address-line1`},{part:Dr.LINE2,autoComplete:`address-line2`},{part:Dr.CITY,autoComplete:`address-level2`},{part:Dr.STATE,autoComplete:`address-level1`},{part:Dr.POSTAL_CODE,autoComplete:`postal-code`}];function aL(e,t){return{[Dr.LINE1]:e?.line1??``,[Dr.LINE2]:e?.line2??``,[Dr.CITY]:e?.city??``,[Dr.STATE]:e?.state??``,[Dr.POSTAL_CODE]:e?.postalCode??``,[Dr.COUNTRY]:e?.country??t??``,[vr.LATITUDE]:e?.coordinates?String(e.coordinates.latitude):``,[vr.LONGITUDE]:e?.coordinates?String(e.coordinates.longitude):``}}function oL(e){return e.trim()===``?NaN:Number(e)}function ohe(e){let t=iL.some(({part:t})=>e[t].trim()!==``),n=e.latitude.trim()!==``||e.longitude.trim()!==``;return!t&&!n?null:{line1:e.line1,...e.line2!==``&&{line2:e.line2},city:e.city,...e.state!==``&&{state:e.state},...e.postalCode!==``&&{postalCode:e.postalCode},country:e.country,...n&&{coordinates:{latitude:oL(e.latitude),longitude:oL(e.longitude)}}}}function she(e,t){let n;try{n=new Intl.DisplayNames([e],{type:`region`})}catch{n=void 0}let r=new Intl.Collator(e);return(t&&t.length>0?[...t]:pi()).map(e=>({code:e,name:n?.of(e)??e})).sort((e,t)=>r.compare(e.name,t.name))}var sL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,autoFocus:l,clearable:u,partErrors:d,renderLookup:f,controlSize:p=Zd.MD},m)=>{let{tComponent:h,currentLanguage:g}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),_=tie(e),v=_?.defaultCountry,y=_?.withCoordinates===!0,b=a??c,[x,S]=Q.useState(()=>aL(b,v)),C=Q.useRef(x),w=Q.useRef(JSON.stringify(b??null)),T=JSON.stringify(b??null);Q.useEffect(()=>{if(T===w.current)return;w.current=T;let e=aL(b,v);C.current=e,S(e)},[T,v]);let E=Q.useMemo(()=>she(g,_?.countriesAllowed),[g,_?.countriesAllowed]),D=Q.useCallback(e=>{C.current=e,S(e);let t=ohe(e)??(u?void 0:{line1:``,city:``,country:e.country});w.current=JSON.stringify(t??null),o?.(t)},[u,o]),O=Q.useCallback((e,t)=>D({...C.current,[e]:t}),[D]),k=n===!0||r===!0,A=Q.useCallback(e=>{if(k)return;let{coordinates:t,...n}=e;D(aL(n,v))},[D,v,k]),j=Q.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||s?.()},[s]),M=`field-${t}`,N=e=>e===Dr.LINE1?M:`${M}-${e.replace(`.`,`-`)}`,P=(e,t,n)=>{let r=N(e),i=d?.[e],a=`${r}-error`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(px,{htmlFor:r,className:`text-sm text-muted-foreground`,children:t}),n({id:r,...i&&{"aria-invalid":!0,"aria-describedby":a}}),i&&(0,$.jsx)(_x,{id:a,children:i})]},e)},F=({part:e,autoComplete:i})=>P(e,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e),a=>(0,$.jsx)(QM,{...a,ref:e===Dr.LINE1?m:void 0,name:`${t}.${e}`,type:`text`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,autoComplete:i,autoFocus:e===Dr.LINE1?l:void 0,controlSize:p})),I=e=>P(`coordinates.${e}`,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e),i=>(0,$.jsx)(QM,{...i,name:`${t}.coordinates.${e}`,type:`number`,step:`any`,inputMode:`decimal`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,className:`tabular-nums`,controlSize:p})),[ee,L,R,z,te]=iL,ne=E.some(e=>e.code===x.country);return(0,$.jsxs)(`div`,{className:U(`flex w-full flex-col gap-element`,i),role:`group`,"aria-labelledby":`${M}-label`,onBlur:j,children:[f?.({..._?.countriesAllowed&&_.countriesAllowed.length>0&&{countriesAllowed:_.countriesAllowed},...v!==void 0&&{defaultCountry:v},disabled:k,applyAddress:A}),F(ee),F(L),(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[F(R),F(te)]}),F(z),P(Dr.COUNTRY,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,Dr.COUNTRY),e=>(0,$.jsxs)(KI,{...e,name:`${t}.${Dr.COUNTRY}`,value:x.country,onChange:e=>O(Dr.COUNTRY,e.target.value),disabled:n||r,autoComplete:`country`,controlSize:p,wrapperClassName:`w-full`,children:[x.country===``&&(0,$.jsx)(`option`,{value:``,disabled:!0,children:h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,`countryPlaceholder`)}),x.country!==``&&!ne&&(0,$.jsx)(`option`,{value:x.country,children:x.country}),E.map(e=>(0,$.jsx)(`option`,{value:e.code,children:e.name},e.code))]})),y&&(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[I(vr.LATITUDE),I(vr.LONGITUDE)]})]})});sL.displayName=`FormFieldAddress_Preset_Default`;var cL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_ADDRESS,`FormFieldAddress`)(e);return(0,$.jsx)(r,{...t,ref:n})});cL.displayName=`FormFieldAddress`;var lL;(function(e){e.MAIN_SCHEMA=`main-schema`,e.PATCH_REQUEST_DTO=`patch-request-dto`,e.VALUE_OBJECT=`value-object`})(lL||={});var che={[lL.MAIN_SCHEMA]:{isClearable:Hie,normalizeClearedValue:Si},[lL.PATCH_REQUEST_DTO]:{isClearable:Re,normalizeClearedValue:ye},[lL.VALUE_OBJECT]:{isClearable:Zee,normalizeClearedValue:Mu}};function lhe({schemaKind:e,rootSchema:t,fieldName:n}){if(e===nT.MAIN_SCHEMA)return lL.MAIN_SCHEMA;if(!t)return lL.PATCH_REQUEST_DTO;let r=n.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).slice(0,-1).join(`.`),i=r?hr.resolveFieldSchemaPath(t,r):t;return i?Ri(i)?lL.PATCH_REQUEST_DTO:lL.VALUE_OBJECT:lL.PATCH_REQUEST_DTO}var uL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:o,onChange:s,onBlur:c,defaultValue:l,validationMode:u,placeholder:d,step:f,min:p,max:m,required:h,autoFocus:g,controlSize:_=Zd.MD},v)=>{let{formatNumber:y,isReady:b}=K({component:B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL}),{renderIcon:x}=Mf(),S=_===Zd.SM?Y.ICON_SM:Y.ICON,C=a(e),w=Ze(e),T=C?.edit?.editMode??w?.edit?.editMode??sc.INPUT,E=Ua(e),D=p??E.min,O=m??E.max,k=E.precision,A=f??(k===void 0?`1`:new Qn(1).div(new Qn(10).pow(k)).toString()),j=a(e)?.edit?.defaultValue,[M,N]=Q.useState(l??j??`0`),P=j_(o,s),F=o??M,I=Q.useMemo(()=>{try{return parseFloat(F)}catch{return 0}},[F]),ee=Q.useCallback(e=>{P?s?.(e):N(e)},[P,s]),L=Q.useCallback(()=>{c?.()},[c]),R=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`||t===`-.`)P?s?.(t):N(t);else try{new Qn(t),ee(t)}catch{/^-?\d*\.?\d*$/.test(t)&&(P?s?.(t):N(t))}},[P,s,ee]),z=()=>{try{let e=new Qn(F||`0`),t=new Qn(A),n=e.plus(t);(O===void 0||n.lte(new Qn(O)))&&ee(n.toString())}catch{ee(A)}},te=()=>{try{let e=new Qn(F||`0`),t=new Qn(A),n=e.minus(t);(D===void 0||n.gte(new Qn(D)))&&ee(n.toString())}catch{ee(new Qn(A).neg().toString())}},ne=Q.useCallback(e=>{let t=e[0];ee(k===void 0?t.toString():t.toFixed(k))},[ee,k]);switch(T){case sc.INPUT:return(0,$.jsx)(QM,{ref:v,id:t,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:d,className:U(`tabular-nums`,i),autoFocus:g,controlSize:_});case sc.SLIDER:let e=D?parseFloat(D):0,a=O?parseFloat(O):100,o=parseFloat(A);return(0,$.jsxs)(`div`,{ref:v,className:U(`flex items-center gap-field`,i),children:[(0,$.jsx)(JM,{value:[I],onValueChange:ne,onValueCommit:()=>L(),min:e,max:a,step:o,disabled:n,className:`flex-1`,controlSize:_}),(0,$.jsx)(`span`,{className:`min-w-[4rem] text-end text-sm tabular-nums`,children:y(I)})]});case sc.STEPPER:let s=t??`stepper-field`,c=D!==void 0&&(()=>{try{return new Qn(F||`0`).lte(new Qn(D))}catch{return!1}})(),l=O!==void 0&&(()=>{try{return new Qn(F||`0`).gte(new Qn(O))}catch{return!1}})();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:S,onClick:te,disabled:n||r||c,children:x(H.MINUS,{size:ca.SM})}),(0,$.jsx)(QM,{ref:v,id:s,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,className:`w-24 text-center tabular-nums`,autoFocus:g,controlSize:_}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:S,onClick:z,disabled:n||r||l,children:x(H.PLUS,{size:ca.SM})})]});default:return(0,$.jsx)(QM,{ref:v,id:t,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:d,className:U(`tabular-nums`,i),autoFocus:g,controlSize:_})}}),dL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,`FormFieldBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});dL.displayName=`FormFieldBigDecimal`;var fL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_CODE,`FormFieldCode`)(e);return(0,$.jsx)(r,{...t,ref:n})});fL.displayName=`FormFieldCode`;var pL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,fromPlaceholder:u=`From`,toPlaceholder:d=`To`,fromLabel:f=`From`,toLabel:p=`To`,required:m,autoFocus:h,controlSize:g=Zd.MD},_)=>{let{tComponent:v,isReady:y}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL}),b=jt(e),x=Ua(e),S=x.min??b?.min,C=x.max??b?.max,w=x.precision,T=b?.fromOptional??!0,E=b?.toOptional??!0,D=w===void 0?`any`:`0.${`0`.repeat(Math.max(0,w-1))}1`,[O,k]=Q.useState(c??{from:void 0,to:void 0}),A=j_(a,o),j=a??O,M=Q.useMemo(()=>{if(j.from==null||j.to==null)return!1;let e=parseFloat(j.from),t=parseFloat(j.to);return isNaN(e)||isNaN(t)?!1:e>t},[j.from,j.to]),N=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,from:t};A?o?.(n):k(n)},[A,o,j]),P=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,to:t};A?o?.(n):k(n)},[A,o,j]),F=Q.useCallback(()=>{s?.()},[s]),I=t??`range-bigdecimal-field`,ee=`${I}-from`,L=`${I}-to`;return y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(QM,{ref:_,id:ee,type:`text`,inputMode:`decimal`,value:j.from??``,onChange:N,onBlur:F,disabled:n,readOnly:r,placeholder:u,"aria-invalid":M,"aria-required":!T,min:S,max:C,step:D,className:`tabular-nums`,autoFocus:h,controlSize:g})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:p}),(0,$.jsx)(QM,{id:L,type:`text`,inputMode:`decimal`,value:j.to??``,onChange:P,onBlur:F,disabled:n,readOnly:r,placeholder:d,"aria-invalid":M,"aria-required":!E,min:S,max:C,step:D,className:`tabular-nums`,controlSize:g})]})]}),M&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:v(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),mL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,`FormFieldRangeBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});mL.displayName=`FormFieldRangeBigDecimal`;function uhe(e,t){let n=Object.keys(Ba);return t&&(n=Yee()),n=n.filter(t=>Aa(t,e)),n.map(e=>({value:e,label:`${Ba[e].symbol} ${e}`})).sort((e,t)=>{let n=Ba[e.value],r=Ba[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var hL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,fromPlaceholder:u=`From`,toPlaceholder:d=`To`,required:f,autoFocus:p,controlSize:m=Zd.MD},h)=>{let{tComponent:g,isReady:_}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY}),{getRecipe:v,fieldVariant:y}=Wg(),b=v(cc.FORM_CONTROL,Hg(y)),x=Me(e),S=zie(e),C=jt(e),w=x?.currenciesAllowed,T=x?.appEnabledOnly??!0,E=S?.edit?.defaultCurrency??`USD`,D=x?.allowCurrencyChange??!0,O=x?.minAmount,k=x?.maxAmount,A=C?.fromOptional??!0,j=C?.toOptional??!0,M=Q.useMemo(()=>uhe(w,T),[w,T]),N=Q.useCallback(e=>Za(e)?.decimals??2,[]);Q.useCallback(()=>{let e=N(E);return{amount:0n,currency:E,decimals:e}},[E,N]);let[P,F]=Q.useState(c??{from:void 0,to:void 0}),[I,ee]=Q.useState(c?.from?.currency??c?.to?.currency??E),L=j_(a,o),R=a??P,z=N(I),ne=Q.useMemo(()=>!R.from||!R.to||R.from.amount===0n&&R.to.amount===0n?!1:Qt(R.from.amount,R.from.decimals)>Qt(R.to.amount,R.to.decimals),[R.from,R.to]),re=Q.useMemo(()=>!R.from||R.from.amount===0n?``:Qt(R.from.amount,R.from.decimals).toFixed(R.from.decimals),[R.from]),ie=Q.useMemo(()=>!R.to||R.to.amount===0n?``:Qt(R.to.amount,R.to.decimals).toFixed(R.to.decimals),[R.to]),ae=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Ji(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,from:n};L?o?.(r):F(r)},[R,I,z,L,o]),oe=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Ji(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,to:n};L?o?.(r):F(r)},[R,I,z,L,o]),se=Q.useCallback(e=>{let t=N(e);ee(e);let n,r;R.from&&R.from.amount!==0n&&(n={amount:te(R.from.amount,R.from.decimals,t),currency:e,decimals:t}),R.to&&R.to.amount!==0n&&(r={amount:te(R.to.amount,R.to.decimals,t),currency:e,decimals:t});let i={from:n,to:r};L?o?.(i):F(i)},[R,N,L,o]),ce=Q.useCallback(()=>{s?.()},[s]),le=t??`range-money-field`,ue=`${le}-from`,de=`${le}-to`,fe=Za(I)?.symbol??I;return _?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(QM,{ref:h,id:ue,type:`number`,step:10**-z,value:re,onChange:ae,onBlur:ce,disabled:n,readOnly:r,placeholder:u,prefix:fe,wrapperClassName:`flex-1`,className:U(`tabular-nums`,ne&&`border-destructive`),"aria-invalid":ne,"aria-required":!A,min:O===void 0?void 0:Qt(O,z),max:k===void 0?void 0:Qt(k,z),autoFocus:p,controlSize:m}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsx)(QM,{id:de,type:`number`,step:10**-z,value:ie,onChange:oe,onBlur:ce,disabled:n,readOnly:r,placeholder:d,prefix:fe,wrapperClassName:`flex-1`,className:U(`tabular-nums`,ne&&`border-destructive`),"aria-invalid":ne,"aria-required":!j,min:O===void 0?void 0:Qt(O,z),max:k===void 0?void 0:Qt(k,z),controlSize:m}),D?(0,$.jsx)(KI,{value:I,onChange:e=>se(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-24`,"aria-label":g(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`currency`),children:M.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.value},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,b.sizes?.[m]),children:I})]}),ne&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:g(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),gL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`FormFieldRangeMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});gL.displayName=`FormFieldRangeMoney`;var _L=class extends Error{};function vL(e,t,n,r){return t.throwIfAborted(),new Promise((i,a)=>{let o=()=>{clearTimeout(c),t.removeEventListener(`abort`,s)},s=()=>{o(),a(t.reason)},c=n===void 0?void 0:setTimeout(()=>{o(),a(new _L(r))},Math.max(0,n));t.addEventListener(`abort`,s,{once:!0}),Promise.resolve().then(()=>(t.throwIfAborted(),e())).then(e=>{o(),i(e)},e=>{o(),a(e)})})}async function dhe(e){let t=Date.now()+(e.timeoutMs??12e4),n=e.metadata;for(;;){if(e.signal.throwIfAborted(),n&&n.fileId!==e.fileId||n&&!Object.values(Li).includes(n.readiness))throw new _L(e.unverifiedMessage);if(n?.readiness===Li.READY)return n;if(n&&n.readiness!==Li.PROCESSING)throw new _L(e.unavailableMessage);if(e.onPending(),!e.getMetadata||Date.now()>=t)throw new _L(e.unverifiedMessage);n&&await new Promise((t,n)=>{let r=()=>{clearTimeout(i),n(e.signal.reason)},i=setTimeout(()=>{e.signal.removeEventListener(`abort`,r),t()},e.intervalMs??2e3);e.signal.addEventListener(`abort`,r,{once:!0})}),e.signal.throwIfAborted();try{n=await vL(e.getMetadata,e.signal,t-Date.now(),e.unverifiedMessage)}catch{throw e.signal.throwIfAborted(),new _L(e.unverifiedMessage)}}}function yL(e,t){return t||(!e||typeof e!=`object`?ta.ON_BLUR:g(e)?ta.ON_CHANGE:ta.ON_BLUR)}function fhe(e){return e.issues[0]?.code??`unknown`}function bL(e){let t={};for(let[n,r]of Object.entries(e))n!==`code`&&n!==`message`&&n!==`path`&&(t[n]=r);return t}function phe(e){let t=Ps(e.schema);return t?{allowedMimeTypes:t.allowedMimeTypes,maxSize:t.maxSize,maxFiles:t.maxFiles}:{}}var mhe={[ju.IMAGE]:`accepted_type_image`,[ju.VIDEO]:`accepted_type_video`,[ju.AUDIO]:`accepted_type_audio`,[ju.PDF]:`accepted_type_pdf`,[ju.OFFICE]:`accepted_type_office`,[ju.ARCHIVE]:`accepted_type_archive`,[ju.ALL]:`accepted_types_all`},hhe={[oc.TEXT]:`accepted_type_text`,[oc.MARKDOWN]:`accepted_type_markdown`,[oc.JSON]:`accepted_type_json`,[oc.TYPESCRIPT]:`accepted_type_typescript`,[oc.TYPESCRIPT_JSX]:`accepted_type_typescript_react`,[oc.YAML]:`accepted_type_yaml`};function xL(e,t){let n=e=>t(B.LOW_LEVEL_FORM_FIELD_FILE,e);return e.length===0?n(`accepted_types_all`):e.map(e=>{switch(e.category){case ku.NATURE:return n(mhe[e.nature]);case ku.AGENT_FORMAT:return n(hhe[e.format]);case ku.MIME_SUBTYPE:return e.subtype.toUpperCase()}}).join(`, `)}var SL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_IMAGE_CROP,`ImageCrop`)(e);return(0,$.jsx)(r,{...t,ref:n})});SL.displayName=`ImageCrop`;function CL(e){return!(!e.type.startsWith(`image/`)||e.type===`image/svg+xml`)}async function wL(e){if(typeof createImageBitmap==`function`)try{let t;try{t=await createImageBitmap(e,{imageOrientation:`from-image`})}catch{t=await createImageBitmap(e)}return{source:t,naturalWidth:t.width,naturalHeight:t.height,dispose:()=>t.close()}}catch{}let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>n(Error(`image_decode_failed`)),r.src=t});return{source:e,naturalWidth:e.naturalWidth,naturalHeight:e.naturalHeight,dispose:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function TL(e,t,n,r){return Math.max(n/e,r/t)}function EL(e,t,n,r){let i=Math.max(0,(t*n-r)/2);return Math.min(i,Math.max(-i,e))}function DL(e){let{naturalWidth:t,naturalHeight:n,viewportWidth:r,viewportHeight:i,transform:a}=e,o=TL(t,n,r,i)*a.zoom,s=r/o,c=i/o,l=t/2-a.offsetX/o,u=n/2-a.offsetY/o;return{x:Math.min(Math.max(0,l-s/2),Math.max(0,t-s)),y:Math.min(Math.max(0,u-c/2),Math.max(0,n-c)),width:Math.min(s,t),height:Math.min(c,n)}}var OL=`image/png`,kL=`image/jpeg`,AL=`image/webp`,jL=[OL,kL,AL],ghe={[OL]:`png`,[kL]:`jpg`,[AL]:`webp`},_he=[.92,.85,.78,.7,.6,.5];function ML(e){return jL.some(t=>Lr(t,e))}function vhe(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function NL(e,t){return`${e.replace(/\.[^./\\]+$/,``)}.${t}`}async function PL(e){let{image:t,sourceRect:n,originalFile:r,maxWidth:i,maxHeight:a,maxSizeBytes:o,allowedMimeTypes:s}=e,c=Math.min(1,i?i/n.width:1,a?a/n.height:1),l=Math.max(1,Math.round(n.width*c)),u=Math.max(1,Math.round(n.height*c)),d=document.createElement(`canvas`);d.width=l,d.height=u;let f=d.getContext(`2d`);if(!f)throw Error(`canvas_2d_unavailable`);f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(t.source,n.x,n.y,n.width,n.height,0,0,l,u);let p=jL.filter(e=>Lr(e,s)),m=[];p.includes(r.type)&&r.type!==kL&&m.push(r.type);for(let e of[OL,AL,kL])p.includes(e)&&!m.includes(e)&&m.push(e);if(m.length===0)throw Error(`image_export_no_allowed_encoding`);let h=e=>new File([e],NL(r.name,ghe[e.type]??`png`),{type:e.type}),g=null,_=e=>p.includes(e.type)?((!g||e.size<g.size)&&(g=e),!o||e.size<=o?h(e):null):null;for(let e of m){e===kL&&(f.save(),f.globalCompositeOperation=`destination-over`,f.fillStyle=`#ffffff`,f.fillRect(0,0,l,u),f.restore());let t=e===OL?[void 0]:_he;for(let n of t){let t=await vhe(d,e,n);if(!t)continue;let r=_(t);if(r)return r;if(e===OL)break}}if(!g)throw Error(`image_encode_failed`);return h(g)}function yhe(e){return e!=null&&`fileId`in e}function FL(e){return e!=null&&`fileIds`in e}var bhe=0;function IL(){return`upload-${Date.now()}-${++bhe}`}function LL(e){return e instanceof Error?e.code===`ERR_CANCELED`||e.name===`AbortError`:!1}function RL(e,t){return t&&e.override?e.override:e.upload}function xhe(e,t){return!!RL(e,t)}function zL(e){return!!e.upload}function She(e,t){return e&&e.trim()!==``?e:t}function BL(e,t){return t instanceof _L?t.message:e}var VL=Q.forwardRef(({schema:e,name:t,value:n,onChange:r,onBlur:i,defaultValue:a,disabled:o=!1,readOnly:s,className:c,validationMode:l,endpoints:u,uploadButtonText:d,replaceButtonText:f,onValidationError:p,required:m,httpOperations:h},g)=>{let{t:_,tErrorValidation:v,tComponent:y,tResourceFieldEnumValue:b,isReady:x,formatByteSize:S}=K({component:B.LOW_LEVEL_FORM_FIELD_FILE,keys:[`errors_validation`,`system_enums`]}),{frontendProviderRegistry:C}=Ou(),{renderIcon:w}=Mf(),{getRecipe:T}=Wg(),E=T(cc.FORM_CONTROL,Gu.DEFAULT),D=d??y(B.LOW_LEVEL_FORM_FIELD_FILE,`choose_file`),O=f??y(B.LOW_LEVEL_FORM_FIELD_FILE,`replace`),k=y(B.LOW_LEVEL_FORM_FIELD_FILE,`drag_and_drop`),A=y(B.LOW_LEVEL_FORM_FIELD_FILE,`remove`),j=y(B.LOW_LEVEL_FORM_FIELD_FILE,`upload_failed`),M=y(B.LOW_LEVEL_FORM_FIELD_FILE,`metadata_load_failed`),N=y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploads_unavailable`),P=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),F=Ps(e),I=phe({schema:e}),ee=I.allowedMimeTypes,L=I.maxSize,R=F?.minSize,z=F?.overridable??!0,te=ee?ste(ee):void 0,ne=F?.multiple??!1,re=I.maxFiles,ie=F?.imageConstraints,ae=F?.videoConstraints,oe=F?.audioConstraints,se=F?.documentConstraints,ce=yL(e,l),[le,ue]=Q.useState(a??null),[de,fe]=Q.useState(),pe=Q.useRef(n);Q.useEffect(()=>{pe.current!==void 0&&n==null&&de&&fe(void 0),pe.current=n},[n,de]);let[me,he]=Q.useState(new Map),ge=Q.useRef(me);ge.current=me;let[_e,ve]=Q.useState(0),[ye,be]=Q.useState(new Map),[xe,Se]=Q.useState(!1),Ce=Q.useRef(new Set),we=Q.useRef(0),[Te,Ee]=Q.useState(new Set),De=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_processing`),Oe=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_unavailable`),ke=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_readiness_unverified`),Ae=Q.useCallback(()=>{we.current+=1;for(let e of Ce.current)e.abort();for(let e of ge.current.values())e.abortController.abort();Ce.current.clear()},[]),je=Q.useRef(null),Me=j_(n,r),Ne=n??le,Pe=Array.from(me.values()).some(e=>e.status===`uploading`),Ie=yhe(Ne)?Ne.fileId:null,Le=FL(Ne)?Ne.fileIds:[],Re=ne?zL(u):xhe(u,Ie),ze=Q.useRef(Le);ze.current=Le;let Be=Q.useMemo(()=>Le.join(`,`),[Le]),Ve=Q.useRef(ye);Ve.current=ye;let He=Ie?ye.get(Ie)??null:null,Ue=Ie?[Ie]:Le,We=Ue.some(e=>ye.get(e)?.readiness===Li.UNAVAILABLE)?Oe:Ue.some(e=>![Li.READY,Li.ATTACHED].includes(ye.get(e)?.readiness))?De:void 0,Ge=Array.from(me.values()).find(e=>e.status===`error`)?.error,Ke=Pe||Te.size>0?De:Ge??We;Q.useEffect(()=>{p?.(de??Ke)},[de,Ke,p]);let qe=Q.useCallback(async e=>h.get(e),[h]),Je=Q.useCallback(async e=>h.delete(e),[h]);Q.useEffect(()=>()=>Ae(),[u.getMetadata,u.upload,u.override,h,qe,Ae]);let Ye=Q.useRef({endpoint:u.getMetadata,get:qe});Q.useEffect(()=>{let e=Ie?[Ie]:Le,t=Ye.current.endpoint!==u.getMetadata||Ye.current.get!==qe;if(Ye.current={endpoint:u.getMetadata,get:qe},t&&(Ve.current=new Map,be(new Map)),e.length===0){be(new Map),fe(e=>e===M?void 0:e);return}let n=!1,r=new AbortController,i,a=async()=>{let t=!1,o=!1,s=new Map;await Promise.all(e.map(async e=>{let n=Ve.current.get(e);if(!(n&&[Li.READY,Li.ATTACHED,Li.UNAVAILABLE].includes(n.readiness))){if(!u.getMetadata)o=!0;else try{let n=await vL(()=>qe(`${u.getMetadata}/${encodeURIComponent(e)}/metadata`),r.signal,12e4,M);if(n.fileId!==e||!Object.values(Li).includes(n.readiness))throw Error(`Invalid file metadata`);s.set(e,n),n.readiness===Li.PROCESSING&&(t=!0)}catch{o=!0,t=!0,console.warn(`Unable to load file metadata for one or more files.`)}}})),n||(be(e=>{let t=new Map(e);for(let[e,n]of s)t.set(e,n);return t}),fe(e=>o?M:e===M?void 0:e),t&&(i=setTimeout(a,2e3)))};return a(),()=>{n=!0,r.abort(),i&&clearTimeout(i)}},[Ie,Be,u.getMetadata,qe,M]);let Xe=Q.useCallback(async(e,t)=>{let n=new AbortController,r=()=>n.abort();t?.aborted&&n.abort(),t?.addEventListener(`abort`,r,{once:!0}),Ce.current.add(n);try{let t=await dhe({...e,signal:n.signal,getMetadata:u.getMetadata?()=>qe(`${u.getMetadata}/${encodeURIComponent(e.fileId)}/metadata`):void 0,onPending:()=>Ee(t=>new Set(t).add(e.fileId)),unavailableMessage:Oe,unverifiedMessage:ke});return n.signal.throwIfAborted(),{fileId:e.fileId,metadata:t}}finally{t?.removeEventListener(`abort`,r),Ce.current.delete(n),Ee(t=>{let n=new Set(t);return n.delete(e.fileId),n})}},[qe,u.getMetadata,Oe,ke]),Ze=Q.useCallback(e=>{if(ee&&ee.length>0&&!Lr(e.type,ee)){let e=xL(Fe(ee),y);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_type_not_allowed`,{accepted:e})}},[ee,y]),Qe=Q.useCallback(e=>{let t=Ze(e);if(t)return t;if(L&&e.size>L){let e=S(L);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_too_large`,{max:e})}if(R&&e.size<R){let e=S(R);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_too_small`,{min:e})}},[Ze,L,R,y,S]),$e=Q.useCallback(async(e,t,n,r,i,a)=>{let o=new FormData;o.append(`file`,e),n&&r&&o.append(`fileId`,r);let s=()=>h.upload(t,o,{onProgress:i,signal:a}),c=a?await vL(s,a,void 0,ke):await s();return a?.throwIfAborted(),Xe(c,a)},[h,Xe,ke]),et=Q.useCallback(async t=>{Ae();let n=we.current,i=RL(u,Ie);if(!i){fe(N);return}let a=Qe(t);if(a){fe(a);return}let o=IL(),s=new AbortController;he(new Map([[o,{tempId:o,fileName:t.name,progress:0,status:`uploading`,abortController:s}]])),ve(0),p?.(De),fe(void 0);try{let a=await $e(t,i,!!Ie,Ie,e=>{ve(e),he(t=>{let n=new Map(t),r=n.get(o);return r&&n.set(o,{...r,progress:e}),n})},s.signal);if(n!==we.current)return;let c={fileId:a.fileId,updatedAt:new Date};if(Me||ue(c),r?.(c),a.metadata&&be(e=>{let t=new Map(e);return t.set(a.fileId,a.metadata),t}),ce!==`onSubmit`){let t=e.safeParse(c);if(!t.success){let e=t.error.issues[0];if(e){let t={...bL(e),message:e.message},n=v(e.code,`msg`,t);fe(n)}}}}catch(e){if(s.signal.aborted||n!==we.current||LL(e))return;fe(BL(j,e))}finally{he(e=>{let t=new Map(e);return t.delete(o),t}),ve(0)}},[Ie,u,Me,r,N,Qe,ce,e,v,$e,Ae,p,De,j]),tt=Q.useCallback(async e=>{let t=we.current;if(!zL(u)){fe(N);return}let n=ze.current.length;if(re&&n+e.length>re){fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`too_many_files`,{max:re}));return}let i=[];for(let t of e){let e=Qe(t);if(e){fe(e);return}i.push(t)}p?.(De),fe(void 0);let a=new Map,o=[];for(let e of i){let t=IL(),n=new AbortController;a.set(t,{tempId:t,fileName:e.name,progress:0,status:`uploading`,abortController:n}),o.push({tempId:t,file:e,abortController:n})}he(e=>{let t=new Map;for(let[n,r]of e)r.status===`uploading`&&t.set(n,r);for(let[e,n]of a)t.set(e,n);return t});let s=await Promise.allSettled(o.map(async({tempId:e,file:n,abortController:r})=>{try{let t=await $e(n,u.upload,!1,null,t=>{he(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,progress:t}),r})},r.signal);return he(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,status:`done`,fileId:t.fileId,progress:100}),r}),t.metadata&&be(e=>{let n=new Map(e);return n.set(t.fileId,t.metadata),n}),t.fileId}catch(n){throw r.signal.aborted||t!==we.current||LL(n)?(he(t=>{let n=new Map(t);return n.delete(e),n}),n):(he(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,status:`error`,error:BL(j,n)}),r}),n)}})),c=[];for(let e of s)e.status===`fulfilled`&&c.push(e.value);if(c.length>0&&t===we.current){let e=[...ze.current,...c];ze.current=e;let t={fileIds:e,updatedAt:new Date};Me||ue(t),r?.(t)}he(e=>{let t=new Map(e);for(let[e,n]of t)n.status===`done`&&t.delete(e);return t})},[u,Me,re,r,y,$e,Qe,j,N,p,De]),nt=ie?.aspectRatio,rt=ine(e)?.display?.preview?.shape,[it,at]=Q.useState(null),ot=Q.useCallback(e=>{at(null),et(e)},[et]),st=Q.useCallback(()=>{at(null)},[]),ct=Q.useCallback(e=>{at(null),et(e)},[et]),lt=Q.useCallback(e=>{if(e.length!==0){if(ne)tt(e);else{let t=e[0];if(nt&&CL(t)&&ML(ee)){let e=Ze(t);if(e){fe(e);return}fe(void 0),at(t);return}et(t)}}},[ne,tt,et,nt,Ze,ee]),ut=Q.useCallback(async(e,t)=>{ne||Ae();let n=we.current,i=ne?t:t.slice(0,1),a=ne?u.upload:RL(u,Ie);if(!a){fe(N);return}p?.(De),fe(void 0);let o=await Promise.allSettled(i.map(async t=>{let n=IL();Ee(e=>new Set(e).add(n));let r=new AbortController;Ce.current.add(r);try{let n=await vL(()=>h.linkRemoteReference(a,{remoteReference:{providerRef:e,externalId:t.externalId,...t.displayName===void 0?{}:{displayName:t.displayName},...t.mimeType===void 0?{}:{mimeType:t.mimeType},...t.sizeBytes===void 0?{}:{sizeBytes:t.sizeBytes}}}),r.signal,12e4,ke);r.signal.throwIfAborted();let i=await Xe(n,r.signal);return i.metadata&&be(e=>{let t=new Map(e);return t.set(i.fileId,i.metadata),t}),i.fileId}finally{Ce.current.delete(r),Ee(e=>{let t=new Set(e);return t.delete(n),t})}})),s=o.flatMap(e=>e.status===`fulfilled`?[e.value]:[]);if(s.length>0&&n===we.current){let e=ne?{fileIds:[...ze.current,...s],updatedAt:new Date}:{fileId:s[0],updatedAt:new Date};FL(e)&&(ze.current=e.fileIds),Me||ue(e),r?.(e)}if(s.length<i.length&&n===we.current){let e=o.find(e=>e.status===`rejected`);fe(BL(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_link_failed`),e?.status===`rejected`?e.reason:void 0))}},[Ie,u,h,Me,ne,r,N,y,Xe,Ae,p,De,ke]),dt=Q.useCallback(async(e,t)=>{ne||Ae();let n=we.current,r=new AbortController,i=IL();Ce.current.add(r),p?.(De),Ee(e=>new Set(e).add(i));try{let i=[],a=[],o=!1;for(let e of t)if(e.kind===dd.BROWSER_READABLE_FILE)i.push(e.file);else if(e.kind===dd.BROWSER_READABLE_URL)try{let t=await vL(()=>fetch(e.url,{signal:r.signal}),r.signal,12e4,ke);if(!t.ok){o=!0;continue}let n=await vL(()=>t.blob(),r.signal,12e4,ke);i.push(new File([n],e.displayName??`file`,{type:e.mimeType??n.type}))}catch{if(r.signal.aborted||n!==we.current)return;o=!0}else a.push(e);if(r.signal.aborted||n!==we.current)return;if(a.length>0){await ut(e,a);return}if(o&&i.length===0){fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`));return}if(i.length===0)return;fe(o?y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`):void 0),lt(i)}finally{Ce.current.delete(r),Ee(e=>{let t=new Set(e);return t.delete(i),t})}},[lt,ut,y,ne,Ae,p,De,ke]),ft=Q.useCallback(()=>{fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_picker_failed`))},[y]),pt=Q.useCallback(e=>{let t=e.target.files;t&&t.length>0&&lt(Array.from(t)),je.current&&(je.current.value=``)},[lt]),mt=o||s,ht=mt||!Re,gt=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),!ht&&!Pe&&Se(!0)},[ht,Pe]),_t=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),Se(!1)},[]),vt=Q.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),Se(!1),ht||Pe)return;let t=e.dataTransfer.files;t&&t.length>0&&lt(Array.from(t))},[ht,Pe,lt]),yt=Q.useCallback(async()=>{if(Ae(),Ie){if(u.delete)try{let e=`${u.delete}/${encodeURIComponent(Ie)}`;await Je(e)}catch(e){if(LL(e))return;fe(BL(j,e));return}fe(void 0),Me||ue(null),r?.(null),be(e=>{let t=new Map(e);return t.delete(Ie),t})}},[Ie,u,Me,r,Je,j]),bt=Q.useCallback(async e=>{if(Ae(),u.delete)try{let t=`${u.delete}/${encodeURIComponent(e)}`;await Je(t)}catch(e){if(LL(e))return;fe(BL(j,e));return}fe(void 0);let t=ze.current.filter(t=>t!==e);ze.current=t;let n=t.length>0?{fileIds:t,updatedAt:new Date}:null;Me||ue(n),r?.(n),be(t=>{let n=new Map(t);return n.delete(e),n})},[u,Me,r,Je,j]),xt=Q.useCallback(e=>{let t=ge.current.get(e);t&&t.abortController.abort(),he(t=>{let n=new Map(t);return n.delete(e),n})},[]),St=Q.useCallback(()=>{!ht&&!Pe&&je.current?.click()},[ht,Pe]),Ct=e=>e?e.startsWith(`image/`)?H.FILE_IMAGE:e.startsWith(`video/`)?H.FILE_VIDEO:e.startsWith(`audio/`)?H.FILE_AUDIO:e===`application/pdf`?H.FILE_TEXT:e.includes(`spreadsheet`)||e.includes(`excel`)?H.FILE_SPREADSHEET:e.includes(`presentation`)||e.includes(`powerpoint`)?H.FILE_PRESENTATION:e.includes(`document`)||e.includes(`word`)?H.FILE_TEXT:e.includes(`zip`)||e.includes(`rar`)||e.includes(`7z`)?H.FILE_ARCHIVE:H.FILE:H.FILE,wt=(e,t=ca.MD)=>w(Ct(e),{size:t}),Tt=xL(Fe(ee),y),Et=F?.nature,Dt=(e,t=!1)=>mt?null:(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,t?`flex-shrink-0`:``),children:[!t&&z&&Re&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,onClick:St,disabled:Pe,children:O}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:e,disabled:Pe,className:U(`text-destructive hover:text-destructive`,t&&`h-6 w-6 p-0`),"aria-label":A,title:A,children:w(H.CLOSE,{size:ca.SM})})]}),Ot=(e,t,n=!1)=>(0,$.jsxs)(`div`,{className:U(`min-w-0`,n?``:`flex-1`),children:[(0,$.jsx)(`div`,{className:`flex items-center gap-element`,children:t?.url?(0,$.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:U(`font-medium text-primary hover:underline truncate`,n&&`text-sm`),children:t.filename}):(0,$.jsx)(`span`,{className:U(`font-medium truncate`,n&&`text-sm`),children:She(t?.filename,P)})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group text-xs text-muted-foreground mt-0.5`,children:[t?.size!==void 0&&(0,$.jsx)(`span`,{children:S(t.size)}),t?.mimeType&&(0,$.jsx)(`span`,{className:`uppercase`,children:t.extension||t.mimeType.split(`/`).pop()}),t?.width&&t?.height&&(0,$.jsxs)(`span`,{children:[t.width,`×`,t.height]})]})]}),kt=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`relative`,children:(0,$.jsx)(`img`,{src:e.url||e.thumbnailUrl||``,alt:e.filename,className:`w-full max-h-64 object-contain bg-checkerboard`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]})]}),At=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`video`,{src:e.url,controls:!0,className:`w-full max-h-64 bg-black`,poster:e.thumbnailUrl,preload:`metadata`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]})]}),V=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]}),(0,$.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]}),jt=(e,t)=>{if(t&&![Li.READY,Li.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0}),!t)return(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(void 0,ca.LG)}),Ot(e,null),Dt(yt)]});let n=xc(Et,t.mimeType);return n===So.IMAGE&&(t.url||t.thumbnailUrl)?kt(t):n===So.VIDEO&&t.url?At(t):n===So.AUDIO&&t.url?V(t):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t.mimeType,ca.LG)}),Ot(e,t),Dt(yt)]})},Mt=(e,t)=>{t&&![Li.READY,Li.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0});let n=xc(Et,t?.mimeType),r=()=>bt(e);return n===So.IMAGE&&t&&(t.url||t.thumbnailUrl)?(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`img`,{src:t.thumbnailUrl||t.url||``,alt:t.filename,className:`h-12 w-12 rounded object-cover flex-shrink-0`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t,!0)}),Dt(r,!0)]},e):n===So.AUDIO&&t?.url?(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t.mimeType,ca.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t,!0)}),Dt(r,!0)]}),(0,$.jsx)(`audio`,{src:t.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]},e):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t?.mimeType,ca.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t??null,!0)}),Dt(r,!0)]},e)},Nt=()=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[Le.map(e=>{let t=ye.get(e);return Mt(e,t)}),Array.from(me.values()).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border border-primary/20 bg-primary/5`,children:[e.status===`uploading`&&(0,$.jsx)(ib,{size:20,className:`text-primary flex-shrink-0`,"aria-hidden":`true`}),e.status===`error`&&(0,$.jsx)(`span`,{className:`text-destructive flex-shrink-0`,"aria-hidden":`true`,children:w(H.WARNING,{size:ca.MD})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-medium text-sm truncate block`,children:e.fileName}),e.status===`uploading`&&(0,$.jsx)(`div`,{className:`w-full h-1 bg-muted rounded-full mt-1 overflow-hidden`,children:e.progress<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${e.progress}%`}})}),e.status===`error`&&e.error&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:e.error})]}),(e.status===`uploading`||e.status===`error`)&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>xt(e.tempId),className:`text-muted-foreground hover:text-destructive h-6 w-6 p-0`,"aria-label":y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),title:y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),children:w(H.CLOSE,{size:ca.SM})})]},e.tempId))]}),Pt=e=>{if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)} min`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${t}h ${n}min`:`${t}h`},Ft=Q.useMemo(()=>{let e=[];if(R&&L?e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_size_range`,{min:S(R),max:S(L)})):R&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_min_size`,{min:S(R)})),ie){let{minWidth:t,maxWidth:n,minHeight:r,maxHeight:i,aspectRatio:a}=ie;if(t||r){let n=t??`–`,i=r??`–`;e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_dimensions`,{width:String(n),height:String(i)}))}if(n||i){let t=n??`–`,r=i??`–`;e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_max_dimensions`,{width:String(t),height:String(r)}))}a&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_aspect_ratio`,{width:String(a.width),height:String(a.height)}))}return ae&&ae.maxDuration&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_video_max_duration`,{duration:Pt(ae.maxDuration)})),oe&&oe.maxDuration&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_audio_max_duration`,{duration:Pt(oe.maxDuration)})),se&&se.maxPages&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_document_max_pages`,{pages:se.maxPages})),ne&&re&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_max_files`,{max:re})),e},[R,L,ie,ae,oe,se,ne,re,y,S]),It=()=>Ft.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-x-group gap-y-item-xs mt-item-xs`,children:Ft.map((e,t)=>(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e},t))}),Lt=(e=!1)=>(0,$.jsx)(`div`,{onClick:St,onDragOver:gt,onDragLeave:_t,onDrop:vt,className:U(`relative flex flex-col items-center justify-center rounded-md border-2 border-dashed cursor-pointer`,e?`p-card-sm`:`p-container`,xe&&`border-primary bg-primary/5`,ht&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`,Pe&&!ne&&`pointer-events-none`,de&&`border-destructive`,!ht&&!Pe&&`hover:border-primary hover:bg-primary/5`,E.motion.transition),children:Pe&&!ne?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ib,{size:32,className:`text-primary mb-element`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_e<0?y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploading_indeterminate`):y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploading`,{progress:_e})}),(0,$.jsx)(`div`,{className:`w-full max-w-xs h-1 bg-muted rounded-full mt-element overflow-hidden`,children:_e<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${_e}%`}})})]}):(0,$.jsxs)($.Fragment,{children:[!e&&(0,$.jsx)(`span`,{className:`mb-element`,"aria-hidden":`true`,children:w(H.UPLOAD,{size:ca.XL})}),(0,$.jsx)(`span`,{className:U(`font-medium`,e?`text-xs`:`text-sm`),children:e?y(B.LOW_LEVEL_FORM_FIELD_FILE,`add_more`):D}),!e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground mt-item-xs`,children:k}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground mt-element`,children:[Tt,L&&!R&&` • ${y(B.LOW_LEVEL_FORM_FIELD_FILE,`max_size`,{size:S(L)})}`]}),It()]})]})}),Rt=ne&&(!re||Le.length<re),zt=()=>(0,$.jsx)(ux,{multiple:ne,constraints:I,acceptedStorages:F?.storageAccepted,onSelect:dt,onProviderFailure:ft,renderConsentRequired:({choice:e,missingPurposes:t,grant:n})=>{let r=t.map(e=>b(ul.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Che)).join(`, `),i=_(e.displayNameLabelKey)??e.displayName??e.providerRef;return(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-item-xs mt-element text-sm text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_required`,{provider:i,purposes:r})}),n===void 0?null:(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.OUTLINE,onClick:()=>void n(),children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_grant`,{purposes:r})})]})},renderChooser:({choices:e,chosen:t,choose:n})=>(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs mt-element`,children:e.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.providerRef===t?J.DEFAULT:J.OUTLINE,"aria-pressed":e.providerRef===t,onClick:()=>n(e.providerRef),children:_(e.displayNameLabelKey)??e.displayName??e.providerRef},e.providerRef))})});return x?(0,$.jsxs)(`div`,{ref:g,className:c,children:[(de??Ke)&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:de??Ke}),Te.size>0&&(0,$.jsx)(X,{type:`button`,onClick:Ae,children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`)}),(0,$.jsx)(`input`,{ref:je,type:`file`,accept:te,multiple:ne,onChange:pt,className:`hidden`,disabled:ht}),ne?(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(Le.length>0||me.size>0)&&Nt(),!ht&&Rt&&Lt(Le.length>0),!ht&&Le.length===0&&!Rt&&Lt(!1),!ht&&Rt&&zt()]}):Ie?jt(Ie,He):Re?(0,$.jsxs)($.Fragment,{children:[Lt(!1),!ht&&zt()]}):null,it&&nt&&(0,$.jsx)(SL,{file:it,aspectRatio:nt,maskShape:rt,maxOutputWidth:ie?.maxWidth,maxOutputHeight:ie?.maxHeight,maxOutputSizeBytes:L,allowedMimeTypes:ee,onConfirm:ot,onCancel:st,onUncroppable:ct})]}):null}),Che=ka(rd).consentedPurposes,HL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,httpOperations:t,...n},r)=>{let{httpClient:i}=Ou(),a=(0,Q.useMemo)(()=>t||{upload:async(e,t,n)=>{let r=await i.uploadFile(e,t,{onUploadProgress:n?.onProgress,signal:n?.signal});if(r?.file?.fileId)return{fileId:r.file.fileId,metadata:r.file};if(r?.fileId)return{fileId:r.fileId,metadata:r.metadata};throw Error(`upload_failed`)},linkRemoteReference:async(e,t)=>{let n=await i.post(e,t);if(n?.file?.fileId)return{fileId:n.file.fileId,metadata:n.file};throw Error(`link_failed`)},get:async e=>i.get(e),delete:async e=>{await i.delete(e)}},[i,t]),o=Nl(B.LOW_LEVEL_FORM_FIELD_FILE,`FormFieldFile`)(e),s={...n,httpOperations:a};return(0,$.jsx)(o,{...s,ref:r})});HL.displayName=`FormFieldFile`;var whe=[`shipping`,`billing`],The=[`home`,`work`,`mobile`,`fax`,`pager`],Ehe=[`webauthn`];function Dhe(e){if(!e)return{leadingModifiers:[],trailingModifiers:[]};let t=Array.isArray(e)?e:[e],n=Array.from(new Set(t)),r=n.find(e=>whe.includes(e)),i=n.find(e=>The.includes(e)),a=n.find(e=>Ehe.includes(e));return{leadingModifiers:[...r?[r]:[],...i?[i]:[]],trailingModifiers:a?[a]:[]}}function Ohe({identifier:e,modifier:t}){if(!e)return;let{leadingModifiers:n,trailingModifiers:r}=Dhe(t);return[...n,e,...r].join(` `)}function UL(e){switch(e){case`stacked`:return Wc.STACKED;case`inline`:return Wc.INLINE;case`compact`:return Wc.COMPACT;default:return}}function WL(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function GL(e){switch(e){case`sm`:return Zd.SM;case`md`:return Zd.MD;default:return}}var KL=300;function khe(e,t,n=KL){let r=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,Q.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]);return{debouncedTrigger:(0,Q.useCallback)(()=>{i(),r.current=setTimeout(()=>{e(t)},n)},[e,t,n,i]),cancelDebounce:i}}function Ahe(e){return!!(e?.upload||e?.override)}function qL(e){return e??void 0}function jhe(e,t,n=ta.ON_BLUR,r=!1,i,a=ye){let{debouncedTrigger:o,cancelDebounce:s}=khe(e.trigger,t,KL),c=EE(),l=(i?Xc(i):void 0)?.autosave,u=OE(l,c?.config.defaultTrigger,r),d=c?.getFieldStateInfo(t),f=d?.state??rT.IDLE,p=d?.lastError,m=(0,Q.useCallback)(()=>{c?.retryFieldSave?.(t)},[c,t]),{validateUniqueness:h}=yfe({fieldName:t,fieldSchema:i}),{handleFieldBlur:g,noteInputReceived:_}=LM(t);return{createBlurHandler:(0,Q.useCallback)(i=>()=>{let a=g(i);if(s(),a||(n===`onBlur`||n===`onTouched`||n===`onChange`&&r)&&e.trigger(t),c&&u===ou.BLUR){let n=e.getValues(t);c.triggerSave(t,n,ou.BLUR)}h()},[e,t,n,r,s,c,u,h,g]),createChangeHandler:(0,Q.useCallback)(s=>l=>{let d=i?a(i,l):l;s(d),_();let f=e.getFieldState(t);(n===`onChange`||n===`onTouched`&&f.isTouched||n===`onBlur`&&f.error)&&(r?o():e.trigger(t)),c&&u===ou.DEBOUNCE&&c.triggerSave(t,d,ou.DEBOUNCE)},[e,t,n,r,o,c,u,i,a,_]),autosaveFieldState:f,autosaveError:p,handleRetrySave:m,saveFieldNow:(0,Q.useMemo)(()=>c?.config.enabled&&u!==ou.NONE?e=>c.triggerSave(t,e,ou.BLUR):void 0,[c,u,t])}}function Mhe(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.fileId==`string`&&t.fileId.trim()!==``||Array.isArray(t.fileIds)&&t.fileIds.some(e=>typeof e==`string`&&e.trim()!==``)}function Nhe(e){if(!Mhe(e))return 0;let t=e;return Array.isArray(t.fileIds)?Math.max(1,t.fileIds.filter(e=>typeof e==`string`&&e.trim()!==``).length):1}function JL({inputProps:e,value:t,isGeneratedPdfField:n,onBlur:r,inputRef:i}){let{tComponent:a}=K({component:B.LOW_LEVEL_FORM_FIELD_FILE}),o=Nhe(t),s=o===0?``:o>1?a(B.LOW_LEVEL_FORM_FIELD_FILE,`files_attached`,{count:o}):a(B.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),c=a(B.LOW_LEVEL_FORM_FIELD_FILE,n?`generated_pdf_read_only`:`uploads_unavailable_placeholder`);return(0,$.jsx)(ZM,{...e,value:s,onChange:()=>void 0,onBlur:r,ref:i,placeholder:c,type:`text`,readOnly:!0,disabled:!0})}function Phe(e,t,n,r){return Xc(e)?.validationMode||t||n||hr.getDefaultValidationMode(r)}function Fhe(e,t){return t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function Ihe(e,t){if(!t)return e;let n=Array.isArray(e.conditions)?e.conditions:[e.conditions];return{...e,conditions:n.map(e=>({...e,field:e.field.includes(`.`)||e.field.includes(`[`)?e.field:`${t}.${e.field}`}))}}function Lhe(e,t){return hr.resolveFieldSchemaPath(e,t)}function YL({name:e,schema:t,label:n,description:r,tooltip:i,labelPlacement:a,hideLabel:o,hideDescription:s,controlSize:c,respectSurfaceErrorPlacement:l,enumLabels:u,allowedValues:d,as:f,validationMode:p,disabled:m,readOnly:h,className:g,placeholder:_,type:v,renderField:y,sectionAppearance:b,objectItemLayout:x,fileUploadContext:S,autoFocus:C,excludedChildKeys:w,quickCreateSourceFieldName:T}){let E=GC(),D=PD(),O=hc(),{registry:k}=fm(),A=Q.useContext(Fi)?.appConfig,{tErrorValidation:j,t:M,isReady:N}=K({keys:[`errors_validation`]}),P=zT(),F=DD(e),I=P?.allowedValuesByField?.[F],ee=d??I?.values;PM(F),hk(F),Vk([F]);let L=!/\.\d+(\.|$)/.test(F),R=t??Lhe(P?.schema,F),te=(0,Q.useMemo)(()=>R?ge(A,ar(R)):void 0,[R,A]),ne=_fe({declaration:P?.requestFieldOffers?.[F],record:P?.requestFieldOfferRecord,appConfig:A,fieldName:F}),re=(0,Q.useMemo)(()=>{if(!R)return;let e=me(R),t=e===vu.ARRAY?Ma(R):void 0,n=te??(e===vu.ENUM?Xo(R):void 0)??(t&&me(t)===vu.ENUM?Xo(t):void 0);return eu(ne,n)},[R,te,ne]),ie=!!R&&!ee&&me(R)===vu.STRING&&xt(R)===z.ORGANIZATION_ROLE,ae=ie?void 0:re,oe=ie?P?.roleGrantPickerOffersByField?.[F]:void 0,se=(0,Q.useMemo)(()=>oe?re?re.filter(e=>oe.includes(e)):oe:re,[re,oe]),ce=ae?ee?ee.filter(e=>ae.includes(e)):ae:ee??te,le=P?.reportRequestFieldOffer,ue=!!P?.requestFieldOffers?.[F];(0,Q.useEffect)(()=>{ue&&le?.(F,ne)},[ue,le,F,ne]);let de=hr.labelDictionaryPath(F),fe=n??P?.fieldLabels?.[de]??e,pe=r??P?.fieldDescriptions?.[de],he=i??P?.fieldTooltips?.[de],_e=u??P?.enumLabels?.[de]??(d?void 0:I?.labels),ve=m??P?.disabled,ye=S??P?.fileUploadContext,be=P?.generatedFieldOverrides?.[F],xe=[...Object.keys(P?.contextFieldValues??{}),...P?.hiddenFieldNames??[],...Object.keys(P?.generatedFieldOverrides??{})],Se=be==null&&Fhe(F,xe),Ce=R?un(R):void 0,we=F.includes(`.`)?F.slice(0,F.lastIndexOf(`.`)):``,Te=Ce?Ihe(Ce,we):void 0,Ee=Te?hr.getShowWhenWatchFields(Te):[],De=VC({name:Ee.length>0?Ee:[]}),Oe=Array.isArray(De)?De:Ee.length>0?[De]:[],ke=VC({name:P?.inheritanceConfig?.discriminatorField?[P.inheritanceConfig.discriminatorField]:[]}),Ae=Array.isArray(ke)?ke[0]:ke,je=F.match(/^[^.[\]]+/)?.[0]??F,Me=(0,Q.useMemo)(()=>{if(!Te)return!0;let e=Object.fromEntries(Ee.map((e,t)=>[e,Oe[t]]));return hr.evaluateShowWhen(Te,e)},[Te,Ee,Oe]),Ne=(0,Q.useMemo)(()=>!P?.inheritanceConfig?.discriminatorField||hr.computeFieldVisibility(P.schema,je,{[P.inheritanceConfig.discriminatorField]:Ae},P.inheritanceConfig),[Ae,P?.inheritanceConfig,P?.schema,je]),Pe=R?me(R):vu.STRING,Fe=R?Xc(R):void 0,B=P?.hostResolvesRelationshipRoots===!0,Le=(0,Q.useMemo)(()=>{if(!(B||!R||!D.resourceType||Pe!==vu.OBJECT&&Pe!==vu.ARRAY))return vj({resourceType:D.resourceType,fieldName:F,operationType:D.operationType,registry:k})},[B,R,D.operationType,D.resourceType,F,k,Pe]),Re=Pe===vu.STRING||Pe===vu.CODE||Pe===vu.NUMBER||Pe===vu.BIGINT||Pe===vu.MONEY||Pe===vu.BIGDECIMAL,ze=R?Phe(R,p,D.validationMode,Pe):p??D.validationMode??ta.ON_BLUR,Be=h??P?.readOnly??(R?Wre(R,D.operationType):!1),Ve=che[lhe({schemaKind:D?.schemaKind,rootSchema:P?.schema,fieldName:F})],He=Ve.normalizeClearedValue,Ue=R?Ve.isClearable(R):!1,{createBlurHandler:We,createChangeHandler:Ge,autosaveFieldState:Ke,autosaveError:qe,handleRetrySave:Je,saveFieldNow:Ye}=jhe(E,F,ze,Re,R,He),Xe=C??(P?void 0:Fe?.autoFocus),Ze=Fe,Qe=Ohe({identifier:Ze?.autoComplete,modifier:Ze?.autoCompleteModifier}),$e=(0,Q.useMemo)(()=>R?!xre(R):!1,[R]),et=Q.useContext(ET),tt=(0,Q.useRef)(Symbol(`file-field-validation`)).current;(0,Q.useEffect)(()=>()=>{et?.delete(tt)},[et,tt,F]);let{setError:nt,clearErrors:rt,getFieldState:it}=E,at=(0,Q.useCallback)(e=>{let t=e=>{let t=it(F).error;(t?.type!==`file-validation`||t.message!==e)&&nt(F,{type:iI,message:e})};if(e)et?.set(tt,{name:F,message:e}),t(e);else{et?.delete(tt);let e=[...et?.values()??[]].find(e=>e.name===F);if(e){t(e.message);return}it(F).error?.type===`file-validation`&&rt(F)}},[nt,rt,it,F,et,tt]),ot=E.getFieldState(F,E.formState),st=oI(ot,E.formState.isSubmitted,ze,j),{formChromeMode:ct,sectionChromeMode:lt}=eT(),ut=UL(O.autoRender?.autoFieldChrome),dt=Fe?.chromeMode??lt??ct??ut,ft=a??WL(O.autoRender?.autoLabelPlacement),pt=c??GL(O.autoRender?.autoFieldDensity),mt=l!==!1&&O.autoRender?.autoErrorPlacement===`summary-at-surface-top`,ht=ne.kind===lne.NOT_OFFERED,gt=!!R&&(Se||!Me||!Ne||ht);if(yk(!!R&&!gt),(0,Q.useEffect)(()=>{gt&&!L&&F&&E.getValues(F)!==void 0&&E.setValue(F,void 0,{shouldDirty:!1,shouldValidate:!1})},[gt,L,F,E]),(0,Q.useEffect)(()=>{if(!re||!F)return;let e=E.getValues(F);if(e==null)return;let t=new Set(re);if(Array.isArray(e)){let n=e.filter(e=>t.has(String(e)));n.length!==e.length&&E.setValue(F,n,{shouldDirty:!0,shouldValidate:!1})}else t.has(String(e))||E.setValue(F,void 0,{shouldDirty:!0,shouldValidate:!1})},[re,F,E]),!R||gt)return null;if(be!=null)return(0,$.jsx)($.Fragment,{children:be});let _t=Fe?.forceHide,vt={mode:dt,label:fe,description:pe,tooltip:he,labelPlacement:ft,error:st,required:$e,hideLabel:o??_t?.label,hideDescription:s??_t?.description,hideError:_t?.error||mt,saveState:Ke,saveErrorMessage:qe,onRetrySave:Je,onSaveFieldNow:Ye,fieldName:F,disabled:ve,className:g},yt={schema:R,clearable:Ue,name:F,disabled:ve,readOnly:Be,validationMode:ze,required:$e,autoFocus:Xe||void 0,controlSize:pt},St=!(!Le||Le.semantics.nature===wi.COMPOSITION&&Le.nestedMutationConfig),Ct=Pe===vu.RANGE_NUMBER||Pe===vu.RANGE_DATE||Pe===vu.RANGE_DATETIME||Pe===vu.RANGE_TIME||Pe===vu.RANGE_BIGDECIMAL||Pe===vu.RANGE_MONEY;if(Ct){let e=An(R),t=f??Fe?.component??mte(e??bt.NUMBER);return(0,$.jsx)(UC,{name:F,control:E.control,shouldUnregister:L,render:({field:e})=>{let n=We(e.onBlur),r=Ge(e.onChange),i={...yt,value:qL(E.getValues(F)),onBlur:n},a=(()=>{let n=e.ref;switch(t){case Ie.RANGE_SLIDER:return(0,$.jsx)(YM,{...i,onValueChange:r,ref:n});case Ie.DATE_RANGE:return(0,$.jsx)(fN,{...i,onChange:r,ref:n});case Ie.DATETIME_RANGE:return(0,$.jsx)(hN,{...i,onChange:r,ref:n});case Ie.TIME_RANGE:return(0,$.jsx)(vN,{...i,onChange:r,ref:n});case Ie.BIGDECIMAL_RANGE:return(0,$.jsx)(mL,{...i,onChange:r,ref:n});case Ie.MONEY_RANGE:return(0,$.jsx)(gL,{...i,onChange:r,ref:n});default:return{[vu.RANGE_BIGDECIMAL]:(0,$.jsx)(mL,{...i,onChange:r,ref:n}),[vu.RANGE_MONEY]:(0,$.jsx)(gL,{...i,onChange:r,ref:n}),[vu.RANGE_DATE]:(0,$.jsx)(fN,{...i,onChange:r,ref:n}),[vu.RANGE_DATETIME]:(0,$.jsx)(hN,{...i,onChange:r,ref:n}),[vu.RANGE_TIME]:(0,$.jsx)(vN,{...i,onChange:r,ref:n}),[vu.RANGE_NUMBER]:(0,$.jsx)(lN,{...i,onChange:r,ref:n})}[Pe]??(0,$.jsx)(YM,{...i,onValueChange:r,ref:n})}})();return(0,$.jsx)(GM,{...vt,children:a})}})}let wt=e=>(0,$.jsx)(AE,{fieldName:F,label:fe,disabled:ve,onSaveFieldNow:Ye,children:e});if(Pe===vu.OBJECT){if(St)return null;let e=cd(R),t=e?Vme(A,e):void 0;return t?Tt(e=>(0,$.jsx)(yI,{...yt,types:t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):wt((0,$.jsx)(bN,{name:F,schema:R,label:fe,hideLabel:o,description:pe,disabled:ve,className:g,renderField:y,excludedChildKeys:w}))}if(Pe===vu.RECORD){let e=vi(R);return e?wt((0,$.jsx)(CN,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,valueSchema:e,keySchema:null})):null}if(Pe===vu.MAP){let e=Pi(R);return e?wt((0,$.jsx)(CN,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,valueSchema:e.valueSchema,keySchema:e.keySchema})):null}if(Pe===vu.ARRAY)return St?null:(0,$.jsx)(gI,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,renderField:y,sectionAppearance:b,objectItemLayout:x,enumLabels:_e,allowedValues:ce});function Tt(e,t){return(0,$.jsx)(UC,{name:F,control:E.control,shouldUnregister:L,render:({field:n})=>(0,$.jsx)(GM,{...vt,...t,children:e({value:qL(E.getValues(F)),onChange:Ge(n.onChange),onBlur:We(n.onBlur),ref:n.ref})})})}if(ce){let e=ar(R),t=t=>{if(!e)return;let n=Pc(e,t),r=M(n);return r===n?void 0:r},n=ce.map(e=>({value:e,label:_e?.[e]??t(e)??e}));return Tt(e=>(0,$.jsx)(rI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,options:n}))}let Et=f;if(Et&&!Ct)switch(Et){case Ie.INPUT:case Ie.TEXTAREA:return Tt(e=>(0,$.jsx)(UI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v}));case Ie.SLIDER:return Tt(e=>(0,$.jsx)(GI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));case Ie.CHECKBOX:case Ie.SWITCH:return Tt(e=>(0,$.jsx)(OI,{...yt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.SELECT:case Ie.RADIO_GROUP:case Ie.CHECKBOX_GROUP:{let e=_e?ZL(R,_e):void 0;return Tt(t=>(0,$.jsx)(rI,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}case Ie.DATE:return Tt(e=>(0,$.jsx)(tN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.DATETIME:return Tt(e=>(0,$.jsx)(iN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.TIME:return Tt(e=>(0,$.jsx)(sN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}))}if(Pe===vu.MONEY)return Tt(e=>(0,$.jsx)(JI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===vu.DURATION)return Tt(e=>(0,$.jsx)(XI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===vu.PHONE)return Tt(e=>(0,$.jsx)(rL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe}));if(Pe===vu.ADDRESS){let e=Object.fromEntries(Xr().map(e=>[e,oI({...E.getFieldState(`${F}.${e}`,E.formState),isTouched:ot.isTouched,isDirty:ot.isDirty},E.formState.isSubmitted,ze,j)])),t=ot.error;return Tt(t=>(0,$.jsx)(cL,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,partErrors:e,renderLookup:e=>(0,$.jsx)(Ex,{host:e,addressSchema:R,fieldName:F})}),t!==void 0&&(t.message!==void 0||t.type!==void 0)?void 0:{error:void 0})}if(Pe===vu.BIGDECIMAL)return Tt(e=>(0,$.jsx)(dL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===vu.CODE)return Tt(e=>(0,$.jsx)(fL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===vu.FILE){let e=hr.normalizeSchemaFieldPath(F),t=ye?.[e],n=eo(R);return!n&&Ahe(t)?Tt(e=>(0,$.jsx)(HL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,endpoints:t,onValidationError:at}),{wideControl:!0}):n?(0,$.jsx)(GM,{...vt,children:(0,$.jsx)(JL,{inputProps:yt,value:E.getValues(F),isGeneratedPdfField:!0})}):Tt(e=>(0,$.jsx)(GM,{...vt,children:(0,$.jsx)(JL,{inputProps:yt,value:e.value,isGeneratedPdfField:!1,onBlur:e.onBlur,inputRef:e.ref})}))}if(Io(R))return Tt(e=>(0,$.jsx)(_I,{...yt,quickCreateSourceFieldName:T,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===vu.BOOLEAN)return Tt(e=>(0,$.jsx)(OI,{...yt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===vu.STRING)return Tt(e=>(0,$.jsx)(UI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v,...ie&&se?{offeredValues:se}:{}}));if(Pe===vu.NUMBER||Pe===vu.BIGINT)return Tt(e=>(0,$.jsx)(GI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===vu.ENUM){let e=_e?ZL(R,_e):void 0;return Tt(t=>(0,$.jsx)(rI,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}return Pe===vu.DATE?Tt(e=>(0,$.jsx)(tN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Pe===vu.DATETIME?Tt(e=>(0,$.jsx)(iN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Pe===vu.TIME?Tt(e=>(0,$.jsx)(sN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):(0,$.jsx)(GM,{...vt,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Unsupported field type:`}),(0,$.jsx)(`code`,{className:`bg-destructive/20 px-item-xs rounded`,children:Pe}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e,`)`]})]})})}YL.displayName=`FormField`;var XL=YL;wk(XL,xk.FIELD_SLOT);function ZL(e,t){return Xo(e).map(e=>({value:e,label:t?.[e]??e}))}var QL=as.getLogger();function $L(e,t){let n=e instanceof fj?e.mutationError:void 0,r=n?n.validationErrors?jM({httpStatus:n.status??400,validationErrors:n.validationErrors}):null:jM(e);if(!r)return;let i=Object.keys(r.validationErrors).find(e=>e===t||e.startsWith(`${t}.`));return i===void 0?void 0:r.validationErrors[i]}var eR=QL.debugByType(`DisplayFieldEditable`);QL.setDebugTypeLogging(`DisplayFieldEditable`,!1);function tR(e,t){return t.some(t=>e===t||e.startsWith(t+`[`)||wM(t,e))}function Rhe(e){return!!(e?.upload||e?.override)}var zhe={mode:`direct`,saveOn:`blur`,showSaveButton:!1,showCancelButton:!0};function nR(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,className:p,hideLabel:m,hideDescription:h,resolvedChromeMode:g,resolvedLabelPlacement:v,resolvedEmptyValue:y,fileUploadContext:b,wideValue:x,announceName:S,doInlineUpdate:C,rmm:w}=e,{tComponent:T,tErrorValidation:E,isReady:D}=K({component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_BUTTON]}),{getRecipe:O}=Wg(),{renderIcon:k}=Mf(),A=dj(),{registry:j}=fm(),M=O(cc.INDICATOR,xl.SUCCESS),[N,P]=(0,Q.useState)(NT.DISPLAY),[F,I]=(0,Q.useState)(null),ee=(0,Q.useRef)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),[te,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(!1),le=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{le.current!==r&&(oe(!1),ce(!1),ie(null),le.current=r)},[r]);let ue=N!==NT.DISPLAY,de=N===NT.SAVING,fe=w??null,pe=(0,Q.useSyncExternalStore)(fe?.subscribe??DM,fe?.getSnapshot??OM),me=Jie(t)??zhe,he=(0,Q.useMemo)(()=>{if(i&&A.resourceType)return bj({resourceType:A.resourceType,fieldName:i,operationType:W.UPDATE,registry:j})},[i,j,A.resourceType]),ge=(0,Q.useMemo)(()=>{if(i)return b?.[hr.normalizeSchemaFieldPath(i)]},[i,b]),_e=n!==vu.FILE||!eo(t)&&Rhe(ge),ve=(0,Q.useMemo)(()=>i?.includes(`.`)?i.split(`.`).pop():i??`value`,[i]),ye=(0,Q.useMemo)(()=>Md({[ve]:t}),[ve,t]),be=Fw({resolver:bT(ye),defaultValues:{[ve]:r},mode:jT});(0,Q.useEffect)(()=>{N===NT.DISPLAY&&(be.reset({[ve]:r}),I(null))},[r,N,be,ve,t]),(0,Q.useEffect)(()=>{if(ue&&ee.current){let e=setTimeout(()=>{let e=ee.current?.querySelector(`input, textarea, select, [tabindex]:not([tabindex="-1"])`);e&&e.focus()},0);return()=>clearTimeout(e)}},[ue]),(0,Q.useEffect)(()=>{N===NT.ERROR&&L.current?.focus()},[N]),(0,Q.useEffect)(()=>()=>{R.current!=null&&clearTimeout(R.current)},[]);let xe=(0,Q.useCallback)(async()=>{if(i){if(!await be.trigger(ve))be.setValue(ve,be.getValues(ve),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),P(NT.EDITING);else{I(null),P(NT.SAVING);try{let e=be.getValues(ve);await C(i,e),eR(`inline edit save`,{fieldName:i,value:e}),P(NT.SAVED),R.current=setTimeout(()=>{P(NT.DISPLAY),R.current=null},500)}catch(e){if(e instanceof fj&&e.mutationError?.type===pE.CONFLICT)return;let t=$L(e,i);if(t!==void 0){let e=_(t)?E(t.code,`msg`,t.params):t;be.setError(ve,{type:oT,message:e}),P(NT.EDITING);return}I(T(B.LOW_LEVEL_FORM_FIELD,`save_failed`)),P(NT.ERROR)}}}},[be,ve,i,C,T,E]);(0,Q.useEffect)(()=>{let e=be.watch((e,{name:t})=>{t===ve&&be.getFieldState(ve).error?.type===`server`&&be.clearErrors(ve)});return()=>e.unsubscribe()},[be,ve]);let Se=(0,Q.useCallback)(()=>{i&&eR(`inline edit cancel`,{fieldName:i}),be.reset({[ve]:r}),I(null),P(NT.DISPLAY)},[be,ve,r,i]),Ce=(0,Q.useCallback)(async e=>{if(i){ie(e),I(null),ne(!0);try{await C(i,e),eR(`inline boolean toggle`,{fieldName:i,value:e})}catch(e){if(ie(null),!(e instanceof fj&&e.mutationError?.type===pE.CONFLICT)){let t=$L(e,i);I(t===void 0?T(B.LOW_LEVEL_FORM_FIELD,`save_failed`):_(t)?E(t.code,`msg`,t.params):t)}}finally{ne(!1)}}},[i,C,T,E]),we=(0,Q.useRef)(T);we.current=T,(0,Q.useEffect)(()=>{if(!fe||!pe?.lastEvent||!i)return;let e=pe.lastEvent;if(e.id!==z.current)switch(z.current=e.id,e.type){case uE.REMOTE_UPDATE:tR(i,e.changedFields)&&N===NT.EDITING&&(eR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se());break;case uE.CONFLICT_RESET:{let t=EM(e.currentData,i);be.reset({[ve]:t}),N!==NT.DISPLAY&&(eR(`RMM event resetting inline edit after conflict`,{fieldName:i,eventType:e.type}),I(we.current(B.LOW_LEVEL_FORM_FIELD,`field_reset_after_conflict`)),P(NT.ERROR));break}case uE.MUTATION_RESULT:e.result.success&&e.source.type!==fE.DISPLAY&&e.result.savedFields&&tR(i,e.result.savedFields)&&N===NT.EDITING&&(eR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se());break;case uE.RESOURCE_DELETED:N===NT.EDITING&&(eR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se())}},[pe?.lastEvent?.id,fe,i,N,ve,be,Se]);let Te=(0,Q.useCallback)(e=>{if(me.saveOn===`blur`&&ee.current){let t=e.relatedTarget;ee.current.contains(t)||xe()}},[me.saveOn,xe]),Ee=n===vu.CODE||Vne(t),De=(0,Q.useCallback)(e=>{e.key===`Escape`?(e.preventDefault(),Se()):e.key===`Enter`&&(Ee?(e.ctrlKey||e.metaKey)&&(e.preventDefault(),xe()):e.shiftKey||(e.preventDefault(),xe()))},[xe,Se,Ee]);function Oe(){return(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:p,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,emptyValue:y,fileUploadContext:b,showAllArrayItems:ae,onExpandArrayItems:()=>oe(!0),showAllObjectFields:se,onExpandObjectFields:()=>ce(!0)})}function ke(){let e=re??!!r;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-element`,children:[te&&(0,$.jsx)(`span`,{className:`text-muted-foreground`,"aria-hidden":`true`,children:k(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`})}),F&&!te&&(0,$.jsx)(`span`,{className:`text-destructive text-xs`,role:`alert`,children:F}),(0,$.jsx)(SI,{checked:e,onCheckedChange:Ce,disabled:te,"aria-label":a||i||void 0})]})}function Ae(){return(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,className:U(`group relative inline-flex items-center gap-element h-auto px-card-sm py-item-xs`),onClick:()=>{i&&eR(`inline edit start`,{fieldName:i}),P(NT.EDITING)},"aria-label":T(B.LOW_LEVEL_FORM_FIELD,`editField`,{label:a||i||``}),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:Oe()}),(0,$.jsx)(`span`,{className:`text-muted-foreground opacity-0 group-hover:opacity-100 motion-safe:transition-opacity`,children:k(H.EDIT,{size:ca.SM})})]})}function je(){let e=i?`inline-edit-error-${i.replace(/\./g,`-`)}`:void 0,n=N===NT.ERROR&&!!F;return(0,$.jsx)(aT,{schema:ye,schemaKind:nT.MAIN_SCHEMA,form:be,resourceType:A.resourceType,resourceId:A.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:A.contextResourceIdentifiers,navigationZone:A.navigationZone,children:(0,$.jsxs)(`div`,{ref:ee,className:`inline-flex flex-col gap-item-xs min-w-[200px]`,onBlur:Te,onKeyDown:De,"aria-describedby":n?e:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(XL,{name:ve,quickCreateSourceFieldName:he?.sourceFieldName,schema:t,label:``,description:``,disabled:de,placeholder:a,enumLabels:l,respectSurfaceErrorPlacement:!1,fileUploadContext:ge?{[ve]:ge}:void 0,className:`inline-edit-field`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-item-xs shrink-0 pt-item-xs`,children:[N===NT.SAVED&&(0,$.jsx)(`div`,{className:M.base,"aria-hidden":`true`,children:k(H.CHECK,{size:ca.SM})}),me.showSaveButton&&N!==NT.SAVED&&(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.DEFAULT,onClick:xe,disabled:de,"aria-label":T(B.LOW_LEVEL_BUTTON,`save`),children:N===NT.SAVING?k(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):k(H.CHECK,{size:ca.SM})}),me.showCancelButton&&(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.GHOST,onClick:Se,disabled:de,"aria-label":T(B.LOW_LEVEL_BUTTON,`cancel`),children:k(H.CLOSE,{size:ca.SM})})]})]}),n&&(0,$.jsxs)(jD,{id:e,variant:`destructive`,role:`alert`,className:`flex items-center gap-element py-card-sm`,children:[k(H.ERROR,{size:ca.SM,className:`shrink-0`}),(0,$.jsx)(ND,{className:`flex-1 m-0`,children:(0,$.jsx)(Z,{children:F})}),(()=>{let e=T(B.LOW_LEVEL_BUTTON,`retry`);return(0,$.jsx)(X,{ref:L,type:`button`,size:Y.SM,variant:J.GHOST,onClick:xe,disabled:de,"aria-label":e,title:e,children:k(H.TRY_AGAIN,{size:ca.SM})})})()]})]})})}if(!D)return null;let Me;return Me=n===vu.BOOLEAN&&i?ke():ue&&i&&_e?je():_e?Ae():Oe(),(0,$.jsx)(cj,{mode:g,label:a,description:o,tooltip:s,provenance:c,name:i,labelPlacement:v,hideLabel:m,hideDescription:h,wide:x,announceName:S,className:p,children:Me})}nR.displayName=`DisplayFieldEditable`;function rR({name:e,schema:t,value:n,label:r,description:i,doInlineUpdate:a,renderField:o,sectionAppearance:s,displayChromeMode:c,objectItemLayout:l,enumLabels:u,hideLabel:d}){let f=(0,Q.useMemo)(()=>e.includes(`.`)?e.split(`.`).pop():e,[e]),p=(0,Q.useMemo)(()=>Md({[f]:t}),[f,t]),m=(0,Q.useMemo)(()=>({[f]:Array.isArray(n)?n:[]}),[f,n]),h=Fw({defaultValues:m,mode:`onChange`}),g=(0,Q.useRef)(null),_=(0,Q.useRef)(JSON.stringify(Array.isArray(n)?n:[]));(0,Q.useEffect)(()=>{let e=Array.isArray(n)?n:[],t=JSON.stringify(e);if(t===_.current)return;let r=typeof document<`u`?document.activeElement:null;r&&g.current?.contains(r)||(h.reset({[f]:e}),_.current=t)},[n,h,f]);let v=dj(),y=e.includes(`.`)?e.slice(0,e.lastIndexOf(`.`)):void 0,b=nE(p,{resourceType:v.resourceType,operationId:W.UPDATE},m,`edit`,{fieldPathPrefix:y}),x=(0,Q.useMemo)(()=>({schema:p,fieldLabels:b.fieldLabels,fieldDescriptions:b.fieldDescriptions,fieldTooltips:b.fieldTooltips,enumLabels:b.enumLabels,sectionLabels:b.sectionLabels,sectionDescriptions:b.sectionDescriptions,groupLabels:b.groupLabels,wizardStepLabels:b.wizardStepLabels,wizardStepDescriptions:b.wizardStepDescriptions,operationType:W.UPDATE,isExisting:!0}),[p,b]),S=d===!0||c===Ic.HIDDEN||c===Ic.COMPACT,C=(0,Q.useMemo)(()=>({enabled:!0}),[]),{tComponent:w}=K({component:B.RESOURCES_LAYOUTS_CREATE}),T=(0,Q.useMemo)(()=>({errorNetwork:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[w]),E=(0,Q.useCallback)(async()=>{await a(e,h.getValues(f))},[a,e,h,f]);return(0,$.jsx)(KC,{...h,children:(0,$.jsx)(aT,{schema:p,form:h,resourceType:v.resourceType,resourceId:v.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:v.contextResourceIdentifiers,navigationZone:v.navigationZone,children:(0,$.jsx)(LT,{value:x,children:(0,$.jsx)(DE,{onSave:E,labels:T,config:C,children:(0,$.jsx)(`div`,{ref:g,children:(0,$.jsx)(gI,{name:f,schema:t,label:r,description:i,renderField:o,sectionAppearance:s,objectItemLayout:l,enumLabels:u,hideLabel:S,chromeMode:c===Ic.SETTINGS_ROW?Wc.SETTINGS_ROW:void 0})})})})})})}rR.displayName=`DisplayFieldEditableArray`;var Bhe=rR,Vhe=Bd({slug:bd().regex(hre,`A slot slug is lowerCamelCase with no separators.`).max(40).refine(e=>e!==Vo,{error:`"${Vo}" is reserved: the environment builder emits ${Die(`example`)} itself to say an environment has no access to an instance. A slot of that name would make "declared absent" indistinguishable from an address whose value happens to be false.`}),required:Od(),description:bd().min(1)}),iR=e=>Pd(Vhe).superRefine((t,n)=>{let r=new Set;for(let[i,a]of t.entries())r.has(a.slug)&&n.addIssue({code:`custom`,path:[i,`slug`],message:`Duplicate ${e} slot "${a.slug}".`}),r.add(a.slug),i>0&&t[i-1].slug.localeCompare(a.slug)>=0&&n.addIssue({code:`custom`,path:[i,`slug`],message:`${e} slots must be sorted by slug.`})});Bd({addressSlots:iR(`credential address`),secretSlots:iR(`credential secret`)});var Hhe={[qs.ODOO_API_KEY_IN_ARGS]:{addressSlots:[{slug:`login`,required:!0,description:"The Odoo user login the API key belongs to. `common.authenticate` resolves it to the uid every `execute_kw` call then acts as, so it decides what the application can read. JSON-RPC only: a JSON-2 key names its user itself."}],secretSlots:[{slug:`apiKey`,required:!0,description:"Odoo external-API key (Settings → Users → API Keys). It replaces the password in `common.authenticate` and rides as a positional argument of every `execute_kw` call."}]},[qs.API_KEY_HEADER]:{addressSlots:[],secretSlots:[{slug:`apiKey`,required:!0,description:`The static key this deployment presents. It travels in the header the vendor facet names — the operator never chooses the header, only supplies the key.`}]},[qs.API_KEY_QUERY]:{addressSlots:[],secretSlots:[{slug:`apiKey`,required:!0,description:`The static key this deployment presents, appended as the query parameter the vendor facet names. Weaker than a header — a URL reaches access logs and proxy logs — so prefer a header kind when the vendor offers one.`}]},[qs.BASIC]:{addressSlots:[{slug:`username`,required:!0,description:`The user this deployment authenticates as (SAP calls it a communication user). It names an identity rather than proving one, so it is authored in the environment config beside the base URL. It may not contain ":" — RFC 7617 makes the colon the delimiter.`}],secretSlots:[{slug:`password`,required:!0,description:`That user's password. Half of one credential; rotate it with the username only if the vendor requires.`}]},[qs.OAUTH2_CLIENT_CREDENTIALS_SECRET]:{addressSlots:[{slug:`audience`,required:!1,description:"The `audience` / `resource` parameter, when the vendor requires one to scope the token (Entra names the resource; Salesforce does not)."},{slug:`clientId`,required:!0,description:`The registered application (client) id. Names WHICH client, so it is addressing rather than proof.`},{slug:`scope`,required:!1,description:`Space-delimited scopes to request. Omitted when the vendor derives them from the client registration.`},{slug:`tokenUrl`,required:!0,description:`The token endpoint's absolute URL. Kind-owned: no vendor would declare it if the instance were reached with a static key.`}],secretSlots:[{slug:`clientSecret`,required:!0,description:`The client secret issued with the client id. This is the half that proves the identity, and the only half that is never printed.`}]},[qs.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE]:{addressSlots:[{slug:`audience`,required:!1,description:"The `audience` / `resource` parameter when the vendor requires one."},{slug:`certificateKeyId`,required:!1,description:"The key id the vendor assigned to this certificate, placed in the assertion's protected header as `kid` (NetSuite issues one at upload). REQUIRED when the vendor facet declares the key-id header policy; unused otherwise."},{slug:`certificatePem`,required:!1,description:"The PUBLIC certificate in PEM, used to derive the `x5t` thumbprint the assertion header carries. REQUIRED when the vendor facet declares the thumbprint header policy; unused otherwise. Public material, so it is an address slot rather than a secret."},{slug:`clientId`,required:!0,description:"The registered application (client) id — the assertion's `iss` and `sub`."},{slug:`scope`,required:!1,description:`Space-delimited scopes to request.`},{slug:`tokenUrl`,required:!0,description:"The token endpoint's absolute URL, and the assertion's `aud`."}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, that signs the client assertion. An encrypted key is refused by name: the secret channel is the protection, and a passphrase stored beside the key it protects protects nothing.`}]},[qs.OAUTH2_JWT_BEARER]:{addressSlots:[{slug:`audience`,required:!1,description:"The assertion's `aud`, when it differs from the token endpoint (Salesforce wants the login host)."},{slug:`clientId`,required:!0,description:"The connected app's consumer key — the assertion's `iss`."},{slug:`scope`,required:!1,description:`Space-delimited scopes to request.`},{slug:`subject`,required:!1,description:"The user the assertion is made FOR — its `sub`. REQUIRED for this grant and declared optional here only because the facet's offer is what asserts it; a service account's username on the vendor side."},{slug:`tokenUrl`,required:!0,description:`The token endpoint's absolute URL.`}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, that signs the assertion. An encrypted key is refused by name.`}]},[qs.MTLS_CLIENT_CERTIFICATE]:{addressSlots:[{slug:`caBundlePem`,required:!1,description:`The CA certificates, in PEM, that the SERVER's certificate must chain to, when the system of record is served by a private CA. Omitted when its certificate chains to a public CA the platform already trusts. Public material, so an address slot.`},{slug:`certificatePem`,required:!0,description:`The CLIENT certificate, in PEM, that the engine presents in the TLS handshake (SAP calls its holder an X.509 communication user). Public material, so an address slot. Refused at startup outside its validity window.`}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, of that client certificate. An encrypted key is refused by name: the secret channel is the protection.`}]}},Uhe=function(e){return e.KEY_ID_SUPPLIED=`key-id-supplied`,e.X509_THUMBPRINT_DERIVED=`x509-thumbprint-derived`,e}({}),Whe=function(e){return e.REQUEST_BODY=`request-body`,e.BASIC_HEADER=`basic-header`,e}({}),aR=function(e){return e.RS256=`RS256`,e.RS384=`RS384`,e.RS512=`RS512`,e.PS256=`PS256`,e.ES256=`ES256`,e.ES384=`ES384`,e.ES512=`ES512`,e}({}),oR=Ed().int().min(30).max(86400),sR={dialects:Pd(kd(Wo)).min(1).optional()},cR=fae(`kind`,[Bd({kind:wd(qs.ODOO_API_KEY_IN_ARGS).systemEnum(`SystemOfRecordCredentialKind`),...sR}),Bd({kind:wd(qs.API_KEY_HEADER).systemEnum(`SystemOfRecordCredentialKind`),...sR,headerName:bd().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/,`A header name is an RFC 9110 token.`).max(64),valuePrefix:bd().max(32).optional()}),Bd({kind:wd(qs.API_KEY_QUERY).systemEnum(`SystemOfRecordCredentialKind`),...sR,parameterName:bd().regex(/^[A-Za-z0-9_.-]+$/,`A query parameter name is alphanumeric with -._`).max(64)}),Bd({kind:wd(qs.BASIC).systemEnum(`SystemOfRecordCredentialKind`),...sR}),Bd({kind:wd(qs.OAUTH2_CLIENT_CREDENTIALS_SECRET).systemEnum(`SystemOfRecordCredentialKind`),...sR,clientAuthentication:kd(Whe),tokenLifetimeFallbackSeconds:oR}),Bd({kind:wd(qs.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...sR,assertionHeaderPolicy:kd(Uhe),assertionSigningAlgorithm:kd(aR),assertionLifetimeSeconds:Ed().int().min(30).max(600),tokenLifetimeFallbackSeconds:oR}),Bd({kind:wd(qs.OAUTH2_JWT_BEARER).systemEnum(`SystemOfRecordCredentialKind`),...sR,assertionSigningAlgorithm:kd(aR),assertionLifetimeSeconds:Ed().int().min(30).max(600),tokenLifetimeFallbackSeconds:oR}),Bd({kind:wd(qs.MTLS_CLIENT_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...sR})]),Ghe=function(e){return e.SKIP=`skip`,e.NEXT_LINK_ONLY=`next-link-only`,e}({}),lR=function(e){return e.FIELD=`field`,e.PATH_SEGMENT=`path-segment`,e}({}),Khe=function(e){return e.SCALAR=`scalar`,e.MANY2ONE_PAIR=`many2one-pair`,e}({}),uR=Bd({kind:kd(lR),remoteField:bd().min(1).max(120),codec:kd(yo),valueShape:kd(Khe)}),dR=function(e){return e.CSRF_TOKEN_HANDSHAKE=`csrf-token-handshake`,e}({}),qhe=`@odata.etag`;Bd({vendor:bd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),dialects:Pd(kd(Wo)).min(1),addressSlots:iR(`vendor address`),credentialOffers:Pd(cR).min(1),odataListPaging:kd(Ghe).optional(),partition:uR.optional(),incrementalExtractionModes:Pd(kd(kt)).optional(),odataExpiredChangePositionErrorCodes:Pd(bd().regex(Fs)).optional(),actionCallShapes:Pd(kd(mie)).optional(),rowVersionField:bd().min(1).max(120).optional(),writePrerequisites:Pd(kd(dR)).optional()}).superRefine((e,t)=>{e.rowVersionField!==void 0&&e.dialects.includes(Wo.ODATA)&&e.rowVersionField!==`@odata.etag`&&t.addIssue({code:`custom`,path:[`rowVersionField`],message:`An OData vendor's row version is its entity tag, "${qhe}" — got "${e.rowVersionField}".`});for(let[n,r]of(e.actionCallShapes??[]).entries())e.dialects.includes(dl[r])||t.addIssue({code:`custom`,path:[`actionCallShapes`,n],message:`Action call shape "${r}" is spoken over ${dl[r]}, which this vendor's dialects do not list.`});e.odataExpiredChangePositionErrorCodes!==void 0&&!(e.incrementalExtractionModes??[]).includes(kt.ODATA_DELTA_LINK)&&t.addIssue({code:`custom`,path:[`odataExpiredChangePositionErrorCodes`],message:`An expired change-position code is read only by the "${kt.ODATA_DELTA_LINK}" mode, which this vendor's incrementalExtractionModes do not list.`});let n=new Set;for(let[r,i]of e.dialects.entries())n.has(i)&&t.addIssue({code:`custom`,path:[`dialects`,r],message:`Duplicate dialects member "${i}".`}),n.add(i);let r=new Set;for(let[n,i]of e.credentialOffers.entries())r.has(i.kind)&&t.addIssue({code:`custom`,path:[`credentialOffers`,n],message:`Duplicate credentialOffers member "${i.kind}".`}),r.add(i.kind);for(let[n,r]of e.credentialOffers.entries())for(let i of r.dialects??[])e.dialects.includes(i)||t.addIssue({code:`custom`,path:[`credentialOffers`,n,`dialects`],message:`Credential offer "${r.kind}" is scoped to ${i}, which this vendor's dialects do not list.`});for(let[n,r]of e.dialects.entries())e.credentialOffers.some(e=>Jhe(e,r))||t.addIssue({code:`custom`,path:[`dialects`,n],message:`No credential offer serves dialect "${r}".`});let i=new Set(e.addressSlots.map(e=>e.slug));for(let n of e.credentialOffers)for(let e of Hhe[n.kind].addressSlots)i.has(e.slug)&&t.addIssue({code:`custom`,path:[`addressSlots`],message:`Address slot "${e.slug}" is declared by this vendor AND by credential kind "${n.kind}" — one slot has one owner.`})}),Bd({vendor:bd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),partition:uR.optional(),credentialOffers:Pd(cR).min(1).optional()}).superRefine((e,t)=>{e.partition===void 0&&e.credentialOffers===void 0&&t.addIssue({code:`custom`,path:[],message:`A facet augmentation that adds nothing is refused: declare a partition, credential offers, or both.`});let n=new Set;for(let[r,i]of(e.credentialOffers??[]).entries())n.has(i.kind)&&t.addIssue({code:`custom`,path:[`credentialOffers`,r],message:`Duplicate credentialOffers member "${i.kind}".`}),n.add(i.kind)});function Jhe(e,t){return e.dialects===void 0||e.dialects.includes(t)}Object.freeze({[Wo.ODATA]:{translatesSort:!0,sendsRowWrites:!0},[Wo.ODATA_V2]:{translatesSort:!0,sendsRowWrites:!1},[Wo.ODOO_JSONRPC]:{translatesSort:!0,sendsRowWrites:!0},[Wo.ODOO_JSON2]:{translatesSort:!0,sendsRowWrites:!0},[Wo.REST_JSON]:{translatesSort:!1,sendsRowWrites:!0}}),Object.freeze({[dR.CSRF_TOKEN_HANDSHAKE]:!1}),Object.freeze({[lR.FIELD]:!0,[lR.PATH_SEGMENT]:!1});function Yhe(e){if(e.direction===En.OUTBOUND)return[];let t=new Set([e.remoteKeyLocalField]);e.partitionKeyLocalField&&t.add(e.partitionKeyLocalField),e.partitionUnitLocalField&&t.add(e.partitionUnitLocalField);for(let n of e.mapping)(e.direction!==En.BIDIRECTIONAL||tte(n)===zee.REMOTE)&&iee(n).length>0&&t.add(n.localField);return[...t]}var Xhe=`external-data-provenance`,Zhe=Bd({system:Yre,currentAsOf:mae().nullable()}),Qhe=3e5,fR=new WeakMap;function $he(e){let t=fR.get(e);return t||(t=new Set(Yhe(e)),fR.set(e,t)),t}function ege(e){let{resourceConfiguration:t,contextualParameters:n}=e,r=(t.operations??[]).filter(e=>dt(e,W.LIST));if(r.length!==1)return;let i=r[0].initiatorInfos??[];if(i.length===0)return;let a=V.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:n,targetResourceType:t.resourceIdentifier,targetDefaultFieldIdentifier:t.resourceFieldIdentifier});if(!a)return;let o=dh.resolveUrlPath(`${br}${a.url}`,n);if(o&&!dh.hasUnresolvedPlaceholders(o))return`${o}/${Xhe}`}var pR=new WeakMap,mR=new Set;function tge(e){let t=pR.get(e);return t||(t={cache:new Map,inFlight:new Map},pR.set(e,t)),t}function nge(){for(let e of mR)e()}function rge(e){return mR.add(e),()=>{mR.delete(e)}}function ige(e,t,n=Date.now()){let r=e&&t?pR.get(t)?.cache.get(e):void 0;return r?Math.max(0,r.fetchedAt+Qhe-n):void 0}function age(e,t){if(e&&t)return pR.get(t)?.cache.get(e)?.value}function hR(e,t,n=Date.now()){let{cache:r,inFlight:i}=tge(t),a=r.get(e);if(a&&n-a.fetchedAt<3e5||i.has(e))return;let o=(async()=>{let n;try{let r=Zhe.safeParse(await t.get(e,{silent:!0}));n=r.success?r.data:null}catch{n=null}r.set(e,{value:n,fetchedAt:Date.now()}),i.delete(e),nge()})();i.set(e,o)}function oge(e){let{resourceType:t,contextualParameters:n}=dj(),r=ym(),i=(0,Q.useContext)(Fi)?.httpClient,a=t?r?.registry.resourceConfigurations[t]:void 0,o=a?.externalDataPipeline,s=e.enabled&&!!o&&!!e.fieldName&&$he(o).has(e.fieldName),c=(0,Q.useMemo)(()=>s&&a?ege({resourceConfiguration:a,contextualParameters:n??{}}):void 0,[s,a,n]),l=(0,Q.useSyncExternalStore)(rge,()=>age(c,i));return(0,Q.useEffect)(()=>{if(!c||!i)return;hR(c,i);let e=ige(c,i);if(e===void 0)return;let t=setTimeout(()=>hR(c,i),e+1);return()=>clearTimeout(t)},[c,i,l]),(0,Q.useMemo)(()=>l?.currentAsOf?{system:l.system,currentAsOf:l.currentAsOf}:void 0,[l])}var gR=as.getLogger();function sge(e){switch(e){case`stacked`:return Ic.STACKED;case`inline`:return Ic.INLINE;case`compact`:return Ic.COMPACT;default:return}}function cge(e){switch(e){case`em-dash`:case`placeholder`:case`hidden`:case`skeleton`:return e;default:return}}function lge(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function _R(e,t){return!e||!t||t.length===0?!1:t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function vR(e){let t=ik(),{pathPrefix:n}=ED(),r=hc(),i=LA(),a=e.name,o=a?n?`${n}.${a}`:a:void 0,s=e.schema??(o?cA(t?.schema,o):void 0),c=e.schemaType??(s?me(s):void 0),l=e.value??(o?lA(t?.data,o):void 0),u=o===void 0?void 0:hr.labelDictionaryPath(o),d=o?hr.isArrayItemPath(o):!1,f=d?void 0:u,p=f?hr.unresolvedFieldLabel(f.split(`.`).pop()??f):void 0,m=e.label??(f?t?.fieldLabels?.[f]:void 0)??p,h=s?Jee(s):!1,g=e.description??(f&&h?t?.fieldDescriptions?.[f]:void 0),_=e.tooltip??(f?t?.fieldTooltips?.[f]:void 0),v=e.enumLabels??(u?t?.enumLabels?.[u]:void 0),y=s?i===PA.SUMMARY?Xs(s):yl(s):void 0,b=e.displayComponent??y?.component,x=e.parentData??uA(t?.data,n||void 0),S=e.disableInlineEdit??!1,C=e.className,w=_R(o,t?.hiddenFieldNames),T=_R(o,t?.inlineEditDisabledFieldNames),{displayChromeMode:D,sectionChromeMode:O}=sk(),k=bA(),A=GA(),j=sge(r.autoRender?.autoFieldChrome),M=i===PA.SUMMARY&&A&&y?.chromeMode===void 0&&O===void 0&&YA(c),N=y?.chromeMode??O??(M?Ic.INLINE:void 0)??D??j,P=e.labelPlacement??(y?.chromeMode===void 0?lge(r.autoRender?.autoLabelPlacement):void 0),F=e.labelStyle??y?.labelStyle,I=CA(c,y?.displayMode,s?No(s)?.mode:void 0),ee=t?.breakpoint,L=ee?pA(y?.forceHide,ee):y?.forceHide,R=L?.label===!0,z=L?.description===!0,te=e.hideLabel===!0||R,ne=e.hideDescription===!0||z||M,{canInlineEdit:re,doInlineUpdate:ie,fileUploadContext:ae,rmm:oe,defaultInlineEdit:se,defaultEmptyValue:ce,parentReferenceConfig:le,resourceType:ue}=dj(),de=ym()?.registry,fe=ce??cge(r.autoRender?.autoEmptyValue),pe=oge({fieldName:!n&&!d?o:void 0,enabled:i!==PA.SUMMARY&&!e.resourceLinkTrail}),he=o&&s&&Ko(s),ge=!!o&&!!s&&se===E.WRITABLE_FIELDS&&Fre(s),_e=!S&&!T&&re&&(!!he||ge);if(w||s&&Cie(s))return(0,$.jsx)($.Fragment,{});let ve=UA(N,ee??Sl.DESKTOP),ye=k&&ve!==Ic.TILE,be=!te&&P!==`hidden`&&ve!==Ic.HIDDEN&&ve!==Ic.COMPACT,xe=!te&&(P===`hidden`||i===PA.SUMMARY),Se=!be&&!xe;if(t?.isLoading??!1)return(0,$.jsx)(HA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(cj,{mode:N,label:m,labelStyle:F,name:o,labelPlacement:P,hideLabel:te,hideDescription:!0,tooltip:_,wide:I,announceName:i===PA.SUMMARY,children:(0,$.jsx)(pm,{className:`h-5 w-full`})})});let Ce=s?un(s):void 0,we=n&&x?x:t?.data;if(Ce&&we&&!hr.evaluateShowWhen(Ce,we))return(0,$.jsx)($.Fragment,{});if(le?.displayMode===na.NONE&&o){let t=Pj({schema:s,value:l,fieldName:o,parentData:x,resourceLinkTrail:e.resourceLinkTrail,currentResourceType:ue,registry:de});if(t&&lj({parentReferenceConfig:le,...t}).hidesWholeReference)return(0,$.jsx)($.Fragment,{})}let Te=(k||i===PA.SUMMARY)&&!_e;if((y?.hideWhenEmpty??Te)&&BA(l))return(0,$.jsx)($.Fragment,{});if(!s||!c)return gR.error(`[DisplayField] Cannot resolve schema for field`,{name:o}),(0,$.jsx)($.Fragment,{});let Ee={schema:s,schemaType:c,value:l,fieldName:o,label:m,description:g,tooltip:_,provenance:pe,enumLabels:v,displayComponent:b,parentData:x,resourceLinkTrail:e.resourceLinkTrail,renderItem:e.renderField,className:C,hideLabel:te,hideDescription:ne,resolvedChromeMode:N,resolvedLabelPlacement:P,resolvedLabelStyle:F,resolvedEmptyValue:fe,fileUploadContext:ae,wideValue:I,announceName:i===PA.SUMMARY};return(0,$.jsx)(bR,{name:o,children:_e&&c===vu.ARRAY?(0,$.jsx)(HA,{active:k,name:o,label:m,children:(0,$.jsx)(Bhe,{name:o,schema:s,value:l,label:m,description:g,doInlineUpdate:ie,renderField:e.renderField,sectionAppearance:e.sectionAppearance,objectItemLayout:e.objectItemLayout,enumLabels:v,hideLabel:te,displayChromeMode:ee?pA(N,ee):typeof N==`string`?N:void 0})}):_e?(0,$.jsx)(HA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(nR,{...Ee,doInlineUpdate:ie,rmm:oe})}):c===vu.ARRAY&&e.sectionAppearance?(0,$.jsx)(HA,{active:k,name:o,label:m,children:(0,$.jsx)(SM,{...Ee,sectionAppearance:e.sectionAppearance})}):(0,$.jsx)(HA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(xM,{...Ee})})})}vR.displayName=`DisplayField`;var yR=vR,bR=class extends Q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){let n=this.props.name;gR.error(`[DisplayField] Error boundary caught error`,{name:n,error:e.message,componentStack:t.componentStack})}render(){let e=this.props.name;return this.state.hasError?(0,$.jsxs)(`div`,{className:`flex items-center gap-element px-card-sm py-item-xs rounded-md bg-destructive/10 border border-destructive/20`,children:[(0,$.jsx)(`span`,{className:`text-destructive text-sm`,children:`Error rendering field`}),e&&(0,$.jsx)(`code`,{className:`text-xs text-destructive/70 px-item-xs rounded bg-destructive/5`,children:e})]}):this.props.children}},xR=(0,Q.createContext)(null);function uge({value:e,children:t}){return(0,$.jsx)(xR.Provider,{value:e,children:t})}function SR(){return(0,Q.useContext)(xR)}var CR;(function(e){e.DEFAULT=`default`,e.ENTRY=`entry`,e.SECTION=`section`,e.DOCUMENT=`document`})(CR||={});var dge={[CR.DEFAULT]:void 0,[CR.ENTRY]:`h5`,[CR.SECTION]:`h4`,[CR.DOCUMENT]:`h3`};function wR({name:e,scale:t=CR.DEFAULT,className:n}){let r=SR(),{getRecipe:i}=Wg(),a=dge[t],o=i(cc.TYPOGRAPHY,y.HEADING),s=a?U(o.base,o.sizes?.[a]):void 0;if(r?.titleMountTracker&&(r.titleMountTracker.titleMounted=!0),e)return(0,$.jsx)(x_,{className:s,children:(0,$.jsx)(`div`,{"data-summary-title":``,className:U(`min-w-0 flex-1 text-foreground`,s?`leading-tight`:`font-medium leading-tight`,n),children:(0,$.jsx)(yR,{name:e,hideLabel:!0})})});let c=r?.primaryLabel;return c?(0,$.jsx)(Z,{as:`p`,"data-summary-title":``,className:U(`min-w-0 flex-1 font-medium text-foreground`,n),truncate:!0,children:c}):null}var TR;(function(e){e.AUTO=`auto`,e.TEMPLATE_OWNED=`template-owned`})(TR||={});var ER;(function(e){e.STACK=`stack`,e.ROW=`row`})(ER||={});var fge={[ER.STACK]:`flex flex-col gap-element text-sm`,[ER.ROW]:`flex flex-wrap items-center gap-x-group gap-y-item text-sm`};function DR(e){let t=!1;return Q.Children.forEach(e,e=>{if(t||!(0,Q.isValidElement)(e))return;if(e.type===wR){t=!0;return}let n=e.props?.children;n!==void 0&&DR(n)&&(t=!0)}),t}function OR({flow:e=ER.STACK,className:t,titlePlacement:n=TR.AUTO,children:r}){let i=n===TR.AUTO&&!DR(r);return(0,$.jsx)(TD,{pathPrefix:``,children:(0,$.jsxs)(`div`,{className:U(fge[e],t),children:[i&&(0,$.jsx)(wR,{}),r]})})}function kR({name:e,className:t,children:n}){let{pathPrefix:r}=ED(),i=r?`${r}.${e}`:e,a=(0,$.jsx)(TD,{pathPrefix:i,children:n});return t?(0,$.jsx)(`div`,{className:t,children:a}):a}wk(kR,xk.FIELD_SLOT_CONTAINER);function AR({field:e,variants:t,fallback:n}){let r=VC({name:DD(e)}),i=r==null?void 0:t[String(r)];return(0,$.jsx)($.Fragment,{children:i??n??null})}function jR({field:e,variants:t,fallback:n}){let r=DD(e),i=lA(ik()?.data,r),a=i==null?void 0:t[String(i)];return(0,$.jsx)($.Fragment,{children:a??n??null})}function MR(e,t,n){let r=me(t),i=un(t);return{name:e,schema:t,schemaType:r,showWhenParams:i,showWhenWatchFields:i?IR(i):void 0,isDiscriminator:n===e}}function NR(e,t){let n=hr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return[];let i=[];for(let e of r){let r=n[e];Qu(r)||su(r)||i.push(MR(e,r,t))}return i}function PR(e){return ka(e)}function FR(e){let t=lr(e);if(!Gne(t))return null;let n=za(t,`discriminator`),r=Kn(t,`options`)??[];if(!n||r.length===0)return null;let i=e=>!!e&&!Qu(e)&&!su(e),a=r.map(e=>new Set(qr(e))),o=[...a[0]??new Set].filter(e=>e!==n&&a.every(t=>t.has(e))),s=F(r[0]),c=s?o.filter(e=>i(s[e])).map(e=>MR(e,s[e])):[],l=[];for(let e of r){let t=F(e);if(!t)continue;let r=wne(t[n])[0];r!=null&&l.push({value:String(r),schema:e,fields:Object.keys(t).filter(e=>e!==n&&!o.includes(e)&&i(t[e])).map(e=>MR(e,t[e]))})}return{discriminator:n,commonFields:c,variants:l}}function pge(e){let t=FR(e);if(t)return{discriminatorField:t.discriminator,inheritedSchemas:t.variants.map(e=>({discriminatorFieldValue:e.value,schema:e.schema}))}}function mge(e){let t=FR(e.schema);if(!t)return null;let n={};for(let e of t.variants)e.fields.length!==0&&(n[e.value]=(0,$.jsx)($.Fragment,{children:e.fields.map(e=>(0,$.jsx)(XL,{name:e.name},e.name))}));return(0,$.jsxs)(kR,{name:e.name,children:[(0,$.jsx)(XL,{name:t.discriminator}),t.commonFields.map(e=>(0,$.jsx)(XL,{name:e.name},e.name)),Object.keys(n).length>0&&(0,$.jsx)(AR,{field:t.discriminator,variants:n})]},e.name)}function IR(e){let t=Array.isArray(e.conditions)?e.conditions:[e.conditions];return[...new Set(t.map(e=>e.field))]}function LR(e,t){let n=t?.inheritanceConfig??pge(e),r=NR(e,n?.discriminatorField);MT.FORM;let i=t?.includeSubmitButton!==!1,a=t?.includeErrorSummary!==!1;if(r.length===0){let e=()=>(0,$.jsx)(nA,{autoInjectSubmitButton:i});return e.displayName=`GeneratedFormTemplate(empty)`,e}let o=vge(r),s=o.length>0,c=new Set(r.map(e=>e.name)),l=()=>{let e=hge(s,o),t=zT(),l=new Set(Object.keys(t?.contextFieldValues??{}));for(let e of t?.hiddenFieldNames??[])l.add(e);return(0,$.jsxs)(nA,{autoInjectSubmitButton:i,children:[a&&(0,$.jsx)(tO,{}),r.map(r=>{let i=!!t?.generatedFieldOverrides?.[r.name],a=l.has(r.name)&&!i?null:gge(r,n,c,l,t?.generatedFieldOverrides,e,o);return!r.showWhenParams||!e||VR(r.showWhenParams,e,o)?a:null}),i&&(0,$.jsx)(rO,{})]})};return l.displayName=`GeneratedFormTemplate`,l}function hge(e,t){let n=VC({name:e?t:[]});return e?Array.isArray(n)?n:[n]:void 0}function gge(e,t,n,r,i,a,o){return i?.[e.name]?(0,$.jsx)(XL,{name:e.name},e.name):e.isDiscriminator&&t&&n&&r?_ge(e,t,n,r,i):e.schemaType===vu.OBJECT?RR(e,a,o):(0,$.jsx)(XL,{name:e.name},e.name)}function _ge(e,t,n,r,i){let a={};if(t.inheritedSchemas)for(let e of t.inheritedSchemas){let t=F(e.schema),o=qr(e.schema);if(t&&o.length>0){let s=o.filter(e=>!Qu(t[e])&&!su(t[e])&&!n.has(e)&&(!r.has(e)||!!i?.[e]));s.length>0&&(a[e.discriminatorFieldValue]=(0,$.jsx)($.Fragment,{children:s.map(e=>(0,$.jsx)(XL,{name:e},e))}))}}let o=Object.keys(a).length>0;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(XL,{name:e.name}),o&&(0,$.jsx)(AR,{field:t.discriminatorField,variants:a})]},e.name)}function RR(e,t,n,r=``){if(e.showWhenParams&&t&&n&&!VR(BR(e.showWhenParams,r),t,n))return null;let i=mge(e);if(i)return i;let a=PR(e.schema),o=Object.keys(a).filter(e=>{let t=a[e];return!Qu(t)&&!su(t)});if(o.length===0)return(0,$.jsx)(XL,{name:e.name},e.name);let s=r?`${r}.${e.name}`:e.name;return(0,$.jsx)(kR,{name:e.name,children:o.map(e=>{let r=a[e];return me(r)===vu.OBJECT?RR(MR(e,r),t,n,s):(0,$.jsx)(XL,{name:e},e)})},e.name)}function vge(e){let t=new Set;for(let n of e)zR(n,t);return[...t]}function zR(e,t,n=``){if(e.showWhenParams){let r=BR(e.showWhenParams,n);for(let e of IR(r))t.add(e)}if(e.schemaType!==vu.OBJECT)return;let r=PR(e.schema),i=n?`${n}.${e.name}`:e.name;for(let[e,n]of Object.entries(r))Qu(n)||su(n)||zR(MR(e,n),t,i)}function BR(e,t){if(!t)return e;let n=Array.isArray(e.conditions)?e.conditions:[e.conditions];return{...e,conditions:n.map(e=>({...e,field:e.field.includes(`.`)||e.field.includes(`[`)?e.field:`${t}.${e.field}`}))}}function VR(e,t,n){let r={};for(let e=0;e<n.length;e++)r[n[e]]=t[e];return hr.evaluateShowWhen(e,r)}function HR(e,t={}){let n=FR(e);if(n)return()=>(0,$.jsx)(hA,{children:t.factsAsTiles?bge(n,t.resourceConfig):qR(n,t.resourceConfig)});let r=NR(e);if(MT.DISPLAY,r.length===0)return()=>(0,$.jsx)(hA,{});let i=UR(r,t.resourceConfig);if(t.factsAsTiles)return()=>(0,$.jsxs)(hA,{children:[i.state.length>0&&(0,$.jsx)(TA,{children:i.state.map(WR)}),i.content.map(KR),i.facts.length>0&&(0,$.jsx)(wA,{children:i.facts.map(KR)}),i.recordKeeping.length>0&&(0,$.jsx)(EA,{children:i.recordKeeping.map(KR)})]});let a=[...i.state,...i.content,...i.facts,...i.recordKeeping];return()=>(0,$.jsx)(hA,{children:a.map(KR)})}function UR(e,t){let n={state:[],content:[],facts:[],recordKeeping:[]};for(let r of e)switch(MA(r.name,r.schema,t)){case DA.STATE:(n.state.length===0?n.state:n.facts).push(r);break;case DA.CONTENT:n.content.push(r);break;case DA.FACT:n.facts.push(r);break;case DA.RECORD_KEEPING:n.recordKeeping.push(r);break;case DA.IDENTITY_PLUMBING:}return n}function WR(e){return(0,$.jsx)(yR,{name:e.name,labelPlacement:`hidden`},e.name)}function yge({children:e}){let{displayChromeMode:t}=sk();return(0,$.jsx)(ok,{displayChromeMode:t,sectionChromeMode:Ic.INLINE,children:e})}function GR(e){return AA(e.schema)}function bge(e,t){let n=UR(e.commonFields,t),r={},i={};for(let t of e.variants){let e=t.fields.filter(GR),n=t.fields.filter(e=>!GR(e));e.length>0&&(r[t.value]=(0,$.jsx)($.Fragment,{children:e.map(KR)})),n.length>0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:n.map(KR)}))}return(0,$.jsxs)($.Fragment,{children:[n.state.length>0&&(0,$.jsx)(TA,{children:n.state.map(WR)}),n.content.map(KR),Object.keys(r).length>0&&(0,$.jsx)(jR,{field:e.discriminator,variants:r}),(0,$.jsxs)(wA,{children:[(0,$.jsx)(yR,{name:e.discriminator}),n.facts.map(KR),Object.keys(i).length>0&&(0,$.jsx)(jR,{field:e.discriminator,variants:i})]}),n.recordKeeping.length>0&&(0,$.jsx)(EA,{children:n.recordKeeping.map(KR)})]})}function KR(e){return e.schemaType===vu.OBJECT?xge(e):(0,$.jsx)(yR,{name:e.name},e.name)}function qR(e,t){let n=UR(e.commonFields,t),r=[...n.state,...n.content,...n.facts,...n.recordKeeping],i={};for(let t of e.variants)t.fields.length!==0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:t.fields.map(KR)}));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yR,{name:e.discriminator}),r.map(KR),Object.keys(i).length>0&&(0,$.jsx)(jR,{field:e.discriminator,variants:i})]})}function xge(e){let t=FR(e.schema);if(t)return(0,$.jsx)(kR,{name:e.name,children:qR(t)},e.name);let n=PR(e.schema),r=Object.keys(n).filter(e=>{let t=n[e];return!Qu(t)&&!su(t)});return r.length===0?(0,$.jsx)(yR,{name:e.name},e.name):(0,$.jsx)(kR,{name:e.name,children:r.map(e=>KR(MR(e,n[e])))},e.name)}function JR(e,t){let n=hr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return()=>(0,$.jsx)(OR,{titlePlacement:TR.AUTO});let i=e=>!V.isIdentityOnlySummaryField(e,t),a=r.filter(e=>{let t=n[e];return i(e)&&!su(t)&&Ss(t)}),o=a.length>0?a:r.filter(e=>i(e)&&!su(n[e])),s=t?.frontendConfiguration?.layout?.defaultChromeMode?.summary!==void 0,c=o.map(e=>me(n[e]));return()=>{let e=ik(),t=e?.data,n=t!==void 0&&e?.isLoading!==!0,r=o.map(e=>!n||XA(t?.[e])),i=s?[]:ZA(o.map((e,t)=>({schemaType:c[t],present:r[t]})));return(0,$.jsx)(OR,{titlePlacement:TR.AUTO,children:o.map((e,t)=>r[t]?i[t]?(0,$.jsx)(yge,{children:(0,$.jsx)(yR,{name:e})},e):(0,$.jsx)(yR,{name:e},e):null)})}}function Sge(e,t){return t!==W.UPDATE||!e?!1:Object.values(e).some(e=>{let t=Xc(e)?.autosave;return t===void 0?!1:t===!0||typeof t==`object`&&t.enabled!==!1})}function YR(e,t){return e?.cause instanceof Error?e.cause:Error(e?.message??t)}var XR=(0,Q.createContext)(null);function ZR(e){let{tErrorValidation:t,tErrorMessage:n,t:r}=K(),i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{a.current?.unsubscribe()},[]);let o=(0,Q.useCallback)(e=>{a.current?.unsubscribe();let t=e.watch((t,{name:n})=>{n&&i.current.has(n)&&(e.clearErrors(n),i.current.delete(n))});a.current=t},[]),s=(0,Q.useCallback)(()=>{e.current&&i.current.size>0&&(Array.from(i.current).forEach(t=>{e.current.clearErrors(t)}),i.current.clear())},[e]);return{initAutoClearing:o,injectServerErrors:(0,Q.useCallback)(a=>{e.current&&(Object.entries(a).forEach(([a,o])=>{let s=ID.isFormLevelErrorPath(a)?cT:a,c=(_(o)&&o.code===ja.DECLARED_REFUSAL?Op({tErrorMessage:n,t:r},o.params?.refusalCode):void 0)??(_(o)?t(o.code,`msg`,o.params):o);e.current.setError(s,{type:oT,message:c}),i.current.add(s)}),qD(Object.keys(a).map(e=>ID.isFormLevelErrorPath(e)?cT:e)))},[e,t,n,r]),clearServerErrors:s}}function QR(e,t){let{emit:n}=Mo(),r=(0,Q.useContext)(um),{registry:i}=fm(),a=r?.isConnected??!1,o=(0,Q.useMemo)(()=>{let t=i.resourceConfigurations[e.resourceType],{[e.resourceType]:n,...r}=Hu(e.contextResourceIdentifiers),a=V.buildContextualParameters(r,i);return Ra(t?.operations??[],W.LIST).filter(e=>$v({operation:e,contextResourceIdentifiers:r,contextualParameters:a}))},[e.contextResourceIdentifiers,e.resourceType,i]);return(0,Q.useCallback)((r,i)=>{if(wn(r))return;n(Ec.RESOURCE_OPERATION_EXECUTED,{resourceType:e.resourceType,operationIdentifier:String(t.operationIdentifier),operation:t,variantType:t.variantType,isOperationDefault:t.isOperationDefault??!0,isBulkOperation:t.isBulkOperation??!1,variantKey:t.variantKey,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:e.resourceType,result:r,isBulkOperation:t.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements,optionalDiscriminator:Bc(e.additionalContext),resultSummary:Xu(r),...i?.partialWrite?{isPartialWrite:!0}:{}});let s=t.admitsCrossTenantPlatformAdministration===!0;if(!t.isBulkOperation&&!s||Ai(t,a))return;let{[e.resourceType]:c,...l}=Hu(e.contextResourceIdentifiers),u=o.length>0?o:[null];for(let t of u)n(Ec.RESOURCE_REFRESH,{resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),operation:t??{operationIdentifier:W.LIST},variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:l,parentResourcesRequirements:e.parentResourcesRequirements})},[n,a,o,t,e.additionalContext,e.contextResourceIdentifiers,e.parentResourcesRequirements,e.resourceType])}function Cge(e){let{apiBaseUrl:t,initiatorInfo:n,contextualParameters:r}=e,i=dh.resolveUrlPath(`${br}${n.url}`,r);if(i&&!dh.hasUnresolvedPlaceholders(i))return`${t}${i}/validate-field`}var $R=as.getLogger(),ez=$R.debugByType(`HttpTransportAdapter`);$R.setDebugTypeLogging(`HttpTransportAdapter`,!1);function wge(e){let t=e?.context;if(!t||typeof t!=`object`)return;let n=t,r=Qte.safeParse(n.versionConflict);return r.success?r.data:void 0}function Tge(e){let t=e.httpStatus;return t!=null&&typeof t==`number`&&!Number.isNaN(t)}function Ege(e){return e>=500?pE.SERVER:e>=400&&!fc.has(e)?pE.REFUSED:pE.TRANSIENT}function tz(e,t,n){let r=e?.validationErrors;return typeof r==`object`&&r&&Object.keys(r).length>0?{type:pE.VALIDATION,status:t,validationErrors:r,message:n}:{type:pE.REFUSED,status:t,message:n}}var Dge=class{_doOperation;constructor(e){this._doOperation=e}async execute(e){ez(`execute`,{operationPathKey:e.operationPathKey,fields:e.requestData?Object.keys(e.requestData):[],expectedVersion:e.expectedVersion});try{let t={};e.expectedVersion!=null&&(t[Ju.IF_MATCH]=String(e.expectedVersion));let n=e.fieldTimestamps?{...e.requestData,_field_timestamps:e.fieldTimestamps}:e.requestData,r=await this._doOperation(e.operationPathKey,{contextualParameters:e.contextualParameters,requestData:n,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:e.dataMode},{signal:e.signal,silent:!0,headers:Object.keys(t).length>0?t:void 0}),i=wn(r);if(i)return ez(`execute: held for approval`,{decisionRef:i.decisionRef}),{status:mE.SUCCESS,heldForApproval:i};let a=r,o={status:mE.SUCCESS,data:a??void 0,newVersion:a?._version,fieldMeta:a?._field_meta};return ez(`execute: success`,{newVersion:o.newVersion}),o}catch(t){let n=this._mapError(t,e.expectedVersion!=null);return ez(`execute: error`,{errorType:n.error?.type,errorStatus:n.error?.status,errorMessage:n.error?.message}),n}}_mapError(e,t){let n=this._classifyError(e,t);return n.error&&(n.error.cause=e,n.error.type!==pE.SERVER&&n.error.type!==pE.TRANSIENT||_a(e)||ll(e)||(n.error.resendable=Wee(e,Ha.REDISPATCH))),n}_classifyError(e,t){if(ree(e))return{status:mE.ERROR,error:{type:pE.ABORT}};if(_a(e)||ll(e))return{status:mE.ERROR,error:{type:pE.TRANSIENT,message:e.message}};let n=Tge(e)?e.httpStatus:void 0;if(n!=null)switch(n){case 400:case 422:return{status:mE.ERROR,error:{type:pE.VALIDATION,status:n,validationErrors:e.validationErrors,message:e.message??String(e)}};case 404:case 410:return{status:mE.ERROR,error:{type:pE.NOT_FOUND,status:n}};case 409:if(e?.customMessageReference===Xl.VERSION_CONFLICT){let r=wge(e);return!r&&!t?{status:mE.ERROR,error:tz(e,n,e?.message??String(e))}:r?{status:mE.ERROR,error:{type:pE.CONFLICT,status:n,conflictDetails:r}}:{status:mE.ERROR,error:{type:pE.SERVER,status:n,message:`Version conflict response missing authoritative conflict details.`}}}return{status:mE.ERROR,error:tz(e,n,e?.message??String(e))};default:return{status:mE.ERROR,error:{type:Ege(n),status:n,message:String(e)}}}return{status:mE.ERROR,error:{type:pE.TRANSIENT,message:mo(e)}}}},Oge=15e3,kge=3e4,Age=[1e3,3e3],jge=2e3,Mge=3e5;function nz(e){let t=e??{},n=t.context??{};return{...typeof t.customMessageReference==`string`?{errorCustomMessageReference:t.customMessageReference}:{},...typeof n.code==`string`&&n.code.length>0?{errorRefusalCode:n.code}:{},...typeof t.httpStatus==`number`?{errorHttpStatus:t.httpStatus}:{},...rz(e)}}function rz(e){let t=ip(e).userGuidance,n=typeof t?.guidanceKey==`string`&&t.guidanceKey.length>0?t.guidanceKey:void 0;return n?{errorGuidanceKey:n,...t?.params?{errorGuidanceParams:t.params}:{}}:{}}var iz=as.getLogger(),az=iz.debugByType(`ResourceMutationManager`);iz.setDebugTypeLogging(`ResourceMutationManager`,!1);var Nge=64;function oz(e,t){let n=CM(t).split(`.`).filter(Boolean),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=Array.isArray(r)?r[Number(e)]:r[e]}return r}function sz(e,t){let n=Object.keys(e).filter(e=>CM(e).includes(`.`));if(n.length===0)return e;if(t===null)throw Error(`Cannot write ${n.join(`, `)} before the record's stored state is known: the stored siblings would be erased.`);let r={};for(let[t,i]of Object.entries(e))n.includes(t)||(r[t]=i);for(let i of n){let n=CM(i).split(`.`)[0];if(n in r)r[n]!==null&&typeof r[n]==`object`&&(r[n]=structuredClone(r[n]));else{let e=t?.[n];r[n]=typeof e==`object`&&e?structuredClone(e):void 0}lz(r,i,e[i])}return r}var cz=new Set([dE.SECTION,dE.AUTOSAVE,dE.INLINE]);function lz(e,t,n){let r=CM(t).split(`.`).filter(Boolean),i=e;for(let e=0;e<r.length-1;e++){let t=r[e],a=r[e+1],o=/^\d+$/.test(a)?[]:{};if(i[t]===void 0||i[t]===null||typeof i[t]!=`object`){if(n===void 0)return;i[t]=o}i=i[t]}let a=r[r.length-1];n===void 0?Array.isArray(i)&&/^\d+$/.test(a)?delete i[Number(a)]:delete i[a]:Array.isArray(i)&&/^\d+$/.test(a)?i[Number(a)]=n:i[a]=n}var uz;(function(e){e.QUEUE_MUTATION=`QUEUE_MUTATION`,e.START_SAVING=`START_SAVING`,e.SAVE_SUCCESS=`SAVE_SUCCESS`,e.SAVE_ERROR=`SAVE_ERROR`,e.RETRY=`RETRY`,e.CONFLICT_DETECTED=`CONFLICT_DETECTED`,e.CONFLICT_ACKNOWLEDGED=`CONFLICT_ACKNOWLEDGED`,e.CANCEL=`CANCEL`,e.DELETE=`DELETE`,e.REMOTE_UPDATE=`REMOTE_UPDATE`})(uz||={});var dz={type:fE.FORM,subscriberId:`autosave`},fz={maxQueueDepth:5,softTimeoutMs:Oge,hardTimeoutMs:kge},pz=class{resourceType;_resourceId;_confirmedData=null;_version=null;_pendingFields=new Map;_queue=[];_activeMutation=null;_state=lE.IDLE;_lastError=null;_lastEvent=null;_eventCounter=0;_snapshotVersion=0;_cachedSnapshot=null;_cachedSnapshotVersion=-1;_snapshotListeners=new Set;_optimisticDataVersion=-1;_cachedOptimisticData=null;_config;_mutationIdCounter=0;_retryTimer=null;_retryDelays=[...Age];_serverRetryDelay=jge;_authoritativeRecoveryTimer=null;_backpressure;_softTimer=null;_hardTimer=null;_deferredSelfEvents=[];_allowSettledSelfEventRepair=!1;_producedVersions=new Set;_crdtFieldNames;_discriminatorFieldNames;_fieldMeta=null;_pendingFieldTimestamps=new Map;_lastIssuedLocalTimestamp=0;_clockOffset=0;_onDrainCallbacks=[];constructor(e){this._config=e,this.resourceType=e.resourceType,this._resourceId=e.resourceId;let t=e.backpressure;this._backpressure={maxQueueDepth:t?.maxQueueDepth??fz.maxQueueDepth,softTimeoutMs:t?.softTimeoutMs??fz.softTimeoutMs,hardTimeoutMs:t?.hardTimeoutMs??fz.hardTimeoutMs},this._crdtFieldNames=N({mainSchema:e.resourceSchema,inheritenceSchemaDefinition:e.resourceInheritance}),this._discriminatorFieldNames=jE(e.resourceSchema),this.subscribe=this.subscribe.bind(this),this.getSnapshot=this.getSnapshot.bind(this),az(`constructor`,{resourceType:e.resourceType,resourceId:e.resourceId,conflictStrategy:e.conflictPolicy.strategy,operationPathKey:e.operationPathKey,crdtFieldCount:this._crdtFieldNames.size,crdtFields:Array.from(this._crdtFieldNames)})}_getAdjustedTimestamp(){let e=Date.now()+this._clockOffset;return this._lastIssuedLocalTimestamp=gee(Math.max(1,e),this._lastIssuedLocalTimestamp),this._lastIssuedLocalTimestamp}_isCrdtManagedField(e){return this._crdtFieldNames.has(e)||this._crdtFieldNames.has(e.split(`.`)[0]??e)}set clockOffset(e){this._clockOffset=e}get resourceId(){return this._resourceId}get contextualParameters(){return this._config.contextualParameters}get contextResourceIdentifiers(){return this._config.contextResourceIdentifiers??{}}get parentResourcesRequirements(){return this._config.parentResourcesRequirements}get readOperationPathKey(){return this._config.readOperationPathKey}syncRuntimeRoutingConfig(e){if(this._state===lE.DELETED)return;let t=Object.prototype.hasOwnProperty.call(e,`readOperationPathKey`),n=Object.prototype.hasOwnProperty.call(e,`parentResourcesRequirements`),r=e.operationPathKey!==void 0&&e.operationPathKey!==this._config.operationPathKey,i=t&&e.readOperationPathKey!==this._config.readOperationPathKey,a=e.transportAdapter!==void 0&&e.transportAdapter!==this._config.transportAdapter,o=e.conflictPolicy!==void 0&&e.conflictPolicy.strategy!==this._config.conflictPolicy.strategy,s=e.resourceSchema!==void 0&&e.resourceSchema!==this._config.resourceSchema||e.resourceInheritance!==void 0&&e.resourceInheritance!==this._config.resourceInheritance;this._config={...this._config,...e.transportAdapter===void 0?{}:{transportAdapter:e.transportAdapter},currentUserId:e.currentUserId,...e.contextResourceIdentifiers===void 0?{}:{contextResourceIdentifiers:{...e.contextResourceIdentifiers}},contextualParameters:{...e.contextualParameters},...n?{parentResourcesRequirements:e.parentResourcesRequirements}:{},...e.operationPathKey===void 0?{}:{operationPathKey:e.operationPathKey},...t?{readOperationPathKey:e.readOperationPathKey}:{},...e.conflictPolicy===void 0?{}:{conflictPolicy:e.conflictPolicy},...e.resourceSchema===void 0?{}:{resourceSchema:e.resourceSchema},...e.resourceInheritance===void 0?{}:{resourceInheritance:e.resourceInheritance}},s&&(this._crdtFieldNames=N({mainSchema:this._config.resourceSchema,inheritenceSchemaDefinition:this._config.resourceInheritance}),this._discriminatorFieldNames=jE(this._config.resourceSchema)),az(`syncRuntimeRoutingConfig`,{resourceType:this.resourceType,resourceId:this._resourceId,hasUserId:e.currentUserId.length>0,didUpdateOperationPathKey:r,didUpdateReadOperationPathKey:i,didUpdateTransportAdapter:a,didUpdateConflictPolicy:o,didUpdateResourceSchema:s,crdtFieldCount:this._crdtFieldNames.size}),(r||i)&&this._invalidateSnapshot()}setInitialState(e,t,n){if(this._state===lE.DELETED)return;this._confirmedData={...e},this._version=t,this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1;let r=n??e._field_meta;this._fieldMeta=r==null?null:Pr(r),this._invalidateSnapshot(),az(`setInitialState`,{resourceId:this._resourceId,version:t,fieldCount:Object.keys(e).length,pendingFieldCount:this._pendingFields.size,hasFieldMeta:this._fieldMeta!==null})}queueMutation(e,t){if(this._state===lE.DELETED)return az(`queueMutation: rejected — resource deleted`,{resourceId:this._resourceId}),Promise.reject(new bE);let n=t?.priority??vE.LOW,r=t?.type??dE.AUTOSAVE,i=t?.source??dz;return this._queue.length>=this._backpressure.maxQueueDepth&&n<=vE.LOW?(az(`queueMutation: rejected — backpressure`,{queueDepth:this._queue.length,maxDepth:this._backpressure.maxQueueDepth}),Promise.reject(new xE)):(az(`queueMutation`,{type:r,priority:n,source:i.subscriberId,fields:Object.keys(e),state:this._state,queueDepth:this._queue.length,pendingFieldCount:this._pendingFields.size}),new Promise((a,o)=>{let s={id:`mut_${++this._mutationIdCounter}`,type:r,fields:{...e},priority:n,source:i,resolve:a,reject:o,signal:t?.signal,transportOverride:t?.transportOverride};if(n>=vE.HIGH){for(let[e,t]of this._pendingFields)e in s.fields||(s.fields[e]=t);this._pendingFields.clear();for(let e of Object.keys(s.fields))this._isCrdtManagedField(e)&&!this._pendingFieldTimestamps.has(e)&&this._pendingFieldTimestamps.set(e,this._getAdjustedTimestamp())}else for(let[t,n]of Object.entries(e))this._pendingFields.set(t,n),this._isCrdtManagedField(t)&&this._pendingFieldTimestamps.set(t,this._getAdjustedTimestamp());this._queue.push(s),this._queue.sort((e,t)=>t.priority-e.priority),this._queue.length>1&&this._autoCoalesceQueue(),this._transition({type:uz.QUEUE_MUTATION}),this._processQueue()}))}autosave(e){this.queueMutation(e,{type:dE.AUTOSAVE,priority:vE.LOW,source:dz}).catch(()=>{})}flushPendingFields(e){if(this._pendingFields.size===0)return Promise.resolve(null);let t={};for(let[e,n]of this._pendingFields)t[e]=n;return this.queueMutation(t,{type:dE.AUTOSAVE,priority:e?.priority??vE.NORMAL,source:e?.source??dz,signal:e?.signal})}cancelPendingMutations(e){if(this._state!==lE.DELETED){az(`cancelPendingMutations`,{source:e?.subscriberId,queueDepth:this._queue.length,hasActiveMutation:this._activeMutation!==null,pendingFieldCount:this._pendingFields.size}),this._retryTimer&&=(clearTimeout(this._retryTimer),null),this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new yE(e)),null);for(let t of this._queue)t.reject(new yE(e));this._queue=[],this._deferredSelfEvents=[],this._pendingFieldTimestamps.clear(),this._transition({type:uz.CANCEL})}}acknowledgeConflict(){this._state===lE.CONFLICT&&(az(`acknowledgeConflict`,{resourceId:this._resourceId}),this._transition({type:uz.CONFLICT_ACKNOWLEDGED}),this._processQueue())}_isOwnEcho(e){return this._producedVersions.has(e)}_recordProducedVersion(e){if(e!=null&&(this._producedVersions.add(e),this._producedVersions.size>Nge)){let e=this._producedVersions.values().next().value;e!==void 0&&this._producedVersions.delete(e)}}applyRemoteUpdate(e,t,n,r){if(this._state!==lE.DELETED){if(this._isOwnEcho(t)){if(this._activeMutation!==null){az(`applyRemoteUpdate: own-echo deferred (mutation in-flight)`,{version:t,activeMutationId:this._activeMutation.entry.id}),this._deferredSelfEvents.push({changedFields:e,version:t,initiatorUserId:n,fieldMeta:r});return}if(this._allowSettledSelfEventRepair){this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,az(`applyRemoteUpdate: accepting settled own-echo after canonical read-back miss`,{version:t}),this._applyRemoteUpdateInternal(e,t,n,r,!0);return}az(`applyRemoteUpdate: own-echo discarded (no in-flight mutation)`,{version:t})}else this._activeMutation!==null&&n!==void 0&&n===this._config.currentUserId?(az(`applyRemoteUpdate: same-user echo deferred (mutation in-flight, version not yet known)`,{version:t,activeMutationId:this._activeMutation.entry.id}),this._deferredSelfEvents.push({changedFields:e,version:t,initiatorUserId:n,fieldMeta:r})):this._applyRemoteUpdateInternal(e,t,n,r)}}handleDeletion(e,t){az(`handleDeletion`,{reason:e,deletedBy:t,resourceId:this._resourceId}),this._transition({type:uz.DELETE,reason:e,deletedBy:t})}subscribe(e){return this._snapshotListeners.add(e),()=>{this._snapshotListeners.delete(e)}}getSnapshot(){if(this._cachedSnapshot&&this._cachedSnapshotVersion===this._snapshotVersion)return this._cachedSnapshot;let e=this._getOptimisticData(),t=Array.from(this._pendingFields.keys()),n={};for(let[e,t]of this._pendingFields)n[e]=t;return this._cachedSnapshot={state:this._state,version:this._version,confirmedData:this._confirmedData,optimisticData:e,pendingFieldNames:t,pendingFieldValues:n,isSaving:this._state===lE.SAVING,isDeleted:this._state===lE.DELETED,hasUnsavedChanges:this._pendingFields.size>0||this._queue.length>0||this._activeMutation!==null,error:this._lastError,queueDepth:this._queue.length,lastEvent:this._lastEvent},this._cachedSnapshotVersion=this._snapshotVersion,this._cachedSnapshot}async destroy(){az(`destroy: starting`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size,queueDepth:this._queue.length,hasActiveMutation:this._activeMutation!==null});let e=0;for(;this._pendingFields.size>0&&e++<3;)try{await this.flushPendingFields()}catch(t){az(`destroy: flushPendingFields failed`,{resourceId:this._resourceId,attempt:e,error:mo(t)});break}this._pendingFields.size>0&&az(`destroy: completing with pending fields remaining (flush exhausted or failed)`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size}),(this._activeMutation||this._queue.length>0)&&(az(`destroy: waiting for drain`,{queueDepth:this._queue.length}),await new Promise(e=>{this._onDrainCallbacks.push(e)})),this._clearTimers(),this._clearAuthoritativeRecoveryTimer(),this._snapshotListeners.clear(),az(`destroy: complete`,{resourceId:this._resourceId})}_transition(e){let t=this._state;switch(e.type){case uz.QUEUE_MUTATION:if(this._state===lE.IDLE)this._state=lE.QUEUED;else if(this._state===lE.ERROR){if(this._retryTimer&&this._activeMutation){this._clearTimers();let e=this._activeMutation;for(let[t,n]of Object.entries(e.savingFields))this._pendingFields.has(t)||this._pendingFields.set(t,n);e.abortController.abort(),this._activeMutation=null,e.entry.reject(new yE(e.entry.source))}this._state=lE.QUEUED}this._invalidateSnapshot();return;case uz.START_SAVING:this._state===lE.QUEUED&&(this._state=lE.SAVING,this._lastError=null,this._startBackpressureTimers());break;case uz.SAVE_SUCCESS:{this._state=this._queue.length>0||this._pendingFields.size>0?lE.QUEUED:lE.IDLE,this._lastError=null,this._clearTimers();let t=e.result.heldForApproval,n=this._confirmedData===null?void 0:{...this._confirmedData};t||(e.result.data&&this._mergeResponseDataIntoConfirmed(e.result.data),this._applyConfirmedClears(e.clearedFields,e.result.data),e.result.newVersion!==void 0&&(this._version=e.result.newVersion)),this._lastEvent={type:uE.MUTATION_RESULT,result:t?{success:!0,savedFields:[],heldForApproval:t}:{success:!0,savedFields:e.savedFields,savedValues:e.savedValues,newVersion:e.result.newVersion,responseData:e.result.data,...n===void 0?{}:{previousConfirmedData:n}},source:e.source,id:++this._eventCounter};break}case uz.SAVE_ERROR:{let t=e.result.error?.type,n=e.result.error?{type:e.result.error.type,status:e.result.error.status,validationErrors:e.result.error.validationErrors,message:e.result.error.message,conflictDetails:e.result.error.conflictDetails,cause:e.result.error.cause,...e.result.error.resendable===void 0?{}:{resendable:e.result.error.resendable}}:{type:pE.SERVER,message:`Unknown error`};if(this._lastError=n,t===pE.CONFLICT){this._clearTimers(),this._state=lE.CONFLICT;let t=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new yE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[];let r=n.conflictDetails,i=r?.currentValues,a=i&&Object.keys(i).length>0?{...this._confirmedData??{},...i}:this._confirmedData??{},o=r?.currentVersion??this._version??0;this._confirmedData={...a},this._version=o,this._lastEvent={type:uE.CONFLICT_RESET,discardedFields:t,reason:gE.VERSION_CONFLICT,currentData:a,currentVersion:o,conflictDetails:r,id:++this._eventCounter};break}if(t===pE.ABORT){this._clearTimers();let e=this._queue.length>0||this._pendingFields.size>0?lE.QUEUED:lE.IDLE;this._state=e,e===lE.IDLE&&(this._lastError=null);break}if(t===pE.VALIDATION||t===pE.NOT_FOUND||t===pE.REFUSED){if(this._clearTimers(),t===pE.VALIDATION&&this._activeMutation)for(let t of e.savedFields)this._pendingFields.has(t)||this._pendingFields.set(t,this._activeMutation.savingFields[t]);this._lastEvent={type:uE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=this._queue.length>0||this._pendingFields.size>0?lE.QUEUED:lE.IDLE;break}let r=this._activeMutation?.retryCount??0,i=n.resendable===!1?0:t===pE.TRANSIENT?this._retryDelays.length:+(t===pE.SERVER);if(r<i){let a=t===pE.TRANSIENT?this._retryDelays[r]:this._serverRetryDelay;this._state=lE.ERROR,this._lastEvent={type:uE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:i-r},source:e.source,id:++this._eventCounter},this._retryTimer=setTimeout(()=>{this._retryTimer=null,this._state===lE.ERROR&&this._activeMutation&&(this._activeMutation.retryCount++,az(`retry: attempt`,{mutationId:this._activeMutation.entry.id,retryCount:this._activeMutation.retryCount,maxRetries:i,delayMs:a}),this._transition({type:uz.RETRY}),this._executeTransport(this._activeMutation))},a);break}this._clearTimers();let a=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new yE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._lastEvent={type:uE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=lE.IDLE,this._emitTerminalMutationFailureNotification(n,a);break}case uz.RETRY:this._state===lE.ERROR&&(this._state=lE.SAVING);break;case uz.CONFLICT_DETECTED:this._clearTimers(),this._state=lE.CONFLICT,this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new yE),null);for(let e of this._queue)e.reject(new yE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._confirmedData={...e.currentData},this._version=e.currentVersion,this._lastEvent={type:uE.CONFLICT_RESET,discardedFields:e.discardedFields,reason:e.reason,currentData:e.currentData,currentVersion:e.currentVersion,conflictDetails:e.conflictDetails,id:++this._eventCounter};break;case uz.CONFLICT_ACKNOWLEDGED:this._state===lE.CONFLICT&&(this._state=this._queue.length>0?lE.QUEUED:lE.IDLE,this._lastError=null);break;case uz.CANCEL:this._state=lE.IDLE,this._lastError=null;break;case uz.DELETE:this._clearTimers(),this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new bE),null);for(let e of this._queue)e.reject(new bE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._state=lE.DELETED,this._lastEvent={type:uE.RESOURCE_DELETED,reason:e.reason,deletedBy:e.deletedBy,id:++this._eventCounter};break;case uz.REMOTE_UPDATE:this._lastEvent={type:uE.REMOTE_UPDATE,changedFields:e.changedFields,mergedFields:e.mergedFields,version:e.version,initiatorUserId:e.initiatorUserId,crdtResolutions:e.crdtResolutions,id:++this._eventCounter}}this._state!==t&&az(`_transition`,{event:e.type,from:t,to:this._state,queueDepth:this._queue.length,pendingFieldCount:this._pendingFields.size,hasActiveMutation:this._activeMutation!==null,lastEventType:this._lastEvent?.type}),this._invalidateSnapshot()}_emitTerminalMutationFailureNotification(e,t){let n=this._config.operationPathKey??this.resourceType,r={};try{r=Ta.parseOperationPathKey(n)}catch{}try{_i.emit(Ec.NOTIFY_RESOURCE_ERROR,{resourceType:this.resourceType,parentResourcesRequirements:[],operationIdentifier:String(r.operationIdentifier??W.UPDATE),isOperationDefault:r.isOperationDefault??!0,isBulkOperation:r.isBulkOperation??!1,variantKey:r.variantKey,operation:void 0,contextResourceIdentifiers:this._config.contextResourceIdentifiers??{},additionalContext:{error:e.message??`Saving failed after retries`,errorCustomMessageReference:e.type===pE.TRANSIENT?Xl.NETWORK:nz(e.cause).errorCustomMessageReference,errorHttpStatus:e.status,errorRefusalCode:nz(e.cause).errorRefusalCode,...rz(e.cause),mutationErrorType:e.type,discardedFields:t}})}catch(e){az(`_emitTerminalMutationFailureNotification: emit failed`,{resourceId:this._resourceId,error:mo(e)})}}_processQueue(){if(this._activeMutation!==null||this._queue.length===0||this._state===lE.CONFLICT||this._state===lE.DELETED||this._state===lE.ERROR)return;let e=this._queue.shift(),t;if(e.type===dE.SUBMIT||e.type===dE.DRAFT||e.type===dE.PUBLISH)t={...e.fields},this._pendingFields.clear();else{t={};for(let n of Object.keys(e.fields))this._pendingFields.has(n)?(t[n]=this._pendingFields.get(n),this._pendingFields.delete(n)):t[n]=e.fields[n]}az(`_processQueue: dequeued`,{mutationId:e.id,type:e.type,priority:e.priority,savingFields:Object.keys(t),remainingQueue:this._queue.length,remainingPending:this._pendingFields.size});let n=new AbortController;if(e.signal){if(e.signal.aborted){e.reject(new yE(e.source)),this._processQueue();return}e.signal.addEventListener(`abort`,()=>n.abort(),{once:!0})}this._activeMutation={entry:e,savingFields:t,abortController:n,retryCount:0},this._transition({type:uz.START_SAVING}),this._executeTransport(this._activeMutation)}_executeTransport(e){let t=e;az(`_executeTransport: sending`,{mutationId:e.entry.id,type:e.entry.type,fields:Object.keys(e.savingFields),version:this._version,retryCount:e.retryCount});let n={};for(let t of Object.keys(e.savingFields))if(this._isCrdtManagedField(t)){let e=this._pendingFieldTimestamps.get(t);e!==void 0&&(n[t]=e)}let r=t.entry.transportOverride,i=()=>({operationPathKey:r?.operationPathKey??this._config.operationPathKey??this._config.resourceType,contextualParameters:r?.contextualParameters??this._config.contextualParameters,parentResourcesRequirements:r?.parentResourcesRequirements??this._config.parentResourcesRequirements,requestData:r?.requestData??(cz.has(e.entry.type)?ME(sz(e.savingFields,this._confirmedData),this._discriminatorFieldNames,this._confirmedData):sz(e.savingFields,this._confirmedData)),expectedVersion:this._version,signal:e.abortController.signal,fieldTimestamps:Object.keys(n).length>0?n:void 0}),a;try{a=this._config.transportAdapter.execute(i())}catch(e){a=Promise.reject(e)}a.then(async e=>{if(this._activeMutation!==t){az(`_executeTransport: stale callback — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),i=t.entry.source,a=e.status===mE.SUCCESS&&!e.heldForApproval&&r?.readBackOnSuccess?await this._readBackConfirmedState(e):e;if(a.status===mE.SUCCESS){az(`_executeTransport: success`,{mutationId:t.entry.id,savedFields:n,newVersion:a.newVersion});let e=a.fieldMeta??a.data?._field_meta;e!=null&&(this._fieldMeta=Pr(e));for(let e of n)this._pendingFieldTimestamps.delete(e);let r=Object.entries(t.savingFields).filter(([,e])=>e===null).map(([e])=>e),o=cz.has(t.entry.type)?t.savingFields:void 0;this._transition({type:uz.SAVE_SUCCESS,result:a,savedFields:n,savedValues:o,clearedFields:r,source:i}),this._activeMutation=null,this._recordProducedVersion(a.newVersion),this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve(a.heldForApproval?{success:!0,savedFields:[],heldForApproval:a.heldForApproval}:{success:!0,savedFields:n,savedValues:o,newVersion:a.newVersion,responseData:a.data}),this._processQueue(),this._notifyDrained()}else az(`_executeTransport: error`,{mutationId:t.entry.id,errorType:a.error?.type,errorStatus:a.error?.status,errorMessage:a.error?.message,savedFields:n}),this._transition({type:uz.SAVE_ERROR,result:a,savedFields:n,source:i}),this._state===lE.ERROR||(this._state===lE.CONFLICT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:pE.CONFLICT,conflictDetails:a.error?.conflictDetails}}),this._notifyDrained()):a.error?.type===pE.ABORT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.reject(new yE(t.entry.source)),this._processQueue(),this._notifyDrained()):(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:a.error?{type:a.error.type,status:a.error.status,validationErrors:a.error.validationErrors,message:a.error.message,cause:a.error.cause}:void 0}),this._processQueue(),this._notifyDrained()))},e=>{if(this._activeMutation!==t){az(`_executeTransport: stale rejection — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),r=t.entry.source;az(`_executeTransport: transport rejected`,{mutationId:t.entry.id,error:mo(e),savedFields:n}),this._transition({type:uz.SAVE_ERROR,result:{status:mE.ERROR,error:{type:pE.TRANSIENT,message:mo(e),cause:e}},savedFields:n,source:r}),this._state===lE.ERROR||(this._activeMutation=null,this._processDeferredSelfEvents(void 0),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:pE.TRANSIENT,message:mo(e),cause:e}}),this._processQueue(),this._notifyDrained())})}async _readBackConfirmedState(e){let t=this._config.readOperationPathKey;if(!t)return e;let n=await this._config.transportAdapter.execute({operationPathKey:t,contextualParameters:this._config.contextualParameters,parentResourcesRequirements:this._config.parentResourcesRequirements,dataMode:Hl.RAW,signal:void 0});return n.status===mE.SUCCESS?(this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,{...e,data:n.data,newVersion:n.newVersion??e.newVersion,fieldMeta:n.fieldMeta??e.fieldMeta}):(this._allowSettledSelfEventRepair=!0,this._scheduleAuthoritativeRecovery(),az(`_readBackConfirmedState: falling back to mutation response`,{errorType:n.error?.type,errorStatus:n.error?.status}),{...e,data:void 0,fieldMeta:void 0})}_applyConfirmedClears(e,t){if(!e?.length||!this._confirmedData)return;let n=structuredClone(this._confirmedData);for(let r of e)t&&oz(t,r)!==void 0||lz(n,r,void 0);this._confirmedData=n}_mergeResponseDataIntoConfirmed(e){let t=this._confirmedData===null?{}:structuredClone(this._confirmedData);for(let[n,r]of Object.entries(e))lz(t,n,r);this._confirmedData=t}_getOptimisticData(){if(!this._confirmedData)return null;if(this._pendingFields.size===0&&!this._activeMutation)return this._confirmedData;if(this._optimisticDataVersion===this._snapshotVersion)return this._cachedOptimisticData;let e=structuredClone(this._confirmedData);if(this._activeMutation)for(let[t,n]of Object.entries(this._activeMutation.savingFields))lz(e,t,n);for(let[t,n]of this._pendingFields)lz(e,t,n);return this._cachedOptimisticData=e,this._optimisticDataVersion=this._snapshotVersion,e}_invalidateSnapshot(){this._snapshotVersion++,this._cachedSnapshot=null;for(let e of this._snapshotListeners)e()}_applyRemoteUpdateInternal(e,t,n,r,i=!1){if(this._state===lE.DELETED)return;let a=this._version;this._clearAuthoritativeRecoveryTimer();let o=structuredClone(this._confirmedData??{});if(this._activeMutation)for(let[e,t]of Object.entries(this._activeMutation.savingFields))lz(o,e,t);for(let[e,t]of this._pendingFields)lz(o,e,t);if(this._version!==null&&(i?t<this._version:t<=this._version)){az(`_applyRemoteUpdateInternal: stale — ignored`,{incomingVersion:t,currentVersion:this._version});return}let s=Object.keys(e),c=[...this._pendingFields.keys()],l=this._activeMutation?Object.keys(this._activeMutation.savingFields):[],u=[...new Set([...l,...c])],d=s.filter(e=>u.some(t=>TM(e,t)));az(`_applyRemoteUpdateInternal`,{version:t,changedFields:s,overlappingFields:d,initiatorUserId:n,state:this._state});let f=[],p=[];for(let e of d)this._isCrdtManagedField(e)?f.push(e):p.push(e);let m=[],h={},g=structuredClone(this._confirmedData??{});for(let t of s)d.includes(t)||(lz(g,t,e[t]),m.push(t));for(let t of f){let n=u.find(e=>TM(t,e)),i=r?.[t]?.ts??0,a=n?this._pendingFieldTimestamps.get(n)??0:0,o=gc(i,a);h[t]=o,o===Oc.INCOMING?(n&&(this._pendingFields.delete(n),this._pendingFieldTimestamps.delete(n)),lz(g,t,e[t]),m.push(t),az(`CRDT LWW: remote wins`,{field:t,remoteTs:i,localTs:a})):az(`CRDT LWW: local wins (keep pending)`,{field:t,remoteTs:i,localTs:a})}this._confirmedData=g,r!=null&&(this._fieldMeta={...Pr(this._fieldMeta),...Pr(r)}),this._version=t;let _=Object.keys(h).length>0?h:void 0;if(p.length===0||this._config.conflictPolicy.strategy===hE.LAST_WRITE_WINS){this._transition({type:uz.REMOTE_UPDATE,changedFields:s,mergedFields:m,version:t,initiatorUserId:n,crdtResolutions:_});return}let v=new Map,y=new Map;for(let e of f){let t=u.find(t=>TM(e,t)),n=t?this._pendingFieldTimestamps.get(t)??0:0,i=r?.[e]?.ts??0;if(t&&gc(i,n)===Oc.EXISTING&&this._pendingFields.has(t)){v.set(t,this._pendingFields.get(t));let e=this._pendingFieldTimestamps.get(t);e!==void 0&&y.set(t,e)}}let b=structuredClone(this._confirmedData??{});for(let[t,n]of Object.entries(e))lz(b,t,n);let x=u.filter(e=>!v.has(e)),S={currentVersion:t,expectedVersion:a??t,conflictingFields:d,currentValues:Object.fromEntries(d.map(e=>[e,EM(b,e)])),submittedValues:Object.fromEntries(d.map(e=>[e,EM(o,e)]))};this._transition({type:uz.CONFLICT_DETECTED,discardedFields:x,reason:gE.REMOTE_UPDATE,currentData:b,currentVersion:t,conflictDetails:S});for(let[e,t]of v)this._pendingFields.set(e,t);for(let[e,t]of y)this._pendingFieldTimestamps.set(e,t)}_processDeferredSelfEvents(e){if(this._deferredSelfEvents.length===0)return;let t=this._deferredSelfEvents;this._deferredSelfEvents=[];for(let n of t)if(e!==void 0&&n.version===e){if(this._allowSettledSelfEventRepair){this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,az(`_processDeferredSelfEvents: accepting deferred self-event after canonical read-back miss`,{version:n.version}),this._applyRemoteUpdateInternal(n.changedFields,n.version,n.initiatorUserId,n.fieldMeta,!0);continue}az(`_processDeferredSelfEvents: discarded (version matches response)`,{version:n.version})}else az(`_processDeferredSelfEvents: processing as remote change`,{eventVersion:n.version,responseVersion:e}),this._applyRemoteUpdateInternal(n.changedFields,n.version,n.initiatorUserId,n.fieldMeta)}_clearTimers(){this._retryTimer&&=(clearTimeout(this._retryTimer),null),this._softTimer&&=(clearTimeout(this._softTimer),null),this._hardTimer&&=(clearTimeout(this._hardTimer),null)}_scheduleAuthoritativeRecovery(){this._authoritativeRecoveryTimer||this._state===lE.DELETED||(this._authoritativeRecoveryTimer=setTimeout(()=>{this._authoritativeRecoveryTimer=null,this._retryAuthoritativeRecovery()},this._serverRetryDelay))}_clearAuthoritativeRecoveryTimer(){this._authoritativeRecoveryTimer&&=(clearTimeout(this._authoritativeRecoveryTimer),null)}async _retryAuthoritativeRecovery(){if(this._state===lE.DELETED||!this._allowSettledSelfEventRepair)return;let e=this._config.readOperationPathKey;if(!e)return;let t=await this._config.transportAdapter.execute({operationPathKey:e,contextualParameters:this._config.contextualParameters,parentResourcesRequirements:this._config.parentResourcesRequirements,dataMode:Hl.RAW,signal:void 0});if(t.status!==mE.SUCCESS||!t.data){az(`_retryAuthoritativeRecovery: canonical reread still unavailable`,{errorType:t.error?.type,errorStatus:t.error?.status});return}let n=t.newVersion??this._version;n==null?az(`_retryAuthoritativeRecovery: canonical reread missing version`,{resourceId:this._resourceId}):(az(`_retryAuthoritativeRecovery: restored canonical confirmed state`,{resourceId:this._resourceId,version:n}),this.setInitialState(t.data,n,t.fieldMeta))}_startBackpressureTimers(){this._softTimer||(this._softTimer=setTimeout(()=>{this._softTimer=null,this._activeMutation&&(az(`backpressure: soft timeout`,{mutationId:this._activeMutation.entry.id,timeoutMs:this._backpressure.softTimeoutMs}),this._lastEvent={type:uE.MUTATION_RESULT,result:{success:!1,error:{type:pE.TRANSIENT,message:`Operation taking longer than expected`}},source:this._activeMutation.entry.source,id:++this._eventCounter},this._invalidateSnapshot())},this._backpressure.softTimeoutMs),this._hardTimer=setTimeout(()=>{this._hardTimer=null,this._clearTimers(),az(`backpressure: hard timeout — aborting`,{mutationId:this._activeMutation?.entry.id,timeoutMs:this._backpressure.hardTimeoutMs});let e=this._activeMutation?.entry.source;this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new yE(this._activeMutation.entry.source)),null),this._deferredSelfEvents=[];let t=this._queue.length>0||this._pendingFields.size>0?lE.QUEUED:lE.IDLE;this._state=t,this._lastError=t===lE.IDLE?null:{type:pE.TRANSIENT,message:`Hard timeout exceeded`},this._lastEvent={type:uE.MUTATION_RESULT,result:{success:!1,error:{type:pE.TRANSIENT,message:`Hard timeout exceeded`},retriesRemaining:0},source:e??dz,id:++this._eventCounter},this._invalidateSnapshot(),this._processQueue(),this._notifyDrained()},this._backpressure.hardTimeoutMs))}_autoCoalesceQueue(){if(this._queue.length<=1||this._queue.some(e=>e.transportOverride!==void 0))return;let e=0;for(let t=1;t<this._queue.length;t++)this._queue[t].priority>=this._queue[e].priority&&(e=t);let t=this._queue[e],n=[];for(let r=0;r<this._queue.length;r++){if(r===e)continue;let i=this._queue[r];for(let[e,n]of Object.entries(i.fields))e in t.fields||(t.fields[e]=n);n.push(i)}az(`_autoCoalesceQueue`,{survivorId:t.id,absorbedCount:n.length,absorbedIds:n.map(e=>e.id),mergedFieldCount:Object.keys(t.fields).length});let r=t.resolve,i=t.reject;t.resolve=e=>{r(e);for(let t of n)t.resolve(e)},t.reject=e=>{i(e);for(let t of n)t.reject(e)},this._queue=[t]}_notifyDrained(){if(!(this._activeMutation!==null||this._queue.length>0)){for(let e of this._onDrainCallbacks)e();this._onDrainCallbacks=[]}}},mz=as.getLogger(),hz=mz.debugByType(`RMMRegistry`);mz.setDebugTypeLogging(`RMMRegistry`,!1);var gz=class{_instances=new Map;_activeInstanceListeners=new Set;_activeInstancesEmitScheduled=!1;MAX_INSTANCES;_clockOffset=0;constructor(e){this.MAX_INSTANCES=e?.maxInstances??200,hz(`constructor`,{maxInstances:this.MAX_INSTANCES})}get clockOffset(){return this._clockOffset}setClockOffset(e){this._clockOffset=e;for(let[,t]of this._instances)t.refCount>0&&!t.destroying&&(t.rmm.clockOffset=e)}getOrCreate(e,t,n){let r=this.keyFor(e,t),i=this._instances.get(r);if(i&&!i.destroying){i.destroyTimer&&(clearTimeout(i.destroyTimer),i.destroyTimer=null,hz(`getOrCreate: cancelled pending destroy`,{key:r}));let e=i.rmm.readOperationPathKey;return n.readOperationPathKey!==void 0&&e!==void 0&&n.readOperationPathKey!==e&&mz.warn(`RMMRegistry updating canonical read path on reused instance`,{key:r,previousReadOperationPathKey:e,nextReadOperationPathKey:n.readOperationPathKey}),i.rmm.syncRuntimeRoutingConfig({transportAdapter:n.transportAdapter,currentUserId:n.currentUserId,contextResourceIdentifiers:n.contextResourceIdentifiers,contextualParameters:n.contextualParameters,parentResourcesRequirements:n.parentResourcesRequirements,operationPathKey:n.operationPathKey,readOperationPathKey:n.readOperationPathKey,conflictPolicy:n.conflictPolicy,resourceSchema:n.resourceSchema,resourceInheritance:n.resourceInheritance}),i.refCount++,i.lastAccessedAt=Date.now(),hz(`getOrCreate: reused`,{key:r,refCount:i.refCount}),this._emitActiveInstancesChanged(),i.rmm}i?.destroying&&(hz(`getOrCreate: old instance mid-destroy, replacing`,{key:r}),this._instances.delete(r)),this._evictIfNeeded();let a=new pz(n);return this._clockOffset!==0&&(a.clockOffset=this._clockOffset),this._instances.set(r,{rmm:a,refCount:1,destroyTimer:null,lastAccessedAt:Date.now(),destroying:!1}),hz(`getOrCreate: created`,{key:r,instanceCount:this._instances.size}),this._instances.size>=this.MAX_INSTANCES*.8&&mz.warn(`RMMRegistry approaching capacity`,{current:this._instances.size,max:this.MAX_INSTANCES}),this._emitActiveInstancesChanged(),a}get(e,t){return this._instances.get(this.keyFor(e,t))?.rmm}getActiveInstances(){let e=[];for(let[t,n]of this._instances)if(n.refCount>0&&!n.destroying){let r=t.indexOf(`:`);if(r<0)continue;let i=t.substring(0,r),a=t.substring(r+1);e.push({key:t,resourceType:i,resourceId:a,rmm:n.rmm})}return e}subscribeActiveInstances(e){return this._activeInstanceListeners.add(e),e(this.getActiveInstances()),()=>{this._activeInstanceListeners.delete(e)}}notifyInstanceRuntimeChanged(){this._emitActiveInstancesChanged()}keyFor(e,t){return`${e}:${t}`}release(e){let t=this._instances.get(e);t&&(t.refCount--,hz(`release`,{key:e,refCount:t.refCount}),t.refCount<=0&&(t.refCount=0,t.destroyTimer||=setTimeout(()=>{t.destroyTimer=null,t.destroying=!0,hz(`release: destroy timer fired`,{key:e}),t.rmm.destroy().then(()=>this.remove(e)).catch(()=>{hz(`release: destroy failed, force-removing`,{key:e}),this.remove(e)})},100)),this._emitActiveInstancesChanged())}remove(e){let t=this._instances.get(e);t&&(t.destroyTimer&&clearTimeout(t.destroyTimer),this._instances.delete(e),hz(`remove`,{key:e,remainingInstances:this._instances.size}),this._emitActiveInstancesChanged())}destroy(){hz(`destroy: cleaning up all instances`,{count:this._instances.size});for(let[e,t]of this._instances)t.destroyTimer&&clearTimeout(t.destroyTimer),t.rmm.destroy().catch(()=>{hz(`destroy: instance cleanup failed`,{key:e})});this._instances.clear(),this._emitActiveInstancesChanged()}_evictIfNeeded(){if(this._instances.size<this.MAX_INSTANCES)return;let e=null,t=1/0;for(let[n,r]of this._instances)r.refCount===0&&r.lastAccessedAt<t&&(e=n,t=r.lastAccessedAt);if(e){let n=this._instances.get(e);n.destroyTimer&&clearTimeout(n.destroyTimer),hz(`_evictIfNeeded: evicting LRU`,{key:e,lastAccessedAt:t}),n.rmm.destroy().catch(()=>{hz(`_evictIfNeeded: eviction cleanup failed`,{key:e})}),this._instances.delete(e)}else mz.warn(`RMMRegistry at capacity with no idle instances to evict`,{instanceCount:this._instances.size,maxInstances:this.MAX_INSTANCES})}_emitActiveInstancesChanged(){this._activeInstanceListeners.size!==0&&(this._activeInstancesEmitScheduled||(this._activeInstancesEmitScheduled=!0,queueMicrotask(()=>{if(this._activeInstancesEmitScheduled=!1,this._activeInstanceListeners.size===0)return;let e=this.getActiveInstances();for(let t of this._activeInstanceListeners)t(e)})))}},_z=as.getLogger(),vz=_z.debugByType(`RMMClockSync`);_z.setDebugTypeLogging(`RMMClockSync`,!1);function yz(e){return e.length===0?0:e.reduce((e,t)=>t.rtt<e.rtt?t:e).offset}async function bz(e){let t=[];for(let n=0;n<5;n++)try{let n=Date.now(),r=await fetch(`${e}${w[tre.HEALTH_TIME]}`),i=Date.now(),a=r.headers.get(Ju.X_SERVER_TIME);if(a){let e=Number(a),r=i-n,o=e-(i-r/2);t.push({offset:o,rtt:r})}}catch{}return t}async function xz(e,t){let n=await bz(e);if(n.length>0){let e=yz(n),r=n.reduce((e,t)=>Math.min(e,t.rtt),1/0);t.setClockOffset(e),vz(`calibrated`,{offset:e,sampleCount:n.length,minRtt:r})}return Date.now()}var Sz=(0,Q.createContext)(void 0);function Cz({children:e,options:t,apiBaseUrl:n}){let r=(0,Q.useMemo)(()=>new gz(t),[]),i=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!n)return;xz(n,r).then(e=>{i.current=e});let e=setInterval(()=>{xz(n,r).then(e=>{i.current=e})},Mge);return()=>{clearInterval(e)}},[r,n]),(0,Q.useEffect)(()=>{if(!n)return;function e(){document.visibilityState===`visible`&&Date.now()-i.current>=3e5&&xz(n,r).then(e=>{i.current=e})}return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[r,n]),(0,Q.useEffect)(()=>()=>r.destroy(),[r]),(0,$.jsx)(Sz.Provider,{value:r,children:e})}var wz=Hl.RAW;function Tz(e,t,n){let r=t.resourceConfigurations[e],i=r?.operations??[],a=(e,n)=>ph({resourceConfig:r,operations:e,coreOperation:W.READ,registry:t,hasResourceId:n.hasResourceId,contextResourceIdentifiers:n.contextResourceIdentifiers,contextualParameters:n.contextualParameters,preferredVariantKey:n.actingOperation?.variantKey}),o=n?.actingOperation?.admitsCrossTenantPlatformAdministration===!0?a(i.filter(e=>e.admitsCrossTenantPlatformAdministration===!0),n):void 0,s=n?o??a(i,n):nu(i,W.READ);if(s||!n||n.hasResourceId===!0)return s;let c=Ra(i,W.READ).filter(e=>e.isOperationDefault!==!0&&e.isBulkOperation!==!0&&(e.initiatorInfos??[]).some(e=>(e.parameters??[]).some(e=>n.contextResourceIdentifiers?.[String(e.resourceType)]!==void 0||n.contextualParameters?.[e.fieldIdentifier]!==void 0)));return c.length===1?c[0]:void 0}function Ez(e,t,n){let r=t.resourceConfigurations[e]?.operations??[],i=Ra(r,W.READ),a=Tz(e,t,n);if(a)return Ta.createOperationPathKeyFromOperation(a);if(i.length===0||n)return;let o=i.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(o.length===1)return Ta.createOperationPathKeyFromOperation(o[0])}function Dz(e){return e.loadedOperationPathKey===e.canonicalReadOperationPathKey&&e.dataMode===wz}async function Oz(e){return e.doOperation(e.readOperationPathKey,{contextualParameters:e.contextualParameters,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:wz})}var kz=as.getLogger(),Az=kz.debugByType(`useListInvalidation`);kz.setDebugTypeLogging(`useListInvalidation`,!1);function jz(e,t){let n=(0,Q.useSyncExternalStore)(e?.subscribe??DM,e?.getSnapshot??OM),{emit:r}=Mo(),i=(0,Q.useContext)(um)?.isConnected??!1,a=(0,Q.useRef)(i);a.current=i;let o=(0,Q.useRef)(t);o.current=t,(0,Q.useEffect)(()=>{if(e&&n.lastEvent?.type===uE.MUTATION_RESULT&&n.lastEvent.result.success&&!a.current){let t=n.lastEvent.result,i=ry({resourceType:e.resourceType,registry:o.current.registry,callContext:o.current.contextResourceIdentifiers,previousRow:t.previousConfirmedData,row:t.responseData}),s=ty({resourceType:e.resourceType,registry:o.current.registry,scopes:i}),c=s.length>0?s:[null];for(let t of c){let n={resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:i.contextResourceIdentifiers,...i.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:i.previousContextResourceIdentifiers}:{},parentResourcesRequirements:o.current.parentResourcesRequirements,operation:t??{operationIdentifier:W.LIST}};r(Ec.RESOURCE_REFRESH,n)}Az(`list invalidation triggered`,{resourceType:e.resourceType,isConnected:a.current})}},[n.lastEvent?.id])}var Mz=as.getLogger(),Nz=Mz.debugByType(`useResourceRMM`);Mz.setDebugTypeLogging(`useResourceRMM`,!1);var Pz={strategy:hE.ACCEPT_REMOTE},Fz;(function(e){e.PROVIDER_MISSING=`PROVIDER_MISSING`,e.DISABLED=`DISABLED`,e.MISSING_RESOURCE_ID=`MISSING_RESOURCE_ID`,e.NO_ELIGIBLE_UPDATE_OPERATION=`NO_ELIGIBLE_UPDATE_OPERATION`})(Fz||={});function Iz(e){let{resourceType:t,resourceId:n,doOperationRef:r,contextualParameters:i,parentResourcesRequirements:a,contextResourceIdentifiers:o,resourceSchema:s,resourceInheritance:c,enabled:l=!0,conflictPolicy:u=Pz,directFallbackAccepted:d=!1,actingOperation:f}=e,p=(0,Q.useContext)(Sz),{registry:m}=fm(),h=(0,Q.useContext)(ah),g=h?.primaryScopeInitiatorIds?.userId??null,_=(0,Q.useRef)(``);(h?.user?._id||g)&&(_.current=h?.user?._id??g);let v=h?.user?._id??g??_.current,y=m.resourceConfigurations[t],b=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(o),[o]),x=(0,Q.useMemo)(()=>JSON.stringify(a??null),[a]),S=n?String(n):``,C=(0,Q.useMemo)(()=>new Dge((...e)=>r.current(...e)),[]),w=fS(hh(t,S||void 0,o)),T=(0,Q.useMemo)(()=>Gm({resourceConfig:y,operations:y?.operations??[],registry:m,hasResourceId:!!S,contextResourceIdentifiers:o,contextualParameters:i,viewer:w}),[b,i,m,y,S,w]),E=(0,Q.useMemo)(()=>T?Ta.createOperationPathKeyFromOperation(T):null,[t,T]),D=(0,Q.useMemo)(()=>Ez(t,m,{hasResourceId:!!S,contextResourceIdentifiers:o,contextualParameters:i,actingOperation:f}),[f?.admitsCrossTenantPlatformAdministration,f?.variantKey,b,i,m,y?.operations,S,t]),O=(0,Q.useMemo)(()=>l?S?T?p?null:Fz.PROVIDER_MISSING:Fz.NO_ELIGIBLE_UPDATE_OPERATION:Fz.MISSING_RESOURCE_ID:Fz.DISABLED,[l,S,p,T]),k=(0,Q.useMemo)(()=>O===Fz.DISABLED?(Nz(`RMM unavailable because attachment is disabled for this surface.`,{resourceType:t,resourceId:S}),null):O===Fz.MISSING_RESOURCE_ID?(Nz(`RMM unavailable because no resource id is attached to the current surface.`,{resourceType:t}),null):O===Fz.NO_ELIGIBLE_UPDATE_OPERATION&&d?(Nz(`RMM unavailable because no eligible UPDATE-like operation resolves; the caller runs directly, as the operation declared.`,{resourceType:t,resourceId:S}),null):O===Fz.NO_ELIGIBLE_UPDATE_OPERATION?(Mz.warn(`[useResourceRMM] RMM unavailable because no eligible UPDATE-like operation could be resolved for this surface. Default update-like surfaces should fail closed unless they explicitly opt into a weaker direct-operation fallback.`,{resourceType:t,resourceId:S}),null):O===Fz.PROVIDER_MISSING?(Mz.warn(`[useResourceRMM] RMM unavailable because RMMRegistryProvider is not mounted. Default update-like surfaces should fail closed unless they explicitly opt into a weaker direct-operation fallback.`,{resourceType:t,resourceId:S}),null):p.getOrCreate(t,S,{resourceType:t,resourceId:S,transportAdapter:C,operationPathKey:E,readOperationPathKey:D,conflictPolicy:u,currentUserId:v,contextResourceIdentifiers:Hu(o),contextualParameters:i,parentResourcesRequirements:a,resourceSchema:s,resourceInheritance:c}),[d,E,D,p,t,S,O]);(0,Q.useEffect)(()=>{k&&E&&(k.syncRuntimeRoutingConfig({transportAdapter:C,currentUserId:v,contextResourceIdentifiers:Hu(o),contextualParameters:i,parentResourcesRequirements:a,operationPathKey:E,readOperationPathKey:D,conflictPolicy:u,resourceSchema:s,resourceInheritance:c}),p?.notifyInstanceRuntimeChanged())},[k,p,v,u.strategy,b,E,D,x,i,s,c,C]),(0,Q.useEffect)(()=>{if(!k||!p||!S)return;let e=p.keyFor(t,S);return()=>{p.release(e)}},[k,p,t,S]);let A=(0,Q.useSyncExternalStore)(k?.subscribe??DM,k?.getSnapshot??OM);return jz(k,{contextResourceIdentifiers:Hu(o),parentResourcesRequirements:a??[],registry:m}),{rmm:k,rmmSnapshot:A,rmmRegistry:p??null,rmmUnavailableReason:O,canonicalReadOperationPathKey:D}}function Lz(e,t){return e.replace(`{fields}`,t.join(`, `))}function Rz(e,t){return t?typeof e==`object`&&e&&t in e?e[t]:t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}function zz(e,t){if(e==null||e===``)return t;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);try{let n=JSON.stringify(e);return n?n.length>120?`${n.slice(0,117)}...`:n:t}catch{return String(e)}}var Bz=e=>{let{renderIcon:t}=Mf();if(e.type===`conflict`){let n=e.conflictDetails?.conflictingFields?.length?e.conflictDetails.conflictingFields:e.discardedFields;return(0,$.jsxs)(jD,{variant:`warning`,children:[t(H.WARNING,{size:ca.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between gap-element`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(MD,{children:e.labels.title}),(0,$.jsx)(ND,{children:Lz(e.labels.message,n)}),e.conflictDetails&&n.length>0&&(0,$.jsx)(`div`,{className:`mt-item-xs space-y-item-xs`,children:n.map(t=>(0,$.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/40 px-item-sm py-item-xs`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:t}),(0,$.jsxs)(`div`,{className:`mt-item-xs grid grid-cols-[auto_1fr] items-baseline gap-x-item-sm gap-y-[2px] text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.labels.currentValue}),(0,$.jsx)(`code`,{className:`min-w-0 truncate text-muted-foreground`,children:zz(Rz(e.conflictDetails?.currentValues,t),e.labels.emptyValue)}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.labels.submittedValue}),(0,$.jsx)(`code`,{className:`min-w-0 truncate font-medium text-foreground`,children:zz(Rz(e.conflictDetails?.submittedValues,t),e.labels.emptyValue)})]})]},t))})]}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:e.onDismiss,className:`shrink-0`,children:e.labels.acknowledgeButton})]})]})}return(0,$.jsxs)(jD,{variant:`info`,className:`mb-item-xs`,children:[t(H.INFO,{size:ca.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,$.jsx)(ND,{children:Lz(e.labels.message,e.changedFields)}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:e.onDismiss,"aria-label":e.labels.dismissAriaLabel,className:`shrink-0`,children:t(H.CLOSE,{size:ca.SM})})]})]})},Vz=`relationship.quick_create.completed`;function Hz(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`quick-create-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Uz(e){if(!e.result||typeof e.result!=`object`||Array.isArray(e.result))return;let t=e.result,n=t[e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]??`_id`]??t._id;return typeof n==`string`&&n!==``?n:void 0}function Wz(e){let{registry:t}=fm(),{on:n}=Mo(),{navigate:r}=DS(),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>{if(e.sourceResourceType&&e.sourceFieldName)return Ej({resourceType:e.sourceResourceType,fieldName:e.sourceFieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:t}).inlineEditSurface?.quickCreate},[e.sourceFieldName,e.sourceResourceType,e.operationType,e.relatedResourceType,t]),c=(0,Q.useMemo)(()=>{if(s)return s.relatedCreateOperation},[s]);(0,Q.useEffect)(()=>n(Ec.RESOURCE_CUSTOM_EVENT,t=>{let n=t.data;n&&n.requestId===o.current&&(o.current=null,a(!1),e.onCreated?.(n))},e=>e.eventName===Vz&&e.data?.requestId===o.current),[n,e]),(0,Q.useEffect)(()=>n(Ec.NAVIGATION_CLOSE,()=>{a(!1)}),[n]);let l=(0,Q.useCallback)(()=>{if(!s||!s.allowQuickCreate||!c||!e.navigationZone||!e.sourceFieldName)return;let n=Hz();o.current=n,a(!0);let i={requestId:n,sourceResourceType:e.sourceResourceType,sourceResourceId:e.sourceResourceId,sourceFieldName:e.sourceFieldName,relatedResourceType:s.relatedResourceType},l=On.createFrontendResourceOperationContextFromOperation({resourceType:s.relatedResourceType,operation:c,contextResourceIdentifiers:On.withoutSelfReferencingParents(e.contextResourceIdentifiers??{},s.relatedResourceType,t),additionalContext:{quickCreateRequest:i},isOperationDefault:c.isOperationDefault??!0,isBulkOperation:c.isBulkOperation??!1,variantKey:c.variantKey});r({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:l},initiator:dh.createOperationInitiator(e.navigationZone,e.sourceOperation),relationshipTransition:e.navigationZone===`overlay`?Rt.SPLIT:{transition:Rt.OVERLAY,ephemeral:!0}})},[s,r,t,e.contextResourceIdentifiers,e.navigationZone,e.sourceFieldName,e.sourceOperation,e.sourceResourceId,e.sourceResourceType,c]);return{canQuickCreate:!!(s?.allowQuickCreate&&c&&e.navigationZone),isLaunching:i,launchQuickCreate:l,relatedCreateOperation:c,config:s}}function Gz(e){e.emit(Ec.RESOURCE_CUSTOM_EVENT,{resourceType:e.resourceType,resourceId:e.resourceId,eventName:Vz,data:{requestId:e.requestId,resourceType:e.resourceType,resourceId:e.resourceId,data:e.data}})}function Kz(e){return(0,$.jsx)(GM,{mode:e.resolvedChromeMode,labelPlacement:e.resolvedLabelPlacement,label:e.fieldLabel,description:e.fieldDescription,hideError:e.hideInlineErrorForPolicy,tooltip:e.fieldTooltip,fieldName:e.fieldName,disabled:e.disabled,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm`,children:[(0,$.jsx)(`div`,{className:`min-w-[16rem] flex-1`,children:e.controls}),e.actions]}),(e.actionError||e.isUnavailable)&&(0,$.jsx)(`span`,{className:e.actionError?`text-xs text-destructive`:`text-xs text-muted-foreground`,children:e.actionError??e.unavailableLabel})]})})}var qz=as.getLogger();function Jz(e){xa.isDevelopment()&&qz.warn(`[${e.componentName}] ${e.message}`,e.context)}function Yz(e){let t=e.formSchemaContext.contextResourceIdentifiers??{};return{contextResourceIdentifiers:t,parentResourcesRequirements:e.formSchemaContext.parentResourcesRequirements??(Object.keys(t).length>0?V.getInstance().buildParentResourcesRequirements(e.formSchemaContext.resourceType,t,e.registry):[]),contextualParameters:V.buildContextualParameters(t,e.registry)}}function Xz(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let t=F(lr(r));if(!t||(r=t[e],!r))return}return r}var Zz=as.getLogger();function Qz(e){let t=GC(),n=PD(),r=zT(),{registry:i,doOperation:a}=fm();hk(e.fieldName);let{formChromeMode:o,sectionChromeMode:s}=eT(),c=hc(),{tComponent:l}=K(),u=Xz(r?.schema,e.fieldName);return{formContext:t,formSchemaContext:n,templateContext:r,registry:i,doOperation:a,fieldSchema:u,resolvedChromeMode:(u?Xc(u):void 0)?.chromeMode??s??o??UL(c.autoRender?.autoFieldChrome),resolvedLabelPlacement:WL(c.autoRender?.autoLabelPlacement),resolvedControlSize:GL(c.autoRender?.autoFieldDensity),hideInlineErrorForPolicy:c.autoRender?.autoErrorPlacement===`summary-at-surface-top`,fieldLabel:r?.fieldLabels?.[e.fieldName]??hr.formatFieldPathFallback(e.fieldName),fieldDescription:r?.fieldDescriptions?.[e.fieldName],fieldTooltip:r?.fieldTooltips?.[e.fieldName],disabled:r?.disabled,readOnly:r?.readOnly,labels:{saveLabel:l(B.LOW_LEVEL_BUTTON,`save`),savingLabel:l(B.LOW_LEVEL_FORM_FIELD,`saving`),clearLabel:l(B.LOW_LEVEL_FORM_FIELD,`clearSelection`),saveFailedLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_failed`),saveConflictLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_conflict`),saveUnavailableLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_unavailable`)}}}function $z(e){(0,Q.useEffect)(()=>{!e.rmm&&xa.isDevelopment()&&(e.allowsDirectOperationFallback?Zz.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are using weaker-guarantee direct-operation fallback.`,e.context):Zz.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are disabled.`,e.context))},[e.allowsDirectOperationFallback,e.componentName,e.context,e.rmm])}function eB({writeSurface:e,replaceOperation:t,initialRelationshipValue:n,hasHydratedInitialValue:r=!1,rmm:i,allowDirectOperationFallback:a=!1}){let o=e.rootFieldName,s=e.relatedResourceType,{formContext:c,formSchemaContext:l,registry:u,doOperation:d,fieldSchema:f,resolvedChromeMode:p,resolvedLabelPlacement:m,resolvedControlSize:h,hideInlineErrorForPolicy:g,fieldLabel:_,fieldDescription:v,fieldTooltip:y,disabled:b,readOnly:x,labels:{saveLabel:S,savingLabel:C,clearLabel:w,saveFailedLabel:T,saveConflictLabel:E,saveUnavailableLabel:D}}=Qz({fieldName:o}),O=u.allResourceFieldIdentifiers?.[s],k=c.watch(o),A=k??n,j=!f||me(f)===vu.ARRAY,M=r||k!==void 0,N=(0,Q.useMemo)(()=>{let e=new Map;if(!O||!A)return e;let t=Array.isArray(A)?A:[A];for(let n of t){if(!n||typeof n!=`object`||Array.isArray(n))continue;let t=n,r=t[O];typeof r==`string`&&r!==``&&e.set(r,t)}return e},[O,A]),P=(0,Q.useMemo)(()=>[...N.keys()],[N]),[F,I]=(0,Q.useState)(void 0),[ee,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{I(void 0),L(!1),z(void 0)},[o,l.resourceId]),(0,Q.useEffect)(()=>{I(void 0),L(!1),z(void 0)},[P.join(`|`)]);let te=F??(j?P:P[0]),ne=(0,Q.useMemo)(()=>[...new Set(Rw(te))],[te]),re=!i&&!a||!M,ie=(0,Q.useMemo)(()=>{if(ne.length!==P.length)return!0;let e=new Set(P);return ne.some(t=>!e.has(t))},[P,ne]);$z({rmm:i,allowsDirectOperationFallback:a,componentName:`GeneratedAssociationRelationshipField`,context:(0,Q.useMemo)(()=>({fieldName:o}),[o])});let ae=(0,Q.useCallback)(e=>{M&&(I(e),z(void 0))},[M]),oe=(0,Q.useCallback)(()=>{M&&(I(j?[]:void 0),z(void 0))},[M,j]),se=(0,Q.useCallback)(async e=>{if(M&&l.resourceId&&l.resourceType&&O&&(e.length!==P.length||e.some(e=>!new Set(P).has(e)))){if(!i&&!a)z(D);else{L(!0),z(void 0);try{let{contextualParameters:n,parentResourcesRequirements:r}=Yz({formSchemaContext:l,registry:u}),a=e.map(e=>N.get(e)??{[O]:e}),s=Ta.createOperationPathKeyFromOperation(t),f={...Ol([l.resourceId]),peerIds:e};if(i){let e=await i.queueMutation({[o]:j?a:a[0]??null},{type:dE.CUSTOM,priority:vE.NORMAL,source:{type:fE.FORM,subscriberId:`generated-association:${o}`},transportOverride:{operationPathKey:s,contextualParameters:n,parentResourcesRequirements:r,requestData:f,readBackOnSuccess:!0}});if(!e.success){z(e.error?.type===pE.CONFLICT?E:T);return}}else await d(s,{contextualParameters:n,parentResourcesRequirements:r,requestData:f});c.setValue(o,j?a:a[0]??null,{shouldDirty:!1,shouldValidate:!1}),I(void 0)}catch(t){Jz({componentName:`GeneratedAssociationRelationshipField`,message:`Failed to update association relationship`,context:{fieldName:o,action:`save`,desiredPeerIds:e,error:t}}),z(T)}finally{L(!1)}}}},[a,P,N,d,o,c,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,M,ie,j,t,u,O,T,D,i]),ce=(0,Q.useCallback)(async()=>{await se(ne)},[ne,se]);return!f||!O?null:(0,$.jsx)(Kz,{fieldName:o,resolvedChromeMode:p,resolvedLabelPlacement:m,resolvedControlSize:h,hideInlineErrorForPolicy:g,fieldLabel:_,fieldDescription:v,fieldTooltip:y,disabled:b,actionError:R,unavailableLabel:D,isUnavailable:re,controls:(0,$.jsx)(_I,{schema:j?Pd(bd()).optional():bd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?o:void 0,value:te,onChange:ae,targetResourceType:s,onQuickCreateCreated:e=>{let t=[...new Set([...ne,e])];I(j?t:e),z(void 0),se(t)},onBlur:()=>{},disabled:b||x||ee||re,readOnly:x,controlSize:h,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Y.SM,className:`shrink-0`,disabled:!ie||ee||x||re,onClick:()=>{ce()},children:ee?C:S}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,className:`shrink-0`,disabled:ne.length===0||ee||x||re,onClick:oe,children:w})]})})}function tB({writeSurface:e,setOperation:t,clearOperation:n,rmm:r,allowDirectOperationFallback:i=!1}){let a=e.rootFieldName,o=e.foreignKeyIdentity?.fieldIdentifier,s=e.relatedResourceType,{formContext:c,formSchemaContext:l,templateContext:u,registry:d,doOperation:f,fieldSchema:p,resolvedChromeMode:m,resolvedLabelPlacement:h,resolvedControlSize:g,hideInlineErrorForPolicy:_,fieldLabel:v,fieldDescription:y,fieldTooltip:b,disabled:x,readOnly:S,labels:{saveLabel:C,savingLabel:w,clearLabel:T,saveFailedLabel:E,saveConflictLabel:D,saveUnavailableLabel:O}}=Qz({fieldName:a});o&&Xz(u?.schema,o);let k=d.allResourceFieldIdentifiers?.[s],A=c.watch(o),j=c.watch(a),M=(0,Q.useMemo)(()=>{if(typeof A==`string`&&A!==``)return A;if(!k||!j||typeof j!=`object`||Array.isArray(j))return;let e=j[k];return typeof e==`string`&&e!==``?e:void 0},[A,k,j]),[N,P]=(0,Q.useState)(void 0),[F,I]=(0,Q.useState)(void 0),[ee,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),z(void 0)},[a,l.resourceId]),(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),z(void 0)},[M]);let te=F===void 0?M:F??void 0,ne=N??te;$z({rmm:r,allowsDirectOperationFallback:i,componentName:`GeneratedReferenceRelationshipField`,context:(0,Q.useMemo)(()=>({fieldName:a,foreignKeyFieldName:o}),[a,o])});let re=(0,Q.useCallback)(e=>{Array.isArray(e)||(P(e),z(void 0))},[]),ie=(0,Q.useCallback)(async(e,s)=>{if(!l.resourceId||!l.resourceType)return;let u=e===`set`?t:n;if(!u)return;let p=e===`set`?s??ne:void 0;if(e!==`set`||p&&p!==te){if(!r&&!i)z(O);else{L(!0),z(void 0);try{let t=Ta.createOperationPathKeyFromOperation(u),{contextualParameters:n,parentResourcesRequirements:i}=Yz({formSchemaContext:l,registry:d}),s=e===`set`&&p?(()=>{let e=c.getValues(a);return e&&typeof e==`object`&&!Array.isArray(e)?{...e,[k]:p}:{[k]:p}})():void 0,m={...Ol([l.resourceId]),...e===`set`?{targetId:p}:{}};if(r){let c=await r.queueMutation({[a]:e===`set`?s:null,[o]:e===`set`?p:null},{type:dE.CUSTOM,priority:vE.NORMAL,source:{type:fE.FORM,subscriberId:`generated-reference:${a}`},transportOverride:{operationPathKey:t,contextualParameters:n,parentResourcesRequirements:i,requestData:m,readBackOnSuccess:!0}});if(!c.success){z(c.error?.type===pE.CONFLICT?D:E);return}}else await f(t,{contextualParameters:n,parentResourcesRequirements:i,requestData:m});c.setValue(a,e===`set`?s:null,{shouldDirty:!1,shouldValidate:!1}),c.setValue(o,e===`set`?p:null,{shouldDirty:!1,shouldValidate:!1}),I(e===`set`?p??null:null),P(void 0)}catch(t){Jz({componentName:`GeneratedReferenceRelationshipField`,message:`Failed to update reference relationship`,context:{fieldName:a,foreignKeyFieldName:o,action:e,error:t}}),z(E)}finally{L(!1)}}}},[n,ne,te,a,o,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,c,k,d,i,f,r,E,O,t]);return!p||!k||!o?null:(0,$.jsx)(Kz,{fieldName:a,resolvedChromeMode:m,resolvedLabelPlacement:h,resolvedControlSize:g,hideInlineErrorForPolicy:_,fieldLabel:v,fieldDescription:y,fieldTooltip:b,disabled:x,actionError:R,unavailableLabel:O,isUnavailable:!r&&!i,controls:(0,$.jsx)(_I,{schema:bd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?a:void 0,value:ne,onChange:re,onQuickCreateCreated:e=>{P(e),z(void 0),ie(`set`,e)},onBlur:()=>{},disabled:x||S||ee||!r&&!i,readOnly:S,controlSize:g,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Y.SM,className:`shrink-0`,disabled:!N||N===te||ee||S||!r&&!i,onClick:()=>{ie(`set`)},children:ee?w:C}),n&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,className:`shrink-0`,disabled:!te||ee||S||!r&&!i,onClick:()=>{ie(`clear`)},children:T})]})})}var nB=as.getLogger(),rB=nB.debugByType(`ResourceAutomatedForm`);nB.setDebugTypeLogging(`ResourceAutomatedForm`,!1);function iB(e,t){return t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function aB(e,t){let n=e=>e.replace(/\[(\d+)\]/g,`.$1`),r=t.map(n),i={};for(let a of t){let t=n(a);if(r.some(e=>e!==t&&t.startsWith(`${e}.`)))continue;let o=iB(e,a);o!==void 0&&(i[a]=o)}return i}function oB(e,t){let n=e=>e==null||e===``;return n(e)||n(t)?n(e)&&n(t):(0,dC.default)(e,t)}function sB(e){return e.validationErrors?jM({httpStatus:e.status??400,validationErrors:e.validationErrors})!==null:!1}function cB(e){let t=(e.userNotifications||[]).find(e=>{let t=e.channel,n=e.target;return t===lu.FRONT_END_SUCCESS&&n===kre.USER_SELF});return t?{identifier:t.identifier,level:t.level||Il.SUCCESS}:null}function lB(e){switch(e){case W.CREATE:return`create`;case W.UPDATE:case W.UPDATE_MANY:return`saveChanges`;case W.DELETE:return`delete`;default:return`submit`}}function uB(e){return!e.success&&e.error?.type===pE.CONFLICT}function dB(e){return ps(e.operationIdentifier,e.resourceOperationLike)===W.READ||nl(e)}function fB(e,t,n,r){if(!e||h(t))return e;let i=n?Object.keys(n):[],a=r?hr.getObjectLikeFieldShape(r):void 0;if(i.length!==0&&a)return i.every(e=>Object.prototype.hasOwnProperty.call(a,e))?e:void 0}function pB({Template:e,requestFieldNames:t}){let n=Ak(),r=zT(),[i,a]=(0,Q.useState)(null);(0,Q.useLayoutEffect)(()=>{let e=n.placedFields(),i=r?.generatedFieldOverrides??{},o=new Set([...Object.keys(r?.contextFieldValues??{}),...r?.hiddenFieldNames??[]].filter(e=>!i[e]));a(t.filter(t=>!e.has(t)&&!o.has(t)))},[]);let[o,s]=(0,Q.useState)(0),c=(0,Q.useCallback)(()=>(s(e=>e+1),()=>s(e=>e-1)),[]),l=!!i&&i.length>0,u=(0,Q.useMemo)(()=>({content:l?(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(XL,{name:e},e))}):null,claim:c}),[c,l,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kk.Provider,{value:n,children:(0,$.jsx)(XR.Provider,{value:u,children:(0,$.jsx)(e,{})})}),l&&o===0&&(0,$.jsx)(`div`,{className:`mr-auto mt-section w-full space-y-field`,style:{maxInlineSize:nD(`measure`)},"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(XL,{name:e},e))})]})}function mB({resourceContext:e,onSuccess:t,onError:n,onCancel:r,disabled:i=!1,className:a,labelsOverride:o,showErrorSummary:s=!0,validationMode:c,autosaveConfig:l,draftConfig:u,onSectionSave:d,defaultValuesOverride:f,navigationZone:p,updateLikeMutationFallbackMode:m}){let{doOperation:g,registry:_}=fm(),{emit:v}=Mo(),{tComponent:y,tResourceOperation:b,isReady:x}=K({component:B.RESOURCES_LAYOUTS_CREATE,resource:e.resourceType}),S=cp(),w=(0,Q.useRef)(g),T=(0,Q.useRef)(v),E=(0,Q.useRef)(n),D=(0,Q.useRef)(t),k=(0,Q.useRef)(null),A=(0,Q.useRef)(d);w.current=g,T.current=v,E.current=n,D.current=t,A.current=d;let j=(0,Q.useMemo)(()=>new De,[]),{resourceType:M,operation:N,contextResourceIdentifiers:P}=e,F=QR(e,N),I=(0,Q.useContext)(uh),ee=(0,Q.useRef)(I);ee.current=I;let L=(0,Q.useCallback)(e=>wn(e)?(ee.current?.notifyInfo(y(B.RESOURCES_LAYOUTS_CREATE,`operationSentForApproval`)),!0):!1,[y]),R=m??Tl(N,_.resourceConfigurations[M]?.operations),z=String(N.operationIdentifier),te=N.variantKey,ne=N.admitsCrossTenantPlatformAdministration===!0,re=(0,Q.useMemo)(()=>({variantKey:te,admitsCrossTenantPlatformAdministration:ne}),[ne,te]),ie=ps(z,N.resourceOperationLike?String(N.resourceOperationLike):void 0),ae=z,oe=N.resourceOperationLike?String(N.resourceOperationLike):void 0,se=oe??ae,ce=BT(ie,se),[le,ue]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(!1),[he,ge]=(0,Q.useState)(void 0),[_e,ve]=(0,Q.useState)(`none`),[ye,be]=(0,Q.useState)(null),xe=(0,Q.useRef)(null),{initAutoClearing:Se,injectServerErrors:Ce,clearServerErrors:we}=ZR(xe),[Te,Ee]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(u?.isDraft??!1),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),Le=(0,Q.useRef)(null),Re=(0,Q.useMemo)(()=>{let e=N.requestDto;if(!e)return nB.error(`[ResourceAutomatedForm] No requestDto found for operation ${z} on resource ${M}`),e;if(N.isBulkOperation===!0&&e instanceof vae){let t=Cre.filter(t=>t in e.shape),n=t.length>0?e.omit(Object.fromEntries(t.map(e=>[e,!0]))):e;return Rl(ie)?oae(n):n}return e},[ie,N,z,M]),ze=(0,Q.useMemo)(()=>_.resourceConfigurations[M],[_,M]),Be=(0,Q.useMemo)(()=>jE(ze?.mainSchema),[ze]),Ve=(0,Q.useMemo)(()=>ie===W.READ||z===W.UPDATE?new Set:new Set([ze?.mainSchema,...il(ze?.inheritenceSchemaDefinition)].flatMap(e=>[...Co(e)])),[ie,z,ze]),He=(0,Q.useCallback)((e,t=!0)=>{let n=f??{},r=t?{...e,...n}:{...e};for(let e of Ve)Object.prototype.hasOwnProperty.call(n,e)||delete r[e];return r},[f,Ve]);(0,Q.useMemo)(()=>N.operationFrontendConfig,[N]);let Ue=ze?.frontendConfiguration?.layout?.refs,We=ze?.frontendConfiguration?.layout?.defaultChromeMode?.edit,Ge=(0,Q.useMemo)(()=>{let e=ze?.inheritenceSchemaDefinition;if(e)return{discriminatorField:e.discriminatorField,withoutInheritanceDiscriminatorFieldValues:e.withoutInheritanceDiscriminatorFieldValues,inheritedSchemas:e.inheritedSchemas}},[ze]),Ke=(0,Q.useMemo)(()=>{if(Re)return hr.getObjectLikeFieldShape(Re)},[Re]),qe=(0,Q.useMemo)(()=>fB(ze?.frontendConfiguration?.layout?.edit,N.operationIdentifier,Ke,ze?.inheritenceSchemaDefinition?Md(V.resolveFieldShapeOfAnyVariant(ze)??{}):ze?.mainSchema),[ze,N.operationIdentifier,Ke]),Je=ze?.frontendConfiguration?.draftableConfig,Ye=(0,Q.useMemo)(()=>{if(Je||u)return!Je&&u?u:Je&&!u?{enabled:!0,isDraft:!1,discriminator:Je.discriminator,draftValue:Je.draftValue,publishedValue:Je.publishedValue,requireConfirmationToPublish:Je.requireConfirmationToPublish}:{...Je,...u,enabled:u?.enabled??!!Je}},[Je,u]);(0,Q.useEffect)(()=>{Ye?.isDraft!==void 0&&Me(Ye.isDraft)},[Ye?.isDraft]);let Xe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(P),[P]),Ze=(0,Q.useMemo)(()=>V.buildContextualParameters(P,_),[Xe,_]),Qe=(0,Q.useMemo)(()=>{if(!Ke)return{};let t=V.resolveSemanticContextFieldValues({resourceType:M,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:P,contextualParameters:Ze,registry:_}),n={};for(let[e,r]of Object.entries(t))Ke[e]&&(n[e]=r);return n},[Xe,Ze,Ke,_,e.parentResourcesRequirements,M]),$e=(0,Q.useMemo)(()=>{if(!Ke)return{};let e={};for(let t of Object.keys(Ke)){let n=vj({resourceType:M,fieldName:t,operationType:se,registry:_});n&&(e[t]=n)}return e},[se,Ke,_,M]),et=ze?.operations??[],tt=(0,Q.useContext)(ah)?.permissions?.accessProfile,nt=tt?.organizationUnitNarrowing,it=(0,Q.useMemo)(()=>ie===W.CREATE?Bue({resourceType:M,resourceConfiguration:ze,formFieldShape:Ke,readThroughCreateOrganizationUnits:tt?.readThroughCreateOrganizationUnits}):void 0,[tt?.readThroughCreateOrganizationUnits,ie,Ke,ze,M]),ot=Hue({resourceType:ul.ORGANIZATION_UNITS,ids:it,hostContextualParameters:Ze}),st=hg(),ct=Zp()?.currentOrganizationId??void 0,lt=ze?.resourcePrimaryScope===Vr.ORGANIZATIONS&&String(Ze[$u[Vr.ORGANIZATIONS]]??ct??``)||void 0,ut=(0,Q.useMemo)(()=>Uue({roleEntries:tt?.roleEntries,organizationId:lt,roleTables:st,rolesWithinAuthority:tt?.rolesWithinAuthority}),[tt?.roleEntries,tt?.rolesWithinAuthority,lt,st]),dt=(0,Q.useMemo)(()=>Gue({fieldShape:Ke,ceiling:ut,record:he}),[Ke,ut,he]),ft=(0,Q.useMemo)(()=>Kue({fieldShape:Ke,ceiling:ut,record:he}),[Ke,ut,he]),pt=(0,Q.useMemo)(()=>{let e=it?{[Nr]:{values:it,labels:ot}}:void 0;return e||dt?{...dt,...e}:void 0},[it,ot,dt]),mt=(0,Q.useMemo)(()=>{if(!Ke)return[];let e=[];for(let t of Object.values($e)){let n=t.rootFieldName,r=e=>et.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Ul.buildRelationshipBulkOperationIdentifier(e,n));(()=>{if(t.semantics.nature===wi.COMPOSITION&&t.nestedMutationConfig)return!0;if(t.semantics.nature===wi.REFERENCE){let e=t.foreignKeyIdentity?.fieldIdentifier,n=e?Ke[e]:void 0;return!!(n&&Io(n)&&!Object.prototype.hasOwnProperty.call(Qe,e??``))||!!r(C.SET)}return t.semantics.nature===wi.ASSOCIATION&&!!r(C.REPLACE)})()?e.push(n):xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] Keeping relationship root visible because no business-facing editor is available`,{resourceType:M,operationType:se,fieldName:n,relationshipNature:t.semantics.nature,hasNestedMutationConfig:!!t.nestedMutationConfig})}return zue({resourceType:M,resourceConfiguration:ze,formFieldShape:Ke,organizationUnitNarrowing:nt})&&e.push(Nr),e},[Qe,se,Ke,nt,$e,ze,et,M]),ht=(0,Q.useMemo)(()=>Ta.createOperationPathKeyFromOperation(N),[N]),gt=(0,Q.useMemo)(()=>nl(N),[N]),_t=(0,Q.useMemo)(()=>{let e=On.getAddressedRecordId({resourceType:M,operation:N,contextResourceIdentifiers:P});if(e)return e;let t=he&&typeof he==`object`?he._id:void 0;return typeof t==`string`&&t.length>0?t:null},[Xe,he,M,N]),vt=(0,Q.useMemo)(()=>JSON.stringify(e.parentResourcesRequirements??[]),[e.parentResourcesRequirements]),yt=(0,Q.useMemo)(()=>!_t||P[M]?P:{...P,[M]:_t},[Xe,_t,M]),bt=(0,Q.useMemo)(()=>{let e=ze?.resourceFieldIdentifier;return!_t||!e||String(Ze[e]??``)===_t?Ze:{...Ze,[e]:_t}},[Ze,ze?.resourceFieldIdentifier,_t]),xt=(0,Q.useMemo)(()=>{if(!gt||ie!==W.UPDATE||N.operationIdentifier!==W.UPDATE||!ze)return ht;let e=ph({resourceConfig:ze,operations:et,coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt});return e?Ta.createOperationPathKeyFromOperation(e):ht},[Xe,yt,bt,ie,gt,N.operationIdentifier,ht,_,ze,_t,et]),St=(0,Q.useMemo)(()=>{let t=gt&&ie===W.UPDATE&&z!==W.UPDATE;return{operationPathKey:xt,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements,...t?{readBackOnSuccess:!0}:{}}},[bt,xt,ie,gt,z,e.parentResourcesRequirements]),Ct=(0,Q.useCallback)(t=>rc({operation:N,requestData:t,additionalContext:e.additionalContext}),[N,e.additionalContext]),{rmm:wt,rmmSnapshot:Tt,canonicalReadOperationPathKey:Et}=Iz({resourceType:M,resourceId:_t,doOperationRef:w,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:yt,resourceSchema:ze?.mainSchema,resourceInheritance:ze?.inheritenceSchemaDefinition,enabled:gt&&!!_t,conflictPolicy:{strategy:hE.ACCEPT_REMOTE},directFallbackAccepted:tr(R),actingOperation:re});Py({markerId:`rmm:${M}:${_t??``}`,isDirty:!!wt&&Tt.hasUnsavedChanges});let Dt=(0,Q.useMemo)(()=>tr(R),[R]),Ot=gt&&!Dt,kt=(0,Q.useCallback)(e=>{if(Ot&&!wt)throw new ua({surfaceName:e,resourceType:M,operationIdentifier:z})},[z,Ot,M,wt]);(0,Q.useEffect)(()=>{Ot&&!wt&&xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] Default update-like mutation path is mounted without RMM. The surface will fail closed unless it explicitly opts into UpdateLikeMutationFallbackMode.DIRECT_OPERATION_FALLBACK.`,{resourceType:M,operationIdentifier:z,hasResourceId:_t!==null,updateLikeMutationFallbackMode:R})},[z,Ot,_t,M,wt,R]);let At=(0,Q.useMemo)(()=>{if(!ze||!gt||!_t||!Ke)return{};let e={};for(let[t,n]of Object.entries($e)){let r=n.rootFieldName,i=e=>et.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Ul.buildRelationshipBulkOperationIdentifier(e,r));if(n.semantics.nature===wi.REFERENCE){let r=n.foreignKeyIdentity?.fieldIdentifier;if(!r)continue;let a=Ke[r];if(a&&Io(a)&&!Object.prototype.hasOwnProperty.call(Qe,r))continue;let o=i(C.SET),s=i(C.CLEAR);if(!o){xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] Skipping reference override because generated bulk set operation is unavailable`,{resourceType:M,fieldName:t,foreignKeyFieldName:r});continue}e[t]=(0,$.jsx)(tB,{writeSurface:n,setOperation:o,clearOperation:s,rmm:wt,allowDirectOperationFallback:Dt})}else if(n.semantics.nature===wi.ASSOCIATION){let r=i(C.REPLACE),a=he?iB(he,t):void 0,o=!!(he&&typeof he==`object`&&Object.prototype.hasOwnProperty.call(he,t));if(!r){xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] Skipping association override because generated bulk replace operation is unavailable`,{resourceType:M,fieldName:t});continue}e[t]=(0,$.jsx)(eB,{writeSurface:n,replaceOperation:r,initialRelationshipValue:a,hasHydratedInitialValue:o,rmm:wt,allowDirectOperationFallback:Dt})}}return e},[Qe,he,se,Ke,gt,_,ze,_t,et,M,$e,wt,Dt]),jt=(0,Q.useCallback)((e,t,n)=>{let r=xe.current;if(r)for(let i of e){if(n&&Object.prototype.hasOwnProperty.call(n,i)&&!oB(r.getValues(i),n[i]))continue;let e=iB(t,i),a=e===void 0?r.getValues(i):e;r.setValue(i,a,{shouldDirty:!1,shouldValidate:!1}),r.resetField(i,{defaultValue:a,keepTouched:!0})}},[]);(0,Q.useEffect)(()=>{if(!wt||!Tt?.lastEvent)return;let e=Tt.lastEvent;switch(e.type){case uE.MUTATION_RESULT:{let{result:t}=e;if(t.success&&t.savedFields&&jt(t.savedFields,Tt.confirmedData,t.savedValues),!t.success&&t.error?.type===pE.VALIDATION&&t.error.validationErrors){let e=jM({httpStatus:t.error.status??400,validationErrors:t.error.validationErrors});e&&Ce(e.validationErrors)}break}case uE.REMOTE_UPDATE:if(xe.current)for(let t of e.changedFields)xe.current.getFieldState(t).isDirty||xe.current.setValue(t,iB(Tt.confirmedData,t),{shouldDirty:!1,shouldValidate:!1});Ie({changedFields:e.changedFields,initiatorUserId:e.initiatorUserId}),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{Ie(null),Le.current=null},3e3);break;case uE.CONFLICT_RESET:xe.current&&xe.current.reset(He(e.currentData,!1)),we(),Pe({discardedFields:e.discardedFields,conflictingFields:e.conflictDetails?.conflictingFields??e.discardedFields,reason:e.reason,conflictDetails:e.conflictDetails});break;case uE.RESOURCE_DELETED:rB(`RMM resource deleted event`,{reason:e.reason})}},[Tt?.lastEvent?.id]),(0,Q.useEffect)(()=>()=>{Le.current&&=(clearTimeout(Le.current),null)},[]);let Mt=(0,Q.useCallback)(()=>{wt?.acknowledgeConflict(),Pe(null)},[wt]),Nt=(0,Q.useMemo)(()=>{let e={resourceContext:{resourceType:M,operationId:z}};return{...e,...o,navigation:{...e.navigation,...o?.navigation}}},[M,z,o]),Pt=(0,Q.useMemo)(()=>{let t=ie===W.CREATE,n=nl(N);if(!t&&!n)return null;try{let t=n?_t:null,r=xa.getApiUrl();if(!ze?.resourceFieldIdentifier)throw V.buildConfigurationError(Xl.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:e.resourceType,component:`ResourceAutomatedForm`});let i=ze.resourceFieldIdentifier,a={...bt};t&&(a[i]=t);let o=N.variantType===at.API_CALL?N:ze&&n?ph({resourceConfig:ze,operations:ze.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt}):ze?nu(ze.operations??[],W.CREATE):void 0,s;if(o){let t=Vn.buildOperationFrontendRoutePaths(ze,o,_.allResourceFieldIdentifiers);if(t.length>0){let n=On.selectMatchingRoutePath(t,yt,ze.resourceIdentifier,i,e.parentResourcesRequirements);s=`${br}${n.url}`,s=dh.resolveUrlPath(s,a),s&&dh.hasUnresolvedPlaceholders(s)&&(nB.warn(`[ResourceAutomatedForm] Unresolved placeholders in routed API basePath; disabling route-derived helpers`,{basePath:s,resourceType:M,operationIdentifier:z}),s=void 0)}}return s?{apiBaseUrl:r,basePath:s,contextualParameters:a,resourceFieldIdentifier:i}:null}catch(e){return nB.error(`[ResourceAutomatedForm] Error computing resource API base:`,e),null}},[yt,bt,ie,N,_,ze,e,_t,M]),Ft=(0,Q.useMemo)(()=>{if(!Re||!Pt||!ze?.resourceFieldIdentifier)return{};let t={},n=nl(N),{apiBaseUrl:r,contextualParameters:i}=Pt;try{let a=N.variantType===at.API_CALL?N:n?ph({resourceConfig:ze,operations:ze.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt}):nu(ze.operations??[],W.CREATE);if(!a)return t;let o=Vn.buildOperationFrontendRoutePaths(ze,a,_.allResourceFieldIdentifiers);if(o.length===0)return t;let s=On.selectMatchingRoutePath(o,yt,ze.resourceIdentifier,ze.resourceFieldIdentifier,e.parentResourcesRequirements),c=`${r}/api/v1/files`,l=hr.collectUploadableFileFieldPaths(Re);for(let e of l){let a=Vn.buildFileUploadRouteForOperation({operationRouteUrl:s.url,operationParameters:s.parameters,targetResourceType:M,targetResourceFieldIdentifier:ze.resourceFieldIdentifier,fieldName:e,requiresTargetResourceId:n,isFrontend:!0}),o=dh.resolveUrlPath(a.url,i);if(dh.hasUnresolvedPlaceholders(o)){nB.warn(`[ResourceAutomatedForm] Unresolved placeholders in file upload path, skipping endpoint`,{fieldName:e,uploadPath:o});continue}let l=`${r}${br}${o}`;t[e]={upload:l,override:n?l:void 0,getMetadata:c,delete:n?void 0:c}}}catch(e){nB.error(`[ResourceAutomatedForm] Error generating file upload context:`,e)}return t},[yt,Re,N,vt,Pt,ze,M]),It=(0,Q.useMemo)(()=>{if(!Pt||!ze)return;let t=V.resolveFieldShapeOfAnyVariant(ze);if(!t||!Object.values(t).some(e=>yu(e)))return;let n=nu(ze.operations??[],W.CREATE),r=n?.initiatorInfos?.length?V.selectOperationUrlInitiatorInfo({initiatorInfos:n.initiatorInfos,contextualParameters:Pt.contextualParameters,targetResourceType:ze.resourceIdentifier,targetDefaultFieldIdentifier:Pt.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}):void 0;if(!r)return;let i=Cge({apiBaseUrl:Pt.apiBaseUrl,initiatorInfo:r,contextualParameters:Pt.contextualParameters});return i||nB.warn(`[ResourceAutomatedForm] validate-field URL has unresolved parameters; blur-time validation disabled`,{initiatorUrl:r.url,resourceType:M}),i},[Pt,ze,e.parentResourcesRequirements,M]),Lt=(0,Q.useMemo)(()=>_t??void 0,[_t]),Rt=(0,Q.useMemo)(()=>{if(!wt)return Tz(M,_,{hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt,actingOperation:re})},[Xe,yt,bt,re,_,_t,M,wt]),zt=(0,Q.useMemo)(()=>wt?Et:Rt?Ta.createOperationPathKeyFromOperation(Rt):Ez(M,_,{hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt,actingOperation:re}),[Rt,Xe,yt,bt,re,_,_t,M,wt,Et]),Bt=(0,Q.useMemo)(()=>dB(N),[N]),Vt=(0,Q.useRef)(null),Ht=US({operation:N,currentObject:Bt?he:void 0,resourceType:M,enabled:Bt&&le&&!ye}),Ut=(0,Q.useMemo)(()=>he&&He(he),[he,He]),Wt=N.isBulkOperation===!0&&Rl(ie),Gt=(0,Q.useMemo)(()=>{if(!Bt)return Wt?f:ide({formFieldShape:Ke,inheritanceConfig:Ge,defaultValuesOverride:f})},[Bt,Ke,Ge,f,Wt]),Kt=(0,Q.useCallback)((e,t,n={})=>Que({values:e,seed:void 0,schema:Re,writtenAsHeld:t,variantFields:Be,clears:n}),[Be,Re]),[qt,Jt]=(0,Q.useState)({}),Yt=(0,Q.useRef)(qt),Xt=xne(e.additionalContext),Zt=(0,Q.useMemo)(()=>{let e=new Map;return t=>{if(Wt)return e.has(t)||e.set(t,$ue(t,N.requestDto,Re,Be)),e.get(t)}},[Be,Re,N.requestDto,Wt]),Qt=(0,Q.useCallback)((e,t)=>{let n=t?Zt(e):void 0;if(t&&!n)return;let r={...Yt.current};if(n?r[e]=n.value:delete r[e],Yt.current=r,Jt(r),!n)return;let i=n.kind===QT.EMPTY?[]:n.kind!==QT.TURN_OFF&&void 0;xe.current?.setValue(e,i,{shouldDirty:!0}),xe.current?.clearErrors(e)},[Zt]),$t=(0,Q.useRef)(new Map),en=(0,Q.useCallback)(e=>{let t=$t.current;return t.set(e,(t.get(e)??0)+1),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),tn=(0,Q.useRef)(xt);(0,Q.useEffect)(()=>{tn.current!==xt&&(tn.current=xt,Object.keys(Yt.current).length!==0&&(Yt.current={},Jt({})))},[xt]);let nn=(0,Q.useCallback)(()=>Object.fromEntries(Object.entries(Yt.current).filter(([e])=>$t.current.has(e))),[]),rn=(0,Q.useCallback)(e=>{let t=Object.keys(e);if(t.length===0)return;let n={...Yt.current};for(let e of t)delete n[e];Yt.current=n,Jt(n)},[]),an=(0,Q.useMemo)(()=>Wt?{selectionCount:Xt,clearFor:Zt,isCleared:e=>Object.hasOwn(qt,e),setCleared:Qt,registerField:en}:null,[Zt,qt,Xt,en,Qt,Wt]);(0,Q.useEffect)(()=>{if(!Bt){ge(f??void 0),ve(`create`),ue(!0);return}let t=JSON.stringify({canonicalReadOperationPathKey:zt,contextResourceIdentifiersKey:Xe,parentResourcesRequirementsKey:vt});if(le&&Vt.current===t){if(wt&&he&&typeof wt.getSnapshot==`function`&&wt.getSnapshot().confirmedData===null&&typeof wt.setInitialState==`function`){let e=he;wt.setInitialState(e,e._version??0,e._field_meta)}return}let n=!1;return(async()=>{be(null);try{if(!zt)throw Error(`No addressable canonical READ operation is available for this resource form context.`);let r=await Oz({doOperation:w.current,readOperationPathKey:zt,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements});if(n)return;let i=r;wt&&wt.setInitialState(i,i._version??0,i._field_meta),ge(f?{...i,...f}:r),Vt.current=t,ve(t),ue(!0)}catch(e){if(n)return;let t=e instanceof Error?e:Error(String(e)),r=O(e),i=j.buildWildoError_Frontend(Va.NOT_FOUND,{customMessageReference:Xl.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:zt,context:{resourceType:M,operationIdentifier:z,originalErrorMessage:t.message,originalErrorStack:t.stack,httpCode:r.code,httpContext:r.context}});be({wildoError:i,message:S(e)}),E.current?.(t)}})(),()=>{n=!0}},[Bt,zt,M,Xe,bt,vt,j,z,f,wt,le,he]);let on=(0,Q.useCallback)(async t=>{k.current?.(),fe(!0),we(),rB(`handleSubmit: starting`,{operationPathKey:ht,dataKeys:Object.keys(t||{})});try{let n;if(wt){let e=await wt.queueMutation(t,{type:dE.SUBMIT,priority:vE.HIGH,source:{type:fE.FORM,subscriberId:`submit`},transportOverride:St});if(!e.success){if(uB(e))return;if(e.error?.type===pE.VALIDATION){E.current?.(YR(e.error,`Validation failed`));return}throw YR(e.error,`Submit failed`)}n=e.heldForApproval??e.responseData}else{kt(`ResourceAutomatedForm submit`);let e=Object.keys(Qe),r=Wt?nn():{},i=Wt?Kt(t,e,r):t,a=z===W.UPDATE||z===W.UPDATE_MANY;if(Wt&&a&&Object.keys(i).every(t=>e.includes(t))){Ce({[cT]:y(B.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0}),rn(r)}if(rB(`handleSubmit: success`,{operationPathKey:ht}),L(n)){D.current?.(n);return}let r=cB(N);if(r){let t=r.level===Il.WARNING?Ec.NOTIFY_RESOURCE_WARNING:r.level===Il.ERROR?Ec.NOTIFY_RESOURCE_ERROR:r.level===Il.INFO?Ec.NOTIFY_RESOURCE_INFO:Ec.NOTIFY_RESOURCE_SUCCESS;T.current(t,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(n),additionalContext:{...e.additionalContext,notificationIdentifier:r.identifier,notificationLevel:r.level,result:n}})}let i=e.additionalContext?.quickCreateRequest;if(i?.requestId&&ie===W.CREATE){let e=Uz({result:n,resourceType:M,registry:_});e&&Gz({emit:T.current,requestId:i.requestId,resourceType:M,resourceId:e,data:typeof n==`object`&&n&&!Array.isArray(n)?n:void 0})}D.current?.(n)}catch(t){if(t instanceof yE)return;let n=t instanceof Error?t:Error(String(t));rB(`handleSubmit: error caught`,{message:n.message,operationPathKey:ht});let r=jM(t);r?(rB(`handleSubmit: server validation errors detected`,{httpStatus:r.httpStatus,fields:Object.keys(r.validationErrors)}),Ce(r.validationErrors)):(rB(`handleSubmit: general error (not validation)`,{message:n.message}),T.current(Ec.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Hu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,error:n.message,...nz(t)}})),E.current?.(n)}finally{fe(!1)}},[kt,Qe,St,Ce,Ct,z,ht,Ze,N,e,wt,y,Kt,rn,nn,Wt]),sn=e=>{rB(`handleError: client-side validation failed`,{errorCount:Object.keys(e).length,fields:Object.keys(e)}),nB.warn(`[ResourceAutomatedForm] Form validation errors`,e),qD(KD(e))};(0,Q.useEffect)(()=>{if(!f||!xe.current)return;let e=he?He(he):f;xe.current.reset(e)},[f]);let cn=(0,Q.useCallback)(e=>{if(xe.current=e,Se(e),f){let t=he?He(he):f;e.reset(t)}},[Se,f]),ln=(0,Q.useCallback)(async e=>xe.current?xe.current.trigger(e):(rB(`validateAutosaveField: form methods unavailable, failing closed`,{fieldName:e}),!1),[]),un=(0,Q.useCallback)(async(e,t,n)=>{kt(`ResourceAutomatedForm autosave`);let r=()=>{if(n.aborted)throw new DOMException(`Autosave aborted`,`AbortError`)};r();let i=!wt&&Wt?ZT(nn(),XT([e],Re)):{},a=!wt&&Wt?Kt(GT(que(xe.current?.getValues()??{},e,t),XT([e],Re)),[],i):void 0;if(a&&Object.keys(a).length===0)return;let o=wt?wt.queueMutation({[e]:t},{type:dE.AUTOSAVE,priority:vE.LOW,transportOverride:St}).then(e=>{if(!e.success)throw e.error??Error(`Autosave failed`)}):w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(a??ME(dA(xe.current?.getValues()??null,e,t),Be,he)),parentResourcesRequirements:St.parentResourcesRequirements},{signal:n,silent:!0}),s=new Promise((e,t)=>{if(n.aborted){t(new DOMException(`Autosave aborted`,`AbortError`));return}let r=()=>{t(new DOMException(`Autosave aborted`,`AbortError`))};n.addEventListener(`abort`,r,{once:!0}),o.finally(()=>{n.removeEventListener(`abort`,r)})});await Promise.race([o,s]),r(),rn(i)},[kt,St,he,Be,Re,Ct,wt,Kt,rn,nn,Wt]),dn=(0,Q.useCallback)(async(t,n,r)=>{if(n.length===0){xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] Skipping section save because no fields were registered for the section.`,{resourceType:M,sectionRef:t});return}let i=KT(GT(r,n),{hiddenFieldNames:mt,contextFieldValues:Qe,omitClearedFields:ce,schema:Re});try{if(A.current){await A.current(t,n,i);return}let a;if(wt){let e=await wt.queueMutation(aB(i,n),{type:dE.SECTION,priority:vE.NORMAL,source:{type:fE.FORM,subscriberId:`section:${t}`},transportOverride:St});if(!e.success){if(uB(e)||e.error?.type===pE.VALIDATION&&sB(e.error))return;throw YR(e.error,`Section save failed`)}a=e.heldForApproval??e.responseData}else{kt(`ResourceAutomatedForm section save`);let e,t={};if(Wt){let i=Object.keys(Qe);t=ZT(nn(),XT(n,Re));let a={...xe.current?.getValues()??r};for(let e of Object.keys(N.requestFieldOffers??{}))e in r?a[e]=r[e]:delete a[e];let o=Kt(KT(GT(a,XT(n,Re)),{hiddenFieldNames:mt,contextFieldValues:Qe,omitClearedFields:ce,schema:Re}),i,t);if((z===W.UPDATE||z===W.UPDATE_MANY)&&Object.keys(o).every(e=>i.includes(e))){Ce({[cT]:y(B.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}e=Ct(o)}else{let t=he;e=Ct(ME(Jue(i,n,t),Be,t))}a=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:e,parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0}),wn(a)||jt(n,a,Object.fromEntries(n.map(e=>[e,iB(i,e)]))),rn(t)}if(L(a))return;F(a,{partialWrite:!0}),T.current(Ec.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:a,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(a),additionalContext:{...e.additionalContext,sectionRef:t,fieldNames:n,notificationIdentifier:`section_saved`,notificationLevel:Il.SUCCESS}})}catch(n){if(n instanceof yE)return;let r=jM(n);if(r){Ce(r.validationErrors);return}let i=n instanceof Error?n:Error(String(n));T.current(Ec.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Hu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,sectionRef:t,error:i.message,...nz(n)}})}},[F,kt,St,Qe,he,Be,Re,mt,Ce,jt,Ct,ce,z,e,M,wt,y,Kt,rn,nn,Wt]),fn=(0,Q.useMemo)(()=>l===void 0&&Sge(Ke,se),[l,se,Ke]),pn=Rl(ie)&&N.requiresApproval===void 0,mn=l?.enabled===!0;(0,Q.useEffect)(()=>{mn&&!pn&&xa.isDevelopment()&&nB.warn(`[ResourceAutomatedForm] autosaveConfig is ignored: autosave saves fields of records that exist, and this form creates one or runs an action.`,{resourceType:M,operationIdentifier:z})},[pn,mn,z,M]);let hn=(0,Q.useMemo)(()=>({enabled:pn&&(l?.enabled??fn),defaultTrigger:l?.defaultTrigger??(fn?ou.NONE:ou.DEBOUNCE),debounceMs:l?.debounceMs??500,savedStateDurationMs:2e3}),[l,pn,fn]),gn=(0,Q.useMemo)(()=>{if(!Re||!Ye?.enabled)return null;try{let e=ae===W.CREATE?`CREATE`:Rl(ae)?`UPDATE`:`CREATE`,t=oe===W.CREATE?`CREATE`:oe&&Rl(oe)?`UPDATE`:oe===W.READ?`READ`:void 0;return rt(Re,{operationType:e,operationLike:t,isDraftMode:!0})}catch{return null}},[Re,Ye?.enabled,ae,oe]),_n=(0,Q.useCallback)(async t=>{if(Ye?.enabled){k.current?.(),me(!0),we();try{let n,r=!0;if(Ye?.onSaveDraft)n=await Ye.onSaveDraft(t),r=n!==void 0;else{let e=Ye?.discriminator||`_isDraft`,r=Ye?.draftValue??!0,i={...t,[e]:r};if(wt){let e=await wt.queueMutation(i,{type:dE.DRAFT,priority:vE.HIGH,source:{type:fE.FORM,subscriberId:`draft`},transportOverride:{...St,requestData:i}});if(!e.success){if(uB(e))return;throw YR(e.error,`Draft save failed`)}n=e.heldForApproval??e.responseData}else kt(`ResourceAutomatedForm draft save`),n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0})}if(L(n)){D.current?.(n);return}Me(!0),r&&(T.current(Ec.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(n),additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaved`}}),D.current?.(n))}catch(t){if(t instanceof yE)return;let n=jM(t);n?Ce(n.validationErrors):T.current(Ec.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Hu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaveFailed`,...nz(t)}}),E.current?.(t)}finally{me(!1)}}},[kt,St,Ye,Ct,e,M,Ce,wt]),vn=(0,Q.useCallback)(async t=>{if(Ye?.enabled){k.current?.(),fe(!0),we();try{let n,r=!0;if(Ye?.onPublish)n=await Ye.onPublish(t),r=n!==void 0;else{let e=Ye?.discriminator||`_isDraft`,r=Ye?.publishedValue??!1,i={...t,[e]:r};if(wt){let e=await wt.queueMutation(i,{type:dE.PUBLISH,priority:vE.HIGH,source:{type:fE.FORM,subscriberId:`publish`},transportOverride:{...St,requestData:i}});if(!e.success){if(uB(e))return;throw YR(e.error,`Publish failed`)}n=e.heldForApproval??e.responseData}else kt(`ResourceAutomatedForm publish`),n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0})}if(L(n)){D.current?.(n);return}if(Me(!1),r){let t=cB(N);t&&T.current(Ec.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(n),additionalContext:{...e.additionalContext,notificationIdentifier:t.identifier}}),D.current?.(n)}}catch(t){if(t instanceof yE)return;let n=jM(t);n?Ce(n.validationErrors):T.current(Ec.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Hu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`publishFailed`,...nz(t)}}),E.current?.(t)}finally{fe(!1)}}},[kt,St,Ye,Ct,e,M,N,Ce,wt]),yn=(0,Q.useCallback)(async e=>{Ye?.enabled&&(Ye?.requireConfirmationToPublish?Ee(e):await vn(e))},[Ye,vn]),bn=(0,Q.useCallback)(async()=>{Te&&(await vn(Te),Ee(null))},[Te,vn]),xn=(0,Q.useCallback)(()=>{Ee(null)},[]),Sn=is(N.riskLevel),Cn=N.riskLevel===zi.CRITICAL,Tn=ei(N)?void 0:null,En=b(M,String(N.operationIdentifier),`description`)||void 0,Dn=(0,Q.useMemo)(()=>KS(b,M,String(N.operationIdentifier)),[b,M,N.operationIdentifier]),kn=!!(Ye?.enabled&&gn),An=(0,Q.useCallback)(e=>{kn?yn(e):on(e)},[kn,yn,on]),jn=(0,Q.useCallback)(e=>{Sn?ke(e):An(e)},[Sn,An]),Mn=(0,Q.useCallback)(()=>{let e=Oe;ke(null),e!==null&&An(e)},[Oe,An]),Nn=(0,Q.useCallback)(()=>{ke(null)},[]),Pn=(0,Q.useMemo)(()=>{let e=h(z)?y(B.RESOURCES_LAYOUTS_CREATE,lB(ie??z)):Dn,t=y(B.RESOURCES_LAYOUTS_CREATE,`submitting`);if(Ye?.enabled&&gn){let e=Ye?.publishLabel?y(B.RESOURCES_LAYOUTS_CREATE,Ye.publishLabel):y(B.RESOURCES_LAYOUTS_CREATE,`publish`),t=y(B.RESOURCES_LAYOUTS_CREATE,`publishing`);return(0,$.jsx)(X,{type:`submit`,disabled:de||pe||i,children:de?t:e})}return(0,$.jsx)(X,{type:`submit`,disabled:de||i,children:de?t:e})},[ie,z,Dn,de,pe,i,y,Ye,gn]),Fn=(0,Q.useMemo)(()=>{if(!r)return null;let e=y(B.RESOURCES_LAYOUTS_CREATE,`cancel`);return(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:de||pe,onClick:r,children:e})},[r,de,pe,y]),In=(0,Q.useMemo)(()=>{if(!Ye?.enabled||!gn)return null;let e=Ye?.saveDraftLabel?y(B.RESOURCES_LAYOUTS_CREATE,Ye.saveDraftLabel):y(B.RESOURCES_LAYOUTS_CREATE,`saveAsDraft`),t=y(B.RESOURCES_LAYOUTS_CREATE,`savingDraft`);return(0,$.jsx)(gB,{draftSchema:gn,omitClearedFields:ce,submissionSchema:Re,onSaveDraft:_n,disabled:pe||de||i,isSavingDraft:pe,label:e,savingLabel:t})},[Ye,gn,_n,pe,de,i,y]),Ln=Ne?{title:y(B.RESOURCES_LAYOUTS_CREATE,Ne.reason===gE.VERSION_CONFLICT?`conflictTitleVersion`:`conflictTitleRemote`),message:y(B.RESOURCES_LAYOUTS_CREATE,Ne.reason===gE.VERSION_CONFLICT?`conflictMessageVersion`:`conflictMessageRemote`),acknowledgeButton:y(B.RESOURCES_LAYOUTS_CREATE,`conflictAcknowledge`),currentValue:y(B.RESOURCES_LAYOUTS_CREATE,`conflictCurrentValue`),submittedValue:y(B.RESOURCES_LAYOUTS_CREATE,`conflictSubmittedValue`),emptyValue:y(B.LOW_LEVEL_FORM_FIELD,`noValue`)}:void 0,Rn=(0,Q.useMemo)(()=>!Ne||!Ln?null:(0,$.jsx)(Bz,{type:`conflict`,discardedFields:Ne.discardedFields,conflictDetails:Ne.conflictDetails,labels:Ln,onDismiss:Mt}),[Ne,Ln,Mt]),[zn,Bn]=(0,Q.useState)(0),Hn=(0,Q.useCallback)(()=>(Bn(e=>e+1),()=>Bn(e=>e-1)),[]),Un=(0,Q.useMemo)(()=>({submitButton:Pn,draftSaveButton:In,cancelButton:Fn,submissionNotice:Rn,claimFooter:Hn,footerClaimed:zn>0}),[Pn,In,Fn,Rn,Hn,zn]),Wn=(0,Q.useMemo)(()=>{if(Bt)return String(Rt?.operationIdentifier??V.resolveSingleResourceReadOperation(M,_)?.operationIdentifier??W.READ)},[Rt,Bt,M,_]),Gn=(0,Q.useMemo)(()=>!Bt||!Wn?[]:[{resourceType:M,operation:Wn}],[Bt,M,Wn]),Kn=(0,Q.useMemo)(()=>[`components.${B.RESOURCES_LAYOUTS_CREATE}`],[]),qn=(0,Q.useMemo)(()=>Bt?[{id:`form-data`,isReady:le}]:[],[Bt,le]),Jn=(0,Q.useMemo)(()=>({errorNetwork:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[y]),Yn=(0,Q.useMemo)(()=>{if(!Re)return null;if(qe){let e=qe,t=h(N.operationIdentifier)?null:NR(Re,Ge?.discriminatorField).map(e=>e.name),n=()=>(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(pB,{Template:e,requestFieldNames:t}):(0,$.jsx)(e,{}),(0,$.jsx)(cE,{})]});return n.displayName=`ResourceFormTemplate(explicit)`,n}let e=LR(Re,{inheritanceConfig:Ge,includeSubmitButton:!1,includeErrorSummary:s}),t=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e,{}),(0,$.jsx)(cE,{})]});return t.displayName=`ResourceFormTemplate`,t},[qe,Re,Ge,s,N.operationIdentifier]);if(!x)return null;if(ye){let e=y(B.RESOURCES_LAYOUTS_CREATE,`failedToLoadData`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:ye.message})]})})}if(Bt&&le&&!Ht.isLoading&&!Ht.isEnabled){let e=y(B.RESOURCES_LAYOUTS_CREATE,`operationUnavailableTitle`),t=y(B.RESOURCES_LAYOUTS_CREATE,`operationUnavailableMessage`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-muted/50 border border-border rounded-lg`,role:`status`,children:[(0,$.jsx)(`p`,{className:`font-medium text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-item-xs`,children:t})]})})}let Xn=Bt?Ut??f:Gt??f;if(!Re){let e=y(B.RESOURCES_LAYOUTS_CREATE,`configurationError`),t=y(B.RESOURCES_LAYOUTS_CREATE,`noSchemaFound`,{operation:z,resource:M});return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}let Zn=y(B.RESOURCES_LAYOUTS_CREATE,`confirmPublishTitle`),Qn=y(B.RESOURCES_LAYOUTS_CREATE,`confirmPublishMessage`),H=y(B.RESOURCES_LAYOUTS_CREATE,`cancel`),$n=y(B.RESOURCES_LAYOUTS_CREATE,`publish`),er=Fe?{message:y(B.RESOURCES_LAYOUTS_CREATE,`remoteUpdateMessage`),dismissAriaLabel:y(B.RESOURCES_LAYOUTS_CREATE,`dismiss`)}:void 0,nr=(0,$.jsx)(sb,{i18nKeys:Kn,loadingScopes:Gn,readiness:qn,children:(0,$.jsxs)(`div`,{className:a,children:[(0,$.jsx)(Uw,{open:!!Te,onOpenChange:e=>!e&&xn(),children:(0,$.jsxs)(Gw,{children:[(0,$.jsxs)(Kw,{children:[(0,$.jsx)(Jw,{children:Zn}),(0,$.jsx)(Yw,{children:Qn})]}),(0,$.jsxs)(qw,{children:[(0,$.jsx)(Zw,{onClick:xn,children:H}),(0,$.jsx)(Xw,{onClick:bn,children:$n})]})]})}),Oe!==null&&(0,$.jsx)(Iw,{open:!0,onOpenChange:e=>{e||Nn()},cancelCallback:Nn,validationCallback:Mn,label:Dn,confirmLabel:Dn,description:Tn,detail:En,requireTypedConfirmation:Cn,confirmationPhrase:Cn?Dn:``}),Fe&&er&&(0,$.jsx)(Bz,{type:`remote-update`,changedFields:Fe.changedFields,labels:er,onDismiss:()=>Ie(null)}),(0,$.jsx)(kE.Provider,{value:an,children:(0,$.jsx)(oE,{value:Un,children:(0,$.jsx)(iE,{schema:Re,defaultValues:Xn,onSubmit:jn,onError:sn,validationMode:c,disabled:i||de,labels:Nt,layoutRefs:Ue,operationRef:z,operationType:ae,operationLike:oe,coreOperation:ie,fileUploadContext:Ft,contextFieldValues:Qe,hiddenFieldNames:mt,generatedFieldOverrides:At,allowedValuesByField:pt,roleGrantPickerOffersByField:ft,requestFieldOffers:N.requestFieldOffers,requestFieldOfferRecord:Bt?he:void 0,inheritanceConfig:Ge,onSectionSave:ede({writesRecordFields:Rl(ie),hasCallerSectionHandler:d!==void 0})?dn:void 0,onFormReady:cn,warnOnUnsavedChanges:!0,validateFieldUrl:It,resourceType:M,hostResolvesRelationshipRoots:!0,resourceId:Lt,contextResourceIdentifiers:yt,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:p,chromeMode:We,layoutTemplate:Yn},_e)})})]})});return hn.enabled?(0,$.jsxs)(DE,{labels:Jn,validateField:ln,onSave:un,rmm:wt??void 0,config:hn,children:[(0,$.jsx)(hB,{cancelRef:k}),nr]}):nr}function hB({cancelRef:e}){let t=EE();return Q.useEffect(()=>(t&&(e.current=t.cancelAllPending),()=>{e.current=null}),[t,e]),null}function gB({draftSchema:e,onSaveDraft:t,disabled:n,isSavingDraft:r,label:i,savingLabel:a,omitClearedFields:o,submissionSchema:s}){let c=GC(),l=zT(),u=(0,Q.useCallback)(async()=>{if(!c)return;let n=c.getValues(),r=e.safeParse(wT(n,e));if(r.success){let e=KT(r.data,{hiddenFieldNames:l?.hiddenFieldNames,contextFieldValues:l?.contextFieldValues,omitClearedFields:o,schema:s});c.clearErrors(),await t(e)}else{let e=yT(r.error.issues),t=Object.keys(e);for(let[t,n]of Object.entries(e))c.setError(t,n);qD(t)}},[c,l?.contextFieldValues,l?.hiddenFieldNames,e,t]);return(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:n,onClick:u,children:r?a:i})}var _B;(function(e){e.SHELL=`shell`,e.SURFACE=`surface`})(_B||={});function vB(e,t,n=!0){return e||(n?t:Cl.PRIMARY)}function yB({preset:e=q.DEFAULT,host:t=_B.SHELL,...n}){let r=(0,Q.useContext)(s_)?.navigationLayout?.backAffordanceOwner;if(!(t===_B.SHELL?du(r):Nre(r)))return null;let i=G(B.APPLICATION_LEVEL_NAVIGATION_BACK,`ApplicationLevel_NavigationBack`)(e);return(0,$.jsx)(i,{...n})}var bB=Qs(B.LOW_LEVEL_BREADCRUMB,`Breadcrumb`,[`List`,`Item`,`Link`,`Page`,`Separator`,`Ellipsis`]);function xB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n,{...t})}function SB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.List,{...t})}function CB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.Item,{...t})}function wB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.Link,{...t})}function TB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.Page,{...t})}function EB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.Separator,{...t})}function DB({preset:e=q.DEFAULT,...t}){let n=bB(e);return(0,$.jsx)(n.Ellipsis,{...t})}function OB(e){let t={};for(let n of e.segment.ancestorRequirements){let r=n.foreignKeyField||n.resourceType,i=e.contextResourceIdentifiers[r]??e.contextResourceIdentifiers[n.resourceType],a=typeof i==`string`?i:i?.resourceId;a&&(n.foreignKeyField?t[r]={fieldIdentifier:n.foreignKeyField,resourceId:a}:t[n.resourceType]=a)}return t[e.segment.resourceType]=e.segment.resourceId,t}function kB(e){let{parentResourcesRequirements:t,contextResourceIdentifiers:n,maxDepth:r=5}=e;if(!t||t.length===0)return[];let i=[],a=new Set,o=[];for(let e of t){let t=e.foreignKeyField||e.resourceType;if(a.has(t))continue;if(a.add(t),i.length>=r)break;let s;if(e.foreignKeyField&&n[e.foreignKeyField]){let t=n[e.foreignKeyField];s=typeof t==`string`?t:t.resourceId}else{let t=n[e.resourceType];if(!t)continue;s=typeof t==`string`?t:t.resourceId}s&&(e.isPrimaryScope||i.push({resourceType:e.resourceType,resourceId:s,ancestorRequirements:[...o]}),o.push(e))}return i}var AB=({resourceContext:e,navigationZone:t,navigationInitiator:n,maxDepth:r=5})=>{let{resourceType:i,contextResourceIdentifiers:a,parentResourcesRequirements:o}=e,{registry:s,doOperation:c}=fm(),l=pS(),{tResourceHeader:u,t:d,formatDate:f,formatDateTime:p,isReady:m}=K({resource:i}),{navigate:h}=DS(),g=(0,Q.useRef)(c);g.current=c;let _=(0,Q.useMemo)(()=>kB({parentResourcesRequirements:o,contextResourceIdentifiers:a,maxDepth:r}),[o,a,r]),[v,y]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(_.length===0){y([]);return}y(_.map(e=>({...e,label:null,isLoading:!0})));let e=!1;return(async()=>{let t=await Promise.allSettled(_.map(async e=>{let t=s.resourceConfigurations[e.resourceType],n=V.buildForeignKeyFetchParams(e.resourceType,e.resourceId,s),r=OB({segment:e,contextResourceIdentifiers:a}),i=t?ph({resourceConfig:t,operations:(t.operations??[]).filter(t=>Zx(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:{...V.buildContextualParameters(r,s),...n.contextualParameters??{}}}):void 0,o=V.tryBuildForeignKeyReadOperationPath(e.resourceType,s,i),c=()=>{let t=Kp({tResourceHeader:u,resourceType:e.resourceType,key:`title`});return{...e,label:`${t} #${e.resourceId.slice(0,8)}`,isLoading:!1}};if(!o)return c();try{let t=await g.current(o,{contextualParameters:{...V.buildContextualParameters(r,s),...n.contextualParameters},parentResourcesRequirements:e.ancestorRequirements,parentChainIsExact:!0});return{...e,label:null,record:t,isLoading:!1}}catch{return c()}}));e||y(t.map((e,t)=>e.status===`fulfilled`?e.value:{..._[t],label:_[t].resourceId.slice(0,8),isLoading:!1}))})(),()=>{e=!0}},[a,_,s,u,l]);let b=(0,Q.useMemo)(()=>v.map(e=>e.record===void 0?e:{...e,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:s,currentObject:e.record,t:d,formatDate:f,formatDateTime:p})||e.resourceId}),[v,s,d,f,p]),x=e=>{let t=s.resourceConfigurations[e.resourceType];if(!t)return;let n=OB({segment:e,contextResourceIdentifiers:a}),r=ph({resourceConfig:t,operations:(t.operations??[]).filter(t=>!fr(t.operationFrontendConfig)&&Zx(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,s)});if(r)return{segmentResourceConfig:t,segmentContextIdentifiers:n,readOp:r}},S=(0,Q.useMemo)(()=>new Map(_.map(e=>[jB(e),x(e)!==void 0])),[_,s,a]),C=(e,n)=>{n.preventDefault();let r=x(e);if(!r)return;let{segmentResourceConfig:i,segmentContextIdentifiers:a,readOp:o}=r,c=On.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:o,contextResourceIdentifiers:a,isOperationDefault:!0,parentResourcesRequirements:e.ancestorRequirements}),l;if(Sn(o.operationFrontendConfig)){let t=Vn.buildOperationFrontendRoutePaths(i,o,s.allResourceFieldIdentifiers);l=On.selectMatchingRoutePath(t,a,i.resourceIdentifier,i.resourceFieldIdentifier,e.ancestorRequirements)?.url}h({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:c},urlPath:l,initiator:{sourceZone:t}})};return _.length===0||!m?null:(0,$.jsx)(xB,{children:(0,$.jsx)(SB,{children:b.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(CB,{children:S.get(jB(e))?(0,$.jsx)(wB,{href:`#`,onClick:t=>C(e,t),className:e.isLoading?`animate-pulse motion-reduce:animate-none`:void 0,children:e.isLoading?`...`:e.label}):(0,$.jsx)(`span`,{className:e.isLoading?`animate-pulse motion-reduce:animate-none`:void 0,children:e.isLoading?`...`:e.label})}),(0,$.jsx)(EB,{})]},jB(e)))})})};function jB(e){return`${e.resourceType}-${e.resourceId}`}function MB({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_BREADCRUMB,`ResourceLayout_Breadcrumb`)(e);return(0,$.jsx)(n,{...t})}var NB=as.getLogger(),PB=NB.debugByType(`AutomaticDisplayer`);NB.setDebugTypeLogging(`AutomaticDisplayer`,!1);function FB({schema:e,data:t,className:n,labels:r,layoutRefs:i,resourceType:a,resourceId:o,contextualParameters:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u,inlineEditOperation:d,parentReferenceConfig:f,onInlineEdit:p,disableInlineEdit:m=!1,fileUploadContext:h,onInlineEditSuccess:g,rmm:_,updateLikeMutationFallbackMode:v=Bt.RMM_REQUIRED,layoutTemplate:y,isLoading:b=!1,defaultDisplayChromeMode:x,defaultInlineEdit:S,defaultEmptyValue:C,defaultSectionAppearance:w,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}){let{doOperation:O,registry:k}=fm(),A=(0,Q.useContext)(s_)?.UIConfig?.currentBreakpoint??Sl.DESKTOP,{fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee}=nE(e,r?.resourceContext,t,`display`,{layoutRefs:i,fieldPathPrefix:r?.fieldPathPrefix,overrides:{fields:r?.fields,enums:r?.enums,sections:r?.sections}}),L=fS(hh(a,o,c)),R=(0,Q.useCallback)(()=>{if(d===null)return null;if(d!==void 0){let e=d.variantType===at.API_CALL,t=d.resourceOperationLike??d.operationIdentifier,n=d.operationIdentifier===W.UPDATE;if(!e||!n||d.isBulkOperation===!0||t!==W.UPDATE)throw PB(`Rejected invalid inlineEditOperation`,{operationIdentifier:String(d.operationIdentifier),variantType:d.variantType,variantKey:d.variantKey,isBulkOperation:d.isBulkOperation,effectiveOperation:String(t)}),new fj(`inlineEditOperation must be the non-bulk URL-bearing literal UPDATE operation, not a custom verb borrowing UPDATE semantics`);return d}if(!a||!o)return null;let e=k.resourceConfigurations[a];if(!e)return null;let t=V.getResourceFieldIdentifierForType(a,k),n=On.buildRecordIdentifiersFromCollection(c,a,o),r={...s??{},[t]:o};return Gm({resourceConfig:e,operations:e.operations??[],registry:k,hasResourceId:On.getResourceId(n[a]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:n,contextualParameters:r,viewer:L})??null},[c,s,d,k,o,a,L]),z=(0,Q.useMemo)(()=>R()!==null,[R]),te=(0,Q.useMemo)(()=>jE(e),[e]),ne=(0,Q.useCallback)(async(n,r)=>{let i=e?Ac(e,n):void 0,c=i?Si(i,r):r;if(PB(`doInlineUpdate`,{fieldName:n,path:p?`custom`:_?`rmm`:`fallback`}),p)await p(n,c),g?.(n,c);else if(_){let e=d?{operationPathKey:Ta.createOperationPathKeyFromOperation(d)}:void 0,t=await _.queueMutation({[n]:c},{type:dE.INLINE,priority:vE.LOW,source:{type:fE.DISPLAY,subscriberId:`display-inline`},transportOverride:e});if(!t.success)throw new fj(t.error?.message??`Inline edit failed`,t.error);g?.(n,c)}else if(tr(v)&&a&&o){let e=R();if(!e)throw Error(`No UPDATE operation configured for resource "${a}". Inline editing requires an UPDATE.default operation.`);let r=Ta.createOperationPathKeyFromOperation(e),i=V.getResourceFieldIdentifierForType(a,k),u={...s,[i]:o};await O(r,{contextualParameters:u,parentResourcesRequirements:l,requestData:ME(dA(t,n,c),te,t)}),g?.(n,c)}else throw new ua({surfaceName:`AutomaticDisplayer inline edit`,resourceType:a??`unknown`,operationIdentifier:d?.operationIdentifier??W.UPDATE})},[p,_,a,o,s,l,O,k,g,R,v,d,te,t,e]),re=!m&&(!!p||!!_||tr(v)&&!!a&&!!o&&z),ie=(0,Q.useMemo)(()=>({resourceType:a,resourceId:o,doInlineUpdate:ne,canInlineEdit:re,defaultInlineEdit:S,defaultEmptyValue:C,fileUploadContext:h,contextualParameters:s,contextResourceIdentifiers:c,navigationZone:u,parentReferenceConfig:f,rmm:_}),[a,o,ne,re,S,C,h,s,c,u,f,_]),ae=(0,Q.useMemo)(()=>({schema:e,data:b?void 0:t,isLoading:b,fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee,defaultSectionAppearance:w,breakpoint:A,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}),[e,t,b,j,M,N,P,F,I,ee,w,A,T,E,D]);return(0,$.jsx)(uj.Provider,{value:ie,children:(0,$.jsx)(yA.Provider,{value:!1,children:(0,$.jsx)(ok,{displayChromeMode:x,children:(0,$.jsx)(nk,{value:ae,children:(0,$.jsx)(`div`,{className:U(`space-y-section`,n),children:y?Q.createElement(y):null})})})})})}FB.displayName=`AutomaticDisplayer`;var IB=FB,LB=(0,Q.createContext)(null);function RB({value:e,children:t}){return(0,$.jsx)(LB.Provider,{value:e,children:t})}function zB(){return(0,Q.useContext)(LB)}function BB({title:e,hostProvidesHeading:t,className:n}){let r=U(`min-w-0 truncate`,HB(),n);return t?(0,$.jsx)(`h2`,{className:r,children:e}):(0,$.jsx)(`h1`,{className:r,children:e})}function VB({className:e}){return(0,$.jsx)(`div`,{className:U(`min-w-0`,HB(),e),"aria-hidden":`true`,"data-resource-header-title-pending":`true`,children:(0,$.jsx)(pm,{className:`h-[1lh] w-48 max-w-full`})})}function HB(){let e=(0,Q.useContext)(s_);return(e?e.getRecipe(cc.TYPOGRAPHY,y.RESOURCE_TITLE):Lg.typography?.[y.RESOURCE_TITLE])?.base}function UB({className:e}){let t=zB();t?.titleMountTracker&&(t.titleMountTracker.titleMounted=!0);let n=t?.title,r=n?(0,$.jsx)(BB,{title:n,hostProvidesHeading:t?.hostProvidesHeading,className:e}):t?.titlePending?(0,$.jsx)(VB,{}):null;return r?t?.titleTarget===void 0?r:t.titleTarget?(0,wN.createPortal)(r,t.titleTarget):null:null}function WB({children:e}){let t=zB();return t?.leadingTarget===void 0?(0,$.jsx)($.Fragment,{children:e}):t.leadingTarget?(0,wN.createPortal)(e,t.leadingTarget):null}var GB=(0,Q.createContext)(null);function KB({zone:e,controls:t,children:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),s=(0,Q.useRef)(null),c=(0,Q.useCallback)(e=>{s.current===null&&(s.current=e,i(e))},[]),l=(0,Q.useCallback)(e=>{s.current===e&&(s.current=null,i(null),o(!0))},[]),u=(0,Q.useCallback)((e,t)=>{s.current===e&&o(t)},[]),d=(0,Q.useMemo)(()=>({zone:e,controls:t,claimant:r,claimantOnScreen:a,claim:c,release:l,reportOnScreen:u}),[e,t,r,a,c,l,u]);return(0,$.jsx)(GB.Provider,{value:d,children:n})}function qB(e){let t=(0,Q.useContext)(GB);return!!t&&t.zone===e}var JB;(function(e){e.OWN_ROW=`own_row`,e.IN_HEADER=`in_header`,e.OVERLAY=`overlay`})(JB||={});function YB(){let e=(0,Q.useContext)(GB);return!e||e.claimant==null?JB.OWN_ROW:e.claimantOnScreen?JB.IN_HEADER:JB.OVERLAY}function XB({children:e}){let t=YB();return t===JB.IN_HEADER?null:(0,$.jsx)(`div`,{className:U(`pointer-events-none sticky top-0 z-10 flex justify-end gap-element`,t===JB.OVERLAY&&`-mb-8`),"data-zone-chrome-presence":t,children:e})}function ZB(e,t,n=!0){let r=(0,Q.useContext)(GB),i=(0,Q.useRef)({}).current,a=!!r&&t&&e===r.zone,o=r?.claim,s=r?.release,c=r?.reportOnScreen;return(0,Q.useLayoutEffect)(()=>{if(a&&o&&s)return o(i),()=>s(i)},[a,o,s,i]),(0,Q.useLayoutEffect)(()=>{a&&c&&c(i,n)},[a,c,i,n,r?.claimant]),a&&r.claimant===i&&n?r.controls:null}var QB=`@container/resource-header`,$B=new Set([W.READ,W.LIST,W.SEARCH,W.COUNT,W.DELETE,W.DELETE_MANY]);function eV(e,t){if(e.resourceType!==t.resourceType||e.isBulkOperation)return!1;let n=vl(e.operation??{operationIdentifier:e.operationIdentifier});return n!==void 0&&$B.has(n)?!1:nV(e,t)}function tV(e,t){return e.resourceType!==t.resourceType||e.isBulkOperation||e.relaysRowDeletion||vl(e.operation??{operationIdentifier:e.operationIdentifier})!==W.READ?!1:nV(e,t)}function nV(e,t){let n=e.contextResourceIdentifiers?.[t.resourceType];if(n==null)return!1;let r=String(On.getResourceId(n));return t.shownRowIds.some(e=>e!=null&&e!==``&&e===r)}function rV(e){let{on:t}=Mo(),[n,r]=(0,Q.useState)(null),i=(0,Q.useRef)(e.rowIds);i.current=e.rowIds;let{resourceType:a,enabled:o}=e;return(0,Q.useEffect)(()=>{if(!o)return;let e=t(Ec.RESOURCE_OPERATION_EXECUTED,()=>r({at:Date.now(),madeElsewhere:!1}),e=>eV(e,{resourceType:a,shownRowIds:i.current})),n=t(Ec.RESOURCE_REFRESH,()=>r({at:Date.now(),madeElsewhere:!0}),e=>tV(e,{resourceType:a,shownRowIds:i.current}));return()=>{e(),n()}},[o,t,a]),n}function iV({className:e,actions:t,bar:n}){return(0,$.jsxs)(`div`,{className:U(e||`flex-1`,QB,`flex min-w-0 flex-col`),"data-resource-header-pending":`true`,children:[n,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1 basis-60`,children:(0,$.jsx)(VB,{})}),t&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(eC,{children:t})})]})]})}var aV=({resourceContext:e,navigationZone:t,navigationInitiator:n,title:r,description:i,className:a,actions:o,parentReferenceConfig:s,heldRecord:c})=>{let l=qk(),u=lC(),d=u?.resourceContext?.resourceType===e.resourceType?u:void 0,f=d?.resourceContext??e,{resourceType:p,operation:m,contextResourceIdentifiers:h}=f,{tResourceHeader:g,tResourceOperation:_,t:v,formatDate:y,formatDateTime:b,isReady:x}=K({component:B.RESOURCES_LAYOUTS_HEADER,resource:p}),S=cp(),{registry:C,doOperation:w}=fm(),{renderIcon:T}=Mf();String(m.operationIdentifier);let E=On.getPrimaryResourceIdentifier(f),D=(0,Q.useMemo)(()=>C.resourceConfigurations[p],[C,p]),k=d?.resourceConfig??D,A=V.frontendResourceLabelDefinitionOf(k),j=vl(m),M=_o(m),N=j===W.READ?k?.frontendConfiguration?.layout?.header:void 0,P=!!A&&!!E&&M,F=(!!A||!!N)&&!!E&&M,I=!!k,[ee,L]=(0,Q.useState)(void 0),[R,z]=(0,Q.useState)(!1),te=c!==void 0,ne=c?c.record:ee,ie=c?c.record===void 0&&!c.failed:R,[ae,oe]=(0,Q.useState)(null),se=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),ce=(0,Q.useMemo)(()=>V.buildContextualParameters(h,C),[se,C]),le=d?.contextualParameters??ce,ue=(0,Q.useMemo)(()=>Object.entries(le).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[le]),de=(0,Q.useMemo)(()=>JSON.stringify(f.parentResourcesRequirements??null),[f.parentResourcesRequirements]),fe=(0,Q.useMemo)(()=>m.operationIdentifier===W.READ?m:d?.resolvePreferredOperation(W.READ,{requireAddressable:!0})??Tz(p,C,{hasResourceId:!!E,contextResourceIdentifiers:h,contextualParameters:le}),[m,d,p,C,E,h,le]),pe=(0,Q.useMemo)(()=>V.tryBuildForeignKeyReadOperationPath(p,C,fe),[p,C,fe]),me=rb(_g({resourceType:p,operation:fe?fe.operationIdentifier??W.READ:W.READ,discriminator:E??void 0})),he=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{he.current=w},[w]);let ge=rV({resourceType:p,rowIds:[E?String(E):null,ee&&(typeof ee._id==`string`||typeof ee._id==`number`)?String(ee._id):null],enabled:!te&&F&&!!E}),_e=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(te||!F||!k||!pe)return;let e=!1,t=`${pe}|${se}|${ue}|${de}`,n=_e.current===t;return _e.current=t,(async()=>{n||(z(!0),L(void 0)),oe(null);try{let t=await he.current(pe,{contextualParameters:le,parentResourcesRequirements:f.parentResourcesRequirements});if(e)return;t&&typeof t==`object`&&!Array.isArray(t)&&L(t)}catch(t){if(e)return;let r=O(t);as.getLogger().error(`[ResourceLayoutPreset_Header_Default] Error fetching resource label:`,{resourceType:p,operationPathKey:pe,...r,error:t}),oe({...r,message:S(t)}),n||L(void 0)}finally{e||z(!1)}})(),()=>{e=!0}},[te,F,pe,se,ue,de,I,p,ge?.at]);let ve=(0,Q.useMemo)(()=>!ne||!P?null:V.computeFrontendResourceLabel({resourceType:p,registry:C,currentObject:ne,objectContext:f,initiatorUserContext:void 0,t:v,formatDate:y,formatDateTime:b}),[ne,P,p,C,f,v,y,b]),ye=ao(m.operationIdentifier,k?.operations),be=(0,Q.useMemo)(()=>r||_(p,ye,`title`),[r,_,p,ye]),xe=j===W.LIST||j===W.SEARCH,Se=fne(m),Ce=!Se&&P?ve:null,we=(0,Q.useMemo)(()=>i||Ce||(xe?Hp({tResourceHeader:g,resourceType:p})??null:null),[i,Ce,xe,g,p]),Te=(0,Q.useMemo)(()=>P&&Se?ie||me.isInitialLoad?null:ve||(E?`#${E}`:null):null,[P,Se,ie,me.isInitialLoad,ve,E]),Ee=m.operationFrontendConfig?.headerIconPlacement,De=(0,Q.useMemo)(()=>Ee===zu.TEMPLATE_OWNED?null:T({category:re.RESOURCES,resourceType:p},{size:ca.MD}),[T,p,Ee]),Oe=!!Te,ke=l&&!Oe,Ae=P&&Se&&!Oe&&(ie||me.isInitialLoad),je=(0,Q.useMemo)(()=>V.resolveRowSchema(k,ne),[k,ne]),Me=(0,Q.useMemo)(()=>({resourceContext:{resourceType:p,operationId:W.READ}}),[p]),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{if(!Le||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&Be(t.isIntersecting)});if(typeof e?.observe==`function`)return e.observe(Le),()=>e.disconnect?.()},[Le]);let Ve=qB(t)&&!l,He=ZB(t,!l&&(x||Ae),ze),Ue=(0,Q.useMemo)(()=>{if(l||Fo.resolve(B.RESOURCES_LAYOUTS_BREADCRUMB,q.DEFAULT)!==AB)return s;let e=kB({parentResourcesRequirements:f.parentResourcesRequirements,contextResourceIdentifiers:f.contextResourceIdentifiers});if(s)return e.some(e=>e.resourceType===s.parentResourceType&&e.resourceId===s.parentResourceId)?{...s,displayMode:na.NONE}:s;let t=e[e.length-1];return t?{parentResourceType:t.resourceType,parentResourceId:t.resourceId,displayMode:na.NONE}:void 0},[s,l,f.parentResourcesRequirements,f.contextResourceIdentifiers]),We=(0,Q.useRef)({titleMounted:!1}).current,Ge=(0,Q.useMemo)(()=>({resourceType:p,title:Oe?Te:l&&Ae?null:be,titlePending:Ae&&(l||!be),titleMountTracker:We,hostProvidesHeading:l,titleTarget:Ne,leadingTarget:Fe}),[p,Oe,Te,be,We,l,Ae,Ne,Fe]);(0,Q.useEffect)(()=>{});let Ke=(0,$.jsxs)(`div`,{ref:Re,className:U(`flex min-w-0 items-center gap-element pb-item-sm`,Ve?`min-h-8`:`empty:hidden`),"data-slot":`resource-header-bar`,children:[(0,$.jsx)(yB,{host:_B.SURFACE,navigationZone:t}),!l&&(0,$.jsx)(MB,{resourceContext:f,navigationZone:t,navigationInitiator:n}),He&&(0,$.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-element`,children:He})]});if(!x)return Ae?(0,$.jsx)(iV,{className:a,actions:o,bar:Ke}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(eC,{children:o})}):null;if(ke)return Ae?(0,$.jsx)(iV,{className:a,actions:o}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(eC,{children:o})}):null;let qe=!!N&&!!je;return(0,$.jsxs)(`div`,{className:U(a||`flex-1`,QB,`flex min-w-0 flex-col`),"data-slot":`resource-header`,children:[Ke,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,"data-slot":`resource-header-title-line`,children:[De&&(0,$.jsx)(`div`,{className:`shrink-0`,children:De}),qe&&(0,$.jsx)(`span`,{ref:Ie,className:`flex shrink-0 items-center gap-field empty:hidden`,"data-slot":`resource-header-leading`}),qe?(0,$.jsx)(`div`,{ref:Pe,className:`flex min-w-0 flex-1 basis-60 items-center`,"data-slot":`resource-header-title`}):(0,$.jsx)(BB,{title:(Oe?Te:be)??``,hostProvidesHeading:l,className:`flex-1 basis-60`}),o&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(eC,{children:o})})]}),qe&&(0,$.jsx)(`div`,{className:`min-w-0 [&:has(:is(span,a,img,svg,button,p))]:pt-item-sm`,"data-slot":`resource-header-facts`,children:(0,$.jsx)(RB,{value:Ge,children:(0,$.jsx)(IB,{schema:je,data:ne,labels:Me,resourceType:p,resourceId:E?String(E):void 0,contextualParameters:le,contextResourceIdentifiers:h,parentResourcesRequirements:f.parentResourcesRequirements,navigationZone:t,parentReferenceConfig:Ue,disableInlineEdit:!0,layoutTemplate:N,defaultDisplayChromeMode:Ic.INLINE,isLoading:!ne})})}),!Oe&&we&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:we}),ae&&(0,$.jsxs)(`p`,{className:`mt-item-xs text-xs text-destructive/80 inline-flex items-center gap-item-xs`,role:`alert`,"aria-live":`polite`,title:ae.message,children:[T(H.WARNING,{size:ca.XS}),(0,$.jsx)(`span`,{children:ae.message})]})]})};function oV({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_HEADER,`ResourceLayout_Header`)(e);return(0,$.jsx)(n,{...t})}function sV({onSuccess:e,errorMessage:t,errorComponent:n}){let{resourceContext:r,resourceType:i,operation:a,reportError:o,goBackWithinZone:s,executeCurrentOperation:c}=cC(),{doOperation:l,registry:u}=fm(),{tComponent:d}=K({component:B.RESOURCES_LAYOUTS_ACTION,resource:i}),f=(0,Q.useRef)(l);f.current=l;let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useMemo)(()=>nl(a),[a]),b=y&&tr(Tl(a,u.resourceConfigurations[i]?.operations)),x=(0,Q.useMemo)(()=>JSON.stringify({contextResourceIdentifiers:V.buildContextResourceIdentifiersKey(r.contextResourceIdentifiers??{}),parentResourcesRequirements:r.parentResourcesRequirements??[]}),[r.contextResourceIdentifiers,r.parentResourcesRequirements]),S=(0,Q.useMemo)(()=>{let e=r.contextResourceIdentifiers?.[i];return e?On.getResourceId(e)??null:null},[r.contextResourceIdentifiers,i])??(_?.contextKey===x&&typeof _.row._id==`string`&&_.row._id.length>0?_.row._id:null),C=(0,Q.useMemo)(()=>!S||r.contextResourceIdentifiers?.[i]?r.contextResourceIdentifiers:{...r.contextResourceIdentifiers,[i]:S},[r.contextResourceIdentifiers,S,i]),w=(0,Q.useMemo)(()=>V.buildContextualParameters(C,u),[C,u]),T=a?.variantKey,E=a?.admitsCrossTenantPlatformAdministration===!0,D=(0,Q.useMemo)(()=>({variantKey:T,admitsCrossTenantPlatformAdministration:E}),[E,T]),O=(0,Q.useMemo)(()=>Ez(i,u,{hasResourceId:!!S,contextResourceIdentifiers:C,contextualParameters:w,actingOperation:D}),[C,w,S,D,u,i]),{rmm:k}=Iz({resourceType:i,resourceId:S,doOperationRef:f,contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,contextResourceIdentifiers:C,resourceSchema:u.resourceConfigurations[i]?.mainSchema,resourceInheritance:u.resourceConfigurations[i]?.inheritenceSchemaDefinition,enabled:y&&!!S,conflictPolicy:{strategy:hE.ACCEPT_REMOTE},directFallbackAccepted:b,actingOperation:D}),A=(0,Q.useMemo)(()=>yp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),[d]),j=QR((0,Q.useMemo)(()=>C===r.contextResourceIdentifiers?r:{...r,contextResourceIdentifiers:C},[C,r]),a),M=(0,Q.useContext)(uh),N=(0,Q.useRef)(M);N.current=M;let P=(0,Q.useCallback)(t=>{wn(t)&&N.current?.notifyInfo(yp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`operationSentForApproval`})),j(t),e?e(t):s()},[j,s,e,d]),F=(0,Q.useCallback)(e=>{o(e,t,n)},[n,t,o]);return(0,Q.useEffect)(()=>{if(!y||S||!O)return;let e=!1;return g(!0),Oz({doOperation:f.current,readOperationPathKey:O,contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements}).then(t=>{e||v({contextKey:x,row:t})}).catch(t=>{e||F(t instanceof Error?t:Error(String(t)))}).finally(()=>{e||g(!1)}),()=>{e=!0}},[x,O,w,r.parentResourcesRequirements,S,F,y]),(0,Q.useEffect)(()=>{if(k&&_&&_.contextKey===x&&(typeof k.getSnapshot!=`function`||k.getSnapshot().confirmedData===null)&&typeof k.setInitialState==`function`){let e=_.row;k.setInitialState(e,e._version??0,e._field_meta)}},[x,_,k]),{execute:(0,Q.useCallback)(async e=>{m(!0);try{let t;if(y&&(k||!b)){if(!k)throw new ua({surfaceName:`useOperationDirectExecution`,resourceType:i,operationIdentifier:String(a.operationIdentifier)});let n=await k.queueMutation({},{type:dE.CUSTOM,priority:vE.HIGH,source:{type:fE.CUSTOM,subscriberId:`direct-execution:${String(a.operationIdentifier)}`},transportOverride:{operationPathKey:Ta.createOperationPathKeyFromOperation(a),contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{},readBackOnSuccess:!0}});if(!n.success)throw YR(n.error,A);t=n.heldForApproval??n.responseData}else if(y){if(!S)throw Error(`${String(a.operationIdentifier)} on ${i} has no row to act on: no id on the route and none from its canonical READ.`);t=await f.current(Ta.createOperationPathKeyFromOperation(a),{contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{}})}else t=await c(e);P(t)}catch(e){F(e instanceof Error?e:Error(A))}finally{m(!1)}},[w,r.parentResourcesRequirements,c,F,P,b,y,S,a,i,k,A]),isExecuting:p,isBootstrapping:h,completeWithSuccess:P,reportFailure:F}}var cV=as.getLogger(),lV;(function(e){e.FULL=`full`,e.COMPACT=`compact`})(lV||={});function uV({...e}){let{errorMessage:t,errorComponent:n,onSuccess:r,onCancel:i,chrome:a,headerActions:o,recordNavigation:s}=e,{resourceContext:c,navigationZone:l,navigationInitiator:u,resourceType:d,operation:f}=cC(),p=e.resourceContext?.operation,m=p?Ta.createOperationPathKeyFromOperation(p):void 0,h=f?Ta.createOperationPathKeyFromOperation(f):void 0;(0,Q.useEffect)(()=>{m&&h&&m!==h&&cV.error(`[ResourceLayout_SemanticOperationFallback] handed "${m}" but the nearest operation view is "${h}" — this host would render and execute the wrong operation. A host rendered outside its operation's own view must provide one; use ResourceOperationDetachedHost.`)},[m,h]);let{tComponent:g,tResourceOperation:_,isReady:v}=K({component:B.RESOURCES_LAYOUTS_ACTION,resource:d}),y=(0,Q.useMemo)(()=>[`resources.${d}`,`components.${B.RESOURCES_LAYOUTS_ACTION}`],[d]),[b,x]=(0,Q.useState)(!1),{execute:S,isExecuting:C,isBootstrapping:w,completeWithSuccess:T,reportFailure:E}=sV({onSuccess:r,errorMessage:t,errorComponent:n}),D=(0,Q.useMemo)(()=>_(d,String(f.operationIdentifier),`title`),[f.operationIdentifier,d,_]),O=(0,Q.useMemo)(()=>yp({tComponent:g,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`runningAction`,params:{actionLabel:D}}),[D,g]),k=(0,Q.useCallback)(async()=>{await S()},[S]),A=!Bre(f)&&!di(f),j=f.riskLevel===zi.CRITICAL,M=(0,Q.useMemo)(()=>KS(_,d,String(f.operationIdentifier)),[_,d,f.operationIdentifier]),N=(0,Q.useCallback)(()=>{j?x(!0):k()},[j,k]),P=(0,Q.useCallback)(()=>{x(!1),k()},[k]),F=(0,Q.useCallback)(()=>{x(!1)},[]),I=a===lV.COMPACT;return v===!1?null:(0,$.jsx)(sb,{i18nKeys:y,children:(0,$.jsxs)(`div`,{className:I?`space-y-field`:`space-y-section`,children:[!I&&(0,$.jsx)(oV,{resourceContext:c,navigationZone:l,navigationInitiator:u,actions:o}),!I&&s,A?(0,$.jsx)(mB,{resourceContext:c,navigationZone:l,onSuccess:T,onError:E,onCancel:i,showErrorSummary:!0,className:I?void 0:`max-w-2xl`}):(0,$.jsxs)(`div`,{className:I?`bg-muted rounded-lg p-container`:`bg-muted rounded-lg p-container max-w-2xl`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-field`,children:yp({tComponent:g,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`confirmMessage`})}),(0,$.jsx)(X,{type:`button`,variant:J.DEFAULT,onClick:N,disabled:C||w,children:C||w?O:D})]}),b&&(0,$.jsx)(Iw,{open:!0,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,requireTypedConfirmation:!0,confirmationPhrase:M})]})})}function dV({resourceContext:e,navigationZone:t,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a}){let o=pV();return(0,$.jsx)(uC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(`div`,{ref:o,className:`contents`,"data-slot":`resource-operation-detached-host`,children:(0,$.jsx)(uV,{resourceContext:e,navigationZone:t,chrome:lV.COMPACT,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a})})})}var fV=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([aria-disabled="true"])`;function pV(){let e=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>`u`)return;let n=!1,r=()=>{if(n)return;if(t.contains(document.activeElement)){n=!0;return}let e=t.querySelector(fV);e&&(e.focus(),n=!0)};if(r(),n)return;let i=new MutationObserver(()=>{r(),n&&i.disconnect()});return i.observe(t,{childList:!0,subtree:!0}),()=>i.disconnect()},[]),e}function mV({resourceContext:e,navigationZone:t,onDismiss:n}){let{tComponent:r}=K({component:B.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n()},[n]);return(0,$.jsx)(dV,{resourceContext:e,navigationZone:t,onSuccess:i,onCancel:n,errorMessage:yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionPopoverBody`})}var hV=10,gV=300,_V=2;function vV({schema:e,name:t,value:n,targetResourceType:r}){let{registry:i,doOperation:a}=fm(),{t:o,formatDate:s,formatDateTime:c,tComponent:l,tResourceFieldEdit:u}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE}),d=cp(),f=FD(),p=lC(),m=(0,Q.useMemo)(()=>f?.contextResourceIdentifiers?V.buildContextualParameters(f.contextResourceIdentifiers,i):p?.contextualParameters??{},[f?.contextResourceIdentifiers,p?.contextualParameters,i]),h=(0,Q.useRef)(null),g=(0,Q.useRef)(a);g.current=a;let _=(0,Q.useRef)(m);_.current=m;let v=f?{resourceType:f.resourceType,id:f.resourceId}:p?.resourceContext?{resourceType:p.resourceContext.resourceType,id:On.getAddressedRecordId(p.resourceContext)}:void 0,y=(0,Q.useRef)(v);y.current=v;let b=me(e)===vu.ARRAY,x=b&&Ma(e)||e,S=(0,Q.useMemo)(()=>Aj({explicitResourceType:r,schema:Du(e)?e:x,fieldName:t,registry:i}),[x,t,i,e,r]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(new Map),[I,ee]=(0,Q.useState)(null),L=(0,Q.useMemo)(()=>Rw(n),[n]),R=(0,Q.useMemo)(()=>S?nu(i.resourceConfigurations?.[S]?.operations??[],W.READ)??null:null,[i,S]),z=(0,Q.useCallback)(async e=>{if(S){k(!0),ee(null);try{let t=V.buildForeignKeySearchOperationPath(S,i),n=V.buildForeignKeySearchParams(e,hV,{resourceType:S,registry:i}),r=On.withoutSelfReferencingParents(_.current,S,i),a=Lw({resourceType:S,registry:i,contextualParameters:r})??r,l=await g.current(t,{contextualParameters:a,queryParameters:n.queryParameters,dataMode:n.dataMode}),u=[];if(Array.isArray(l))u=l;else if(l&&typeof l==`object`){let e=l;u=e.data||e.items||[]}E(Vue({items:u,resourceType:S,registry:i,t:o,formatDate:s,formatDateTime:c}))}catch(t){let n=O(t);as.getLogger().error(`[useResourceSearch] Failed to fetch options:`,{resourceType:S,query:e,...n,error:t}),ee({...n,message:d(t)}),E([])}finally{k(!1)}}},[S,i,o,s,c]),te=(0,Q.useRef)(P);te.current=P;let ne=(0,Q.useCallback)(async()=>{if(!S||L.length===0)return;let e=L.filter(e=>!te.current.has(e));if(e.length===0)return;j(!0);let t=new Map(te.current);for(let n of e)try{let{label:e}=await Bw({resourceType:S,id:n,registry:i,doOperation:g.current,contextualParameters:zm({hostIdentifiers:{},hostContextualParameters:_.current,hostRecord:y.current,targetResourceType:S,targetId:n,registry:i}).contextualParameters,readOperation:R,t:o,formatDate:s,formatDateTime:c});t.set(n,e)}catch{t.set(n,n)}F(t),j(!1)},[S,L,i,R,o,s,c]);(0,Q.useEffect)(()=>{ne()},[ne]),(0,Q.useEffect)(()=>{if(C)return h.current&&clearTimeout(h.current),M.length>=_V?h.current=setTimeout(()=>{z(M)},gV):M.length===0&&z(),()=>{h.current&&clearTimeout(h.current)}},[M,C,z]);let re=(0,Q.useCallback)(e=>{N(e)},[]),ie=(0,Q.useCallback)(e=>{w(e),e?ee(null):N(``)},[]),ae=(0,Q.useCallback)(e=>P.get(e)||e,[P]),oe=(0,Q.useMemo)(()=>M.length>0&&M.length<_V?l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`minSearchChars`,{count:String(_V)}):l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`noResults`),[M,l]),se=f?.resourceType;return{options:T,isLoading:D,isLoadingCurrentValue:A,isOpen:C,setIsOpen:ie,handleSearchChange:re,getDisplayLabel:ae,resourceType:S,isMultiple:b,normalizedValue:L,emptyMessage:oe,defaultPlaceholder:(0,Q.useMemo)(()=>{if(!b&&se){let e=u(se,hr.labelDictionaryPath(t),`label`);if(e)return yp({tComponent:l,componentType:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`selectReferencePlaceholder`,params:{target:e}})}return l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`selectPlaceholder`)},[se,b,t,l,u]),fetchError:I}}var yV=Qs(B.LOW_LEVEL_COMMAND,`Command`,[`Dialog`,`Input`,`List`,`Empty`,`Group`,`Item`,`Shortcut`,`Separator`]);function bV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n,{...t})}function xV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Dialog,{...t})}function SV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Input,{...t})}function CV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.List,{...t})}function wV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Empty,{...t})}function TV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Group,{...t})}function EV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Item,{...t})}function DV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Shortcut,{...t})}function OV({preset:e=q.DEFAULT,...t}){let n=yV(e);return(0,$.jsx)(n.Separator,{...t})}var kV=7;function AV({resourceContext:e,navigationZone:t,currentValue:n,onDismiss:r}){return(0,$.jsx)(uC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(jV,{currentValue:n,onDismiss:r})})}function jV({currentValue:e,onDismiss:t}){let{operation:n,resourceType:r}=cC(),{tComponent:i}=K({component:B.RESOURCES_LAYOUTS_ACTION,resource:r}),a=(0,Q.useMemo)(()=>Gs(n),[n]),{execute:o,isExecuting:s,isBootstrapping:c}=sV({onSuccess:t,errorMessage:yp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionDropdownBody`}),l=(0,Q.useCallback)(n=>{a&&(n===e?t():o({[a.fieldName]:n}))},[a,e,o,t]);if(!a)return null;let u=s||c;return a.domain===ma.REFERENCE?(0,$.jsx)(NV,{choice:a,currentValue:e,busy:u,onPick:l}):(0,$.jsx)(MV,{choice:a,currentValue:e,busy:u,onPick:l})}function MV({choice:e,currentValue:t,busy:n,onPick:r}){let{resourceType:i,operation:a}=cC(),{tComponent:o,isReady:s}=K({component:B.LOW_LEVEL_FORM_FIELD}),{enumLabels:c,isReady:l}=nE(a.requestDto,{resourceType:i,operationId:String(a.operationIdentifier)},void 0,`edit`),u=(0,Q.useMemo)(()=>Xo(e.fieldSchema)??[],[e.fieldSchema]),d=c[e.fieldName],f=u.length>kV;return s===!1||l===!1?(0,$.jsx)(PV,{}):(0,$.jsxs)(bV,{shouldFilter:f,children:[f&&(0,$.jsx)(SV,{placeholder:o(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`)}),(0,$.jsxs)(CV,{children:[(0,$.jsx)(wV,{children:o(B.LOW_LEVEL_FORM_FIELD,`noResults`)}),(0,$.jsx)(TV,{children:u.map(e=>{let i=d?.[e]??e;return(0,$.jsx)(FV,{value:e,label:i,isCurrent:e===t,disabled:n,onPick:r},e)})})]})]})}function NV({choice:e,currentValue:t,busy:n,onPick:r}){let{tComponent:i,isReady:a}=K({component:B.LOW_LEVEL_FORM_FIELD}),{options:o,isLoading:s,setIsOpen:c,handleSearchChange:l,emptyMessage:u,fetchError:d}=vV({schema:e.fieldSchema,name:e.fieldName,value:t});return(0,Q.useEffect)(()=>(c(!0),()=>c(!1)),[]),a===!1?(0,$.jsx)(PV,{}):(0,$.jsxs)(bV,{shouldFilter:!1,children:[(0,$.jsx)(SV,{placeholder:i(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),onValueChange:l,autoFocus:!0}),(0,$.jsxs)(CV,{children:[(0,$.jsx)(wV,{children:s?(0,$.jsx)(PV,{}):d?.message??u}),(0,$.jsx)(TV,{children:o.map(e=>(0,$.jsx)(FV,{value:e.value,label:e.label,isCurrent:e.value===t,disabled:n||e.disabled===!0,onPick:r},e.value))})]})]})}function PV(){return(0,$.jsx)(`span`,{className:`flex justify-center py-element`,children:(0,$.jsx)(ib,{size:16})})}function FV({value:e,label:t,isCurrent:n,disabled:r,onPick:i}){let{renderIcon:a}=Mf();return(0,$.jsxs)(EV,{value:e,keywords:[t],disabled:r,onSelect:()=>i(e),"aria-current":n?`true`:void 0,"data-choice-value":e,children:[a(H.CHECK,{size:ca.SM,className:U(`me-2 shrink-0`,n?`opacity-100`:`opacity-0`)}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})}function IV(e){return e}function LV(e,t,n){let r=e.initiatorInfos??[];return r.length===0||r.some(e=>{let r=e.parameters??[];return r.length===0||r.every(e=>[e.fieldIdentifier,e.relationshipField,e.resourceType].filter(e=>typeof e==`string`&&e.length>0).some(e=>{if(On.getResourceId(t[e]).length>0)return!0;let r=n[e];return r!==void 0&&String(r).length>0}))})}var RV={[W.UPDATE]:10,[W.CREATE]:20,[W.DELETE]:90,[W.DELETE_MANY]:90,[W.UPDATE_MANY]:10},zV=50,BV=0;function VV(e){let t=e.generatedOperation?.export;if(t?.formats?.length&&t.rowScopes?.length)return t}function HV(e){if(!e)return;let{page:t,limit:n,...r}=e;return r}function UV(e){let t=e.rowScope===ed.FULL_RESULT_SET?`all rows`:`this page`;return`${e.format.toUpperCase()} — ${t}`}function WV(e){let t=e.generatedOperation?.kind===Oo.GENERATED_FILE_REGENERATE?e.generatedOperation:void 0,n=typeof t?.fieldName==`string`?t.fieldName:typeof e.operationIdentifier==`string`?Ul.parseGeneratedFileRegenerateOperationIdentifier(e.operationIdentifier)?.fieldName:void 0;return n&&n.length>0?n:void 0}function GV(e){switch(e){case zi.CRITICAL:case zi.HIGH:return J.DESTRUCTIVE;default:return J.GHOST}}function KV(e){return e?{unavailability:e}:{}}var qV={[W.READ]:`viewDetails`,[W.UPDATE]:`edit`,[W.DELETE]:`delete`},JV=[];function YV(e,t){let n=e?.[ul.ORGANIZATIONS],r=n?On.getResourceId(n):``;return r.length>0?r:t??null}function XV(e){let{resourceType:t,displayMode:n,currentObject:r,currentObjectDataMode:i,contextResourceIdentifiers:a,parentResourcesRequirements:o,navigationZone:s,sourceOperation:c,excludeOperations:l,bulkOnly:u=!1,selectionObjects:d,onSelectionNarrow:f,collectionOnly:p=!1,placementFilter:m,selectedItemIds:h,matchAllSelection:g,additionalContext:_,successDiscriminator:v,suppressViewDetails:y=!1,onOperationExecuted:b,collectionExportQuery:x}=e,S=(0,Q.useRef)(r);S.current=r;let{registry:C,doOperation:w}=fm(),{permissions:E}=pg(),D=Zp(),{navigateToResource:O}=DS(),{tComponent:k,tResourceOperation:A,tResourceFieldDisplay:j,isReady:M}=K({component:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,resource:t}),N=cp(),{renderIcon:P}=Mf(),F=Ux(),{emit:I,on:ee}=Mo(),L=(0,Q.useContext)(um)?.isConnected??!1,R=(0,Q.useContext)(Fi),z=(0,Q.useRef)(R);z.current=R;let te=(0,Q.useRef)(x);te.current=x;let ne=(0,Q.useContext)(uh),ie=(0,Q.useRef)(ne);ie.current=ne;let ae=(0,Q.useRef)(w),oe=(0,Q.useRef)(I),ce=(0,Q.useRef)(L);ae.current=w,oe.current=I,ce.current=L;let[le,ue]=(0,Q.useState)({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null}),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(new Set),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(()=>new Set),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(null),Ce=(0,Q.useRef)(null),we=(0,Q.useMemo)(()=>C.resourceConfigurations[t],[C,t]),Te=n===Se.DETAIL&&Tie({resourceRelationships:we?.resourceRelationships,currentObject:r,contextResourceIdentifiers:a}),Ee=(0,Q.useMemo)(()=>se(n,we?.frontendConfiguration?.layout?.actionDisclosure),[n,we]),De=JSON.stringify(a??{}),Oe=(0,Q.useMemo)(()=>a,[De]),ke=JSON.stringify(o??[]),je=(0,Q.useMemo)(()=>o??[],[ke]),Me=r?._id??(we?.resourceFieldIdentifier?r?.[we.resourceFieldIdentifier]:void 0),Ne=typeof Me==`string`&&Me.length>0?Me:void 0,Pe=(0,Q.useMemo)(()=>{if(!Ne)return Oe;let e=Oe[t];if(On.getResourceId(e)===Ne)return Oe;let n=e?On.getFieldIdentifier(e):void 0;return{...Oe,[t]:n?{fieldIdentifier:n,resourceId:Ne}:Ne}},[Oe,Ne,t]),Fe=JSON.stringify(l??[]),Ie=(0,Q.useMemo)(()=>l??[],[Fe]),Le=YV(Oe,D?.currentOrganizationId),Re=E?.appLevel??JV,ze=Le?E?.organizations?.[Le]??JV:JV,Be=Re.join(`,`),Ve=ze.join(`,`),He=(0,Q.useMemo)(()=>Re,[Be]),Ue=hg(),We=(0,Q.useMemo)(()=>ze,[Ve]),Ge=E?.accessProfile??null,Ke=(0,Q.useMemo)(()=>({applicationRoles:[...He],organizationRoles:[...We],roleTables:Ue,organizationId:Le??null,accessProfile:Ge}),[He,We,Ue,Le,Ge]),qe=yS(),Je=(0,Q.useMemo)(()=>(we?.operations??[]).filter(e=>!bS(e.operationFrontendConfig?.runtimeAvailability,qe)).map(e=>Ta.createOperationPathKeyFromOperation(e)).sort().join(`
11
- `),[we,qe]),Ye=(0,Q.useMemo)(()=>new Set(Je?Je.split(`
12
- `):[]),[Je]),Xe=x?.isSearchActive,Ze=x?.listingVariantKeys!==void 0,Qe=x?.listingVariantKeys?.list,$e=x?.listingVariantKeys?.search,et=(0,Q.useMemo)(()=>Ze?{list:Qe,search:$e}:void 0,[Ze,Qe,$e]),tt=(0,Q.useMemo)(()=>{let e=(we?.operations??[]).filter(e=>Ya(e)),t=e.some(e=>e.generatedOperation?.kind===Oo.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH),n=e.some(e=>e.generatedOperation?.kind===Oo.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation!==W.SEARCH);return t&&n},[we]),nt=(0,Q.useMemo)(()=>{if(!we)return[];let e=we.operations||[],n=new Set(Ie);return e.filter(e=>{let r=String(e.operationIdentifier),i=e.isBulkOperation??!1;if(n.has(r)||e.operationFrontendConfig?.actionVisibility===ho.HIDDEN||Ye.has(Ta.createOperationPathKeyFromOperation(e))||fr(e.operationFrontendConfig)&&!Ya(e))return!1;let a=Da(e,{addressesTheContextSingletonRecord:Te});if(p){if(!a||i)return!1}else if(a)return!1;if(!Wn(e,et)||Xe!==void 0&&tt&&Ya(e)&&(e.generatedOperation?.kind===Oo.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH)!==Xe||u&&!i||!u&&(i||nae(e)))return!1;let o=e.variantType;return!(o&&o!==at.API_CALL||!Um({...e,resourceType:t,resourcePrimaryScope:we?.resourcePrimaryScope},Ke))})},[we,t,Ie,Ye,u,p,Ke,Xe,et,tt,Te]),rt=GS(nt,{currentObject:r,resourceType:t,selectionObjects:d,...i?{subjectDataMode:i}:{},...Le?{organizationId:Le}:{}}),it=(0,Q.useMemo)(()=>V.buildContextualParameters(Pe,C),[Pe,C]),ot=(0,Q.useMemo)(()=>!!On.getResourceId(Pe[t]),[Pe,t]),st=v??Bc(_),ct=(0,Q.useCallback)(e=>we?e.isBulkOperation===!0?LV(e,Pe,it):!nh({operation:e,resourceType:t,resourceConfig:we})||Km({resourceConfig:we,operation:e,registry:C,hasResourceId:ot,contextResourceIdentifiers:Pe,contextualParameters:it}):!0,[Pe,it,ot,C,we,t]),lt=(0,Q.useCallback)(e=>{let n=String(e.operationIdentifier);if(Ya(e)){let t=VV(e),n=t?Mr(t):[],r=yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`collectionExport`});return n.length===1?`${r} ${n[0].format.toUpperCase()}`:r}if(di(e)){let n=WV(e);return yp(n?{tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerateNamed`,params:{field:j(t,n,`label`)}}:{tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerate`})}let r=qV[n];return r?yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:r}):KS(A,t,n)},[k,A,j,t]),ut=(0,Q.useCallback)(e=>P({category:re.OPERATION_RESOURCES,resourceType:t,operationReference:String(e.operationIdentifier)},{size:ca.SM}),[P,t]),dt=(0,Q.useCallback)(e=>{let t=e.operationFrontendConfig;return t?.displayPriority===void 0?RV[vl(e)??String(e.operationIdentifier)]??zV:t.displayPriority},[]),ft=(0,Q.useCallback)(e=>ge.has(Ta.createOperationPathKeyFromOperation(e)),[ge]),pt=(0,Q.useCallback)(()=>g?.matchedCount??d?.length??h?.length??0,[g,h,d]),mt=(0,Q.useRef)(pt);mt.current=pt,(0,Q.useEffect)(()=>{if(st)return ee(Ec.RESOURCE_OPERATION_EXECUTED,e=>{let t=ni(e.resultSummary);t&&he({jobId:t.jobId,attemptedCount:mt.current()})},e=>e.resourceType===t&&e.isBulkOperation===!0&&e.optionalDiscriminator===st)},[ee,t,st]);let ht=(0,Q.useCallback)(e=>g?T(e):nre(e),[g]),gt=(0,Q.useCallback)(e=>e.isBulkOperation===!0&&pt()>ht(e),[pt,ht]),_t=(0,Q.useCallback)((e,n)=>{if(gt(e))return{reason:yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`bulkSelectionTooLarge`,params:{maxSelection:ht(e),selectedCount:pt()}})};if(n.isEnabled||n.featureAvailability&&!n.featureAvailability.isAvailable)return;let r=String(e.operationIdentifier),i=cm(A,t,r),a=n.ineligibleSelectionIndices;if(e.isBulkOperation===!0&&a&&a.length>0&&d?.length){let e=yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForSelection`,params:{ineligibleCount:a.length,selectedCount:d.length}}),t=new Set(a),n=d.filter((e,n)=>!t.has(n));return{reason:i?`${e} ${i}`:e,...n.length>0&&f?{resolve:{label:yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`keepEligibleOnly`,params:{eligibleCount:n.length}}),onSelect:()=>f(n)}}:{}}}return{reason:i??yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForItem`})}},[gt,ht,pt,f,t,h,d,k,A]),vt=(0,Q.useCallback)(e=>{let t=zS(e);return rt.has(t)?rt.get(t):e.enabledCondition||e.requiredFeatures?{isEnabled:!1}:{isEnabled:!0}},[rt]),yt=(0,Q.useCallback)(e=>vt(e).isEnabled,[vt]),bt=(0,Q.useCallback)(e=>On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:e,contextResourceIdentifiers:Pe,additionalContext:{...e.isBulkOperation===!0&&g?{[Ote]:{...g.filters?{filters:g.filters}:{},...g.search?{search:g.search}:{},...g.listing?{listing:g.listing}:{},matchedCount:g.matchedCount}}:e.isBulkOperation===!0&&h?.length?{[ln]:h}:{},...st?{[bte]:st}:{}},parentResourcesRequirements:je,isOperationDefault:e.isOperationDefault??!0}),[t,Pe,je,h,g,st]),xt=(0,Q.useCallback)(e=>{if(!we)return;let t=bt(e),n=V.flattenContextIdentifiers(Pe),r=dh.resolveResourceUrl(we,e,n,C.allResourceFieldIdentifiers,je)?.resolvedUrl;O(t,dh.createOperationInitiator(s,c),r)},[we,bt,Pe,je,C,O,s,c]),St=(0,Q.useCallback)(async(e,n)=>{let r=VV(e),i=z.current?.httpClient;if(!r||!i){ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnavailable`));return}let o=te.current,s=e.resourceOperationLike===W.SEARCH;if(o?.isSearchActive&&!s){ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportClearSearch`));return}let{format:c,rowScope:l}=n,u=mue({registry:C,resourceConfig:we,exportOperation:e,resourceType:t,contextResourceIdentifiers:Hu(a),contextualParameters:it,parentResourcesRequirements:je,apiBaseUrl:xa.getApiUrl(),format:c,rowScope:l,listingQuery:l===ed.FULL_RESULT_SET?HV(o?.params):o?.params});if(!u)ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnaddressable`));else try{await hue({url:u,resourceType:t,format:c,getBlob:e=>i.fetchFileBlob(e)})}catch(e){ie.current?.notifyError?.(N(e,k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportFailed`)))}},[C,we,t,a,it,je,k,N]),Ct=(0,Q.useCallback)(async e=>{if(!we)return;let n=Ta.createOperationPathKeyFromOperation(e);if(!pe.current.has(n)){pe.current.add(n),_e(new Set(pe.current)),fe(!0);try{let n=Ta.createOperationPathKeyFromOperation(e),r=e.isBulkOperation??!1,i=e.operationFrontendConfig?.rowTargetRequestField,a=i?On.getResourceId(Pe[t]):``,o=r&&g?eee(g):r&&h?.length?Ol(h):i&&a?{[i]:a}:void 0;if(i&&!a)throw Error(`Row-targeted operation "${String(e.operationIdentifier)}" could not resolve the target row id from context.`);let s=S.current,c=await ae.current(n,{contextualParameters:it,parentResourcesRequirements:je,...o?{requestData:o}:{}},{silent:!0});if(wn(c)){ie.current?.notifyInfo(yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationSentForApproval`}));return}let l=ni(c);l&&ie.current?.notifyInfo(yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationRunningInBackground`}));let u=l?void 0:c&&typeof c==`object`&&!Array.isArray(c)?c.message:void 0;typeof u==`string`&&u.length>0&&ie.current?.notifySuccess(u);let d=()=>{let n=di(e),r=Ae({contextResourceIdentifiers:Pe,resourceType:t,result:c,isBulkOperation:e.isBulkOperation===!0}),i=V.buildContextualParameters(r,C),a=Xu(c);if(!Ai(e,ce.current)&&Tu(e)){let a=ry({resourceType:t,registry:C,callContext:Pe,...e.isBulkOperation===!0?{}:{previousRow:s,row:c}}),o=ty({resourceType:t,registry:C,scopes:a}),l=o.length>0?o:[null];for(let e of l){let n=e??{operationIdentifier:W.LIST};oe.current(Ec.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:a.contextResourceIdentifiers,...a.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:a.previousContextResourceIdentifiers}:{},parentResourcesRequirements:je,...st?{optionalDiscriminator:st}:{}})}if(n){let e=Ra(we.operations??[],W.READ,{requireAddressable:!0}).filter(e=>Km({resourceConfig:we,operation:e,registry:C,hasResourceId:On.getResourceId(r[t]).length>0,contextResourceIdentifiers:r,contextualParameters:i})),n=e.length>0?e:[null],a=new Set;for(let e of n){let n=e??{operationIdentifier:W.READ},i=[On.getResourceId(r[t]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);a.has(i)||(a.add(i),oe.current(Ec.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:je,...st?{optionalDiscriminator:st}:{}}))}}}oe.current(Ec.RESOURCE_OPERATION_EXECUTED,{resourceType:t,operationIdentifier:String(e.operationIdentifier),operation:e,variantType:e.variantType,isOperationDefault:e.isOperationDefault??!0,isBulkOperation:e.isBulkOperation??!1,variantKey:e.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:je,resultSummary:a,...st?{optionalDiscriminator:st}:{}}),b?.(e)};if(c&&typeof c==`object`){let t=JS(e.responseDto,c);if(t.length>0){xe(t),Ce.current=d;return}}d()}catch(n){console.error(`[useResourceOperationActions] Operation ${String(e.operationIdentifier)} failed:`,n);let r=n&&typeof n==`object`?n:{};oe.current(Ec.NOTIFY_RESOURCE_ERROR,{resourceType:t,operationIdentifier:String(e.operationIdentifier),operation:e,variantType:e.variantType,isOperationDefault:e.isOperationDefault??!0,isBulkOperation:e.isBulkOperation??!1,variantKey:e.variantKey,contextResourceIdentifiers:Hu(Pe),parentResourcesRequirements:je,additionalContext:{error:r.message??mo(n),errorCustomMessageReference:r.customMessageReference,errorHttpStatus:r.httpStatus,errorRefusalCode:nz(n).errorRefusalCode,...rz(n)}})}finally{fe(!1),pe.current.delete(n),_e(new Set(pe.current))}}},[we,t,C,it,Pe,je,h,st,b]),wt=(0,Q.useCallback)(e=>{if(Ya(e)){let t=VV(e),n=t?Mr(t):[];n.length>0&&St(e,n[0]);return}let n=String(e.operationIdentifier),r=e.riskLevel,i=Jc(e);if(i===uc.INLINE&&F.isAvailable){let n=On.getResourceId(Pe[t]);if(n){F.open({kind:Bx.ELEMENT,elementId:n,operation:e,resourceContext:bt(e)});return}}if(i===uc.POPOVER||i===uc.DROPDOWN)ye(Ta.createOperationPathKeyFromOperation(e));else if(Gt(i)||i===uc.INLINE)xt(e);else if(is(r)){let t=n===W.DELETE?yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmDelete`}):lt(e),i=r===zi.CRITICAL,a=e.isBulkOperation===!0?pt():0,o=[a>0?yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmAppliesToSelection`,params:{count:a}}):void 0,ei(e)?yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmCannotBeUndone`}):void 0].filter(e=>!!e);ue({open:!0,label:t,requiresTypedConfirmation:i,confirmationPhrase:i?lt(e):``,description:o.length>0?o.join(` `):null,confirmLabel:lt(e),callback:()=>Ct(e)})}else Ct(e)},[xt,Ct,k,lt,d,h]),Tt=(0,Q.useCallback)(e=>{let t=Jc(e);t===uc.POPOVER||t===uc.DROPDOWN?xt(e):wt(e)},[xt,wt]),Et=(0,Q.useCallback)(async()=>{le.callback&&await le.callback(),ue({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[le.callback]),Dt=(0,Q.useCallback)(()=>{ue({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[]),Ot=(0,Q.useCallback)(()=>{xe(null);let e=Ce.current;Ce.current=null,e?.()},[]),kt=(0,Q.useCallback)(e=>{let n=Jc(e);if(!(n===uc.POPOVER||n===uc.DROPDOWN||n===uc.INLINE&&!F.isAvailable)||!we)return;let r=Ta.createOperationPathKeyFromOperation(e),i=()=>ye(null),a=A(t,ao(e.operationIdentifier,we.operations),`title`);if(n===uc.DROPDOWN){let t=Gs(e),n=e.isBulkOperation===!0||!t?void 0:S.current?.[t.rowFieldName];return{open:ve===r,onOpenChange:e=>ye(e?r:null),title:a,chrome:YS.LIST,content:Q.createElement(AV,{resourceContext:bt(e),navigationZone:s,onDismiss:i,...typeof n==`string`?{currentValue:n}:{}})}}return{open:ve===r,onOpenChange:e=>ye(e?r:null),title:a,content:Q.createElement(mV,{resourceContext:bt(e),navigationZone:s,onDismiss:i})}},[we,t,A,ve,bt,s,F.isAvailable]);return{items:(0,Q.useMemo)(()=>{if(!we)return[];let e=we.operations||[],t=new Map;for(let e of nt.filter(ct)){let n=String(e.operationIdentifier);t.has(n)||t.set(n,[]),t.get(n).push(e)}let r=[];for(let[e,n]of t){let e=n.filter(e=>vt(e).isEnabled),t=Ke.organizationRoles.length>0?e.filter(e=>e.admitsCrossTenantPlatformAdministration!==!0):[],i=oo(t.length>0?t:e.length>0?e:n),a=i.find(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0)||i.find(e=>e.isOperationDefault===!0)||i[0],o=vt(a),s=a.operationFrontendConfig?.actionVisibility,c=!(!o.featureAvailability||o.featureAvailability.isAvailable);if((s??(Ee.disabledActionHandling===ko.HIDE&&!c?ho.WHEN_AVAILABLE:ho.ALWAYS))===ho.WHEN_AVAILABLE&&!o.isEnabled||!o.isEnabled&&a.isBulkOperation===!0&&d?.length&&(o.ineligibleSelectionIndices?.length??0)>=d.length)continue;let l=new Map(i.map(e=>[e,vt(e)])),u=a.riskLevel,f=a.operationFrontendConfig?.actionVariant??GV(u),p=ut(a),h=lt(a),g=dt(a),_=a.operationFrontendConfig?.actionPlacement??(is(u)&&ei(a)?nc.DANGER_ZONE:nc.PRIMARY);if(m&&_!==m)continue;let v=!o.isEnabled||gt(a);if(v&&o.featureAvailability&&!o.featureAvailability.isAvailable){let e=o.featureAvailability;switch(e.behavior){case Jo.HIDE:continue;case Jo.DISABLE:break;case Jo.UPGRADE_PROMPT:case Jo.ADDON_PROMPT:case Jo.LIMIT_UPGRADE_PROMPT:case Jo.CONTACT_ADMIN:case Jo.CUSTOM:i.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>wt(a),disabled:!0,featureLocked:!0,featureAvailability:IV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)}):r.push({type:`subgroup`,icon:p,label:h,variant:f,items:[],disabled:!0,featureLocked:!0,featureAvailability:IV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)});continue}}let y=Ya(a)?VV(a):void 0;if(y){let e=Mr(y);e.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>{St(a,e[0])},disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)}):e.length>1&&r.push({type:`subgroup`,icon:p,label:h,variant:f,items:e.map(e=>({type:`button`,icon:p,label:UV(e),variant:f,riskLevel:u,operationIdentifier:String(a.operationIdentifier),onClick:()=>{St(a,e)},disabled:v})),disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else if(i.length===1){let e=kt(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>xt(a):()=>wt(a),...e?{popover:e}:{},disabled:v,...v?KV(_t(a,o)):{},...ft(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else{let e=i.filter(e=>e!==a).flatMap(e=>{let t=l.get(e);if(t.featureAvailability&&!t.featureAvailability.isAvailable&&t.featureAvailability.behavior===Jo.HIDE)return[];let n=e.variantKey,r=n?`${h} (${n})`:h,i=e.riskLevel;return[{type:`button`,icon:ut(e),label:r,variant:GV(i),riskLevel:i,operationIdentifier:String(e.operationIdentifier),onClick:()=>Tt(e),disabled:!t.isEnabled||gt(e),...!t.isEnabled||gt(e)?KV(_t(e,t)):{},...t.featureAvailability&&!t.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:IV(t.featureAvailability)}:{}}]}),t=!o.isEnabled&&e.every(e=>e.disabled===!0);if(e.length===0){let e=kt(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>xt(a):()=>wt(a),...e?{popover:e}:{},disabled:v,...v?KV(_t(a,o)):{},...ft(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier),...o.featureAvailability&&!o.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:IV(o.featureAvailability)}:{}});continue}r.push({type:`subgroup`,icon:p,label:h,variant:f,items:e,disabled:t,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}}if(n===Se.SUMMARY&&m!==nc.DANGER_ZONE&&!y){let t=we?ph({resourceConfig:we,operations:e,coreOperation:W.READ,registry:C,hasResourceId:ot,requireFrontendAddressable:!0,contextResourceIdentifiers:Pe,contextualParameters:it}):void 0;if(t){let e=yp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`viewDetails`});r.push({type:`button`,icon:P(H.EYE,{size:ca.SM}),label:e,variant:J.GHOST,onClick:()=>xt(t),disabled:!1,_priority:BV,_group:nc.PRIMARY})}}let i=e=>+(e===nc.DANGER_ZONE);r.sort((e,t)=>i(e._group)-i(t._group)||e._priority-t._priority);let a=[],o;for(let{_priority:e,_group:t,...n}of r)t===nc.DANGER_ZONE&&o===nc.PRIMARY&&a.push({type:`separator`}),a.push(n),o=t;return a},[we,Pe,it,ot,Ke,ct,C,t,nt,rt,n,Ee,y,ut,lt,dt,yt,vt,_t,gt,ft,wt,Tt,xt,kt,St,k,P,d]),isConfirmDialogOpen:le.open,confirmDialogLabel:le.label,confirmDialogDescription:le.description,confirmDialogConfirmLabel:le.confirmLabel,confirmRequiresTypedConfirmation:le.requiresTypedConfirmation,confirmConfirmationPhrase:le.confirmationPhrase,onConfirm:Et,onCancel:Dt,isExecuting:de,acceptedBackgroundRun:me,ephemeralFields:be,onEphemeralAcknowledge:Ot}}function ZV(e={}){let{idField:t=`id`}=e,[n,r]=(0,Q.useState)(new Map),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c=(0,Q.useCallback)(e=>String(e[t]??e._id??``),[t]),l=(0,Q.useCallback)(e=>{let t=typeof e==`string`?e:c(e);return n.has(t)},[n,c]),u=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(n=>{let r=new Map(n);return r.has(t)?r.delete(t):r.set(t,e),r})},[c]),d=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(n=>{if(n.has(t))return n;let r=new Map(n);return r.set(t,e),r})},[c]),f=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})},[c]),p=(0,Q.useCallback)(e=>{a(null),s(null);let t=new Map;for(let n of e)t.set(c(n),n);r(t)},[c]),m=(0,Q.useCallback)(()=>{r(new Map),a(null),s(null)},[]),h=(0,Q.useCallback)(e=>{r(new Map),s(null),a(e)},[]),g=(0,Q.useCallback)(e=>{r(new Map),a(null),s(e.length>0?[...e]:null)},[]),_=(0,Q.useMemo)(()=>Array.from(n.values()),[n]),v=(0,Q.useMemo)(()=>new Set(n.keys()),[n]),y=i?i.matchedCount:o?.length??n.size;return{selectedItems:_,selectedIds:v,isSelected:l,toggleSelection:u,selectItem:d,deselectItem:f,selectAll:p,clearSelection:m,matchAllSelection:i,selectAllMatching:h,explicitIdSelection:o,selectIds:g,selectionCount:y,hasSelection:y>0}}function QV(e){let{registry:t,resourceConfig:n,operation:r,resourceType:i,fieldName:a,recordId:o,contextResourceIdentifiers:s,contextualParameters:c,parentResourcesRequirements:l,apiBaseUrl:u}=e;if(!n?.resourceFieldIdentifier||!o||!r)return null;try{let e=Vn.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let d=On.selectMatchingRoutePath(e,s,n.resourceIdentifier,n.resourceFieldIdentifier,l,t.allResourceFieldIdentifiers),f={...c,[n.resourceFieldIdentifier]:o},p=Vn.buildFileUploadRouteForOperation({operationRouteUrl:d.url,operationParameters:d.parameters,targetResourceType:i,targetResourceFieldIdentifier:n.resourceFieldIdentifier,fieldName:a,requiresTargetResourceId:!0,isFrontend:!0}),m=dh.resolveUrlPath(p.url,f);return dh.hasUnresolvedPlaceholders(m)?null:`${u}${br}${m}`}catch{return null}}function $V(e,t){return t===Bi.ORIGINAL?e:`${e}${e.includes(`?`)?`&`:`?`}variant=${encodeURIComponent(t)}`}function eH(e){return $V(e,Bi.THUMBNAIL)}function tH(e,t){let n=e.VITE_API_BASE_URL;return n?{...e,VITE_API_BASE_URL:lre(n,t)}:e}function nH(e){return Q.createElement(Ah,{flushSync:wN.flushSync,...e})}gg();var rH=`wildo:reauthentication`,iH=`wildo:reauthentication-callback`,aH;(function(e){e.POPUP_BLOCKED=`popup_blocked`,e.CANCELLED=`cancelled`,e.TIMED_OUT=`timed_out`,e.FAILED=`failed`})(aH||={});var oH=class extends Error{reason;constructor(e){super(`Federated re-authentication did not complete: ${e}`),this.reason=e,this.name=`FederatedReAuthenticationFailure`}},sH=6e5,cH=`wildo-reauthentication`,lH=`popup=yes,width=520,height=680`;function uH(){return window.open(`about:blank`,cH,lH)}function dH(e){let t=new BroadcastChannel(rH);t.postMessage({type:iH,...e}),t.close()}function fH(e,t=sH){return new Promise((n,r)=>{let i=new BroadcastChannel(rH),a=!1,o=t=>{a||(a=!0,i.close(),clearTimeout(l),e?.removeEventListener(`abort`,c),t())},s=()=>o(()=>r(new oH(aH.CANCELLED))),c=()=>s();i.onmessage=e=>{let t=e.data;t&&t.type===`wildo:reauthentication-callback`&&o(()=>typeof t.code==`string`&&t.code?n(t.code):r(new oH(aH.FAILED)))};let l=setTimeout(()=>o(()=>r(new oH(aH.TIMED_OUT))),t);e?.aborted?s():e?.addEventListener(`abort`,c)})}async function pH(e,t,n,r){if(!n)throw new oH(aH.POPUP_BLOCKED);let i=bc();try{let{authorizationUrl:a}=await i.startFederatedReAuthentication(e,t);n.location.href=a;let o=await fH(r);return await i.exchangeFederatedReAuthentication(o)}catch(e){try{n.close()}catch{}throw e instanceof oH?e:new oH(aH.FAILED)}}var mH=[_s.PASSKEY,_s.TOTP,_s.PASSWORD],hH={[aH.POPUP_BLOCKED]:pu.REAUTH_PROVIDER_POPUP_BLOCKED,[aH.CANCELLED]:pu.REAUTH_PROVIDER_FAILED,[aH.TIMED_OUT]:pu.REAUTH_PROVIDER_TIMED_OUT,[aH.FAILED]:pu.REAUTH_PROVIDER_FAILED},gH={[_s.PASSKEY]:pu.REAUTH_WITH_PASSKEY,[_s.TOTP]:pu.REAUTH_WITH_TOTP,[_s.PASSWORD]:pu.REAUTH_WITH_PASSWORD};async function _H(e){try{let{methods:t,identityLinks:n}=await bc().getReAuthenticationMethods(e),r=new Set(t);return{methods:mH.filter(e=>r.has(e)),identityLinks:n??[]}}catch{return{methods:[...mH],identityLinks:[]}}}function vH(e,t){switch(e){case _s.PASSWORD:return t.password.trim()?{method:e,password:t.password}:null;case _s.TOTP:return/^\d{6,8}$/.test(t.code.trim())?{method:e,code:t.code.trim()}:null;case _s.PASSKEY:return{method:e};default:return null}}function yH(e,t){let n=t.origin===Ki.GRANTING_ORGANIZATION,r=t.decisionRequirement?.minimumAssurance;return{methods:e.methods.filter(e=>!n||e!==_s.PASSWORD).filter(e=>{if(r===void 0)return!0;let t=Zte(e);return t!==void 0&&Oa(t,r)}),identityLinks:n||t.decisionRequirement?[]:[...e.identityLinks]}}var bH=({open:e,purpose:t,origin:n=Ki.ACCOUNT_OR_OPERATION,decisionRequirement:r,onConfirm:i,onCancel:a,failure:o,isLoading:s})=>{let c=cp(),{tComponent:l,isReady:u}=K({component:B.APP_LAYOUTS_SECURITY_SETTINGS}),d=(0,Q.useCallback)(e=>l(B.APP_LAYOUTS_SECURITY_SETTINGS,e),[l]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(!1),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(!e)return;S(``),w(``),T.current=!1,b.current=!1,p(null),h([]),_(null),y(null);let i=!1;return _H(t).then(e=>{if(i)return;let{methods:t,identityLinks:a}=yH(e,{origin:n,...r?{decisionRequirement:r}:{}});p(t),h(a),_(t[0]??null),y(t.length===0?a[0]??null:null)}),()=>{i=!0}},[e,t,n,r]),(0,Q.useEffect)(()=>{s||(T.current=!1,b.current=!1)},[s]);let E=(0,Q.useCallback)(()=>vH(g,{password:x,code:C}),[g,x,C]),D=f?.length===0&&m.length===0,O=(0,Q.useCallback)(()=>{if(D){a();return}if(v){if(T.current)return;T.current=!0,b.current=!0,i({method:v.method,identityLinkId:v.identityLinkId,popup:uH()});return}let e=E();e&&!T.current&&(T.current=!0,i(e))},[D,v,E,a,i]),k=(0,Q.useCallback)(()=>{(!T.current||b.current)&&(S(``),w(``),a())},[a]),A=(0,Q.useCallback)(e=>{!e&&!T.current&&k()},[k]),j=e=>{e.key===`Enter`&&O()};return u?(0,$.jsx)(Iw,{open:e,onOpenChange:A,cancelCallback:k,validationCallback:O,label:d(pu.REAUTH_TITLE),children:(0,$.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:d(n===Ki.GRANTING_ORGANIZATION?pu.REAUTH_GRANTING_ORGANIZATION_DESCRIPTION:pu.REAUTH_DESCRIPTION)}),o!==null&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o instanceof oH?d(hH[o.reason]):c(o,d(pu.ERROR))})}),D&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:d(pu.REAUTH_NO_ACCEPTED_METHOD)})}),f&&f.length+m.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":d(pu.REAUTH_TITLE),children:[f.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e===g?J.DEFAULT:J.OUTLINE,"aria-pressed":e===g,disabled:s,onClick:()=>{_(e),y(null)},children:d(gH[e])},e)),m.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.identityLinkId===v?.identityLinkId?J.DEFAULT:J.OUTLINE,"aria-pressed":e.identityLinkId===v?.identityLinkId,disabled:s,onClick:()=>{y(e),_(null)},children:l(B.APP_LAYOUTS_SECURITY_SETTINGS,pu.REAUTH_WITH_PROVIDER,{provider:e.displayName})},e.identityLinkId))]}),v&&(0,$.jsx)(Z,{className:`text-sm`,children:l(B.APP_LAYOUTS_SECURITY_SETTINGS,pu.REAUTH_PROVIDER_PROMPT,{provider:v.displayName})}),g===_s.PASSWORD&&(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:d(pu.REAUTH_PASSWORD)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value),placeholder:d(pu.REAUTH_PASSWORD_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===_s.TOTP&&(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:d(pu.REAUTH_TOTP_CODE)}),(0,$.jsx)(QM,{inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:8,value:C,onChange:e=>w(e.target.value.replace(/\D/g,``)),placeholder:d(pu.REAUTH_TOTP_CODE_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===_s.PASSKEY&&(0,$.jsx)(Z,{className:`text-sm`,children:d(pu.REAUTH_PASSKEY_PROMPT)})]})}):null},xH=(0,Q.createContext)(void 0),SH=({children:e})=>{let{setStepUpAuthHandler:t}=fm(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(Po.STEP_UP),[u,d]=(0,Q.useState)(Ki.ACCOUNT_OR_OPERATION),[f,p]=(0,Q.useState)(void 0),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async(e,t=Ki.ACCOUNT_OR_OPERATION,n)=>n?(g.current&&await g.current.catch(()=>void 0),l(Po.STEP_UP),d(t),p(n),y()):g.current?(e===Po.STEP_UP&&l(Po.STEP_UP),t===Ki.GRANTING_ORGANIZATION&&d(Ki.GRANTING_ORGANIZATION),g.current):(l(e),d(t),p(void 0),y()),[]);function y(){let e=new Promise((e,t)=>{m.current=e,h.current=t,a(null),s(!1),r(!0)});return g.current=e,e.finally(()=>{g.current=null}).catch(()=>void 0),e}let b=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{b.current=t},[t]),(0,Q.useEffect)(()=>(bc().setStepUpAuthHandler(v),b.current(v),()=>{bc().setStepUpAuthHandler(null),b.current(null),h.current?.(Error(`StepUpAuthProvider unmounted`)),m.current=null,h.current=null}),[v]);let x=(0,Q.useCallback)(async e=>{s(!0),a(null);let t=new AbortController;_.current=t;try{let{reAuthToken:n}=await CH(e,c,t.signal,f?.binding);r(!1),m.current?.(n),m.current=null,h.current=null}catch(e){t.signal.aborted||a(e)}finally{_.current===t&&(_.current=null),s(!1)}},[c,f]),S=(0,Q.useCallback)(()=>{_.current?.abort(),r(!1),h.current?.(Error(`Step-up authentication cancelled`)),m.current=null,h.current=null},[]),C=(0,Q.useMemo)(()=>({isStepUpPending:n}),[n]);return(0,$.jsxs)(xH.Provider,{value:C,children:[e,(0,$.jsx)(bH,{open:n,purpose:c,origin:u,...f?{decisionRequirement:f.requirement}:{},onConfirm:x,onCancel:S,failure:i,isLoading:o})]})};async function CH(e,t=Po.STEP_UP,n,r){let i=bc(),a=r?{decisionBinding:r}:{};switch(e.method){case _s.PASSWORD:return i.reAuthenticate(_s.PASSWORD,{password:e.password,...a},t);case _s.TOTP:return i.reAuthenticate(_s.TOTP,{code:e.code,...a},t);case _s.PASSKEY:{let e=await i.reAuthPasskeyOptions(void 0,r),n=await loe({optionsJSON:e});return i.reAuthenticate(_s.PASSKEY,{passkeyResponse:n,...a},t)}case _s.EXTERNAL_OAUTH2:case _s.ORG_OPENID_CONNECT:case _s.ORG_SAML:return pH(e.identityLinkId,t,e.popup,n)}}var wH=as.getLogger();function TH(){let e=Rm(),{registry:t}=fm(),n=t.resourceConfigurations[ul.ORGANIZATIONS]?.resourceFieldIdentifier;return n?e[n]:void 0}function EH(){let e=TH(),{registry:t,doOperation:n}=fm(),{auth:r,user:i}=pg(),a=Zp(),o=(0,Q.useRef)(n);o.current=n;let s=t.resourceConfigurations[ul.ORGANIZATIONS],c=s?.resourceFieldIdentifier,l=a?.currentUserId??null,u=!!i&&(!l||i._id===l),d=!!r.accessToken&&r.sessionType!==Rc.ONE_OFF&&!r.isRestoringSession&&r.sessionRestored&&u,f=!!r.accessToken&&r.sessionType!==Rc.ONE_OFF&&u,p=!!e&&f&&Rh(i?.organizationMembers,e),m=e&&d&&!p?`${i?._id}:${e}`:null,[h,g]=(0,Q.useState)({}),_=m?h[m]:void 0;return(0,Q.useEffect)(()=>{if(!m||_||!e||!c)return;let t=e=>{g(t=>({...t,[m]:e}))},n=Zm(s);if(!n){t(dg.INCONCLUSIVE);return}let r=!1;return o.current(Ta.buildOperationPathKeyFromOperation(n),{contextualParameters:{[c]:e}},{silent:!0}).then(()=>{r||t(dg.ADMITTED)}).catch(n=>{if(r)return;let i=lt.isAuthorizationError(n)||lt.isNotFoundError(n);i||wH.warn(`Could not verify access to the organization addressed by the route`,{organizationId:e,error:n}),t(i?dg.REFUSED:dg.INCONCLUSIVE)}),()=>{r=!0}},[m,_,e,c,s]),e?p?dg.ACTIVE_MEMBERSHIP:d?_??dg.VERIFYING:dg.UNDECIDABLE:dg.NOT_ADDRESSED}var DH=(0,Q.createContext)(null);function OH(e){let t=TH(),n=Zp(),{user:r,organizations:i,permissions:a,followRouteOrganization:o}=pg(),{emit:s}=Mo(),c=n?.currentOrganizationId,l=t&&r?._id?`${r._id}:${t}`:null,[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(null),m=l!==null&&f===l;u!==l&&(d(l),p(null),m=!1),l&&!m&&c===t&&(p(l),m=!0);let h=cse({routeOrganizationId:t,access:e,routeOrganizationLoaded:!!t&&i.some(e=>e._id===t),routeOrganizationConferred:ose(a?.accessProfile,t),currentOrganizationId:c,arrivalSettled:m});return(0,Q.useEffect)(()=>{h===sh.FOLLOWING&&t&&l&&(p(l),o(t)&&s(Ec.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:t}))},[h,t,l,o,s]),h}function kH(){let e=(0,Q.useContext)(s_),t=e&&!e.shellIdentity?e.organizationProductName:void 0;(0,Q.useEffect)(()=>{if(!t)return;let e=document.title;return document.title=t,()=>{document.title=e}},[t])}function AH({preset:e=q.DEFAULT,...t}){kH();let n=G(B.APP_LAYOUTS_MAIN_CONTAINER,`AppLayout_MainContainer`)(e);return(0,$.jsx)(n,{...t})}var jH=as.getLogger();function MH(){let{appConfig:e}=Ou(),{privacy:t,recordConsentDecision:n,logout:r}=pg(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)([]),u=(0,Q.useMemo)(()=>$b({serviceConsentRequirement:e.compliance?.serviceConsentRequirement,analyticsEnabled:e.analytics?.enabled===!0,analyticsRequiresConsent:e.analytics?.requiresConsent!==!1,capabilityDeclaredConsentPurposes:e.compliance?.capabilityDeclaredConsentPurposes,privacy:t}),[e.analytics?.enabled,e.analytics?.requiresConsent,e.compliance?.serviceConsentRequirement,e.compliance?.capabilityDeclaredConsentPurposes,t]),d=(0,Q.useCallback)(async(e,t,r=!1)=>{s(!1);let i=tx(u,e,t);if(i.length>0&&!r)l(i);else{l([]),a(!0);try{await n(ex(u.grantedPurposes,e,t))}catch(e){jH.error(`Consent decision could not be recorded`,{error:e}),s(!0)}finally{a(!1)}}},[n,u]);return{...u,isSaving:i,saveFailed:o,pendingWithdrawalCost:c,decide:d,signOut:r}}function NH({preset:e=q.DEFAULT,children:t}){let n=MH();if(n.status===Qb.NOT_APPLICABLE||n.status===Qb.SATISFIED)return(0,$.jsx)($.Fragment,{children:t});let r=G(B.APP_LAYOUTS_CONSENT_GATE,`AppLayout_ConsentGate`)(e);return n.status===Qb.REQUIRED?(0,$.jsx)(r,{gate:n}):(0,$.jsxs)($.Fragment,{children:[t,(0,$.jsx)(r,{gate:n})]})}var PH;(function(e){e.NOT_APPLICABLE=`NOT_APPLICABLE`,e.CHECKING=`CHECKING`,e.SATISFIED=`SATISFIED`,e.REQUIRED=`REQUIRED`,e.UNAVAILABLE=`UNAVAILABLE`})(PH||={});function FH(){let{appConfig:e}=Ou(),{logout:t}=pg(),{resolvedUserType:n}=$x(),r=e.compliance?.governedDocumentAcceptanceMode??fo.EXPLICIT_CHECKBOX,i=ts(e.compliance),a=n!==null&&(e.compliance?.governedDocumentReleases??[]).some(e=>e.allowedInteractionKinds.includes(Cs.CONTRACT_ACCEPTED)&&(!i||e.approvalState===be.APPROVED)),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!a)return;let e=!1;return bc().getOwedGovernedDocumentAcceptances().then(t=>{e||s(t.owed)}).catch(()=>{e||l(!0)}),()=>{e=!0}},[a]);let b=(0,Q.useMemo)(()=>(o??[]).flatMap(e=>e.releases),[o]),x=(0,Q.useMemo)(()=>b.map(t=>({release:t,document:cu(e.compliance?.publicDocuments??[],t,{requireApproved:i})})),[b,e.compliance?.publicDocuments,i]),S=(0,Q.useMemo)(()=>e.compliance?.publicDocuments??[],[e.compliance?.publicDocuments]),C=(0,Q.useCallback)(e=>{p(t=>t.includes(e)?t:[...t,e])},[]),w=a?c?PH.UNAVAILABLE:o===void 0?PH.CHECKING:o.length===0?PH.SATISFIED:PH.REQUIRED:PH.NOT_APPLICABLE,T=r===fo.IMPLIED_BY_REGISTERING||u,E=(0,Q.useCallback)(async()=>{if(T&&b.length!==0){h(!0),_(!1),y(!1);try{let e=await bc().acceptGovernedDocuments(b.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})));s(e.owed),d(!1),p([]),e.owed.length>0&&_(!0)}catch(e){if(jr(e)&&e.customMessageReference===Xl.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)try{let e=await bc().getOwedGovernedDocumentAcceptances();s(e.owed),d(!1),p([]),y(!0)}catch{_(!0)}else _(!0)}finally{h(!1)}}},[T,b]),D=(0,Q.useMemo)(()=>({requiredReleases:b,acceptanceMode:r,requiredDocuments:x,servedDocuments:S,accepted:u,setAccepted:d,documentsRead:f,markDocumentRead:C}),[b,r,x,S,u,f,C]);return{status:w,reason:w===PH.REQUIRED?o?.[0]?.reason:void 0,acceptance:D,canAccept:T,isSaving:m,saveFailed:g,releaseSuperseded:v,accept:E,signOut:t}}function IH({preset:e=q.DEFAULT,children:t}){let n=FH();if(n.status!==PH.REQUIRED)return(0,$.jsx)($.Fragment,{children:t});let r=G(B.APP_LAYOUTS_DOCUMENT_ACCEPTANCE_GATE,`AppLayout_DocumentAcceptanceGate`)(e);return(0,$.jsx)(r,{gate:n})}var LH=()=>(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(ib,{})}),RH=()=>{let e=oh(),{notifyWarning:t}=Fm(),{tErrorMessage:n,tErrorGuidance:r}=K(),i=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{i.current||(i.current=!0,t(fp({type:Va.AUTHORIZATION,customMessageReference:Xl.AUTHORIZATION_ORGANIZATION_NOT_ACCESSIBLE},{translators:{tErrorMessage:n,tErrorGuidance:r}})),e(Ln.home,{replace:!0}))},[e,t,n,r]),(0,$.jsx)(LH,{})},zH=({redirectTo:e=Ln.login})=>{let{auth:t}=pg(),n=(0,Q.useContext)(Fi)?.shellCompanions??[],r=Zp(),i=mg(),a=EH(),o=OH(a),s=TH()??null,c=a===dg.VERIFYING||a===dg.REFUSED||o===sh.FOLLOWING,l=(0,Q.useMemo)(()=>({routeOrganizationId:s,routeContentHeld:c}),[s,c]),u=r?.currentOrganizationId,d=!!t.accessToken,f=td(i),p=fi(e,f);if(!d)return(0,$.jsx)(Xh,{to:p,replace:!0});if(t.isRestoringSession||!t.sessionRestored&&!u)return(0,$.jsx)(AH,{children:(0,$.jsx)(LH,{})});let m=(0,$.jsx)(Uh,{});return a===dg.REFUSED?m=(0,$.jsx)(RH,{}):c&&(m=(0,$.jsx)(LH,{})),(0,$.jsx)(DH.Provider,{value:l,children:(0,$.jsx)(IH,{children:(0,$.jsxs)(NH,{children:[n.map((e,t)=>(0,$.jsx)(e,{},t)),(0,$.jsx)(AH,{children:m})]})})})},BH=new Set;function VH(e){let{resourceType:t,guidanceFlows:n,urlPatterns:r}=e;return n.map(e=>{let n=`${t}.${e.ref}`,i=HH(e,t,r),a=e.elements.map((e,t)=>UH(e,t)),o=a.filter(e=>e.type===He.CHECKLIST_ITEM).map(e=>e.ref),s=0;for(let e of a)e.type===He.CHECKLIST&&(s++,e.items=s===1?o:[]);return s>1&&o.length>0&&!BH.has(n)&&(BH.add(n),as.getLogger().warn(`compileResourceGuidance: flow "${n}" declares ${s} checklists and ${o.length} checklist item(s). The resource-level authoring surface cannot express which items belong to which checklist, so the first checklist owns them all and the others render empty. Declare one checklist per flow.`)),{ref:n,scope:e.scope??tu.USER,renderMode:e.renderMode,trigger:i,audience:e.audience,priority:e.priority??100,elements:a}})}function HH(e,t,n){let r=e.trigger;switch(r.type){case`FIRST_VISIT`:{let r=n?.[e.bindToOperation];return{type:lc.ROUTE_MATCH,routePattern:r??`/${t.toLowerCase()}`}}case`MANUAL`:return{type:lc.MANUAL};case`DELAYED`:return{type:lc.DELAYED,delayMs:r.delayMs??1e3};case`EVENT`:{let n=r.eventName??`${t}:${e.bindToOperation}`;return{type:lc.EVENT,eventName:n}}default:return{type:lc.MANUAL}}}function UH(e,t){let n=e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),r={ref:e.ref,type:e.type,order:t,...e.targetField?{targetField:e.targetField}:{}};switch(e.type){case He.TOOLTIP:return{...r,type:He.TOOLTIP,targetSelector:n??``,placement:WH(e.placement)};case He.TOUR:return{...r,type:He.TOUR,steps:(e.steps??[]).map((e,t)=>({ref:e.ref,order:t,placement:WH(e.placement)??ti.BOTTOM,targetSelector:e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),...e.targetField?{targetField:e.targetField}:{}}))};case He.MODAL:return{...r,type:He.MODAL,dismissible:!0,...e.actionRef?{ctaAction:e.actionRef}:{}};case He.BANNER:return{...r,type:He.BANNER,...e.actionRef?{actionRef:e.actionRef}:{}};case He.ANNOUNCEMENT:return{...r,type:He.ANNOUNCEMENT,...e.actionRef?{actionRef:e.actionRef}:{}};case He.BADGE:return{...r,type:He.BADGE,...n?{targetSelector:n}:{}};case He.CARD:return{...r,type:He.CARD,...e.actionRef?{actionRef:e.actionRef}:{}};case He.SURVEY:return{...r,type:He.SURVEY,questions:(e.questions??[]).map(e=>({id:e.id,type:e.type,required:e.required??!1,options:e.options?.map(e=>({ref:e.ref}))}))};case He.CHECKLIST:return{...r,type:He.CHECKLIST,items:[]};case He.CHECKLIST_ITEM:return{...r,type:He.CHECKLIST_ITEM,...e.actionRef?{actionRef:e.actionRef}:{}};default:return{...r,type:e.type}}}function WH(e){if(!e)return;let t=e.toUpperCase();if(t in ti)return ti[t]}var GH={achievedMilestoneRefs:new Set,stagesReached:new Set};function KH(e,t,n){if(!e)return!0;let r=t.scopedState[n]??GH;if(e.roles&&e.roles.length>0&&!e.roles.some(e=>t.userRoles.includes(e)))return!1;if(e.requiredFeatures){let n=e.requiredFeatures,r=Array.isArray(n)?n:n.features??[],i=Array.isArray(n)?`OR`:n.mode??`OR`;if(r.length>0&&!(i===`OR`?r.some(e=>t.userFeatures.includes(e)):r.every(e=>t.userFeatures.includes(e)))||!Array.isArray(n)&&n.limitChecks?.length&&n.limitChecks.some(e=>{let n=t.featureLimits[e.featureId];return n===void 0||n===-1?!1:(t.currentUsage[e.featureId]??0)+(e.increment??1)>n}))return!1}if(e.excludeIfCompleted&&e.excludeIfCompleted.length>0&&e.excludeIfCompleted.some(e=>t.completedFlowRefs.has(e))||e.requireIfCompleted&&e.requireIfCompleted.length>0&&!e.requireIfCompleted.every(e=>t.completedFlowRefs.has(e))||e.requiredMilestones&&e.requiredMilestones.length>0&&!e.requiredMilestones.every(e=>r.achievedMilestoneRefs.has(e)))return!1;if(e.currentLifecycleStages&&e.currentLifecycleStages.length>0){let t=r.currentLifecycleStage;if(t===void 0||!e.currentLifecycleStages.includes(t))return!1}return!(e.lifecycleStagesReached&&e.lifecycleStagesReached.length>0&&!e.lifecycleStagesReached.some(e=>r.stagesReached.has(e))||e.requiredSurveyAnswers&&e.requiredSurveyAnswers.length>0&&!e.requiredSurveyAnswers.every(e=>{let n=t.recordedSurveyAnswer(e.flowRef,e.elementRef,e.questionId);return Array.isArray(n)?n.includes(String(e.equals)):n===e.equals})||e.createdAfter&&t.userCreatedAt&&t.userCreatedAt<e.createdAfter)}var qH=(0,Q.createContext)(null),JH=[],YH={},XH=[],ZH={[jo.USER]:null,[jo.ORGANIZATION]:null},QH={scopedStates:ZH,isMilestoneAchieved:()=>!1,getMilestoneAchievement:()=>void 0,getCategoryProgress:()=>void 0,totalPoints:0,milestoneDefinitions:XH,isLoading:!1},$H={currentStage:null,stageEnteredAt:null,isEnabled:!1,isLoading:!1,hasReachedStage:()=>!1,activationProgress:{criteriaMet:{},criteria:[],totalCriteria:0,metCriteria:0,isFullyActivated:!1}},eU={activeFlows:JH,flowStates:YH,activateFlow:()=>{},recordFlowPresented:()=>{},reportFlowNotPresentable:()=>{},completeElement:async()=>{},completeFlow:()=>{},dismissFlow:()=>{},skipFlow:()=>{},isFlowActive:()=>!1,isFlowCompleted:()=>!1,isFlowPersistable:()=>!1,isLoading:!1,progression:QH,lifecycle:$H};function tU(e,t,n){let r=e.resourceConfigurations[t];return r?r.operations.find(e=>e.operationIdentifier===n&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)??null:null}var nU;(function(e){e.LOADED=`loaded`,e.ABSENT=`absent`,e.UNAVAILABLE=`unavailable`})(nU||={});var rU=new Set;function iU(e,t){let n=`${e}:${t}`;rU.has(n)||(rU.add(n),as.getLogger().warn(`GuidanceContext: no default non-bulk API_CALL ${t} operation is registered for "${e}". Guidance for this scope cannot be persisted and every change will be local to the session. Register the operation, or stop declaring persistable flows for it.`))}function aU(e,t){return t?{...e,flows:{...e.flows,...t.flows}}:e}async function oU(e,t,n){let r=go[e],i=tU(n,r,W.READ);if(!i)return iU(r,W.READ),{outcome:nU.UNAVAILABLE};let a=Ta.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:nU.LOADED,state:e??{flows:{}}}}catch(e){return lt.isNotFoundError(e)?{outcome:nU.ABSENT}:{outcome:nU.UNAVAILABLE}}}async function sU(e,t,n){let r=go[e],i=tU(n,r,W.CREATE);if(!i)return iU(r,W.CREATE),{outcome:nU.UNAVAILABLE};let a=Ta.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{},requestData:{flows:{}}},{silent:!0});return{outcome:nU.LOADED,state:e??{flows:{}}}}catch{return oU(e,t,n)}}async function cU(e,t,n,r){let i=go[e],a=tU(r,i,W.UPDATE);if(!a){iU(i,W.UPDATE);return}let o=Ta.buildOperationPathKeyFromOperation(a);try{await n(o,{contextualParameters:{},requestData:t})}catch{}}var lU;(function(e){e.WRITTEN=`written`,e.NOT_BOUND=`not_bound`,e.NO_OPERATION=`no_operation`,e.REFUSED=`refused`})(lU||={});async function uU(e,t,n,r){if(e.type!==He.SURVEY)return lU.NOT_BOUND;let i=e,a=i.bindTo?.resourceType;if(!a)return lU.NOT_BOUND;let o={};for(let e of i.questions??[]){if(!e.bindToField)continue;let n=t?.[e.id];n!==void 0&&(o[e.bindToField]=n)}if(Object.keys(o).length===0)return lU.NOT_BOUND;let s=tU(r,a,W.UPDATE);if(!s)return as.getLogger().warn(`GuidanceContext: survey "${e.ref}" binds to "${a}", which registers no default non-bulk API_CALL UPDATE operation. Its answers cannot be written, so the survey will not complete. Register the operation, or remove the binding.`,{elementRef:e.ref,resourceType:a}),lU.NO_OPERATION;let c=Ta.buildOperationPathKeyFromOperation(s);try{return await n(c,{contextualParameters:{},requestData:o}),lU.WRITTEN}catch(t){return as.getLogger().warn(`GuidanceContext: writing survey "${e.ref}" answers to "${a}" was refused. The survey has not been completed, so the person can retry.`,{elementRef:e.ref,resourceType:a,fields:Object.keys(o),error:String(t)}),lU.REFUSED}}async function dU(e,t,n){let r=tae[e],i=tU(n,r,W.READ);if(!i)return{outcome:nU.UNAVAILABLE};let a=Ta.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:nU.LOADED,state:e??{milestonesAchieved:{},operationCounts:{},totalPoints:0,valueMomentsAchieved:{},categoriesProgress:{}}}}catch(e){return lt.isNotFoundError(e)?{outcome:nU.ABSENT}:{outcome:nU.UNAVAILABLE}}}async function fU(e){if(!e)return[];try{return(await bc().getMilestoneDefinitions({silent:!0}))?.definitions??[]}catch{return[]}}var pU={[Ee.USER]:null,[Ee.ORGANIZATION]:null};async function mU(e,t,n){let r=ki[e],i=tU(n,r,W.READ);if(!i)return{outcome:nU.UNAVAILABLE};let a=Ta.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return e?{outcome:nU.LOADED,state:e}:{outcome:nU.ABSENT}}catch(e){return lt.isNotFoundError(e)?{outcome:nU.ABSENT}:{outcome:nU.UNAVAILABLE}}}function hU(e,t=new Set){let n=[...e].sort((e,n)=>{let r=+!!t.has(e.ref),i=+!!t.has(n.ref);return r===i?(e.priority??100)-(n.priority??100):r-i}),r=[],i=!1,a=!1;for(let e of n)switch(e.renderMode){case zo.OVERLAY:i||=(r.push(e),!0);break;case zo.CHECKLIST:a||=(r.push(e),!0);break;case zo.INLINE:r.push(e)}return r}var gU=({children:e})=>{let t=(0,Q.useContext)(Fi),{on:n,emit:r}=Mo(),i=pg(),a=Zp(),o=fm(),s=(0,Q.useContext)(gh),c=(0,Q.useRef)(o);c.current=o;let l=(0,Q.useMemo)(()=>as.getLogger(),[]),u=(0,Q.useMemo)(()=>{let e=l.debugByType(`GuidanceContext`);return l.setDebugTypeLogging(`GuidanceContext`,!1),e},[l]),d=(0,Q.useMemo)(()=>{let e=[],n=t?.frontendConfiguration;n?.guidanceFlows&&e.push(...n.guidanceFlows);let r=[];if(o?.registry)for(let e of o.getAvailableResourceTypes()){let t=o.getResourceConfiguration(e)?.frontendConfiguration?.guidance;if(t&&Array.isArray(t)&&t.length>0){let n=VH({resourceType:e,guidanceFlows:t});r.push(...n)}}return[...e,...r]},[t?.frontendConfiguration,o]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,t);return e},[d]),m=(0,Q.useMemo)(()=>t?.frontendConfiguration?.onboardingViews??[],[t?.frontendConfiguration]),h=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,{ref:t.ref,scope:t.scope??tu.USER,elements:t.elements,renderMode:t.renderMode});for(let t of m)e.has(t.ref)||e.set(t.ref,{ref:t.ref,scope:tu.USER,elements:t.elements,renderMode:void 0});return e},[d,m]),g=h.size>0,_=(0,Q.useMemo)(()=>{let e={};for(let t of h.values())e[t.ref]=t.scope;return e},[h]),[v,y]=(0,Q.useState)({}),b=(0,Q.useRef)({}),x=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(x.current=!0,()=>{x.current=!1}),[]);let S=(0,Q.useRef)(new Set),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T=(0,Q.useRef)(0),[E,D]=(0,Q.useState)(new Set),[O,k]=(0,Q.useState)(!0),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(new Map),M=(0,Q.useRef)(new Set),N=(0,Q.useCallback)(e=>(b.current=e,y(e),e),[]),P=(0,Q.useCallback)(e=>{let t=e(b.current);return N(t)},[N]),[F,I]=(0,Q.useState)({...ZH}),[ee,L]=(0,Q.useState)(!0),R=(0,Q.useRef)(!1),[z,te]=(0,Q.useState)(XH),ne=t?.appConfig?.lifecycle,re=!!ne?.enabled,[ie,ae]=(0,Q.useState)({...pU}),[oe,se]=(0,Q.useState)(re),ce=(0,Q.useRef)(!1),le=(0,Q.useMemo)(()=>ne?.activationCriteria,[ne?.activationCriteria]),ue=i.user?._id??null,de=!!i.auth.accessToken,fe=!!t?.appConfig?.analytics?.enabled,pe=s?.isLoading??!1,me=de&&g&&!A.current,he=de&&g?O||me:!1;Ym({identifier:ns.PROGRESSION,isLoading:ee}),Ym({identifier:ns.LIFECYCLE,isLoading:oe});let ge=(0,Q.useMemo)(()=>{let e=[tu.USER];return a?.currentOrganizationId&&e.push(tu.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{b.current=v},[v]);let _e=(0,Q.useRef)(ge);(0,Q.useEffect)(()=>{_e.current!==ge&&(A.current=!1,R.current=!1,ce.current=!1,M.current.clear(),S.current.clear(),C.current=!1,we.current.clear(),Te.current.clear(),T.current+=1,_e.current=ge,de&&g&&k(!0),de&&L(!0),de&&re&&se(!0),P(e=>{if(!(tu.ORGANIZATION in e))return e;let t={...e};return delete t[tu.ORGANIZATION],t}),I(e=>({...e,[jo.ORGANIZATION]:null})),ae(e=>({...e,[Ee.ORGANIZATION]:null})),D(e=>{let t=new Set(e);for(let e of d)(e.scope??tu.USER)===tu.ORGANIZATION&&t.delete(e.ref);return t}))},[ge,d,g,de,re,P]);let ve=(0,Q.useRef)({isAuthenticated:de,userId:ue});(0,Q.useEffect)(()=>{let e=ve.current,t=e.isAuthenticated&&!de,n=e.userId!==null&&ue!==null&&e.userId!==ue;if(ve.current={isAuthenticated:de,userId:ue},t||n){for(let e of j.current.values())clearTimeout(e);j.current.clear(),A.current=!1,R.current=!1,ce.current=!1,M.current.clear(),S.current.clear(),C.current=!1,we.current.clear(),Te.current.clear(),T.current+=1,N({}),D(new Set),I({...ZH}),te(XH),ae({...pU}),k(de&&g),L(de),se(de&&re)}},[N,ue,g,de,re]);let ye=(0,Q.useMemo)(()=>{let e={};for(let t of ge){let n=v[t];n?.flows&&Object.assign(e,n.flows)}return e},[v,ge]),be=(0,Q.useMemo)(()=>{let e=new Set;for(let[t,n]of Object.entries(ye))n.status===Hr.COMPLETED&&e.add(t);let t=Bh(i.permissions,a?.currentOrganizationId).filter(Boolean),n=s?.resolvedFeatures?.features??[],r=s?.resolvedFeatures?.limits??{},o=s?.resolvedFeatures?.currentUsage??{},c={};for(let e of[tu.USER,tu.ORGANIZATION]){let t=F[Yne[e]],n=ie[cie[e]];(t||n)&&(c[e]={achievedMilestoneRefs:new Set(Object.keys(t?.milestonesAchieved??{})),currentLifecycleStage:n?.currentStage,stagesReached:new Set(n?.stagesVisited??[])})}return{userRoles:t,userFeatures:n,featureLimits:r,currentUsage:o,completedFlowRefs:e,userCreatedAt:i.user?.createdAt?new Date(i.user.createdAt):void 0,scopedState:c,recordedSurveyAnswer:(e,t,n)=>ye[e]?.elements?.[t]?.surveyAnswers?.[n]}},[ye,F,ie,i.permissions,a?.currentOrganizationId,i.user?.createdAt,s?.resolvedFeatures?.features,s?.resolvedFeatures?.limits,s?.resolvedFeatures?.currentUsage]);(0,Q.useEffect)(()=>{if(A.current||!g||!de)return;A.current=!0;let e=Symbol(`guidance-init`);w.current=e,C.current=!0;let t=!1,n=!1;return(async()=>{let e=c.current;u(`Initializing guidance state`,{scopes:ge,flowCount:h.size});let r=await Promise.allSettled(ge.map(async t=>{let n=await oU(t,e.doOperation,e.registry);return n.outcome===nU.ABSENT&&(u(`Auto-creating guidance state for scope ${t}`),n=await sU(t,e.doOperation,e.registry)),{scope:t,read:n}}));if(t)return;let i={};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===nU.LOADED?(S.current.add(t),i[t]=n.state):u(`Guidance state unavailable for scope ${t} — writes suppressed for this scope`)}P(e=>{let t={...e};for(let[n,r]of Object.entries(i))t[n]=aU(r,e[n]);return t}),n=!0,k(!1),u(`Guidance state loaded`,{scopeCount:Object.keys(i).length})})().catch(e=>{as.getLogger().warn(`GuidanceContext: guidance initialization failed`,{error:e}),A.current=!1,k(!1)}).finally(()=>{w.current===e&&(C.current=!1)}),()=>{t=!0,n||(A.current=!1),w.current===e&&(C.current=!1)}},[g,ge,de,u,P]);let xe=(0,Q.useMemo)(()=>{let e=[jo.USER];return a?.currentOrganizationId&&e.push(jo.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(R.current||!de)return;R.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;u(`Initializing progression state`,{scopes:xe});let[r,i]=await Promise.all([Promise.allSettled(xe.map(async e=>({scope:e,read:await dU(e,n.doOperation,n.registry)}))),fU(fe&&n.hasResource(ul.USER_PROGRESSION_STATE))]);if(e)return;let a={...ZH};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===nU.LOADED?a[t]=n.state:u(`Progression state unavailable for scope ${t} — showing nothing rather than zeroes`)}I(e=>({...e,...a})),i.length>0&&te(i),t=!0,L(!1),u(`Progression state loaded`,{scopeCount:Object.values(a).filter(Boolean).length,milestoneDefinitionCount:i.length})})().catch(e=>{as.getLogger().warn(`GuidanceContext: progression initialization failed`,{error:e}),R.current=!1,L(!1)}),()=>{e=!0,t||(R.current=!1)}},[fe,xe,de,u]);let Se=(0,Q.useMemo)(()=>{if(!re)return[];let e=[Ee.USER];return a?.currentOrganizationId&&e.push(Ee.ORGANIZATION),e},[re,a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(ce.current||!de||!re)return;ce.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;se(!0),u(`Initializing lifecycle state`,{scopes:Se});let r=await Promise.allSettled(Se.map(async e=>({scope:e,read:await mU(e,n.doOperation,n.registry)})));if(e)return;let i={...pU};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===nU.LOADED?i[t]=n.state:n.outcome===nU.ABSENT&&(i[t]=p.createInitialLifecycleState())}ae(e=>({...e,...i})),t=!0,se(!1),u(`Lifecycle state loaded`,{scopeCount:Object.values(i).filter(Boolean).length})})().catch(e=>{as.getLogger().warn(`GuidanceContext: lifecycle initialization failed`,{error:e}),ce.current=!1,se(!1)}),()=>{e=!0,t||(ce.current=!1)}},[Se,de,re,u]);let Ce=(0,Q.useCallback)((e,t=b.current)=>{let n=[tu.USER,tu.ORGANIZATION].filter(n=>t[n]?.flows?.[e]!==void 0);return n.find(n=>t[n]?.flows?.[e]?.status===Hr.IN_PROGRESS)??n[0]??_[e]??tu.USER},[_]),we=(0,Q.useRef)(new Set),Te=(0,Q.useRef)(new Set),De=(0,Q.useRef)(new Set),Oe=(0,Q.useCallback)(async e=>{if(De.current.has(e))return;De.current.add(e);let t=T.current;try{let n=c.current,r=await dU(e,n.doOperation,n.registry);if(r.outcome!==nU.LOADED||!x.current||T.current!==t)return;I(t=>({...t,[e]:r.state})),u(`Progression state for scope ${e} recovered after a failed read`)}finally{De.current.delete(e)}},[u]),ke=(0,Q.useCallback)(async e=>{if(S.current.has(e)||C.current||Te.current.has(e))return;Te.current.add(e);let t=T.current;try{let n=c.current,r=await oU(e,n.doOperation,n.registry);if(r.outcome===nU.ABSENT&&(r=await sU(e,n.doOperation,n.registry)),r.outcome!==nU.LOADED||!x.current||T.current!==t)return;S.current.add(e),as.getLogger().info(`GuidanceContext: guidance state for scope "${e}" recovered — persistence resumes for this scope.`),we.current.delete(e),P(t=>({...t,[e]:aU(r.state,t[e])}))}finally{Te.current.delete(e)}},[P]),Ae=(0,Q.useCallback)((e,t,n)=>{let r=b.current,i=n?.scopeOverride??Ce(e,r),a=S.current.has(i),s=r[i]??{flows:{}},c=t(s.flows[e]??{status:Hr.NOT_STARTED,elements:{},triggerCount:0}),l={...s,flows:{...s.flows,[e]:c}};N({...r,[i]:l}),a?cU(i,l,o.doOperation,o.registry):(we.current.has(i)||(we.current.add(i),as.getLogger().warn(`GuidanceContext: guidance persistence is SUPPRESSED for scope "${i}" — its stored document was never read this session, so writing would replace the server's history with this session's single entry. Changes apply locally and are retried on the next interaction.`)),ke(i))},[N,Ce,o,ke]),je=(0,Q.useCallback)(e=>{let t=f.get(e);if(!t)return;let n=_[e]??tu.USER;if(!ge.includes(n))return;if(pe&&t.audience?.requiredFeatures){M.current.add(e);return}let r=ye[e];Tt(r?.status)||r?.status===Hr.IN_PROGRESS&&E.has(e)||KH(t.audience,be,t.scope??tu.USER)&&(u(`Activating flow: ${e}`),D(t=>{let n=new Set(t);return n.add(e),n}))},[f,ye,E,be,_,ge,u,pe]),Me=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{for(let e of Me.current)E.has(e)||Me.current.delete(e);let e=!1;for(let t of Ne.current)E.has(t)||(Ne.current.delete(t),e=!0);e&&Fe(new Set(Ne.current))},[E]);let Ne=(0,Q.useRef)(new Set),[Pe,Fe]=(0,Q.useState)(new Set),B=(0,Q.useCallback)((e,t)=>{Ne.current.has(e)!==t&&(t?Ne.current.add(e):Ne.current.delete(e),Fe(new Set(Ne.current)))},[]),Ie=(0,Q.useCallback)(e=>{if(!E.has(e)||Me.current.has(e))return;let t=f.get(e);t&&(Me.current.add(e),Ae(e,e=>({...e,status:Hr.IN_PROGRESS,startedAt:e.startedAt??new Date,triggerCount:(e.triggerCount??0)+1})),r(Ec.GUIDANCE_FLOW_ACTIVATED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:_[e]??tu.USER}))},[E,f,_,Ae,r]);(0,Q.useEffect)(()=>{if(!(he||pe||d.length===0))for(let e of d){if(e.trigger.type!==lc.FIRST_VISIT)continue;let t=ye[e.ref];t&&t.triggerCount!==0||je(e.ref)}},[he,pe,ge]),(0,Q.useEffect)(()=>{if(pe||M.current.size===0)return;let e=Array.from(M.current);M.current.clear();for(let t of e)je(t)},[pe,je]);let Le=(0,Q.useMemo)(()=>d.filter(e=>e.trigger.type===lc.ROUTE_MATCH&&e.trigger.routePattern).map(e=>{try{return{...e,_compiledPattern:new RegExp(e.trigger.routePattern)}}catch{return null}}).filter(e=>e!==null),[d]);(0,Q.useEffect)(()=>{if(!(he||Le.length===0))return n(Ec.NAVIGATION_ZONE_CHANGED,e=>{let t=e.currentContent?.urlPath;if(t)for(let e of Le)e._compiledPattern.test(t)&&je(e.ref)})},[he,Le,n,je]);let Re=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===lc.EVENT&&e.trigger.eventName);if(e.length!==0){for(let t of e){let e=t.trigger.eventName;e.includes(`:`)||Re.current.has(t.ref)||(Re.current.add(t.ref),as.getLogger().warn(`GuidanceContext: guidance flow "${t.ref}" declares an EVENT trigger with the unqualified eventName "${e}". Event names are matched as "<resourceType>:<operationIdentifier>", so this flow can never fire. Qualify it with the resource it belongs to.`))}return n(Ec.NOTIFY_RESOURCE_SUCCESS,t=>{let n=`${t.resourceType}:${t.operationIdentifier}`;for(let t of e)t.trigger.eventName===n&&je(t.ref)})}},[he,d,n,je]);let ze=(0,Q.useRef)(je);(0,Q.useEffect)(()=>{ze.current=je},[je]),(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===lc.DELAYED&&e.trigger.delayMs);if(e.length!==0){for(let t of e){if(j.current.has(t.ref))continue;let e=setTimeout(()=>{ze.current(t.ref),j.current.delete(t.ref)},t.trigger.delayMs);j.current.set(t.ref,e)}return()=>{for(let e of j.current.values())clearTimeout(e);j.current.clear()}}},[he,d]);let Be=(0,Q.useMemo)(()=>hU(d.filter(e=>E.has(e.ref)),Pe),[d,E]),Ve=(0,Q.useCallback)(e=>{he||je(e)},[je,he]),He=(0,Q.useCallback)(e=>{D(t=>{let n=new Set(t);return n.delete(e),n});let t=h.get(e),n=Ce(e);t?.renderMode&&r(Ec.GUIDANCE_FLOW_COMPLETED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:n}),u(`Flow completed: ${e}`)},[h,Ce,r,u]),Ue=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];Tt(t?.status)||(Ae(e,e=>({...e,status:Hr.COMPLETED,completedAt:new Date})),He(e))},[Ae,h,ye,He]),We=(0,Q.useCallback)(async(e,t,n)=>{if(!h.has(e))return;let i;if(n?.surveyAnswers){let e={};for(let[t,r]of Object.entries(n.surveyAnswers))(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(e[t]=r);i=e}let a=h.get(e)?.elements.find(e=>e.ref===t);if(a&&!n?.declineResourceBinding){let e=c.current,t=await uU(a,i,e.doOperation,e.registry);if(t===lU.REFUSED||t===lU.NO_OPERATION)throw Error(`guidance_survey_binding_write_failed:${t}`)}let o=h.get(e),s=o!==void 0&&o.elements.every(n=>n.ref===t||ye[e]?.elements?.[n.ref]?.status===Hr.COMPLETED);if(Ae(e,e=>({...e,status:s?Hr.COMPLETED:e.status===Hr.NOT_STARTED?Hr.IN_PROGRESS:e.status,...s?{completedAt:new Date}:{},elements:{...e.elements,[t]:{status:Hr.COMPLETED,completedAt:new Date,surveyAnswers:i,lastStepIndex:n?.lastStepIndex}}})),o?.renderMode){let n=o.elements.find(e=>e.ref===t);n&&r(Ec.GUIDANCE_ELEMENT_COMPLETED,{flowRef:e,elementRef:t,elementType:n.type})}u(`Element completed: ${e}/${t}`),s&&He(e)},[Ae,h,r,u,He,ye]),Ge=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];if(Tt(t?.status))return;Ae(e,e=>({...e,status:Hr.DISMISSED,dismissedAt:new Date})),D(t=>{let n=new Set(t);return n.delete(e),n});let n=h.get(e),i=Ce(e);n?.renderMode&&r(Ec.GUIDANCE_FLOW_DISMISSED,{flowRef:e,renderMode:n.renderMode,triggerSource:`frontend`,scope:i}),u(`Flow dismissed: ${e}`)},[Ae,h,ye,Ce,r,u]),Ke=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];Tt(t?.status)||(Ae(e,e=>({...e,status:Hr.SKIPPED})),D(t=>{let n=new Set(t);return n.delete(e),n}),u(`Flow skipped: ${e}`))},[Ae,h,ye,u]),qe=(0,Q.useCallback)(e=>E.has(e),[E]),Je=(0,Q.useCallback)(e=>ye[e]?.status===Hr.COMPLETED,[ye]),Ye=(0,Q.useCallback)(e=>h.has(e),[h]);(0,Q.useEffect)(()=>{let e=n(Ec.GUIDANCE_FLOW_ACTIVATED,e=>{e.triggerSource===`backend`&&(u(`Backend activated flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.add(e.flowRef),n}))}),t=n(Ec.GUIDANCE_FLOW_COMPLETED,e=>{e.triggerSource===`backend`&&(u(`Backend completed flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Ae(e.flowRef,e=>({...e,status:Hr.COMPLETED,completedAt:new Date}),{scopeOverride:e.scope}))}),r=n(Ec.GUIDANCE_FLOW_DISMISSED,e=>{e.triggerSource===`backend`&&(u(`Backend dismissed flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Ae(e.flowRef,e=>({...e,status:Hr.DISMISSED,dismissedAt:new Date}),{scopeOverride:e.scope}))});return()=>{e(),t(),r()}},[n,u,Ae]),(0,Q.useEffect)(()=>{let e=n(Ec.MILESTONE_ACHIEVED,e=>{u(`Milestone achieved: ${e.milestoneRef} (scope: ${e.scope})`);let t=e.scope;if(I(n=>{let r=n[t];return r?{...n,[t]:{...r,milestonesAchieved:{...r.milestonesAchieved,[e.milestoneRef]:{achievedAt:new Date,count:1}},totalPoints:e.totalPoints,categoriesProgress:{...r.categoriesProgress,[e.category]:{completedCount:(r.categoriesProgress[e.category]?.completedCount??0)+1,totalPoints:(r.categoriesProgress[e.category]?.totalPoints??0)+(e.points??0)}}}}:(u(`Milestone event for unread progression scope ${t} — dropped rather than seeded`),Oe(t),n)}),e.reward?.type===io.FEATURE_UNLOCK&&(s?.refetch(),r(Ec.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.feature_unlock.${e.milestoneRef}`,data:{milestoneRef:e.milestoneRef,featureRef:e.reward.featureRef}})),e.reward?.type===io.CELEBRATION&&e.reward?.celebrationLevel){let t=Wie(e.reward);r(Ec.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.${e.milestoneRef}`,data:{frontendDisplayHints:{celebration:{mode:t}},milestoneRef:e.milestoneRef,category:e.category,points:e.points}})}}),t=n(Ec.PROGRESSION_UPDATED,e=>{let t=e.scope;I(n=>{let r=n[t];return r?{...n,[t]:{...r,operationCounts:e.operationCounts,totalPoints:e.totalPoints}}:(u(`Progression update for unread progression scope ${t} — dropped rather than seeded`),Oe(t),n)})});return()=>{e(),t()}},[n,u,r,s,Oe]),(0,Q.useEffect)(()=>{if(!re)return;let e=n(Ec.LIFECYCLE_STAGE_CHANGED,e=>{u(`Lifecycle stage changed: ${e.previousStage} → ${e.newStage} (scope: ${e.scope})`);let t=e.scope;ae(n=>{let r=n[t]??p.createInitialLifecycleState(new Date(e.changedAt)),i=new Date(e.changedAt),a=[...r.stageHistory];return a.length>0&&!a[0].exitedAt&&(a[0]={...a[0],exitedAt:i}),a.unshift({stage:e.newStage,enteredAt:i,trigger:e.trigger}),{...n,[t]:{...r,currentStage:e.newStage,stageEnteredAt:i,stageHistory:a,...e.activationCriteriaMet?{activationCriteriaMet:e.activationCriteriaMet}:{}}}})});return()=>{e()}},[n,u,re]);let Xe=(0,Q.useMemo)(()=>{let e=e=>{for(let t of Object.values(jo))if(F[t]?.milestonesAchieved[e])return!0;return!1},t=e=>{for(let t of Object.values(jo)){let n=F[t]?.milestonesAchieved[e];if(n)return n}},n=e=>{let t;for(let n of Object.values(jo)){let r=F[n]?.categoriesProgress[e];r&&(t||={completedCount:0,totalPoints:0},t.completedCount+=r.completedCount,t.totalPoints+=r.totalPoints)}return t},r=0;for(let e of Object.values(jo)){let t=F[e];t&&(r+=t.totalPoints)}return{scopedStates:F,isMilestoneAchieved:e,getMilestoneAchievement:t,getCategoryProgress:n,totalPoints:r,milestoneDefinitions:z,isLoading:ee}},[F,ee,z]),Ze=(0,Q.useMemo)(()=>{if(!re)return $H;let e=ie[Ee.USER],t=e?.currentStage??null,n=e?.stageEnteredAt?new Date(e.stageEnteredAt):null,r=t=>e?ct(e,t):!1,i=e?.activationCriteriaMet??{},a=le?.criteria??[],o=a.length,s=Object.values(i).filter(Boolean).length;return{currentStage:t,stageEnteredAt:n,isEnabled:!0,isLoading:oe,hasReachedStage:r,activationProgress:{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:o>0?s>=o:t!==Bu.SIGNED_UP}}},[re,ie,oe,le]),Qe=(0,Q.useMemo)(()=>({activeFlows:Be,flowStates:ye,activateFlow:Ve,recordFlowPresented:Ie,reportFlowNotPresentable:B,completeElement:We,completeFlow:Ue,dismissFlow:Ge,skipFlow:Ke,isFlowActive:qe,isFlowCompleted:Je,isFlowPersistable:Ye,isLoading:he,progression:Xe,lifecycle:Ze}),[Be,ye,Ve,Ie,We,Ue,Ge,Ke,qe,Je,Ye,he,Xe,Ze]);return(0,$.jsx)(qH.Provider,{value:Qe,children:e})};function _U(){return(0,Q.useContext)(qH)??eU}function vU(){let e=(0,Q.useContext)(qH);return(0,Q.useMemo)(()=>e?.lifecycle??$H,[e?.lifecycle])}function yU(){let e=(0,Q.useContext)(qH);return(0,Q.useMemo)(()=>e?.progression??QH,[e?.progression])}var bU=new Set,xU;(function(e){e.ACHIEVED=`achieved`,e.IN_PROGRESS=`in-progress`,e.LOCKED=`locked`})(xU||={});function SU(e,t){return e.scopedStates[t]!=null}function CU(e,t){return e.filter(e=>SU(t,e.scope??jo.USER)).map(e=>{let n=t.getMilestoneAchievement(e.identifier);if(n)return{definition:e,status:xU.ACHIEVED,achievement:n};if(e.dependencies?.length&&!e.dependencies.every(e=>t.isMilestoneAchieved(e)))return{definition:e,status:xU.LOCKED};let r=`${e.trigger.resourceType}:${e.trigger.operation}`,i=e.scope??jo.USER,a=t.scopedStates[i]?.operationCounts?.[r]??0;return{definition:e,status:xU.IN_PROGRESS,currentCount:a}})}function wU(e){let t=new Map;for(let n of e){let e=n.definition.category;t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({category:e,milestones:t,completedCount:t.filter(e=>e.status===xU.ACHIEVED).length,totalCount:t.length,totalPoints:t.reduce((e,t)=>t.status===xU.ACHIEVED?e+(t.definition.points??0):e,0)}))}function TU(e,t){return t(e,`title`)}function EU(e,t){return t(e)}function DU(e,t){return e.filter(e=>e.status===xU.IN_PROGRESS).sort((e,t)=>OU(t)-OU(e)).slice(0,t)}function OU(e){let t=e.definition.threshold;return!t||e.definition.type!==wu.COUNT_THRESHOLD?0:Math.min(1,(e.currentCount??0)/t)}function kU(e){return e.status===xU.IN_PROGRESS&&e.definition.type===wu.COUNT_THRESHOLD&&e.definition.threshold!=null&&e.definition.threshold>0}function AU({item:e,name:t,tTracker:n,showPoints:r,showStatusIcon:i}){let{renderIcon:a}=Mf(),o=e.status===xU.ACHIEVED?a(H.CHECK,{size:ca.SM,className:`text-success`}):e.status===xU.LOCKED?a(H.LOCK,{size:ca.SM,className:`text-muted-foreground`}):a(H.CLOCK,{size:ca.SM,className:`text-primary`}),s=n(e.status===xU.ACHIEVED?`achieved`:e.status===xU.LOCKED?`locked`:`inProgress`),c=kU(e),l=c&&e.definition.threshold?Math.min(100,Math.round((e.currentCount??0)/e.definition.threshold*100)):0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-2.5`,role:`listitem`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,$.jsx)(`span`,{className:`shrink-0`,role:`img`,"aria-label":s,children:o}),(0,$.jsx)(`span`,{className:`text-sm flex-1 text-foreground`,children:t}),r&&(e.definition.points??0)>0&&(0,$.jsx)(If,{variant:`outline`,className:`text-xs shrink-0`,children:n(`milestonePoints`,{points:e.definition.points??0})})]}),c&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 ps-6`,children:[(0,$.jsx)(E_,{value:l,className:`flex-1 h-1`,"aria-label":t,"aria-valuenow":Math.min(e.currentCount??0,e.definition.threshold),"aria-valuemin":0,"aria-valuemax":e.definition.threshold}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:n(`countProgress`,{current:e.currentCount??0,total:e.definition.threshold??0})})]})]})}function jU({completed:e,total:t,tTracker:n}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(E_,{value:t>0?e/t*100:0,className:`flex-1 h-2`,"aria-label":n(`title`),"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":t}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:n(`progressDisplay`,{completed:e,total:t})})]})}function MU({variant:e=Z_,actionableLimit:t=3,className:n}={}){let r=yU(),{tComponent:i,tMilestone:a,tMilestoneCategory:o,isReady:s}=K({component:B.PROGRESSION_MILESTONE_TRACKER,keys:[ai.MILESTONES]}),c=(0,Q.useMemo)(()=>(e,t)=>i(B.PROGRESSION_MILESTONE_TRACKER,e,t),[i]),l=(0,Q.useMemo)(()=>CU(r.milestoneDefinitions,r),[r]),u=(0,Q.useMemo)(()=>wU(l),[l]);if(!s||r.isLoading||r.milestoneDefinitions.length===0||!Object.values(r.scopedStates).some(e=>e!=null))return null;let d=l.filter(e=>e.status===xU.ACHIEVED).length,f=l.length,p=c(`title`),m=c(`description`),h=e=>TU(e.definition.identifier,a),g=Object.values(X_).includes(e)?e:Z_;g!==e&&!bU.has(e)&&(bU.add(e),as.getLogger().warn(`ProgressionMilestoneTracker: unknown variant "${e}" — falling back to "${Z_}". Valid values: ${Object.values(X_).join(`, `)}.`));let _=(()=>{switch(g){case X_.NEXT_ACTIONS:{let e=DU(l,t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(jU,{completed:d,total:f,tTracker:c}),e.length>0&&(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.map(e=>(0,$.jsx)(AU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1},e.definition.identifier))})]})}case X_.SUMMARY:{let[e]=DU(l,1);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(jU,{completed:d,total:f,tTracker:c}),e&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:c(`nextUp`)}),(0,$.jsx)(`div`,{role:`list`,children:(0,$.jsx)(AU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1})})]})]})}case X_.FLAT:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(jU,{completed:d,total:f,tTracker:c}),u.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:EU(e.category,o)}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(AU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!0},e.definition.identifier))})]},e.category))]});case X_.DETAILED:return(0,$.jsx)(`div`,{className:`flex flex-col gap-5`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:EU(e.category,o)}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`progressDisplay`,{completed:e.completedCount,total:e.totalCount})})]}),(0,$.jsx)(E_,{value:e.totalCount>0?e.completedCount/e.totalCount*100:0,className:`h-2`,"aria-label":EU(e.category,o),"aria-valuenow":e.completedCount,"aria-valuemin":0,"aria-valuemax":e.totalCount}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(AU,{item:e,name:h(e),tTracker:c,showPoints:!0,showStatusIcon:!0},e.definition.identifier))})]},e.category))})}})(),v=g===X_.SUMMARY||g===X_.DETAILED;return(0,$.jsxs)(EF,{role:`region`,"aria-label":p,className:n,"data-progression-variant":g,children:[(0,$.jsxs)(OF,{className:`pb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 text-base font-semibold`,children:p}),v&&(0,$.jsx)(If,{variant:`secondary`,className:`text-sm shrink-0`,children:c(`totalPoints`,{points:r.totalPoints})})]}),m&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:m})]}),(0,$.jsx)(NF,{className:`pt-0`,children:_})]})}var NU=(0,Q.createContext)(null);function PU({hostResourceType:e,contextResourceIdentifiers:t,navigationZone:n,navigationInitiator:r,children:i}){let a=(0,Q.useMemo)(()=>({hostResourceType:e,contextResourceIdentifiers:t,navigationZone:n,navigationInitiator:r}),[e,t,n,r]);return(0,$.jsx)(NU.Provider,{value:a,children:i})}function FU(){let e=(0,Q.useContext)(NU);if(!e)throw Error(`useEmbeddedResourceHostContext must be used inside a host that provides an embedded-resource context — a composite view (CompositeViewProvider) or a resource layout surface (EmbeddedResourceHostProvider).`);return e}function IU(){return(0,Q.useContext)(NU)}var LU=(0,Q.createContext)(null);function RU({viewDefinition:e,breakpoint:t,navigationZone:n,navigationInitiator:r,hostResourceType:i,contextResourceIdentifiers:a,children:o}){let s=(0,Q.useMemo)(()=>({viewDefinition:e,breakpoint:t,navigationZone:n,navigationInitiator:r,hostResourceType:i,contextResourceIdentifiers:a}),[e,t,n,r,i,a]);return(0,$.jsx)(PU,{hostResourceType:i,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r,children:(0,$.jsx)(LU.Provider,{value:s,children:o})})}function zU(){let e=(0,Q.useContext)(LU);if(!e)throw Error(`useCompositeViewContext must be used within a CompositeViewProvider`);return e}function BU(){return(0,Q.useContext)(LU)}var VU=({viewRef:e,document:t,hostResourceType:n,contextResourceIdentifiers:r,navigationZone:i,navigationInitiator:a})=>{let o=BU(),{registry:s}=fm(),c=Zp(),{UIConfig:l,compositeViews:u}=Wg(),d=l?.currentBreakpoint,f=Q.useMemo(()=>jp(e),[e]),p=n??(f?.hostKind===Bp.RESOURCE&&f.viewKind===bp.COMPOSITE_VIEW?f.hostRef:void 0)??o?.hostResourceType,m=r??o?.contextResourceIdentifiers,h=(0,Q.useMemo)(()=>t??_p({viewRef:e,compositeViews:u,registry:s}),[t,e,u,s]);(0,Q.useEffect)(()=>{},[h,m,e]);let g=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:c?.currentUserId,organizationId:c?.currentOrganizationId,applicationId:c?.currentApplicationId,anonymousUserId:c?.currentAnonymousUserId}),t=h?.primaryScope?tm.primaryScopeToContextIdentifiers(e,h.primaryScope):{},n=c?.buildContextResourceIdentifiers()??{},r=tm.filterCustomScopeContextResourceIdentifiers(n);if(!h)return tm.mergeContextResourceIdentifiers(t,r,m);let i=h.scope===em.RESOURCE&&p?[{resourceType:p,requirement:Be.OPTIONAL,isPrimaryScope:!1}]:[],a=[...h.additionalResourceRequirements??[],...i],o=tm.getAllowedViewBindingKeys({primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a});return tm.resolveViewContextResourceIdentifiers({surfaceName:`CompositeView`,surfaceRef:h.ref,primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a,primaryScopeContext:t,customScopeContext:r,explicitContextResourceIdentifiers:tm.scopeContextToBindingContract(m,o)})},[c,c?.currentAnonymousUserId,c?.currentApplicationId,c?.currentOrganizationId,c?.currentUserId,h,p,m]),_=V.buildContextResourceIdentifiersKey(g),v=(0,Q.useMemo)(()=>g,[_]),y=i??o?.navigationZone??rr.PRIMARY,b=a??o?.navigationInitiator;if(!h)return(0,$.jsx)(g_,{viewKind:`composite`,viewRef:e});let x=h.viewComponent;return(0,$.jsx)(RU,{viewDefinition:h,breakpoint:d,navigationZone:y,navigationInitiator:b,hostResourceType:p,contextResourceIdentifiers:v,children:(0,$.jsx)(x,{viewRef:h.ref,viewDefinition:h})})};function HU({activationProgress:e}){let{tLifecycle:t,tActivationCriterion:n,isReady:r}=K({keys:[`lifecycle`]}),{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:c}=e;return(0,$.jsxs)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`},children:[(0,$.jsx)(`h2`,{children:t(`home_activation_progress.title`)}),(0,$.jsx)(`p`,{children:t(`home_activation_progress.description`)}),o>0&&(0,$.jsxs)(`div`,{style:{marginTop:`1rem`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:`0.5rem`},children:[s,` / `,o]}),(0,$.jsx)(`div`,{className:`w-full h-2 bg-muted rounded overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded transition-all duration-[var(--motion-duration-normal)] ease-in-out ${c?`bg-success`:`bg-primary`}`,style:{width:`${o>0?s/o*100:0}%`}})}),(0,$.jsx)(`ul`,{style:{listStyle:`none`,padding:0,marginTop:`1rem`},children:a.map((e,t)=>{let r=e.criterionType===yee.MILESTONE?e.milestoneRef:e.guidanceFlowRef,a=i[r]??!1;return(0,$.jsxs)(`li`,{style:{padding:`0.25rem 0`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,$.jsx)(`span`,{children:a?`✓`:`○`}),(0,$.jsx)(`span`,{style:{opacity:a?.6:1},children:n(e)})]},r??t)})})]})]})}function UU({stage:e}){let{tLifecycle:t,tLifecycleStage:n}=K({keys:[`lifecycle`]});return(0,$.jsxs)(`div`,{className:`px-8 py-4 bg-success/5 rounded-lg mb-4`,children:[(0,$.jsx)(`strong`,{children:t(`home_welcome_back.title`)}),(0,$.jsx)(`p`,{style:{margin:`0.25rem 0 0`},children:t(`home_welcome_back.message`,{stage:n(e)})})]})}function WU(){let{tLifecycle:e,isReady:t}=K({keys:[`lifecycle`]}),{milestoneDefinitions:n,isLoading:r}=yU(),i=!r&&n.length>0;return(0,$.jsxs)(`div`,{style:{padding:`2rem`,maxWidth:800,margin:`0 auto`},children:[(0,$.jsx)(`h2`,{children:e(`home_dashboard.title`)}),(0,$.jsx)(`p`,{children:e(`home_dashboard.description`)}),i&&(0,$.jsx)(`div`,{className:`mt-6`,children:(0,$.jsx)(MU,{})})]})}function GU(){let{tComponent:e}=K({component:B.APP_LAYOUTS_HOME});return(0,$.jsx)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`,textAlign:`center`},children:(0,$.jsx)(`h2`,{children:e(B.APP_LAYOUTS_HOME,`welcomeTitle`)})})}var KU=({})=>{let{currentStage:e,isEnabled:t,isLoading:n,activationProgress:r}=vU(),{homeDefinition:i}=Wg(),{registry:a}=fm(),o=mg(),{navigate:s}=DS(),c=Zp(),{tComponent:l,isReady:u}=K({component:B.APP_LAYOUTS_HOME}),d=i?.compositeViewReference,f=(0,Q.useMemo)(()=>{if(!i||i.compositeViewReference)return null;let e=i.resourceOperationPath;if(!e)return null;let t=a.resourceConfigurations[e.resourceType];if(!t)return null;let n=t.operations.find(t=>String(t.operationIdentifier)===String(e.operationIdentifier)&&!!(t.isOperationDefault??!0)===e.isOperationDefault&&!!(t.isBulkOperation??!1)===e.isBulkOperation&&String(t.variantKey??``)===String(e.variantKey??``));if(!n)return null;let r=dh.resolveResourceUrl(t,n,c?.buildContextResourceIdentifiers?.()??{},a.allResourceFieldIdentifiers,e.parentResourcesRequirements);return r?.resolvedUrl?{content:{contentType:sd.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:n,contextResourceIdentifiers:c?.buildContextResourceIdentifiers?.()??{},parentResourcesRequirements:e.parentResourcesRequirements})},urlPath:r.resolvedUrl}:null},[c,i,a]);if((0,Q.useEffect)(()=>{f&&f.urlPath!==o.pathname&&s({content:f.content,urlPath:f.urlPath,initiator:{sourceZone:Dn},replaceBrowserHistory:!0})},[f,o.pathname,s]),d)return(0,$.jsx)(VU,{viewRef:d,navigationZone:rr.PRIMARY});if(!u)return null;if(n)return(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`},children:l(B.APP_LAYOUTS_HOME,`loading`)});if(!t||!e)return(0,$.jsx)(GU,{});switch(e){case Bu.SIGNED_UP:return(0,$.jsx)(HU,{activationProgress:r});case Bu.REACTIVATED:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(UU,{stage:e}),(0,$.jsx)(WU,{})]});case Bu.DORMANT:case Bu.ACTIVATED:case Bu.ENGAGED:default:return(0,$.jsx)(WU,{})}};function qU({preset:e=q.DEFAULT,...t}){let n=G(B.APP_LAYOUTS_HOME,`AppLayout_Home`)(e);return(0,$.jsx)(n,{...t})}function JU({className:e,children:t,containerConfig:n,sectionMetadata:r,onSectionChange:i}){let a=BU(),o=a?.viewDefinition.translationRef,s=(0,Q.useMemo)(()=>o?[`${ai.COMPOSITE_VIEWS}.${o}`]:[],[o]),{tCompositeViewSection:c}=K({keys:s}),l=(0,Q.useMemo)(()=>{let e=new Set([...Object.keys(r??{}),...a?.viewDefinition.sectionRefs??[]]);if(e.size===0)return;let t=new Set(a?.viewDefinition.sectionRefs??[]);return Object.fromEntries(Array.from(e).map(e=>[e,{title:o&&t.has(e)?c(o,e,`title`):void 0,description:o&&t.has(e)?c(o,e,`description`):void 0,icon:r?.[e]?.icon,count:r?.[e]?.count,countTone:r?.[e]?.countTone}]))},[o,a?.viewDefinition.sectionRefs,r,c]),u=(0,Q.useMemo)(()=>YU(t,n,l,r,i),[t,n,l,r,i]);return(0,$.jsx)(Wk,{value:{sectionEntries:l},children:(0,$.jsx)(`div`,{className:U(`flex flex-col gap-section`,e),"data-composite-layout":!0,children:u})})}function YU(e,t,n,r,i){let a=eA(e);return(0,$.jsx)($.Fragment,{children:a.items.map((e,a)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},a);let{group:o}=e;return $U(o.sections,r).map((e,s)=>{let c=QU(tA({...o,sections:e}),ZU(e,t,r)),l=e.map(e=>XU(e,n));return(0,$.jsx)(WO,{sections:l,config:c,onSectionChange:i},`composite-group-${o.mode}-${a}-${s}`)})})})}function XU(e,t){let n=t?.[e.props.name];return{id:e.props.name,title:n?.title,description:n?.description,icon:n?.icon,count:n?.count,countTone:n?.countTone,disabled:e.props.disabled,content:(0,$.jsx)(Xk,{hostKind:lk.COMPOSITE,sectionProps:e.props,providesHeading:!!n?.title})}}function ZU(e,t,n){let r=e.map(e=>n?.[e.props.name]?.containerConfig).find(e=>e!==void 0);if(t||r)return{...t,...r}}function QU(e,t){return t?{...e,...t}:e}function $U(e,t){let n=[];for(let r of e){let e=JSON.stringify(t?.[r.props.name]?.containerConfig??null),i=n[n.length-1];if(!i){n.push([r]);continue}let a=i[i.length-1];JSON.stringify(t?.[a.props.name]?.containerConfig??null)===e?i.push(r):n.push([r])}return n}function eW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_APPROVAL_REQUEST,`AI_ApprovalRequest`)(e);return(0,$.jsx)(n,{...t})}function tW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_APPROVAL_QUEUE,`AI_ApprovalQueue`)(e);return(0,$.jsx)(n,{...t})}function nW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_DECISION_REQUEST,`AI_DecisionRequest`)(e);return(0,$.jsx)(n,{...t})}function rW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_HUMAN_INPUT_REQUEST,`AI_HumanInputRequest`)(e);return(0,$.jsx)(n,{...t})}var iW=as.getLogger(),aW=new Set(Object.values(Uu));function oW(e,t){let n=e=>e.decisionRef===t.decisionRef&&(t.routeVersion===void 0||e.routeVersion<t.routeVersion);return e.some(n)?e.filter(e=>!n(e)):e}function sW(e){let t=e?.response?.data;return t&&typeof t.kind==`string`&&aW.has(t.kind)?t:void 0}var cW;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(cW||={});function lW(){let{httpClient:e}=Ou(),{on:t}=up(),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(cW.LOADING),c=(0,Q.useRef)(!0),l=(0,Q.useRef)(new Set),u=(0,Q.useRef)(n),d=(0,Q.useRef)(0),f=(0,Q.useRef)(0),p=(0,Q.useCallback)(e=>{u.current=e,r(e)},[]),m=(0,Q.useCallback)(async()=>{if(!e)return;let t=++d.current;f.current+=1,a(!0);try{let n=`${br}${Ia(Ar.FLOWS_ACTORS_DECISIONS)}`,r=await e.get(n,{silent:!0});c.current&&t===d.current&&(p(r?.decisions??[]),s(cW.READY))}catch(e){iW.warn(`Pending decisions could not be read`,{error:e instanceof Error?e.message:`unknown`}),c.current&&t===d.current&&s(cW.FAILED)}finally{--f.current,c.current&&t===d.current&&a(!1)}},[e,p]),h=(0,Q.useCallback)(async(t,n,r)=>{if(!e)return{kind:Uu.NOT_ACTIONABLE};let i=`${br}${Ia(Ar.FLOWS_ACTORS_DECISION_ACT,{decisionRef:t,act:n})}`,a=async t=>{try{return await e.post(i,r,{silent:!0,...t?{headers:{[Ju.REAUTH_TOKEN]:t}}:{}})}catch(e){let t=sW(e);if(!t)throw e;return t}},o=i=>n===Ne.ANSWER&&r.presentationId!==void 0?e.stepUpForDecision({binding:{decisionRef:t,presentationId:r.presentationId},requirement:i}):Promise.resolve(void 0),s={kind:Uu.NOT_ACTIONABLE,reason:Mc.DECISION_STEP_UP_REQUIRED},c;l.current.add(t);try{let e=n===Ne.ANSWER?u.current.find(e=>e.decisionRef===t)?.stepUp:void 0;if(e){let t=await o(e);c=t?await a(t):s}else if(c=await a(),c.kind===Uu.NOT_ACTIONABLE&&c.reason===Mc.DECISION_STEP_UP_REQUIRED){let e=await o({});e&&(c=await a(e))}await m()}finally{l.current.delete(t)}return c},[e,m]),g=(0,Q.useCallback)(async t=>{if(!e)return[];let n=`${br}${Ia(Ar.FLOWS_ACTORS_DECISION_CANDIDATES,{decisionRef:t})}`;try{return(await e.get(n,{silent:!0}))?.candidates??[]}catch(e){if(sW(e))return[];throw e}},[e]);return(0,Q.useEffect)(()=>{c.current=!0,m();let e=t(fa.FLOWS_ACTORS_DECISION_ROUTED,()=>{m()}),n=t(fa.FLOWS_ACTORS_DECISION_WITHDRAWN,e=>{if(!e?.decisionRef||l.current.has(e.decisionRef))return;let t=oW(u.current,e);t===u.current?f.current>0&&m():(p(t),m())});return()=>{c.current=!1,e?.(),n?.()}},[t,m,p]),{decisions:n,isLoading:i,readState:o,refresh:m,act:h,candidates:g}}var uW=as.getLogger(),dW=uW.debugByType(`FlowsActorsContext`);uW.setDebugTypeLogging(`FlowsActorsContext`,!1);var fW=500;function pW(e,...t){let n=[...e,...t];return n.length>fW?n.slice(n.length-fW):n}function mW(e,t,n){if(t.messageId){let r=e.findIndex(e=>e.messageId===t.messageId);if(r>=0){let i=[...e],a=i[r];return i[r]={...a,type:t.type,content:n?t.content:a.content+t.content,data:t.data??a.data,timestamp:t.timestamp},i}}return pW(e,t)}var hW;(function(e){e.IDLE=`idle`,e.STARTING=`starting`,e.RUNNING=`running`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`,e.CANCELLED=`cancelled`,e.ERROR=`error`})(hW||={});var gW={[Yt.COMPLETED]:hW.COMPLETED,[Yt.CANCELLED]:hW.CANCELLED,[Yt.AWAITING_APPROVAL]:hW.AWAITING_APPROVAL,[Yt.PROCESSING]:hW.RUNNING,[Yt.PENDING]:hW.STARTING,[Yt.READY]:hW.STARTING,[Yt.FAILED]:hW.ERROR,[Yt.ABORTED]:hW.ERROR};function _W(e){return gW[e]??hW.ERROR}function vW(e){let{approvalId:t,decisionRef:n,routeKind:r,toolName:i,toolArgs:a,toolInputSchema:o,requestedAt:s,expiresAt:c,reasonCodes:l,riskLevel:u,question:d,presentation:f,presentationId:p}=e;return{approvalId:t,...u?{riskLevel:u}:{},toolName:i,toolArgs:a,toolInputSchema:o,requestedAt:new Date(s),expiresAt:c?new Date(c):void 0,decisionRef:n,routeKind:r,...l&&l.length>0?{reasonCodes:l}:{},...d?{question:d}:{},...f?{presentation:f}:{},...p?{presentationId:p}:{}}}var yW=(0,Q.createContext)(void 0),bW=({children:e})=>{let{appConfig:t,frontendConfiguration:n,httpClient:r}=Ou(),i=pg(),a=Zp(),{on:o,emit:s,isConnected:c}=up(),l=(0,Q.useRef)(!1),u=(n?.flowsActorsViews?.length??0)>0,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(new Map),[T,E]=(0,Q.useState)(!1);Ym({identifier:ns.FLOWS_ACTORS,isLoading:y,hasLoadedOnce:T});let D=(0,Q.useRef)(C);D.current=C;let O=(0,Q.useCallback)((e,t)=>{w(n=>{let r=n.get(e);if(!r)return n;let i=new Map(n);return i.set(e,t(r)),i})},[]),k=(0,Q.useCallback)(async()=>{if(!t?.runtime?.endPoints?.main_backend_api)dW(`Cannot refresh systems - API endpoint not configured`);else if(!r)dW(`Cannot refresh systems - httpClient not available`);else{b(!0),S(null);try{let e=await r.get(`${br}${Ia(Ar.FLOWS_ACTORS_FRONTEND_INFO)}`);f(e.systems),m(e.autonomousAgents),g(e.chatAgents),v(e.chatConnectionRefs),E(!0),dW(`Systems refreshed`,{count:e.systems.length})}catch(e){if(lt.isNotFoundError(e)){dW(`FlowsActors backend support not available - skipping systems bootstrap`),f([]),m([]),g([]),v([]),S(null),E(!0);return}let t=e instanceof Error?e:Error(`Unknown error`);S(t),dW(`Failed to refresh systems`,{error:t.message})}finally{b(!1)}}},[t?.runtime?.endPoints?.main_backend_api,r]),A=(0,Q.useCallback)(async(e,t,n)=>{if(!r)dW(`Cannot fetch conversation history - httpClient not available`);else try{let i=`${br}${Ia(Ar.FLOWS_ACTORS_HISTORY)}`,o=t===void 0?void 0:_c({...a?.currentOrganizationId?{organizationId:a.currentOrganizationId}:{},...t}),s=`?systemRef=${encodeURIComponent(e)}${o===void 0?``:`&contextRef=${encodeURIComponent(o)}`}`+(n?.before?`&before=${encodeURIComponent(n.before)}`:``),c=kh(sn,await r.get(`${i}${s}`));dW(`Conversation history fetched`,{systemRef:e,count:c.executions.length});let l=c.executions.filter(e=>e.pendingApproval!==void 0);return l.length>0&&w(e=>{let t;for(let n of l){let r=e.get(n.executionId),i=r?.status===hW.ERROR&&(r.errorCode===fn.DECISION_PENDING||r.errorCode===fn.DECISION_PRESENTATION_STALE||r.errorCode===fn.DECISION_STEP_UP_REQUIRED);r&&!i||n.pendingApproval===void 0||(t??=new Map(e),t.set(n.executionId,{executionId:n.executionId,systemRef:n.systemRef,status:hW.AWAITING_APPROVAL,messages:[],pendingApproval:vW(n.pendingApproval)}))}return t??e}),{executions:c.executions,hasOlder:c.hasOlder===!0}}catch(t){if(lt.isNotFoundError(t))return dW(`FlowsActors history surface not available - returning empty history`,{systemRef:e}),{executions:[],hasOlder:!1};uW.warn(`Failed to fetch conversation history`,{systemRef:e,error:t instanceof Error?t.message:`unknown`});return}},[r,a?.currentOrganizationId]),j=(0,Q.useCallback)(async e=>{if(!r){dW(`Cannot delete conversation - httpClient not available`);return}let t=`${br}${Ia(Ar.FLOWS_ACTORS_HISTORY)}`;await r.delete(`${t}?executionId=${encodeURIComponent(e)}`),dW(`Conversation deleted`,{executionId:e})},[r]),M=(0,Q.useCallback)((e,t,n,r,i)=>{if(!c)return dW(`Cannot start execution — WebSocket not connected`,{systemRef:e}),null;let o=n??crypto.randomUUID();dW(`Starting execution`,{systemRef:e,executionId:o,hasInput:!!t,isContinuation:!!n});let l={};return a?.currentOrganizationId&&(l.organizationId=a.currentOrganizationId),Object.assign(l,r??{}),w(t=>{let n=new Map(t);return n.set(o,{executionId:o,systemRef:e,status:hW.STARTING,messages:[]}),n}),s(fa.FLOWS_ACTORS_START,{systemRef:e,executionId:o,contextResourceIdentifiers:l,initialInput:t,...i?.caseRef?{caseRef:i.caseRef}:{},...i?.messageId?{messageId:i.messageId}:{}}),o},[c,s,a?.currentOrganizationId]),N=(0,Q.useCallback)((e,t,n,r,i,a)=>{let o=D.current.get(e);o?c?(dW(`Responding to approval`,{executionId:e,approvalId:t,approved:n,modified:i!==void 0}),s(fa.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:o.systemRef,executionId:e,approvalId:t,approved:n,comment:r,...o.pendingApproval?.decisionRef?{decisionRef:o.pendingApproval.decisionRef}:{},...o.pendingApproval?.presentationId?{presentationId:o.pendingApproval.presentationId}:{},...i?{modifiedToolArgs:i}:{},...a?{reasonCode:a}:{}}),O(e,e=>({...e,status:n?hW.RUNNING:e.status,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval,...i?{submittedToolArgs:i}:{}}:void 0}))):dW(`Cannot respond to approval — WebSocket not connected`,{executionId:e,approvalId:t}):dW(`Cannot respond to approval — execution not found`,{executionId:e,approvalId:t})},[c,s,O]),P=(0,Q.useCallback)((e,t,n,r)=>{let i=D.current.get(e),a=i?.pendingApproval;if(!i||!a?.question||!a.decisionRef||!c){dW(`Cannot answer a question — no paused question, or the WebSocket is not connected`,{executionId:e});return}let o=t===Ine.ANSWER;s(fa.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:i.systemRef,executionId:e,approvalId:a.approvalId,decisionRef:a.decisionRef,...a.presentationId?{presentationId:a.presentationId}:{},approved:o,answer:{decisionId:a.decisionRef,optionRef:t,values:[...n]},...r?{comment:r}:{}}),O(e,e=>({...e,status:hW.RUNNING,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval}:void 0}))},[c,s,O]),F=(0,Q.useCallback)(e=>D.current.get(e),[]),I=(0,Q.useCallback)(e=>d.find(t=>t.ref===e),[d]),ee=(0,Q.useCallback)(e=>{let t=D.current.get(e);t&&c&&s(fa.FLOWS_ACTORS_CANCEL,{systemRef:t.systemRef,executionId:e})},[c,s]),L=(0,Q.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]);(0,Q.useEffect)(()=>{i.isAuthenticated()||(l.current=!1,f([]),m([]),g([]),v([]),S(null),w(new Map))},[i]);let R=(0,Q.useCallback)(()=>{!l.current&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,r,i,k]);(0,Q.useEffect)(()=>{!l.current&&u&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,u,r,i,k]);let z=(0,Q.useRef)(c);(0,Q.useEffect)(()=>{let e=z.current&&!c;z.current=c,e&&w(e=>{let t=null;for(let[n,r]of e)(r.status===hW.STARTING||r.status===hW.RUNNING)&&(t??=new Map(e),t.set(n,{...r,status:hW.ERROR,recoverable:!0,errorCode:fn.CONNECTION_LOST}));return t??e})},[c]),(0,Q.useEffect)(()=>{if(!c)return;let e=o(fa.FLOWS_ACTORS_STARTED,e=>{dW(`Execution started`,{executionId:e.executionId}),O(e.executionId,e=>({...e,status:hW.RUNNING}))}),t=o(fa.FLOWS_ACTORS_MESSAGE,e=>{dW(`Execution message`,{executionId:e.executionId,type:e.messageType,messageId:e.messageId,isFinal:e.isFinal});let t=Hte.safeParse(e.data);if(t.success){let{approvalId:n,toolName:r}=t.data;dW(`Approval requested`,{executionId:e.executionId,approvalId:n,toolName:r}),O(e.executionId,e=>({...e,status:hW.AWAITING_APPROVAL,answeredApproval:void 0,pendingApproval:vW(t.data)}))}O(e.executionId,t=>({...t,messages:mW(t.messages,{type:e.messageType,content:e.content,data:e.data,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp),messageId:e.messageId},e.isFinal===!0)}))}),n=o(fa.FLOWS_ACTORS_COMPLETED,e=>{dW(`Execution completed`,{executionId:e.executionId,status:e.status,duration:e.duration}),O(e.executionId,t=>({...t,status:_W(e.status),pendingApproval:void 0,duration:e.duration,...e.usage?{usage:e.usage}:{}}))}),r=o(fa.FLOWS_ACTORS_ERROR,e=>{dW(`Execution error`,{executionId:e.executionId,errorCode:e.errorCode,recoverable:e.recoverable}),O(e.executionId,t=>{if(e.recoverable&&e.errorCode===fn.APPROVAL_MODIFICATION_REJECTED&&t.answeredApproval)return{...t,status:hW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:e.approvalModificationRefusal??{reason:``},rejectedToolArgs:t.answeredApproval.submittedToolArgs,reasonCodeRefused:void 0},answeredApproval:void 0};if(e.recoverable&&e.errorCode===fn.APPROVAL_REASON_CODE_REJECTED&&t.answeredApproval)return{...t,status:hW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:void 0,rejectedToolArgs:void 0,reasonCodeRefused:!0},answeredApproval:void 0};if(e.recoverable&&e.errorCode===fn.SERVICE_CONSENT_REQUIRED&&t.answeredApproval)return{...t,status:hW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:void 0,rejectedToolArgs:t.answeredApproval.submittedToolArgs,reasonCodeRefused:void 0},answeredApproval:void 0};let n=t.pendingApproval?.decisionRef??t.answeredApproval?.approval.decisionRef;return e.errorCode===fn.DECISION_PENDING&&n!==void 0&&n===e.waitingDecisionRef?t:{...t,status:hW.ERROR,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:void 0,answeredApproval:void 0}})});return()=>{e(),t(),n(),r()}},[c,o,O]);let te=(0,Q.useMemo)(()=>({systems:d,autonomousAgents:p,chatAgents:h,chatConnectionRefs:_,requestAgentDeclarations:R,isLoading:y,error:x,executions:C,startExecution:M,respondToApproval:N,answerQuestion:P,cancelExecution:ee,clearExecution:L,getExecution:F,getSystem:I,refreshSystems:k,fetchConversationHistory:A,deleteConversation:j}),[d,p,h,_,R,y,x,C,M,N,P,ee,L,F,I,k,A,j]);return(0,$.jsx)(yW.Provider,{value:te,children:e})};function xW(){let e=(0,Q.useContext)(yW);if(!e)throw Error(`useFlowsActors must be used within a FlowsActorsProvider`);return e}function SW(){return(0,Q.useContext)(yW)}var CW={[Ut.AGENT_NOT_REGISTERED]:`refusalAgentNotRegistered`,[Ut.TOOL_NOT_DECLARED]:`refusalToolNotDeclared`,[Ut.TOOL_NO_LONGER_GATED]:`refusalToolNoLongerGated`,[Ut.APPROVAL_ROUTE_CHANGED]:`refusalApprovalRouteChanged`,[Ut.AGENT_NOT_ACTIVE]:`refusalAgentNotActive`,[Ut.AGENT_SUSPENDED]:`refusalAgentSuspended`,[Ut.CONTENT_POLICY_TIGHTENED]:`refusalContentPolicyTightened`,[Ut.AGENT_STANDING_UNREADABLE]:`refusalAgentStandingUnreadable`,[Ut.ARGUMENTS_INVALID]:`refusalArgumentsInvalid`,[Ut.ARGUMENTS_NOT_RUN_AS_WRITTEN]:`refusalArgumentsNotRunAsWritten`,[Ut.ARGUMENTS_CANNOT_BE_CORRECTED]:`refusalArgumentsCannotBeCorrected`,[Ut.CREDENTIAL_NOT_ACCEPTED]:`refusalCredentialNotAccepted`,[Ut.SIGNING_KEY_NOT_CONFIGURED]:`refusalSigningKeyNotConfigured`,[Ut.CALL_NOT_REWRITABLE]:`refusalCallNotRewritable`,[Ut.RECORD_NOT_REACHABLE]:`refusalRecordNotReachable`,[Ut.DELIVERABLE_FILE_NOT_EDITABLE]:`refusalDeliverableFileNotEditable`},wW=`refusalReasonUnstated`,TW=new Set(Object.values(Ut));function EW(e,t){return t(TW.has(e.reason)?CW[e.reason]:wW,{toolName:e.toolName??``,arguments:(e.argumentPaths??[]).join(`, `)})}var DW=5;function OW(e,t){let n={arguments:(e.argumentNames??[]).join(`, `)||t(`noticeTheseArguments`)};return{[Uu.APPLIED]:void 0,[Uu.NOT_ACTIONABLE]:e.reason===Mc.PRESENTATION_STALE?t(`noticePresentationStale`):e.reason===Mc.CLOCK_ALREADY_PAUSED?t(`noticeClockAlreadyPaused`):e.reason===Mc.CLOCK_NOT_PAUSED?t(`noticeClockNotPaused`):e.reason===Mc.PAUSE_STATE_NOT_DECLARED?t(`noticePauseStateNotDeclared`):t(`noticeNotActionable`),[Uu.LAPSED]:t(`noticeLapsed`),[Uu.REQUESTER_AUTHORITY_LAPSED]:t(`noticeRequesterAuthorityLapsed`),[Uu.MODIFICATION_REJECTED]:e.reason===Mc.EDITED_CALL_NOT_REACHABLE?t(`noticeEditedCallNotReachable`,n):e.reason===Mc.CALL_NOT_RUN_AS_READ?t(`noticeCallNotRunAsRead`,n):e.reason===Mc.CREDENTIAL_NOT_ACCEPTED?t(`noticeCredentialNotAccepted`,n):e.reason===Mc.CALL_CANNOT_RUN?t(`noticeCallCannotRun`):e.reason===Mc.ARGUMENTS_CANNOT_BE_CORRECTED?t(`noticeArgumentsCannotBeCorrected`,n):t(`noticeModificationRejected`),[Uu.REASON_CODE_REJECTED]:t(`noticeReasonCodeRejected`),[Uu.CONSENT_REQUIRED]:t(`noticeConsentRequired`),[Uu.TARGET_REFUSED]:e.reason===Mc.NO_TARGET?t(`noticeNoEscalationTarget`):t(`noticeTargetRefused`),[Uu.SUPERSEDED]:t(`noticeSuperseded`)}[e.kind]}function kW(e,t){let n=e.find(e=>e.decisionRef===t)?.presentationId;return n?{presentationId:n}:{}}function AW(e,t){if(e&&e.length!==0)return e.map(e=>({value:e,label:t(Yie,e)}))}function jW(e,t){return t(ite.HUMAN_DECISION_PAUSE_STATE,e)}var MW=[ai.SYSTEM_ENUMS,ai.ROLES],NW=[];function PW({executionId:e,...t}){let{executions:n,respondToApproval:r,answerQuestion:i}=xW(),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(null),u=n.get(e),d=u?.pendingApproval,f=d?.toolName,{t:p,roleLabel:m,toolLabel:h,operationLabel:g,tComponent:_,tSystemEnum:v}=HW(Q.useMemo(()=>f?[f]:[],[f]),NW),y=Q.useCallback((t,n,i,a)=>{o(t),c(l.current),r(e,t,!0,n,i,...a?[a]:[])},[e,r]),b=Q.useCallback((t,n,i)=>{o(t),c(l.current),i?r(e,t,!1,n,void 0,i):r(e,t,!1,n)},[e,r]),x=Q.useCallback((t,n,r,a)=>{o(t),c(l.current),i(e,n,r,a)},[e,i]),S=Q.useCallback(e=>_(B.LOW_LEVEL_AI_APPROVAL,e),[_]);if(Q.useEffect(()=>{o(null)},[d]),!u||!d)return s?(0,$.jsx)(rM,{decisionRef:s.decisionRef,description:s.title}):null;let{approvalId:C,riskLevel:w,expiresAt:T,toolName:E,toolArgs:D,toolInputSchema:O,modificationRefusal:k,rejectedToolArgs:A,routeKind:j,reasonCodes:M,reasonCodeRefused:N,question:P,presentation:F}=d,I=RW(F?.title??dc({plane:Jr.CONVERSATIONAL,toolName:E??``}).title,p,m,h,g);l.current=d.decisionRef?{decisionRef:d.decisionRef,title:I}:null;let ee=j===void 0||j===Tr.OWNER;return P?(0,$.jsx)(eW,{approvalId:C,actionDescription:P.title,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:ee,question:BW(P,S),onAnswer:x,isProcessing:a===C,...t}):(0,$.jsx)(eW,{approvalId:C,actionDescription:I,riskLevel:w,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:ee,actionNotice:ee?N?_(B.LOW_LEVEL_AI_APPROVAL,`noticeReasonCodeRejected`):void 0:_(B.LOW_LEVEL_AI_APPROVAL,`awaitingReview`),reasonCodeOptions:ee?AW(M,v):void 0,allowArgumentModification:ee,toolName:E,toolLabel:E?h(E):void 0,executionContext:D,presentedArguments:d.presentation?Wr(d.presentation):void 0,argumentsSchema:O,argumentModificationError:k?EW(k,(e,t)=>_(B.LOW_LEVEL_AI_APPROVAL,e,t)):void 0,rejectedArguments:A,onApprove:y,onDeny:b,isProcessing:a===C,...t})}function FW(e,t,n,r){return{[Tr.OWNER]:()=>t(`holderOwner`),[Tr.ASSIGNEE]:()=>e.claimedAt?t(`holderClaimedByYou`,{when:r(e.claimedAt)}):t(`holderAssignedToYou`),[Tr.ROLE]:()=>e.eligibleRole?t(`holderRole`,{role:n(e.eligibleRole)}):void 0}[e.kind]()}var IW={[ee.USER]:void 0,[ee.MACHINE]:`requesterAutonomousAgent`,[ee.DELEGATED_CLIENT]:`requesterConnectedApplication`};function LW(e,t){let n=IW[e];return n?t(n):void 0}function RW(e,t,n,r,i=(e,t)=>`${ai.RESOURCES}.${e}.operations.${t}.${Fc.TITLE}`){switch(e.kind){case D.LABEL:return e.params?t(e.labelRef,Object.fromEntries(Object.entries(e.params).map(([e,a])=>[e,typeof a==`object`?RW(a,t,n,r,i):String(a)]))):t(e.labelRef);case D.ROLE:return n(e.roleKey);case D.TOOL:return r(e.toolName);case D.RESOURCE_OPERATION:return i(e.resourceType,e.operationIdentifier);case D.TEXT:return e.text;default:return e}}function zW(e,t,n=e=>e,r=e=>e,i){let a=e.presentation?{presentedArguments:Wr(e.presentation)}:{},o=RW(e.presentation?.title??dc(e).title,t,n,r,i);return e.plane===Jr.OPERATION_APPROVAL&&e.operationApproval?{actionDescription:o,executionContext:e.operationApproval.requestedValues,...a}:e.plane===Jr.REPRESENTATIVE_ADMISSION&&e.representativeAdmission||Cr(e)?{actionDescription:o}:{actionDescription:o,toolName:e.toolName,toolLabel:r(e.toolName),executionContext:e.toolArgs,...a}}function BW(e,t){return{description:e.description,options:e.options.map(e=>({ref:e.ref,label:RW(Cee(e),t,e=>e,e=>e),intent:e.intent,...e.description?{description:e.description}:{}})),fields:e.fields,...e.form?{form:e.form}:{}}}function VW(e,t){if(e.request&&Cr(e))return BW(e.request,t)}function HW(e,t){let n=Q.useMemo(()=>[...MW,...e.map(Vee),...t.map(e=>`${ai.RESOURCES}.${e}`)],[e,t]),{t:r,tComponent:i,tRole:a,tSystemEnum:o,tResourceOperation:s,formatDateTime:c}=K({component:B.LOW_LEVEL_AI_APPROVAL,keys:n});return{t:Q.useCallback((e,t)=>i(B.LOW_LEVEL_AI_APPROVAL,e,t),[i]),roleLabel:Q.useCallback(e=>a?a(e,`label`):e,[a]),toolLabel:Q.useCallback(e=>{let t=Tee(e,Rie.TITLE),n=r(t);return n===t||n.length===0?e:n},[r]),operationLabel:Q.useCallback((e,t)=>s(e,t,Fc.TITLE),[s]),tComponent:i,tSystemEnum:o,formatDateTime:c}}function UW(e,t){let n=new URLSearchParams(t).get(ote);if(!n)return e;let r=e.filter(e=>e.decisionRef===n);return r.length===0?e:[...r,...e.filter(e=>e.decisionRef!==n)]}function WW(e){let{decisions:t,readState:n,refresh:r,act:i,candidates:a}=lW(),o=Q.useMemo(()=>UW(t,window.location.search),[t]),{t:s,roleLabel:c,toolLabel:l,operationLabel:u,tSystemEnum:d,formatDateTime:f}=HW(Q.useMemo(()=>[...new Set(o.map(e=>e.toolName).filter(e=>!!e))].sort(),[o]),Q.useMemo(()=>[...new Set(o.map(e=>e.operationApproval?.resourceType).filter(e=>!!e))].sort(),[o])),[p,m]=Q.useState(()=>new Set),[h,g]=Q.useState(()=>new Map),[_,v]=Q.useState(()=>new Map),[y,b]=Q.useState([]),x=Q.useRef(new Map),S=Q.useCallback(async(e,t,n)=>{m(t=>new Set(t).add(e));let r=x.current.get(e);try{let a=await i(e,t,n);t===Ne.ANSWER&&a.kind===Uu.APPLIED&&b(t=>[{decisionRef:e,...r?{title:r}:{}},...t.filter(t=>t.decisionRef!==e)].slice(0,DW));let o=OW(a,s);g(t=>{let n=new Map(t);return o===void 0?n.delete(e):n.set(e,o),n})}catch{g(t=>new Map(t).set(e,s(`noticeNotActionable`)))}finally{m(t=>{let n=new Set(t);return n.delete(e),n})}},[i,s]),C=Q.useMemo(()=>o.map(e=>({approvalId:e.decisionRef,executionId:e.executionId,systemRef:e.systemRef,systemName:e.systemDisplayName,riskLevel:e.riskLevel,question:VW(e,s),holderNotice:FW(e.route,s,c,f),requesterNotice:LW(e.requesterKind,s),...zW(e,s,c,l,u),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,createdAt:new Date(e.requestedAt),canEscalate:e.permittedActs.includes(Ne.ESCALATE)&&e.declaresEscalationTarget,canClaim:e.permittedActs.includes(Ne.CLAIM),canUnclaim:e.permittedActs.includes(Ne.UNCLAIM),canReassign:e.permittedActs.includes(Ne.REASSIGN),reassignCandidates:_.get(e.decisionRef),actionNotice:h.get(e.decisionRef),canPauseClock:e.permittedActs.includes(Ne.PAUSE_CLOCK)&&!e.clockPause&&e.pauseStates.length>0,canResumeClock:e.permittedActs.includes(Ne.RESUME_CLOCK)&&!!e.clockPause,pauseStateOptions:e.pauseStates.map(e=>({value:e,label:jW(e,d)})),deadlineNotice:e.nextDeadline?s(e.nextDeadline.kind===Uee.CLAIM?`deadlineClaimBy`:`deadlineDecisionBy`,{when:f(e.nextDeadline.dueAt)}):void 0,clockPausedNotice:e.clockPause?s(`clockPausedIn`,{pauseState:jW(e.clockPause.pauseStateRef,d)}):void 0,reasonCodeOptions:AW(e.reasonCodes,d),allowArgumentModification:e.plane===Jr.CONVERSATIONAL,argumentsSchema:e.toolInputSchema})),[o,_,h,s,c,l,u,d,f]);x.current=new Map(C.flatMap(e=>typeof e.actionDescription==`string`?[[e.approvalId,e.actionDescription]]:[]));let w=Q.useCallback((e,t,n,r,i)=>{let a=o.find(t=>t.decisionRef===e)?.plane,c=a?cre[a]:void 0;if(!c){g(t=>new Map(t).set(e,s(`noticeNotActionable`)));return}let l=t?c.approve:c.deny;S(e,Ne.ANSWER,{answer:{decisionId:e,optionRef:l,values:[]},...kW(o,e),...n?{reason:n}:{},...r?{modifiedToolArgs:r}:{},...i?{reasonCode:i}:{}})},[S,o,s]),T=Q.useCallback(e=>{v(t=>{let n=new Map(t);return n.delete(e),n}),a(e).then(t=>v(n=>new Map(n).set(e,t.map(e=>({value:e.userId,label:e.email??e.userId}))))).catch(()=>v(t=>new Map(t).set(e,[])))},[a]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(tW,{items:C,onApprove:(e,t,n,r)=>w(e,!0,t,n,r),onDeny:(e,t,n)=>w(e,!1,t,void 0,n),onEscalate:(e,t)=>void S(e,Ne.ESCALATE,t?{reason:t}:{}),onAnswer:(e,t,n,r,i)=>void S(e,Ne.ANSWER,{answer:{decisionId:e,optionRef:t,values:[...n]},...kW(o,e),...r?{reason:r}:{},...i?{reasonCode:i}:{}}),onClaim:e=>void S(e,Ne.CLAIM,{}),onUnclaim:e=>void S(e,Ne.UNCLAIM,{}),onReassignOpen:T,onReassign:(e,t,n)=>void S(e,Ne.REASSIGN,{targetUserId:t,...n?{reason:n}:{}}),onPauseClock:(e,t)=>void S(e,Ne.PAUSE_CLOCK,{pauseStateRef:t}),onResumeClock:e=>void S(e,Ne.RESUME_CLOCK,{}),processingIds:p,isLoading:n===cW.LOADING,loadFailed:n===cW.FAILED,onRetry:()=>{r()},...e}),y.map(e=>(0,$.jsx)(rM,{decisionRef:e.decisionRef,...e.title?{description:e.title}:{}},e.decisionRef))]})}function GW(){return(0,$.jsx)(JU,{children:(0,$.jsx)(Yk,{name:`decisions`,appearance:cr.CARD,children:(0,$.jsx)(WW,{})})})}function KW(e){return e.operationFrontendConfig?.customView}function qW(e){return e.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey}var JW=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_ACTION});return i?(0,$.jsx)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceLayoutPreset_Action_Default`}):null};function YW({preset:e,...t}){let n=KW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=qW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.RESOURCES_LAYOUTS_ACTION,`ResourceLayout_Action`)(i);return(0,$.jsx)(a,{...t})}var XW=Qs(B.LOW_LEVEL_DIALOG,`Dialog`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function ZW({preset:e=q.DEFAULT,...t}){let n=XW(e);return(0,$.jsx)(n,{...t})}var QW=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XW(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});QW.displayName=`DialogTrigger`;var $W=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XW(e);return(0,$.jsx)(r.Content,{...t,ref:n})});$W.displayName=`DialogContent`;function eG({preset:e=q.DEFAULT,...t}){let n=XW(e);return(0,$.jsx)(n.Close,{...t})}function tG({preset:e=q.DEFAULT,...t}){let n=XW(e);return(0,$.jsx)(n.Header,{...t})}function nG({preset:e=q.DEFAULT,...t}){let n=XW(e);return(0,$.jsx)(n.Footer,{...t})}var rG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XW(e);return(0,$.jsx)(r.Title,{...t,ref:n})});rG.displayName=`DialogTitle`;var iG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=XW(e);return(0,$.jsx)(r.Description,{...t,ref:n})});iG.displayName=`DialogDescription`;function aG({open:e,onAcknowledge:t,fields:n,resourceType:r}){let{tComponent:i,tResourceFieldDisplay:a,isReady:o}=K({component:B.RESOURCES_LAYOUTS_CREATE,resource:r}),s=Q.useRef(n);if(s.current=n,(0,Q.useEffect)(()=>()=>{s.current=[]},[]),!o)return null;let c=yp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.title`}),l=yp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.warning`}),u=yp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.acknowledge`});return(0,$.jsx)(ZW,{open:e,onOpenChange:()=>{},children:(0,$.jsxs)($W,{className:`sm:max-w-lg`,onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),showCloseButton:!1,children:[(0,$.jsxs)(tG,{children:[(0,$.jsx)(rG,{className:`text-warning-foreground`,children:c}),(0,$.jsx)(iG,{className:`text-sm text-muted-foreground`,children:l})]}),(0,$.jsx)(`div`,{className:`space-y-field py-field`,children:n.map(e=>{let t=a(r,e.fieldName,`description`);return(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:a(r,e.fieldName,`label`)}),(0,$.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted/40 px-element py-item`,children:(0,$.jsx)(Bj,{schema:e.schema,value:String(e.value),className:`w-full overflow-x-auto`})}),t?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]},e.fieldName)})}),(0,$.jsx)(nG,{children:(0,$.jsx)(X,{onClick:t,children:u})})]})})}var oG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_CREATE}),{resourceType:a,operation:o,resourceConfig:s,isSemanticCustomOperation:c,navigateToPreferredRead:l,reportError:u,goBackWithinZone:d}=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),f=yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`formSubmissionFailed`}),p=yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`semanticOperationFailed`}),{closeOverlay:m}=DS(),h=e.additionalContext?.defaultValuesOverride,g=!!e.additionalContext?.quickCreateRequest,[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(n=>{if(g)t===rr.OVERLAY?m():d();else if(s){if(n){let r=n._id||n[s.resourceFieldIdentifier];if(r){l({contextResourceIdentifiers:On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,a,String(r)),fallbackToGoBack:!1,transitionOverride:t===rr.OVERLAY?Rt.PROMOTE:void 0})||d();return}}d()}},[m,d,g,l,t,s,e.contextResourceIdentifiers,a]),b=(0,Q.useCallback)(e=>{if(!s)return;let t=JS(o.responseDto,e);t.length>0?v({fields:t,result:e}):y(e)},[s,o.responseDto,y]),x=(0,Q.useCallback)(()=>{if(_){let{result:e}=_;v(null),y(e)}},[_,y]),S=(0,Q.useCallback)(e=>{u(e,f,`ResourceLayoutPreset_Create_Default`)},[f,u]),C=(0,Q.useMemo)(()=>t===rr.OVERLAY?()=>m():void 0,[t,m]);return i?c?(0,$.jsx)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:p,errorComponent:`ResourceLayoutPreset_Create_Default`,onSuccess:b,onCancel:C}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(mB,{resourceContext:e,defaultValuesOverride:h,navigationZone:t,onSuccess:b,onError:S,onCancel:C,showErrorSummary:!0}),_&&(0,$.jsx)(aG,{open:!0,onAcknowledge:x,fields:_.fields,resourceType:a})]}):null};function sG({preset:e,...t}){let n=KW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=qW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.RESOURCES_LAYOUTS_CREATE,`ResourceLayout_Create`)(i);return(0,$.jsx)(a,{...t})}var cG=700;function lG(e,{enabled:t=!0,delayMs:n=450,moveTolerancePx:r=10}={}){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(null),c=(0,Q.useRef)(e);c.current=e;let l=(0,Q.useCallback)(()=>{i.current&&=(clearTimeout(i.current),null)},[]),u=(0,Q.useCallback)(e=>{if(!t)return;if(e.touches.length>1){l();return}o.current=!1;let r=e.touches[0];s.current=r?{x:r.clientX,y:r.clientY}:null,l(),i.current=setTimeout(()=>{o.current=!0,c.current()},n)},[t,n,l]),d=(0,Q.useCallback)(e=>{let t=s.current,n=e.touches[0];t&&n&&(Math.abs(n.clientX-t.x)>r||Math.abs(n.clientY-t.y)>r)&&l()},[r,l]),f=(0,Q.useCallback)(()=>{l(),o.current&&(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o.current=!1},cG))},[l]),p=(0,Q.useCallback)(e=>{o.current&&e.preventDefault()},[]),m=(0,Q.useCallback)(()=>o.current?(o.current=!1,!0):!1,[]);return(0,Q.useEffect)(()=>()=>{i.current&&clearTimeout(i.current),a.current&&clearTimeout(a.current)},[]),{handlers:{onTouchStart:u,onTouchEnd:f,onTouchMove:d,onContextMenu:p},consumeLongPress:m}}var uG=Ic.HIDDEN;function dG(e){let{resourceType:t,resourceConfig:n,data:r,hostIdentifiers:i}=e,a={...i??{}},o=n?.resourcePrimaryScope;if(o){let e=r[$u[o]];typeof e==`string`&&e.length>0&&(a[Fie[o]]=e)}let s=n?.resourceFieldIdentifier,c=s?V.getResourceObjectId(r,s):void 0;return c&&(a[t]=c),a}function fG({resourceType:e,schema:t,data:n,className:r,primaryLabel:i=null,contextResourceIdentifiers:a}){let{registry:o}=fm(),s=(0,Q.useMemo)(()=>o.resourceConfigurations[e],[o,e]),c=(0,Q.useMemo)(()=>dG({resourceType:e,resourceConfig:s,data:n,hostIdentifiers:a}),[e,s,n,a]),l=(0,Q.useMemo)(()=>V.buildContextualParameters(c,o),[c,o]),u=V.getInstance().getResourceId(c[e])||void 0,d=s?.frontendConfiguration?.layout?.summary,f=s?.frontendConfiguration?.layout?.defaultChromeMode?.summary,p=(0,Q.useMemo)(()=>d??JR(t,s),[d,t,s]),m=(0,Q.useRef)({titleMounted:!1}).current,h=(0,Q.useMemo)(()=>({resourceType:e,primaryLabel:i,titleMountTracker:m}),[e,i,m]);(0,Q.useEffect)(()=>{});let g=(0,Q.useMemo)(()=>({resourceContext:{resourceType:e,operationId:W.READ}}),[e]);return(0,$.jsx)(IA,{kind:PA.SUMMARY,children:(0,$.jsx)(uge,{value:h,children:(0,$.jsx)(WA.Provider,{value:f===void 0,children:(0,$.jsx)(IB,{schema:t,data:n,resourceType:e,resourceId:u,contextResourceIdentifiers:c,contextualParameters:l,className:r,labels:g,disableInlineEdit:!0,layoutTemplate:p,defaultDisplayChromeMode:f??uG,isLoading:!1})})})})}fG.displayName=`ResourceSummaryDisplayer`;var pG=fG;function mG({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item`,`[&>*]:w-auto`,e),children:t})}var hG=`15rem`,gG=`border border-border rounded-lg divide-y divide-border list-none m-0 p-0`,_G=`px-card py-card-sm`,vG=`ps-card`,yG=`flex items-start gap-element-sm`,bG=`border-s border-transparent ${vG}`,xG=`grid gap-element list-none m-0 p-0`;function SG(e){return e===void 0?gG:U(xG)}function CG(e){if(e===void 0)return;let t=Math.min(Math.max(Math.trunc(e),1),6);return{gridTemplateColumns:`repeat(auto-fill, minmax(max(${hG}, ${`calc((100% - ${t-1} * var(--spacing-element)) / ${t})`}), 1fr))`}}var wG={vertical:ol.MIDDLE,horizontal:Qc.END,orientation:mu.HORIZONTAL},TG={[ol.TOP]:`items-start`,[ol.MIDDLE]:`items-center`,[ol.BOTTOM]:`items-end`};function EG(e=wG){let{vertical:t,horizontal:n,orientation:r=mu.HORIZONTAL}=e,i=r===mu.VERTICAL?`flex flex-col gap-element-sm`:`flex gap-element-sm`;return n===Qc.MIDDLE?{containerClass:`flex ${t===ol.TOP?`flex-col-reverse`:`flex-col`} gap-element-sm`,contentClass:`min-w-0`,actionsClass:`${i} self-center`}:{containerClass:`flex ${n===Qc.START?`flex-row-reverse`:``} ${TG[t]} gap-element-sm`.replace(/\s+/g,` `).trim(),contentClass:`min-w-0 flex-1`,actionsClass:`${i} shrink-0`}}var DG=async()=>{throw Error(`A collection cell does not edit in place.`)};function OG(e){let t=dj(),n=ym()?.registry,{resourceType:r,record:i,collectionContextResourceIdentifiers:a}=e;return(0,Q.useMemo)(()=>{if(!n||!i)return t;let e=dG({resourceType:r,resourceConfig:n.resourceConfigurations[r],data:i,hostIdentifiers:a??t.contextResourceIdentifiers});return{...t,resourceType:r,resourceId:On.getResourceId(e[r])||void 0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,n),canInlineEdit:!1,doInlineUpdate:DG,defaultInlineEdit:void 0,fileUploadContext:void 0,rmm:null}},[t,n,i,r,a])}function kG({fieldName:e,value:t,fieldSchema:n,fieldLabel:r,resourceType:i,record:a,collectionContextResourceIdentifiers:o,tResourceFieldEnumValue:s,fieldLabelVisible:c=!1}){let l=OG({resourceType:i,record:a,collectionContextResourceIdentifiers:o}),u=(0,Q.useMemo)(()=>{let t=n?Hc(n):void 0;if(!t)return;let r=Xo(t);if(r.length!==0)return Object.fromEntries(r.map(t=>[t,s(i,e,t,n)]))},[n,i,e,s]);return t==null?null:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-element-sm`,children:[r&&(c?(0,$.jsxs)(Z,{as:`span`,variant:zr.MUTED,size:Le.XS,children:[r,`:`]}):(0,$.jsxs)(`span`,{className:`sr-only`,children:[r,`: `]})),n?(0,$.jsx)(uj.Provider,{value:l,children:(0,$.jsx)(ok,{displayChromeMode:Ic.COMPACT,children:(0,$.jsx)(yR,{name:e,schema:n,value:t,enumLabels:u,parentData:a,disableInlineEdit:!0,className:`min-w-0 truncate text-sm text-muted-foreground`})})}):(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm text-muted-foreground`,children:String(t)})]})}function AG({item:e,resourceType:t,resourceConfig:n,registry:r,collectionContextResourceIdentifiers:i,summaryFields:a,fieldLabelsMap:o,tResourceFieldEnumValue:s,onItemClick:c,operationsSlot:l,cardActionPlacement:u,selectable:d=!1,isSelected:f=!1,onToggleSelect:p,selectionActive:m=!1,selectAriaLabel:h,className:g,interactiveClasses:_}){if(!n?.resourceFieldIdentifier)throw V.buildConfigurationError(Xl.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:t,component:`ResourceListItemRenderer`});let v=n.resourceFieldIdentifier,y=V.getResourceObjectId(e,v),{t:b,formatDate:x,formatDateTime:S}=K({resource:t}),C=(0,Q.useMemo)(()=>{let n=V.computeFrontendResourceLabel({resourceType:t,registry:r,currentObject:e,t:b,formatDate:x,formatDateTime:S});return String(n||e[a[0]]||`${t} #${y}`)},[e,t,r,a,y,b,x,S]),w=(0,Q.useMemo)(()=>a.filter(t=>{let n=e[t];return XA(n)?String(n)!==C:!1}),[a,e,C]),T=(0,Q.useMemo)(()=>V.resolveRowSchema(n,e),[n,e]),E=(0,Q.useMemo)(()=>T?hr.getObjectLikeFieldShape(T,{commonOnly:!1})??null:null,[T]),D=Q.useContext(s_),O=D?.UIConfig?.currentBreakpoint??Sl.DESKTOP,k=UA(n?.frontendConfiguration?.layout?.defaultChromeMode?.summary,O),A=(0,Q.useMemo)(()=>$A(k,w.map(e=>{let t=E?.[e];return{schemaType:t?me(t):void 0,present:!0,declaredChrome:t?UA(Xs(t)?.chromeMode,O):void 0}})),[k,w,E,O]),j=n?.frontendConfiguration?.layout?.summary,M=_?.hover??``,N=_?.transition??``,P=EG(u),F=D?.UIConfig?.currentBreakpoint===Sl.MOBILE,I=d&&m&&F,ee=lG(()=>p?.(e),{enabled:d&&!!p&&F}),L=!!c||I,R=()=>{ee.consumeLongPress()||(I?p?.(e):c?.(e))};return(0,$.jsxs)(`div`,{"data-slot":`resource-list-item`,className:U(`group/list-item`,_G,N,L&&`relative`,L&&M,L&&`cursor-pointer`,f&&`bg-primary/5`,d&&`select-none`,g),onClick:L?R:void 0,...ee.handlers,children:[L&&(0,$.jsx)(`button`,{type:`button`,"aria-label":String(C),className:U(`absolute inset-0 rounded-[inherit] outline-none`,Rg(d_.INSET)),onClick:e=>{e.stopPropagation(),R()}}),(0,$.jsxs)(`div`,{className:U(yG,L&&`relative`),children:[d&&(0,$.jsx)(`div`,{className:U(`shrink-0`,`pt-0.5`,!f&&!m&&`opacity-0 group-hover/list-item:opacity-100 group-focus-within/list-item:opacity-100 any-pointer-coarse:opacity-100 motion-safe:transition-opacity`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,$.jsx)(TI,{checked:f,onCheckedChange:()=>p?.(e),"aria-label":h??String(C)})}),(0,$.jsxs)(`div`,{className:U(P.containerClass,`min-w-0 flex-1`),children:[(0,$.jsx)(`div`,{className:U(`space-y-item-xs`,P.contentClass),children:j&&T?(0,$.jsx)(pG,{resourceType:t,schema:T,data:e,primaryLabel:C,contextResourceIdentifiers:i}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{as:`p`,className:`font-medium text-foreground`,truncate:!0,children:C}),w.length>0&&(0,$.jsx)(mG,{children:w.map((n,r)=>{let a=e[n];return(0,$.jsx)(kG,{fieldLabelVisible:A[r],fieldName:n,value:a,fieldSchema:E?.[n],fieldLabel:o[n],resourceType:t,record:e,collectionContextResourceIdentifiers:i,tResourceFieldEnumValue:s},n)})})]})}),l&&(0,$.jsx)(`div`,{className:P.actionsClass,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:l})]})]})]})}function jG({navigationZone:e,className:t}){let n=Ux(),{tComponent:r}=K({component:B.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n.close()},[n]),a=n.target;return a?(0,$.jsx)(`div`,{"data-slot":`resource-in-place-operation`,className:U(`p-container`,t),children:(0,$.jsx)(dV,{resourceContext:a.resourceContext,navigationZone:e,onSuccess:i,onCancel:i,errorMessage:yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceInPlaceOperationRow`})}):null}var MG;(function(e){e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.ENUM=`enum`,e.DATE=`date`,e.YEAR_MONTH=`yearMonth`,e.REFERENCE=`reference`,e.NUMBER_RANGE=`numberRange`,e.YEAR_MONTH_RANGE=`yearMonthRange`,e.UNKNOWN=`unknown`})(MG||={});var NG=new Set;function PG(e,t){return FG(e,t,el)}function FG(e,t,n){if(!e)return NG;let r=new Set;for(let i of[e,...il(t)]){let e=hr.getObjectLikeFieldShape(i,{commonOnly:!1});for(let[t,i]of Object.entries(e??{}))n(i)&&r.add(t)}return r.size>0?r:NG}var IG=class e{constructor(){}static detectSummaryFields(e){return V.detectSummaryFields(e)}static withoutPinnedFilterFields(e,t){return t?e.filter(e=>!Object.prototype.hasOwnProperty.call(t,e.fieldName)):[...e]}static withoutPresetsAssigningPinnedFields(e,t){return!e||!t?e?[...e]:void 0:e.filter(e=>!Object.keys(e.filters).some(e=>Object.prototype.hasOwnProperty.call(t,e)))}static withPinnedFilters(e,t){return{...e,...t??{}}}static variantKeyOf(e){let t=e?.variantKey;return typeof t==`string`&&t.length>0?t:null}static searchOperationAcceptsATerm(e){return!!e&&e.isSearchable!==!1}static listingOperationShown(e){return e.inlineSearchTerm&&e.searchOperation?e.searchOperation:e.listOperation}static matchListingOf(t){if(!ore(t))return;let n=String(t.operationIdentifier),r=e.variantKeyOf(t);return{operation:n,...r?{variantKey:r}:{}}}static computeTransportPinnedFieldNames(e){let t=new Set,n=e.resourceConfig.resourcePrimaryScope,r=n?$u[n]:void 0;r&&t.add(r);let i=(`initiatorInfos`in e.operation?e.operation.initiatorInfos:void 0)??[];if(i.length>0){let n=V.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:e.contextualParameters,targetResourceType:e.resourceConfig.resourceIdentifier,targetDefaultFieldIdentifier:String(e.resourceConfig.resourceFieldIdentifier??``),parentResourcesRequirements:e.parentResourcesRequirements});for(let e of n?.parameters??[])t.add(e.fieldIdentifier)}return t}static parseFilterFieldDefinitions(t,n,r){if(!t||typeof t!=`object`)return[];let i=n?e.computeTransportPinnedFieldNames(n):void 0,a=n?.resourceConfig??r,o=FG(a?.mainSchema,a?.inheritenceSchemaDefinition,sa),s=[];for(let[e,r]of Object.entries(t)){if(typeof r==`function`||!r||typeof r!=`object`||i?.has(e)||e===`_id`)continue;let t=r,a=me(t),c=MG.UNKNOWN;if(Ue(t)){s.push({fieldName:e,schema:t,fieldType:MG.NUMBER_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}if(kee(t)){s.push({fieldName:e,schema:t,fieldType:MG.YEAR_MONTH_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}let l,u;switch(a){case vu.STRING:c=MG.STRING;break;case vu.NUMBER:case vu.BIGDECIMAL:c=MG.NUMBER;break;case vu.BOOLEAN:c=MG.BOOLEAN;break;case vu.ENUM:c=MG.ENUM;try{l=Xo(lr(t))}catch{l=[]}break;case vu.DATE:case vu.DATETIME:c=MG.DATE;break;default:c=MG.STRING}if(c===MG.STRING&&n){let t=n.registry.fieldIdentifierToResourceType?.[e];t&&(c=MG.REFERENCE,u=t)}c===MG.STRING&&(sa(t)||o.has(e))&&(c=MG.YEAR_MONTH),s.push({fieldName:e,schema:t,fieldType:c,enumValues:l,referenceTargetResourceType:u})}return s}},LG=new Set([W.LIST,W.SEARCH,W.COUNT]);function RG(e){let{parentRelationships:t,childRelationships:n,selfRelationships:r}=e.hostRelationships;return[...t,...n,...r].filter(t=>t.isDisabled!==!0&&(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType&&Ul.resolveForeignKeyHolderResourceType(t)===e.targetResourceType).map(t=>({relationship:t,foreignKeyField:Ul.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier})).filter(t=>e.selectedForeignKey===void 0||t.foreignKeyField===e.selectedForeignKey)}var zG;(function(e){e.NAMES_HOST=`names_host`,e.OTHER=`other`,e.NO_ROUTE=`no_route`})(zG||={});function BG(e){return VG(e)===zG.NAMES_HOST}function VG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,registry:i,edgeForeignKeyFields:a}=e,o=t.operation.initiatorInfos??[],s=V.buildContextualParameters(t.contextResourceIdentifiers,i),c=V.selectOperationUrlInitiatorInfo({initiatorInfos:o,contextualParameters:s,targetResourceType:t.resourceType,targetDefaultFieldIdentifier:String(i.allResourceFieldIdentifiers[t.resourceType]??``),parentResourcesRequirements:t.parentResourcesRequirements});return c?c.parameters.some(e=>(e.resourceType===n||a.includes(e.fieldIdentifier))&&String(s[e.fieldIdentifier]??``)===r)?zG.NAMES_HOST:zG.OTHER:zG.NO_ROUTE}function HG(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{message:e,component:`confineRelatedCollectionToHost`,...t})}function UG(e,t,n){let r=n.resourceConfigurations[t]?.operations??[];return new Set(Object.keys(kS(e,r)??{}))}function WG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:i,registry:a}=e,o=t.resourceType,s=String(a.allResourceFieldIdentifiers[o]??``),c=[...t.operation.initiatorInfos??[]].sort((e,t)=>t.parameters.length-e.parameters.length||String(e.url??``).localeCompare(String(t.url??``))),l=V.buildContextualParameters(t.contextResourceIdentifiers,a),u=e=>(t.parentResourcesRequirements??[]).find(t=>t.resourceType===e);for(let e of c){let c=e.parameters.filter(e=>e.resourceType!==o||e.fieldIdentifier!==s),d=e=>i.length>0?i.includes(e.fieldIdentifier)||e.relationshipField!==void 0&&i.includes(e.relationshipField):e.resourceType===n;if(!c.some(d))continue;let f={...t.contextResourceIdentifiers},p=!0;for(let e of c){let t=l[e.fieldIdentifier],n=(typeof t==`string`||typeof t==`number`)&&String(t).length>0;if(d(e)){if(n&&String(t)!==r){p=!1;break}n||(f[e.fieldIdentifier]={fieldIdentifier:e.fieldIdentifier,resourceId:r})}else if(!n){p=!1;break}}if(!p)continue;let m=c.map((e,t)=>{let n=c[t+1]?.resourceType??o,r=u(e.resourceType);return{resourceType:e.resourceType,foreignKeyField:e.relationshipField,childResourceType:n,relationshipEdgeKey:V.buildRelationshipEdgeKey({parentResourceType:e.resourceType,childResourceType:n,foreignKeyField:e.relationshipField}),requirement:r?.requirement??Be.MANDATORY,isPrimaryScope:r?.isPrimaryScope??!1,...r?.primaryScope?{primaryScope:r.primaryScope}:{}}}),h={...t,contextResourceIdentifiers:f,parentResourcesRequirements:m};if(BG({childContext:h,hostResourceType:n,hostResourceId:r,registry:a,edgeForeignKeyFields:i}))return h}}function GG(e){let{childContext:t,hostResourceId:n,callerPinnedFilters:r,registry:i}=e,{operation:a}=t,o=a.isBulkOperation===!0?void 0:vl(a);if(!o||!LG.has(o))return t;if(r&&Object.keys(r).length>0){let a=JG(t,r,i,qG.CALLER);if(!n)return a;try{return KG({...e,childContext:a,hostResourceId:n})}catch(e){if(e.wildoError?.context?.conflictingKey!==void 0)throw e;return a}}return n?KG({...e,hostResourceId:n}):t}function KG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,hostRelationships:i,selectedForeignKey:a,registry:o}=e,{operation:s,resourceType:c}=t,l=i?RG({hostResourceType:n,hostRelationships:i,targetResourceType:c,selectedForeignKey:a,registry:o}):[];if(a!==void 0&&l.length===0)throw HG(`"${c}" is placed on a "${n}" record through \`viaForeignKey: { ${n}: '${a}' }\`, but no live relationship from "${n}" to "${c}" has that foreign key (a typo, a renamed or a disabled relationship), so nothing says which rows are this record's.`,{hostResourceType:n,targetResourceType:c,selectedForeignKey:a});if(l.some(e=>e.relationship.isPrimaryScope===!0))return t;let u=l.map(e=>e.foreignKeyField).filter(e=>!!e),d=VG({childContext:t,hostResourceType:n,hostResourceId:r,registry:o,edgeForeignKeyFields:u});if(d===zG.NAMES_HOST)return t;let f=l.length<=1?WG({childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:u,registry:o}):void 0;if(f)return f;if(d===zG.NO_ROUTE)return t;if(l.length===0)throw HG(`"${c}" is embedded on a "${n}" record, but no relationship links the two and no route of its ${String(s.operationIdentifier)} names the record, so nothing says which rows are this record's. Relate the two resources, or pin the collection to the record on a filter its operation declares.`,{hostResourceType:n,targetResourceType:c,operationIdentifier:s.operationIdentifier});if(l.length>1)throw HG(`"${c}" is placed on a "${n}" record through ${l.length} relationships, and its ${String(s.operationIdentifier)} route names none of them, so the embed cannot tell which of the record's rows to list. Name the relationship with \`viaForeignKey: { ${n}: '<foreign key>' }\`.`,{hostResourceType:n,targetResourceType:c,foreignKeyFields:l.map(e=>e.foreignKeyField)});let p=l[0].foreignKeyField;if(!p)throw HG(`"${c}" is placed on a "${n}" record through a relationship whose foreign key cannot be resolved, and no route names the record, so nothing can confine it to this record's rows.`,{hostResourceType:n,targetResourceType:c});return JG(t,{[p]:r},o,qG.RELATIONSHIP,n)}var qG;(function(e){e.CALLER=`caller`,e.RELATIONSHIP=`relationship`})(qG||={});function JG(e,t,n,r,i){let a=r===qG.CALLER?`the embed's own filter`:`the relationship's foreign key`,{operation:o,resourceType:s}=e;if(vl(o)===W.COUNT)throw HG(`"${s}"'s ${String(o.operationIdentifier)} can only be confined by a pinned filter (${a}), and a count is rendered without the pinned filters, so it would count every row the reader may read. Embed its LIST, or route the relationship under the record.`,{hostResourceType:i,targetResourceType:s,pins:Object.keys(t)});let c=UG(o,s,n),l=Object.keys(t).find(e=>!c.has(e));if(l!==void 0&&r===qG.CALLER)throw HG(`"${s}" is embedded with its own filter "${l}", which its ${String(o.operationIdentifier)} does not admit (it is not in the operation's filterFields), so the backend would drop it and list every row the reader may read. Declare "${l}" in the operation's filterFields, or confine the embed by a filter it declares.`,{targetResourceType:s,refusedKey:l,operationIdentifier:o.operationIdentifier});if(l!==void 0)throw HG(`"${s}"${i?` is placed on a "${i}" record, but the`:`'s`} ${String(o.operationIdentifier)} route its request would take does not name the record (the relationship is standalone, or its context policy is disabled, and no route under the record can be selected) and the operation does not admit "${l}" as a filter (${a}), so nothing can confine it to this record's rows: embedding it would list every row the reader may read. Declare "${l}" in the operation's filterFields (the embed then pins it to the record), or route the relationship under the record.`,{hostResourceType:i,targetResourceType:s,refusedKey:l,operationIdentifier:o.operationIdentifier});let u=Object.keys(t).find(n=>e.pinnedFilters?.[n]!==void 0&&e.pinnedFilters[n]!==t[n]);if(u!==void 0)throw HG(`"${s}" is pinned on "${u}" twice, to "${e.pinnedFilters?.[u]}" and to "${t[u]}", so the embed cannot tell which rows it lists.`,{hostResourceType:i,targetResourceType:s,conflictingKey:u});return{...e,pinnedFilters:{...e.pinnedFilters??{},...t}}}function YG(e){let{searchOperation:t}=e;if(!t)return!1;let n=Object.keys(e.pinnedFilters??{});if(n.length>0){let r=UG(t,e.resourceType,e.registry);if(!n.every(e=>r.has(e)))return!1}let r=t=>V.selectOperationUrlInitiatorInfo({initiatorInfos:t.initiatorInfos??[],contextualParameters:e.contextualParameters,targetResourceType:e.resourceType,targetDefaultFieldIdentifier:e.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}),i=r(e.listOperation);if(!i)return!0;let a=r(t);if(!a)return!1;let o=new Set(a.parameters.map(e=>e.fieldIdentifier));return i.parameters.every(e=>o.has(e.fieldIdentifier))}function XG(e){let t=e?.wildoError?.context?.message;return typeof t==`string`&&t.length>0?t:e instanceof Error?e.message:void 0}var ZG=({pagination:e,onPaginationChange:t,className:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_PAGINATION}),a=(e.page-1)*e.limit+1,o=Math.min(e.page*e.limit,e.total),s=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page-1}))},[t]),c=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page+1}))},[t]);return e.total<=e.limit||!i?null:(0,$.jsxs)(`nav`,{"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`paginationLabel`),className:U(`flex items-center justify-between`,n),children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"aria-live":`polite`,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`showing`,{from:a,to:o,total:e.total})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:e.page<=1,"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`previousPage`),onClick:s,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`previous`)}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:e.page>=e.totalPages,"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`nextPage`),onClick:c,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`next`)})]})]})};function QG({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_PAGINATION,`ResourceLayout_Pagination`)(e);return(0,$.jsx)(n,{...t})}function $G(e,t){let n=hc();return _m(n.interactiveState?.emptyDisplay)===`placeholder`&&eK(e,t)}function eK(e,t){return e?.primaryAction!==!1&&t}var tK=G(B.RESOURCES_LAYOUTS_EMPTY_STATE,`ResourceEmptyState`);function nK({resourceType:e,config:t,hasCreateOperation:n=!1,onCreateAction:r,variant:i=`default`,title:a,description:o,preset:s=q.DEFAULT}){let{tResourceEmptyState:c,tResourceOperation:l,tComponent:u,isReady:d}=K({component:[B.RESOURCES_LAYOUTS_EMPTY_STATE,B.RESOURCES_LAYOUTS_LIST],resource:e}),{activateFlow:f}=_U(),p=hc(),m=_m(p.interactiveState?.emptyDisplay),h=(0,Q.useMemo)(()=>a||c(e,`title`)||yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noItems`}),[a,e,c,u]),g=(0,Q.useMemo)(()=>a?o:c(e,`description`),[a,o,e,c]),_=eK(t,n),v=(0,Q.useMemo)(()=>{if(_)return l(e,W.CREATE,`title`)},[_,e,l]),y=(0,Q.useMemo)(()=>{if(t?.icon)return t.icon},[t?.icon]),b=(0,Q.useMemo)(()=>{if(!t?.secondaryAction)return;let{type:n,target:r}=t.secondaryAction,i=c(e,`secondaryActionLabel`);if(n===Ur.LINK)return{label:i,onClick:()=>{window.open(r,`_blank`,`noopener,noreferrer`)}};if(n===Ur.GUIDANCE)return{label:i,onClick:()=>f(r)}},[t?.secondaryAction,e,c,f]),x=tK(s);return!d||m===`render-children`||joe(m)?null:(0,$.jsx)(x,{title:h,description:g,iconRef:y,primaryActionLabel:v,onPrimaryAction:_?r:void 0,showPrimaryAction:_,secondaryAction:b,variant:i,hidden:Yp(m),style:Yp(m)?{display:`none`}:void 0})}function rK(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function iK(e){return e.isSearchActive||Object.values(e.filterValues).some(rK)}function aK(e){return!(e.hasLoadedOnce&&e.itemCount===0&&!e.isNarrowed&&e.emptyStateOffersCreate)}var oK=300;function sK({enabled:e,debounceMs:t=oK,onDebouncedChange:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{o(e=>(e!==r&&n?.(),r))},t);return()=>clearTimeout(e)},[r,t]);let s=(0,Q.useCallback)(e=>{i(e.target.value)},[]),c=(0,Q.useCallback)(()=>{i(``)},[]);return{query:r,debouncedQuery:a,isVisible:e,isActive:a.length>0,handleChange:s,handleClear:c}}var cK=({query:e,onChange:t,onClear:n,resourceType:r,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s})=>{let{tComponent:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:u}=Mf(),d=u(H.SEARCH,{size:ca.SM}),f=u(H.X_MARK,{size:ca.SM});if(!l)return null;let p=c(B.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`);return(0,$.jsx)(QM,{type:`text`,value:e,onChange:t,placeholder:p,"aria-label":p,"data-slot":`collection-toolbar-search-input`,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s,prefix:d,suffix:e?(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:n,"aria-label":c(B.RESOURCES_LAYOUTS_LIST,`clearSearch`),className:`me-1`,children:f}):void 0})};function lK(e){let{resolvedRegionalPreferences:t}=K(),{registry:n}=fm(),r=n.resourceConfigurations[e],i=r?.mainSchema,a=r?.inheritenceSchemaDefinition,o=(0,Q.useMemo)(()=>PG(i,a),[i,a]),s=t?.timezone,c=(0,Q.useContext)(ah)?.user?._id,l=(0,Q.useMemo)(()=>c?{userId:String(c)}:{},[c]);return(0,Q.useMemo)(()=>({timeZone:s,calendarDateFields:o,viewer:l}),[s,o,l])}var uK=864e5;function dK(e,t){return new Date(e.getTime()+t*uK)}function fK(e,t,n,r){let i=e=>n?e:jl.startOfZonedDay(e,r),a={};return e!==void 0&&(a.startDate=i(e)),t!==void 0&&(a.endDate=new Date(i(dK(t,1)).getTime()-1)),a}function pK(e){let t=e instanceof Date?e:typeof e==`string`&&e!==``?new Date(e):void 0;return t&&!Number.isNaN(t.getTime())?t:void 0}function mK(e,t,n){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return;let r=e,i=pK(r.startDate),a=pK(r.endDate);if(!i&&!a)return;let o=e=>jl.calendarDateToday({timezone:t?`UTC`:n},e);return{firstDay:i?o(i):void 0,lastDay:a?o(a):void 0}}function hK(e){return typeof e==`string`&&Pt(e)!==void 0?e:void 0}function gK(e){let t=hK(e);if(t!==void 0)return{startMonth:t,endMonth:t};if(typeof e!=`object`||!e||Array.isArray(e))return{};let{startMonth:n,endMonth:r}=e,i=hK(n),a=hK(r);return{...i===void 0?{}:{startMonth:i},...a===void 0?{}:{endMonth:a}}}function _K(e,t,n){let r={...gK(e)},i=hK(n);return i===void 0?delete r[t]:r[t]=i,r.startMonth===void 0&&r.endMonth===void 0?void 0:r}var vK={[Kc.TODAY]:e=>({firstDay:e,lastDay:e}),[Kc.YESTERDAY]:e=>({firstDay:dK(e,-1),lastDay:dK(e,-1)}),[Kc.LAST_7_DAYS]:e=>({firstDay:dK(e,-6),lastDay:e}),[Kc.LAST_30_DAYS]:e=>({firstDay:dK(e,-29),lastDay:e}),[Kc.THIS_MONTH]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),lastDay:e}),[Kc.THIS_YEAR]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),0,1)),lastDay:e}),[Kc.BEFORE_TODAY]:e=>({lastDay:dK(e,-1)}),[Kc.BEFORE_NOW]:e=>({lastDay:dK(e,-1)}),[Kc.NEXT_7_DAYS]:e=>({firstDay:e,lastDay:dK(e,6)}),[Kc.NEXT_30_DAYS]:e=>({firstDay:e,lastDay:dK(e,29)})},yK=new Set([Kc.BEFORE_NOW]),bK;(function(e){e.EXACT_BOUNDS=`exact_bounds`,e.ENDS_EARLIER_TODAY=`ends_earlier_today`})(bK||={});function xK(e,t,n,r){let i=r.calendarDateFields.has(t);return yK.has(e)&&!i?{window:{endDate:new Date(r.now.getTime())},readBack:bK.ENDS_EARLIER_TODAY}:{window:CK(vK[e](n),i,r.timeZone),readBack:bK.EXACT_BOUNDS}}function SK(e,t,n){if(!FK(e)||e.startDate!==void 0||e.endDate===void 0)return!1;let r=fK(t,void 0,!1,n.timeZone).startDate,i=e.endDate.getTime();return r!==void 0&&i>=r.getTime()&&i<=n.now.getTime()}function CK(e,t,n){return fK(e.firstDay,e.lastDay,t,n)}var wK={[gl.THIS_MONTH]:e=>({first:e,last:e}),[gl.LAST_MONTH]:e=>({first:e-1,last:e-1}),[gl.NEXT_MONTH]:e=>({first:e+1,last:e+1}),[gl.THIS_QUARTER]:e=>({first:e-e%3,last:e-e%3+2}),[gl.LAST_QUARTER]:e=>({first:e-e%3-3,last:e-e%3-1}),[gl.LAST_3_MONTHS]:e=>({first:e-2,last:e}),[gl.LAST_12_MONTHS]:e=>({first:e-11,last:e}),[gl.YEAR_TO_DATE]:e=>({first:e-e%12,last:e}),[gl.THIS_YEAR]:e=>({first:e-e%12,last:e-e%12+11})};function TK(e){return qi(Math.floor(e/12),e%12+1)}function EK(e,t){let n=wK[e](t.getUTCFullYear()*12+t.getUTCMonth());return{startMonth:TK(n.first),endMonth:TK(n.last)}}var DK={[ds.CURRENT_USER]:e=>e.userId!==void 0&&e.userId.length>0?e.userId:void 0};function OK(e){return typeof e==`object`&&!!e&&`contextValue`in e}function kK(e){return typeof e==`object`&&!!e&&`relativeMonthRange`in e}function AK(e){return typeof e==`object`&&!!e&&`relativeRange`in e}function jK(e,t){let n=jl.calendarDateToday({timezone:t.timeZone},t.now),r={};for(let[i,a]of Object.entries(e.filters))if(AK(a))r[i]=xK(a.relativeRange,i,n,t).window;else if(kK(a))r[i]=EK(a.relativeMonthRange,n);else if(OK(a)){let e=DK[a.contextValue](t.viewer);if(e===void 0)return null;r[i]=e}else r[i]=a;return r}function MK(e,t){return Object.values(e.filters).every(e=>!OK(e)||DK[e.contextValue](t)!==void 0)}function NK(e,t){if(FK(t)){if(!FK(e))return!1;let n=(e,t)=>e===void 0?t===void 0:t!==void 0&&e.getTime()===t.getTime();return n(e.startDate,t.startDate)&&n(e.endDate,t.endDate)}if(IK(t))return IK(e)&&e.min===t.min&&e.max===t.max;if(PK(t)||PK(e)){let n=gK(e),r=gK(t);return(n.startMonth!==void 0||n.endMonth!==void 0)&&n.startMonth===r.startMonth&&n.endMonth===r.endMonth}return e===t}function PK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length>0&&t.every(([e,t])=>(e===`startMonth`||e===`endMonth`)&&typeof t==`string`&&Pt(t)!==void 0)}function FK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length>0&&t.every(([e,t])=>(e===`startDate`||e===`endDate`)&&t instanceof Date)}function IK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.keys(e);return t.length>0&&t.every(e=>e===`min`||e===`max`)}function LK(e,t,n){let r=jK(e,n);if(r===null)return!1;let i=Object.entries(r),a=jl.calendarDateToday({timezone:n.timeZone},n.now);return i.length>0&&i.every(([r,i])=>{let o=e.filters[r];return o!==void 0&&AK(o)&&xK(o.relativeRange,r,a,n).readBack===bK.ENDS_EARLIER_TODAY?SK(t[r],a,n):NK(t[r],i)})}function RK(e,t,n){let r=jK(e,n);if(r===null)return t;let i={...t};if(LK(e,t,n)){for(let e of Object.keys(r))delete i[e];return i}return{...i,...r}}function zK(e,t,n){let r=new Set;for(let i of e)if(LK(i,t,n))for(let e of Object.keys(i.filters))r.add(e);return r}var BK=/^(\d{4})-(\d{2})-(\d{2})$/;function VK(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:{date:e,calendarDate:t};if(typeof e!=`string`||e===``)return null;let n=BK.exec(e),r=n?new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]))):new Date(e);return Number.isNaN(r.getTime())?null:{date:r,calendarDate:n!==null}}function HK(e,t,n=!1){let r=e=>t(e.date,{calendarDate:e.calendarDate});if(typeof e==`object`&&e&&!(e instanceof Date)){let t=e,i=VK(t.startDate,n),a=VK(t.endDate,n);if(!i&&!a)return null;if(i&&a){let e=r(i),t=r(a);return e===t?e:`${e} – ${t}`}return i?`≥ ${r(i)}`:`≤ ${r(a)}`}let i=VK(e,n);return i?r(i):null}var UK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,presetFilters:i,className:a})=>{let{tResourceFieldDisplay:o,tResourceFieldEnumValue:s,tComponent:c,formatDate:l,isReady:u}=K({component:B.RESOURCES_LAYOUTS_FILTERS,resource:e}),{renderIcon:d}=Mf(),f=e=>c(B.RESOURCES_LAYOUTS_FILTERS,e),p=lK(e),m=p.calendarDateFields,h=(0,Q.useMemo)(()=>{if(!i||i.length===0)return t;let e=zK(i,n,{now:new Date,...p});return t.filter(t=>!e.has(t.fieldName))},[t,i,n,p]),g=(0,Q.useMemo)(()=>h.filter(e=>{let t=n[e.fieldName];return t!=null&&t!==``}),[h,n]),_=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=o(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,o]),v=(0,Q.useCallback)(()=>{let e={...n};for(let t of h)delete e[t.fieldName];r(e)},[n,h,r]),y=(0,Q.useCallback)(e=>{let t={...n};delete t[e],r(t)},[n,r]);if(!u||g.length===0)return null;let b=d(H.X_MARK,{size:ca.XS});return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm flex-wrap`,a),children:[g.map(t=>{let r=t.fieldName,i=n[r],a=_[r]||r,o=String(i);if(t.fieldType===MG.REFERENCE)o=(0,$.jsx)(WK,{field:t,value:String(i)});else if(t.fieldType===MG.ENUM){let n=s(e,r,String(i),t.schema);typeof n==`string`&&(o=n)}else if(t.fieldType===MG.BOOLEAN)o=f(i?`booleanYes`:`booleanNo`);else if(t.fieldType===MG.YEAR_MONTH){let e=l(String(i),{yearMonth:!0});e!==``&&(o=e)}else if(t.fieldType===MG.YEAR_MONTH_RANGE){let{startMonth:e,endMonth:t}=gK(i),n=e===void 0?``:l(e,{yearMonth:!0}),r=t===void 0?``:l(t,{yearMonth:!0});n!==``&&r!==``?o=e===t?n:`${n} – ${r}`:n===``?r!==``&&(o=`≤ ${r}`):o=`≥ ${n}`}else if(t.fieldType===MG.DATE){let e=HK(i,l,m.has(t.fieldName));e!==null&&(o=e)}else if(t.fieldType===MG.NUMBER_RANGE){let e=i??{};o=e.min!==void 0&&e.max!==void 0?`${e.min} – ${e.max}`:e.min===void 0?`≤ ${e.max}`:`≥ ${e.min}`}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-xs ps-element-sm pe-element-xs py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[a,`:`]}),o,(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:()=>y(r),className:`ms-0.5 h-4 w-4 p-0`,"aria-label":f(`removeFilter`),children:b})]},r)}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:v,className:`text-xs text-muted-foreground`,children:f(`clearAll`)})]})},WK=({field:e,value:t})=>{let{getDisplayLabel:n,isLoadingCurrentValue:r}=vV({schema:e.schema,name:e.fieldName,value:t,targetResourceType:e.referenceTargetResourceType});return r?(0,$.jsx)($.Fragment,{children:`…`}):(0,$.jsx)($.Fragment,{children:n(t)})};function GK(e,t){return(t?t.map(t=>e[t]):Object.values(e)).filter(e=>e!=null&&e!==``).length}var KK=`filters-panel`,qK=({activeCount:e,isExpanded:t,onToggle:n,className:r})=>{let{tComponent:i,isReady:a}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),{renderIcon:o}=Mf();if(!a)return null;let s=(e=>i(B.RESOURCES_LAYOUTS_FILTERS,e))(`filters`);return(0,$.jsxs)(X,{variant:J.GHOST,size:Y.SM,onClick:n,"aria-expanded":t,"aria-controls":KK,"aria-label":s,title:s,"data-slot":`collection-toolbar-filters-trigger`,className:U(`gap-element-sm`,r),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(H.FILTER,{size:ca.SM})}),e>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-element-xs text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:e})]})},JK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFieldDisplay:a,tResourceFieldEnumValue:o,tComponent:s,resolvedRegionalPreferences:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_FILTERS,resource:e}),{timeZone:u,calendarDateFields:d}=lK(e),f=e=>s(B.RESOURCES_LAYOUTS_FILTERS,e),p=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=a(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,a]),m=(0,Q.useCallback)((e,t)=>{let i={...n};t===``||t==null?delete i[e]:i[e]=t,r(i)},[n,r]);return!l||t.length===0?null:(0,$.jsx)(`div`,{id:KK,className:U(`flex items-start gap-field flex-wrap p-card bg-muted/50 rounded-lg border border-border`,i),children:t.map(t=>(0,$.jsx)(`div`,{"data-filter-field":t.fieldName,className:`contents`,children:(0,$.jsx)($K,{field:t,value:n[t.fieldName],label:p[t.fieldName],resourceType:e,onChange:e=>m(t.fieldName,e),tResourceFieldEnumValue:o,tc:f,calendarDateField:d.has(t.fieldName),timeZone:u,dateFormat:c?.dateFormat},t.fieldName)},t.fieldName))})},YK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let[a,o]=(0,Q.useState)(!1),s=GK(n,t.map(e=>e.fieldName));return t.length===0?null:(0,$.jsxs)(`div`,{className:U(`space-y-element-sm`,i),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm flex-wrap`,children:[(0,$.jsx)(qK,{activeCount:s,isExpanded:a,onToggle:()=>o(e=>!e)}),(0,$.jsx)(UK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]}),a&&(0,$.jsx)(JK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]})},XK={[tc.TOGGLE]:bs.TOGGLE,[tc.RADIO]:bs.RADIO,[tc.SWITCH]:bs.SELECT,[tc.CHECKBOX]:bs.SELECT},ZK;(function(e){e.ANY=``,e.YES=`true`,e.NO=`false`})(ZK||={});function QK(e){return kd(ZK).enumUI({edit:{editMode:XK[Br(e)]}})}var $K=({field:e,value:t,label:n,resourceType:r,onChange:i,tResourceFieldEnumValue:a,tc:o,calendarDateField:s,timeZone:c,dateFormat:l})=>{let[u,d]=(0,Q.useState)(t??``),f=(0,Q.useRef)(void 0),p=(0,Q.useId)();(0,Q.useEffect)(()=>{d(t??``)},[t]);let m=(0,Q.useCallback)(e=>{let t=e.target.value;d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{i(t||void 0)},400)},[i]),h=(0,Q.useCallback)(e=>{let t=e.target.value;d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{i(t?Number(t):void 0)},400)},[i]);(0,Q.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let g=(0,Q.useMemo)(()=>QK(e.schema),[e.schema]);switch(e.fieldType){case MG.REFERENCE:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[200px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(_I,{name:e.fieldName,schema:e.schema,value:typeof t==`string`&&t!==``?t:void 0,onChange:e=>i(typeof e==`string`&&e!==``?e:void 0),targetResourceType:e.referenceTargetResourceType,placeholder:o(`anyValue`),controlSize:Zd.SM})]});case MG.STRING:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[160px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(QM,{type:`text`,value:u,onChange:m})]});case MG.NUMBER:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[120px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(QM,{type:`number`,value:u,onChange:h})]});case MG.BOOLEAN:{let r=[{value:ZK.ANY,label:o(`booleanAny`)},{value:ZK.YES,label:o(`booleanYes`)},{value:ZK.NO,label:o(`booleanNo`)}];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[100px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(rI,{name:e.fieldName,schema:g,options:r,value:t===void 0?ZK.ANY:String(t),onChange:e=>i(e===ZK.ANY?void 0:e===ZK.YES),controlSize:Zd.SM})]})}case MG.ENUM:{let s=[{value:``,label:o(`enumAll`)},...(e.enumValues??[]).map(t=>{let n=a(r,e.fieldName,t,e.schema);return{value:t,label:typeof n==`string`?n:t}})];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[140px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(rI,{name:e.fieldName,schema:e.schema,options:s,value:t??``,onChange:e=>i(e||void 0),controlSize:Zd.SM})]})}case MG.DATE:{let r=mK(t,s,c),a=r?{from:r.firstDay,to:r.lastDay}:void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[200px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(uN,{name:e.fieldName,schema:e.schema,value:a,onChange:e=>{let t=e?.from??e?.to;i(t?fK(t,e?.to??t,s,c):void 0)},placeholder:o(`anyValue`),dateFormat:l,timeZone:c,controlSize:Zd.SM})]})}case MG.YEAR_MONTH:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[240px]`,children:[(0,$.jsx)(`label`,{id:p,className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(PI,{name:e.fieldName,schema:e.schema,value:typeof t==`string`?t:void 0,onChange:i,clearable:!0,labelledBy:p,controlId:`${p}-month`,monthPlaceholder:o(`anyValue`),controlSize:Zd.SM})]});case MG.YEAR_MONTH_RANGE:{let r=gK(t),a=`${p}-start`,s=`${p}-end`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[240px]`,children:[(0,$.jsx)(`label`,{id:p,className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(`span`,{id:a,className:`text-xs text-muted-foreground`,children:o(`monthRangeStart`)}),(0,$.jsx)(PI,{name:`${e.fieldName}.startMonth`,schema:e.schema,value:r.startMonth,onChange:e=>i(_K(t,`startMonth`,e)),clearable:!0,labelledBy:`${p} ${a}`,controlId:`${p}-start-month`,monthPlaceholder:o(`anyValue`),controlSize:Zd.SM}),(0,$.jsx)(`span`,{id:s,className:`text-xs text-muted-foreground`,children:o(`monthRangeEnd`)}),(0,$.jsx)(PI,{name:`${e.fieldName}.endMonth`,schema:e.schema,value:r.endMonth,onChange:e=>i(_K(t,`endMonth`,e)),clearable:!0,labelledBy:`${p} ${s}`,controlId:`${p}-end-month`,monthPlaceholder:o(`anyValue`),controlSize:Zd.SM})]})}case MG.NUMBER_RANGE:{let e=t??{},r=(t,n)=>{let r={...e,[t]:n===``?void 0:Number(n)};i(r.min!==void 0||r.max!==void 0?{...r.min===void 0?{}:{min:r.min},...r.max===void 0?{}:{max:r.max}}:void 0)};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[180px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,children:[(0,$.jsx)(QM,{type:`number`,"aria-label":o(`rangeMinimum`),placeholder:o(`rangeMinimum`),value:e.min??``,onChange:e=>r(`min`,e.target.value)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`–`}),(0,$.jsx)(QM,{type:`number`,"aria-label":o(`rangeMaximum`),placeholder:o(`rangeMaximum`),value:e.max??``,onChange:e=>r(`max`,e.target.value)})]})]})}default:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[160px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(QM,{type:`text`,value:u,onChange:m})]})}},eq=`__wildo-quick-filter-all__`,tq=bd(),nq=`@max-[32rem]/collection-toolbar:hidden`,rq=`hidden @max-[32rem]/collection-toolbar:block`,iq=({resourceType:e,field:t,value:n,onChange:r,className:i})=>{let{tComponent:a,tResourceFieldDisplay:o,tResourceFieldEnumValue:s,isReady:c}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),l=(0,Q.useCallback)(e=>{typeof e==`string`&&e!==``&&r(e===eq?void 0:e)},[r]);if(!c)return null;let u=t.enumValues??[];if(u.length===0)return null;let d=o(e,t.fieldName,`label`),f=a(B.RESOURCES_LAYOUTS_FILTERS,`enumAll`),p=a(B.RESOURCES_LAYOUTS_FILTERS,`quickFilterLabel`,{field:d}),m=[{value:eq,label:f},...u.map(n=>({value:n,label:s(e,t.fieldName,n,t.schema)}))],h=n??eq;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bO,{type:_O.SINGLE,value:h,onValueChange:l,size:Y.SM,rovingFocus:!0,loop:!0,className:U(`justify-start`,nq,i),"data-slot":`collection-quick-filter`,"aria-label":p,children:m.map(e=>(0,$.jsx)(xO,{value:e.value,size:Y.SM,children:e.label},e.value))}),(0,$.jsx)(`div`,{className:U(rq,i),"data-slot":`collection-quick-filter-select`,children:(0,$.jsx)(mF,{name:`quick-filter-${t.fieldName}`,schema:tq,options:m,value:h,onChange:e=>l(e),"aria-label":p,size:Zd.SM})})]})},aq=({resourceType:e,presets:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFilterPreset:a}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),o=new Date,s=lK(e),c=(0,Q.useMemo)(()=>t.filter(e=>LK(e,n,{now:o,...s})).map(e=>e.ref),[t,n,s]),l=(0,Q.useCallback)(e=>{let i=Array.isArray(e)?e:[e],a=i.find(e=>!c.includes(e))??c.find(e=>!i.includes(e));if(!a)return;let o=t.find(e=>e.ref===a);o&&r(RK(o,n,{now:new Date,...s}))},[c,t,n,r,s]);return t.length===0?null:(0,$.jsx)(bO,{type:_O.MULTIPLE,appearance:vO.CHIPS,value:c,onValueChange:l,size:Y.SM,orientation:mu.HORIZONTAL,className:i,"data-slot":`collection-filter-presets`,children:t.map(t=>{let n=a(e,t.ref,`label`);return(0,$.jsx)(xO,{value:t.ref,size:Y.SM,"data-preset":t.ref,disabled:!MK(t,s.viewer),children:n},t.ref)})})},oq=Qs(B.LOW_LEVEL_POPOVER,`Popover`,[`Trigger`,`Content`,`Anchor`]);function sq({preset:e=q.DEFAULT,...t}){let n=oq(e);return(0,$.jsx)(n,{...t})}var cq=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=oq(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});cq.displayName=`PopoverTrigger`;var lq=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=oq(e);return(0,$.jsx)(r.Content,{...t,ref:n})});lq.displayName=`PopoverContent`;function uq({preset:e=q.DEFAULT,...t}){let n=oq(e);return(0,$.jsx)(n.Anchor,{...t})}function dq(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var fq={activationConstraint:{distance:8}},pq={coordinateGetter:uF};function mq({rule:e,index:t,reorderable:n,label:r,reorderLabel:i,ascLabel:a,descLabel:o,removeLabel:s,onToggleDirection:c,onRemove:l,renderIcon:u}){let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=cF({id:e.field,disabled:!n}),_=e.direction===`asc`,v={transform:dq(m),transition:h,opacity:g?.5:void 0,zIndex:g?10:void 0,position:`relative`};return(0,$.jsxs)(`div`,{ref:p,style:v,className:`flex items-center gap-element-sm rounded-md bg-muted/40 px-element-sm py-1`,children:[n&&(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:bg-accent/50 hover:text-muted-foreground`,Rg(d_.OFFSET),`active:cursor-grabbing`),"aria-label":i,...d,...f,children:u(H.GRIP_VERTICAL,{size:ca.SM})}),(0,$.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:r}),(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,onClick:()=>c(t),className:`h-6 gap-1 px-2 text-xs`,children:[u(_?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.XS}),_?a:o]}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`h-5 w-5 p-0 text-muted-foreground`,onClick:()=>l(t),"aria-label":s,children:u(H.X_MARK,{size:ca.XS})})]})}var hq=({resourceType:e,sortFields:t,currentSorts:n,onSortChange:r,className:i})=>{let{tResourceFieldDisplay:a,tComponent:o,isReady:s}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:e}),{renderIcon:c}=Mf(),[l,u]=(0,Q.useState)(!1),d=QN(ZN(AP,fq),ZN(EP,pq)),f=(0,Q.useCallback)(t=>a(e,t,`label`),[a,e]),p=(0,Q.useMemo)(()=>t.filter(e=>!n.some(t=>t.field===e)),[t,n]),m=(0,Q.useMemo)(()=>n.map(e=>e.field),[n]),h=(0,Q.useCallback)(e=>{r(n.map((t,n)=>n===e?{...t,direction:t.direction===`asc`?`desc`:`asc`}:t))},[n,r]),g=(0,Q.useCallback)(e=>{r(n.filter((t,n)=>n!==e))},[n,r]),_=(0,Q.useCallback)(e=>{let{active:t,over:i}=e;if(i&&t.id!==i.id){let e=n.findIndex(e=>e.field===t.id),a=n.findIndex(e=>e.field===i.id);e!==-1&&a!==-1&&r($P([...n],e,a))}},[n,r]),v=(0,Q.useCallback)(e=>{r([...n,{field:e,direction:`asc`}])},[n,r]),y=(0,Q.useCallback)(()=>r([]),[r]);if(t.length===0||!s)return null;let b=e=>o(B.RESOURCES_LAYOUTS_LIST,e),x=n.length,S=x>1,C=c(H.ARROWS_UP_DOWN,{size:ca.SM}),w=b(`sortAsc`),T=b(`sortDesc`),E=b(`removeSort`),D=b(`reorderSort`);return(0,$.jsxs)(sq,{open:l,onOpenChange:u,children:[(0,$.jsx)(cq,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-label":b(`sortLabel`),"data-slot":`collection-toolbar-sort-trigger`,className:U(`gap-1.5`,i),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:C}),(0,$.jsx)(`span`,{children:b(`sortLabel`)}),x>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:x})]})}),(0,$.jsxs)(lq,{align:Rr.START,className:`w-72 p-element-sm space-y-element-sm`,onInteractOutside:e=>{let t=e.detail.originalEvent?.type;t!==`pointerdown`&&t!==`mousedown`&&t!==`touchstart`&&t!==`click`&&e.preventDefault()},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-element-sm`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:b(`sortLabel`)}),x>0&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:y,className:`h-auto py-0.5 text-xs text-muted-foreground`,children:b(`clearSort`)})]}),(0,$.jsx)(ZP,{sensors:d,collisionDetection:aP,onDragEnd:_,children:(0,$.jsx)(oF,{items:m,strategy:rF,children:(0,$.jsx)(`div`,{className:`space-y-element-sm`,children:n.map((e,t)=>(0,$.jsx)(mq,{rule:e,index:t,reorderable:S,label:f(e.field),reorderLabel:D,ascLabel:w,descLabel:T,removeLabel:E,onToggleDirection:h,onRemove:g,renderIcon:c},e.field))})})}),p.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-border/50 pt-element-sm`,children:[(0,$.jsx)(`span`,{className:`px-element-sm text-xs text-muted-foreground`,children:b(`addSort`)}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1 px-element-sm`,children:p.map(e=>(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>v(e),className:`h-6 gap-1 px-2 text-xs`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:c(H.PLUS,{size:ca.XS})}),f(e)]},e))})]})]})]})},gq=[{mode:_u.CARDS,icon:H.VIEW_LIST,labelKey:`viewCards`},{mode:_u.TABLE,icon:H.VIEW_TABLE,labelKey:`viewTable`},{mode:_u.BOARD,icon:H.VIEW_BOARD,labelKey:`viewBoard`},{mode:_u.CALENDAR,icon:H.VIEW_CALENDAR,labelKey:`viewCalendar`},{mode:_u.TIMELINE,icon:H.VIEW_TIMELINE,labelKey:`viewTimeline`}],_q=[_u.CARDS,_u.TABLE],vq=e=>gq.some(t=>t.mode===e),yq=({viewMode:e,onViewModeChange:t,availableModes:n=_q,className:r})=>{let{tComponent:i,isReady:a}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Mf();if(!a)return null;let s=e=>i(B.RESOURCES_LAYOUTS_LIST,e);return(0,$.jsx)(bO,{type:_O.SINGLE,value:e,onValueChange:r=>{typeof r==`string`&&vq(r)&&n.includes(r)&&r!==e&&t(r)},size:Y.SM,"aria-label":s(`viewModeLabel`),className:U(`shrink-0`,r),"data-slot":`collection-view-mode`,children:gq.filter(({mode:e})=>n.includes(e)).map(({mode:e,icon:t,labelKey:n})=>{let r=s(n);return(0,$.jsx)(xO,{value:e,size:Y.SM,"aria-label":r,title:r,children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(t,{size:ca.SM})})},e)})})};function bq({count:e,onClear:t,matchAllOffer:n,isMatchAllSelected:r,className:i}){let{tComponent:a}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Mf();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm`,i),"data-slot":`collection-selection`,children:[(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:U(`text-sm font-medium text-muted-foreground whitespace-nowrap`,e===0&&`sr-only`),children:e>0?a(B.RESOURCES_LAYOUTS_LIST,r?`allMatchingSelected`:`selectedCount`,{count:e}):``}),n&&!r&&(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:n.onSelectAllMatching,children:a(B.RESOURCES_LAYOUTS_LIST,`selectAllMatching`,{count:n.matchedCount})}),e>0&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:t,"aria-label":a(B.RESOURCES_LAYOUTS_LIST,`clearSelection`),children:o(H.X_MARK,{size:ca.XS})})]})}function xq(e,t){return e===0||t===0?!1:t>=e||`indeterminate`}function Sq({state:e,onToggle:t,className:n}){let{tComponent:r}=K({component:B.RESOURCES_LAYOUTS_LIST}),i=r(B.RESOURCES_LAYOUTS_LIST,`selectAll`);return(0,$.jsx)(`span`,{className:U(`inline-flex shrink-0 items-center`,bG,n),"data-slot":`collection-select-all`,title:i,children:(0,$.jsx)(TI,{checked:e,onCheckedChange:()=>t(),"aria-label":i})})}var Cq;(function(e){e.LABELLED=`labelled`,e.ICONS=`icons`,e.CAPPED=`capped`})(Cq||={});var Pge={[Cq.LABELLED]:Cq.ICONS,[Cq.ICONS]:Cq.CAPPED,[Cq.CAPPED]:Cq.CAPPED},wq=(0,Q.createContext)(null);function Tq({density:e,onActionSetChange:t,onBackgroundRunChange:n,children:r}){let i=(0,Q.useMemo)(()=>({density:e,reportActionSet:t,reportBackgroundRun:n}),[e,t,n]);return(0,$.jsx)(wq.Provider,{value:i,children:r})}function Fge(){return(0,Q.useContext)(wq)?.density??null}function Ige(e){let t=(0,Q.useContext)(wq)?.reportActionSet;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e])}var Eq;(function(e){e.NONE=`none`,e.WORKING=`working`,e.FINISHED=`finished`})(Eq||={});function Lge(e){let t=(0,Q.useContext)(wq)?.reportBackgroundRun;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e]),(0,Q.useLayoutEffect)(()=>()=>t?.(Eq.NONE),[t])}function Dq(e){let[t,n]=(0,Q.useState)(e);e&&!t&&n(!0);let[r,i]=(0,Q.useState)(Eq.NONE);return{isBulkBarMounted:e||t,backgroundRunState:r,onBackgroundRunChange:i}}function Oq(e,t){let[n,r]=(0,Q.useState)(Cq.LABELLED),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null);return(0,Q.useLayoutEffect)(()=>{if(s===l.current)return;let e=l.current!==null;l.current=s,e&&r(Cq.LABELLED)},[s]),(0,Q.useLayoutEffect)(()=>{if(!t){r(Cq.LABELLED);return}let n=e.current;n&&n.scrollWidth>n.clientWidth+1&&r(e=>Pge[e])},[t,n,i,e]),(0,Q.useEffect)(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let i=new ResizeObserver(()=>{let e=n.clientWidth;o.current!==null&&Math.abs(e-o.current)>1&&r(Cq.LABELLED),o.current=e,a(e=>e+1)});if(typeof i?.observe==`function`){i.observe(n);for(let e of Array.from(n.children))i.observe(e);return()=>i.disconnect?.()}},[t,e]),(0,Q.useMemo)(()=>({density:n,reportActionSet:c}),[n])}var Rge=`motion-safe:transition-[width] motion-safe:duration-[var(--motion-duration-normal)] motion-safe:ease-[var(--motion-easing-default)] motion-reduce:transition-none`,zge=`@container/collection-toolbar`,Bge=`@max-[32rem]/collection-toolbar:order-last @max-[32rem]/collection-toolbar:basis-full`,Vge=`@max-[32rem]/collection-toolbar:hidden`,kq;(function(e){e.REFINE=`refine`,e.SELECTION=`selection`})(kq||={});var Hge=({resourceType:e,quickFilter:t,presetFilters:n,search:r,filterFields:i,filterPanel:a=qo.OFFERED,filterValues:o,onFiltersChange:s,sort:c,viewMode:l,primaryAction:u,selection:d,selectAll:f,bulkActions:p,collectionActions:m,className:h})=>{let[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),{tComponent:b}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:x}=Mf(),S=b(B.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`),C=(0,Q.useCallback)(e=>{e.currentTarget.value||_(!1)},[]),w=(0,Q.useCallback)(e=>{e.key===`Escape`&&(r?.onClear(),_(!1),e.currentTarget.blur())},[r]),T=i.length>0,E=T&&a!==qo.HIDDEN,D=!!c&&c.sortFields.length>0,O=GK(o,i.map(e=>e.fieldName)),k=!!r&&(g||!!r.query),A=!!d&&d.count>0,j=!!n&&n.length>0,M=(0,Q.useRef)(null),N=Oq(M,A),P=Dq(A);return(0,$.jsxs)(`div`,{className:U(zge,`flex flex-col gap-element-sm`,h),"data-slot":`collection-toolbar`,children:[t&&(0,$.jsx)(iq,{resourceType:e,field:t.field,value:t.value,onChange:t.onChange}),(0,$.jsxs)(`div`,{ref:M,className:U(`flex items-center gap-element`,A?`flex-nowrap`:`flex-wrap`),"data-slot":`collection-toolbar-row`,"data-mode":A?kq.SELECTION:kq.REFINE,children:[f&&(0,$.jsx)(Sq,{state:f.state,onToggle:f.onToggle}),!A&&(0,$.jsxs)($.Fragment,{children:[r&&!k&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:()=>_(!0),"aria-label":S,title:S,"data-slot":`collection-toolbar-search-trigger`,children:x(H.SEARCH,{size:ca.SM})}),r&&k&&(0,$.jsx)(`div`,{className:U(`overflow-hidden shrink-0 w-64 max-w-full`,Rge),"data-state":`open`,children:(0,$.jsx)(cK,{query:r.query,onChange:r.onChange,onClear:r.onClear,resourceType:e,autoFocus:!0,onFocus:()=>_(!0),onBlur:C,onKeyDown:w})}),E&&(0,$.jsx)(qK,{activeCount:O,isExpanded:v,onToggle:()=>y(e=>!e)}),D&&(0,$.jsx)(hq,{resourceType:e,sortFields:c.sortFields,currentSorts:c.sortStates,onSortChange:c.onSortChange}),j&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:U(`h-5 w-px bg-border`,Vge),"aria-hidden":`true`}),(0,$.jsx)(aq,{resourceType:e,presets:n,currentFilters:o,onFiltersChange:s,className:Bge})]})]}),d&&(0,$.jsx)(bq,{className:`shrink-0`,count:d.count,onClear:d.onClear,...d.matchAllOffer?{matchAllOffer:d.matchAllOffer}:{},...d.isMatchAllSelected?{isMatchAllSelected:!0}:{}}),(l||u||p||m)&&(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-element ms-auto`,children:[l&&!A&&(0,$.jsx)(yq,{viewMode:l.viewMode,onViewModeChange:l.onViewModeChange,availableModes:l.availableModes}),!A&&m,p&&P.isBulkBarMounted&&(0,$.jsx)(Tq,{density:N.density,onActionSetChange:N.reportActionSet,onBackgroundRunChange:P.onBackgroundRunChange,children:p}),!A&&P.backgroundRunState!==Eq.WORKING&&u]})]}),E&&v&&!A&&(0,$.jsx)(JK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s}),T&&(0,$.jsx)(UK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s,...n?{presetFilters:n}:{}})]})};function Aq(e,t){return typeof e==`function`?e(t):e}function jq(e,t){return n=>{t.setState(t=>({...t,[e]:Aq(n,t[e])}))}}function Mq(e){return e instanceof Function}function Uge(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function Wge(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function Nq(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
13
- font-size: .6rem;
14
- font-weight: bold;
15
- color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function Pq(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function Gge(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:Nq(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),Pq(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function Kge(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:Nq(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],Pq(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:Nq(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},Pq(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var Fq=`debugHeaders`;function Iq(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var qge={createTable:e=>{e.getHeaderGroups=Nq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return Lq(t,[...a,...s,...o],e)},Pq(e.options,Fq,`getHeaderGroups`)),e.getCenterHeaderGroups=Nq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),Lq(t,n,e,`center`)),Pq(e.options,Fq,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=Nq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>Lq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),Pq(e.options,Fq,`getLeftHeaderGroups`)),e.getRightHeaderGroups=Nq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>Lq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),Pq(e.options,Fq,`getRightHeaderGroups`)),e.getFooterGroups=Nq(()=>[e.getHeaderGroups()],e=>[...e].reverse(),Pq(e.options,Fq,`getFooterGroups`)),e.getLeftFooterGroups=Nq(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),Pq(e.options,Fq,`getLeftFooterGroups`)),e.getCenterFooterGroups=Nq(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),Pq(e.options,Fq,`getCenterFooterGroups`)),e.getRightFooterGroups=Nq(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),Pq(e.options,Fq,`getRightFooterGroups`)),e.getFlatHeaders=Nq(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),Pq(e.options,Fq,`getFlatHeaders`)),e.getLeftFlatHeaders=Nq(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),Pq(e.options,Fq,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=Nq(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),Pq(e.options,Fq,`getCenterFlatHeaders`)),e.getRightFlatHeaders=Nq(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),Pq(e.options,Fq,`getRightFlatHeaders`)),e.getCenterLeafHeaders=Nq(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Pq(e.options,Fq,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=Nq(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Pq(e.options,Fq,`getLeftLeafHeaders`)),e.getRightLeafHeaders=Nq(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Pq(e.options,Fq,`getRightLeafHeaders`)),e.getLeafHeaders=Nq(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),Pq(e.options,Fq,`getLeafHeaders`))}};function Lq(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=Iq(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>Iq(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var Jge=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>Wge(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Nq(()=>[e.getAllLeafColumns()],t=>t.map(t=>Gge(e,s,t,t.id)),Pq(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:Nq(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),Pq(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},Yge={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Rq=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!((i=e.getValue(t))!=null&&(i=i.toString())!=null&&(i=i.toLowerCase())!=null&&i.includes(a))};Rq.autoRemove=e=>Jq(e);var zq=(e,t,n)=>{var r;return!!((r=e.getValue(t))!=null&&(r=r.toString())!=null&&r.includes(n))};zq.autoRemove=e=>Jq(e);var Bq=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Bq.autoRemove=e=>Jq(e);var Vq=(e,t,n)=>e.getValue(t)?.includes(n);Vq.autoRemove=e=>Jq(e);var Hq=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});Hq.autoRemove=e=>Jq(e)||!(e!=null&&e.length);var Uq=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));Uq.autoRemove=e=>Jq(e)||!(e!=null&&e.length);var Wq=(e,t,n)=>e.getValue(t)===n;Wq.autoRemove=e=>Jq(e);var Gq=(e,t,n)=>e.getValue(t)==n;Gq.autoRemove=e=>Jq(e);var Kq=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};Kq.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},Kq.autoRemove=e=>Jq(e)||Jq(e[0])&&Jq(e[1]);var qq={includesString:Rq,includesStringSensitive:zq,equalsString:Bq,arrIncludes:Vq,arrIncludesAll:Hq,arrIncludesSome:Uq,equals:Wq,weakEquals:Gq,inNumberRange:Kq};function Jq(e){return e==null||e===``}var Xge={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:jq(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?qq.includesString:typeof n==`number`?qq.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?qq.equals:Array.isArray(n)?qq.arrIncludes:qq.weakEquals},e.getFilterFn=()=>Mq(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??qq[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=Aq(n,i?i.value:void 0);if(Yq(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>Aq(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&Yq(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Yq(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var Xq={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!Uge(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},Zge={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:jq(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return Xq.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return Xq.extent},e.getAggregationFn=()=>{if(!e)throw Error();return Mq(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??Xq[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function Qge(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var $ge={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:jq(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=Nq(e=>[nJ(t,e)],t=>t.findIndex(t=>t.id===e.id),Pq(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>nJ(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=nJ(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=Nq(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return Qge(i,t,n)},Pq(e.options,`debugTable`,`_getOrderColumnsFn`))}},Zq=()=>({left:[],right:[]}),e_e={getInitialState:e=>({columnPinning:Zq(),...e}),getDefaultOptions:e=>({onColumnPinningChange:jq(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Nq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},Pq(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=Nq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),Pq(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=Nq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),Pq(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?Zq():e.initialState?.columnPinning??Zq()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=Nq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Pq(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=Nq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Pq(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=Nq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},Pq(e.options,`debugColumns`,`getCenterLeafColumns`))}};function t_e(e){return e||(typeof document<`u`?document:null)}var Qq={size:150,minSize:20,maxSize:2**53-1},$q=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),n_e={getDefaultColumnDef:()=>Qq,getInitialState:e=>({columnSizing:{},columnSizingInfo:$q(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:jq(`columnSizing`,e),onColumnSizingInfoChange:jq(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Qq.minSize,n??e.columnDef.size??Qq.size),e.columnDef.maxSize??Qq.maxSize)},e.getStart=Nq(e=>[e,nJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),Pq(t.options,`debugColumns`,`getStart`)),e.getAfter=Nq(e=>[e,nJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),Pq(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),tJ(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=tJ(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=t_e(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=r_e()?{passive:!1}:!1;tJ(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?$q():e.initialState.columnSizingInfo??$q())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},eJ=null;function r_e(){if(typeof eJ==`boolean`)return eJ;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return eJ=e,eJ}function tJ(e){return e.type===`touchstart`}var i_e={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:jq(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Nq(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),Pq(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=Nq(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],Pq(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>Nq(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),Pq(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function nJ(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var a_e={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},o_e={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:jq(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>qq.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return Mq(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??qq[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},s_e={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:jq(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t)e._queue(()=>{t=!0});else if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0||!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},rJ=0,iJ=10,aJ=()=>({pageIndex:rJ,pageSize:iJ}),c_e={getInitialState:e=>({...e,pagination:{...aJ(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:jq(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t)e._queue(()=>{t=!0});else if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>Aq(t,e)),e.resetPagination=t=>{e.setPagination(t?aJ():e.initialState.pagination??aJ())},e.setPageIndex=t=>{e.setPagination(n=>{let r=Aq(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?rJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??rJ)},e.resetPageSize=t=>{var n;e.setPageSize(t?iJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??iJ)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,Aq(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=Aq(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=Nq(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},Pq(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1||n!==0&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},oJ=()=>({top:[],bottom:[]}),l_e={getInitialState:e=>({rowPinning:oJ(),...e}),getDefaultOptions:e=>({onRowPinningChange:jq(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?oJ():e.initialState?.rowPinning??oJ()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=Nq(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),Pq(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=Nq(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),Pq(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=Nq(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},Pq(e.options,`debugRows`,`getCenterRows`))}},u_e={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:jq(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{sJ(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Nq(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?cJ(e,n):{rows:[],flatRows:[],rowsById:{}},Pq(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=Nq(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?cJ(e,n):{rows:[],flatRows:[],rowsById:{}},Pq(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=Nq(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?cJ(e,n):{rows:[],flatRows:[],rowsById:{}},Pq(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return sJ(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return lJ(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return uJ(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return uJ(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},sJ=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>sJ(e,t.id,n,r,i))};function cJ(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=lJ(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function lJ(e,t){return t[e.id]??!1}function uJ(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if((!a||i)&&(e.getCanSelect()&&(lJ(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=uJ(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var dJ=/([0-9]+)/gm,d_e=(e,t,n)=>mJ(pJ(e.getValue(n)).toLowerCase(),pJ(t.getValue(n)).toLowerCase()),f_e=(e,t,n)=>mJ(pJ(e.getValue(n)),pJ(t.getValue(n))),p_e=(e,t,n)=>fJ(pJ(e.getValue(n)).toLowerCase(),pJ(t.getValue(n)).toLowerCase()),m_e=(e,t,n)=>fJ(pJ(e.getValue(n)),pJ(t.getValue(n))),h_e=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},g_e=(e,t,n)=>fJ(e.getValue(n),t.getValue(n));function fJ(e,t){return e===t?0:e>t?1:-1}function pJ(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function mJ(e,t){let n=e.split(dJ).filter(Boolean),r=t.split(dJ).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}}return n.length-r.length}var hJ={alphanumeric:d_e,alphanumericCaseSensitive:f_e,text:p_e,textCaseSensitive:m_e,datetime:h_e,basic:g_e},__e=[qge,i_e,$ge,e_e,Yge,Xge,a_e,o_e,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:jq(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return hJ.datetime;if(typeof n==`string`&&(r=!0,n.split(dJ).length>1))return hJ.alphanumeric}return r?hJ.text:hJ.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return Mq(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??hJ[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Zge,s_e,c_e,l_e,u_e,n_e];function v_e(e){let t=[...__e,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{let t=Aq(e,n.options);n.options=i(t)},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:Nq(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),Pq(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:Nq(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=Kge(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},Pq(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:Nq(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),Pq(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:Nq(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),Pq(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:Nq(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),Pq(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function y_e(){return e=>Nq(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=Jge(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},Pq(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function b_e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=Q.useState(()=>({current:v_e(t)})),[r,i]=Q.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var gJ=Qs(B.LOW_LEVEL_TABLE,`Table`,[`Header`,`Body`,`Footer`,`Row`,`Head`,`Cell`,`Caption`]);function _J({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n,{...t})}function vJ({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Header,{...t})}function yJ({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Body,{...t})}function x_e({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Footer,{...t})}function bJ({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Row,{...t})}function xJ({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Head,{...t})}function SJ({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Cell,{...t})}function S_e({preset:e=q.DEFAULT,...t}){let n=gJ(e);return(0,$.jsx)(n.Caption,{...t})}function CJ(e,t){return e===void 0?null:typeof e==`function`?e(t):e}var C_e=({items:e,resourceType:t,resourceConfig:n,navigationZone:r,summaryFields:i,contextResourceIdentifiers:a,fieldLabelsMap:o,sortFields:s,sortStates:c,onSortChange:l,selectable:u=!1,isRowSelected:d,onToggleRow:f,allSelected:p=!1,onToggleAll:m,renderRowActions:h,onRowClick:g,canOpenRow:_})=>{let{tComponent:v,tResourceFieldEnumValue:b}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:t}),{renderIcon:x}=Mf(),S=Ux(),{getRecipe:C}=Wg(),w=C(cc.INTERACTIVE,In.GHOST),T=C(cc.TYPOGRAPHY,y.EYEBROW),E=(0,Q.useMemo)(()=>V.resolveFieldShapeOfAnyVariant(n)??null,[n]),D=(0,Q.useMemo)(()=>new Set(s),[s]),O=b_e({data:e,columns:(0,Q.useMemo)(()=>{let e=[];u&&e.push({id:`__select`,header:()=>(0,$.jsx)(TI,{checked:p,onCheckedChange:()=>m?.(),"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`selectAll`)}),cell:({row:e})=>(0,$.jsx)(TI,{checked:d?.(e.original)??!1,onCheckedChange:()=>f?.(e.original),"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:e.index+1})}),size:40,enableSorting:!1});for(let n of i){let r=E?.[n],i=D.has(n),s=o[n]||n;e.push({id:n,accessorFn:e=>e[n],header:()=>{if(!i)return(0,$.jsx)(`span`,{children:s});let e=c.findIndex(e=>e.field===n),t=e>=0,r=t?c[e].direction:null;return(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`inline-flex items-center gap-1 text-start -ms-2 h-auto py-0.5 px-2 font-medium`,onClick:()=>{e<0?l([...c,{field:n,direction:`asc`}]):c[e].direction===`asc`?l(c.map((t,n)=>n===e?{...t,direction:`desc`}:t)):l(c.filter((t,n)=>n!==e))},children:[s,t&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-muted-foreground`,"aria-hidden":`true`,children:[x(r===`asc`?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.XS}),c.length>1&&(0,$.jsx)(`span`,{className:`text-[10px] font-semibold tabular-nums`,children:e+1})]})]})},cell:({row:e})=>(0,$.jsx)(kG,{value:e.original[n],fieldSchema:r,fieldLabel:void 0,resourceType:t,record:e.original,collectionContextResourceIdentifiers:a,fieldName:n,tResourceFieldEnumValue:b})})}return h&&e.push({id:`__actions`,header:()=>(0,$.jsx)(`span`,{className:`sr-only`,children:v(B.RESOURCES_LAYOUTS_LIST,`actionsColumn`)}),cell:({row:e})=>(0,$.jsx)(`div`,{className:`flex justify-end`,children:h(e.original)}),enableSorting:!1}),e},[u,p,m,d,f,h,i,a,E,D,o,c,l,t,b,v,x]),getCoreRowModel:y_e(),getRowId:(e,t)=>String(e.id??e._id??t),manualSorting:!0});return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{"data-slot":`table`,className:`w-full text-sm tabular-nums`,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`listLabel`),children:[(0,$.jsx)(`thead`,{className:`bg-muted/50 border-b border-border`,children:O.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsx)(`th`,{className:U(`px-card-sm py-element-sm text-start`,T.base),style:{width:e.getSize()===150?void 0:e.getSize()},children:e.isPlaceholder?null:CJ(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,$.jsx)(`tbody`,{className:`divide-y divide-border`,children:O.getRowModel().rows.map(e=>{let t=V.getResourceObjectId(e.original,n.resourceFieldIdentifier);if(S.isElementActive(t))return(0,$.jsx)(`tr`,{role:`row`,children:(0,$.jsx)(`td`,{colSpan:e.getVisibleCells().length,className:`p-0`,children:(0,$.jsx)(jG,{navigationZone:r})})},e.id);let i=!_||_(e.original);return(0,$.jsx)(`tr`,{"data-slot":`resource-list-item`,className:U(i&&(w.states.hover||`hover:bg-muted/30`),`transition-colors motion-reduce:transition-none`,i&&`cursor-pointer`,i&&Rg(d_.INSET),d?.(e.original)&&`bg-primary/5`),onClick:i?()=>g(e.original):void 0,role:`row`,"aria-selected":u?d?.(e.original)??!1:void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e.original))}:void 0,children:e.getVisibleCells().map(e=>{let t=e.column.id===`__select`||e.column.id===`__actions`;return(0,$.jsx)(SJ,{className:`px-card-sm py-element-sm text-foreground`,truncate:!t,onClick:t?e=>e.stopPropagation():void 0,onKeyDown:t?e=>e.stopPropagation():void 0,children:CJ(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]})})})})},w_e=`__wildo-board-ungrouped__`;function T_e(e){let{vocabulary:t,labelOf:n,pages:r,collectionTotal:i}=e;if(t.length===0)return null;let a=t.map(e=>{let t=r.get(e);return{key:e,value:e,label:n(e),items:t?.items??[],total:t?.total??0,loading:!t||t.loading,failed:t?.failed??!1}}),o=a.every(e=>!e.loading&&!e.failed)&&i!==void 0?i-a.reduce((e,t)=>e+t.total,0):0;return o>0&&a.push({key:w_e,value:null,label:null,items:[],total:o,loading:!1,failed:!1}),a}function E_e(e,t){if(t===void 0)return[];let n=e.filter(e=>e.isBulkOperation!==!0);if(typeof t==`string`)return n.filter(e=>String(e.operationIdentifier)===t);let[r,i]=t;return n.filter(e=>String(e.operationIdentifier)===r&&e.variantKey===i)}function D_e(e,t){if(e.length===0)return;let n=t(e);return n.find(e=>e.isOperationDefault===!0)??n[0]}function O_e(e,t){return{[e]:t}}async function k_e(e){let t=O_e(e.groupByField,e.targetValue);try{await e.call(t)}catch(t){return e.reportRefusal(t),!1}return e.applyMove(t),!0}function A_e(e,t,n){let r=e.filter(e=>e.value!==null),i=r.findIndex(e=>e.value===t);if(i!==-1)return r[i+n]?.value??void 0}var wJ=`application/x-wildo-board-card`,j_e=[];function M_e(e,t){let n=e?.operations??j_e,r=GS(n,{currentObject:t,resourceType:e?.resourceType,subjectDataMode:e?.subjectDataMode,organizationId:e?.organizationId});return D_e(n.filter(e=>r.get(zS(e))?.isEnabled===!0),e=>oo(e))}function N_e({item:e,index:t,itemId:n,columnValue:r,transition:i,isMoving:a,hintId:o,renderCard:s,onDragStart:c,onDragEnd:l,onKeyboardMove:u}){let d=M_e(i,e),f=d!==void 0&&!a;return(0,$.jsx)(`li`,{className:U(`list-none rounded-md border bg-background`,f&&`cursor-grab`,a&&`opacity-60`),"data-board-card":n,"data-board-card-movable":f?`true`:void 0,draggable:f,tabIndex:f?0:void 0,"aria-describedby":f?o:void 0,"aria-busy":a?!0:void 0,onDragStart:e=>{!f||!d?e.preventDefault():(e.dataTransfer.setData(wJ,n),e.dataTransfer.effectAllowed=`move`,c(n,r,d))},onDragEnd:l,onKeyDown:t=>{if(!f||!d||t.target!==t.currentTarget)return;let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;n!==0&&(t.preventDefault(),u(e,r,n,d))},children:s(e,t)})}function P_e({columns:e,onLoadMore:t,loadMoreLabel:n,columnLoadFailedLabel:r,ungroupedNote:i,renderCard:a,getItemId:o,transition:s,onMoveItem:c,boardLabel:l,ungroupedLabel:u,columnCountLabel:d,moveHint:f}){let p=(0,Q.useId)(),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useCallback)(t=>{for(let n of e){let e=n.items.find(e=>o(e)===t);if(e)return e}},[e,o]),x=(0,Q.useCallback)(async(e,t,n)=>{y(o(e));try{await c(e,t,n)}finally{y(null)}},[o,c]),S=(0,Q.useCallback)(()=>{h(null),_(null)},[]),C=(0,Q.useCallback)((t,n,r,i)=>{let a=A_e(e,n,r);a!==void 0&&x(t,a,i)},[e,x]),w=0;return(0,$.jsxs)(`div`,{role:`group`,"aria-label":l,className:`flex gap-group overflow-x-auto pb-item-sm`,"data-slot":`collection-board`,children:[(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:f}),e.map(e=>{let c=e.value!==null&&m!==null&&m.fromValue!==e.value,l=c&&g===e.value,f=e.label??u;return(0,$.jsxs)(`section`,{"aria-label":f,"data-board-column":e.key,"data-drop-target":l?`true`:void 0,className:U(`flex w-72 shrink-0 flex-col gap-item-sm rounded-lg border bg-muted/20 p-item-sm`,l&&`border-primary bg-muted/40`),onDragOver:t=>{c&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,g!==e.value&&_(e.value))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||g===e.value&&_(null)},onDrop:t=>{if(!c||e.value===null)return;t.preventDefault();let n=t.dataTransfer.getData(wJ)||m?.itemId,r=m?.itemId===n?m?.operation:void 0;S();let i=n?b(n):void 0;i&&r&&x(i,e.value,r)},children:[(0,$.jsxs)(`header`,{className:`flex items-baseline justify-between gap-item-sm px-item-xs`,children:[(0,$.jsx)(`h3`,{className:`truncate text-xs font-medium text-muted-foreground`,children:f}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.failed?null:d(e.total)})]}),e.value===null&&(0,$.jsx)(`p`,{className:`px-item-xs text-xs text-muted-foreground`,children:i(e.total)}),e.failed&&(0,$.jsx)(`p`,{role:`alert`,className:`px-item-xs text-xs text-destructive`,children:r}),(0,$.jsx)(`ul`,{role:`list`,"aria-label":f,"aria-busy":e.loading?!0:void 0,className:`flex min-h-16 flex-col gap-item-sm`,children:e.items.map(t=>{let n=w++,r=o(t);return(0,$.jsx)(N_e,{item:t,index:n,itemId:r,columnValue:e.value,transition:s,isMoving:v===r,hintId:p,renderCard:a,onDragStart:(e,t,n)=>h({itemId:e,fromValue:t,operation:n}),onDragEnd:S,onKeyboardMove:C},r||n)})}),e.value!==null&&!e.failed&&e.items.length<e.total&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,disabled:e.loading,"data-board-load-more":e.key,onClick:()=>t(e.value),children:n(e.total-e.items.length)})]},e.key)})]})}function TJ(e){return e.toISOString().slice(0,10)}function EJ(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1))}function DJ(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function OJ(e){return TJ(e).slice(0,7)}function F_e(e){try{let t=new Intl.Locale(e||`en`),n=t.getWeekInfo?.().firstDay??t.weekInfo?.firstDay;if(typeof n==`number`&&n>=1&&n<=7)return n%7}catch{}return 1}function I_e(e,t){let n=EJ(e),r=(n.getUTCDay()-t+7)%7,i=dK(DJ(n,1),-1),a=[],o=dK(n,-r);for(;o.getTime()<=i.getTime();){let e=[];for(let t=0;t<7;t++)e.push({day:o,key:TJ(o),inMonth:o.getUTCMonth()===n.getUTCMonth()}),o=dK(o,1);a.push(e)}return a}function L_e(e){let t=e[0],n=e[e.length-1];return{firstDay:t[0].day,lastDay:n[n.length-1].day}}function kJ(e,t,n){let r=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):void 0;if(r&&!Number.isNaN(r.getTime()))return jl.calendarDateToday({timezone:t?`UTC`:n},r)}function R_e(e){let t=new Map;for(let n of e.items){let r=kJ(n[e.dateField],e.calendarField,e.timeZone);if(!r)continue;let i=TJ(r),a=t.get(i);a?a.push(n):t.set(i,[n])}return t}function z_e(e,t,n){return fK(e.firstDay,e.lastDay,t,n)}function AJ(e){let t=e instanceof Date?e:typeof e==`string`&&e!==``?new Date(e):void 0;return t&&!Number.isNaN(t.getTime())?t:void 0}function B_e(e,t){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return{...t};let n=e,r=[AJ(n.startDate),t.startDate].filter(e=>e!==void 0),i=[AJ(n.endDate),t.endDate].filter(e=>e!==void 0),a={};return r.length>0&&(a.startDate=new Date(Math.max(...r.map(e=>e.getTime())))),i.length>0&&(a.endDate=new Date(Math.min(...i.map(e=>e.getTime())))),a}function V_e(e,t){if(!t||Object.keys(t).length===0)return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=B_e(e[r],i);return n}function H_e(e){switch(e){case`ArrowLeft`:return{days:-1};case`ArrowRight`:return{days:1};case`ArrowUp`:return{days:-7};case`ArrowDown`:return{days:7};case`PageUp`:return{months:-1};case`PageDown`:return{months:1};case`Home`:return{weekEdge:`start`};case`End`:return{weekEdge:`end`};default:return}}function U_e(e,t,n){if(`days`in t)return dK(e,t.days);if(`months`in t){let n=DJ(EJ(e),t.months),r=dK(DJ(n,1),-1).getUTCDate();return new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),Math.min(e.getUTCDate(),r)))}let r=(e.getUTCDay()-n+7)%7;return t.weekEdge===`start`?dK(e,-r):dK(e,6-r)}var W_e=[];function G_e({weeks:e,itemsByDay:t,month:n,today:r,firstDayOfWeek:i,onMonthChange:a,monthHeading:o,weekdayLabels:s,dayNumberLabel:c,dayLabel:l,getItemId:u,getItemLabel:d,canOpenItem:f,onOpenItem:p,calendarLabel:m,previousMonthLabel:h,nextMonthLabel:g,todayLabel:_,keyboardHint:v}){let y=(0,Q.useId)(),b=(0,Q.useId)(),{renderIcon:x}=Mf(),S=(0,Q.useRef)(null),[C,w]=(0,Q.useState)(()=>EJ(r).getTime()===EJ(n).getTime()?r:EJ(n)),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{w(e=>EJ(e).getTime()===EJ(n).getTime()?e:EJ(n))},[n]);let E=TJ(C);(0,Q.useEffect)(()=>{T.current&&(T.current=!1,S.current?.querySelector(`[data-calendar-day="${E}"]`)?.focus())},[E,e]);let D=(0,Q.useCallback)(e=>{T.current=!0,w(e);let t=EJ(e);t.getTime()!==EJ(n).getTime()&&a(t)},[n,a]),O=(e,t)=>{if(e.target!==e.currentTarget)return;let n=H_e(e.key);n&&(e.preventDefault(),D(U_e(t,n,i)))},k=TJ(r);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,"data-slot":`collection-calendar`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":h,title:h,onClick:()=>a(DJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_LEFT,{size:ca.SM})})}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":g,title:g,onClick:()=>a(DJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_RIGHT,{size:ca.SM})})}),(0,$.jsx)(`h3`,{id:b,className:`text-sm font-medium`,"aria-live":`polite`,children:o}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,className:`ms-auto`,onClick:()=>D(r),children:_})]}),(0,$.jsx)(`span`,{id:y,className:`sr-only`,children:v}),(0,$.jsxs)(`table`,{ref:S,role:`grid`,"aria-label":m,"aria-describedby":y,className:`w-full table-fixed border-collapse`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:o}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:s.map((e,t)=>(0,$.jsx)(`th`,{scope:`col`,className:`pb-item-xs text-xs font-medium text-muted-foreground`,children:e},t))})}),(0,$.jsx)(`tbody`,{children:e.map(e=>(0,$.jsx)(`tr`,{children:e.map(({day:e,key:n,inMonth:r})=>{let i=t.get(n)??W_e,a=n===E;return(0,$.jsxs)(`td`,{role:`gridcell`,"data-calendar-day":n,"data-in-month":r?`true`:void 0,"data-today":n===k?`true`:void 0,"aria-label":l(e,i.length),"aria-current":n===k?`date`:void 0,tabIndex:a?0:-1,onKeyDown:t=>O(t,e),onFocus:t=>{t.target===t.currentTarget&&!a&&w(e)},className:U(`h-24 border align-top p-item-xs`,Rg(d_.INSET),!r&&`bg-muted/30 text-muted-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs`,n===k&&`bg-primary text-primary-foreground`),children:c(e)}),i.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`flex max-h-28 flex-col gap-px overflow-y-auto`,children:i.map(e=>{let t=u(e),n=d(e);return(0,$.jsx)(`li`,{className:`list-none`,"data-calendar-item":t,children:f(e)?(0,$.jsx)(X,{variant:J.GHOST,size:Y.XS,tabIndex:a?0:-1,className:`h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal`,title:n,onClick:()=>p(e),children:n}):(0,$.jsx)(`span`,{className:`block truncate px-item-xs text-xs`,title:n,children:n})},t)})})]},n)})},e[0].key))})]})]})}function K_e(e){let t=EJ(e),n=DJ(t,1),r=[];for(let e=t;e.getTime()<n.getTime();e=dK(e,1))r.push(e);return r}var jJ=864e5;function q_e(e){let{items:t,startField:n,endField:r,startIsCalendarDate:i,endIsCalendarDate:a,timeZone:o,days:s}=e;if(s.length===0)return[];let c=s[0].getTime(),l=s[s.length-1].getTime(),u=[];for(let e of t){let t=kJ(e[n],i,o),s=kJ(e[r],a,o);if(!t||!s)continue;let d=s.getTime()<t.getTime()?t:s;if(t.getTime()>l||d.getTime()<c)continue;let f=Math.round((Math.max(t.getTime(),c)-c)/jJ)+1,p=Math.round((Math.min(d.getTime(),l)-c)/jJ)+1;u.push({item:e,startDay:t,endDay:d,startColumn:f,endColumn:p,continuesBefore:t.getTime()<c,continuesAfter:d.getTime()>l})}return u}function J_e(e){let{startField:t,endField:n,startIsCalendarDate:r,endIsCalendarDate:i,timeZone:a,firstDay:o,lastDay:s}=e;return{[t]:fK(void 0,s,r,a),[n]:fK(o,void 0,i,a)}}var MJ=TJ;function Y_e(e){return{gridTemplateColumns:`minmax(8rem, 12rem) repeat(${e}, minmax(1.5rem, 1fr))`}}function X_e({days:e,placements:t,month:n,today:r,onMonthChange:i,monthHeading:a,dayNumberLabel:o,getItemId:s,getItemLabel:c,barLabel:l,canOpenItem:u,onOpenItem:d,timelineLabel:f,previousMonthLabel:p,nextMonthLabel:m,todayLabel:h,emptyMonthLabel:g}){let{renderIcon:_}=Mf(),v=(0,Q.useRef)(null),y=MJ(r),b=Y_e(e.length),x=e=>{let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(t===0)return;let n=Array.from(v.current?.querySelectorAll(`[data-timeline-bar]`)??[]),r=n[n.indexOf(e.currentTarget)+t];r&&(e.preventDefault(),r.focus())};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,"data-slot":`collection-timeline`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":p,title:p,onClick:()=>i(DJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_LEFT,{size:ca.SM})})}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":m,title:m,onClick:()=>i(DJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_RIGHT,{size:ca.SM})})}),(0,$.jsx)(`h3`,{className:`text-sm font-medium`,"aria-live":`polite`,children:a}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,className:`ms-auto`,onClick:()=>i(r),children:h})]}),(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`div`,{className:`min-w-max`,children:[(0,$.jsxs)(`div`,{className:`grid border-b pb-item-xs`,style:b,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{}),e.map(e=>{let t=MJ(e);return(0,$.jsx)(`span`,{"data-timeline-day":t,"data-today":t===y?`true`:void 0,className:U(`text-center text-xs text-muted-foreground`,t===y&&`font-semibold text-foreground`),children:o(e)},t)})]}),t.length===0?(0,$.jsx)(`p`,{role:`status`,className:`py-section text-center text-sm text-muted-foreground`,children:g}):(0,$.jsx)(`ul`,{ref:v,role:`list`,"aria-label":f,className:`flex flex-col`,children:t.map(e=>{let{item:t,startDay:n,endDay:r,startColumn:i,endColumn:a,continuesBefore:o,continuesAfter:f}=e,p=s(t),m=c(t),h=l(t,n,r),g=U(`h-6 min-w-0 truncate rounded-md bg-primary/15 px-item-xs text-start text-xs text-foreground`,o&&`rounded-s-none`,f&&`rounded-e-none`),_={gridColumn:`${i+1} / ${a+2}`,gridRow:1};return(0,$.jsxs)(`li`,{className:`grid list-none items-center border-b py-px`,style:b,"data-timeline-item":p,"data-continues-before":o?`true`:void 0,"data-continues-after":f?`true`:void 0,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`truncate pe-item-sm text-sm`,style:{gridColumn:1,gridRow:1},title:m,children:m}),u(t)?(0,$.jsx)(X,{variant:J.GHOST,size:Y.XS,"data-timeline-bar":p,"aria-label":h,title:h,className:U(g,`justify-start font-normal hover:bg-primary/25`),style:_,onClick:()=>d(t),onKeyDown:x,children:m}):(0,$.jsx)(`span`,{role:`img`,"data-timeline-bar":p,tabIndex:0,"aria-label":h,title:h,className:U(g,`flex items-center`),style:_,onKeyDown:x,children:m})]},p)})})]})})]})}function NJ(e){if(Array.isArray(e))return{items:e,total:e.length,totalPages:1};if(e&&typeof e==`object`&&`data`in e&&`pagination`in e){let{data:t,pagination:n}=e;return Array.isArray(t)?{items:t,total:typeof n?.total==`number`?n.total:t.length,totalPages:typeof n?.totalPages==`number`?n.totalPages:1}:void 0}}async function Z_e(e){let{requestPage:t,pageLimit:n,maxPages:r=5}=e,i=async e=>{let r=NJ(await t(e,n));if(!r)throw Error(`The collection answered a display window with a response that holds no rows.`);return r},a=await i(1),o=Math.min(a.totalPages,r),s=[a,...o>1?await Promise.all(Array.from({length:o-1},(e,t)=>i(t+2))):[]].flatMap(e=>e.items);return{items:s,total:a.total,notShown:Math.max(0,a.total-s.length)}}function PJ(e,t,n){let r=e[t];return r!=null&&r!==``&&!(Array.isArray(r)?r.includes(n):r===n)?null:{...e,[t]:n}}function Q_e(e,t){let{itemId:n,fromValue:r,toValue:i,movedFields:a,getItemId:o}=t,s=e.get(r),c=e.get(i),l=s?.items.find(e=>o(e)===n);if(!s||!c||!l)return new Map(e);let u=new Map(e);return u.set(r,{...s,items:s.items.filter(e=>o(e)!==n),total:Math.max(0,s.total-1)}),u.set(i,{...c,items:[{...l,...a},...c.items],total:c.total+1}),u}function $_e(e,t,n,r){let i=new Set(e.items.map(r));return{items:[...e.items,...t.items.filter(e=>!i.has(r(e)))],total:t.total,page:n,loading:!1,failed:!1}}var FJ={items:[],total:0,page:0,loading:!1,failed:!1};function eve(e){let{enabled:t,vocabulary:n,groupByField:r,readerFilters:i,reloadKey:a,pageSize:o,requestPage:s,getItemId:c}=e,[l,u]=(0,Q.useState)(()=>new Map),d=(0,Q.useRef)({readerFilters:i,requestPage:s,getItemId:c,pageSize:o,groupByField:r});d.current={readerFilters:i,requestPage:s,getItemId:c,pageSize:o,groupByField:r};let f=n.join(`\0`);return(0,Q.useEffect)(()=>{if(!t)return;let e=!1,{readerFilters:r,requestPage:i,pageSize:a,groupByField:o}=d.current;u(new Map(n.map(e=>[e,{...FJ,items:[],loading:tve(r,o,e)}])));for(let t of n){let n=PJ(r,o,t);n&&i(n,1,a).then(n=>{if(e)return;let r=NJ(n);u(e=>new Map(e).set(t,r?{items:r.items,total:r.total,page:1,loading:!1,failed:!1}:{...FJ,items:[],failed:!0}))},()=>{e||u(e=>new Map(e).set(t,{...FJ,items:[],failed:!0}))})}return()=>{e=!0}},[t,f,a]),{pages:l,loadMore:(0,Q.useCallback)(async e=>{let{readerFilters:t,requestPage:n,pageSize:r,groupByField:i,getItemId:a}=d.current,o=PJ(t,i,e),s=l.get(e);if(!o||!s||s.loading)return;let c=s.page+1;u(t=>new Map(t).set(e,{...s,loading:!0}));try{let t=NJ(await n(o,c,r));u(n=>{let r=n.get(e)??s;return new Map(n).set(e,t?$_e(r,t,c,a):{...r,loading:!1,failed:!0})})}catch{u(t=>new Map(t).set(e,{...t.get(e)??s,loading:!1,failed:!0}))}},[l]),applyMove:(0,Q.useCallback)((e,t,n,r)=>{u(i=>Q_e(i,{itemId:e,fromValue:t,toValue:n,movedFields:r,getItemId:d.current.getItemId}))},[])}}function tve(e,t,n){return PJ(e,t,n)!==null}function nve(e){let{on:t}=Mo(),[n,r]=(0,Q.useState)(null),i=e?.jobId??null,a=e?.attemptedCount??0;return(0,Q.useEffect)(()=>{if(!i)r(null);else return r({jobId:i,attemptedCount:a,processedCount:0,failedCount:0,finished:!1,failures:[]}),t(Ec.BULK_JOB_PROGRESS,e=>{e.jobId===i&&r({jobId:e.jobId,operationIdentifier:e.operationIdentifier,attemptedCount:e.attemptedCount,processedCount:e.processedCount,failedCount:e.failedCount,finished:e.finished,failures:e.failures??[]})})},[t,i,a]),n}function rve(e,t){let n=new Map;for(let r of e){let e=r.customMessageReference??`unnamedRefusal`,i=n.get(e);i?i.resourceIds.push(r.resourceId):n.set(e,{key:e,reason:(r.customMessageReference?t(r.customMessageReference):void 0)??e,resourceIds:[r.resourceId]})}return[...n.values()].sort((e,t)=>t.resourceIds.length-e.resourceIds.length)}var IJ=({resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:r,selectedItemsDataMode:i,matchAllSelection:a,explicitIdSelection:o,onSelectIds:s,idField:c=`_id`,onSelectionClear:l,onSelectionReplace:u,size:d=Y.ICON_SM,labelDisplayMode:f=Ga.INLINE,className:p})=>{let m=Fge(),{resourceType:h,operation:g}=e,{on:_}=Mo(),v=(0,Q.useId)(),{isReady:y,tComponent:b,tErrorMessage:x,tResourceOperation:S}=K({component:B.RESOURCES_LAYOUTS_OPERATIONS_BULK,resource:h}),C=(0,Q.useMemo)(()=>Hu(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),w=(0,Q.useMemo)(()=>[`resources.${h}`,`components.${B.RESOURCES_LAYOUTS_OPERATIONS_BULK}`],[h]),T=(0,Q.useMemo)(()=>o&&o.length>0?[...o]:r.map(e=>String(e[c]??e._id??``)),[o,r,c]),E=(0,Q.useMemo)(()=>u?e=>u([...e]):void 0,[u]),{items:D,isConfirmDialogOpen:O,confirmDialogLabel:k,confirmDialogDescription:A,confirmDialogConfirmLabel:j,confirmRequiresTypedConfirmation:M,confirmConfirmationPhrase:N,onConfirm:P,onCancel:F,isExecuting:I,acceptedBackgroundRun:ee}=XV({resourceType:h,displayMode:Se.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:t,sourceOperation:g,bulkOnly:!0,selectedItemIds:T,successDiscriminator:v,selectionObjects:r,...i?{currentObjectDataMode:i}:{},...a?{matchAllSelection:a}:{},onSelectionNarrow:E}),L=nve(ee),R=r.length>0||!!a||!!o?.length,z=a?`match:${JSON.stringify(a)}`:R?`ids:${T.join(`,`)}`:``,[te,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null);L?.finished&&te?.jobId!==L.jobId&&ne({jobId:L.jobId,selectionKey:z});let ae=!!L?.finished&&te?.jobId===L.jobId&&z!==``&&z!==te.selectionKey;ae&&re!==L.jobId&&ie(L.jobId);let oe=L&&!ae&&L.jobId!==re?L:null;return Lge(oe?oe.finished?Eq.FINISHED:Eq.WORKING:Eq.NONE),Ige((0,Q.useMemo)(()=>D.map(e=>e.type===`separator`?`|`:e.operationIdentifier??e.label).join(`,`),[D])),(0,Q.useEffect)(()=>{if(l)return _(Ec.RESOURCE_OPERATION_EXECUTED,()=>l(),e=>{let t=e;return t.resourceType===h&&t.isBulkOperation===!0&&t.isPartialWrite!==!0&&t.optionalDiscriminator===v&&(0,dC.default)(Hu(t.contextResourceIdentifiers),C)})},[_,l,C,h,v]),y?oe?(0,$.jsx)(sb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,"data-slot":`bulk-background-run`,children:[!oe.finished&&(0,$.jsx)(E_,{value:oe.processedCount,max:Math.max(oe.attemptedCount,1),className:`w-40`,getValueLabel:(e,t)=>`${e}/${t}`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground whitespace-nowrap`,role:`status`,"aria-live":`polite`,children:oe.finished?b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunFinished`,{succeededCount:oe.processedCount-oe.failedCount,failedCount:oe.failedCount}):b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunProgress`,{processedCount:oe.processedCount,attemptedCount:oe.attemptedCount})}),oe.finished&&oe.failures.length>0&&(0,$.jsxs)(sq,{children:[(0,$.jsx)(cq,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`viewFailures`)})}),(0,$.jsxs)(lq,{className:`w-96 max-h-80 overflow-auto`,children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-element-sm`,children:rve(oe.failures,e=>Tp({tErrorMessage:x,tResourceOperation:S,resourceType:h,operationIdentifier:oe.operationIdentifier,customMessageReference:e})).map(e=>(0,$.jsxs)(`li`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.reason}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failureReasonRowCount`,{count:e.resourceIds.length})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground break-all`,children:e.resourceIds.join(`, `)})]},e.key))}),s&&(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:()=>s(oe.failures.map(e=>e.resourceId)),children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`selectRefusedRows`,{count:oe.failures.length})}),oe.failures.length<oe.failedCount&&(0,$.jsx)(`p`,{className:`mt-element-sm text-xs text-muted-foreground`,children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failuresPartialList`,{shownCount:oe.failures.length,failedCount:oe.failedCount})})]})]})]})}):!R||D.length===0?null:(0,$.jsx)(sb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{"data-slot":`operations-bulk`,className:U(`flex items-center`,p),children:[(0,$.jsx)(QS,{items:D,size:d,labelDisplayMode:m===null||m===Cq.LABELLED?f:Ga.TOOLTIP,...m===Cq.CAPPED?{maxDisplayed:2}:{}}),O&&(0,$.jsx)(Iw,{open:O,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,label:k,description:A,confirmLabel:j,requireTypedConfirmation:M,confirmationPhrase:N})]})}):null};function LJ({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`ResourceLayout_OperationBulk`)(e);return(0,$.jsx)(n,{...t})}var ive=({resourceContext:e,navigationZone:t,size:n=Y.ICON_SM,className:r,collectionExportQuery:i})=>{let{resourceType:a,operation:o}=e,{items:s,isConfirmDialogOpen:c,confirmDialogLabel:l,confirmDialogDescription:u,confirmDialogConfirmLabel:d,confirmRequiresTypedConfirmation:f,confirmConfirmationPhrase:p,onConfirm:m,onCancel:h,ephemeralFields:g,onEphemeralAcknowledge:_}=XV({resourceType:a,displayMode:Se.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:o,collectionOnly:!0,collectionExportQuery:i});return s.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(QS,{items:s,size:n,labelDisplayMode:Ga.INLINE,className:r}),c&&(0,$.jsx)(Iw,{open:c,onOpenChange:e=>{e||h()},cancelCallback:h,validationCallback:m,label:l,description:u,confirmLabel:d,requireTypedConfirmation:f,confirmationPhrase:p}),g&&(0,$.jsx)(aG,{open:!0,onAcknowledge:_,fields:g,resourceType:a})]})},ave=`__wildo-ungrouped__`;function ove(e,t,n,r,i){let a=PG(n,i).has(t),o=[];for(let n of e){let e=n[t],i=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):null,s=i&&!Number.isNaN(i.getTime())?r(i,{calendarDate:a}):null,c=s??ave,l=o[o.length-1];l&&l.key===c?l.items.push(n):o.push({key:c,label:s,items:[n]})}return o}var sve=`wildo-collection-view-mode:`;function RJ(e){return`${sve}${e}`}function cve(e){let t=Ys(RJ(e));return t!==null&&Object.values(_u).includes(t)?t:null}function lve(e,t){co(RJ(e),t)}function uve(e,t){let[n,r]=(0,Q.useState)(()=>cve(e)??t);return{viewMode:n,setViewMode:(0,Q.useCallback)(t=>{r(t),lve(e,t)},[e])}}function dve(e){return e instanceof Error?e:Error(String(e))}var zJ=class extends Q.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){let n=dve(e);as.getLogger().warn(`[${this.props.doorName}] lazy door failed to render its module`,{error:n.message,componentStack:t.componentStack}),this.props.onError?.(n)}render(){return this.state.failed?this.props.fallback:this.props.children}};function BJ({className:e,style:t}){return(0,$.jsx)(`div`,{"aria-hidden":`true`,"data-lazy-door":`unavailable`,className:U(`rounded-md border border-dashed border-muted-foreground/40 bg-muted/30`,e),style:t})}var fve=Q.lazy(()=>h_(()=>import(`./ChartView-Qqvf_azZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function pve({height:e}){let{tComponent:t,isReady:n}=K({component:B.HIGH_LEVEL_VIEWS_CHART_WIDGET});return n?(0,$.jsx)(`div`,{style:{minHeight:e},"data-lazy-door":`unavailable`,children:(0,$.jsx)(dm,{variant:`compact`,iconRef:H.ERROR_APPLICATION,title:t(B.HIGH_LEVEL_VIEWS_CHART_WIDGET,`chartFailed`),respectSurfaceEmptyDisplay:!1,className:`h-full min-h-[120px] border-0`})}):null}var VJ=e=>(0,$.jsx)(zJ,{doorName:`ChartView`,fallback:(0,$.jsx)(pve,{height:e.height??400}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Sm,{height:e.height??400}),children:(0,$.jsx)(fve,{...e})})});function mve(e){return typeof e.resourceType==`string`&&e.resourceType.length>0}function hve(e){return e.foreignKeyField??e.resourceType}function gve(e,t){if(!e.anchor||!t)return null;let{bindingKey:n,source:r}=e.anchor,i=t[n];if(!i)return null;let a=((r===km.PARENT_RESOURCE_REQUIREMENT?e.parentResourcesRequirements:e.additionalResourceRequirements)??[]).filter(e=>mve(e)?hve(e)===n:!1);return a.length===1?{mainResourceType:a[0].resourceType,mainResourceId:i,bindingKey:n,source:r===km.PARENT_RESOURCE_REQUIREMENT?iy.PARENT_RESOURCE_REQUIREMENT:iy.ADDITIONAL_RESOURCE_REQUIREMENT}:null}function _ve(e){return e.explicitTemplate?e.explicitTemplate:e.displaySchema?HR(e.displaySchema,{factsAsTiles:e.defaultDisplayChromeMode===void 0,...e.resourceConfig?{resourceConfig:e.resourceConfig}:{}}):null}function HJ(e){return e??void 0}var UJ=class{resourcesRegistry;errorBuilder;constructor(e){this.resourcesRegistry=e,this.errorBuilder=new De}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(Va.INTERNAL,{customMessageReference:e,operationPathKey:t?.operationPathKey,context:{...n,resourceType:t?.resourceType,operationIdentifier:t?.operationIdentifier}}),i=Error(e);return i.wildoError=r,i}findOperation(e){let t=this.resourcesRegistry.resourceConfigurations[e.resourceType];if(!t||!e.operationIdentifier)return null;let n=t.operations.filter(t=>String(t.operationIdentifier)===e.operationIdentifier&&(HJ(e.variantType)===void 0||t.variantType===e.variantType)&&(HJ(e.variantKey)===void 0||t.variantKey===e.variantKey)&&(HJ(e.isOperationDefault)===void 0||!!t.isOperationDefault===e.isOperationDefault)&&(HJ(e.isBulkOperation)===void 0||t.isBulkOperation===!0===e.isBulkOperation));if(n.length===1)return n[0];let r=n.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);return r.length===1?r[0]:null}findOperationByPathKey(e,t){if(!t)return null;let n=this.resourcesRegistry.resourceConfigurations[e];if(!n)return null;try{return n.operations.find(e=>Ta.createOperationPathKeyFromOperation(e)===t)??null}catch{return null}}resolveOperation(e){if(!this.resourcesRegistry.resourceConfigurations[e.resourceType])return null;let t=this.findOperationByPathKey(e.resourceType,e.operationPathKey);return t?e.validationTarget===`canonical-read`&&Vte.getCoreResourceOperationFromOperation(t)!==W.READ?null:t:e.validationTarget===`canonical-read`?null:this.findOperation(e)}selectResponseDto(e,t){return us.selectResponseDto(e,t)}validateResourceData(e,t,n){if(!t)return e;try{return t.parse(e)}catch(t){throw t instanceof Id?this.buildError(Xl.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,n,{validationErrors:t.issues,resourceData:e}):t}}validateWebSocketResourceData(e,t){let n=this.resolveOperation(t),r=t.validationTarget!=null;if(!n){if(r)throw this.buildError(Xl.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,t,{message:`Unable to resolve websocket validation operation`,resourceData:e});return e}let i=this.selectResponseDto(n,t.dataMode);if(!i&&r)throw this.buildError(Xl.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,t,{message:`Unable to resolve websocket validation DTO`,resourceData:e,operationIdentifier:n.operationIdentifier});return this.validateResourceData(e,i,t)}validateWebSocketResourceDataArray(e,t){return e.map((e,n)=>{try{return this.validateWebSocketResourceData(e,t)}catch(e){if(e instanceof Error&&e.wildoError){let r={...t,operationPathKey:t.operationPathKey?`${t.operationPathKey}[${n}]`:`[${n}]`};throw this.buildError(Xl.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{arrayIndex:n,originalError:e})}throw e}})}},WJ=as.getLogger(),GJ=WJ.debugByType(`RMMWebSocketBridge`);WJ.setDebugTypeLogging(`RMMWebSocketBridge`,!1);function KJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qJ(e,t){return e===t?!0:e==null||t==null?e===t:Array.isArray(e)||Array.isArray(t)?!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>qJ(e,t[n])):KJ(e)||KJ(t)?!KJ(e)||!KJ(t)?!1:[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>qJ(e[n],t[n])):!1}function JJ(e,t,n=``,r={}){if(qJ(e,t))return r;if(Array.isArray(e)||Array.isArray(t))return n&&(r[n]=e),r;if(KJ(e)&&KJ(t)){let i=[...new Set([...Object.keys(e),...Object.keys(t)])];for(let a of i){let i=n?`${n}.${a}`:a;JJ(e[a],t[a],i,r)}return r}if(KJ(e)){for(let[t,i]of Object.entries(e))JJ(i,void 0,n?`${n}.${t}`:t,r);return r}return n&&(r[n]=e),r}function vve(e,t){return JJ(e,t)}async function YJ(e){let{resourceType:t,resourceId:n,rmm:r,doOperation:i}=e;if(r.getSnapshot().isDeleted)return;let a=r.readOperationPathKey;if(!a){GJ(`authoritative refetch skipped: missing canonical read operation`,{resourceType:t,resourceId:n});return}let o=await Oz({doOperation:i,readOperationPathKey:a,contextualParameters:r.contextualParameters,parentResourcesRequirements:r.parentResourcesRequirements});if(!o||typeof o!=`object`)return;let s=o,c=s._version,l=r.getSnapshot();l.isDeleted||c!=null&&(l.version==null||c>l.version)&&(GJ(`authoritative refetch: applying newer state`,{resourceType:t,resourceId:n,localVersion:l.version,serverVersion:c}),r.setInitialState(s,c,s._field_meta))}var yve=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=up(),a=(0,Q.useContext)(Sz),{doOperation:o,getResourcesRegistry:s}=fm(),c=(0,Q.useMemo)(()=>s(),[s]),l=(0,Q.useMemo)(()=>new UJ(c),[c]),u=(0,Q.useRef)(o);u.current=o;let d=(0,Q.useRef)(new Set),f=(0,Q.useRef)(new Set),p=(0,Q.useRef)(new Map),m=(0,Q.useCallback)((e,t,n)=>{let r=`${e}:${t}`;d.current.has(r)||(d.current.add(r),YJ({resourceType:e,resourceId:t,rmm:n,doOperation:u.current}).catch(n=>{GJ(`authoritative refetch failed`,{resourceType:e,resourceId:t,error:mo(n)})}).finally(()=>{d.current.delete(r)}))},[]),h=(0,Q.useCallback)(async e=>{let t=new Set(e.map(({key:e})=>`rmm:${e}`));for(let e of f.current){if(t.has(e))continue;let n=p.current.get(e);n&&(await i({ownerKey:e,resourceType:n.resourceType,resourceId:n.resourceId,contextResourceIdentifiers:n.contextResourceIdentifiers}),p.current.delete(e))}for(let{key:t,resourceType:n,resourceId:i,rmm:a}of e){let e=`rmm:${t}`;p.current.set(e,{resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers}),await r({ownerKey:e,resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers})}f.current=t},[r,i]);(0,Q.useEffect)(()=>{if(!a)return;let e=a.subscribeActiveInstances(e=>{h(e)});return()=>{e();let t=Array.from(f.current);f.current.clear();for(let e of t){let t=p.current.get(e);t&&(i({ownerKey:e,resourceType:t.resourceType,resourceId:t.resourceId,contextResourceIdentifiers:t.contextResourceIdentifiers}),p.current.delete(e))}}},[a,i,h]),(0,Q.useEffect)(()=>{if(!t||!a)return;let n=e(fa.RESOURCE_UPDATED,e=>{if(e.deliveryTarget===Ja.SCOPE_ROOM_NOTIFICATION){let t=new Set([e.resourceId,...e.affectedIds??[]].filter(e=>!!e));for(let n of t){let t=a.get(e.resourceType,n);t&&m(e.resourceType,n,t)}return}let t=a.get(e.resourceType,e.resourceId);if(!t)return;if(e.deliveryTarget!==Ja.RESOURCE_ROOM_SYNC){GJ(`RESOURCE_UPDATED: notification-grade resource room update, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,deliveryTarget:e.deliveryTarget}),m(e.resourceType,e.resourceId,t);return}let n=e.resourceData,r=e.version;if(!KJ(n)||r==null){GJ(`RESOURCE_UPDATED: sync payload missing replayable object data, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId}),m(e.resourceType,e.resourceId,t);return}let i;try{i=l.validateWebSocketResourceData(n,{resourceType:e.resourceType,operationPathKey:t.readOperationPathKey,operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,dataMode:wz,validationTarget:`canonical-read`})}catch(n){GJ(`RESOURCE_UPDATED: sync payload failed canonical-read validation, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,error:mo(n)}),m(e.resourceType,e.resourceId,t);return}let o=t.getSnapshot(),s=o.confirmedData??{},c=vve(i,s);Object.keys(c).length===0&&r===o.version?GJ(`RESOURCE_UPDATED: no changes detected, skipping`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r}):(GJ(`RESOURCE_UPDATED → applyRemoteUpdate`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r,changedFieldCount:Object.keys(c).length,initiatorUserId:e.initiatorUserId}),t.applyRemoteUpdate(c,r,e.initiatorUserId,e.fieldMeta))}),r=e(fa.RESOURCE_DELETED,e=>{let t=a.get(e.resourceType,e.resourceId);t&&(GJ(`RESOURCE_DELETED → handleDeletion`,{resourceType:e.resourceType,resourceId:e.resourceId,initiatorUserId:e.initiatorUserId}),t.handleDeletion(_E.REMOTE,e.initiatorUserId))});return()=>{n(),r()}},[t,e,a,m,l]);let g=(0,Q.useRef)(n);return(0,Q.useEffect)(()=>{if(!a)return;if(g.current===0){g.current=n;return}if(n<=g.current)return;g.current=n;let e=a.getActiveInstances();if(e.length!==0){GJ(`reconnection detected — syncing versions`,{connectionCount:n,activeRMMCount:e.length}),h(e);for(let{resourceType:t,resourceId:n,rmm:r}of e)m(t,n,r)}},[n,a,m,h]),null},XJ=as.getLogger(),ZJ=XJ.debugByType(`ResourceAutomaticDisplayer`),QJ=2e3,$J=3e4;XJ.setDebugTypeLogging(`ResourceAutomaticDisplayer`,!1);function eY({resourceContext:e,onError:t,className:n,labelsOverride:r,dataMode:i,onDataLoaded:a,parentReferenceConfig:o,navigationZone:s,updateLikeMutationFallbackMode:c=Bt.RMM_REQUIRED,recordNameShownAbove:l=!1}){let{doOperation:u,registry:d}=fm(),{emit:f,resourceRefreshEvent:p}=Mo(),{lastRefreshAt:m}=p({ctx:e}),{tComponent:h,isReady:g,t:_,formatDate:v,formatDateTime:y}=K({component:B.RESOURCES_LAYOUTS_READ,resource:e.resourceType}),[b]=ch(),x=(0,Q.useMemo)(()=>[`resources.${e.resourceType}`,`components.${B.RESOURCES_LAYOUTS_READ}`],[e.resourceType]),S=(0,Q.useRef)(u),C=(0,Q.useRef)(f),w=(0,Q.useRef)(t),T=(0,Q.useRef)(a),D=(0,Q.useRef)(e);S.current=u,C.current=f,w.current=t,T.current=a,D.current=e;let O=(0,Q.useMemo)(()=>new De,[]),{resourceType:k,operation:A,contextResourceIdentifiers:j}=e,M=String(A.operationIdentifier),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[ee,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),te=(0,Q.useMemo)(()=>[{resourceType:k,operation:M}],[k,M]),ne=(0,Q.useMemo)(()=>On.extractDataMode(b,i),[b,i]),re=(0,Q.useMemo)(()=>ne??Hl.RAW,[ne]),ie=(0,Q.useMemo)(()=>{let e;switch(re){case Hl.SUMMARY:e=A.summaryDto||A.responseDto;break;case Hl.CONTEXT:e=A.contextDto||A.responseDto;break;case Hl.RAW:default:e=A.responseDto}return e||XJ.error(`[ResourceAutomaticDisplayer] No DTO found`,{operationIdentifier:M,resourceType:k,dataMode:re}),e},[re,A,M,k]),ae=(0,Q.useMemo)(()=>d.resourceConfigurations[k],[d,k]),oe=ae?.frontendConfiguration?.layout?.refs,se=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(j),[j]),ce=(0,Q.useMemo)(()=>V.buildContextualParameters(j,d),[se,d]),le=(0,Q.useMemo)(()=>Ta.createOperationPathKeyFromOperation(A),[A]),ue=(0,Q.useMemo)(()=>({resourceContext:{resourceType:k,operationId:M},...r}),[k,M,r]),de=(0,Q.useMemo)(()=>{if(ie)try{let e=hr.collectFileFieldPaths(ie);if(e.length===0)return;let t=xa.getApiUrl(),n=`${t}/api/v1/files`,r={},i=N?String(N._id??N[ae?.resourceFieldIdentifier??`_id`]??``):``;if(ae&&i)for(let n of e){let e=QV({registry:d,resourceConfig:ae,operation:A,resourceType:k,fieldName:n,recordId:i,contextResourceIdentifiers:j,contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements,apiBaseUrl:t});e&&(r[n]=e)}let a={};for(let t of e)a[t]={getMetadata:n,serve:r[t],upload:``,override:void 0,delete:``};return a}catch{return}},[ie,ae,A,d,j,ce,k,N]);(0,Q.useEffect)(()=>{let e=!1,t,n=QJ,r=async(i=!1)=>{i||L(null);try{let t=await S.current(le,{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements,dataMode:re},{silent:!0});if(e)return;L(null),P(t)}catch(a){if(e)return;let o=a instanceof Error?a:Error(String(a)),s=a&&typeof a==`object`?a:{},c=O.buildWildoError_Frontend(Va.NOT_FOUND,{customMessageReference:Xl.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:le,context:{resourceType:k,operationIdentifier:M,originalErrorMessage:o.message,originalErrorStack:o.stack,httpCode:s.code,httpContext:s.context}});if(L(c),(xie(a)||ll(a))&&(t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,r(!0)},n),n=Math.min(n*2,$J)),i)return;let l=D.current,{errorRefusalCode:u}=nz(a);C.current(Ec.NOTIFY_RESOURCE_ERROR,{...l,contextResourceIdentifiers:Hu(l.contextResourceIdentifiers),parentResourcesRequirements:l.parentResourcesRequirements||[],additionalContext:{...l.additionalContext,error:o.message,errorCustomMessageReference:Xl.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,...u?{errorRefusalCode:u}:{},...rz(a)}}),w.current?.(o),ZJ(`fetch error`,{resourceType:k,error:o.message})}};return r(),()=>{e=!0,t!==void 0&&clearTimeout(t)}},[k,le,se,O,M,re,m,F]);let fe=(0,Q.useMemo)(()=>{let e=j?.[k];if(e)return On.getResourceId(e);if(N){let e=V.getResourceFieldIdentifierForType(k,d),t=N[e];if(t!=null)return t;let n=ae?.mainSchema?Hee(ae.mainSchema):void 0;if(n)return N[n]}},[j,k,N,d,ae?.mainSchema]),pe=(0,Q.useMemo)(()=>!fe||j?.[k]?j:{...j,[k]:String(fe)},[j,fe,k]),me=(0,Q.useMemo)(()=>{let e=ae?.resourceFieldIdentifier;if(!fe||!e)return ce;let t=String(fe);return String(ce[e]??``)===t?ce:{...ce,[e]:t}},[ce,fe,ae?.resourceFieldIdentifier]),he=fS(hh(ae?.resourceIdentifier,fe==null?void 0:String(fe),pe)),ge=(0,Q.useMemo)(()=>{if(ae)return Gm({resourceConfig:ae,operations:ae.operations??[],registry:d,hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me,viewer:he})},[pe,me,fe,A,d,ae,he]),_e=(0,Q.useMemo)(()=>ge!==void 0,[ge]),{rmm:ve,rmmSnapshot:ye}=Iz({resourceType:k,resourceId:fe==null?null:String(fe),doOperationRef:S,contextualParameters:me,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:pe,resourceSchema:ae?.mainSchema,resourceInheritance:ae?.inheritenceSchemaDefinition,enabled:_e&&fe!=null,conflictPolicy:{strategy:hE.ACCEPT_REMOTE}}),be=(0,Q.useRef)(null);be.current=typeof N?._id==`string`||typeof N?._id==`number`?String(N._id):null;let xe=ve!==null&&!R,Ce=(0,Q.useRef)(!1),we=rV({resourceType:k,rowIds:[fe==null?null:String(fe),be.current],enabled:fe!=null});(0,Q.useEffect)(()=>{if(we!=null&&fe!=null){if(xe&&ve!==null&&!we.madeElsewhere){let e=String(fe);YJ({resourceType:k,resourceId:e,rmm:ve,doOperation:S.current}).catch(t=>{XJ.warn(`[ResourceAutomaticDisplayer] Re-reading the row after it changed failed`,{resourceType:k,resourceId:e,error:mo(t)})})}xe&&Ce.current||I(we.at)}},[we]);let Te=(0,Q.useMemo)(()=>ve?ve.readOperationPathKey:Ez(k,d,{hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me}),[d,k,ve,fe,pe,me]),Ee=R?null:ve;(0,Q.useEffect)(()=>{ZJ(`RMM obtained`,{resourceType:k,resourceId:fe==null?void 0:String(fe),rmmExists:!!ve})},[ve,k,fe]),(0,Q.useEffect)(()=>{z(!1)},[Te,fe,le,k]),(0,Q.useEffect)(()=>{if(!ve||!N)return;let e=ve.getSnapshot();if(e.confirmedData!==null&&m==null)return;if(!Te){z(!0),XJ.warn(`[ResourceAutomaticDisplayer] Cannot seed RMM without an addressable canonical READ`,{resourceType:k,resourceId:fe==null?void 0:String(fe)});return}let t=!1;return(async()=>{let n=Dz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}),r=n?N:await Oz({doOperation:S.current,readOperationPathKey:Te,contextualParameters:me,parentResourcesRequirements:D.current.parentResourcesRequirements});if(t)return;if(typeof r!=`object`||!r){z(!0);return}let i=r,a=i._version??0;ve.setInitialState(i,a,i._field_meta),z(!1),ZJ(`setInitialState`,{resourceType:k,resourceId:fe==null?void 0:String(fe),version:a,fieldCount:Object.keys(i).length,refreshDriven:e.confirmedData!==null,seededFromCanonicalRead:!n})})().catch(e=>{z(!0),XJ.warn(`[ResourceAutomaticDisplayer] Failed to seed RMM from canonical read`,{resourceType:k,resourceId:fe==null?void 0:String(fe),error:mo(e)})}),()=>{t=!0}},[ve,N,re,le,Te,me,k,fe,m]),(0,Q.useEffect)(()=>{if(!ve||!ye?.lastEvent)return;let e=ye.lastEvent;ZJ(`RMM event`,{type:e.type,resourceType:k,resourceId:fe==null?void 0:String(fe)});let t=Te?!Dz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}):!1,n=()=>{t&&S.current(le,{contextualParameters:me,parentResourcesRequirements:D.current.parentResourcesRequirements,dataMode:re}).then(e=>{P(e)}).catch(e=>{XJ.warn(`[ResourceAutomaticDisplayer] Summary/context refetch failed (RMM handler)`,{resourceType:k,error:mo(e)})})};switch(e.type){case uE.MUTATION_RESULT:e.result.success&&(e.source.type===fE.DISPLAY&&C.current(Ec.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ae({contextResourceIdentifiers:D.current.contextResourceIdentifiers,resourceType:k,result:e.result.responseData}),parentResourcesRequirements:D.current.parentResourcesRequirements||[],additionalContext:{...D.current.additionalContext,inlineEdit:!0,fieldName:e.result.savedFields?.[0]},resultSummary:e.result.responseData}),n());break;case uE.REMOTE_UPDATE:case uE.CONFLICT_RESET:n();break;case uE.RESOURCE_DELETED:}},[ye?.lastEvent?.id]);let Oe=(0,Q.useMemo)(()=>Dz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}),[Te,re,le]),ke=re===Hl.SUMMARY||re===Hl.CONTEXT,je=!ke&&Oe&&ve&&ye.optimisticData?ye.optimisticData:N;Ce.current=!ke&&Oe&&xe;let Me=xe?ye.optimisticData:null;(0,Q.useEffect)(()=>{if(je==null)return;let e=Oe?je:Me??void 0;T.current?.(je,{holdsCanonicalRecord:Oe||xe,canonicalRecord:e})},[je,Oe,xe,Me]),(0,Q.useEffect)(()=>{ZJ(`effectiveData source`,{dataMode:re,usingRmmData:Oe&&!!ye?.optimisticData})},[Oe,re,ye?.optimisticData]);let Ne=(0,Q.useCallback)((e,t)=>{P(n=>n&&fA(n,e,t)),C.current(Ec.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ae({contextResourceIdentifiers:D.current.contextResourceIdentifiers,resourceType:k,result:t}),parentResourcesRequirements:D.current.parentResourcesRequirements||[],additionalContext:{...D.current.additionalContext,inlineEdit:!0,fieldName:e},resultSummary:typeof t==`object`&&t?t:fA({},e,t)})},[k]),Pe=ae?.frontendConfiguration?.layout?.display,Fe=ae?.frontendConfiguration?.layout?.defaultChromeMode?.display,Ie=ae?.frontendConfiguration?.layout?.defaultInlineEdit,Le=ae?.frontendConfiguration?.layout?.defaultEmptyValue,Re=ae?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,ze=(0,Q.useMemo)(()=>_ve({explicitTemplate:Pe,displaySchema:ie,defaultDisplayChromeMode:Fe,resourceConfig:ae}),[Pe,ie,Fe,ae]),Be=XV({resourceType:e.resourceType,displayMode:Se.DETAIL,currentObject:je,currentObjectDataMode:re,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s??Cl.PRIMARY,sourceOperation:e.operation}),Ve=(0,Q.useCallback)(t=>{let n=Be.items.find(e=>e.type!==`separator`&&e.type!==`subgroup`&&e.operationIdentifier===t.operationIdentifier);n?.onClick?n.onClick():xa.isDevelopment()&&as.getLogger().warn(`[ResourceAutomaticDisplayer] File "${t.fieldName}" requests operation "${t.operationIdentifier}", which is not available on ${e.resourceType} for the current user/row (unauthorized, condition-disabled, or unknown). The activation is inert.`)},[Be.items,e.resourceType]),He=(0,Q.useMemo)(()=>{if(Pe)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let e=Tj({resourceType:k,schema:ie,parentData:je,registry:d}),t=ae?.frontendConfiguration?.layout?.defaultInlineEdit===E.WRITABLE_FIELDS,n=ie?hr.getObjectLikeFieldShape(ie,{commonOnly:!1}):void 0,r=l&&!t?NA({resourceType:k,registry:d,data:je,t:_,formatDate:v,formatDateTime:y}).filter(e=>{let t=n?.[e];return!t||!Ko(t)}):[];return r.length===0?e:{...e,hiddenFieldNames:[...e.hiddenFieldNames,...r]}},[ie,je,Pe,d,k,ae,l,_,v,y]),Ue=!je,We=(0,Q.useCallback)(async e=>{let t=ae?.operations?.find(t=>String(t.operationIdentifier)===e&&t.isOperationDefault===!0);if(!t)throw Error(`${k} declares no operation ${e}`);return S.current(Ta.createOperationPathKeyFromOperation(t),{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements},{silent:!0})},[ae,k,ce]);if(g===!1)return null;if(ee){let t=ae?.frontendConfiguration?.layout?.readFailure;if(t)return(0,$.jsx)(`div`,{className:n,children:(0,$.jsx)(t,{error:ee,resourceContext:e,askOperation:We})});let r=h(B.RESOURCES_LAYOUTS_READ,`failedToLoadData`),i=r;return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:r}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:i})]})})}if(!ie){let e=h(B.RESOURCES_LAYOUTS_READ,`configurationError`),t=h(B.RESOURCES_LAYOUTS_READ,`noSchemaFound`,{operation:M,resource:k});return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}return(0,$.jsx)(sb,{i18nKeys:x,loadingScopes:te,children:(0,$.jsx)(IB,{schema:ie,data:je,className:n,labels:ue,layoutRefs:oe,resourceType:k,resourceId:fe?String(fe):void 0,contextualParameters:me,contextResourceIdentifiers:pe,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s,inlineEditOperation:ge??null,parentReferenceConfig:o,fileUploadContext:de,rmm:Ee,onInlineEditSuccess:!Ee&&tr(c)?Ne:void 0,updateLikeMutationFallbackMode:c,layoutTemplate:ze,isLoading:Ue,defaultDisplayChromeMode:Fe,defaultInlineEdit:Ie,defaultEmptyValue:Le,defaultSectionAppearance:Re,hiddenFieldNames:He.hiddenFieldNames,inlineEditDisabledFieldNames:He.inlineEditDisabledFieldNames,onFileActivationOperation:Ve})})}eY.displayName=`ResourceAutomaticDisplayer`;var tY=eY,bve=Object.freeze(new Set),xve=Object.freeze({depth:0,visited:bve}),nY=(0,Q.createContext)(xve);function rY(){return(0,Q.useContext)(nY)}var iY=new Set;function Sve(e,t,n,r){iY.has(`${e}:${t}`)||(iY.add(`${e}:${t}`),as.getLogger().warn(t===`cycle`?`[embedded-resource-descent] CYCLE refused at "${e}": this record was already reached on this path, so rendering it again would not terminate. Nothing is rendered here.`:`[embedded-resource-descent] DEPTH LIMIT refused at "${e}": embedded nesting reached ${n} of a maximum ${r}. Nothing is rendered here. Raise the per-edge limit only if this hierarchy genuinely belongs on one page — otherwise link to the child instead of embedding it.`))}function aY({descentKey:e,maxDepth:t=3,children:n}){let r=rY(),i=r.visited.has(e),a=r.depth+1,o=a>t,s=(0,Q.useMemo)(()=>{let t=new Set(r.visited);return t.add(e),{depth:a,visited:t}},[r.visited,e,a]);return i||o?(Sve(e,i?`cycle`:`depth`,a,t),null):(0,$.jsx)(nY.Provider,{value:s,children:n})}var oY=(0,Q.createContext)(null);function sY({children:e}){let t=(0,Q.useRef)({placed:new Set,owned:{current:!1},composedAutomatically:{current:!1}});t.current.placed.clear(),t.current.owned.current=!1,t.current.composedAutomatically.current=!1;let n=(0,Q.useMemo)(()=>t.current,[]);return(0,Q.useEffect)(()=>{let e=t.current;e.composedAutomatically.current&&(e.owned.current||e.placed.size>0)&&Cve([...e.placed])}),(0,$.jsx)(oY.Provider,{value:n,children:e})}var cY=new Set;function Cve(e){let t=e.slice().sort().join(`,`);cY.has(t)||(cY.add(t),as.getLogger().warn(`[composed-children] A template claimed the child region AND the automatic container composed children in the same pass, so children render TWICE${e.length>0?` (placed: ${e.join(`, `)})`:``}. The handshake is render-phase, so the template must render BEFORE the container — check that the surface still renders its display template above <ResourceLayout_ContainerNested>.`))}function lY(e){let t=(0,Q.useContext)(oY);t&&e&&t.placed.add(e)}function uY(){let e=(0,Q.useContext)(oY);return e?e.owned.current||e.placed.size>0:!1}function dY(){let e=(0,Q.useContext)(oY);e&&(e.owned.current=!0)}var wve=Object.freeze(new Set);function fY(e){let t=(0,Q.useContext)(oY);t&&e&&(t.composedAutomatically.current=!0)}function Tve(){return(0,Q.useContext)(oY)?.placed??wve}function Eve(e,t){if(!t)return;let n=On.getResourceId(e[t]);return typeof n==`string`&&n.length>0?n:void 0}function pY(e,t,n){let r=e.initiatorInfos??[];return r.length!==0&&r.some(e=>(e.parameters??[]).every(e=>[e.fieldIdentifier,e.relationshipField,e.resourceType].filter(e=>typeof e==`string`&&e.length>0).some(e=>Eve(t.contextResourceIdentifiers,e)!==void 0||n[e]!==void 0&&String(n[e]).length>0)))}function mY(e){let t=e.operations.filter(t=>pY(t,e.childContext,e.contextualParameters));return nu(t,W.LIST)}function Dve(e){return e.isOneToOne}function Ove(e){return e===cr.COLLAPSIBLE}function kve(e){let t=[];for(let n of e){let e=n.contentSectionConfig.mode;if(Ove(e)){t.push({type:`single`,config:n});continue}let r=JSON.stringify(n.contentSectionConfig),i=t[t.length-1];i?.type===`group`&&i.groupingKey===r?i.configs.push(n):t.push({type:`group`,mode:e,configs:[n],groupingKey:r})}return{items:t}}var hY=new Set;function gY(e,t,n){let r=`${e}->${t}`;hY.has(r)||(hY.add(r),as.getLogger().warn(`[nested-container] "${r}" is not displayable and was SKIPPED: no unambiguous LIST/READ operation could be resolved for the child. The parent surface still renders. Cause: ${mo(n)}`))}var _Y=new Set;function Ave(e,t){let n=`${e}->${t.childResourceType}`;_Y.has(n)||(_Y.add(n),as.getLogger().warn(`[nested-container] owned child "${n}" composes NOTHING: no addressable ${t.isOneToOne?`READ`:`LIST`} operation resolves for the child in this parent context. Common cause: the child operation is contextPolicy-disabled (e.g. operationOverrides.LIST.enabled=false) or not addressable here. Surface the child explicitly (a composite view / EmbedRelatedResourceOperation) or enable the operation.`))}var vY=({resourceContext:e,navigationZone:t,navigationInitiator:n,parentData:r})=>{let{resourceType:i}=e,{registry:a}=fm(),{tResourceHeader:o,isReady:s}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:i}),{navigate:c}=DS(),{currentBreakpoint:l}=Wg(),u=uY(),d=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_CONTAINER_NESTED}`],[i]),f=(0,Q.useMemo)(()=>a.resourceConfigurations[i],[a,i]),p=(0,Q.useMemo)(()=>f?.resourceRelationships?Hi(f.resourceRelationships):[],[f]),m=(0,Q.useMemo)(()=>{if(p.length===0)return[];let t=[];for(let n of p){let s=Sj({parentResourceType:i,relationship:n,parentData:r,registry:a,viewport:l});if(!s)continue;let c=s.childResourceType,u=a.resourceConfigurations[c];if(!u)continue;let d=s.isOneToOne,p;try{p=On.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:d?W.READ:W.LIST,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){gY(i,c,e);continue}let m=V.buildContextualParameters(p.contextResourceIdentifiers,a),h=d?ph({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!On.getResourceId(p.contextResourceIdentifiers?.[c]),contextResourceIdentifiers:p.contextResourceIdentifiers,contextualParameters:m}):p&&m?mY({operations:u.operations??[],childContext:p,contextualParameters:m}):void 0;if(!d&&h){let t;try{t=On.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:String(h.operationIdentifier),operation:h,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){gY(i,c,e);continue}let n=On.getResourceId(e.contextResourceIdentifiers?.[i])||void 0,r=s.relationship.isPrimaryScope===!0;if(n!==void 0)try{r=GG({childContext:t,hostResourceType:i,hostResourceId:n,hostRelationships:f?.resourceRelationships,selectedForeignKey:s.foreignKeyField,registry:a})===t}catch{r=!1}if(!r)continue}if(!h){Ave(i,s);continue}let g=Kp({tResourceHeader:o,resourceType:c,key:`title`});t.push({...s,label:g})}return t},[p,f,a,e,i,o,r,l]),h=(0,Q.useMemo)(()=>kve(m),[m]),g=(0,Q.useMemo)(()=>{let t=e.contextResourceIdentifiers?.[i];if(t)return typeof t==`string`?t:t.resourceId},[e.contextResourceIdentifiers,i]),_=(0,Q.useCallback)((t,n)=>On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:String(n.operationIdentifier),operation:n,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),[a,e,i]),v=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.READ,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return ph({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!On.getResourceId(r.contextResourceIdentifiers?.[t.childResourceType]),contextResourceIdentifiers:r.contextResourceIdentifiers,contextualParameters:o})},[a,e,i]),y=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.LIST,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return mY({operations:n.operations??[],childContext:r,contextualParameters:o})},[a,e,i]),b=(0,Q.useCallback)(e=>{let n=a.resourceConfigurations[e.childResourceType]?e.isOneToOne?v(e):y(e):void 0;if(!n)return;let r=_(e,n);c({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:t,sourceOperation:vl(n),sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},relationshipTransition:e.transition,relationshipMaxDepth:e.navigationConfig?.maxDepth})},[_,a,c,t,i,g,v,y]),x=e=>{if(e.transition)return(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>b(e),children:e.label},e.relationshipEdgeKey);let r=a.resourceConfigurations[e.childResourceType];if(Dve(e)){let t=r?v(e):void 0;if(t){let n=_(e,t);return(0,$.jsx)(tY,{resourceContext:n},e.relationshipEdgeKey)}return null}let o=r?y(e):void 0;if(!o)return null;let s=_(e,o),c={parentResourceType:i,parentResourceId:g,transition:typeof e.transition==`string`?e.transition:e.transition?.transition};return(0,$.jsx)(dX,{resourceContext:s,navigationZone:t,navigationInitiator:n,inlineParentContext:c,sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},e.relationshipEdgeKey)},S=(0,Q.useCallback)(e=>({id:e.relationshipEdgeKey,title:e.label,content:(0,$.jsx)(aY,{descentKey:`nested:${e.relationshipEdgeKey}::${g||`no-row`}`,children:(0,$.jsx)(Kk.Provider,{value:!0,children:x(e)})})}),[x,g]);return fY(m.length>0&&s&&!u),m.length===0||!s||u?null:(0,$.jsx)(sb,{i18nKeys:d,children:(0,$.jsx)(`div`,{className:`space-y-section`,children:h.items.map((e,t)=>e.type===`single`?(0,$.jsx)(WO,{config:{...e.config.contentSectionConfig,...e.config.contentSectionConfig.mode===cr.COLLAPSIBLE?{showSingleSectionNav:!0}:{}},sections:[S(e.config)]},e.config.relationshipEdgeKey):(0,$.jsx)(WO,{config:e.configs[0].contentSectionConfig,sections:e.configs.map(S)},`relationship-group-${e.mode}-${t}`))})})};function yY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_CONTAINER_NESTED,`ResourceLayout_ContainerNested`)(e);return(0,$.jsx)(n,{...t})}var bY=(0,Q.memo)(({resourceContext:e,navigationZone:t,navigationInitiator:n,currentObject:r,currentObjectDataMode:i,displayMode:a=Se.DETAIL,onOperationExecuted:o,size:s=Y.ICON_SM,maxDisplayed:c,excludeOperations:l,placementFilter:u,hostRowOpensRead:d=!1,orientation:f,className:p})=>{let{resourceType:m,operation:h}=e,g=ym()?.getResourceConfiguration(m)?.frontendConfiguration?.layout,_=g?.actionLabelDisplayMode?.[a],v=Q.useContext(s_)?.UIConfig?.currentBreakpoint===Sl.MOBILE,y=g?.actionDisclosure?.[a]?.maxPrimaryActions??c??(v?a===Se.SUMMARY?0:1:void 0)??se(a,g?.actionDisclosure).maxPrimaryActions,{items:b,isConfirmDialogOpen:x,confirmDialogLabel:S,confirmDialogDescription:C,confirmDialogConfirmLabel:w,confirmRequiresTypedConfirmation:T,confirmConfirmationPhrase:E,onConfirm:D,onCancel:O,ephemeralFields:k,onEphemeralAcknowledge:A}=XV({resourceType:m,displayMode:a,currentObject:r,...i?{currentObjectDataMode:i}:{},contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:h,excludeOperations:l,placementFilter:u,suppressViewDetails:d,onOperationExecuted:o});return b.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(QS,{items:b,maxDisplayed:y,labelDisplayMode:_,orientation:f,size:s,className:p}),x&&(0,$.jsx)(Iw,{open:x,onOpenChange:e=>{e||O()},cancelCallback:O,validationCallback:D,label:S,description:C,confirmLabel:w,requireTypedConfirmation:T,confirmationPhrase:E}),k&&(0,$.jsx)(aG,{open:!0,onAcknowledge:A,fields:k,resourceType:m})]})});function xY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`ResourceLayout_OperationsItems`)(e);return(0,$.jsx)(n,{...t})}function SY({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DANGER_ZONE,`DangerZone`)(e);return(0,$.jsx)(n,{...t})}function CY({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_HEADING,`Heading`)(e);return(0,$.jsx)(n,{...t})}function wY({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_SUBHEADING,`Subheading`)(e);return(0,$.jsx)(n,{...t})}var TY=({resourceContext:e,navigationZone:t,currentObject:n,onOperationExecuted:r,className:i,responsiveMaxWidth:a})=>{let{resourceType:o,operation:s}=e,{tComponent:c,tResourceOperation:l}=K({component:B.RESOURCES_LAYOUTS_DANGER_ZONE,resource:o}),{items:u,isConfirmDialogOpen:d,confirmDialogLabel:f,confirmDialogDescription:p,confirmDialogConfirmLabel:m,confirmRequiresTypedConfirmation:h,confirmConfirmationPhrase:g,onConfirm:_,onCancel:v}=XV({resourceType:o,displayMode:Se.DETAIL,currentObject:n,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:s,placementFilter:nc.DANGER_ZONE,onOperationExecuted:r}),y=(0,Q.useMemo)(()=>u.flatMap(e=>e.type===`subgroup`?e.items.filter(e=>e.type!==`separator`&&e.type!==`subgroup`):e.type===`separator`?[]:[e]),[u]);if(y.length===0)return null;let b=e=>c(B.RESOURCES_LAYOUTS_DANGER_ZONE,e),x=b(`title`),S=e=>{switch(e){case zi.CRITICAL:return b(`descriptionCritical`);case zi.HIGH:return b(`descriptionHigh`);default:return b(`descriptionDefault`)}},C=e=>(e.operationIdentifier?l(o,e.operationIdentifier,`description`):``)||S(e.riskLevel);return(0,$.jsxs)(`section`,{"data-slot":`danger-zone-section`,"data-inline-size-tier":a,className:U(`mr-auto w-full flex flex-col gap-field-sm`,i),style:{maxInlineSize:nD(a)},children:[(0,$.jsx)(CY,{level:3,children:x}),(0,$.jsx)(SY,{className:`rounded-xl p-0 overflow-hidden divide-y divide-destructive/20`,children:y.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(y_,{children:e.label}),(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:C(e)})]}),(0,$.jsx)(X,{variant:Hd(e.variant,XS(e)),disabled:e.disabled,onClick:e.onClick,className:`shrink-0 self-start sm:self-auto`,children:e.label})]},t))}),d&&(0,$.jsx)(Iw,{open:d,onOpenChange:e=>{e||v()},cancelCallback:v,validationCallback:_,label:f,description:p,confirmLabel:m,requireTypedConfirmation:h,confirmationPhrase:g})]})};function EY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_DANGER_ZONE,`ResourceLayout_DangerZone`)(e);return(0,$.jsx)(n,{...t})}var jve=as.getLogger(),DY;(function(e){e.IDLE=`idle`,e.LOADING=`loading`,e.READY=`ready`,e.NOT_SHAREABLE=`not_shareable`,e.FAILED=`failed`})(DY||={});function OY(e,t){return(e?.resourceConfigurations[ul.ORGANIZATION_RELATIONSHIPS]?.operations)?.find(e=>String(e.operationIdentifier)===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function kY(e,t,n,r){let i=ul.ORGANIZATION_RELATIONSHIPS,a={...tm.buildResourceOperationContextIdentifiers({currentOrganizationId:n,primaryScope:e.resourceConfigurations[i]?.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),...r?{[i]:r}:{}};return{operationPathKey:Ta.buildOperationPathKeyFromOperation(t),contextualParameters:V.buildContextualParameters(a,e),parentResourcesRequirements:On.buildParentResourcesRequirements(i,a,e)}}function Mve(e){let t=e;return(t?.response?.data?.error?.details?.code??t?.context?.code)===nee.RELATIONSHIP_RECORD_NOT_SHAREABLE}var AY={relationships:[],viaRelationshipId:null,sharedWithRelationshipIds:[],commonToEveryRelationship:!1};function Nve(e){let t=(0,Q.useContext)(sm),n=t?.registry,r=(0,Q.useRef)(t?.doOperation);r.current=t?.doOperation;let[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(DY.IDLE),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(AY),{enabled:f,organizationId:p,resourceType:m,recordId:h}=e,[g,_]=(0,Q.useState)(void 0),v=f&&p&&h?`${p}|${m}|${h}`:void 0,y=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{let e=r.current,t=OY(n,ce.READ_RECORD_SHARING);if(!f||!n||!e||!p||!h||!t){y.current=void 0,_(void 0),s(DY.IDLE),l(!1),d(AY);return}let i=!1,a=`${p}|${m}|${h}`;return y.current===a?l(!0):(y.current=void 0,l(!1),d(AY),s(DY.LOADING)),(async()=>{try{let r=kY(n,t,p),o=vte.parse(await e(r.operationPathKey,{contextualParameters:r.contextualParameters,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{resourceType:m,recordId:h}},{silent:!0}));if(i)return;d({relationships:o.relationships.map(({representingOrganizationName:e,...t})=>({...t,...e?{name:e}:{}})),viaRelationshipId:o.viaRelationshipId,sharedWithRelationshipIds:o.sharedWithRelationshipIds,commonToEveryRelationship:o.commonToEveryRelationship}),y.current=a,_(a),s(DY.READY),l(!1)}catch(e){if(i)return;if(y.current=void 0,_(a),l(!1),d(AY),Mve(e)){s(DY.NOT_SHAREABLE);return}jve.warn(`[RecordSharing] The record's sharing could not be read`,{resourceType:m,backendRefusal:jr(e)}),s(DY.FAILED)}})(),()=>{i=!0}},[f,n,p,m,h,i]);let b=(0,Q.useCallback)(async(e,t)=>{let i=r.current,o=OY(n,e);if(!n||!i||!o||!p||!h)throw Error(`The ${e} operation of organization relationships is not available in this frontend.`);let s=kY(n,o,p,t);l(!0);try{await i(s.operationPathKey,{contextualParameters:s.contextualParameters,parentResourcesRequirements:s.parentResourcesRequirements,requestData:{resourceType:m,recordId:h}})}finally{a(e=>e+1)}},[n,p,m,h]),x=(0,Q.useCallback)(e=>b(ce.SHARE_RECORD,e),[b]),S=(0,Q.useCallback)(e=>b(ce.UNSHARE_RECORD,e),[b]);return o!==DY.IDLE&&o!==DY.LOADING&&g!==v?{readState:DY.LOADING,refreshing:!1,relationships:AY.relationships,viaRelationshipId:AY.viaRelationshipId,sharedWithRelationshipIds:AY.sharedWithRelationshipIds,commonToEveryRelationship:AY.commonToEveryRelationship,share:x,unshare:S}:{readState:o,refreshing:c,relationships:u.relationships,viaRelationshipId:u.viaRelationshipId,sharedWithRelationshipIds:u.sharedWithRelationshipIds,commonToEveryRelationship:u.commonToEveryRelationship,share:x,unshare:S}}function Pve(e,t){let n=e?._id??(t?e?.[t]:void 0);return(typeof n==`string`||typeof n==`number`)&&String(n).length>0?String(n):void 0}function jY(e){let t=e.registry?.resourceConfigurations[e.resourceType];if(!t||!A(e.resourceType,t.resourcePrimaryScope)||ure.includes(e.resourceType)||!e.recordId||!e.currentOrganizationId||e.recordOrganizationId!==e.currentOrganizationId||!e.grants)return!1;let n=e.registry?.resourceConfigurations[ul.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope,r=t=>!!t&&Um({...t,resourceType:ul.ORGANIZATION_RELATIONSHIPS,resourcePrimaryScope:n},e.viewer);return r(OY(e.registry,ce.READ_RECORD_SHARING))&&r(OY(e.registry,ce.SHARE_RECORD))&&!!OY(e.registry,ce.UNSHARE_RECORD)}var MY=({resourceContext:e,currentObject:t,className:n,responsiveMaxWidth:r})=>{let{resourceType:i}=e,{tComponent:a,formatList:o}=K({component:B.RESOURCES_LAYOUTS_RECORD_SHARING,resource:i}),s=(e,t)=>a(B.RESOURCES_LAYOUTS_RECORD_SHARING,e,t),c=(0,Q.useContext)(sm)?.registry,l=Zp()?.currentOrganizationId??void 0,u=Pve(t,c?.resourceConfigurations[i]?.resourceFieldIdentifier),d=(typeof t?.organizationId==`string`&&t.organizationId.length>0?t.organizationId:void 0)??hh(i,u,e.contextResourceIdentifiers),f=fS(d),p=hS()[vv.GRANTS],m=jY({registry:c,resourceType:i,recordId:u,recordOrganizationId:d,currentOrganizationId:l,grants:p,viewer:f}),h=Nve({enabled:m,organizationId:d,resourceType:i,recordId:u}),[g,_]=(0,Q.useState)(void 0),[v,y]=(0,Q.useState)(void 0),[b,x]=(0,Q.useState)(!1),S=`${i}|${u??``}`,[C,w]=(0,Q.useState)(S);C!==S&&(w(S),_(void 0),y(void 0));let T=(0,Q.useMemo)(()=>new Map(h.relationships.map(e=>[e.relationshipId,e])),[h.relationships]),E=e=>T.get(e)?.name??s(`unnamedRelationship`),D=h.relationships.filter(e=>e.wouldReadIfShared&&!h.sharedWithRelationshipIds.includes(e.relationshipId)),O=e=>e!==void 0&&D.some(t=>t.relationshipId===e),k=h.readState!==DY.LOADING&&!h.refreshing;k&&g!==void 0&&!O(g)&&_(void 0),k&&v!==void 0&&!O(v)&&y(void 0);let A=g,j=v,M=h.relationships.filter(e=>e.readsWithoutShare&&e.relationshipId!==h.viaRelationshipId),N=h.relationships.filter(e=>e.confersNow),P=!h.commonToEveryRelationship&&N.length>0&&N.every(e=>!e.rolesReachRecord),F=h.viaRelationshipId===null?void 0:T.get(h.viaRelationshipId),I=e=>{let t=T.get(e);if(!t?.confersNow)return s(`relationshipInactive`);if(t.readsWithoutShare)return s(`readsWithoutShare`);if(!t.rolesReachRecord)return s(`shareHasNoEffect`)};if(!m||h.readState!==DY.READY&&h.readState!==DY.FAILED||h.readState===DY.READY&&h.viaRelationshipId===null&&h.sharedWithRelationshipIds.length===0&&D.length===0&&M.length===0)return null;let ee=b||h.refreshing,L=e=>{x(!0),e().then(()=>_(void 0)).catch(()=>void 0).finally(()=>x(!1))},R=OY(c,ce.SHARE_RECORD),z=e=>{is(R?.riskLevel)?y(e):L(()=>h.share(e))};return(0,$.jsxs)(`section`,{"data-slot":`record-sharing-section`,"data-inline-size-tier":r,className:U(`mr-auto w-full flex flex-col gap-field-sm`,n),style:{maxInlineSize:nD(r)},children:[(0,$.jsx)(CY,{level:3,children:s(`title`)}),(0,$.jsx)(EF,{className:`rounded-xl p-0 overflow-hidden divide-y divide-border`,children:h.readState===DY.FAILED?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`readFailed`)})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs px-card py-card`,children:[(0,$.jsx)(Z,{size:Le.SM,children:h.viaRelationshipId===null?s(`ownRecord`):s(`createdThrough`,{relationship:E(h.viaRelationshipId)})}),h.viaRelationshipId!==null&&!F?.confersNow&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`relationshipInactive`)}),h.viaRelationshipId!==null&&F?.confersNow&&!F.rolesReachRecord&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`creatorCannotRead`)}),(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:h.commonToEveryRelationship?s(`commonToEveryRelationship`):s(P?`notReadableByRelationships`:`description`)}),M.length>0&&!h.commonToEveryRelationship&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`alreadyReadBy`,{relationships:o(M.map(e=>E(e.relationshipId)))})})]}),h.sharedWithRelationshipIds.length===0?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`notShared`)})}):h.sharedWithRelationshipIds.map(e=>{let t=I(e);return(0,$.jsxs)(`div`,{"data-slot":`record-sharing-share`,className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(y_,{children:E(e)}),t!==void 0&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:t})]}),(0,$.jsx)(X,{variant:J.OUTLINE,disabled:ee,onClick:()=>L(()=>h.unshare(e)),className:`shrink-0 self-start sm:self-auto`,children:s(`withdraw`)})]},e)}),D.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center`,children:[(0,$.jsx)(mF,{name:`recordSharingRelationship`,schema:bd(),options:D.map(e=>({value:e.relationshipId,label:E(e.relationshipId)})),value:A,onChange:_,placeholder:s(`chooseRelationship`),size:Zd.SM,disabled:ee}),(0,$.jsx)(X,{variant:J.SECONDARY,disabled:ee||!A,onClick:()=>{A&&z(A)},className:`shrink-0 self-start sm:self-auto`,children:s(`share`)})]})]})}),j!==void 0&&(0,$.jsx)(Iw,{open:!0,onOpenChange:e=>{e||y(void 0)},cancelCallback:()=>y(void 0),validationCallback:()=>{let e=j;y(void 0),L(()=>h.share(e))},label:s(`confirmShareTitle`,{relationship:E(j)}),description:s(`confirmShareDescription`),confirmLabel:s(`share`)})]})};function NY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_RECORD_SHARING,`ResourceLayout_RecordSharing`)(e);return(0,$.jsx)(n,{...t})}var PY=(0,Q.createContext)(void 0);function FY(){return(0,Q.useContext)(PY)}function Fve(e){let{registry:t,doOperation:n}=fm(),[r,i]=(0,Q.useState)(void 0),a=(0,Q.useMemo)(()=>{if(!e.enabled)return!1;let n=t.resourceConfigurations[e.resourceContext.resourceType];return(n?.resourceRelationships?Hi(n.resourceRelationships):[]).some(e=>e.discriminator!=null||e.condition!=null)},[e.enabled,e.resourceContext.resourceType,t]),o=rV({resourceType:e.resourceContext.resourceType,rowIds:[On.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),typeof r?._id==`string`?r._id:null],enabled:a}),s=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(!a){i(void 0);return}let r=t.resourceConfigurations[e.resourceContext.resourceType];if(!r){i(void 0);return}let o=V.buildContextualParameters(e.resourceContext.contextResourceIdentifiers,t),c=On.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),l=ph({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!!c,contextResourceIdentifiers:e.resourceContext.contextResourceIdentifiers,contextualParameters:o});if(!l){i(void 0);return}let u=Ta.createOperationPathKeyFromOperation(l),d=`${u}|${JSON.stringify(o)}`,f=s.current===d;s.current=d;let p=!1;return n(u,{contextualParameters:o,parentResourcesRequirements:e.resourceContext.parentResourcesRequirements}).then(e=>{p||(e&&typeof e==`object`&&!Array.isArray(e)&&!(`data`in e)?i(e):i(void 0))}).catch(()=>{!p&&!f&&i(void 0)}),()=>{p=!0}},[n,e.resourceContext.contextResourceIdentifiers,e.resourceContext.parentResourcesRequirements,e.resourceContext.resourceType,t,a,o?.at]),r}var IY=({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i,showCharts:a=!0})=>{let{goBack:o,canGoBack:s,navigate:c}=DS(),{getZoneState:l}=zx(),{registry:u}=fm(),{tComponent:d,isReady:f}=K({component:B.RESOURCES_LAYOUTS_READ}),{resourceContext:p,resourceType:m,operation:h,isSemanticCustomOperation:g,reportError:_,resolvePreferredOperation:v,navigateToResourceOperation:b}=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),[x,S]=(0,Q.useState)(void 0),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),k=(0,Q.useCallback)((e,t)=>{S(e),w(!1),E(t.canonicalRecord),O(t.holdsCanonicalRecord)},[]),A=D??String(p.operation.operationIdentifier)===W.READ,j=(0,Q.useMemo)(()=>A?{record:T,failed:C}:void 0,[A,T,C]),M=yp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_READ,key:`displayFailed`}),N=yp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_READ,key:`semanticOperationFailed`}),P=Fve({resourceContext:p,enabled:g}),F=(0,Q.useMemo)(()=>wj({inlineParentContext:r,navigationZone:t,navigationInitiator:n,getZoneState:l}),[r,t,n,l]),I=(0,Q.useCallback)(e=>{let n=F?.parentReference,r=n?.parentResourceType,i=t?l(t):void 0,a=i&&i.activeTabId===void 0?i.stack[i.stack.length-2]:void 0;if(a?.content.contentType===sd.RESOURCE_OPERATION&&a.content.resourceContext.resourceType===r&&On.getAddressedRecordId(a.content.resourceContext)===e&&s(t))return o(t),!0;if(!n||!r)return!1;let d=u.resourceConfigurations[r];if(!d)return!1;let f=p.contextResourceIdentifiers??{},m=p.parentResourcesRequirements??[],h=m[m.length-1]?.resourceType===r?m.slice(0,-1):On.buildParentResourcesRequirements(r,f,u),g={};for(let e of h){let t=e.foreignKeyField??e.resourceType,n=f[t]??f[e.resourceType],r=On.getResourceId(n);r&&(e.foreignKeyField?g[t]={fieldIdentifier:e.foreignKeyField,resourceId:r}:g[e.resourceType]=r)}g[r]=e;let _=V.buildContextualParameters(g,u),v=ph({resourceConfig:d,operations:d.operations??[],coreOperation:W.READ,registry:u,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:g,contextualParameters:_});if(!v)return!1;let y=On.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:v,contextResourceIdentifiers:g,parentResourcesRequirements:h}),b=dh.resolveResourceUrl(d,v,Hu(g),u.allResourceFieldIdentifiers,h);return c({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:y},initiator:{sourceZone:t},urlPath:b?.resolvedUrl}),!0},[s,p.contextResourceIdentifiers,p.parentResourcesRequirements,l,o,c,F,t,u]),ee=(0,Q.useMemo)(()=>{let e=F?.parentReference;if(e)return{parentResourceType:e.parentResourceType,parentResourceId:e.parentResourceId,displayMode:e.parentDisplay??na.CONTEXT,showParentLink:e.showParentLink,onNavigateToParent:I}},[F,I]),L=(0,Q.useCallback)(e=>{w(!0),_(e,M,`ResourceLayoutPreset_Read_Default`)},[M,_]),R=(0,Q.useCallback)(e=>{let n=vl(e);if(n!==W.DELETE&&n!==W.DELETE_MANY)return;if(s(t)||t!==Cl.PRIMARY){o(t);return}let r=v(W.LIST);if(!r)return;let{[m]:i,...a}=p.contextResourceIdentifiers??{};b({operation:r,contextResourceIdentifiers:a,parentResourcesRequirements:p.parentResourcesRequirements})},[o,s,t,v,b,m,p.contextResourceIdentifiers,p.parentResourcesRequirements]),z=(0,Q.useMemo)(()=>V.flattenContextIdentifiers(p.contextResourceIdentifiers),[p.contextResourceIdentifiers]);return f===!1?null:g?(0,$.jsx)(PU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,navigationZone:t,navigationInitiator:n,children:(0,$.jsxs)(sY,{children:[(0,$.jsx)(uV,{resourceContext:p,navigationZone:t,navigationInitiator:n,errorMessage:N,errorComponent:`ResourceLayoutPreset_Read_Default`,headerActions:(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.ACTION_BAR}),recordNavigation:(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.RECORD_NAVIGATION})}),(0,$.jsxs)(xD,{voice:y.EYEBROW,children:[(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.CONTENT}),(0,$.jsx)(yY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:P})]})]})}):(0,$.jsx)(PU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,navigationZone:t,navigationInitiator:n,children:(0,$.jsx)(sY,{children:(0,$.jsxs)(`div`,{className:`space-y-section [--record-body-max-inline-size:var(--measure-max-width,42rem)] has-[[data-record-body]_[data-guidance-display][data-inline-size-tier=derived]_[data-collection-surface]]:[--record-body-max-inline-size:none] has-[[data-record-body]_[data-guidance-display][data-inline-size-tier=none]]:[--record-body-max-inline-size:none]`,children:[(0,$.jsx)(oV,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentReferenceConfig:ee,heldRecord:j,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.ACTION_BAR}),(0,$.jsx)(xY,{resourceContext:p,currentObject:x,navigationZone:t,navigationInitiator:n,displayMode:Se.DETAIL,placementFilter:nc.PRIMARY,size:Y.ICON_SM,onOperationExecuted:R})]})}),(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.RECORD_NAVIGATION}),(0,$.jsx)(`div`,{"data-record-body":!0,children:(0,$.jsx)(tY,{resourceContext:p,navigationZone:t,onError:L,onDataLoaded:k,parentReferenceConfig:ee,recordNameShownAbove:!0})}),(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,showCharts:a,renderSlot:rX.CONTENT}),(0,$.jsxs)(xD,{voice:y.EYEBROW,children:[(0,$.jsx)(PY.Provider,{value:x,children:i}),(0,$.jsx)(yY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:x})]}),(0,$.jsx)(NY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:x,className:`[max-inline-size:var(--record-body-max-inline-size)]`}),(0,$.jsx)(EY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:x,onOperationExecuted:R,className:`[max-inline-size:var(--record-body-max-inline-size)]`})]})})})},LY=(0,Q.createContext)(new Set);function RY({preset:e,...t}){let n=KW(t.resourceContext.operation),r=qW(t.resourceContext.operation),i=e??r??xi.DEFAULT,a=(0,Q.useContext)(LY),o=(0,Q.useMemo)(()=>Ta.createOperationPathKeyFromOperation(t.resourceContext.operation),[t.resourceContext.operation]),s=!!n&&a.has(o),c=(0,Q.useMemo)(()=>n&&!s?new Set([...a,o]):a,[n,s,a,o]);if(n&&!s)return(0,$.jsx)(LY.Provider,{value:c,children:(0,$.jsx)(n,{...t})});let l=G(B.RESOURCES_LAYOUTS_READ,`ResourceLayout_Read`)(i);return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(l,{...t})})}var zY=as.getLogger(),BY=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r})=>{let{resourceType:i,operation:a,resourceConfig:o,operationInitiator:s,contextualParameters:c,navigateToResourceOperation:l}=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tComponent:u,tResourceFieldDisplay:d,tResourceFieldEnumValue:f}=K({component:[B.RESOURCES_LAYOUTS_SEARCH,B.RESOURCES_LAYOUTS_LIST],resource:i}),p=cp(),m=e=>u(B.RESOURCES_LAYOUTS_SEARCH,e),{renderIcon:h}=Mf(),{getRecipe:g}=Wg(),_=g(cc.INTERACTIVE,In.GHOST),{registry:v,doOperation:y}=fm(),[b]=ch(),x=a.operationFrontendConfig?.collectionDisplayConfig,S=x?.cardLayout,C=x?.cardActionPlacement,w=x?.selectable??!1,T=S?.style===$l.GRID,E=S?.style===$l.GRID?S.columns:void 0,D=o?.resourceFieldIdentifier,k=ZV({idField:D}),A=Ux(),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)([]),ee=(0,Q.useRef)(null),L=Oq(ee,k.selectionCount>0),R=Dq(k.selectionCount>0),z=F.length>0&&F.every(e=>k.isSelected(e)),te=(0,Q.useCallback)(()=>{F.length>0&&F.every(e=>k.isSelected(e))?F.forEach(e=>k.deselectItem(e)):F.forEach(e=>k.selectItem(e))},[F,k]),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(()=>{let e=a,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[ce,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)([]),[fe,pe]=(0,Q.useState)({});(0,Q.useEffect)(()=>{k.clearSelection()},[N,fe]);let me=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_SEARCH}`],[i]),he=a?.operationIdentifier??W.SEARCH,{isInitialLoad:ge,isRefreshing:_e}=rb(_g({resourceType:i,operation:he})),ve=(0,Q.useRef)(y),ye=(0,Q.useRef)(e),be=(0,Q.useRef)(ue),xe=(0,Q.useRef)(fe);ve.current=y,ye.current=e,be.current=ue,xe.current=fe;let Se=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),Ce=(0,Q.useMemo)(()=>IG.searchOperationAcceptsATerm(a),[a]),we=(0,Q.useMemo)(()=>IG.detectSummaryFields(o),[o]),Te=(0,Q.useMemo)(()=>yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_SEARCH,key:`resultsLabel`}),[u]),Ee=(0,Q.useMemo)(()=>{let e={};for(let t of we)e[t]=d(i,t,`label`);return e},[we,i,d]),De=(0,Q.useCallback)(e=>o?ph({resourceConfig:o,operations:o.operations??[],coreOperation:W.READ,registry:v,hasResourceId:On.getResourceId(e[i]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,v)})??null:null,[v,o,i]),{sortFields:Oe,filterFields:ke,filtersEnabled:Ae}=(0,Q.useMemo)(()=>{let t=a,n=t?.sortFields??[],r=IG.parseFilterFieldDefinitions(t?.filterFields,o?{registry:v,resourceConfig:o,operation:a,contextualParameters:c,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),i=IG.withoutPinnedFilterFields(r,e.pinnedFilters);return{sortFields:n,filterFields:i,filtersEnabled:i.length>0}},[a,v,o,c,e.parentResourcesRequirements,e.pinnedFilters]),je=(0,Q.useMemo)(()=>On.extractDataMode(b,r),[b,r]),Me=(0,Q.useMemo)(()=>Ta.createOperationPathKeyFromOperation(a),[a]),Ne=IG.matchListingOf(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{P(j)},300);return()=>clearTimeout(e)},[j]);let Pe=ue.map(e=>`${e.field}:${e.direction}`).join(`,`),Fe=(0,Q.useMemo)(()=>JSON.stringify(fe),[fe]),Ie=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]),{emit:Le}=Mo();(0,Q.useEffect)(()=>{Le(Ec.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:i,filterValues:xe.current})},[Fe,i,Le]);let Re=`${i}|${Me}|${Se}|${N}|${oe.page}|${oe.limit}|${Pe}|${Fe}|${Ie}|${Ce}`;(0,Q.useEffect)(()=>{if(!N&&!ie&&Ce)return;let e=!1,t=!1,n=()=>{t||(t=!0,le(!1))};return(async()=>{le(!0),re(null),ae(!0);try{let t=IG.withPinnedFilters(xe.current,ye.current.pinnedFilters),n=Object.keys(t).length>0?t:void 0,r={contextualParameters:c,searchQuery:N||void 0,filters:n,pagination:{page:oe.page,limit:oe.limit},sort:be.current.length?[...be.current]:void 0,parentResourcesRequirements:ye.current.parentResourcesRequirements,dataMode:je},i=await ve.current(Me,r);if(e)return;if(i&&typeof i==`object`&&`data`in i&&`pagination`in i){let e=i;I(e.data),se(e.pagination)}else Array.isArray(i)&&(I(i),se(e=>({...e,total:i.length,totalPages:1})))}catch(t){if(e)return;let n=O(t);re({message:p(t)}),zY.error(`[ResourceLayoutPreset_Search_Default] Search error:`,{...n,error:t})}finally{e||n()}})(),()=>{e=!0,n()}},[Re]);let ze=(0,Q.useCallback)(e=>{if(!o)return;let t=V.getResourceObjectId(e,o.resourceFieldIdentifier);if(!t){zY.error(`[ResourceLayoutPreset_Search] Result click ignored: could not resolve resource id from search result.`,{resourceType:i,fieldIdentifier:o.resourceFieldIdentifier,itemKeys:Object.keys(e??{})});return}let n=On.buildRecordIdentifiersFromCollection(ye.current.contextResourceIdentifiers,i,t),r=De(n);r&&l({operation:r,contextResourceIdentifiers:n,parentResourcesRequirements:ye.current.parentResourcesRequirements,initiatorOverride:s})},[o,o?.resourceFieldIdentifier,i,l,s,De]),Be=(0,Q.useCallback)(e=>{de(e),se(e=>({...e,page:1}))},[]),Ve=(0,Q.useCallback)(e=>{pe(e),se(e=>({...e,page:1}))},[]),He=(0,Q.useCallback)(e=>{e.preventDefault(),P(j)},[j]),Ue=h(H.SEARCH,{size:ca.SM});return(0,$.jsx)(sb,{i18nKeys:me,readiness:[{id:`search-initial-load`,isReady:!ge}],renderLoading:()=>(0,$.jsx)(pm,{template:`list`,density:`auto`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,"aria-label":`Loading`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),Ce&&(0,$.jsxs)(`form`,{onSubmit:He,role:`search`,className:`flex gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(QM,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:m(`placeholder`),"aria-label":m(`placeholder`),prefix:Ue})}),(0,$.jsx)(X,{type:`submit`,disabled:ce,children:m(`search`)})]}),(Ae||Oe.length>0&&ie)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[Ae&&ke.length>0&&(0,$.jsx)(YK,{resourceType:i,filterFields:ke,currentFilters:fe,onFiltersChange:Ve}),Oe.length>0&&ie&&(0,$.jsx)(hq,{resourceType:i,sortFields:Oe,currentSorts:ue,onSortChange:Be})]}),w&&ie&&(F.length>0||k.selectionCount>0||R.backgroundRunState!==Eq.NONE)&&(0,$.jsxs)(`div`,{ref:ee,className:`flex flex-nowrap items-center gap-element`,"data-slot":`collection-selection-row`,children:[F.length>0&&(0,$.jsx)(Sq,{state:xq(F.length,F.filter(e=>k.isSelected(e)).length),onToggle:te}),(0,$.jsx)(bq,{count:k.selectionCount,onClear:k.clearSelection,...z&&!k.matchAllSelection&&oe.total>F.length&&Ne?{matchAllOffer:{matchedCount:oe.total,onSelectAllMatching:()=>k.selectAllMatching({filters:IG.withPinnedFilters(fe,e.pinnedFilters),...N?{search:N}:{},listing:Ne,matchedCount:oe.total})}}:{},...k.matchAllSelection?{isMatchAllSelected:!0}:{}}),R.isBulkBarMounted&&(0,$.jsx)(`div`,{className:`ms-auto min-w-0`,children:(0,$.jsx)(Tq,{density:L.density,onActionSetChange:L.reportActionSet,onBackgroundRunChange:R.onBackgroundRunChange,children:(0,$.jsx)(LJ,{resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:k.selectedItems,selectedItemsDataMode:je,matchAllSelection:k.matchAllSelection,explicitIdSelection:k.explicitIdSelection,onSelectIds:k.selectIds,idField:D,onSelectionClear:k.clearSelection,onSelectionReplace:k.selectAll})})})]}),ne&&(0,$.jsx)(Wy,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_SEARCH,key:`errorLoading`}),message:ne.message}),A.isCreateActive&&(0,$.jsx)(jG,{navigationZone:t,className:`border border-border rounded-lg`}),ie&&!ne&&(0,$.jsxs)($.Fragment,{children:[F.length===0?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`})}):(0,$.jsx)(`div`,{className:`space-y-item-sm`,children:(0,$.jsx)(`ul`,{role:`list`,"aria-label":Te,style:CG(E),className:U(SG(E),_e&&`opacity-70 transition-opacity duration-150 motion-reduce:transition-none`),"aria-busy":ge||_e||void 0,children:F.map((n,r)=>{let a=o?.resourceFieldIdentifier;if(!a)throw V.buildConfigurationError(Xl.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:i,component:`ResourceLayoutPreset_Search`});let s=V.getResourceObjectId(n,a);return A.isElementActive(s)?(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(jG,{navigationZone:t})},s||r):(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(AG,{item:n,resourceType:i,resourceConfig:o,registry:v,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:we,fieldLabelsMap:Ee,tResourceFieldEnumValue:f,onItemClick:ze,cardActionPlacement:C,selectable:w,isSelected:k.isSelected(n),selectionActive:k.selectionCount>0,onToggleSelect:k.toggleSelection,selectAriaLabel:u(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:r+1}),interactiveClasses:{hover:_.states.hover,transition:_.motion.transition}})},s||r)})})}),(0,$.jsx)(QG,{pagination:oe,onPaginationChange:se})]})]})})};function VY({preset:e,...t}){let n=KW(t.resourceContext.operation),r=qW(t.resourceContext.operation),i=e??r??Au.DEFAULT,a=n?(0,$.jsx)(n,{...t}):Q.createElement(G(B.RESOURCES_LAYOUTS_SEARCH,`ResourceLayout_Search`)(i),t);return(0,$.jsx)(Hx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[mA]:!0,children:a})})}var HY=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_UPDATE}),{resourceContext:a,operation:o,isSemanticCustomOperation:s,navigateToPreferredRead:c,goBackWithinZone:l,reportError:u}=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),d=yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_UPDATE,key:`formUpdateFailed`}),f=yp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_UPDATE,key:`semanticOperationFailed`}),{closeOverlay:p}=DS(),m=(0,Q.useCallback)(()=>{o.isBulkOperation?l():c({transitionOverride:t===rr.OVERLAY?Rt.PROMOTE:void 0})},[l,c,t,o.isBulkOperation]),h=QR(a,o),g=(0,Q.useCallback)(e=>{h(e),m()},[h,m]),_=(0,Q.useCallback)(e=>{u(e,d,`ResourceLayoutPreset_Update_Default`)},[d,u]),v=(0,Q.useMemo)(()=>t===rr.OVERLAY?()=>p():void 0,[t,p]);return i?s?(0,$.jsx)(uV,{resourceContext:a,navigationZone:t,navigationInitiator:n,errorMessage:f,errorComponent:`ResourceLayoutPreset_Update_Default`,onSuccess:m,onCancel:v}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:a,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(mB,{resourceContext:a,navigationZone:t,onSuccess:g,onError:_,onCancel:v,showErrorSummary:!0})]}):null};function UY({preset:e,...t}){let n=KW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=qW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.RESOURCES_LAYOUTS_UPDATE,`ResourceLayout_Update`)(i);return(0,$.jsx)(a,{...t})}function WY({resourceContext:e,navigationZone:t,navigationInitiator:n}){let r={resourceContext:e,navigationZone:t,navigationInitiator:n},i=As(e.operation),a;switch(i){case`create`:a=(0,$.jsx)(sG,{...r});break;case`list`:a=(0,$.jsx)(dX,{...r});break;case`read`:a=(0,$.jsx)(RY,{...r});break;case`update`:a=(0,$.jsx)(UY,{...r});break;case`search`:a=(0,$.jsx)(VY,{...r});break;default:a=(0,$.jsx)(YW,{...r})}return(0,$.jsx)(uC,{...r,children:a})}function GY(e){return`${ai.COMPOSITE_VIEWS}.${e}`}function KY(e){return`${ai.VIEWS}.${e.family}.${e.translationRef}`}function qY(e){return`app.${e}`}function JY(e,t){return`resources.${e}.${t}`}function YY(e){let t=jp(e);if(!t)return Ep(e);if(t.viewKind===bp.COMPOSITE_VIEW)return t.hostKind===Bp.RESOURCE?pp(t.hostRef,t.localRef):Ep(t.localRef)}function XY(e){let t=jp(e.viewRef);if(e.contentType===sd.CHART_VIEW)return t?.viewKind===bp.CHART_VIEW?{family:au.CHART,translationRef:JY(t.hostRef,t.localRef)}:{family:au.CHART,translationRef:qY(e.viewRef)};if(e.contentType===sd.EXECUTION_VIEW)return t?.viewKind===bp.EXECUTION_VIEW?{family:au.EXECUTION,translationRef:JY(t.hostRef,t.localRef)}:{family:au.EXECUTION,translationRef:qY(e.viewRef)};if(e.contentType===sd.FULL_CUSTOM_VIEW)return{family:au.FULL_CUSTOM,translationRef:qY(e.viewRef)};if(e.contentType===sd.FLOWS_ACTORS_VIEW)return{family:au.FLOWS_ACTORS,translationRef:qY(e.viewRef)}}function ZY(e){if(e.contentType===sd.COMPOSITE_VIEW){let t=YY(e.viewRef);return t?e.tCompositeView(t,`title`):e.viewRef}let t=XY({viewRef:e.viewRef,contentType:e.contentType});return t?e.tView(t.family,t.translationRef,`title`):e.viewRef}var Ive={[sd.FULL_CUSTOM_VIEW]:`view-custom-`,[sd.EXECUTION_VIEW]:`view-execution-`,[sd.FLOWS_ACTORS_VIEW]:`view-flows-`,[sd.CHART_VIEW]:`view-chart-`},QY=({viewRef:e,contentType:t,hasAuthoredIcon:n=!1,iconViewRef:r,navigationZone:i=rr.PRIMARY,className:a})=>{let o=qk(),s=(0,Q.useMemo)(()=>{if(t===sd.COMPOSITE_VIEW){let t=YY(e);return t?[GY(t)]:[]}let n=XY({viewRef:e,contentType:t});return n?[KY(n)]:[]},[e,t]),{tCompositeView:c,tView:l,isReady:u}=K({keys:s}),{renderIcon:d}=Mf(),{title:f,description:p}=(0,Q.useMemo)(()=>{if(t===sd.COMPOSITE_VIEW){let t=YY(e);return t?{title:c(t,`title`),description:c(t,`description`)}:{title:``,description:``}}let n=XY({viewRef:e,contentType:t});return n?{title:l(n.family,n.translationRef,`title`),description:l(n.family,n.translationRef,`description`)}:{title:``,description:``}},[t,e,c,l]),m=(0,Q.useMemo)(()=>{if(!n)return null;let i=Ive[t];return i?d({category:re.CUSTOM,customReference:`${i}${r??e}`},{size:ca.LG}):null},[n,t,e,r,d]);return!u||o||!f?null:(0,$.jsxs)(`div`,{className:U(a),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-field`,children:[(0,$.jsx)(yB,{host:_B.SURFACE,navigationZone:i}),m&&(0,$.jsx)(`div`,{className:`shrink-0`,children:m}),(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 text-xl font-semibold text-foreground`,children:f})]}),p&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:p})]})};function Lve(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-${crypto.randomUUID()}`:`execution-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var $Y=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=rr.PRIMARY})=>{let i=Zp(),{doOperation:a,registry:o}=fm(),{navigate:s}=DS(),{tComponent:c,isReady:l}=K({component:B.HIGH_LEVEL_VIEWS_EXECUTION}),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)({}),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)({}),S=t??Dp({viewRef:e,registry:o}),C=(0,Q.useMemo)(()=>Lve(),[S?.ref]);(0,Q.useEffect)(()=>{},[n,S,e]);let w=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:i?.currentUserId,organizationId:i?.currentOrganizationId,applicationId:i?.currentApplicationId,anonymousUserId:i?.currentAnonymousUserId}),t=S?.primaryScope?tm.primaryScopeToContextIdentifiers(e,S.primaryScope):{},r=i?.buildContextResourceIdentifiers()??{},a=tm.filterCustomScopeContextResourceIdentifiers(r);if(!S)return tm.mergeContextResourceIdentifiers(t,a,n);let o=tm.getAllowedViewBindingKeys({primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements});return tm.resolveViewContextResourceIdentifiers({surfaceName:`ExecutionView`,surfaceRef:S.ref,primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:a,explicitContextResourceIdentifiers:tm.scopeContextToBindingContract(n,o)})},[n,S?.primaryScope,S?.ref,S?.parentResourcesRequirements,S?.additionalResourceRequirements,i?.currentUserId,i?.currentOrganizationId,i?.currentApplicationId,i?.currentAnonymousUserId,i]),T=(0,Q.useMemo)(()=>S?gve(S,n):null,[S,n]),E=(0,Q.useMemo)(()=>({embeddedContent:u,localPane:f,pendingActions:m,participationPrefetchActions:g,dirtyMarkers:v,failedActions:b}),[u,f,m,g,v,b]),D=(0,Q.useMemo)(()=>S?Use({viewDefinition:S,registry:o,anchor:T,contextResourceIdentifiers:w,explicitContextResourceIdentifiers:n}):{},[T,w,n,o,S]),O=(0,Q.useMemo)(()=>({delegateToParent:e=>{s({content:e.content,urlPath:e.urlPath,contextResourceIdentifiers:e.contextResourceIdentifiers,relationshipTransition:e.relationshipTransition,initiator:{sourceZone:r,...e.initiator??{}}})},openEmbeddedContent:e=>{uy(e.content),d(e),y(e=>Iy(e,sy.EMBEDDED_CONTENT)),x(e=>gy(e,dy.EMBEDDED_CONTENT))},closeEmbeddedContent:()=>{d(null),y(e=>Iy(e,sy.EMBEDDED_CONTENT)),x(e=>gy(e,dy.EMBEDDED_CONTENT))},openLocalPane:(e,t)=>{ly(t),p({paneId:e,payload:t}),y(t=>Ly(t,e)),x(t=>_y(t,e))},closeLocalPane:()=>{p(null),y(e=>Ly(e,null)),x(e=>_y(e,null))},beginPendingAction:e=>{h(t=>({...t,[e.actionRuntimeId]:e}))},endPendingAction:e=>{h(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},beginParticipationPrefetch:e=>{oy(e),_(t=>({...t,[e.prefetchRuntimeId]:e}))},endParticipationPrefetch:e=>{_(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},markDirty:e=>{cy(e),y(t=>({...t,[e.markerId]:e}))},clearDirty:e=>{y(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},clearAllDirty:()=>{y(e=>Object.keys(e).length===0?e:{})},captureFailedAction:e=>{fy(e),x(t=>({...t,[e.failureRuntimeId]:e}))},clearFailedAction:e=>{x(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},clearAllFailedActions:()=>{x(e=>Object.keys(e).length===0?e:{})},clearFailedActionsForPrefetchKey:e=>{x(t=>by(t,e))}}),[s,r]);if(!S)return(0,$.jsx)(g_,{viewKind:`execution`,viewRef:e});if(!l)return null;let k=e=>yp({tComponent:c,componentType:B.HIGH_LEVEL_VIEWS_EXECUTION,key:e}),A=S.viewComponent,j=E.embeddedContent,M=j?.content??null,N=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(A,{viewRef:S.ref,viewDefinition:S,contextResourceIdentifiers:w})});return(0,$.jsxs)(hy,{viewDefinition:S,contextResourceIdentifiers:w,runtimeInstanceId:C,navigationZone:r,doOperation:a,navigation:O,anchor:T,participations:D,runtimeState:E,children:[(0,$.jsx)(QY,{viewRef:e??S.ref,iconViewRef:S.ref,contentType:sd.EXECUTION_VIEW,hasAuthoredIcon:!!S.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Jy,{children:M?(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-group xl:grid-cols-[minmax(0,1fr)_minmax(360px,480px)]`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-col`,children:N}),(0,$.jsxs)(`aside`,{className:`flex min-w-0 min-h-0 flex-col overflow-hidden rounded-lg border bg-background`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b px-card py-item-sm`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:k(`embeddedTitle`)}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:k(`embeddedDescription`)})]}),(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:()=>{O.closeEmbeddedContent()},children:k(`embeddedClose`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,$.jsx)(Ny,{scope:{scope:sy.EMBEDDED_CONTENT},children:(0,$.jsx)(WY,{resourceContext:M.resourceContext,navigationZone:r,navigationInitiator:j?.navigationInitiator})})})]})]}):N})]})};function eX(e){let t={};for(let[n,r]of Object.entries(e.contextResourceIdentifiers)){let e=On.getResourceId(r);if(e&&(t[n]=e,typeof r==`object`&&r&&`fieldIdentifier`in r)){let n=r.fieldIdentifier;typeof n==`string`&&n.length>0&&(t[n]=e)}}return t}function tX(e,t){return!e||e.length===0||e.every(e=>{if(e.requirement!==Be.MANDATORY||e.isPrimaryScope)return!0;let n=e.foreignKeyField?t[e.foreignKeyField]:void 0,r=t[e.resourceType];return!!(n??r)})}function nX({resourceContext:e,viewRef:t,navigationZone:n,navigationInitiator:r}){let i=(0,Q.useMemo)(()=>vp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>eX(e),[e]);return(0,$.jsx)(VU,{viewRef:i.insertedViewRef,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r})}function Rve({resourceContext:e,viewRef:t,inputs:n,urlParamValues:r,className:i}){let{registry:a}=fm(),o=(0,Q.useMemo)(()=>xp(e.resourceType,{ref:t}),[e.resourceType,t]),s=(0,Q.useMemo)(()=>eX(e),[e]),c=a.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(e=>e.ref===t);if(!c)throw Bve(`Cannot resolve resource-owned chart view "${t}" on resource "${e.resourceType}".`,{resourceType:e.resourceType,viewRef:t});return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)($h,{requiredFeatures:c.chartDefinition.requiredFeatures,children:(0,$.jsx)(VJ,{viewRef:o.insertedViewRef,viewDefinition:c,runtimeDescriptor:gp({identity:o,chartView:c,contextResourceIdentifiers:s}),contextResourceIdentifiers:s,inputs:n,urlParamValues:r,localErrorOnly:!0})})})}function zve({resourceContext:e,viewRef:t,navigationZone:n,className:r}){let i=(0,Q.useMemo)(()=>dp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>eX(e),[e]);return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)($Y,{viewRef:i.insertedViewRef,navigationZone:n,contextResourceIdentifiers:a})})}function Bve(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{component:`ResourceOwnedViewEmbeds`,message:e,...t})}var rX;(function(e){e.ACTION_BAR=`action_bar`,e.RECORD_NAVIGATION=`record_navigation`,e.CONTENT=`content`,e.ALL=`all`})(rX||={});var iX=(0,Q.createContext)(new Set);function aX({resourceContext:e,navigationZone:t,navigationInitiator:n,className:r=``,chartHeight:i=320,showCharts:a=!0,renderSlot:o=rX.ALL}){let{registry:s}=fm(),c=(0,Q.useContext)(iX),{navigate:l}=DS(),{renderIcon:u}=Mf(),d=s.resourceConfigurations[e.resourceType]?.frontendConfiguration,f=(0,Q.useMemo)(()=>(d?.compositeViews??[]).map(e=>GY(e.translationRef)),[d?.compositeViews]),p=(0,Q.useMemo)(()=>[...(d?.chartViews??[]).map(t=>KY({family:au.CHART,translationRef:JY(e.resourceType,t.ref)})),...(d?.executionViews??[]).map(t=>KY({family:au.EXECUTION,translationRef:JY(e.resourceType,t.ref)}))],[d?.chartViews,d?.executionViews,e.resourceType]),{tCompositeView:m,tResourceHeader:h,tResourceOperation:g,tView:_}=K({keys:[...f,...p]}),v=(0,Q.useMemo)(()=>eX(e),[e]),b=e.operation,x=b.isOperationDefault===!0||!b.variantKey,S=String(b.operationIdentifier),C=bD(),w=S===W.READ?y.EYEBROW:C,{getRecipe:T}=Wg(),E=(0,Q.useMemo)(()=>x?S:mp([S,String(b.variantKey)]),[S,x,b.variantKey]),D=(0,Q.useMemo)(()=>x?(d?.compositeViews??[]).filter(e=>String(e.operationLike)===S&&tX(e.parentResourcesRequirements,v)):[],[v,S,d?.compositeViews,x]),O=(0,Q.useMemo)(()=>x?(d?.chartViews??[]).filter(e=>String(e.operationLike)===S&&tX(e.parentResourcesRequirements,v)):[],[v,S,d?.chartViews,x]),k=(0,Q.useMemo)(()=>(d?.executionViews??[]).filter(e=>(e.surfaceInOperations??[]).some(e=>mp(e)===E)&&tX(e.parentResourcesRequirements,v)),[v,E,d?.executionViews]),A=(0,Q.useMemo)(()=>{if(D.length===0&&O.length===0&&k.length===0)return[];let t={registry:s,contextResourceIdentifiers:v,views:{},tResourceHeader:h,tResourceOperation:g,tViewTitle:(e,t)=>ZY({viewRef:e,contentType:t,tCompositeView:m,tView:_}),t:e=>e,settingsSectionIcon:()=>void 0,settingsSectionLabel:()=>void 0,settingsSectionVisible:null,viewerRoles:null},n=[];for(let r of D)r.isAddressable?oX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:b.operationIdentifier,familyLabel:`composite`,launcher:r.launcher}):c.has(r.ref)||n.push({type:`embedded-composite`,ref:r.ref});if(a)for(let t of O)n.push({type:`chart`,ref:t.ref,chartView:t,title:_(au.CHART,JY(e.resourceType,t.ref),`title`)});for(let r of k)oX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:b.operationIdentifier,familyLabel:`execution`,launcher:r.launcher});return n},[c,D,O,k,v,b.operationIdentifier,s,e.resourceType,a,m,_,h,g]),j=(0,Q.useCallback)(e=>{l({content:{contentType:e.kind,viewRef:e.ref,contextResourceIdentifiers:e.contextResourceIdentifiers},initiator:{sourceZone:t},urlPath:e.urlPath})},[l,t]),M=(0,Q.useMemo)(()=>{if(o===rX.ALL)return A;let e={[Fp.ACTION_BAR]:rX.ACTION_BAR,[Fp.RECORD_NAVIGATION]:rX.RECORD_NAVIGATION,[Fp.CONTENT_CARD]:rX.CONTENT};return A.flatMap(t=>{if(t.type!==`launcher-group`)return o===rX.CONTENT?[t]:[];let n=t.views.filter(t=>e[t.presentation.placement]===o);return n.length>0?[{...t,views:n}]:[]})},[A,o]);return M.length===0?null:(0,$.jsx)(xD,{voice:w,children:(0,$.jsx)(`div`,{className:U(`space-y-section`,r),"data-testid":`resource-layout-inserted-views`,children:M.map((r,a)=>r.type===`embedded-composite`?(0,$.jsx)(iX.Provider,{value:new Set([...c,r.ref]),children:(0,$.jsx)(nX,{resourceContext:e,viewRef:r.ref,navigationZone:t,navigationInitiator:n})},`embedded-composite:${r.ref}:${a}`):r.type===`chart`?(0,$.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:[r.title&&(0,$.jsx)(`h3`,{className:U(`mb-element-sm`,w?T(cc.TYPOGRAPHY,w).base:`text-sm font-medium text-foreground`),children:r.title}),(0,$.jsx)($h,{requiredFeatures:r.chartView.chartDefinition.requiredFeatures,children:(0,$.jsx)(VJ,{viewDefinition:r.chartView,runtimeDescriptor:gp({identity:xp(e.resourceType,r.chartView),chartView:r.chartView,contextResourceIdentifiers:v}),height:i,localErrorOnly:!0})})]},`chart:${r.ref}:${a}`):(0,$.jsx)(Vve,{renderSlot:o,children:r.views.map(e=>(0,$.jsx)($h,{requiredFeatures:e.requiredFeatures,children:(0,$.jsxs)(X,{"data-testid":`inserted-view-launcher-${e.ref}`,type:`button`,variant:e.presentation.emphasized?J.DEFAULT:o===rX.RECORD_NAVIGATION?J.GHOST:J.OUTLINE,size:Y.SM,onClick:()=>j(e),"aria-label":e.presentation.showLabel?void 0:e.label,title:e.presentation.showLabel&&o!==rX.ACTION_BAR?void 0:e.label,children:[e.iconReference?u(e.iconReference,{size:ca.SM}):e.kind===sd.COMPOSITE_VIEW?u({category:re.COMPOSITE_VIEW,viewReference:e.ref},{size:ca.SM}):u({category:re.CUSTOM,customReference:`view-execution-${e.ref}`},{size:ca.SM}),e.presentation.showLabel&&(0,$.jsx)(`span`,{className:o===rX.ACTION_BAR?`@max-[48rem]/resource-header:sr-only`:void 0,children:e.label})]})},`${e.kind}:${e.ref}`))},`launcher-group:${a}`))})})}function Vve({renderSlot:e,children:t}){return e===rX.ACTION_BAR?(0,$.jsx)($.Fragment,{children:t}):e===rX.RECORD_NAVIGATION?(0,$.jsx)(`nav`,{className:`-mt-element flex flex-wrap items-center gap-item-xs border-b border-border pb-element-sm`,children:t}):(0,$.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-item-sm`,children:t})})}function Hve(e){return e?.contentType===sd.COMPOSITE_VIEW||e?.contentType===sd.EXECUTION_VIEW}function oX(e){let{resolvedSegments:t,resolutionContext:n,resourceType:r,viewRef:i,operationIdentifier:a,familyLabel:o,launcher:s}=e,c=Jm({kind:hu.RESOURCE_VIEW,resourceType:r,viewRef:i},n);if(!c)throw sX(`Operation "${String(a)}" on resource "${r}" could not resolve resource-owned ${o} view "${i}".`);if(!Hve(c))throw sX(`Operation "${String(a)}" on resource "${r}" resolved ${o} view "${i}" into unsupported content type "${c.contentType}".`);let l={kind:c.contentType,ref:c.viewRef,label:c.label,iconReference:c.iconReference,urlPath:c.urlPath,contextResourceIdentifiers:c.contextResourceIdentifiers,requiredFeatures:c.requiredFeatures,presentation:Mm(s)},u=t[t.length-1];u?.type===`launcher-group`?u.views.push(l):t.push({type:`launcher-group`,views:[l]})}function sX(e){return V.buildConfigurationError(Xl.CONFIGURATION,{component:`ResourceLayout_InsertedViews`,message:e})}var cX=as.getLogger(),lX=cX.debugByType(`ResourceLayoutPreset_List_Default`);cX.setDebugTypeLogging(`ResourceLayoutPreset_List_Default`,!1);var uX=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r,sourceRelationship:i,showCharts:a=!0,defaultViewMode:o=_u.CARDS})=>{let{resourceType:s,operation:c,operationId:l,resourceConfig:u,operationInitiator:d,contextualParameters:f,resolvePreferredOperation:p,navigateToResourceOperation:m}=aC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tResourceHeader:h,tResourceFieldDisplay:g,tResourceFieldEnumValue:_,tResourceOperation:v,tComponent:y,formatDate:b,formatDateTime:x,isReady:S,resolvedRegionalPreferences:C}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:s}),{t:w}=K({resource:s}),T=cp(),{renderIcon:E}=Mf(),{registry:D,doOperation:k}=fm(),[A]=ch(),{getRecipe:j}=Wg(),M=j(cc.INTERACTIVE,In.GHOST),N=(0,Q.useMemo)(()=>({...d,sourceRelationship:i??n?.sourceRelationship}),[d,i,n?.sourceRelationship]),P=c.operationFrontendConfig?.collectionDisplayConfig,F=P?.displayMode??o??_u.CARDS,I=P?.userSwitchableDisplayMode??!1,ee=P?.quickFilterField,L=IG.withoutPresetsAssigningPinnedFields(P?.presetFilters,e.pinnedFilters),R=e.collectionToolbar!==Cu.HIDDEN,z=P?.filterPanel,te=P?.temporalGroupField,ne=P?.enumGroupField,re=P?.board,ie=P?.calendar,ae=P?.timeline,oe=P?.cardLayout,se=P?.cardActionPlacement,ce=P?.selectable??!1,le=oe?.style===$l.GRID,ue=oe?.style===$l.GRID?oe.columns:void 0,{viewMode:de,setViewMode:fe}=uve(s,F),pe=I?de:F,me=(0,Q.useMemo)(()=>[_u.CARDS,_u.TABLE,...re?[_u.BOARD]:[],...ie?[_u.CALENDAR]:[],...ae?[_u.TIMELINE]:[]],[re,ie,ae]),he=me.includes(pe)?pe:_u.CARDS,ge=u?.resourceFieldIdentifier,_e=Ux(),ve=ZV({idField:ge}),[ye,be]=(0,Q.useState)([]),xe=ye.length>0&&ye.every(e=>ve.isSelected(e)),Ce=xq(ye.length,ye.filter(e=>ve.isSelected(e)).length),{isSelected:we,selectItem:Te,deselectItem:Ee,toggleSelection:De}=ve,Oe=(0,Q.useCallback)(()=>{ye.length>0&&ye.every(e=>we(e))?ye.forEach(e=>Ee(e)):ye.forEach(e=>Te(e))},[ye,we,Te,Ee]),[ke,Ae]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(()=>{let e=c,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[Ne,Pe]=(0,Q.useState)(!1),[Fe,Ie]=(0,Q.useState)([]),[Le,Re]=(0,Q.useState)({}),ze=(0,Q.useMemo)(()=>[`resources.${s}`,`components.${B.RESOURCES_LAYOUTS_LIST}`],[s]),Be=(0,Q.useMemo)(()=>[{id:`initial-data`,isReady:Ne}],[Ne]),Ve=(0,Q.useCallback)(()=>{Me(e=>({...e,page:1}))},[]),He=(0,Q.useRef)(k),Ue=(0,Q.useRef)(Fe),We=(0,Q.useRef)(Le);He.current=k,Ue.current=Fe,We.current=Le,(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]);let Ge=(0,Q.useMemo)(()=>Object.entries(f).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[f]),Ke=fS(YV(e.contextResourceIdentifiers,void 0)??void 0),qe=(0,Q.useMemo)(()=>{if(!u)return{create:null,read:null,search:null};let t=p(W.CREATE,{requireLiteralIdentifier:!0}),n=t?.operationFrontendConfig;return{create:t&&n&&!fr(n)&&n.actionVisibility!==ho.HIDDEN&&Um({...t,resourceType:e.resourceType,resourcePrimaryScope:u.resourcePrimaryScope},Ke)?t:null,read:p(W.READ,{requireAddressable:!0})||null,search:p(W.SEARCH)||null}},[u,p,Ke,e.resourceType]),Je=(0,Q.useCallback)(e=>{if(!u)return null;let t=t=>ph({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:D,hasResourceId:On.getResourceId(e[s]).length>0,requireFrontendAddressable:t,preferredVariantKey:c?.variantKey,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,D)})??null,n=t(!0);if(n)return n;let r=t(!1);return r&&r.operationFrontendConfig&&!fr(r.operationFrontendConfig)?r:null},[c,D,u,s]),Ye=(0,Q.useMemo)(()=>{let e=[{resourceType:s,operation:l}];return qe.search&&e.push({resourceType:s,operation:String(qe.search.operationIdentifier)}),e},[s,l,qe.search]),Xe=(0,Q.useMemo)(()=>u?.frontendConfiguration?.emptyState,[u]),{sortFields:Ze,filterFields:Qe,searchEnabled:$e,filtersEnabled:et}=(0,Q.useMemo)(()=>{let t=c,n=qe.search,r=(t?.sortFields?.length?t.sortFields:n?.sortFields)??[],i=t?.filterFields&&Object.keys(t.filterFields).length>0?t.filterFields:n?.filterFields,a=IG.parseFilterFieldDefinitions(i,u?{registry:D,resourceConfig:u,operation:c,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),o=t?.searchEnabled??!0,s=t?.filtersEnabled??!0;return{sortFields:r,filterFields:IG.withoutPinnedFilterFields(a,e.pinnedFilters),searchEnabled:o,filtersEnabled:s}},[qe.search,c,D,u,f,e.parentResourcesRequirements,e.pinnedFilters]),tt=C?.timezone,nt=(0,Q.useMemo)(()=>F_e(C?.locale),[C?.locale]),rt=jl.calendarDateToday({timezone:tt}),[it,at]=(0,Q.useState)(()=>EJ(rt)),ot=(0,Q.useCallback)(e=>at(EJ(e)),[]),st=ie&&he===_u.CALENDAR?Qe.find(e=>e.fieldName===ie.dateField&&e.fieldType===MG.DATE):void 0,ct=(0,Q.useMemo)(()=>ie?PG(u?.mainSchema,u?.inheritenceSchemaDefinition).has(ie.dateField):!1,[ie,u]),lt=(0,Q.useMemo)(()=>I_e(it,nt),[it,nt]),ut=!!ae&&he===_u.TIMELINE&&[ae.startField,ae.endField].every(e=>Qe.some(t=>t.fieldName===e&&t.fieldType===MG.DATE)),dt=(0,Q.useMemo)(()=>PG(u?.mainSchema,u?.inheritenceSchemaDefinition),[u]),ft=(0,Q.useMemo)(()=>K_e(it),[it]),pt=(0,Q.useMemo)(()=>{if(ie&&st)return{[ie.dateField]:z_e(L_e(lt),ct,tt)};if(ae&&ut)return J_e({startField:ae.startField,endField:ae.endField,startIsCalendarDate:dt.has(ae.startField),endIsCalendarDate:dt.has(ae.endField),timeZone:tt,firstDay:ft[0],lastDay:ft[ft.length-1]})},[ie,st,lt,ct,tt,ae,ut,dt,ft]),mt=(0,Q.useRef)(pt);mt.current=pt;let ht=(0,Q.useMemo)(()=>JSON.stringify(pt??{}),[pt]);(0,Q.useEffect)(()=>{Me(e=>e.page===1?e:{...e,page:1})},[ht]);let{quickFilterDef:gt,panelFilterFields:_t}=(0,Q.useMemo)(()=>{if(!ee)return{quickFilterDef:void 0,panelFilterFields:Qe};let e=Qe.find(e=>e.fieldName===ee&&e.fieldType===MG.ENUM&&(e.enumValues?.length??0)>0);return e?{quickFilterDef:e,panelFilterFields:Qe.filter(t=>t!==e)}:{quickFilterDef:void 0,panelFilterFields:Qe}},[Qe,ee]),vt=(0,Q.useMemo)(()=>IG.detectSummaryFields(u),[u]),yt=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`errorLoading`}),[y]),bt=(0,Q.useMemo)(()=>v(s,W.CREATE,`title`),[v,s]),xt=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`}),[y]),St=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`listLabel`}),[y]),Ct=(0,Q.useMemo)(()=>{let e={};for(let t of vt)e[t]=g(s,t,`label`);return e},[vt,s,g]),wt=(0,Q.useMemo)(()=>On.extractDataMode(A,r,Hl.SUMMARY),[A,r]),Tt=(0,Q.useMemo)(()=>Ta.createOperationPathKeyFromOperation(c),[c]),Et=(0,Q.useMemo)(()=>IG.searchOperationAcceptsATerm(qe.search)&&YG({listOperation:c,searchOperation:qe.search??void 0,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements,pinnedFilters:e.pinnedFilters,resourceType:s,resourceFieldIdentifier:String(u?.resourceFieldIdentifier??``),registry:D}),[qe.search,f,c,D,u,e.parentResourcesRequirements,e.pinnedFilters,s]),Dt=(0,Q.useMemo)(()=>!qe.search||!Et?null:Ta.createOperationPathKeyFromOperation(qe.search),[qe.search,Et]),Ot=sK({enabled:$e&&!!qe.search&&Et,onDebouncedChange:Ve}),kt=Ot.debouncedQuery;(0,Q.useEffect)(()=>{ve.clearSelection()},[Le,kt]);let At=(0,Q.useRef)(e);At.current=e;let jt=Fe.map(e=>`${e.field}:${e.direction}`).join(`,`),Mt=(0,Q.useMemo)(()=>JSON.stringify(Le),[Le]),Nt=e.pinnedFilters,Pt=(0,Q.useMemo)(()=>JSON.stringify(Nt??{}),[Nt]),{emit:Ft,resourceCollectionRefreshEvent:It}=Mo(),{lastRefreshAt:Lt}=It({ctx:(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:V.resolveCollectionRefreshScope({operation:c,contextResourceIdentifiers:e.contextResourceIdentifiers,contextualParameters:f,targetResourceType:s,targetDefaultFieldIdentifier:String(u?.resourceFieldIdentifier??``),parentResourcesRequirements:e.parentResourcesRequirements})}),[f,c,u?.resourceFieldIdentifier,e,s])});(0,Q.useEffect)(()=>{Ft(Ec.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:s,filterValues:We.current})},[Mt,s,Ft]);let Rt=kt.length>0&&!!Dt,zt=`${s}|${Rt?Dt:Tt}|${Ge}|${je.limit}|${jt}|${Mt}|${Pt}|${ht}|${kt}|${Lt??0}`,Bt=`${zt}|page:${je.page}`,Vt=(0,Q.useCallback)(async(e,t,n)=>{let r=IG.withPinnedFilters(e,At.current.pinnedFilters);if(Rt&&Dt){lX(`Calling doOperation (SEARCH via inline search)`,{searchOperationPathKey:Dt,query:kt});let e={contextualParameters:f,searchQuery:kt,filters:Object.keys(r).length>0?r:void 0,pagination:{page:t,limit:n},sort:Ue.current.length?[...Ue.current]:void 0,parentResourcesRequirements:At.current.parentResourcesRequirements,dataMode:wt};return He.current(Dt,e)}lX(`Calling doOperation (LIST)`,{operationPathKey:Tt});let i={page:t,limit:n};return Ue.current.length&&(i.sort=Ue.current.map(e=>`${e.field}:${e.direction}`).join(`,`)),Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&(i[e]=t)}),He.current(Tt,{contextualParameters:f,queryParameters:i,parentResourcesRequirements:At.current.parentResourcesRequirements,dataMode:wt})},[Rt,Dt,kt,f,wt,Tt]),Ht=(0,Q.useRef)(Vt);Ht.current=Vt;let Ut=Rt?qe.search?.maxPaginatedResultPerPageLimit??50:c?.maxPaginatedResultPerPageLimit??100,[Wt,Gt]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{lX(`useEffect triggered`,{fetchKey:Bt,resourceType:s});let e=!1;return(async()=>{lX(`fetchData started`,{fetchKey:Bt,operationPathKey:Tt,contextualParameters:f}),Ae(null);try{let t=V_e(We.current,mt.current);if(mt.current){let n=await Z_e({requestPage:(e,n)=>Ht.current(t,e,n),pageLimit:Ut});if(e)return;be(n.items),Gt(n.notShown),Pe(!0);return}let n=await Ht.current(t,je.page,je.limit);if(lX(`doOperation completed`,{resultType:Array.isArray(n)?`array`:typeof n,resultLength:Array.isArray(n)?n.length:void 0}),e)return;if(Gt(0),n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;be(e.data),Me(t=>{let n=e.pagination;return t.page===n.page&&t.limit===n.limit&&t.total===n.total&&t.totalPages===n.totalPages?t:n})}else Array.isArray(n)&&(be(n),Me(e=>e.total===n.length&&e.totalPages===1?e:{...e,total:n.length,totalPages:1}));Pe(!0)}catch(t){if(e){lX(`Fetch cancelled after error`,{fetchKey:Bt});return}let n=O(t);Ae({message:T(t)}),cX.error(`Fetch error`,{...n,error:t,fetchKey:Bt})}finally{lX(`fetchData finally block`,{cancelled:e,fetchKey:Bt})}})(),()=>{lX(`useEffect cleanup`,{cancelled:e,fetchKey:Bt}),e=!0}},[Bt]);let Kt=(0,Q.useCallback)(e=>{Ie(e),Me(e=>({...e,page:1}))},[]),qt=(0,Q.useCallback)(e=>{Re(e),Me(e=>({...e,page:1}))},[]),Jt=(0,Q.useCallback)(e=>{ee&&(Re(t=>{let n={...t};return e===void 0?delete n[ee]:n[ee]=e,n}),Me(e=>({...e,page:1})))},[ee]),Yt=(0,Q.useMemo)(()=>{if(!ne||he!==_u.CARDS)return null;let e=Qe.find(e=>e.fieldName===ne),t=e?.enumValues??[];if(t.length===0)return null;let n=new Map(t.map(e=>[e,[]])),r=[];for(let e of ye){let t=e[ne],i=typeof t==`string`?n.get(t):void 0;i?i.push(e):r.push(e)}let i=[];for(let r of t){let t=n.get(r)??[];t.length!==0&&i.push({key:r,label:_(s,ne,r,e?.schema),items:t})}return r.length>0&&i.push({key:`__wildo-ungrouped__`,label:null,items:r}),i},[ye,ne,he,Qe,_,s]),Xt=(0,Q.useMemo)(()=>Yt||!te||he!==_u.CARDS?null:ove(ye,te,u?.mainSchema,b,u?.inheritenceSchemaDefinition),[ye,te,he,b,Yt,u]),Zt=Yt??Xt,Qt=re&&he===_u.BOARD?Qe.find(e=>e.fieldName===re.groupByField):void 0,$t=(0,Q.useMemo)(()=>Qt?.fieldType===MG.ENUM?Qt.enumValues??[]:[],[Qt]),en=(0,Q.useCallback)(e=>V.getResourceObjectId(e,String(u?.resourceFieldIdentifier??``))??``,[u?.resourceFieldIdentifier]),tn=eve({enabled:$t.length>0,vocabulary:$t,groupByField:re?.groupByField??``,readerFilters:Le,reloadKey:zt,pageSize:je.limit,requestPage:Vt,getItemId:en}),nn=(0,Q.useMemo)(()=>!re||!Qt?null:T_e({vocabulary:$t,labelOf:e=>_(s,re.groupByField,e,Qt.schema),pages:tn.pages,collectionTotal:Ne?je.total:void 0}),[re,Qt,$t,tn.pages,Ne,je.total,_,s]),rn=(0,Q.useMemo)(()=>{if(!re||!u)return;let t=E_e(u.operations??[],re.transitionOperation).filter(e=>Um({...e,resourceType:s,resourcePrimaryScope:u.resourcePrimaryScope},Ke));if(t.length!==0)return{operations:t,resourceType:s,subjectDataMode:wt,organizationId:YV(e.contextResourceIdentifiers,void 0)??void 0}},[re,u,s,Ke,wt,e.contextResourceIdentifiers]),an=(0,Q.useCallback)(async(t,n,r)=>{if(!re)return;let i=en(t);if(!i)return;let a=On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,i);await k_e({groupByField:re.groupByField,targetValue:n,call:t=>k(Ta.createOperationPathKeyFromOperation(r),{contextualParameters:V.buildContextualParameters(a,D),requestData:t,parentResourcesRequirements:e.parentResourcesRequirements}),applyMove:e=>{let r=t[re.groupByField];typeof r==`string`&&tn.applyMove(i,r,n,e)},reportRefusal:e=>fh.error(T(e))})},[re,tn.applyMove,en,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,k,D,T]),on=(0,Q.useMemo)(()=>!ie||!st?new Map:R_e({items:ye,dateField:ie.dateField,calendarField:ct,timeZone:tt}),[ie,st,ye,ct,tt]),sn=(0,Q.useMemo)(()=>!ae||!ut?[]:q_e({items:ye,startField:ae.startField,endField:ae.endField,startIsCalendarDate:dt.has(ae.startField),endIsCalendarDate:dt.has(ae.endField),timeZone:tt,days:ft}),[ae,ut,ye,dt,tt,ft]),cn=C?.locale,ln=(0,Q.useMemo)(()=>{let e=new Intl.DateTimeFormat(cn||void 0,{weekday:`short`,timeZone:`UTC`});return(lt[0]??[]).map(({day:t})=>e.format(t))},[cn,lt]),un=(0,Q.useMemo)(()=>new Intl.DateTimeFormat(cn||void 0,{day:`numeric`,timeZone:`UTC`}),[cn]),dn=(0,Q.useCallback)(e=>{let t=V.computeFrontendResourceLabel({resourceType:s,registry:D,currentObject:e,t:w,formatDate:b,formatDateTime:x});return String(t||en(e))},[s,D,w,b,x,en]),fn=(0,Q.useCallback)(()=>{u?qe.create?m({operation:qe.create,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N}):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - CREATE operation not available for resource:`,s):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - missing resourceConfig`)},[u,qe.create,m,e.contextResourceIdentifiers,e.parentResourcesRequirements,N]),pn=(0,Q.useCallback)(t=>{if(!u)return!1;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);return n?Je(On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n))!==null:!1},[u,e.contextResourceIdentifiers,s,Je]),mn=(0,Q.useCallback)(t=>{if(!u)return;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);if(!n){cX.error(`[ResourceLayoutPreset_List] Item click ignored: could not resolve resource id from list item.`,{resourceType:s,fieldIdentifier:u.resourceFieldIdentifier,itemKeys:Object.keys(t??{})});return}let r=On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n),i=Je(r);i&&m({operation:i,contextResourceIdentifiers:r,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N})},[u,m,u?.resourceFieldIdentifier,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,N,Je]),hn=(0,Q.useCallback)((n,r)=>{let i=u?.resourceFieldIdentifier;if(!i)return null;let a=V.getResourceObjectId(n,i),o=a?On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,a):e.contextResourceIdentifiers,c=Je(o),l=On.createFrontendResourceOperationContextFromOperation({resourceType:s,operation:c??e.operation,contextResourceIdentifiers:o});return(0,$.jsx)(xY,{resourceContext:l,navigationZone:t,navigationInitiator:N,currentObject:n,currentObjectDataMode:wt,displayMode:Se.SUMMARY,size:Y.ICON_SM,orientation:r,hostRowOpensRead:!0})},[u,s,e.contextResourceIdentifiers,e.operation,Je,t,N,wt]),gn=(e,n)=>{let r=u?.resourceFieldIdentifier;if(!r)throw V.buildConfigurationError(Xl.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:s,component:`ResourceLayoutPreset_List`});let i=V.getResourceObjectId(e,r);return _e.isElementActive(i)?(0,$.jsx)(`li`,{className:U(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(jG,{navigationZone:t})},i||n):(0,$.jsx)(`li`,{className:U(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:_n(e,n)},i||n)},_n=(t,n)=>(0,$.jsx)(AG,{item:t,resourceType:s,resourceConfig:u,registry:D,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:vt,fieldLabelsMap:Ct,tResourceFieldEnumValue:_,onItemClick:pn(t)?mn:void 0,cardActionPlacement:se,selectable:ce,isSelected:ve.isSelected(t),selectionActive:ve.selectionCount>0,onToggleSelect:ve.toggleSelection,selectAriaLabel:y(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:n+1}),operationsSlot:hn(t,se?.orientation),interactiveClasses:{hover:`hover:bg-muted/50`,transition:M.motion.transition}}),vn=E(H.PLUS,{size:ca.SM}),yn=qe.create?(0,$.jsxs)(X,{onClick:fn,size:Y.SM,"data-slot":`collection-create`,className:`inline-flex items-center gap-element`,children:[vn,(0,$.jsx)(`span`,{children:bt})]}):void 0,bn=iK({isSearchActive:Rt,filterValues:Le}),xn=R&&!!qe.create,Sn=$G(Xe,xn),Cn=aK({hasLoadedOnce:Ne,itemCount:ye.length,isNarrowed:bn,emptyStateOffersCreate:Sn})?yn:void 0,wn=(0,Q.useMemo)(()=>(u?.operations??[]).some(e=>Da(e)),[u]),Tn=(0,Q.useMemo)(()=>{let e={page:je.page,limit:je.limit};Fe.length&&(e.sort=Fe.map(e=>`${e.field}:${e.direction}`).join(`,`));for(let[t,n]of Object.entries(IG.withPinnedFilters(Le,Nt)))n!=null&&n!==``&&(e[t]=n);Rt&&(e.q=kt);let t={list:IG.variantKeyOf(c),...qe.search?{search:IG.variantKeyOf(qe.search)}:{}};return{params:e,isSearchActive:!!kt,listingVariantKeys:t}},[je.page,je.limit,Fe,Le,Nt,kt,Rt,c,qe.search]),En=IG.matchListingOf(IG.listingOperationShown({inlineSearchTerm:kt,listOperation:c,searchOperation:qe.search})),Dn=wn?(0,$.jsx)(ive,{resourceContext:e,navigationZone:t,navigationInitiator:N,collectionExportQuery:Tn}):void 0;return S?ke?(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:yt}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:ke.message})]})]}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),R&&(0,$.jsx)(Hge,{resourceType:s,quickFilter:gt?{field:gt,value:Le[gt.fieldName],onChange:Jt}:void 0,presetFilters:L,search:Ot.isVisible?{query:Ot.query,onChange:Ot.handleChange,onClear:Ot.handleClear}:void 0,filterFields:et?_t:[],filterPanel:z,filterValues:Le,onFiltersChange:qt,sort:he===_u.CARDS&&Ze.length>0?{sortFields:Ze,sortStates:Fe,onSortChange:Kt}:void 0,viewMode:I?{viewMode:he,onViewModeChange:fe,availableModes:me}:void 0,primaryAction:Cn,collectionActions:Dn,...ce&&he!==_u.TABLE&&ye.length>0?{selectAll:{state:Ce,onToggle:Oe}}:{},selection:ce?{count:ve.selectionCount,onClear:ve.clearSelection,...xe&&!ve.matchAllSelection&&je.total>ye.length&&En?{matchAllOffer:{matchedCount:je.total,onSelectAllMatching:()=>ve.selectAllMatching({filters:IG.withPinnedFilters(Le,Nt),...kt?{search:kt}:{},listing:En,matchedCount:je.total})}}:{},...ve.matchAllSelection?{isMatchAllSelected:!0}:{}}:void 0,bulkActions:ce?(0,$.jsx)(LJ,{resourceContext:e,navigationZone:t,navigationInitiator:N,selectedItems:ve.selectedItems,selectedItemsDataMode:wt,matchAllSelection:ve.matchAllSelection,explicitIdSelection:ve.explicitIdSelection,onSelectIds:ve.selectIds,idField:ge,onSelectionClear:ve.clearSelection,onSelectionReplace:ve.selectAll}):void 0}),(0,$.jsx)(sb,{i18nKeys:ze,loadingScopes:Ye,readiness:Be,renderLoading:()=>(0,$.jsx)(pm,{template:he===_u.TABLE?`table`:le?`card`:`list`,density:`auto`,count:je.limit,"aria-hidden":`true`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(aX,{resourceContext:e,navigationZone:t,showCharts:a}),_e.isCreateActive&&(0,$.jsx)(jG,{navigationZone:t,className:`border border-border rounded-lg`}),pt&&Wt>0&&(0,$.jsx)(jD,{variant:`warning`,"data-slot":`collection-window-not-shown`,children:(0,$.jsx)(ND,{children:y(B.RESOURCES_LAYOUTS_LIST,`displayWindowRowsNotShown`,{count:Wt})})}),ie&&st?(0,$.jsx)(G_e,{weeks:lt,itemsByDay:on,month:it,today:rt,firstDayOfWeek:nt,onMonthChange:ot,monthHeading:b(OJ(it),{yearMonth:!0}),weekdayLabels:ln,dayNumberLabel:e=>un.format(e),dayLabel:(e,t)=>y(B.RESOURCES_LAYOUTS_LIST,`calendarDayItemCount`,{date:b(e,{calendarDate:!0}),count:t}),getItemId:en,getItemLabel:dn,canOpenItem:pn,onOpenItem:mn,calendarLabel:St,previousMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayToday`),keyboardHint:y(B.RESOURCES_LAYOUTS_LIST,`calendarKeyboardHint`)}):ae&&ut?(0,$.jsx)(X_e,{days:ft,placements:sn,month:it,today:rt,onMonthChange:ot,monthHeading:b(OJ(it),{yearMonth:!0}),dayNumberLabel:e=>un.format(e),getItemId:en,getItemLabel:dn,barLabel:(e,t,n)=>y(B.RESOURCES_LAYOUTS_LIST,`timelineItemSpan`,{label:dn(e),from:b(t,{calendarDate:!0}),to:b(n,{calendarDate:!0})}),canOpenItem:pn,onOpenItem:mn,timelineLabel:St,previousMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayToday`),emptyMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`timelineEmptyMonth`)}):ye.length===0?bn?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:xt}):(0,$.jsx)(nK,{resourceType:s,config:Xe,hasCreateOperation:xn,onCreateAction:fn,variant:R?`default`:`compact`,title:e.emptyStateWords?.title,description:e.emptyStateWords?.description}):he===_u.TABLE?(0,$.jsx)(C_e,{items:ye,resourceType:s,resourceConfig:u,navigationZone:t,summaryFields:vt,contextResourceIdentifiers:e.contextResourceIdentifiers,fieldLabelsMap:Ct,sortFields:Ze,sortStates:Fe,onSortChange:Kt,selectable:ce,isRowSelected:we,onToggleRow:De,allSelected:xe,onToggleAll:Oe,renderRowActions:hn,onRowClick:mn,canOpenRow:pn}):nn?(0,$.jsx)(P_e,{columns:nn,onLoadMore:e=>{tn.loadMore(e)},loadMoreLabel:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardLoadMore`,{count:e}),columnLoadFailedLabel:y(B.RESOURCES_LAYOUTS_LIST,`boardColumnLoadFailed`),ungroupedNote:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardUngroupedNote`,{count:e}),renderCard:_n,getItemId:en,transition:rn,onMoveItem:an,boardLabel:St,ungroupedLabel:y(B.RESOURCES_LAYOUTS_LIST,`boardUngrouped`),columnCountLabel:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardColumnCount`,{count:e}),moveHint:y(B.RESOURCES_LAYOUTS_LIST,`boardMoveHint`)}):Zt?(0,$.jsx)(`div`,{className:`space-y-card`,"data-slot":`collection-groups`,children:Zt.map((e,t)=>{let n=Zt.slice(0,t).reduce((e,t)=>e+t.items.length,0);return(0,$.jsxs)(`section`,{className:`space-y-item-xs`,children:[e.label&&(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,$.jsx)(`ul`,{role:`list`,"aria-label":e.label??St,className:SG(ue),style:CG(ue),children:e.items.map((e,t)=>gn(e,n+t))})]},`${e.key}:${t}`)})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":St,className:SG(ue),style:CG(ue),children:ye.map(gn)}),!nn&&!pt&&(0,$.jsx)(QG,{pagination:je,onPaginationChange:Me})]})})]}):null};function dX({preset:e,...t}){let n=KW(t.resourceContext.operation),r=e??qW(t.resourceContext.operation)??Wu.DEFAULT,i=n?(0,$.jsx)(n,{...t}):Q.createElement(G(B.RESOURCES_LAYOUTS_LIST,`ResourceLayout_List`)(r),t);return(0,$.jsx)(Hx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[mA]:!0,children:i})})}var fX=as.getLogger(),Uve=fX.debugByType(`PublicLayout_MainContainer`);fX.setDebugTypeLogging(`PublicLayout_MainContainer`,!1);function pX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MAIN_CONTAINER,`PublicLayout_MainContainer`)(e);return Uve(`Render preset=${e} card=${t.useCardLayout?`yes`:`no`} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var mX;(function(e){e.DEFAULT=`default`,e.MUTED=`muted`,e.CONTRAST=`contrast`,e.DESTRUCTIVE=`destructive`,e.SUCCESS=`success`,e.INHERIT=`inherit`})(mX||={});var hX;(function(e){e.HOVER=`hover`,e.ALWAYS=`always`,e.NONE=`none`})(hX||={});var gX;(function(e){e.NORMAL=`normal`,e.MEDIUM=`medium`,e.SEMIBOLD=`semibold`})(gX||={});function _X({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LINK,`Link`)(e);return(0,$.jsx)(n,{...t})}var vX=({href:e,onClick:t,children:n})=>(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:e,onClick:t,children:n})}),yX=({code:e,errorParam:t,errorDescription:n})=>{let{handleAuthCodeExchange:r,auth:i}=hm(),{tComponent:a,isReady:o}=K({component:B.PUBLIC_LAYOUTS_AUTH_CALLBACK}),s=cp(),c=mg(),l=e=>a(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,e),u=(0,Q.useMemo)(()=>L(c.search),[c.search]),d=(0,Q.useMemo)(()=>fi(Ln.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(c.search),[c.search]),[p,m]=(0,Q.useState)(null),h=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{h.current||(t?(h.current=!0,m(l(Zn.ERROR_GENERIC))):e?i.accessToken||i.onboardingSessionId?h.current=!0:(h.current=!0,r(e).catch(e=>{m(s(e,l(Zn.ERROR_EXCHANGE_FAILED)))})):(h.current=!0,m(l(Zn.ERROR_NO_CODE))))},[e,t,n,i.accessToken,i.onboardingSessionId,r]);let g=Rp(i,u);return g?(0,$.jsx)(Xh,{to:g,replace:!0}):i.accessToken&&!i.isLoading?(0,$.jsx)(Xh,{to:f,replace:!0}):o?p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(CY,{children:l(Zn.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:p})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:l(Zn.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(Zn.VERIFYING)})]}):null};function bX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,`Auth_AuthCallback`)(e);return(0,$.jsx)(n,{...t})}var Wve=()=>{let[e]=ch(),t=e.get(`code`),n=e.get(`error`),r=e.get(`error_description`);return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(bX,{code:t,errorParam:n,errorDescription:r})})},xX;(function(e){e.REPORTED=`reported`,e.NOTHING_TO_REPORT=`nothing_to_report`})(xX||={});var Gve=()=>{let[e]=ch(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_AUTH_CALLBACK}),[r,i]=(0,Q.useState)(null),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let t=e.get(`code`),n=e.get(`error`);!t&&!n?i(xX.NOTHING_TO_REPORT):(dH(t?{code:t}:{error:n??void 0}),i(xX.REPORTED),window.close())},[e]),!n||r===null?null:(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(Z,{className:`text-sm`,children:t(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,r===xX.REPORTED?Zn.REAUTH_RETURNING:Zn.REAUTH_NO_RESULT)})})};function SX({mfaRequired:e,mfaSessionId:t,usableSecondFactorMethods:n,email:r,authRedirectTarget:i}){let a=oh();(0,Q.useEffect)(()=>{e&&t&&(n.length===0?a(fi(Ln.enrollmentRequired,i),{replace:!0}):a(fi(`${Ln.mfaChallenge}?sessionId=${t}&email=${encodeURIComponent(r||``)}`,i),{replace:!0}))},[e,t,n,a,r,i])}var CX=({token:e,email:t,redirect:n})=>{let r=Ste(n)?n:void 0,{handleMagicLinkVerify:i,auth:a}=hm(),{tComponent:s,isReady:c}=K({component:B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY}),l=cp(),u=e=>s(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,e),d=Ln.login,[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(!e||!t?(m.current=!0,p(u(o.ERROR_INVALID_LINK))):a.accessToken?m.current=!0:(m.current=!0,i(e,t).then(e=>{!e.success&&!e.requiresMFA&&p(l(null,u(o.ERROR_VERIFICATION_FAILED)))}).catch(e=>{p(l(e,u(o.ERROR_EXPIRED)))})))},[e,t,a.accessToken,i]),SX({mfaRequired:a.mfaRequired,mfaSessionId:a.mfaSessionId,usableSecondFactorMethods:a.usableSecondFactorMethods,email:t??void 0,authRedirectTarget:r});let h=Rp(a,r);return h?(0,$.jsx)(Xh,{to:h,replace:!0}):a.accessToken&&!a.isLoading?(0,$.jsx)(Xh,{to:r??Ln.home,replace:!0}):c?f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(CY,{children:u(o.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:f})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:u(o.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:u(o.VERIFYING)})]}):null};function wX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,`Auth_MagicLinkVerify`)(e);return(0,$.jsx)(n,{...t})}var Kve=()=>{let[e]=ch(),t=e.get(`token`),n=e.get(`email`),r=e.get(`redirect`);return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(wX,{token:t,email:n,redirect:r})})},qve=()=>{let{auth:e}=pg(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`email`}),(0,$.jsx)(XL,{name:`password`}),e.error&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.error})}),(0,$.jsx)(rO,{label:(e=>t(B.PUBLIC_LAYOUTS_USER_AUTH,e))(ss.SUBMIT),submittingLabel:`…`,fullWidth:!0})]}):null},Jve=({email:e,onSuccess:t,onError:n,isLoading:r,t:i})=>{let{authenticateWithPassword:a}=pg(),o=cp(),s=(0,Q.useCallback)(async e=>{try{t(await a(e.email,e.password))}catch(e){n(o(e))}},[a,t,n,o]),c=(0,Q.useMemo)(()=>({email:e,password:``}),[e]);return(0,$.jsx)(iE,{schema:Bl,defaultValues:c,onSubmit:s,validationMode:ta.ON_BLUR,disabled:r,labels:{fields:{email:i(ss.EMAIL_ADDRESS),password:i(ss.PASSWORD)}},layoutTemplate:qve},`password-auth`)},TX={[_s.PASSWORD]:H.KEY,[_s.PASSKEY]:H.FINGERPRINT,[_s.MAGIC_LINK]:H.MAIL,[_s.EMAIL_OTP]:H.MAIL,[_s.SMS_OTP]:H.MESSAGE_CIRCLE,[_s.TOTP]:H.SMARTPHONE,[_s.ORG_SAML]:H.ORGANIZATION,[_s.ORG_OPENID_CONNECT]:H.ORGANIZATION,[_s.EXTERNAL_OAUTH2]:H.LINK},Yve={[_s.PASSWORD]:ss.METHOD_PASSWORD,[_s.MAGIC_LINK]:ss.METHOD_MAGIC_LINK,[_s.PASSKEY]:ss.METHOD_PASSKEY,[_s.SMS_OTP]:ss.METHOD_SMS_OTP,[_s.ORG_SAML]:ss.METHOD_ORG_SSO,[_s.ORG_OPENID_CONNECT]:ss.METHOD_ORG_SSO,[_s.EXTERNAL_OAUTH2]:ss.METHOD_EXTERNAL_OAUTH2};function Xve(e,t,n){if(e===_s.ORG_SAML||e===_s.ORG_OPENID_CONNECT)return t.offeredMethod?.config?.displayName?.trim()||void 0;if(e!==_s.EXTERNAL_OAUTH2)return;let r=t.offeredMethod?.oauth2ProviderRefs,i=t.socialProviders??[],a=r&&r.length>0?i.filter(e=>r.includes(e.providerRef)):i;return a.length===1&&n(a[0]).trim()||void 0}function EX(e,t){let n=Xve(e,t,t.resolveSocialProviderLabel);if(n&&t.continueWithTemplate.includes(`{provider}`))return t.continueWithTemplate.replace(`{provider}`,n);let r=Yve[e];return r?t.translateLabel(r):e}var DX=({method:e})=>{let{renderIcon:t}=Mf();return t(TX[e],{size:ca.SM})},Zve=({email:e,isLoading:t,t:n,authRedirectTarget:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),c=(0,Q.useCallback)(async()=>{if(e){s(!0);try{await bc().magicLinkSend(e,r),a(!0)}catch{}finally{s(!1)}}},[e,r]);return i?(0,$.jsxs)(`div`,{className:`space-y-item text-center`,children:[(0,$.jsx)(CY,{children:n(ss.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:n(ss.MAGIC_LINK_SENT_DESCRIPTION)}),(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:`#`,onClick:e=>{e.preventDefault(),a(!1)},children:n(ss.MAGIC_LINK_TRY_ANOTHER_METHOD)})})]}):(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:tf.WRAP,onClick:c,disabled:o||t,children:[(0,$.jsx)(DX,{method:_s.MAGIC_LINK}),o?`…`:n(ss.MAGIC_LINK_SEND)]})})};function OX({fieldName:e,submitLabel:t,submittingLabel:n,fieldProps:r}){let{formState:i}=GC();return(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:e,...r}),i.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:i.errors.root.message})}),(0,$.jsx)(rO,{label:t,submittingLabel:n,fullWidth:!0})]})}var kX=5e3,Qve=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(p===0)return;let t=!1,n=Date.now(),r,i=async()=>{if(!t){try{let{codeUndelivered:n}=await bc().smsOTPDelivery(e);if(t)return;if(n){g(!0);return}}catch{}!t&&Date.now()-n<12e4&&(r=setTimeout(()=>{i()},kX))}};return r=setTimeout(()=>{i()},kX),()=>{t=!0,r!==void 0&&clearTimeout(r)}},[p,e]);let _=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r($o.VERIFY_BUTTON),submittingLabel:r($o.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),v=(0,Q.useCallback)(e=>{o.current=e},[]),y=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),b=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),x=(0,Q.useCallback)(async()=>{u(!0),f(null),y();try{await bc().smsOTPSend(e),g(!1),c(!0),m(e=>e+1)}catch(e){let t=a(e,r($o.ERROR_GENERIC));s?b(t):f(t)}finally{u(!1)}},[e,s,y,b,r,a]),S=(0,Q.useCallback)(async n=>{y();try{let o=await i(e,_s.SMS_OTP,n.code.trim());o.success?t(o):b(a(null,r($o.ERROR_INVALID_CODE)))}catch(e){b(a(e,r($o.ERROR_INVALID_CODE)))}},[e,i,t,r,y,b,a]);return s?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r($o.SMS_OTP_SENT)}),h&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:r($o.SMS_OTP_UNDELIVERED)})}),(0,$.jsx)(iE,{schema:Aie,defaultValues:{code:``},onSubmit:S,validationMode:ta.ON_BLUR,disabled:n||l,onFormReady:v,labels:{fields:{code:r($o.SMS_OTP_CODE_LABEL)}},layoutTemplate:_},`sms-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:x,disabled:l,children:r($o.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r($o.SMS_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:tf.WRAP,onClick:x,disabled:l||n,children:[(0,$.jsx)(DX,{method:_s.SMS_OTP}),r(l?$o.SMS_OTP_SENDING:$o.SMS_OTP_SEND)]}),d&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})})]})},$ve=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r($o.VERIFY_BUTTON),submittingLabel:r($o.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),m=(0,Q.useCallback)(e=>{o.current=e},[]),h=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),g=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),_=(0,Q.useCallback)(async()=>{u(!0),f(null),h();try{await bc().mfaEmailOTPSend(e),c(!0)}catch(e){let t=a(e,r($o.ERROR_GENERIC));s?g(t):f(t)}finally{u(!1)}},[e,s,h,g,r,a]),v=(0,Q.useCallback)(async n=>{h();try{let o=await i(e,_s.EMAIL_OTP,n.code.trim());o.success?t(o):g(a(null,r($o.ERROR_INVALID_CODE)))}catch(e){g(a(e,r($o.ERROR_INVALID_CODE)))}},[e,i,t,r,h,g,a]);return s?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r($o.EMAIL_OTP_SENT)}),(0,$.jsx)(iE,{schema:vo,defaultValues:{code:``},onSubmit:v,validationMode:ta.ON_BLUR,disabled:n||l,onFormReady:m,labels:{fields:{code:r($o.EMAIL_OTP_CODE_LABEL)}},layoutTemplate:p},`email-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:_,disabled:l,children:r($o.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r($o.EMAIL_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:tf.WRAP,onClick:_,disabled:l||n,children:[(0,$.jsx)(DX,{method:_s.EMAIL_OTP}),r(l?$o.EMAIL_OTP_SENDING:$o.EMAIL_OTP_SEND)]}),d&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})})]})},eye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r($o.VERIFY_BUTTON),submittingLabel:r($o.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),c=(0,Q.useCallback)(e=>{o.current=e},[]),l=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),u=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),d=(0,Q.useCallback)(async n=>{l();try{let o=await i(e,_s.TOTP,n.code.trim());o.success?t(o):u(a(null,r($o.ERROR_INVALID_CODE)))}catch(e){u(a(e,r($o.ERROR_INVALID_CODE)))}},[e,i,t,r,l,u,a]);return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r($o.TOTP_DESCRIPTION)}),(0,$.jsx)(iE,{schema:Mne,defaultValues:{code:``},onSubmit:d,validationMode:ta.ON_BLUR,disabled:n,onFormReady:c,labels:{fields:{code:r($o.TOTP_CODE_LABEL)}},layoutTemplate:s},`totp-challenge`)]})},tye=({sessionId:e,onSuccess:t,onError:n,isLoading:r,t:i,factorLevel:a})=>{let{handlePasskeyAuth:o}=hm(),s=cp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>a===`first`?ss:$o,[a]),p=typeof window<`u`&&!!window.PublicKeyCredential,m=(0,Q.useCallback)(async()=>{l(!0),d(null);try{let r=await o(e,a);if(r.success)t(r);else{let e=s(null,i(f.PASSKEY_ERROR));d(e),n(e)}}catch(e){let t=e?.name===`NotAllowedError`?i(f.PASSKEY_CANCELLED):s(e,i(f.PASSKEY_ERROR));d(t),n(t)}finally{l(!1)}},[e,a,o,t,n,i,f,s]);return p?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(f.PASSKEY_DESCRIPTION)}),u&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:u})}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:tf.WRAP,onClick:m,disabled:c||r,children:[(0,$.jsx)(DX,{method:_s.PASSKEY}),i(c?f.PASSKEY_AUTHENTICATING:f.PASSKEY_BUTTON)]})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:i(f.PASSKEY_UNSUPPORTED)})})})},nye=br,rye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=mg(),l=e.config?.displayName||`SSO`,u=e.config?.connectionId,d=td(c),f=(0,Q.useCallback)(()=>{if(!u){s(n(ss.SSO_CONFIGURATION_ERROR));return}a(!0);let e=Ia(Ar.AUTH_SAML_LOGIN,{connectionId:u}),t=bc().getBaseURL(),r=t===window.location.origin?window.location.origin:``;window.location.href=`${t}${nye}${e}?returnUrl=${encodeURIComponent(`${r}${d}`)}`},[u,d,n]),p=r===`first`?n(ss.CONTINUE_WITH).replace(`{provider}`,l):l;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:tf.WRAP,onClick:f,disabled:t||i,children:[(0,$.jsx)(DX,{method:_s.ORG_SAML}),i?`…`:p]}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},iye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=mg(),l=cp(),u=e.config?.displayName||`SSO`,d=e.config?.connectionId,f=e.config?.scopeType,p=e.config?.scopeId,m=f===Zs.ORGANIZATION?p:void 0,h=td(c),g=f===Zs.APPLICATION?p:void 0,_=(0,Q.useCallback)(async()=>{if(!d)s(n(ss.SSO_CONFIGURATION_ERROR));else{a(!0),s(null);try{let e=bc();if(!m&&!g){s(n(ss.SSO_CONFIGURATION_ERROR)),a(!1);return}let t=m?await e.getEnterpriseSSOAuthorizationUrl(m,d,h):await e.getAppEnterpriseSSOAuthorizationUrl(d,h,{headers:{[Ju.APPLICATION_ID]:g}});window.location.href=t.authorizationUrl}catch(e){a(!1),s(l(e))}}},[g,d,m,h,n,l]),v=r===`first`?n(ss.CONTINUE_WITH).replace(`{provider}`,u):u;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:tf.WRAP,onClick:_,disabled:t||i,children:[(0,$.jsx)(DX,{method:_s.ORG_OPENID_CONNECT}),i?`…`:v]}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},AX=({label:e,className:t})=>(0,$.jsxs)(`div`,{className:`my-group flex items-center gap-element text-xs uppercase text-muted-foreground${t?` ${t}`:``}`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`})]});function jX(e){return mb({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,fallbackLabel:e.brandLabel,translate:e.translate})}function MX(e){let t=e.publicProviders;return t?Object.entries(t).map(([e,t])=>({key:e,providerRef:e,displayName:t.displayName,displayNameLabelKey:vd(e)})):[]}var NX={google:{label:`Google`,brandClass:``,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,$.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z`,fill:`#4285F4`}),(0,$.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,$.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,$.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})},microsoft:{label:`Microsoft`,brandClass:`bg-[#2F2F2F] hover:bg-[#404040] text-white`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 21 21`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`9`,height:`9`,fill:`#F25022`}),(0,$.jsx)(`rect`,{x:`11`,y:`1`,width:`9`,height:`9`,fill:`#7FBA00`}),(0,$.jsx)(`rect`,{x:`1`,y:`11`,width:`9`,height:`9`,fill:`#00A4EF`}),(0,$.jsx)(`rect`,{x:`11`,y:`11`,width:`9`,height:`9`,fill:`#FFB900`})]})},github:{label:`GitHub`,brandClass:`bg-[#24292e] hover:bg-[#2f363d] text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})})},apple:{label:`Apple`,brandClass:`bg-black hover:bg-gray-900 text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z`})})}},PX={brandClass:`bg-muted hover:bg-muted/80 border border-border text-foreground`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,$.jsx)(`path`,{d:`M2 12h20`}),(0,$.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]})},FX=({providers:e,onProviderClick:t,isLoading:n,disabled:r=!1,continueWithLabel:i,translate:a,dividerLabel:o,showDivider:s})=>e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`space-y-item`,children:e.map(({key:e,providerRef:o,displayName:s,displayNameLabelKey:c})=>{let l=NX[o]??null,u=jX({providerRef:o,displayName:s,displayNameLabelKey:c,brandLabel:l?.label,translate:a}),d=l?.brandClass??PX.brandClass,f=l?.icon??PX.icon;return(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,disabled:n||r,onClick:()=>t(o),className:`w-full ${d}`,children:[f,(0,$.jsx)(`span`,{children:i.replace(`{provider}`,u)})]},e)})}),s&&o&&(0,$.jsx)(AX,{label:o})]}),aye=({methodConfig:e,isLoading:t,t:n})=>{let{initiateOAuth2Login:r}=pg(),{appConfig:i}=Ou(),a=mg(),[o,s]=(0,Q.useState)(null),c=cp(),l=e.oauth2ProviderRefs||[],u=(0,Q.useMemo)(()=>MX({publicProviders:Object.fromEntries(l.map(e=>[e,i.auth?.socialOAuth2Providers?.[e]??{}]))}),[i.auth?.socialOAuth2Providers,l]),d=(0,Q.useMemo)(()=>pb(u.map(e=>e.displayNameLabelKey)),[u]),{t:f}=K({keys:d}),p=(0,Q.useMemo)(()=>td(a),[a]),m=(0,Q.useCallback)(async e=>{s(null);try{await r(e,p)}catch(e){s(c(e))}},[r,p,c]);return l.length===0?null:(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(FX,{providers:u,onProviderClick:m,isLoading:t,continueWithLabel:n(ss.CONTINUE_WITH),translate:f}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},IX={};IX[_s.PASSWORD]=Jve,IX[_s.MAGIC_LINK]=Zve,IX[_s.SMS_OTP]=Qve,IX[_s.EMAIL_OTP]=$ve,IX[_s.TOTP]=eye,IX[_s.PASSKEY]=tye,IX[_s.ORG_SAML]=rye,IX[_s.ORG_OPENID_CONNECT]=iye,IX[_s.EXTERNAL_OAUTH2]=aye;var LX={};function RX(e,t){LX[e]=t}var zX;(function(e){e.REFLOW=`reflow`,e.LIST=`list`})(zX||={});var BX=({methods:e,labelFor:t,onSelect:n,disabled:r,layout:i=zX.REFLOW,className:a})=>{if(e.length===0)return null;let o=i===zX.REFLOW;return(0,$.jsx)(`div`,{className:U(o?`flex flex-wrap gap-element`:`flex flex-col gap-item`,a),children:e.map(e=>(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,labelOverflow:tf.WRAP,className:o?`grow basis-[10rem] max-w-full text-center`:`w-full justify-start text-start`,onClick:()=>n(e),disabled:r,"data-auth-method":e,children:[(0,$.jsx)(DX,{method:e}),(0,$.jsx)(`span`,{children:t(e)})]},e))})};function VX({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LABEL,`Label`)(e);return(0,$.jsx)(n,{...t})}var oye=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),HX=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),UX=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),sye=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),cye=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),lye=n((e=>{var t=HX().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),uye=n((e=>{var t=HX().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),dye=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),WX=n((e=>{var t=UX(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),fye=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),pye=n((e=>{var t=fye();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),mye=n(((e,t)=>{var n=pye();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),GX=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),KX=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
16
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),qX=n((e=>{var t=GX(),n=KX();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),hye=n((e=>{var t=HX(),n=WX(),r=UX(),i=qX(),a=GX(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),gye=n((e=>{var t=HX(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),_ye=n(((e,t)=>{var n=qX();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),vye=n(((e,t)=>{var n=qX(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),yye=n(((e,t)=>{var n=qX();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),bye=n(((e,t)=>{var n=qX(),r=HX();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
17
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),xye=n(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Sye=n((e=>{var t=qX(),n=_ye(),r=vye(),i=yye(),a=bye(),o=KX(),s=HX(),c=xye();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
18
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Cye=n((e=>{var t=HX(),n=UX(),r=sye(),i=cye(),a=lye(),o=uye(),s=dye(),c=WX(),l=mye(),u=hye(),d=gye(),f=qX(),p=Sye();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
19
- The chosen QR Code version cannot contain this amount of data.
20
- Minimum version required to store current data is: `+c+`.
21
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),JX=n((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),wye=n((e=>{var t=JX();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o!==void 0||i&&i.getContext||(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Tye=n((e=>{var t=JX();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
22
- `;return typeof a==`function`&&a(null,p),p}})),Eye=e(n((e=>{var t=oye(),n=Cye(),r=wye(),i=Tye();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function YX(e){return e?{[Ju.AUTH_SESSION_ID]:e}:void 0}var XX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(`loading`),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=(0,Q.useRef)(n);v.current=n;let y=(0,Q.useRef)(i);y.current=i;let b=cp(),x=(0,Q.useRef)(null),S=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:i(Na.TOTP_VERIFY_BUTTON),submittingLabel:i(Na.TOTP_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),C=(0,Q.useCallback)(e=>{a.current=e},[]),w=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),T=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]);(0,Q.useEffect)(()=>{let t=!1;if(!x.current||x.current.sessionId!==e){let t=YX(e);x.current={sessionId:e,promise:bc().mfaTOTPSetup(t?{headers:t}:void 0)}}let n=x.current.promise;return(async()=>{try{let e=await n;if(t)return;let r=await Eye.toDataURL(e.qrCodeUri,{width:256,margin:2});if(t)return;d(e.secret),l(r),p(e.backupCodes||[]),s(`ready`)}catch(e){if(t)return;let n=b(e,y.current(Na.ENROLL_ERROR));_(n),v.current(n)}})(),()=>{t=!0}},[e]);let E=(0,Q.useCallback)(async r=>{w();try{let n=YX(e),a=await bc().mfaTOTPVerifySetup(r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):T(i(Na.ENROLL_ERROR))}catch(e){let t=b(e,i(Na.ENROLL_ERROR));T(t),n(t)}},[e,t,n,i,w,T,b]);if(o===`loading`)return(0,$.jsx)(`div`,{className:`space-y-item text-center`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(Na.LOADING)})});let D=f.length>0&&!m;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Na.TOTP_QR_INSTRUCTION)}),c&&(0,$.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,$.jsx)(`img`,{src:c,alt:`TOTP QR Code`,className:`rounded-md`})}),(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(Na.TOTP_MANUAL_SECRET)}),(0,$.jsx)(`code`,{className:`block mt-1 text-sm font-mono bg-muted px-3 py-2 rounded-md select-all break-all`,children:u})]}),f.length>0&&(0,$.jsx)(EF,{children:(0,$.jsxs)(NF,{className:`space-y-2 pt-4`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:i(Na.TOTP_BACKUP_CODES)}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:f.map((e,t)=>(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted px-2 py-1 rounded text-center`,children:e},t))}),(0,$.jsxs)(VX,{className:`flex items-center gap-2 cursor-pointer mt-2`,children:[(0,$.jsx)(TI,{checked:m,onCheckedChange:e=>h(e===!0)}),(0,$.jsx)(Z,{className:`text-xs`,children:i(Na.TOTP_BACKUP_SAVED)})]})]})}),(0,$.jsxs)(`div`,{className:`space-y-item-xs pt-2`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:i(Na.TOTP_VERIFY_LABEL)}),(0,$.jsx)(iE,{schema:hs,defaultValues:{code:``},onSubmit:E,validationMode:ta.ON_BLUR,disabled:r||D,onFormReady:C,labels:{fields:{code:i(Na.TOTP_VERIFY_LABEL)}},layoutTemplate:S},`totp-enrollment-verify`)]}),g&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:g})})]})};RX(_s.TOTP,XX);function Dye(e){return e?{[Ju.AUTH_SESSION_ID]:e}:void 0}RX(_s.PASSKEY,({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l=cp(),u=typeof window<`u`&&!!window.PublicKeyCredential,d=(0,Q.useCallback)(async()=>{o(!0),c(null);try{let n=Dye(e),r=await bc().passkeyRegisterOptions(n?{headers:n}:void 0),i=await hp({optionsJSON:r});t((await bc().passkeyRegisterVerify({response:i},n?{headers:n}:void 0)).enrollmentSession)}catch(e){let t=e?.name===`NotAllowedError`?i(Na.PASSKEY_CANCELLED):l(e,i(Na.ENROLL_ERROR));c(t),n(t)}finally{o(!1)}},[e,t,n,i,l]);return u?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Na.PASSKEY_DESCRIPTION)}),s&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:s})}),(0,$.jsx)(X,{className:`w-full`,onClick:d,disabled:a||r,children:i(a?Na.PASSKEY_REGISTERING:Na.PASSKEY_REGISTER_BUTTON)})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:i(Na.PASSKEY_UNSUPPORTED)})})})});function ZX(e){return e?{[Ju.AUTH_SESSION_ID]:e}:void 0}var QX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=cp(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`phoneNumber`,submitLabel:i(Na.PHONE_SEND_CODE),submittingLabel:i(Na.PHONE_SENDING),fieldProps:{type:`tel`,placeholder:`+1 555 123 4567`,autoFocus:!0}}),[i]),h=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:i(Na.PHONE_VERIFY_BUTTON),submittingLabel:i(Na.PHONE_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),g=(0,Q.useCallback)(e=>{a.current=e},[]),_=(0,Q.useCallback)(e=>{o.current=e},[]),v=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),y=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),b=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]),x=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),S=(0,Q.useCallback)(async(t,r)=>{let a=t.trim();if(a){p(!0),r===`phone`?v():y();try{let t=ZX(e);await bc().phoneVerifySend(a,t?{headers:t}:void 0),l(a),d(!0)}catch(e){let t=s(e,i(Na.ENROLL_ERROR));r===`phone`?b(t):x(t),n(t)}finally{p(!1)}}},[e,n,i,s,v,y,b,x]),C=(0,Q.useCallback)(async e=>{await S(e.phoneNumber,`phone`)},[S]),w=(0,Q.useCallback)(async()=>{await S(c,`code`)},[c,S]),T=(0,Q.useCallback)(async r=>{y();try{let n=ZX(e),a=await bc().phoneVerifyConfirm(c.trim(),r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):x(i(Na.ENROLL_ERROR))}catch(e){let t=s(e,i(Na.ENROLL_ERROR));x(t),n(t)}},[c,e,t,n,i,y,x,s]);return u?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Na.PHONE_CODE_SENT)}),(0,$.jsx)(iE,{schema:vre,defaultValues:{code:``},onSubmit:T,validationMode:ta.ON_BLUR,disabled:f||r,onFormReady:_,labels:{fields:{code:i(Na.PHONE_CODE_LABEL)}},layoutTemplate:h},`phone-enrollment-verify`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:w,disabled:f,children:i(Na.PHONE_RESEND)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Na.PHONE_DESCRIPTION)}),(0,$.jsx)(iE,{schema:Cne,defaultValues:{phoneNumber:c},onSubmit:C,validationMode:ta.ON_BLUR,disabled:f||r,onFormReady:g,labels:{fields:{phoneNumber:i(Na.PHONE_NUMBER_LABEL)}},layoutTemplate:m},`phone-enrollment-start`)]})};RX(_s.SMS_OTP,QX);var Oye={[_s.SMS_OTP]:$o.SMS_OTP_TITLE,[_s.EMAIL_OTP]:$o.EMAIL_OTP_TITLE,[_s.TOTP]:$o.TOTP_TITLE,[_s.PASSKEY]:$o.PASSKEY_TITLE},$X=({sessionId:e,sessionEmail:t=``})=>{let{getSessionState:n,auth:r}=hm(),i=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_MFA_CHALLENGE,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:a,isReady:o}=K({component:i}),s=mg(),c=e=>a(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,e),l=(0,Q.useMemo)(()=>gm(a,B.PUBLIC_LAYOUTS_USER_AUTH),[a]),u=(0,Q.useMemo)(()=>L(s.search),[s.search]),d=(0,Q.useMemo)(()=>fi(Ln.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(s.search),[s.search]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!C.current&&e&&(C.current=!0,n(e).then(e=>{let t=new Set(e.usableSecondFactorMethods||[]),n=(e.availableSecondFactorMethods||[]).filter(e=>t.has(e.method)).filter(e=>IX[e.method]);n.length===0?(e.availableEnrollmentMethods||[]).filter(e=>LX[e]).length>0?S(!0):b(`no_methods`):(m(n),n.length===1&&g(n[0].method))}).catch(e=>{let t=e?.response?.status;b(t===404||t===410?`expired`:`generic`)}))},[e,n]);let w=(0,Q.useCallback)(e=>{},[]),T=(0,Q.useCallback)(e=>{v(e)},[]),E=(0,Q.useCallback)(()=>{g(null),v(null)},[]),D=Rp(r,u);if(D)return(0,$.jsx)(Xh,{to:D,replace:!0});if(r.accessToken&&!r.isLoading)return(0,$.jsx)(Xh,{to:f,replace:!0});if(x&&e)return(0,$.jsx)(Xh,{to:fi(`${Ln.enrollmentRequired}?sessionId=${encodeURIComponent(e)}&email=${encodeURIComponent(t)}`,u),replace:!0});if(!o)return null;if(!e||y){let e={expired:$o.ERROR_EXPIRED,no_methods:$o.ERROR_NO_METHODS,generic:$o.ERROR_GENERIC},t=y?e[y]:$o.ERROR_GENERIC;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(CY,{children:c($o.TITLE)})}),(0,$.jsx)(jD,{variant:y===`no_methods`?`default`:`destructive`,children:(0,$.jsx)(ND,{children:c(t)})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:c($o.BACK_TO_LOGIN)})})]})}return p.length===0?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs py-section`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`text-muted-foreground`,children:c($o.VERIFYING)})]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:c($o.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto text-muted-foreground`,children:c($o.SUB_TITLE)})]}),!h&&p.length>1&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c($o.SELECT_METHOD)}),(0,$.jsx)(BX,{layout:zX.LIST,methods:p.map(e=>e.method),labelFor:e=>{let t=Oye[e];return t?c(t):e},onSelect:g})]}),h&&(()=>{let n=IX[h];if(!n)return null;let i=p.find(e=>e.method===h);if(!i)return null;let a={sessionId:e,email:t,methodConfig:i,onSuccess:w,onError:T,factorLevel:`second`,isLoading:r.isLoading,t:l,authRedirectTarget:u};return(0,$.jsx)(n,{...a})})(),_&&!h&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:_})}),h&&p.length>1&&(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:E,children:c($o.CHANGE_METHOD)})}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:d,children:c($o.BACK_TO_LOGIN)})})]})};function eZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,`Auth_MfaChallenge`)(e);return(0,$.jsx)(n,{...t})}var kye=()=>{let[e]=ch(),t=e.get(`sessionId`),n=e.get(`email`)||``;return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(eZ,{sessionId:t,sessionEmail:n})})},tZ={[_s.TOTP]:Na.TOTP_TITLE,[_s.PASSKEY]:Na.PASSKEY_TITLE,[_s.SMS_OTP]:Na.PHONE_TITLE},nZ=e=>{let{auth:t,completeEnrollmentSession:n,getSessionState:r,adoptPendingMfaSession:i}=hm(),{logout:a}=pg(),{tComponent:o,isReady:s}=K({component:B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED}),c=oh(),l=mg(),u=e=>o(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e),d=(0,Q.useMemo)(()=>L(l.search),[l.search]),{urlSessionId:f,urlEmail:p}=(0,Q.useMemo)(()=>{let e=new URLSearchParams(l.search);return{urlSessionId:e.get(`sessionId`),urlEmail:e.get(`email`)||``}},[l.search]),[m]=(0,Q.useState)(()=>Qae()),h=f??m?.sessionId??null,g=p||m?.email||``,_=!t.accessToken&&!t.mfaRequired&&!!h,[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(!_||!h||b.current)return;b.current=!0;let e=()=>{m?.sessionId===h&&qae()};r(h).then(t=>{i(h,t)||e()}).catch(t=>{let n=t?.response?.status;(n===404||n===410)&&e()}).finally(()=>y(!0))},[_,h,m,r,i]);let x=(0,Q.useMemo)(()=>fi(Ln.login,d),[d]),S=(0,Q.useMemo)(()=>Xt(l.search),[l.search]),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),k=(0,Q.useMemo)(()=>t.availableEnrollmentMethods.filter(e=>LX[e]),[t.availableEnrollmentMethods]),A=(0,Q.useMemo)(()=>{let e=t.mfaSessionId;if(!e)return fi(Ln.mfaChallenge,d);let n=t.identification?.email||g;return fi(`${Ln.mfaChallenge}?sessionId=${e}&email=${encodeURIComponent(n)}`,d)},[t.mfaSessionId,t.identification?.email,g,d]),j=(0,Q.useCallback)(e=>{O(null),n(e)||(E(!0),setTimeout(()=>{c(A,{replace:!0})},1200))},[c,A,n]),M=(0,Q.useCallback)(e=>{O(e)},[]),N=Rp(t,d);if(N)return(0,$.jsx)(Xh,{to:N,replace:!0});if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Xh,{to:S,replace:!0});if(!t.mfaRequired)return _&&!v?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(Xh,{to:x,replace:!0});let P=t.usableSecondFactorMethods.length>0;if(t.mfaSessionId&&k.length===0&&P)return(0,$.jsx)(Xh,{to:A,replace:!0});if(!s)return null;if(k.length===0)return(0,$.jsxs)(`div`,{className:`space-y-group py-section`,children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs`,children:(0,$.jsx)(CY,{children:u(Na.TITLE)})}),(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:u(Na.NO_METHODS_AVAILABLE)})}),(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Na.LOGOUT_BUTTON)})]});if(T)return(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:u(Na.ENROLL_SUCCESS)})}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:u(Na.LOADING)})]});let F=C?LX[C]:null;return(0,$.jsxs)(`div`,{className:`space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:u(Na.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:u(Na.DESCRIPTION)})]}),D&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:D})}),!C&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:u(Na.SELECT_METHOD)}),(0,$.jsx)(BX,{layout:zX.LIST,methods:k,labelFor:e=>u(tZ[e]||e),onSelect:e=>{w(e),O(null)}})]}),C&&F&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:()=>{w(null),O(null)},children:`←`}),(0,$.jsx)(Z,{className:`text-sm font-medium`,children:u(tZ[C]||C)})]}),(0,$.jsx)(F,{sessionId:t.mfaSessionId||void 0,onComplete:j,onError:M,isLoading:!1,t:u})]}),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Na.LOGOUT_BUTTON)})})]})};function rZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,`Auth_EnrollmentRequired`)(e);return(0,$.jsx)(n,{...t})}var Aye=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(rZ,{})}),iZ=B.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,aZ=Q.createContext(null),jye=()=>{let{tComponent:e,isReady:t}=K({component:iZ}),n=Q.useContext(aZ);return t?(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`organizationName`}),n&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n})}),(0,$.jsx)(rO,{label:e(iZ,uo.SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null},Mye=()=>{let{tComponent:e,isReady:t}=K({component:iZ}),n=Q.useContext(aZ);return t?(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`firstName`}),(0,$.jsx)(XL,{name:`lastName`}),n&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n})}),(0,$.jsx)(rO,{label:e(iZ,uo.PROFILE_SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null};function oZ(e){let t=e?.pendingObligations;if(!Array.isArray(t))return[ru.ORGANIZATION];let n=new Set(Object.values(ru));return t.filter(e=>typeof e==`string`&&n.has(e))}var sZ=e=>{let{auth:t,completeOrganizationOnboarding:n,completeProfileOnboarding:r,abandonOrganizationOnboarding:i,getSessionState:a}=hm(),{tComponent:o,isReady:s}=K({component:iZ}),c=e=>o(iZ,e),l=cp(),u=mg(),d=oh(),f=(0,Q.useMemo)(()=>L(u.search),[u.search]),p=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),m=(0,Q.useMemo)(()=>fi(Ln.login,f),[f]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=t.onboardingSessionId;if(!e){v(null);return}let n=!1;return a(e).then(e=>{n||v(oZ(e))}).catch(()=>{n||v([ru.ORGANIZATION])}),()=>{n=!0}},[t.onboardingSessionId]);let y=_?.[0],b=(0,Q.useCallback)(async e=>{g(null);try{let t=await r(e.firstName.trim(),e.lastName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(uo.COMPLETION_ERROR)))}},[r,c]),x=(0,Q.useCallback)(async e=>{g(null);try{let t=await n(e.organizationName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(uo.COMPLETION_ERROR)))}},[n,c]),S=(0,Q.useCallback)(()=>{i(),d(m,{replace:!0})},[i,d,m]);if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Xh,{to:p,replace:!0});if(!s)return null;if(!t.onboardingSessionId)return(0,$.jsxs)(`div`,{className:`space-y-group py-section text-center`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(CY,{children:c(uo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(uo.SESSION_EXPIRED)})]}),(0,$.jsx)(Z,{className:`text-sm`,children:(0,$.jsx)(_X,{href:m,children:c(uo.SIGN_IN_AGAIN_LINK)})})]});if(_===null)return null;let C=(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,onClick:S,children:c(uo.USE_DIFFERENT_ACCOUNT)})});return y===ru.PROFILE_NAMES?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:c(uo.PROFILE_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(uo.PROFILE_DESCRIPTION)})]}),(0,$.jsx)(aZ.Provider,{value:h,children:(0,$.jsx)(iE,{schema:Kte,defaultValues:{firstName:``,lastName:``},onSubmit:b,validationMode:ta.ON_BLUR,disabled:t.isLoading,layoutTemplate:Mye,labels:{fields:{firstName:c(uo.FIRST_NAME),lastName:c(uo.LAST_NAME)}}},ru.PROFILE_NAMES)}),C]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:c(uo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(uo.DESCRIPTION)})]}),(0,$.jsx)(aZ.Provider,{value:h,children:(0,$.jsx)(iE,{schema:Ite,defaultValues:{organizationName:``},onSubmit:x,validationMode:ta.ON_BLUR,disabled:t.isLoading,layoutTemplate:jye,labels:{fields:{organizationName:c(uo.ORGANIZATION_NAME)}}},ru.ORGANIZATION)}),C]})};function cZ({preset:e=q.DEFAULT,...t}){let n=G(iZ,`Auth_OrganizationOnboarding`)(e);return(0,$.jsx)(n,{...t})}var Nye=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(cZ,{})}),lZ=({label:e})=>{let{appConfig:t}=Ou(),n=sie(t.compliance,gae.PRIVACY_NOTICE,new Date().toISOString());return n===void 0?null:(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:n,external:!0,"data-privacy-notice-link":``,children:e})})},uZ=as.getLogger(),dZ=uZ.debugByType(`Auth_Main`);uZ.setDebugTypeLogging(`Auth_Main`,!1);var Pye=()=>{let{auth:e}=pg(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`email`}),e.error&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.error})}),(0,$.jsx)(rO,{label:(e=>t(B.PUBLIC_LAYOUTS_USER_AUTH,e))(ss.CONTINUE),submittingLabel:`…`,fullWidth:!0})]}):null};function Fye(e){return new Promise(t=>{let n=Date.now()+e,r=()=>{let e=document.querySelector(`input[autocomplete~="webauthn"]`);e||Date.now()>=n?t(e):requestAnimationFrame(r)};r()})}var Iye=3e3,Lye={[Zc.SAML_LOGIN_FAILED]:{label:ss.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Zc.SAML_AUTH_FAILED]:{label:ss.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Zc.MISSING_PARAMS]:{label:ss.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Zc.OAUTH_FAILED]:{label:ss.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Zc.SAML_SLO_FAILED]:{label:ss.PROVIDER_SIGN_OUT_FAILED,variant:`warning`}},fZ=({})=>{let{auth:e,identifyByEmail:t,initiateOAuth2Login:n}=pg(),{signInWithPasskey:r,endedSessionReason:i}=hm(),a=$x(),o=mg(),s=(0,Q.useMemo)(()=>MX({publicProviders:a.globalAuth?.socialOAuth2Providers}),[a.globalAuth?.socialOAuth2Providers]),c=(0,Q.useMemo)(()=>pb(s.map(e=>e.displayNameLabelKey)),[s]),{t:l,tComponent:u,isReady:d}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH,keys:c}),f=e=>u(B.PUBLIC_LAYOUTS_USER_AUTH,e),p=Ln,m=(0,Q.useMemo)(()=>Xt(o.search),[o.search]),h=(0,Q.useMemo)(()=>L(o.search),[o.search]),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams(o.search).get(`error`);if(!e)return null;let{label:t,variant:n}=Lye[e]??{label:ss.PROVIDER_SIGN_IN_FAILED,variant:`destructive`};return{text:u(B.PUBLIC_LAYOUTS_USER_AUTH,t),variant:n}},[o.search,u]),_=i===j.ACCOUNT_NOT_ACTIVE?{text:f(ss.ACCOUNT_NOT_ACTIVE_NOTICE),variant:`destructive`}:i===j.SESSION_ENDED?{text:f(ss.SESSION_ENDED_NOTICE),variant:`info`}:null,v=(0,Q.useMemo)(()=>fi(p.passwordLost,h),[h,p.passwordLost]),y=(0,Q.useMemo)(()=>fi(p.register,h),[h,p.register]),[b,x]=(0,Q.useState)(null);SX({mfaRequired:e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:e.identification?.email,authRedirectTarget:h});let S=!!e.identification,C=e.identification?.sessionId||``,w=e.identification?.email||``,T=(0,Q.useMemo)(()=>!S||!e.identification?.userExists?[]:(e.identification?.firstFactorMethods||[]).filter(e=>IX[e.method]),[S,e.identification]),E=(0,Q.useMemo)(()=>{if(T.length===0)return null;let t=e.identification?.defaultFirstFactorMethod;return t&&IX[t]?t:T[0].method},[T,e.identification?.defaultFirstFactorMethod]),D=b||E,O=T.filter(e=>e.method!==D),k=T.some(e=>e.method===D&&e.enforcedFirstFactor),A=async e=>{try{await n(e,h)}catch{}},M=async e=>{await t(e.email)},N=(0,Q.useCallback)(e=>{},[]),P=(0,Q.useCallback)(e=>{},[]),F=s.length>0,I=!S||!e.identification?.userExists,ee=F&&I,R=(0,Q.useMemo)(()=>{let e=Iu(a.userTypeAuth?.authMethodsEnabled);return F||e.delete(_s.EXTERNAL_OAUTH2),e},[F,a.userTypeAuth?.authMethodsEnabled]),z=!a.userTypeAuth?.authMethodsEnabled||R.size>0,te=ee&&z,ne=lte(a.userTypeAuth?.authMethodsEnabled).has(_s.PASSKEY)&&e.purpose!==Is.REAUTH&&typeof window<`u`&&!!window.PublicKeyCredential,re=I&&!z&&!ne&&!ee,ie=!I&&T.length===0,ae=(0,Q.useRef)(!1),[oe,se]=(0,Q.useState)(0),ce=(0,Q.useCallback)(async()=>{ae.current=!0;try{await r(Om.MODAL)}catch{}finally{ae.current=!1,se(e=>e+1)}},[r]),le=(0,Q.useRef)(r);le.current=r,(0,Q.useEffect)(()=>{if(!d||!I||!ne)return;let e=!1;return(async()=>{if(await poe())for(await Fye(Iye);!e;)try{await le.current(Om.CONDITIONAL);return}catch(e){if(!(e instanceof Am)||ae.current)return}})(),()=>{e=!0,Zae.cancelCeremony()}},[d,I,ne,oe]),(0,Q.useEffect)(()=>{dZ(`Render isReady=${d} accessToken=${e.accessToken?`yes`:`no`} authLoading=${e.isLoading?`yes`:`no`} identification=${S?`yes`:`no`} showIdentify=${I?`yes`:`no`} activeMethod=${D??`none`}`)},[d,e.accessToken,e.isLoading,S,I,D]);let ue=Rp(e,h);return ue?(0,$.jsx)(Xh,{to:ue,replace:!0}):e.accessToken?(0,$.jsx)(Xh,{to:m,replace:!0}):d?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:e.purpose===Is.REAUTH?f(ss.REAUTH_TITLE):f(ss.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:e.purpose===Is.REAUTH?f(ss.REAUTH_SUB_TITLE):f(ss.SUB_TITLE)})]}),ee&&(0,$.jsx)(FX,{providers:s,onProviderClick:A,isLoading:e.isLoading,continueWithLabel:f(ss.CONTINUE_WITH),translate:l,dividerLabel:f(ss.DIVIDER_OR),showDivider:te}),!e.error&&_&&(0,$.jsx)(jD,{variant:_.variant,"data-session-ended-notice":i??void 0,children:(0,$.jsx)(ND,{children:_.text})}),!e.error&&g&&(0,$.jsx)(jD,{variant:g.variant,children:(0,$.jsx)(ND,{children:g.text})}),I&&z&&(0,$.jsx)(iE,{schema:Mre,defaultValues:{email:``},onSubmit:M,validationMode:ta.ON_BLUR,disabled:e.isLoading,labels:{fields:{email:f(ss.EMAIL_ADDRESS)}},layoutTemplate:Pye},`identify`),I&&ne&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:f(ss.DIVIDER_OR)}),(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:tf.WRAP,onClick:ce,disabled:e.isLoading,"data-passkey-sign-in":``,children:[(0,$.jsx)(DX,{method:_s.PASSKEY}),f(ss.PASSKEY_SIGN_IN)]})]}),D&&!I&&(()=>{let t=IX[D];if(!t)return null;let n=T.find(e=>e.method===D);if(!n)return null;let r={sessionId:C,email:w,methodConfig:n,onSuccess:N,onError:P,factorLevel:`first`,isLoading:e.isLoading,t:f,authRedirectTarget:h};return(0,$.jsx)(t,{...r})})(),k&&O.length>0&&!I&&(0,$.jsx)(Z,{children:f(ss.ORGANIZATION_ENFORCED_METHOD)}),O.length>0&&!I&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:f(ss.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(BX,{methods:O.map(e=>e.method),labelFor:e=>EX(e,{offeredMethod:O.find(t=>t.method===e),socialProviders:s,continueWithTemplate:f(ss.CONTINUE_WITH),translateLabel:e=>f(e),resolveSocialProviderLabel:e=>jX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:NX[e.providerRef]?.label,translate:l})}),onSelect:x,disabled:e.isLoading})]}),re&&(0,$.jsx)(jD,{"data-auth-no-entry-point":``,children:(0,$.jsx)(ND,{children:f(ss.NO_SIGN_IN_METHOD_AVAILABLE)})}),ie&&(0,$.jsx)(jD,{"data-auth-no-method-for-address":``,children:(0,$.jsx)(ND,{children:f(ss.NO_SIGN_IN_METHOD_FOR_ADDRESS)})}),!z&&!S&&e.error&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.error})}),(0,$.jsxs)(`div`,{className:`text-center space-y-item pt-group`,children:[D===_s.PASSWORD&&!I&&(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:v,children:f(ss.FORGOT_PASSWORD)})}),e.purpose!==Is.REAUTH&&a.registrationConfig.publicRegistrationAvailable&&(0,$.jsxs)(Z,{children:[f(ss.NO_ACCOUNT),` `,(0,$.jsx)(_X,{href:y,children:f(ss.SIGNUP_LINK)})]}),(0,$.jsx)(lZ,{label:f(ss.PRIVACY_NOTICE_LINK)})]})]}):null};function pZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_AUTH,`Auth_Main`)(e);return dZ(`Resolve wrapper preset=${e} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var mZ=as.getLogger(),Rye=mZ.debugByType(`AuthPage_Main`);mZ.setDebugTypeLogging(`AuthPage_Main`,!1);var zye=()=>{let{auth:e}=hm(),{isReady:t}=K({component:[B.PUBLIC_LAYOUTS_USER_AUTH,B.LOW_LEVEL_FORM_MESSAGE],keys:[`errors_validation`]});return Rye(`Render ready=${t}`),t?(0,$.jsx)(pX,{useCardLayout:!0,organizationBranding:e.identification?.organizationBranding,children:(0,$.jsx)(pZ,{})}):(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(ib,{size:48})})},Bye=60,hZ=({token:e,email:t})=>{let{auth:n,handleEmailVerification:r}=hm(),{tComponent:i,isReady:a}=K({component:B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL}),o=cp(),s=e=>i(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,e),c=Ln.login,[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(t||``),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(null),S=(0,Q.useCallback)(()=>{e&&t&&r(e,t).catch(e=>{u(o(e,s(pl.ERROR_MESSAGE)))})},[e,t]);(0,Q.useEffect)(()=>{e&&t&&!d.current&&(d.current=!0,n.accessToken&&!n.isLoading?p(!0):S())},[e,t]),(0,Q.useEffect)(()=>{if(v<=0)return;let e=setInterval(()=>{y(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[v]),SX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:t,authRedirectTarget:void 0});let C=(0,Q.useCallback)(async()=>{if(!(!m||v>0)){_(`sending`),x(null);try{await bc().resendVerificationEmail(m),_(`sent`),y(Bye)}catch(e){_(`error`),x(o(e,s(pl.ERROR_MESSAGE)))}}},[m,v]),w=Rp(n,void 0);return w?(0,$.jsx)(Xh,{to:w,replace:!0}):a?!e||!t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(CY,{children:s(pl.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(pl.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(pl.LOGIN_LINK)})})]}):f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-warning/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-warning-foreground`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z`})})}),(0,$.jsx)(CY,{children:s(pl.SESSION_CONFLICT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(pl.SESSION_CONFLICT_DESCRIPTION).replace(`{email}`,t)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,children:[(0,$.jsx)(X,{type:`button`,onClick:()=>{p(!1),S()},children:s(pl.SESSION_CONFLICT_VERIFY_BUTTON).replace(`{email}`,t)}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>{window.location.href=Ln.home},children:s(pl.SESSION_CONFLICT_CANCEL_BUTTON)})]})]}):n.accessToken&&!n.isLoading?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-success`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,$.jsx)(CY,{children:s(pl.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(pl.SUCCESS_MESSAGE)})]}),(0,$.jsx)(Xh,{to:Ln.home,replace:!0})]}):l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(CY,{children:s(pl.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:l})}),(0,$.jsxs)(`div`,{className:`mt-group space-y-item-sm`,children:[(0,$.jsx)(Z,{className:`text-sm text-center`,children:s(pl.RESEND_DESCRIPTION)}),(0,$.jsxs)(`div`,{className:`flex gap-item-xs`,children:[(0,$.jsx)(ZM,{name:`__display`,schema:bd(),type:`email`,placeholder:s(pl.RESEND_EMAIL_PLACEHOLDER),value:m,onChange:e=>h(String(e)),disabled:g===`sending`||v>0}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:C,disabled:!m||g===`sending`||v>0,children:g===`sending`?s(pl.RESEND_SENDING):v>0?`${s(pl.RESEND_COOLDOWN)} (${v}s)`:s(pl.RESEND_BUTTON)})]}),g===`sent`&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:s(pl.RESEND_SUCCESS)})}),g===`error`&&b&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:b})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(pl.LOGIN_LINK)})})]}):(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(CY,{children:s(pl.TITLE)}),(0,$.jsxs)(Z,{className:`max-w-sm mx-auto`,children:[s(pl.VERIFYING),` `,t]})]})}):null};function gZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,`Auth_ConfirmEmail`)(e);return(0,$.jsx)(n,{...t})}var Vye=()=>{let[e]=ch(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(gZ,{token:t,email:n})})},_Z={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0},vZ=({fieldName:e,policy:t,t:n,blocklistContext:r})=>{let{watch:i}=GC(),a=i(e)||``,o=(0,Q.useMemo)(()=>{if(!a)return[];let e=[];return e.push({label:n(sl.MIN_LENGTH).replace(`{minLength}`,String(t.minLength)),passed:a.length>=t.minLength}),e.push({label:n(sl.MAX_LENGTH).replace(`{maxLength}`,String(t.maxLength)),passed:a.length<=t.maxLength}),t.requireUppercase&&e.push({label:n(sl.UPPERCASE),passed:/[A-Z]/.test(a)}),t.requireLowercase&&e.push({label:n(sl.LOWERCASE),passed:/[a-z]/.test(a)}),t.requireNumbers&&e.push({label:n(sl.NUMBER),passed:/\d/.test(a)}),t.requireSpecialChars&&e.push({label:n(sl.SPECIAL_CHAR),passed:/[^A-Za-z0-9]/.test(a)}),e.push({label:n(sl.BLOCKLISTED),passed:!Ve(a,r)}),e},[a,t,n,r]);return!a||o.length===0?null:(0,$.jsx)(`ul`,{className:`space-y-1 text-xs mt-item-xs`,children:o.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5 ${e.passed?`text-success-subtle-foreground`:`text-muted-foreground`}`,children:[e.passed?(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})}):(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`circle`,{cx:`10`,cy:`10`,r:`3`})}),(0,$.jsx)(`span`,{children:e.label})]},t))})};function yZ({email:e}){return e?(0,$.jsx)(`input`,{"data-testid":`credential-username-autofill`,type:`email`,name:`email`,autoComplete:`username`,value:e,readOnly:!0,tabIndex:-1,className:`sr-only`}):null}function bZ(e,t,n){return e.map(e=>{let r=t(e);return e===gu.MIN_LENGTH?r.replace(`{minLength}`,String(n.minLength??8)):e===gu.MAX_LENGTH?r.replace(`{maxLength}`,String(n.maxLength??128)):r})}function xZ(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;if(r.message!==Xl.VALIDATION_PASSWORD_POLICY_VIOLATION)return null;let i=r.context,a=i?.violations;return!Array.isArray(a)||a.length===0?null:bZ(a,t,{minLength:i.minLength??n.minLength??8,maxLength:i.maxLength??n.maxLength??128}).join(`. `)}var Hye=new Set([_s.PASSWORD,_s.ORG_SAML,_s.ORG_OPENID_CONNECT,_s.EXTERNAL_OAUTH2,_s.MAGIC_LINK,_s.PASSKEY]),Uye=({invitationEmail:e,passwordPolicy:t})=>{let{formState:n}=GC(),{tComponent:r,isReady:i}=K({component:B.PUBLIC_LAYOUTS_USER_INVITATION}),a=e=>r(B.PUBLIC_LAYOUTS_USER_INVITATION,e);return i?(0,$.jsxs)(nA,{children:[(0,$.jsx)(yZ,{email:e}),(0,$.jsx)(XL,{name:`firstName`}),(0,$.jsx)(XL,{name:`lastName`}),(0,$.jsx)(XL,{name:`password`}),(0,$.jsx)(XL,{name:`confirmPassword`}),(0,$.jsx)(vZ,{fieldName:`password`,policy:t,t:a}),n.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n.errors.root.message})}),(0,$.jsx)(rO,{label:a(Uc.ACCEPT_INVITATION),submittingLabel:a(Uc.ACCEPTING_INVITATION),fullWidth:!0})]}):null},Wye=({invitationEmail:e,t,tAuth:n})=>{let{formState:r}=GC();return(0,$.jsxs)(nA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(XL,{name:`firstName`}),(0,$.jsx)(XL,{name:`lastName`}),r.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:r.errors.root.message})}),(0,$.jsx)(rO,{label:n(ss.MAGIC_LINK_SEND),submittingLabel:n(ss.MAGIC_LINK_SEND),fullWidth:!0})]})},Gye=({invitationEmail:e,disabled:t,onSubmit:n,t:r,tAuth:i})=>{let a=(0,Q.useRef)(null),o=cp(),s=(0,Q.useMemo)(()=>ci.pick({firstName:!0,lastName:!0}),[]),c=(0,Q.useCallback)(async e=>{a.current?.clearErrors(`root`);try{await n(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0)}catch(e){a.current?.setError(`root`,{type:`server`,message:o(e,r(Uc.UNEXPECTED_ERROR))})}},[n,r,o]);return(0,$.jsx)(iE,{schema:s,defaultValues:{firstName:``,lastName:``},onSubmit:c,validationMode:ta.ON_BLUR,disabled:t,onFormReady:e=>{a.current=e},labels:{fields:{firstName:r(Uc.FIRST_NAME),lastName:r(Uc.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(Wye,{invitationEmail:e,t:r,tAuth:i})})},Kye=({invitationEmail:e,error:t,t:n})=>(0,$.jsxs)(nA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:n(Uc.PASSKEY_DESCRIPTION)}),(0,$.jsx)(XL,{name:`firstName`}),(0,$.jsx)(XL,{name:`lastName`}),t&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:t})}),(0,$.jsx)(rO,{label:n(Uc.PASSKEY_CREATE),submittingLabel:n(Uc.PASSKEY_CREATING),fullWidth:!0})]}),qye=({invitationEmail:e,disabled:t,error:n,onSubmit:r,t:i})=>{let a=typeof window<`u`&&!!window.PublicKeyCredential,o=(0,Q.useMemo)(()=>ci.pick({firstName:!0,lastName:!0}),[]);return a?(0,$.jsx)(iE,{schema:o,defaultValues:{firstName:``,lastName:``},onSubmit:e=>r(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0),validationMode:ta.ON_BLUR,disabled:t,labels:{fields:{firstName:i(Uc.FIRST_NAME),lastName:i(Uc.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(Kye,{invitationEmail:e,error:n,t:i})}):(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:i(Uc.PASSKEY_UNAVAILABLE_HINT)})})},SZ=({token:e,email:t})=>{let{auth:n,acceptInvitation:r}=hm(),{handleError:i}=rp(),a=cp(),o=$x(),s=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_USER_INVITATION,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:c,isReady:l}=K({component:s}),u=mg(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),I=(0,Q.useCallback)(e=>c(B.PUBLIC_LAYOUTS_USER_INVITATION,e),[c]),ee=(0,Q.useCallback)(e=>c(B.PUBLIC_LAYOUTS_USER_AUTH,e),[c]),R=(0,Q.useMemo)(()=>gm(c,B.PUBLIC_LAYOUTS_USER_AUTH),[c]),z=Ln.login,te=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),ne=(0,Q.useMemo)(()=>L(u.search),[u.search]),re=O?.inviteeEmail??t,ie=(0,Q.useMemo)(()=>O?.passwordPolicy??o.passwordPolicy??_Z,[O?.passwordPolicy,o.passwordPolicy]),ae=(0,Q.useMemo)(()=>ci.refine(e=>!e.password||e.password===e.confirmPassword,{message:I(Uc.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[I]),oe=(0,Q.useCallback)(e=>{d.current=e},[]);(0,Q.useEffect)(()=>{if(!e||n.accessToken){j(!1);return}let t=!1;return j(!0),N(null),bc().getInvitationInfo(e).then(e=>{t||k(e)}).catch(e=>{t||N(a(e,I(Uc.UNEXPECTED_ERROR)))}).finally(()=>{t||j(!1)}),()=>{t=!0}},[e,n.accessToken]);let se=(0,Q.useMemo)(()=>(O?.availableFirstFactorMethods??[]).filter(e=>Hye.has(e.method)),[O]),ce=se.length>0,le=n.isLoading||E||v,ue=(0,Q.useMemo)(()=>se[0]?.method??null,[se]),de=P??ue,fe=se.filter(e=>e.method!==de);SX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:re||void 0,authRedirectTarget:ne});let pe=(0,Q.useCallback)(async t=>{if(d.current?.clearErrors(`root`),t.password){let e=st.validatePasswordAgainstPolicy(t.password,ie);if(!e.valid){d.current?.setError(`root`,{type:`policy`,message:bZ(e.violations,I,ie).join(`. `)});return}}let n=e=>e?.trim()||void 0;try{(await r({invitationToken:e,firstName:n(t.firstName),lastName:n(t.lastName),password:t.password||void 0}))?.signInRequired&&T(!0)}catch(e){d.current?.setError(`root`,{type:`server`,message:a(e,I(Uc.UNEXPECTED_ERROR))})}},[r,ie,I,e,a]),me=(0,Q.useCallback)(async(t,n)=>{x(null),y(!0);try{let i=await r({invitationToken:e,firstName:t,lastName:n,credentialMethod:_s.PASSKEY});if(i?.signInRequired){T(!0);return}let a=i?.passkeyRegistrationOptions;if(a)try{let e=await hp({optionsJSON:a});await bc().passkeyRegisterVerify({response:e})}catch{}}catch(e){x(a(e,I(Uc.UNEXPECTED_ERROR)))}finally{y(!1)}},[r,e,I,a]),he=(0,Q.useCallback)(async(t,n)=>{D(!0);try{(await bc().acceptInvitation({invitationToken:e,firstName:t,lastName:n,credentialMethod:_s.MAGIC_LINK,redirect:ne})).nextStep===$re.SIGN_IN_REQUIRED?T(!0):C(!0)}catch(e){throw i(e,`Invitation acceptance failed (magic link)`,{credentialMethod:_s.MAGIC_LINK}),e}finally{D(!1)}},[e,i,ne]),ge=(0,Q.useCallback)(async()=>{if(_(null),!e)_(I(Uc.INVALID_LINK));else{p(!0);try{await bc().rejectInvitation({invitationToken:e}),h(!0)}catch(e){_(a(e,I(Uc.UNEXPECTED_ERROR)))}finally{p(!1)}}},[I,e,a]),_e=(0,Q.useCallback)(e=>{},[]),ve=(0,Q.useCallback)(e=>{},[]);return n.accessToken&&!v?(0,$.jsx)(Xh,{to:te,replace:!0}):l?e?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.DECLINE_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Uc.DECLINE_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Uc.CONTINUE_LINK)})})]}):w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.SIGN_IN_REQUIRED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Uc.SIGN_IN_REQUIRED_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)})})]}):S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:ee(ss.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:ee(ss.MAGIC_LINK_SENT_DESCRIPTION)}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)})})]}):A?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-group`,children:(0,$.jsx)(ib,{size:40})}):M||!O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:M||I(Uc.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)})})]}):O.managementMode===Hre.SCIM?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.SCIM_MANAGED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Uc.SCIM_MANAGED_MESSAGE)}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),g&&(0,$.jsx)(jD,{variant:`destructive`,className:`mb-group`,children:(0,$.jsx)(ND,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ge,disabled:f,className:`w-full`,children:I(f?Uc.DECLINING_INVITATION:Uc.DECLINE_INVITATION)}),(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)}),(0,$.jsx)(lZ,{label:ee(ss.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Uc.SUB_TITLE)}),O.organizationName&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:O.organizationName}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),ce?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:I(Uc.METHOD_CHOICE_HINT)}),(()=>{if(!de)return null;let e=se.find(e=>e.method===de);if(!e)return null;if(de===_s.PASSWORD)return(0,$.jsx)(iE,{schema:ae,defaultValues:{firstName:``,lastName:``,password:``,confirmPassword:``},onSubmit:pe,validationMode:ta.ON_BLUR,disabled:n.isLoading||f,onFormReady:oe,labels:{fields:{firstName:I(Uc.FIRST_NAME),lastName:I(Uc.LAST_NAME),password:I(Uc.PASSWORD),confirmPassword:I(Uc.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(Uye,{invitationEmail:re,passwordPolicy:ie})});if(de===_s.MAGIC_LINK)return(0,$.jsx)(Gye,{invitationEmail:re,disabled:n.isLoading||f,onSubmit:he,t:I,tAuth:ee});if(de===_s.PASSKEY)return(0,$.jsx)(qye,{invitationEmail:re,disabled:n.isLoading||f,error:b,onSubmit:me,t:I});let t=IX[de];if(!t)return null;let r={sessionId:``,email:re??``,methodConfig:e,onSuccess:_e,onError:ve,factorLevel:`first`,isLoading:n.isLoading||f,t:R};return(0,$.jsx)(t,{...r})})(),fe.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:ee(ss.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(BX,{methods:fe.map(e=>e.method),labelFor:e=>EX(e,{offeredMethod:fe.find(t=>t.method===e),continueWithTemplate:ee(ss.CONTINUE_WITH),translateLabel:e=>ee(e),resolveSocialProviderLabel:e=>e.displayName??e.providerRef}),onSelect:e=>{F(e),x(null)},disabled:le||f})]})]}):(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:I(Uc.NO_METHOD_AVAILABLE_HINT)})}),g&&(0,$.jsx)(jD,{variant:`destructive`,className:`mt-group`,children:(0,$.jsx)(ND,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ge,disabled:le||f,className:`w-full`,children:I(f?Uc.DECLINING_INVITATION:Uc.DECLINE_INVITATION)}),(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)}),(0,$.jsx)(lZ,{label:ee(ss.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:I(Uc.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Uc.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Uc.LOGIN_LINK)})})]}):null};function CZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_INVITATION,`Auth_Invitation`)(e);return(0,$.jsx)(n,{...t})}var Jye=()=>{let[e]=ch(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(CZ,{token:t,email:n})})};function Yye(e,t,n){if(!t||Object.keys(t).length===0)return;let r,i;for(let t of Object.values(n.resourceConfigurations)){let n=Array.isArray(t.operations)?t.operations:[];for(let a of n)if(a.tokenAuthentication?.types?.includes(e)&&Sn(a.operationFrontendConfig)){r=t,i=a;break}if(i)break}if(!r||!i)return;let a={};for(let[e,r]of Object.entries(t)){let t=n.fieldIdentifierToResourceType[e];t&&(a[t]=r)}return dh.resolveResourceUrl(r,i,a,n.allResourceFieldIdentifiers)?.resolvedUrl??void 0}function Xye(e){return!e||!Eae(e)||e.includes(`..`)||e.includes(`\\`)||e.includes(`://`)||/[<>"]/.test(e)||e.length>256?Ln.home:e}var wZ=({token:e,mode:t=`one-off-session`,returnPathFromUrl:n})=>{let{handleOneOffTokenExchange:r,handleAuthCodeExchange:i,clearCrossFrontendHandoffContext:a,auth:o,tokenStorage:s}=hm(),{registry:c}=fm(),{tComponent:l,isReady:u}=K({component:B.PUBLIC_LAYOUTS_ONE_OFF_SESSION}),d=cp(),f=e=>l(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,e),p=Ln.login,[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(t===`one-off-session`&&!!o.accessToken),y=(0,Q.useMemo)(()=>o.accessToken?t===`cross-frontend-handoff`?Xye(o.crossFrontendHandoffContext?.returnPath??n):o.oneOffContext?Yye(o.oneOffContext.tokenType,o.oneOffContext.scopedInitiatorIds,c)??Ln.home:Ln.home:Ln.home,[t,o.oneOffContext,o.accessToken,o.crossFrontendHandoffContext,n,c]);return(0,Q.useEffect)(()=>{g.current||(t===`one-off-session`&&!(s instanceof nm)?(g.current=!0,h(f(ec.ERROR_WRONG_TAB)),v(!0)):e?o.accessToken&&t===`one-off-session`?(g.current=!0,v(!0)):(g.current=!0,(t===`cross-frontend-handoff`?i(e):r(e)).catch(e=>{h(d(e,f(ec.ERROR_GENERIC)))}).finally(()=>{v(!0)})):(g.current=!0,h(f(ec.ERROR_NO_TOKEN)),v(!0)))},[e,t,o.accessToken,r,i,s]),(0,Q.useEffect)(()=>()=>{t===`cross-frontend-handoff`&&a()},[t,a]),o.accessToken&&!o.isLoading&&_&&!m?(0,$.jsx)(Xh,{to:y,replace:!0}):u?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(CY,{children:f(ec.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:m})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:p,children:f(ec.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:f(ec.VERIFYING)})]}):null};function TZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,`Auth_OneOffSession`)(e);return(0,$.jsx)(n,{...t})}var EZ=()=>{let{token:e}=Rm();return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(TZ,{token:e})})},DZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.UPLOADING=`uploading`,e.DONE=`done`,e.FAILED=`failed`})(DZ||={});function OZ(e,t){if(e.length===0||t===``)return!0;let n=t.split(`/`)[0];return e.some(e=>e===t||e===`${n}/*`)}function Zye(e){let t=e,n=t?.status??t?.statusCode??t?.response?.status;return typeof n==`number`?n:void 0}var kZ=({token:e})=>{let{tComponent:t,isReady:n,formatDateTime:r,formatByteSize:i}=K({component:B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT}),a=cp(),o=(0,Q.useCallback)((e,n)=>t(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,e,n),[t]),[s,c]=(0,Q.useState)(DZ.LOADING),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async()=>{if(!e)return f({kind:ya.ERROR_NOT_FOUND,cause:void 0}),c(DZ.FAILED),null;try{let t=await bc().readFileUploadGrantStatus(e);return u(t),t}catch(e){let t=Zye(e)===404?ya.ERROR_NOT_FOUND:ya.ERROR_GENERIC;return f({kind:t,cause:t===ya.ERROR_GENERIC?e:void 0}),c(DZ.FAILED),null}},[e]);(0,Q.useEffect)(()=>{let e=!1;return v().then(t=>{!e&&t&&c(DZ.READY)}),()=>{e=!0}},[v]);let y=(0,Q.useMemo)(()=>l?i(l.constraints.maxBytes):``,[l,i]),b=(0,Q.useCallback)(e=>{e&&l&&(e.size>l.constraints.maxBytes?(m(null),f({kind:ya.ERROR_TOO_LARGE,cause:void 0}),c(DZ.FAILED)):OZ(l.constraints.allowedMimeTypes,e.type)?(f(null),m(e),c(DZ.READY)):(m(null),f({kind:ya.ERROR_TYPE_NOT_ACCEPTED,cause:void 0}),c(DZ.FAILED)))},[l]),x=(0,Q.useCallback)(async()=>{if(e&&l&&p){c(DZ.UPLOADING),g(0);try{await bc().uploadWithFileUploadGrant(l,e,p,{onUploadProgress:e=>g(e<0?0:e)}),await v()&&c(DZ.DONE)}catch(e){f({kind:ya.ERROR_GENERIC,cause:e}),c(DZ.FAILED)}}},[e,l,p,v]),S=(0,Q.useCallback)(()=>{f(null),m(null),g(0),l?c(DZ.READY):(c(DZ.LOADING),v().then(e=>{e&&c(DZ.READY)}))},[l,v]);if(!n)return null;if(s===DZ.LOADING)return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(ib,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(ya.LOADING)})]});if(s===DZ.FAILED&&d){let e=o(ya.ERROR_GENERIC),t=d.cause===void 0?null:a(d.cause,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(CY,{children:o(ya.ERROR_TITLE)})}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsxs)(ND,{children:[o(d.kind,d.kind===ya.ERROR_TOO_LARGE?{maxSize:y}:void 0),t&&t!==e?(0,$.jsx)(`span`,{className:`block mt-element text-xs opacity-80`,children:t}):null]})}),d.kind===ya.ERROR_NOT_FOUND?null:(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:S,children:o(ya.RETRY)})})]})}if(!l)return null;if(l.state!==Fu.PENDING){let e=s===DZ.DONE,t=e?ya.SUCCESS_TITLE:l.state===Fu.REDEEMED?ya.STATE_REDEEMED_TITLE:l.state===Fu.EXPIRED?ya.STATE_EXPIRED_TITLE:ya.STATE_REVOKED_TITLE,n=e?ya.SUCCESS_MESSAGE:l.state===Fu.REDEEMED?ya.STATE_REDEEMED:l.state===Fu.EXPIRED?ya.STATE_EXPIRED:ya.STATE_REVOKED;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(CY,{children:o(t)})}),(0,$.jsx)(jD,{variant:e?`success`:`info`,children:(0,$.jsx)(ND,{children:o(n)})}),l.file?(0,$.jsxs)(`dl`,{className:`mt-group text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ya.FILE_ID)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{"data-testid":`upload-grant-file-id`,children:l.file.fileId})})]}):null]})}let C=s===DZ.UPLOADING,w=l.constraints.allowedMimeTypes;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:o(ya.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(ya.INTRO,{fieldName:l.target.fieldName})})]}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-element gap-y-item-xs text-sm mb-group`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ya.MAX_SIZE)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-max-size`,children:y}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ya.ACCEPTED_TYPES)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-accepted-types`,children:w.length>0?w.join(`, `):o(ya.ANY_TYPE)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ya.EXPIRES_AT)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:l.expiresAt,children:r(l.expiresAt)})})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":o(ya.DROPZONE_ARIA),className:`rounded-md border border-dashed border-input p-group text-center`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),C||b(e.dataTransfer.files?.[0]??null)},children:[(0,$.jsx)(`input`,{ref:_,type:`file`,"data-testid":`upload-grant-file-input`,className:`sr-only`,accept:w.length>0?w.join(`,`):void 0,disabled:C,onChange:e=>b(e.target.files?.[0]??null)}),(0,$.jsx)(Z,{className:`mb-element`,children:o(ya.DROPZONE_PROMPT)}),(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-choose`,variant:J.OUTLINE,disabled:C,onClick:()=>_.current?.click(),children:o(ya.CHOOSE_FILE)}),(0,$.jsx)(Z,{className:`mt-element text-sm`,"data-testid":`upload-grant-selected-file`,children:p?`${p.name} · ${i(p.size)}`:o(ya.NO_FILE_SELECTED)})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-submit`,disabled:!p||C,onClick:()=>void x(),children:C?o(ya.UPLOADING,{percent:h}):o(ya.UPLOAD)})})]})};function AZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,`Files_UploadGrantDrop`)(e);return(0,$.jsx)(n,{...t})}var jZ=()=>{let{token:e}=Rm();return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(AZ,{token:e})})},Qye=()=>{let[e]=ch(),t=e.get(`code`)??void 0,n=e.get(`return`)??void 0;return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(TZ,{token:t,mode:`cross-frontend-handoff`,returnPathFromUrl:n})})},$ye=()=>{let{formState:e}=GC(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),r=e=>t(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e);return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`email`}),e.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.errors.root.message})}),(0,$.jsx)(rO,{label:r(ys.SEND_RESET_PASSWORD_LINK),submittingLabel:r(ys.SENDING),fullWidth:!0})]}):null},MZ=({resetEmail:e})=>{let t=$x(),{formState:n}=GC(),{tComponent:r,isReady:i}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),a=e=>r(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),o=t.passwordPolicy??_Z;return i?(0,$.jsxs)(nA,{children:[(0,$.jsx)(yZ,{email:e}),(0,$.jsx)(XL,{name:`newPassword`}),(0,$.jsx)(XL,{name:`confirmPassword`}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:o,t:a}),n.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n.errors.root.message})}),(0,$.jsx)(rO,{label:a(ys.RESET_BUTTON),submittingLabel:a(ys.RESETTING),fullWidth:!0})]}):null},NZ=({resetToken:e,email:t})=>{let{auth:n}=pg(),r=$x(),i=cp(),{tComponent:a,isReady:o}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),s=e=>a(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),c=Ln.login,l=(0,Q.useRef)(null),{initAutoClearing:u,injectServerErrors:d,clearServerErrors:f}=ZR(l),p=(0,Q.useCallback)(e=>{l.current=e,u(e)},[u]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=(0,Q.useMemo)(()=>r.passwordPolicy??_Z,[r.passwordPolicy]),x=(0,Q.useMemo)(()=>zne.refine(e=>e.newPassword===e.confirmPassword,{message:s(ys.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[s]);return n.accessToken?(0,$.jsx)(Xh,{to:Ln.home,replace:!0}):o?v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-success`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,$.jsx)(CY,{children:s(ys.RESET_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(ys.RESET_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(ys.LOGIN_LINK)})})]}):e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:s(ys.RESET_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(ys.RESET_SUB_TITLE)})]}),(0,$.jsx)(iE,{schema:x,defaultValues:{newPassword:``,confirmPassword:``},onSubmit:async t=>{h(!0),l.current?.clearErrors(`root`),f();let n=st.validatePasswordAgainstPolicy(t.newPassword,b);if(!n.valid)l.current?.setError(`root`,{type:`policy`,message:bZ(n.violations,s,b).join(`. `)}),h(!1);else try{await bc().completePasswordReset(e,t.newPassword),y(!0)}catch(e){let t=jM(e);if(t)d(t.validationErrors);else{let t=xZ(e,s,b);l.current?.setError(`root`,{type:`server`,message:t??i(e,s(ys.INVALID_TOKEN))})}}finally{h(!1)}},onFormReady:p,validationMode:ta.ON_BLUR,disabled:m,labels:{fields:{newPassword:s(ys.NEW_PASSWORD),confirmPassword:s(ys.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(MZ,{resetEmail:t})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(ys.BACK_TO_LOGIN)})})]}):g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-primary`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}),(0,$.jsx)(CY,{children:s(ys.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(ys.SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(ys.BACK_TO_LOGIN)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:s(ys.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(ys.SUB_TITLE)})]}),(0,$.jsx)(iE,{schema:Sie,defaultValues:{email:``},onSubmit:async e=>{h(!0),l.current?.clearErrors(`root`),f();try{await bc().requestPasswordReset(e.email),_(!0)}catch(e){let t=jM(e);t?d(t.validationErrors):l.current?.setError(`root`,{type:`server`,message:i(e,s(ys.UNEXPECTED_ERROR))})}finally{h(!1)}},onFormReady:p,validationMode:ta.ON_BLUR,disabled:m,labels:{fields:{email:s(ys.EMAIL_ADDRESS)}},layoutTemplate:$ye}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(ys.BACK_TO_LOGIN)})})]}):null};function PZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,`Auth_PasswordLost`)(e);return(0,$.jsx)(n,{...t})}var ebe=()=>{let[e]=ch(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(PZ,{resetToken:t,email:n})})},tbe=[`response_type`,`client_id`,`redirect_uri`,`code_challenge`,`code_challenge_method`,`scope`,`resource`,`state`,`nonce`],FZ=e=>{let{auth:t}=pg(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_OAUTH_CONSENT}),[i]=ch(),[a,o]=(0,Q.useState)(`loading`),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=t?.accessToken,m=(e,t)=>n(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,e,t),h=(0,Q.useRef)(!1),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams;for(let t of tbe){let n=i.get(t);n&&e.set(t,n)}return e},[i]);(0,Q.useEffect)(()=>{if(!p)return;let e=!1;return o(`loading`),u(null),bc().oauthAuthorizeConsent(g).then(t=>{e||(t&&`consent_required`in t&&t.consent_required&&t.consent_token?(c(t),o(`ready`)):t&&`redirect_to`in t&&t.redirect_to?window.location.assign(t.redirect_to):(o(`error`),u(Rs.ERROR_INVALID)))}).catch(()=>{e||(o(`error`),u(Rs.ERROR_LOAD))}),()=>{e=!0}},[p,g]);let _=(0,Q.useCallback)(async e=>{if(s&&!h.current){h.current=!0,o(`submitting`),u(null);try{let{redirect_to:t}=await bc().oauthConsentDecision(s.consent_token,e,e===Kr.APPROVE&&d);window.location.assign(t)}catch{h.current=!1,o(`error`),u(Rs.ERROR_DECISION)}}},[s,d]);if(!p){let e=td({pathname:Ln.oauthConsent,search:`?${i.toString()}`});return(0,$.jsx)(Xh,{to:fi(Ln.login,e),replace:!0})}return a===`loading`||a===`submitting`||!r?(0,$.jsx)(`div`,{className:`py-region flex justify-center`,children:(0,$.jsx)(ib,{})}):a===`error`||!s?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:m(l??Rs.ERROR_GENERIC)})}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:m(Rs.TITLE,{clientName:s.client.name})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:m(Rs.SUB_TITLE)})]}),s.scopes.length>0&&(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:m(Rs.SCOPES_INTRO)}),(0,$.jsx)(`ul`,{className:`space-y-item-xs`,children:s.scopes.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Z,{children:e})},e))})]}),s.resource&&(0,$.jsx)(Z,{className:`text-sm break-all`,children:m(Rs.AGENT_ENDPOINT,{resource:s.resource})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-item-xs cursor-pointer`,children:[(0,$.jsx)(TI,{checked:d,onCheckedChange:e=>f(e===!0)}),(0,$.jsx)(Z,{children:m(Rs.REMEMBER)})]}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,className:`flex-1`,onClick:()=>_(Kr.DENY),children:m(Rs.DENY)}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,onClick:()=>_(Kr.APPROVE),children:m(Rs.APPROVE)})]})]})};function IZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,`Auth_OAuthConsent`)(e);return(0,$.jsx)(n,{...t})}var nbe=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(IZ,{})})),LZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.LINKING=`linking`,e.LINKED=`linked`,e.ERROR=`error`})(LZ||={});var RZ=B.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK;function zZ(e){return Ta.createOperationPathKey({resourceIdentifier:ul.CHAT_IDENTITY_LINKS,operationIdentifier:e,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1})}var BZ=e=>{let{auth:t}=pg(),n=t?.accessToken,{tComponent:r,isReady:i,formatDateTime:a}=K({component:RZ}),o=(e,t)=>r(RZ,e,t),{doOperation:s}=fm(),c=cp(),l=oh(),[u,d]=ch(),[f]=(0,Q.useState)(()=>({organizationId:u.get(ha.ORGANIZATION_ID),token:u.get(ha.TOKEN),host:Tae(u.get(ha.HOST))})),p=Jb(f.host),[m,h]=(0,Q.useState)(LZ.LOADING),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(s);x.current=s;let S=(0,Q.useRef)(c);S.current=c;let C=(0,Q.useCallback)(()=>({contextualParameters:{organizationId:f.organizationId??``},requestData:{token:f.token??``}}),[f]),w=!!n;(0,Q.useEffect)(()=>{if(!w||b.current)return;if(u.has(ha.TOKEN)&&d({},{replace:!0}),!f.organizationId||!f.token){h(LZ.ERROR),y(null);return}let e=!1;return h(LZ.LOADING),x.current(zZ(kl.PREVIEW_LINK),C()).then(t=>{e||(_(t),h(LZ.READY))}).catch(t=>{e||(y(S.current(t)),h(LZ.ERROR))}),()=>{e=!0}},[w,f,C]);let T=(0,Q.useCallback)(async()=>{if(!b.current){b.current=!0,h(LZ.LINKING);try{await x.current(zZ(kl.COMPLETE_LINK),C()),h(LZ.LINKED)}catch(e){b.current=!1,y(S.current(e)),h(LZ.ERROR)}}},[C]),E=m===LZ.LINKED||m===LZ.READY&&g?.standing===Kt.LINKED_TO_YOU,D=p.tell;(0,Q.useEffect)(()=>{E&&D(Kb.SUCCEEDED)},[E,D]);let O=(e,t)=>p.hostServed?(0,$.jsx)(X,{variant:J.OUTLINE,className:t,onClick:()=>{D(E?Kb.SUCCEEDED:Kb.FAILED,{repeat:!0}).then(e=>{e===0&&l(Ln.home)})},children:o(bl.CLOSE_HOST_WINDOW)}):(0,$.jsx)(X,{variant:J.OUTLINE,className:t,onClick:()=>l(Ln.home),children:o(e)}),k=O(bl.BACK_TO_APP);if(!n){let e=td({pathname:xte,search:`?${u.toString()}`});return(0,$.jsx)(Xh,{to:fi(Ln.login,e),replace:!0})}if(!i||m===LZ.LOADING||m===LZ.LINKING)return(0,$.jsxs)(`div`,{className:`py-region flex flex-col items-center gap-element`,children:[(0,$.jsx)(ib,{}),i&&(0,$.jsx)(Z,{children:o(m===LZ.LINKING?bl.LINKING:bl.LOADING)})]});if(m===LZ.ERROR||!g)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(CY,{children:o(bl.ERROR_TITLE)}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:v??o(bl.ERROR_INCOMPLETE_LINK)})}),k]});if(m===LZ.LINKED)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(CY,{children:o(bl.SUCCESS_TITLE)}),(0,$.jsx)(Z,{children:o(bl.SUCCESS_MESSAGE)}),k]});if(g.standing===Kt.LINKED_TO_YOU)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(CY,{children:o(bl.ALREADY_LINKED_TITLE)}),(0,$.jsx)(Z,{children:o(bl.ALREADY_LINKED)}),k]});if(g.standing===Kt.LINKED_TO_ANOTHER_MEMBER)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(CY,{children:o(bl.LINKED_TO_ANOTHER_TITLE)}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(bl.LINKED_TO_ANOTHER)})}),k]});let A=g.chatUserDisplayName&&g.workspaceDisplayName?o(bl.ACCOUNT_NAMED,{chatUser:g.chatUserDisplayName,workspace:g.workspaceDisplayName}):void 0,j=o(bl.ACCOUNT_IDS,{chatUserId:g.chatUserId,workspaceId:g.workspaceRef});return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(CY,{children:o(bl.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(bl.INTRO)})]}),(0,$.jsxs)(`dl`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`dt`,{children:(0,$.jsx)(Z,{className:`font-medium`,children:o(bl.ACCOUNT_LABEL)})}),(0,$.jsxs)(`dd`,{className:`space-y-item-xs`,children:[A!==void 0&&(0,$.jsx)(Z,{children:A}),(0,$.jsx)(Z,{className:`font-mono text-sm`,children:j})]})]}),(0,$.jsx)(jD,{variant:`warning`,children:(0,$.jsx)(ND,{children:o(bl.WARNING_NOT_YOURS)})}),(0,$.jsx)(Z,{className:`text-sm`,children:o(bl.EXPIRES_AT,{expiresAt:a(g.expiresAt)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[O(bl.CANCEL,`flex-1`),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,onClick:T,children:o(bl.CONFIRM)})]})]})};function VZ({preset:e=q.DEFAULT,...t}){let n=G(RZ,`Auth_ChatIdentityLink`)(e);return(0,$.jsx)(n,{...t})}var rbe=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(VZ,{})})),HZ=e=>{let{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT}),r=oh(),i=e=>t(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,e);return n?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(CY,{children:i($c.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:i($c.SUB_TITLE)})]}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`w-full`,onClick:()=>r(Ln.login),children:i($c.RETURN_TO_SIGN_IN)})]}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(ib,{})})};function UZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,`Auth_OAuthLoggedOut`)(e);return(0,$.jsx)(n,{...t})}var ibe=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(UZ,{})}),WZ;(function(e){e.READY=`ready`,e.SUBMITTING=`submitting`,e.ERROR=`error`})(WZ||={});var GZ=e=>{let{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM}),[r]=ch(),[i,a]=(0,Q.useState)(WZ.READY),o=e=>t(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,e),s=(0,Q.useMemo)(()=>r.get(`token`)??``,[r]),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)(async()=>{if(s&&!c.current){c.current=!0,a(WZ.SUBMITTING);try{let{redirect_to:e}=await bc().oauthEndSessionConfirm(s);window.location.assign(e)}catch{c.current=!1,a(WZ.ERROR)}}},[s]),u=(0,Q.useCallback)(()=>{window.location.assign(Ln.home)},[]);return n?s?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(CY,{children:o(Pl.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:o(Pl.SUB_TITLE)})]}),i===WZ.ERROR&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(Pl.ERROR)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,className:`flex-1`,disabled:i===WZ.SUBMITTING,onClick:u,children:o(Pl.CANCEL)}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,disabled:i===WZ.SUBMITTING,onClick:l,children:o(Pl.CONFIRM)})]})]}):(0,$.jsx)(Xh,{to:Ln.oauthLoggedOut,replace:!0}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(ib,{})})};function KZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,`Auth_OAuthLogoutConfirm`)(e);return(0,$.jsx)(n,{...t})}var abe=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(KZ,{})})),qZ=(e,t)=>e.kind===wo.RELEASED?`${String(t)}:${e.release.identity.releaseId}@${String(e.release.identity.releaseVersion)}:${e.content.title}`:`${String(t)}:${e.content.title}`,obe=({document:e,t,paneKey:n,onReachedEnd:r})=>{let i=(0,Q.useRef)(null),a=(0,Q.useCallback)(()=>{let e=i.current;e&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&r(n)},[r,n]);return(0,Q.useEffect)(a,[a,e]),(0,$.jsxs)(`div`,{ref:i,onScroll:a,tabIndex:0,lang:e.content.locale,role:`region`,"aria-label":e.content.title,className:U(`max-h-64 overflow-y-auto rounded-md border border-border bg-muted/30 p-element text-sm`,Rg(d_.FIELD)),children:[(0,$.jsx)(`h2`,{className:`font-medium`,children:e.content.title}),e.kind===wo.UNRELEASED_DRAFT&&(0,$.jsx)(Z,{role:`note`,className:`mt-element-sm text-xs font-medium`,children:t(Qa.TERMS_DRAFT_NOTICE)}),e.content.sections.map(e=>(0,$.jsxs)(`div`,{className:`mt-element flex flex-col gap-element-sm`,children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:e.title}),e.clauses.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[(0,$.jsx)(Z,{className:`whitespace-pre-line text-muted-foreground`,children:e.bodyMarkdown}),e.standing===Zie.NOT_YET_ESTABLISHED&&(0,$.jsx)(Z,{role:`note`,className:`text-xs`,children:`${t(Qa.TERMS_CLAUSE_NOT_ESTABLISHED)} ${e.missingInformation??``}`.trim()})]},e.clauseRef))]},e.sectionRef))]})},JZ=({state:e,t,tComponent:n})=>{let{requiredReleases:r,acceptanceMode:i,requiredDocuments:a,servedDocuments:o,accepted:s,setAccepted:c,documentsRead:l,markDocumentRead:u}=e,d=a.map(e=>e.document).filter(e=>e!==void 0),f=a.map(e=>({release:e.release,routePath:Cd(e.release.identity.document.documentRef),path:Ye(e.release),title:e.document?.content.title??Cd(e.release.identity.document.documentRef)??``,locale:e.document?.content.locale??e.release.locale})).filter(e=>e.path!==void 0&&e.routePath!==void 0),p=new Set(f.map(e=>e.routePath)),m=o.map(e=>({document:e,path:Cd(e.kind===wo.RELEASED?e.release.identity.document.documentRef:e.documentRef)})).filter(e=>e.path!==void 0&&!p.has(e.path)),h=d.length>0&&d.every((e,t)=>l.includes(qZ(e,t)));if(r.length===0)return null;let g=f.length>0&&(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-element-sm`,children:[m.map(({document:e,path:t})=>(0,$.jsx)(_X,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:e.content.locale,children:n(B.PUBLIC_LAYOUTS_USER_REGISTER,Qa.TERMS_OPEN_DOCUMENT,{documentTitle:e.content.title})},t)),f.map(({release:e,path:t,title:r,locale:i})=>(0,$.jsx)(_X,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:i,children:n(B.PUBLIC_LAYOUTS_USER_REGISTER,Qa.TERMS_OPEN_DOCUMENT,{documentTitle:r})},e.identity.releaseId))]});if(!Cc(i))return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[(0,$.jsx)(Z,{role:`note`,className:`text-sm text-muted-foreground`,children:t(Qa.TERMS_ACCEPTANCE_IMPLIED)}),g]});let _=a.every(e=>e.document!==void 0)&&a.length>0,v=x(i)&&_,y=v&&!h,b=(0,Q.useId)();return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{id:b,className:`text-sm text-muted-foreground`,children:t(Qa.TERMS_READ_PROMPT)}),d.map((e,n)=>(0,$.jsx)(obe,{document:e,t,paneKey:qZ(e,n),onReachedEnd:u},qZ(e,n)))]}),(0,$.jsxs)(`label`,{className:U(`flex items-start gap-element`,y?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(TI,{checked:s,"aria-disabled":y||void 0,"aria-describedby":v?b:void 0,onCheckedChange:e=>{y||c(e===!0)}}),(0,$.jsx)(Z,{className:`text-sm`,children:t(Qa.TERMS_ACCEPTANCE)})]}),(0,$.jsx)(Z,{"aria-live":`polite`,className:`sr-only`,children:v&&h?t(Qa.TERMS_READ_COMPLETE):``}),g]})},sbe=60,cbe=[_s.PASSWORD,_s.MAGIC_LINK,_s.PASSKEY],YZ=Q.createContext({requiredReleases:[],acceptanceMode:fo.EXPLICIT_CHECKBOX,requiredDocuments:[],servedDocuments:[],accepted:!1,setAccepted:()=>{},documentsRead:[],markDocumentRead:()=>{},method:_s.PASSWORD}),XZ=({t:e,tComponent:t})=>{let{method:n,...r}=Q.useContext(YZ);return(0,$.jsx)(JZ,{state:r,t:e,tComponent:t})},lbe=()=>{let e=$x(),{formState:t}=GC(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_USER_REGISTER}),i=e=>n(B.PUBLIC_LAYOUTS_USER_REGISTER,e),a=e.passwordPolicy??_Z,{requiredReleases:o,acceptanceMode:s,accepted:c,method:l}=Q.useContext(YZ),u=l===_s.PASSWORD;if(!r)return null;let d=u?Qa.REGISTER_BUTTON:l===_s.PASSKEY?Qa.PASSKEY_SIGNUP_BUTTON:Qa.MAGIC_LINK_SIGNUP_BUTTON,f=u?Qa.REGISTERING:Qa.MAGIC_LINK_SIGNUP_SENDING;return(0,$.jsxs)(nA,{children:[(0,$.jsx)(XL,{name:`email`}),(0,$.jsx)(XL,{name:`firstName`}),(0,$.jsx)(XL,{name:`lastName`}),(0,$.jsx)(XL,{name:`organizationName`}),(e.registrationConfig.additionalProfileQuestions??[]).map(e=>(0,$.jsx)(XL,{name:e.id},e.id)),(0,$.jsx)(XL,{name:`password`}),(0,$.jsx)(XL,{name:`confirmPassword`}),u&&(0,$.jsx)(vZ,{fieldName:`password`,policy:a,t:i}),t.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:t.errors.root.message})}),(0,$.jsx)(XZ,{t:i,tComponent:n}),(0,$.jsx)(rO,{label:i(d),submittingLabel:i(f),fullWidth:!0,disabled:o.length>0&&Cc(s)&&!c})]})},ZZ=({})=>{let{auth:e,initiateOAuth2Login:t}=pg(),{registerAccount:n}=hm(),r=cp(),{appConfig:i}=Ou(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)([]),l=(0,Q.useCallback)(e=>{c(t=>t.includes(e)?t:[...t,e])},[]),[u,f]=(0,Q.useState)(null),p=i.compliance?.governedDocumentAcceptanceMode??fo.EXPLICIT_CHECKBOX,m=ts(i.compliance),h=(0,Q.useMemo)(()=>(u===null?Kne(i.compliance?.governedDocumentReleases??[],new Date().toISOString(),{requireApproved:m}):(i.compliance?.governedDocumentReleases??[]).filter(e=>u.some(t=>t.releaseId===e.identity.releaseId&&t.releaseVersion===e.identity.releaseVersion))).filter(e=>e.allowedInteractionKinds.includes(Cs.CONTRACT_ACCEPTED)),[i.compliance?.governedDocumentReleases,m,u]),g=(0,Q.useMemo)(()=>h.map(e=>({release:e,document:cu(i.compliance?.publicDocuments??[],e,{requireApproved:m})})),[h,i.compliance?.publicDocuments,m]),_=(0,Q.useMemo)(()=>i.compliance?.publicDocuments??[],[i.compliance?.publicDocuments]),v=(0,Q.useMemo)(()=>({requiredReleases:h,acceptanceMode:p,requiredDocuments:g,servedDocuments:_,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:_s.EXTERNAL_OAUTH2}),[h,p,g,_,a,s,l]),y=h.length>0&&Cc(p)&&!a,b=(0,Q.useMemo)(()=>h.length===0||Cc(p)&&!a?[]:h.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})),[h,p,a]),x=(0,Q.useCallback)(e=>{if(!jr(e)||e.customMessageReference!==Xl.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)return!1;let t=e.context?.inForceReleases,n=Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.releaseId==`string`&&typeof e.releaseVersion==`number`):[],r=i.compliance?.governedDocumentReleases??[];return n.every(e=>r.some(t=>t.identity.releaseId===e.releaseId&&t.identity.releaseVersion===e.releaseVersion))?(f(n),o(!1),c([]),!0):(window.location.reload(),!0)},[i.compliance?.governedDocumentReleases]),S=$x(),C=mg(),w=(0,Q.useMemo)(()=>S.registrationConfig.allowedMethods.includes(_s.EXTERNAL_OAUTH2)?MX({publicProviders:S.globalAuth?.socialOAuth2Providers}):[],[S.globalAuth?.socialOAuth2Providers,S.registrationConfig.allowedMethods]),T=(0,Q.useMemo)(()=>pb(w.map(e=>e.displayNameLabelKey)),[w]),E=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_USER_REGISTER,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{t:D,tComponent:O,isReady:k}=K({component:E,keys:T}),A=e=>O(B.PUBLIC_LAYOUTS_USER_REGISTER,e),j=e=>O(B.PUBLIC_LAYOUTS_USER_AUTH,e),M=(0,Q.useMemo)(()=>L(C.search),[C.search]),N=(0,Q.useMemo)(()=>new URLSearchParams(C.search).get(`email`)?.trim()??``,[C.search]),P=(0,Q.useMemo)(()=>fi(Ln.login,M),[M]),F=(0,Q.useMemo)(()=>Xt(C.search),[C.search]),I=w.length>0,ee=(0,Q.useCallback)(async e=>{try{await t(e,M,b)}catch(e){x(e)}},[b,M,t,x]),R=(0,Q.useRef)(null),{initAutoClearing:z,injectServerErrors:te,clearServerErrors:ne}=ZR(R),re=(0,Q.useCallback)(e=>{R.current=e,z(e)},[z]),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(``);SX({mfaRequired:oe===Np.MFA_ENROLLMENT_REQUIRED&&e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:ce,authRedirectTarget:M});let[ue,de]=(0,Q.useState)(`idle`),[fe,pe]=(0,Q.useState)(0),[me,he]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(fe<=0)return;let e=setInterval(()=>{pe(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[fe]);let ge=(0,Q.useCallback)(async()=>{if(!(!ce||fe>0)){de(`sending`),he(null);try{await bc().resendVerificationEmail(ce),de(`sent`),pe(sbe)}catch(e){de(`error`),he(r(e,A(Qa.UNEXPECTED_ERROR)))}}},[ce,fe]),_e=(0,Q.useMemo)(()=>S.passwordPolicy??_Z,[S.passwordPolicy]),ve=(0,Q.useMemo)(()=>{if(!S.resolvedUserType)return!1;let e=$ie(i.organizationTypes,S.resolvedUserType);return e.length===1&&e[0]?.definition.creationPolicy?.orgNameSource===Kre.ASK},[i.organizationTypes,S.resolvedUserType]),ye=(0,Q.useMemo)(()=>S.registrationConfig,[S.registrationConfig]).allowedMethods,be=(0,Q.useMemo)(()=>cbe.filter(e=>ye.includes(e)),[ye]),[xe,Se]=(0,Q.useState)(null),Ce=xe!==null&&be.includes(xe)?xe:be[0]??null,we=be.filter(e=>e!==Ce),Te=Ce!==null,Ee=Te&&Ce!==null,De=Ce===_s.PASSWORD,Oe=I&&Te,ke=S.registrationConfig.additionalProfileQuestions??[],Ae=S.registrationConfig.profileNamesCollectedAt!==Gc.ONBOARDING,je=(0,Q.useMemo)(()=>{let e={};for(let t of ke){let n=t.type===Tc.RATING?Ed():bd().min(1);e[t.id]=t.required?n:n.optional()}let t=d.extend(e),n=Ae?t:t.omit({firstName:!0,lastName:!0}),r=ve?n:n.omit({organizationName:!0});return De?r.refine(e=>!e.password||e.password===e.confirmPassword,{message:A(Qa.PASSWORD_MISMATCH),path:[`confirmPassword`]}):r.omit({password:!0,confirmPassword:!0})},[A,ve,De,ke,Ae]),Me=Rp(e,M);if(Me)return(0,$.jsx)(Xh,{to:Me,replace:!0});if(!k)return null;if(oe===Np.SIGNED_IN)return e.accessToken?(0,$.jsx)(Xh,{to:F,replace:!0}):null;if(oe===Np.MFA_ENROLLMENT_REQUIRED)return null;if(oe!==null){let e=oe===Np.SSO_REDIRECT_REQUIRED,t=e?Qa.SSO_REGISTRATION_TITLE:Qa.SUCCESS_TITLE,n=e?Qa.SSO_REGISTRATION_MESSAGE:oe===Np.UNFINISHED?Qa.REGISTRATION_UNFINISHED:oe===Np.MAGIC_LINK_SENT?Qa.MAGIC_LINK_SENT_MESSAGE:oe===Np.PASSKEY_ENROLLMENT_PENDING?Qa.PASSKEY_ENROLLMENT_PENDING_MESSAGE:Qa.SUCCESS_MESSAGE,r=oe===Np.EMAIL_VERIFICATION_PENDING;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-primary`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}),(0,$.jsx)(CY,{children:A(t)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(n)})]}),r&&(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsxs)(Z,{className:`text-sm text-muted-foreground`,children:[A(Qa.RESEND_PROMPT),` `,(0,$.jsx)(X,{variant:J.LINK,className:`p-0 h-auto text-sm`,onClick:ge,disabled:ue===`sending`||fe>0,children:ue===`sending`?A(Qa.RESEND_SENDING):fe>0?`${A(Qa.RESEND_COOLDOWN)} (${fe}s)`:A(Qa.RESEND_LINK)})]}),ue===`sent`&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:A(Qa.RESEND_SUCCESS)})}),ue===`error`&&me&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:me})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:P,children:A(Qa.SIGNIN_LINK)})})]})}let Ne=async e=>{ae(!0),R.current?.clearErrors(`root`),ne();let t=Ce??_s.PASSWORD;if(t===_s.PASSWORD&&e.password){let t=st.validatePasswordAgainstPolicy(e.password,_e);if(!t.valid){R.current?.setError(`root`,{type:`policy`,message:bZ(t.violations,A,_e).join(`. `)}),ae(!1);return}}try{let r=await n({email:e.email,...Ae?{firstName:e.firstName,lastName:e.lastName}:{},password:t===_s.PASSWORD&&e.password?.trim()||void 0,organizationName:e.organizationName?.trim()||void 0,profileAnswers:ke.length>0?Object.fromEntries(ke.map(t=>[t.id,e[t.id]]).filter(([,e])=>e!==void 0&&e!==``)):void 0,method:t,...M?{redirect:M}:{},...b.length>0?{acceptedGovernedDocumentReleases:b}:{}});le(e.email),se(r)}catch(e){x(e);let t=jM(e);if(t)te(t.validationErrors);else{let t=xZ(e,A,_e);R.current?.setError(`root`,{type:`server`,message:t??r(e,A(Qa.UNEXPECTED_ERROR))})}}finally{ae(!1)}};return!I&&!Te?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:A(Qa.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(Qa.REGISTRATION_DISABLED)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:P,children:A(Qa.SIGNIN_LINK)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:A(Qa.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(Qa.SUB_TITLE)})]}),w.length>0&&h.length>0&&!Ee&&(0,$.jsx)(YZ.Provider,{value:v,children:(0,$.jsx)(XZ,{t:A,tComponent:O})}),(0,$.jsx)(FX,{providers:w,onProviderClick:ee,isLoading:ie||e.isLoading,disabled:y,continueWithLabel:A(Qa.CONTINUE_WITH),translate:D,dividerLabel:A(Qa.DIVIDER_OR),showDivider:Oe}),Te&&Ce!==null&&(0,$.jsx)(YZ.Provider,{value:{requiredReleases:h,acceptanceMode:p,requiredDocuments:g,servedDocuments:_,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:Ce},children:(0,$.jsx)(iE,{schema:je,defaultValues:{email:N,...Ae&&{firstName:``,lastName:``},...ve&&{organizationName:``},...De&&{password:``,confirmPassword:``}},onSubmit:Ne,onFormReady:re,validationMode:ta.ON_BLUR,disabled:ie,layoutTemplate:lbe,labels:{fields:{email:A(Qa.EMAIL_ADDRESS),...Ae&&{firstName:A(Qa.FIRST_NAME),lastName:A(Qa.LAST_NAME)},...ve&&{organizationName:A(Qa.ORGANIZATION_NAME)},...De&&{password:A(Qa.PASSWORD),confirmPassword:A(Qa.CONFIRM_PASSWORD)}}}},Ce)}),we.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:j(ss.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:A(Qa.METHOD_CHOICE_HINT)}),(0,$.jsx)(BX,{methods:we,labelFor:e=>EX(e,{socialProviders:w,continueWithTemplate:j(ss.CONTINUE_WITH),translateLabel:e=>j(e),resolveSocialProviderLabel:e=>jX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:NX[e.providerRef]?.label,translate:D})}),onSelect:Se,disabled:ie})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsxs)(Z,{className:`text-sm`,children:[A(Qa.ALREADY_HAVE_ACCOUNT),` `,(0,$.jsx)(_X,{href:P,children:A(Qa.SIGNIN_LINK)})]})})]})};function ube({mode:e}){let t=mg(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_USER_REGISTER}),i=(0,Q.useMemo)(()=>L(t.search),[t.search]),a=(0,Q.useMemo)(()=>fi(Ln.login,i),[i]);if(!r)return null;let o=e===no.INVITATION_ONLY?Qa.INVITATION_ONLY:e===no.ADMIN_ONLY?Qa.ADMIN_ONLY:Qa.REGISTRATION_DISABLED,s=e=>n(B.PUBLIC_LAYOUTS_USER_REGISTER,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(CY,{children:s(Qa.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(o)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:a,children:s(Qa.SIGNIN_LINK)})})]})}function QZ({preset:e=q.DEFAULT,...t}){let{auth:n}=pg(),r=$x(),i=mg(),a=(0,Q.useMemo)(()=>Xt(i.search),[i.search]);if(n.accessToken)return(0,$.jsx)(Xh,{to:a,replace:!0});if(!r.registrationConfig.publicRegistrationAvailable)return(0,$.jsx)(ube,{mode:r.registrationConfig.mode});let o=G(B.PUBLIC_LAYOUTS_USER_REGISTER,`Auth_Register`)(e);return(0,$.jsx)(o,{...t})}var dbe=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(QZ,{})});function $Z({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_TERMS,`PublicLayout_Terms`)(e);return(0,$.jsx)(n,{...t})}function eQ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_LEGAL_NOTICE,`PublicLayout_LegalNotice`)(e);return(0,$.jsx)(n,{...t})}function fbe(){let{on:e}=Mo(),{navigate:t}=DS(),{registry:n}=fm(),r=oh();return(0,Q.useEffect)(()=>e(Ec.NAVIGATION_REQUEST,e=>{let i;e.operationRef?i=dh.resolveOperationRef(e.operationRef,e.operationRefContextIdentifiers,n):e.content&&(i=e.content),i?t({content:i,initiator:e.initiator,urlPath:e.urlPath,replaceBrowserHistory:e.replaceBrowserHistory}):!e.operationRef&&e.urlPath&&r(e.urlPath,e.replaceBrowserHistory?{replace:!0}:void 0)}),[t,e,n,r]),null}function tQ(e){let t=(0,Q.useSyncExternalStore)(dh.subscribeToTransactionState,dh.getTransactionEpoch,dh.getTransactionEpoch),n=(0,Q.useCallback)(()=>void 0,[]);return{retryTick:t,scheduleRetry:n,clearRetry:n}}function nQ(){let e=mg(),t=(0,Q.useContext)(wh)?.router,n=(0,Q.useCallback)(e=>t?t.subscribe(()=>e()):()=>void 0,[t]),r=(0,Q.useCallback)(()=>t?.state.location??e,[t,e]);return(0,Q.useSyncExternalStore)(n,r,r)}function rQ(e){let t=nQ();return t.pathname!==e.pathname||t.search!==e.search}function pbe(e,t,n){let r=mg(),i=rQ(r),a=Rm(),{registry:o}=fm(),{emit:s}=Mo(),{getZoneState:c,contentAreaWidth:l}=zx(),u=Zp(),d=pS(),{navigationLayout:f,currentBreakpoint:p}=Wg(),m=(0,Q.useMemo)(()=>dh.buildBrowserUrl(r.pathname,r.search),[r.pathname,r.search]),h=(0,Q.useMemo)(()=>u?.buildContextResourceIdentifiers?.()??{},[u]),g=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),_=(0,Q.useRef)(null),{retryTick:v,scheduleRetry:y,clearRetry:b}=tQ(m),x=(0,Q.useMemo)(()=>{if(!e||!t)return[];let n=o.resourceConfigurations?.[e];return n?Vn.buildOperationFrontendRoutePaths(n,t,o.allResourceFieldIdentifiers).map(e=>e.url):[]},[e,t,o]);(0,Q.useEffect)(()=>{if(!e||!t)return;if(Gx(`useRouterSync: effect fired`,{resourceType:e,operationId:t.operationIdentifier,locationPathname:r.pathname,lastSyncedPath:_.current,routePatternsCount:x.length}),dh.isInTransaction()){Gx(`useRouterSync: SKIP — navigation transaction active`,{source:dh.getTransactionSource()}),y();return}if(b(),i){Gx(`useRouterSync: SKIP — the router is ahead of the committed location`,{committedUrl:m});return}if(_.current===m){Gx(`useRouterSync: SKIP — already synced this path`,{currentBrowserUrl:m});return}if(x.length>0&&!x.some(e=>dh.matchUrlPattern(e,r.pathname))){Gx(`useRouterSync: SKIP — URL does not match any resource route pattern`,{pathname:r.pathname,patterns:x}),_.current=m;return}let g=o.resourceConfigurations?.[e]?.resourcePrimaryScope,v=n?On.buildParentResourcesRequirementsFromRouteParams(n,e,o):[],S=f?.zones,C=!!S?.secondary,w=!!S?.companion,T=dh.calculateResourceRelationshipDepth(v),E=T===0&&C&&t!==void 0&&dh.layoutSplitsOperationFromPrimary(f,t,p),D=dh.resolveResourceTargetZone(T,{hasSecondary:C,hasCompanion:w,prefersAdjacentZoneForDetail:E}),O=Wh({zone:D,layout:f,viewport:p,contentAreaWidth:l})?D:Cl.PRIMARY;O!==D&&Gx(`useRouterSync: adjacent zone is collapsed at this viewport — restoring into PRIMARY`,{preferredZone:D,viewport:p,contentAreaWidth:l});let k=dh.zoneOwnsBrowserUrl(O,m,c);if(Gx(`useRouterSync: checking guards`,{currentBrowserUrl:m,targetZone:O,targetZoneOwnsUrl:k,targetZoneTopUrlPath:dh.getTopEntry(c(O))?.urlPath}),k){Gx(`useRouterSync: SKIP — target zone already owns current URL`,{targetZone:O}),_.current=m;return}let A=dh.findStructuralRouteOwner(m,c);if(A&&A.zone!==O){Gx(`useRouterSync: SKIP — another structural zone already shows this destination`,{owningZone:A.zone,targetZone:O,currentBrowserUrl:m}),_.current=m;return}let j=On.extractResourceIdentifiersFromUrlParams(a,o,n),M=tm.buildResourceOperationContextIdentifiers({currentUserId:u?.currentUserId,currentOrganizationId:u?.currentOrganizationId,currentApplicationId:u?.currentApplicationId,currentAnonymousUserId:u?.currentAnonymousUserId,primaryScope:g,liveAppScopeContextResourceIdentifiers:h,explicitContextResourceIdentifiers:j}),N=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:M,parentResourcesRequirements:v}),P={contentType:sd.RESOURCE_OPERATION,resourceContext:N},F=dh.generateStackEntryId();Gx(`useRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{resourceType:e,operationId:t.operationIdentifier,currentBrowserUrl:m,mergedContextIdentifiers:M,depth:T,targetZone:O}),T>=1&&dh.beginTransaction(`url_reverse_cascade`);let I=O!==D,ee=ble({content:P,paneZone:D,placedZone:O,layout:f,registry:o,viewport:p,contentAreaWidth:l});if(I&&E&&D===Cl.SECONDARY&&Xx({resourceType:e,contextResourceIdentifiers:M,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),s(I?Ec.NAVIGATION_PUSH:Ec.NAVIGATION_REPLACE,{zone:O,content:P,urlPath:m,stackEntryId:F,initiator:{sourceZone:O},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE,...I?{collapsedFromZone:D}:{},...ee?{persistent:!0}:{}}),E&&O===Cl.SECONDARY&&Xx({resourceType:e,contextResourceIdentifiers:M,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),T>=1){let e=Hu(M);Qx(P,O,o,e,s,null,c,{overwriteExisting:!0,viewerMayPerform:d})}_.current=m},[r.pathname,r.search,i,a,e,t,o,s,c,u?.currentUserId,u?.currentOrganizationId,u?.currentApplicationId,u?.currentAnonymousUserId,g,n,x,f,p,m,v,y,b])}function iQ(e,t){let n=mg(),r=rQ(n),{emit:i}=Mo(),{getZoneState:a}=zx(),{registry:o}=fm(),{fullCustomViews:s,flowsActorsViews:c}=Wg(),l=(0,Q.useRef)(null),u=dh.buildBrowserUrl(n.pathname,n.search),{retryTick:d,scheduleRetry:f,clearRetry:p}=tQ(u);(0,Q.useEffect)(()=>{if(!e)return;if(dh.isInTransaction()){f();return}if(p(),r||l.current===u)return;if(dh.zoneOwnsBrowserUrl(Cl.PRIMARY,u,a)){l.current=u;return}let d,m=t===sd.COMPOSITE_VIEW?Pp(new URLSearchParams(n.search)):void 0,h=t===sd.CHART_VIEW?Gp(new URLSearchParams(n.search)):void 0,g=t===sd.CHART_VIEW?Up(new URLSearchParams(n.search)):void 0,_=t===sd.EXECUTION_VIEW?lm(new URLSearchParams(n.search)):void 0,v=t===sd.FULL_CUSTOM_VIEW?s?.find(t=>t.ref===e):void 0,y=t===sd.FLOWS_ACTORS_VIEW?c?.find(t=>t.ref===e):void 0,b=t===sd.EXECUTION_VIEW?Dp({viewRef:e,registry:o}):void 0;switch(t){case sd.COMPOSITE_VIEW:d={contentType:sd.COMPOSITE_VIEW,viewRef:e,contextResourceIdentifiers:m};break;case sd.CHART_VIEW:d={contentType:sd.CHART_VIEW,viewRef:e,contextResourceIdentifiers:h,urlParamValues:g};break;case sd.FULL_CUSTOM_VIEW:if(!v)return;d={contentType:sd.FULL_CUSTOM_VIEW,viewRef:e,fullCustomComponentRef:v.componentRef};break;case sd.FLOWS_ACTORS_VIEW:if(!y)return;d={contentType:sd.FLOWS_ACTORS_VIEW,viewRef:e,flowsActorsSystemRef:y.systemRef};break;case sd.EXECUTION_VIEW:if(!b||b.isAddressable!==!0)return;d={contentType:sd.EXECUTION_VIEW,viewRef:e,contextResourceIdentifiers:_};break;default:return}let x=dh.generateStackEntryId();Gx(`useViewRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{viewRef:e,contentType:t,locationPathname:n.pathname,locationSearch:n.search}),i(Ec.NAVIGATION_REPLACE,{zone:Cl.PRIMARY,content:d,urlPath:dh.decomposeHostedPaneBrowserUrl(u).hostUrl,stackEntryId:x,initiator:{sourceZone:Cl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),l.current=u},[e,t,i,a,s,c,o,u,r,d,f,p])}function mbe(e){let t=mg(),n=rQ(t),{emit:r}=Mo(),{getZoneState:i}=zx(),a=(0,Q.useRef)(null),o=dh.buildBrowserUrl(t.pathname,t.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=tQ(o);(0,Q.useEffect)(()=>{if(!e)return;if(dh.isInTransaction()){c();return}if(l(),n||a.current===o)return;if(dh.zoneOwnsBrowserUrl(Cl.PRIMARY,o,i)){a.current=o;return}let t=dh.generateStackEntryId();r(Ec.NAVIGATION_REPLACE,{zone:Cl.PRIMARY,content:{contentType:sd.ENGINE_PAGE,pageRef:e},urlPath:dh.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:t,initiator:{sourceZone:Cl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),a.current=o},[e,r,i,o,n,s,c,l])}function hbe(){let e=nQ(),{emit:t}=Mo(),{getZoneState:n}=zx(),r=(0,Q.useRef)(null),i=dh.buildBrowserUrl(e.pathname,e.search),{retryTick:a,scheduleRetry:o,clearRetry:s}=tQ(i);(0,Q.useEffect)(()=>{if(dh.isInTransaction()){o();return}if(s(),r.current===i)return;if(aQ(e.pathname).isSettings){r.current=i;return}let a=dh.findStructuralStackEntryOwningUrl(i,n);if(a?.isTop){if(a.searchDiffers){let{hostUrl:e,paneUrl:r}=dh.decomposeHostedPaneBrowserUrl(i),o=r===void 0?[{zone:a.zone,entry:a.entry,urlPath:i}]:[{zone:Cl.PRIMARY,entry:dh.getTopEntry(n(Cl.PRIMARY)),urlPath:e},{zone:Cl.SECONDARY,entry:a.entry,urlPath:r}];for(let e of o)e.entry&&e.entry.urlPath!==e.urlPath&&(Gx(`useStructuralZoneBackForwardSync: refreshing entry urlPath for a view-state change`,{zone:e.zone,stackEntryId:e.entry.id,from:e.entry.urlPath,to:e.urlPath}),t(Ec.NAVIGATION_URL_PATH_UPDATED,{zone:e.zone,stackEntryId:e.entry.id,urlPath:e.urlPath}))}r.current=i}else if(a)Gx(`useStructuralZoneBackForwardSync: POP to backstack entry`,{zone:a.zone,toStackEntryId:a.entry.id,currentUrl:i}),t(Ec.NAVIGATION_POP,{zone:a.zone,toStackEntryId:a.entry.id}),r.current=i;else{if(pr.some(e=>n(e).stack.length>0)){Gx(`useStructuralZoneBackForwardSync: clearing structural zones for URL rebuild`,{currentUrl:i}),dh.beginTransaction(`backforward_url_rebuild`);for(let e of pr)t(Ec.NAVIGATION_CLEAR_ZONE,{zone:e})}r.current=i}},[i,e.pathname,t,n,a,o,s])}function gbe(){let e=nQ(),{emit:t}=Mo(),{getZoneState:n}=zx(),{registry:r}=fm(),i=Zp(),a=(0,Q.useRef)(null),o=dh.buildBrowserUrl(e.pathname,e.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=tQ(o),u=(0,Q.useMemo)(()=>i?.buildContextResourceIdentifiers?.()??{},[i]);(0,Q.useEffect)(()=>{if(dh.isInTransaction()){c();return}if(l(),a.current===o)return;if(aQ(e.pathname).isSettings){a.current=o;return}let{paneUrl:s}=dh.decomposeHostedPaneBrowserUrl(o),d=n(Cl.SECONDARY),f=dh.getTopEntry(d);if(s===void 0){f?.hostedPane&&(Gx(`useHostedPaneRouteSync: pane left the URL — clearing SECONDARY`,{currentUrl:o}),t(Ec.NAVIGATION_CLEAR_ZONE,{zone:Cl.SECONDARY})),a.current=o;return}if(f?.hostedPane&&dh.urlsAddressSameDestination(f.urlPath,s)){a.current=o;return}let p=dh.getTopEntry(n(Cl.PRIMARY));if(dh.isHeldHostedPane(p)&&dh.urlsAddressSameDestination(p?.urlPath,s)){a.current=o;return}let m=[...d.stack].reverse().find(e=>e.hostedPane&&dh.urlsAddressSameDestination(e.urlPath,s));if(m){Gx(`useHostedPaneRouteSync: POP to a buried pane`,{toStackEntryId:m.id,paneUrl:s}),t(Ec.NAVIGATION_POP,{zone:Cl.SECONDARY,toStackEntryId:m.id}),a.current=o;return}let h=dh.resolveResourceRouteForUrl(s,r);if(!h){Gx(`useHostedPaneRouteSync: pane URL matches no addressable resource route — ignored`,{paneUrl:s}),a.current=o;return}let g=On.buildParentResourcesRequirementsFromRouteParams(h.routePathParameters,h.resourceType,r),_=On.extractResourceIdentifiersFromUrlParams(h.urlParameters,r,h.routePathParameters),v=r.resourceConfigurations?.[h.resourceType]?.resourcePrimaryScope,y=tm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:i?.currentApplicationId,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:v,liveAppScopeContextResourceIdentifiers:u,explicitContextResourceIdentifiers:_}),b=On.createFrontendResourceOperationContextFromOperation({resourceType:h.resourceType,operation:h.operation,contextResourceIdentifiers:y,parentResourcesRequirements:g});Gx(`useHostedPaneRouteSync: EMITTING NAVIGATION_REPLACE (URL_SYNC) for the hosted pane`,{paneUrl:s,resourceType:h.resourceType,operationId:h.operation.operationIdentifier}),t(Ec.NAVIGATION_REPLACE,{zone:Cl.SECONDARY,content:{contentType:sd.RESOURCE_OPERATION,resourceContext:b},urlPath:s,stackEntryId:dh.generateStackEntryId(),initiator:{sourceZone:Cl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.SPLIT,hostedPane:!0}),a.current=o},[o,e.pathname,t,n,r,i?.currentUserId,i?.currentOrganizationId,i?.currentApplicationId,i?.currentAnonymousUserId,u,s,c,l])}function aQ(e){if(e===Ln.settings)return{isSettings:!0};let t=`${Ln.settings}/`;if(e.startsWith(t)){let[n,r]=e.slice(t.length).split(`/`);return{isSettings:!0,sectionRef:n&&n.length>0?n:void 0,subTabRef:r&&r.length>0?r:void 0}}return{isSettings:!1}}function _be(){let e=nQ(),{emit:t}=Mo(),{state:n}=zx(),{retryTick:r,scheduleRetry:i,clearRetry:a}=tQ(e.pathname),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(dh.isInTransaction()){i();return}a();let{isSettings:r,sectionRef:s,subTabRef:c}=aQ(e.pathname),l=n.overlay,u=l.length>0?l[l.length-1]:void 0,d=!1,f,p;if(u&&u.content.contentType===sd.SETTINGS_HUB&&(d=!0,f=u.content.sectionRef,p=u.content.subTabRef),r){if(d&&f===s&&p===c){o.current=null;return}let n=d?Ec.NAVIGATION_REPLACE:Ec.NAVIGATION_PUSH,r=`${n}|${e.pathname}|${s??``}|${c??``}|${l.length}`;if(o.current===r)return;o.current=r,t(n,{zone:rr.OVERLAY,content:{contentType:sd.SETTINGS_HUB,sectionRef:s,subTabRef:c},urlPath:dh.buildBrowserUrl(e.pathname,e.search),stackEntryId:dh.generateStackEntryId(),initiator:{sourceZone:rr.OVERLAY},navigationSource:Qi.URL_SYNC,transition:Rt.OVERLAY,appearance:Rn.DIALOG,ephemeral:!1})}else if(d){let e=`${Ec.NAVIGATION_CLOSE}|${l.length}`;if(o.current===e)return;o.current=e,t(Ec.NAVIGATION_CLOSE,{zone:rr.OVERLAY})}else o.current=null},[e.pathname,e.search,t,n.overlay,r,i,a])}var oQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=rr.PRIMARY})=>{let{fullCustomViews:i}=Wg(),a=Zp(),o=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,o,e]);let s=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=o?.primaryScope?tm.primaryScopeToContextIdentifiers(e,o.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=tm.filterCustomScopeContextResourceIdentifiers(r);return o?tm.resolveViewContextResourceIdentifiers({surfaceName:`FullCustomView`,surfaceRef:o.ref,primaryScope:o.primaryScope,parentResourcesRequirements:o.parentResourcesRequirements,additionalResourceRequirements:o.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n}):tm.mergeContextResourceIdentifiers(t,i,n)},[n,o?.primaryScope,o?.ref,o?.parentResourcesRequirements,o?.additionalResourceRequirements,a?.currentUserId,a?.currentOrganizationId,a?.currentApplicationId,a?.currentAnonymousUserId,a]);if(!o)return(0,$.jsx)(g_,{viewKind:`full-custom`,viewRef:e});let c=Fo.resolve(o.componentRef,q.DEFAULT);return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(QY,{viewRef:o.ref,contentType:sd.FULL_CUSTOM_VIEW,hasAuthoredIcon:!!o.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(c,{viewRef:o.ref,viewDefinition:o,contextResourceIdentifiers:s})})]}):(0,$.jsx)(al,{componentType:o.componentRef,componentName:o.componentRef})},sQ;(function(e){e.TURN=`turn`,e.TOOL=`tool`,e.REASONING=`reasoning`,e.HOST=`host`})(sQ||={});var cQ;(function(e){e.IDLE=`idle`,e.WORKING=`working`,e.ANSWERING=`answering`,e.AWAITING_DECISION=`awaiting_decision`,e.STOPPED=`stopped`,e.FAILED=`failed`,e.INTERRUPTED=`interrupted`})(cQ||={});function lQ(e,t){return[...e??[],t]}function vbe(e,t){if(!e||e.length===0)return[];let n=-1;return e.forEach((e,r)=>{t.has(e.id)&&(n=r)}),e.slice(n+1)}var uQ=new Set([ht.TEXT,ht.MARKDOWN]);function dQ(e){if(e==null)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t}function ybe(e){if(e.role===Gi.TOOL){let t=kc.safeParse(e.data);return t.success?{kind:sQ.TOOL,key:`tool:${t.data.toolCallId}`,trace:t.data,fromRecordOnly:!0}:null}if(e.role!==Gi.USER&&e.role!==Gi.ASSISTANT)return null;if(e.contentType===ht.REASONING)return{kind:sQ.REASONING,key:`reasoning:${e.id}`,content:e.content};if(e.contentType!==void 0&&!uQ.has(e.contentType))return null;let t=Xe.safeParse(e.data).data?.sources;return{kind:sQ.TURN,key:`message:${e.id}`,storedMessageId:e.id,role:e.role,content:e.content,markdown:e.role===Gi.ASSISTANT||e.contentType===ht.MARKDOWN,...t&&t.length>0?{sources:t}:{}}}var fQ;(function(e){e.NONE=`none`,e.REASONING=`reasoning`,e.TOOL=`tool`,e.REPLY=`reply`})(fQ||={});function bbe(e,t){let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>{let t=e.role===Gi.TOOL?kc.safeParse(e.data):null;return t?.success?[t.data.toolCallId]:[]})),i=e.status===hW.RUNNING||e.status===hW.STARTING,a=new Map,o=new Map,s=new Map,c=fQ.NONE;e.messages.forEach((t,r)=>{let i=t.messageId??`${e.executionId}:${r}`;if(t.type===ht.REASONING){let e=a.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,a.set(i,e),n.has(i)||(c=fQ.REASONING)}else if(t.type===ht.PROGRESS){let e=kc.safeParse(t.data);if(!e.success)return;s.set(e.data.toolCallId,{...s.get(e.data.toolCallId),...e.data}),c=fQ.TOOL}else if(uQ.has(t.type)){let e=o.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,e.sources.push(...Xe.safeParse(t.data).data?.sources??[]),o.set(i,e),n.has(i)||(c=fQ.REPLY)}});let l=e=>[...e.values()].filter(e=>e.content.length>0&&!n.has(e.id)),u=l(a),d=l(o),f=[];u.forEach((e,t)=>f.push({kind:sQ.REASONING,key:`live-reasoning:${e.id}`,content:e.content,streaming:i&&t===u.length-1&&c===fQ.REASONING}));let p=new Map;for(let e of s.values())r.has(e.toolCallId)?p.set(e.toolCallId,e):f.push({kind:sQ.TOOL,key:`tool:${e.toolCallId}`,trace:e});return d.forEach((e,t)=>f.push({kind:sQ.TURN,key:`live-reply:${e.id}`,role:Gi.ASSISTANT,content:e.content,markdown:!0,...i&&t===d.length-1&&c===fQ.REPLY?{streaming:!0}:{},...e.sources.length>0?{sources:e.sources}:{}})),{entries:f,calls:[...s.values()],recordedCallUpdates:p,activity:c}}function xbe(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if((n.role===Gi.USER||n.role===Gi.ASSISTANT)&&(n.contentType===void 0||uQ.has(n.contentType)))return n.role}}function pQ(e){let t=e.thread?.messages??[],n=[],r=new Map;for(let e of t){let t=ybe(e);if(t){if(t.kind===sQ.TOOL){let e=r.get(t.trace.toolCallId);if(e!==void 0){let r=n[e].entry;n[e].entry={...r,trace:{...r.trace,...t.trace}};continue}r.set(t.trace.toolCallId,n.length)}n.push({at:dQ(e.createdAt),entry:t})}}let i=e.live,a=i?bbe(i,t):void 0;for(let[e,t]of a?.recordedCallUpdates??[]){let i=r.get(e);if(i===void 0)continue;let{fromRecordOnly:a,...o}=n[i].entry;n[i].entry={...o,trace:{...o.trace,...t}}}for(let r of vbe(e.sent,new Set(t.map(e=>e.id))))n.push({at:r.sentAt.getTime(),entry:{kind:sQ.TURN,key:`sent-pending:${r.id}`,role:Gi.USER,content:r.text,markdown:!1,pending:!0}});let o=(e.hostEntries??[]).map((e,t)=>({at:dQ(e.at),index:t,entry:{kind:sQ.HOST,key:`host:${e.key}`,node:e.node}})).sort((e,t)=>e.at-t.at||e.index-t.index),s=[],c=0;for(let e of n){for(;c<o.length&&o[c].at<e.at;)s.push(o[c++].entry);s.push(e.entry)}for(;c<o.length;)s.push(o[c++].entry);if(!i||!a){let n=e.thread?.status,r=e.thread?.executionId;if(n===Yt.AWAITING_APPROVAL&&r&&e.thread?.pendingApproval!==void 0)return{entries:s,turnState:cQ.AWAITING_DECISION,activeExecutionId:r,stoppable:!1};let i=e.thread?.failureCode;return n===Yt.FAILED&&i!==void 0?{entries:s,turnState:cQ.FAILED,stoppable:!1,recoverable:!1,errorCode:i}:n===Yt.FAILED&&xbe(t)===Gi.USER?{entries:s,turnState:cQ.INTERRUPTED,stoppable:!1}:n===Yt.CANCELLED?{entries:s,turnState:cQ.STOPPED,stoppable:!1}:{entries:s,turnState:cQ.IDLE,stoppable:!1}}switch(s.push(...a.entries),i.status){case hW.STARTING:case hW.RUNNING:{if(a.activity===fQ.REPLY)return{entries:s,turnState:cQ.ANSWERING,activeExecutionId:i.executionId,stoppable:!0};let e=a.activity===fQ.TOOL?a.calls.at(-1):void 0;return{entries:s,turnState:cQ.WORKING,activeExecutionId:i.executionId,stoppable:!0,...e?.phase===Nee.CALL?{currentCall:e}:{}}}case hW.AWAITING_APPROVAL:return{entries:s,turnState:cQ.AWAITING_DECISION,activeExecutionId:i.executionId,stoppable:!1,...i.errorCode?{errorCode:i.errorCode}:{}};case hW.CANCELLED:return{entries:s,turnState:cQ.STOPPED,stoppable:!1};case hW.ERROR:return{entries:s,turnState:cQ.FAILED,stoppable:!1,recoverable:i.recoverable===!0,...i.errorCode?{errorCode:i.errorCode}:{}};case hW.IDLE:case hW.COMPLETED:return{entries:s,turnState:cQ.IDLE,stoppable:!1}}}function mQ(e){return new Date(e.createdAt).getTime()}function hQ(e){return[...e].sort((e,t)=>mQ(t)-mQ(e))}function gQ(e,t){if(!t.hasOlder)return{threads:hQ(t.executions),hasOlder:!1};let n=Math.min(...t.executions.map(mQ)),r=new Set(t.executions.map(e=>e.executionId)),i=e.threads.filter(e=>mQ(e)<n&&!r.has(e.executionId));return{threads:hQ([...t.executions,...i]),hasOlder:i.length>0?e.hasOlder:!0}}function _Q(e,t){let n=new Map(e.threads.map(e=>[e.executionId,e]));for(let e of t.executions)n.set(e.executionId,e);return{threads:hQ(n.values()),hasOlder:t.hasOlder}}function vQ(e){let t=e.threads.at(-1);return t?new Date(t.createdAt).toISOString():void 0}async function yQ(e){let t=await e();if(!t)return;let n=gQ({threads:[],hasOlder:!1},t);for(;n.hasOlder;){let t=vQ(n),r=await e(t?{before:t}:void 0);if(!r)return;let i=_Q(n,r);if(i.threads.length===n.threads.length)break;n=i}return n.threads}var bQ=Qs(B.LOW_LEVEL_AI_CONVERSATION_THREAD,`AI_ConversationThread`,[`Composer`,`Discussions`]);function xQ({preset:e=q.DEFAULT,...t}){let n=bQ(e);return(0,$.jsx)(n,{...t})}function SQ({preset:e=q.DEFAULT,...t}){let n=bQ(e);return(0,$.jsx)(n.Composer,{...t})}function CQ({preset:e=q.DEFAULT,...t}){let n=bQ(e);return(0,$.jsx)(n.Discussions,{...t})}var wQ=new Map;function TQ(e,t,n,r){return`${e??``}\u0000${t}\u0000${n}\u0000${r}`}function Sbe(e){return wQ.get(e)??null}function Cbe(e,t){t?wQ.set(e,t):wQ.delete(e)}var EQ=Qs(B.LOW_LEVEL_AI_MESSAGE,`AI_Message`,[`Content`,`Response`,`Actions`,`Action`,`Branch`,`BranchContent`,`BranchSelector`,`BranchPrevious`,`BranchNext`,`BranchPage`,`Attachment`,`Attachments`,`Toolbar`]);function DQ({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n,{...t})}function OQ({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Content,{...t})}function kQ({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Response,{...t})}function AQ({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Actions,{...t})}function jQ({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Action,{...t})}function wbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Branch,{...t})}function Tbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.BranchContent,{...t})}function Ebe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.BranchSelector,{...t})}function Dbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.BranchPrevious,{...t})}function Obe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.BranchNext,{...t})}function kbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.BranchPage,{...t})}function Abe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Attachment,{...t})}function jbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Attachments,{...t})}function Mbe({preset:e=q.DEFAULT,...t}){let n=EQ(e);return(0,$.jsx)(n.Toolbar,{...t})}var Nbe=Ta.createOperationPathKey({resourceIdentifier:ul.AGENT_BEHAVIOR_REPORTS,operationIdentifier:W.CREATE,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),MQ;(function(e){e.IDLE=`idle`,e.SENDING=`sending`,e.SENT=`sent`})(MQ||={});function Pbe({executionId:e,messageId:t,organizationId:n}){let{tComponent:r,tResourceFieldEnumValue:i}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,resource:ul.AGENT_BEHAVIOR_REPORTS}),a=(0,Q.useMemo)(()=>gm(r,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[r]),{doOperation:o}=fm(),s=cp(),{renderIcon:c}=Mf(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(void 0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(MQ.IDLE),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b=(0,Q.useMemo)(()=>Object.values(tee).map(e=>({value:e,label:i(ul.AGENT_BEHAVIOR_REPORTS,`category`,e,ie.shape.category)})),[i]),x=(0,Q.useCallback)(async()=>{if(d&&!y.current){y.current=!0,g(MQ.SENDING),v(null);try{let r=p.trim();await o(Nbe,{contextualParameters:{organizationId:n},requestData:{executionRef:{kind:pe.CONVERSATIONAL_EXECUTION,id:e},turnMessageId:t,category:d,...r?{comment:r}:{}}},{silent:!0}),g(MQ.SENT),u(!1)}catch(e){v(s(e)),g(MQ.IDLE)}finally{y.current=!1}}},[d,p,o,e,t,n,s]),S=`agent-reply-report-category-label-${t}`,C=`agent-reply-report-comment-${t}`,w=h===MQ.SENT,T=a(w?`replyReported`:`reportReply`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jQ,{tooltip:T,label:T,disabled:w,onClick:()=>{v(null),u(!0)},"data-agent-reply-report":h,children:c(H.WARNING,{size:ca.SM})}),(0,$.jsx)(ZW,{open:l,onOpenChange:e=>{h!==MQ.SENDING&&u(e)},children:(0,$.jsxs)($W,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(tG,{children:[(0,$.jsx)(rG,{children:a(`reportDialogTitle`)}),(0,$.jsx)(iG,{children:a(`reportDialogDescription`)})]}),(0,$.jsxs)(hx,{className:`gap-field py-field`,children:[(0,$.jsxs)(fx,{children:[(0,$.jsx)(mx,{id:S,children:a(`reportCategoryLabel`)}),(0,$.jsx)(xF,{"aria-labelledby":S,name:`agent-reply-report-category-${t}`,schema:ie.shape.category,options:b,value:d,onValueChange:e=>f(e),orientation:mu.VERTICAL,disabled:h===MQ.SENDING,required:!0})]}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{htmlFor:`field-${C}`,children:a(`reportCommentLabel`)}),(0,$.jsx)(AI,{name:C,schema:ie.shape.comment,value:p,onChange:e=>m((e??``).slice(0,yn)),placeholder:a(`reportCommentPlaceholder`),rows:3,disabled:h===MQ.SENDING})]}),_?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:_})}):null]}),(0,$.jsxs)(nG,{children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>u(!1),disabled:h===MQ.SENDING,children:a(`reportCancel`)}),(0,$.jsx)(X,{onClick:()=>{x()},disabled:!d||h===MQ.SENDING,children:a(`reportSend`)})]})]})})]})}function NQ(e,t=40){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t)}…`:n}function Fbe(e){return NQ(e.messages.find(e=>e.role===Gi.USER)?.content??``)}function PQ(){let{tComponent:e}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS});return(0,Q.useMemo)(()=>gm(e,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[e])}var Ibe=new Set([hW.COMPLETED,hW.CANCELLED,hW.ERROR,hW.AWAITING_APPROVAL]),FQ={threads:[],hasOlder:!1},Lbe=({system:e,contextResourceIdentifiers:t,preset:n,caseRef:r})=>{let i=PQ(),{startExecution:a,cancelExecution:o,executions:s,fetchConversationHistory:c,deleteConversation:l}=xW(),u=Zp(),d=u?.currentUserId??null,f=_c(t),p=(0,Q.useRef)(t);p.current=t;let[m,h]=(0,Q.useState)(FQ),g=m.threads,[_,v]=(0,Q.useState)(!1),y=r?`${r.resourceType}:${r.resourceId}`:``,b=TQ(d,e.ref,f,y),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(b);C.current=b;let w=(0,Q.useCallback)(e=>{S(t=>{let n=typeof e==`function`?e(t):e;return Cbe(C.current,n),n})},[]),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)({}),O=(0,Q.useRef)(0),k=(0,Q.useCallback)(async()=>{let t=++O.current,n=await c(e.ref,p.current);t===O.current&&n!==void 0&&h(e=>gQ(e,n))},[e.ref,c]),A=(0,Q.useRef)(0),j=(0,Q.useCallback)(async()=>{let t=vQ(m);if(!t||_)return;let n=A.current;v(!0);try{let r=await c(e.ref,p.current,{before:t});if(n!==A.current||r===void 0)return;h(e=>_Q(e,r))}finally{n===A.current&&v(!1)}},[m,_,e.ref,c]);(0,Q.useEffect)(()=>{let e=T.current;e&&m!==FQ&&(T.current=null,!m.threads.some(t=>t.executionId===e)&&!s.has(e)&&w(t=>t===e?null:t))},[m,s,w]),(0,Q.useEffect)(()=>{A.current+=1,h(FQ),v(!1);let t=Sbe(TQ(d,e.ref,f,y));T.current=t,S(t),D({}),k()},[k,d,f,e.ref,y]);let M=x?s.get(x):void 0;(0,Q.useEffect)(()=>{M&&Ibe.has(M.status)&&k()},[M?.status,k]);let N=x?g.find(e=>e.executionId===x):void 0,P=x?E[x]:void 0,F=(0,Q.useMemo)(()=>pQ({...N?{thread:N}:{},...M?{live:M}:{},...P?{sent:P}:{}}),[N,M,P]),I=(0,Q.useMemo)(()=>{let e=g.map(e=>({id:e.executionId,title:Fbe(e)}));return[...Object.entries(E).filter(([e,t])=>t.length>0&&!g.some(t=>t.executionId===e)).sort(([,e],[,t])=>t[0].sentAt.getTime()-e[0].sentAt.getTime()).map(([e,t])=>({id:e,title:NQ(t[0].text)})),...e]},[g,E]),ee=(0,Q.useCallback)(()=>w(null),[w]),L=(0,Q.useCallback)(e=>{w(e),k()},[k,w]),R=(0,Q.useCallback)(e=>{h(t=>({...t,threads:t.threads.filter(t=>t.executionId!==e)})),D(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),w(t=>t===e?null:t),l(e).catch(()=>{k()})},[l,k,w]),z=(0,Q.useCallback)(t=>{let n=crypto.randomUUID(),i=a(e.ref,{message:t},x??void 0,p.current,{messageId:n,...r?{caseRef:r}:{}});i&&(D(e=>({...e,[i]:lQ(e[i],{id:n,text:t,sentAt:new Date})})),w(i))},[a,e.ref,x,r,w]),te=F.turnState===cQ.WORKING||F.turnState===cQ.ANSWERING||F.turnState===cQ.AWAITING_DECISION,ne=F.stoppable?F.activeExecutionId:void 0,re=jte(t,u?.currentOrganizationId??void 0),ie=N?x:null,ae=(0,Q.useMemo)(()=>ie&&re?({messageId:e})=>(0,$.jsx)(Pbe,{executionId:ie,messageId:e,organizationId:re},e):void 0,[ie,re]);return(0,$.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-card @2xl:flex-row`,children:[(0,$.jsx)(CQ,{preset:n,discussions:I,currentId:x,onNew:ee,onSelect:L,onDelete:R,...m.hasOlder?{onLoadOlder:()=>{j()},loadingOlder:_}:{}}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-card-sm`,children:[(0,$.jsx)(xQ,{preset:n,model:F,...ae?{renderReplyActions:ae}:{},emptyState:{title:e.displayName,description:e.description||i(`emptyStateDescription`)}}),(0,$.jsx)(SQ,{preset:n,placeholder:i(`promptPlaceholder`,{assistant:e.displayName}),onSubmit:z,sendDisabled:te,...ne?{onStop:()=>o(ne)}:{}})]})]})})},Rbe=({system:e})=>{let t=PQ(),{executions:n}=xW(),r=(0,Q.useMemo)(()=>Array.from(n.values()).some(t=>t.systemRef===e.ref&&(t.status===hW.RUNNING||t.status===hW.STARTING)),[n,e.ref]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-element border-b border-border pb-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:U(`size-2 shrink-0 rounded-full`,r?`bg-warning`:`bg-success`)}),(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.displayName}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(r?`statusWorking`:`statusReady`)})]})},IQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,caseRef:r})=>{let{flowsActorsViews:i}=Wg(),a=Zp(),{systems:o,isLoading:s}=xW(),{isReady:c}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),l=PQ(),u=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,u,e]);let d=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=u?.primaryScope?tm.primaryScopeToContextIdentifiers(e,u.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=tm.filterCustomScopeContextResourceIdentifiers(r);return u?tm.resolveViewContextResourceIdentifiers({surfaceName:`FlowsActorsView`,surfaceRef:u.ref,primaryScope:u.primaryScope,parentResourcesRequirements:u.parentResourcesRequirements,additionalResourceRequirements:u.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n})??{}:tm.mergeContextResourceIdentifiers(t,i,n)??{}},[n,u,a]),f=(0,Q.useMemo)(()=>{if(u)return o.find(e=>e.ref===u.systemRef)},[u,o]);return u?c?(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Rbe,{system:f}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col pt-card-sm`,children:(0,$.jsx)(Lbe,{system:f,contextResourceIdentifiers:d,preset:u.layoutPreset,caseRef:r})})]}):(0,$.jsx)(`div`,{role:`status`,className:`p-section text-sm text-muted-foreground`,children:l(s?`loading`:`unavailable`)})}):null:(0,$.jsx)(g_,{viewKind:`flows-actors`})},zbe=Q.lazy(()=>h_(()=>import(`./ChartView-Qqvf_azZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function Bbe(e){let{insertedIdentity:t,contextResourceIdentifiers:n,urlParamValues:r,registry:i}=e;if(t.hostKind!==Bp.RESOURCE||t.viewKind!==bp.CHART_VIEW)return;let a=Mp({viewRef:t.insertedViewRef,registry:i})?.chartView;if(!a||!qp(a))return;let o=n??{};return{routeViewRef:t.insertedViewRef,viewDefinition:a,contextResourceIdentifiers:o,urlParamValues:r,runtimeDescriptor:gp({identity:t,chartView:a,contextResourceIdentifiers:o}),requiredFeatures:a.chartDefinition.requiredFeatures}}function Vbe(e){let{viewRef:t,registry:n,contextResourceIdentifiers:r,urlParamValues:i}=e;if(!t)return;let a=jp(t);if(a)return Bbe({insertedIdentity:a,contextResourceIdentifiers:r,urlParamValues:i,registry:n})}function Hbe(e){let t=mg(),n=rQ(t),{emit:r}=Mo(),{getZoneState:i}=zx(),a=Q.useRef(null),o=`${t.pathname}${t.search}`,{retryTick:s,scheduleRetry:c,clearRetry:l}=tQ(o);Q.useEffect(()=>{e&&(dh.isInTransaction()?c():(l(),n||a.current!==o&&(dh.zoneOwnsBrowserUrl(Cl.PRIMARY,o,i)||r(Ec.NAVIGATION_REPLACE,{zone:Cl.PRIMARY,content:{contentType:sd.CHART_VIEW,viewRef:e.routeViewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor,requiredFeatures:e.requiredFeatures},urlPath:dh.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:dh.generateStackEntryId(),initiator:{sourceZone:Cl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),a.current=o)))},[r,i,e,o,n,s,c,l])}var Ube=new Set(Object.values(W).map(e=>String(e).toLowerCase()));function Wbe(e,t){let n=[],r=[],i=[];for(let[t,a]of Object.entries(e))a&&a.startsWith(`:`)?n.push(`${t}=${a}`):!a||a.trim()===``?r.push(t):a===`undefined`||a===`null`||a===`[object Object]`?n.push(`${t}=${a}`):Ube.has(a.toLowerCase())&&i.push(`${t}=${a}`);return n.length>0?{isValid:!1,errorType:`unresolved`,invalidParams:n,message:`Unresolved route parameters for ${t}: ${n.join(`, `)}. The URL contains placeholder values instead of actual IDs.`}:i.length>0?{isValid:!1,errorType:`invalid`,invalidParams:i,message:`Route parameter for ${t} is an operation keyword, not a resource id: ${i.join(`, `)}. This URL does not address a resource.`}:r.length>0?{isValid:!1,errorType:`missing`,invalidParams:r,message:`Missing required parameters for ${t}: ${r.join(`, `)}`}:{isValid:!0}}var Gbe=as.getLogger(),Kbe=({resourceType:e,operation:t,PageComponent:n,routePathParameters:r})=>{let{registry:i}=fm(),a=Zp(),{navigationLayout:o,currentBreakpoint:s}=Wg(),{contentAreaWidth:c}=zx(),l=Rm(),u=Q.useMemo(()=>Wbe(l,e),[l,e]);pbe(u.isValid?e:void 0,u.isValid?t:void 0,r),Q.useEffect(()=>{!u.isValid&&u.message&&Gbe.warn(`[AppRouter] ${u.message}`,{resourceType:e,operation:String(t.operationIdentifier),invalidParams:u.invalidParams,errorType:u.errorType,url:window.location.href})},[u.isValid,u.message,u.errorType,u.invalidParams,e,t.operationIdentifier]);let d=Q.useMemo(()=>On.buildParentResourcesRequirementsFromRouteParams(r,e,i),[r,e,i]);if(!u.isValid)return(0,$.jsx)(Qy,{});let f=On.extractResourceIdentifiersFromUrlParams(l,i,r),p=i.resourceConfigurations?.[e]?.resourcePrimaryScope,m=tm.buildResourceOperationContextIdentifiers({currentUserId:a?.currentUserId,currentOrganizationId:a?.currentOrganizationId,currentApplicationId:a?.currentApplicationId,currentAnonymousUserId:a?.currentAnonymousUserId,primaryScope:p,liveAppScopeContextResourceIdentifiers:a?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:f}),h=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:m,parentResourcesRequirements:d}),g=dh.calculateResourceRelationshipDepth(d),_=g===0&&!!o?.zones?.secondary&&dh.layoutSplitsOperationFromPrimary(o,t,s),v=dh.resolveResourceTargetZone(g,{hasSecondary:!!o?.zones?.secondary,hasCompanion:!!o?.zones?.companion,prefersAdjacentZoneForDetail:_}),y=Wh({zone:v,layout:o,viewport:s,contentAreaWidth:c})?v:Cl.PRIMARY;return(0,$.jsx)(n,{resourceContext:h,navigationZone:y,navigationInitiator:{sourceZone:y}})};function LQ(e,t){let{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Wg(),{registry:a}=fm();return Q.useMemo(()=>{if(e)switch(t){case sd.COMPOSITE_VIEW:return _p({viewRef:e,compositeViews:n,registry:a})?.requiredFeatures;case sd.CHART_VIEW:return Mp({viewRef:e,registry:a})?.chartView.chartDefinition.requiredFeatures;case sd.FULL_CUSTOM_VIEW:return r?.find(t=>t.ref===e)?.requiredFeatures;case sd.FLOWS_ACTORS_VIEW:return i?.find(t=>t.ref===e)?.requiredFeatures;case sd.EXECUTION_VIEW:return Dp({viewRef:e,registry:a})?.requiredFeatures;default:return}},[e,t,n,r,i,a])}var RQ=({ViewComponent:e,contentType:t,viewProps:n})=>{let{viewRef:r}=Rm();iQ(r,t);let i=LQ(r,t);return(0,$.jsx)($h,{requiredFeatures:i,children:(0,$.jsx)(e,{viewRef:r,...n})})},qbe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=mg(),{compositeViews:r}=Wg(),{registry:i}=fm(),a=Q.useMemo(()=>Pp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>_p({viewRef:t,compositeViews:r,registry:i}),[t,r,i]),s=!!t&&zp(o);iQ(s?t:void 0,sd.COMPOSITE_VIEW);let c=LQ(s?t:void 0,sd.COMPOSITE_VIEW);return s?(0,$.jsx)($h,{requiredFeatures:c,children:(0,$.jsx)(VU,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(g_,{viewKind:`composite`,viewRef:t})},Jbe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=mg(),{registry:r}=fm(),i=Q.useMemo(()=>Dp({viewRef:t,registry:r}),[t,r]),a=Q.useMemo(()=>lm(new URLSearchParams(n.search)),[n.search]),o=!!t&&!!i&&ap(i);iQ(o?t:void 0,sd.EXECUTION_VIEW);let s=LQ(o?t:void 0,sd.EXECUTION_VIEW);return o?(0,$.jsx)($h,{requiredFeatures:s,children:(0,$.jsx)($Y,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(g_,{viewKind:`execution`,viewRef:t})},Ybe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=mg(),{registry:r}=fm(),i=Q.useMemo(()=>Gp(new URLSearchParams(n.search)),[n.search]),a=Q.useMemo(()=>Up(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>Vbe({viewRef:t,registry:r,contextResourceIdentifiers:i,urlParamValues:a}),[t,r,i,a]);return Hbe(o),o?(0,$.jsx)($h,{requiredFeatures:o.requiredFeatures,children:(0,$.jsx)(zbe,{viewRef:o.routeViewRef,viewDefinition:o.viewDefinition,contextResourceIdentifiers:o.contextResourceIdentifiers,urlParamValues:o.urlParamValues,runtimeDescriptor:o.runtimeDescriptor,...e})}):(0,$.jsx)(g_,{viewKind:`chart`,viewRef:t})},zQ=({pageRef:e,PageComponent:t})=>(mbe(e),(0,$.jsx)(t,{})),BQ=()=>(0,$.jsx)(qU,{});function Xbe({documentRef:e}){let[t]=ch(),n=mt(t);return(0,$.jsx)($Z,{documentRef:e,...n?{namedRelease:n}:{}})}var Zbe=()=>{let{registry:e}=fm();xa.isDevelopment();let t=[];return Object.values(e.resourceConfigurations).forEach(n=>{(Array.isArray(n.operations)?n.operations:[]).forEach(r=>{if(!Sn(r.operationFrontendConfig))return;let i=Vn.buildOperationFrontendRoutePaths(n,r,e.allResourceFieldIdentifiers),a=As(r),o;switch(a){case`create`:o=sG;break;case`list`:o=dX;break;case`read`:o=RY;break;case`update`:o=UY;break;case`search`:o=VY;break;default:o=YW}i.forEach((e,i)=>{let a=(0,$.jsx)($h,{operation:r,children:(0,$.jsx)(Kbe,{resourceType:n.resourceIdentifier,operation:r,PageComponent:o,routePathParameters:e.parameters})}),s=`${n.resourceIdentifier}-${String(r.operationIdentifier)}-${i}`;t.push((0,$.jsx)(Mh,{path:e.url,element:a,errorElement:(0,$.jsx)(Qy,{})},s))})})}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fbe,{}),(0,$.jsxs)(xse,{children:[(0,$.jsx)(Mh,{path:Ln.authCallback,element:(0,$.jsx)(Wve,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.reAuthenticationCallback,element:(0,$.jsx)(Gve,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.magicLinkVerify,element:(0,$.jsx)(Kve,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.mfaChallenge,element:(0,$.jsx)(kye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.enrollmentRequired,element:(0,$.jsx)(Aye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.organizationOnboarding,element:(0,$.jsx)(Nye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.oneOffSession,element:(0,$.jsx)(EZ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.fileUploadGrant,element:(0,$.jsx)(jZ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.authExchange,element:(0,$.jsx)(Qye,{}),errorElement:(0,$.jsx)(Qy,{})}),Object.entries(bae).map(([e,t])=>(0,$.jsx)(Mh,{path:t,element:(0,$.jsx)(Xbe,{documentRef:e}),errorElement:(0,$.jsx)(Qy,{})},e)),(0,$.jsx)(Mh,{path:Dae,element:(0,$.jsx)(eQ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.login,element:(0,$.jsx)(zye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.register,element:(0,$.jsx)(dbe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.passwordLost,element:(0,$.jsx)(ebe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.oauthConsent,element:(0,$.jsx)(nbe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.chatIdentityLink,element:(0,$.jsx)(rbe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.oauthLoggedOut,element:(0,$.jsx)(ibe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.oauthLogoutConfirm,element:(0,$.jsx)(abe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.invitation,element:(0,$.jsx)(Jye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.confirmEmail,element:(0,$.jsx)(Vye,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsxs)(Mh,{element:(0,$.jsx)(zH,{}),errorElement:(0,$.jsx)(Qy,{}),children:[(0,$.jsx)(Mh,{path:Ln.home,element:(0,$.jsx)(zQ,{pageRef:po.HOME,PageComponent:qU}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.decisions,element:(0,$.jsx)(zQ,{pageRef:po.DECISIONS,PageComponent:GW}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.settings,element:(0,$.jsx)(BQ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.settingsSection,element:(0,$.jsx)(BQ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:Ln.settingsSectionSubTab,element:(0,$.jsx)(BQ,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:`/composite/:viewRef`,element:(0,$.jsx)(qbe,{}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:`/custom/:viewRef`,element:(0,$.jsx)(RQ,{ViewComponent:oQ,contentType:sd.FULL_CUSTOM_VIEW}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:`/flows-actors/:viewRef`,element:(0,$.jsx)(RQ,{ViewComponent:IQ,contentType:sd.FLOWS_ACTORS_VIEW}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:`/execution/:viewRef`,element:(0,$.jsx)(Jbe,{viewProps:{navigationZone:rr.PRIMARY}}),errorElement:(0,$.jsx)(Qy,{})}),(0,$.jsx)(Mh,{path:`/chart/:viewRef`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`var(--muted-foreground, #737373)`},children:`Loading chart...`}),children:(0,$.jsx)(Ybe,{})}),errorElement:(0,$.jsx)(Qy,{})}),t]}),(0,$.jsx)(Mh,{path:`*`,element:(0,$.jsx)(Qy,{})})]})]})},VQ=pae.EN,HQ={en:{title:`Something went wrong`,message:`The application could not start. Please try again.`,retry:`Try again`},es:{title:`Algo salió mal`,message:`La aplicación no pudo iniciarse. Vuelve a intentarlo.`,retry:`Reintentar`},fr:{title:`Une erreur est survenue`,message:`L'application n'a pas pu démarrer. Veuillez réessayer.`,retry:`Réessayer`},de:{title:`Etwas ist schiefgelaufen`,message:`Die Anwendung konnte nicht gestartet werden. Bitte versuchen Sie es erneut.`,retry:`Erneut versuchen`},pt:{title:`Algo correu mal`,message:`A aplicação não conseguiu iniciar. Tente novamente.`,retry:`Tentar novamente`},it:{title:`Qualcosa è andato storto`,message:`L'applicazione non è riuscita ad avviarsi. Riprova.`,retry:`Riprova`},nl:{title:`Er is iets misgegaan`,message:`De applicatie kon niet starten. Probeer het opnieuw.`,retry:`Opnieuw proberen`},ru:{title:`Что-то пошло не так`,message:`Не удалось запустить приложение. Попробуйте ещё раз.`,retry:`Повторить`},zh:{title:`出了点问题`,message:`应用无法启动,请重试。`,retry:`重试`},"zh-TW":{title:`發生錯誤`,message:`應用程式無法啟動,請重試。`,retry:`重試`},"zh-HK":{title:`發生錯誤`,message:`應用程式無法啟動,請重試。`,retry:`重試`},ja:{title:`問題が発生しました`,message:`アプリケーションを起動できませんでした。もう一度お試しください。`,retry:`再試行`},ko:{title:`문제가 발생했습니다`,message:`애플리케이션을 시작할 수 없습니다. 다시 시도해 주세요.`,retry:`다시 시도`},ar:{title:`حدث خطأ ما`,message:`تعذّر بدء تشغيل التطبيق. يرجى المحاولة مرة أخرى.`,retry:`إعادة المحاولة`},hi:{title:`कुछ गलत हो गया`,message:`एप्लिकेशन शुरू नहीं हो सका। कृपया पुनः प्रयास करें।`,retry:`पुनः प्रयास करें`},sv:{title:`Något gick fel`,message:`Appen kunde inte starta. Försök igen.`,retry:`Försök igen`},no:{title:`Noe gikk galt`,message:`Appen kunne ikke starte. Prøv igjen.`,retry:`Prøv igjen`},da:{title:`Noget gik galt`,message:`Appen kunne ikke starte. Prøv igen.`,retry:`Prøv igen`},fi:{title:`Jokin meni pieleen`,message:`Sovellusta ei voitu käynnistää. Yritä uudelleen.`,retry:`Yritä uudelleen`},pl:{title:`Coś poszło nie tak`,message:`Nie udało się uruchomić aplikacji. Spróbuj ponownie.`,retry:`Spróbuj ponownie`},cs:{title:`Něco se pokazilo`,message:`Aplikaci se nepodařilo spustit. Zkuste to znovu.`,retry:`Zkusit znovu`},hu:{title:`Valami hiba történt`,message:`Az alkalmazást nem sikerült elindítani. Próbálja újra.`,retry:`Újrapróbálkozás`},ro:{title:`Ceva nu a funcționat`,message:`Aplicația nu a putut porni. Încercați din nou.`,retry:`Încercați din nou`},bg:{title:`Нещо се обърка`,message:`Приложението не можа да стартира. Опитайте отново.`,retry:`Опитайте отново`},hr:{title:`Nešto je pošlo po zlu`,message:`Aplikacija se nije mogla pokrenuti. Pokušajte ponovno.`,retry:`Pokušaj ponovno`},sk:{title:`Niečo sa pokazilo`,message:`Aplikáciu sa nepodarilo spustiť. Skúste to znova.`,retry:`Skúsiť znova`},sl:{title:`Nekaj je šlo narobe`,message:`Aplikacije ni bilo mogoče zagnati. Poskusite znova.`,retry:`Poskusi znova`},lt:{title:`Kažkas nepavyko`,message:`Nepavyko paleisti programos. Bandykite dar kartą.`,retry:`Bandyti dar kartą`},lv:{title:`Kaut kas nogāja greizi`,message:`Neizdevās palaist lietotni. Mēģiniet vēlreiz.`,retry:`Mēģināt vēlreiz`},et:{title:`Midagi läks valesti`,message:`Rakendust ei õnnestunud käivitada. Proovige uuesti.`,retry:`Proovi uuesti`},el:{title:`Κάτι πήγε στραβά`,message:`Η εφαρμογή δεν μπόρεσε να ξεκινήσει. Δοκιμάστε ξανά.`,retry:`Δοκιμάστε ξανά`},tr:{title:`Bir şeyler ters gitti`,message:`Uygulama başlatılamadı. Lütfen tekrar deneyin.`,retry:`Tekrar dene`},th:{title:`เกิดข้อผิดพลาด`,message:`ไม่สามารถเริ่มแอปพลิเคชันได้ โปรดลองอีกครั้ง`,retry:`ลองอีกครั้ง`},vi:{title:`Đã xảy ra lỗi`,message:`Không thể khởi động ứng dụng. Vui lòng thử lại.`,retry:`Thử lại`},id:{title:`Terjadi kesalahan`,message:`Aplikasi tidak dapat dimulai. Silakan coba lagi.`,retry:`Coba lagi`},ms:{title:`Sesuatu tidak kena`,message:`Aplikasi tidak dapat dimulakan. Sila cuba lagi.`,retry:`Cuba lagi`},ta:{title:`ஏதோ தவறு நடந்தது`,message:`செயலியைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,retry:`மீண்டும் முயற்சி`},bn:{title:`কিছু ভুল হয়েছে`,message:`অ্যাপ্লিকেশনটি চালু করা যায়নি। আবার চেষ্টা করুন।`,retry:`আবার চেষ্টা করুন`},ur:{title:`کچھ غلط ہو گیا`,message:`ایپلیکیشن شروع نہیں ہو سکی۔ دوبارہ کوشش کریں۔`,retry:`دوبارہ کوشش کریں`},fa:{title:`مشکلی پیش آمد`,message:`برنامه راه‌اندازی نشد. لطفاً دوباره تلاش کنید.`,retry:`تلاش دوباره`},he:{title:`משהו השתבש`,message:`לא ניתן היה להפעיל את היישום. נסה שוב.`,retry:`נסה שוב`},sw:{title:`Hitilafu imetokea`,message:`Programu haikuweza kuanza. Tafadhali jaribu tena.`,retry:`Jaribu tena`},af:{title:`Iets het verkeerd geloop`,message:`Die toepassing kon nie begin nie. Probeer weer.`,retry:`Probeer weer`},am:{title:`የሆነ ችግር ተፈጥሯል`,message:`መተግበሪያውን መጀመር አልተቻለም። እባክዎ እንደገና ይሞክሩ።`,retry:`እንደገና ይሞክሩ`},is:{title:`Eitthvað fór úrskeiðis`,message:`Ekki tókst að ræsa forritið. Reyndu aftur.`,retry:`Reyna aftur`},mt:{title:`Xi ħaġa marret ħażin`,message:`L-applikazzjoni ma setgħetx tibda. Erġa' pprova.`,retry:`Erġa' pprova`},ga:{title:`Chuaigh rud éigin mícheart`,message:`Níorbh fhéidir an feidhmchlár a thosú. Bain triail eile as.`,retry:`Bain triail eile as`},cy:{title:`Aeth rhywbeth o'i le`,message:`Nid oedd modd cychwyn y rhaglen. Rhowch gynnig arall arni.`,retry:`Rhoi cynnig arall`},eu:{title:`Zerbait gaizki joan da`,message:`Aplikazioa ezin izan da abiarazi. Saiatu berriro.`,retry:`Saiatu berriro`},ca:{title:`Alguna cosa ha anat malament`,message:`L'aplicació no s'ha pogut iniciar. Torna-ho a provar.`,retry:`Torna-ho a provar`},gl:{title:`Algo foi mal`,message:`A aplicación non puido iniciarse. Téntao de novo.`,retry:`Tentar de novo`}};function Qbe(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function UQ(e){let t=e.trim().toLowerCase();if(t)return Object.keys(HQ).find(e=>e.toLowerCase()===t)}function WQ(e){let t=HQ[e]??HQ[VQ],n=qn[e]?.direction??zd.LTR;return{...t,languageTag:e,direction:n}}function $be(e){for(let t of e){if(typeof t!=`string`)continue;let e=UQ(t);if(e)return WQ(e);let n=UQ(Qbe(t));if(n)return WQ(n)}return WQ(VQ)}function exe({onRetry:e}){let t=(0,Q.useMemo)(()=>$be(navigator.languages??[navigator.language]),[]);return(0,$.jsx)(`div`,{className:`min-h-screen w-screen bg-background px-6 py-10 md:px-10`,lang:t.languageTag,dir:t.direction,children:(0,$.jsx)(`div`,{className:`mx-auto flex min-h-[calc(100vh-5rem)] max-w-xl items-center justify-center`,children:(0,$.jsxs)(`div`,{role:`alert`,className:`w-full rounded-2xl border border-border bg-card px-6 py-8 text-center shadow-sm md:px-8`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive`,children:`!`}),(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-foreground`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:t.message}),(0,$.jsx)(`button`,{type:`button`,onClick:e,className:`mt-6 inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90`,children:t.retry})]})})})}function txe(e){let t=[...rxe(e.appConfig),...axe(e.resourcesRegistry)],n=yie({definitions:e.featureConfiguration.definitions,usages:t}),r=[...nxe(e.featureConfiguration,e.isComponentRegistered),...n.unknownIssues.map(e=>`${e.surface}: unknown feature reference(s): ${sxe(e.references)}`),...n.incompatibleIssues.map(e=>`${e.surface}: incompatible feature reference(s): ${e.references.map(e=>`'${e.featureId}' via ${e.slotLabel} expects ${e.expectedValueType} but registry defines ${e.actualValueType}`).join(`, `)}`)];return{...n,warnings:r,isValid:r.length===0}}function nxe(e,t){let n=[];for(let r of e.definitions??[]){let e=r.unavailability;if(!e||!(e.behavior===Jo.CUSTOM||Object.values(e.byRole??{}).includes(Jo.CUSTOM)))continue;let i=e.customComponentRef;i?t&&!t(i)&&n.push(`feature '${r.identifier}': customComponentRef '${i}' is not registered in ComponentRegistryService`):n.push(`feature '${r.identifier}': unavailability behavior CUSTOM declares no customComponentRef, so it renders the generic prompt and behaves identically to DISABLE`)}return n}function rxe(e){return[...GQ(e.compositeViews,e=>`frontend composite view '${e.ref}'`),...GQ(e.fullCustomViews,e=>`frontend full custom view '${e.ref}'`),...GQ(e.flowsActorsViews,e=>`frontend flows/actors view '${e.ref}'`),...GQ(e.onboardingViews,e=>`frontend onboarding view '${e.ref}'`),...ixe(e)]}function ixe(e){return(e.guidanceFlows??[]).flatMap(e=>{let t=rl(e.audience?.requiredFeatures);return t.length===0?[]:[{surface:`frontend guidance flow '${e.ref}' audience`,references:t}]})}function GQ(e,t){return e?e.flatMap((e,n)=>{let r=rl(e.requiredFeatures);return r.length===0?[]:[{surface:t(e,n),references:r}]}):[]}function axe(e){return Object.entries(e.resourceConfigurations).flatMap(([e,t])=>oxe(e,t))}function oxe(e,t){let n=t.frontendConfiguration;return[...(n?.compositeViews??[]).flatMap(t=>{let n=rl(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' composite view '${t.ref}'`,references:n}]}),...(n?.chartViews??[]).flatMap(t=>{let n=rl(t.chartDefinition.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' chart '${t.ref}'`,references:n}]}),...(n?.executionViews??[]).flatMap(t=>{let n=rl(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' execution view '${t.ref}'`,references:n}]}),...(n?.guidance??[]).flatMap(t=>{let n=rl(t.audience?.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' guidance flow '${t.ref}' audience`,references:n}]})]}function sxe(e){return e.map(e=>`'${e.featureId}' via ${e.slotLabel}`).join(`, `)}var KQ;(function(e){e.HANDLE_IS_NOT_A_SINK=`HANDLE_IS_NOT_A_SINK`,e.NO_ACTIVATED_SDK=`NO_ACTIVATED_SDK`,e.REPORT_FAILED=`REPORT_FAILED`})(KQ||={});function cxe(e){let t=e.context??{},n=e=>{let n=t[e];return typeof n==`string`&&n.length>0?n:void 0};return{name:n(`errorName`)??`Error`,message:n(`errorMessage`)??n(`message`)??e.type,stack:n(`errorStack`),componentStack:n(`componentStack`),tags:{errorType:e.type,errorSeverity:e.severity,...e.operationPathKey===void 0?{}:{operationPathKey:e.operationPathKey}}}}function lxe(e){let t=t=>{e.onDiagnostic?.(t)},n=[];for(let r of e.modules){if(!r.providerCapabilities.includes(Dd.FRONTEND_ERROR_MONITORING))continue;let i=r.metadata.ref,a=e.activations.get(i);a===void 0?t({kind:KQ.NO_ACTIVATED_SDK,providerRef:i,message:`Provider "${i}" declares FRONTEND_ERROR_MONITORING but has no activated SDK, so crashes are not being reported anywhere. Its activation diagnostic says why.`}):Pse(a.handle)?n.push({providerRef:i,sink:a.handle}):t({kind:KQ.HANDLE_IS_NOT_A_SINK,providerRef:i,message:`Provider "${i}" declares FRONTEND_ERROR_MONITORING but its activated handle has no reportCrash(report). Return a FrontendErrorMonitoringSink from activate() rather than the vendor namespace; crashes are not being reported until it does.`})}return(e.subscribe??_i.on.bind(_i))(Ec.ERROR_OCCURED,e=>{if(n.length===0)return;let r=cxe(e.error);for(let{providerRef:e,sink:i}of n)try{i.reportCrash(r)}catch(n){t({kind:KQ.REPORT_FAILED,providerRef:e,message:`Provider "${e}" threw while reporting a crash; the crash itself is unaffected.`,cause:n})}})}function qQ(e){return typeof e==`object`&&!!e}function uxe(e){if(!qQ(e)||!(`cause`in e))return;let t=e.cause;if(t instanceof Error)return t.message;if(typeof t==`string`)return t}function dxe(e,t){let n=e instanceof Error?e:Error(String(e)),r=qQ(n)&&qQ(n.wildoError)?n.wildoError:void 0;return n.initializationDiagnostics={...t,errorName:n.name,errorMessage:n.message,stack:n.stack,causeMessage:uxe(n),wildoError:r?{type:r.type,customMessageReference:r.customMessageReference,context:qQ(r.context)?r.context:void 0}:void 0},n}var JQ=class{services=null;isInitialized=!1;initializationPromise=null;logger=null;logDebug=null;reportNavigationLayoutDiagnostics(e){if(!e)return;let t;try{t=Wte(e)}catch(e){this.logger.warn(`Navigation layout diagnostics could not run`,{error:mo(e)});return}if(t.length!==0)for(let e of t){let t={path:e.path,code:e.code,remedy:e.remedy};e.severity===gte.ERROR?this.logger.error(`Navigation layout: ${e.message}`,t):this.logger.warn(`Navigation layout: ${e.message}`,t)}}async initializeApplication(e){if(this.isInitialized&&this.services)return this.services;if(this.initializationPromise)return this.initializationPromise;let t={...e};this.initializationPromise=this.performInitialization(t);try{this.services=await this.initializationPromise,this.isInitialized=!0;try{e.onInitialized&&e.onInitialized()}catch(e){this.logger.error(`Failed to fire onInitialized callback`,{error:mo(e)})}return this.services}catch(e){throw this.initializationPromise=null,e}}async performInitialization(e){let{config:t,autoAuth:n=!0,preloadResources:r=[],onError:i,customShared_ResourcesConfigurationsFactoryMap:a,customShared_ResourceFieldIdentifier:o,customShared_ResourcesRelationships:s,componentLoader:c}=e,l=`startup preparation`,u;this.logger||(this.logger=as.getLogger(),this.logDebug=this.logger.debugByType(`StartApplicationFrontendService`),this.logger.setDebugTypeLogging(`StartApplicationFrontendService`,!1)),this.logger.info(`Starting application initialization...`,{autoAuth:n}),this.logDebug(`Frontend initialization started with config`,{apiBaseUrl:t.apiBaseUrl,autoAuth:n});try{l=`http client initialization`,this.logDebug(`Initializing HTTP client...`);let n=new oa({baseURL:t.apiBaseUrl});l=`manual backend client setup`,this.logDebug(`Fetching application configuration from backend...`);let i=new Ir({baseURL:t.apiBaseUrl});try{l=`environment configuration loading`,u=xa.loadEnvironmentConfig(),this.logDebug(`Environment configuration loaded`,{frontendServiceName:u.frontendServiceName,apiBaseUrl:u.apiBaseUrl,appName:u.appName})}catch(e){throw this.logger.error(`Failed to load environment configuration`,{error:e.message}),Error(`Environment configuration failed: ${e.message}`)}let d,f;try{l=`backend application configuration fetch`;let t=null;for(let n=1;n<=2;n++)try{let t=Zl.parse(await i.getApplicationConfig(u.frontendServiceName));f=Wb({entries:t.frontendProviders,modules:e.frontendProviderModules,onDiagnostic:e=>{this.logger?.warn(`Frontend provider hydration diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}}),d=fre.parse(t);break}catch(e){if(t=e instanceof Error?e:Error(String(e)),n<2){let e=Math.min(2e3*2**(n-1),5e3);this.logDebug(`Config fetch attempt ${n}/2 failed, retrying after ${e}ms`,{error:t.message,attempt:n,totalAttempts:2}),await new Promise(t=>setTimeout(t,e))}else throw this.logger.error(`All 2 config fetch attempts failed`,{error:t.message,totalAttempts:2}),t}Ho(d.compliance.clientInstanceIdScope),this.logDebug(`Application configuration fetched successfully`,{hasAppIdentity:!!d.appIdentity,hasAppPreferences:!!d.appPreferences,hasRuntime:!!d.runtime,endpointsCount:Object.keys(d.runtime?.endPoints||{}).length}),this.logDebug(`Application configuration loaded from backend`,{appName:d.appIdentity?.appName,version:d.appIdentity?.version,hasAuth:!!d.auth,hasSocialOAuth2Providers:!!d.auth?.socialOAuth2Providers&&Object.keys(d.auth.socialOAuth2Providers).length>0,defaultLanguage:d.appPreferences?.languages?.defaultLanguage,enabledLanguages:d.appPreferences?.languages?.enabledLanguages,endpointsList:Object.keys(d.runtime?.endPoints||{}),frontendProvidersCount:f?.listAll().length??0})}catch(e){throw this.logger.error(`Failed to fetch application configuration from backend`,{error:e.message,frontendServiceName:u?.frontendServiceName,apiBaseUrl:t.apiBaseUrl}),Error(`Application configuration fetch failed: ${e.message}`)}l=`frontend configuration validation`;let p={...e.baseFrontendConfig};this.logDebug(`Using app-provided base frontend configuration`),e.frontendConfigOverrides&&(p=zy(p,e.frontendConfigOverrides),this.logDebug(`Applied frontend config overrides`,{sections:Object.keys(e.frontendConfigOverrides)})),p=Cm.parse(p),this.reportNavigationLayoutDiagnostics(p.navigationLayout),this.logDebug(`Frontend configuration resolved`,{frontendServiceName:u.frontendServiceName,finalConfig:{hasNavigationLayout:!!p.navigationLayout,hasAppComponentsConfiguration:!!p.appComponentsConfiguration,hasDesignSystem:!!p.designSystemConfiguration,hasTypography:!!p.designSystemConfiguration?.typography}}),l=`frontend resource registry initialization`,this.logDebug(`Initializing resources repository...`);let m=new RS(n);await m.initializeResources(a,o,s,e.excludedResourceTypes,e.resourceUIBehavior,e.notificationBadgeDefinitions);let h=m.getResourcesRegistry();if(l=`component preset registration`,await c(),xa.isDevelopment()&&(l=`development launcher verification`,Wv(Uv(h,p,e=>Fo.hasComponentType(e),{organizationRoles:d.organizationRoles})),Qv(Zv(Pv(p?.settingsHub),Fv(p?.settingsHub),Nv(p?.settingsHub))),e.featureConfiguration)){let t=txe({resourcesRegistry:h,appConfig:p,featureConfiguration:e.featureConfiguration,isComponentRegistered:e=>Fo.hasComponentType(e)});t.isValid||this.logger.warn(`Invalid frontend feature references detected:\n${t.warnings.map(e=>` ⚠ ${e}`).join(`
23
- `)}`)}r.length>0&&(l=`resource preload`,await this.preloadResources(r)),l=`frontend provider SDK activation`;let g=f??Wb(),_=await Fb({surface:Zo.SAAS_APP,modules:g.listAll().filter(e=>Tb(e).length===0),onDiagnostic:e=>{this.logger?.warn(`Frontend provider SDK activation diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});l=`frontend error-monitoring bridge`,lxe({modules:g.listAll(),activations:_.activations,onDiagnostic:e=>{this.logger?.warn(`Frontend error-monitoring bridge diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});let v=e=>{this.logger?.warn(`Provider component diagnostic`,{kind:e.kind,capability:e.capability,providerRef:e.providerRef,message:e.message})},y=tle(g.listAll(),{contributedLoaders:Zb(),onDiagnostic:v}),b=$ce({registrations:y,onDiagnostic:v});l=`frontend provider script loading`;let x=nle(g.listAll(),y);x.length>0&&Rb(x,document).then(e=>{for(let t of e.failed)this.logger?.warn(`Frontend provider script diagnostic`,{providerRef:t.providerRef,src:t.src,message:t.message})});let S={logger:this.logger,httpClient:n,resourceRepository:m,resourcesRegistry:h,appConfigFromBackend:d,frontendProviderRegistry:g,frontendProviderSdks:_,providerComponentRegistry:b,frontendConfiguration:p};return this.logger.info(`Application initialization completed successfully`),S}catch(e){let n=dxe(e,{phase:l,apiBaseUrl:t.apiBaseUrl,frontendServiceName:u?.frontendServiceName});throw this.logger?this.logger.error(`Application initialization failed`,{error:n.message,stack:n.stack,phase:l,apiBaseUrl:t.apiBaseUrl,frontendServiceName:u?.frontendServiceName,initializationDiagnostics:n.initializationDiagnostics}):console.error(`Application initialization failed:`,n),i&&i(n),n}}getServices(){return this.services}isApplicationInitialized(){return this.isInitialized}reset(){this.services=null,this.isInitialized=!1,this.initializationPromise=null}async preloadResources(e){if(this.logger){this.logger.info(`Preloading resources...`,{resourceCount:e.length});try{await Promise.all(e.map(async e=>{this.logger.debug(`Preloading resource: ${e}`)})),this.logger.info(`Resource preloading completed successfully`)}catch(e){this.logger.warn(`Resource preloading failed`,{error:e.message})}}}},YQ=typeof globalThis<`u`?globalThis:window;YQ.__START_APPLICATION_FRONTEND_SERVICE__||=new JQ;var XQ=YQ.__START_APPLICATION_FRONTEND_SERVICE__,fxe=G(B.LOW_LEVEL_CELEBRATION_OVERLAY,`CelebrationOverlay`),ZQ=({preset:e=q.DEFAULT})=>{let{celebration:t,dismissCelebration:n}=Fm(),{tComponent:r,isReady:i}=K({component:B.LOW_LEVEL_CELEBRATION_OVERLAY}),a=r(B.LOW_LEVEL_CELEBRATION_OVERLAY,`dismiss`),o=r(B.LOW_LEVEL_CELEBRATION_OVERLAY,`ariaLabel`),s=fxe(e);return!i&&!t.isActive?null:(0,$.jsx)(s,{isActive:t.isActive,mode:t.mode?.mode,message:t.message,heading:t.heading,notificationIdentifier:t.notificationIdentifier,nextStep:t.nextStep,onDismiss:n,dismissLabel:a,ariaLabel:o})};ZQ.displayName=`AppCelebrationOverlay`;function QQ({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_TOAST,`Toaster`)(e);return(0,$.jsx)(n,{...t})}var $Q=({children:e})=>{let{registry:t}=fm(),{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Wg(),a=(0,Q.useMemo)(()=>e$({registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}),[t,n,r,i]);return(0,$.jsx)(bf,{customRegistry:a,children:e})};function e$(e){let{registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=e,a=new Map,o=new Map,s=new Map,c=new Map;if(t?.resourceConfigurations)for(let[e,n]of Object.entries(t.resourceConfigurations)){let t=n.frontendConfiguration?.icon,r=t$(t);r&&a.set(e,r);let i=n.frontendConfiguration?.compositeViews??[];for(let e of i){let t=t$(e.icon);t&&s.set(e.ref,t)}let l=n.frontendConfiguration?.executionViews??[];for(let e of l){let t=t$(e.icon);t&&c.set(`view-execution-${e.ref}`,t)}let u=n.frontendConfiguration?.chartViews??[];for(let e of u){let t=t$(e.icon);t&&c.set(`view-chart-${e.ref}`,t)}let d=Array.isArray(n.operations)?n.operations:[];for(let t of d){let n=t.operationFrontendConfig?.iconOverride,r=t$(n);if(!r)continue;let i=`${e}:${String(t.operationIdentifier)}`;o.set(i,r)}}for(let e of n??[]){let t=t$(e.icon);t&&s.set(e.ref,t)}for(let e of r??[]){let t=t$(e.icon);t&&c.set(`view-custom-${e.ref}`,t)}for(let e of i??[]){let t=t$(e.icon);t&&c.set(`view-flows-${e.ref}`,t)}return{resources:a,operationResources:o,compositeView:s,custom:c}}function t$(e){if(e)return typeof e==`string`?Cf.standard.get(e):{icon:e}}var pxe=2e3,n$=new Map;function r$(e,t){let n=Ti(t.badgeReference);n&&n$.set(n,t.badgeCount),e(Ec.BADGE_COUNT_CHANGED,t)}function i$(){n$.clear()}function a$(){let e=Zp(),t=e?.currentUserId??null,n=e?.currentOrganizationId??null,r=(0,Q.useRef)({userId:t,organizationId:n});return(0,Q.useEffect)(()=>{let e=r.current;r.current={userId:t,organizationId:n};let i=e.userId!==null&&e.userId!==t,a=e.organizationId!==null&&e.organizationId!==n;(i||a)&&i$()},[t,n]),null}var o$=()=>{let{on:e}=Mo(),[t,n]=(0,Q.useState)(()=>Object.fromEntries(n$)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(Object.fromEntries(n$));return(0,Q.useEffect)(()=>e(Ec.BADGE_COUNT_CHANGED,e=>{let t=Ti(e.badgeReference);if(!t)return;let r=a.current[t]??0;a.current[t]=e.badgeCount,n(n=>({...n,[t]:e.badgeCount})),e.badgeCount>r&&(i(e=>({...e,[t]:!0})),setTimeout(()=>{i(e=>({...e,[t]:!1}))},pxe))}),[e]),{getBadgeState:(0,Q.useCallback)(e=>{let n=qu(e),i=t[n]??0,a=!1;switch(e.display.pulse){case to.WHILE_ACTIVE:a=i>0;break;case to.ON_INCREASE:a=!!r[n];break;case to.NONE:default:a=!1}return{count:i,pulse:a}},[t,r])}},s$=()=>{let{on:e,isConnected:t}=up(),n=Mo(),{getResourcesRegistry:r}=fm(),i=(0,Q.useMemo)(()=>r(),[r]),a=(0,Q.useMemo)(()=>new UJ(i),[i]);return(0,Q.useEffect)(()=>{if(!t)return;let r=e=>{switch(e){case Hn.CREATED:return El.SUCCESS;case Hn.UPDATED:return El.INFO;case Hn.DELETED:return El.WARNING;default:return El.INFO}},o=e=>{let t=i.resourceConfigurations[e.resourceType]?.operations??[];if(e.operationPathKey){let n=t.find(t=>{try{return Ta.createOperationPathKeyFromOperation(t)===e.operationPathKey}catch{return!1}});if(n)return n}let n=t.filter(t=>String(t.operationIdentifier)===e.operationIdentifier&&(e.variantType==null||t.variantType===e.variantType)&&(e.variantKey==null||t.variantKey===e.variantKey)&&(e.isBulkOperation==null||t.isBulkOperation===!0===e.isBulkOperation)&&(e.isOperationDefault==null||!!t.isOperationDefault===e.isOperationDefault));return n.length===1?n[0]:(n.length>1&&console.warn(`[WebSocketEventBridge] Ambiguous operation identity in notification payload; emitting minimal operation context.`,{resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,candidateVariants:n.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))}),{operationIdentifier:e.operationIdentifier,variantType:e.variantType,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,variantKey:e.variantKey})},s=(e,t)=>ey(e,t,i),c=({resourceType:e,resourceIds:t,contextResourceIdentifiers:r,previousContextResourceIdentifiers:a,shouldEmitReadRefresh:o,relaysRowDeletion:c=!1})=>{let l=i.resourceConfigurations[e],u=s(e,r),d=a?s(e,a):void 0,f=ty({resourceType:e,registry:i,scopes:d?{contextResourceIdentifiers:u,previousContextResourceIdentifiers:d}:{contextResourceIdentifiers:u}}),p=f.length>0?f:[null],m=On.buildParentResourcesRequirements(e,u,i);for(let t of p)n.emit(Ec.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:u,parentResourcesRequirements:m,operation:t??{operationIdentifier:W.LIST},...d?{previousContextResourceIdentifiers:d}:{},...c?{relaysRowDeletion:!0}:{}});let h=Array.from(new Set((t??[]).filter(e=>typeof e==`string`&&e.length>0)));if(!o||h.length===0)return;let g=Ra(l?.operations??[],W.READ,{requireAddressable:!0}),_=new Set;for(let t of h){let r={...u,[e]:t},a=V.buildContextualParameters(r,i),o=On.buildParentResourcesRequirements(e,r,i),s=g.filter(e=>!l||Km({resourceConfig:l,operation:e,registry:i,hasResourceId:!0,contextResourceIdentifiers:r,contextualParameters:a})),d=s.length>0?s:[null];for(let i of d){let a=i??{operationIdentifier:W.READ},s=[t,String(a.operationIdentifier),a.variantType??``,a.variantKey??``,a.isBulkOperation??!1].join(`:`);_.has(s)||(_.add(s),n.emit(Ec.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(a.operationIdentifier??W.READ),variantType:i?.variantType,isOperationDefault:i?.isOperationDefault??!0,isBulkOperation:i?.isBulkOperation??!1,variantKey:i?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:o,operation:a,...c?{relaysRowDeletion:!0}:{}}))}}},l=e(fa.RESOURCE_NOTIFICATION,e=>{let t=o({resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,operationPathKey:e.operationPathKey,variantType:e.variantType,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,variantKey:e.variantKey}),i={serverNotification:e.deliveryPolicy,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,variantType:t.variantType??e.variantType,isOperationDefault:t.isOperationDefault??e.isOperationDefault,isBulkOperation:t.isBulkOperation??e.isBulkOperation,variantKey:typeof t.variantKey==`string`?t.variantKey:e.variantKey,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:[],operation:t,additionalContext:{notificationIdentifier:e.notificationIdentifier,action:e.action,frontendDisplayHints:e.frontendDisplayHints,...e.isBulkOperation?{affectedCount:e.affectedIds.length}:{}},resultSummary:e.contextResourceIdentifiers?{...e.contextResourceIdentifiers}:void 0},a=e.notificationLevel??r(e.action);switch(a!==El.ERROR&&c({resourceType:e.resourceType,resourceIds:e.affectedIds,contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.affectedIds.length>0&&!(e.isBulkOperation??!1)}),a){case El.SUCCESS:n.emit(Ec.NOTIFY_RESOURCE_SUCCESS,i);break;case El.WARNING:n.emit(Ec.NOTIFY_RESOURCE_WARNING,i);break;case El.ERROR:n.emit(Ec.NOTIFY_RESOURCE_ERROR,i);break;case El.INFO:default:n.emit(Ec.NOTIFY_RESOURCE_INFO,i)}}),u=e(fa.RESOURCE_UPDATED,e=>{c({resourceType:e.resourceType,resourceIds:e.deliveryTarget===Ja.SCOPE_ROOM_NOTIFICATION?e.affectedIds??[]:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.deliveryTarget===Ja.SCOPE_ROOM_NOTIFICATION?(e.affectedIds?.length??0)>0:!!e.resourceId})}),d=e(fa.RESOURCE_DELETED,e=>{c({resourceType:e.resourceType,resourceIds:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:!!e.resourceId,relaysRowDeletion:!0})}),f=e(fa.BADGE_UPDATE,e=>{let t={badgeReference:e.badgeReference,badgeCount:e.badgeCount};r$(n.emit,t)}),p=e(fa.BULK_JOB_PROGRESS,e=>{n.emit(Ec.BULK_JOB_PROGRESS,{jobId:e.jobId,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,attemptedCount:e.attemptedCount,processedCount:e.processedCount,failedCount:e.failedCount,finished:e.finished,...e.failures?{failures:e.failures}:{}})}),m=e(fa.RESOURCE_EDITING_START,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(Ec.RESOURCE_EDITING_START,t)}}),h=e(fa.RESOURCE_EDITING_END,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(Ec.RESOURCE_EDITING_END,t)}}),g=e(fa.RESOURCE_CUSTOM,e=>{let t=e.resourceData;if(e.resourceData&&typeof e.resourceData==`object`&&!Array.isArray(e.resourceData))try{t=a.validateWebSocketResourceData(e.resourceData,{resourceType:e.resourceType,operationIdentifier:void 0,dataMode:e.dataMode})}catch(n){console.warn(`[WebSocketEventBridge] Resource data validation failed:`,n),t=e.resourceData}let r={resourceType:e.resourceType,resourceId:e.resourceId,eventName:e.eventName,data:e.data,resourceData:t,dataMode:e.dataMode,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(Ec.RESOURCE_CUSTOM_EVENT,r)}),_=e(fa.USER_NOTIFICATION,e=>{let t={identifier:e.identifier??``,data:{...e.data,_backendNotification:!0,displayTarget:e.displayTarget,message:e.message,title:e.title,organizationId:e.organizationId,destination:e.destination}};switch(e.notificationLevel){case El.INFO:n.emit(Ec.NOTIFY_CUSTOM_INFO,t);break;case El.SUCCESS:n.emit(Ec.NOTIFY_CUSTOM_SUCCESS,t);break;case El.WARNING:n.emit(Ec.NOTIFY_CUSTOM_WARNING,t);break;case El.ERROR:n.emit(Ec.NOTIFY_CUSTOM_ERROR,t);break;default:n.emit(Ec.NOTIFY_CUSTOM_INFO,t)}}),v=e(fa.ANALYTICS_MOMENT_ACHIEVED,e=>{let t={momentIdentifier:e.momentIdentifier,role:e.role,scope:e.scope,triggerSource:ad.BACKEND};n.emit(Ec.ANALYTICS_MOMENT_ACHIEVED,t)}),y=e(fa.GUIDANCE_STATE_CHANGED,e=>{let t={flowRef:e.flowRef,triggerSource:e.triggerSource,scope:e.scope,renderMode:e.renderMode};switch(e.status){case Hr.IN_PROGRESS:n.emit(Ec.GUIDANCE_FLOW_ACTIVATED,t);break;case Hr.COMPLETED:n.emit(Ec.GUIDANCE_FLOW_COMPLETED,t);break;case Hr.DISMISSED:n.emit(Ec.GUIDANCE_FLOW_DISMISSED,t)}}),b=e(fa.MILESTONE_ACHIEVED,e=>{let t={milestoneRef:e.milestoneRef,category:e.category,points:e.points,achievedAt:e.achievedAt,scope:e.scope,reward:e.reward,lifecycleTransition:e.lifecycleTransition,totalPoints:e.totalPoints};n.emit(Ec.MILESTONE_ACHIEVED,t)}),x=e(fa.PROGRESSION_UPDATED,e=>{let t={scope:e.scope,operationCounts:e.operationCounts,totalPoints:e.totalPoints,updatedAt:e.updatedAt};n.emit(Ec.PROGRESSION_UPDATED,t)}),S=e(fa.LIFECYCLE_STAGE_CHANGED,e=>{let t={previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger,changedAt:e.changedAt,activationCriteriaMet:e.activationCriteriaMet};n.emit(Ec.LIFECYCLE_STAGE_CHANGED,t)});return()=>{l(),u(),d(),f(),p(),m(),h(),g(),_(),v(),y(),b(),x(),S()}},[t,e,n,i,a]),null},c$=`wildo:connectivity-status`,mxe=3e3,hxe={connectionReconnectingNotice:`Connection lost — reconnecting…`,connectionLostNotice:`Connection lost. Please check your network and reload the page.`},l$=e=>e===$p.RECONNECTING||e===$p.ERROR,u$=()=>{let{status:e}=up(),{showPersistentToast:t,dismissPersistentToast:n}=Fm(),{tComponent:r,isReady:i}=K({component:B.APPLICATION_LEVEL_STATUS_BAR}),a=(0,Q.useRef)(r);a.current=r;let o=(0,Q.useRef)(t);o.current=t;let s=(0,Q.useRef)(n);s.current=n;let c=(0,Q.useRef)(e);c.current=e;let l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{l$(c.current)||s.current(c$)},[]),(0,Q.useEffect)(()=>{let t=()=>{l.current&&=(clearTimeout(l.current),null)},n=()=>{let e=c.current===$p.ERROR,t=e?`connectionLostNotice`:`connectionReconnectingNotice`,n=a.current(B.APPLICATION_LEVEL_STATUS_BAR,t),r=n.startsWith(`components.`)?hxe[t]:n;o.current(c$,e?`error`:`loading`,r),u.current=!0};l$(e)?i&&(u.current?n():l.current||=setTimeout(()=>{l.current=null,n()},mxe)):(t(),u.current&&=(s.current(c$),!1))},[e,i]),(0,Q.useEffect)(()=>()=>{l.current&&=(clearTimeout(l.current),null),u.current&&=(s.current(c$),!1)},[]),null},d$=class{name=Lo.CONSOLE;async initialize(){console.log(`[Analytics:Console] Initialized`)}identify(e){console.log(`[Analytics:Console] Identify:`,e)}track(e){console.log(`[Analytics:Console] Track: ${e.name}`,e.properties)}page(e,t){console.log(`[Analytics:Console] Page: ${e}`,t)}reset(){console.log(`[Analytics:Console] Reset`)}discard(){}async shutdown(){console.log(`[Analytics:Console] Shutdown`)}},gxe=50,_xe=1e4,vxe=20,f$=class{name=Lo.BACKEND_PROXY;buffer=[];flushInterval=null;httpClient;identity=null;generation=0;constructor(e){this.httpClient=e}async initialize(e){let t=e?.flushIntervalMs??_xe;this.flushInterval=setInterval(()=>this.flush(),t)}identify(e){this.identity!==null&&this.identity.userId!==e.userId&&(this.buffer=[],this.generation+=1),this.identity=e}track(e){this.buffer.push({...e,timestamp:e.timestamp??Date.now()}),this.buffer.length>=vxe&&this.flush()}page(e,t){this.track({name:dr.PAGE_VIEW,properties:{path:e,...t}})}reset(){let e=this.buffer,t=this.identity,n=this.credentialOf(t);this.generation+=1,this.buffer=[],this.identity=null,e.length!==0&&n!==null&&this.httpClient.postAnalyticsEvents({events:e},{sessionBoundCredential:n,silent:!0}).catch(()=>{})}credentialOf(e){let t=this.httpClient.getAuthToken();if(!t||!e)return null;try{return Ooe(t).userId===e.userId?t:null}catch{return null}}discard(){this.buffer=[],this.generation+=1}async shutdown(){this.flushInterval&&=(clearInterval(this.flushInterval),null),await this.flush()}async flush(){if(this.buffer.length===0)return;let e=this.credentialOf(this.identity);if(this.identity!==null&&e===null){this.buffer=this.buffer.slice(-50);return}let t=[...this.buffer],n=this.generation;this.buffer=[];try{await this.httpClient.postAnalyticsEvents({events:t},e===null?{silent:!0}:{sessionBoundCredential:e,silent:!0})}catch{if(n!==this.generation)return;this.buffer=[...t.slice(-50),...this.buffer].slice(0,gxe)}}},yxe={[Lo.CONSOLE]:()=>new d$,[Lo.BACKEND_PROXY]:e=>new f$(e)},p$=class{resolveFromConfig(e,t){return e.map(e=>yxe[e.providerType](t,e.config))}},bxe={current:null};function m$(){return(0,Q.useContext)(h$)||{track:()=>{},page:()=>{},isActive:!1,sessionStartTimestamp:Date.now(),achievedMoments:new Set,markMomentAchieved:()=>!1,_onTrackRef:bxe}}var xxe=({config:e,valueMoments:t,identity:n,progress:r})=>{let{track:i,page:a,isActive:o,sessionStartTimestamp:s,achievedMoments:c,markMomentAchieved:l,_onTrackRef:u}=m$(),{on:d,emit:f}=Mo(),p=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let m=(0,Q.useRef)(r.signals),h=(0,Q.useRef)(r.completed),g=(0,Q.useRef)(r.counts),_=(0,Q.useRef)(r.lastFired),v=(0,Q.useRef)(new Map),y=(0,Q.useRef)(i);(0,Q.useEffect)(()=>{y.current=i},[i]);let b=(0,Q.useRef)(l);(0,Q.useEffect)(()=>{b.current=l},[l]);let x=(0,Q.useMemo)(()=>t??[],[t]),S=(0,Q.useCallback)(e=>JSON.stringify([n.applicationId,e.scope,e.scope===la.ORGANIZATION?n.organizationId:n.userId,e]),[n.applicationId,n.userId,n.organizationId]),C=(0,Q.useCallback)(e=>{if((e.scope===la.ORGANIZATION?!n.organizationId:!n.userId)||e.role!==Xi.ANTI_PATTERN&&(c.has(e.identifier)||h.current.has(S(e)))||e.requires?.length&&!e.requires.every(e=>c.has(e))||e.beforeStage?.length&&e.beforeStage.some(e=>c.has(e)))return!1;if(e.role===Xi.ANTI_PATTERN){let t=e.cooldownMs??3e5,n=_.current.get(S(e));if(n&&Date.now()-n<t)return!1}return!0},[c,n,S]),w=(0,Q.useCallback)((e,t)=>{if(!p.current||!C(e))return;let n=e.identifier,r=S(e);m.current.has(r)||m.current.set(r,new Set);let i=m.current.get(r);if(i.add(t),e.mode!==nn.ANY&&i.size!==e.signals.length)return;e.role!==Xi.ANTI_PATTERN&&h.current.add(r);let a=()=>{if(!p.current)return;let r=e.role===Xi.ANTI_PATTERN?Xi.ANTI_PATTERN:ae;y.current(`${r}.${n}`,{signalIndex:e.mode===nn.ANY?t:void 0,signalType:e.mode===nn.ANY?e.signals[t].signalType:wte,elapsedMs:Date.now()-s,role:e.role,scope:e.scope}),e.onAchieved?.frontendEvent&&f(Ec.ANALYTICS_MOMENT_ACHIEVED,{momentIdentifier:n,role:e.role,scope:e.scope??la.USER,triggerSource:ad.FRONTEND})};e.role===Xi.ANTI_PATTERN?(_.current.set(r,Date.now()),a()):Promise.resolve(b.current(n)).then(e=>{e?a():h.current.delete(r)})},[C,s,f,S]),T=(0,Q.useCallback)((e,t)=>t?e?Object.entries(t).every(([t,n])=>e[t]===n):!1:!0,[]);return(0,Q.useEffect)(()=>{if(!o)return;let e=bc();for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==zt.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})},[o,x]),(0,Q.useEffect)(()=>{if(!o)return;let e=bc(),t=()=>{if(document.visibilityState===`visible`)for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==zt.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[o,x]),(0,Q.useEffect)(()=>{if(o)return d(Ec.NAVIGATION_ZONE_CHANGED,t=>{if(e?.pageViews&&a(window.location.pathname,{contentType:t.currentContent?.contentType,zone:t.zone,stackDepth:t.stackDepth}),t.currentContent){let e=t.currentContent;for(let t of x)t.signals.forEach((n,r)=>{n.signalType===zt.VIEW_VISIT&&e.contentType===n.contentType&&(!n.viewRef||`viewRef`in e&&e.viewRef===n.viewRef)&&w(t,r)})}})},[o,e?.pageViews,x,d,a,w]),(0,Q.useEffect)(()=>{if(o)return d(Ec.NOTIFY_RESOURCE_SUCCESS,t=>{e?.resourceOperations&&i(dr.RESOURCE_OPERATION,{resourceType:t.resourceType,operation:t.operationIdentifier});let n=t.resultSummary;for(let e of x)e.signals.forEach((r,i)=>{if(r.signalType===zt.RESOURCE_OPERATION&&t.resourceType===r.resourceType&&t.operationIdentifier===r.operation&&T(n,r.filter)&&p.current&&C(e)){if(r.threshold&&r.threshold>1){let t=JSON.stringify([S(e),i]),n=(g.current.get(t)??0)+1;if(g.current.set(t,n),n<r.threshold)return}w(e,i)}});let r=bc();for(let e of x)for(let n of e.signals){if(n.signalType!==zt.RESOURCE_STATE||t.resourceType!==n.resourceType)continue;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;r.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(t=>{if(!p.current)return;let r=t.totalCount??0;v.current.set(a,r),r>=n.threshold&&w(e,e.signals.indexOf(n))}).catch(()=>{})}})},[o,e?.resourceOperations,x,d,i,w,T,C,S]),(0,Q.useEffect)(()=>{if(o&&e?.trackErrors)return d(Ec.ERROR_OCCURED,e=>{i(dr.ERROR,{errorType:e.error?.type,errorSeverity:e.error?.severity})})},[o,e?.trackErrors,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.userLifecycle)return;let t=[d(Ec.USER_STATUS_CHANGED,e=>i(dr.USER_STATUS_CHANGED,{newStatus:e.newStatus,oldStatus:e.oldStatus}))];return()=>t.forEach(e=>e())},[o,e?.userLifecycle,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.notifications)return;let t=[d(Ec.NOTIFY_CUSTOM_INFO,e=>i(dr.NOTIFICATION,{level:Il.INFO,identifier:e.identifier})),d(Ec.NOTIFY_CUSTOM_SUCCESS,e=>i(dr.NOTIFICATION,{level:Il.SUCCESS,identifier:e.identifier})),d(Ec.NOTIFY_CUSTOM_WARNING,e=>i(dr.NOTIFICATION,{level:Il.WARNING,identifier:e.identifier})),d(Ec.NOTIFY_CUSTOM_ERROR,e=>i(dr.NOTIFICATION,{level:Il.ERROR,identifier:e.identifier}))];return()=>t.forEach(e=>e())},[o,e?.notifications,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.hotkeys)return;let t=[d(Ec.HOTKEY_COMMAND_MENU_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.COMMAND_MENU})),d(Ec.HOTKEY_SIDEBAR_TOGGLE,()=>i(dr.HOTKEY_USED,{key:hi.SIDEBAR_TOGGLE})),d(Ec.HOTKEY_NOTIFICATIONS_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.NOTIFICATIONS})),d(Ec.HOTKEY_QUICK_SWITCHER_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.QUICK_SWITCHER})),d(Ec.HOTKEY_SHORTCUTS_HELP,()=>i(dr.HOTKEY_USED,{key:hi.SHORTCUTS_HELP}))];return()=>t.forEach(e=>e())},[o,e?.hotkeys,d,i]),(0,Q.useEffect)(()=>{if(!o)return;let e=[d(Ec.MILESTONE_ACHIEVED,e=>{i(`milestone_achieved`,{milestoneRef:e.milestoneRef,category:e.category,points:e.points,scope:e.scope})}),d(Ec.LIFECYCLE_STAGE_CHANGED,e=>{i(`lifecycle_stage_changed`,{previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger})})];return()=>e.forEach(e=>e())},[o,d,i]),(0,Q.useEffect)(()=>{if(o)return u.current=(e,t)=>{for(let n of x)n.signals.forEach((r,i)=>{if(r.signalType===zt.CUSTOM_EVENT&&r.eventName===e){if(!p.current||!C(n))return;if(r.threshold&&r.threshold>1){let e=JSON.stringify([S(n),i]),t=(g.current.get(e)??0)+1;if(g.current.set(e,t),t<r.threshold)return}w(n,i)}r.signalType===zt.FEATURE_ACCESS&&e===dr.FEATURE_ACCESSED&&r.featureId===t?.featureId&&w(n,i)})},()=>{u.current=null}},[o,x,w,C,S,u]),null},h$=(0,Q.createContext)(null),g$=(0,Q.createContext)(null),Sxe=new p$,Cxe=`signed_in_at`,_$=({children:e})=>{let t=(0,Q.useContext)(Fi),{on:n}=Mo(),r=wm(ul.USER_PROGRESSION_STATE),i=(0,Q.useRef)([]),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(Date.now()).current,c=(0,Q.useMemo)(()=>t?.appConfig?.analytics,[t?.appConfig?.analytics]),[l,u]=(0,Q.useState)(null),d=(0,Q.useMemo)(()=>l??[],[l]);(0,Q.useEffect)(()=>n(Ec.USER_PREFERENCES_CHANGED,e=>{let t=()=>{S.current&&i.current.forEach(e=>e.discard())};if(e.privacy===null){t(),u([]);return}let n=e.privacy?.consentedPurposes;if(n!==void 0){let e=Nd(n);Ad(e,[Ld.ANALYTICS])||t(),u(e)}}),[n]);let f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!c?.enabled){o(!1);return}if(!(c.requiresConsent===!1||Ad(d,[Ld.ANALYTICS]))){i.current.forEach(e=>e.reset()),o(!1);return}let e=!1,t=bc(),n=[...Sxe.resolveFromConfig(c.providers??[],t)];return Promise.all(n.map(e=>e.initialize(c.providers?.find(t=>t.providerType===e.name)?.config).catch(t=>{console.warn(`[Analytics] Failed to initialize provider "${e.name}":`,t)}))).then(()=>{if(e)return;i.current=n;let t=f.current;t!==null&&n.forEach(e=>e.identify({userId:t})),o(!0),m(e=>e+1)}),()=>{e=!0,n.forEach(e=>e.shutdown().catch(()=>{})),i.current=[]}},[c,d]);let g=Dx(),_=(0,Q.useMemo)(()=>c?.enabled?g.filter(e=>e.providerCapabilities.includes(Dd.FRONTEND_PRODUCT_ANALYTICS)).map(e=>e.activation.handle).filter(Fse):[],[c?.enabled,g]),v=a||_.length>0,y=c?.autoInstrumentation?.userLifecycle===!0,b=(0,Q.useRef)(y);b.current=y;let x=c?.requiresConsent!==!1,S=(0,Q.useRef)(x);S.current=x;let C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(0),E=(0,Q.useCallback)(e=>{C.current=e,T(e=>e+1)},[]);(0,Q.useEffect)(()=>n(Ec.USER_LOGIN,e=>{f.current=e.userId,i.current.forEach(t=>t.identify({userId:e.userId})),e.establishment===mc.SIGNED_IN&&E({occurredAt:Date.now(),decided:!S.current,owedToBuiltIns:!0,owedToVendorSinks:!0})}),[n,E]),(0,Q.useEffect)(()=>n(Ec.USER_PREFERENCES_CHANGED,e=>{let t=C.current;if(t===null||!S.current||!e.privacy)return;let n=e.privacy.consentedPurposes;n!==void 0&&E(Ad(Nd(n),[Ld.ANALYTICS])?{...t,decided:!0}:null)}),[n,E]),(0,Q.useEffect)(()=>n(Ec.USER_LOGOUT,e=>{e.reason===j.SIGNED_OUT&&b.current&&h.current(dr.USER_LOGOUT),E(null),f.current=null,i.current.forEach(e=>e.reset())}),[n,E]);let[D,O]=(0,Q.useState)(null),k=(0,Q.useRef)(null),A=(0,Q.useCallback)(e=>{let t=Symbol();return k.current=t,O(e),()=>{k.current===t&&(k.current=null,O(null))}},[]),M=JSON.stringify(D),N=D?.userId??null;(0,Q.useEffect)(()=>{_.length!==0&&(N===null?_.forEach(e=>e.reset()):_.forEach(e=>e.identify({userId:N})))},[_,N]);let P=(0,Q.useRef)(M);P.current=M;let F=(0,Q.useRef)({signals:new Map,counts:new Map,lastFired:new Map,completed:new Set}),I=D?.userId?`${bn}${JSON.stringify([D.applicationId,la.USER,D.userId])}`:null,ee=D?.organizationId?`${bn}${JSON.stringify([D.applicationId,la.ORGANIZATION,D.organizationId])}`:null,L=JSON.stringify([I,ee]),R=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.scope===la.ORGANIZATION,[c?.valueMoments]),z=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.role!==Xi.ANTI_PATTERN,[c?.valueMoments]),[te,ne]=(0,Q.useState)({key:M,moments:new Set}),re=(0,Q.useMemo)(()=>te.key===M?te.moments:new Set,[te,M]),ie=(0,Q.useCallback)(e=>{ne(t=>({key:M,moments:typeof e==`function`?e(t.key===M?t.moments:new Set):e}))},[M]),ae=(0,Q.useCallback)(e=>{try{I&&localStorage.setItem(I,JSON.stringify([...e].filter(e=>!R(e)))),ee&&localStorage.setItem(ee,JSON.stringify([...e].filter(R)))}catch{}},[I,ee,R]);(0,Q.useEffect)(()=>{if(ie(new Set),c?.enabled&&D&&(D.userId||D.organizationId)){try{let e=new Set;for(let[t,n]of[[I,!1],[ee,!0]]){if(!t)continue;let r=localStorage.getItem(t);if(r)for(let t of JSON.parse(r))z(t)&&R(t)===n&&e.add(t)}ie(e)}catch{}if(c?.persistence?.backendSync&&r){let e=!1;return bc().getAnalyticsMomentsAchieved().then(t=>{if(e||P.current!==M)return;let n=t;n.moments&&ie(e=>{let t=new Set([...e,...n.moments].filter(z));return ae(t),t})}).catch(()=>{}),()=>{e=!0}}}},[c?.enabled,c?.persistence?.backendSync,r,L,M,ae,z,R]),(0,Q.useEffect)(()=>n(Ec.ANALYTICS_MOMENT_ACHIEVED,e=>{D&&e.triggerSource!==ad.FRONTEND&&e.role!==Xi.ANTI_PATTERN&&z(e.momentIdentifier)&&ie(t=>{let n=new Set(t);return n.add(e.momentIdentifier),ae(n),n})}),[n,ae,M,z]);let oe=(0,Q.useCallback)(e=>{if(!D||!z(e))return!1;let t=c?.valueMoments?.find(t=>t.identifier===e);if(t?.requires?.some(e=>!re.has(e))||t?.beforeStage?.some(e=>re.has(e)))return!1;let n=()=>P.current===M&&(ie(t=>{let n=new Set(t);return n.add(e),ae(n),n}),!0);return c?.persistence?.backendSync?bc().postAnalyticsMomentsAchieved({momentIdentifier:e,scope:t?.scope}).then(e=>e.success!==!1&&n()).catch(e=>{let t=e,r=t?.httpStatus??t?.response?.status;return r&&r>=400&&r<500?!1:n()}):n()},[c,ae,M,z,re]),se=(0,Q.useRef)(null),ce=(0,Q.useCallback)((e,t)=>{if(!v)return;let n={name:e,properties:t,timestamp:Date.now()};a&&i.current.forEach(e=>e.track(n)),_.forEach(n=>n.track({name:e,properties:t})),se.current?.(e,t)},[a,v,_]);h.current=ce,(0,Q.useEffect)(()=>{let e=C.current;if(e===null||!e.decided||!y)return;let t={name:dr.USER_LOGIN,timestamp:e.occurredAt},n=e.owedToBuiltIns,r=e.owedToVendorSinks;n&&a&&i.current.length>0&&(i.current.forEach(e=>e.track(t)),n=!1),r&&_.length>0&&(_.forEach(n=>n.track({name:t.name,properties:{[Cxe]:new Date(e.occurredAt).toISOString()}})),r=!1),(n!==e.owedToBuiltIns||r!==e.owedToVendorSinks)&&(C.current=n||r?{...e,owedToBuiltIns:n,owedToVendorSinks:r}:null)},[w,p,a,_,y]);let le=(0,Q.useCallback)((e,t)=>{v&&(a&&i.current.forEach(n=>n.page(e,t)),_.forEach(n=>n.page(e,t)))},[a,v,_]),ue=(0,Q.useMemo)(()=>({track:ce,page:le,isActive:v,sessionStartTimestamp:s,achievedMoments:re,markMomentAchieved:oe,_onTrackRef:se}),[ce,le,v,s,re,oe]);return(0,$.jsx)(g$.Provider,{value:A,children:(0,$.jsxs)(h$.Provider,{value:ue,children:[v&&D&&c&&(0,$.jsx)(xxe,{identity:D,progress:F.current,config:c.autoInstrumentation,valueMoments:c.valueMoments},`${M}:${JSON.stringify(c.valueMoments)}`),e]})})};function wxe(){let e=bm(),t=(0,Q.useContext)(g$);return(0,Q.useLayoutEffect)(()=>t?.({userId:e.currentUserId,organizationId:e.currentOrganizationId,applicationId:e.currentApplicationId,anonymousUserId:e.currentAnonymousUserId}),[t,e.currentUserId,e.currentOrganizationId,e.currentApplicationId,e.currentAnonymousUserId]),null}var v$=as.getLogger(),y$=v$.debugByType(`ResourceReadCacheBridge`);v$.setDebugTypeLogging(`ResourceReadCacheBridge`,!1);var b$=`read-cache`,x$=`VITE_RESOURCE_READ_CACHE`,Txe=`off`,Exe=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=up(),{getReadCache:a}=fm(),o=a();(0,Q.useEffect)(()=>{let e=xa.readOptionalEnvironmentValue(x$)?.toLowerCase()===Txe;o.setEnabled(!e),e&&v$.info(`Resource read cache disabled by environment`,{flag:x$})},[o]);let s=Zp(),c=s?.currentOrganizationId??null,l=(0,Q.useContext)(Fi)?.appIdentity?.applicationId??s?.currentApplicationId??null,u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(new Map),f=(0,Q.useRef)(new Map),p=(0,Q.useRef)(t);p.current=t;let m=(0,Q.useCallback)((e,t)=>{d.current.has(e)||(d.current.set(e,t),r({ownerKey:`${b$}:${e}`,resourceType:t.resourceType,scopeKey:t.scopeKey,scopeId:t.scopeId,contextResourceIdentifiers:{[`${t.scopeKey}Id`]:t.scopeId}}).then(n=>{d.current.get(e)===t&&(n?.success?(u.current.add(e),y$(`scope room confirmed`,{roomName:e})):(d.current.delete(e),y$(`scope room not confirmed; entries under it stay unservable`,{roomName:e})))}).catch(()=>{d.current.get(e)===t&&d.current.delete(e)}))},[r]),h=(0,Q.useRef)(m);h.current=m;let g=(0,Q.useCallback)(()=>{for(let[e,t]of d.current)i({ownerKey:`${b$}:${e}`,resourceType:t.resourceType,scopeKey:t.scopeKey,scopeId:t.scopeId,contextResourceIdentifiers:{[`${t.scopeKey}Id`]:t.scopeId}});d.current.clear(),u.current.clear(),f.current.clear()},[i]),_=(0,Q.useRef)(g);_.current=g,(0,Q.useEffect)(()=>{let e=o;return e.setCoverageAuthority({covers:(e,t)=>!p.current||t.length===0?!1:t.every(t=>u.current.has(rs(e,t.scopeKey,t.scopeId))),requestCoverage:(e,t)=>{for(let n of t){let t=rs(e,n.scopeKey,n.scopeId);d.current.has(t)||(p.current?h.current(t,{...n,resourceType:e}):(f.current.set(t,{...n,resourceType:e}),y$(`coverage deferred until the socket is up`,{roomName:t})))}}}),()=>{e.setCoverageAuthority(null),_.current()}},[o]),(0,Q.useEffect)(()=>{if(!t||f.current.size===0)return;let e=[...f.current.entries()];f.current.clear(),y$(`claiming coverage deferred during the connect window`,{rooms:e.length});for(let[t,n]of e)m(t,n)},[t,m]),(0,Q.useEffect)(()=>{o.setApplicationId(l)},[l,o]),(0,Q.useEffect)(()=>{o.setOrganizationId(c)},[c,o]);let v=(0,Q.useRef)(n);return(0,Q.useEffect)(()=>{let e=v.current;v.current=n,n<=1||n!==e&&(u.current.clear(),d.current.clear(),f.current.clear(),o.clear(),y$(`reconnected; coverage and cache reset`,{connectionCount:n}))},[n,o]),(0,Q.useEffect)(()=>{o.clear(),g(),y$(`organization scope changed; cache cleared`,{currentOrganizationId:c})},[c,o,g]),(0,Q.useEffect)(()=>{if(!t)return;let n=e(fa.RESOURCE_UPDATED,e=>{o.invalidateResourceType(e.resourceType),y$(`invalidated by resource update`,{resourceType:e.resourceType,deliveryTarget:e.deliveryTarget,isScopeRoom:e.deliveryTarget===Ja.SCOPE_ROOM_NOTIFICATION})}),r=e(fa.RESOURCE_DELETED,e=>{o.invalidateResourceType(e.resourceType)});return()=>{n(),r()}},[e,t,o]),null},S$;(function(e){e.CTRL=`ctrl`,e.ALT=`alt`,e.SHIFT=`shift`,e.META=`meta`,e.MOD=`mod`})(S$||={});function C$(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var w$=-100,T$={[ld.COMPONENT]:2,[ld.PAGE]:1,[ld.GLOBAL]:0};function E$(e){return e.length===1&&!/[a-z0-9]/i.test(e)}function D$(e){let t=e.split(`+`).map(e=>e.trim().toLowerCase()),n=[],r=``;for(let e of t)switch(e){case`ctrl`:case`control`:n.push(S$.CTRL);break;case`alt`:case`option`:n.push(S$.ALT);break;case`shift`:n.push(S$.SHIFT);break;case`meta`:case`cmd`:case`command`:case`win`:case`windows`:n.push(S$.META);break;case`mod`:n.push(S$.MOD);break;default:r=e}E$(r)&&(n=n.filter(e=>e!==S$.SHIFT));let i=C$(),a=[];return n.includes(S$.MOD)&&a.push(i?`⌘`:`Ctrl`),n.includes(S$.CTRL)&&a.push(i?`⌃`:`Ctrl`),n.includes(S$.ALT)&&a.push(i?`⌥`:`Alt`),n.includes(S$.SHIFT)&&a.push(i?`⇧`:`Shift`),n.includes(S$.META)&&a.push(i?`⌘`:`Win`),a.push(r.toUpperCase()),{modifiers:n,key:r,chord:[...[...n].sort(),r].join(`+`),display:a.join(i?``:`+`)}}function O$(e,t){let n=e.ctrlKey,r=e.altKey,i=e.shiftKey,a=e.metaKey,o=t.modifiers.includes(S$.MOD),s=C$(),c=t.modifiers.includes(S$.CTRL)||o&&!s,l=t.modifiers.includes(S$.ALT),u=t.modifiers.includes(S$.SHIFT),d=t.modifiers.includes(S$.META)||o&&s;return n!==c||r!==l||!E$(t.key)&&i!==u||a!==d?!1:e.key.toLowerCase()===t.key}var k$=(0,Q.createContext)(null);function A$(e,t){return e===t||e===ld.GLOBAL||t===ld.GLOBAL}var j$=({children:e,initialScope:t=ld.GLOBAL})=>{let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(new Map),[s,c]=(0,Q.useState)(0),l=(0,Q.useCallback)(e=>{let t=D$(e.shortcut),n=Array.from(o.current.values()).filter(n=>n.id!==e.id&&n.parsed.chord===t.chord&&A$(n.scope,e.scope));n.length>0&&console.warn(`[HotkeyRegistry] Duplicate shortcut "${e.shortcut}" detected. Precedence: priority, then scope specificity (component > page > global), then registration order. Declare \`priority\` on the one that should win, or give one of them a different chord.`,{incomingId:e.id,incomingPriority:e.priority??0,existing:n.map(e=>({id:e.id,priority:e.priority??0}))});let r={...e,enabled:e.enabled!==!1,preventDefault:e.preventDefault??!0,stopPropagation:e.stopPropagation??!1,parsed:t};return o.current.set(e.id,r),c(e=>e+1),()=>{o.current.delete(e.id),c(e=>e+1)}},[]),u=(0,Q.useCallback)(e=>{o.current.delete(e),c(e=>e+1)},[]),d=(0,Q.useCallback)((e,t)=>{let n=o.current.get(e);n&&(n.enabled=t,c(e=>e+1))},[]),f=(0,Q.useCallback)(()=>a(!0),[]),p=(0,Q.useCallback)(()=>a(!1),[]),m=(0,Q.useCallback)(()=>Array.from(o.current.values()),[]),h=(0,Q.useCallback)(e=>Array.from(o.current.values()).filter(t=>t.group===e),[]),g=(0,Q.useCallback)(()=>{let e=new Map;for(let t of o.current.values()){let n=t.parsed.chord,r=e.get(n)??[];r.push(t),e.set(n,r)}let t=[];for(let[n,r]of e.entries()){let e=r.filter(e=>r.some(t=>t.id!==e.id&&A$(t.scope,e.scope))).map(e=>e.id);e.length>1&&t.push({shortcut:n,hotkeyIds:e})}return t},[]);(0,Q.useEffect)(()=>{let e=e=>{if(i)return;let t=e.target,r=t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable;r&&t.closest(`[data-hotkey-passthrough]`)&&(r=!1);let a,s;for(let t of o.current.values()){if(!t.enabled||t.scope===ld.PAGE&&n!==ld.PAGE||t.scope===ld.COMPONENT&&n!==ld.COMPONENT||r&&t.scope!==ld.GLOBAL||!O$(e,t.parsed))continue;let i=[t.priority??0,T$[t.scope]];(s===void 0||i[0]>s[0]||i[0]===s[0]&&i[1]>s[1])&&(a=t,s=i)}{let t=a;if(t){try{t.handler()}catch(e){console.error(`Hotkey handler error for ${t.id}:`,e)}t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation()}}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n,i]);let _=(0,Q.useMemo)(()=>({register:l,unregister:u,setEnabled:d,setActiveScope:r,pause:f,resume:p,getHotkeys:m,getHotkeysByGroup:h,getConflicts:g,activeScope:n,isPaused:i}),[l,u,d,f,p,m,h,g,n,i]);return(0,$.jsx)(k$.Provider,{value:_,children:e})};function M$(){let e=(0,Q.useContext)(k$);if(!e)throw Error(`useHotkeyRegistry must be used within a HotkeyRegistryProvider`);return e}var N$=0;function Dxe(e,t,n={}){let{register:r}=M$(),i=(0,Q.useMemo)(()=>n.id??`hotkey-${++N$}`,[n.id]);return(0,Q.useEffect)(()=>{let a={id:i,shortcut:e,handler:t,description:n.description??e,scope:n.scope??ld.GLOBAL,enabled:n.enabled!==!1,group:n.group,preventDefault:n.preventDefault};return r(a)},[i,e,t,n.description,n.scope,n.enabled,n.group,n.preventDefault,r]),(0,Q.useMemo)(()=>D$(e),[e])}function Oxe(e){let{register:t}=M$();(0,Q.useEffect)(()=>{let n=[];for(let r of e){let e={id:r.id??`hotkey-batch-${++N$}`,shortcut:r.shortcut,handler:r.handler,description:r.description??r.shortcut,scope:r.scope??ld.GLOBAL,enabled:r.enabled!==!1,group:r.group};n.push(t(e))}return()=>{for(let e of n)e()}},[e,t])}function kxe(){let{pause:e,resume:t,isPaused:n}=M$();return{pause:e,resume:t,isPaused:n}}function Axe(){let{activeScope:e,setActiveScope:t}=M$();return{activeScope:e,setActiveScope:t}}function P$(e,t){let n=new Map;for(let t of e)n.set(t.event,t);if(t)for(let e of t)n.set(e.event,e);let r=e.map(e=>n.get(e.event));for(let i of t??[])e.some(e=>e.event===i.event)||r.push(n.get(i.event));return r}function jxe(e,t){switch(e){case void 0:return!0;case Vr.USER_SELF:return!!t.currentUserId;case Vr.ORGANIZATIONS:return!!t.currentOrganizationId;case Vr.APPLICATION:return!!t.currentApplicationId;case Vr.ANONYMOUS:return!!t.currentAnonymousUserId}}function Mxe(e,t){return Im(e,t)}function Nxe(e,t){if(!e)return!0;let n=Array.isArray(e)?e:e.features??[];return n.length===0?!0:(Array.isArray(e)?`OR`:e.mode??`OR`)===`OR`?n.some(e=>t.includes(e)):n.every(e=>t.includes(e))}function Pxe(e,t){return(e??[]).every(e=>t.includes(e))}function Fxe(e,t){return Pxe(e.requiredEngineCapabilities,t.enabledEngineCapabilities)&&bS(e.runtimeAvailability,t.runtimeContext)&&Mxe(e.requiredRoles,t.runtimeContext.effectiveRoles)&&Nxe(e.requiredFeatures,t.enabledFeatures)}function Ixe(e,t){if(e.target.kind!==gv.SUB_TABS)return e;let n=e.target.subTabs.filter(e=>bS(e.runtimeAvailability,t.runtimeContext));return n.length===0?null:n.length===e.target.subTabs.length?e:{...e,target:{...e.target,subTabs:n}}}function Lxe(e,t){let n=e.categories.filter(e=>jxe(e.scope,t.scopeIds)),r=new Set(n.map(e=>e.ref)),i=e.sections.flatMap(e=>{if(!r.has(e.categoryRef)||!Fxe(e,t))return[];let n=Ixe(e,t);return n?[n]:[]}),a=new Set(i.map(e=>e.categoryRef));return{categories:n.filter(e=>a.has(e.ref)),sections:i,defaultSectionRef:e.defaultSectionRef&&i.some(t=>t.ref===e.defaultSectionRef)?e.defaultSectionRef:i[0]?.ref}}var Rxe=[];function F$(){let e=Iv(),t=Zp(),n=(0,Q.useContext)(gh)?.resolvedFeatures,r=yS(),i=(0,Q.useContext)(Fi),a=i?.appIdentity?.applicationId??t?.currentApplicationId??null,o=i?.appConfig?.enabledEngineCapabilities??Rxe;return(0,Q.useMemo)(()=>Lxe(e,{scopeIds:{currentUserId:t?.currentUserId,currentOrganizationId:t?.currentOrganizationId,currentApplicationId:a,currentAnonymousUserId:t?.currentAnonymousUserId},enabledFeatures:n?.features??[],runtimeContext:r,enabledEngineCapabilities:o}),[e,t?.currentUserId,t?.currentOrganizationId,a,t?.currentAnonymousUserId,n?.features,r,o])}var zxe=Object.values(Fl).map(e=>`${e.i18nKey}.title`);function I$(){let{registry:e}=fm(),{compositeViews:t,fullCustomViews:n,flowsActorsViews:r}=Wg(),i=Zp(),a=(0,Q.useMemo)(()=>e?.resourceConfigurations?Object.keys(e.resourceConfigurations).filter(t=>e.resourceConfigurations[t]?.frontendConfiguration):[],[e]),o=(0,Q.useMemo)(()=>{let n=(t??[]).map(e=>GY(e.translationRef)),r=e?.resourceConfigurations?Object.values(e.resourceConfigurations).flatMap(e=>e.frontendConfiguration?.compositeViews?.map(e=>GY(e.translationRef))??[]):[];return Array.from(new Set([...n,...r]))},[t,e]),s=(0,Q.useMemo)(()=>{let t=[...(n??[]).map(e=>KY({family:au.FULL_CUSTOM,translationRef:qY(e.ref)})),...(r??[]).map(e=>KY({family:au.FLOWS_ACTORS,translationRef:qY(e.ref)}))],i=e?.resourceConfigurations?Object.entries(e.resourceConfigurations).flatMap(([e,t])=>[...t.frontendConfiguration?.chartViews?.map(t=>KY({family:au.CHART,translationRef:JY(e,t.ref)}))??[],...t.frontendConfiguration?.executionViews?.map(t=>KY({family:au.EXECUTION,translationRef:JY(e,t.ref)}))??[]]):[];return Array.from(new Set([...t,...i]))},[r,n,e]),{t:c,tResourceHeader:l,tResourceOperation:u,tCompositeView:d,tView:f,translations:p,isReady:m}=K({resource:a,keys:[...o,...s,...zxe,Qm]}),h=dS(),{sections:g}=Iv(),_=(0,Q.useMemo)(()=>{let e=new Map(g.map(e=>[e.ref,e.icon]));return t=>e.get(t)},[g]),v=(0,Q.useMemo)(()=>{let e=new Map(g.map(e=>[e.ref,e.label]));return t=>e.get(t)},[g]),{sections:y}=F$(),b=(0,Q.useMemo)(()=>ih(g.map(e=>e.ref),y.map(e=>e.ref)),[g,y]),x=(0,Q.useMemo)(()=>(e,t)=>ZY({viewRef:e,contentType:t,tCompositeView:d,tView:f}),[d,f]);return(0,Q.useMemo)(()=>!e||!m?null:{registry:e,contextResourceIdentifiers:i?.buildContextResourceIdentifiers()??{},views:{compositeViews:t,fullCustomViews:n,flowsActorsViews:r},tResourceHeader:l,tResourceOperation:u,tViewTitle:x,t:c,settingsSectionIcon:_,settingsSectionLabel:v,settingsSectionVisible:b,viewerRoles:h},[e,m,i,t,n,r,l,u,x,c,_,v,b,h,p])}var Bxe={[jn.HOTKEY_SIDEBAR_TOGGLE]:`engine.hotkeys.sidebarToggle`,[jn.HOTKEY_NOTIFICATIONS_OPEN]:`engine.hotkeys.notificationsOpen`,[jn.HOTKEY_QUICK_SWITCHER_OPEN]:`engine.hotkeys.quickSwitcherOpen`,[jn.HOTKEY_SHORTCUTS_HELP]:`engine.hotkeys.shortcutsHelp`},L$=[{event:jn.HOTKEY_SIDEBAR_TOGGLE,shortcut:`Mod+B`,scope:ld.GLOBAL,group:yi.NAVIGATION},{event:jn.HOTKEY_QUICK_SWITCHER_OPEN,shortcut:`Mod+P`,scope:ld.GLOBAL,group:yi.NAVIGATION},{event:jn.HOTKEY_NOTIFICATIONS_OPEN,shortcut:`Mod+I`,scope:ld.GLOBAL,group:yi.NAVIGATION}];function Vxe(e){return L$.includes(e)}function Hxe(e){switch(e){case jn.HOTKEY_QUICK_SWITCHER_OPEN:return Fr.QUICK_SWITCHER;case jn.HOTKEY_NOTIFICATIONS_OPEN:return Fr.NOTIFICATION_CENTER;default:return}}function R$(){let{register:e}=M$(),{emit:t}=Mo(),n=I$(),{navigate:r}=DS(),{appComponentsConfiguration:i}=Wg(),a=yS(),o=i?.[Fr.HOTKEY],s=typeof o==`object`&&o?o.bindings:void 0,c=(0,Q.useMemo)(()=>Qle(s,a),[s,a]),l=typeof o==`object`&&o?o.emitShortcuts:void 0,u=(0,Q.useMemo)(()=>P$(L$,l),[l]),d=(0,Q.useMemo)(()=>!c||!n?[]:Lh(c,n),[c,n]);return(0,Q.useEffect)(()=>{let i=[],a=e=>{let t=e.descriptionLabellingRef??Bxe[e.event];return n?n.t(t):t};for(let n of u)n.enabled!==!1&&i.push(e({id:`app-emit-${n.event}`,shortcut:n.shortcut,description:a(n),scope:n.scope??ld.GLOBAL,group:n.group,handler:()=>{switch(n.event){case jn.HOTKEY_SIDEBAR_TOGGLE:t(Ec.HOTKEY_SIDEBAR_TOGGLE,{});break;case jn.HOTKEY_NOTIFICATIONS_OPEN:t(Ec.HOTKEY_NOTIFICATIONS_OPEN,{});break;case jn.HOTKEY_QUICK_SWITCHER_OPEN:t(Ec.HOTKEY_QUICK_SWITCHER_OPEN,{});break;case jn.HOTKEY_SHORTCUTS_HELP:t(Ec.HOTKEY_SHORTCUTS_HELP,{})}},launcher:Hxe(n.event),preventDefault:n.preventDefault!==!1,priority:Vxe(n)?w$:void 0}));for(let t of d)i.push(e({id:`app-hotkey-${t.id}`,shortcut:t.shortcut,description:t.description??t.label,scope:t.scope??ld.GLOBAL,group:yi.ACTIONS,handler:()=>{dh.dispatchNavigationForResolvedTarget(r,t,Fr.HOTKEY)},launcher:Fr.HOTKEY,preventDefault:!0}));return()=>{for(let e of i)e()}},[e,t,d,r,u,n]),null}function z$({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_KBD,`Kbd`)(e);return(0,$.jsx)(n,{...t})}z$.displayName=`Kbd`;var B$=[yi.NAVIGATION,yi.ACTIONS,yi.HELP,`other`];function Uxe(e,t){switch(e){case yi.NAVIGATION:return t(`navigation`);case yi.ACTIONS:return t(`actions`);case yi.HELP:return t(`help`);default:return t(`other`)}}function V$(e,t){switch(e){case ld.GLOBAL:return t(`shortcutsHelpScopeGlobal`);case ld.PAGE:return t(`shortcutsHelpScopePage`);case ld.COMPONENT:return t(`shortcutsHelpScopeComponent`);default:return t(`shortcutsHelpScopeUnknown`)}}function H$(){let[e,t]=(0,Q.useState)(!1),{on:n}=Mo(),{getHotkeys:r,getConflicts:i,activeScope:a,isPaused:o}=M$(),{t:s,tComponent:c,isReady:l}=K({component:B.APPLICATION_LEVEL_COMMAND_MENU});(0,Q.useEffect)(()=>n(Ec.HOTKEY_SHORTCUTS_HELP,()=>{t(e=>!e)}),[n]);let u=(e,t)=>yp({tComponent:c,componentType:B.APPLICATION_LEVEL_COMMAND_MENU,key:e,params:t}),d=(0,Q.useMemo)(()=>e?r().slice().sort((e,t)=>{let n=B$.indexOf(e.group??`other`),r=B$.indexOf(t.group??`other`);return n===r?e.description.localeCompare(t.description):n-r}):[],[r,e]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d){let n=t.group??`other`,r=e.get(n)??[];r.push(t),e.set(n,r)}return B$.map(t=>({group:t,label:Uxe(t,u),hotkeys:e.get(t)??[]})).filter(e=>e.hotkeys.length>0)},[d,u]),p=(0,Q.useMemo)(()=>e?i():[],[i,e]);if(!l)return null;let m=Ap({t:s,key:`engine.hotkeys.shortcutsHelp`});return(0,$.jsx)(ZW,{open:e,onOpenChange:t,children:(0,$.jsxs)($W,{className:`max-w-3xl pt-10`,children:[(0,$.jsx)(tG,{children:(0,$.jsx)(rG,{children:m})}),(0,$.jsxs)(`div`,{className:`space-y-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[u(`shortcutsHelpActiveScope`),`: `,V$(a,u)]}),(0,$.jsxs)(`span`,{children:[u(`shortcutsHelpRegistry`),`: `,u(o?`shortcutsHelpRegistryPaused`:`shortcutsHelpRegistryListening`)]}),(0,$.jsx)(`span`,{children:u(`shortcutsHelpCount`,{count:d.length})})]}),p.length>0&&(0,$.jsxs)(`div`,{className:`rounded-md border border-warning/40 bg-warning/10 p-card-sm text-sm text-warning-foreground`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:u(`shortcutsHelpConflictsDetected`)}),(0,$.jsx)(`ul`,{className:`mt-item-xs space-y-item-xs`,children:p.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`code`,{children:e.shortcut}),` `,u(`shortcutsHelpConflictUsedBy`),` `,e.hotkeyIds.join(`, `)]},e.shortcut))})]}),(0,$.jsx)(lf,{className:`max-h-[60vh] pe-item-sm`,children:(0,$.jsx)(`div`,{className:`space-y-card`,children:f.map(({group:e,label:t,hotkeys:n})=>(0,$.jsxs)(`section`,{className:`space-y-item-sm`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:t}),(0,$.jsx)(`div`,{className:`space-y-item-xs`,children:n.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-field rounded-md border border-border/70 px-card-sm py-item-sm`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-[2px]`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:V$(e.scope,u)}),e.launcher&&(0,$.jsx)(`span`,{children:e.launcher}),(0,$.jsx)(`span`,{children:e.id})]})]}),(0,$.jsx)(z$,{children:e.parsed.display})]},e.id))})]},e))})})]})]})})}function Wxe(e){return typeof e==`string`?e:Ta.createOperationPathKey(e)}function Gxe(e,t){let n=e.resourceConfigurations[t.resourceIdentifier];return n&&n.operations.find(e=>{let n=Ta.extractOperationPath(e);if(n.operationIdentifier!==t.operationIdentifier||n.variantType!==t.variantType)return!1;if(t.isOperationDefault){if(!n.isOperationDefault)return!1}else{let e=t.variantKey;if((n.variantKey??void 0)!==(e??void 0))return!1}return n.variantType!==at.API_CALL||n.isBulkOperation===!0==(t.isBulkOperation===!0)})||null}function Kxe({children:e}){let t=fm(),n=Zp(),r=(0,Q.useCallback)(async(e,r,i)=>{if(!n)return t.doOperation(e,r,i);let a=Wxe(e),o=null;try{o=Ta.parseOperationPathKey(a)}catch{o=null}let s=o?Gxe(t.registry,o):null;if(!s)return t.doOperation(e,r,i);let c=n.buildContextualParameters(),l=r?.contextualParameters,u={...c,...l||{}},d=r,f=d?.parentChainIsExact===!0?void 0:ase({initiatorInfos:s.initiatorInfos,targetResourceType:s.resourceIdentifier,registry:t.registry,ownContextualParameters:{...Object.fromEntries(Object.entries(c).filter(([e])=>lse.has(e))),...l||{}},parentResourcesRequirements:d?.parentResourcesRequirements}),p={...r,contextualParameters:u,...f?{parentResourcesRequirements:f,parentChainIsExact:!0}:{}};return t.doOperation(e,p,i)},[n,t]),i=(0,Q.useCallback)(async e=>Hoe.evaluateEnabledCondition({...e,resourcesRegistry:t.registry,doOperation:r}),[t.registry,r]),a=(0,Q.useMemo)(()=>({...t,doOperation:r,evaluateOperationEnabled:i}),[t,r,i]);return(0,$.jsx)(sm.Provider,{value:a,children:e})}function qxe(){let e=Yh(),{notifyError:t}=Fm(),n=cp(),r=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(e?.error){let i=e.error.message;r.current!==i&&(r.current=i,t(n(e.error)))}else r.current=null},[e?.error,t,n]),null}function Jxe(){let{currentOrganizationId:e}=pg(),{isLoading:t,isFeatureEnabled:n,resolvedForOrganizationId:r}=Ch(),{doOperation:i,registry:a}=fm(),{emit:o,on:s}=Mo(),{httpClient:c}=Ou(),[l,u]=(0,Q.useState)(0),d=e??null,f=d!==null&&!t&&r===d&&n(ks.CUSTOM_BRANDING);return(0,Q.useEffect)(()=>s(Ec.RESOURCE_OPERATION_EXECUTED,()=>u(e=>e+1),e=>e.resourceType===ul.ORGANIZATION_PROFILES&&!da(e.operation??{operationIdentifier:e.operationIdentifier})),[s]),(0,Q.useEffect)(()=>{let e=!1,t=t=>{if(e)return;let n=d===null?void 0:Oi(t?.logo),r=n&&d!==null?`${c.getBaseURL().replace(/\/+$/,``)}${br}${Iee(d,Ao.LOGO,n.updatedAt)}`:null;o(Ec.ORGANIZATION_BRANDING_CHANGED,{organizationId:d,primaryColor:t?.primaryColor??null,secondaryColor:t?.secondaryColor??null,logoUrl:r,productName:t?.productName??null})},n=Zm(a.resourceConfigurations[ul.ORGANIZATION_PROFILES]);return!f||d===null||!n?(t(null),()=>{e=!0}):(i(Ta.buildOperationPathKeyFromOperation(n),{contextualParameters:{organizationId:d}}).then(e=>t(e?.branding)).catch(()=>t(null)),()=>{e=!0})},[d,f,i,a,o,l,c]),(0,Q.useEffect)(()=>()=>o(Ec.ORGANIZATION_BRANDING_CHANGED,{organizationId:null,primaryColor:null,secondaryColor:null,logoUrl:null,productName:null}),[o]),null}var U$=[{componentType:B.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT},{componentType:B.PUBLIC_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT}];function Yxe({children:e}){let{frontendConfiguration:t,markComponentInitialized:n}=Ou(),{on:r}=Mo(),i=(0,Q.useCallback)(e=>r(Ec.USER_PREFERENCES_CHANGED,t=>{Object.prototype.hasOwnProperty.call(t,`uiPreferences`)&&e(t.uiPreferences??null)}),[r]),a=(0,Q.useCallback)(e=>r(Ec.ORGANIZATION_BRANDING_CHANGED,t=>{e({primaryColor:t.primaryColor??null,secondaryColor:t.secondaryColor??null,logoUrl:t.logoUrl??null,productName:t.productName??null})}),[r]),o=(0,Q.useCallback)(()=>n(Pe.UI),[n]);return(0,$.jsx)(Kg,{frontendConfiguration:t,subscribeToUserPreferences:i,subscribeToOrganizationBranding:a,markInitialized:o,children:e})}function W$(e){return typeof e==`object`&&!!e}function G$(e){if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e===void 0)return`undefined`;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Xxe(e){return e.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function K$(e){if(typeof e==`string`&&e.trim().length!==0)return Xxe(e.trim())}function Zxe(e){if(W$(e)&&W$(e.initializationDiagnostics))return e.initializationDiagnostics}function Qxe(e,t){if(t&&W$(t.wildoError))return t.wildoError;if(W$(e)&&W$(e.wildoError))return e.wildoError}function $xe(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.filter(e=>typeof e==`object`&&!!e);return n.length>0?n:null}catch{return null}}function eSe(e,t,n){return t&&typeof t.errorMessage==`string`&&t.errorMessage.trim().length>0?t.errorMessage:n&&W$(n.context)&&typeof n.context.message==`string`?n.context.message:e instanceof Error?e.message:typeof e==`string`?e:G$(e)}function tSe(e){if(!e)return[];let t=[];if(Array.isArray(e.unresolvedFKFields))for(let n of e.unresolvedFKFields){let e=typeof n?.resourceType==`string`?n.resourceType:`unknown-resource`,r=typeof n?.fieldName==`string`?n.fieldName:`unknown-field`;t.push(`${e}.${r}: foreign key cannot be resolved to a resource type`)}if(typeof e.message==`string`){let n=e.message.split(`
24
- `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`[ResourcesRegistry]`)&&!e.startsWith(`Fix:`));for(let e of n)e.startsWith(`- `)?t.push(e.slice(2)):t.includes(e)||t.push(e)}let n=[[`Resource type`,e.resourceType],[`Foreign key field`,e.foreignKeyField],[`Method`,e.method],[`Existing type`,e.existingType],[`New type`,e.newType]];for(let[e,r]of n)typeof r==`string`&&r.trim().length>0&&t.push(`${e}: ${r}`);return Array.from(new Set(t)).slice(0,6)}function q$(e){let t=[{label:`Application`,value:e.startupAppName}],n=K$(e.diagnostics?.phase);return n&&t.push({label:`Failed step`,value:n}),typeof e.diagnostics?.frontendServiceName==`string`&&e.diagnostics.frontendServiceName.trim().length>0&&t.push({label:`Frontend service`,value:e.diagnostics.frontendServiceName}),typeof e.diagnostics?.apiBaseUrl==`string`&&e.diagnostics.apiBaseUrl.trim().length>0&&t.push({label:`API base URL`,value:e.diagnostics.apiBaseUrl}),typeof e.wildoError?.customMessageReference==`string`&&e.wildoError.customMessageReference.trim().length>0&&t.push({label:`Error reference`,value:e.wildoError.customMessageReference}),typeof e.wildoError?.type==`string`&&e.wildoError.type.trim().length>0&&t.push({label:`Error type`,value:e.wildoError.type}),t}function nSe(e){return!e||e.length===0?`root`:e.map(e=>typeof e==`string`?e:String(e)).join(` > `)}function rSe(e,t){let n=Zxe(e),r=Qxe(e,n),i=eSe(e,n,r),a=$xe(i),o=G$(n?{...n,rawError:e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e}:e);if(a){let e=a.slice(0,6).map(e=>`${nSe(e.path)}: ${e.message??`Invalid configuration value`}`);return{title:`Application configuration is invalid`,description:`Startup stopped because the frontend configuration failed validation in ${a.length} place${a.length===1?``:`s`}.`,highlights:e,technicalDetails:JSON.stringify(a,null,2),remainingIssueCount:Math.max(a.length-e.length,0),contextRows:q$({diagnostics:n,wildoError:r,startupAppName:t})}}let s=tSe(r&&W$(r.context)?r.context:void 0),c=K$(n?.phase),l=i===`configuration`||typeof r?.customMessageReference==`string`&&r.customMessageReference===`configuration`,u=[c?`Startup stopped during ${c}.`:void 0,i&&i!==`configuration`?i:void 0,!i||i===`configuration`?`Open the technical details to inspect the full startup diagnostics.`:void 0].filter(e=>!!e);return{title:l?`Application configuration is invalid`:`Application initialization failed`,description:u.join(` `),highlights:s,technicalDetails:o,remainingIssueCount:0,contextRows:q$({diagnostics:n,wildoError:r,startupAppName:t})}}function J$({options:e}){let t=(0,Q.useMemo)(()=>lie(e.featureConfiguration),[e.featureConfiguration]),n=(0,Q.useMemo)(()=>as.getLogger(),[]),r=(0,Q.useMemo)(()=>{let e=n.debugByType(`ApplicationMainContext`);return n.setDebugTypeLogging(`ApplicationMainContext`,!1),e},[n]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)({[Pe.MAIN_CONTEXT]:!1,[Pe.UI]:!1,[Pe.LOADER]:!1,[Pe.ERRORS]:!1,[Pe.ROUTER]:!1,[Pe.I18N]:!1,[Pe.APP_MAIN_CONTAINER]:!1,[Pe.PUBLIC_APP_CONTAINER]:!1}),m=(0,Q.useCallback)(e=>e[Pe.MAIN_CONTEXT]&&e[Pe.UI]&&e[Pe.APP_MAIN_CONTAINER]&&e[Pe.PUBLIC_APP_CONTAINER],[]),h=(0,Q.useCallback)(e=>{p(t=>{let n={...t,[e]:!0},i=Object.entries(n).filter(([e,t])=>!t).map(([e])=>e);return r(`Component initialized: ${e}`,{newStatus:n,allComponentsReady:m(n),missingComponents:i}),m(n)&&(r(`All components initialized, setting isInitialized=true`),a(!0)),n})},[m,r]),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useMemo)(()=>{let t=e.env.VITE_APP_NAME?.trim();return t&&t.length>0?t:`Application`},[e.env]),b=(0,Q.useMemo)(()=>o?rSe(o,y):null,[o,y]);(0,Q.useEffect)(()=>{r(`useEffect triggered`,{initializationStartedRef:g.current,initializationFailedRef:_.current,hasApplicationServices:!!c,isInitialized:i,currentInitializationStatus:f}),c&&!i?(r(`Services exist but not initialized, restoring core components`),h(Pe.MAIN_CONTEXT),h(Pe.LOADER),h(Pe.ERRORS),h(Pe.ROUTER),h(Pe.APP_MAIN_CONTAINER),h(Pe.PUBLIC_APP_CONTAINER),r(`Marked container components for hot reload (they will re-mark themselves when rendered)`)):g.current||_.current?(r(`Skipping initialization (already started/failed)`),_.current&&!o&&s(`Initialization previously failed. Click Retry to try again.`)):(async()=>{g.current=!0;try{Ui.initializeGlobalErrorHandlers(),xa.injectEnvironmentVariables(tH(e.env,window.location));let i=xa.loadEnvironmentConfig(),a={apiBaseUrl:e.apiBaseUrl??i.apiBaseUrl};d(a);let o=await XQ.initializeApplication({config:a,autoAuth:!1,frontendProviderModules:e.frontendProviderModules,customShared_ResourcesConfigurationsFactoryMap:e.customShared_ResourcesConfigurationsFactoryMap,customShared_ResourceFieldIdentifier:e.customShared_ResourceFieldIdentifier,customShared_ResourcesRelationships:e.customShared_ResourcesRelationships,excludedResourceTypes:e.excludedResourceTypes,resourceUIBehavior:e.resourceUIBehavior,notificationBadgeDefinitions:e.notificationBadgeDefinitions,baseFrontendConfig:e.baseFrontendConfig,frontendConfigOverrides:e.frontendConfigOverrides,featureConfiguration:t,componentLoader:async()=>{await e.componentLoader(),Fo.assertRequiredRegistrations(`SaaS application`,U$)},onInitialized:()=>{r(`Application initialized successfully`)},onError:e=>{n.error(`Application initialization failed`,{error:e.message,details:e}),s(e)}});Fo.assertRequiredRegistrations(`SaaS application`,U$),l(o),h(Pe.MAIN_CONTEXT),h(Pe.LOADER),h(Pe.ERRORS),h(Pe.ROUTER)}catch(e){_.current=!0;let t=e instanceof Error?e.message:`Unknown initialization error`;s(e),n.error(`Application initialization failed`,{error:t,details:e})}})()},[e,c,i]);let x=(0,Q.useCallback)(()=>{_.current=!1,g.current=!1,window.location.reload()},[]),S=(0,Q.useRef)(window.location.pathname.startsWith(`/one-off-session/`)),C=(0,Q.useMemo)(()=>S.current?new nm:void 0,[]);if(o&&b)return xa.readEnvironmentMode()===`development`?(0,$.jsx)(`div`,{className:`min-h-screen w-screen bg-background px-6 py-10 md:px-10`,children:(0,$.jsx)(`div`,{className:`mx-auto flex min-h-[calc(100vh-5rem)] max-w-5xl items-center justify-center`,children:(0,$.jsxs)(`div`,{role:`alert`,className:`w-full overflow-hidden rounded-2xl border border-border bg-card shadow-sm`,children:[(0,$.jsx)(`div`,{className:`border-b border-border bg-muted/40 px-6 py-5 md:px-8`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive`,children:`!`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium uppercase tracking-wide text-destructive`,children:`Initialization failed`}),(0,$.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-foreground`,children:b.title}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-muted-foreground`,children:b.description})]})]})}),(0,$.jsxs)(`div`,{className:`space-y-6 px-6 py-6 md:px-8`,children:[b.contextRows.length>0?(0,$.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:b.contextRows.map(e=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-foreground`,children:e.value})]},`${e.label}:${e.value}`))}):null,b.highlights.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`What needs attention`}),(0,$.jsx)(`div`,{className:`grid gap-2`,children:b.highlights.map(e=>(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/30 px-3 py-2 font-mono text-xs leading-5 text-foreground`,children:e},e))}),b.remainingIssueCount>0?(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`And `,b.remainingIssueCount,` more issue`,b.remainingIssueCount===1?``:`s`,` in the technical details below.`]}):null]}):null,(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The application will not automatically retry. Fix the underlying issue, then reload the app to start a fresh initialization attempt.`}),(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,$.jsx)(`button`,{onClick:x,className:`inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90`,children:`Retry initialization`})})]}),(0,$.jsxs)(`details`,{className:`group rounded-xl border border-border bg-background`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer list-none px-4 py-3 text-sm font-medium text-foreground`,children:[(0,$.jsx)(`span`,{className:`group-open:hidden`,children:`Show technical details`}),(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:`Hide technical details`})]}),(0,$.jsx)(`div`,{className:`border-t border-border px-4 py-4`,children:(0,$.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/30 p-4 font-mono text-xs leading-5 text-foreground`,children:b.technicalDetails})})]})]})]})})}):(0,$.jsx)(exe,{onRetry:x});if(!c||!u){let e=Object.entries(f).filter(([e,t])=>!t).map(([e])=>e);return r(`Still loading`,{isInitialized:i,hasApplicationServices:!!c,hasConfig:!!u,initializationStatus:f,missingComponents:e}),(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(ib,{size:48})})}let w=(0,$.jsx)(Jy,{children:(0,$.jsx)(Bm,{children:(0,$.jsx)(fb,{children:(0,$.jsx)(op,{children:(0,$.jsxs)(rm,{tokenStorage:C,children:[(0,$.jsx)(tb,{}),(0,$.jsx)(SH,{children:(0,$.jsxs)(Tm,{children:[(0,$.jsx)(Exe,{}),(0,$.jsx)(a$,{}),(0,$.jsx)(wxe,{}),(0,$.jsx)(yh,{customRoles:e.customRoles,children:(0,$.jsx)(Lm,{children:(0,$.jsx)(nS,{children:(0,$.jsxs)(jh,{productDefinitions:e.productDefinitions,children:[(0,$.jsx)(qxe,{}),(0,$.jsxs)(lg,{featureConfiguration:t,children:[(0,$.jsx)(Jxe,{}),(0,$.jsx)(Kxe,{children:(0,$.jsx)(gU,{children:(0,$.jsx)(bW,{children:(0,$.jsxs)(th,{children:[(0,$.jsx)(R$,{}),(0,$.jsx)(H$,{}),(0,$.jsx)(Zbe,{})]})})})})]})]})})})})]})})]})})})})});v.current===null&&(v.current=ug([{path:`/*`,element:w,errorElement:(0,$.jsx)(Qy,{})}]));let T=v.current;return(0,$.jsx)(pt,{children:(0,$.jsx)(Em,{children:(0,$.jsx)(Fi.Provider,{value:{appConfig:c.appConfigFromBackend,appIdentity:c.appConfigFromBackend.appIdentity,appPreferences:c.appConfigFromBackend.appPreferences,runtime:c.appConfigFromBackend.runtime,auth:c.appConfigFromBackend.auth,compliance:c.appConfigFromBackend.compliance,frontendConfiguration:c.frontendConfiguration,logger:c.logger,httpClient:c.httpClient,frontendProviderRegistry:c.frontendProviderRegistry,providerComponentRegistry:c.providerComponentRegistry,...e.shellCompanions?{shellCompanions:e.shellCompanions}:{},isInitialized:i,version:c.appConfigFromBackend.appIdentity?.version??`1.0.0`,initializationStatus:f,markComponentInitialized:h},children:(0,$.jsx)(Yxe,{children:(0,$.jsx)(bi,{children:(0,$.jsx)(fu,{children:(0,$.jsx)(Hm,{children:(0,$.jsx)(j$,{children:(0,$.jsx)(Xp,{resourcesRepository:c.resourceRepository,children:(0,$.jsx)(kx,{children:(0,$.jsx)(_$,{children:(0,$.jsx)($Q,{children:(0,$.jsxs)(Cz,{apiBaseUrl:u.apiBaseUrl,children:[(0,$.jsx)(s$,{}),(0,$.jsx)(yve,{}),(0,$.jsx)(u$,{}),(0,$.jsx)(ZQ,{}),(0,$.jsx)(QQ,{}),(0,$.jsx)(nH,{router:T})]})})})})})})})})})})})})})}function iSe(e){let t=ym()?.registry,n=dS(),{resourceType:r,operationIdentifier:i,variantKey:a}=e;return(0,Q.useMemo)(()=>{let e=t?.resourceConfigurations?.[r]?.operations;return e?e.filter(e=>String(e.operationIdentifier)===String(i)).filter(e=>a===void 0||e.variantKey===a).filter(e=>e.variantType===void 0||dte.includes(e.variantType)).some(e=>Um({...e,resourceType:r},n)):!1},[t,r,i,a,n])}var aSe=[Cl.SECONDARY,Cl.COMPANION];function oSe(e){let{zones:t,viewport:n,contentAreaWidth:r,reconcileCollapsedZones:i,navigationState:a}=e;(0,Q.useEffect)(()=>{i(aSe.map(e=>({zone:e,mode:ag({zoneConfig:t?.[e],viewport:n,contentAreaWidth:r}),contentModel:t?.[e]?.contentModel})))},[t,n,r,i,a])}function Y$(e){return e.contentType===sd.COMPOSITE_VIEW||e.contentType===sd.CHART_VIEW||e.contentType===sd.FULL_CUSTOM_VIEW||e.contentType===sd.FLOWS_ACTORS_VIEW||e.contentType===sd.EXECUTION_VIEW}function X$(e,t={}){let{keepOperationTitle:n=!1}=t,r=e?.content?.contentType===sd.RESOURCE_OPERATION?e.content.resourceContext.resourceType:void 0,i=(0,Q.useMemo)(()=>{if(e?.content.contentType!==sd.COMPOSITE_VIEW)return[];let t=YY(e.content.viewRef);return t?[GY(t)]:[]},[e]),a=(0,Q.useMemo)(()=>{let t=e?.content;if(!t||!Y$(t)||t.contentType===sd.COMPOSITE_VIEW)return[];let n=XY({viewRef:t.viewRef,contentType:t.contentType});return n?[KY(n)]:[]},[e]),o=ym()?.registry.resourceConfigurations[r??``]?.operations,{tResourceOperation:s,tCompositeView:c,tView:l}=K({resource:r,keys:[...i,...a]});return(0,Q.useMemo)(()=>{if(!e)return{title:``};let{content:t}=e;if(t.contentType===sd.RESOURCE_OPERATION){let{resourceType:e,operationIdentifier:r}=t.resourceContext,i=n?String(r):ao(r,o);return{title:s(e,i,`title`)}}return Y$(t)?{title:ZY({viewRef:t.viewRef,contentType:t.contentType,tCompositeView:c,tView:l})}:t.contentType===sd.SETTINGS_HUB?{title:`Settings`}:{title:``}},[e,o,n,c,s,l])}function sSe(){let e=(0,Q.useContext)(DH),t=Zp()?.currentOrganizationId,{getZoneState:n}=zx();return(0,Q.useCallback)(r=>sse({entryOrganizationId:og(r.content),entryOwnsBrowserUrl:Gh(r,n),currentOrganizationId:t,routeDecision:e}),[e,t,n])}var cSe=({wildoError:e})=>{let t=cp();return(0,$.jsx)(`div`,{className:`space-y-element`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground whitespace-pre-wrap`,children:t(e)})})},Z$=Qs(B.LOW_LEVEL_RESIZABLE_PANEL_GROUP,`ResizablePanelGroup`,[`Panel`,`Handle`]);function Q$({preset:e=q.DEFAULT,...t}){let n=Z$(e);return(0,$.jsx)(n,{...t})}function $$({preset:e=q.DEFAULT,...t}){let n=Z$(e);return(0,$.jsx)(n.Panel,{...t})}function e1({preset:e=q.DEFAULT,...t}){let n=Z$(e);return(0,$.jsx)(n.Handle,{...t})}var t1=Qs(B.LOW_LEVEL_SHEET,`Sheet`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function n1({preset:e=q.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n,{...t})}var r1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});r1.displayName=`SheetTrigger`;var i1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});i1.displayName=`SheetContent`;function lSe({preset:e=q.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Close,{...t})}function a1({preset:e=q.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Header,{...t})}function o1({preset:e=q.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Footer,{...t})}var s1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});s1.displayName=`SheetTitle`;var c1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});c1.displayName=`SheetDescription`;var l1=Qs(B.LOW_LEVEL_DRAWER,`Drawer`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function u1({preset:e=q.DEFAULT,...t}){let n=l1(e);return(0,$.jsx)(n,{...t})}var d1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=l1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});d1.displayName=`DrawerTrigger`;var f1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=l1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});f1.displayName=`DrawerContent`;function p1({preset:e=q.DEFAULT,...t}){let n=l1(e);return(0,$.jsx)(n.Close,{...t})}function m1({preset:e=q.DEFAULT,...t}){let n=l1(e);return(0,$.jsx)(n.Header,{...t})}function h1({preset:e=q.DEFAULT,...t}){let n=l1(e);return(0,$.jsx)(n.Footer,{...t})}var g1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=l1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});g1.displayName=`DrawerTitle`;var _1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=l1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});_1.displayName=`DrawerDescription`;function v1({requestedMode:e,isMobileViewport:t,mobileShape:n}){if(e===Or.DIALOG&&t){if(n===`drawer`)return Or.DRAWER;if(n===`sheet`)return Or.SHEET}return e}function y1(){let e=null;return{resolve(t){let n=v1(t);return t.open===!0?(e??=n,e):(e=null,n)},reset(){e=null}}}var b1=({open:e,onOpenChange:t,trigger:n,anchor:r,title:i,titleVisuallyHidden:a,description:o,children:s,footer:c,config:l,surfacePolicyOverride:u,className:d,cancelText:f,confirmText:p,onConfirm:m,onCancel:h,commandPlaceholder:g,commandItems:_=[]})=>{let{mode:v,...y}=l,[b,x]=(0,Q.useState)(!1),S=e??b,C=(0,Q.useCallback)(n=>{e===void 0&&x(n),t?.(n)},[t,e]),{isMobile:w,getSurfacePolicy:T}=Wg(),E=(0,Q.useRef)(null);E.current===null&&(E.current=y1());let D=T?.(nt.OVERLAY,u),O=E.current.resolve({open:S,requestedMode:v,isMobileViewport:w,mobileShape:D?.geometry?.mobileShape}),{tComponent:k,isReady:A}=K({component:[B.LOW_LEVEL_OVERLAY_CONTAINER,B.LOW_LEVEL_DIALOG,B.LOW_LEVEL_SHEET,B.LOW_LEVEL_DRAWER]}),j=(e,t)=>yp({tComponent:k,componentType:B.LOW_LEVEL_OVERLAY_CONTAINER,key:e,params:t}),M=f??j(`cancel`),N=p??j(`confirm`),P=g??j(`commandPlaceholder`),F=j(`commandEmpty`),I=j(`commandGroup`),ee=j(`close`),L=vSe(O,k),R=i||L,z=a||!i,te=(0,Q.useMemo)(()=>l.closeOnEscape===!1?e=>e.preventDefault():void 0,[l.closeOnEscape]);if(!A)return null;switch(O){case Or.DIALOG:return(0,$.jsx)(S1,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.ALERT:return(0,$.jsx)(uSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,cancelText:M,confirmText:N,onConfirm:m,onCancel:h,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.SHEET:return(0,$.jsx)(dSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.DRAWER:return(0,$.jsx)(fSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.COMMAND:return(0,$.jsx)(pSe,{open:e,onOpenChange:C,placeholder:P,emptyLabel:F,groupLabel:I,items:_,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.POPOVER:return(0,$.jsx)(mSe,{open:e,onOpenChange:C,trigger:n,anchor:r,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.LIGHTBOX:return(0,$.jsx)(hSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,closeLabel:ee,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.ACTION_SHEET:return(0,$.jsx)(gSe,{open:e,onOpenChange:C,trigger:n,title:R,cancelText:M,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.TOAST:return null;default:return(0,$.jsx)(S1,{open:e,onOpenChange:C,trigger:n,title:R,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s})}};function x1(e){return e?{}:{"aria-describedby":void 0}}var S1=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u,onEscapeKeyDown:d})=>{let f=_Se(s.size);return(0,$.jsxs)(ZW,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(QW,{asChild:!0,children:n}),(0,$.jsxs)($W,{surfacePolicyOverride:c,className:U(f,l),...x1(a),onEscapeKeyDown:d,children:[i&&!a?r&&(0,$.jsx)(rG,{className:`sr-only`,children:r}):(r||a)&&(0,$.jsxs)(tG,{children:[r&&(0,$.jsx)(rG,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(iG,{children:a})]}),u,o&&(0,$.jsx)(nG,{children:o})]})]})},uSe=({open:e,onOpenChange:t,trigger:n,title:r,description:i,cancelText:a,confirmText:o,onConfirm:s,onCancel:c,config:l,surfacePolicyOverride:u,className:d,children:f,onEscapeKeyDown:p})=>(0,$.jsxs)(Uw,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(Ww,{asChild:!0,children:n}),(0,$.jsxs)(Gw,{surfacePolicyOverride:u,className:d,onEscapeKeyDown:p,children:[(0,$.jsxs)(Kw,{children:[r&&(0,$.jsx)(Jw,{children:r}),i&&(0,$.jsx)(Yw,{children:i})]}),f,(0,$.jsxs)(qw,{children:[(0,$.jsx)(Zw,{onClick:c,children:a}),(0,$.jsx)(Xw,{onClick:s,children:o})]})]})]}),dSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u,onEscapeKeyDown:d})=>{let f=s.side??$s.END,p=typeof f==`string`&&!Object.values($s).includes(f)?f:Gl(f,document.documentElement.dir===`rtl`?`rtl`:`ltr`);return(0,$.jsxs)(n1,{open:e,onOpenChange:t,modal:s.modal??!0,children:[n&&(0,$.jsx)(r1,{asChild:!0,children:n}),(0,$.jsxs)(i1,{surfacePolicyOverride:c,side:p,className:l,...x1(a),onEscapeKeyDown:d,showBackdrop:s.showBackdrop??!0,onPointerDownOutside:s.closeOnOutsideClick===!1?e=>e.preventDefault():void 0,onInteractOutside:s.closeOnOutsideClick===!1?e=>e.preventDefault():void 0,children:[(r||a)&&(0,$.jsxs)(a1,{children:[r&&(0,$.jsx)(s1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(c1,{children:a})]}),u,o&&(0,$.jsx)(o1,{children:o})]})]})},fSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u})=>(0,$.jsxs)(u1,{open:e,onOpenChange:t,direction:`bottom`,snapPoints:s.snapPoints,dismissible:s.closeOnEscape!==!1&&s.dismissible,children:[n&&(0,$.jsx)(d1,{asChild:!0,children:n}),(0,$.jsxs)(f1,{surfacePolicyOverride:c,className:l,...x1(a),children:[(r||a)&&(0,$.jsxs)(m1,{children:[r&&(0,$.jsx)(g1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(_1,{children:a})]}),(0,$.jsx)(`div`,{className:`px-container pb-card`,children:u}),o&&(0,$.jsx)(h1,{children:o})]})]}),pSe=({open:e,onOpenChange:t,placeholder:n,emptyLabel:r,groupLabel:i,items:a,surfacePolicyOverride:o,className:s,children:c})=>(0,$.jsxs)(xV,{open:e,onOpenChange:t,surfacePolicyOverride:o,children:[(0,$.jsx)(SV,{placeholder:n}),(0,$.jsxs)(CV,{className:s,children:[(0,$.jsx)(wV,{children:r}),a.length>0&&(0,$.jsx)(TV,{heading:i,children:a.map(e=>(0,$.jsxs)(EV,{onSelect:e.onSelect,children:[(0,$.jsx)(`span`,{children:e.label}),e.shortcut&&(0,$.jsx)(z$,{className:`ms-auto`,children:e.shortcut})]},e.id))}),c]})]}),mSe=({open:e,onOpenChange:t,trigger:n,anchor:r,surfacePolicyOverride:i,className:a,children:o,onEscapeKeyDown:s})=>(0,$.jsxs)(sq,{open:e,onOpenChange:t,children:[r&&(0,$.jsx)(uq,{asChild:!0,children:(0,$.jsx)(`span`,{ref:r})}),n&&(0,$.jsx)(cq,{asChild:!0,children:n}),(0,$.jsx)(lq,{surfacePolicyOverride:i,className:a,onEscapeKeyDown:s,children:o})]}),hSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,closeLabel:a,surfacePolicyOverride:o,className:s,children:c,onEscapeKeyDown:l})=>{let{getRecipe:u}=Wg(),d=u(cc.OVERLAY_BACKDROP);return(0,$.jsxs)(ZW,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(QW,{asChild:!0,children:n}),(0,$.jsxs)($W,{surfacePolicyOverride:o,showCloseButton:!1,onEscapeKeyDown:l,...x1(void 0),className:U(`max-w-[90vw] max-h-[90vh] p-0 overflow-hidden`,d.base,s),children:[(0,$.jsxs)(eG,{className:`absolute top-4 end-4 z-(--z-transient) text-white hover:text-white/80`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:a}),(0,$.jsx)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})]}),(0,$.jsx)(`div`,{className:`flex items-center justify-center min-h-[50vh]`,children:c}),i?(0,$.jsx)(rG,{className:`sr-only`,children:r}):(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 p-card bg-gradient-to-t from-black/80 to-transparent`,children:(0,$.jsx)(rG,{className:`text-white text-center text-base font-normal tracking-normal leading-normal`,children:r})})]})]})},gSe=({open:e,onOpenChange:t,trigger:n,title:r,cancelText:i,surfacePolicyOverride:a,className:o,children:s})=>(0,$.jsxs)(u1,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(d1,{asChild:!0,children:n}),(0,$.jsxs)(f1,{surfacePolicyOverride:a,className:o,children:[r&&(0,$.jsx)(m1,{className:`text-center`,children:(0,$.jsx)(g1,{className:`text-sm font-normal text-muted-foreground`,children:r})}),(0,$.jsx)(`div`,{className:`px-card-sm pb-card`,children:s}),(0,$.jsx)(h1,{className:`pt-element border-t`,children:(0,$.jsx)(p1,{asChild:!0,children:(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,children:i})})})]})]});function _Se(e){switch(e){case`sm`:return`max-w-sm`;case`md`:return`max-w-md`;case`lg`:return`max-w-lg`;case`xl`:return`max-w-xl`;case`full`:return`max-w-[95vw] max-h-[95vh]`;default:return`max-w-lg`}}function vSe(e,t){switch(e){case Or.DIALOG:return yp({tComponent:t,componentType:B.LOW_LEVEL_DIALOG,key:`defaultTitle`});case Or.SHEET:return yp({tComponent:t,componentType:B.LOW_LEVEL_SHEET,key:`defaultTitle`});case Or.DRAWER:return yp({tComponent:t,componentType:B.LOW_LEVEL_DRAWER,key:`defaultTitle`});default:return``}}b1.displayName=`OverlayContainer`;var ySe=`w-full max-w-md overflow-y-auto`,bSe=`max-w-2xl max-h-[90vh] overflow-y-auto pt-10 data-[vaul-drawer-direction=bottom]:max-w-none data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:pt-0`,C1=`w-full h-[min(92vh,56rem)] p-0 gap-0 overflow-hidden`,xSe=`${C1} max-w-6xl`,SSe=`${C1} max-w-[min(94vw,88rem)]`;function CSe(e){return e?SSe:xSe}function w1(e){switch(e){case Rn.SHEET:return Or.SHEET;case Rn.DRAWER:return Or.DRAWER;case Rn.DIALOG:default:return Or.DIALOG}}function wSe(e){return e===Or.SHEET?ySe:bSe}var TSe=[W.LIST,W.SEARCH];function T1(e){return e.kind===gv.SUB_TABS?e.subTabs.map(e=>e.target):[e]}function ESe(e){return e===cr.VERTICAL_TABS}var DSe={[_v.SECURITY]:!1,[_v.APPEARANCE]:!1,[_v.INVITATIONS]:!1,[_v.BILLING]:!0,[_v.CONNECTED_ACCOUNTS]:!1,[_v.ORGANIZATION_CONNECTED_ACCOUNTS]:!1,[_v.APPLICATION_CONNECTED_ACCOUNTS]:!1,[_v.AGENT_WORK_OVERRIDE_RATE]:!1,[_v.AUTONOMOUS_AGENTS]:!1,[_v.MODEL_COST_BREAKDOWN]:!1,[_v.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN]:!1,[_v.REPRESENTATIVE_ACTIVITY]:!1,[_v.AGENT_WORK_EVALUATION_EXPORT]:!1};function OSe(e){return e.kind===gv.ENGINE_PANEL?DSe[e.panelRef]:e.kind===gv.RESOURCE_OPERATION&&TSe.includes(String(e.operation))}function kSe(e){return T1(e).some(OSe)}function ASe(e,t,n){if(!t)return!1;let r=e.find(e=>e.ref===t);return r?kSe(r.target)?!0:T1(r.target).some(e=>e.kind===gv.RESOURCE_OPERATION&&ESe(n(e.resourceType))):!1}function E1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_SEPARATOR,`Separator`)(e);return(0,$.jsx)(n,{...t})}var D1;(function(e){e.ACTIVE=`active`,e.INACTIVE=`inactive`,e.UNAVAILABLE=`unavailable`})(D1||={});var jSe={[D1.ACTIVE]:`success`,[D1.INACTIVE]:`outline`,[D1.UNAVAILABLE]:`secondary`},O1=({icon:e,title:t,description:n,state:r,statusLabel:i,meta:a,action:o,children:s})=>{let{renderIcon:c}=Mf(),l=r===D1.ACTIVE;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item py-group first:pt-0 last:pb-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:U(`flex size-9 shrink-0 items-center justify-center rounded-md`,l?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:c(e,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:t}),(0,$.jsx)(If,{variant:jSe[r],children:i})]}),!l&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n}),a]}),o&&(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:o})]}),s&&(0,$.jsx)(`div`,{className:`flex flex-col gap-item ps-[calc(var(--spacing)*9+var(--sp-item))]`,children:s})]})},MSe=()=>{let{auth:e}=Ou(),{auth:t,signOutEverywhere:n}=hm(),{user:r}=pg(),i=$x(),a=cp(),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w=(0,Q.useMemo)(()=>pb(u.map(e=>vd(e.providerRef))),[u]),{tComponent:T,t:E,isReady:D,formatDate:O}=K({component:[B.APP_LAYOUTS_SECURITY_SETTINGS,B.PUBLIC_LAYOUTS_USER_REGISTER,B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED],keys:w}),k=(0,Q.useCallback)((e,t)=>T(B.APP_LAYOUTS_SECURITY_SETTINGS,e,t),[T]),A=(0,Q.useCallback)(e=>T(B.PUBLIC_LAYOUTS_USER_REGISTER,e),[T]),j=e?.passkeyConfig,M=i.userTypeAuth?.methodManagement,N=i.passwordPolicy,P=j?.maxPasskeysPerUser??10,F=M?.allowUserMethodRemoval??!0,I=(0,Q.useCallback)(async()=>{p(!0),h(null);try{let e=bc(),[t,n,r]=await Promise.all([e.getMyMethods(),e.passkeyList().catch(()=>({credentials:[]})),e.getIdentityLinks().catch(()=>({links:[]}))]);s(t.methods??[]),l(n.credentials??[]),d(r.links??[])}catch(e){h(a(e,k(pu.ERROR)))}finally{p(!1)}},[k,a]);(0,Q.useEffect)(()=>{I()},[I]),(0,Q.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>_(null),5e3);return()=>clearTimeout(e)},[g]);let ee=st.getEnrollableSecondFactorMethods(),L=o.filter(e=>e.enrolled&&ee.includes(e.method)).map(e=>e.method),R=qm.evaluateAccountCompleteness(t.identification?.requiresMFA??!1,t.identification?.secondFactorMethods?.map(e=>e.method)??[],L.length>0?L:t.enrolledSecondFactorMethods,i.userTypeAuth?.mfaPolicy?.acceptableMFAMethods??[]),z=o.some(e=>e.method===_s.PASSWORD&&e.enrolled),te=o.some(e=>e.method===_s.TOTP&&e.enrolled),ne=o.find(e=>e.method===_s.SMS_OTP),re=ne?.enrolled??!1,ie=ne?.details?.phoneNumber,ae=(0,Q.useMemo)(()=>u.map(t=>({...t,providerLabel:mb({providerRef:t.providerRef,displayName:e?.socialOAuth2Providers?.[t.providerRef]?.displayName,translate:E})})),[e?.socialOAuth2Providers,u,E]),oe=(0,Q.useCallback)(async()=>{if(!(c.length>=P)&&typeof window<`u`&&window.PublicKeyCredential){C(!0),h(null);try{let e=bc(),t=await e.passkeyRegisterOptions(),n=await hp({optionsJSON:t});await e.passkeyRegisterVerify({response:n}),_(k(pu.SUCCESS)),I()}catch(e){if(ri(e))return;let t=e?.name===`NotAllowedError`?k(pu.PASSKEY_CANCELLED):a(e,k(pu.ERROR));h(t)}finally{C(!1)}}},[P,c.length,I,k,a]),se=(0,Q.useCallback)(async e=>{if(F)try{await bc().passkeyRemove(e),_(k(pu.SUCCESS)),I()}catch(e){ri(e)||h(a(e,k(pu.ERROR)))}},[F,I,k,a]),ce=(0,Q.useCallback)(async()=>{try{await bc().mfaTOTPDisable(),_(k(pu.SUCCESS)),y(!1),I()}catch(e){ri(e)||h(a(e,k(pu.ERROR)))}},[I,k,a]),le=(0,Q.useCallback)(async e=>{if(F)try{await bc().unlinkIdentityLink(e),_(k(pu.SUCCESS)),I()}catch(e){ri(e)||h(a(e,k(pu.ERROR)))}},[F,I,k,a]);if(!D)return null;let ue=typeof window<`u`&&!!window.PublicKeyCredential,de=ue?c.length>0?D1.ACTIVE:D1.INACTIVE:D1.UNAVAILABLE,fe=e=>{switch(e){case D1.ACTIVE:return k(pu.STATUS_ACTIVE);case D1.UNAVAILABLE:return k(pu.STATUS_UNAVAILABLE);case D1.INACTIVE:return k(pu.STATUS_NOT_CONFIGURED)}},pe=(0,$.jsxs)(O1,{icon:TX[_s.PASSKEY],title:k(pu.SECTION_PASSKEYS),description:k(pu.PASSKEYS_DESCRIPTION),state:de,statusLabel:fe(de),action:ue&&c.length<P?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:oe,disabled:S,children:k(S?pu.PASSKEY_ADDING:pu.PASSKEY_ADD)}):void 0,children:[!ue&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:k(pu.PASSKEY_UNSUPPORTED)})}),ue&&c.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:c.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.name}),e.createdAt&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:k(pu.PASSKEY_ADDED,{date:O(e.createdAt)})})]}),F&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>se(e.credentialId),children:k(pu.PASSKEY_REMOVE)})]},e.credentialId))})]}),me=te?D1.ACTIVE:D1.INACTIVE,he=(0,$.jsx)(O1,{icon:TX[_s.TOTP],title:k(pu.SECTION_TOTP),description:k(pu.TOTP_DESCRIPTION),state:me,statusLabel:fe(me),action:te?F?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ce,children:k(pu.TOTP_DISABLE)}):void 0:v?void 0:(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>y(!0),children:k(pu.TOTP_SETUP)}),children:te?(0,$.jsx)($.Fragment,{children:R.enrolledMethods.length===1&&R.enrolledMethods.includes(_s.TOTP)&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:k(pu.TOTP_ONLY_MFA_WARNING)})})}):v?(0,$.jsx)(XX,{onComplete:()=>{y(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null}),ge=re?D1.ACTIVE:D1.INACTIVE,_e=(0,$.jsx)(O1,{icon:TX[_s.SMS_OTP],title:k(pu.SECTION_PHONE),description:k(pu.PHONE_DESCRIPTION),state:ge,statusLabel:fe(ge),meta:re&&ie?(0,$.jsx)(Z,{className:`text-sm`,children:ie}):void 0,action:re?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>x(!0),children:k(pu.PHONE_CHANGE)}):b?void 0:(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>x(!0),children:k(pu.PHONE_VERIFY)}),children:re&&!b?null:b?(0,$.jsx)(QX,{onComplete:()=>{x(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:k(pu.PAGE_TITLE)}),m&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:m})}),g&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:g})}),f?(0,$.jsx)(Z,{className:`text-muted-foreground`,children:k(pu.LOADING)}):(0,$.jsx)(EF,{children:(0,$.jsxs)(NF,{className:`flex flex-col divide-y divide-border p-card`,children:[pe,he,_e,(0,$.jsx)(NSe,{hasPassword:z,passwordPolicy:N,userEmail:r?.email,t:k,tPolicy:A,onSuccess:()=>{_(k(pu.SUCCESS)),I()},onError:e=>h(e)}),(0,$.jsx)(FSe,{links:ae,allowRemoval:F,t:k,onUnlink:le})]})}),!f&&(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`flex flex-col divide-y divide-border p-card`,children:(0,$.jsx)(PSe,{t:k,formatDate:O,onSignOutEverywhere:n,onError:e=>h(a(e))})})})]})},NSe=({hasPassword:e,passwordPolicy:t,userEmail:n,t:r,tPolicy:i,onSuccess:a,onError:o})=>{let s=cp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=Fw({defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),p=Fw({defaultValues:{newPassword:``,confirmPassword:``}}),m=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(pu.PASSWORD_MISMATCH));else{l(!0);try{await bc().passwordChange(e.currentPassword,e.newPassword),a(),f.reset(),d(!1)}catch(e){ri(e)||o(s(e,r(pu.ERROR)))}finally{l(!1)}}},[f,o,a,r,s]),h=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(pu.PASSWORD_MISMATCH));else{l(!0);try{await bc().passwordSet(e.newPassword),a(),p.reset(),d(!1)}catch(e){ri(e)||o(s(e,r(pu.ERROR)))}finally{l(!1)}}},[o,a,p,r,s]),g=e?D1.ACTIVE:D1.INACTIVE;return(0,$.jsx)(O1,{icon:TX[_s.PASSWORD],title:r(pu.SECTION_PASSWORD),description:r(pu.PASSWORD_DESCRIPTION),state:g,statusLabel:r(e?pu.STATUS_ACTIVE:pu.STATUS_NOT_CONFIGURED),action:u?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>{d(!1),f.reset(),p.reset()},children:r(pu.CANCEL)}):(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>d(!0),children:r(e?pu.PASSWORD_CHANGE:pu.PASSWORD_SET)}),children:u?e?(0,$.jsx)(KC,{...f,children:(0,$.jsxs)(`form`,{onSubmit:f.handleSubmit(m),className:`space-y-4`,children:[(0,$.jsx)(yZ,{email:n}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:r(pu.PASSWORD_CURRENT)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`current-password`,...f.register(`currentPassword`,{required:!0})})]}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:r(pu.PASSWORD_NEW)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`new-password`,...f.register(`newPassword`,{required:!0})}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:r(pu.PASSWORD_CONFIRM)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`new-password`,...f.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(pu.PASSWORD_CHANGE)})]})}):(0,$.jsx)(KC,{...p,children:(0,$.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,$.jsx)(yZ,{email:n}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:r(pu.PASSWORD_NEW)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`new-password`,...p.register(`newPassword`,{required:!0})}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(fx,{children:[(0,$.jsx)(px,{children:r(pu.PASSWORD_CONFIRM)}),(0,$.jsx)(QM,{type:`password`,autoComplete:`new-password`,...p.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(pu.PASSWORD_SET)})]})}):null})},PSe=({t:e,formatDate:t,onSignOutEverywhere:n,onError:r})=>{let{renderIcon:i}=Mf(),{t:a}=K(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(r);m.current=r,(0,Q.useEffect)(()=>{let e=!1;return bc().listMySessions().then(t=>{e||d(t.sessions)}).catch(t=>{e||(d([]),m.current(t))}),()=>{e=!0}},[]);let h=(0,Q.useCallback)(async e=>{p(e);let t=()=>d(t=>t?.filter(t=>t.sessionId!==e)??null);try{await bc().revokeMySession(e),t()}catch(e){e?.httpStatus===404?t():m.current(e)}finally{p(null)}},[]),g=(e,t)=>{let n=Pc(e,t),r=a(n);return r===n?os(t):r},_=t=>e(pu.SESSION_DEVICE,{browser:g(ji.BROWSER,t.browser??pne.OTHER),operatingSystem:g(ji.OPERATING_SYSTEM,t.operatingSystem??Gie.OTHER)}),v=n=>n.ipAddress?e(pu.SESSION_DETAILS,{address:n.ipAddress,lastActive:t(n.lastActiveAt)}):e(pu.SESSION_LAST_ACTIVE,{lastActive:t(n.lastActiveAt)}),y=(0,Q.useCallback)(async()=>{l(!0);try{await n()}catch(e){l(!1),s(!1),r(e)}},[n,r]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:i(H.LOGOUT,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:e(pu.SECTION_SESSIONS)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e(pu.SIGN_OUT_EVERYWHERE_DESCRIPTION)})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>s(!0),disabled:c,children:e(pu.SIGN_OUT_EVERYWHERE)})}),(0,$.jsx)(Uw,{open:o,onOpenChange:e=>{!e&&!c&&s(!1)},children:(0,$.jsxs)(Gw,{children:[(0,$.jsxs)(Kw,{children:[(0,$.jsx)(Jw,{children:e(pu.SIGN_OUT_EVERYWHERE_CONFIRM_TITLE)}),(0,$.jsx)(Yw,{children:e(pu.SIGN_OUT_EVERYWHERE_CONFIRM_DESCRIPTION)})]}),(0,$.jsxs)(qw,{children:[(0,$.jsx)(Zw,{disabled:c,children:e(pu.CANCEL)}),(0,$.jsx)(Xw,{disabled:c,onClick:e=>{e.preventDefault(),y()},children:e(pu.SIGN_OUT_EVERYWHERE)})]})]})})]}),u&&u.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element ps-[calc(var(--spacing)*9+var(--sp-item))]`,"aria-label":e(pu.SECTION_SESSIONS),children:u.map(t=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,"data-session-id":t.sessionId,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element-xs`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:_(t)}),t.isCurrent&&(0,$.jsx)(If,{variant:`secondary`,children:e(pu.SESSION_THIS_DEVICE)})]}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:v(t)})]}),!t.isCurrent&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:f===t.sessionId,onClick:()=>{h(t.sessionId)},children:e(pu.SESSION_SIGN_OUT)})]},t.sessionId))})]})},FSe=({links:e,allowRemoval:t,t:n,onUnlink:r})=>(0,$.jsx)(O1,{icon:TX[_s.EXTERNAL_OAUTH2],title:n(pu.SECTION_IDENTITY_LINKS),description:n(pu.IDENTITY_LINKS_DESCRIPTION),state:e.length>0?D1.ACTIVE:D1.INACTIVE,statusLabel:n(e.length>0?pu.STATUS_ACTIVE:pu.STATUS_NOT_CONFIGURED),children:e.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.providerLabel}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:e.providerEmail})]}),t&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>r(e._id),children:n(pu.IDENTITY_LINKS_UNLINK)})]},e._id))})});function ISe(e,t,n){let r=e.resourceConfigurations[t];return r?r.operations.find(e=>e.operationIdentifier===n&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)??null:null}function k1(){let{themePreference:e,setTheme:t}=Wg(),{doOperation:n,registry:r}=fm();return{themePreference:e,selectTheme:(0,Q.useCallback)(e=>{t(e);let i=ISe(r,ul.USER_SELF_PREFERENCES,W.UPDATE);if(!i)return;let a=Ta.buildOperationPathKeyFromOperation(i);n(a,{contextualParameters:{},requestData:{ui:{theme:e}}}).catch(()=>{})},[n,r,t])}}var LSe=[ls.LIGHT,ls.DARK,ls.AUTO],RSe={[ls.LIGHT]:`themeLight`,[ls.DARK]:`themeDark`,[ls.AUTO]:`themeSystem`},zSe=[hl.BACKGROUND,hl.FOREGROUND,hl.MUTED,hl.MUTED_FOREGROUND,hl.PRIMARY,hl.BORDER];function A1(e,t,n){let r=r=>{let i=e?.[r]??t?.[r];return i?see(i,n):`var(--${r})`};return zSe.reduce((e,t)=>({...e,[t]:r(t)}),{})}var j1=({palette:e,className:t})=>(0,$.jsxs)(`div`,{className:U(`flex h-full w-full gap-[3px] p-[5px]`,t),style:{backgroundColor:e[hl.BACKGROUND]},children:[(0,$.jsxs)(`div`,{className:`flex w-1/4 shrink-0 flex-col gap-[3px] rounded-[3px] p-[3px]`,style:{backgroundColor:e[hl.MUTED]},children:[(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[hl.PRIMARY]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-3/4 rounded-full`,style:{backgroundColor:e[hl.MUTED_FOREGROUND],opacity:.5}}),(0,$.jsx)(`div`,{className:`h-[3px] w-2/3 rounded-full`,style:{backgroundColor:e[hl.MUTED_FOREGROUND],opacity:.5}})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-[4px] rounded-[3px] border p-[4px]`,style:{backgroundColor:e[hl.MUTED],borderColor:e[hl.BORDER]},children:[(0,$.jsx)(`div`,{className:`h-[4px] w-2/3 rounded-full`,style:{backgroundColor:e[hl.FOREGROUND]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[hl.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`h-[3px] w-4/5 rounded-full`,style:{backgroundColor:e[hl.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`mt-auto h-[6px] w-2/5 rounded-[2px]`,style:{backgroundColor:e[hl.PRIMARY]}})]})]}),BSe=({option:e,light:t,dark:n})=>e===ls.AUTO?(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-16 w-full overflow-hidden rounded-md border`,children:[(0,$.jsx)(`div`,{className:`w-1/2 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full w-[200%]`,children:(0,$.jsx)(j1,{palette:t})})}),(0,$.jsx)(`div`,{className:`w-1/2 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`ms-[-100%] h-full w-[200%]`,children:(0,$.jsx)(j1,{palette:n})})})]}):(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-16 w-full overflow-hidden rounded-md border`,children:(0,$.jsx)(j1,{palette:e===ls.DARK?n:t})}),VSe=()=>{let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_APPEARANCE_SETTINGS}),{designSystemConfiguration:n}=Wg(),{themePreference:r,selectTheme:i}=k1(),a=(0,Q.useCallback)(t=>e(B.APP_LAYOUTS_APPEARANCE_SETTINGS,t),[e]),o=(0,Q.useMemo)(()=>A1(n?.tokens,n?.customTokens,xs.LIGHT),[n]),s=(0,Q.useMemo)(()=>A1(n?.tokens,n?.customTokens,xs.DARK),[n]);return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(SF,{value:r,onValueChange:e=>i(e),"aria-label":a(`themeHeading`),className:`grid-cols-1 gap-item sm:grid-cols-3`,children:LSe.map(e=>{let t=`appearance-theme-${e}`;return(0,$.jsxs)(VX,{htmlFor:t,className:U(`flex cursor-pointer flex-col gap-element rounded-lg border p-card-sm font-normal transition-colors`,r===e?`border-primary ring-1 ring-primary`:`hover:border-primary/40`),children:[(0,$.jsx)(BSe,{option:e,light:o,dark:s}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-xs`,children:[(0,$.jsx)(CF,{id:t,value:e}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:a(RSe[e])})]})]},e)})})]}):null},HSe=[ai.ROLES],USe=bd().min(1),WSe=()=>{let{tComponent:e,tRole:t,isReady:n,formatDateTime:r}=K({component:B.APP_LAYOUTS_INVITATIONS_SETTINGS,keys:HSe}),{refreshOrganizations:i}=pg(),a=(0,Q.useCallback)((t,n)=>e(B.APP_LAYOUTS_INVITATIONS_SETTINGS,t,n),[e]),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(a);b.current=a;let x=(0,Q.useCallback)(async()=>{p(!0),_(null);try{let e=bc(),[t,n]=await Promise.allSettled([e.listMyPendingInvitations(),e.listMyRelationshipInvitations()]);s(t.status===`fulfilled`?t.value.invitations??[]:[]),l(n.status===`fulfilled`?n.value.invitations??[]:[]),[t,n].find(e=>e.status===`rejected`)?.status===`rejected`&&_(b.current(`errorGeneric`))}catch{_(b.current(`errorGeneric`))}finally{p(!1)}},[]);(0,Q.useEffect)(()=>{x()},[x]),(0,Q.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>y(null),5e3);return()=>clearTimeout(e)},[v]);let S=(0,Q.useCallback)(async e=>{h(e),_(null);try{await bc().acceptMyInvitation(e),await i(),y(a(`acceptSuccess`)),await x()}catch(e){ri(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,i,a]),C=(0,Q.useCallback)(async e=>{h(e),_(null);try{await bc().rejectMyInvitation(e),y(a(`rejectSuccess`)),await x()}catch(e){ri(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,a]),w=(0,Q.useCallback)(async(e,t)=>{h(e),_(null);try{y(await t()),await x()}catch(e){jr(e)&&await x(),ri(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,a]),T=(0,Q.useCallback)(e=>{let t=u[e.invitationId]??e.receivingOrganizations[0]?.organizationId,n=e.receivingOrganizations.find(e=>e.organizationId===t);if(n)return w(e.invitationId,async()=>(await bc().receiveMyRelationshipInvitation(e.invitationId,n.organizationId),a(`relationshipReceiveSuccess`,{representingOrganization:e.representingOrganizationName??a(`unknownRepresentingOrganization`),organization:n.organizationName??a(`unknownOrganization`)})))},[u,w,a]),E=(0,Q.useCallback)(e=>w(e.invitationId,async()=>(await bc().declineMyRelationshipInvitation(e.invitationId),a(`relationshipDeclineSuccess`))),[w,a]);if(!n)return null;let D=o.length===0&&c.length===0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),g&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:g})}),v&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:v})}),(f||D)&&(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`p-card`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(f?`loading`:`empty`)})})}),!f&&o.length>0&&(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:o.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-section py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.organizationName??a(`unknownOrganization`)}),e.roles.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`rolesPrefix`),` `,e.roles.map(e=>t(e,`label`)).join(`, `)]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:m===e.membershipId,onClick:()=>C(e.membershipId),children:a(`rejectButton`)}),(0,$.jsx)(X,{size:Y.SM,disabled:m===e.membershipId,onClick:()=>S(e.membershipId),children:a(`acceptButton`)})]})]},e.membershipId))})})}),!f&&c.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`invitations-settings-relationships`,className:`flex flex-col gap-group`,children:[(0,$.jsx)(`h4`,{id:`invitations-settings-relationships`,className:`text-sm font-semibold`,children:a(`relationshipInvitationsHeading`)}),(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>{let n=e.receivingOrganizations,i=u[e.invitationId]??n[0]?.organizationId,o=m===e.invitationId;return(0,$.jsxs)(`li`,{className:`flex flex-col gap-group py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.representingOrganizationName??a(`unknownRepresentingOrganization`)}),e.purpose&&(0,$.jsx)(Z,{className:`text-sm`,children:e.purpose}),e.role&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`relationshipRolePrefix`),` `,t(e.role,`label`)]}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:a(`relationshipExpires`,{date:r(e.expiresAt)})})]}),n.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`relationshipNoReceivingOrganization`)}):n.length===1?(0,$.jsx)(Z,{className:`text-sm`,children:a(`relationshipReceivesInto`,{organization:n[0].organizationName??a(`unknownOrganization`)})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(VX,{htmlFor:`field-receiving-organization-${e.invitationId}`,children:a(`relationshipReceivingOrganizationLabel`)}),(0,$.jsx)(mF,{name:`receiving-organization-${e.invitationId}`,schema:USe,options:n.map(e=>({value:e.organizationId,label:e.organizationName??a(`unknownOrganization`)})),value:i,disabled:o,onChange:t=>d(n=>({...n,[e.invitationId]:t}))})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:o,onClick:()=>E(e),children:a(`relationshipDeclineButton`)}),n.length>0&&(0,$.jsx)(X,{size:Y.SM,disabled:o||!i,onClick:()=>T(e),children:a(`relationshipReceiveButton`)})]})]},e.invitationId)})})})})]})]})};function M1(e){return pb([e?vd(e):void 0])}function N1(e){if(e.providerRef)return mb({providerRef:e.providerRef,translate:e.translate})}function P1({preset:e=q.DEFAULT,...t}){let n=Yh(),r=cp(),i=_h(),a=(0,Q.useMemo)(()=>M1(n?.billingProviderRef),[n?.billingProviderRef]),{tBillingProduct:o,t:s,isReady:c}=K({keys:[`billing_products`,...a]}),l=G(B.LOW_LEVEL_BILLING_SUBSCRIPTION_STATUS,`SubscriptionStatus`)(e),u=t.status??n?.subscription?.status??null,d=t.planName??(n?.currentPlanKey?o(n.currentPlanKey,`name`):null),f=t.providerName??N1({providerRef:n?.billingProviderRef,translate:s}),p=t.currentPeriodEnd??n?.subscription?.currentPeriodEnd??null,m=t.cancelAtPeriodEnd??n?.subscription?.cancelAtPeriodEnd,h=t.trialEnd===void 0?n?.subscription?.trialEnd??null:t.trialEnd,g=(0,Q.useMemo)(()=>{if(t.nextPayment!==void 0)return t.nextPayment;if(!n?.isSliceAvailable(bu.PRICES)||!n.currentPlanProduct)return;let e=n.getPricesForProduct(n.currentPlanProduct._id),r=(e.find(e=>e.isDefault)??e[0])?.unitPrice;if(r&&r.currency)return r},[t.nextPayment,n?.currentPlanProduct,n?.getPricesForProduct]),_=t.onManageBilling??(n?.isSliceAvailable(bu.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),v=t.unavailable??(!!n?.isEnabled&&(t.status===void 0||t.planName===void 0||t.currentPeriodEnd===void 0)&&[bu.SUBSCRIPTION,bu.PRODUCTS,bu.PRICES].some(e=>!n.isSliceAvailable(e))),y=t.isLoading??n?.isLoading,b=t.error===void 0?n?.error?r(n.error):null:t.error;return c?(0,$.jsx)(l,{...t,status:u,planName:d,providerName:f,currentPeriodEnd:p,cancelAtPeriodEnd:m,trialEnd:h,nextPayment:g,onManageBilling:_,isLoading:y,error:b,unavailable:v}):null}function F1({preset:e=q.DEFAULT,...t}){let n=Yh(),r=cp(),i=_h(),a=Q.useMemo(()=>M1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(B.LOW_LEVEL_BILLING_PORTAL_LINK,`BillingPortalLink`)(e),c=t.onOpenPortal??(()=>{n&&i(()=>n.openCustomerPortal())}),l=t.providerName??N1({providerRef:n?.billingProviderRef,translate:o}),u=t.unavailable??(!!n?.isEnabled&&t.onOpenPortal===void 0&&[bu.BILLING_ACCOUNT].some(e=>!n.isSliceAvailable(e))),d=t.isLoading??n?.isLoading,f=t.error===void 0?n?.error?r(n.error):null:t.error;return(0,$.jsx)(s,{...t,onOpenPortal:c,providerName:l,isLoading:d,error:f,unavailable:u})}var I1;(function(e){e.IDLE=`idle`,e.PREVIEWING=`previewing`,e.READY=`ready`,e.CONFIRMING=`confirming`,e.FAILED=`failed`})(I1||={});function GSe(e){let t=e.currency.toUpperCase(),n=Ft(t);if(n===void 0||!Number.isSafeInteger(e.amount)||e.lineItems.some(e=>!Number.isSafeInteger(e.amount)))throw Error(`The invoice estimate contains unsupported monetary values.`);return{amount:{amount:BigInt(e.amount),currency:t,decimals:n},lineItems:e.lineItems.map(e=>({...e,amount:{amount:BigInt(e.amount),currency:t,decimals:n}})),periodStart:e.periodStart,periodEnd:e.periodEnd,timing:e.timing,effectiveAt:new Date(e.effectiveAt)}}function KSe(e){let[t,n]=(0,Q.useState)({phase:I1.IDLE}),r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(t);o.current=t;let s=JSON.stringify([e?.currentScope,e?.billingAccount?._id,e?.subscription?._id]),c=(0,Q.useRef)(s);c.current=s;let l=!!e?.isEnabled&&[bu.BILLING_ACCOUNT,bu.SUBSCRIPTION,bu.PRODUCTS,bu.PRICES].every(e.isSliceAvailable);return(0,Q.useEffect)(()=>(r.current+=1,i.current?.abort(),n({phase:I1.IDLE}),()=>{r.current+=1,i.current?.abort()}),[s]),(0,Q.useEffect)(()=>{let e=o.current;a.current||e.phase===I1.READY&&e.hasError||l||(r.current+=1,i.current?.abort(),n({phase:I1.IDLE}))},[l]),{state:t,select:(0,Q.useCallback)(async t=>{if(!e||!l||!e.subscription||a.current)return;let o=++r.current;i.current?.abort();let u=new AbortController;i.current=u;let d={target:t,scopeIdentity:s};n({...d,phase:I1.PREVIEWING});try{let i=await e.previewPlanChange(t,{signal:u.signal}),a=GSe(i);if(!i.previewToken)throw Error(`The invoice estimate has no confirmation binding.`);if(r.current!==o||c.current!==s)return;n({...d,phase:I1.READY,response:i,preview:a})}catch{if(r.current!==o||u.signal.aborted)return;n({...d,phase:I1.FAILED})}},[e,l,s]),cancel:(0,Q.useCallback)(()=>{a.current||(r.current+=1,i.current?.abort(),n({phase:I1.IDLE}))},[]),confirm:(0,Q.useCallback)(async()=>{let t=o.current;if(!e||!l||a.current||t.phase!==I1.READY||t.scopeIdentity!==c.current)return;a.current=!0;let i=r.current;n({...t,phase:I1.CONFIRMING,hasError:!1});try{await e.confirmPlanChange({...t.target,previewToken:t.response.previewToken}),r.current===i&&n({phase:I1.IDLE})}catch{r.current===i&&n({...t,phase:I1.READY,hasError:!0})}finally{a.current=!1}},[e,l])}}function L1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW,`PlanChangePreview`)(e);return(0,$.jsx)(n,{...t})}function R1({preset:e=q.DEFAULT,...t}){let n=Yh(),r=cp(),i=KSe(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=i.state.phase!==I1.IDLE;o.current&&!e&&a.current?.isConnected&&a.current.focus(),o.current=e},[i.state.phase]),(0,Q.useEffect)(()=>{t.onSelectPlan&&i.cancel()},[t.onSelectPlan,i.cancel]);let s=_h(),{tBillingProduct:c,tBillingFeature:l,tBillingLimit:u,isReady:d}=K({keys:[`billing_products`,`billing_features`,`billing_limits`]}),f=G(B.LOW_LEVEL_BILLING_PRICING_TABLE,`PricingTable`)(e),p=(0,Q.useMemo)(()=>t.plans?t.plans:n?.products?n.products.filter(e=>e.type===qa.PLAN&&e.isPublic&&e.isActive).filter(e=>!n.currentScope||!e.targetScopes||e.targetScopes.includes(n.currentScope)).map(e=>{let t=n.getPricesForProduct(e._id);return{key:e.key,name:c(e.key,`name`),description:c(e.key,`tagline`),planTier:e.planTier,sortOrder:e.sortOrder??0,grantedFeatures:(e.grantedFeatures??[]).map(e=>({id:e,label:l(e,`label`)})),grantedLimits:Object.entries(e.grantedLimits??{}).map(([e,t])=>({id:e,label:u(e,`label`),value:typeof t==`object`&&t?t.value??0:0})),isCurrent:e.key===n.currentPlanKey,prices:t.filter(e=>e.unitPrice&&e.unitPrice.currency).map(e=>({priceId:e._id,price:e.unitPrice,interval:e.interval,isDefault:e.isDefault??!0})),isRecommended:e.isRecommended===!0,priceDisclosure:e.priceDisclosure,isAcquirable:n.isProductAcquirable(e.key),isFree:t.length>0&&t.every(e=>e.unitPrice?.amount===0n),trialDays:e.behaviorPolicy?.trial?.days}}):[],[t.plans,n?.products,n?.currentScope,n?.currentPlanKey,n?.getPricesForProduct,n?.isProductAcquirable,c,l,u]),m=t.currentPlanKey===void 0?n?.currentPlanKey??null:t.currentPlanKey,h=n?.subscription?.pendingPlanChange,g=t.pendingPlanChange===void 0?h?{targetPlanName:(()=>{let e=n?.products?.find(e=>e._id===h.productId)?.key;return e?c(e,`name`):h.productId})(),effectiveAt:new Date(h.effectiveAt)}:null:t.pendingPlanChange,[_,v]=(0,Q.useState)(!1),y=t.onKeepCurrentPlan??(h&&n&&ot(h)?()=>{v(!0),s(async()=>{try{await n.cancelPendingPlanChange()}finally{v(!1)}})}:void 0),b=(0,Q.useCallback)((e,r)=>{t.onSelectPlan?t.onSelectPlan(e,r):n&&[bu.BILLING_ACCOUNT,bu.SUBSCRIPTION,bu.PRODUCTS,bu.PRICES].every(n.isSliceAvailable)&&(n.subscription?(document.activeElement instanceof HTMLElement&&(a.current=document.activeElement),i.select({newProductKey:e,newPriceId:r})):s(()=>n.openCheckout(e,r)))},[t.onSelectPlan,n,s,i.select]),x=t.unavailable??(!!n?.isEnabled&&t.plans===void 0&&[bu.PRODUCTS,bu.PRICES,bu.SUBSCRIPTION].some(e=>!n.isSliceAvailable(e))),S=t.isLoading??n?.isLoading,C=t.error===void 0?n?.error?r(n.error):null:t.error;return d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{...t,plans:p,currentPlanKey:m,onSelectPlan:b,isLoading:S,error:C,unavailable:x,isSelectionDisabled:t.isSelectionDisabled||i.state.phase===I1.CONFIRMING||!!g,pendingPlanChange:g,onKeepCurrentPlan:y,isKeepingCurrentPlan:t.isKeepingCurrentPlan??_}),i.state.phase!==I1.IDLE&&(0,$.jsx)(L1,{targetPlanName:c(i.state.target.newProductKey,`name`),preview:`preview`in i.state?i.state.preview:null,isLoading:i.state.phase===I1.PREVIEWING,isConfirming:i.state.phase===I1.CONFIRMING,hasError:i.state.phase===I1.FAILED||`hasError`in i.state&&i.state.hasError,onCancel:i.cancel,onConfirm:i.state.phase===I1.READY||i.state.phase===I1.CONFIRMING?()=>{i.confirm()}:void 0,onRetry:i.state.phase===I1.FAILED?()=>{i.state.phase===I1.FAILED&&i.select(i.state.target)}:void 0})]}):null}function z1({preset:e=q.DEFAULT,...t}){let n=Yh(),r=cp(),i=_h(),{tBillingProduct:a,tBillingCreditPool:o,isReady:s}=K({keys:[`billing_products`,`billing_credit_pools`]}),c=G(B.LOW_LEVEL_BILLING_USAGE_DASHBOARD,`UsageDashboard`)(e),l=(0,Q.useMemo)(()=>t.products?t.products:n?.usage?.byProduct?Object.entries(n.usage.byProduct).map(([e,t])=>({productKey:e,productName:a(e,`name`),currentPeriodUsage:t.currentPeriodUsage,previousPeriodUsage:t.previousPeriodUsage,limit:t.limit,lastRecordedAt:t.lastRecordedAt})):[],[t.products,n?.usage?.byProduct,a]),u=(0,Q.useMemo)(()=>t.creditPools?t.creditPools:n?.creditPools?Object.entries(n.creditPools).map(([e,t])=>({poolKey:e,poolName:o(e,`name`),available:t.available,totalPurchased:t.totalPurchased,totalGranted:t.totalGranted??0,totalConsumed:t.totalConsumed})):[],[t.creditPools,n?.creditPools,o]),d=(0,Q.useCallback)(e=>{if(t.onTopUp){t.onTopUp(e);return}if(!n||![bu.BILLING_ACCOUNT,bu.PRODUCTS,bu.PRICES,bu.CREDIT_POOLS].every(n.isSliceAvailable))return;let r=n.products.find(t=>t.type===qa.CREDIT_PACK&&t.purchaseConfig?.creditPoolKey===e);if(!r)return;let a=n.getPricesForProduct(r._id),o=a.find(e=>e.isDefault)??a[0];o&&i(()=>n.openCheckout(r.key,o._id))},[t.onTopUp,n,i]),f=t.usageUnavailable??(!!n?.isEnabled&&t.products===void 0&&!n.isSliceAvailable(bu.USAGE)),p=t.creditPoolsUnavailable??(!!n?.isEnabled&&t.creditPools===void 0&&!n.isSliceAvailable(bu.CREDIT_POOLS)),m=!!t.onTopUp||!!n&&[bu.BILLING_ACCOUNT,bu.PRODUCTS,bu.PRICES,bu.CREDIT_POOLS].every(n.isSliceAvailable),h=t.isLoading??n?.isLoading,g=t.error===void 0?n?.error?r(n.error):null:t.error;return s?(0,$.jsx)(c,{...t,products:l,creditPools:u,onTopUp:m?d:void 0,usageUnavailable:f,creditPoolsUnavailable:p,isLoading:h,error:g}):null}function B1({preset:e=q.DEFAULT,...t}){let n=Yh(),r=cp(),i=_h(),a=Q.useMemo(()=>M1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(B.LOW_LEVEL_BILLING_INVOICE_HISTORY,`InvoiceHistory`)(e),c=t.invoices??n?.invoices??[],l=t.onViewAll??(n?.isSliceAvailable(bu.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),u=t.providerName??N1({providerRef:n?.billingProviderRef,translate:o}),d=t.unavailable??(!!n?.isEnabled&&t.invoices===void 0&&[bu.INVOICES].some(e=>!n.isSliceAvailable(e))),f=t.isLoading??n?.isLoading,p=t.error===void 0?n?.error?r(n.error):null:t.error;return(0,$.jsx)(s,{...t,invoices:c,providerName:u,onViewAll:l,isLoading:f,error:p,unavailable:d})}var qSe=()=>{let e=Yh(),{tComponent:t,isReady:n}=K({component:B.APP_LAYOUTS_BILLING_SETTINGS}),r=(0,Q.useCallback)(e=>t(B.APP_LAYOUTS_BILLING_SETTINGS,e),[t]);if(!n)return null;if(!e?.isEnabled)return(0,$.jsxs)(EF,{children:[(0,$.jsx)(OF,{children:(0,$.jsx)(AF,{children:r(`disabledTitle`)})}),(0,$.jsx)(NF,{children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:r(`disabledDescription`)})})]});let i=e.isSliceAvailable(bu.BILLING_ACCOUNT),a=[bu.SUBSCRIPTION,bu.PRODUCTS,bu.PRICES].every(t=>e.isSliceAvailable(t));return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:r(`pageTitle`)}),(0,$.jsx)(P1,{}),i&&!a&&(0,$.jsx)(F1,{}),(0,$.jsx)(R1,{}),(0,$.jsx)(z1,{}),(0,$.jsx)(B1,{})]})};function V1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_LIST,`DescriptionList`)(e);return(0,$.jsx)(n,{...t})}function H1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_TERM,`DescriptionTerm`)(e);return(0,$.jsx)(n,{...t})}function U1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_DETAILS,`DescriptionDetails`)(e);return(0,$.jsx)(n,{...t})}function W1(e){switch(e){case I.USER:return ul.USER_PROVIDER_CREDENTIALS;case I.ORGANIZATION:return ul.ORG_PROVIDER_CREDENTIALS;case I.APPLICATION:return}}function JSe(e){return W1(e)!==void 0}function YSe(e,t){return e===I.APPLICATION?e:t===null?null:`${e}:${t}`}function G1(e){let t=W1(e.ownerScope);if(t===void 0)return;let n=e.registry.resourceConfigurations[t];if(!n)return;let r=n.operations.find(t=>t.operationIdentifier===e.operation&&t.isOperationDefault===!0&&t.isBulkOperation!==!0&&t.variantType===at.API_CALL);if(!r)return;let i={...tm.buildResourceOperationContextIdentifiers({...e.ownerScope===I.USER?{currentUserId:e.ownerId}:{currentOrganizationId:e.ownerId},primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),[t]:e.credentialId};return{operationPathKey:Ta.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e.registry),parentResourcesRequirements:On.buildParentResourcesRequirements(t,i,e.registry)}}function XSe(e,t){let{registry:n,doOperation:r}=fm(),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(null),p=YSe(e,t);(0,Q.useEffect)(()=>{if(p===null){a([]),s(!1),f.current=null;return}let n=!1,r=p;return f.current!==r&&(a([]),l(!1),s(!0),f.current=r),(async()=>{try{let r=await bc().listLinkedProviderConnections(e===I.APPLICATION||t===null?{ownerScope:e}:{ownerScope:e,ownerId:t});n||(a(r.connections??[]),l(!1))}catch{n||l(!0)}finally{n||s(!1)}})(),()=>{n=!0}},[p,e,t,u]);let m=(0,Q.useCallback)(()=>d(e=>e+1),[]),h=(0,Q.useCallback)(async i=>{if(p!==null){if(e===I.APPLICATION)try{await bc().disconnectApplicationProviderConnection(i.connectionRef)}finally{m()}else if(t!==null)try{for(let a of i.credentials){let i=G1({registry:n,ownerScope:e,ownerId:t,credentialId:a.credentialId,operation:W.DELETE});if(i===void 0)throw Error(`No DELETE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements})}ac({ownerScope:e,ownerId:t},i.connectionRef)}finally{m()}}},[r,t,p,e,n,m]),g=(0,Q.useCallback)(async(i,a)=>{if(t!==null)try{for(let o of i.credentials){let i=G1({registry:n,ownerScope:e,ownerId:t,credentialId:o.credentialId,operation:W.UPDATE});if(i===void 0)throw Error(`No UPDATE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements,requestData:{enabled:a}})}}finally{m()}},[r,t,e,n,m]),_=(0,Q.useCallback)(async(i,a,o)=>{if(t!==null)try{let s=G1({registry:n,ownerScope:e,ownerId:t,credentialId:i,operation:a});if(s===void 0)throw Error(`No ${a} operation is registered for the ${e} credential resource in this frontend.`);await r(s.operationPathKey,{contextualParameters:s.contextualParameters,parentResourcesRequirements:s.parentResourcesRequirements,...o===void 0?{}:{requestData:o}})}finally{m()}},[r,t,e,n,m]),v=(0,Q.useCallback)((e,t)=>_(e,W.UPDATE,{description:t.trim()===``?null:t.trim()}),[_]),y=(0,Q.useCallback)(e=>_(e,W.DELETE),[_]);return{connections:i,loading:o,failed:c,reload:m,disconnect:h,holdsCredentialResource:JSe(e),setEnabled:g,setCredentialDescription:v,removeCredential:y}}var K1=B.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,ZSe={[I.USER]:sae.shape.description.unwrap().maxLength??void 0,[I.ORGANIZATION]:Fee.shape.description.unwrap().maxLength??void 0},q1=bd().min(1),J1=Od(),QSe=bd().min(1),$Se=(e,t)=>e.filter(e=>e.admissibleConnections.some(e=>e.ownerScope===t)),Y1=(e,t)=>{let n=new Set(Object.values(jc)),r=[];for(let i of e.admissibleConnections){if(i.ownerScope!==t||!n.has(i.delegation))continue;let e=i.delegation;r.includes(e)||r.push(e)}return r},eCe=(e,t)=>{let n=Y1(e,t);return t===I.APPLICATION?n.filter(e=>e===jc.SERVICE):n},X1=e=>({ownerScope:e.ownerScope,delegation:e.delegation,...e.ownerScope===I.APPLICATION||e.ownerId===null?{}:{ownerId:e.ownerId},...wr(e)&&e.signedInUserId!==null?{actingForUserId:e.signedInUserId}:{}}),tCe=(e,t,n)=>e.map(e=>{let r=/^\{([A-Za-z_][A-Za-z0-9_]*)\}/.exec(e);if(r===null)return e;let i=(Object.hasOwn(t,r[1])?t[r[1]]:void 0)?.trim()??``;return i===``?n:`${i}${e.slice(r[0].length)}`}),Z1;(function(e){e.SUPERSEDED=`SUPERSEDED`,e.DISABLED=`DISABLED`,e.NEEDS_REAUTHORIZATION=`NEEDS_REAUTHORIZATION`,e.WORKING=`WORKING`,e.NOT_YET_USED=`NOT_YET_USED`})(Z1||={});var Q1;(function(e){e.DISCONNECTED=`DISCONNECTED`,e.FAILED=`FAILED`})(Q1||={});var nCe=e=>{if(e.supersededByConnectionRef!==void 0)return Z1.SUPERSEDED;if(!e.enabled)return Z1.DISABLED;switch(e.validationState){case mi.INVALID:return Z1.NEEDS_REAUTHORIZATION;case mi.VALID:return Z1.WORKING;case mi.UNVALIDATED:return Z1.NOT_YET_USED}},rCe={[Z1.SUPERSEDED]:`warning`,[Z1.DISABLED]:`secondary`,[Z1.NEEDS_REAUTHORIZATION]:`destructive`,[Z1.WORKING]:`success`,[Z1.NOT_YET_USED]:`secondary`},iCe={[Z1.SUPERSEDED]:`statusSuperseded`,[Z1.DISABLED]:`statusDisabled`,[Z1.NEEDS_REAUTHORIZATION]:`statusNeedsReauthorization`,[Z1.WORKING]:`statusWorking`,[Z1.NOT_YET_USED]:`statusNotYetUsed`},aCe=(e,t)=>{if(t===void 0||t.connectionRef!==e.connectionRef)return;let n=new Set(e.grantedScopes??[]),r=t.requestableScopes.filter(e=>!n.has(e)),i=t.administratorConsentScopes.filter(e=>!n.has(e));if(r.length!==0||i.length!==0)return{requestableScopes:r,administratorConsentScopes:i,offer:t}},oCe=(e,t)=>pb([...[...e.flatMap(e=>[e.providerRef,...e.servesRefs??[]]),...t.flatMap(e=>[e.connectionRef,...e.servesRefs,...e.supersededByConnectionRef===void 0?[]:[e.supersededByConnectionRef]])].map(vd),...e.flatMap(e=>(e.credentialFields??[]).flatMap(t=>[gd(e.providerRef,t.slug,_d.LABEL),gd(e.providerRef,t.slug,_d.DESCRIPTION)])),...e.flatMap(e=>(e.connectionParameters??[]).flatMap(t=>[hd(e.providerRef,t,_d.LABEL),hd(e.providerRef,t,_d.DESCRIPTION)])),...t.flatMap(e=>e.credentials.map(e=>gd(e.providerRef,e.secretSlug,_d.LABEL)))]),$1=(e,t,n,r)=>{let i=gd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===_d.LABEL?t:i},e0=(e,t,n,r)=>{let i=hd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===_d.LABEL?t:i},sCe=(e,t)=>{let n=e=>e.connectionRef??e.providerRef,r=new Set(t.map(e=>e.connectionRef));return[...t.map(t=>({connectionRef:t.connectionRef,connection:t,catalogueEntry:e.find(e=>n(e)===t.connectionRef)})),...e.filter(e=>!r.has(n(e))).map(e=>({connectionRef:n(e),catalogueEntry:e}))]},cCe=()=>{if(typeof window>`u`)return{};let e=new URLSearchParams(window.location.search);return{connected:e.get(`connected`)??void 0,connectionError:e.get(`connectionError`)??void 0,state:e.get(`state`)??void 0,code:e.get(`code`)??void 0}},lCe=()=>{if(typeof window>`u`)return;let e=new URL(window.location.href);e.searchParams.delete(`state`),e.searchParams.delete(`code`),window.history.replaceState(window.history.state,``,e.toString())},uCe=({connection:e,pending:t,catalogueEntry:n,ownerScope:r,ownerId:i,signedInUserId:a,label:o,t:s,tWith:c})=>{let l=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=n===void 0?[]:Y1(n,r),y=v.length===1?v[0]:v.find(e=>e===u),b=y!==void 0&&yc({ownerScope:r,delegation:y}),x=r===I.USER||e.linkedByUserId!==void 0&&e.linkedByUserId===a,S=(0,Q.useCallback)(async()=>{if(i!==null&&y!==void 0){h(!0),_(!1);try{let{authorizeUrl:e}=await bc().startProviderConnection(t.offer.providerRef,{target:X1({ownerScope:r,ownerId:i,delegation:y,signedInUserId:a}),addScopes:t.requestableScopes,forOperationId:t.offer.operationId,...b?{acknowledgesOrganizationWideUse:f}:{}});window.location.href=e}catch(e){h(!1),ri(e)||_(!0)}}},[f,y,b,i,r,t,a]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs`,children:s(`reauthorizationOfferDescription`)}),t.requestableScopes.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[s(`reauthorizationScopesPrefix`),` `,t.requestableScopes.join(`, `)]}),t.administratorConsentScopes.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[s(`reauthorizationAdministratorPrefix`),` `,t.administratorConsentScopes.join(`, `)]}),t.requestableScopes.length>0&&!x&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`reauthorizationLinkerOnlyNotice`)}),t.requestableScopes.length>0&&x&&(0,$.jsxs)($.Fragment,{children:[v.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:s(`delegationHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`delegationDescription`)}),(0,$.jsx)(mF,{name:`delegation-${e.connectionRef}`,schema:q1,options:v.map(e=>({value:e,label:s(e===jc.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:u,placeholder:s(`delegationPlaceholder`),onChange:e=>{d(e),p(!1)}})]}),b&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(wI,{name:`organizationWideUseAcknowledged-${e.connectionRef}`,schema:J1,checked:f,onCheckedChange:p,"aria-describedby":l}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:s(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:l,className:`text-xs text-muted-foreground`,children:s(`organizationWideUseDescription`)})]})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,"aria-label":c(`grantMoreAccessAccessibleName`,{provider:o}),disabled:m||i===null||y===void 0||b&&!f,onClick:S,children:s(`grantMoreAccessButton`)})})]}),g&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:s(`errorGeneric`)})})]})},dCe={[Pee.MESSAGING_ENDPOINT]:`vendorRegistrationMessagingEndpointLabel`},fCe=new Set([Xl.PROVIDER_VENDOR_REGISTRATION_DEPLOYMENT_INCOMPLETE]),t0=e=>Ot(e)||jr(e)&&e.customMessageReference!==void 0&&fCe.has(e.customMessageReference);function pCe(e){if(e.encoding===Y_.BASE64){let t=atob(e.content),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Blob([n],{type:e.mediaType})}return new Blob([e.content],{type:e.mediaType})}var mCe=({providerRef:e,organizationId:t,label:n,t:r,tWith:i})=>{let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=cp(),g=(0,Q.useMemo)(()=>[...new Set((s?.steps??[]).map(t=>pd(e,t.ref)))],[e,s]),{t:_,isReady:v}=K({keys:g}),y=(0,Q.useCallback)(async()=>{o(!0),u(!0),f(null),c(null);try{c(await bc().getProviderVendorRegistration(e,{ownerScope:I.ORGANIZATION,ownerId:t},{silent:!0}))}catch(e){f(e)}finally{u(!1)}},[t,e]),b=(0,Q.useCallback)(e=>{navigator.clipboard?.writeText(e).then(()=>m(e),()=>m(null))},[]);return a?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs font-medium text-muted-foreground`,children:r(`vendorRegistrationHeading`)}),l&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationLoading`)}),d!==null&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:jr(d)?h(d,r(t0(d)?`vendorRegistrationRefused`:`vendorRegistrationFailed`)):r(`vendorRegistrationFailed`)}),t0(d)?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationRefusalFinal`)}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:l,onClick:()=>{y()},children:r(`vendorRegistrationRetryButton`)})})]}),s!==null&&(0,$.jsxs)($.Fragment,{children:[(s.addresses??[]).length>0&&(0,$.jsx)(V1,{children:(s.addresses??[]).map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(H1,{children:r(dCe[e.kind]??e.kind)}),(0,$.jsx)(U1,{children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-item-xs`,children:[(0,$.jsx)(`code`,{className:`select-all break-all text-xs`,children:e.url}),(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`vendorRegistrationCopyAccessibleName`,{address:e.url}),onClick:()=>b(e.url),children:r(p===e.url?`vendorRegistrationCopiedButton`:`vendorRegistrationCopyButton`)})]})})]},e.kind))}),v&&(0,$.jsx)(`ol`,{className:`flex list-decimal flex-col gap-item-xs pl-5`,children:s.steps.map((t,n)=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Z,{className:`text-xs`,children:_(pd(e,t.ref),t.params)})},`${n}:${t.ref}`))})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,onClick:()=>{o(!1),m(null)},children:r(`vendorRegistrationHideButton`)}),s?.file!==void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,onClick:()=>Hy(pCe(s.file),s.file.name),children:i(`vendorRegistrationDownloadButton`,{file:s.file.name})})]})]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":i(`vendorRegistrationAccessibleName`,{provider:n}),onClick:()=>{y()},children:r(`vendorRegistrationButton`)})})},hCe=({connection:e,descriptionMaxLength:t,label:n,t:r,tWith:i,translateProvider:a,onSaveDescription:o,onRemove:s})=>{let[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=e.credentials.length>1,_=async e=>{h(e);try{await o(e,u)&&l(null)}finally{h(null)}},v=async e=>{h(e);try{await s(e)}finally{h(null),p(null)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs font-medium text-muted-foreground`,children:r(g?`credentialFieldsLabel`:`descriptionLabel`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-item-xs`,children:e.credentials.map(e=>{let o=c===e.credentialId,s=f===e.credentialId,h=m===e.credentialId,y=$1(e.providerRef,e.secretSlug,_d.LABEL,a);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[g&&(0,$.jsx)(Z,{className:`text-sm font-medium`,children:y}),!o&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e.description??r(`noDescription`)}),!o&&!s&&(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`editDescriptionAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{l(e.credentialId),d(e.description??``),p(null)},children:r(`editDescriptionButton`)}),g&&!o&&!s&&(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`removeSlotAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{p(e.credentialId),l(null)},children:r(`removeSlotButton`)})]}),o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(QM,{"aria-label":i(`descriptionInputAccessibleName`,{provider:n,slot:y}),type:`text`,maxLength:t,autoFocus:!0,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:h,onClick:()=>{_(e.credentialId)},children:r(`saveDescriptionButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:h,onClick:()=>l(null),children:r(`cancelDescriptionButton`)})]}),s&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:i(`removeSlotConfirmation`,{slot:y})}),(0,$.jsx)(X,{size:Y.SM,variant:J.DESTRUCTIVE,disabled:h,"aria-label":i(`removeSlotConfirmAccessibleName`,{provider:n,slot:y}),autoFocus:!0,onClick:()=>{v(e.credentialId)},children:r(`removeSlotConfirmButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:h,onClick:()=>p(null),children:r(`removeSlotCancelButton`)})]})]},e.credentialId)})})]})},n0=({ownerScope:e=I.USER})=>{let{tComponent:t,isReady:n,formatDateTime:r}=K({component:K1}),{user:i,currentOrganizationId:a}=pg(),o=(0,Q.useCallback)(e=>t(K1,e),[t]),s=(0,Q.useCallback)((e,n)=>t(K1,e,n),[t]),c=(0,Q.useId)(),l=e===I.USER?i?._id??null:e===I.ORGANIZATION?a??null:null,u=e===I.APPLICATION||l!==null,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)(cCe),j=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let{state:e,code:t}=k;if(e===void 0||t===void 0)return;j.current===null&&(lCe(),j.current=bc().completeProviderConnection({state:e,code:t}));let n=!1;return j.current.then(({connected:e})=>{n||A({connected:e})}).catch(()=>{n||A({connectionError:`failed`})}),()=>{n=!0}},[]),(0,Q.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await bc().listConnectableProviders(e===I.APPLICATION?{ownerScope:e}:void 0);t||(f(n.providers??[]),v(!1))}catch{t||v(!0)}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let M=(0,Q.useMemo)(()=>$Se(d,e),[d,e]),{connections:N,loading:P,failed:F,reload:ee,disconnect:L,holdsCredentialResource:R,setEnabled:z,setCredentialDescription:te,removeCredential:ne}=XSe(e,l),re=sr(),ie=(0,Q.useMemo)(()=>oCe(d,N),[d,N]),{t:ae}=K({keys:ie}),oe=(0,Q.useCallback)(e=>mb({providerRef:e,translate:ae}),[ae]),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(null),[de,fe]=(0,Q.useState)(null),pe=(0,Q.useCallback)(async e=>{ue(e.connectionRef),fe(null);try{await L(e),fe(Q1.DISCONNECTED),g(null)}catch(e){ri(e)||fe(Q1.FAILED)}finally{ue(null),ce(null)}},[L]),[me,he]=(0,Q.useState)(null),ge=(0,Q.useCallback)(async(e,t)=>{he(e.connectionRef),fe(null);try{await z(e,t),g(null)}catch(e){ri(e)||g(o(`errorGeneric`))}finally{he(null)}},[z,o]),_e=(0,Q.useCallback)(async e=>{fe(null);try{return await e(),g(null),!0}catch(e){return ri(e)||g(o(`errorGeneric`)),!1}},[o]),ve=(0,Q.useCallback)((e,t)=>_e(()=>te(e,t)),[_e,te]),ye=(0,Q.useCallback)(e=>_e(()=>ne(e)),[_e,ne]),be=(0,Q.useMemo)(()=>{if(M.length===0)return`disconnectNotice`;let e=M.filter(e=>e.revocationTellsVendor===!0).length;return e===0?`disconnectNotice`:e===M.length?`disconnectRevokesNotice`:`disconnectMixedNotice`},[M]),xe=(0,Q.useMemo)(()=>d.filter(e=>(e.missingRegistration??[]).length>0).map(e=>({providerRef:e.providerRef,envVarNames:(e.missingRegistration??[]).map(e=>e.envVarName)})),[d]),Se=(0,Q.useMemo)(()=>M.find(e=>e.providerRef===y),[M,y]),Ce=(0,Q.useCallback)(e=>{b(e),O({}),w(``),E(!1),g(null)},[]),we=(0,Q.useMemo)(()=>Se===void 0?[]:eCe(Se,e),[e,Se]),Te=we.length===1?we[0]:we.find(e=>e===C),[Ee,De]=(0,Q.useState)(null),Oe=Te!==void 0&&yc({ownerScope:e,delegation:Te}),ke=(0,Q.useCallback)(async()=>{if(Se===void 0||!u||Te===void 0)return;S(!0),g(null),De(null);let t=X1({ownerScope:e,ownerId:l,delegation:Te,signedInUserId:i?._id??null});try{if(Se.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1){let{authorizeUrl:e}=await bc().startProviderConnection(Se.providerRef,{target:t,connectionParameters:D,...Oe?{acknowledgesOrganizationWideUse:T}:{}});window.location.href=e;return}let e=new Set((Se.credentialFields??[]).map(e=>e.slug)),n=Object.fromEntries(Object.entries(D).filter(([t,n])=>e.has(t)&&n.trim()!==``)),r=new Set(Se.connectionParameters??[]),i=Object.fromEntries(Object.entries(D).filter(([e,t])=>r.has(e)&&t.trim()!==``));await bc().storeProviderCredential(Se.providerRef,{target:t,values:n,...Object.keys(i).length===0?{}:{connectionParameters:i},...Oe?{acknowledgesOrganizationWideUse:T}:{}}),O({}),De(o(`credentialStoredNotice`)),S(!1),b(``),ee()}catch(e){S(!1),ri(e)||g(o(`errorGeneric`))}},[D,Te,Oe,T,l,u,e,ee,Se,o,i?._id]);if(!n)return null;let Ae=sCe(M,N),je=Se?.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1,Me=Se?.missingRegistration??[],Ne=Se?.connectionParameters??[],Pe=Se?.connectionParameterChoices??{},Fe=Se?.credentialFields??[],B=Se?.scopes??[],Ie=[...Ne,...je?[]:Fe.filter(e=>e.required).map(e=>e.slug)].some(e=>(D[e]??``).trim()===``);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[k.connected!==void 0&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:o(`connectedNotice`)})}),k.connectionError===`declined`&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:o(`declinedNotice`)})}),k.connectionError!==void 0&&k.connectionError!==`declined`&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(`failedNotice`)})}),Ee&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:Ee})}),_&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(`catalogueFailed`)})}),h&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:h})}),de===Q1.DISCONNECTED&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:o(`disconnectedNotice`)})}),de===Q1.FAILED&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(`disconnectFailedNotice`)})}),(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:[(0,$.jsx)(wY,{level:3,id:c,children:o(`providersHeading`)}),p||P?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`loading`)}):(0,$.jsxs)($.Fragment,{children:[F&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(`connectionsFailed`)})}),Ae.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`empty`)}):(0,$.jsx)(`ul`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:Ae.map(({connectionRef:t,connection:n,catalogueEntry:a})=>{let c=oe(n===void 0?a?.providerRef??t:n.connectionRef),d=n===void 0?void 0:nCe(n),f=n===void 0||d===Z1.SUPERSEDED?void 0:aCe(n,l===null?void 0:_r(re,{ownerScope:e,ownerId:l},n.connectionRef)),p=se===t,m=le===t,h=me===t,g=a!==void 0&&Se?.providerRef===a.providerRef,_=a!==void 0&&!(a.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1),v=n!==void 0&&_&&d!==Z1.SUPERSEDED;return(0,$.jsx)(`li`,{children:(0,$.jsx)(EF,{children:(0,$.jsxs)(NF,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c}),d===void 0?(0,$.jsx)(If,{variant:`outline`,children:o(`notConnectedBadge`)}):(0,$.jsx)(If,{variant:rCe[d],children:o(iCe[d])})]}),n!==void 0&&(0,$.jsxs)(V1,{children:[n.servesRefs.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`servesLabel`)}),(0,$.jsx)(U1,{children:n.servesRefs.map(oe).join(`, `)})]}),(n.grantedScopes??[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`grantedScopesLabel`)}),(0,$.jsx)(U1,{children:(n.grantedScopes??[]).join(`, `)})]}),n.connectedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`connectedAtLabel`)}),(0,$.jsx)(U1,{children:r(n.connectedAt)})]}),n.validationError!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`lastRefusalLabel`)}),(0,$.jsx)(U1,{children:n.validationError})]}),n.lastValidatedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`lastValidatedAtLabel`)}),(0,$.jsx)(U1,{children:r(n.lastValidatedAt)})]}),n.lastUsedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`lastUsedAtLabel`)}),(0,$.jsx)(U1,{children:r(n.lastUsedAt)})]}),n.linkedByUserId!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H1,{children:o(`linkedByLabel`)}),(0,$.jsx)(U1,{children:n.linkedByUserName??n.linkedByUserId})]})]}),n!==void 0&&d!==Z1.SUPERSEDED&&R&&(0,$.jsx)(hCe,{connection:n,descriptionMaxLength:ZSe[e],label:c,t:o,tWith:s,translateProvider:ae,onSaveDescription:ve,onRemove:ye}),e===I.ORGANIZATION&&l!==null&&(a?.vendorRegistrationOwnerScopes??[]).includes(I.ORGANIZATION)&&(0,$.jsx)(mCe,{providerRef:a.providerRef,organizationId:l,label:c,t:o,tWith:s}),n!==void 0&&d===Z1.SUPERSEDED&&n.supersededByConnectionRef!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`supersededNotice`,{connection:oe(n.supersededByConnectionRef)})}),n!==void 0&&!n.enabled&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`disabledNotice`)}),d===Z1.NEEDS_REAUTHORIZATION&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`needsReauthorizationNotice`)}),n!==void 0&&f!==void 0&&(0,$.jsx)(uCe,{connection:n,pending:f,catalogueEntry:a,ownerScope:e,ownerId:l,signedInUserId:i?._id??null,label:c,t:o,tWith:s}),n!==void 0&&p?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs`,children:s(`disconnectConfirmDescription`,{provider:c})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(n.revocationTellsVendor?`disconnectRevokesNotice`:`disconnectNotice`)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,disabled:m,onClick:()=>ce(null),children:o(`disconnectCancelButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DESTRUCTIVE,"aria-label":s(`disconnectConfirmAccessibleName`,{provider:c}),disabled:m,onClick:()=>{pe(n)},children:o(`disconnectConfirmButton`)})]})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[a!==void 0&&!g&&n===void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,"aria-label":s(`connectAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`connectButton`)}),a!==void 0&&!g&&v&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`replaceCredentialAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`replaceCredentialButton`)}),a!==void 0&&!g&&d===Z1.NEEDS_REAUTHORIZATION&&!v&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`reconnectAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`reconnectButton`)}),n!==void 0&&d!==Z1.SUPERSEDED&&R&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(n.enabled?`disableAccessibleName`:`enableAccessibleName`,{provider:c}),disabled:h||le!==null,onClick:()=>{ge(n,!n.enabled)},children:o(n.enabled?`disableButton`:`enableButton`)}),n!==void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`disconnectAccessibleName`,{provider:c}),disabled:le!==null,onClick:()=>{ce(t),fe(null)},children:o(`disconnectButton`)})]}),g&&Se!==void 0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,children:[(Se.servesRefs??[]).length>1&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`servesLabel`),` `,(Se.servesRefs??[]).map(oe).join(`, `)]}),!je&&Me.length===0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`pastedCredentialNotice`)}),we.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`delegationHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`delegationDescription`)}),(0,$.jsx)(mF,{name:`delegation`,schema:q1,options:we.map(e=>({value:e,label:o(e===jc.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:C,placeholder:o(`delegationPlaceholder`),onChange:e=>{w(e),E(!1)}})]}),je&&B.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`scopesPrefix`),` `,tCe(B,D,o(`scopeChosenBelow`)).join(`, `)]}),(Ne.length>0||!je&&Fe.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`parametersHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`parametersDescription`)})]}),[...je||Se===void 0?[]:Fe.map(e=>({key:e.slug,label:$1(Se.providerRef,e.slug,_d.LABEL,ae),description:$1(Se.providerRef,e.slug,_d.DESCRIPTION,ae),choices:void 0,secret:!0})),...Se===void 0?[]:Ne.map(e=>({key:e,label:e0(Se.providerRef,e,_d.LABEL,ae),description:e0(Se.providerRef,e,_d.DESCRIPTION,ae),choices:Pe[e],secret:!1}))].map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:e.label}),e.description!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:e.description}),e.choices!==void 0&&(e.choices.hostSuffixes??[]).length===0?(0,$.jsx)(mF,{name:e.key,schema:QSe,options:e.choices.values.map(e=>({value:e,label:e})),value:D[e.key]??``,onChange:t=>O(n=>({...n,[e.key]:t}))}):(0,$.jsxs)($.Fragment,{children:[e.choices!==void 0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`parameterAdmittedHostsPrefix`),` `,[...e.choices.values,...(e.choices.hostSuffixes??[]).map(t=>e.choices?.position===ane.ORIGIN?`https://*${t}`:`*${t}`)].join(`, `)]}),(0,$.jsx)(QM,{"aria-label":e.label,type:e.secret?`password`:`text`,value:D[e.key]??``,onChange:t=>O(n=>({...n,[e.key]:t.target.value}))})]})]},e.key)),Oe&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(wI,{name:`organizationWideUseAcknowledged`,schema:J1,checked:T,onCheckedChange:E,"aria-describedby":`organization-wide-use-description`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:`organization-wide-use-description`,className:`text-xs text-muted-foreground`,children:o(`organizationWideUseDescription`)})]})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,disabled:x,onClick:()=>Ce(``),children:o(`connectCancelButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:x||!u||Se.notConnectableBecause!==void 0&&Se.notConnectableBecause!==vn.NO_AUTHORIZATION_FLOW||Ie||Te===void 0||Oe&&!T,onClick:ke,children:o(x?`connectingButton`:`connectButton`)})]})]})]})})},t)})})]})]}),xe.length>0&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`configurationGapsHeading`)}),(0,$.jsx)(Z,{className:`text-xs`,children:o(`configurationGapsDescription`)}),(0,$.jsx)(`ul`,{className:`list-disc pl-4`,children:xe.map(e=>(0,$.jsxs)(`li`,{className:`text-xs`,children:[oe(e.providerRef),`: `,e.envVarNames.join(`, `)]},e.providerRef))})]})})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(be)})]})},r0=B.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,i0;(function(e){e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_90_DAYS=90]=`LAST_90_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(i0||={});var gCe=[i0.LAST_30_DAYS,i0.LAST_90_DAYS,i0.LAST_365_DAYS],_Ce=Object.values(wl);function a0(e){return`groupBy_${e}`}function o0(e){return`window_${e}`}function vCe(e,t){switch(t){case wl.AGENT:return e.key.agentRef;case wl.TOOL:return e.key.toolName;case wl.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType}:${e.key.caseRef.resourceId}`:void 0;case wl.DECIDER:return e.key.deciderUserId}}function yCe(e,t){return e===null?null:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}var bCe=()=>{let{tComponent:e,isReady:t,currentLanguage:n}=K({component:r0}),{currentOrganizationId:r}=pg(),i=(0,Q.useCallback)(t=>e(r0,t),[e]),[a,o]=(0,Q.useState)(wl.AGENT),[s,c]=(0,Q.useState)(i0.LAST_90_DAYS),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!r){m(null),f(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-s*24*60*6e4);return f(!0),m(null),bc().summarizeAgentWorkOverrideRate({from:n.toISOString(),to:t.toISOString(),groupBy:a,organizationId:r}).then(t=>{e||u(t)}).catch(()=>{e||m(i(`errorGeneric`))}).finally(()=>{e||f(!1)}),()=>{e=!0}},[r,a,s,i]);let h=(0,Q.useMemo)(()=>l?.groupBy===a?l.groups:[],[l,a]),g=d||l!==null&&l.groupBy!==a;return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(cO,{value:a,onValueChange:e=>o(e),children:(0,$.jsx)(lO,{children:_Ce.map(e=>(0,$.jsx)(uO,{value:e,"data-ref":e,children:i(a0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:gCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===s?J.DEFAULT:J.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(o0(e))},e))})]}),p&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:p})}),!(p&&h.length===0)&&(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`p-card`,children:r?g&&h.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):h.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(_J,{children:[(0,$.jsx)(vJ,{children:(0,$.jsxs)(bJ,{children:[(0,$.jsx)(xJ,{children:i(a0(a))}),(0,$.jsx)(xJ,{children:i(`columnAccepted`)}),(0,$.jsx)(xJ,{children:i(`columnAcceptedWithModifications`)}),(0,$.jsx)(xJ,{children:i(`columnRejected`)}),(0,$.jsx)(xJ,{children:i(`columnNotDecided`)}),(0,$.jsx)(xJ,{children:i(`columnOverrideRate`)})]})}),(0,$.jsx)(yJ,{children:h.map((e,t)=>{let r=vCe(e,a),o=yCe(e.overrideRate,n);return(0,$.jsxs)(bJ,{children:[(0,$.jsx)(SJ,{children:r??i(`unattributed`)}),(0,$.jsx)(SJ,{children:e.accepted}),(0,$.jsx)(SJ,{children:e.acceptedWithModifications}),(0,$.jsx)(SJ,{children:e.rejected}),(0,$.jsx)(SJ,{children:e.notDecided}),(0,$.jsx)(SJ,{children:o??i(`nothingDecided`)})]},r??`unattributed-${t}`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})})})]}):null},s0=B.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,c0=ar(Ni.shape.status),l0=ar(Ni.shape.autonomousTrigger);function xCe(e){return`reason_${e}`}function SCe(e){return`concurrency_${e}`}function CCe(e){if(e.caseLimit!==void 0&&e.matchedCaseCount!==void 0)return{matched:e.matchedCaseCount,limit:e.caseLimit}}var u0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(u0||={});var wCe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:s0,keys:[`system_enums`]}),{currentOrganizationId:i}=pg(),a=(0,Q.useCallback)((t,n)=>e(s0,t,n),[e]),o=(0,Q.useCallback)((e,n)=>{if(!e)return n;let r=Pc(e,n),i=t(r);return i===r?n:i},[t]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(u0.LOADING);if((0,Q.useEffect)(()=>{if(!i)return;let e=!1;return u(u0.LOADING),bc().readAutonomousAgentsOverview(i).then(t=>{e||(c(t),u(u0.READY))}).catch(()=>{e||u(u0.FAILED)}),()=>{e=!0}},[i]),!n)return null;let d=s&&s.organizationId===i?s:null,f=d?.agents??[],p=d?.undeclaredAgentRefusals??[],m=d?.refusalsScannedSince;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`pageDescription`)}),i?l===u0.FAILED?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:a(`errorGeneric`)})}):l===u0.LOADING?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`loading`)}):f.length===0&&p.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`empty`)}):(0,$.jsxs)($.Fragment,{children:[f.map(e=>(0,$.jsx)(TCe,{agent:e,scannedSince:m,tc:a,word:o,formatDateTime:r},e.ref)),p.map(e=>(0,$.jsx)(EF,{"data-autonomous-agent-undeclared":e.autonomousAgentRef,children:(0,$.jsxs)(NF,{className:`flex flex-col gap-section p-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.autonomousAgentRef}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`undeclaredAgent`)})]}),(0,$.jsx)(f0,{refusals:e.recentRefusals,scannedSince:m,tc:a,word:o,formatDateTime:r})]})},e.autonomousAgentRef))]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)})]})};function d0(e,t){return e?e.organizationRelationshipId===null?t(`partyOwn`):e.representingOrganizationName??t(`partyUnnamedRelationship`):null}function TCe({agent:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){let a=__(c0??``)?.values;return(0,$.jsx)(EF,{"data-autonomous-agent":e.ref,children:(0,$.jsxs)(NF,{className:`flex flex-col gap-section p-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.ref}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-section gap-y-element text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`systemLabel`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.systemRef}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`scheduleLabel`)}),(0,$.jsx)(`dd`,{children:e.schedule?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(`code`,{className:`font-mono`,children:e.schedule.cronJobExpression}),e.schedule.perCaseResourceType?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`perCase`)}):null]}):n(`scheduleNone`)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`concurrencyLabel`)}),(0,$.jsx)(`dd`,{children:n(SCe(e.concurrency))})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":n(`recentRunsHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`recentRunsHeading`)}),e.recentRuns.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n(`noRuns`)}):(0,$.jsxs)(_J,{children:[(0,$.jsx)(vJ,{children:(0,$.jsxs)(bJ,{children:[(0,$.jsx)(xJ,{children:n(`columnStatus`)}),(0,$.jsx)(xJ,{children:n(`columnParty`)}),(0,$.jsx)(xJ,{children:n(`columnTrigger`)}),(0,$.jsx)(xJ,{children:n(`columnCase`)}),(0,$.jsx)(xJ,{children:n(`columnStarted`)}),(0,$.jsx)(xJ,{children:n(`columnFinished`)})]})}),(0,$.jsx)(yJ,{children:e.recentRuns.map(e=>(0,$.jsxs)(bJ,{"data-autonomous-run":e.executionId,children:[(0,$.jsx)(SJ,{children:(0,$.jsx)(If,{variant:a?.[e.status]?.color??`outline`,dot:!0,children:r(c0,e.status)})}),(0,$.jsx)(SJ,{"data-autonomous-party":!0,children:d0(e.party,n)}),(0,$.jsx)(SJ,{children:e.trigger?r(l0,e.trigger):null}),(0,$.jsx)(SJ,{className:`font-mono`,children:e.caseRef?.resourceId??null}),(0,$.jsx)(SJ,{children:i(e.createdAt)}),(0,$.jsx)(SJ,{children:e.finishedAt?i(e.finishedAt):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`notFinished`)})})]},e.executionId))})]}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:n(`allRunsHint`)})]}),(0,$.jsx)(f0,{refusals:e.recentRefusals,scannedSince:t,tc:n,word:r,formatDateTime:i})]})})}function f0({refusals:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":n(`recentRefusalsHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`recentRefusalsHeading`)}),e.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:t?n(`noRefusalsSince`,{since:i(t)}):n(`noRefusals`)}):(0,$.jsxs)(_J,{children:[(0,$.jsx)(vJ,{children:(0,$.jsxs)(bJ,{children:[(0,$.jsx)(xJ,{children:n(`columnRefusedAt`)}),(0,$.jsx)(xJ,{children:n(`columnParty`)}),(0,$.jsx)(xJ,{children:n(`columnTrigger`)}),(0,$.jsx)(xJ,{children:n(`columnReason`)})]})}),(0,$.jsx)(yJ,{children:e.map(e=>(0,$.jsxs)(bJ,{"data-autonomous-refusal":e.reason,children:[(0,$.jsx)(SJ,{children:i(e.refusedAt)}),(0,$.jsx)(SJ,{"data-autonomous-party":!0,children:d0(e.party,n)}),(0,$.jsx)(SJ,{children:r(l0,e.trigger)}),(0,$.jsx)(SJ,{children:n(xCe(e.reason),CCe(e))})]},`${e.occurrenceKey}:${e.refusedAt}:${e.party?e.party.organizationRelationshipId??`own`:`unknown`}`))})]})]})}function p0(e,t,n){let r=Ft(t);if(r!==void 0)return n(Qt(BigInt(e),r),{style:`currency`,currency:t,minimumFractionDigits:r,maximumFractionDigits:r})}var m0=B.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,h0;(function(e){e.APPLICATION=`application`,e.REPRESENTING_ORGANIZATION=`representing-organization`})(h0||={});var g0;(function(e){e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_90_DAYS=90]=`LAST_90_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(g0||={});var ECe=[g0.LAST_30_DAYS,g0.LAST_90_DAYS,g0.LAST_365_DAYS],DCe=Object.values(ia),_0;(function(e){e.GENERIC=`generic`,e.ACCESS_GRANT_REQUIRED=`accessGrantRequired`})(_0||={});function OCe(e){return e===_0.ACCESS_GRANT_REQUIRED?`errorAccessGrantRequired`:`errorGeneric`}function v0(e){return`groupBy_${e}`}function kCe(e){return`window_${e}`}function ACe(e){return`decisionTime_${e}`}function jCe(e,t){switch(t){case ia.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType} · ${e.key.caseRef.resourceId}`:void 0;case ia.ORGANIZATION:return e.key.organizationId;case ia.AGENT:return e.key.agentRef;case ia.MODEL:return e.key.model?[e.key.provider,e.key.model].filter(Boolean).join(` · `):void 0}}function MCe(e){if(e.availability===dae.JOINED)return{decisions:e.decisionCount??0,minutes:Math.round((e.reviewDurationMs??0)/6e4)}}var y0=({scope:e})=>{let{tComponent:t,isReady:n,formatNumber:r}=K({component:m0}),i=(0,Q.useCallback)((e,n)=>t(m0,e,n),[t]),{currentOrganizationId:a}=pg(),o=e===h0.REPRESENTING_ORGANIZATION?a??void 0:void 0,s=e===h0.REPRESENTING_ORGANIZATION&&!o,[c,l]=(0,Q.useState)(ia.CASE),[u,d]=(0,Q.useState)(g0.LAST_30_DAYS),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),[g,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(s){_(null),h(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-u*24*60*6e4);return h(!0),_(null),bc().summarizeModelCost({from:n.toISOString(),to:t.toISOString(),groupBy:c,...o?{organizationId:o}:{}}).then(t=>{e||p({summary:t,windowDays:u,organizationId:o})}).catch(t=>{e||(jr(t)&&t.customMessageReference===Xl.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?_(_0.ACCESS_GRANT_REQUIRED):_(_0.GENERIC))}).finally(()=>{e||h(!1)}),()=>{e=!0}},[c,u,o,s]);let v=f&&f.windowDays===u&&f.summary.groupBy===c&&f.organizationId===o?f.summary:null,y=(0,Q.useMemo)(()=>v?.groups??[],[v]),b=m||v===null;if(!n)return null;let x=e=>{let t=e.totals.flatMap(e=>{let t=p0(e.costMinor,e.currency,r);return t===void 0?[]:[t]});return t.length>0?t.join(`, `):i(`noPricedCost`)},S=e=>e.totals.reduce((e,t)=>e+t.totalTokens,0);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(e===h0.REPRESENTING_ORGANIZATION?`representingPageTitle`:`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(e===h0.REPRESENTING_ORGANIZATION?`representingPageDescription`:`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(cO,{value:c,onValueChange:e=>l(e),children:(0,$.jsx)(lO,{children:DCe.map(e=>(0,$.jsx)(uO,{value:e,"data-ref":e,children:i(v0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:ECe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===u?J.DEFAULT:J.OUTLINE,"aria-pressed":e===u,onClick:()=>d(e),children:i(kCe(e))},e))})]}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)}):g?(0,$.jsx)(jD,{variant:g===_0.ACCESS_GRANT_REQUIRED?`default`:`destructive`,children:(0,$.jsx)(ND,{children:i(OCe(g))})}):(0,$.jsx)(EF,{children:(0,$.jsxs)(NF,{className:`flex flex-col gap-element p-card`,children:[b&&y.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):y.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(_J,{children:[(0,$.jsx)(vJ,{children:(0,$.jsxs)(bJ,{children:[(0,$.jsx)(xJ,{children:i(v0(c))}),(0,$.jsx)(xJ,{children:i(`columnCost`)}),(0,$.jsx)(xJ,{children:i(`columnCalls`)}),(0,$.jsx)(xJ,{children:i(`columnUnpriced`)}),(0,$.jsx)(xJ,{children:i(`columnTokens`)}),(0,$.jsx)(xJ,{children:i(`columnClassifierCalls`)}),(0,$.jsx)(xJ,{children:i(`columnDocumentExtractionCalls`)}),(0,$.jsx)(xJ,{children:i(`columnPersonalDataWithheld`)}),c===ia.CASE?(0,$.jsx)(xJ,{children:i(`columnDecisionTime`)}):null]})}),(0,$.jsx)(yJ,{children:y.map((e,t)=>{let n=jCe(e,c);return(0,$.jsxs)(bJ,{"data-model-cost-group":n??`unattributed`,children:[(0,$.jsx)(SJ,{className:n?`font-mono`:`text-muted-foreground`,children:n??i(`unattributed`)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:x(e)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.callCount)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.unpricedCallCount)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(S(e))}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.classifierCallCount)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.documentExtractionCallCount)}),(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.personalDataFieldsWithheld)}),c===ia.CASE?(0,$.jsx)(SJ,{children:e.decisionTime?i(ACe(e.decisionTime.availability),MCe(e.decisionTime)):null}):null]},n??`unattributed-${t}`)})})]}),v&&v.unattributedCallCount>0?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(`windowUnattributed`,{count:v.unattributedCallCount})}):null,v&&v.unpricedCallCount>0?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(`windowUnpriced`,{count:v.unpricedCallCount})}):null]})})]})},b0=B.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,x0;(function(e){e[e.LAST_7_DAYS=7]=`LAST_7_DAYS`,e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(x0||={});var NCe=[x0.LAST_7_DAYS,x0.LAST_30_DAYS,x0.LAST_365_DAYS];function PCe(e){return`window_${e}`}function S0(e){return`disclosure_${e}`}function FCe(e){return`outcome_${e}`}function ICe(e){let t=[e.resourceType,e.operationIdentifier,e.resourceId].filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):void 0}var LCe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:b0}),i=(0,Q.useCallback)((t,n)=>e(b0,t,n),[e]),{currentOrganizationId:a}=pg(),o=a??void 0,[s,c]=(0,Q.useState)(x0.LAST_30_DAYS),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(async e=>bc().readRepresentativeActivity(e),[]);(0,Q.useEffect)(()=>{if(!o){m(!1),f(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-s*24*60*6e4),r={organizationId:o,from:n.toISOString(),to:t.toISOString()};return f(!0),m(!1),g(!1),v(null),y(r).then(t=>{e||u({...r,rows:t.rows,nextCursor:t.nextCursor,windowDays:s})}).catch(()=>{e||m(!0)}).finally(()=>{e||f(!1)}),()=>{e=!0}},[o,s,y]);let b=(0,Q.useCallback)(()=>{if(!l?.nextCursor)return;let e=l;f(!0),g(!1),y({organizationId:e.organizationId,from:e.from,to:e.to,cursor:e.nextCursor}).then(t=>u(n=>n===e?{...e,rows:[...e.rows,...t.rows],nextCursor:t.nextCursor}:n)).catch(()=>g(!0)).finally(()=>f(!1))},[l,y]),x=l&&l.windowDays===s&&l.organizationId===o?l:null,S=x?.rows??[];if(!n)return null;let C=e=>{let n=Pc(uie.CORE_AUDITABLE_EVENT_TYPE,e),r=t(n);return r===n?os(e):r};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`pageDescription`)}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:NCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===s?J.DEFAULT:J.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(PCe(e))},e))}),o?p?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:i(`errorGeneric`)})}):(0,$.jsx)(EF,{children:(0,$.jsxs)(NF,{className:`flex flex-col gap-element p-card`,children:[x===null?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):S.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(_J,{children:[(0,$.jsx)(vJ,{children:(0,$.jsxs)(bJ,{children:[(0,$.jsx)(xJ,{children:i(`columnWhen`)}),(0,$.jsx)(xJ,{children:i(`columnOrganization`)}),(0,$.jsx)(xJ,{children:i(`columnPerson`)}),(0,$.jsx)(xJ,{children:i(`columnEvent`)}),(0,$.jsx)(xJ,{children:i(`columnTarget`)}),(0,$.jsx)(xJ,{children:i(`columnOutcome`)}),(0,$.jsx)(xJ,{children:i(`columnDetail`)})]})}),(0,$.jsx)(yJ,{children:S.map(e=>{let t=ICe(e),n=_===e.eventId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(bJ,{"data-representative-activity-row":e.eventId,"data-disclosure":e.disclosure,children:[(0,$.jsx)(SJ,{className:`tabular-nums`,children:r(e.createdAt)}),(0,$.jsx)(SJ,{className:e.grantingOrganizationName?void 0:`font-mono`,children:e.grantingOrganizationName??e.grantingOrganizationId}),(0,$.jsx)(SJ,{className:e.userName?void 0:e.userId?`font-mono`:`text-muted-foreground`,children:e.userName??e.userId??e.agentRef??i(`automatedActor`)}),(0,$.jsx)(SJ,{children:C(e.eventType)}),(0,$.jsx)(SJ,{className:`font-mono`,children:t??null}),(0,$.jsx)(SJ,{className:e.outcome===Ns.FAILURE?`text-destructive`:void 0,children:i(FCe(e.outcome))}),(0,$.jsx)(SJ,{children:e.disclosure===Ql.FULL?(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-expanded":n,onClick:()=>v(n?null:e.eventId),children:i(n?`hideDetail`:S0(Ql.FULL))}):(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(S0(Ql.METADATA))})})]}),n&&e.eventData?(0,$.jsx)(bJ,{children:(0,$.jsx)(SJ,{colSpan:7,children:(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-all text-xs`,"data-representative-activity-detail":e.eventId,children:JSON.stringify(e.eventData,null,2)})})}):null]},e.eventId)})})]}),h?(0,$.jsx)(Z,{className:`text-xs text-destructive`,children:i(`errorLoadMore`)}):null,x?.nextCursor?(0,$.jsx)(`div`,{children:(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:d,onClick:b,children:i(`loadMore`)})}):null]})}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})]})},C0=B.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,w0=864e5,RCe=i0.LAST_365_DAYS,zCe=[i0.LAST_30_DAYS,i0.LAST_90_DAYS,i0.LAST_365_DAYS],BCe=Fte.shape.destination.maxLength??void 0,VCe=bd().min(1);function HCe(e,t){return`evaluation-dataset-${e}-${t}.jsonl`}function UCe(e,t){let n=e.resourceConfigurations[ul.EVALUATION_EXPORT_AUTHORIZATIONS],r=n?.operations.find(e=>e.operationIdentifier===W.READ&&e.isOperationDefault===!0&&e.variantType===at.API_CALL);if(!n||!r)return;let i=tm.buildResourceOperationContextIdentifiers({currentOrganizationId:t,primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}});return{operationPathKey:Ta.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e)}}var WCe=()=>{let{tComponent:e,isReady:t}=K({component:C0}),{currentOrganizationId:n}=pg(),{registry:r,doOperation:i}=fm(),a=(0,Q.useCallback)(t=>e(C0,t),[e]),o=(0,Q.useCallback)((t,n)=>e(C0,t,n),[e]),s=(0,Q.useRef)(a);s.current=a;let[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(!0),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(i0.LAST_90_DAYS),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(T(null),!n)return;let e=UCe(r,n);if(e===void 0)return;let t=!1;return i(e.operationPathKey,{contextualParameters:e.contextualParameters},{silent:!0,riskLevel:zi.LOW}).then(e=>{t||T(e?.status===Lne.ACTIVE)}).catch(()=>{}),()=>{t=!0}},[n,i,r]);let E=w===!1;(0,Q.useEffect)(()=>{if(!n){l([]),d(!1);return}let e=!1,t=new Date;return d(!0),bc().summarizeAgentWorkOverrideRate({from:new Date(t.getTime()-RCe*w0).toISOString(),to:t.toISOString(),groupBy:wl.AGENT,organizationId:n}).then(t=>{e||l([...new Set(t.groups.map(e=>e.key.agentRef).filter(e=>typeof e==`string`&&e.length>0))])}).catch(()=>{e||C(s.current(`errorGeneric`))}).finally(()=>{e||d(!1)}),()=>{e=!0}},[n]);let D=(0,Q.useCallback)(async()=>{if(!n||E||f===``||g.trim()===``)return;y(!0),C(null),x(null);let e=new Date;try{let t=await bc().exportEvaluationDataset({organizationId:n,agentRef:f,from:new Date(e.getTime()-m*w0).toISOString(),to:e.toISOString(),destination:g.trim()});Hy(new Blob([t.jsonl],{type:`application/x-ndjson`}),HCe(f,t.exportId)),x({exportId:t.exportId,recordCount:t.recordCount})}catch(e){ri(e)||C(a(`errorGeneric`))}finally{y(!1)}},[f,E,n,g,a,m]);return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`pageDescription`)}),S&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:S})}),E&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:a(`authorizationMissingNotice`)})}),b&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:o(`exportedNotice`,{count:b.recordCount})})}),(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`flex flex-col gap-group p-card`,children:n?u?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`loading`)}):c.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noAgents`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`agentLabel`)}),(0,$.jsx)(mF,{name:`agentRef`,schema:VCe,options:c.map(e=>({value:e,label:e})),value:f,placeholder:a(`agentPlaceholder`),onChange:e=>{p(e),x(null)}})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`windowLabel`)}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":a(`windowLabel`),children:zCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===m?J.DEFAULT:J.OUTLINE,"aria-pressed":e===m,onClick:()=>h(e),children:a(o0(e))},e))})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`destinationLabel`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:a(`destinationDescription`)}),(0,$.jsx)(QM,{"aria-label":a(`destinationLabel`),type:`text`,maxLength:BCe,value:g,onChange:e=>_(e.target.value)})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:v||E||f===``||g.trim()===``,onClick:()=>{D()},children:a(v?`runningButton`:`runButton`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)})})})]}):null},T0=new Set;function E0(e){let{resolvedFeatures:t,resolvedFeaturesResponse:n,featureDefinitions:r,unavailabilityPolicy:i,isLoading:a}=Ch(),{permissions:o}=pg(),{track:s,isActive:c}=m$(),l=Yh(),u=Zp(),d=(0,Q.useMemo)(()=>{if(a)return{isAvailable:!0,behavior:Jo.DISABLE};let s=r.get(e);if(!s){let{behavior:t,debugTrace:n}=sg({reason:fs.NOT_CONFIGURED,featureDef:void 0,policy:i,userRoles:[],billingEnabled:l?.isEnabled??!1});return{isAvailable:!1,reason:fs.NOT_CONFIGURED,behavior:t,missingFeatures:[e],debugTrace:xa.isDevelopment()?n:void 0}}let c=Bh(o,u?.currentOrganizationId??null);if(s.valueType===_l.BOOLEAN){if(new Set(t.features).has(e))return{isAvailable:!0,behavior:Jo.DISABLE};let r=fs.FEATURE_NOT_ENABLED,{behavior:a,suggestedProductRef:o,customComponentRef:u,debugTrace:d}=sg({reason:r,featureDef:s,policy:i,userRoles:c,billingEnabled:l?.isEnabled??!1}),f=n?.upgradeOptions?.[e]?.availableVia;return{isAvailable:!1,reason:r,behavior:a,missingFeatures:[e],upgradeOptions:f,suggestedProductRef:o,customComponentRef:u,debugTrace:xa.isDevelopment()?d:void 0}}if(s.valueType===_l.LIMIT){let r=t.limits[e];if(r===void 0||r===-1)return{isAvailable:!0,behavior:Jo.DISABLE};let a=t.currentUsage[e]??0;if(a<r)return{isAvailable:!0,behavior:Jo.DISABLE};let o=fs.LIMIT_EXCEEDED,{behavior:u,suggestedProductRef:d,customComponentRef:f,debugTrace:p}=sg({reason:o,featureDef:s,policy:i,userRoles:c,billingEnabled:l?.isEnabled??!1}),m=n?.upgradeOptions?.[e]?.availableVia;return{isAvailable:!1,reason:o,behavior:u,limitInfo:{featureId:e,current:a,limit:r},upgradeOptions:m,suggestedProductRef:d,customComponentRef:f,debugTrace:xa.isDevelopment()?p:void 0}}return{isAvailable:!0,behavior:Jo.DISABLE}},[e,a,t,n,r,i,o,u?.currentOrganizationId,l?.isEnabled]);return(0,Q.useEffect)(()=>{if(!c)return;let t=`${e}:${d.isAvailable}`;T0.has(t)||(T0.add(t),s(`feature_gate`,{featureRef:e,isAvailable:d.isAvailable,reason:d.reason}),d.isAvailable&&s(`feature_accessed`,{featureId:e}))},[e,d.isAvailable,d.reason,c,s]),d}function D0({featureId:e,children:t,renderUnavailable:n}){let r=E0(e),i=Nh();return r.isAvailable?(0,$.jsx)($.Fragment,{children:t}):r.behavior===Jo.HIDE?null:n?(0,$.jsx)($.Fragment,{children:n(r)}):(0,$.jsx)(Kh,{behavior:r.behavior,missingFeatures:r.missingFeatures,limitInfo:r.limitInfo,upgradeOptionsCount:r.upgradeOptions?.length,customComponentRef:r.customComponentRef,onDismiss:void 0,onAction:()=>i(r)})}function GCe(e,t){switch(t.type){case`push`:return[...e,{id:dh.generateStackEntryId(),context:t.context}];case`pop`:return e.length>1?e.slice(0,-1):e;case`resetToRoot`:return e.length>1?[e[0]]:e}}function KCe(e){return{navigate:t=>{dh.isResourceOperationContent(t.content)?e.dispatch({type:`push`,context:t.content.resourceContext}):e.globalController.navigate(t)},navigateToResource:t=>e.dispatch({type:`push`,context:t}),goBack:()=>e.dispatch({type:`pop`}),closeOverlay:()=>e.dispatch({type:`resetToRoot`}),dismissZone:t=>e.globalController.dismissZone(t),canGoBack:()=>e.getDepth()>1,resourceRelationshipDepth:e.globalController.resourceRelationshipDepth}}function qCe({rootContext:e}){let t=ES(),[n,r]=(0,Q.useReducer)(GCe,e,e=>[{id:dh.generateStackEntryId(),context:e}]),i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useMemo)(()=>KCe({dispatch:r,getDepth:()=>i.current.length,globalController:t}),[t]),o=n[n.length-1];return(0,$.jsx)(TS.Provider,{value:a,children:(0,$.jsx)(WY,{resourceContext:o.context,navigationZone:rr.OVERLAY,navigationInitiator:{sourceZone:rr.OVERLAY}},o.id)})}function JCe(e,t,n,r){return t!==Vr.APPLICATION||!r||e[ul.ORGANIZATIONS]!==void 0?e:(n.initiatorInfos??[]).some(e=>e.parameters?.some(e=>e.resourceType===ul.ORGANIZATIONS))?{...e,[ul.ORGANIZATIONS]:r}:e}function YCe(e,t,n){let r=(Array.isArray(e.operations)?e.operations:[]).filter(e=>String(e.operationIdentifier)===t);if(r.length===0)return;if(n)return r.find(e=>e.variantKey===n);let i=r.filter(e=>e.isOperationDefault===!0);if(i.length===1)return i[0];if(r.length===1)return r[0]}function XCe({message:e}){return(0,$.jsx)(`div`,{className:`p-card text-sm text-muted-foreground`,children:e})}function ZCe({resourceType:e,operation:t,operationVariant:n}){let{registry:r}=fm(),i=Zp(),a=(0,Q.useContext)(Fi)?.appIdentity?.applicationId??i?.currentApplicationId??null,o=(0,Q.useMemo)(()=>{let o=r.resourceConfigurations[e];if(!o)return;let s=YCe(o,t,n);if(!s)return;let c=JCe(tm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:a,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:o.resourcePrimaryScope,liveAppScopeContextResourceIdentifiers:i?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:{}}),o.resourcePrimaryScope,s,i?.currentOrganizationId),l=Mx(o,r.allResourceFieldIdentifiers)&&_o(s)&&c[e]===void 0?c[ul.USERS]:void 0,u=typeof l==`string`?{...c,[e]:l}:c,d=On.buildParentResourcesRequirements(e,u,r);return On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:s,contextResourceIdentifiers:u,parentResourcesRequirements:d})},[r,e,t,n,i,a]);if(!o)return(0,$.jsx)(XCe,{message:`Settings surface unavailable for ${e} (${t}).`});let s=[e,t,n??``,i?.currentOrganizationId??``,i?.currentUserId??``,a??``].join(`|`);return(0,$.jsx)(qCe,{rootContext:o},s)}function QCe(e){return[...e.categories].sort((e,t)=>(e.order??0)-(t.order??0))}function $Ce(e,t){return e.sections.filter(e=>e.categoryRef===t).sort((e,t)=>(e.order??0)-(t.order??0))}function ewe(e,t){let n=[...e.groups??[]].sort((e,t)=>(e.order??0)-(t.order??0)),r=new Set(n.map(e=>e.ref)),i=t.filter(e=>e.groupRef===void 0||!r.has(e.groupRef));return[...i.length>0?[{sections:i}]:[],...n.map(e=>({group:e,sections:t.filter(t=>t.groupRef===e.ref)})).filter(e=>e.sections.length>0)]}function twe(e,t){return t&&e.sections.some(e=>e.ref===t)?t:e.defaultSectionRef&&e.sections.some(t=>t.ref===e.defaultSectionRef)?e.defaultSectionRef:e.sections[0]?.ref}function nwe({panelRef:e}){switch(e){case _v.SECURITY:return(0,$.jsx)(MSe,{});case _v.APPEARANCE:return(0,$.jsx)(VSe,{});case _v.INVITATIONS:return(0,$.jsx)(WSe,{});case _v.BILLING:return(0,$.jsx)(qSe,{});case _v.CONNECTED_ACCOUNTS:return(0,$.jsx)(n0,{ownerScope:I.USER});case _v.ORGANIZATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(n0,{ownerScope:I.ORGANIZATION});case _v.APPLICATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(n0,{ownerScope:I.APPLICATION});case _v.AGENT_WORK_OVERRIDE_RATE:return(0,$.jsx)(bCe,{});case _v.AUTONOMOUS_AGENTS:return(0,$.jsx)(wCe,{});case _v.MODEL_COST_BREAKDOWN:return(0,$.jsx)(y0,{scope:h0.APPLICATION});case _v.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN:return(0,$.jsx)(y0,{scope:h0.REPRESENTING_ORGANIZATION});case _v.REPRESENTATIVE_ACTIVITY:return(0,$.jsx)(LCe,{});case _v.AGENT_WORK_EVALUATION_EXPORT:return(0,$.jsx)(WCe,{})}}function O0({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){switch(e.kind){case gv.ENGINE_PANEL:return(0,$.jsx)(nwe,{panelRef:e.panelRef});case gv.CUSTOM_COMPONENT:{let t=Fo.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{})}):(0,$.jsx)(al,{componentType:e.componentRef,componentName:e.componentRef})}case gv.RESOURCE_OPERATION:return(0,$.jsx)(ZCe,{resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant});case gv.SUB_TABS:return(0,$.jsx)(rwe,{target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r})}}function rwe({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){let i=e.subTabs.some(e=>e.ref===n)?n:e.subTabs[0]?.ref;return e.subTabs.length===0?null:(0,$.jsxs)(cO,{value:i,onValueChange:e=>r?.(e),children:[(0,$.jsx)(lO,{children:e.subTabs.map(e=>(0,$.jsx)(uO,{value:e.ref,"data-ref":e.ref,children:t(e.ref,e.label)},e.ref))}),e.subTabs.map(e=>(0,$.jsx)(dO,{value:e.ref,children:(0,$.jsx)(O0,{target:e.target,resolveSubTabLabel:t})},e.ref))]})}var iwe=`inline-flex w-full cursor-pointer items-center justify-start gap-1.5 whitespace-nowrap rounded-md px-card-sm py-item text-sm font-medium no-underline [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`;function awe({sectionRef:e,subTabRef:t}){let n=F$(),r=(0,Q.useMemo)(()=>QCe(n),[n]),i=(0,Q.useMemo)(()=>twe(n,e),[n,e]),a=oh(),o=(0,Q.useCallback)(e=>{i&&a(`${Ln.settings}/${i}/${e}`,{replace:!0})},[i,a]),{UIConfig:s,getRecipe:c}=Wg(),l=c(cc.SELECTABLE,Pa.FILLED),u=c(cc.TYPOGRAPHY,y.EYEBROW),d=c(cc.TYPOGRAPHY,y.LABEL),{renderIcon:f}=Mf(),p=s?.currentBreakpoint===Sl.MOBILE,m=p&&!!e,h=(0,Q.useCallback)(()=>{a(Ln.settings,{replace:!0})},[a]),{tComponent:g,tSettingsHubCategory:_,tSettingsHubGroup:v,tSettingsHubSection:b,isReady:x}=K({component:B.APP_LAYOUTS_SETTINGS_HUB}),S=(0,Q.useCallback)(e=>g(B.APP_LAYOUTS_SETTINGS_HUB,e),[g]),C=(0,Q.useMemo)(()=>{let e=n.sections.find(e=>e.ref===i);return e?b(e.ref,e.label):void 0},[n.sections,i,b]),w=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{i&&w.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[i]),(0,$.jsx)(sb,{readiness:[{id:`settings-hub-labels`,isReady:x}],children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col min-w-0`,children:[(0,$.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-item border-b px-card-lg`,children:[m&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,"aria-label":S(`backToSections`),onClick:h,children:f(H.BACK,{size:ca.SM})}),(0,$.jsx)(`h2`,{className:`truncate text-base font-semibold tracking-tight`,children:m?C??S(`title`):S(`title`)})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsx)(`nav`,{"aria-label":S(`sectionsNavLabel`),className:U(`overflow-y-auto px-card-sm py-card`,p?`w-full flex-1`:`w-60 shrink-0 border-e`,m&&`hidden`),children:r.map((e,t)=>{let r=$Ce(n,e.ref);if(r.length===0)return null;let a=`settings-hub-category-${e.ref}`;return(0,$.jsxs)(Q.Fragment,{children:[t>0&&(0,$.jsx)(E1,{className:`my-item`}),(0,$.jsx)(`div`,{id:a,className:U(`px-card-sm py-card-sm`,u.base),children:_(e.ref,e.label)}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,children:ewe(e,r).map(t=>(0,$.jsxs)(Q.Fragment,{children:[t.group&&(0,$.jsx)(`div`,{id:`${a}-group-${t.group.ref}`,className:U(`px-card-sm pt-card-sm pb-item-xs text-muted-foreground`,d.base),children:v(e.ref,t.group.ref,t.group.label)}),(0,$.jsx)(`div`,{role:t.group?`group`:void 0,"aria-labelledby":t.group?`${a}-group-${t.group.ref}`:void 0,children:t.sections.map(e=>{let t=e.ref===i;return(0,$.jsxs)(Oh,{ref:t?w:void 0,to:`${Ln.settings}/${e.ref}`,replace:!0,"data-ref":e.ref,"aria-current":t?`page`:void 0,"data-state":t?`active`:`inactive`,className:U(iwe,l.base,l.states.focus,l.states.selected,l.motion.transition),children:[e.icon&&f(e.icon,{size:ca.SM}),b(e.ref,e.label)]},e.ref)})})]},t.group?.ref??`__ungrouped`))})]},e.ref)})}),(0,$.jsx)(`div`,{className:U(`min-w-0 flex-1 overflow-y-auto p-card-lg`,p&&!m&&`hidden`),children:n.sections.filter(e=>e.ref===i).map(e=>(0,$.jsx)(Q.Fragment,{children:e.entitlementFeatureId?(0,$.jsx)(owe,{featureId:e.entitlementFeatureId,keptConfigurationNotice:S(`entitlementLapsedConfigurationKept`),children:(0,$.jsx)(O0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})}):(0,$.jsx)(O0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})},e.ref))})]})]})})}function owe({featureId:e,keptConfigurationNotice:t,children:n}){let r=E0(e),i=!r.isAvailable&&r.behavior!==Jo.HIDE,a=(r.upgradeOptions?.length??0)>0;return i?(0,$.jsxs)(`div`,{className:`space-y-card`,children:[(0,$.jsx)(jD,{variant:`info`,children:(0,$.jsx)(ND,{children:t})}),a&&(0,$.jsx)(D0,{featureId:e,children:null}),n]}):(0,$.jsx)(`div`,{className:`space-y-card`,children:(0,$.jsx)(D0,{featureId:e,children:n})})}function swe(e){return e.requested===null||e.isMobile?null:e.requested===Cl.SECONDARY?e.secondaryShown&&e.secondaryHasContent?Cl.SECONDARY:null:e.requested===Cl.COMPANION&&e.companionShown&&e.companionHasContent?Cl.COMPANION:null}function cwe(e){if(e.key!==`Escape`||!e.emphasized||e.overlayOpen)return!1;let t=e.target instanceof HTMLElement?e.target:null;if(t===null)return!0;if(t.isContentEditable)return!1;let n=t.tagName;return n!==`INPUT`&&n!==`TEXTAREA`&&n!==`SELECT`}function lwe(e){let{homeCompositeViewRef:t,isAppRootPath:n,primaryStackTop:r}=e;if(n&&t&&!(r&&r.contentType!==sd.ENGINE_PAGE))return{contentType:sd.COMPOSITE_VIEW,viewRef:t}}function uwe(e){let{primaryContent:t,compositeViews:n}=e;return t?t.contentType===sd.COMPOSITE_VIEW?n?.some(e=>e.ref===t.viewRef)??!1:!0:!1}function k0(e){let{primaryContent:t,compositeViews:n,resolveExecutionView:r}=e;if(t){if(t.contentType===sd.RESOURCE_OPERATION)return t.resourceContext?.operation?.operationFrontendConfig;if(t.contentType===sd.COMPOSITE_VIEW)return n?.find(e=>e.ref===t.viewRef);if(t.contentType===sd.EXECUTION_VIEW)return r?.(t.viewRef)}}function A0({zone:e,zones:t,destinationOverride:n}){return e===Cl.PRIMARY?Sa.COLLAPSE:n??t?.[e]?.onEmpty??Sa.COLLAPSE}function j0(e){return e===Sa.EMPTY_STATE}function M0(e){return e.hasContent&&!j0(e.behavior)}function dwe(e){return k0(e)?.adjacentZoneOnEmpty}var N0={maxWidth:`content`,fillsHeight:!1};function fwe(e){let t=k0(e);return{maxWidth:t?.zoneContentMaxWidth??N0.maxWidth,fillsHeight:t?.zoneContentFillsHeight??N0.fillsHeight}}function P0(e){return{maxWidth:k0({primaryContent:e.zoneContent,compositeViews:e.compositeViews,resolveExecutionView:e.resolveExecutionView})?.zoneContentMaxWidth??N0.maxWidth,fillsHeight:!1}}function pwe(e,t){return e.maxWidth===N0.maxWidth?t:{...t,geometry:{responsiveMaxWidth:e.maxWidth}}}function mwe(e){return e.fillsHeight?`flex h-full min-h-0 flex-col`:void 0}var hwe=Q.lazy(()=>h_(()=>import(`./ChartView-Qqvf_azZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),F0=as.getLogger(),I0=F0.debugByType(`NavigationContentAreas`);F0.setDebugTypeLogging(`NavigationContentAreas`,!1);var gwe={[po.HOME]:qU,[po.DECISIONS]:GW},_we=`no-entry`;function L0(e,t){let n=t||_we,r=e=>Object.entries(e??{}).map(([e,t])=>`${e}:${t}`).join(`|`);switch(e.contentType){case sd.RESOURCE_OPERATION:{let t=e.resourceContext,r=Object.entries(t.contextResourceIdentifiers).map(([e,t])=>`${e}:${typeof t==`string`?t:t.resourceId}`).join(`|`);return`${e.contentType}-${t.resourceType}-${t.operationIdentifier}-${r}-${n}`}case sd.COMPOSITE_VIEW:case sd.CHART_VIEW:case sd.FULL_CUSTOM_VIEW:case sd.FLOWS_ACTORS_VIEW:case sd.EXECUTION_VIEW:return`${e.contentType}-${e.viewRef}-${e.contentType===sd.CHART_VIEW?e.runtimeDescriptor?.identity.insertedViewRef??``:``}-${r(e.contextResourceIdentifiers)}-${e.contentType===sd.CHART_VIEW?r(e.urlParamValues):``}-${n}`;case sd.CUSTOM_COMPONENT:return`${e.contentType}-${e.componentRef}-${r(e.contextResourceIdentifiers)}-${n}`;case sd.ENGINE_PAGE:return`${e.contentType}-${e.pageRef}-${n}`;case sd.INLINE_CREATE:return`${e.contentType}-${e.resourceContext.resourceType}-${e.resourceContext.operationIdentifier}-${n}`;case sd.ERROR_MODAL:return`${e.contentType}-${e.errorType}-${n}`;case sd.SETTINGS_HUB:return e.contentType;default:return`unknown-${e.contentType}-${n}`}}var R0=({content:e,zone:t,initiator:n,entryId:r})=>{let{tComponent:i,isReady:a}=K({component:B.HIGH_LEVEL_VIEWS_CHART}),{registry:o}=fm(),s=L0(e,r);if(I0(`Rendering content`,{contentType:e.contentType,zone:t,contentKey:s}),e.contentType===sd.RESOURCE_OPERATION)return(0,$.jsx)(WY,{resourceContext:e.resourceContext,navigationZone:t,navigationInitiator:n},s);if(e.contentType===sd.COMPOSITE_VIEW)return(0,$.jsx)(VU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n},s);if(e.contentType===sd.CHART_VIEW){if(!a)return null;let t=e.runtimeDescriptor?.chartDefinition.requiredFeatures??e.viewDefinition?.chartDefinition.requiredFeatures??e.requiredFeatures??Mp({viewRef:e.viewRef,registry:o})?.chartView.chartDefinition.requiredFeatures;return(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`p-container text-center text-muted-foreground`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i(B.HIGH_LEVEL_VIEWS_CHART,`loading`)})}),children:(0,$.jsx)($h,{requiredFeatures:t,children:(0,$.jsx)(hwe,{viewRef:e.viewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor})})},s)}if(e.contentType===sd.FULL_CUSTOM_VIEW)return(0,$.jsx)(oQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===sd.FLOWS_ACTORS_VIEW)return(0,$.jsx)(IQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers},s);if(e.contentType===sd.EXECUTION_VIEW)return(0,$.jsx)($Y,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===sd.CUSTOM_COMPONENT){let t=Fo.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{contextResourceIdentifiers:e.contextResourceIdentifiers})},s):(0,$.jsx)(al,{componentType:e.componentRef,componentName:e.componentRef})}if(e.contentType===sd.ENGINE_PAGE){let t=gwe[e.pageRef];return t?(0,$.jsx)(t,{},s):(0,$.jsx)(al,{componentType:String(e.pageRef),componentName:String(e.pageRef)},s)}if(e.contentType===sd.SETTINGS_HUB)return(0,$.jsx)(awe,{sectionRef:e.sectionRef,subTabRef:e.subTabRef},s);if(e.contentType===sd.INLINE_CREATE){let r={...e.resourceContext,additionalContext:{...e.resourceContext.additionalContext,defaultValuesOverride:e.defaultValues}};return(0,$.jsx)(WY,{resourceContext:r,navigationZone:t,navigationInitiator:n},s)}return e.contentType===sd.ERROR_MODAL?(0,$.jsx)(cSe,{wildoError:e.wildoError},s):null};function z0(e,t){let n=`${e}-${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`;return{tabId:`nav-zone-tab-${n}`,panelId:`nav-zone-tabpanel-${n}`}}var vwe=({zone:e,entry:t})=>{let{title:n}=X$(t,{keepOperationTitle:!0}),{tabId:r,panelId:i}=z0(e,t.id);return(0,$.jsx)(uO,{value:t.id,id:r,"aria-controls":i,children:n})},ywe=({zone:e,entries:t,activeEntryId:n,onSelect:r})=>(0,$.jsx)(cO,{value:n,onValueChange:t=>r(e,t),"data-zone-tab-bar":e,children:(0,$.jsx)(lO,{children:t.map(t=>(0,$.jsx)(vwe,{zone:e,entry:t},t.id))})}),B0=({zone:e,fallback:t,emptyState:n})=>{let{getTopEntry:r,getZoneState:i,setActiveTab:a}=zx(),{navigationLayout:o}=Wg(),s=sSe(),c=r(e),l=i(e),u=o?.zones?.[e]?.contentModel===$n.TABBED,d=tg(l.stack,o?.zones?.[e]?.contentModel,l.activeTabId);I0(`ZoneContentRenderer render`,{zone:e,hasTopEntry:!!c,stackDepth:l.stack.length,isVisible:l.isVisible,topEntryContentType:c?.content?.contentType,topEntryUrlPath:c?.urlPath,hasFallback:!!t});let f=l.stack;return f.length>0?(I0(`ZoneContentRenderer → rendering persistent stack`,{zone:e,stackDepth:f.length}),(0,$.jsxs)($.Fragment,{children:[u&&f.length>0&&(0,$.jsx)(ywe,{zone:e,entries:f,activeEntryId:f[d]?.id,onSelect:a}),f.map((t,n)=>{let r=n===d,i=u?(()=>{let{tabId:n,panelId:r}=z0(e,t.id);return{role:`tabpanel`,id:r,"aria-labelledby":n}})():void 0;return(0,$.jsx)(`div`,{...i,style:{display:r?`contents`:`none`},inert:!r,children:s(t)?(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(ib,{})}):(0,$.jsx)(R0,{content:t.content,zone:t.zone,initiator:t.initiator,entryId:t.id})},L0(t.content,t.id))})]})):t?(I0(`ZoneContentRenderer → rendering fallback (routerChildren / Outlet)`,{zone:e}),(0,$.jsx)($.Fragment,{children:t})):n?(I0(`ZoneContentRenderer → rendering empty state (onEmpty: EMPTY_STATE)`,{zone:e}),(0,$.jsx)($.Fragment,{children:n})):(I0(`ZoneContentRenderer → rendering null (no entry, no fallback)`,{zone:e}),null)};function V0(e){return e===mu.HORIZONTAL?mu.VERTICAL:mu.HORIZONTAL}var bwe=1280,H0=25,U0=H0;function W0(e,t){return Math.round(Math.max(5,Math.min(70,e/t*100)))}function xwe(e){let[t,n]=(0,Q.useState)(bwe);return(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(e=>{let t=e[0];if(t){let e=t.contentRect.width;e>0&&n(e)}});return r.observe(t),()=>r.disconnect()},[e]),t}function G0(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),n)}function K0(e){if(!e.isResizable)return{minSize:e.defaultSize,maxSize:e.defaultSize};let t=e.maxWidthPx?W0(e.maxWidthPx,e.containerWidth):75,n=e.minWidthPx?W0(e.minWidthPx,e.containerWidth):Math.min(U0,e.defaultSize);return{minSize:Math.min(n,t),maxSize:t}}var q0=1e-9;function Swe(e,t){let n=e.map(e=>e.defaultSize),r=e.map(e=>e.frozen?1/0:Math.floor(e.maxSize+q0)),i=e.map((e,t)=>Math.min(Math.ceil((e.frozen?Math.min(U0,e.defaultSize):e.minSize)-q0),r[t])),a=i.reduce((e,t)=>e+t,0),o,s=a>t;if(s)o=i.map(e=>e*t/a);else{let r=e.map(()=>!1);for(;;){let e=t-i.reduce((e,t,n)=>e+(r[n]?t:0),0),a=n.reduce((e,t,n)=>e+(r[n]?0:t),0),s=a>0?e/a:0,c=n.flatMap((e,t)=>!r[t]&&e*s<i[t]-q0?[t]:[]);if(c.length===0){o=n.map((e,t)=>r[t]?i[t]:e*s);break}for(let e of c)r[e]=!0}}let c=o.map(e=>Math.floor(e+q0)),l=Math.round(o.reduce((e,t)=>e+t,0))-c.reduce((e,t)=>e+t,0),u=o.map((e,t)=>({index:t,fraction:e-c[t]})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;e<l;e+=1)c[u[e].index]+=1;e.forEach((e,t)=>{e.defaultSize=c[t],e.frozen?(e.minSize=e.defaultSize,e.maxSize=e.defaultSize):s&&(e.minSize=e.defaultSize)})}var J0;(function(e){e.SINGLE_ZONE=`single-zone`,e.MULTI_ZONE_STATIC=`multi-zone-static`,e.MULTI_ZONE_RESIZABLE=`multi-zone-resizable`})(J0||={});function Y0(e){return!e.hasSecondaryZone&&!e.hasCompanionZone?J0.SINGLE_ZONE:e.hasSecondaryZone&&e.split?.resizable||e.hasCompanionZone&&e.split?.companion?.resizable?J0.MULTI_ZONE_RESIZABLE:J0.MULTI_ZONE_STATIC}function X0(e){let t=e.showSecondary?Math.max(0,e.secondaryPercent):0,n=e.showCompanion?Math.max(0,e.companionPercent):0,r=t+n;if(r<=75||r===0)return{secondary:t,companion:n};let i=75/r;return{secondary:t*i,companion:n*i}}function Z0(e){return{primary:e.showSecondary||e.showCompanion,secondary:e.showSecondary&&e.showCompanion}}function Q0(e,t,n,r,i){let a=0,o;if(n){let n=e.secondary,r=t?.resizable??!1,s=(t?.ratio??[50,50])[1];a+=s;let c=n?.minWidth,{minSize:l,maxSize:u}=K0({isResizable:r,defaultSize:s,minWidthPx:c,maxWidthPx:n?.maxWidth,containerWidth:i}),d=G0(s,l,u);a+=d-s,o={defaultSize:d,minSize:l,maxSize:u,frozen:!r}}let s;if(r){let n=e.companion,r=t?.companion,o=r?.resizable??!1,c=(r?.ratio??[70,30])[1];a+=c;let l=n?.minWidth,{minSize:u,maxSize:d}=K0({isResizable:o,defaultSize:c,minWidthPx:l,maxWidthPx:n?.maxWidth,containerWidth:i}),f=G0(c,u,d);a+=f-c,s={defaultSize:f,minSize:u,maxSize:d,frozen:!o}}let c=[o,s].filter(e=>e!==void 0);return a>75&&Swe(c,75),{primaryDefault:100-c.reduce((e,t)=>e+t.defaultSize,0),secondary:o,companion:s}}var Cwe={...KE,geometry:{responsiveMaxWidth:`content`},containment:{gap:`none`}};function $0({children:e,geometry:t}){return(0,$.jsx)(vD,{variant:nt.SHELL,emitPolicyVars:!0,policyOverride:pwe(t,Cwe),className:U(`bg-transparent text-inherit`,mwe(t)),children:e})}var wwe=()=>{let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),n=t?yp({tComponent:e,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneEmptyState`}):``;return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-container`,"data-zone-empty-state":`true`,children:(0,$.jsx)(`p`,{className:`max-w-xs text-center text-sm text-muted-foreground`,children:n})})},e2=`pointer-events-auto bg-surface-raised/80 backdrop-blur-sm`,t2=({emphasized:e,onToggle:t,floating:n=!0})=>{let{tComponent:r,isReady:i}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:a}=Mf(),o=i?yp({tComponent:r,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:e?`zoneRestore`:`zoneExpand`}):``;return(0,$.jsx)(X,{type:`button`,size:Y.ICON_SM,variant:J.GHOST,className:n?e2:void 0,"aria-pressed":e,"aria-label":o||void 0,title:o||void 0,"data-zone-emphasis-toggle":e?`restore`:`expand`,onClick:t,children:a(e?H.MINIMIZE:H.MAXIMIZE,{size:ca.SM})})},n2=({onDismiss:e,floating:t=!0})=>{let{tComponent:n,isReady:r}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:i}=Mf(),a=r?yp({tComponent:n,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneDismiss`}):``;return(0,$.jsx)(X,{type:`button`,size:Y.ICON_SM,variant:J.GHOST,className:t?e2:void 0,"aria-label":a||void 0,title:a||void 0,"data-zone-dismiss":`true`,onClick:e,children:i(H.CLOSE,{size:ca.SM})})};function Twe(){let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),n=(0,Q.useCallback)(n=>t&&yp({tComponent:e,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:n})||void 0,[e,t]);return{regionProps:(0,Q.useCallback)(e=>({role:`region`,"aria-label":n(Ewe[e])}),[n]),resizeHandleLabel:n(`zoneResizeHandle`)}}var Ewe={[Cl.PRIMARY]:`zoneRegionPrimary`,[Cl.SECONDARY]:`zoneRegionSecondary`,[Cl.COMPANION]:`zoneRegionCompanion`},Dwe=({emphasized:e,onToggleEmphasis:t,onDismiss:n})=>(0,$.jsxs)(XB,{children:[(0,$.jsx)(t2,{emphasized:e,onToggle:t}),n&&(0,$.jsx)(n2,{onDismiss:n})]}),r2=({zone:e,emphasized:t,onToggleEmphasis:n,onDismiss:r,children:i})=>(0,$.jsxs)(KB,{zone:e,controls:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t2,{emphasized:t,onToggle:n,floating:!1}),r&&(0,$.jsx)(n2,{onDismiss:r,floating:!1})]}),children:[(0,$.jsx)(Dwe,{emphasized:t,onToggleEmphasis:n,onDismiss:r}),i]}),i2=({routerChildren:e})=>{_be(),hbe(),gbe();let{isZoneVisible:t,getZoneDepth:n,getTopContent:r,setFocusedZone:i,emphasizedZone:a,setEmphasizedZone:o,reconcileCollapsedZones:s,state:c}=zx(),{dismissZone:l}=DS(),{setContentAreaWidth:u}=zx(),{regionProps:d,resizeHandleLabel:f}=Twe(),{navigationLayout:p,UIConfig:m,shellAppearance:h,compositeViews:g,homeDefinition:_}=Wg(),v=mg(),{registry:y}=fm(),b=(0,Q.useCallback)(e=>Dp({viewRef:e,registry:y}),[y]),x=(0,Q.useRef)(null),S=xwe(x);(0,Q.useEffect)(()=>{u(S>0?S:void 0)},[S,u]);let C=m?.currentBreakpoint===Sl.MOBILE,w=p?.zones,T=p?.split,E=h===Qo.CONTINUOUS?`bg-transparent text-foreground`:`bg-surface-raised text-surface-raised-foreground`,D=!!w?.secondary,O=!!w?.companion,k=t(Cl.SECONDARY)||n(Cl.SECONDARY)>0,A=t(Cl.COMPANION)||n(Cl.COMPANION)>0,j=r(Cl.PRIMARY),M=lwe({homeCompositeViewRef:_?.compositeViewReference,isAppRootPath:v.pathname===`/`,primaryStackTop:j})??j,N=(0,Q.useMemo)(()=>dwe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),P=(0,Q.useMemo)(()=>fwe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),F=(0,Q.useMemo)(()=>P0({zoneContent:r(Cl.SECONDARY),compositeViews:g,resolveExecutionView:b}),[r,g,b]),I=(0,Q.useMemo)(()=>P0({zoneContent:r(Cl.COMPANION),compositeViews:g,resolveExecutionView:b}),[r,g,b]),ee=A0({zone:Cl.SECONDARY,zones:w,destinationOverride:N}),L=A0({zone:Cl.COMPANION,zones:w,destinationOverride:N}),R=(0,$.jsx)(wwe,{}),z=(0,Q.useMemo)(()=>uwe({primaryContent:M,compositeViews:g}),[M,g]),te=eg({zoneConfig:w?.secondary,viewport:m?.currentBreakpoint,contentAreaWidth:S}),ne=eg({zoneConfig:w?.companion,viewport:m?.currentBreakpoint,contentAreaWidth:S});oSe({zones:w,viewport:m?.currentBreakpoint,contentAreaWidth:S,reconcileCollapsedZones:s,navigationState:c});let re=!te&&D&&(k||z&&j0(ee)),ie=!ne&&O&&(A||z&&j0(L)),ae=Y0({hasSecondaryZone:D,hasCompanionZone:O,split:T}),oe=(0,Q.useCallback)(()=>i(Cl.PRIMARY),[i]),se=(0,Q.useCallback)(()=>i(Cl.SECONDARY),[i]),ce=(0,Q.useCallback)(()=>i(Cl.COMPANION),[i]),le=swe({requested:a,isMobile:C,secondaryShown:re,companionShown:ie,secondaryHasContent:k,companionHasContent:A}),ue=n(rr.OVERLAY)>0;(0,Q.useEffect)(()=>{if(le===null)return;let e=e=>{cwe({key:e.key,emphasized:!0,overlayOpen:ue,target:e.target})&&o(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[le,ue,o]);let de=(0,Q.useCallback)(()=>o(le===Cl.SECONDARY?null:Cl.SECONDARY),[le,o]),fe=(0,Q.useCallback)(()=>o(le===Cl.COMPANION?null:Cl.COMPANION),[le,o]),pe=(0,Q.useCallback)(()=>{o(null),l(Cl.SECONDARY)},[l,o]),me=(0,Q.useCallback)(()=>{o(null),l(Cl.COMPANION)},[l,o]),he=M0({hasContent:k,behavior:ee}),ge=M0({hasContent:A,behavior:L}),_e=le!==null,ve=le!==null&&le!==Cl.SECONDARY,ye=le!==null&&le!==Cl.COMPANION,be=(0,Q.useMemo)(()=>w?Q0(w,T,re,ie,S):null,[w,T,re,ie,S]);if(ae===J0.SINGLE_ZONE)return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:KE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full overflow-auto p-container ${E}`,"data-content-area":`primary`,onPointerDown:oe,onFocus:oe,...d(Cl.PRIMARY),children:(0,$.jsx)($0,{geometry:P,children:(0,$.jsx)(B0,{zone:Cl.PRIMARY,fallback:e})})})});if(ae===J0.MULTI_ZONE_RESIZABLE&&be){let t=V0(T?.orientation);return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:KE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full ${E}`,children:(0,$.jsxs)(Q$,{direction:t,autoSaveId:`nav-zones`,className:`h-full`,children:[(0,$.jsx)($$,{defaultSize:be.primaryDefault,minSize:H0,id:`nav-primary`,order:1,className:U(`h-full`,_e&&`hidden`),"data-zone-hidden":_e||void 0,children:(0,$.jsx)(`div`,{className:`h-full p-container ${P.fillsHeight?`overflow-hidden`:`overflow-auto`}`,"data-content-area":`primary`,onPointerDown:oe,onFocus:oe,...d(Cl.PRIMARY),children:(0,$.jsx)($0,{geometry:P,children:(0,$.jsx)(B0,{zone:Cl.PRIMARY,fallback:e})})})}),re&&be.secondary&&(0,$.jsxs)($.Fragment,{children:[le===null&&(0,$.jsx)(e1,{withHandle:!0,disabled:be.secondary.frozen,"aria-label":f}),(0,$.jsx)($$,{defaultSize:be.secondary.defaultSize,minSize:be.secondary.minSize,maxSize:be.secondary.maxSize,id:`nav-secondary`,order:2,className:U(`h-full`,ve&&`hidden`),"data-zone-hidden":ve||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`secondary`,"data-zone-emphasized":le===Cl.SECONDARY||void 0,onPointerDown:se,onFocus:se,...d(Cl.SECONDARY),children:(0,$.jsx)(r2,{zone:Cl.SECONDARY,emphasized:le===Cl.SECONDARY,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)($0,{geometry:F,children:(0,$.jsx)(B0,{zone:Cl.SECONDARY,emptyState:R})})})})})]}),ie&&be.companion&&(0,$.jsxs)($.Fragment,{children:[le===null&&(0,$.jsx)(e1,{withHandle:!0,disabled:be.companion.frozen,"aria-label":f}),(0,$.jsx)($$,{defaultSize:be.companion.defaultSize,minSize:be.companion.minSize,maxSize:be.companion.maxSize,id:`nav-companion`,order:3,className:U(`h-full`,ye&&`hidden`),"data-zone-hidden":ye||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`companion`,"data-zone-emphasized":le===Cl.COMPANION||void 0,onPointerDown:ce,onFocus:ce,...d(Cl.COMPANION),children:(0,$.jsx)(r2,{zone:Cl.COMPANION,emphasized:le===Cl.COMPANION,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)($0,{geometry:I,children:(0,$.jsx)(B0,{zone:Cl.COMPANION,emptyState:R})})})})})]})]})})})}let xe=V0(T?.orientation)===mu.VERTICAL,Se=X0({secondaryPercent:T?.ratio?.[1]??50,companionPercent:T?.companion?.ratio?.[1]??30,showSecondary:re,showCompanion:ie}),Ce=(e,t)=>xe?{height:t?`100%`:`${e}%`}:{width:t?`100%`:`${e}%`},we=Z0({showSecondary:re,showCompanion:ie});return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:KE,children:(0,$.jsxs)(`div`,{ref:x,className:U(`h-full flex`,xe?`flex-col`:`flex-row`,E),children:[(0,$.jsx)(`div`,{className:U(`flex-1 h-full overflow-auto p-container`,we.primary&&le===null&&(xe?`border-b border-border`:`border-e border-border`),_e&&`hidden`),"data-content-area":`primary`,"data-zone-hidden":_e||void 0,onPointerDown:oe,onFocus:oe,...d(Cl.PRIMARY),children:(0,$.jsx)($0,{geometry:P,children:(0,$.jsx)(B0,{zone:Cl.PRIMARY,fallback:e})})}),re&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,we.secondary&&le===null&&(xe?`border-b border-border`:`border-e border-border`),ve&&`hidden`),style:Ce(Se.secondary,le===Cl.SECONDARY),"data-content-area":`secondary`,"data-zone-hidden":ve||void 0,"data-zone-emphasized":le===Cl.SECONDARY||void 0,onPointerDown:se,onFocus:se,...d(Cl.SECONDARY),children:(0,$.jsx)(r2,{zone:Cl.SECONDARY,emphasized:le===Cl.SECONDARY,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)($0,{geometry:F,children:(0,$.jsx)(B0,{zone:Cl.SECONDARY,emptyState:R})})})}),ie&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,ye&&`hidden`),style:Ce(Se.companion,le===Cl.COMPANION),"data-content-area":`companion`,"data-zone-hidden":ye||void 0,"data-zone-emphasized":le===Cl.COMPANION||void 0,onPointerDown:ce,onFocus:ce,...d(Cl.COMPANION),children:(0,$.jsx)(r2,{zone:Cl.COMPANION,emphasized:le===Cl.COMPANION,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)($0,{geometry:I,children:(0,$.jsx)(B0,{zone:Cl.COMPANION,emptyState:R})})})})]})})},Owe=()=>{let{state:e,getZoneState:t}=zx(),{closeOverlay:n}=DS(),r=oh(),i=e.overlay,a=i.length>0?i[i.length-1]:void 0,o=i.length>0,s=w1(a?.appearance??Rn.DIALOG),{title:c}=X$(a),l=(0,Q.useCallback)(i=>{if(!i){if(a?.content.contentType===sd.SETTINGS_HUB){let n=e.zones[Cl.PRIMARY]?.stack??[],i=e.zones[Cl.SECONDARY]?.stack??[],a=i[i.length-1],o=n[n.length-1]?.urlPath,s=(a?.hostedPane&&o?dh.resolveBrowserUrlForZoneEntry({zone:Cl.SECONDARY,entryUrlPath:a.urlPath,paneContent:a.content,currentBrowserUrl:o,getZoneState:t}):o)??Ln.home;r(s,{replace:!0})}else n()}},[n,r,a,e.zones,t]),u=F$(),{registry:d}=fm(),f=(0,Q.useCallback)(e=>d.resourceConfigurations[e]?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,[d]),p=a?.content.contentType===sd.SETTINGS_HUB?CSe(ASe(u.sections,a.content.sectionRef??u.defaultSectionRef,f)):wSe(s);return(0,$.jsx)(b1,{open:o,onOpenChange:l,title:c||void 0,titleVisuallyHidden:!0,config:{mode:s,modal:a?.overlayBehavior?.modal??!0,closeOnOutsideClick:a?.overlayBehavior?.closeOnOutsideClick??!0,showBackdrop:a?.overlayBehavior?.showBackdrop??!0,side:$s.END},className:p,children:a&&(0,$.jsx)(R0,{content:a.content,zone:rr.OVERLAY,initiator:a.initiator,entryId:a.id})})},a2=()=>(0,$.jsx)(Owe,{});function o2(e){return typeof e==`object`&&!!e&&`placement`in e&&`collapsible`in e}function s2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c2(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.position===void 0||t.position===Qc.START||t.position===Qc.END,r=t.items===void 0||Array.isArray(t.items);return n&&r}var l2;(function(e){e.ENUM=`enum`,e.RESOURCE_REFERENCE=`resource_reference`,e.RAW=`raw`})(l2||={});var u2;(function(e){e.STATIC=`static`,e.LINK=`link`,e.BUTTON=`button`})(u2||={});var d2;(function(e){e.BUTTON=`button`,e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.SELECT=`select`})(d2||={});var f2;(function(e){e.COMMANDS=`commands`,e.RECORDS=`records`})(f2||={});function p2(e){switch(e){case Fr.COMMAND_MENU:return B.APPLICATION_LEVEL_COMMAND_MENU;case Fr.QUICK_ACTION_BUTTON:return B.APPLICATION_LEVEL_QUICK_ACTION_BUTTON;case Fr.NOTIFICATION_CENTER:return B.APPLICATION_LEVEL_NOTIFICATION_CENTER;case Fr.USER_DROPDOWN:return B.APPLICATION_LEVEL_USER_DROPDOWN;case Fr.CONTROL_PANEL:return B.APPLICATION_LEVEL_CONTROL_PANEL;case Fr.QUICK_SWITCHER:return B.APPLICATION_LEVEL_QUICK_SWITCHER;case Fr.NAVIGATION_CONTROL:return B.APPLICATION_LEVEL_NAVIGATION_BACK;case Fr.UTILITY_PANEL:return B.APPLICATION_LEVEL_UTILITY_PANEL;default:return null}}function m2(e,t){if(e.startsWith(`data:`)||e.startsWith(`blob:`))return!0;try{return new URL(e,t).origin===t}catch{return!1}}function h2(e){let{httpClient:t}=Ou(),n=e!==void 0&&m2(e,window.location.origin),[r,i]=(0,Q.useState)(void 0);if((0,Q.useEffect)(()=>{if(i(void 0),e===void 0||n)return;let r=!1,a,o=new AbortController;return t.fetchFileBlob(e,{signal:o.signal,silent:!0}).then(e=>{r||(a=URL.createObjectURL(e),i(a))}).catch(()=>{r||i(void 0)}),()=>{r=!0,o.abort(),a&&URL.revokeObjectURL(a)}},[e,n,t]),e!==void 0)return n?e:r}function g2(e={}){let{composition:t=ne.SYMBOL,purpose:n=$t.PRIMARY,theme:r,includeOrganizationBrand:i=!0}=e,{appConfig:a}=Ou(),{isDark:o,shellIdentity:s,organizationLogoUrl:c,organizationProductName:l}=Wg(),u=s?s.brandAssets:a.brandAssets,d=s?s.name:a.appIdentity?Dne(a.appIdentity):``,f=(0,Q.useMemo)(()=>{if(u?.length)return It(u,{composition:t,theme:r??(o?Yi.DARK:Yi.LIGHT),purpose:n})},[u,t,n,r,o]),p=i&&!s,m=h2(p?c:void 0),h=p&&l||d;return p&&c?{name:h,logoUrl:m,logoComposition:void 0,markIsSingleColourOnDarkUi:!1}:{name:h,logoUrl:f?.url,logoComposition:f?.composition,markIsSingleColourOnDarkUi:f?.theme===Yi.MONOCHROME&&o}}function _2(e){let t=e?.logoUrl,n=e?.name??``,[r,i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>i(!1),[t]);let a=(0,Q.useCallback)(()=>i(!0),[]),o=!!t&&!r,s=o&&e?.logoComposition!==void 0&&e.logoComposition!==ne.SYMBOL;return{name:n,logoUrl:o?t:void 0,hasMark:o,markCarriesName:s,drawMarkLight:o&&e?.markIsSingleColourOnDarkUi===!0,isEmpty:!o&&n.length===0,onMarkError:a}}function v2(e,t,n,r,i,a){if(!n||!t||t.length===0)return[];let o=[],s=new Map;for(let c of t){let t=c.componentType;if(c.breakpoint&&c.breakpoint!==r||n[t]===!1||t===Fr.NAVIGATION_CONTROL&&!du(a?.backAffordanceOwner))continue;let l=p2(t);if(!l)continue;let u=s.get(t)??0;s.set(t,u+1),o.push({instanceId:`${e}:${t}-${u}`,component:t,frontendComponentType:l,placement:c.placement??i,presetName:c.presetName,triggerWidth:c.triggerWidth,triggerAppearance:c.triggerAppearance})}return o}function y2(e,t,n){let r=e=>{let n=t?.[e];if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n.hostedComponents;return Array.isArray(r)?r:void 0},i=(i,a)=>v2(i,r(i),t,n,a).some(t=>t.component===e);return!!t?.[Fr.MENUBAR]&&i(Fr.MENUBAR,Qc.START)||!!t?.[Fr.SIDEBAR]&&i(Fr.SIDEBAR,ol.TOP)}var b2=new Set;function x2(e){let t=typeof e==`string`?e:s2(e)?e.placement:void 0;if(t===void 0)return ol.BOTTOM;if(or(t))return t;let n=String(t);return b2.has(n)||(b2.add(n),as.getLogger().warn(`[app-shell] the status bar is configured at '${n}', which no shell layout places (only '${ol.TOP}' and '${ol.BOTTOM}'); it is shown at '${ol.BOTTOM}'.`)),ol.BOTTOM}function S2(){let{UIConfig:e,navigationLayout:t,appComponentsConfiguration:n}=Wg(),{markComponentInitialized:r}=Ou(),i=!!(t&&n);return(0,Q.useEffect)(()=>{i&&r(Pe.APP_MAIN_CONTAINER)},[i,r]),(0,Q.useMemo)(()=>{if(!i||!t||!n)return{hasMenubar:!1,hasSidebar:!1,hasStatusBar:!1,hasToolbar:!1,hasActivityBar:!1,hasQuickActionButton:!1,hasUtilityPanel:!1,quickActionButtonHostedInChrome:!1,utilityPanelHostedInChrome:!1,sidebarPlacement:Qc.START,statusBarPlacement:ol.BOTTOM,utilityPanelPlacement:Qc.END,isLayoutReady:!1};let r=n[Fr.SIDEBAR],a=n[Fr.STATUS_BAR],o=n[Fr.UTILITY_PANEL],s=o2(r)?r.placement:Qc.START;return{hasMenubar:!!n[Fr.MENUBAR],hasSidebar:!!r,hasStatusBar:!!a,hasToolbar:!!n[Fr.TOOLBAR],hasActivityBar:!!n[Fr.ACTIVITY_BAR],hasQuickActionButton:!!n[Fr.QUICK_ACTION_BUTTON],hasUtilityPanel:!!o,quickActionButtonHostedInChrome:y2(Fr.QUICK_ACTION_BUTTON,n,e?.currentBreakpoint),utilityPanelHostedInChrome:y2(Fr.UTILITY_PANEL,n,e?.currentBreakpoint),sidebarPlacement:s,statusBarPlacement:x2(a),utilityPanelPlacement:c2(o)?o.position??Qc.END:Qc.END,isLayoutReady:!0}},[i,t,n,e?.currentBreakpoint])}function kwe(e){(0,Q.useEffect)(()=>{if(!e)return;let t=Array.from(document.querySelectorAll(`link[rel~="icon"]`)),n=t.length===0?document.createElement(`link`):void 0;n&&(n.rel=`icon`,document.head.appendChild(n));let r=n?[n]:t,i=r.map(e=>e.getAttribute(`href`));return r.forEach(t=>{t.href=e}),()=>{n?n.remove():r.forEach((e,t)=>{let n=i[t];n==null?e.removeAttribute(`href`):e.setAttribute(`href`,n)})}},[e])}function C2(e=!1,t){let{markComponentInitialized:n,frontendConfiguration:r}=Ou();(0,Q.useEffect)(()=>{n(Pe.PUBLIC_APP_CONTAINER)},[n]);let i=g2({includeOrganizationBrand:!1}),{shellIdentity:a}=Wg(),o=e&&!a?t:void 0,s=h2(o?.logoUrl||void 0),c=h2(o?.faviconUrl||void 0),l=o?{name:o.productName||o.organizationName||i.name,logoUrl:o.logoUrl?s:i.logoUrl,logoComposition:void 0}:i,u=r.publicShellIdentityMode===im.BRAND_HEADER?l:void 0;return kwe(c),{useCardLayout:e,isReady:!0,brandHeader:u,brandAccentColor:u?o?.primaryColor:void 0}}var Awe=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function w2(e){return!e||typeof document>`u`?null:document.getElementById(e)}var T2=(0,Q.createContext)(null);function E2(){return(0,Q.useContext)(T2)??void 0}function D2(e,t){let n=E2(),{getSurfacePolicy:r}=Wg(),i=r?.(e,t)?.stacking?.portalTarget,a=typeof i==`string`&&i!==`inline`&&i!==`app-portal`&&i!==`reset`?i:null,[o,s]=(0,Q.useState)(()=>w2(a));return Awe(()=>{if(!a||typeof document>`u`){s(null);return}let e=w2(a);if(s(e),e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{let e=w2(a);e&&(s(e),t.disconnect())});return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[a]),i===`inline`?{container:void 0,shouldPortal:!1}:o?{container:o,shouldPortal:!0}:{container:n,shouldPortal:!0}}function O2(e){switch(e){case`content`:return`z-(--z-content)`;case`transient`:return`z-(--z-transient)`;case`guidance`:return`z-(--z-guidance)`;case`critical`:return`z-(--z-critical)`;default:return`z-(--z-overlay)`}}function k2(e,t){let{getSurfacePolicy:n}=Wg(),r=n?.(e,t)?.stacking?.stackingTier;return O2(r)}function A2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_ACTIVITY_BAR,`ApplicationLevel_ActivityBar`)(e);return(0,$.jsx)(n,{...t})}function j2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_MENUBAR,`ApplicationLevel_MenuBar`)(e);return(0,$.jsx)(n,{...t})}function M2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_QUICK_ACTION_BUTTON,`ApplicationLevel_QuickActionButton`)(e);return(0,$.jsx)(n,{...t})}function N2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_SIDEBAR,`ApplicationLevel_Sidebar`)(e);return(0,$.jsx)(n,{...t})}function P2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_STATUS_BAR,`ApplicationLevel_StatusBar`)(e);return(0,$.jsx)(n,{...t})}function F2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_TOOLBAR,`ApplicationLevel_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function I2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_UTILITY_PANEL,`ApplicationLevel_UtilityPanel`)(e);return(0,$.jsx)(n,{...t})}var L2=(0,Q.createContext)({getHostedComponentProps:()=>({})});function R2(){return(0,Q.useContext)(L2)}function z2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jwe(e){return z2(e)}var Mwe=new Set([Fr.COMMAND_MENU,Fr.NOTIFICATION_CENTER,Fr.QUICK_SWITCHER]);function B2({children:e}){let{appComponentsConfiguration:t,UIConfig:n,navigationLayout:r}=Wg(),i=n?.currentBreakpoint,{on:a,emit:o}=Mo(),{register:s}=M$(),{t:c}=K(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(0),h=t?.[Fr.MENUBAR],g=t?.[Fr.SIDEBAR],_=(0,Q.useMemo)(()=>{let e=t,n=z2(h)?v2(Fr.MENUBAR,h.hostedComponents,e,i,Qc.START,r):[],a=z2(g)?v2(Fr.SIDEBAR,g.hostedComponents,e,i,ol.TOP,r):[];return[...n,...a]},[t,h,g,i,r]),v=(0,Q.useMemo)(()=>new Set(_.map(e=>e.component)),[_]),y=(0,Q.useMemo)(()=>{let e=new Map;for(let t of _)Mwe.has(t.component)&&(e.has(t.component)||e.set(t.component,t.instanceId));return e},[_]),b=e=>v.has(e),x=t?.[Fr.COMMAND_MENU],S=jwe(x)?x.openShortcut:void 0;(0,Q.useEffect)(()=>{if(b(Fr.COMMAND_MENU))return a(Ec.HOTKEY_COMMAND_MENU_OPEN,()=>{u(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.NOTIFICATION_CENTER))return a(Ec.HOTKEY_NOTIFICATIONS_OPEN,()=>{f(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.QUICK_SWITCHER))return a(Ec.HOTKEY_QUICK_SWITCHER_OPEN,()=>{m(e=>e+1)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.COMMAND_MENU)&&S&&x!==!1)return s({id:`shell-hosted-command-menu-open-shortcut`,shortcut:S,description:c(`engine.hotkeys.commandMenuOpen`),scope:ld.GLOBAL,group:yi.NAVIGATION,launcher:Fr.COMMAND_MENU,preventDefault:!0,handler:()=>{o(Ec.HOTKEY_COMMAND_MENU_OPEN,{})}})},[x,S,o,s,c,v]);let C=(0,Q.useMemo)(()=>({getHostedComponentProps:(e,t)=>{let n=y.get(e)===t;switch(e){case Fr.COMMAND_MENU:return{listenForHotkeys:!1,isOpen:l,onOpenChange:u,renderDialog:n};case Fr.NOTIFICATION_CENTER:return{listenForHotkeys:!1,...n?{isOpen:d,onOpenChange:f}:{}};case Fr.QUICK_SWITCHER:return{focusTrigger:n?p:0};default:return{}}}}),[y,l,d,p]);return(0,$.jsx)(L2.Provider,{value:C,children:e})}var V2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a,children:o})=>{let{tComponent:s,isReady:c}=K({component:B.GUIDANCE_CHECKLIST}),{renderIcon:l}=Mf(),{flowStates:u}=_U(),[d,f]=(0,Q.useState)(!1),p=e,m=u[t],{completed:h,total:g}=(0,Q.useMemo)(()=>{let e=p.items??[],t=0;for(let n of e)m?.elements?.[n]?.status===Hr.COMPLETED&&t++;return{completed:t,total:e.length}},[p.items,m?.elements]),_=g>0?Math.round(h/g*100):0,v=(0,Q.useCallback)(()=>{f(e=>!e)},[]),y=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if(!c)return null;let b=a(`title`),x=a(`description`),S=s(B.GUIDANCE_CHECKLIST,`headerTitle`),C=s(B.GUIDANCE_CHECKLIST,`progress`,{completed:h,total:g}),w=d?s(B.GUIDANCE_CHECKLIST,`expand`):s(B.GUIDANCE_CHECKLIST,`collapse`),T=s(B.GUIDANCE_CHECKLIST,`dismiss`);return(0,$.jsxs)(EF,{className:`w-80 max-w-[calc(100vw-3rem)] overflow-hidden`,role:`region`,"aria-label":S||b,children:[(0,$.jsxs)(OF,{className:`flex-row items-center justify-between gap-2 py-3 px-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-sm truncate`,children:S||b}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:v,"aria-expanded":!d,"aria-controls":`guidance-checklist-${p.ref}`,className:`text-xs text-muted-foreground px-1.5 py-0.5 h-auto`,children:w})]}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:y,"aria-label":T,children:l(H.CLOSE,{size:ca.SM})})]}),p.showProgress&&(0,$.jsxs)(`div`,{className:`px-4 pb-2 flex items-center gap-2.5`,children:[(0,$.jsx)(E_,{value:_,className:`flex-1`,"aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":g}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:C})]}),!d&&(0,$.jsxs)(NF,{id:`guidance-checklist-${p.ref}`,className:`pt-0 pb-4 px-4`,children:[x&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2 leading-normal`,children:x}),o&&(0,$.jsx)(`div`,{role:`list`,children:o})]})]})},H2=({element:e,flowRef:t,state:n,onComplete:r,onAction:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:B.GUIDANCE_CHECKLIST_ITEM}),c=e,l=n?.status===Hr.COMPLETED,u=(0,Q.useCallback)(()=>{l||r(c.ref)},[l,r,c.ref]),d=(0,Q.useCallback)(()=>{c.actionRef&&i(c.actionRef)},[i,c.actionRef]);if(!s)return null;let f=a(`title`),p=a(`actionLabel`);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2 border-b border-border/50 last:border-b-0`,role:`listitem`,children:[(0,$.jsx)(wI,{name:`__display`,schema:Od(),checked:l,onCheckedChange:u,disabled:l,"aria-label":l?o(B.GUIDANCE_CHECKLIST_ITEM,`completed`):o(B.GUIDANCE_CHECKLIST_ITEM,`markComplete`)}),(0,$.jsx)(`span`,{className:`flex-1 min-w-0 text-sm leading-snug ${l?`line-through text-muted-foreground`:``}`,children:f}),p&&c.actionRef&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:d,className:`shrink-0`,children:p})]})},U2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let o=(0,Q.useMemo)(()=>[`guidance.${t}`],[t]),{tComponent:s,tGuidanceTourStep:c,isReady:l}=K({component:B.GUIDANCE_TOUR,keys:o}),{getRecipe:u}=Wg(),{renderIcon:d}=Mf(),f=E2(),p=e,m=u(cc.SURFACE,nt.OVERLAY),h=(0,Q.useMemo)(()=>[...p.steps??[]].sort((e,t)=>e.order-t.order),[p.steps]),[g,_]=(0,Q.useState)(n?.lastStepIndex??0),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=h[g],C=h.length,w=g===C-1,T=g===0;(0,Q.useEffect)(()=>{if(!S?.targetSelector){y(null);return}let e=()=>{let e=document.querySelector(S.targetSelector);y(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(S.targetSelector);t&&(x.current=new ResizeObserver(e),x.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{x.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[S?.targetSelector]);let E=(0,Q.useCallback)(()=>{w?r(p.ref,{lastStepIndex:g}):_(e=>e+1)},[w,r,p.ref,g]),D=(0,Q.useCallback)(()=>{T||_(e=>e-1)},[T]),O=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if((0,Q.useEffect)(()=>{let e=b.current;if(!e)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),O())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[O]),ZE(b,!0),!l)return null;let k=s(B.GUIDANCE_TOUR,`next`),A=s(B.GUIDANCE_TOUR,`previous`),j=s(B.GUIDANCE_TOUR,`skip`),M=s(B.GUIDANCE_TOUR,`finish`),N=s(B.GUIDANCE_TOUR,`close`),P=s(B.GUIDANCE_TOUR,`stepProgress`,{current:g+1,total:C}),F=S?c(t,p.ref,S.ref,`title`):``,I=S?c(t,p.ref,S.ref,`description`):``;if(!S||typeof document>`u`)return null;let ee=Nwe(S.placement??ti.BOTTOM,v),L=f??document.body;return wN.createPortal((0,$.jsxs)(`div`,{className:`fixed inset-0 z-[calc(var(--z-guidance)+1)] pointer-events-auto`,"data-guidance-tour":p.ref,children:[v&&(0,$.jsxs)(`svg`,{className:`fixed inset-0 w-full h-full pointer-events-none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsxs)(`mask`,{id:`spotlight-${p.ref}`,children:[(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`white`}),(0,$.jsx)(`rect`,{x:v.left-4,y:v.top-4,width:v.width+8,height:v.height+8,rx:`8`,fill:`black`})]})}),(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,className:`fill-black/50`,mask:`url(#spotlight-${p.ref})`})]}),(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.OVERLAY,children:(0,$.jsxs)(`div`,{ref:b,style:ee,role:`dialog`,"aria-modal":`true`,tabIndex:-1,"aria-label":F,className:U(`w-[340px] max-w-[calc(100vw-2rem)] rounded-xl overflow-hidden font-inherit text-sm pointer-events-auto`,m.base,`shadow-[var(--shadow-xl)]`),children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:O,"aria-label":N,className:`absolute top-2 end-2 z-[calc(var(--z-guidance)+2)]`,children:d(H.CLOSE,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`px-5 pt-5 pb-3`,children:[F&&(0,$.jsx)(`h3`,{className:`m-0 text-base font-semibold leading-tight pe-6`,children:F}),I&&(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground leading-normal`,children:I})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-4`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:P}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p.allowSkip&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:O,children:j}),!T&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:D,children:A}),(0,$.jsx)(X,{size:Y.SM,onClick:E,children:w?M:k})]})]})]})})]}),L)};function Nwe(e,t){if(!t)return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};switch(e){case ti.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case ti.BOTTOM:return{position:`fixed`,top:t.bottom+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case ti.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+12,transform:`translateY(-50%)`};case ti.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+12,transform:`translateY(-50%)`};case ti.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var W2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:B.GUIDANCE_TOOLTIP}),{getRecipe:c}=Wg(),l=E2(),u=e,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(null),h=c(cc.SURFACE,nt.RAISED);(0,Q.useEffect)(()=>{if(!u.targetSelector)return;let e=()=>{let e=document.querySelector(u.targetSelector);f(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(u.targetSelector);t&&(m.current=new ResizeObserver(e),m.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{m.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[u.targetSelector]),(0,Q.useEffect)(()=>{u.showOnce&&!p.current&&d&&n?.status!==Hr.COMPLETED&&(p.current=!0,r(u.ref))},[u.showOnce,u.ref,d,n?.status,r]);let g=(0,Q.useCallback)(()=>{i(u.ref)},[i,u.ref]),_=(0,Q.useCallback)(()=>{r(u.ref)},[r,u.ref]);if(!s||typeof document>`u`||!d)return null;let v=l??document.body,y=a(`title`),b=a(`content`),x=o(B.GUIDANCE_TOOLTIP,`dismiss`),S=o(B.GUIDANCE_TOOLTIP,`gotIt`),C=Pwe(u.placement??ti.BOTTOM,d);return wN.createPortal((0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.RAISED,children:(0,$.jsxs)(`div`,{style:C,role:`dialog`,"aria-label":y||b||void 0,"data-guidance-tooltip":u.ref,className:U(`w-70 max-w-[calc(100vw-2rem)] rounded-xl z-[calc(var(--z-guidance)+2)] font-inherit text-sm`,h.base,`shadow-[var(--shadow-lg)]`),children:[(0,$.jsxs)(`div`,{className:`px-4 pt-3.5 pb-2`,children:[y&&(0,$.jsx)(`div`,{className:`font-semibold text-sm mb-1`,children:y}),b&&(0,$.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground leading-normal`,children:b})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 px-4 pb-3.5`,children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:g,children:x}),(0,$.jsx)(X,{size:Y.SM,onClick:_,children:S})]})]})}),v)};function Pwe(e,t){switch(e){case ti.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case ti.BOTTOM:return{position:`fixed`,top:t.bottom+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case ti.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+10,transform:`translateY(-50%)`};case ti.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+10,transform:`translateY(-50%)`};case ti.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var G2=({element:e,t,onAction:n,onDismiss:r,onComplete:i})=>{let{tComponent:a,isReady:o}=K({component:B.GUIDANCE_MODAL}),s=e,c=s.ctaAction,l=s.dismissible??!0,u=s.imageUrl,d=s.videoUrl,f=(0,Q.useCallback)(()=>{c&&n(c),i(e.ref)},[c,n,i,e.ref]),p=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]),m=(0,Q.useCallback)(t=>{!t&&l&&r(e.ref)},[l,r,e.ref]);if(!o)return null;let h=t(`title`),g=t(`description`),_=t(`content`),v=t(`actionLabel`),y=h||a(B.GUIDANCE_MODAL,`defaultTitle`);return(0,$.jsx)(ZW,{open:!0,onOpenChange:m,children:(0,$.jsxs)($W,{showCloseButton:l,onPointerDownOutside:l?void 0:e=>e.preventDefault(),onEscapeKeyDown:l?void 0:e=>e.preventDefault(),className:`max-w-md`,...g?{}:{"aria-describedby":void 0},children:[d&&(0,$.jsx)(`video`,{src:d,controls:!0,className:`w-full max-h-60 object-cover -mt-6 -mx-6 mb-0 rounded-t-lg`,style:{width:`calc(100% + 3rem)`}}),!d&&u&&(0,$.jsx)(`img`,{src:u,alt:``,className:`w-full max-h-60 object-cover -mt-6 -mx-6 mb-0 rounded-t-lg`,style:{width:`calc(100% + 3rem)`}}),h||g?(0,$.jsxs)(tG,{children:[(0,$.jsx)(rG,{className:h?void 0:`sr-only`,children:y}),g&&(0,$.jsx)(iG,{children:g})]}):(0,$.jsx)(rG,{className:`sr-only`,children:y}),_&&(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:_}),(0,$.jsxs)(nG,{children:[l&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:p,children:a(B.GUIDANCE_MODAL,`dismiss`)}),v&&(0,$.jsx)(X,{size:Y.SM,onClick:f,children:v})]})]})})},Fwe={[xr.INFO]:`info`,[xr.SUCCESS]:`success`,[xr.WARNING]:`warning`,[xr.ERROR]:`destructive`},K2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_BANNER}),{renderIcon:o}=Mf(),s=e,c=s.variant??xr.INFO,l=s.position??Vi.TOP,u=s.dismissible??!0,d=s.actionRef,f=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let p=t(`title`),m=t(`content`),h=t(`actionLabel`),g=l===Vi.BOTTOM?`absolute bottom-0 inset-x-0 rounded-none border-x-0 border-b-0`:`absolute top-0 inset-x-0 rounded-none border-x-0 border-t-0`;return(0,$.jsx)(jD,{variant:Fwe[c],role:`status`,className:`pointer-events-auto ${g}`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5 flex-1 min-w-0`,children:[p&&(0,$.jsx)(MD,{children:p}),m&&(0,$.jsx)(ND,{children:m})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[h&&d&&(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(d),children:h}),u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:f,"aria-label":i(B.GUIDANCE_BANNER,`ariaClose`),title:i(B.GUIDANCE_BANNER,`dismiss`),children:o(H.CLOSE,{size:ca.SM})})]})]})})},Iwe={[xr.INFO]:`info`,[xr.SUCCESS]:`success`,[xr.WARNING]:`warning`,[xr.ERROR]:`destructive`},q2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_ANNOUNCEMENT}),{renderIcon:o}=Mf(),s=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let c=e,l=c.variant??xr.INFO,u=c.dismissible??!0,d=t(`title`),f=t(`content`),p=t(`actionLabel`),m=c.actionRef,h=c.icon;return(0,$.jsxs)(jD,{variant:Iwe[l],role:`status`,className:`pointer-events-auto relative`,children:[h&&(0,$.jsx)(`span`,{className:`text-xl leading-none shrink-0 mt-0.5`,"aria-hidden":`true`,children:h}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[d&&(0,$.jsx)(MD,{children:d}),f&&(0,$.jsx)(ND,{children:f}),p&&m&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(m),children:p})})]}),u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:s,"aria-label":i(B.GUIDANCE_ANNOUNCEMENT,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:ca.SM})})]})},Lwe={[Lu.DEFAULT]:xl.NEUTRAL,[Lu.PRIMARY]:xl.INFO,[Lu.SECONDARY]:xl.NEUTRAL,[Lu.SUCCESS]:xl.SUCCESS,[Lu.WARNING]:xl.WARNING,[Lu.ERROR]:xl.ERROR},J2=({element:e,t})=>{let n=e,r=n.variant??Lu.DEFAULT,i=n.unlocked??!1,a=t(`title`),o=t(`content`),s=n.icon;return(0,$.jsxs)(If,{variant:Zg(Lwe[r]),className:i?``:`opacity-[var(--opacity-disabled)]`,children:[s&&(0,$.jsx)(`span`,{className:`text-xs leading-none`,"aria-hidden":`true`,children:s}),a||o]})},Y2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_CARD}),{renderIcon:o}=Mf(),s=e,c=`dismissible`in s&&typeof s.dismissible==`boolean`?s.dismissible:!0,l=s.actionRef,u=s.imageUrl,d=s.icon,f=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let p=t(`title`),m=t(`description`),h=t(`content`),g=t(`actionLabel`);return(0,$.jsxs)(EF,{className:`pointer-events-auto relative overflow-hidden`,children:[u&&(0,$.jsx)(`img`,{src:u,alt:``,className:`w-full max-h-[200px] object-cover`}),(0,$.jsx)(OF,{children:(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[d&&(0,$.jsx)(`span`,{className:`text-2xl leading-none shrink-0`,"aria-hidden":`true`,children:d}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[p&&(0,$.jsx)(`h3`,{className:`text-base font-semibold leading-snug`,children:p}),m&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-normal`,children:m})]})]})}),h&&(0,$.jsx)(NF,{children:(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:h})}),g&&l&&(0,$.jsx)(kF,{children:(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(l),children:g})}),c&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:f,"aria-label":i(B.GUIDANCE_CARD,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:ca.SM})})]})},Rwe=bd(),X2=({element:e,flowRef:t,t:n,onComplete:r})=>{let i=Q.useMemo(()=>t?[`guidance.${t}`]:[],[t]),{tComponent:a,tGuidanceSurveyQuestion:o,isReady:s}=K({component:B.GUIDANCE_SURVEY,keys:i}),c=e,l=c.questions??[],u=c.allowSkip??!0,[d,f]=(0,Q.useState)(0),[p,m]=(0,Q.useState)({}),[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)(!1),y=l[d],b=d===l.length-1,x=d===0,S=l.length,C=(0,Q.useCallback)(n=>o(t,e.ref,n.id,`question`),[t,e.ref,o]),w=(0,Q.useCallback)((n,r)=>o(t,e.ref,n.id,`options.${r}.label`),[t,e.ref,o]),T=(0,Q.useCallback)((e,t)=>{m(n=>({...n,[e]:t})),g(t=>({...t,[e]:!1}))},[]),E=(0,Q.useCallback)(()=>{if(!y||!y.required)return!0;let e=p[y.id];return!(e==null||e===``||Array.isArray(e)&&e.length===0)},[y,p]),D=(0,Q.useCallback)(async()=>{if(!E())y&&g(e=>({...e,[y.id]:!0}));else if(b){v(!1);try{await r(e.ref,{surveyAnswers:p})}catch{v(!0)}}else f(e=>e+1)},[E,b,r,e.ref,p,y]),O=(0,Q.useCallback)(()=>{x||f(e=>e-1)},[x]),k=(0,Q.useCallback)(async()=>{v(!1),await r(e.ref,{surveyAnswers:p,declineResourceBinding:!0})},[r,e.ref,p]);if(!s)return null;let A=(e,t)=>{switch(e.type){case Tc.TEXT:return(0,$.jsx)(QM,{value:t??``,onChange:t=>T(e.id,t.target.value)});case Tc.TEXTAREA:return(0,$.jsx)(jI,{value:t??``,onChange:t=>T(e.id,t.target.value),rows:3});case Tc.RADIO:case Tc.SINGLE_CHOICE:{let n=(e.options??[]).map(t=>({value:t.ref,label:w(e,t.ref)}));return(0,$.jsx)(xF,{schema:Rwe,name:`survey-${e.id}`,value:t??``,onValueChange:t=>T(e.id,t),options:n,orientation:mu.VERTICAL})}case Tc.CHECKBOX:return(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:(e.options??[]).map(n=>{let r=w(e,n.ref),i=Array.isArray(t)?t:[],a=i.includes(n.ref);return(0,$.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer rounded-md px-2 py-1.5 text-sm hover:bg-accent/5`,children:[(0,$.jsx)(wI,{name:`__display`,schema:Od(),checked:a,onCheckedChange:()=>{let t=a?i.filter(e=>e!==n.ref):[...i,n.ref];T(e.id,t)}}),(0,$.jsx)(`span`,{children:r})]},n.ref)})});case Tc.RATING:{let n=typeof t==`number`?t:0;return(0,$.jsx)(`div`,{className:`flex gap-1`,role:`radiogroup`,"aria-label":C(e),children:[1,2,3,4,5].map(t=>(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON,onClick:()=>T(e.id,t),"aria-label":a(B.GUIDANCE_SURVEY,`ratingStar`,{star:t,total:5}),className:t<=n?`text-warning`:`text-muted-foreground/40`,children:(0,$.jsx)(`span`,{className:`text-xl`,children:`★`})},t))})}default:return null}};if(l.length===0)return null;let j=n(`title`),M=n(`description`),N=S>0?Math.round((d+1)/S*100):0;return(0,$.jsxs)(EF,{className:`pointer-events-auto`,children:[(j||M)&&(0,$.jsxs)(OF,{children:[j&&(0,$.jsx)(`h3`,{className:`text-base font-semibold`,children:j}),M&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M})]}),(0,$.jsxs)(NF,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(E_,{value:N,className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:a(B.GUIDANCE_SURVEY,`questionProgress`,{current:d+1,total:S})})]}),y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsxs)(`label`,{className:`text-sm font-medium`,children:[C(y),y.required&&(0,$.jsx)(`span`,{className:`text-destructive ml-1`,children:a(B.GUIDANCE_SURVEY,`required`)})]}),A(y,p[y.id]),h[y.id]&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:a(B.GUIDANCE_SURVEY,`required`)})]}),_&&(0,$.jsx)(jD,{variant:`destructive`,role:`alert`,children:(0,$.jsx)(ND,{children:a(B.GUIDANCE_SURVEY,`submissionFailed`)})})]}),(0,$.jsxs)(kF,{className:`flex justify-between items-center`,children:[(0,$.jsx)(`div`,{children:!x&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:O,children:a(B.GUIDANCE_SURVEY,`previous`)})}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:k,children:a(B.GUIDANCE_SURVEY,`skip`)}),(0,$.jsx)(X,{size:Y.SM,onClick:D,children:b?a(B.GUIDANCE_SURVEY,`submit`):a(B.GUIDANCE_SURVEY,`next`)})]})]})]})},Z2=()=>null,zwe={[He.CHECKLIST]:V2,[He.CHECKLIST_ITEM]:H2,[He.TOUR]:U2,[He.TOOLTIP]:W2,[He.MODAL]:G2,[He.BANNER]:K2,[He.ANNOUNCEMENT]:q2,[He.BADGE]:J2,[He.CARD]:Y2,[He.SURVEY]:X2},Q2={[He.CHECKLIST]:B.GUIDANCE_CHECKLIST,[He.CHECKLIST_ITEM]:B.GUIDANCE_CHECKLIST_ITEM,[He.TOUR]:B.GUIDANCE_TOUR,[He.TOOLTIP]:B.GUIDANCE_TOOLTIP,[He.MODAL]:B.GUIDANCE_MODAL,[He.BANNER]:B.GUIDANCE_BANNER,[He.ANNOUNCEMENT]:B.GUIDANCE_ANNOUNCEMENT,[He.BADGE]:B.GUIDANCE_BADGE,[He.CARD]:B.GUIDANCE_CARD,[He.SURVEY]:B.GUIDANCE_SURVEY};function $2(e,t){return t?.[e]||Fo.resolve(Q2[e],q.DEFAULT)||zwe[e]}var e4=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){as.getLogger().error(`GuidanceRenderer: element "${this.props.elementRef}" threw an error`,e)}render(){return this.state.hasError?null:this.props.children}};function t4(e){return`targetSelector`in e&&typeof e.targetSelector==`string`?e.targetSelector:e.targetField?`[data-guidance-field="${e.targetField}"]`:null}function n4(e){try{return!!document.querySelector(e)}catch{return r4.has(e)||(r4.add(e),as.getLogger().warn(`GuidanceRenderer: "${e}" is not a valid CSS selector, so the element targeting it can never be shown.`)),!1}}var r4=new Set;function Bwe(e,t){if(typeof document>`u`)return!1;if(t.type===He.TOOLTIP){let e=t.targetSelector;return typeof e==`string`&&n4(e)}if(t.type===He.TOUR){let e=t.steps;return Array.isArray(e)&&e.length>0}if(e.renderMode===zo.INLINE){let e=t4(t);return e===null||n4(e)}return!0}function Vwe(e,t){let n=e=>{let n=t[e.type];return!!n&&n!==Z2};return e.renderMode===zo.CHECKLIST?e.elements.filter(e=>e.type===He.CHECKLIST&&n(e)).length===0?[]:e.elements.filter(e=>(e.type===He.CHECKLIST||e.type===He.CHECKLIST_ITEM)&&n(e)):e.elements.filter(t=>n(t)&&Bwe(e,t))}var Hwe=({targetSelector:e,children:t})=>{let n=typeof document<`u`&&n4(e)?document.querySelector(e):null;return n?wN.createPortal((0,$.jsx)(`div`,{className:`absolute z-[calc(var(--z-guidance)-2)]`,children:t}),n):null},i4=({customRenderers:e})=>{let{activeFlows:t,flowStates:n,completeElement:r,dismissFlow:i,recordFlowPresented:a,reportFlowNotPresentable:o}=_U(),s=(0,Q.useMemo)(()=>t.map(e=>`guidance.${e.ref}`),[t]),{makeTrGuidanceElement:c,tGuidanceElement:l,isReady:u}=K({keys:s}),{emit:d}=Mo(),f=E2(),p=Fo.getRegistrationCount(),m=(0,Q.useRef)(null),h=(0,Q.useMemo)(()=>{let t={};for(let n of Object.values(He)){let r=$2(n,e);r&&(t[n]=r)}let n=t,r=m.current;return r&&Object.values(He).every(e=>r[e]===n[e])?r:(m.current=n,n)},[e,p]),g=(0,Q.useCallback)(e=>{d(Ec.NAVIGATION_REQUEST,{operationRef:e,initiator:{sourceZone:Dn}})},[d]),_=(0,Q.useCallback)((e,t,n)=>r(e,t,n),[r]),v=(0,Q.useCallback)((e,t)=>{i(e)},[i]),y=(0,Q.useMemo)(()=>{if(t.length===0)return null;let e=[],r=[],i=[];for(let a of t){let t=n[a.ref];if(a.renderMode===zo.CHECKLIST){let e=a.elements.filter(e=>e.type===He.CHECKLIST),n=a.elements.filter(e=>e.type===He.CHECKLIST_ITEM);for(let r of e){let e=h[He.CHECKLIST];if(!e||e===Z2)continue;let o=t?.elements?.[r.ref],s=c(a.ref,r.ref,zc(r)),l=h[He.CHECKLIST_ITEM],u=l&&l!==Z2?n.map(e=>{let n=t?.elements?.[e.ref],r=c(a.ref,e.ref,zc(e));return(0,$.jsx)(e4,{elementRef:e.ref,children:(0,$.jsx)(l,{element:e,flowRef:a.ref,state:n,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:r})},`${a.ref}-${e.ref}`)}):null,d=(0,$.jsx)(e4,{elementRef:r.ref,children:(0,$.jsx)(e,{element:r,flowRef:a.ref,state:o,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:s,children:u})},`${a.ref}-${r.ref}`);i.push(d)}}else for(let n of a.elements){let i=h[n.type];if(!i||i===Z2)continue;let o=t?.elements?.[n.ref],s=c(a.ref,n.ref,zc(n)),l=(0,$.jsx)(e4,{elementRef:n.ref,children:(0,$.jsx)(i,{element:n,flowRef:a.ref,state:o,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:s})},`${a.ref}-${n.ref}`);switch(a.renderMode){case zo.OVERLAY:e.push(l);break;case zo.INLINE:{let e=t4(n);e?r.push((0,$.jsx)(Hwe,{targetSelector:e,children:l},`inline-${a.ref}-${n.ref}`)):r.push(l);break}}}}return{overlayElements:e,inlineElements:r,checklistElements:i}},[t,n,h,c,g,_,v]),b=(0,Q.useRef)(new Set);if((0,Q.useEffect)(()=>{if(u)for(let e of t){let t=Vwe(e,h);if(o(e.ref,t.length===0),t.length===0)continue;let n=t.flatMap(t=>zc(t).filter(n=>l(e.ref,t.ref,n)===void 0).map(n=>`guidance.${e.ref}.elements.${t.ref}.${n}`));if(n.length===0){a(e.ref);continue}let r=`${e.ref}|${n.join(`,`)}`;b.current.has(r)||(b.current.add(r),as.getLogger().warn(`GuidanceRenderer: flow "${e.ref}" is shown but NOT recorded as presented — its required labels are unresolved [${n.join(`, `)}]. Generate the labels; the flow will trigger again once they exist.`))}},[u,t,h,l,a]),!u||!y)return null;let{overlayElements:x,inlineElements:S,checklistElements:C}=y;if(!(x.length>0||S.length>0||C.length>0))return null;let w=typeof document<`u`?f??document.body:void 0,T=f?`absolute`:`fixed`;return(0,$.jsxs)($.Fragment,{children:[x.length>0&&w&&wN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`overlay`,className:`${T} inset-0 z-(--z-guidance) pointer-events-none flex flex-col items-center justify-center gap-element`,children:x.map(e=>(0,$.jsx)(`div`,{className:`w-full max-w-md shrink-0 px-element empty:hidden`,children:e},e.key))}),w),S,C.length>0&&w&&wN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`checklist`,className:`${T} bottom-6 end-6 z-[calc(var(--z-guidance)-1)]`,children:C}),w)]})},a4=(0,Q.createContext)(null),o4=(0,Q.createContext)(null),s4=(0,Q.createContext)(null);function c4(e){let t=(0,Q.useContext)(a4);if(!t)throw Error(`${e} must be rendered inside <AppShellProviders>, which supplies the layout it places regions from.`);return t}function l4(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{e&&n(!0)},[e]),t}function u4(){return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:KE,children:(0,$.jsx)(`div`,{className:`h-screen w-screen bg-background flex items-center justify-center`,role:`status`,"aria-live":`polite`,children:(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(ib,{size:32,className:`text-primary mx-auto mb-field`,"aria-hidden":`true`})})})})}function d4({layout:e,children:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=(0,Q.useCallback)(e=>{r(e)},[]),s=(0,Q.useCallback)(e=>{a(e)},[]);return(0,$.jsx)(a4.Provider,{value:e,children:(0,$.jsx)(o4.Provider,{value:o,children:(0,$.jsx)(s4.Provider,{value:s,children:(0,$.jsx)(T2.Provider,{value:i??n,children:(0,$.jsx)(B2,{children:t})})})})})}function f4(){let e=(0,Q.useContext)(s4);if(!e)throw Error(`AppShellOverlayPortalLayer must be rendered inside <AppShellProviders>, which exposes it as the portal container.`);return(0,$.jsx)(`div`,{ref:e,"data-shell-overlay-layer":``,className:`absolute left-0 top-0 h-0 w-0`})}function p4(e){let t=c4(`AppShellRegionOutlet`),{region:n,placement:r}=e,i=e=>r===void 0||r===e?e:null;switch(n){case lo.ACTIVITY_BAR:return t.hasActivityBar?(0,$.jsx)(A2,{}):null;case lo.MENUBAR:return t.hasMenubar?(0,$.jsx)(j2,{}):null;case lo.TOOLBAR:return t.hasToolbar?(0,$.jsx)(F2,{}):null;case lo.SIDEBAR:{let e=i(t.sidebarPlacement);return t.hasSidebar&&e?(0,$.jsx)(N2,{placement:e}):null}case lo.UTILITY_PANEL:{let e=i(t.utilityPanelPlacement);return t.hasUtilityPanel&&e&&!t.utilityPanelHostedInChrome?(0,$.jsx)(I2,{position:e}):null}case lo.STATUS_BAR:{let e=i(t.statusBarPlacement);return t.hasStatusBar&&e?(0,$.jsx)(P2,{placement:e}):null}default:throw Error(`AppShellRegionOutlet has no rendering for region "${String(n)}".`)}}function m4({className:e,children:t}){let n=c4(`AppShellContentOutlet`),r=(0,Q.useContext)(o4);return(0,$.jsxs)(`main`,{ref:r??void 0,"data-component-area":lo.CONTENT,className:e,children:[(0,$.jsx)(i2,{routerChildren:t}),n.hasQuickActionButton&&!n.quickActionButtonHostedInChrome&&(0,$.jsx)(M2,{placement:`floating`})]})}function h4(){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(a2,{}),(0,$.jsx)(i4,{})]})}var g4;(function(e){e.INHERIT=`inherit`,e.COMPOSED=`composed`})(g4||={});var _4;(function(e){e.SHELL=`shell`,e.LAYOUT_2D=`layout-2d`,e.LAYOUT_3D=`layout-3d`})(_4||={});var v4=Symbol.for(`@wildo-ai/saas-frontend-lib/shell-layout-main-container`);function y4(e){return typeof e==`function`&&e[v4]===!0}function b4(e,t){switch(t.placement.kind){case g4.INHERIT:return e;case g4.COMPOSED:return t.placement.container;default:{let e=t.placement;throw Error(`The shell layout '${t.id}' has a placement this framework does not implement: ${JSON.stringify(e)}.`)}}}function x4(e,t,n,r,i){return Object.assign(e,{...i??{},[v4]:!0,captured:t,layout:n,layoutFamily:r})}function S4(e,t,n=_4.SHELL){let r=b4(e,t);function i(e){return(0,$.jsx)(r,{...e})}return x4(i,e,t,n)}function C4(e,t={}){let n=t.callerName??`registerShellLayout()`,r=!1;return{componentRef:B.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT,get isConfigurable(){return r},loadComponent:async()=>{let i=Fo.resolve(B.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT);if(!i)throw Error(`${n}: no Default APP_LAYOUTS_MAIN_CONTAINER is registered to capture. Call it from the engine module's \`componentRegistrations\`, which run after the framework presets — not from a module evaluated before them.`);let a=t.family??_4.SHELL,o=t.builtInLayouts&&Object.hasOwn(t.builtInLayouts,e.id)?t.builtInLayouts[e.id]:void 0;if(o!==void 0&&o!==e)throw Error(`${n}: the layout id '${e.id}' belongs to a built-in layout; give the application's own layout an id of its own.`);if(y4(i)&&(i.layout.id!==e.id||i.layoutFamily!==a)){let t=(t,n)=>i.layout.id===e.id?`'${t}' (${n})`:`'${t}'`;throw Error(`${n}: this application already registered the layout ${t(i.layout.id,i.layoutFamily)} and now asks for ${t(e.id,a)}. An application uses one layout: remove the other registration — or, if you just changed the layout in code, reload the page (the component registry outlives a hot reload).`)}r=Fo.getMetadata(B.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT)?.isConfigurable??!1;let s=y4(i)?i.captured:i,c=t.createContainer?t.createContainer(s,e):S4(s,e,a);if(c.layoutFamily!==a)throw Error(`${n}: the container was branded for the family '${c.layoutFamily}' while registering for '${a}'.`);return c}}}var w4;(function(e){e.APPEARED=`appeared`,e.CHANGED=`changed`})(w4||={});var T4;(function(e){e.REST=`rest`,e.BEHIND=`behind`,e.DISCARDED=`discarded`})(T4||={});var E4;(function(e){e.PANE_SWAP=`pane-swap`,e.COLUMN_RESIZE=`column-resize`})(E4||={});var D4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(D4||={});var O4;(function(e){e.INSTANT=`instant`,e.GROW=`grow`})(O4||={});var k4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(k4||={});var A4=.55,j4=`data-shell-proxy`,M4=`data-shell-object`,N4=`data-shell-ghost-layer`,P4=`data-shell-ghost`,F4;(function(e){e.DISCARDED=`discarded`,e.BEHIND=`behind`})(F4||={});var I4;(function(e){e.BACK=`back`,e.FRONT=`front`})(I4||={});function L4(e){return`[data-component-area="${e}"]`}var R4=L4(lo.CONTENT),z4=`${R4} [data-content-area]:not([data-panel-id] *), ${R4} [data-panel-id^="nav-"]`;function B4(e){return`${R4} [data-content-area="${e}"]:not([data-panel-id] *), ${R4} [data-panel-id="nav-${e}"]`}function V4(e){if(e instanceof HTMLElement)return e.dataset.contentArea??e.dataset.panelId?.replace(/^nav-/,``)}var H4=new Set([Cl.SECONDARY,Cl.COMPANION]);function U4(e){let t=V4(e);return t!==void 0&&H4.has(t)}function W4(e){return H4.has(e)}var G4;(function(e){e.DROPDOWN_MENU=`dropdown-menu-content`,e.DROPDOWN_MENU_SUB=`dropdown-menu-sub-content`,e.CONTEXT_MENU=`context-menu-content`,e.CONTEXT_MENU_SUB=`context-menu-sub-content`,e.POPOVER=`popover-content`,e.HOVER_CARD=`hover-card-content`,e.TOOLTIP=`tooltip-content`,e.SELECT=`select-content`,e.MENUBAR=`menubar-content`,e.MENUBAR_SUB=`menubar-sub-content`,e.DIALOG=`dialog-content`,e.ALERT_DIALOG=`alert-dialog-content`,e.SHEET=`sheet-content`,e.DRAWER=`drawer-content`})(G4||={});var K4={[G4.DROPDOWN_MENU]:`--radix-dropdown-menu-content-transform-origin`,[G4.DROPDOWN_MENU_SUB]:`--radix-dropdown-menu-content-transform-origin`,[G4.CONTEXT_MENU]:`--radix-context-menu-content-transform-origin`,[G4.CONTEXT_MENU_SUB]:`--radix-context-menu-content-transform-origin`,[G4.POPOVER]:`--radix-popover-content-transform-origin`,[G4.HOVER_CARD]:`--radix-hover-card-content-transform-origin`,[G4.TOOLTIP]:`--radix-tooltip-content-transform-origin`,[G4.SELECT]:`--radix-select-content-transform-origin`,[G4.MENUBAR]:`--radix-menubar-content-transform-origin`,[G4.MENUBAR_SUB]:`--radix-menubar-content-transform-origin`},Uwe=[G4.DIALOG,G4.ALERT_DIALOG],q4=[G4.DIALOG,G4.ALERT_DIALOG,G4.SHEET,G4.DRAWER],J4=[`open`,`delayed-open`,`instant-open`];function Wwe(){return`:has([data-shell-overlay-layer] :is(${q4.map(e=>`[data-slot="${e}"]`).join(`, `)})[data-state="open"])`}var Y4=new Map;function X4(e,t,n=document){let r=Y4.get(e)??{sheet:null,users:0};if(Y4.set(e,r),r.users+=1,r.users===1){if(`adoptedStyleSheets`in n&&typeof CSSStyleSheet<`u`&&`replaceSync`in CSSStyleSheet.prototype)r.sheet=new CSSStyleSheet,r.sheet.replaceSync(t),n.adoptedStyleSheets=[...n.adoptedStyleSheets,r.sheet];else{let r=n.createElement(`style`);r.dataset.shellLayoutStylesheet=e,r.textContent=t,n.head.appendChild(r),r.sheet===null&&console.warn(`[ShellLayout] The "${e}" layout's stylesheet was not applied: this browser has no constructable stylesheets (Chrome 73+, Firefox 101+, Safari 16.4+ have them) and the content security policy refused the <style> fallback. Allow 'unsafe-inline' in style-src, or support only browsers with constructable stylesheets.`)}}let i=!1;return()=>{if(i||(i=!0,--r.users,r.users>0))return;let{sheet:t}=r;t&&(n.adoptedStyleSheets=n.adoptedStyleSheets.filter(e=>e!==t));for(let t of n.head.querySelectorAll(`style[data-shell-layout-stylesheet]`))t.dataset.shellLayoutStylesheet===e&&t.remove();Y4.delete(e)}}var Gwe=24,Kwe=220,qwe=.5,Z4=24,Jwe=28,Ywe=1500,Q4=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Xwe(e){let t=e.cloneNode(!0);t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`inert`,``);for(let e of[t,...t.querySelectorAll(`*`)])for(let t of[`id`,`data-content-area`,`data-panel-id`,`data-component-area`,`data-slot`,`data-state`])e.removeAttribute(t);for(let e of t.querySelectorAll(`iframe, video, audio`))e.remove();return t}function $4(e,t){if(!(e instanceof HTMLElement))return!1;let n=e.offsetHeight;return n>=Gwe&&n<=Kwe&&e.offsetWidth>=t*qwe}function e3(e,t){if(e.tagName!==t.tagName)return!1;let n=new Set(e.classList),r=new Set(t.classList);return n.size===0&&r.size===0||[...n].filter(e=>r.has(e)).length/Math.max(n.size,r.size)>=.5}function Zwe(e,t){return(e.parentElement?[...e.parentElement.children]:[]).some(n=>n!==e&&$4(n,t)&&e3(n,e))}function t3(e){let t=e.closest(z4);if(!t)return null;let n=t.clientWidth;for(let r=e;r&&r!==t;r=r.parentElement)if($4(r,n)&&Zwe(r,n))return r;return null}var Qwe=`button, a, [role="button"], [role="menuitem"], [role="option"]`;function n3(e){let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(t.current=null,!e)return;let n=e=>{if(!e)return;let n=t3(e),r=e.closest(Qwe)??e;t.current={row:n?{...Q4(n.getBoundingClientRect()),picture:Xwe(n),element:n}:null,control:Q4(r.getBoundingClientRect()),at:performance.now()}},r=e=>n(e.target instanceof Element?e.target:null),i=e=>{e.key===`Enter`||e.key===` `?n(document.activeElement):t.current=null};return document.addEventListener(`pointerdown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`pointerdown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),(0,Q.useMemo)(()=>{let e=(e,n)=>{let r=t.current;return!r||performance.now()-r.at>n?null:(t.current=null,e(r))};return{takeRow:t=>e(e=>e.row,t),peekRow:e=>{let n=t.current;return n&&performance.now()-n.at<=e?n.row:null},takeControl:t=>e(e=>e.control,t)}},[])}function r3(e,t,n,r,i){let a=Math.round(r.durationMs*A4);if(a===0||typeof HTMLElement.prototype.animate!=`function`)return Promise.resolve();let o=e.getBoundingClientRect(),s=(e,t)=>({left:`${e.left-o.left}px`,top:`${e.top-o.top}px`,width:`${e.width}px`,height:`${e.height}px`,borderRadius:`${t}px`}),c=document.createElement(`div`);return c.setAttribute(j4,``),c.setAttribute(`aria-hidden`,`true`),Object.assign(c.style,{position:`absolute`,zIndex:`400`,pointerEvents:`none`,boxSizing:`border-box`,background:`var(--card, var(--background))`,border:`1px solid var(--primary, currentColor)`,boxShadow:`0 18px 40px -18px rgb(0 0 0 / 0.35)`}),Object.assign(c.style,s(t,10),{overflow:`hidden`}),t.picture&&(Object.assign(t.picture.style,{position:`absolute`,left:`0`,top:`0`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,pointerEvents:`none`}),c.appendChild(t.picture),t.picture.animate([{opacity:1},{opacity:0}],{duration:Math.round(a*.8),easing:`ease-in`,fill:`forwards`})),e.appendChild(c),i instanceof HTMLElement&&typeof i.animate==`function`&&i.animate([{opacity:0},{opacity:0,offset:A4},{opacity:1}],{duration:r.durationMs,easing:`linear`}),c.animate([s(t,10),s(n,14)],{duration:a,easing:r.easing,fill:`forwards`}).finished.catch(()=>void 0).then(()=>c.remove())}function i3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,i.top+t.top-a.top),s=Math.max(0,i.left+t.left-a.left),c=Math.max(0,a.right-(i.left+t.left+t.width)),l=Math.max(0,a.bottom-(i.top+t.top+t.height));e.animate([{clipPath:`inset(${o}px ${c}px ${l}px ${s}px round 12px)`},{clipPath:`inset(0px 0px 0px 0px round 0px)`}],{duration:r.durationMs,easing:r.easing})}function a3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect().left+t.left-e.getBoundingClientRect().left;Math.abs(i)<2||e.animate([{transform:`translateX(${i}px)`},{transform:`none`}],{duration:r.durationMs,easing:r.easing})}function o3(e){let t=e.clientWidth,n=[];for(let r of[e,...e.querySelectorAll(`*`)]){if(r.children.length<2||r.children.length<=n.length)continue;let e=[...r.children].filter(e=>$4(e,t)),i=[];for(let t of e){let e=i.find(e=>e3(e[0],t));e?e.push(t):i.push([t])}let a=i.reduce((e,t)=>t.length>e.length?t:e,[]);a.length>=2&&a.length>n.length&&a.length>=r.children.length*.6&&(n=a)}return n}function s3(e,t){if(t.durationMs===0||typeof e.animate!=`function`)return()=>void 0;let n=new WeakSet,r=0,i=()=>{a=0;for(let i of o3(e).slice(0,Z4))n.has(i)||(n.add(i),i.animate([{opacity:0,transform:`translateY(12px) scale(0.98)`},{opacity:1,transform:`none`}],{duration:Math.round(t.durationMs*.8),easing:t.easing,delay:Math.min(r,Z4)*Jwe,fill:`backwards`}),r+=1)},a=0;i();let o=new MutationObserver(()=>{a||=(r=0,requestAnimationFrame(i))});o.observe(e,{childList:!0,subtree:!0});let s=setTimeout(()=>{cancelAnimationFrame(a),o.disconnect()},Ywe);return()=>{clearTimeout(s),cancelAnimationFrame(a),o.disconnect()}}function c3(e,t,n){(0,Q.useEffect)(()=>{let r=e.current?.querySelector(`[data-shell-overlay-layer]`),i=e.current;if(!i||!r||t.dialogArrival!==k4.FROM_PRESSED_ELEMENT||t.durationMs===0)return;let a=new WeakSet,o=q4.filter(e=>e!==G4.DRAWER).map(e=>`[data-slot="${e}"][data-state="open"]`).join(`, `),s=new MutationObserver(()=>{for(let e of r.querySelectorAll(o)){if(a.has(e))continue;a.add(e);let r=n.takeControl(800);r&&r3(i,r,Q4(e.getBoundingClientRect()),t,e)}});return s.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>s.disconnect()},[e,t,n])}var l3=`shell-pane-arrival`,u3=`data-shell-view-transition`,$we=`
25
- html[${u3}]::view-transition-old(root),
26
- html[${u3}]::view-transition-new(root) { animation: none; }
27
- ::view-transition-group(${l3}) {
28
- animation-duration: var(--shell-vt-duration, 320ms); animation-timing-function: var(--shell-vt-ease, ease);
29
- overflow: clip; border-radius: var(--radius, 8px);
30
- }
31
- ::view-transition-old(${l3}),
32
- ::view-transition-new(${l3}) { height: 100%; object-fit: none; object-position: left top; }
33
- html:dir(rtl)::view-transition-old(${l3}),
34
- html:dir(rtl)::view-transition-new(${l3}) { object-position: right top; }
35
- ::view-transition-old(${l3}) { animation: shell-vt-out calc(var(--shell-vt-duration, 320ms) * 0.6) ease-out both; }
36
- ::view-transition-new(${l3}) { animation: shell-vt-in var(--shell-vt-duration, 320ms) ease-in both; }
37
- @keyframes shell-vt-out { to { opacity: 0; } }
38
- @keyframes shell-vt-in { 0%, 40% { opacity: 0; } 100% { opacity: 1; } }
39
- @media (prefers-reduced-motion: reduce) {
40
- ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
41
- }
42
- `,eTe=as.getLogger(),d3=null;function tTe(e=document){return typeof e.startViewTransition==`function`}function f3(e,t){for(let n of e.querySelectorAll(B4(t)))if(!n.hasAttribute(`data-zone-hidden`)&&n.offsetWidth>0)return n;return null}function nTe(e){let t=e.doc??document;return(n,{zone:r})=>{let i=e.stage(),a=t.startViewTransition;if(!i||typeof a!=`function`||e.axis.durationMs===0||!W4(r)||f3(i,r)){n();return}let o=e.origin.peekRow(800)?.element;if(!o?.isConnected){n();return}e.origin.takeRow(800);let s=t.documentElement,c={};d3=c;let l=null,u=()=>{o.style.removeProperty(`view-transition-name`),l?.style.removeProperty(`view-transition-name`),d3===c&&(d3=null,s.removeAttribute(u3),s.style.removeProperty(`--shell-vt-duration`),s.style.removeProperty(`--shell-vt-ease`))};s.setAttribute(u3,``),s.style.setProperty(`--shell-vt-duration`,`${e.axis.durationMs}ms`),s.style.setProperty(`--shell-vt-ease`,e.axis.easing),o.style.setProperty(`view-transition-name`,l3);try{a.call(t,()=>{o.style.removeProperty(`view-transition-name`);try{(0,wN.flushSync)(n)}catch(e){eTe.error(`A navigation commit failed inside the view-transition arrival`,{error:e,zone:r});return}let e=f3(i,r);if(e){for(let e of i.querySelectorAll(B4(r)))for(let t of e.getAnimations?.()??[])`animationName`in t&&t.finish();e.style.setProperty(`view-transition-name`,l3),l=e}}).finished.then(u,u)}catch{u(),n()}}}var rTe=`[${M4}], ${z4}`,p3=new WeakMap;function m3(e,t){let n=0,r=0,i=e;for(;i&&i!==t;){n+=i.offsetLeft,r+=i.offsetTop;let e=i.offsetParent;if(!e||!t.contains(e)&&e!==t)break;i=e}return{left:n,top:r}}function h3(e,t){let n=(0,Q.useRef)(t);n.current=t,(0,Q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>s()),a=new Set,o=()=>{r=0;let e=new Set(t.querySelectorAll(rTe));for(let t of e)a.has(t)||(i?.observe(t),a.add(t));for(let t of a)e.has(t)||(i?.unobserve(t),a.delete(t));for(let r of e){let e=m3(r,t);n.current?.(r,e,t),r.offsetWidth>0&&r.offsetHeight>0&&p3.set(r,{...e,width:r.offsetWidth,height:r.offsetHeight})}},s=()=>{r||=requestAnimationFrame(o)};o(),i?.observe(t);let c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0}),window.addEventListener(`resize`,s),()=>{cancelAnimationFrame(r),i?.disconnect(),c.disconnect(),window.removeEventListener(`resize`,s)}},[e])}function g3(e,t){let[n,r]=(0,Q.useState)(t);return(0,Q.useEffect)(()=>r(t),[t]),(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let t=(e.target instanceof Element?e.target:null)?.closest(`${L4(lo.CONTENT)} :is([data-content-area], [data-panel-id^="nav-"])`),n=t?V4(t):void 0;n&&r(n)};return t.addEventListener(`pointerdown`,n,!0),t.addEventListener(`focusin`,n,!0),()=>{t.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`focusin`,n,!0)}},[e]),{zone:n,bringForward:r}}var iTe=new Set(pr);function _3(e,t){let n=Object.keys(e.state.zones).filter(e=>iTe.has(e)),r=n.map(t=>{let n=e.getTopEntry(t);return n?n.urlPath?.split(/[?#]/)[0]??n.id:``}),i=n.map((e,t)=>`${e}:${r[t]}`).join(`|`),a=(0,Q.useRef)(null),o=(0,Q.useRef)(t);o.current=t,(0,Q.useEffect)(()=>{let e=new Map(n.map((e,t)=>[e,r[t]??``])),t=a.current;if(a.current=e,t)for(let[n,r]of e){let e=t.get(n)??``;r!==``&&e!==r&&o.current(n,e===``?w4.APPEARED:w4.CHANGED)}},[i])}function v3(e){e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of[`id`,`data-content-area`,`data-panel-id`,`data-zone-hidden`,`data-zone-emphasized`,`data-component-area`,M4])t.removeAttribute(e);for(let t of e.querySelectorAll(`iframe, video, audio`))t.remove()}function y3(e,t){for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}function b3(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function x3(e,t){(0,Q.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let r=n.querySelector(`[${N4}="${I4.BACK}"]`),i=n.querySelector(`[${N4}="${I4.FRONT}"]`);if(!r||!i)return;let a=new Map,o=t.durationMs,s=(e,r)=>{let i=document.createElement(`div`);return i.setAttribute(P4,e),i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,left:`${r.left}px`,top:`${r.top}px`,width:`${r.width}px`,height:`${r.height}px`}),y3(i,t.ghostPose(T4.REST,{rect:r,stage:n})),i},c=e=>{let r=p3.get(e);if(!r||o===0||e.isConnected)return;let a=s(F4.DISCARDED,r);v3(e),a.appendChild(e),i.appendChild(a),b3(()=>{y3(a,t.ghostPose(T4.DISCARDED,{rect:r,stage:n})),a.style.opacity=`0`}),setTimeout(()=>a.remove(),o+60)},l=()=>{let e=n.querySelector(`[data-zone-emphasized]`)&&t.drawsHiddenPanePicture?[...n.querySelectorAll(z4)].filter(e=>e.hasAttribute(`data-zone-hidden`)):[];for(let[r,i]of a){if(e.includes(r))continue;if(a.delete(r),o===0){i.remove();continue}let s=p3.get(r);s&&y3(i,t.ghostPose(T4.REST,{rect:s,stage:n})),i.style.opacity=`0`,setTimeout(()=>i.remove(),o)}for(let i of e){if(a.has(i))continue;let e=p3.get(i);if(!e)continue;let c=s(F4.BEHIND,e),l=i.cloneNode(!0);v3(l),l.classList.remove(`hidden`),l.style.width=`100%`,l.style.height=`100%`,c.appendChild(l),a.set(i,c),o===0?(y3(c,t.ghostPose(T4.BEHIND,{rect:e,stage:n})),r.appendChild(c)):(c.style.opacity=`0`,r.appendChild(c),b3(()=>{y3(c,t.ghostPose(T4.BEHIND,{rect:e,stage:n})),c.style.opacity=`1`}))}},u=e=>e.matches(z4)?e:e.closest(`[data-panel-id^="nav-"]`),d=new MutationObserver(e=>{for(let r of e)if(r.type===`attributes`&&r.attributeName===`data-zone-emphasized`&&t.paneResize===O4.GROW){let e=r.target instanceof Element?u(r.target):null,i=e?p3.get(e):void 0;e&&i&&(r.target.hasAttribute(`data-zone-emphasized`)?i3(e,i,n,t):a3(e,i,n,t))}else if(r.type===`childList`)for(let e of r.removedNodes)e instanceof HTMLElement&&p3.has(e)&&U4(e)&&c(e);l()}),f=n.querySelector(L4(lo.CONTENT))??n;return d.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-zone-hidden`,`data-zone-emphasized`]}),l(),()=>{d.disconnect();for(let e of a.values())e.remove()}},[e,t]);let n=(0,Q.useRef)(()=>void 0);return(0,Q.useEffect)(()=>{n.current=n=>{let r=e.current;if(!r||t.durationMs===0)return;let i=r.querySelector(B4(n));i&&typeof i.animate==`function`&&i.animate([t.dipPeak(E4.PANE_SWAP,{stage:r})],{duration:t.durationMs,easing:t.easing})}},[e,t]),{dip:e=>n.current(e)}}var aTe=24;function S3(e,t){(0,Q.useEffect)(()=>{let n=e.current;if(!n||t.durationMs===0||typeof ResizeObserver>`u`)return;let r=[...n.querySelectorAll(`[${M4}]`)].filter(e=>e.querySelector(`:scope > ${L4(lo.SIDEBAR)}, :scope > ${L4(lo.UTILITY_PANEL)}`)),i=new Map,a=new Map,o=new ResizeObserver(e=>{for(let r of e){let e=r.target,o=e.offsetWidth,s=i.get(e);if(s===void 0||o===0){i.set(e,o);continue}if(Math.abs(o-s)<=aTe)continue;i.set(e,o);let c=performance.now();c-(a.get(e)??0)<t.durationMs||(a.set(e,c),e.animate([t.dipPeak(E4.COLUMN_RESIZE,{stage:n})],{duration:t.durationMs,easing:t.easing}))}});for(let e of r)o.observe(e);return()=>o.disconnect()},[e,t])}function C3(e,{axis:t,navigation:n,onObjectMeasured:r}){h3(e,r);let{dip:i}=x3(e,t),a=g3(e,n.focusedZone);S3(e,t);let o=n3(t.paneArrival===D4.FROM_PRESSED_ELEMENT||t.dialogArrival===k4.FROM_PRESSED_ELEMENT);c3(e,t,o),(0,Q.useEffect)(()=>{if(t.paneArrival!==D4.FROM_PRESSED_ELEMENT||!t.paneArrivalByViewTransition||t.durationMs===0||!tTe())return;let n=X4(`shell-view-transition`,$we),r=vh(nTe({stage:()=>e.current,origin:o,axis:t}));return()=>{r(),n()}},[e,o,t]);let s=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>()=>{for(let e of s.current.values())e();s.current.clear()},[]),_3(n,(n,r)=>{r===w4.CHANGED&&i(n),a.bringForward(n);let c=e.current,l=c?.querySelector(B4(n));if(c&&l&&t.durationMs!==0){if(r===w4.APPEARED&&t.paneArrival===D4.FROM_PRESSED_ELEMENT&&U4(l)){let e=o.takeRow(800);e&&r3(c,e,l.getBoundingClientRect(),t,l)}t.cascadesRows&&(s.current.get(n)?.(),s.current.set(n,s3(l,t)))}}),{frontZone:a.zone}}var w3=as.getLogger(),oTe=w3.debugByType(`ComponentRegistryLoaderService`);w3.setDebugTypeLogging(`ComponentRegistryLoaderService`,!1);function sTe(e){if(!e||e.length===0)return;let t=0;e.forEach(e=>{e&&Object.entries(e).forEach(([e,n])=>{let r=e;n&&Array.isArray(n)&&n.forEach(e=>{if(!e||!e.component)return;let n=e.variant||e.preset||q.DEFAULT;Fo.isRegistered(r,n,e.category)||(Fo.register(r,n,e.component,{isConfigurable:e.isConfigurable!==!1,category:e.category}),t++)})})}),t>0&&oTe(`✅ Custom components loaded: ${t} components registered`)}function cTe(){let e=Fo.getRegistrationsByType(),t=new Map;return e.forEach((e,n)=>{let r=n.split(`_`).slice(0,-1).join(`_`)||`OTHER`;t.set(r,(t.get(r)||0)+e.length)}),{totalRegistered:Fo.getRegistrationCount(),byCategory:t}}async function lTe(e){for(let t of e){let e=await t.loadComponent();Fo.register(t.componentRef,t.preset??q.DEFAULT,e,{isConfigurable:t.isConfigurable??!1})}}var T3=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,schema:i,disabled:a,readOnly:o,className:s,placeholder:c,controlSize:l=Zd.MD,targetResourceType:u,optionDisplayMode:d,onClear:f,leadingAdornment:p,quickCreateSourceFieldName:m,onQuickCreateCreated:h},g)=>{let _=FD(),{tComponent:v,isReady:y}=K({component:[B.RESOURCES_FIELDS_RESOURCE_REFERENCE,B.RESOURCES_LAYOUTS_LIST]}),{renderIcon:b}=Mf(),x=l===Zd.SM?`sm`:`md`,S=l===Zd.SM?Y.XS:Y.SM,{options:C,isLoading:w,isLoadingCurrentValue:T,setIsOpen:E,handleSearchChange:D,getDisplayLabel:O,resourceType:k,isMultiple:A,normalizedValue:j,emptyMessage:M,defaultPlaceholder:N,fetchError:P}=vV({schema:i,name:e,value:t,targetResourceType:u}),{registry:F}=fm(),I=d??iae(i)?.edit?.optionDisplayMode??Kl,ee=k?F.resourceConfigurations[k]:void 0,L=ee?.mainSchema,R=P?yp({tComponent:v,componentType:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`fetchErrorEmptyMessage`,params:{message:P.message}}):M,z=Wz({sourceResourceType:zT()?.hostResolvesRelationshipRoots===!0?void 0:_?.resourceType,sourceResourceId:_?.resourceId,sourceFieldName:m??e,sourceOperation:_?.operationType,relatedResourceType:k,contextResourceIdentifiers:_?.contextResourceIdentifiers,navigationZone:_?.navigationZone,operationType:_?.operationType,onCreated:async({resourceId:e})=>{if(h)await h(e);else if(A){let t=[...new Set([...j,e])];n(t.length>0?t:void 0)}else n(e)}}),te=(0,Q.useCallback)(e=>{n(e||void 0)},[n]),ne=(0,Q.useCallback)(e=>{n(e.length>0?e:void 0)},[n]),re=(0,Q.useCallback)(e=>T?`...`:O(e.value),[T,O]),ie=(0,Q.useCallback)(e=>k&&L&&e.data&&typeof e.data==`object`?(0,$.jsx)(pG,{resourceType:k,schema:V.resolveRowSchema(ee,e.data)??L,data:e.data,primaryLabel:e.label,contextResourceIdentifiers:_?.contextResourceIdentifiers}):e.label,[k,ee,L,_?.contextResourceIdentifiers]),ae=I===tt.SUMMARY?ie:void 0;return k?y?A?(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(yx,{ref:g,name:e,schema:i,options:C,value:j,onChange:ne,renderOption:ae,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:re}),z.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:J.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:ca.SM})})]}):(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(vx,{ref:g,name:e,schema:i,options:C,value:j[0]??``,onChange:te,renderOption:ae,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:re,onClear:f,leadingAdornment:p}),z.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:J.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:ca.SM})})]}):null:(0,$.jsx)(`div`,{className:U(`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,s),children:(0,$.jsxs)(`span`,{children:[`Unknown resource type for field: `,e]})})});T3.displayName=`ResourceFieldEditPreset_ResourceReference_Default`;var uTe=T3;function dTe(e){let t=e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType],n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}var E3=U(`block rounded-md text-inherit no-underline transition-colors hover:bg-muted/40`,Rg(d_.OFFSET));function D3({label:e}){return(0,$.jsx)(Z,{as:`span`,variant:zr.INHERIT,children:e})}var fTe=({fieldName:e,value:t,resourceType:n,data:r,displayParams:i,labelFallback:a,schema:o,className:s})=>{let{registry:c,doOperation:l}=fm(),{emit:u}=Mo(),d=dj(),f=FD(),p=Aj({explicitResourceType:n,schema:o,fieldName:e,registry:c})||V.resolveResourceTypeForForeignKey(e,o,c),{t:m,tComponent:h,formatDate:g,formatDateTime:_,isReady:v}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,resource:p}),y=cp(),b=(0,Q.useMemo)(()=>d?.contextualParameters&&Object.keys(d.contextualParameters).length>0?d.contextualParameters:f?.contextResourceIdentifiers?V.buildContextualParameters(f.contextResourceIdentifiers,c):{},[d?.contextualParameters,f?.contextResourceIdentifiers,c]),[x,S]=(0,Q.useState)(new Map),C=(0,Q.useRef)(new Map),w=(0,Q.useCallback)((e,t)=>{C.current.set(e,t),S(new Map(C.current))},[]),T=i?.mode??Pre,E=d?.parentReferenceConfig,{hidesWholeReference:D,visibleIds:O}=Q.useMemo(()=>lj({parentReferenceConfig:E,referencedResourceType:p,referencedIds:Rw(t)}),[E,p,t]),k=!!(E&&p&&E.parentResourceType===p&&E.displayMode!==na.NONE),A=(0,Q.useMemo)(()=>{if(!k||!E)return T;switch(E.displayMode){case na.CONTEXT:case na.BREADCRUMB:return T;case na.BADGE:case na.SUMMARY:return E.displayMode;default:return T}},[k,E,T]),j=(0,Q.useMemo)(()=>{if(k){if(E?.showParentLink===!1)return!1;if(E?.displayMode===na.CONTEXT||E?.displayMode===na.BREADCRUMB)return!0}return i?.linkable??!0},[k,E,i?.linkable]),M=d?.navigationZone??f?.navigationZone,N=Q.useMemo(()=>{if(!r||typeof r!=`object`||!p||Array.isArray(t))return null;let e=dTe({record:r,resourceType:p,registry:c});return!e||e!==t||!Object.entries(r).some(([t,n])=>t!==`_id`&&t!==`id`&&n!=null&&n!==e)?null:V.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:r,t:m,formatDate:g,formatDateTime:_})},[r,p,t,c,m,g,_]),P=(0,Q.useMemo)(()=>{let e={},t=d?.contextResourceIdentifiers||f?.contextResourceIdentifiers;if(t)for(let[n,r]of Object.entries(t)){let t=typeof r==`string`?r:r?.resourceId;t&&(e[n]=t)}return e},[d?.contextResourceIdentifiers,f?.contextResourceIdentifiers]),F=(0,Q.useMemo)(()=>{if(!p)return null;let e=c.resourceConfigurations[p];if(!e)return null;let t=d?.contextResourceIdentifiers||f?.contextResourceIdentifiers,n=d?.resourceType||f?.resourceType,r=n&&t?On.buildParentResourcesRequirements(n,t,c):[];return{refResourceConfig:e,ownFieldIdentifier:c.allResourceFieldIdentifiers?.[p],currentParentRequirements:r}},[p,c,d?.contextResourceIdentifiers,d?.resourceType,f?.contextResourceIdentifiers,f?.resourceType]),I=d?.resourceType?{resourceType:d.resourceType,id:d.resourceId}:f?{resourceType:f.resourceType,id:f.resourceId}:void 0,ee=I?.resourceType,L=I?.id,R=(0,Q.useCallback)(e=>zm({hostIdentifiers:P,hostContextualParameters:b,hostParentRequirements:F?.currentParentRequirements,hostRecord:{resourceType:ee,id:L},targetResourceType:p??``,targetId:e,registry:c}),[P,b,F?.currentParentRequirements,ee,L,p,c]),z=(0,Q.useCallback)(e=>{if(!F||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=F,r=R(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=ph({resourceConfig:t,operations:t.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a});if(!o)return null;let s=Vn.buildOperationFrontendRoutePaths(t,o,c.allResourceFieldIdentifiers);if(s.length===0)return null;try{let t=On.selectMatchingRoutePath(s,i,p,n,r.parentRequirements,c.allResourceFieldIdentifiers);if(!t?.url)return null;let a=On.buildParentResourcesRequirementsFromRouteParams(t.parameters??[],p,c),l={};for(let[e,t]of Object.entries(r.contextualParameters))t!=null&&(l[e]=String(t));n&&(l[n]=e);let u=dh.resolveUrlPath(t.url,l);if(u&&!dh.hasUnresolvedPlaceholders(u))return{url:u,parentResourcesRequirements:a,readOp:o}}catch{}return null},[F,c,p,R]),te=(0,Q.useCallback)(e=>{if(!F||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=F,r=R(e),i={...r.identifiers,[p]:e},a=ph({resourceConfig:t,operations:t.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:i,contextualParameters:{...r.contextualParameters,...n?{[n]:e}:{}}});return!a||a.operationFrontendConfig?.surface!==Pu.EMBEDDED?null:{readOp:a}},[F,c,p,R]),ne=(0,Q.useCallback)(e=>{let t=z(e);if(t)return{readOp:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements};if(!F||!p)return null;let{refResourceConfig:n,ownFieldIdentifier:r}=F,i=R(e),a={...i.contextualParameters,...r?{[r]:e}:{}},o=ph({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:{...i.identifiers,[p]:e},contextualParameters:a});if(!o)return null;let s=V.selectOperationUrlInitiatorInfo({initiatorInfos:o.initiatorInfos??[],contextualParameters:a,targetResourceType:p,targetDefaultFieldIdentifier:r??``});return s?{readOp:o,parentResourcesRequirements:On.buildParentResourcesRequirementsFromRouteParams(s.parameters,p,c)}:null},[z,F,p,R,c]),re=(0,Q.useCallback)(async e=>{if(!p||!e)return;let t=C.current.get(e);if(!t||t.label===null&&!t.isLoading){w(e,{id:e,label:null,error:null,isLoading:!0});try{let t=ne(e),{record:n,label:r}=await Bw({resourceType:p,id:e,registry:c,doOperation:l,...t?{readOperation:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements}:{},contextualParameters:R(e).contextualParameters,t:m,formatDate:g,formatDateTime:_});w(e,{id:e,label:r,data:n,error:null,isLoading:!1})}catch(t){w(e,{id:e,label:null,error:y(t),isLoading:!1})}}},[p,c,l,w,m,g,_,R,y,ne]);(0,Q.useEffect)(()=>{p&&O.length!==0&&A!==tt.ID&&(N&&O.length===1&&!C.current.has(O[0])?w(O[0],{id:O[0],label:N,data:r,error:null,isLoading:!1}):O.forEach(e=>{e&&!C.current.has(e)&&re(e)}))},[p,O,A,re,w,N]);let ie=(0,Q.useCallback)((e,t)=>{if(!j||!p)return t;let n=A===tt.SUMMARY,r=z(e),i=!!(M&&r?.readOp&&r?.url),a=t=>{if(!i||!r||t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;let n={...R(e).identifiers,[p]:e},a=On.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:r.readOp,contextResourceIdentifiers:n,parentResourcesRequirements:r.parentResourcesRequirements});t.preventDefault(),u(Ec.NAVIGATION_REQUEST,{content:{contentType:sd.RESOURCE_OPERATION,resourceContext:a},initiator:{sourceZone:M},urlPath:r.url})};if(k&&E?.onNavigateToParent)return r?.url?(0,$.jsx)(Oh,{to:r.url,className:`text-primary hover:underline`,onClick:t=>{t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||E.onNavigateToParent(e)!==!1&&t.preventDefault()},children:t}):(0,$.jsx)(`button`,{type:`button`,className:`block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left`,onClick:()=>{E.onNavigateToParent(e)},children:t});if(r?.url)return(0,$.jsx)(Oh,{to:r.url,className:n?E3:`text-primary hover:underline`,onClick:a,children:t});let o=te(e);return o?(0,$.jsx)(`button`,{type:`button`,className:n?U(E3,`w-full bg-transparent border-none p-0 cursor-pointer text-left`):`block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left`,onClick:t=>{if(t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;t.preventDefault();let n=R(e),r=On.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:o.readOp,contextResourceIdentifiers:{...n.identifiers,[p]:e},parentResourcesRequirements:n.parentRequirements});u(Ec.NAVIGATION_REQUEST,{content:{contentType:sd.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:M??rr.PRIMARY}})},children:t}):t},[u,A,F,j,k,M,E,z,te,p,R]),ae=(0,Q.useCallback)(e=>{if(A===tt.ID)return(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:e});let t=x.get(e);if((t?.isLoading??!1)||!t)return(0,$.jsx)(pm,{className:`h-4 w-24 inline-block`});if(t.error)return a?(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm`,title:t.error,children:a}):(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm italic`,title:`${e} · ${t.error}`,children:h(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`recordUnavailable`)});let n=!!p&&!!V.frontendResourceLabelDefinitionOf(c.resourceConfigurations?.[p]),r=(t.data&&p&&n?V.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:t.data,t:m,formatDate:g,formatDateTime:_}):null)||t.label||a||e;if(A===na.BADGE){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(If,{variant:`secondary`,className:t?`cursor-pointer hover:opacity-[var(--opacity-hover)]`:void 0,onClick:t,children:r})}if(A===na.SUMMARY){if(k){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm ${t?`cursor-pointer hover:text-foreground transition-colors`:``}`,onClick:t,role:t?`button`:void 0,tabIndex:t?0:void 0,onKeyDown:t?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}:void 0,children:r})}if(t.data&&p){let n=c.resourceConfigurations[p],i=V.resolveRowSchema(n,t.data);if(i){let n=(0,$.jsx)(pG,{resourceType:p,schema:i,data:t.data,primaryLabel:r,contextResourceIdentifiers:R(e).identifiers});return j?ie(e,n):n}}return ie(e,(0,$.jsx)(D3,{label:r}))}return tt.LABEL,ie(e,(0,$.jsx)(D3,{label:r}))},[A,x,p,k,E,ie,c,j,m,h,g,_,a]);return D?null:O.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):!p&&A!==tt.ID?(0,$.jsx)(`div`,{className:s,title:`Unknown resource type - showing IDs`,children:O.length===1?(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:O[0]}):(0,$.jsx)(`ul`,{className:`list-disc ps-4 space-y-item-xs`,children:O.map(e=>(0,$.jsx)(`li`,{className:`font-mono text-sm`,children:e},e))})}):O.length===1?(0,$.jsx)(`div`,{className:s,children:ae(O[0])}):(0,$.jsx)(`ul`,{className:U(`list-disc ps-4 space-y-item-xs`,s),children:O.map(e=>(0,$.jsx)(`li`,{children:ae(e)},e))})};function pTe(e,t){let n=w1(e),r={size:Af.LG,closeOnEscape:!0,closeOnOutsideClick:t?.closeOnOutsideClick??!0,modal:t?.modal??!0,showBackdrop:t?.showBackdrop??!0};return n===Or.SHEET?{mode:n,side:$s.END,...r}:{mode:n,...r}}var mTe=()=>{let{state:e}=zx(),{closeOverlay:t}=DS(),n=e.overlay,r=n.length>0?n[n.length-1]:void 0,i=n.length>0,{title:a,description:o}=X$(r),s=(0,Q.useMemo)(()=>pTe(r?.appearance,r?.overlayBehavior),[r?.appearance,r?.overlayBehavior]),c=(0,Q.useCallback)(e=>{e||t()},[t]);return(0,$.jsx)(b1,{open:i,onOpenChange:c,title:a||void 0,description:o,config:s,children:r&&(0,$.jsx)(R0,{content:r.content,zone:rr.OVERLAY,initiator:r.initiator,entryId:r.id})})},O3=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(mTe,{});function hTe({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,`ResourceLayout_ContainerDialogs`)(e);return(0,$.jsx)(n,{...t})}var k3=({resourceContext:e,onFiltersChange:t})=>{let{registry:n}=fm(),{resourceType:r}=e,[i,a]=(0,Q.useState)({}),o=(0,Q.useMemo)(()=>n.resourceConfigurations[r],[n,r]),s=(0,Q.useMemo)(()=>IG.parseFilterFieldDefinitions(e.operation?.filterFields,void 0,o),[e.operation,o]),c=(0,Q.useCallback)(e=>{a(e),t?.(e)},[t]);return s.length===0?(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground p-card`,children:`No filters available for this resource.`}):(0,$.jsx)(YK,{resourceType:r,filterFields:s,currentFilters:i,onFiltersChange:c})};function gTe({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_FILTERS,`ResourceLayout_Filters`)(e);return(0,$.jsx)(n,{...t})}var _Te=e=>(0,$.jsx)(uX,{...e,defaultViewMode:_u.TABLE}),A3=e=>(0,$.jsx)(IY,{...e,showCharts:!1}),j3=(0,Q.memo)(({resourceContext:e,item:t,onNavigate:n,className:r})=>{let{resourceType:i}=e,{registry:a}=fm(),{t:o,formatDate:s,formatDateTime:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_READ_SUMMARY,resource:i}),u=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_READ_SUMMARY}`],[i]),d=a.resourceConfigurations[i],f=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:i,registry:a,currentObject:t,t:o,formatDate:s,formatDateTime:c})||String(i),[t,i,a,o,s,c]),p=(0,Q.useMemo)(()=>V.resolveRowSchema(d,t),[d,t]),m=d?.frontendConfiguration?.layout?.summary;return l?(0,$.jsx)(sb,{i18nKeys:u,children:(0,$.jsx)(`div`,{className:[`flex flex-col gap-element-sm p-card rounded-lg`,n?`cursor-pointer hover:bg-muted/50 motion-safe:transition-colors`:``,r??``].filter(Boolean).join(` `),onClick:n?()=>n(t):void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))}:void 0,children:p&&m?(0,$.jsx)(pG,{resourceType:i,schema:p,data:t,primaryLabel:f,contextResourceIdentifiers:e.contextResourceIdentifiers}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:f}),p&&(0,$.jsx)(pG,{resourceType:i,schema:p,data:t,contextResourceIdentifiers:e.contextResourceIdentifiers})]})})}):null});function vTe({preset:e,...t}){let n=t.resourceContext.operation.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey,r=e??n??ve.DEFAULT,i=G(B.RESOURCES_LAYOUTS_READ_SUMMARY,`ResourceLayout_ReadSummary`)(r);return(0,$.jsx)(i,{...t})}var yTe=({resourceContext:e,item:t,summaryFields:n,fieldLabelsMap:r,onItemClick:i,operationsSlot:a,isSelected:o,className:s})=>{let{resourceType:c}=e,{registry:l}=fm(),{t:u,formatDate:d,formatDateTime:f,tResourceFieldEnumValue:p}=K({resource:c}),{tComponent:m}=K({component:B.LOW_LEVEL_FORM_FIELD}),h=l.resourceConfigurations[c],g=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:c,registry:l,currentObject:t,t:u,formatDate:d,formatDateTime:f})||String(t[n[0]]??`${c}`),[t,c,l,n,u,d,f]),_=(0,Q.useMemo)(()=>{let e=V.resolveRowSchema(h,t);return e?hr.getObjectLikeFieldShape(e,{commonOnly:!1})??null:null},[h,t]),v=(0,Q.useCallback)(()=>{i?.(t)},[i,t]),y=(0,Q.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i?.(t))},[i,t]);return(0,$.jsxs)(`tr`,{"data-slot":`resource-list-item`,className:[`border-b border-border/50 motion-safe:transition-colors`,i?`cursor-pointer hover:bg-muted/50`:``,i?Rg(d_.INSET):``,o?`bg-primary/5`:``,s??``].filter(Boolean).join(` `),onClick:v,onKeyDown:y,tabIndex:i?0:void 0,"aria-label":g,"aria-selected":o,children:[n.map(n=>{let i=t[n];return(0,$.jsx)(SJ,{className:`px-card py-element text-sm align-middle`,truncate:!0,"aria-label":r[n],children:i==null?(0,$.jsx)(Fj,{noValueLabel:m(B.LOW_LEVEL_FORM_FIELD,`noValue`),typography:Lj(_?.[n]?me(_[n]):void 0)}):(0,$.jsx)(kG,{fieldName:n,value:i,fieldSchema:_?.[n],fieldLabel:void 0,resourceType:c,record:t,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,tResourceFieldEnumValue:p})},n)}),a&&(0,$.jsx)(SJ,{className:`px-card py-element text-sm align-middle text-end`,onClick:e=>e.stopPropagation(),children:a})]})},bTe=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(BY,{resourceContext:e,navigationZone:t,navigationInitiator:n}),M3=({children:e=null})=>(0,$.jsx)(pX,{children:`PublicLayoutPreset_StaticContentContainer_Default`});function xTe({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,`PublicLayout_StaticContentContainer`)(e);return(0,$.jsx)(n,{...t})}var STe=Q.lazy(()=>h_(()=>import(`./ChartView-Qqvf_azZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),CTe=Q.lazy(()=>h_(()=>import(`./ChartWidget-BfFSlmcK.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,9,4,5,6,11,12])));function wTe(){Fo.register(B.HIGH_LEVEL_VIEWS_CHART_ECHARTS,q.DEFAULT,STe,{isConfigurable:!1}),Fo.register(B.HIGH_LEVEL_VIEWS_CHART_WIDGET,q.DEFAULT,CTe,{isConfigurable:!1}),Fo.register(B.APP_LAYOUTS_ERROR_BOUNDARY,q.DEFAULT,Gy,{isConfigurable:!0}),Fo.register(B.APP_LAYOUTS_HOME,q.DEFAULT,KU,{isConfigurable:!0}),Fo.register(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,q.DEFAULT,Yy,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,q.DEFAULT,M3,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_USER_AUTH,q.DEFAULT,fZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,q.DEFAULT,hZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_USER_INVITATION,q.DEFAULT,SZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,q.DEFAULT,NZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_USER_REGISTER,q.DEFAULT,ZZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,q.DEFAULT,wZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,q.DEFAULT,kZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,q.DEFAULT,yX,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,q.DEFAULT,CX,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,q.DEFAULT,nZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,q.DEFAULT,sZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,q.DEFAULT,$X,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,q.DEFAULT,FZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,q.DEFAULT,HZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,q.DEFAULT,GZ,{isConfigurable:!0}),Fo.register(B.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK,q.DEFAULT,BZ,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_BREADCRUMB,q.DEFAULT,AB,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,q.DEFAULT,O3,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_CONTAINER_NESTED,q.DEFAULT,vY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_CREATE,q.DEFAULT,oG,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_ACTION,q.DEFAULT,JW,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_FILTERS,q.DEFAULT,k3,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_HEADER,q.DEFAULT,aV,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_LIST,Wu.DEFAULT,uX,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_LIST,Wu.TABLE,_Te,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,q.DEFAULT,IJ,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,q.DEFAULT,bY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_RECORD_SHARING,q.DEFAULT,MY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_DANGER_ZONE,q.DEFAULT,TY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_PAGINATION,q.DEFAULT,ZG,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_READ,xi.DEFAULT,IY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_READ,xi.EXPANDABLE,A3,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_READ_SUMMARY,ve.DEFAULT,j3,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_READ_SUMMARY,ve.TABLE_ROW,yTe,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_SEARCH,Au.DEFAULT,BY,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_SEARCH,Au.TABLE,bTe,{isConfigurable:!0}),Fo.register(B.RESOURCES_LAYOUTS_UPDATE,q.DEFAULT,HY,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,q.DEFAULT,uL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,q.DEFAULT,DI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_DATE,q.DEFAULT,eN,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_DATETIME,q.DEFAULT,rN,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_ENUM,q.DEFAULT,nI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_FILE,q.DEFAULT,VL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_MONEY,q.DEFAULT,qI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_DURATION,q.DEFAULT,YI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_PHONE,q.DEFAULT,nL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_ADDRESS,q.DEFAULT,sL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_NUMBER,q.DEFAULT,WI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,q.DEFAULT,pL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_DATE,q.DEFAULT,dN,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,q.DEFAULT,mN,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,q.DEFAULT,hL,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,q.DEFAULT,cN,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_RANGE_TIME,q.DEFAULT,_N,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_STRING,q.DEFAULT,HI,{isConfigurable:!0}),Fo.register(B.LOW_LEVEL_FORM_FIELD_TIME,q.DEFAULT,oN,{isConfigurable:!0}),Fo.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,T3,{isConfigurable:!0,category:Ii.EDIT}),Fo.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,xo.SEARCH,uTe,{isConfigurable:!0,category:Ii.EDIT}),Fo.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,fTe,{isConfigurable:!0,category:Ii.DISPLAY})}var TTe=as.getLogger(),N3=new Set([B.LOW_LEVEL_CONTENT_SECTION_CONTAINER,B.LOW_LEVEL_OVERLAY_CONTAINER,B.LOW_LEVEL_AI_FLOW_NODE,B.LOW_LEVEL_AI_FLOW_EXECUTION,B.LOW_LEVEL_AI_SYSTEM_CATALOG,B.LOW_LEVEL_AI_ACTOR,B.LOW_LEVEL_AI_EXECUTION_PLAN,B.LOW_LEVEL_AI_TASK_DETAIL,B.LOW_LEVEL_AI_TASK_MEMORY,B.LOW_LEVEL_AI_EXECUTION_USAGE,B.LOW_LEVEL_AI_GRAPH_VIEWER,B.LOW_LEVEL_AI_APPROVAL,B.LOW_LEVEL_AI_DECISION,B.LOW_LEVEL_AI_EXECUTION_STREAM,B.LOW_LEVEL_AI_ARTIFACT_BROWSER,B.LOW_LEVEL_AI_AGENT_CONFIG,B.GUIDANCE_CHECKLIST,B.GUIDANCE_CHECKLIST_ITEM,B.GUIDANCE_TOUR,B.GUIDANCE_TOOLTIP,B.GUIDANCE_MODAL,B.GUIDANCE_BANNER,B.GUIDANCE_ANNOUNCEMENT,B.GUIDANCE_BADGE,B.GUIDANCE_CARD,B.GUIDANCE_SURVEY,B.GUIDANCE_ONBOARDING_VIEW,B.PROGRESSION_MILESTONE_TRACKER,B.PROGRESSION_ACHIEVEMENT_BADGE,B.LIFECYCLE_HOME_ACTIVATION_PROGRESS,B.LIFECYCLE_HOME_WELCOME_BACK,B.LIFECYCLE_HOME_DASHBOARD,B.HIGH_LEVEL_VIEWS_COMPOSITE,B.HIGH_LEVEL_VIEWS_CHART,B.HIGH_LEVEL_VIEWS_FULL_CUSTOM,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,B.HIGH_LEVEL_VIEWS_EXECUTION,B.HIGH_LEVEL_VIEWS_NOT_FOUND,B.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,B.APP_LAYOUTS_TEST_COMPONENT,B.APP_LAYOUTS_SECURITY_SETTINGS,B.APP_LAYOUTS_SETTINGS_HUB,B.APP_LAYOUTS_APPEARANCE_SETTINGS,B.APP_LAYOUTS_INVITATIONS_SETTINGS,B.APP_LAYOUTS_BILLING_SETTINGS,B.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,B.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,B.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,B.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,B.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,B.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,B.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,B.LOW_LEVEL_FORM_FIELD_FOREIGN_KEY,B.LOW_LEVEL_DISPLAY_FIELD_FOREIGN_KEY]);function P3(){let e=Object.values(B),t=[],n=0;for(let r of e)N3.has(r)||(Fo.hasComponentType(r)?n+=1:t.push(r));return{totalEnumValues:e.length,registeredCount:n,denyListedCount:N3.size,missing:t}}function ETe(e){let t=P3();if(t.missing.length===0)return t;let n=`[ComponentRegistry] Tier-1 completeness check failed: ${t.missing.length} FrontendComponentType value(s) have no registered preset.\n\nMissing entries:\n${t.missing.map(e=>` - ${e}`).join(`
43
- `)}\n\nFor each missing entry you must EITHER:\n (1) register a default preset in registerDefaultPresets() / registerFrameworkLayouts(); OR\n (2) add the enum value to KNOWN_NON_REGISTERED_COMPONENT_TYPES in assert-registry-completeness.frontend.helper.ts with a one-line justification (Tier-1 slots resolve through the registry; Tier-2, framework-internal and i18n-bundle-only slots are rendered directly and are the only ones that belong in that list).`,r=typeof process<`u`&&!1;if(e?.strict||r)throw Error(n);return TTe.warn(`component-registry.completeness-check.failed`,{message:n,missing:t.missing}),t}function DTe(e){return ql(e)}var F3;(function(e){e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`})(F3||={});var OTe=/^#([0-9a-f]{6})$/i,kTe=/^#([0-9a-f]{3})$/i,ATe=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/i,jTe=/^hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*(?:,\s*[\d.]+\s*)?\)$/i;function I3(e,t,n){return Math.min(n,Math.max(t,e))}function L3(e){let t=e.trim();if(t.length===0)return null;let n=OTe.exec(t);if(n){let e=n[1];return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}}let r=kTe.exec(t);if(r){let[e,t,n]=r[1].split(``);return{r:parseInt(`${e}${e}`,16),g:parseInt(`${t}${t}`,16),b:parseInt(`${n}${n}`,16)}}let i=ATe.exec(t);if(i){let e=[i[1],i[2],i[3]].map(e=>parseInt(e,10));return e.some(e=>e>255)?null:{r:e[0],g:e[1],b:e[2]}}let a=jTe.exec(t);if(a){let e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);return e>360||t>100||n>100?null:H3(e,t,n)}return null}function R3(e){let t=z3(e);return t===null?null:L3(t)}function z3(e){let t=e.trim();if(t.length===0)return null;let n=document.createElement(`span`);if(n.style.color=``,n.style.color=t,n.style.color===``)return null;let r=document.createElement(`span`);r.style.display=`none`,r.appendChild(n),document.body.appendChild(r);try{r.style.color=`rgb(1, 2, 3)`;let e=window.getComputedStyle(n).color;return r.style.color=`rgb(4, 5, 6)`,e===window.getComputedStyle(n).color&&e||null}finally{document.body.removeChild(r)}}function B3({r:e,g:t,b:n}){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=o-Math.min(r,i,a),c=0;return s!==0&&(c=o===r?((i-a)/s+(i<a?6:0))*60:o===i?((a-r)/s+2)*60:((r-i)/s+4)*60),{h:c,s:o===0?0:s/o*100,v:o*100}}function V3({h:e,s:t,v:n}){let r=(e%360+360)%360,i=I3(t,0,100)/100,a=I3(n,0,100)/100,o=a*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function H3(e,t,n){let r=(e%360+360)%360,i=I3(t,0,100)/100,a=I3(n,0,100)/100,o=(1-Math.abs(2*a-1))*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o/2,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function U3({r:e,g:t,b:n}){let r=e=>I3(Math.round(e),0,255).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function W3(e,t){if(t===F3.RGB)return`rgb(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)})`;if(t===F3.HSL){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a,s=(i+a)/2,c=0,l=0;return o!==0&&(l=s>.5?o/(2-i-a):o/(i+a),c=i===t?((n-r)/o+(n<r?6:0))*60:i===n?((r-t)/o+2)*60:((t-n)/o+4)*60),`hsl(${Math.round(c)}, ${Math.round(l*100)}%, ${Math.round(s*100)}%)`}return U3(e)}function MTe(e,t){return W3(V3(e),t)}function G3({r:e,g:t,b:n}){let r=e=>{let t=I3(e,0,255)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}var NTe=()=>{let e=(0,Q.useContext)(xH);if(!e)throw Error(`useStepUpAuth must be used within a StepUpAuthProvider`);return e},K3=class extends Error{code;httpStatus;constructor(e,t,n){super(t),this.name=`CrossFrontendHandoffClientError`,this.code=e,this.httpStatus=n}};async function q3(e,t){let n;try{n=await bc().crossFrontendHandoff(e,t)}catch(e){throw FTe(e)}if(!n||typeof n.handoffUrl!=`string`||typeof n.expiresAt!=`string`)throw new K3(`malformed_response`,`Cross-frontend handoff response missing required fields`,null);return{handoffUrl:n.handoffUrl,expiresAt:n.expiresAt}}var PTe=new Set(Object.values(kae));function FTe(e){if(e instanceof K3)return e;let t=e,n=typeof t?.response?.status==`number`?t.response.status:typeof t?.httpStatus==`number`?t.httpStatus:null;if(n===null)return new K3(`network`,t?.message??`Cross-frontend handoff request failed (no response)`,null);if(n===401)return new K3(`unauthenticated`,`Cross-frontend handoff requires an authenticated session`,401);let r=t?.response?.data?.error?.details?.code??t?.context?.code;return typeof r==`string`&&PTe.has(r)?new K3(r,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n):new K3(`malformed_response`,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n)}function ITe(){let[e,t]=(0,Q.useState)(`idle`),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>(o.current=!1,()=>{o.current=!0}),[]),{status:e,data:n,error:i,requestHandoff:(0,Q.useCallback)(async(e,n)=>{let i=++s.current;t(`pending`),a(null);try{let a=await q3(e,n);return!o.current&&i===s.current&&(r(a),t(`success`)),a}catch(e){let n=e instanceof K3?e:new K3(`malformed_response`,e instanceof Error?e.message:`Cross-frontend handoff failed`,null);throw!o.current&&i===s.current&&(a(n),t(`error`)),n}},[]),reset:(0,Q.useCallback)(()=>{s.current++,t(`idle`),r(null),a(null)},[])}}function J3(e,t,n){if(e.visibleInModes&&e.visibleInModes.length>0&&(!t||!e.visibleInModes.includes(t)))return!1;if(e.scopeCondition)try{return e.scopeCondition(n)}catch{return!1}return!0}function Y3(e,t,n,r=!1){let i=e.filter(e=>J3(e,t,n));return r&&i.length===0&&e.length>0&&(e.some(e=>e.contentKind===ze.GUIDANCE_WIDGET&&(!e.visibleInModes||e.visibleInModes.length===0))||console.warn(`[AppMode] All sidebar sections are hidden and no unconditionally-visible GUIDANCE_WIDGET section covers the empty state. Consider adding a GUIDANCE_WIDGET section without visibleInModes restrictions and a scopeCondition that activates when other sections are hidden.`)),i}function X3(e,t,n){return{appScopeValues:e,activeMode:t,availableModes:n}}function Z3(e,t,n){let r=e.map(e=>{let r=!!(e.visibleInModes&&e.visibleInModes.length>0),i=`N/A`;r&&(i=!!t&&e.visibleInModes.includes(t));let a=!!e.scopeCondition,o=`N/A`;if(a)try{o=e.scopeCondition(n)}catch{o=!1}let s=J3(e,t,n);return{ref:e.ref,contentKind:e.contentKind,modeFilter:r?e.visibleInModes.join(`, `):`(all)`,modeMatch:i,hasScopeCondition:a,scopeMatch:o,visible:s}});console.group(`[SidebarVisibility] activeMode="${t??`none`}" | ${r.filter(e=>e.visible).length}/${r.length} sections visible`),console.table(r),console.log(`Scope params:`,n),console.groupEnd()}function LTe(e){return E0(e)}function RTe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FEATURE_UNAVAILABLE_DIALOG,`FeatureUnavailableDialog`)(e);return(0,$.jsx)(n,{...t})}function zTe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FEATURE_LOCK_BADGE,`FeatureLockBadge`)(e);return(0,$.jsx)(n,{...t})}function Q3({featureId:e,showLabel:t=!0,size:n=`sm`,preset:r=q.DEFAULT}){let{getLimit:i,getCurrentUsage:a}=Ch(),{t:o}=K(),s=i(e),c=a(e)??0;if(s===void 0||s===-1)return null;let l=Pc(_ne.LIMIT,e),u=o(l),d=u===l?e:u,f=G(B.LOW_LEVEL_FEATURE_LIMIT_INDICATOR,`FeatureLimitIndicator`)(r);return(0,$.jsx)(f,{usage:c,limit:s,label:d,showLabel:t,size:n})}var $3=ic.BILLING,e6={kind:hu.SETTINGS_SECTION,sectionRef:$3,category:Fn.BILLING,searchKeywords:[`billing`,`subscription`,`plan`,`payment`,`invoice`,`upgrade`],runtimeAvailability:{requiredCapabilities:[`billingEnabled`]}};function t6(e){let t=ym(),n=dS(),r=(0,Q.useContext)(ah)?.user?._id,i=e!==void 0&&e===r;return(0,Q.useMemo)(()=>t?cne(t.getAvailableResourceTypes().flatMap(e=>{let n=t.getResourceConfiguration(e);return n?[{resourceIdentifier:e,operations:n.operations??[]}]:[]}),i?{initiatorMayPerform:e=>Um({resourceType:e.resourceIdentifier,roles:e.roles,operationIdentifier:e.operationIdentifier,resourceOperationLike:e.resourceOperationLike},n)}:{}):[],[t,n,i])}function n6(e){for(let t of e)for(let e of t)if(e.userNotifications?.some(e=>e.channel===lu.SMS))return!0;return!1}function r6(e){let t=ym(),n=(0,Q.useContext)(ah)?.user?._id,r=e!==void 0&&e===n,i=(0,Q.useMemo)(()=>t?n6(t.getAvailableResourceTypes().map(e=>t.getResourceConfiguration(e)?.operations??[])):!1,[t]),[a,o]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!i||!r){o(!1);return}let e=!1;return bc().getMyMethods().then(t=>{e||o((t.methods??[]).some(e=>e.method===_s.SMS_OTP&&e.enrolled))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[i,r]),i&&r&&a}var BTe=e=>{let{resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a,autoSubscribe:o=!0,onUpdated:s,onDeleted:c,onEditingStart:l,onEditingEnd:u,onCustomEvent:d}=e,f=up(),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)([]),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(`useResourceRoom:${Math.random().toString(36).slice(2)}`),S=(0,Q.useRef)(async()=>void 0);b.current=p;let C=n?`${t}:${n}`:`${t}:${r}:${i}`,w=(0,Q.useCallback)(async()=>{if(p)return!0;let e=await f.claimResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a});return m(e.success),e.success&&e.editingUsers&&v(e.editingUsers),e.success},[f,t,n,r,i,a,p]),T=(0,Q.useCallback)(async()=>{p&&(await f.releaseResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a}),m(!1),v([]))},[f,t,n,r,i,a,p]);S.current=T;let E=(0,Q.useCallback)(async()=>{if(!n)return console.warn(`Cannot start editing without resourceId`),!1;let e=await f.startEditing({resourceType:t,resourceId:n,contextResourceIdentifiers:a});return e&&(g(!0),y.current=!0),e},[f,t,n,a]),D=(0,Q.useCallback)(()=>{n&&h&&(f.stopEditing({resourceType:t,resourceId:n}),g(!1),y.current=!1)},[f,t,n,h]),O=(0,Q.useCallback)((e,r,i)=>{n?f.sendCustomEvent({resourceType:t,resourceId:n,eventName:e,data:r,contextResourceIdentifiers:a,includeSelf:i}):console.warn(`Cannot send custom event without resourceId`)},[f,t,n,a]);return(0,Q.useEffect)(()=>{if(!f.isConnected||!p)return;let e=f.on(fa.RESOURCE_UPDATED,e=>{if(e.resourceType===t){if(n){if(e.resourceId!==n||e.deliveryTarget!==Ja.RESOURCE_ROOM_SYNC&&e.deliveryTarget!==Ja.RESOURCE_ROOM_NOTIFICATION)return}else if(e.deliveryTarget!==Ja.SCOPE_ROOM_NOTIFICATION)return;s?.(e)}}),r=f.on(fa.RESOURCE_DELETED,e=>{e.resourceType===t&&n&&e.resourceId===n&&c?.(e)}),i=f.on(fa.RESOURCE_EDITING_START,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.includes(e.initiatorUserId)?t:[...t,e.initiatorUserId]),l?.(e))}),a=f.on(fa.RESOURCE_EDITING_END,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.filter(t=>t!==e.initiatorUserId)),u?.(e))}),o=f.on(fa.RESOURCE_CUSTOM,e=>{e.resourceType===t&&n&&e.resourceId===n&&d?.(e)});return()=>{e(),r(),i(),a(),o()}},[f,p,t,n,s,c,l,u,d]),(0,Q.useEffect)(()=>{o&&f.isConnected&&!p&&w()},[o,f.isConnected,p,w]),(0,Q.useEffect)(()=>()=>{y.current&&n&&f.stopEditing({resourceType:t,resourceId:n})},[f,t,n]),(0,Q.useEffect)(()=>()=>{b.current&&S.current()},[C]),{isSubscribed:p,isEditing:h,editingUsers:_,subscribe:w,unsubscribe:T,startEditing:E,stopEditing:D,sendCustomEvent:O}},i6=`this-session`;function a6(e,t){let{emit:n}=Mo(),{registry:r}=fm(),i=(0,Q.useRef)(!1),a=r.notificationBadgeDefinitions.find(t=>qu(t)===e),o=a?.source.kind===xu.FRONTEND_PRODUCED;(0,Q.useEffect)(()=>{if(!o){!i.current&&xa.isDevelopment()&&(i.current=!0,console.warn(a?`[usePublishNotificationBadgeCount] "${e}" is a ${a.source.kind} badge; its count is the backend's, so this page does not publish one.`:`[usePublishNotificationBadgeCount] "${e}" names no registered notification badge definition; nothing would draw it.`));return}if(t===null)return;let r=Ce(e);r&&r$(n,{badgeReference:Eo(r.scope,i6,r.identifier),badgeCount:Math.max(0,Math.trunc(t))})},[e,t,o,a,n])}function VTe({milestoneRef:e,className:t}){let n=yU(),{tComponent:r,isReady:i}=K({component:B.PROGRESSION_ACHIEVEMENT_BADGE}),{renderIcon:a}=Mf(),o=(0,Q.useMemo)(()=>(e,t)=>r(B.PROGRESSION_ACHIEVEMENT_BADGE,e,t),[r]),s=n.isMilestoneAchieved(e);if(!i)return null;let c=n.milestoneDefinitions.find(t=>t.identifier===e);if(!c)return null;let l=o(s?`achieved`:`locked`),u=s?a(H.CHECK,{size:ca.XS,className:`text-success`}):a(H.LOCK,{size:ca.XS});return(0,$.jsxs)(If,{variant:s?`default`:`outline`,className:U(`gap-1`,!s&&`opacity-60`,t),title:o(`description`),children:[u,(0,$.jsx)(`span`,{children:l}),s&&(c.points??0)>0&&(0,$.jsxs)(`span`,{className:`text-xs opacity-70`,children:[`+`,c.points]})]})}var o6=B.LOW_LEVEL_AI_ACTOR;function s6(e){return`role_${e}`}function c6(e){return`mode_${e}`}function l6(e){return`modeDesc_${e}`}var HTe={[Zi.COORDINATOR]:H.USERS,[Zi.TASK_PLANNER]:H.BOOK,[Zi.OPERATOR]:H.WRENCH,[Zi.ANALYZER]:H.SEARCH,[Zi.REVIEWER]:H.CHECK_CIRCLE,[Zi.HUMAN_IN_THE_LOOP]:H.LOCK,[Zi.FLOW_EXECUTION]:H.ARROW_RIGHT},UTe={[rn.AGENTIC]:H.BRAIN,[rn.FLOW_EXECUTION]:H.ARROW_RIGHT,[rn.HUMAN_INTERACTION]:H.USERS,[rn.PROGRAMMATIC]:H.SETTINGS},WTe={[Zi.COORDINATOR]:`default`,[Zi.TASK_PLANNER]:`default`,[Zi.OPERATOR]:`secondary`,[Zi.ANALYZER]:`secondary`,[Zi.REVIEWER]:`outline`,[Zi.HUMAN_IN_THE_LOOP]:`destructive`,[Zi.FLOW_EXECUTION]:`outline`},u6=e=>Object.values(Zi).includes(e),GTe=e=>Object.values(rn).includes(e),d6;(function(e){e.IDLE=`idle`,e.EXECUTING=`executing`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`})(d6||={});var KTe={[d6.IDLE]:xl.NEUTRAL,[d6.EXECUTING]:xl.INFO,[d6.AWAITING_APPROVAL]:xl.WARNING,[d6.COMPLETED]:xl.SUCCESS};function qTe(e){return U(qf[KTe[e]],e===d6.EXECUTING&&`motion-safe:animate-pulse`)}function f6(e){return`status_${e}`}var JTe=({systemName:e,actors:t,systemRef:n,executions:r,className:i,children:a,...o})=>{let{tComponent:s,isReady:c}=K({component:o6}),l=SW(),u=t,d=r??l?.executions,f=n&&l?.isLoading&&!u,p=Q.useMemo(()=>{if(!u)return new Map;let e=new Map;for(let t of u)e.set(t.roleCategory,(e.get(t.roleCategory)??0)+1);return e},[u]);return c?f?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,i),"aria-label":s(o6,`loading`),...o,children:[(0,$.jsx)(pm,{className:`h-6 w-48`}),(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:[(0,$.jsx)(pm,{className:`h-40`}),(0,$.jsx)(pm,{className:`h-40`}),(0,$.jsx)(pm,{className:`h-40`})]})]}):u&&u.length===0?(0,$.jsx)(`div`,{className:U(`flex flex-col items-center gap-element py-section text-center text-muted-foreground`,i),...o,children:(0,$.jsx)(`p`,{className:`text-sm`,children:s(o6,`noActors`)})}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,i),...o,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-element`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[e&&(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:s(o6,`teamTitle`,{name:e})}),u&&(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,children:s(o6,`teamSummary`,{count:String(u.length)})})]})}),u&&u.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Array.from(p.entries()).map(([e,t])=>(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:s(o6,`roleCount`,{role:u6(e)?s(o6,s6(e)):e,count:String(t)})},e))}),(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:u?u.map(e=>(0,$.jsx)(p6,{actor:e,status:YTe(e,Mte(u)?.ref,n,d)},e.ref)):a})]}):null};function YTe(e,t,n,r){if(!r||!n||e.ref!==t)return d6.IDLE;let i=!1;for(let e of r.values())if(e.systemRef===n){if(e.status===hW.RUNNING||e.status===hW.STARTING)return d6.EXECUTING;if(e.status===hW.AWAITING_APPROVAL)return d6.AWAITING_APPROVAL;e.status===hW.COMPLETED&&(i=!0)}return i?d6.COMPLETED:d6.IDLE}var p6=({actor:e,actorRef:t,displayName:n,roleCategory:r,executionMode:i,description:a,agentRef:o,flowRef:s,status:c=d6.IDLE,currentTask:l,onAgentClick:u,onFlowClick:d,className:f,...p})=>{let{tComponent:m,isReady:h}=K({component:o6}),{renderIcon:g}=Mf();if(!h)return null;let _=e?.ref??t??``,v=e?.displayName??n??_,y=e?.roleCategory??r??``,b=e?.executionMode??i??``,x=a,S=e?.agentRef??o,C=e?.flowRef??s,w=m(o6,f6(c));return(0,$.jsxs)(EF,{className:U(`flex flex-col`,f),...p,children:[(0,$.jsxs)(OF,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(m6,{role:y}),(0,$.jsx)(h6,{mode:b})]}),(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(`span`,{role:`img`,"aria-label":w,className:U(`inline-block size-2.5 shrink-0 rounded-full`,qTe(c))})}),(0,$.jsx)(rj,{side:$s.TOP,className:`text-xs`,children:w})]})]}),(0,$.jsx)(AF,{className:`text-sm`,children:v}),(0,$.jsx)(MF,{className:`text-xs`,children:_})]}),(0,$.jsxs)(NF,{className:`flex flex-col gap-element`,children:[x&&(0,$.jsx)(Z,{size:Le.XS,variant:zr.MUTED,"aria-label":m(o6,`description`),children:x}),l&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 rounded-sm bg-primary/10 px-2 py-1`,"aria-label":m(o6,`currentTask`),children:[g(H.LOADER_2,{size:ca.SM,className:`animate-spin text-primary`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-medium text-primary`,children:l})]}),(S||C)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[S&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>u?.(S),"aria-label":`${m(o6,`linkedAgent`)}: ${S}`,children:[g(H.BRAIN,{size:ca.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(o6,`linkedAgent`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:S})]}),C&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d?.(C),"aria-label":`${m(o6,`linkedFlow`)}: ${C}`,children:[g(H.ARROW_RIGHT,{size:ca.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(o6,`linkedFlow`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:C})]})]})]})]})},m6=({role:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:o6}),{renderIcon:i}=Mf();if(!r)return null;let a=u6(e),o=a?HTe[e]:void 0,s=a?n(o6,s6(e)):e;return(0,$.jsxs)(If,{variant:a?WTe[e]:`secondary`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:ca.XS}),s]})},h6=({mode:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:o6}),{renderIcon:i}=Mf();if(!r)return null;let a=GTe(e),o=a?UTe[e]:void 0,s=a?n(o6,c6(e)):e,c=a?n(o6,l6(e)):void 0,l=(0,$.jsxs)(If,{variant:`outline`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:ca.XS}),s]});return c?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:l}),(0,$.jsx)(rj,{side:$s.TOP,className:`text-xs`,children:c})]}):l},XTe=Q.lazy(()=>h_(()=>import(`./flows-actors-graph-runtime-DI3n8jVc.js`).then(e=>({default:e.AI_FlowExecutionCanvas})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),ZTe=Q.lazy(()=>h_(()=>import(`./flows-actors-graph-runtime-DI3n8jVc.js`).then(e=>({default:e.AI_FlowExecutionSummary})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),QTe=Q.lazy(()=>h_(()=>import(`./flows-actors-graph-runtime-DI3n8jVc.js`).then(e=>({default:e.AI_FlowExecutionTimeline})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),$Te=Q.lazy(()=>h_(()=>import(`./flows-actors-graph-runtime-DI3n8jVc.js`).then(e=>({default:e.AI_FlowExecutionTimelineItem})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),eEe=Q.lazy(()=>h_(()=>import(`./flows-actors-graph-runtime-DI3n8jVc.js`).then(e=>({default:e.AI_GraphViewer})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),g6=e=>(0,$.jsx)(zJ,{doorName:`AI_GraphViewer`,fallback:(0,$.jsx)(BJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(eEe,{...e})})}),tEe=e=>(0,$.jsx)(zJ,{doorName:`AI_FlowExecutionCanvas`,fallback:(0,$.jsx)(BJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(XTe,{...e})})}),nEe=e=>(0,$.jsx)(zJ,{doorName:`AI_FlowExecutionSummary`,fallback:(0,$.jsx)(BJ,{className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(ZTe,{...e})})}),_6=e=>(0,$.jsx)(zJ,{doorName:`AI_FlowExecutionTimeline`,fallback:(0,$.jsx)(BJ,{className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(QTe,{...e})})}),rEe=e=>(0,$.jsx)(zJ,{doorName:`AI_FlowExecutionTimelineItem`,fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(BJ,{className:`h-8 w-full`})}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(pm,{className:`h-8 w-full`})}),children:(0,$.jsx)($Te,{...e})})}),v6=B.LOW_LEVEL_AI_SYSTEM_CATALOG,iEe=[`all`,`draft`,`active`,`inactive`,`deprecated`,`archived`];function aEe(e,t){let n=t.toLowerCase();return e.displayName.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)||(e.category?.toLowerCase().includes(n)??!1)||(e.tags?.some(e=>e.toLowerCase().includes(n))??!1)}var oEe=({className:e,defaultKindFilter:t=`all`,defaultStatusFilter:n=`all`,defaultViewMode:r=`grid`,onSelectSystem:i,onLaunch:a,...o})=>{let{tComponent:s,isReady:c}=K({component:v6}),{systems:l,isLoading:u,error:d,refreshSystems:f}=xW(),[p,m]=Q.useState(``),[h,g]=Q.useState(t),[_,v]=Q.useState(n),[y,b]=Q.useState(r),[x,S]=Q.useState(null),C=Q.useMemo(()=>l.filter(e=>!(h!==`all`&&e.kind!==h||_!==`all`&&e.status!==_||p&&!aEe(e,p))),[l,h,_,p]),w=Q.useMemo(()=>x?l.find(e=>e.ref===x):void 0,[l,x]),T=Q.useCallback(e=>{S(e),i?.(e)},[i]),E=Q.useCallback(()=>{S(null)},[]);return w?(0,$.jsx)(x6,{system:w,onBack:E,onLaunch:a,className:e,...o}):c?d?(0,$.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center gap-card rounded-lg border bg-card p-section text-center`,e),...o,children:[(0,$.jsx)(Z,{variant:zr.DESTRUCTIVE,children:s(v6,`errorState`)}),(0,$.jsx)(X,{type:`button`,variant:J.SECONDARY,size:Y.SM,onClick:()=>void f(),children:s(v6,`retry`)})]}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,e),...o,children:[(0,$.jsx)(sEe,{searchQuery:p,onSearchChange:m,kindFilter:h,onKindFilterChange:g,statusFilter:_,onStatusFilterChange:v,viewMode:y,onViewModeChange:b,systemCount:C.length,totalCount:l.length}),u?(0,$.jsx)(cEe,{viewMode:y}):C.length===0?(0,$.jsx)(`div`,{className:`flex flex-col items-center justify-center gap-element rounded-lg border bg-card p-section text-center`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:l.length===0?s(v6,`emptyState`):s(v6,`emptyFilteredState`)})}):y===`grid`?(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,$.jsx)(y6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))}):(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:C.map(e=>(0,$.jsx)(b6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))})]}):null},sEe=({searchQuery:e,onSearchChange:t,kindFilter:n,onKindFilterChange:r,statusFilter:i,onStatusFilterChange:a,viewMode:o,onViewModeChange:s,systemCount:c,totalCount:l})=>{let{tComponent:u,isReady:d}=K({component:v6});return d?(0,$.jsxs)(`div`,{className:`flex flex-col gap-element sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-element`,children:[(0,$.jsx)(QM,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:u(v6,`searchPlaceholder`),className:`min-w-[180px] max-w-xs flex-1`}),(0,$.jsx)(cO,{value:n,onValueChange:e=>r(e),children:(0,$.jsxs)(lO,{children:[(0,$.jsx)(uO,{value:`all`,children:u(v6,`allKinds`)}),(0,$.jsx)(uO,{value:`flow`,children:u(v6,`kindFlow`)}),(0,$.jsx)(uO,{value:`actor`,children:u(v6,`kindActor`)})]})}),(0,$.jsx)(mF,{name:`statusFilter`,schema:bd(),options:iEe.map(e=>({value:e,label:u(v6,`status_${e}`)})),value:i,onChange:e=>a(e),placeholder:u(v6,`filterByStatus`),size:Zd.SM})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,children:u(v6,`systemCount`,{count:c,total:l})}),(0,$.jsx)(cO,{value:o,onValueChange:e=>s(e),children:(0,$.jsxs)(lO,{children:[(0,$.jsx)(uO,{value:`grid`,children:u(v6,`gridView`)}),(0,$.jsx)(uO,{value:`list`,children:u(v6,`listView`)})]})})]})]}):null},cEe=({viewMode:e})=>e===`list`?(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:Array.from({length:4},(e,t)=>(0,$.jsx)(pm,{className:`h-20 w-full rounded-lg`},t))}):(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,$.jsx)(pm,{className:`h-52 w-full rounded-lg`},t))}),y6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:v6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(EF,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer flex-col transition-shadow hover:shadow-[var(--shadow-md)]`,Rg(d_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(OF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status}),s.riskLevel!==`low`&&(0,$.jsx)(T6,{level:s.riskLevel})]}),(0,$.jsx)(AF,{className:`text-sm`,children:e.displayName}),(0,$.jsx)(MF,{className:`line-clamp-2 text-xs`,children:e.description})]}),(0,$.jsxs)(NF,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-element`,children:(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:i(v6,`scope_${s.primaryScope}`)})}),(e.category||e.tags&&e.tags.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-element`,children:[e.category&&(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:e.category}),e.tags?.map(e=>(0,$.jsx)(If,{variant:`secondary`,className:`text-2xs`,children:e},e))]})]}),t&&(0,$.jsx)(kF,{className:`mt-auto`,children:(0,$.jsx)(X,{type:`button`,variant:o?J.DEFAULT:J.SECONDARY,disabled:!o,onClick:n=>{n.stopPropagation(),t(e.ref)},className:`w-full`,children:i(v6,`launch`)})})]}):null},b6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:v6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer items-center gap-card rounded-lg border bg-card p-card-sm transition-shadow hover:shadow-[var(--shadow-md)]`,Rg(d_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-card overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status})]}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.displayName}),(0,$.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]}),(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-element md:flex`,children:s.riskLevel!==`low`&&(0,$.jsx)(T6,{level:s.riskLevel})})]}),t&&(0,$.jsx)(X,{type:`button`,variant:o?J.DEFAULT:J.SECONDARY,disabled:!o,size:Y.SM,onClick:n=>{n.stopPropagation(),t(e.ref)},children:i(v6,`launch`)})]}):null},x6=({system:e,onBack:t,onLaunch:n,className:r,...i})=>{let{tComponent:a,isReady:o}=K({component:v6}),s=SW(),c=e.frontendRelevantConfig,l=e.status===`active`,u=Q.useMemo(()=>{if(!s?.executions)return[];let t=[];return s.executions.forEach(n=>{n.systemRef===e.ref&&t.push(n)}),t},[s?.executions,e.ref]);return o?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,r),...i,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[t&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:t,className:`self-start`,children:a(v6,`backToCatalog`)}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.displayName}),(0,$.jsx)(Z,{variant:zr.MUTED,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status}),c.riskLevel!==`low`&&(0,$.jsx)(T6,{level:c.riskLevel})]})]}),n&&(0,$.jsx)(X,{type:`button`,variant:l?J.DEFAULT:J.SECONDARY,disabled:!l,onClick:()=>n(e.ref),children:a(v6,`launch`)})]}),(0,$.jsxs)(cO,{defaultValue:`config`,children:[(0,$.jsxs)(lO,{children:[(0,$.jsx)(uO,{value:`config`,children:a(v6,`detailConfig`)}),e.kind===`flow`&&(0,$.jsx)(uO,{value:`preview`,children:a(v6,`flowPreview`)}),e.kind===`actor`&&(0,$.jsx)(uO,{value:`preview`,children:a(v6,`actorTeamPreview`)}),(0,$.jsx)(uO,{value:`executions`,children:a(v6,`executionHistory`)})]}),(0,$.jsx)(dO,{value:`config`,children:(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2`,children:[(0,$.jsxs)(EF,{children:[(0,$.jsx)(OF,{children:(0,$.jsx)(AF,{className:`text-sm`,children:a(v6,`detailConfig`)})}),(0,$.jsxs)(NF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(S6,{label:a(v6,`scope`),value:a(v6,`scope_${c.primaryScope}`)}),(0,$.jsx)(S6,{label:a(v6,`riskLevel`),value:(0,$.jsx)(T6,{level:c.riskLevel})})]})]}),(0,$.jsxs)(EF,{children:[(0,$.jsx)(OF,{children:(0,$.jsx)(AF,{className:`text-sm`,children:a(v6,`detailMetadata`)})}),(0,$.jsxs)(NF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(S6,{label:a(v6,`detailRef`),value:e.ref}),(0,$.jsx)(S6,{label:a(v6,`detailKind`),value:e.kind}),(0,$.jsx)(S6,{label:a(v6,`detailStatus`),value:e.status}),e.category&&(0,$.jsx)(S6,{label:a(v6,`detailCategory`),value:e.category}),e.tags&&e.tags.length>0&&(0,$.jsx)(S6,{label:a(v6,`detailTags`),value:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-element`,children:e.tags.map(e=>(0,$.jsx)(If,{variant:`secondary`,className:`text-2xs`,children:e},e))})}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsx)($.Fragment,{children:Object.entries(e.metadata).map(([e,t])=>(0,$.jsx)(S6,{label:e,value:t},e))})]})]})]})}),(0,$.jsx)(dO,{value:`preview`,children:(0,$.jsx)(EF,{children:(0,$.jsx)(NF,{className:`p-card`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:e.kind===`flow`?a(v6,`flowPreviewPlaceholder`):a(v6,`actorTeamPreviewPlaceholder`)})})})}),(0,$.jsx)(dO,{value:`executions`,children:u.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border bg-card p-section`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:a(v6,`noExecutions`)})}):(0,$.jsx)(lf,{className:`max-h-96`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:u.map(e=>(0,$.jsx)(uEe,{execution:e},e.executionId))})})})]})]}):null},S6=({label:e,value:t})=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,className:`font-medium`,children:e}),(0,$.jsx)(Z,{as:`span`,size:Le.XS,className:`text-end`,children:t})]}),lEe={[hW.IDLE]:`outline`,[hW.STARTING]:`secondary`,[hW.RUNNING]:`default`,[hW.AWAITING_APPROVAL]:`secondary`,[hW.COMPLETED]:`default`,[hW.CANCELLED]:`outline`,[hW.ERROR]:`destructive`},uEe=({execution:e})=>{let{tComponent:t,isReady:n}=K({component:v6});return n?(0,$.jsxs)(`div`,{className:`flex items-center gap-card rounded-lg border bg-card p-card-sm`,children:[(0,$.jsx)(If,{variant:lEe[e.status]??`secondary`,className:`text-2xs`,children:t(v6,`execStatus_${e.status}`)}),(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,className:`flex-1 truncate`,children:e.executionId})]}):null},C6=({kind:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6});return r?(0,$.jsx)(If,{variant:e===`flow`?`default`:`secondary`,className:U(`text-2xs`,t),children:e===`flow`?n(v6,`kindFlow`):n(v6,`kindActor`)}):null},dEe={draft:{variant:`outline`,extraClass:`text-muted-foreground`},active:{variant:`default`},inactive:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},deprecated:{variant:`destructive`,extraClass:`opacity-[0.75]`},archived:{variant:`outline`,extraClass:`text-muted-foreground opacity-[var(--opacity-muted)]`}},w6=({status:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6}),i=dEe[e]??{variant:`secondary`};return r?(0,$.jsx)(If,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(v6,`status_${e}`)}):null},fEe={low:{variant:`outline`},medium:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},high:{variant:`destructive`},critical:{variant:`destructive`,extraClass:`animate-pulse`}},T6=({level:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6}),i=fEe[e]??{variant:`outline`};return r?(0,$.jsx)(If,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(v6,`riskLevel_${e}`)}):null},E6=B.LOW_LEVEL_AI_EXECUTION_PLAN,pEe=[Yt.COMPLETED,Yt.PROCESSING,Yt.AWAITING_APPROVAL,Yt.FAILED],D6=({plan:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:E6}),a=Q.useMemo(()=>new Map(e.stepStates.map(e=>[e.planStepId,e])),[e.stepStates]),o=Q.useMemo(()=>{let t={};for(let n of e.planSteps){let e=a.get(n._id)?.status??n.status;t[e]=(t[e]??0)+1}return t},[e.planSteps,a]),s=Q.useCallback(t=>e.planSteps.find(e=>e._id===t)?.name??t,[e.planSteps]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card rounded-lg border bg-card p-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(E6,`title`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.goalDescription})]}),(0,$.jsx)(yf,{status:e.status})]}),(0,$.jsx)(k6,{total:e.planSteps.length,statusCounts:o}),(0,$.jsx)(lf,{className:`max-h-80`,children:(0,$.jsx)(`ol`,{className:`flex flex-col gap-2`,children:e.planSteps.map((e,t)=>{let n=a.get(e._id);return(0,$.jsx)(O6,{step:e,index:t,resolvedStatus:n?.status??e.status,statusChanges:n?.statusChanges,nameOfStep:s},e._id)})})})]}):null},O6=({step:e,index:t,resolvedStatus:n,statusChanges:r,nameOfStep:i,className:a,...o})=>{let{tComponent:s,isReady:c,formatTime:l,formatList:u}=K({component:E6}),{statusWord:d,isReady:f}=tp(),{word:p,isReady:m}=hf(Jf),{renderIcon:h}=Mf(),g=Q.useMemo(()=>xn(e),[e]),[_,v]=Q.useState(!1),y=g.length>0||r&&r.length>0;return!c||!f||!m?null:(0,$.jsxs)(`li`,{className:U(`flex items-start gap-element`,a),...o,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-mono text-muted-foreground`,children:t+1}),(0,$.jsx)(`div`,{className:U(`size-2.5 shrink-0 rounded-full`,df(n))})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.name??e._id}),(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:p(e.topic)}),(0,$.jsx)(yf,{status:n})]}),e.description&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),y&&(0,$.jsxs)(CO,{open:_,onOpenChange:v,children:[(0,$.jsx)(wO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.LINK,size:Y.SM,className:`h-auto p-0 text-2xs`,children:[h(_?H.CHEVRON_DOWN:H.CHEVRON_RIGHT,{size:ca.XS}),s(E6,`stepDetails`)]})}),(0,$.jsxs)(TO,{className:`mt-1 flex flex-col gap-1`,children:[g.length>0&&(0,$.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:s(E6,`stepWaitsOn`,{steps:u(g.map(e=>i?.(e)??e))})}),r&&r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:r.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(`div`,{className:U(`size-1.5 rounded-full`,df(e.status))}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:d(e.status)}),(0,$.jsx)(`time`,{className:`text-muted-foreground`,dateTime:e.timestamp,children:Vd.formatTimestamp(e.timestamp,l)})]},`${e.status}-${e.timestamp}-${t}`))}),(0,$.jsx)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:(0,$.jsx)(`span`,{children:s(E6,`stepCreatedAt`,{time:Vd.formatTimestamp(e.createdAt,l)})})})]})]})]})]})},k6=({total:e,statusCounts:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:E6}),{statusWord:o,isReady:s}=tp(),c=t[Yt.COMPLETED]??0,l=e>0?Math.round(c/e*100):0,u=pEe.flatMap(n=>{let r=t[n]??0;return r>0&&e>0?[{status:n,width:r/e*100}]:[]}),d=Object.values(Yt).flatMap(e=>{let n=t[e]??0;return e!==Yt.COMPLETED&&n>0?[{status:e,count:n}]:[]});return!a||!s?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:i(E6,`progress`,{completed:c,total:e})}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[l,`%`]})]}),(0,$.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded-full bg-secondary`,children:u.map(({status:e,width:t})=>(0,$.jsx)(`div`,{"data-plan-progress-segment":e,className:U(`h-full motion-safe:transition-all`,df(e)),style:{width:`${t}%`}},e))}),d.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-card text-2xs text-muted-foreground`,children:d.map(({status:e,count:t})=>(0,$.jsxs)(`span`,{"data-plan-progress-legend":e,className:`flex items-center gap-0.5`,children:[(0,$.jsx)(`span`,{className:U(`inline-block size-1.5 rounded-full`,df(e))}),i(E6,`progressLegendEntry`,{status:o(e),count:t})]},e))})]})},A6=B.LOW_LEVEL_AI_TASK_DETAIL;function j6(e){switch(e.kind){case aa.TASK:return e.taskId;case aa.PLAN_STEP:return e.planStepId;case aa.PLAN:return e.planId;case aa.ACTOR:return e.actorId;case aa.ACTOR_SYSTEM:return e.actorSystemId;case aa.FLOW:return e.flowId;case aa.FLOW_STEP:return e.stepId}}var M6=({task:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a,formatDateTime:o}=K({component:A6}),{word:s,isReady:c}=hf(Jf),{word:l,isReady:u}=hf(zf),d=Object.keys(e.context).length>0,f=e.relationships.length>0,p=e.artifacts&&e.artifacts.length>0;return!a||!c||!u?null:(0,$.jsxs)(EF,{statusEdge:Ef(e.status),className:U(`flex flex-col`,n),...r,children:[(0,$.jsxs)(OF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:s(e.topic)}),(0,$.jsx)(yf,{status:e.status}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:i(A6,`actor`)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.actors.actorRef})]})]}),(0,$.jsx)(AF,{className:`text-sm`,children:e.title}),(0,$.jsx)(MF,{className:`text-xs`,children:e.description})]}),(0,$.jsxs)(NF,{className:`flex flex-col gap-card-sm`,children:[e.input!==void 0&&(0,$.jsx)(N6,{label:i(A6,`input`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.input==`string`?e.input:JSON.stringify(e.input,null,2)})}),e.output!==void 0&&(0,$.jsx)(N6,{label:i(A6,`output`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.output==`string`?e.output:JSON.stringify(e.output,null,2)})}),(0,$.jsx)(N6,{label:i(A6,`context`),children:d?(0,$.jsx)(`pre`,{className:`max-h-24 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:JSON.stringify(e.context,null,2)}):(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:i(A6,`contextEmpty`)})}),f&&(0,$.jsx)(N6,{label:i(A6,`relationships`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.relationships.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,"data-task-relationship":e.relation,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:l(e.relation)}),(0,$.jsx)(`span`,{className:`text-muted-foreground truncate`,children:t?.(e)??j6(e)})]},n))})}),p&&(0,$.jsx)(N6,{label:i(A6,`artifacts`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.artifacts.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:e.type}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.name})]},t))})}),e.actorStates.length>0&&(0,$.jsx)(F6,{events:e.actorStates.flatMap(e=>e.statusChanges.map(t=>({status:t.status,timestamp:t.timestamp,actorRef:e.actorRef})))}),(e.startedAt||e.completedAt)&&(0,$.jsxs)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:[e.startedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(A6,`started`)}),(0,$.jsx)(`span`,{children:Vd.formatTimestamp(e.startedAt,o)})]}),e.completedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(A6,`completed`)}),(0,$.jsx)(`span`,{children:Vd.formatTimestamp(e.completedAt,o)})]}),e.startedAt&&(0,$.jsx)(`span`,{className:`font-mono`,children:Vd.formatDuration(e.startedAt,e.completedAt)})]})]})]})};function N6({label:e,children:t,defaultOpen:n=!1}){return(0,$.jsxs)(CO,{defaultOpen:n,children:[(0,$.jsx)(wO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`h-auto justify-start p-0 text-xs font-medium`,children:e})}),(0,$.jsx)(TO,{className:`mt-1`,children:t})]})}var P6=({tasks:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:A6}),{statusWord:o,isReady:s}=tp(),{word:c,isReady:l}=hf(Jf),[u,d]=Q.useState(null),[f,p]=Q.useState(null),[m,h]=Q.useState(`createdAt`),g=Q.useMemo(()=>[...new Set(e.map(e=>e.status))],[e]),_=Q.useMemo(()=>[...new Set(e.map(e=>e.topic))],[e]),v=Q.useMemo(()=>{let t=e;return u&&(t=t.filter(e=>e.status===u)),f&&(t=t.filter(e=>e.topic===f)),[...t].sort((e,t)=>m===`createdAt`?new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime():e.status.localeCompare(t.status))},[e,u,f,m]);return!a||!s||!l?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`filterByStatus`)}),(0,$.jsx)(X,{type:`button`,variant:u===null?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>d(null),children:i(A6,`filterAll`)}),g.map(e=>(0,$.jsx)(X,{type:`button`,variant:u===e?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>d(e===u?null:e),children:o(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`filterByTopic`)}),(0,$.jsx)(X,{type:`button`,variant:f===null?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>p(null),children:i(A6,`filterAll`)}),_.map(e=>(0,$.jsx)(X,{type:`button`,variant:f===e?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>p(e===f?null:e),children:c(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`sortBy`)}),(0,$.jsx)(X,{type:`button`,variant:m===`createdAt`?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>h(`createdAt`),children:i(A6,`sortDate`)}),(0,$.jsx)(X,{type:`button`,variant:m===`status`?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>h(`status`),children:i(A6,`sortStatus`)})]})]}),(0,$.jsx)(lf,{className:`max-h-[32rem]`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-card`,children:[v.length===0&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:i(A6,`noTasks`)}),v.map(e=>(0,$.jsx)(M6,{task:e,...t?{nameOf:t}:{}},e._id))]})})]})},F6=({events:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatTime:a}=K({component:A6}),o=Q.useMemo(()=>[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[e]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,t),...n,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:r(A6,`timeline`)}),(0,$.jsx)(lf,{className:`max-h-40`,children:(0,$.jsx)(`ol`,{className:`relative border-s border-border ms-3 space-y-1.5`,children:o.map((e,t)=>{let n=t>0?Vd.formatDuration(o[t-1].timestamp,e.timestamp):void 0;return(0,$.jsxs)(`li`,{className:`ms-4`,children:[(0,$.jsx)(`div`,{className:U(`absolute -start-1.5 mt-1.5 size-3 rounded-full`,df(e.status))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(yf,{status:e.status}),e.actorRef&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:e.actorRef}),n&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`+`,n]})]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground`,dateTime:e.timestamp,children:Vd.formatTimestamp(e.timestamp,a)})]},`${e.status}-${e.timestamp}-${t}`)})})})]}):null},I6=B.LOW_LEVEL_AI_TASK_MEMORY,mEe={short_term:`⚡`,long_term:`📦`,working:`🔧`},hEe=({memory:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:I6}),a=e.shortTerm.entries.length+e.longTerm.entries.length+e.working.entries.length;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:r(I6,`title`)}),(0,$.jsx)(If,{variant:`secondary`,className:`text-2xs`,children:a})]}),(0,$.jsx)(L6,{scope:`short_term`,label:r(I6,`shortTerm`),store:e.shortTerm,defaultOpen:!0}),(0,$.jsx)(L6,{scope:`long_term`,label:r(I6,`longTerm`),store:e.longTerm}),(0,$.jsx)(L6,{scope:`working`,label:r(I6,`working`),store:e.working})]}):null},L6=({scope:e,label:t,store:n,defaultOpen:r=!1,className:i,...a})=>{let{tComponent:o,isReady:s}=K({component:I6}),c=mEe[e]??`📋`;return s?(0,$.jsxs)(CO,{defaultOpen:r,className:U(`rounded-md border`,i),...a,children:[(0,$.jsx)(wO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,className:`w-full justify-between p-card-sm`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-element text-xs font-medium`,children:[(0,$.jsx)(`span`,{children:c}),t,n.maxSize!=null&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`(`,n.entries.length,`/`,n.maxSize,`)`]})]}),(0,$.jsx)(If,{variant:`secondary`,className:`text-2xs`,children:n.entries.length})]})}),(0,$.jsx)(TO,{children:(0,$.jsx)(lf,{className:`max-h-48`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 p-card-sm pt-0`,children:[n.entries.map(e=>(0,$.jsx)(R6,{entry:e},e.key)),n.entries.length===0&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:o(I6,`scopeEmpty`)})]})})})]}):null},R6=({entry:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatDateTime:a}=K({component:I6}),o=e.expiresAt?new Date(e.expiresAt).getTime()<Date.now():!1;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-0.5 rounded-sm bg-muted p-1.5`,o&&`opacity-[var(--opacity-muted)]`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-medium`,children:e.key}),(0,$.jsx)(If,{variant:`outline`,className:`text-2xs`,children:e.type}),o&&(0,$.jsx)(If,{variant:`destructive`,className:`text-2xs`,children:r(I6,`expired`)}),e.expiresAt&&!o&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(I6,`expires`),`: `,(0,$.jsx)(`time`,{dateTime:e.expiresAt,children:Vd.formatTimestamp(e.expiresAt,a)})]})]}),(0,$.jsx)(`pre`,{className:`max-h-16 overflow-auto text-2xs text-muted-foreground`,children:typeof e.value==`string`?e.value:JSON.stringify(e.value,null,2)}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap gap-1`,children:[(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(I6,`metadata`),`:`]}),Object.entries(e.metadata).map(([e,t])=>(0,$.jsxs)(If,{variant:`outline`,className:`text-2xs`,children:[e,`: `,String(t)]},e))]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground/60`,dateTime:e.timestamp,children:Vd.formatTimestamp(e.timestamp,a)})]}):null},z6=new WeakMap;function gEe(e){let{doOperation:t,operationPathKey:n,contextualParameters:r,executionId:i}=e,a=z6.get(t);a||(a=new Map,z6.set(t,a));let o=JSON.stringify([n,Object.entries(r).sort(([e],[t])=>e.localeCompare(t))]),s=a.get(o);if(!s){s={operationPathKey:n,contextualParameters:r,waiters:new Map},a.set(o,s);let e=a,i=s;setTimeout(()=>{e.delete(o),_Ee(t,i)},0)}return new Promise((e,t)=>{let n=s.waiters.get(i)??[];n.push({resolve:e,reject:t}),s.waiters.set(i,n)})}async function _Ee(e,t){let n=[...t.waiters.keys()];for(let r=0;r<n.length;r+=100){let i=n.slice(r,r+100);try{let n=await e(t.operationPathKey,{contextualParameters:t.contextualParameters,requestData:{executionIds:i}}),r=new Map((n?.items??[]).map(e=>[e.executionId,e.usage]));for(let e of i)for(let n of t.waiters.get(e)??[])n.resolve(r.get(e))}catch(e){for(let n of i)for(let r of t.waiters.get(n)??[])r.reject(e)}}}var vEe=Object.freeze({});function B6(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{message:e,component:`useEmbeddedResourceContext`,...t})}function V6(e){return typeof e.operationIdentifier==`string`}function yEe(e,t,n,r,i){let a=(e?.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation)),o=a.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0),s=a.length===1?a[0]:n.variantType===void 0&&n.variantKey===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&o.length===1?o[0]:void 0;if(!s)throw B6(a.length===0?`Composite resource runtime cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Composite resource runtime found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:a.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))});let c=e?nh({operation:s,resourceType:t,resourceConfig:e}):!1;if(e&&c&&s.isBulkOperation!==!0&&!Km({resourceConfig:e,operation:s,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw B6(`Composite resource runtime resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return s}function H6(e){return e.hostResourceType!==void 0&&e.target.resourceType===e.hostResourceType&&!e.target.resourceId&&!_o(e.operation)&&On.selfReferenceForeignKeysOf(e.hostResourceType,e.registry).length>0}function U6(){let e=IU(),{registry:t}=fm(),n=e?.hostResourceType,r=e?.contextResourceIdentifiers??vEe,i=(0,Q.useMemo)(()=>{if(!n)return;let e=t.resourceConfigurations[n];if(!e)throw B6(`Composite resource runtime cannot resolve host resource "${n}" from the registry.`,{hostResourceType:n});return e},[n,t.resourceConfigurations]),a=(0,Q.useMemo)(()=>n?On.buildParentResourcesRequirements(n,r,t):[],[r,n,t]),o=(0,Q.useMemo)(()=>{if(i)return ph({resourceConfig:i,operations:i.operations??[],coreOperation:W.READ,registry:t,hasResourceId:n?On.getResourceId(r[n]).length>0:!1,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)})??i.operations?.[0]},[r,i,n,t]),s=(0,Q.useCallback)(e=>{let a=e.resourceType??n;if(!a)throw B6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let o=a===n?i:t.resourceConfigurations[a];if(V6(e))return yEe(o,a,e,t,r);let s=e.operationLike===W.READ||e.operationLike===W.UPDATE||e.operationLike===W.DELETE,c=e.requireAddressable||s?o?ph({resourceConfig:o,operations:o.operations??[],coreOperation:e.operationLike,registry:t,hasResourceId:On.getResourceId(r[a]).length>0,allowBulk:e.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)}):void 0:nu(o?.operations??[],e.operationLike,{requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});if(!c)throw B6(`Composite resource runtime cannot resolve a preferred ${e.operationLike}-like operation on resource "${a}".`,{resourceType:a,operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});return c},[r,i,n,t]),c=(0,Q.useCallback)((e,c)=>{if(!n)throw B6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let l=e.resourceType??n,u=s({resourceType:l,...V6(e)?{operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}:{operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk}}),d=H6({target:e,hostResourceType:n,operation:u,registry:t});if(l===n&&!d){let i=On.getResourceId(r[n]),a=e.resourceId?{...zm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:n,id:i},targetResourceType:n,targetId:e.resourceId,registry:t}).identifiers,[n]:e.resourceId}:r,o=On.buildParentResourcesRequirements(n,a,t,e.relationshipFieldOverrides),s=On.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:u,contextResourceIdentifiers:a,additionalContext:e.additionalContext,parentResourcesRequirements:o});return c&&e.pinnedFilters&&Object.keys(e.pinnedFilters).length>0?GG({childContext:s,hostResourceType:n,hostResourceId:void 0,hostRelationships:void 0,selectedForeignKey:void 0,callerPinnedFilters:e.pinnedFilters,registry:t}):s}if(!o)throw B6(`Composite resource runtime cannot derive related resource operations from host "${n}" because no host operation is configured.`,{hostResourceType:n,targetResourceType:l});let f=On.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:o,contextResourceIdentifiers:r,parentResourcesRequirements:a}),p=On.deriveChildResourceContext(f,{resourceType:l,operationIdentifier:String(u.operationIdentifier),operation:u,resourceId:e.resourceId,relationshipFieldOverrides:e.relationshipFieldOverrides,additionalContext:e.additionalContext},t);return c?GG({childContext:p,hostResourceType:n,hostResourceId:On.getResourceId(r[n])||void 0,hostRelationships:i?.resourceRelationships,selectedForeignKey:e.relationshipFieldOverrides?.[n],callerPinnedFilters:e.pinnedFilters,registry:t}):p},[r,o,i,n,a,t,s]),l=(0,Q.useCallback)(e=>c(e,!0),[c]),u=(0,Q.useCallback)(e=>V.flattenContextIdentifiers(c(e,!1).contextResourceIdentifiers),[c]),d=(0,Q.useCallback)(e=>{try{return l(e),!0}catch{return!1}},[l]);return(0,Q.useMemo)(()=>!n||!i?null:{hostResourceType:n,hostResourceId:On.getResourceId(r[n]),hostResourceConfig:i,contextResourceIdentifiers:r,parentResourcesRequirements:a,resolveOperation:s,buildOperationContext:l,deriveRelatedScopeIdentifiers:u,canBuildOperationContext:d},[l,u,d,r,i,n,a,s])}function W6(){let e=U6();if(!e)throw B6(`useEmbeddedResourceContext() must be used within a resource-scoped CompositeView.`);return e}var G6=B.LOW_LEVEL_AI_EXECUTION_USAGE,K6;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(K6||={});function q6(e,t){return e.disclosure===P.TOKENS_AND_COST?e.costs.flatMap(e=>{let n=p0(e.costMinor,e.currency,t);return n===void 0?[]:[{currency:e.currency,amount:n}]}):[]}function J6(e){return(t,n)=>e(G6,t,n)}function Y6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:G6}),a=J6(i.tComponent);if(e===K6.LOADING)return null;if(e===K6.FAILED||!t)return(0,$.jsx)(`p`,{role:`status`,className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":e,children:a(`readFailed`)});if(t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0)return(0,$.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":`empty`,children:a(`noCalls`)});let o=q6(t,r),s=t.disclosure===P.TOKENS_AND_COST?t.unpricedCallCount:0,c=[{key:`calls`,label:a(`calls`),value:r(t.callCount)},...s>0?[{key:`unpricedCalls`,label:a(`unpricedCalls`),value:r(s)}]:[],{key:`inputTokens`,label:a(`inputTokens`),value:r(t.promptTokens)},{key:`outputTokens`,label:a(`outputTokens`),value:r(t.completionTokens)},...t.reasoningTokens>0?[{key:`reasoningTokens`,label:a(`reasoningTokens`),value:r(t.reasoningTokens)}]:[],{key:`totalTokens`,label:a(`totalTokens`),value:r(t.totalTokens)},...t.classifierCallCount>0?[{key:`classifierCalls`,label:a(`classifierCalls`),value:r(t.classifierCallCount)}]:[],...t.documentExtractionCallCount>0?[{key:`documentExtractionCalls`,label:a(`documentExtractionCalls`),value:r(t.documentExtractionCallCount)}]:[],...t.personalDataFieldsWithheld>0?[{key:`personalDataWithheld`,label:a(`personalDataWithheld`),value:r(t.personalDataFieldsWithheld)}]:[],...o.map(e=>({key:`cost-${e.currency}`,label:a(`cost`),value:e.amount}))];return(0,$.jsxs)(`section`,{className:U(`flex flex-col gap-field`,n),"data-execution-usage":e,"aria-label":a(`title`),children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:a(`title`)}),(0,$.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-field gap-y-1 text-sm`,children:c.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`dd`,{className:`tabular-nums`,"data-execution-usage-row":e.key,children:e.value})]},e.key))})]})}function X6({className:e}){let t=U6(),{registry:n,doOperation:r}=fm(),i=(0,Q.useMemo)(()=>{if(!t?.hostResourceId)return;let e={resourceType:t.hostResourceType,resourceId:t.hostResourceId,operationIdentifier:je.USAGE,isOperationDefault:!0};if(!t.canBuildOperationContext(e))return;let r=t.buildOperationContext(e);return{operationPathKey:Ta.createOperationPathKeyFromOperation(r.operation),contextualParameters:V.buildContextualParameters(r.contextResourceIdentifiers,n),parentResourcesRequirements:r.parentResourcesRequirements}},[t,n]),[a,o]=(0,Q.useState)({state:K6.LOADING});return(0,Q.useEffect)(()=>{if(!i)return;let e=!0;return o({state:K6.LOADING}),r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements}).then(t=>{e&&o({state:K6.READY,usage:t})}).catch(()=>{e&&o({state:K6.FAILED})}),()=>{e=!1}},[i,r]),i?(0,$.jsx)(Y6,{readState:a.state,...a.usage?{usage:a.usage}:{},...e?{className:e}:{}}):null}function Z6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:G6}),a=J6(i.tComponent);if(e===K6.LOADING)return null;let o=(e,t)=>(0,$.jsx)(`span`,{className:U(`text-xs text-muted-foreground tabular-nums`,n),"data-execution-usage-summary":t,children:e});return e===K6.FAILED||!t?o(a(`readFailed`),K6.FAILED):t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0?o(a(`noCalls`),`empty`):o([a(`summaryTokens`,{tokens:r(t.totalTokens)}),...q6(t,r).map(e=>e.amount)].join(` · `),e)}function Q6({className:e}){let t=SR()?.resourceType,n=ik()?.data,r=dj().contextualParameters,{registry:i,doOperation:a}=fm(),o=typeof n?.executionId==`string`&&n.executionId!==``?n.executionId:void 0,s=(0,Q.useMemo)(()=>[..._ee.variants.values()].find(e=>e.resourceType===t)?.parentFieldIdentifier,[t]),c=s?r?.[s]:void 0,l=(0,Q.useMemo)(()=>{let e=t?i.resourceConfigurations[t]?.operations?.find(e=>e.operationIdentifier===je.USAGES&&e.isOperationDefault):void 0;return e?Ta.createOperationPathKeyFromOperation(e):void 0},[i,t]),[u,d]=(0,Q.useState)({state:K6.LOADING});return(0,Q.useEffect)(()=>{if(!o||!l||!s||typeof c!=`string`||c===``)return;let e=!0;return d({state:K6.LOADING}),gEe({doOperation:a,operationPathKey:l,contextualParameters:{[s]:c},executionId:o}).then(t=>{e&&d(t?{state:K6.READY,usage:t}:{state:K6.FAILED})}).catch(()=>{e&&d({state:K6.FAILED})}),()=>{e=!1}},[a,o,l,s,c]),!o||!l||typeof c!=`string`||c===``?null:(0,$.jsx)(Z6,{readState:u.state,...u.usage?{usage:u.usage}:{},...e?{className:e}:{}})}function $6(e,t){let n={},r={},i={};for(let a of e.fields)n[a.key]=a.request.question,a.request.why&&(r[a.key]=a.request.why),a.request.kind===_t.CHOICE?i[a.key]=Object.fromEntries((a.request.options??[]).map(e=>[e,Mn(a.request,e)])):a.request.kind===_t.CONFIRM&&(i[a.key]={...t});let a=e.layout.kind===gr.SECTIONS?e.layout.sections:e.layout.kind===gr.WIZARD?e.layout.steps:[],o={};for(let e of a)o[e.name]={title:e.title,...e.description?{description:e.description}:{}};return{fields:n,descriptions:r,enums:i,sections:o}}var e8=Q.createContext(null);function t8(){let e=Q.useContext(e8),{control:t}=GC(),n=VC({control:t}),r=Q.useMemo(()=>e?.compiled.schema.safeParse(n).success??!1,[e?.compiled,n]);return Q.useEffect(()=>{e?.onCompleteChangeRef.current?.(r)},[r,e]),null}function bEe(){let e=Q.useContext(e8);if(!e)return null;let{layout:t,fields:n}=e.compiled;if(t.kind===gr.FLAT)return(0,$.jsxs)(nA,{autoInjectSubmitButton:!1,children:[n.map(e=>(0,$.jsx)(XL,{name:e.key},e.key)),(0,$.jsx)(t8,{})]});let r=t.kind===gr.SECTIONS?t.appearance:cr.STEPPER,i=t.kind===gr.SECTIONS?t.sections:t.steps;return(0,$.jsxs)(nA,{autoInjectSubmitButton:!1,children:[i.map(e=>(0,$.jsx)(Yk,{name:e.name,appearance:r,children:e.keys.map(e=>(0,$.jsx)(XL,{name:e},e))},e.name)),(0,$.jsx)(t8,{})]})}var xEe=()=>void 0;function n8(e){let t=JSON.stringify(e);return Q.useMemo(()=>e,[t])}function r8({fields:e,form:t,confirmWords:n,disabled:r,onReady:i,onCompleteChange:a,className:o}){let s=n8(e),c=n8(t),l=n8(n),u=Q.useMemo(()=>wie({fields:[...s],form:c}),[s,c]),d=Q.useMemo(()=>$6(u,l),[u,l]),f=Q.useRef(a);Q.useLayoutEffect(()=>{f.current=a},[a]);let p=Q.useMemo(()=>({compiled:u,onCompleteChangeRef:f}),[u]),m=Q.useCallback(e=>{i?.({async readValues(){if(!await e.trigger())return null;let t=u.schema.safeParse(e.getValues());if(!t.success)return null;let n=t.data;return u.fields.map(e=>({ref:e.request.ref,value:One(n[e.key])}))}})},[u,i]);return(0,$.jsx)(`div`,{className:o,"data-human-decision-form":``,children:(0,$.jsx)(e8.Provider,{value:p,children:(0,$.jsx)(iE,{schema:u.schema,onSubmit:xEe,labels:d,disabled:r,layoutTemplate:bEe,onFormReady:m})})})}var i8=Qs(B.LOW_LEVEL_AI_ARTIFACT_LIST,`AI_ArtifactList`,[`Item`,`Origin`,`TextContent`,`FileContent`,`StructuredContent`]);function a8({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n,{...t})}function o8({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.Item,{...t})}function SEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.Origin,{...t})}function CEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.TextContent,{...t})}function wEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.FileContent,{...t})}function TEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.StructuredContent,{...t})}var EEe={[er.TEXT]:`TEXT`,[er.FILE]:`FILE`,[er.RAW_DATA]:`RAW_DATA`,[er.STRUCTURED]:`STRUCTURED`};function s8(e){let t=e.content;return{ref:e.ref,name:e.name,type:EEe[e.type]??`RAW_DATA`,description:e.description,origin:e.origin,createdAt:e.createdAt,content:e.content,mimeType:t?.mimeType,size:t?.size,metadata:e.metadata}}function DEe({artifacts:e,...t}){let n=Q.useMemo(()=>e.map(s8),[e]);return(0,$.jsx)(a8,{items:n,...t})}function OEe({artifact:e,...t}){let n=Q.useMemo(()=>s8(e),[e]);return(0,$.jsx)(o8,{item:n,...t})}function c8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_LIST,`AI_AgentList`)(e);return(0,$.jsx)(n,{...t})}function l8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_CARD,`AI_AgentCard`)(e);return(0,$.jsx)(n,{...t})}function kEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_PROMPT_SPEC,`AI_AgentPromptSpec`)(e);return(0,$.jsx)(n,{...t})}function AEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_CAPABILITIES,`AI_AgentCapabilities`)(e);return(0,$.jsx)(n,{...t})}var jEe={[oe.ACTIVE]:`ACTIVE`,[oe.INACTIVE]:`INACTIVE`,[oe.DEPRECATED]:`DEPRECATED`},MEe={[od.GENERATION]:`GENERATION`,[od.ANALYSIS]:`ANALYSIS`,[od.TRANSFORMATION]:`TRANSFORMATION`,[od.DECISION]:`DECISION`,[od.CHAT]:`CHAT`,[od.CUSTOM]:`CUSTOM`},NEe={[gi.SECURITY]:`SECURITY`,[gi.SAFETY]:`SAFETY`,[gi.PRIVACY]:`PRIVACY`,[gi.SCOPE]:`SCOPE`,[gi.COMPLIANCE]:`COMPLIANCE`};function u8(e){let t=e.promptSpec;return{ref:e.ref,displayName:e.displayName,status:jEe[e.status]??`INACTIVE`,promptSpec:{role:t.role,persona:t.persona,skillType:MEe[t.skillType]??`CUSTOM`,constraints:t.constraints?.map(e=>({id:e.id,text:e.text,type:NEe[e.type]??`SCOPE`,onViolation:e.onViolation})),goal:t.goal,output:t.output?{type:t.output.type,fileFormat:t.output.fileFormat,lengthGuidance:t.output.lengthGuidance?.toUpperCase(),includeReasoning:t.output.includeReasoning,requiredSections:t.output.requiredSections}:void 0,instructions:t.instructions,hints:t.hints,uncertainty:t.uncertainty?{policy:t.uncertainty.policy.toUpperCase(),confidenceThreshold:t.uncertainty.confidenceThreshold}:void 0,outOfScope:t.outOfScope,examples:t.examples,style:t.style?{verbosity:t.style.verbosity?.toUpperCase(),tone:t.style.tone?.toUpperCase()}:void 0,curation:t.curation,metadata:t.metadata},capabilities:e.capabilities,config:{operationKey:e.config.operationKey,seed:`seed`in e.config?e.config.seed:void 0,modelName:e.config.model},version:e.version,createdAt:e.createdAt,updatedAt:e.updatedAt}}function PEe({agents:e,...t}){let n=Q.useMemo(()=>e.map(u8),[e]);return(0,$.jsx)(c8,{agents:n,...t})}function FEe({agent:e,...t}){let n=Q.useMemo(()=>u8(e),[e]);return(0,$.jsx)(l8,{agent:n,...t})}var d8=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_ACTION_BUTTON,`ActionButton`)(e);return(0,$.jsx)(r,{...t,ref:n})});d8.displayName=`ActionButton`;function f8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP,`ButtonGroup`)(e);return(0,$.jsx)(n,{...t})}function p8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP_TEXT,`ButtonGroupText`)(e);return(0,$.jsx)(n,{...t})}function IEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP_SEPARATOR,`ButtonGroupSeparator`)(e);return(0,$.jsx)(n,{...t})}function m8({as:e=`span`,children:t,className:n,textClassName:r,maxWidth:i=`100%`,tooltipSide:a=$s.TOP,tooltipDelayDuration:o=300,alwaysShowTooltip:s=!1,...c}){let l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!1),f=e===`span`?`span`:`div`,p=Q.useCallback(e=>{l.current=e},[]);(0,Q.useLayoutEffect)(()=>{let e=()=>{if(l.current){let e=l.current.scrollWidth>l.current.clientWidth;d(e)}};e();let t=new ResizeObserver(e);return l.current&&t.observe(l.current),()=>t.disconnect()},[t]);let m=(0,$.jsx)(e,{ref:p,"data-slot":`truncated-text`,className:U(`block truncate text-start`,r),style:{maxWidth:i},...c,children:t});return u||s?(0,$.jsxs)(tj,{delayDuration:o,children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}),(0,$.jsx)(rj,{side:a,children:t})]}):(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}var h8=Qs(B.LOW_LEVEL_AVATAR,`Avatar`,[`Image`,`Fallback`]);function g8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n,{...t})}function _8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n.Image,{...t})}function v8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n.Fallback,{...t})}function y8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_NOTIFICATION_INDICATOR,`NotificationIndicator`)(e);return(0,$.jsx)(n,{...t})}y8.displayName=`NotificationIndicator`;function b8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_IDENTIFIER,`Identifier`)(e);return(0,$.jsx)(n,{...t})}b8.displayName=`Identifier`;function x8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DURATION,`Duration`)(e);return(0,$.jsx)(n,{...t})}x8.displayName=`Duration`;function S8({activation:e,metadata:t,fileId:n,fieldName:r,onOverlayRequested:i,getBlob:a,onOperationRequested:o,ariaLabel:s}){let c=(0,Q.useCallback)(async()=>{let e=t.url;if(!e)return;if(a)try{Hy(await a(e),t.filename||`file`);return}catch{}let n=document.createElement(`a`);n.href=e,n.download=t.filename||`file`,document.body.appendChild(n),n.click(),n.remove()},[a,t.filename,t.url]),l=(0,Q.useCallback)(()=>{switch(e.policy){case Zu.NONE:return;case Zu.OVERLAY:i?.();return;case Zu.DOWNLOAD:c();return;case Zu.NEW_TAB:t.url&&window.open(t.url,`_blank`,`noopener,noreferrer`);return;case Zu.CUSTOM:o?.({operationIdentifier:e.operationIdentifier,variantKey:e.variantKey,fieldName:r,fileId:n});return}},[e,c,r,n,t.url,o,i]);return(0,Q.useMemo)(()=>e.policy!==Zu.NONE&&(e.policy===Zu.OVERLAY?i:e.policy===Zu.CUSTOM?o:t.url)?{interactive:!0,effectivePolicy:e.policy,activationProps:{role:`button`,tabIndex:0,"aria-label":s,onClick:e=>{e.stopPropagation(),l()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l())}}}:{interactive:!1,activationProps:{},effectivePolicy:Zu.NONE},[l,e.policy,s,t.url,o,i])}function C8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE,`DisplayFieldFileImage`)(e);return(0,$.jsx)(n,{...t})}function w8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO,`DisplayFieldFileVideo`)(e);return(0,$.jsx)(n,{...t})}function T8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO,`DisplayFieldFileAudio`)(e);return(0,$.jsx)(n,{...t})}function E8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT,`DisplayFieldFileDocument`)(e);return(0,$.jsx)(n,{...t})}function D8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY,`DisplayFieldFileGallery`)(e);return(0,$.jsx)(n,{...t})}var LEe=G(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`NotificationCenter`),O8=({preset:e=q.DEFAULT})=>{let{notifications:t,removeNotification:n,clearAll:r}=Fm(),{tComponent:i,isReady:a}=K({component:B.APPLICATION_LEVEL_NOTIFICATION_CENTER}),o=(0,Q.useMemo)(()=>gm(i,B.APPLICATION_LEVEL_NOTIFICATION_CENTER),[i]),s=(0,Q.useMemo)(()=>t.map(e=>({id:e.id,type:e.type,message:e.message,timestamp:e.timestamp,wasCelebration:e.wasCelebration,nextStep:e.nextStep})),[t]),c=LEe(e);return a?(0,$.jsx)(c,{notifications:s,sessionCount:s.length,onRemove:n,onClearAll:r,labelTitle:o(`title`),labelNoNotifications:o(`noNotificationsThisSession`),labelClearAll:o(`clearAll`),labelDismiss:o(`dismiss`),labelTimeJustNow:o(`timeJustNow`),formatTimeMinutesAgo:e=>o(`timeMinutesAgo`,{count:e}),formatTimeHoursAgo:e=>o(`timeHoursAgo`,{count:e}),formatTimeDaysAgo:e=>o(`timeDaysAgo`,{count:e})}):null};O8.displayName=`AppNotificationCenter`;var k8=({preset:e})=>{let{notifications:t}=Fm(),n=t.length,[r,i]=(0,Q.useState)(!1),a=(0,Q.useRef)(null),o=(0,Q.useCallback)(e=>{a.current&&!a.current.contains(e.target)&&i(!1)},[]);(0,Q.useEffect)(()=>(r&&document.addEventListener(`mousedown`,o),()=>{document.removeEventListener(`mousedown`,o)}),[r,o]);let s=(0,Q.useCallback)(e=>{e.key===`Escape`&&i(!1)},[]);return(0,$.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:s,children:[(0,$.jsxs)(`button`,{type:`button`,className:`relative inline-flex items-center justify-center w-8 h-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,onClick:()=>i(e=>!e),"aria-label":`Notifications${n>0?` (${n} this session)`:``}`,"aria-expanded":r,"aria-haspopup":`true`,children:[(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,$.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),n>0&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -end-0.5 flex items-center justify-center h-4 min-w-[16px] px-1 text-[10px] font-bold bg-destructive text-destructive-foreground rounded-full`,children:Jt(n)})]}),r&&(0,$.jsx)(`div`,{className:`absolute end-0 top-full mt-2 z-(--z-overlay) animate-in fade-in slide-in-from-top-2 duration-[var(--motion-duration-fast)]`,children:(0,$.jsx)(O8,{preset:e})})]})};k8.displayName=`AppLayout_NotificationCenter`;function A8({name:e,renderItem:t,sectionAppearance:n,objectItemLayout:r,className:i}){return(0,$.jsx)(XL,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,className:i})}A8.displayName=`FormFieldArray`,wk(A8,xk.FIELD_SLOT);function j8({name:e,renderItem:t,sectionAppearance:n=cr.GHOST,objectItemLayout:r,className:i,hideLabel:a,labelPlacement:o,hideDescription:s,labelStyle:c}){return(0,$.jsx)(yR,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,labelStyle:c,className:i,hideLabel:a,labelPlacement:o,hideDescription:s})}j8.displayName=`DisplayFieldArray`;var REe=Nl(B.LOW_LEVEL_CALENDAR,`Calendar`),zEe=Nl(B.LOW_LEVEL_CALENDAR_DAY_BUTTON,`CalendarDayButton`),M8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=REe(e);return(0,$.jsx)(r,{...t,ref:n})});M8.displayName=`Calendar`;var N8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=zEe(e);return(0,$.jsx)(r,{...t,ref:n})});N8.displayName=`CalendarDayButton`;function P8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INLINE_EDIT_TEXT,`InlineEditText`)(e);return(0,$.jsx)(n,{...t})}P8.displayName=`InlineEditText`;var F8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_FILE_UPLOAD,`FileUpload`)(e);return(0,$.jsx)(r,{...t,ref:n})});F8.displayName=`FileUpload`;var I8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(I8||={});var L8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Nl(B.LOW_LEVEL_TOGGLE,`Toggle`)(e);return(0,$.jsx)(r,{...t,ref:n})});L8.displayName=`Toggle`;function BEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM,`FormRoot`)(e);return(0,$.jsx)(n,{...t})}function VEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_ITEM,`FormItem`)(e);return(0,$.jsx)(n,{...t})}function HEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_LABEL,`FormLabel`)(e);return(0,$.jsx)(n,{...t})}function UEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_CONTROL,`FormControl`)(e);return(0,$.jsx)(n,{...t})}function WEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_DESCRIPTION,`FormDescription`)(e);return(0,$.jsx)(n,{...t})}function GEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_MESSAGE,`FormMessage`)(e);return(0,$.jsx)(n,{...t})}function KEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_FIELD,`FormFieldPrimitive`)(e);return(0,$.jsx)(n,{...t})}var R8=Q.createContext({}),z8=Q.createContext({}),B8=()=>{let e=Q.useContext(R8),t=Q.useContext(z8),{getFieldState:n}=GC(),r=IC({name:e.name}),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}};function qEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ASPECT_RATIO,`AspectRatio`)(e);return(0,$.jsx)(n,{...t})}var V8=Qs(B.LOW_LEVEL_CAROUSEL,`Carousel`,[`Content`,`Item`,`Previous`,`Next`]);function H8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n,{...t})}function U8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Content,{...t})}function W8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Item,{...t})}function JEe({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Previous,{...t})}function YEe({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Next,{...t})}function XEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DIVIDER,`Divider`)(e);return(0,$.jsx)(n,{...t})}function G8({notificationBadgeRef:e,label:t,className:n}){let{registry:r}=fm(),{getBadgeState:i}=o$(),a=e?r.notificationBadgeDefinitions.find(t=>qu(t)===e):void 0;if(!a)return null;let{count:o,pulse:s}=i(a),c=t?.trim()?t:os(qu(a));return(0,$.jsx)(y8,{mode:a.display.mode,tone:a.display.tone,count:o,pulse:s,label:c,className:n})}G8.displayName=`NavigationItemBadge`;var K8=Qs(B.LOW_LEVEL_MENU_BAR,`Menubar`,[`Menu`,`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function ZEe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n,{...t})}function QEe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Menu,{...t})}var q8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});q8.displayName=`MenubarTrigger`;var J8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.Content,{...t,ref:n})});J8.displayName=`MenubarContent`;function $Ee({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Group,{...t})}function eDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Item,{...t})}function tDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function nDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.RadioGroup,{...t})}function rDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.RadioItem,{...t})}function iDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Label,{...t})}function aDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Separator,{...t})}function oDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Shortcut,{...t})}function sDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Sub,{...t})}function cDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.SubTrigger,{...t})}var Y8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});Y8.displayName=`MenubarSubContent`;var X8=Qs(B.LOW_LEVEL_NAVBAR,`NavigationMenu`,[`List`,`Item`,`Content`,`Trigger`,`Link`,`Indicator`,`Viewport`]);function lDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n,{...t})}function uDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.List,{...t})}function dDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Item,{...t})}function fDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Content,{...t})}function pDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Trigger,{...t})}function mDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Link,{...t})}function hDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Indicator,{...t})}function gDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Viewport,{...t})}var Z8;(function(e){e.SIDEBAR=`sidebar`,e.FLOATING=`floating`,e.INSET=`inset`})(Z8||={});var Q8;(function(e){e.OFFCANVAS=`offcanvas`,e.ICON=`icon`,e.NONE=`none`})(Q8||={});var $8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})($8||={});var e5=Qs(B.LOW_LEVEL_SIDEBAR,`Sidebar`,[`Content`,`Footer`,`Group`,`GroupAction`,`GroupContent`,`GroupLabel`,`Header`,`Input`,`Inset`,`Menu`,`MenuAction`,`MenuBadge`,`MenuButton`,`MenuItem`,`MenuSkeleton`,`MenuSub`,`MenuSubButton`,`MenuSubItem`,`Provider`,`Rail`,`Separator`,`Trigger`]);function _De({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n,{...t})}function vDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Content,{...t})}function yDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Footer,{...t})}function bDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Group,{...t})}function xDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupAction,{...t})}function SDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupContent,{...t})}function CDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupLabel,{...t})}function wDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Header,{...t})}function TDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Input,{...t})}function EDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Inset,{...t})}function DDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Menu,{...t})}function ODe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuAction,{...t})}function kDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuBadge,{...t})}function ADe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuButton,{...t})}function jDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuItem,{...t})}function MDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSkeleton,{...t})}function NDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSub,{...t})}function PDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSubButton,{...t})}function FDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSubItem,{...t})}function IDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Provider,{...t})}function LDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Rail,{...t})}function RDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Separator,{...t})}function zDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Trigger,{...t})}var t5=Qs(B.LOW_LEVEL_CONTEXT_MENU,`ContextMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function BDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n,{...t})}function VDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Trigger,{...t})}var n5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});n5.displayName=`ContextMenuContent`;function HDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Group,{...t})}function UDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Item,{...t})}function WDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function GDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function KDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.RadioItem,{...t})}function qDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Label,{...t})}function JDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Separator,{...t})}function YDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Shortcut,{...t})}function XDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Sub,{...t})}function ZDe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var r5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});r5.displayName=`ContextMenuSubContent`;var i5=Qs(B.LOW_LEVEL_DROPDOWN_MENU,`DropdownMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function a5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n,{...t})}var o5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});o5.displayName=`DropdownMenuTrigger`;var s5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});s5.displayName=`DropdownMenuContent`;function QDe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Group,{...t})}function c5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Item,{...t})}function $De({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function eOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function tOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.RadioItem,{...t})}function l5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Label,{...t})}function u5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Separator,{...t})}function nOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Shortcut,{...t})}function d5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Sub,{...t})}function f5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var p5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});p5.displayName=`DropdownMenuSubContent`;var m5=Qs(B.LOW_LEVEL_HOVER_CARD,`HoverCard`,[`Trigger`,`Content`]);function h5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n,{...t})}function g5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n.Trigger,{...t})}function _5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n.Content,{...t})}var v5=Qs(B.LOW_LEVEL_PAGINATION,`Pagination`,[`Content`,`Item`,`Link`,`Previous`,`Next`,`Ellipsis`]);function rOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n,{...t})}function iOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Content,{...t})}function aOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Item,{...t})}function oOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Link,{...t})}function sOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Previous,{...t})}function cOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Next,{...t})}function lOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Ellipsis,{...t})}var y5=Qs(B.LOW_LEVEL_STACKED_LAYOUT,`StackedLayout`,[`Header`,`Title`,`Subtitle`,`Actions`,`Toolbar`,`Body`,`Aside`,`Content`,`Section`]);function uOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n,{...t})}function dOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Header,{...t})}function fOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Title,{...t})}function pOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Subtitle,{...t})}function mOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Actions,{...t})}function hOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Toolbar,{...t})}function gOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Body,{...t})}function _Oe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Aside,{...t})}function vOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Content,{...t})}function yOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Section,{...t})}var b5=Qs(B.LOW_LEVEL_AI_ARTIFACT,`AI_Artifact`,[`Header`,`Close`,`Content`,`Title`,`Description`,`Actions`,`Action`]);function bOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n,{...t})}function xOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Header,{...t})}function SOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Close,{...t})}function COe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Content,{...t})}function wOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Title,{...t})}function TOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Description,{...t})}function EOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Actions,{...t})}function DOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Action,{...t})}function x5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CODE_BLOCK,`AI_CodeBlock`)(e);return(0,$.jsx)(n,{...t})}function S5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_DIFF_BLOCK,`AI_DiffBlock`)(e);return(0,$.jsx)(n,{...t})}var C5;(function(e){e.CONTEXT=`context`,e.ADDED=`added`,e.REMOVED=`removed`,e.NOTE=`note`})(C5||={});var OOe=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,kOe=/^diff --git (?:a\/)?(\S+) (?:b\/)?(\S+)$/,AOe=/^--- (?:a\/)?(.*)$/,jOe=/^\+\+\+ (?:b\/)?(.*)$/,MOe=/^Binary files .* differ$/,NOe=`/dev/null`;function w5(e){if(e===void 0)return;let t=e.trim();return t===NOe||t===``?void 0:t}function T5(e){let t=e.replace(/\r\n/g,`
44
- `).split(`
45
- `);t.length>0&&t[t.length-1]===``&&t.pop();let n=[],r=null,i=null,a=0,o=0,s=()=>{i&&r&&r.hunks.push({...i,lines:[...i.lines]}),i=null},c=()=>{s(),r&&n.push({...r.newPath??r.oldPath?{path:r.newPath??r.oldPath}:{},...r.oldPath?{oldPath:r.oldPath}:{},...r.newPath?{newPath:r.newPath}:{},isBinary:r.isBinary,hunks:r.hunks,added:r.added,removed:r.removed}),r=null},l=()=>{c(),r={pathHeaderSeen:!1,isBinary:!1,hunks:[],added:0,removed:0}};for(let e of t){let t=kOe.exec(e);if(t){l(),r.oldPath=w5(t[1]),r.newPath=w5(t[2]);continue}let n=i===null?AOe.exec(e):null;if(n){(!r||r.pathHeaderSeen||r.hunks.length>0)&&l(),r.pathHeaderSeen=!0,r.oldPath=w5(n[1]);continue}let c=i===null?jOe.exec(e):null;if(c){r||l(),r.newPath=w5(c[1]);continue}if(MOe.test(e)){r||l(),r.isBinary=!0;continue}let u=OOe.exec(e);if(u){r||l(),s();let t=Number(u[1]),n=Number(u[3]);i={header:e,oldStart:t,oldLines:u[2]===void 0?1:Number(u[2]),newStart:n,newLines:u[4]===void 0?1:Number(u[4]),lines:[]},a=t,o=n;continue}if(!i||!r)continue;let d=e.charAt(0),f=e.slice(1);switch(d){case`+`:i.lines.push({kind:C5.ADDED,text:f,newNumber:o}),o+=1,r.added+=1;break;case`-`:i.lines.push({kind:C5.REMOVED,text:f,oldNumber:a}),a+=1,r.removed+=1;break;case`\\`:i.lines.push({kind:C5.NOTE,text:f.trim()});break;default:i.lines.push({kind:C5.CONTEXT,text:d===` `?f:e,oldNumber:a,newNumber:o}),a+=1,o+=1}}return c(),n}function E5(e){return e.hunks.reduce((e,t)=>e+t.lines.length+1,0)}function POe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_IMAGE,`AI_Image`)(e);return(0,$.jsx)(n,{...t})}var D5=Qs(B.LOW_LEVEL_AI_WEB_PREVIEW,`AI_WebPreview`,[`Navigation`,`NavigationButton`,`Url`,`Body`,`Console`]);function FOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n,{...t})}function IOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Navigation,{...t})}function LOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.NavigationButton,{...t})}function ROe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Url,{...t})}function zOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Body,{...t})}function BOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Console,{...t})}var O5=Qs(B.LOW_LEVEL_AI_CONVERSATION,`AI_Conversation`,[`Content`,`EmptyState`,`ScrollButton`]);function k5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n,{...t})}function A5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.Content,{...t})}function j5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.EmptyState,{...t})}function M5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.ScrollButton,{...t})}var N5=Qs(B.LOW_LEVEL_AI_PROMPT_INPUT,`AI_PromptInput`,`Provider.Attachment.Attachments.Body.Textarea.Header.Footer.Tools.Button.Submit.ActionMenu.ActionMenuTrigger.ActionMenuContent.ActionMenuItem.ActionAddAttachments.SpeechButton.Select.SelectTrigger.SelectContent.SelectItem.SelectValue.Command.CommandInput.CommandList.CommandEmpty.CommandGroup.CommandItem.CommandSeparator.HoverCard.HoverCardTrigger.HoverCardContent.TabsList.Tab.TabLabel.TabBody.TabItem`.split(`.`));function P5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n,{...t})}function VOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Provider,{...t})}function HOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Attachment,{...t})}function UOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Attachments,{...t})}function WOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Body,{...t})}function F5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Textarea,{...t})}function GOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Header,{...t})}function I5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Footer,{...t})}function KOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Tools,{...t})}function qOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Button,{...t})}function L5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Submit,{...t})}function JOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenu,{...t})}function YOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuTrigger,{...t})}function XOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuContent,{...t})}function ZOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuItem,{...t})}function QOe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionAddAttachments,{...t})}function $Oe({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SpeechButton,{...t})}function eke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Select,{...t})}function tke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectTrigger,{...t})}function nke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectContent,{...t})}function rke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectItem,{...t})}function ike({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectValue,{...t})}function ake({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Command,{...t})}function oke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandInput,{...t})}function ske({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandList,{...t})}function cke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandEmpty,{...t})}function lke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandGroup,{...t})}function uke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandItem,{...t})}function dke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandSeparator,{...t})}function fke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCard,{...t})}function pke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCardTrigger,{...t})}function mke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCardContent,{...t})}function hke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabsList,{...t})}function gke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Tab,{...t})}function _ke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabLabel,{...t})}function vke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabBody,{...t})}function yke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabItem,{...t})}var R5=Qs(B.LOW_LEVEL_AI_SOURCES,`AI_Sources`,[`Trigger`,`Content`,`Source`]);function z5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n,{...t})}function B5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Trigger,{...t})}function V5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Content,{...t})}function H5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Source,{...t})}function U5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SUGGESTIONS,`AI_Suggestions`)(e);return(0,$.jsx)(n,{...t})}function W5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SUGGESTION,`AI_Suggestion`)(e);return(0,$.jsx)(n,{...t})}function bke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONFIRMATION,`AI_Confirmation`)(e);return(0,$.jsx)(n,{...t})}var G5=Qs(B.LOW_LEVEL_AI_QUEUE,`AI_Queue`,[`List`,`Item`,`ItemIndicator`,`ItemContent`,`ItemDescription`,`ItemActions`,`ItemAction`,`ItemAttachment`,`ItemImage`,`ItemFile`,`Section`,`SectionTrigger`,`SectionLabel`,`SectionContent`,`TodoItem`,`MessageItem`]);function xke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n,{...t})}function Ske({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.List,{...t})}function Cke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Item,{...t})}function wke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemIndicator,{...t})}function Tke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemContent,{...t})}function Eke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemDescription,{...t})}function Dke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemActions,{...t})}function Oke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemAction,{...t})}function kke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemAttachment,{...t})}function Ake({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemImage,{...t})}function jke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemFile,{...t})}function Mke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Section,{...t})}function Nke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionTrigger,{...t})}function Pke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionLabel,{...t})}function Fke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionContent,{...t})}function Ike({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.TodoItem,{...t})}function Lke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.MessageItem,{...t})}var K5=Qs(B.LOW_LEVEL_AI_TASK,`AI_Task`,[`Trigger`,`Content`,`Item`,`ItemFile`]);function Rke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n,{...t})}function zke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Trigger,{...t})}function Bke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Content,{...t})}function Vke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Item,{...t})}function q5({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.ItemFile,{...t})}var J5=Qs(B.LOW_LEVEL_AI_TOOL,`AI_Tool`,[`Header`,`Content`,`Input`,`Output`]);function Y5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n,{...t})}function X5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Header,{...t})}function Z5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Content,{...t})}function Q5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Input,{...t})}function $5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Output,{...t})}function Hke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_EXECUTION_STREAM,`AI_ExecutionStream`)(e);return(0,$.jsx)(n,{...t})}function Uke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONNECTION,`AI_Connection`)(e);return(0,$.jsx)(n,{...t})}function Wke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_EDGE,`AI_Edge`)(e);return(0,$.jsx)(n,{...t})}function e7({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_PANEL,`AI_Panel`)(e);return(0,$.jsx)(n,{...t})}function Gke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_TOOLBAR,`AI_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function Kke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONTEXT,`AI_Context`)(e);return(0,$.jsx)(n,{...t})}function qke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_MODEL_SELECTOR,`AI_ModelSelector`)(e);return(0,$.jsx)(n,{...t})}function Jke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_OPEN_IN_CHAT,`AI_OpenInChat`)(e);return(0,$.jsx)(n,{...t})}function Yke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_LOADER,`AI_Loader`)(e);return(0,$.jsx)(n,{...t})}function t7({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SHIMMER,`AI_Shimmer`)(e);return(0,$.jsx)(n,{...t})}var n7=Qs(B.LOW_LEVEL_AI_CHAIN_OF_THOUGHT,`AI_ChainOfThought`,[`Header`,`Step`,`SearchResults`,`SearchResult`,`Content`,`Image`]);function r7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n,{...t})}function i7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Header,{...t})}function a7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Step,{...t})}function Xke({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.SearchResults,{...t})}function Zke({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.SearchResult,{...t})}function o7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Content,{...t})}function Qke({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Image,{...t})}function $ke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CHECKPOINT,`AI_Checkpoint`)(e);return(0,$.jsx)(n,{...t})}function eAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_INLINE_CITATION,`AI_InlineCitation`)(e);return(0,$.jsx)(n,{...t})}var s7=Qs(B.LOW_LEVEL_AI_PLAN,`AI_Plan`,[`Header`,`Trigger`,`Content`,`Title`,`Description`,`Action`,`Footer`]);function tAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n,{...t})}function nAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Header,{...t})}function rAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Trigger,{...t})}function iAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Content,{...t})}function aAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Title,{...t})}function oAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Description,{...t})}function sAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Action,{...t})}function cAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Footer,{...t})}var c7=Qs(B.LOW_LEVEL_AI_REASONING,`AI_Reasoning`,[`Trigger`,`Content`]);function l7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n,{...t})}function u7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Trigger,{...t})}function d7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Content,{...t})}function f7(){let e=oh(),t=mg(),n=Fl[po.HOME].route,{navigate:r}=DS(),{isNavigationItemActive:i}=zx(),{emit:a}=Mo();return{isNavigationItemActive:i,handleNavigationClick:(0,Q.useCallback)((e,t)=>{dh.dispatchNavigationForItem(r,e,t)},[r]),handleHomeClick:(0,Q.useCallback)(()=>{Vh({emit:a,routerNavigate:e,homePath:n})},[a,e,n]),isHomeActive:(0,Q.useMemo)(()=>{let e=t.pathname;return e===n||n===`/`&&e===``},[t.pathname,n])}}function lAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uAe(e){switch(e){case Ca.VERTICAL_RAIL:return{direction:Sc.VERTICAL,borderSide:$s.END,tooltipSide:$s.END,orientation:Sc.VERTICAL};case Ca.HORIZONTAL_BAR:return{direction:Sc.HORIZONTAL,borderSide:$s.BOTTOM,tooltipSide:$s.TOP,orientation:Sc.HORIZONTAL};case Ca.BOTTOM_TAB_BAR:return{direction:Sc.HORIZONTAL,borderSide:$s.TOP,tooltipSide:$s.TOP,orientation:Sc.HORIZONTAL};default:return{direction:Sc.VERTICAL,borderSide:$s.END,tooltipSide:$s.END,orientation:Sc.VERTICAL}}}function p7(){let{UIConfig:e,appComponentsConfiguration:t}=Wg(),n=rS(),r=t?.[Fr.ACTIVITY_BAR],i=e?.currentBreakpoint===Sl.MOBILE,a=(0,Q.useMemo)(()=>lAe(r)?i?r.mobileRendering??Ca.BOTTOM_TAB_BAR:r.desktopRendering??Ca.VERTICAL_RAIL:i?Ca.BOTTOM_TAB_BAR:Ca.VERTICAL_RAIL,[r,i]),o=(0,Q.useMemo)(()=>uAe(a),[a]);return{availableModes:(0,Q.useMemo)(()=>n?.availableModes??[],[n?.availableModes]),activeMode:n?.activeMode??null,setActiveMode:n?.setActiveMode??(()=>{}),hasModes:n?.hasModes??!1,activeRenderingMode:a,layout:o,isNavigationLoading:!n}}var m7=`engine:primary`;function h7(){return{requiredCapabilities:[Gv.ANSWERER]}}function g7(e,t){return(e??[]).some(e=>e.kind===hu.ENGINE_PAGE&&e.pageRef===t||g7(e.children,t))}function dAe(e,t){if(!t||(e??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&g7(e.children,po.DECISIONS)))return e;let n={kind:hu.ENGINE_PAGE,pageRef:po.DECISIONS,runtimeAvailability:h7()},r=(e??[]).findIndex(e=>e.contentKind===ze.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:ze.NAVIGATION_LIST,ref:m7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e;return{...i,children:[n,...i.children]}})}function fAe(e,t){return!t||(e??[]).some(e=>e.kind===hu.ENGINE_PAGE&&e.pageRef===po.DECISIONS)?e:[...e??[],{kind:hu.ENGINE_PAGE,pageRef:po.DECISIONS,runtimeAvailability:h7()}]}function _7(){return{kind:hu.RESOURCE_OPERATION,resourceType:ul.ORGANIZATION_REPRESENTATIONS,operation:W.LIST,runtimeAvailability:{requiredCapabilities:[vv.REPRESENTS]}}}function v7(e){return(e??[]).some(e=>e.kind===hu.RESOURCE_OPERATION&&e.resourceType===ul.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST||v7(e.children))}function pAe(e,t){if(t?.includes(om.CLIENTS)||(e??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&v7(e.children)))return e;let n=_7(),r=(e??[]).findIndex(e=>e.contentKind===ze.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:ze.NAVIGATION_LIST,ref:m7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e,a=i.children.findIndex(e=>e.kind!==hu.ENGINE_PAGE||e.pageRef!==po.DECISIONS),o=a===-1?i.children.length:a;return{...i,children:[...i.children.slice(0,o),n,...i.children.slice(o)]}})}function mAe(e,t){return t?.includes(om.CLIENTS)||(e??[]).some(e=>e.kind===hu.RESOURCE_OPERATION&&e.resourceType===ul.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST)?e:[...e??[],_7()]}var y7=as.getLogger(),b7=y7.debugByType(`SidebarBehavior`);y7.setDebugTypeLogging(`SidebarBehavior`,!1);var x7=[Sl.MOBILE,Sl.VERT_TABLET,Sl.DESKTOP];function S7(e,t){return x7.indexOf(e)<=x7.indexOf(t)}function C7(e,t){if(e===!1||!t)return!1;let n=o2(e)?e:void 0;return(n?.policy??Nu.BURGER)===Nu.BURGER&&S7(t,n?.responsiveBreakpoint??Sl.MOBILE)}function w7(){let{UIConfig:e,appComponentsConfiguration:t}=Wg(),n=t?.[Fr.SIDEBAR];return n!==!1&&n!==void 0&&C7(n,e?.currentBreakpoint)}function hAe(){let e=Ys(ms.SIDEBAR_COLLAPSED);return e===null?null:e===`true`}function T7(e={}){let{placement:t=Qc.START,isCollapsed:n,onToggleCollapse:r}=e,i=f7(),{isNavigationItemActive:a}=i,o=I$(),s=Zp(),c=yS(),{UIConfig:l,appComponentsConfiguration:u,sidebarCompactLabelMode:d,navigationLayout:f,suppressedEngineNavigationEntries:p}=Wg(),{navigate:m,navigateToResource:h}=DS(),{registry:g}=fm(),_=u?.[Fr.SIDEBAR],v=_!==!1,y=l?.currentBreakpoint,{on:b}=Mo(),x=Ou().appConfig.decisionInbox,S=o2(_)?_.contentSections:void 0,C=(0,Q.useMemo)(()=>v?pAe(dAe(S,x),p):S,[v,S,x,p]),w=o2(_)?_.defaultSection:void 0,T=(o2(_)?_.homeDisplayMode:void 0)??Ku.NAVIGATION_ITEM,E=g2({theme:o2(_)?_.brandMarkTheme:void 0}),D=T===Ku.BRAND_HEADER?E:void 0,O=(0,Q.useMemo)(()=>{let e=o2(_)?_.hostedComponents:void 0;return v2(Fr.SIDEBAR,e,u,y,ol.TOP,f)},[_,u,y,f]),k=c.activeMode,A=c.availableModes,j=c.allScopeValues,M=(0,Q.useMemo)(()=>{if(!C)return;let e=X3(j,k,A);return qle(Y3(C,k,e,xa.isDevelopment()),c)},[C,k,A,j,c]);(0,Q.useEffect)(()=>{if(!xa.isDevelopment()||!C||!window.__WILDO_DEBUG_SIDEBAR__)return;let e=X3(j,k,A);Z3(C,k,e)},[C,k,A,j]);let N=(0,Q.useRef)(hAe()),P=o2(_)?_.defaultCollapsed:void 0,[F,I]=(0,Q.useState)(N.current),ee=F??P??!1,L=(0,Q.useCallback)(e=>{I(e),co(ms.SIDEBAR_COLLAPSED,String(e))},[]),R=n===void 0?ee:n,z=v&&C7(_,y),[te,ne]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{z||ne(!1)},[z]);let[re,ie]=(0,Q.useState)(()=>{try{let e=localStorage.getItem(ms.SIDEBAR_SECTION_COLLAPSED);return e?JSON.parse(e):{}}catch{return{}}}),[ae,oe]=(0,Q.useState)({}),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(``),[de,fe]=(0,Q.useState)(()=>{try{let e=Ys(ms.SIDEBAR_FAVORITES),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}});(0,Q.useEffect)(()=>{co(ms.SIDEBAR_FAVORITES,JSON.stringify(de))},[de]),(0,Q.useEffect)(()=>{try{localStorage.setItem(ms.SIDEBAR_SECTION_COLLAPSED,JSON.stringify(re))}catch{}},[re]);let pe=(0,Q.useMemo)(()=>{let e=y===Sl.MOBILE,t=o2(_)?_:void 0,n=d===hie.ICON_AND_LABEL;return{width:e?t?.mobileWidth??280:t?.width??256,collapsedWidth:e?t?.mobileCollapsedWidth??(n?80:56):t?.collapsedWidth??(n?88:64)}},[y,_,d]),me=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let e=o2(_)?_:void 0;if(e?.policy!==Nu.DRAWER||!y)return;let t=e.responsiveBreakpoint??Sl.MOBILE,r=S7(y,t),i=me.current;me.current=r,i===!0&&!r&&n===void 0&&L(!1)},[y,_,n,L]);let he=(0,Q.useMemo)(()=>!M||!o?[]:Vm(M,o),[M,o]),ge=(0,Q.useMemo)(()=>{let e=he.map((e,t)=>gAe(e,t)),t=new Map,n=e=>{for(let r of e)t.has(r.id)||t.set(r.id,r),r.children?.length&&n(r.children)};for(let t of e)t.contentKind===ze.NAVIGATION_LIST&&t.section.behavior!==it.FAVORITES&&(n(t.items),n(t.moreMenuItems));let r=e.map(e=>{if(e.contentKind!==ze.NAVIGATION_LIST||e.section.behavior!==it.FAVORITES)return e;let n=de.map(e=>t.get(e)).filter(e=>e!==void 0).map(e=>({...e,id:`favorite-${e.id}`,favoriteId:e.id,children:void 0}));return{...e,items:n}}).filter(e=>e.contentKind!==ze.NAVIGATION_LIST||e.items.length>0||e.moreMenuItems.length>0||e.section.inlineCreate!==wc.NONE),i=e=>e.section.isPrimary?0:e.section.behavior===it.FAVORITES?1:2;return r.map((e,t)=>({group:e,declaredIndex:t})).sort((e,t)=>i(e.group)-i(t.group)||e.declaredIndex-t.declaredIndex).map(e=>e.group)},[he,de]),_e=(0,Q.useMemo)(()=>{let e=[],t=n=>{for(let r of n)r.urlPath&&e.push({id:r.id,urlPath:r.urlPath}),r.children?.length&&t(r.children)};for(let e of ge)t(e.items),t(e.moreMenuItems);return e},[ge]),ve=(0,Q.useMemo)(()=>dh.getMostSpecificActiveRoute(_e.map(e=>e.urlPath),a),[_e,a]),ye=(0,Q.useMemo)(()=>{if(ve)return _e.find(e=>e.urlPath===ve)?.id},[_e,ve]),be=(0,Q.useCallback)(e=>!!ye&&e.id===ye,[ye]),xe=!z&&R,Se=(0,Q.useMemo)(()=>({isCollapsible:!o2(_)||_.collapsible!==!1,responsivePolicy:o2(_)?_.policy:Nu.BURGER,currentWidth:xe?pe.collapsedWidth:pe.width}),[_,xe,pe]),Ce=(0,Q.useCallback)(()=>{z?ne(e=>!e):r?r():L(!R)},[z,R,r,L]),we=(0,Q.useCallback)(()=>{ne(!1)},[]),Te=(0,Q.useRef)(Ce);Te.current=Ce,(0,Q.useEffect)(()=>{if(v)return b(Ec.HOTKEY_SIDEBAR_TOGGLE,()=>{Te.current()})},[b,v]);let Ee=(0,Q.useCallback)((e,t)=>{ie(n=>({...n,[e]:t}))},[]),De=(0,Q.useCallback)(e=>{if(!e.collapsible)return!1;let t=re[e.ref];return t===void 0?w&&e.ref===w?!1:e.defaultCollapsed??!1:t},[re,w]),Oe=(0,Q.useCallback)(e=>{oe(t=>({...t,[e]:!t[e]}))},[]),ke=(0,Q.useCallback)(e=>{b7(`handleNavigationClick`,{itemId:e.id,itemLabel:e.label,urlPath:e.urlPath}),i.handleNavigationClick(e,Fr.SIDEBAR),z&&ne(!1)},[i.handleNavigationClick,z]),Ae=(0,Q.useCallback)(()=>{b7(`handleHomeClick: START`),i.handleHomeClick(),z&&ne(!1),b7(`handleHomeClick: DONE`)},[i.handleHomeClick,z]),je=(0,Q.useCallback)(e=>{ce(e),ue(``)},[]),Me=(0,Q.useCallback)(()=>{ce(null),ue(``)},[]),Ne=(0,Q.useCallback)((e,t)=>{if(!t)return;let n=(o2(_)?_.contentSections:void 0)?.find(t=>t.ref===e),r=n?.contentKind===ze.NAVIGATION_LIST&&n.inlineCreate===wc.DIALOG;if(!r&&!le.trim())return;let i=(n?.contentKind===ze.NAVIGATION_LIST?n.inlineCreateField:void 0)??`title`,a=g.resourceConfigurations[t],o=a?.operations?.find(e=>String(e.operationIdentifier)===W.CREATE);if(!a||!o)return;let c=On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:o,contextResourceIdentifiers:s?.buildContextResourceIdentifiers()??{},...r?{}:{additionalContext:{defaultValuesOverride:{[i]:le.trim()}}}});r?h(c,dh.createAppLevelInitiator(Fr.SIDEBAR),void 0,Rt.OVERLAY):(m({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:c},initiator:dh.createAppLevelInitiator(Fr.SIDEBAR)}),Me())},[le,m,h,Me,_,g,s]),Pe=(0,Q.useCallback)(e=>ae[e]??!1,[ae]),Fe=(0,Q.useCallback)(e=>de.includes(e.favoriteId??e.id),[de]),B=(0,Q.useCallback)(e=>{let t=e.favoriteId??e.id;fe(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},[]),Ie=(0,Q.useMemo)(()=>(M??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&e.behavior===it.FAVORITES),[M]);return{groupedSections:ge,hostedComponents:O,isCollapsed:xe,isHomeActive:i.isHomeActive,dimensions:pe,sidebarConfig:Se,isNavigationLoading:!o,hasItems:ge.length>0||T===Ku.NAVIGATION_ITEM,placement:t,isMobileDrawerMode:z,isMobileDrawerOpen:te,closeMobileDrawer:we,homeDisplayMode:T,brandHeader:D,isNavigationItemActive:be,isSectionCollapsed:De,isItemCollapsed:Pe,handleNavigationClick:ke,handleHomeClick:Ae,handleToggleCollapse:Ce,handleSetSectionCollapsed:Ee,handleToggleItemCollapse:Oe,isItemFavorite:Fe,handleToggleItemFavorite:B,hasFavoritesSection:Ie,inlineCreate:{activeSection:se,value:le,start:je,cancel:Me,submit:Ne,setValue:ue}}}function gAe(e,t){let n={ref:e.ref,label:e.label,showLabel:e.showLabel!==!1,collapsible:e.collapsible??!1,defaultCollapsed:e.defaultCollapsed??!1,behavior:it.STATIC,inlineCreate:wc.NONE,nested:!1,maxNestingDepth:1};switch(e.contentKind){case ze.NAVIGATION_LIST:{let t={...n,behavior:e.behavior??it.STATIC,inlineCreate:e.inlineCreate??wc.NONE,inlineCreateResourceType:e.inlineCreateResourceType,nested:e.nested??!0,maxNestingDepth:e.maxNestingDepth??1,isPrimary:e.isPrimary??!1,...e.isPrimary?{showLabel:!1,collapsible:!1}:{}},r=E7(e.items.map(e=>D7(e)).filter(e=>e!==null),t.nested??!0,t.maxNestingDepth??1);return{section:t,items:r.filter(e=>e.displayPolicy!==dn.SECTION_MORE_MENU),moreMenuItems:r.filter(e=>e.displayPolicy===dn.SECTION_MORE_MENU),contentKind:ze.NAVIGATION_LIST}}case ze.RESOURCE_BROWSER:return{section:n,items:[],moreMenuItems:[],contentKind:ze.RESOURCE_BROWSER,resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant,navigateOperation:e.navigateOperation,navigateOperationVariant:e.navigateOperationVariant,instanceFilter:e.instanceFilter,onInstanceClick:e.onInstanceClick};case ze.GUIDANCE_WIDGET:return{section:n,items:[],moreMenuItems:[],contentKind:ze.GUIDANCE_WIDGET,guidanceRef:e.guidanceRef};case ze.CUSTOM_COMPONENT:return{section:n,items:[],moreMenuItems:[],contentKind:ze.CUSTOM_COMPONENT,componentRef:e.componentRef}}}function E7(e,t,n){let r=t?Math.max(1,Math.floor(n)):0,i=e=>e.flatMap(e=>[{...e,children:void 0},...i(e.children??[])]),a=(e,t)=>e.flatMap(e=>{let n=e.children??[];return n.length===0?[e]:t===0?[{...e,children:void 0},...i(n)]:[{...e,children:a(n,t-1)}]});return a(e,r)}function _Ae(e,t){y7.warn(`Navigation item "${e.id}" ${t} — dropped from the sidebar`,{itemId:e.id,ref:e.ref,contentType:e.contentType})}function D7(e){let t={id:e.id,ref:e.ref,label:e.label,urlPath:e.urlPath,iconReference:e.iconReference,displayPolicy:e.displayPolicy,notificationBadgeRef:e.notificationBadgeRef,children:e.children?.map(D7).filter(e=>e!==null)};return e.operation&&e.resourceContext?(xa.isDevelopment()&&(e.resourceType||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing resourceType`),e.operationIdentifier||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing operationIdentifier`)),{...t,itemType:ra.RESOURCE,resourceType:e.resourceType??``,operationIdentifier:e.operationIdentifier??``,operation:e.operation,resourceContext:e.resourceContext}):e.contentType===sd.ENGINE_PAGE?e.pageRef?{...t,itemType:ra.ENGINE_PAGE,pageRef:e.pageRef}:(_Ae(e,"declares contentType ENGINE_PAGE with no `pageRef`"),null):e.contentType===sd.SETTINGS_HUB?{...t,itemType:ra.SETTINGS_HUB,sectionRef:e.sectionRef}:e.componentRef?{...t,itemType:ra.CUSTOM_COMPONENT,componentRef:e.componentRef,contextResourceIdentifiers:e.contextResourceIdentifiers}:{...t,itemType:ra.VIEW,viewRef:e.viewRef??e.ref,contentType:e.contentType??sd.COMPOSITE_VIEW,contextResourceIdentifiers:e.contextResourceIdentifiers,flowsActorsSystemRef:e.flowsActorsSystemRef,fullCustomComponentRef:e.fullCustomComponentRef,requiredFeatures:e.requiredFeatures}}function O7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k7(e={}){let{mode:t}=e,{UIConfig:n,appComponentsConfiguration:r,navigationLayout:i,homeDefinition:a}=Wg(),o=I$(),{navigate:s}=DS(),c=yS(),{isNavigationItemActive:l,isHomeActive:u,handleHomeClick:d}=f7(),f=a?.compositeViewReference,p=r?.[Fr.MENUBAR],m=n?.currentBreakpoint,h=g2({theme:O7(p)?p.brandMarkTheme:void 0}),g=O7(p)&&p.brandHeader===!0?h:void 0,_=(0,Q.useMemo)(()=>O7(p)?v2(Fr.MENUBAR,p.hostedComponents,r,m,Qc.START,i):[],[r,p,m,i]),v=(0,Q.useMemo)(()=>O7(p)?$le(p.items,c):void 0,[p,c]);return{containerComponents:_,brandHeader:g,isHomeActive:u,handleHomeClick:d,items:(0,Q.useMemo)(()=>{if(!o||!v?.length)return[];let e=Xm(void 0,v,o),t=dh.getMostSpecificActiveRoute(e.items.map(e=>e.urlPath),l),n=e=>u&&f!==void 0&&e.viewRef===f;return e.items.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,group:e.group,isActive:t!==void 0&&e.urlPath===t||n(e),...e.notificationBadgeRef?{notificationBadgeRef:e.notificationBadgeRef}:{},onExecute:()=>{dh.dispatchNavigationForResolvedTarget(s,e,Fr.MENUBAR)}}))},[v,o,s,l,u,f]),menubarConfig:(0,Q.useMemo)(()=>{let e=t||(O7(p)?p.displayPolicy??`FIXED`:typeof p==`string`?p:`FIXED`),n=e===`OVERLAY`;return{mode:e,isOverlay:n,showMobileLayout:m===Sl.MOBILE&&n}},[p,t,m]),mapToFrontendComponentType:p2}}function A7(e,t){if(!e)return;let n=e.resourceConfigurations[t.resourceType];if(!n?.mainSchema)return;let r=V.resolveFieldShapeOfAnyVariant(n),i=r?.[t.fieldIdentifier];if(i)return{schema:i,isPrimaryKeyFallback:!1};if(t.fieldIdentifier!==n.resourceFieldIdentifier)return;let a=r?._id??r?.id;return a?{schema:a,isPrimaryKeyFallback:!0}:void 0}function j7(e={}){let t=Zp(),{on:n}=Mo(),{registry:r}=fm(),[i,a]=(0,Q.useState)(0),o=e.focusTrigger??i;(0,Q.useEffect)(()=>{if(e.focusTrigger===void 0)return n(Ec.HOTKEY_QUICK_SWITCHER_OPEN,()=>{a(e=>e+1)})},[n,e.focusTrigger]);let s=Fw({mode:`onChange`,defaultValues:t?.customScopeValues??{}}),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)((e,t)=>e==null?t?[]:void 0:Array.isArray(e)?t?e:e[0]:t?[e]:e,[]),u=(0,Q.useMemo)(()=>t?.customScopeFields?[...t.customScopeFields].sort((e,t)=>(e.position??999)-(t.position??999)):[],[t?.customScopeFields]),d=(0,Q.useMemo)(()=>{let e=new Map;if(!r)return e;for(let t of u){let n=A7(r,t);n&&e.set(t.fieldIdentifier,n)}return e},[u,r]);(0,Q.useEffect)(()=>{if(t?.customScopeValues){c.current=!0;for(let e of t.customScopeFields){let n=e.fieldIdentifier,r=t.customScopeValues[n],i=s.getValues(n),a=d.get(n)?.schema,o=a?me(a)===vu.ARRAY:Array.isArray(r),c=l(r??null,o);JSON.stringify(i)!==JSON.stringify(c)&&s.setValue(n,c)}queueMicrotask(()=>{c.current=!1})}},[t?.customScopeValues,t?.customScopeFields,s,l,d]);let f=(0,Q.useMemo)(()=>{let e=new Set;for(let t of u)e.add(t.resourceType);return Array.from(e)},[u]),{tResourceHeader:p}=K({component:B.APPLICATION_LEVEL_QUICK_SWITCHER,resource:f}),m=(0,Q.useMemo)(()=>u.map(e=>e.fieldIdentifier),[u]),h=VC({control:s.control,name:m});(0,Q.useEffect)(()=>{c.current||m.forEach((e,n)=>{let r=h[n],i=t?.customScopeValues[e],a=d.get(e)?.schema,o=a?me(a)===vu.ARRAY:!1,s;if(r===void 0||r===``||r===null)s=null;else if(o){let e=Array.isArray(r)?r.filter(e=>typeof e==`string`&&e.length>0):[String(r)];s=e.length>0?e:null}else s=Array.isArray(r)?r[0]??null:String(r);JSON.stringify(s)!==JSON.stringify(i??null)&&t?.setScopeValue(e,s,{initiator:At.USER_SELECTION})})},[h,m,t,u,d]);let g=(0,Q.useCallback)(e=>{let n=e.dependsOn?t?.allScopeValues?.[e.dependsOn]:null;return e.dependsOn?Array.isArray(n)?n.length===0:!n:!1},[t?.allScopeValues]);return{fields:(0,Q.useMemo)(()=>u.flatMap(e=>{let t=e.fieldIdentifier,n=d.get(t);if(!n)return xa.isDevelopment()&&console.warn(`[QuickSwitcher] No schema found for scope field "${t}" — field will not render.`),[];let{schema:r,isPrimaryKeyFallback:i}=n,a=me(r)===vu.ARRAY,o=a?Ma(r)??r:r,c=me(o),l=Io(o)||i?l2.RESOURCE_REFERENCE:c===vu.ENUM?l2.ENUM:l2.RAW,u=p(e.resourceType,`title`),f=e.label||u||t;return[{fieldId:t,label:f,schema:r,valueSchema:o,disabled:g(e),isMultiple:a,controlKind:l,targetResourceType:i?e.resourceType:void 0,placeholder:u||f,optionDisplayMode:e.optionDisplayMode??Kl,presentation:e.presentation??Jp.CONTROL_ONLY,onClear:()=>s.setValue(t,a?[]:void 0,{shouldDirty:!0,shouldTouch:!0}),hasValue:(()=>{let e=s.getValues(t);return Array.isArray(e)?e.length>0:e!=null&&e!==``})(),definition:e}]}),[u,d,p,g,s,h]),formMethods:s,layoutDirection:(0,Q.useMemo)(()=>e.containerType===Fr.SIDEBAR?`vertical`:`horizontal`,[e.containerType]),focusTrigger:o}}function M7(e=ol.BOTTOM){let{UIConfig:t,appComponentsConfiguration:n,shellAppearance:r}=Wg(),{tComponent:i}=K({component:B.APPLICATION_LEVEL_STATUS_BAR}),{status:a}=up(),{notifications:o}=Fm(),s=n?.[Fr.STATUS_BAR],c=t?.currentBreakpoint,l=s2(s)?s:void 0,u=l?.showConnectionStatus??!0,d=l?.showConnectionStatusOnMobile??!1,f=l?.showNotificationCount??!0,p=l?.showMemoryUsage??!1,m=(0,Q.useMemo)(()=>f?o.length:0,[f,o.length]),h=(0,Q.useMemo)(()=>(l?.statusItems??[]).map(e=>{let t=e.value==null?void 0:String(e.value);switch(e.type){case $i.LINK:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:u2.LINK,href:e.href}};case $i.BUTTON:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:u2.BUTTON,onClick:e.onClick}};case $i.TEXT:default:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:u2.STATIC}}}}),[l]),g=(0,Q.useMemo)(()=>{if(!l)return;let{backgroundClassName:e,textClassName:t,style:n}=l;if(e!==void 0||t!==void 0||n!==void 0)return{backgroundClassName:e,textClassName:t,style:n}},[l]),_=(0,Q.useMemo)(()=>{let e=c===Sl.MOBILE;return{height:l?.height??(e?28:32)}},[c,l]),v=(0,Q.useMemo)(()=>{let t=e===ol.TOP,n=e===ol.BOTTOM,i=c===Sl.MOBILE,a=r===Qo.CONTINUOUS;return{isTop:t,isBottom:n,isMobile:i,isContinuousShell:a,showBorder:l?.showBorder??!a}},[e,c,l,r]),y=(0,Q.useMemo)(()=>{let e=c===Sl.MOBILE;return u&&(!e||d)},[c,u,d]),b=f&&m>0,x=(0,Q.useMemo)(()=>!p||typeof performance>`u`||!(`memory`in performance)?null:`${Math.round((performance.memory?.usedJSHeapSize??0)/1048576)}MB`,[p]),S=(0,Q.useMemo)(()=>Jt(m),[m]);return{totalBadgeCount:m,connectionStatus:a,showConnectionStatus:u,showConnectionStatusOnMobile:d,shouldShowConnectionStatus:y,showNotificationCount:f,shouldShowNotificationCount:b,showMemoryUsage:p,memoryUsageLabel:x,notificationCountLabel:S,notificationCountAriaLabel:(0,Q.useMemo)(()=>i(B.APPLICATION_LEVEL_STATUS_BAR,`notificationCount`,{count:S}),[S,i]),connectionStatusLabel:(0,Q.useMemo)(()=>{switch(a){case $p.CONNECTED:return i(B.APPLICATION_LEVEL_STATUS_BAR,`connected`);case $p.CONNECTING:case $p.RECONNECTING:return i(B.APPLICATION_LEVEL_STATUS_BAR,`reconnecting`);case $p.DISCONNECTED:case $p.ERROR:default:return i(B.APPLICATION_LEVEL_STATUS_BAR,`disconnected`)}},[a,i]),statusItems:h,dimensions:_,statusBarConfig:v,authoredAppearance:g,currentBreakpoint:c}}function vAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N7(){let{UIConfig:e,appComponentsConfiguration:t}=Wg(),n=I$(),{navigate:r}=DS(),i=yS(),a=t?.[Fr.TOOLBAR],o=e?.currentBreakpoint,s=o===Sl.MOBILE,c=vAe(a)?a:void 0,l=(0,Q.useMemo)(()=>Xle(c?.tools,i),[c?.tools,i]),u=(0,Q.useMemo)(()=>!l?.length||!n?[]:Wm(l,n),[l,n]),d=(0,Q.useMemo)(()=>u.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,iconOnly:e.iconOnly,onClick:()=>dh.dispatchNavigationForResolvedTarget(r,e,Fr.TOOLBAR)})),[u,r]),f=(0,Q.useMemo)(()=>({placement:c?.placement??`top`,compact:c?.compact??!1,showSeparator:c?.showSeparator??!0,hideOnMobile:c?.hideOnMobile??!1}),[c]);return{tools:d,toolbarConfig:f,shouldRender:d.length>0&&!(s&&f.hideOnMobile),currentBreakpoint:o}}function P7(e){return Fo.isRegistered(e,q.DEFAULT)}function F7(e,t,n=P7){return e.map(e=>{if(e.kind===hu.VIEW){let n=t.includes(e.viewRef);return!n&&typeof console<`u`&&console.warn(`[utility-panel] item "${e.label}" names viewRef "${e.viewRef}", which no declared application-scoped view carries. Declare it in the application's \`flowsActorsViews\`, or the panel has nothing to host for this item.`),{kind:hu.VIEW,viewRef:e.viewRef,resolvedViewRef:n?e.viewRef:null,icon:e.icon,label:e.label}}let r=n(e.componentRef);return!r&&typeof console<`u`&&console.warn(`[utility-panel] item "${e.label}" names componentRef "${e.componentRef}", which has no component registered under the default preset. Register it — an application component through its domain module's \`componentRegistrations\`, an engine one through its preset — or nothing will render for this item.`),{kind:hu.CUSTOM_COMPONENT,componentRef:e.componentRef,resolvedComponentRef:r?e.componentRef:null,icon:e.icon,label:e.label}})}function I7(e){if(e)return pr.map(t=>`${t}:${e.zones[t].stack.map(e=>e.id).join(`,`)}#${e.zones[t].activeTabId??``}`).join(`|`)}function L7(e=Qc.END,t){let{UIConfig:n,appComponentsConfiguration:r,flowsActorsViews:i}=Wg(),[a,o]=(0,Q.useState)(!1),s=I7((0,Q.useContext)(mh)?.state),c=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{a?c.current===void 0?c.current=s:s!==c.current&&o(!1):c.current=void 0},[a,s]);let l=n?.currentBreakpoint,u=r?.[Fr.UTILITY_PANEL],d=c2(u)?u:void 0,f=(0,Q.useMemo)(()=>F7(t??d?.items??[],i?.map(e=>e.ref)??[]),[d,t,i]),p=(0,Q.useMemo)(()=>d?.position??e,[d,e]),m=f.length===1?f[0]:void 0,h=m?.kind===hu.VIEW?qY(m.viewRef):void 0,g=(0,Q.useMemo)(()=>h?[KY({family:au.FLOWS_ACTORS,translationRef:h})]:[],[h]),{tComponent:_,tView:v,isReady:y}=K({component:B.APPLICATION_LEVEL_UTILITY_PANEL,keys:g}),b=h?v(au.FLOWS_ACTORS,h,`title`):m?.kind===hu.CUSTOM_COMPONENT?m.label:yp({tComponent:_,componentType:B.APPLICATION_LEVEL_UTILITY_PANEL,key:`title`}),x=d?.icon??(f.length===1?f[0].icon:void 0);return{isOpen:a,setIsOpen:o,items:f,itemCount:f.length,position:p,triggerIcon:x,panelName:b,isPanelNameReady:y,currentBreakpoint:l}}function yAe(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function R7(e=Qc.END,t=[]){let{UIConfig:n,appComponentsConfiguration:r}=Wg(),i=I$(),{navigate:a}=DS(),{tComponent:o}=K({component:B.APPLICATION_LEVEL_CONTROL_PANEL}),s=yS(),[c,l]=(0,Q.useState)(!1),u=n?.currentBreakpoint,d=r?.[Fr.CONTROL_PANEL],f=typeof d==`object`&&d?d.items:void 0,p=(0,Q.useMemo)(()=>Zle(f,s),[f,s]),m=(0,Q.useMemo)(()=>!p||!i?[]:Pm(p,i),[p,i]),h=(0,Q.useMemo)(()=>{let e={uncategorized:[]};for(let t of m){let n=t.section??`uncategorized`;e[n]||(e[n]=[]),e[n].push(t)}return e},[m]),g=(0,Q.useMemo)(()=>t.map(e=>{let t=!e.onChange;switch(e.type){case d2.BUTTON:return{id:e.id,label:e.label,type:d2.BUTTON,disabled:t,onTrigger:()=>e.onChange?.(!0)};case d2.TOGGLE:{let n=e.value===!0;return{id:e.id,label:e.label,type:d2.TOGGLE,disabled:t,value:n,onToggle:()=>e.onChange?.(!n)}}case d2.SELECT:return{id:e.id,label:e.label,type:d2.SELECT,disabled:t,value:e.value,options:(e.options??[]).map(t=>({label:t.label,value:t.value,isSelected:e.value===t.value,onSelect:()=>e.onChange?.(t.value)}))};case d2.SLIDER:{let n=e.min??0,r=e.max??100,i=e.step??1,a=yAe(e.value,n);return{id:e.id,label:e.label,type:d2.SLIDER,disabled:t,value:a,min:n,max:r,step:i,onValueChange:t=>e.onChange?.(t)}}}}),[t]);return{isOpen:c,setIsOpen:l,groupedItems:h,sections:(0,Q.useMemo)(()=>Object.entries(h).filter(([,e])=>e.length>0).map(([e,t])=>({id:e,label:e===`uncategorized`?o(B.APPLICATION_LEVEL_CONTROL_PANEL,`actions`):o(B.APPLICATION_LEVEL_CONTROL_PANEL,e),items:t})),[h,o]),controls:g,handleItemClick:(0,Q.useCallback)(e=>{l(!1),dh.dispatchNavigationForResolvedTarget(a,e,Fr.CONTROL_PANEL)},[a]),sheetSide:(0,Q.useMemo)(()=>{let t=e;return t===Qc.START?$s.START:t===Qc.END?$s.END:t===ol.TOP?$s.TOP:t===ol.BOTTOM?$s.BOTTOM:$s.END},[e]),isNavigationLoading:!i,navigationItemCount:m.length,currentBreakpoint:u}}function z7(e,t,n,r){let i=B.APPLICATION_LEVEL_NOTIFICATION_CENTER,a=e(i,t,r);return a===`components.${i}.${t}`?n??a:a}function bAe(e,t,n,r){let i=t-e,a=Math.floor(i/6e4),o=Math.floor(i/36e5),s=Math.floor(i/864e5);return a<1?z7(n,`timeJustNow`):a<60?z7(n,`timeMinutesAgo`,void 0,{count:a}):o<24?z7(n,`timeHoursAgo`,void 0,{count:o}):s<7?z7(n,`timeDaysAgo`,void 0,{count:s}):r(e)}function xAe(e){switch(e){case`success`:return H.CHECK_CIRCLE;case`warning`:return H.WARNING;case`error`:return H.X_CIRCLE;default:return H.INFO}}function B7(e,t,n={}){let{notifications:r,clearAll:i,removeNotification:a}=Fm(),{on:o}=Mo(),{tComponent:s,formatDate:c}=K({component:B.APPLICATION_LEVEL_NOTIFICATION_CENTER}),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(()=>Date.now()),p=n.listenForHotkeys!==!1,m=e!==void 0&&t!==void 0,h=m?e:l,g=(0,Q.useRef)(h);g.current=h;let _=(0,Q.useCallback)(e=>{m&&t?t(e):u(e)},[m,t]);(0,Q.useEffect)(()=>{if(p)return o(Ec.HOTKEY_NOTIFICATIONS_OPEN,()=>{_(!g.current)})},[o,p,_]),(0,Q.useEffect)(()=>{let e=globalThis.setInterval(()=>{f(Date.now())},6e4);return()=>globalThis.clearInterval(e)},[]);let v=(0,Q.useMemo)(()=>r.map(e=>{let t=``,n=e.message;return e.source===`resource`&&e.resourceContext?(t=z7(s,`resourceNotificationTitle`,e.resourceContext.resourceType,{resourceType:e.resourceContext.resourceType}),n||=z7(s,`resourceNotificationMessage`,e.resourceContext.operationIdentifier,{operation:e.resourceContext.operationIdentifier})):e.source===`custom`&&e.identifier&&(t=``),!t&&n&&(t=n,n=``),!t&&e.identifier&&(t=e.identifier),t||=s(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`title`),{id:e.id,type:e.type,source:e.source,timestamp:e.timestamp,displayTitle:t,displayMessage:n,relativeTimeLabel:bAe(e.timestamp,d,s,c),iconReference:xAe(e.type),nextStep:e.nextStep}}),[r,s,d,c]),y=(0,Q.useCallback)(e=>{a(e)},[a]);return{isOpen:h,setIsOpen:_,sessionNotifications:v,notificationCount:r.length,handleClearAll:i,dismissNotification:y}}var SAe=[Fn.NAVIGATION,Fn.ACTIONS],V7=0,CAe=1e3,wAe=300,TAe=2,EAe=5,H7=as.getLogger(),DAe={[W.CREATE]:`keywordsCreate`,[W.CREATE_MANY]:`keywordsCreate`,[W.LIST]:`keywordsList`,[W.SEARCH]:`keywordsSearch`,[W.READ]:`keywordsRead`,[W.UPDATE]:`keywordsUpdate`,[W.UPDATE_MANY]:`keywordsUpdate`,[W.DELETE]:`keywordsDelete`,[W.DELETE_MANY]:`keywordsDelete`};function U7(e,t){let n=B.APPLICATION_LEVEL_COMMAND_MENU,r=`components.${n}.${t}`,i=e(n,t);return!i||i===r?[]:i.split(`,`).map(e=>e.trim()).filter(Boolean)}function OAe(e,t){if(!t)return[];let n=vl(t),r=n?DAe[n]:void 0;return r?U7(e,r):[]}function W7(e,t,n){return Nie(n)?t(B.APPLICATION_LEVEL_COMMAND_MENU,n):e(`${ai.COMMAND_CATEGORIES}.${n}.label`)}function G7(e,t,n){return n.category===void 0?e(`${ai.RESOURCES}.${n.resourceType}.header.title`):W7(e,t,n.category)}function kAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K7(e,t,n={}){let r=I$(),{navigate:i,navigateToResource:a}=DS(),{registry:o,doOperation:s}=fm(),c=Zp(),{appComponentsConfiguration:l,suppressedEngineNavigationEntries:u}=Wg(),{on:d,emit:f}=Mo(),{register:p}=M$(),{t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({component:B.APPLICATION_LEVEL_COMMAND_MENU}),v=l?.[Fr.COMMAND_MENU],y=kAe(v)?v:void 0,b=y?.openShortcut,x=y?.showRecent!==!1,S=y?.maxRecentItems??5,C=y?.showShortcuts!==!1,w=y?.defaultCategory??Fn.NAVIGATION,T=y?.categoryOrder??SAe,E=y?.policy===vm.OMNIBOX,D=y?.searchResources,k=y?.dialogWidth,A=yS(),j=(0,Q.useContext)(Fi)?.appConfig?.decisionInbox,M=(0,Q.useMemo)(()=>Jle(mAe(fAe(y?.commands,j),u),A),[y?.commands,j,u,A]),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(``),[ee,L]=(0,Q.useState)([]),R=e!==void 0&&t!==void 0,z=R?e:N,te=(0,Q.useRef)(z);te.current=z;let ne=n.listenForHotkeys!==!1,re=(0,Q.useCallback)(e=>{R&&t?t(e):P(e),e||I(``)},[R,t]);(0,Q.useEffect)(()=>{if(ne)return d(Ec.HOTKEY_COMMAND_MENU_OPEN,()=>{re(!te.current)})},[d,re,ne]),(0,Q.useEffect)(()=>{if(ne&&b&&v!==!1)return p({id:`app-command-menu-open-shortcut`,shortcut:b,description:m(`engine.hotkeys.commandMenuOpen`),scope:ld.GLOBAL,group:yi.NAVIGATION,launcher:Fr.COMMAND_MENU,preventDefault:!0,handler:()=>{f(Ec.HOTKEY_COMMAND_MENU_OPEN,{})}})},[b,v,p,f,m,ne]);let ie=(0,Q.useMemo)(()=>!M||!r?[]:zh(M,r),[M,r]),ae=(0,Q.useMemo)(()=>ie.filter(e=>{let t=e.displayPolicy;return t===void 0||t===Mt.ALWAYS?!0:t===Mt.NEVER?!1:t===Mt.RECENT?!0:t===Mt.CONTEXTUAL?(xa.isDevelopment()&&console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for "${e.id}"`),!1):(xa.isDevelopment()&&console.warn(`[CommandMenu] Unknown displayPolicy "${t}" for command "${e.id}" — treating as ALWAYS`),!0)}).map(e=>({id:e.id,label:e.label,shortcut:e.shortcut??``,iconReference:e.iconReference,category:e.category??w,keywords:[...OAe(h,e.operation),...e.searchKeywords??[]],displayPolicy:e.displayPolicy,onExecute:()=>{re(!1),L(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,S)),e.urlPath&&dh.dispatchNavigationForResolvedTarget(i,e,Fr.COMMAND_MENU)}})),[ie,re,i,S,w,h]),oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of ae){if(t.displayPolicy===Mt.RECENT)continue;let n=t.category,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>e.label.localeCompare(t.label));let t=[];for(let n of T){let r=e.get(n);r&&(t.push({category:n,label:W7(m,h,n),items:r}),e.delete(n))}for(let[n,r]of e.entries())t.push({category:n,label:W7(m,h,n),items:r});return t},[ae,T,m,h]),se=(0,Q.useMemo)(()=>{if(ee.length===0)return[];let e=new Map(ae.map(e=>[e.id,e]));return ee.map(t=>e.get(t)).filter(Boolean)},[ae,ee]),[ce,le]=(0,Q.useState)([]),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(s);fe.current=s;let pe=(0,Q.useRef)(o);pe.current=o;let me=(0,Q.useRef)(c);me.current=c;let he=(0,Q.useRef)(a);he.current=a;let ge=(0,Q.useRef)(re);ge.current=re;let _e=(0,Q.useRef)(m);_e.current=m;let ve=(0,Q.useRef)(g);ve.current=g;let ye=(0,Q.useRef)(_);ye.current=_;let be=(0,Q.useRef)(h);be.current=h;let xe=(0,Q.useRef)(D);xe.current=D;let Se=(0,Q.useRef)(null),Ce=(0,Q.useCallback)(e=>{let t=me.current,n=tm.buildInitiatorIds({userId:t?.currentUserId,organizationId:t?.currentOrganizationId,applicationId:t?.currentApplicationId,anonymousUserId:t?.currentAnonymousUserId});return{...tm.primaryScopeToContextIdentifiers(n,e),...t?.buildContextResourceIdentifiers()??{}}},[]),we=(0,Q.useCallback)((e,t)=>{let n=pe.current,r=n.resourceConfigurations[e];if(!r)return;let i=nu(r.operations??[],W.READ);if(!i){H7.warn(`[CommandMenu] Omnibox result has no addressable READ operation`,{resourceType:e,recordId:t});return}let a=q7({scopeIdentifiers:Ce(r.resourcePrimaryScope),resourceType:e,recordId:t,registry:n}),o=On.buildParentResourcesRequirements(e,a,n),s=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:i,contextResourceIdentifiers:a,parentResourcesRequirements:o});ge.current(!1),he.current(s,dh.createAppLevelInitiator(Fr.COMMAND_MENU))},[Ce]),Te=(0,Q.useMemo)(()=>JSON.stringify(D??[]),[D]),Ee=E&&!!D&&D.length>0;(0,Q.useEffect)(()=>{if(Se.current&&=(clearTimeout(Se.current),null),!z||!Ee||F.trim().length<TAe){le([]),de(!1);return}let e=!1,t=F.trim();de(!0);let n=async()=>{let n=pe.current,r=xe.current??[],i=await Promise.all(r.map(async e=>{let r=n.resourceConfigurations[e.resourceType];if(!r)return H7.warn(`[CommandMenu] Omnibox searchResource not in registry — skipped`,{resourceType:e.resourceType}),null;let i;try{i=V.buildForeignKeySearchOperationPath(e.resourceType,n)}catch{return H7.warn(`[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped`,{resourceType:e.resourceType}),null}let a=V.buildForeignKeySearchParams(t,e.maxResults??EAe,{resourceType:e.resourceType,registry:n}),o;try{o=await fe.current(i,{contextualParameters:Ce(r.resourcePrimaryScope),queryParameters:a.queryParameters,dataMode:a.dataMode})}catch(t){return H7.error(`[CommandMenu] Omnibox search failed`,{resourceType:e.resourceType,...O(t),error:t}),null}let s=[];if(Array.isArray(o))s=o;else if(o&&typeof o==`object`){let e=o;s=e.data??e.items??[]}if(s.length===0)return null;let c=V.getResourceFieldIdentifierForType(e.resourceType,n),l=e.category??e.resourceType,u=e.resultDisplay===tt.LABEL||e.resultDisplay===tt.ID?tt.LABEL:tt.SUMMARY,d=[t,...U7(be.current,`keywordsSearch`),...e.searchKeywords??[]],f=s.flatMap(t=>{let r=V.getResourceObjectId(t,c);if(!r)return[];let i=V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:n,currentObject:t,t:_e.current,formatDate:ve.current,formatDateTime:ye.current})??r;return[{id:`omnibox:${e.resourceType}:${r}`,resourceType:e.resourceType,record:t,label:i,keywords:d,onExecute:()=>we(e.resourceType,r)}]});return f.length===0?null:{category:l,label:G7(_e.current,be.current,e),displayMode:u,items:f}}));e||(le(i.filter(e=>e!==null)),de(!1))};return Se.current=setTimeout(()=>{n()},wAe),()=>{e=!0,Se.current&&=(clearTimeout(Se.current),null)}},[z,F,Ee,Te,Ce,we]);let De=(0,Q.useMemo)(()=>{let e=new Map;return(D??[]).forEach((t,n)=>{let r=t.category??t.resourceType;e.set(r,t.order??V7+n)}),e},[D]),Oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of D??[])e.set(t.category??t.resourceType,t);return e},[D]),ke=(0,Q.useMemo)(()=>ce.map(e=>{let t=Oe.get(e.category);return t?{...e,label:G7(m,h,t)}:e}),[ce,Oe,m,h]);return{isOpen:z,handleOpenChange:re,searchQuery:F,setSearchQuery:I,commandItems:ae,groupedItems:oe,recentItems:se,searchResultGroups:ke,orderedGroups:(0,Q.useMemo)(()=>{let e=[];return ke.forEach((t,n)=>{e.push({kind:f2.RECORDS,order:De.get(t.category)??V7+n,group:t})}),oe.forEach((t,n)=>{e.push({kind:f2.COMMANDS,order:CAe+n,group:t})}),e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)},[ke,oe,De]),isSearching:ue,isNavigationLoading:!r,showRecent:x,showShortcuts:C,openShortcut:b,authoredDialogWidth:k}}function q7(e){return{...zm({hostIdentifiers:e.scopeIdentifiers,hostContextualParameters:{},targetResourceType:e.resourceType,targetId:e.recordId,registry:e.registry}).identifiers,[e.resourceType]:e.recordId}}function AAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J7(){let{UIConfig:e,appComponentsConfiguration:t}=Wg(),n=I$(),{navigate:r}=DS(),i=yS(),a=t?.[Fr.QUICK_ACTION_BUTTON],o=AAe(a)?a:void 0,s=(0,Q.useMemo)(()=>Yle(o?.actions,i),[o?.actions,i]),c=(0,Q.useMemo)(()=>!s?.length||!n?[]:eh(s,n),[s,n]),l=(0,Q.useMemo)(()=>c.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,displayPolicy:e.displayPolicy,onClick:()=>dh.dispatchNavigationForResolvedTarget(r,e,Fr.QUICK_ACTION_BUTTON)})),[c,r]),{primaryAction:u,menuActions:d}=(0,Q.useMemo)(()=>({primaryAction:l.find(e=>e.displayPolicy===he.PRIMARY)??null,menuActions:l.filter(e=>e.displayPolicy!==he.PRIMARY)}),[l]),[f,p]=(0,Q.useState)(!1);return{allItems:l,primaryAction:u,menuActions:d,isOpen:f,setIsOpen:p,handleActionClick:(0,Q.useCallback)(e=>{p(!1),e.onClick()},[]),hasActions:!!s?.length,isNavigationLoading:!!s?.length&&n===null,currentBreakpoint:e?.currentBreakpoint}}function jAe(e){let{registry:t,doOperation:n}=fm(),r=(0,Q.useRef)(n);r.current=n;let i=(0,Q.useRef)(t);i.current=t;let[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(0),m=(0,Q.useMemo)(()=>{let e=t?.resourceConfigurations?.[ul.ORGANIZATIONS]?.operations.find(e=>e.operationIdentifier===W.SEARCH&&e.variantType===at.API_CALL&&e.variantKey===Aee.MINE);return e?Ta.buildOperationPathKeyFromOperation(e):null},[t]),h=a.trim(),g=e&&m!==null&&h.length>=2;return(0,Q.useEffect)(()=>{e||o(``)},[e]),(0,Q.useEffect)(()=>{if(!g||!m){p.current+=1,c(null),u(!1),f(!1);return}let e=++p.current;u(!0);let t=setTimeout(()=>{(async()=>{try{let t=V.buildForeignKeySearchParams(h,20,{resourceType:ul.ORGANIZATIONS,registry:i.current}),n=await r.current(m,{contextualParameters:{},queryParameters:t.queryParameters,dataMode:t.dataMode});if(p.current!==e)return;let a=Array.isArray(n)?n:n?.data??n?.items??[];c(a.filter(e=>!!e&&e._id!==void 0&&e._id!==null&&typeof e.name==`string`).map(e=>({_id:String(e._id),name:e.name}))),f(!1)}catch(t){if(p.current!==e)return;as.getLogger().warn(`[OrganizationSwitcher] Searching the person's own organizations failed`,{error:t}),c([]),f(!0)}finally{p.current===e&&u(!1)}})()},300);return()=>clearTimeout(t)},[g,m,h]),{query:a,setQuery:o,results:s,isSearching:l,failed:d}}function MAe(e){let{httpClient:t}=Ou(),[n,r]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(!e){r(null);return}let n=!1,i=null,a=new AbortController;return t.fetchFileBlob(e,{signal:a.signal}).then(e=>{n||(i=URL.createObjectURL(e),r(i))}).catch(()=>{n||r(null)}),()=>{n=!0,a.abort(),i&&URL.revokeObjectURL(i)}},[e,t]),n}var Y7=Object.freeze([]);function NAe(e){return typeof e==`object`&&!!e}var X7=[sp.USER_INFO,sp.ORG_SWITCHER,sp.SETTINGS,sp.LOGOUT];function Z7(e,t){let{appComponentsConfiguration:n}=Wg(),{user:r,organizations:i,getCurrentOrganization:a,setCurrentOrganization:o,logout:s,isAuthenticated:c,permissions:l}=pg(),{registry:u}=fm(),d=I$(),f=oh(),p=yS(),[m,h]=(0,Q.useState)(!1),g=n?.[Fr.USER_DROPDOWN],_=(0,Q.useMemo)(()=>{let e=NAe(g)?g:void 0;if(e)return{avatarDisplay:e.avatarDisplay??Ip.AVATAR_ONLY,sections:e.sections??X7,showOrgSwitcher:e.showOrgSwitcher??!0,showLogout:e.showLogout??!0,settingsEntries:e.settingsEntries??Y7}},[g]),v=a(),y=_?.sections??X7,b=_?.avatarDisplay??Ip.AVATAR_ONLY,x=_?.showOrgSwitcher!==!1,S=_?.showLogout!==!1,C=_?.settingsEntries??Y7;p.activeMode,p.availableModes,p.allScopeValues;let w=(0,Q.useMemo)(()=>e===Fr.MENUBAR?t===Qc.END?{align:Rr.END,side:$s.BOTTOM}:{align:Rr.START,side:$s.BOTTOM}:e===Fr.SIDEBAR?t===ol.BOTTOM?{align:Rr.END,side:$s.END}:{align:Rr.START,side:$s.END}:{align:Rr.END,side:$s.BOTTOM},[e,t]),T=(0,Q.useMemo)(()=>d?C.flatMap(e=>{let t=Jm({kind:hu.SETTINGS_SECTION,sectionRef:e},d);return t?[t]:[]}):[],[d,C]),E=(0,Q.useMemo)(()=>d?Jm({kind:hu.SETTINGS_SECTION},d):null,[d]),D=r?.userSelfProfile,O=(0,Q.useMemo)(()=>{if(!D)return r?.email?.charAt(0).toUpperCase()||`?`;let e=D.firstName??``,t=D.lastName??``;return`${e.charAt(0)}${t.charAt(0)}`.toUpperCase()||r?.email?.charAt(0).toUpperCase()||`?`},[r,D]),k=(0,Q.useMemo)(()=>r?D?.firstName&&D?.lastName?`${D.firstName} ${D.lastName}`:r.email??``:``,[r,D]),A=(0,Q.useMemo)(()=>{let e=new Set((i??[]).map(e=>String(e._id)));return Ih(l?.accessProfile).filter(t=>!e.has(t)).length},[i,l?.accessProfile]),j=jAe(m&&A>0),M=(0,Q.useCallback)(()=>{h(!1),s()},[s]),N=(0,Q.useCallback)(e=>{h(!1),o(e)},[o]),P=(0,Q.useCallback)(e=>{h(!1),f(e.urlPath||Ln.settings)},[f]),F=D?.avatar,I=MAe((0,Q.useMemo)(()=>{let e=String(D?.userId??r?._id??``),t=String(D?._id??``),n=F?.fileId;if(!u||!e||!t||!n)return null;let i=u.resourceConfigurations?.[ul.USER_SELF_PROFILES],a=V.resolveSingleResourceReadOperation(ul.USER_SELF_PROFILES,u);if(!i||!a)return null;let o={[ul.USER_SELF]:e},s=QV({registry:u,resourceConfig:i,operation:a,resourceType:ul.USER_SELF_PROFILES,fieldName:`avatar`,recordId:t,contextResourceIdentifiers:o,contextualParameters:V.buildContextualParameters(o,u),apiBaseUrl:xa.getApiUrl()});return s?eH(`${s}/${encodeURIComponent(n)}`):null},[u,r,D,F?.fileId]))??void 0,ee=r?.email??``,L=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r?.organizationMembers??[]){if(!rie(t))continue;let n=t.representingOrganizationName;typeof n==`string`&&n.length>0&&e.set(String(t.organizationId),n)}return e},[r?.organizationMembers]);return{isOpen:m,setIsOpen:h,isUserAuthenticated:c()&&!!r,userInitials:O,displayName:k,email:ee,avatarUrl:I,currentOrganization:v?{_id:v._id,name:v.name}:void 0,organizations:(i??[]).map(e=>{let t=L.get(String(e._id));return{_id:e._id,name:e.name,...t?{viaOrganizationName:t}:{}}}),unlistedOrganizationCount:A,organizationSearchQuery:j.query,setOrganizationSearchQuery:j.setQuery,organizationSearchResults:j.results,isSearchingOrganizations:j.isSearching,organizationSearchFailed:j.failed,sections:y,avatarDisplay:b,showOrgSwitcher:x,showLogout:S,settingsTarget:E,settingsTargets:T,popupAlignment:w,handleLogout:M,handleSwitchOrg:N,handleNavigateToSettingsTarget:P}}function PAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_COMMAND_MENU,`ApplicationLevel_CommandMenu`)(e);return(0,$.jsx)(n,{...t})}function FAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_CONTROL_PANEL,`ApplicationLevel_ControlPanel`)(e);return(0,$.jsx)(n,{...t})}function IAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_USER_DROPDOWN,`ApplicationLevel_MenuUserOrg`)(e);return(0,$.jsx)(n,{...t})}function LAe(e){return e.tResourceEmptyState(e.resourceType,`title`)||e.tComponent(B.RESOURCES_LAYOUTS_LIST,`noItems`)}var Q7=as.getLogger(),$7=Q7.debugByType(`sidebar-resource-browser`);Q7.setDebugTypeLogging(`sidebar-resource-browser`,!1);var RAe=[B.APPLICATION_LEVEL_SIDEBAR,B.RESOURCES_LAYOUTS_LIST],e9=({resourceType:e,operation:t,operationVariant:n,navigateOperation:r,navigateOperationVariant:i,instanceFilter:a,onInstanceClick:o,isCollapsed:s=!1})=>{let{registry:c,doOperation:l}=fm(),{navigateToResource:u}=DS(),d=Zp(),{tResourceHeader:f,tResourceEmptyState:p,t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({resource:e,component:RAe}),v=cp(),{renderIcon:y}=Mf(),[b,x]=(0,Q.useState)([]),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(l);O.current=l;let k=c.resourceConfigurations[e],A=(0,Q.useMemo)(()=>{if(k)return lh(k,t??W.LIST,n)},[k,t,n]),j=(0,Q.useMemo)(()=>{if(k)return r?lh(k,r,i):t&&t!==W.LIST?lh(k,t,n):lh(k,W.READ)??A},[k,r,i,t,n,A]),M=(0,Q.useMemo)(()=>{if(!k)return{};let e=tm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId});return{...tm.primaryScopeToContextIdentifiers(e,k.resourcePrimaryScope),...d?.buildContextResourceIdentifiers()??{}}},[k,d?.currentUserId,d?.currentOrganizationId,d?.currentApplicationId,d?.currentAnonymousUserId,d]),N=(0,Q.useMemo)(()=>A?Ta.createOperationPathKeyFromOperation(A):null,[A]);(0,Q.useEffect)(()=>{if(D(!!k&&!N),!N||!k){if(x([]),k&&!N){let r=`Sidebar resource browser cannot resolve operation "${t??W.LIST}" on resource "${e}".`;T(null),Q7.warn(r,{resourceType:e,operationIdentifier:t??W.LIST,operationVariant:n})}else k||Q7.warn(`Sidebar resource browser: resource type "${e}" is not registered.`,{resourceType:e}),T(null);C(!1);return}let r=!1;return(async()=>{C(!0),T(null);try{$7(`Fetching resource instances`,{resourceType:e,operationPathKey:N});let t=await O.current(N,{contextualParameters:M,queryParameters:{limit:100}});if(r)return;let n=Array.isArray(t)?t:t?.data??[];x(n),$7(`Fetched instances`,{count:n.length})}catch(t){if(r)return;T(v(t)),Q7.error(`SidebarResourceBrowser fetch failed`,{resourceType:e,error:t})}finally{r||C(!1)}})(),()=>{r=!0}},[N,e,k,M,t,n]);let P=(0,Q.useMemo)(()=>a?b.filter(a):b,[b,a]),F=(0,Q.useMemo)(()=>Kp({tResourceHeader:f,resourceType:e,key:`title`}),[e,f]),I=(0,Q.useCallback)(t=>{let n=t.id??t._id??``;if(o)o({resourceType:e,instanceId:n,instanceData:t});else if(k&&j){let t={...M,[e]:n},r=On.buildParentResourcesRequirements(e,t,c),i=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:j,contextResourceIdentifiers:t,parentResourcesRequirements:r});u(i,dh.createAppLevelInitiator(Fr.SIDEBAR))}else Q7.warn(`SidebarResourceBrowser navigation skipped: no navigation operation resolved`,{resourceType:e,fetchOperationIdentifier:A?.operationIdentifier,navigationOperationIdentifier:r??W.READ,navigationOperationVariant:i,instanceId:n})},[e,o,k,j,r,i,M,c,u,A]),ee=(0,Q.useCallback)(t=>V.computeFrontendResourceLabel({resourceType:e,registry:c,currentObject:t,t:m,formatDate:g,formatDateTime:_})??String(t._id??``),[e,c,m,g,_]),L=(0,Q.useMemo)(()=>y({category:re.RESOURCES,resourceType:e},{size:ca.SM}),[y,e]),R=(0,Q.useMemo)(()=>A?[_g({resourceType:e,operation:A.operationIdentifier})]:[],[e,A]),z=(0,Q.useMemo)(()=>[`resources.${e}`],[e]),te=(0,Q.useCallback)(()=>(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs space-y-item-xs`,role:`status`,"aria-live":`polite`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`animate-pulse motion-reduce:animate-none h-7 bg-surface-sunken-accent rounded`,"aria-hidden":`true`},e))}),[]);if(!k)return(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:h(B.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`)});let ne=E||w?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:E?h(B.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`):w}):P.length===0?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-muted-foreground`,children:LAe({resourceType:e,tResourceEmptyState:p,tComponent:h})}):s?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-item-xs py-item-xs`,children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:P.length})]}):(0,$.jsx)(`div`,{className:`space-y-item-xs`,role:`listbox`,"aria-label":F,children:P.map((e,t)=>{let n=ee(e);e.id??e._id;let r=e.id??e._id??`sidebar-resource-${t}`;return(0,$.jsxs)(`button`,{type:`button`,role:`option`,onClick:()=>I(e),className:U(`w-full text-start px-card-sm py-item-xs text-sm rounded-sm hover:bg-surface-sunken-accent/50 transition-colors flex items-center gap-field-sm min-h-7`,Rg(d_.INSET)),children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:n})]},String(r))})});return(0,$.jsx)(sb,{i18nKeys:z,loadingScopes:R,readiness:[{id:`sidebar-resource-browser-data`,isReady:!S||w!==null}],renderLoading:te,children:ne})};function zAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`ApplicationLevel_NotificationCenter`)(e);return(0,$.jsx)(n,{...t})}function BAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_QUICK_SWITCHER,`ApplicationLevel_QuickSwitcher`)(e);return(0,$.jsx)(n,{...t})}var t9=({resourceContext:e})=>{let{registry:t,doOperation:n}=fm(),{resourceContext:r,navigationZone:i,navigationInitiator:a,resourceType:o,contextualParameters:s,reportError:c,navigateToPreferredRead:l,goBackWithinZone:u}=cC(),{closeOverlay:d}=DS(),{makeTrComponent:f,isReady:p}=K({component:B.RESOURCES_LAYOUTS_CREATE}),m=f(B.RESOURCES_LAYOUTS_CREATE),h=cp(),g=!!(r.additionalContext?.quickCreateRequest??e.additionalContext?.quickCreateRequest),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(void 0);(0,Q.useMemo)(()=>t.resourceConfigurations[o],[t,o]);let T=(0,Q.useCallback)(async()=>{let e=_.trim();if(!e)S(m(`saml.metadataUrlRequired`));else{b(!0),S(null);try{let t=Ta.createOperationPathKey({resourceIdentifier:o,operationIdentifier:so.DISCOVER_ENDPOINTS,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),i=await n(t,{contextualParameters:s,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{metadataUrl:e}}),a=(i.x509Certificates??[]).join(`
46
- `);w({protocol:hne.SAML,displayName:i.entityId?.split(`/`).pop()??`SAML Connection`,saml:{entityId:i.entityId,ssoUrl:i.ssoUrl,sloUrl:i.sloUrl,nameIdFormat:i.nameIdFormat,x509CertificatePem:a}})}catch(e){S(h(e))}finally{b(!1)}}},[s,r.parentResourcesRequirements,n,_,o,h,m]),E=(0,Q.useCallback)(e=>{if(g){i===rr.OVERLAY?d():u();return}let n=Uz({result:e,resourceType:o,registry:t});n&&l({contextResourceIdentifiers:On.buildRecordIdentifiersFromCollection(r.contextResourceIdentifiers,o,n),fallbackToGoBack:!1})||u()},[d,r.contextResourceIdentifiers,u,g,l,i,t,o]),D=(0,Q.useCallback)(e=>{c(e,`Form submission failed`,`ResourceLayoutPreset_Create_SamlWizard`)},[c]);if(!p)return null;let O=m(`saml.import`);return(0,$.jsx)(xD,{voice:void 0,children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(oV,{resourceContext:r,navigationZone:i,navigationInitiator:a}),(0,$.jsxs)(OT,{className:`max-w-2xl`,children:[(0,$.jsx)(AT,{children:m(`saml.metadataImport`)}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-field`,children:m(`saml.metadataImportHelp`)}),(0,$.jsxs)(`div`,{className:`flex gap-field`,onKeyDown:e=>e.key===`Enter`&&T(),children:[(0,$.jsx)(ZM,{name:`saml-metadata-url`,schema:bd(),type:`url`,placeholder:m(`saml.metadataUrlPlaceholder`),value:_,onChange:e=>v(String(e)),className:`flex-1`}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:T,disabled:y,children:y?m(`saml.importing`):O})]}),x&&(0,$.jsx)(`p`,{className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:x}),C&&(0,$.jsx)(`p`,{className:`text-sm text-success-subtle-foreground mt-item-xs`,role:`status`,children:m(`saml.importSuccess`)})]}),(0,$.jsx)(mB,{resourceContext:r,navigationZone:i,onSuccess:E,onError:D,onCancel:i===rr.OVERLAY?()=>d():void 0,showErrorSummary:!0,className:`max-w-2xl`,defaultValuesOverride:C})]})})};function VAe({resourceContext:e}){let{resourceType:t,contextResourceIdentifiers:n}=e,{registry:r,doOperation:i}=fm(),{makeTrComponent:a,isReady:o}=K({component:B.RESOURCES_LAYOUTS_READ}),s=a(B.RESOURCES_LAYOUTS_READ),c=cp(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=n,m=p.organizations?On.getResourceId(p.organizations):void 0,h=p.applications?On.getResourceId(p.applications):void 0,g=m==null?Zs.APPLICATION:Zs.ORGANIZATION,_=String(m??h??``),v=(0,Q.useMemo)(()=>_?`${xa.getApiUrl()}/auth/saml/metadata/${g}/${_}`:null,[g,_]),y=(0,Q.useCallback)(async()=>{f(!0),u(null);try{let a=Ta.createOperationPathKey({resourceIdentifier:t,operationIdentifier:so.TEST_CONNECTION,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),o=V.buildContextualParameters(n,r),s=p[t]?On.getResourceId(p[t]):``,c=await i(a,{contextualParameters:o,parentResourcesRequirements:e.parentResourcesRequirements,requestData:{connectionId:s}});u(c)}catch(e){u({overallStatus:`fail`,errors:[c(e)]})}finally{f(!1)}},[t,e.parentResourcesRequirements,n,r,i,p,c]);if(!o)return null;let b=s(`saml.testConnection`),x=s(`saml.downloadSpMetadata`);return(0,$.jsxs)(`div`,{className:`space-y-section max-w-4xl`,children:[(0,$.jsxs)(OT,{children:[(0,$.jsx)(AT,{children:s(`saml.samlTools`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-field`,children:[v&&(0,$.jsx)(X,{variant:J.OUTLINE,asChild:!0,children:(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,children:x})}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:y,disabled:d,children:d?s(`saml.testing`):b})]})]}),l&&(0,$.jsxs)(OT,{className:l.overallStatus===`pass`?`border-success/50 bg-success/5`:l.overallStatus===`warning`?`border-warning/50 bg-warning/5`:`border-destructive/50 bg-destructive/5`,children:[(0,$.jsx)(AT,{children:s(`saml.testResults`)}),(0,$.jsxs)(`div`,{className:`space-y-item-sm text-sm`,children:[l.entityIdConfigured!==void 0&&(0,$.jsxs)(`p`,{children:[l.entityIdConfigured?`✓`:`✗`,` IdP Entity ID:`,` `,l.entityIdConfigured?`Configured`:`Not configured`]}),l.ssoUrlReachable!==void 0&&(0,$.jsxs)(`p`,{children:[l.ssoUrlReachable?`✓`:`✗`,` SSO URL:`,` `,l.ssoUrlReachable?`Reachable (${l.ssoUrlStatus??`OK`})`:`Not reachable`]}),l.sloUrlReachable!==void 0&&(0,$.jsxs)(`p`,{children:[l.sloUrlReachable?`✓`:`✗`,` SLO URL:`,` `,l.sloUrlReachable?`Reachable (${l.sloUrlStatus??`OK`})`:`Not reachable`]}),l.spMetadataValid!==void 0&&(0,$.jsxs)(`p`,{children:[l.spMetadataValid?`✓`:`✗`,` SP Metadata: `,l.spMetadataValid?`Valid`:`Invalid`]}),l.certificates?.map((e,t)=>{let n=e.daysRemaining??0,r=!e.valid||n<0||n<7?`text-destructive`:n<30?`text-warning-subtle-foreground`:``,i=e.fingerprint?e.fingerprint.slice(0,12)+(e.fingerprint.length>12?`…`:``):null;return(0,$.jsxs)(`div`,{className:`pl-item-sm ${r}`,children:[(0,$.jsxs)(`p`,{children:[e.valid?`✓`:`✗`,` Certificate `,t+1,`:`,` `,e.valid?`Valid`:`Invalid`,` — expires`,` `,e.expiresAt?.slice(0,10)??`N/A`,` (`,e.daysRemaining,` days)`,i!=null&&(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs ml-1`,children:[`(`,i,`)`]})]}),e.warnings?.length>0&&(0,$.jsx)(`p`,{className:`text-warning-subtle-foreground text-xs`,children:e.warnings.join(`; `)})]},t)}),l.errors?.map((e,t)=>(0,$.jsx)(`p`,{className:`text-destructive`,children:e},t)),l.warnings?.map((e,t)=>(0,$.jsx)(`p`,{className:`text-warning-subtle-foreground`,children:e},t)),(0,$.jsxs)(`p`,{className:`font-medium mt-item-sm`,children:[`Overall: `,l.overallStatus===`pass`?`✓ Pass`:l.overallStatus===`warning`?`⚠ Warning`:`✗ Fail`]})]})]})]})}var n9=e=>(0,$.jsx)(IY,{...e,showCharts:!1,children:(0,$.jsx)(VAe,{resourceContext:e.resourceContext})});function r9(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{message:e,component:`useCompositeResourceOperationContextBuilder`,...t})}function HAe(e){return`operationIdentifier`in e}function UAe(e,t,n){let r=(e.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation));if(r.length===1)return r[0];let i=r.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(n.variantKey===void 0&&n.variantType===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&i.length===1)return i[0];throw r9(r.length===0?`Composite resource-operation builder cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Composite resource-operation builder found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:r.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))})}function WAe(e,t,n,r,i){if(!e)throw r9(`Composite resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(HAe(n)){let a=UAe(e,t,n);if(nh({operation:a,resourceType:t,resourceConfig:e})&&a.isBulkOperation!==!0&&!Km({resourceConfig:e,operation:a,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw r9(`Composite resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return a}let a=n.operationLike,o=a===W.READ||a===W.UPDATE||a===W.DELETE,s=n.requireAddressable||o?ph({resourceConfig:e,operations:e.operations??[],coreOperation:a,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}):nu(e.operations??[],a,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw r9(`Composite resource-operation builder cannot resolve a preferred ${String(n.operationLike)}-like operation on resource "${t}".`,{resourceType:t,operationLike:n.operationLike,requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});return s}function i9(){let{registry:e}=fm(),t=BU(),n=Zp();return{buildResourceOperationContext:(0,Q.useCallback)(r=>{let i=e.resourceConfigurations[r.resourceType],a=r.contextResourceIdentifiers??t?.contextResourceIdentifiers,o=a?V.flattenContextIdentifiers(a):void 0,s=tm.mergeContextResourceIdentifiers(void 0,n?.buildContextResourceIdentifiers()??{},o)??{},c=r.resourceId?{...zm({hostIdentifiers:r.contextResourceIdentifiers?n?.buildContextResourceIdentifiers()??{}:s,hostContextualParameters:{},hostRecord:{resourceType:r.resourceType,id:r.contextResourceIdentifiers?``:On.getResourceId(o?.[r.resourceType])},targetResourceType:r.resourceType,targetId:r.resourceId,registry:e}).identifiers,...r.contextResourceIdentifiers?o:{},[r.resourceType]:r.resourceId}:s,l=WAe(i,r.resourceType,r,e,c),u=On.buildParentResourcesRequirements(r.resourceType,c,e,r.relationshipFieldOverrides);return On.createFrontendResourceOperationContextFromOperation({resourceType:r.resourceType,operation:l,contextResourceIdentifiers:c,additionalContext:r.additionalContext,parentResourcesRequirements:u})},[n,t?.contextResourceIdentifiers,e])}}function a9({childContext:e,inlineLimit:t,showViewAllLink:n,childResourceType:r,onViewAll:i}){let{registry:a,doOperation:o}=fm(),{t:s,formatDate:c,formatDateTime:l,tComponent:u,isReady:d}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:e.resourceType}),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(!0),[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(o);b.current=o;let x=t,S=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),C=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]);if((0,Q.useEffect)(()=>{if(x===0){_(!1);return}let t=!1;return(async()=>{_(!0),y(!1);let n=a.resourceConfigurations[r],i=V.buildContextualParameters(e.contextResourceIdentifiers,a),o=e.operation&&vl(e.operation)===W.LIST?e.operation:n?nu((n.operations??[]).filter(t=>pY(t,e,i)),W.LIST):void 0,s=e.pinnedFilters;if(s&&o&&o!==e.operation&&as.getLogger().warn(`[related-resource-preview] the "${r}" preview is confined by a pin on its context's own operation, but would fetch through "${String(o.operationIdentifier)}", which may not declare that filter; it fetches nothing rather than an unconfined list (#3072).`),!o||s&&o!==e.operation){_(!1);return}let c=Ta.createOperationPathKeyFromOperation(o);try{let n=await b.current(c,{contextualParameters:i,queryParameters:{page:1,limit:x,...s??{}},parentResourcesRequirements:e.parentResourcesRequirements});if(t)return;if(n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;p(e.data),h(e.pagination.total)}else Array.isArray(n)&&(p(n),h(n.length))}catch{t||y(!0)}finally{t||_(!1)}})(),()=>{t=!0}},[r,x,a,S,C]),g)return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-card-sm`,children:(0,$.jsx)(ib,{size:20,className:`text-muted-foreground`})});if(v)return(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:u(B.RESOURCES_LAYOUTS_CONTAINER_NESTED,`previewLoadFailed`)});if(!d)return null;if(x===0){if(!n)return null;let e=yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAll`});return(0,$.jsx)(X,{variant:J.LINK,size:Y.SM,className:`px-0`,onClick:i,children:e})}if(f.length===0){let e=yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`emptyState`});return(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})}let w=m>x,T=yp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAllWithCount`,params:{total:m}});return(0,$.jsxs)(`div`,{className:`space-y-xs`,children:[(0,$.jsx)(`ul`,{className:`space-y-xs`,children:f.map((e,t)=>{let n=e._id??e.id??t,i=V.computeFrontendResourceLabel({resourceType:r,registry:a,currentObject:e,t:s,formatDate:c,formatDateTime:l})??String(n);return(0,$.jsx)(`li`,{className:`text-sm px-sm py-xs rounded-radius border border-border bg-card`,children:i},n)})}),n&&w&&(0,$.jsx)(X,{variant:J.LINK,size:Y.SM,className:`px-0`,onClick:i,children:T})]})}function GAe({resourceType:e,limit:t,showViewAllLink:n=!0,viaForeignKey:r,className:i}){lY(e);let{buildOperationContext:a}=W6(),{navigationZone:o}=FU(),{navigate:s}=DS(),c=(0,Q.useMemo)(()=>a({resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:r}),[a,e,JSON.stringify(r??null)]);return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)(a9,{childContext:c,inlineLimit:t,showViewAllLink:n&&!(c.pinnedFilters&&Object.keys(c.pinnedFilters).length>0),childResourceType:e,onViewAll:()=>s({content:{contentType:sd.RESOURCE_OPERATION,resourceContext:c},initiator:{sourceZone:o}})})})}var o9=({document:e,options:t={},className:n=``,onStatusChange:r,onAction:i,viewRef:a,guidanceFlowRef:o})=>{let{flowStates:s,completeElement:c,completeFlow:l,dismissFlow:u,skipFlow:d,isFlowPersistable:f,isLoading:p}=_U(),m=(0,Q.useId)(),h=o,g=h??e.ref,_=f(g),v=g??`onboarding-local-${m}`,y=a||e.ref||h||`onboarding`,b=(0,Q.useMemo)(()=>[`guidance.${y}`],[y]),{makeTrGuidanceElement:x,tComponent:S,isReady:C}=K({component:B.GUIDANCE_ONBOARDING_VIEW,keys:b});(0,Q.useEffect)(()=>{if(!_){let t=e.elements.map(e=>e.ref).join(`, `);console.warn(`[OnboardingView] Mounted with no persistable identity (ref="${g??`(none)`}", viewRef="${a??`(none)`}", elements=[${t}]). Dismiss, complete, and skip actions will only affect local component state and will NOT be persisted to the backend. To persist, either declare this onboarding view (by ref) in the app frontend config so it is registered, or pass the guidanceFlowRef prop matching a registered GuidanceFlowDefinition.`)}},[]);let w=(0,Q.useMemo)(()=>({...e.options,...t}),[e.options,t]),T=(0,Q.useMemo)(()=>[...e.elements].sort((e,t)=>e.order-t.order),[e.elements]),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)({status:Hr.IN_PROGRESS,elements:{},triggerCount:1}),A=T.length;(0,Q.useEffect)(()=>{D(0),k({status:Hr.IN_PROGRESS,elements:{},triggerCount:1})},[v]);let j=_?s[g]??O:O,M=(0,Q.useCallback)(e=>j?.elements?.[e],[j]),N=(0,Q.useMemo)(()=>j?.elements?Object.values(j.elements).filter(e=>e.status===Hr.COMPLETED).length:0,[j]),P=(0,Q.useCallback)((e,t,n)=>{let r=t===Hr.COMPLETED?new Date:void 0;k(i=>({...i,elements:{...i.elements,[e]:{...i.elements[e],status:t,completedAt:r,surveyAnswers:n?.surveyAnswers??i.elements[e]?.surveyAnswers,lastStepIndex:n?.lastStepIndex??i.elements[e]?.lastStepIndex}}}))},[]),F=(0,Q.useCallback)(e=>{let t=new Date;k(n=>({...n,status:e,completedAt:e===Hr.COMPLETED?t:n.completedAt,dismissedAt:e===Hr.DISMISSED?t:n.dismissedAt}))},[]),I=(0,Q.useCallback)(async(e,t)=>{P(e,Hr.COMPLETED,t),_&&c(g,e,t),r?.(e,Hr.COMPLETED),E<A-1?D(e=>e+1):(F(Hr.COMPLETED),_&&l(g))},[c,l,E,_,g,r,P,F,A]),ee=(0,Q.useCallback)(e=>{P(e,Hr.DISMISSED),r?.(e,Hr.DISMISSED),w.allowDismiss&&(F(Hr.DISMISSED),_&&u(g))},[u,_,g,w.allowDismiss,r,P,F]),L=(0,Q.useCallback)(e=>{let t=T[E];i?.(t?.ref??``,e)},[i,T,E]),R=(0,Q.useCallback)(()=>{if(E<A-1){D(e=>e+1);return}let e=T[E];e?I(e.ref):(F(Hr.COMPLETED),_&&l(g))},[E,A,T,I,l,_,g,F]),z=(0,Q.useCallback)(()=>{E>0&&D(e=>e-1)},[E]),te=(0,Q.useCallback)(()=>{F(Hr.SKIPPED),_&&d(g)},[_,g,F,d]);if(!C||_&&p)return null;if(T.length===0)return(0,$.jsx)(`div`,{className:U(`p-container-xl text-center text-muted-foreground`,n),children:S(B.GUIDANCE_ONBOARDING_VIEW,`empty`)});if(Tt(j?.status))return null;let ne=T[E];if(!ne)return null;let re=$2(ne.type),ie=M(ne.ref),ae=x(y,ne.ref,zc(ne));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-element`,n),children:[w.showProgress&&A>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center text-[0.8125rem] text-muted-foreground font-medium`,children:[(0,$.jsx)(`span`,{children:S(B.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A})}),(0,$.jsxs)(`span`,{className:`text-xs`,children:[N,`/`,A]})]}),(0,$.jsx)(E_,{value:A>0?(E+1)/A*100:0,className:`h-1`,"aria-label":S(B.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A}),"aria-valuenow":E+1,"aria-valuemin":1,"aria-valuemax":A})]}),re&&(0,$.jsx)(re,{element:ne,flowRef:v,state:ie,onComplete:I,onDismiss:ee,onAction:L,t:ae}),A>1&&(0,$.jsxs)(`div`,{className:`flex justify-between items-center pt-item`,children:[(0,$.jsx)(`div`,{children:E>0&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:z,children:S(B.GUIDANCE_ONBOARDING_VIEW,`back`)})}),(0,$.jsxs)(`div`,{className:`flex gap-item items-center`,children:[w.allowSkip&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:te,children:S(B.GUIDANCE_ONBOARDING_VIEW,`skip`)}),(0,$.jsx)(X,{variant:J.DEFAULT,size:Y.SM,onClick:R,children:E===A-1?S(B.GUIDANCE_ONBOARDING_VIEW,`complete`):S(B.GUIDANCE_ONBOARDING_VIEW,`next`)})]})]}),A===1&&(0,$.jsxs)(`div`,{className:`flex justify-end gap-item items-center`,children:[w.allowDismiss&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:()=>ee(ne.ref),children:S(B.GUIDANCE_ONBOARDING_VIEW,`dismiss`)}),(0,$.jsx)(X,{variant:J.DEFAULT,size:Y.SM,onClick:R,children:S(B.GUIDANCE_ONBOARDING_VIEW,`complete`)})]})]})},s9=Object.freeze({});function KAe(e,t){let n={};for(let r of t){let t=e[r.foreignKeyField];typeof t==`string`&&t.length>0&&(n[r.resourceType]=t)}return n}function c9(e){let{registry:t,doOperation:n}=fm(),[r,i]=(0,Q.useState)(s9),{hostResourceType:a,hostResourceId:o,hostResourceConfig:s,contextResourceIdentifiers:c,parentResourcesRequirements:l}=e,u=(0,Q.useMemo)(()=>o?(l??[]).filter(e=>{if(!e.foreignKeyField)return!1;let t=On.getResourceId(c[e.resourceType]);return!(t&&t.length>0)}).map(e=>({resourceType:e.resourceType,foreignKeyField:e.foreignKeyField})):[],[l,c,o]),d=(0,Q.useMemo)(()=>u.map(e=>`${e.resourceType}:${e.foreignKeyField}`).sort().join(`|`),[u]),f=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(c),[c]),p=(0,Q.useRef)(null),m=rV({resourceType:a,rowIds:[o,p.current],enabled:u.length>0&&!!o}),h=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(u.length===0||!o){i(s9);return}let e=V.buildContextualParameters(c,t),r=ph({resourceConfig:s,operations:s.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:c,contextualParameters:e});if(!r){i(s9);return}let m=Ta.createOperationPathKeyFromOperation(r),g=`${m}|${a}|${o}|${d}|${f}`,_=h.current===g;h.current=g;let v=!1;return n(m,{contextualParameters:e,parentResourcesRequirements:l}).then(e=>{if(v)return;let t=e&&typeof e==`object`&&!Array.isArray(e)&&!(`data`in e)?e:void 0;if(!t){i(s9);return}p.current=typeof t._id==`string`?t._id:null;let n=KAe(t,u);i(e=>Object.keys(n).length===0?s9:Object.keys(n).length===Object.keys(e).length&&Object.entries(n).every(([t,n])=>e[t]===n)?e:n)}).catch(()=>{!v&&!_&&i(s9)}),()=>{v=!0}},[d,f,o,a,m?.at]),r}function l9(e,t){return Object.keys(t).length===0?e:{...t,...e}}function u9(e){let{registry:t}=fm(),n=t.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.viewRef);if(!n)throw p9(`Composite chart runtime cannot resolve chart view "${e.viewRef}" on resource "${e.resourceType}".`,{resourceType:e.resourceType,viewRef:e.viewRef});let r=xp(e.resourceType,{ref:e.viewRef});return(0,$.jsx)(`div`,{className:e.className,children:(0,$.jsx)($h,{requiredFeatures:n.chartDefinition.requiredFeatures,children:(0,$.jsx)(VJ,{viewRef:r.insertedViewRef,viewDefinition:n,runtimeDescriptor:gp({identity:r,chartView:n,contextResourceIdentifiers:e.contextResourceIdentifiers??{}}),contextResourceIdentifiers:e.contextResourceIdentifiers,inputs:e.inputs,urlParamValues:e.urlParamValues,...e.height==null?{}:{height:e.height},localErrorOnly:!0})})})}function d9({resourceType:e,viewRef:t,contextResourceIdentifiers:n,inputs:r,urlParamValues:i,className:a,height:o}){let s=FU();return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:{...s.contextResourceIdentifiers??{},...n??{}},inputs:r,urlParamValues:i,className:a,height:o})}function qAe({document:e,viewRef:t,guidanceFlowRef:n,className:r}){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(o9,{document:e,viewRef:t,guidanceFlowRef:n})})}function JAe({viewRef:e,className:t}){let n=IU(),r=n?.hostResourceType?n.contextResourceIdentifiers?.[n.hostResourceType]??`no-row`:`no-host`;return(0,$.jsx)(`div`,{className:t,children:(0,$.jsx)(aY,{descentKey:`composite:${e}::${r}`,children:(0,$.jsx)(VU,{viewRef:e})})})}function f9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(aY,{descentKey:`execution:${e}::${Object.values(n??{}).join(`,`)||`no-row`}`,children:(0,$.jsx)($Y,{viewRef:e,navigationZone:t,contextResourceIdentifiers:n})})})}function YAe({viewRef:e,contextResourceIdentifiers:t,className:n}){let r=FU();return f9(e,r.navigationZone,{...r.contextResourceIdentifiers??{},...t??{}},n)}function p9(e,t){return V.buildConfigurationError(Xl.CONFIGURATION,{message:e,component:`ResourceEmbeds`,...t})}function m9(e){let t=V.getInstance().getAddressedRecordId(e);if(t)return`embed:${e.resourceType}::${t}`;let n=Object.fromEntries(Object.entries(e.contextResourceIdentifiers??{}).filter(([t])=>t!==e.resourceType));return`embed:${e.resourceType}::scope:${V.buildContextResourceIdentifiersKey(n)}`}function h9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(aY,{descentKey:m9(e),children:(0,$.jsx)(Kk.Provider,{value:!0,children:(0,$.jsx)(WY,{resourceContext:e,navigationZone:t,navigationInitiator:n})})})})}function g9({resourceContext:e,className:t}){let{navigationZone:n,navigationInitiator:r}=FU();return h9(e,n,r,t)}function XAe({className:e,...t}){let{navigationZone:n,navigationInitiator:r}=FU(),i=W6();return h9((0,Q.useMemo)(()=>i.buildOperationContext(t),[i,JSON.stringify(t)]),n,r,e)}function _9({className:e,...t}){lY(t.resourceType);let{navigationZone:n,navigationInitiator:r}=FU(),i=W6(),{registry:a}=fm(),o=(0,Q.useMemo)(()=>{if(!t.resourceType)throw p9(`EmbedRelatedResourceOperation() requires a target resourceType.`,{target:t});return i.buildOperationContext(t)},[i,JSON.stringify(t)]),s=(0,Q.useMemo)(()=>{let{hostResourceType:e,hostResourceId:n,hostResourceConfig:r}=i,s=t.resourceType===e&&!H6({target:t,hostResourceType:e,operation:o.operation,registry:a});if(!t.resourceType||s||!r?.resourceRelationships)return;let c=t.relationshipFieldOverrides?.[e],l=Hi(r.resourceRelationships).map(t=>Sj({parentResourceType:e,relationship:t,registry:a})).filter(e=>e!==void 0).filter(e=>e.childResourceType===t.resourceType).filter(e=>c===void 0||e.foreignKeyField===c);if(l.length!==1)return;let u=l[0];return{parentResourceType:e,parentResourceId:n||void 0,childResourceType:u.childResourceType,foreignKeyField:u.foreignKeyField,relationshipEdgeKey:u.relationshipEdgeKey,inChildView:u.inChildView}},[i,a,o,JSON.stringify(t)]);return h9(o,n,(0,Q.useMemo)(()=>s?{...r??{sourceZone:n},sourceRelationship:s}:r,[r,n,s]),e)}function v9({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:t,className:n})}function ZAe({className:e}){let{navigationZone:t,navigationInitiator:n}=FU(),r=W6(),{hostResourceType:i,hostResourceId:a}=r;return h9((0,Q.useMemo)(()=>{if(!a)throw p9(`EmbedLinkedConversations() needs a host RECORD: place it on a READ surface, where the record it lists conversations for exists.`,{hostResourceType:i});return r.buildOperationContext({resourceType:ul.CONVERSATION_THREADS,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[Gn.RESOURCE_TYPE]:i,[Gn.RESOURCE_ID]:a}})},[r,i,a]),t,n,e)}var QAe={[ul.USER_FLOW_ACTOR_EXECUTIONS]:ul.USER_AGENT_WORK_DECISIONS,[ul.ORGANIZATION_FLOW_ACTOR_EXECUTIONS]:ul.ORGANIZATION_AGENT_WORK_DECISIONS,[ul.APPLICATION_FLOW_ACTOR_EXECUTIONS]:ul.APPLICATION_AGENT_WORK_DECISIONS};function y9({executionId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=FU(),i=W6(),{hostResourceType:a}=i;return h9((0,Q.useMemo)(()=>{let t=QAe[a];if(!t)throw p9(`EmbedExecutionDecisions() lists the decisions of a conversational RUN: place it on a flowActorExecutions READ surface.`,{hostResourceType:a});return i.buildOperationContext({resourceType:t,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[mr.KIND]:pe.CONVERSATIONAL_EXECUTION,[mr.ID]:e}})},[i,a,e]),n,r,t)}var b9=new Set;function $Ae(e,t,n){let r=`${e}::${t}`;b9.has(r)||(b9.add(r),as.getLogger().warn(`[related-resource-list] the "${t}" LIST cannot be embedded on "${e}", so a section asking whether the viewer may read it is not drawn.${n?` ${n}`:``}`))}function x9(e,t){let n=W6(),r=dS(),i=t?JSON.stringify(t):``;return(0,Q.useMemo)(()=>{if(t===null)return!1;let a;try{a=n.buildOperationContext({resourceType:e,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:t?JSON.parse(i):void 0})}catch(t){return $Ae(n.hostResourceType,e,XG(t)),!1}let o=a.operation;return Um({...o,resourceType:e},r)},[n,e,r,i,t===null])}function S9(e){let t=W6(),{hostResourceType:n}=t,{embedName:r,resourceType:i,pinnedFilters:a}=e,o=x9(i,a),s=JSON.stringify(a);return(0,Q.useMemo)(()=>{if(n!==ul.ORGANIZATION_REPRESENTATIONS)throw p9(`${r}() lists what belongs to one client relationship: place it on an organizationRepresentations READ surface.`,{hostResourceType:n});return o?t.buildOperationContext({resourceType:i,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:JSON.parse(s)}):null},[t,n,o,r,i,s])}function C9({organizationRepresentationId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=FU(),i=S9({embedName:`EmbedRepresentationTeam`,resourceType:ul.REPRESENTATIVE_ASSIGNMENTS,pinnedFilters:{[l]:e}});return i?h9(i,n,r,t):null}function w9({organizationRelationshipId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=FU(),i=S9({embedName:`EmbedRepresentationMailboxes`,resourceType:ul.RELATIONSHIP_MAILBOXES,pinnedFilters:{[kn]:e}});return i?h9(i,n,r,t):null}function eje({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:W.SEARCH,relationshipFieldOverrides:t,className:n})}function tje({viewRef:e,inputs:t,urlParamValues:n,className:r,...i}){let a=W6(),o=a.buildOperationContext({...i,operationLike:W.READ}),s=c9(a);return(0,$.jsx)(u9,{resourceType:a.hostResourceType,viewRef:e,contextResourceIdentifiers:l9(V.flattenContextIdentifiers(o.contextResourceIdentifiers),s),inputs:t,urlParamValues:n,className:r})}function nje({resourceType:e,viewRef:t,inputs:n,urlParamValues:r,className:i,...a}){if(!e)throw p9(`EmbedRelatedChart() requires a target resourceType.`,{target:a});let o=W6().deriveRelatedScopeIdentifiers({...a,resourceType:e,operationLike:W.LIST});return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:o,inputs:n,urlParamValues:r,className:i})}function rje({viewRef:e,className:t,...n}){let{navigationZone:r}=FU(),i=W6(),a=i.buildOperationContext({...n,operationLike:W.READ}),o=c9(i);return f9(dp(i.hostResourceType,{ref:e}).insertedViewRef,r,l9(V.flattenContextIdentifiers(a.contextResourceIdentifiers),o),t)}function ije({resourceType:e,viewRef:t,className:n,...r}){let{navigationZone:i}=FU(),a=W6();if(!e)throw p9(`EmbedRelatedExecution() requires a target resourceType.`,{target:{resourceType:e,viewRef:t,...r}});let o=a.buildOperationContext({...r,resourceType:e,operationLike:W.READ});return f9(dp(e,{ref:t}).insertedViewRef,i,V.flattenContextIdentifiers(o.contextResourceIdentifiers),n)}function aje(e){if(!e.hostRelationships)return!1;let t=Hi(e.hostRelationships).filter(t=>(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType);return t.length>0&&t.every(t=>!Ul.isRelationshipActiveForParent(t,e.hostRecord,{onMissingParentResource:`exclude`,onConditionError:`exclude`}))}var T9=new Set;function oje(e,t,n){let r=`${e}::${t}`;T9.has(r)||(T9.add(r),as.getLogger().warn(`[related-resource-sections] "${t}" was placed on "${e}" but cannot be embedded here, so its section is omitted. Two causes are usual: the target exposes no ADDRESSABLE variant of the requested operation (a core verb declared REPOSITORY_ONLY or INTERNAL_CALL has no HTTP surface to embed), or nothing can confine its collection to this record — no route of it names the record and its operation admits no filter on the relationship's foreign key, or no live relationship links the two, so it would list every row (#3072). `+(n?`Here: ${n}`:"Give the target an addressable variant, point `operationLike` at one it does expose, or stop placing it.")))}function E9({targets:e,config:t,className:n}){dY();let r=(0,Q.useMemo)(()=>e.map(e=>typeof e==`string`?{resourceType:e}:e),[e]),i=U6(),a=i?.hostResourceType??``,o=i?.hostResourceConfig?.resourceRelationships,s=ik(),c=s?.data,{tResourceHeader:l,isReady:u}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED}),d=(0,Q.useMemo)(()=>r.filter(e=>{if(!i)return!0;if(s&&aje({hostResourceType:a,hostRelationships:o,targetResourceType:e.resourceType,hostRecord:c}))return!1;try{return i.buildOperationContext({resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey}),!0}catch(t){return oje(a,e.resourceType,XG(t)),!1}}),[r,i,a,o,s,c]),f=(0,Q.useMemo)(()=>d.map(e=>({id:e.resourceType,title:Kp({tResourceHeader:l,resourceType:e.resourceType,key:`title`}),content:(0,$.jsx)(Kk.Provider,{value:!0,children:(0,$.jsx)(_9,{resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey})})})),[d,l]);if(f.length===0)return null;let p=d.some(e=>{let t=e.operationLike??W.LIST;return t===W.LIST||t===W.SEARCH}),m=u?(0,$.jsx)(WO,{sections:f,config:t,className:n}):null;return p?(0,$.jsx)(`div`,{[mA]:!0,children:m}):m}function D9({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-element-sm gap-y-element-xs`,`[&>*:not(:first-child)]:shrink-0 [&>*:not(:first-child)]:w-auto [&>*:not(:first-child)]:max-w-full`,`[&>[data-summary-title]]:basis-auto`,`[&>:has(>[data-summary-title])]:w-auto [&>:has(>[data-summary-title])]:min-w-0 [&>:has(>[data-summary-title])]:flex-auto`,e),children:t})}function O9({name:e,className:t,children:n}){let[r]=(0,Q.useState)(()=>new Set),i=eO(),a=(0,Q.useContext)($D),o=(0,Q.useRef)(!1),s=(0,Q.useCallback)(t=>{r.add(t),i?.registerStep(e,r)},[r,e,i]),c=(0,Q.useCallback)(t=>{r.delete(t),i?.registerStep(e,r)},[r,e,i]),l=(0,Q.useMemo)(()=>({registerField:s,unregisterField:c}),[s,c]);(0,Q.useEffect)(()=>{if(i&&!o.current){o.current=!0;let t=requestAnimationFrame(()=>{i.registerStep(e,r)});return()=>cancelAnimationFrame(t)}},[i,e,r]);let u=`wizard-step-${e}`;return(0,$.jsx)(NM.Provider,{value:l,children:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,t),id:u,"data-guidance-wizard-step":e,role:`group`,"aria-labelledby":`wizard-tab-${e}`,tabIndex:-1,children:[n,a]})})}var sje=as.getLogger(),cje=new Set;function lje(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}var uje=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`,`range`,`color`,`hidden`]),dje=600;function k9(e,t=[]){return Q.Children.forEach(e,e=>{if(!Q.isValidElement(e))return;if(e.type===Q.Fragment){k9(e.props.children,t);return}if(e.type!==O9)return;let n=e.props.name;t.some(e=>e.name===n)?sje.error(`[WizardLayout] Two steps are named "${n}"; a step name must be unique. The second is ignored.`):t.push({name:n,element:e})}),t}function fje({className:e,initialStep:t=0,validateOnStepChange:n=!0,onStepChange:r,submitButton:i,children:a}){jde();let[o,s]=(0,Q.useState)(t),c=(0,Q.useRef)(new Map),l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1),d=(0,Q.useRef)(0),[f,p]=(0,Q.useState)(t),[m,h]=(0,Q.useState)(cje),g=GC(),_=zT(),v=sE(),y=v?.claimFooter,b=(0,Q.useContext)(XR),x=b?.claim;(0,Q.useLayoutEffect)(()=>x?.(),[x]),(0,Q.useLayoutEffect)(()=>y?.(),[y]);let{tComponent:S,isReady:C}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),w=(0,Q.useMemo)(()=>k9(a),[a]),T=w.length,E=Math.min(o,Math.max(T-1,0)),D=(0,Q.useCallback)((e,t)=>{c.current.set(e,t)},[]),O=(0,Q.useCallback)(()=>{let e=w[E]?.name;if(!e)return;let t=c.current.get(e);return t?Array.from(t):void 0},[E,w]),k=(0,Q.useMemo)(()=>({registerStep:D,getCurrentStepFieldNames:O,currentStep:E,totalSteps:T}),[D,O,E,T]),A=(e,t)=>_?.wizardStepLabels?.[e]?_.wizardStepLabels[e]:S(B.LOW_LEVEL_FORM_MESSAGE,`wizardStepDefault`,{index:String(t+1)}),j=()=>{l.current?.scrollIntoView({behavior:`smooth`,block:`start`})},M=e=>{let t=E;d.current=Date.now(),s(e),p(t=>Math.max(t,e)),r?.(t,e)};(0,Q.useEffect)(()=>{if(!g)return;let e=e=>{let t=new Set;w.forEach((n,r)=>{let i=c.current.get(n.name);i&&Array.from(i).some(t=>TC(e,t)!==void 0)&&t.add(r)}),h(e=>lje(e,t)?e:t)};return e(g.formState.errors),g.subscribe({formState:{errors:!0},callback:({errors:t})=>e(t??{})})},[g,w]);let N=e=>{u.current=!0,M(e),j()},P=HD(e=>{let t=w.findIndex(t=>t.name===e);return t<0||t===E?!1:(M(t),!0)});(0,Q.useEffect)(()=>{if(!u.current)return;u.current=!1;let e=w[E]?.name;e&&document.getElementById(`wizard-step-${e}`)?.focus({preventScroll:!0})},[E,w]);let F=()=>{E>0&&N(E-1)},I=async e=>{e>E&&!await ee(E,e)||N(e)},ee=async(e,t)=>{if(!n||!g)return!0;let r=w.slice(e,t).flatMap(e=>Array.from(c.current.get(e.name)??[]));return ek(g,r)},L=async()=>{if(n&&g){let e=w[E]?.name,t=e?c.current.get(e):void 0;if(!await ek(g,t?Array.from(t):[]))return}E<T-1&&N(E+1)},R=E===0,z=E===T-1,te=e=>{if(e.key!==`Enter`||z||e.defaultPrevented||e.nativeEvent.isComposing)return;let t=e.target;t instanceof HTMLInputElement&&!uje.has(t.type)&&(e.preventDefault(),L())},ne=e=>{e.detail>1&&Date.now()-d.current<dje&&(e.preventDefault(),e.stopPropagation())};if(!C)return null;let re=S(B.LOW_LEVEL_FORM_MESSAGE,`wizardPrevious`),ie=S(B.LOW_LEVEL_FORM_MESSAGE,`wizardNext`),ae=i??v?.submitButton??(0,$.jsx)(X,{type:`submit`,disabled:_?.disabled,children:S(B.LOW_LEVEL_FORM_MESSAGE,`wizardSubmit`)},`submit`),oe=_?.isExisting===!0;return(0,$.jsx)(QD.Provider,{value:k,children:(0,$.jsxs)(`div`,{className:e,"data-guidance-wizard":``,onKeyDown:te,children:[(0,$.jsx)(`div`,{ref:l,children:(0,$.jsx)(DO,{currentStep:E,totalSteps:T,orientation:mu.HORIZONTAL,className:`mb-region`,role:`list`,errorSteps:m,onStepSelect:e=>{I(e)},isStepSelectable:e=>e!==E&&(_?.isExisting===!0||e<=f),children:w.map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(OO,{step:t,role:`listitem`,"aria-current":t===E?`step`:void 0,children:[(0,$.jsx)(kO,{step:t,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex flex-col items-center text-center`,children:(0,$.jsx)(jO,{step:t,children:(0,$.jsx)(`span`,{id:`wizard-tab-${e.name}`,children:A(e.name,t)})})})]}),t<T-1&&(0,$.jsx)(AO,{step:t,"aria-hidden":`true`})]},e.name))})}),w.map((e,t)=>{let n=_?.wizardStepDescriptions?.[e.name];return(0,$.jsxs)(`div`,{hidden:t!==E,...UD(P,e.name),children:[n?(0,$.jsx)(`p`,{className:`mb-field text-sm text-muted-foreground`,children:n}):null,(0,$.jsx)(Jy,{children:(0,$.jsx)($D.Provider,{value:t===T-1?b?.content??null:null,children:e.element})})]},e.name)}),v?.submissionNotice,(0,$.jsxs)(`div`,{className:`flex justify-between gap-field pt-field`,onClickCapture:ne,children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:F,disabled:R||_?.disabled,children:re}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[v?.cancelButton,v?.draftSaveButton,(z||oe)&&(0,$.jsx)(Q.Fragment,{children:ae},`submit`),!z&&(0,$.jsx)(X,{type:`button`,variant:oe?J.OUTLINE:void 0,onClick:L,disabled:_?.disabled,children:ie},`next`)]})]})]})})}function A9({name:e,className:t,children:n}){let r=zT(),i=ik(),{getRecipe:a}=Wg(),o=r?.groupLabels?.[e]??i?.groupLabels?.[e];return(0,$.jsxs)(`div`,{className:t,"data-guidance-group":e,children:[o&&(0,$.jsx)(`h3`,{className:U(`col-span-full mb-element`,a(cc.TYPOGRAPHY,y.EYEBROW).base),children:o}),n]})}A9.displayName=`Group`;function j9({className:e,children:t}){return e?(0,$.jsx)(`div`,{className:e,children:t}):(0,$.jsx)($.Fragment,{children:t})}function M9({name:e,className:t,addLabel:n,removeLabel:r,minItems:i,maxItems:a,children:o}){let s=DD(e),{control:c}=GC(),{fields:l,append:u,remove:d}=Pw({control:c,name:s});hk(s),PM(s);let{tComponent:f,isReady:p}=K({component:B.LOW_LEVEL_FORM_MESSAGE});if(!p)return null;let m=pje(o),h=a===void 0||l.length<a,g=i===void 0||l.length>i,_=n??f(B.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),v=f(B.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`);return(0,$.jsxs)(`div`,{className:t,"data-guidance-array":e,children:[l.map((e,t)=>(0,$.jsxs)(`div`,{className:`relative`,"data-guidance-array-item":t,children:[(0,$.jsx)(TD,{pathPrefix:`${s}[${t}]`,children:m?Q.cloneElement(m):null}),g&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,onClick:()=>d(t),className:`mt-1`,children:r??f(B.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:`${v} ${t+1}`})})]},e.id)),h&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>u({}),className:`mt-2`,children:_})]})}function pje(e){let t=null;return Q.Children.forEach(e,e=>{!t&&Q.isValidElement(e)&&e.type===j9&&(t=e)}),t}Nk(M9);function mje({className:e}){return(0,$.jsx)(`hr`,{className:e})}function hje(e){let{resourceType:t,viewRef:n,contextResourceIdentifiers:r,inputs:i,urlParamValues:a,localErrorOnly:o=!1}=e,{registry:s}=fm(),{resolvedRegionalPreferences:c}=K(),l=s.resourceConfigurations[t]?.frontendConfiguration?.chartViews?.find(e=>e.ref===n);if(!l)throw Error(`useResourceChartData: resource "${t}" declares no chart view "${n}".`);let u=(0,Q.useMemo)(()=>gp({identity:xp(t,{ref:n}),chartView:l,contextResourceIdentifiers:r??{}}),[t,n,l,r]),d=D_({surfaceDefinition:l,runtimeDescriptor:u,explicitContextResourceIdentifiers:r,explicitInputs:i,urlParamValues:a});return S_(d?.chartDefinition,d?.executionChartRef,d?.resolvedInputs,d?.contextResourceIdentifiers,a,o,c.timezone)}function gje(e,t){let n=(Array.isArray(e?.operations)?e.operations:[]).find(e=>String(e.operationIdentifier)===W.LIST&&e.isOperationDefault===!0);if(!n||!Array.isArray(n.roles))return;let r=n.roles.map(String);return t?r.filter(e=>t.includes(e)):r}function _je(e,t){let n=e.accessProfile,r=Ke(n?.organizationOwnRows,t),i=ut(n?.organizationAssignedRows,t);if(!r&&!i)return e.organizationRoles;let a=t=>Ks(t,e.roleTables.orgRolesConfig);return e.organizationRoles.filter(e=>ute({role:e,ownRowsDeclaration:r,assignedRowsDeclaration:i,roleHierarchyOf:a}))}function N9(e,t,n){return[e.dataQuery.mainResourceType,...(e.dataQuery.joins??[]).map(e=>e.resourceType)].every(r=>{let i=gje(t.resourceConfigurations[r],e.accessControl?.roles);return!i||i.length===0?!1:Im(i,{...n,organizationRoles:_je(n,r)})})}function P9(e){return e.rows??qc.ONE}function vje(e,t){if(e.height!==void 0)return t===P9(e)?e.height:t===qc.TWO?e.height*2+32:Math.max(1,Math.round((e.height-32)/2))}function F9(e,t,n){let r=vje(e,n),{height:i,...a}=e;return{...a,span:t,rows:n,...r===void 0?{}:{height:r}}}function I9(e,t){if(!t)return e.map(e=>({tile:e,declared:e,hidden:!1}));let n=new Map(e.map(e=>[Os(e),e])),r=new Set,i=[];for(let e of t){let t=Os(e),a=n.get(t);a&&!r.has(t)&&(r.add(t),i.push({tile:F9(a,e.span,e.rows),declared:a,hidden:e.hidden}))}for(let t of e)r.has(Os(t))||i.push({tile:t,declared:t,hidden:!1});return i}function yje(e,t){return I9(e,t).filter(e=>!e.hidden).map(e=>e.tile)}function L9(e){return e.map(({tile:e,hidden:t})=>({resourceType:e.resourceType,chartViewRef:e.chartViewRef,span:e.span??Ws.ONE,rows:P9(e),hidden:t}))}function R9(e,t){let n=e?xje:bje;return t===qc.TWO&&!e?n*2+32:n}var bje=280,xje=64,Sje=as.getLogger(),z9=ul.ORGANIZATION_DASHBOARD_LAYOUTS,B9;(function(e){e.LOADING=`loading`,e.SETTLED=`settled`})(B9||={});var V9=new Map;function H9(e){V9.get(e)?.forEach(e=>e())}function U9(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function W9(e){return t=>{throw H9(e),t}}function Cje(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}function wje(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.data,n=t&&typeof t==`object`&&!Array.isArray(t)?t:e;return typeof n._id==`string`&&Array.isArray(n.tiles)?n:void 0}function G9(e,t){let{registry:n,doOperation:r}=fm(),i=Zp()?.currentOrganizationId??null,a=n.resourceConfigurations[z9],o=a?.operations,s=n.resourceConfigurations[ul.ORGANIZATIONS]?.resourceFieldIdentifier??`organizationId`,c=a?.resourceFieldIdentifier,l=(0,Q.useMemo)(()=>({list:U9(o,W.LIST),create:U9(o,W.CREATE),update:U9(o,W.UPDATE),remove:U9(o,W.DELETE)}),[o]),u=e=>!!e&&Um({...e,resourceType:z9},t),d=!!e&&i!==null&&u(l.list),f=d&&u(l.create)&&u(l.update)&&u(l.remove),p=d?`${i}|${e}`:null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(0),v=(0,Q.useRef)(r);v.current=r,(0,Q.useEffect)(()=>{if(!p)return;let e=()=>_(e=>e+1),t=V9.get(p)??new Set;return t.add(e),V9.set(p,t),()=>{t.delete(e),t.size===0&&V9.delete(p)}},[p]),(0,Q.useEffect)(()=>{if(!p||!l.list||i===null||!e)return;let t=!1,n=e=>{t||h({key:p,stored:e})};return v.current(Ta.buildOperationPathKeyFromOperation(l.list),{contextualParameters:{[s]:i},queryParameters:{dashboardRef:e,page:1,limit:1}},{silent:!0}).then(t=>n(Cje(t).find(t=>t.dashboardRef===e))).catch(t=>{Sje.warn(`Could not read the organization's dashboard layout; showing the declared one`,{layoutRef:e,organizationId:i,error:t}),n(void 0)}),()=>{t=!0}},[p,l.list,i,e,s,g]);let y=p&&m?.key===p?m.stored:void 0;return{readState:!p||m?.key===p?B9.SETTLED:B9.LOADING,stored:y,canEdit:f,save:(0,Q.useCallback)(async t=>{if(!p||i===null||!e||!l.create||!l.update||!c)return;let n={[s]:i},r=wje(await(y?v.current(Ta.buildOperationPathKeyFromOperation(l.update),{contextualParameters:{...n,[c]:y._id},requestData:{tiles:t}}):v.current(Ta.buildOperationPathKeyFromOperation(l.create),{contextualParameters:n,requestData:{dashboardRef:e,tiles:t}})).catch(W9(p)));r&&h({key:p,stored:r}),H9(p)},[p,i,e,l.create,l.update,c,s,y]),reset:(0,Q.useCallback)(async()=>{p&&i!==null&&l.remove&&c&&y&&(await v.current(Ta.buildOperationPathKeyFromOperation(l.remove),{contextualParameters:{[s]:i,[c]:y._id}}).catch(W9(p)),h({key:p,stored:void 0}),H9(p))},[p,i,l.remove,c,s,y])}}var K9=B.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,q9=kd(Ws),J9=kd(qc),Tje=Object.values(Ws),Eje=Object.values(qc);function Dje(e){return`${e.resourceType}:${e.chartViewRef}`}function Y9(e,t,n){let r=t+n;if(r<0||r>=e.length)return[...e];let i=[...e],[a]=i.splice(t,1);return i.splice(r,0,a),i}function X9({tiles:e,layout:t,onDone:n}){let{tComponent:r,tView:i,isReady:a}=K({component:K9}),{renderIcon:o}=Mf(),s=(0,Q.useCallback)((e,t)=>r(K9,e,t),[r]),[c,l]=(0,Q.useState)(()=>I9(e,t.stored?.tiles)),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useCallback)((e,t)=>{l(n=>n.map((n,r)=>r===e?t(n):n))},[]),h=(0,Q.useCallback)(async e=>{d(!0),p(!1);try{await e(),n()}catch{p(!0)}finally{d(!1)}},[n]),g=(0,Q.useMemo)(()=>Tje.map(e=>({value:e,label:s(`span_${e}`)})),[s]),_=(0,Q.useMemo)(()=>Eje.map(e=>({value:e,label:s(`rows_${e}`)})),[s]);return a?(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,"data-chart-dashboard-layout-editor":!0,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-element`,children:c.map((e,t)=>{let n=Dje(e.tile),r=i(au.CHART,`resources.${e.tile.resourceType}.${e.tile.chartViewRef}`,`title`)||n,a=e.tile.span??Ws.ONE,d=e.tile.rows??qc.ONE;return(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-item`,"data-chart-dashboard-layout-tile":n,"data-hidden":e.hidden?``:void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,"aria-label":s(`moveUp`),disabled:u||t===0,onClick:()=>l(e=>Y9(e,t,-1)),children:o(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,"aria-label":s(`moveDown`),disabled:u||t===c.length-1,onClick:()=>l(e=>Y9(e,t,1)),children:o(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.BODY,children:r}),(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`tilePosition`,{position:t+1,count:c.length})})]}),(0,$.jsx)(xI,{name:`${n}:shown`,schema:Od(),"aria-label":s(`shownLabel`),checked:!e.hidden,disabled:u,onCheckedChange:e=>m(t,t=>({...t,hidden:!e}))}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`widthLabel`)}),(0,$.jsx)(mF,{name:`${n}:span`,schema:q9,options:g,value:a,disabled:u,onChange:e=>m(t,t=>({...t,tile:F9(t.declared,q9.parse(e),d)}))})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`heightLabel`)}),(0,$.jsx)(mF,{name:`${n}:rows`,schema:J9,options:_,value:d,disabled:u,onChange:e=>m(t,t=>({...t,tile:F9(t.declared,a,J9.parse(e))}))})]})]},n)})}),f&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:s(`saveFailed`)})}),(0,$.jsxs)(nG,{children:[t.stored&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:u,onClick:()=>void h(t.reset),"data-chart-dashboard-layout-reset":!0,children:s(`resetButton`)}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,disabled:u,onClick:n,children:s(`cancelButton`)}),(0,$.jsx)(X,{type:`button`,variant:J.DEFAULT,loading:u,disabled:u,onClick:()=>void h(()=>t.save(L9(c))),"data-chart-dashboard-layout-save":!0,children:s(`saveButton`)})]})]}):null}function Z9({tiles:e,layout:t}){let{tComponent:n,isReady:r}=K({component:K9}),[i,a]=(0,Q.useState)(!1),o=(0,Q.useCallback)(()=>a(!1),[]);return r?(0,$.jsxs)(`div`,{className:`flex justify-end`,"data-chart-dashboard-layout-control":!0,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>a(!0),"data-chart-dashboard-layout-open":!0,children:n(K9,`customizeButton`)}),(0,$.jsx)(ZW,{open:i,onOpenChange:a,children:(0,$.jsxs)($W,{children:[(0,$.jsxs)(tG,{children:[(0,$.jsx)(rG,{children:n(K9,`title`)}),(0,$.jsx)(iG,{children:n(K9,`description`)})]}),i&&(0,$.jsx)(X9,{tiles:e,layout:t,onDone:o})]})})]}):null}var Q9;(function(e){e.TWO=`two`,e.THREE=`three`,e.FOUR=`four`})(Q9||={});function $9({tiles:e,columns:t=Q9.FOUR,layoutRef:n,className:r}){let{registry:i}=fm(),a=dS(),o=G9(n,a),s=(0,Q.useMemo)(()=>I9(e,o.stored?.tiles).filter(e=>!e.hidden).map(e=>e.tile),[e,o.stored]),c=(0,Q.useMemo)(()=>s.flatMap(e=>{let t=i.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.chartViewRef);return t!==void 0&&!N9(t.chartDefinition,i,a)?[]:[{tile:e,isFigure:t?.chartDefinition.chartType===gne.KPI}]}),[s,i,a]);if(o.readState===B9.LOADING||c.length===0&&!o.canEdit)return null;let l=Oje[t];return(0,$.jsxs)(`div`,{className:U(`@container flex w-full flex-col gap-element`,r),"data-chart-dashboard":!0,children:[o.canEdit&&(0,$.jsx)(Z9,{tiles:e,layout:o}),c.length>0&&(0,$.jsx)(`div`,{className:U(`grid grid-cols-1 gap-group`,l.columns),children:c.map(({tile:e,isFigure:t})=>(0,$.jsx)(Aje,{tile:e,isFigure:t,grid:l},`${e.resourceType}:${e.chartViewRef}`))})]})}var Oje={[Q9.TWO]:{columns:`@2xl:grid-cols-2`,spanTwo:`@2xl:col-span-2`,rowsTwo:`@2xl:row-span-2`},[Q9.THREE]:{columns:`@md:grid-cols-3`,spanTwo:`@md:col-span-2`,rowsTwo:`@md:row-span-2`},[Q9.FOUR]:{columns:`@2xl:grid-cols-2 @5xl:grid-cols-4`,spanTwo:`@2xl:col-span-2`,rowsTwo:`@2xl:row-span-2`}};function kje(e,t){let n=e.span??Ws.ONE;return U(n===Ws.TWO&&t.spanTwo,n===Ws.FULL&&`col-span-full`,e.rows===qc.TWO&&t.rowsTwo)}function Aje({tile:e,isFigure:t,grid:n}){let{tView:r}=K(),i=r(au.CHART,`resources.${e.resourceType}.${e.chartViewRef}`,`title`);return(0,$.jsxs)(`section`,{className:U(`flex min-w-0 flex-col gap-element`,kje(e,n)),"data-chart-dashboard-tile":`${e.resourceType}:${e.chartViewRef}`,"data-chart-dashboard-figure":t?``:void 0,children:[i&&(0,$.jsx)(Z,{as:`div`,typography:y.EYEBROW,children:i}),(0,$.jsx)(d9,{resourceType:e.resourceType,viewRef:e.chartViewRef,height:e.height??R9(t,e.rows)})]})}function jje(e){let{tiles:t,columns:n,layoutRef:r,...i}=e;function a(){return(0,$.jsx)(JU,{children:(0,$.jsx)($9,{tiles:t,columns:n,layoutRef:r})})}return Sp(a,i)}function Mje(e,t=em.APPLICATION){return lp.parse({ref:e,scope:t,options:{showProgress:!0,allowDismiss:!0,persistState:!0},elements:[]})}function Nje(e,t){return{...e,elements:[...e.elements,t]}}function Pje(e,t){return{...e,elements:e.elements.filter(e=>e.ref!==t)}}function Fje(e,t,n){return{...e,elements:e.elements.map(e=>e.ref===t?{...e,status:n}:e)}}function Ije(e){if(e.elements.length===0)return 0;let t=e.elements.filter(e=>e.status===Hr.COMPLETED).length;return Math.round(t/e.elements.length*100)}function Lje(e){return e.elements.every(e=>e.status===Hr.COMPLETED)}function Rje(e,t){return e.elements.filter(e=>e.type===t)}function zje(e){return JSON.stringify(e,null,2)}function Bje(e){let t=JSON.parse(e);return lp.parse(t)}var Vje=t({ACTOR_TASK_TOPICS_VOCABULARY:()=>Jf,AI_ActorCard:()=>p6,AI_ActorExecutionModeBadge:()=>h6,AI_ActorRoleBadge:()=>m6,AI_ActorTeam:()=>JTe,AI_AgentCapabilities:()=>AEe,AI_AgentCard:()=>l8,AI_AgentList:()=>c8,AI_AgentPromptSpec:()=>kEe,AI_ApprovalQueue:()=>tW,AI_ApprovalRequest:()=>eW,AI_Artifact:()=>bOe,AI_ArtifactAction:()=>DOe,AI_ArtifactActions:()=>EOe,AI_ArtifactClose:()=>SOe,AI_ArtifactContent:()=>COe,AI_ArtifactDescription:()=>TOe,AI_ArtifactFileContent:()=>wEe,AI_ArtifactHeader:()=>xOe,AI_ArtifactItem:()=>o8,AI_ArtifactList:()=>a8,AI_ArtifactOrigin:()=>SEe,AI_ArtifactStructuredContent:()=>TEe,AI_ArtifactTextContent:()=>CEe,AI_ArtifactTitle:()=>wOe,AI_Canvas:()=>pf,AI_ChainOfThought:()=>r7,AI_ChainOfThoughtContent:()=>o7,AI_ChainOfThoughtHeader:()=>i7,AI_ChainOfThoughtImage:()=>Qke,AI_ChainOfThoughtSearchResult:()=>Zke,AI_ChainOfThoughtSearchResults:()=>Xke,AI_ChainOfThoughtStep:()=>a7,AI_Checkpoint:()=>$ke,AI_CodeBlock:()=>x5,AI_Confirmation:()=>bke,AI_Connection:()=>Uke,AI_Context:()=>Kke,AI_Controls:()=>Of,AI_Conversation:()=>k5,AI_ConversationContent:()=>A5,AI_ConversationEmptyState:()=>j5,AI_ConversationScrollButton:()=>M5,AI_ConversationThread:()=>xQ,AI_ConversationThreadComposer:()=>SQ,AI_ConversationThreadDiscussions:()=>CQ,AI_DecisionRequest:()=>nW,AI_DiffBlock:()=>S5,AI_Edge:()=>Wke,AI_ExecutionPlan:()=>D6,AI_ExecutionPlanProgress:()=>k6,AI_ExecutionPlanStep:()=>O6,AI_ExecutionStream:()=>Hke,AI_ExecutionUsage:()=>Y6,AI_ExecutionUsageSummary:()=>Z6,AI_FlowExecutionCanvas:()=>tEe,AI_FlowExecutionSummary:()=>nEe,AI_FlowExecutionTimeline:()=>_6,AI_FlowExecutionTimelineItem:()=>rEe,AI_FlowNodeStatusBadge:()=>yf,AI_FlowNodeStepBadge:()=>Sf,AI_GraphViewer:()=>g6,AI_HumanInputRequest:()=>rW,AI_Image:()=>POe,AI_InlineCitation:()=>eAe,AI_Loader:()=>Yke,AI_Message:()=>DQ,AI_MessageAction:()=>jQ,AI_MessageActions:()=>AQ,AI_MessageAttachment:()=>Abe,AI_MessageAttachments:()=>jbe,AI_MessageBranch:()=>wbe,AI_MessageBranchContent:()=>Tbe,AI_MessageBranchNext:()=>Obe,AI_MessageBranchPage:()=>kbe,AI_MessageBranchPrevious:()=>Dbe,AI_MessageBranchSelector:()=>Ebe,AI_MessageContent:()=>OQ,AI_MessageResponse:()=>kQ,AI_MessageToolbar:()=>Mbe,AI_ModelSelector:()=>qke,AI_Node:()=>Kf,AI_OpenInChat:()=>Jke,AI_Panel:()=>e7,AI_Plan:()=>tAe,AI_PlanAction:()=>sAe,AI_PlanContent:()=>iAe,AI_PlanDescription:()=>oAe,AI_PlanFooter:()=>cAe,AI_PlanHeader:()=>nAe,AI_PlanTitle:()=>aAe,AI_PlanTrigger:()=>rAe,AI_PromptInput:()=>P5,AI_PromptInputActionAddAttachments:()=>QOe,AI_PromptInputActionMenu:()=>JOe,AI_PromptInputActionMenuContent:()=>XOe,AI_PromptInputActionMenuItem:()=>ZOe,AI_PromptInputActionMenuTrigger:()=>YOe,AI_PromptInputAttachment:()=>HOe,AI_PromptInputAttachments:()=>UOe,AI_PromptInputBody:()=>WOe,AI_PromptInputButton:()=>qOe,AI_PromptInputCommand:()=>ake,AI_PromptInputCommandEmpty:()=>cke,AI_PromptInputCommandGroup:()=>lke,AI_PromptInputCommandInput:()=>oke,AI_PromptInputCommandItem:()=>uke,AI_PromptInputCommandList:()=>ske,AI_PromptInputCommandSeparator:()=>dke,AI_PromptInputFooter:()=>I5,AI_PromptInputHeader:()=>GOe,AI_PromptInputHoverCard:()=>fke,AI_PromptInputHoverCardContent:()=>mke,AI_PromptInputHoverCardTrigger:()=>pke,AI_PromptInputProvider:()=>VOe,AI_PromptInputSelect:()=>eke,AI_PromptInputSelectContent:()=>nke,AI_PromptInputSelectItem:()=>rke,AI_PromptInputSelectTrigger:()=>tke,AI_PromptInputSelectValue:()=>ike,AI_PromptInputSpeechButton:()=>$Oe,AI_PromptInputSubmit:()=>L5,AI_PromptInputTab:()=>gke,AI_PromptInputTabBody:()=>vke,AI_PromptInputTabItem:()=>yke,AI_PromptInputTabLabel:()=>_ke,AI_PromptInputTabsList:()=>hke,AI_PromptInputTextarea:()=>F5,AI_PromptInputTools:()=>KOe,AI_Queue:()=>xke,AI_QueueItem:()=>Cke,AI_QueueItemAction:()=>Oke,AI_QueueItemActions:()=>Dke,AI_QueueItemAttachment:()=>kke,AI_QueueItemContent:()=>Tke,AI_QueueItemDescription:()=>Eke,AI_QueueItemFile:()=>jke,AI_QueueItemImage:()=>Ake,AI_QueueItemIndicator:()=>wke,AI_QueueList:()=>Ske,AI_QueueMessageItem:()=>Lke,AI_QueueSection:()=>Mke,AI_QueueSectionContent:()=>Fke,AI_QueueSectionLabel:()=>Pke,AI_QueueSectionTrigger:()=>Nke,AI_QueueTodoItem:()=>Ike,AI_Reasoning:()=>l7,AI_ReasoningContent:()=>d7,AI_ReasoningTrigger:()=>u7,AI_RiskLevelBadge:()=>T6,AI_Shimmer:()=>t7,AI_Source:()=>H5,AI_Sources:()=>z5,AI_SourcesContent:()=>V5,AI_SourcesTrigger:()=>B5,AI_Suggestion:()=>W5,AI_Suggestions:()=>U5,AI_SystemCard:()=>y6,AI_SystemCardCompact:()=>b6,AI_SystemCatalog:()=>oEe,AI_SystemDetail:()=>x6,AI_SystemKindBadge:()=>C6,AI_SystemStatusBadge:()=>w6,AI_Task:()=>Rke,AI_TaskContent:()=>Bke,AI_TaskDetail:()=>M6,AI_TaskItem:()=>Vke,AI_TaskItemFile:()=>q5,AI_TaskList:()=>P6,AI_TaskMemory:()=>hEe,AI_TaskMemoryEntryItem:()=>R6,AI_TaskMemoryScope:()=>L6,AI_TaskTimeline:()=>F6,AI_TaskTrigger:()=>zke,AI_Tool:()=>Y5,AI_ToolContent:()=>Z5,AI_ToolHeader:()=>X5,AI_ToolInput:()=>Q5,AI_ToolOutput:()=>$5,AI_Toolbar:()=>Gke,AI_WebPreview:()=>FOe,AI_WebPreviewBody:()=>zOe,AI_WebPreviewConsole:()=>BOe,AI_WebPreviewNavigation:()=>IOe,AI_WebPreviewNavigationButton:()=>LOe,AI_WebPreviewUrl:()=>ROe,APP_LEVEL_NAVIGATION_SOURCE:()=>Dn,APP_SCOPE_FIELD_DEFAULT_POSITION:()=>999,ARRAY_ROW_TEMPLATE_GUTTER_CLASS:()=>`w-7`,Accordion:()=>pO,AccordionContent:()=>gO,AccordionItem:()=>mO,AccordionTrigger:()=>hO,ActionBar:()=>QS,ActionBarPopoverChrome:()=>YS,ActionButton:()=>d8,ActionPlacement:()=>nc,ActionVisibility:()=>ho,ActivityBarRendering:()=>Ca,ActivityBarRenderingSchema:()=>Gte,ActorActivity:()=>d6,Alert:()=>jD,AlertDescription:()=>ND,AlertDialog:()=>Uw,AlertDialogAction:()=>Xw,AlertDialogCancel:()=>Zw,AlertDialogContent:()=>Gw,AlertDialogDescription:()=>Yw,AlertDialogFooter:()=>qw,AlertDialogHeader:()=>Kw,AlertDialogTitle:()=>Jw,AlertDialogTrigger:()=>Ww,AlertTitle:()=>MD,AnalyticsContext:()=>h$,AnalyticsContextProvider:()=>_$,AnalyticsIdentityPublisherContext:()=>g$,AnalyticsProviderRegistry:()=>p$,AnonymousSessionProvider:()=>op,AnonymousSessionStatus:()=>$oe,ApiNotReadyError:()=>zl,ApiReadinessChecker:()=>Zne,AppCelebrationOverlay:()=>ZQ,AppConfiguration_Frontend_Schema:()=>Cm,AppLayoutPreset_ErrorBoundary_Default:()=>Gy,AppLayoutPreset_Home_Default:()=>KU,AppLayoutPreset_RouterErrorBoundary_Default:()=>Yy,AppLayout_AuthenticatedRoute:()=>zH,AppLayout_ConsentGate:()=>NH,AppLayout_DocumentAcceptanceGate:()=>IH,AppLayout_ErrorBoundary:()=>Ky,AppLayout_Home:()=>qU,AppLayout_MainContainer:()=>AH,AppLayout_NotificationCenter:()=>k8,AppLayout_RouterErrorBoundary:()=>Xy,AppLevelComponentConfigurationSchema:()=>Voe,AppLoadingGate:()=>fb,AppLoadingIdentifier:()=>m,AppModeDefinitionSchema:()=>si,AppModeProvider:()=>nS,AppNotificationCenter:()=>O8,AppScopeContext:()=>Ioe,AppScopeProvider:()=>Tm,AppScopeSessionMode:()=>mee,AppShellContentOutlet:()=>m4,AppShellLoadingState:()=>u4,AppShellOverlayPortalLayer:()=>f4,AppShellOverlaysOutlet:()=>h4,AppShellProviders:()=>d4,AppShellRegionOutlet:()=>p4,ApplicationContext:()=>Fi,ApplicationLevelComponentType:()=>Fr,ApplicationLevel_ActivityBar:()=>A2,ApplicationLevel_CommandMenu:()=>PAe,ApplicationLevel_ControlPanel:()=>FAe,ApplicationLevel_MenuBar:()=>j2,ApplicationLevel_MenuUserOrg:()=>IAe,ApplicationLevel_NavigationBack:()=>yB,ApplicationLevel_NotificationCenter:()=>zAe,ApplicationLevel_QuickActionButton:()=>M2,ApplicationLevel_QuickSwitcher:()=>BAe,ApplicationLevel_Sidebar:()=>N2,ApplicationLevel_StatusBar:()=>P2,ApplicationLevel_Toolbar:()=>F2,ApplicationLevel_UtilityPanel:()=>I2,ApplicationMainProvider:()=>J$,ApprovalSeal:()=>$j,ApprovalSealCheckState:()=>Qj,ApprovalSealReadState:()=>Zj,ArrayAutosavesContext:()=>cI,ArrayField:()=>M9,ArrayItemTemplate:()=>j9,AspectRatio:()=>qEe,AuthPage_OneOffSession:()=>EZ,AuthSessionContext:()=>Roe,AuthSessionProvider:()=>rm,AuthSessionUtils:()=>qm,Auth_AuthCallback:()=>bX,Auth_ChatIdentityLink:()=>VZ,Auth_ConfirmEmail:()=>gZ,Auth_EnrollmentRequired:()=>rZ,Auth_Invitation:()=>CZ,Auth_MagicLinkVerify:()=>wX,Auth_Main:()=>pZ,Auth_MfaChallenge:()=>eZ,Auth_OAuthConsent:()=>IZ,Auth_OAuthLoggedOut:()=>UZ,Auth_OAuthLogoutConfirm:()=>KZ,Auth_OneOffSession:()=>TZ,Auth_OrganizationOnboarding:()=>cZ,Auth_PasswordLost:()=>PZ,Auth_Register:()=>QZ,AutomatedArrayField:()=>gI,AutomatedForm:()=>iE,AutomatedLayoutFrontendUtils:()=>hr,AutomatedLayoutTemplateKind:()=>MT,AutomaticDisplayer:()=>IB,AutosaveFieldState:()=>rT,AutosaveIndicator:()=>VM,AutosaveProvider:()=>DE,AutosaveTrigger:()=>ou,Avatar:()=>g8,AvatarFallback:()=>v8,AvatarImage:()=>_8,BADGE_DISPLAY_CAP:()=>99,BADGE_VARIANT_INDICATOR:()=>c_,BILLING_COMMAND_MENU_ITEM:()=>e6,BILLING_SETTINGS_SECTION_REF:()=>$3,BackendProxyAnalyticsProvider:()=>f$,Badge:()=>If,BillingContext:()=>Hh,BillingPortalLink:()=>F1,BillingProvider:()=>jh,Breadcrumb:()=>xB,BreadcrumbEllipsis:()=>DB,BreadcrumbItem:()=>CB,BreadcrumbLink:()=>wB,BreadcrumbList:()=>SB,BreadcrumbPage:()=>TB,BreadcrumbSeparator:()=>EB,Button:()=>X,ButtonGroup:()=>f8,ButtonGroupSeparator:()=>IEe,ButtonGroupText:()=>p8,ButtonLabelOverflow:()=>tf,ButtonVariants_Variant:()=>J,CATEGORY_LOADING_DEFAULTS:()=>ub,CHART_DASHBOARD_ROW_GAP_PX:()=>32,CHART_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Bae,CHART_ROUTE_PATH_PREFIX:()=>foe,COLLECTION_SURFACE_ATTRIBUTE:()=>mA,COMMON_ENUM_DISPLAY_CONFIG:()=>O_,COMPOSITE_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>noe,Calendar:()=>M8,CalendarDayButton:()=>N8,Card:()=>EF,CardAction:()=>jF,CardActionPlacementSchema:()=>Rre,CardContent:()=>NF,CardDescription:()=>MF,CardFooter:()=>kF,CardHeader:()=>OF,CardLayoutStyle:()=>$l,CardListbox:()=>DF,CardStatusEdge:()=>wF,CardTitle:()=>AF,Carousel:()=>H8,CarouselContent:()=>U8,CarouselItem:()=>W8,CarouselNext:()=>YEe,CarouselPrevious:()=>JEe,ChartDashboard:()=>$9,ChartDashboardColumns:()=>Q9,ChartDashboardLayoutControl:()=>Z9,ChartDashboardLayoutEditor:()=>X9,ChartDashboardLayoutReadState:()=>B9,ChartEmptyState:()=>k_,ChartErrorState:()=>T_,ChartLoadingSkeleton:()=>Sm,ChartView:()=>VJ,ChartWidget:()=>ig,ChatSignInCompletionOutcome:()=>Kb,Checkbox:()=>wI,CheckboxRoot:()=>TI,ChipsInput:()=>sI,Code:()=>v_,Collapsible:()=>CO,CollapsibleContent:()=>TO,CollapsibleTrigger:()=>wO,CollectionBoardConfigSchema:()=>bne,CollectionCalendarConfigSchema:()=>pre,CollectionDisplayMode:()=>_u,CollectionFilterPanelVisibility:()=>qo,CollectionFilterPresetContextValue:()=>ds,CollectionFilterPresetRelativeMonthRange:()=>gl,CollectionFilterPresetRelativeRange:()=>Kc,CollectionFilterPresetSchema:()=>Us,CollectionFilterPresetValueSchema:()=>Ds,CollectionTimelineConfigSchema:()=>nne,CollectionToolbarPresence:()=>Cu,ColorInput:()=>NI,ColorNotation:()=>F3,Combobox:()=>vx,ComboboxMultiple:()=>yx,Command:()=>bV,CommandBarPolicy:()=>vm,CommandDialog:()=>xV,CommandEmpty:()=>wV,CommandGroup:()=>TV,CommandInput:()=>SV,CommandItem:()=>EV,CommandList:()=>CV,CommandMenuCommandSchema:()=>u,CommandMenuDisplayPolicy:()=>Mt,CommandMenuPaletteGroupKind:()=>f2,CommandMenuSearchResourceSchema:()=>Fne,CommandSeparator:()=>OV,CommandShortcut:()=>DV,ComponentNotInjected:()=>al,ComponentRegistryKeyBuilder:()=>Wl,ComponentRegistryService:()=>Fo,ComponentsViewportProvider:()=>r_,ComposedChildrenRegistryProvider:()=>sY,CompositeLayout:()=>JU,CompositeView:()=>VU,CompositeViewDefinitionBaseSchema:()=>Foe,CompositeViewDefinitionSchema:()=>Lae,CompositeViewProvider:()=>RU,CompositeView_BaseFieldsSchema:()=>Moe,ConnectionStatusNotifier:()=>u$,ConsentBasedProviderActivationsContext:()=>Ox,ConsentBasedProviderSdksProvider:()=>kx,ConsentGateStatus:()=>Qb,ConsoleAnalyticsProvider:()=>d$,ContentAreaRenderBranch:()=>J0,ContentSection:()=>OT,ContentSectionContainer:()=>WO,ContentSectionGroup:()=>kT,ContentSectionLegend:()=>AT,ContextLoadingIdentifier:()=>ns,ContextMenu:()=>BDe,ContextMenuCheckboxItem:()=>WDe,ContextMenuContent:()=>n5,ContextMenuGroup:()=>HDe,ContextMenuItem:()=>UDe,ContextMenuLabel:()=>qDe,ContextMenuRadioGroup:()=>GDe,ContextMenuRadioItem:()=>KDe,ContextMenuSeparator:()=>JDe,ContextMenuShortcut:()=>YDe,ContextMenuSub:()=>XDe,ContextMenuSubContent:()=>r5,ContextMenuSubTrigger:()=>ZDe,ContextMenuTrigger:()=>VDe,ControlPanelControlType:()=>d2,ControlPanelItemSchema:()=>gie,ConversationThreadEntryKind:()=>sQ,ConversationTurnState:()=>cQ,CoreIconRegistry:()=>Cf,CrossFrontendHandoffClientError:()=>K3,CustomComponentItemRefSchema:()=>Ore,DEFAULT_ACTION_DISCLOSURE:()=>eae,DEFAULT_BUTTON_COMPONENT_REQUIREMENT:()=>$f,DEFAULT_CHART_STYLE_PRESET:()=>wg,DEFAULT_ICON_CONFIG:()=>Bf,DEFAULT_INSERTED_VIEW_LAUNCHER:()=>Jae,DEFAULT_MATERIAL_RUNTIME_POLICY:()=>e_,DEFAULT_MAX_EMBEDDED_RESOURCE_DEPTH:()=>3,DEFAULT_SUMMARY_CHROME_MODE:()=>uG,DEFAULT_VALIDATION_MODE:()=>jT,DUPLICATE_KEY_ERROR_TYPE:()=>lT,DangerZone:()=>SY,DatePicker:()=>$M,DateRangePicker:()=>uN,DateTimePicker:()=>nN,DateTimeRangePicker:()=>pN,DecisionApprovalSeal:()=>rM,DecisionInboxCapability:()=>Gv,DefaultHotkeyHandler:()=>R$,DescriptionDetails:()=>U1,DescriptionList:()=>V1,DescriptionTerm:()=>H1,DeviceInfoSchema:()=>fce,DeviceType:()=>By,Dialog:()=>ZW,DialogClose:()=>eG,DialogContent:()=>$W,DialogDescription:()=>iG,DialogFooter:()=>nG,DialogHeader:()=>tG,DialogTitle:()=>rG,DialogTrigger:()=>QW,DiffLineKind:()=>C5,DirectoryProvisioningCapability:()=>Cv,DisabledActionHandling:()=>ko,DiscriminatorSwitch:()=>AR,DisplayChromeContext:()=>ak,DisplayChromeProvider:()=>ok,DisplayContextKind:()=>PA,DisplayContextKindProvider:()=>IA,DisplayDiscriminatorSwitch:()=>jR,DisplayField:()=>yR,DisplayFieldAddress:()=>Kj,DisplayFieldArray:()=>j8,DisplayFieldBigDecimal:()=>qj,DisplayFieldBoolean:()=>Rj,DisplayFieldChrome:()=>cj,DisplayFieldCode:()=>Jj,DisplayFieldDate:()=>sM,DisplayFieldDateTime:()=>cM,DisplayFieldDuration:()=>Wj,DisplayFieldEditable:()=>nR,DisplayFieldEnum:()=>Hj,DisplayFieldErrorBoundary:()=>bR,DisplayFieldFile:()=>iM,DisplayFieldFileAudio:()=>T8,DisplayFieldFileDocument:()=>E8,DisplayFieldFileGallery:()=>D8,DisplayFieldFileImage:()=>C8,DisplayFieldFileVideo:()=>w8,DisplayFieldJson:()=>Yj,DisplayFieldMoney:()=>Uj,DisplayFieldNumber:()=>Vj,DisplayFieldPhone:()=>Gj,DisplayFieldRangeBigDecimal:()=>aM,DisplayFieldRangeDate:()=>dM,DisplayFieldRangeDateTime:()=>fM,DisplayFieldRangeMoney:()=>oM,DisplayFieldRangeNumber:()=>uM,DisplayFieldRangeTime:()=>pM,DisplayFieldReadOnly:()=>xM,DisplayFieldString:()=>Bj,DisplayFieldTime:()=>lM,DisplayLayout:()=>hA,DisplayTemplateProvider:()=>nk,DisplayValueDispatcher:()=>bM,Divider:()=>XEe,DocumentAcceptanceGateStatus:()=>PH,Drawer:()=>u1,DrawerClose:()=>p1,DrawerContent:()=>f1,DrawerDescription:()=>_1,DrawerFooter:()=>h1,DrawerHeader:()=>m1,DrawerTitle:()=>g1,DrawerTrigger:()=>d1,DropdownMenu:()=>a5,DropdownMenuCheckboxItem:()=>$De,DropdownMenuContent:()=>s5,DropdownMenuGroup:()=>QDe,DropdownMenuItem:()=>c5,DropdownMenuLabel:()=>l5,DropdownMenuRadioGroup:()=>eOe,DropdownMenuRadioItem:()=>tOe,DropdownMenuSeparator:()=>u5,DropdownMenuShortcut:()=>nOe,DropdownMenuSub:()=>d5,DropdownMenuSubContent:()=>p5,DropdownMenuSubTrigger:()=>f5,DropdownMenuTrigger:()=>o5,Duration:()=>x8,EMPTY_AUTH_STATE:()=>Xoe,ENGINE_DEFAULT_HOTKEY_EMIT_SHORTCUTS:()=>L$,ENGINE_PAGE_METADATA:()=>Fl,ENGINE_SETTINGS_DESTINATIONS:()=>Av,ERROR_DEDUPLICATION_WINDOW_MS:()=>jee,ERROR_MAX_DUPLICATES:()=>3,EXECUTION_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Woe,EmbedChart:()=>d9,EmbedComposite:()=>JAe,EmbedExecution:()=>YAe,EmbedExecutionDecisions:()=>y9,EmbedHostChart:()=>tje,EmbedHostExecution:()=>rje,EmbedHostResourceOperation:()=>XAe,EmbedLinkedConversations:()=>ZAe,EmbedOnboarding:()=>qAe,EmbedRelatedChart:()=>nje,EmbedRelatedExecution:()=>ije,EmbedRelatedResourceList:()=>v9,EmbedRelatedResourceOperation:()=>_9,EmbedRelatedResourceSearch:()=>eje,EmbedRepresentationMailboxes:()=>w9,EmbedRepresentationTeam:()=>C9,EmbedResourceOperation:()=>g9,EmbedResourceOwnedChartView:()=>Rve,EmbedResourceOwnedCompositeView:()=>nX,EmbedResourceOwnedExecutionView:()=>zve,EmbeddedResourceDescentBoundary:()=>aY,EmbeddedResourceHostProvider:()=>PU,EmphasisedActionLabelsProvider:()=>eC,EmptyState:()=>dm,EmptyValueMark:()=>Fj,EngineNavigationEntry:()=>om,EnginePageItemRefSchema:()=>qne,EnginePageRef:()=>po,EnginePageRefSchema:()=>Ire,EnvVariableLoaderFrontendService:()=>Rte,EphemeralSessionTokenStorage:()=>nm,ErrorBoundary:()=>Jy,ErrorBuilderFrontend:()=>De,ErrorContext:()=>Bie,ErrorDisplay:()=>Wy,ErrorManagementService:()=>Ui,ErrorPageActionSchema:()=>yoe,ErrorPageActionType:()=>mm,ErrorPageConfigDefinitionSchema:()=>qoe,ErrorPageConfigSchema:()=>Coe,ErrorPageFeatureGuideItemSchema:()=>Loe,ErrorPageLeadMagnetType:()=>Yoe,ErrorPageSupportAccessSchema:()=>Toe,ErrorPageSupportType:()=>Doe,ErrorProvider:()=>bi,EventBusContext:()=>Wi,EventBusProvider:()=>pt,ExecutionAnchorSource:()=>iy,ExecutionConcreteOperationIdentitySchema:()=>Boe,ExecutionDirtyMarkerScope:()=>sy,ExecutionDirtyMarkerScopeContext:()=>My,ExecutionDirtyMarkerScopeProvider:()=>Ny,ExecutionFailedActionScope:()=>dy,ExecutionNavigationHandlingMode:()=>am,ExecutionNavigationPolicyDefinitionSchema:()=>Aoe,ExecutionNavigationPolicyExceptionRuleSchema:()=>voe,ExecutionParticipationDefinitionSchema:()=>Qoe,ExecutionParticipationPrefetchIntent:()=>ay,ExecutionParticipationSource:()=>jm,ExecutionRuntimeContext:()=>py,ExecutionRuntimeProvider:()=>hy,ExecutionSurfaceInOperationSchema:()=>Soe,ExecutionUsageReadState:()=>K6,ExecutionView:()=>$Y,ExecutionViewAnchorBindingSource:()=>km,ExecutionViewAnchorDefinitionSchema:()=>ooe,ExecutionViewDefinitionSchema:()=>Vae,FILE_VALIDATION_ERROR_TYPE:()=>iI,FLOWS_ACTORS_RELATION_VOCABULARY:()=>zf,FLOWS_ACTORS_STATUS_VOCABULARY:()=>Nf,FLOW_STEP_CATEGORY_ICONS:()=>ep,FLOW_TRIGGER_TYPE_LABEL_KEYS:()=>ef,FOCUS_INDICATOR_CLASSES:()=>Sg,FORM_ERROR_SUMMARY_ATTRIBUTE:()=>GD,FORM_LEVEL_ERROR_PATH:()=>cT,FRONTEND_DECLARED_SCHEMA_KEY:()=>Yu,FRONTEND_PRODUCED_BADGE_SCOPE_ID:()=>i6,FRONTEND_SCHEMA_KEY:()=>Di,FeatureGate:()=>D0,FeatureLimitIndicator:()=>Q3,FeatureLockBadge:()=>zTe,FeatureRouteGuard:()=>$h,FeatureUnavailableDialog:()=>RTe,FeatureUnavailablePrompt:()=>Kh,FeaturesContext:()=>gh,FeaturesProvider:()=>lg,Field:()=>fx,FieldContent:()=>hx,FieldControlAriaProvider:()=>zM,FieldDescription:()=>gx,FieldError:()=>_x,FieldLabel:()=>px,FieldScopeProvider:()=>TD,FieldSeparator:()=>sle,FieldTiles:()=>wA,FieldTitle:()=>mx,FieldValueMembersChromeBoundary:()=>ck,FieldVariants_Orientation:()=>dx,FileApprovalSeal:()=>nM,FileUpload:()=>F8,FilesPage_UploadGrant:()=>jZ,Files_UploadGrantDrop:()=>AZ,FlowStepCategory:()=>Pae,FlowsActorsContext:()=>yW,FlowsActorsExecutionStatus:()=>hW,FlowsActorsProvider:()=>bW,FlowsActorsUIUtils:()=>Vd,FlowsActorsView:()=>IQ,FlowsActorsViewDefinitionSchema:()=>Uae,FlowsActors_AgentCard:()=>FEe,FlowsActors_AgentList:()=>PEe,FlowsActors_ApprovalQueue:()=>WW,FlowsActors_ApprovalRequest:()=>PW,FlowsActors_ArtifactItem:()=>OEe,FlowsActors_ArtifactList:()=>DEe,FlowsActors_ExecutionUsage:()=>X6,FlowsActors_ExecutionUsageSummary:()=>Q6,FocusIndicatorShape:()=>d_,Form:()=>FT,FormChromeContext:()=>Qw,FormChromeProvider:()=>$w,FormContextUtils:()=>ID,FormControl:()=>UEe,FormDescription:()=>WEe,FormErrorSummary:()=>ZD,FormErrorSummarySlot:()=>tO,FormField:()=>XL,FormFieldAddress:()=>cL,FormFieldAddress_Preset_Default:()=>sL,FormFieldArray:()=>A8,FormFieldBigDecimal:()=>dL,FormFieldBigDecimal_Preset_Default:()=>uL,FormFieldBoolean:()=>OI,FormFieldBoolean_Preset_Default:()=>DI,FormFieldCheckboxGroup:()=>tI,FormFieldChrome:()=>GM,FormFieldCode:()=>fL,FormFieldComposite:()=>bN,FormFieldContext:()=>R8,FormFieldDate:()=>tN,FormFieldDateTime:()=>iN,FormFieldDateTime_Preset_Default:()=>rN,FormFieldDate_Preset_Default:()=>eN,FormFieldDuration:()=>XI,FormFieldDuration_Preset_Default:()=>YI,FormFieldEnum:()=>rI,FormFieldEnum_Preset_Default:()=>nI,FormFieldFile:()=>HL,FormFieldFile_Preset_Default:()=>VL,FormFieldLegendVoice:()=>SD,FormFieldMoney:()=>JI,FormFieldMoney_Preset_Default:()=>qI,FormFieldNumber:()=>GI,FormFieldNumber_Preset_Default:()=>WI,FormFieldPhone:()=>rL,FormFieldPhone_Preset_Default:()=>nL,FormFieldPrimitive:()=>KEe,FormFieldRangeBigDecimal:()=>mL,FormFieldRangeBigDecimal_Preset_Default:()=>pL,FormFieldRangeDate:()=>fN,FormFieldRangeDateTime:()=>hN,FormFieldRangeDateTime_Preset_Default:()=>mN,FormFieldRangeDate_Preset_Default:()=>dN,FormFieldRangeMoney:()=>gL,FormFieldRangeMoney_Preset_Default:()=>hL,FormFieldRangeNumber:()=>lN,FormFieldRangeNumber_Preset_Default:()=>cN,FormFieldRangeTime:()=>vN,FormFieldRangeTime_Preset_Default:()=>_N,FormFieldString:()=>UI,FormFieldString_Preset_Default:()=>HI,FormFieldTime:()=>sN,FormFieldTime_Preset_Default:()=>oN,FormItem:()=>VEe,FormItemContext:()=>z8,FormLabel:()=>HEe,FormLayout:()=>nA,FormMessage:()=>GEe,FormRoot:()=>BEe,FormSchemaContext:()=>iT,FormSchemaKind:()=>nT,FormSchemaProvider:()=>aT,FormTemplateProvider:()=>LT,FrontEndEvent_BasicUser_Schema:()=>lae,FrontendEventBadgeCountChangedSchema:()=>le,FrontendEventBulkJobProgressSchema:()=>Ete,FrontendEventCategory:()=>on,FrontendEventCategoryMap:()=>yte,FrontendEventCustomSchema:()=>Nte,FrontendEventErrorOccuredSchema:()=>Ht,FrontendEventLoadingResourceSchema:()=>nr,FrontendEventNoDataSchema:()=>iie,FrontendEventNotifyCustomSchema:()=>Bn,FrontendEventOrgBillingStatusChangedSchema:()=>Bte,FrontendEventOrgStatusChangedSchema:()=>wa,FrontendEventOrganizationBrandingChangedSchema:()=>Jte,FrontendEventResourceCustomSchema:()=>li,FrontendEventResourceEditingSchema:()=>f,FrontendEventResourceOperationSchema:()=>Rne,FrontendEventSchemas:()=>bie,FrontendEventUserLoginSchema:()=>Are,FrontendEventUserLogoutSchema:()=>die,FrontendEventUserPreferencesChangedSchema:()=>Xne,FrontendEventUserStatusChangedSchema:()=>une,FrontendEvent_AnalyticsMomentAchievedSchema:()=>Vre,FrontendEvent_AppScopeChangedSchema:()=>fie,FrontendEvent_GuidanceElementSchema:()=>Sne,FrontendEvent_GuidanceFlowSchema:()=>gre,FrontendEvent_HotkeyCommandMenuOpenSchema:()=>Oie,FrontendEvent_HotkeyNotificationsOpenSchema:()=>Ane,FrontendEvent_HotkeyQuickSwitcherOpenSchema:()=>Wne,FrontendEvent_HotkeyShortcutsHelpSchema:()=>Xre,FrontendEvent_HotkeySidebarToggleSchema:()=>Ere,FrontendEvent_LifecycleStageChangedSchema:()=>Js,FrontendEvent_MilestoneAchievedSchema:()=>js,FrontendEvent_NavigationClearZoneSchema:()=>rne,FrontendEvent_NavigationCloseSchema:()=>Eu,FrontendEvent_NavigationOrganizationFollowedSchema:()=>rae,FrontendEvent_NavigationPopSchema:()=>mne,FrontendEvent_NavigationPushSchema:()=>Kie,FrontendEvent_NavigationReplaceSchema:()=>Mi,FrontendEvent_NavigationRequestSchema:()=>ke,FrontendEvent_NavigationUrlPathUpdatedSchema:()=>Lie,FrontendEvent_NavigationZoneChangedSchema:()=>fte,FrontendEvent_PrimaryScopeChangedSchema:()=>ft,FrontendEvent_ProgressionUpdatedSchema:()=>qe,FrontendEvent_ResourceCollectionFiltersChangedSchema:()=>Mee,FrontendEvents:()=>Ec,FrontendInsertedViewHostKind:()=>Bp,FrontendInsertedViewIdentitySchema:()=>Wae,FrontendInsertedViewKind:()=>bp,FrontendResourceOperationAddressingMode:()=>dse,FrontendResourceOperationContextSchema:()=>Te,FrontendResourceOperationPathSchema:()=>Ute,FrontendResourcePathSchema:()=>oi,FrontendResource_ParentResourceRequirementSchema:()=>c,FrontendView_DefinitionSchema:()=>Iae,FrontendView_ScopeMode:()=>em,FullCustomView:()=>oQ,FullCustomViewDefinitionSchema:()=>coe,GENERIC_ERROR_WORDING_BY_ERROR_TYPE:()=>toe,GRAPH_VIEW_ADMITS_PORT:()=>Ud,GRAPH_VIEW_GATE_PORT:()=>Kd,GRAPH_VIEW_IN_PORT:()=>`in`,GRAPH_VIEW_LAYOUT_GROUP_HEADER:()=>32,GRAPH_VIEW_LAYOUT_GROUP_MIN_WIDTH:()=>160,GRAPH_VIEW_LAYOUT_GROUP_PADDING:()=>16,GRAPH_VIEW_LAYOUT_NODE_SPACING:()=>40,GRAPH_VIEW_LAYOUT_RANK_SPACING:()=>80,GRAPH_VIEW_OUT_PORT:()=>`out`,GUIDANCE_ELEMENT_COMPONENT_TYPE:()=>Q2,GUIDANCE_FALLBACK:()=>eU,GenericErrorWording:()=>Poe,GlobalErrorHandler:()=>tb,GoogleFontPresets:()=>Cg,GovernedDocumentAcceptanceControl:()=>JZ,GraphCanvasInteraction:()=>Lf,GraphHandleRole:()=>Ff,GraphLegendMark:()=>Wf,GraphNodeSide:()=>Hf,GraphViewEdgeKind:()=>Fae,GraphViewLayoutDirection:()=>Yd,GraphViewNodeKind:()=>Nae,GraphViewerPresentation:()=>_f,Group:()=>A9,GroupedSectionBody:()=>Xk,GuidanceAnnouncement:()=>q2,GuidanceBadge:()=>J2,GuidanceBanner:()=>K2,GuidanceCard:()=>Y2,GuidanceChecklist:()=>V2,GuidanceChecklistItem:()=>H2,GuidanceContext:()=>qH,GuidanceContextProvider:()=>gU,GuidanceModal:()=>G2,GuidanceRenderer:()=>i4,GuidanceSurvey:()=>X2,GuidanceTooltip:()=>W2,GuidanceTour:()=>U2,HOTKEY_DEFAULT_PRIORITY:()=>0,HOTKEY_FRAMEWORK_DEFAULT_PRIORITY:()=>w$,HOTKEY_SCOPE_SPECIFICITY:()=>T$,HTTP_ERROR_BEHAVIOR_MATRIX:()=>Ge,HeaderIconPlacement:()=>zu,Heading:()=>CY,HomeDefinitionSchema:()=>Uoe,HostFormActionsFooter:()=>cE,HostedComponentInteractionsProvider:()=>B2,HostedTriggerAppearance:()=>Yl,HotkeyBindingSchema:()=>yne,HotkeyDispatchableEvent:()=>jn,HotkeyEmitShortcutSchema:()=>oee,HotkeyGroup:()=>yi,HotkeyRegistryContext:()=>k$,HotkeyRegistryProvider:()=>j$,HotkeyScope:()=>ld,HotkeyShortcutsHelpDialog:()=>H$,HoverCard:()=>h5,HoverCardContent:()=>_5,HoverCardTrigger:()=>g5,HumanDecisionForm:()=>r8,I18nContext:()=>Nc,I18nProvider:()=>fu,ICON_SIZE_MAP:()=>id,INDICATOR_BADGE_VARIANT:()=>n_,IconCategory:()=>re,IconCategorySchema:()=>Cte,IconPropsSchema:()=>en,IconRegistryBridge:()=>$Q,IconRegistryContext:()=>Yf,IconRegistryProvider:()=>bf,IconRequestSchema:()=>hte,IconSize:()=>ca,IconSizeSchema:()=>Lt,Identifier:()=>b8,ImageCrop:()=>SL,InMemoryFrontendProviderRegistryFrontendService:()=>Ub,InitializationStatusSchema:()=>Qe,InlineEditMutationError:()=>fj,InlineEditState:()=>NT,InlineEditText:()=>P8,Input:()=>ZM,InputGroup:()=>ZI,InputGroupAddon:()=>QI,InputGroupButton:()=>$I,InputGroupInput:()=>eL,InputGroupText:()=>ehe,InputGroupTextarea:()=>tL,InputOTP:()=>LI,InputOTPGroup:()=>RI,InputOTPSeparator:()=>Kme,InputOTPSlot:()=>zI,InputRoot:()=>QM,InsertedChartDeclarationSchema:()=>Kae,InsertedViewInputBindingSchema:()=>Goe,InsertedViewInputBindingSource:()=>Yae,InsertedViewLauncherConfigSchema:()=>$ae,InsertedViewLauncherPlacement:()=>Fp,InsertedViewRenderSlot:()=>rX,InvoiceHistory:()=>B1,Kbd:()=>z$,LIFECYCLE_DEFAULTS:()=>$H,LOCAL_STORAGE_KEYS:()=>ms,Label:()=>VX,LauncherItemRefSchema:()=>dre,LauncherItemTargetKind:()=>hu,LauncherItemTargetKindSchema:()=>Ene,LauncherRuntimeAvailabilityConfigSchema:()=>Hne,LauncherVerificationErrorCode:()=>Rv,LauncherVerificationSeverity:()=>Lv,LayoutDivider:()=>mje,LazyDoorErrorBoundary:()=>zJ,LazyDoorUnavailableFrame:()=>BJ,Link:()=>_X,LinkVariants_Underline:()=>hX,LinkVariants_Variant:()=>mX,LinkVariants_Weight:()=>gX,LoadingBarrier:()=>Ace,LoadingContext:()=>$m,LoadingGate:()=>sb,LoadingOverlay:()=>ab,LoadingPhase:()=>uu,LoadingProvider:()=>Bm,LoadingSpinner:()=>ib,LoadingTier:()=>tl,LoadingTreatment:()=>Ll,LoggerFrontendService:()=>as,MOBILE_DETAIL_MAX_PRIMARY_ACTIONS:()=>1,MOBILE_SUMMARY_MAX_PRIMARY_ACTIONS:()=>0,MainContextInitComponents:()=>Pe,MarkdownEditor:()=>MI,MaterialRefractiveBudgetManager:()=>l_,MaterialRuntimeGroup:()=>qg,MaterialRuntimePolicyProvider:()=>Jg,MenuBarDisplayPolicy:()=>zoe,Menubar:()=>ZEe,MenubarCheckboxItem:()=>tDe,MenubarContent:()=>J8,MenubarGroup:()=>$Ee,MenubarHostedComponentSchema:()=>Gre,MenubarItem:()=>eDe,MenubarLabel:()=>iDe,MenubarLauncherItemSchema:()=>Sre,MenubarMenu:()=>QEe,MenubarRadioGroup:()=>nDe,MenubarRadioItem:()=>rDe,MenubarSeparator:()=>aDe,MenubarShortcut:()=>oDe,MenubarSub:()=>sDe,MenubarSubContent:()=>Y8,MenubarSubTrigger:()=>cDe,MenubarTrigger:()=>q8,MilestoneStatus:()=>xU,MissingRMMRuntimeError:()=>ua,ModifierKey:()=>S$,NAVIGATION_STRUCTURAL_ZONES:()=>pr,NON_CANONICAL_SHELL_SURFACE_POLICY_OVERRIDE:()=>KE,NOTIFICATION_DISPLAY_POLICY:()=>mse,NOTIFICATION_SOURCE_OVERRIDES:()=>Zh,NavigationBackHost:()=>_B,NavigationContentAreas:()=>i2,NavigationContentRenderer:()=>R0,NavigationContentSchema:()=>nte,NavigationContentType:()=>sd,NavigationContext:()=>mh,NavigationInitiatorContextSchema:()=>de,NavigationItemBadge:()=>G8,NavigationItemType:()=>ra,NavigationMenu:()=>lDe,NavigationMenuContent:()=>fDe,NavigationMenuIndicator:()=>hDe,NavigationMenuItem:()=>dDe,NavigationMenuLink:()=>mDe,NavigationMenuList:()=>uDe,NavigationMenuTrigger:()=>pDe,NavigationMenuViewport:()=>gDe,NavigationOperationOverrideSchema:()=>We,NavigationOverlays:()=>a2,NavigationPlacementAdjustment:()=>cn,NavigationProvider:()=>th,NavigationSource:()=>Qi,NavigationStackEntrySchema:()=>pa,NavigationTransitionSource:()=>Wt,NavigationUtils:()=>dh,NavigationZone:()=>rr,NavigationZoneSchema:()=>Dl,NetworkOfflineError:()=>Yn,NetworkOfflineReason:()=>eie,NotificationBadgeMemoryBoundary:()=>a$,NotificationContext:()=>uh,NotificationIndicator:()=>y8,NotificationProvider:()=>Hm,ObjectScope:()=>kR,OfflineReplayPolicy:()=>Nn,OnboardingView:()=>o9,OnboardingViewDefinitionSchema:()=>lp,OperationsConfirmCritical:()=>Iw,OverlayContainer:()=>b1,PRIMARY_SCOPE_FIELDS:()=>wee,PROFESSIONAL_QUALIFICATIONS_DECLARED_CAPABILITY:()=>kv,PROGRESSION_DEFAULTS:()=>QH,PROVIDER_ADDRESS_LOOKUP_DEBOUNCE_MS:()=>300,PROVIDER_ADDRESS_LOOKUP_MINIMUM_QUERY_LENGTH:()=>3,Pagination:()=>rOe,PaginationContent:()=>iOe,PaginationEllipsis:()=>lOe,PaginationItem:()=>aOe,PaginationLink:()=>oOe,PaginationNext:()=>cOe,PaginationPrevious:()=>sOe,PasskeyAutofillExpiredError:()=>Am,PasskeyAutofillSupersededError:()=>boe,PasskeySignInMediation:()=>Om,PasswordInput:()=>FI,PendingDecisionsReadState:()=>cW,PersistentSessionTokenStorage:()=>_oe,PlanChangePreview:()=>L1,Popover:()=>sq,PopoverAnchor:()=>uq,PopoverContent:()=>lq,PopoverTrigger:()=>cq,PortalContainerContext:()=>T2,PricingTable:()=>R1,Progress:()=>E_,ProgressionAchievementBadge:()=>VTe,ProgressionMilestoneTracker:()=>MU,ProviderAddressLookupAttribution:()=>xx,ProviderAddressLookupCombobox:()=>Cx,ProviderAddressLookupHost:()=>Ex,ProviderAddressLookupNotice:()=>Tx,ProviderAddressLookupPlaceWithoutAddressError:()=>bx,ProviderAddressLookupRejectionKind:()=>sx,ProviderFilePickerHost:()=>ux,ProviderFileSelectionRejectionKind:()=>ax,PublicLayoutPreset_AuthCallback_Default:()=>yX,PublicLayoutPreset_ChatIdentityLink_Default:()=>BZ,PublicLayoutPreset_EnrollmentRequired_Default:()=>nZ,PublicLayoutPreset_FileUploadGrant_Default:()=>kZ,PublicLayoutPreset_MagicLinkVerify_Default:()=>CX,PublicLayoutPreset_MfaChallenge_Default:()=>$X,PublicLayoutPreset_OAuthConsent_Default:()=>FZ,PublicLayoutPreset_OAuthLoggedOut_Default:()=>HZ,PublicLayoutPreset_OAuthLogoutConfirm_Default:()=>GZ,PublicLayoutPreset_OneOffSession_Default:()=>wZ,PublicLayoutPreset_OrganizationOnboarding_Default:()=>sZ,PublicLayoutPreset_StaticContentContainer_Default:()=>M3,PublicLayoutPreset_UserAuth_Default:()=>fZ,PublicLayoutPreset_UserConfirmEmail_Default:()=>hZ,PublicLayoutPreset_UserInvitation_Default:()=>SZ,PublicLayoutPreset_UserPasswordLost_Default:()=>NZ,PublicLayoutPreset_UserRegister_Default:()=>ZZ,PublicLayout_LegalNotice:()=>eQ,PublicLayout_MainContainer:()=>pX,PublicLayout_StaticContentContainer:()=>xTe,PublicLayout_Terms:()=>$Z,PublicShellIdentityMode:()=>im,QuickActionButtonPlacement:()=>Vs,QuickActionButtonPlacementSchema:()=>ws,QuickActionDisplayPolicy:()=>he,QuickActionItemSchema:()=>ene,QuickActionPlacement:()=>koe,QuickSwitcherFieldControlKind:()=>l2,QuickSwitcherFieldPresentation:()=>Jp,QuickSwitcherPlacement:()=>Zoe,QuickSwitcherScopeFieldSchema:()=>nse,READ_RETRY_FIRST_DELAY_MS:()=>QJ,READ_RETRY_MAX_DELAY_MS:()=>$J,REGIONAL_PREFERENCE_FRAMEWORK_FLOOR:()=>vs,RETRYABLE_CLIENT_ERROR_STATUSES:()=>fc,REVEAL_FIELD_EVENT:()=>LD,RUNTIME_SCOPED_STORAGE_KEYS:()=>Zre,RadioGroup:()=>xF,RadioGroupItem:()=>CF,RadioGroupRoot:()=>SF,RangeSlider:()=>YM,RecordApprovalSeal:()=>lfe,RecordFactRole:()=>DA,RecordKeepingFacts:()=>EA,RecordState:()=>TA,RegionalReaderStanding:()=>$te,RegionalReaderStandingPublisherContext:()=>Tne,RegistrationOutcome:()=>Np,RelatedResourcePreview:()=>GAe,RelatedResourcePreviewSurface:()=>a9,RelatedResourceSections:()=>E9,RelationshipShapeCapability:()=>xv,RelationshipSideCapability:()=>vv,ResizableHandle:()=>e1,ResizablePanel:()=>$$,ResizablePanelGroup:()=>Q$,ResolvedInsertedChartDescriptorSchema:()=>doe,ResolvedInsertedViewDescriptorSchema:()=>hoe,ResourceAutomatedForm:()=>mB,ResourceAutomaticDisplayer:()=>tY,ResourceCollectionQuickFilterTabs:()=>iq,ResourceDisplayContext:()=>uj,ResourceEmptyState:()=>nK,ResourceFieldDisplay_ResourceReference:()=>zj,ResourceFieldEdit_ResourceReference:()=>_I,ResourceFormActionsProvider:()=>oE,ResourceFrontend_EmptyStateSecondaryActionType:()=>Ur,ResourceFrontend_GuidanceFlowTriggerType:()=>sre,ResourceHeaderContextProvider:()=>RB,ResourceHeaderLeading:()=>WB,ResourceHeaderTitle:()=>UB,ResourceHeaderTitleHeading:()=>BB,ResourceHeaderTitlePlaceholder:()=>VB,ResourceLayoutInlineEditDefault:()=>E,ResourceLayoutPreset_Action_Default:()=>JW,ResourceLayoutPreset_Breadcrumb_Default:()=>AB,ResourceLayoutPreset_ContainerDialogs_Default:()=>O3,ResourceLayoutPreset_ContainerNested_Default:()=>vY,ResourceLayoutPreset_Create_Default:()=>oG,ResourceLayoutPreset_Create_SamlWizard:()=>t9,ResourceLayoutPreset_DangerZone_Default:()=>TY,ResourceLayoutPreset_Filters_Default:()=>k3,ResourceLayoutPreset_Header_Default:()=>aV,ResourceLayoutPreset_List_Default:()=>uX,ResourceLayoutPreset_OperationsBulk_Default:()=>IJ,ResourceLayoutPreset_OperationsItems_Default:()=>bY,ResourceLayoutPreset_Pagination_Default:()=>ZG,ResourceLayoutPreset_ReadSummary_Default:()=>j3,ResourceLayoutPreset_Read_Default:()=>IY,ResourceLayoutPreset_Read_Expandable:()=>A3,ResourceLayoutPreset_Read_SsoSaml:()=>n9,ResourceLayoutPreset_RecordSharing_Default:()=>MY,ResourceLayoutPreset_Search_Default:()=>BY,ResourceLayoutPreset_Update_Default:()=>HY,ResourceLayout_Action:()=>YW,ResourceLayout_Breadcrumb:()=>MB,ResourceLayout_ContainerDialogs:()=>hTe,ResourceLayout_ContainerNested:()=>yY,ResourceLayout_Create:()=>sG,ResourceLayout_DangerZone:()=>EY,ResourceLayout_Filters:()=>gTe,ResourceLayout_Header:()=>oV,ResourceLayout_InsertedViews:()=>aX,ResourceLayout_List:()=>dX,ResourceLayout_OperationBulk:()=>LJ,ResourceLayout_OperationsItems:()=>xY,ResourceLayout_Pagination:()=>QG,ResourceLayout_Read:()=>RY,ResourceLayout_ReadSummary:()=>vTe,ResourceLayout_RecordSharing:()=>NY,ResourceLayout_Search:()=>VY,ResourceLayout_Update:()=>UY,ResourceOperationActionPresentation:()=>uc,ResourceOperationActionScope:()=>Sr,ResourceOperationFrontendConfigSchema:()=>See,ResourceOperationItemRefSchema:()=>Pie,ResourceRegistryContext:()=>sm,ResourceRegistryProvider:()=>Xp,ResourceSummaryDisplayer:()=>pG,ResourceViewItemRefSchema:()=>Qie,ResourcesRepositoryFrontendService:()=>RS,RouterErrorBoundary:()=>Qy,SCAFFOLD_SETTINGS_HUB_CONFIG:()=>Dse,SCAFFOLD_SETTINGS_RAIL_GROUPS:()=>jv,SCOPE_PARAM_PREFIX:()=>Bee,SERVER_ERROR_TYPE:()=>oT,SESSION_STORAGE_KEYS:()=>Dre,SETTINGS_HUB_TITLE_LABEL_KEY:()=>Qm,SHELL_ANCHORED_POPUP_ORIGINS:()=>K4,SHELL_CENTRED_POPUP_SLOTS:()=>Uwe,SHELL_GHOST_ATTRIBUTE:()=>P4,SHELL_GHOST_LAYER_ATTRIBUTE:()=>N4,SHELL_MODAL_POPUP_SLOTS:()=>q4,SHELL_OBJECT_ATTRIBUTE:()=>M4,SHELL_PANE_SELECTOR:()=>z4,SHELL_POPUP_OPEN_STATES:()=>J4,SHELL_PRESS_ORIGIN_MAX_AGE_MS:()=>800,SHELL_PROXY_ATTRIBUTE:()=>j4,SHELL_PROXY_FLIGHT_SHARE:()=>A4,STATUS_BAR_PLACEMENTS:()=>Ate,SameSite:()=>Vy,ScopeChangeInitiator:()=>At,ScopeUtilsService:()=>tm,ScopedNavigationControllerContext:()=>TS,ScrollArea:()=>lf,ScrollAreaType:()=>cf,ScrollBar:()=>uf,Section:()=>Yk,SectionLegendVoiceHost:()=>xD,SectionSaveButton:()=>Qk,SectionStageBindingError:()=>PO,SectionStageState:()=>NO,Select:()=>mF,SelectContent:()=>_F,SelectGroup:()=>ome,SelectItem:()=>yF,SelectLabel:()=>sme,SelectMultiple:()=>PF,SelectPosition:()=>fF,SelectRoot:()=>hF,SelectScrollDownButton:()=>ume,SelectScrollUpButton:()=>lme,SelectSeparator:()=>cme,SelectTrigger:()=>gF,SelectValue:()=>vF,Separator:()=>E1,SessionEndReason:()=>j,SessionEstablishment:()=>mc,SettingsHubVerificationErrorCode:()=>Yv,SettingsHubVerificationSeverity:()=>Jv,SettingsPanelRef:()=>_v,SettingsSectionItemRefSchema:()=>To,SettingsSectionTargetKind:()=>gv,Sheet:()=>n1,SheetClose:()=>lSe,SheetContent:()=>i1,SheetDescription:()=>c1,SheetFooter:()=>o1,SheetHeader:()=>a1,SheetTitle:()=>s1,SheetTrigger:()=>r1,ShellDialogArrival:()=>k4,ShellGhostKind:()=>F4,ShellGhostLayer:()=>I4,ShellGhostPose:()=>T4,ShellIdentitySchema:()=>xoe,ShellLayoutFamily:()=>_4,ShellLayoutPlacementKind:()=>g4,ShellMotionDip:()=>E4,ShellPaneArrival:()=>D4,ShellPaneResize:()=>O4,ShellPlaceChange:()=>w4,ShellPopupSlot:()=>G4,Sidebar:()=>_De,SidebarCollapsible:()=>Q8,SidebarContent:()=>vDe,SidebarFooter:()=>yDe,SidebarGroup:()=>bDe,SidebarGroupAction:()=>xDe,SidebarGroupContent:()=>SDe,SidebarGroupLabel:()=>CDe,SidebarHeader:()=>wDe,SidebarHomeDisplayMode:()=>Ku,SidebarHostedComponentSchema:()=>Ci,SidebarInput:()=>TDe,SidebarInset:()=>EDe,SidebarItemDisplayPolicy:()=>dn,SidebarItemSchema:()=>xe,SidebarMenu:()=>DDe,SidebarMenuAction:()=>ODe,SidebarMenuBadge:()=>kDe,SidebarMenuButton:()=>ADe,SidebarMenuButtonVariant:()=>$8,SidebarMenuItem:()=>jDe,SidebarMenuSkeleton:()=>MDe,SidebarMenuSub:()=>NDe,SidebarMenuSubButton:()=>PDe,SidebarMenuSubItem:()=>FDe,SidebarProvider:()=>IDe,SidebarRail:()=>LDe,SidebarResourceBrowser:()=>e9,SidebarResponsivePolicy:()=>Nu,SidebarResponsivePolicySchema:()=>cte,SidebarSectionBehavior:()=>it,SidebarSectionContentKind:()=>ze,SidebarSectionContentKindSchema:()=>Dee,SidebarSectionInlineCreate:()=>wc,SidebarSectionSchema:()=>S,SidebarSection_CustomComponentSchema:()=>ere,SidebarSection_GuidanceWidgetSchema:()=>lee,SidebarSection_NavigationListSchema:()=>bee,SidebarSection_ResourceBrowserSchema:()=>$r,SidebarSeparator:()=>RDe,SidebarTrigger:()=>zDe,SidebarVariant:()=>Z8,Skeleton:()=>pm,Slider:()=>qM,SliderRoot:()=>JM,StackedActions:()=>mOe,StackedAside:()=>_Oe,StackedBody:()=>gOe,StackedContent:()=>vOe,StackedHeader:()=>dOe,StackedLayout:()=>uOe,StackedSection:()=>yOe,StackedSubtitle:()=>pOe,StackedTitle:()=>fOe,StackedToolbar:()=>hOe,StandardIconReference:()=>H,StandardIconReferenceSchema:()=>nie,StartApplicationFrontendService:()=>JQ,StatusBarDisplayInteractionType:()=>u2,StatusBarItemSchema:()=>tse,StatusBarItemType:()=>$i,StatusBarPlacementSchema:()=>ga,StepUpAuthContext:()=>xH,StepUpAuthProvider:()=>SH,StepUpRefusalOrigin:()=>Ki,Stepper:()=>DO,StepperDescription:()=>MO,StepperIndicator:()=>kO,StepperItem:()=>OO,StepperSeparator:()=>AO,StepperTitle:()=>jO,Strong:()=>y_,Subheading:()=>wY,SubmitButton:()=>rO,SubscriptionStatus:()=>P1,SummaryFlow:()=>ER,SummaryHeader:()=>D9,SummaryLayout:()=>OR,SummaryMeta:()=>mG,SummaryTitle:()=>wR,SummaryTitlePlacement:()=>TR,SummaryTitleScale:()=>CR,Surface:()=>vD,SurfaceAction:()=>_D,SurfaceBody:()=>hD,SurfaceErrorBoundary:()=>HE,SurfaceFooter:()=>gD,SurfaceHeader:()=>mD,SurfacePolicyContext:()=>Je,SurveyBindingWriteOutcome:()=>lU,Switch:()=>xI,SwitchRoot:()=>SI,TONE_DOT_CLASS:()=>$d,TONE_INK:()=>Mae,TONE_MARKER_COLOUR:()=>xf,TONE_MARKER_FILL:()=>qf,Table:()=>_J,TableBody:()=>yJ,TableCaption:()=>S_e,TableCell:()=>SJ,TableFooter:()=>x_e,TableHead:()=>xJ,TableHeader:()=>vJ,TableRow:()=>bJ,Tabs:()=>cO,TabsActivationMode:()=>iO,TabsContent:()=>dO,TabsLevel:()=>aO,TabsLevelContext:()=>oO,TabsList:()=>lO,TabsTrigger:()=>uO,Text:()=>Z,TextDirection:()=>zd,TextLink:()=>w_,TextSize:()=>Le,TextVariant:()=>zr,Textarea:()=>AI,TextareaRoot:()=>jI,TimePicker:()=>aN,TimeRangePicker:()=>gN,Timeline:()=>Uf,TimelineActions:()=>kf,TimelineBody:()=>mf,TimelineEntry:()=>Rf,TimelineMarker:()=>Gf,TimelineTime:()=>vf,Toaster:()=>QQ,Toggle:()=>L8,ToggleGroup:()=>bO,ToggleGroupAppearance:()=>vO,ToggleGroupBoolean:()=>EI,ToggleGroupItem:()=>xO,ToggleGroupType:()=>_O,ToggleVariants_Variant:()=>I8,ToolbarItemRefSchema:()=>St,ToolbarItemSchema:()=>_n,Tooltip:()=>tj,TooltipContent:()=>rj,TooltipProvider:()=>ij,TooltipTrigger:()=>nj,TruncatedText:()=>m8,TypographyScope:()=>x_,UIContext:()=>s_,UIProvider:()=>Kg,UNIQUE_ERROR_TYPE:()=>sT,UpdateLikeMutationFallbackMode:()=>Bt,UsageDashboard:()=>z1,UserDropdownAvatarDisplay:()=>Ip,UserDropdownSection:()=>sp,UserOrgsContext:()=>ah,UserOrgsProvider:()=>Lm,UtilityPanelItemSchema:()=>ur,ValidationMode:()=>ta,ViewItemRefSchema:()=>Qee,ViewLayout_Header:()=>QY,ViewNotFound:()=>g_,WINDOW_EVENTS_SLUGS:()=>_e,WebSocketContext:()=>um,WebSocketEventBridge:()=>s$,WebSocketProvider:()=>Em,WebSocketResourceValidationService:()=>UJ,WebSocketStatus:()=>$p,WildoBackendHttpClient:()=>oa,WildoBackendHttpClient_ManualCalls:()=>Ir,WildoBackendHttpClient_Resources:()=>Lx,WizardLayout:()=>fje,WizardStep:()=>O9,ZoneContentRenderer:()=>B0,_clearContributedProviderComponentLoaders:()=>ile,actionBarItemCannotRun:()=>XS,actorActivityLabelKey:()=>f6,actorModeDescriptionKey:()=>l6,actorModeLabelKey:()=>c6,actorRoleLabelKey:()=>s6,actorSystemExecutionGraph:()=>of,addElement:()=>Nje,allocateActionBarSlots:()=>ZS,allowsDirectOperationFallback:()=>tr,appendFileServeVariant:()=>$V,appendNavChildrenToSidebarSection:()=>av,applyChartColorPalette:()=>Pg,applyCustomTokens:()=>$g,applyDesignSystemConfiguration:()=>bg,applyDesignTokens:()=>Qg,applyFrontendConfigOverrides:()=>zy,applyTypographyConfiguration:()=>Mg,arrangeChartDashboardTiles:()=>I9,assertExecutionDirtyMarkerShape:()=>cy,assertExecutionEmbeddableContent:()=>uy,assertExecutionFailedActionShape:()=>fy,assertExecutionLocalPanePayloadIsNotEmbeddableContent:()=>ly,assertExecutionPendingPrefetchShape:()=>oy,assertExecutionRuntimeContext:()=>my,assertRegistryCompleteness:()=>ETe,assertSectionStageBinding:()=>FO,attachBackendErrorEnvelope:()=>fee,authFactorLevelForUiLevel:()=>aoe,backendNotificationDestination:()=>_se,backendNotificationI18nParams:()=>yse,badgeVariantIndicator:()=>o_,brandShellLayoutMainContainer:()=>x4,buildAppLoadingScope:()=>fse,buildApplicationCompositeViewDefinitions:()=>Cp,buildApplicationCompositeViewTranslationRef:()=>Ep,buildApplicationViewTranslationRef:()=>Joe,buildAuthoredIconRegistry:()=>e$,buildChartRouteUrlPath:()=>Vp,buildCompositeRouteUrlPath:()=>kp,buildContextLoadingScope:()=>hse,buildExecutionConcreteOperationIdentity:()=>ese,buildExecutionDirtyMarker:()=>dce,buildExecutionFailedAction:()=>yy,buildExecutionRouteUrlPath:()=>Lp,buildFileServeThumbnailUrl:()=>eH,buildFrontendInsertedViewRef:()=>moe,buildFrontendModuleAppComponentsConfiguration:()=>hv,buildFrontendModuleAppScope:()=>pv,buildFrontendModuleConfigOverrides:()=>Ry,buildFrontendModuleRegistry:()=>fv,buildFrontendModuleSidebarSections:()=>mv,buildLoadingScopeKey:()=>rh,buildOmniboxRecordContextIdentifiers:()=>q7,buildResolvedInsertedChartDescriptor:()=>gp,buildResourceCompositeViewTranslationRef:()=>pp,buildResourceFileServeBaseUrl:()=>QV,buildResourceInsertedChartIdentity:()=>xp,buildResourceInsertedCompositeIdentity:()=>vp,buildResourceInsertedExecutionIdentity:()=>dp,buildResourceLoadingScope:()=>_g,buildScopeConditionParams:()=>X3,buildSummaryRecordIdentifiers:()=>dG,calculateGlassBezelResponse:()=>i_,calculateGlassBoundaryCoverage:()=>t_,calculateGlassEdgeResponse:()=>Xg,calculateGlassRefractionProfile:()=>Yg,calculateRoundedRectangleOutwardNormal:()=>Ug,canExportWithinAllowedMimeTypes:()=>ML,cardsAfterWithdrawal:()=>oW,cascadeShellRows:()=>s3,choreographyGraph:()=>Gd,clampCropOffset:()=>EL,clampStaticSidePanels:()=>X0,classifyRecordFact:()=>MA,classifyRegistrationOutcome:()=>rse,clearAllProviderScopeReauthorizationOffers:()=>v,clearAppliedDesignTokens:()=>Ng,clearProviderScopeReauthorizationOffer:()=>ac,clickDownloadLink:()=>Uy,cn:()=>U,collectBillingProviderLabelKeys:()=>M1,collectErroredFieldPaths:()=>KD,collectExecutionViewSurfaceRefsByOperation:()=>Hae,collectFrontendChartRegistrationRefs:()=>Koe,collectFrontendChartRegistrationRefsFromUIBehavior:()=>Xae,collectFrontendProviderDisplayLabelKeys:()=>pb,collectOperationLikeViewRefs:()=>roe,collectResourceLabelFieldEntries:()=>fl,combineModuleSidebarSections:()=>nv,composeConsentDecision:()=>ex,composeUiBehaviorPresentation:()=>NS,computeCoverScale:()=>TL,computeCropSourceRect:()=>DL,computePanelSizes:()=>Q0,computeRegistryCompleteness:()=>P3,computeSurfacePolicyContextValue:()=>Gr,configureClientInstanceIdPolicy:()=>Ho,consentWithdrawalCost:()=>tx,contributeProviderComponentLoaders:()=>Xb,conversationThreadModel:()=>pQ,countDiffLines:()=>E5,createComponentResolver:()=>G,createComponentResolverWithRef:()=>Nl,createCompoundComponentResolver:()=>Qs,createCompoundPreset:()=>one,createDesignSystemConfigurationFromSourceConfig:()=>DTe,createEmojiIcon:()=>Pf,createEmptyOnboardingView:()=>Mje,createFrontendInsertedViewIdentity:()=>goe,createFrontendProviderRegistryFrontendService:()=>Wb,createOpenSessionOverlayModeResolver:()=>y1,createPolymorphicFrontendPreset:()=>Lee,createShellLayoutMainContainer:()=>S4,darkModeUtils:()=>Fg,debugSectionVisibility:()=>Z3,decisionQuestionOf:()=>VW,decisionStepUpRequestOfRefusal:()=>Nt,defaultChartDashboardTileHeight:()=>R9,defaultOfflineReplayPolicyForMethod:()=>Lte,defaultTheme:()=>Lg,defineChartDashboardView:()=>jje,defineCompositeView:()=>Sp,deriveBreadcrumbAncestors:()=>kB,deriveConsentGateState:()=>$b,deriveDecisionInboxCapabilities:()=>qv,deriveDirectoryProvisioningCapabilities:()=>Tv,deriveRegionalReaderStanding:()=>Mie,deriveRelationshipShapeCapabilities:()=>Sv,deriveRelationshipSideCapabilities:()=>bv,describeDecisionHolder:()=>FW,describeDecisionRequester:()=>LW,describePauseState:()=>jW,describeReasonCodeOptions:()=>AW,deserializeOnboardingView:()=>Bje,determineValidationMode:()=>yL,documentReadKey:()=>qZ,embeddedResourceDescentKey:()=>m9,emptyValueTypographyFor:()=>Lj,envLoader:()=>xa,errorManagement:()=>lt,evaluateGlassSurfaceHeight:()=>u_,executionPlanGraph:()=>af,exportCroppedImageFile:()=>PL,extractChartRouteContextResourceIdentifiers:()=>Gp,extractChartRouteUrlParamValues:()=>Up,extractCompositeRouteContextResourceIdentifiers:()=>Pp,extractEphemeralFields:()=>JS,extractErrorInfo:()=>O,extractExecutionRouteContextResourceIdentifiers:()=>lm,extractPrimaryFontFamily:()=>Tg,extractSchemaFieldList:()=>NR,fieldRevealPanelAttributes:()=>UD,fieldsHoldingTheRecordName:()=>NA,fileTypeIsAccepted:()=>OZ,filterVisibleSections:()=>Y3,findDuplicateAppScopeResourceTypes:()=>Dm,findProviderScopeReauthorizationOffer:()=>_r,findUnknownDestinationRefs:()=>Fv,flowGraph:()=>sf,flowGraphInputOf:()=>Wd,flowGraphNodeId:()=>Jd,flowNodeStatusIndicator:()=>Ef,flowStepCategory:()=>Qf,flowTriggerTypeVisual:()=>nf,flowsActorsStatusColour:()=>wf,flowsActorsStatusDotClass:()=>df,flowsActorsStatusIsMoving:()=>Xf,flyShellProxy:()=>r3,focusIndicatorClasses:()=>Rg,fontConfigToGoogleFontConfig:()=>Og,forgetNotificationBadgeCounts:()=>i$,formatBadgeCount:()=>Jt,formatHsvAsCssColor:()=>MTe,formatRgbAsCssColor:()=>W3,generateChartConfig:()=>jg,generateDefaultDisplayTemplate:()=>HR,generateDefaultFormTemplate:()=>LR,generateDefaultSummaryTemplate:()=>JR,generateGoogleFontsUrl:()=>Ig,generateTokensCSS:()=>m_,getChartColorPaletteFromCSS:()=>xg,getChartColors:()=>Bg,getClientInstanceId:()=>_re,getClientInstanceIdScope:()=>kie,getCommonEnumDisplayConfig:()=>__,getCompletionPercentage:()=>Ije,getContentKey:()=>L0,getElementsByType:()=>Rje,getFieldError:()=>oI,getIconAnimation:()=>Df,getLoadingStats:()=>cTe,getLocalStorageItem:()=>Ys,getManualCallsHttpClient:()=>bc,getNotificationDisplayBehavior:()=>pse,getProviderScopeReauthorizationOffers:()=>Er,getReadinessChecker:()=>dne,getTailwindColor:()=>Dg,getZodErrorCode:()=>fhe,getZodErrorParams:()=>bL,graphViewParentOf:()=>Xd,graphViewerEdgeLabelKey:()=>jf,growShellPane:()=>i3,hasValidAnimationSource:()=>Tf,hslToRgb:()=>H3,hsvToRgb:()=>V3,humanDecisionFormLabels:()=>$6,humanDecisionQuestionOf:()=>BW,indicatorBadgeVariant:()=>Zg,installShellLayoutStylesheet:()=>X4,isApiNotReadyError:()=>ll,isBackendRefusal:()=>jr,isBackendRefusalShownToUser:()=>ri,isCollectionScopedOperation:()=>Et,isCroppableRasterImageFile:()=>CL,isCustomComponentNavigationItem:()=>Un,isDirectlyDisplayableImageUrl:()=>m2,isEmphasisButtonVariant:()=>rf,isEnginePageNavigationItem:()=>La,isErrorMarkedByHttpClient:()=>vy,isFinalBackendRefusal:()=>Ot,isFrontendOperationAddressableForCurrentContext:()=>Km,isGlyphKey:()=>E$,isGoogleFont:()=>zg,isHostedInShellChrome:()=>y2,isNamelessDisplayContent:()=>AA,isNetworkOfflineRejection:()=>_a,isOnboardingComplete:()=>Lje,isOperationAddressable:()=>Sn,isOperationHeadless:()=>fr,isRecordSharingOffered:()=>jY,isRequiredFieldError:()=>aI,isResourceNavigationItem:()=>Ea,isResourceReachable:()=>Eoe,isSectionVisible:()=>J3,isSelfReferencingRelatedCollectionTarget:()=>H6,isSettingsHubNavigationItem:()=>Xte,isShellLayoutMainContainer:()=>y4,isShellSidePane:()=>U4,isShellSideZone:()=>W4,isSidebarConfigObject:()=>o2,isSpentOrganizationOnboardingSession:()=>Rae,isStandaloneRoutableCompositeView:()=>ise,isStandaloneRoutableExecutionView:()=>ap,isStandaloneRoutableInsertedChartView:()=>qp,isStandaloneRoutableInsertedCompositeView:()=>zae,isStandaloneRoutableResolvedCompositeView:()=>zp,isStatusBarConfigObject:()=>s2,isStatusBarPlacement:()=>or,isUnrevokedScimTokenProbeNeeded:()=>wv,isUtilityPanelComponentRegistered:()=>P7,isUtilityPanelConfigObject:()=>c2,isViewNavigationItem:()=>Kee,launcherItemRefKey:()=>iv,layoutGraphView:()=>Qd,listContributedProviderComponentLoaders:()=>Zb,loadCroppableImage:()=>wL,loadCustomComponents:()=>sTe,loadFontsFromTypography:()=>Vg,loadGoogleFonts:()=>Eg,makeComponentLabelResolver:()=>gm,makeShellPicture:()=>v3,mapApplicationLevelToFrontendComponentType:()=>p2,matchesExecutionConcreteOperationIdentity:()=>Noe,matchesShortcut:()=>O$,mergeAppModes:()=>ev,mergeAppScope:()=>$_,mergeCommandMenuCommandLists:()=>ov,mergeDesignSystemConfiguration:()=>Ag,mergeFrontendComponentRegistrations:()=>dv,mergeFrontendDomainModules:()=>wse,mergeFullCustomViewsByRef:()=>cv,mergeHotkeyEmitShortcuts:()=>P$,mergeMenubarLauncherItems:()=>sv,mergeQuickSwitcherFields:()=>Cse,mergeSidebarSections:()=>tv,mergeSurfacePolicy:()=>Dc,obtainStepUpToken:()=>CH,offsetWithin:()=>m3,olderHistoryCursor:()=>vQ,onboardingObligationsFromSessionState:()=>oZ,operationTargetsCurrentResource:()=>Qh,organizationOnboardingNavigationTarget:()=>Rp,parkedOrganizationOnboardingSessionId:()=>Gae,parseChartColorPalette:()=>a_,parseCssColorToRgb:()=>L3,parseFrontendInsertedViewRef:()=>jp,parseShortcut:()=>D$,parseUnifiedDiff:()=>T5,pickInlineFieldWriteOperation:()=>Gm,pickPreferredOperationForCoreSemanticAddressability:()=>ph,playbookCatalogGraph:()=>Vf,playbookCatalogNodeId:()=>qd,polymorphicResourceUIBehavior:()=>ete,polymorphicResourceUIBehaviorFrom:()=>cae,providerScopeReauthorizationOfferKey:()=>Yr,pruneDirtyMarkersForPaneTransition:()=>Ly,pruneDirtyMarkersForScopeChange:()=>Iy,pruneFailedActionsForPaneTransition:()=>_y,pruneFailedActionsForPrefetchSettlement:()=>by,pruneFailedActionsForScopeChange:()=>gy,publishNotificationBadgeCount:()=>r$,readAllConversationHistory:()=>yQ,readBrowserRegionalEvidence:()=>Xie,readComputedCssColorViaDom:()=>z3,readDisplayableErrorFacts:()=>ip,readProviderScopeReauthorizationOffer:()=>vt,receiveProviderAddressLookupSelection:()=>cx,receiveProviderFileSelections:()=>ox,recordProviderScopeReauthorizationOffer:()=>pn,registerCommonEnum:()=>C_,registerFrameworkLayouts:()=>wTe,registerFrontendComponentRegistrations:()=>lTe,registerIconAnimation:()=>ff,registerIconAnimations:()=>Zf,registerShellLayout:()=>C4,registerStandardIcon:()=>np,registerStandardIcons:()=>gf,registryDeclaresSmsNotification:()=>n6,relationshipTargetRef:()=>j6,relativeLuminance:()=>G3,removeElement:()=>Pje,removeLocalStorageItem:()=>Ms,replaceFileExtension:()=>NL,reportLauncherVerificationResults:()=>Wv,reportSettingsHubVerificationResults:()=>Qv,requestCrossFrontendHandoff:()=>q3,requestFieldReveal:()=>BD,resetClientInstanceIdPolicy:()=>jne,resizeChartDashboardTile:()=>F9,resolveActionDisclosure:()=>se,resolveActionSurfaceOrganizationId:()=>YV,resolveApplicationLevelNavigationBackZone:()=>vB,resolveAuthoredOperationUnavailableReason:()=>cm,resolveAutomaticRelationshipDisplayShaping:()=>Tj,resolveBillingProviderDisplayName:()=>N1,resolveCommandMenuCommands:()=>zh,resolveComponentLabel:()=>yp,resolveCompositeViewDefinition:()=>_p,resolveCompositeViewPrimaryScope:()=>uoe,resolveContentAreaRenderBranch:()=>Y0,resolveContextualDisplayParams:()=>zA,resolveControlPanelItems:()=>Pm,resolveCssColorViaDom:()=>R3,resolveCurrentSectionStage:()=>IO,resolveDrawnActionVariant:()=>Hd,resolveEffectiveChromeMode:()=>UM,resolveEffectiveDisplayChromeMode:()=>oj,resolveEnumDisplayConfig:()=>A_,resolveErrorReferenceLabel:()=>eoe,resolveExecutionNavigationHandlingMode:()=>wp,resolveExecutionViewDefinition:()=>Dp,resolveFieldAutosaveTrigger:()=>OE,resolveFieldControlVariant:()=>Hg,resolveFrontendProviderDisplayLabel:()=>mb,resolveFrontendResourceOperationAddressability:()=>bse,resolveGuidanceElementRenderer:()=>$2,resolveHostedComponents:()=>v2,resolveHotkeyBindings:()=>Lh,resolveInsertedChartView:()=>Mp,resolveInsertedViewLauncherConfig:()=>Mm,resolveItemRef:()=>Jm,resolveLoadingPolicy:()=>jce,resolveMenubarContent:()=>Xm,resolveMilestoneLabel:()=>use,resolveOperationFeatureAvailability:()=>ng,resolveOperationIdempotencyHeaders:()=>Px,resolveOperationRefusalLabel:()=>Tp,resolveOperationRequestTimeout:()=>Nx,resolveOptionalComponentLabel:()=>Wp,resolveOptionalResourceHeaderDescription:()=>Hp,resolveQuickActions:()=>eh,resolveQuickSwitcherFieldSchema:()=>A7,resolveRecordOrganizationId:()=>hh,resolveRefusalCodeLabel:()=>Op,resolveRegionalFormatting:()=>bo,resolveRelationshipInlineEditSurface:()=>bj,resolveRelationshipNavigationSurface:()=>wj,resolveRelationshipNestedReadSurface:()=>Sj,resolveRelationshipQuickCreateCreateOperation:()=>hj,resolveRelationshipReadSurface:()=>yj,resolveRelationshipSurfaceRuntime:()=>Ej,resolveRelationshipWriteSurface:()=>vj,resolveResourceHeaderLabel:()=>Kp,resolveResourceLabelEnumSchema:()=>Hc,resolveResourceLabelSystemEnumName:()=>Ls,resolveSearchGroupLabel:()=>G7,resolveSectionStageStates:()=>LO,resolveSettingsDestinationCatalog:()=>Nv,resolveSettingsHubConfig:()=>Pv,resolveShellLayoutPlacement:()=>b4,resolveSidebarMobileDrawerMode:()=>C7,resolveSidebarSections:()=>Vm,resolveStatusBarPlacement:()=>x2,resolveSurfaceAutoFieldDensity:()=>GL,resolveSurfaceAutoLabelPlacement:()=>WL,resolveSurfaceFormChromeMode:()=>UL,resolveSurfaceOverlayMode:()=>v1,resolveSurfacePolicyStackingClass:()=>O2,resolveToolbarTools:()=>Wm,resolveTranslationKey:()=>Ap,resolveUpdateLikeMutationFallbackMode:()=>Tl,resolveUserFacingErrorMessage:()=>fp,resolveUtilityPanelItems:()=>F7,resolveVisibleEntryIndex:()=>tg,resourceExecutionView:()=>ioe,resourceHasFieldWriteRoute:()=>zn,resourceUIBehavior:()=>Tte,resourceUIBehaviorFrom:()=>an,responsiveMaxWidthToCssValue:()=>nD,rgbToHex:()=>U3,rgbToHsv:()=>B3,sampleGlassRefractionProfile:()=>p_,saveBlobAsFile:()=>Hy,scrollAndFocusFirstErroredField:()=>qD,sectionHeadingClassName:()=>CD,selectMaterialCapabilityTier:()=>Gg,serializeOnboardingView:()=>zje,serializeSurfaceOperation:()=>mp,setLocalStorageItem:()=>co,settingsHubSectionLabelKey:()=>gse,settingsSectionVisibilityOf:()=>ih,shapeSectionNesting:()=>E7,sharedErrorBuilder:()=>Vu,shellModalOpenClause:()=>Wwe,shellPaneRows:()=>o3,shellPaneSelectorForZone:()=>B4,shellPaneZone:()=>V4,shellRegionSelector:()=>L4,shellRowBox:()=>t3,shellStageRects:()=>p3,shouldRequireCurrentContextAddressabilityForOperation:()=>nh,slideShellPaneHome:()=>a3,splitDividerOrientationToPanelGroupDirection:()=>V0,startApplicationService:()=>XQ,staticZoneDividers:()=>Z0,storedLayoutTilesOf:()=>L9,tellChatSignInCompletionSinks:()=>qb,toDateOrUndefined:()=>ii,toast:()=>fh,turnStatusFromServer:()=>_W,unresolvedLabel:()=>os,updateElementStatus:()=>Fje,useActionOperationSurface:()=>xue,useActivityBarBehavior:()=>p7,useAnalytics:()=>m$,useAnonymousSession:()=>soe,useAppLoading:()=>nb,useAppMode:()=>kle,useAppModeSafe:()=>rS,useAppScope:()=>bm,useAppScopeInternal:()=>woe,useAppScopeSafe:()=>Zp,useAppShellFirstReady:()=>l4,useAppShellLayout:()=>S2,useApplication:()=>Ou,useArrayItemAutosaveField:()=>lI,useAuthSession:()=>hm,useBarrierParticipant:()=>kce,useBilling:()=>Dh,useBillingAction:()=>Nh,useBillingSafe:()=>Yh,useBrandIdentity:()=>g2,useBrandPresentation:()=>_2,useChartDashboardLayout:()=>G9,useChartData:()=>S_,useChatSignInCompletion:()=>Jb,useClaimChildComposition:()=>dY,useCommandMenuBehavior:()=>K7,useComponentLoading:()=>rb,useComposedChildren:()=>Tve,useCompositeResourceOperationContextBuilder:()=>i9,useCompositeViewContext:()=>zU,useConsentBasedProviderActivations:()=>Dx,useConsentGateBehavior:()=>MH,useContextualDisplayParams:()=>RA,useControlPanelBehavior:()=>R7,useCreateOperationSurface:()=>vue,useCrossFrontendHandoff:()=>ITe,useDisplayChromeContext:()=>sk,useDisplayContextKind:()=>LA,useDisplayTemplateContext:()=>rk,useDisplayableImageUrl:()=>h2,useDocumentAcceptanceGateBehavior:()=>FH,useEmbeddedResourceContext:()=>W6,useEmbeddedResourceDescent:()=>rY,useEmbeddedResourceHostContext:()=>FU,useEmitLoadingScope:()=>Ym,useEmphasisedActionLabels:()=>tC,useError:()=>rp,useEventBus:()=>Mo,useEventEmit:()=>qie,useEventSubscription:()=>ate,useExecution:()=>ice,useExecutionDirtyBridge:()=>Py,useExecutionDirtyMarkerScope:()=>ace,useExecutionParticipationDataPrefetch:()=>uce,useExecutionParticipationPrefetch:()=>Fy,useFeatureAvailability:()=>E0,useFeatureGate:()=>LTe,useFeatures:()=>Ch,useFieldControlAria:()=>BM,useFieldRevealRequests:()=>HD,useFieldScope:()=>ED,useFileActivation:()=>S8,useFlowsActors:()=>xW,useFlowsActorsSafe:()=>SW,useFlowsActorsStatusWord:()=>tp,useFormChromeContext:()=>eT,useFormField:()=>B8,useFormSchemaContext:()=>PD,useFormTemplateContext:()=>RT,useGlobalNavigationController:()=>ES,useGrantedConsentPurposes:()=>nx,useGuidance:()=>_U,useHostedComponentInteractions:()=>R2,useHostlessResourceNavigation:()=>OS,useHotkey:()=>Dxe,useHotkeyPause:()=>kxe,useHotkeyRegistry:()=>M$,useHotkeyScope:()=>Axe,useHotkeys:()=>Oxe,useI18n:()=>K,useIconRegistry:()=>Mf,useIsInFramedAncestor:()=>M,useKeepsHiddenPanelsMounted:()=>WD,useLauncherResolutionContext:()=>I$,useLifecycle:()=>vU,useListOperationSurface:()=>_ue,useLoading:()=>Tce,useMaterialRuntime:()=>f_,useMenuBarBehavior:()=>k7,useMenuUserOrgBehavior:()=>Z7,useMfaContinuationNavigation:()=>SX,useNavigationBehaviors:()=>f7,useNavigationController:()=>DS,useNavigationState:()=>zx,useNotification:()=>Fm,useNotificationBadges:()=>o$,useNotificationCenterBehavior:()=>B7,useNotificationPreferenceKinds:()=>t6,useOperationEnabled:()=>US,useOperationFeatureAvailability:()=>xh,useOperationsEnabled:()=>GS,useOptionalAutosave:()=>EE,useOptionalCompositeResourceContext:()=>U6,useOptionalCompositeViewContext:()=>BU,useOptionalDisplayTemplateContext:()=>ik,useOptionalEmbeddedResourceHostContext:()=>IU,useOptionalFormSchemaContext:()=>FD,useOptionalFormTemplateContext:()=>zT,useOptionalResourceFormActions:()=>sE,useOptionalResourceHeaderContext:()=>zB,useOverlayTitle:()=>X$,usePendingDecisions:()=>lW,usePortalContainer:()=>E2,useProgression:()=>yU,useProviderComponent:()=>ix,useProviderComponentChoices:()=>rx,useProviderScopeReauthorizationOffers:()=>sr,usePublicShellLayout:()=>C2,usePublishNotificationBadgeCount:()=>a6,useQuickActionButtonBehavior:()=>J7,useQuickSwitcherBehavior:()=>j7,useReadOperationSurface:()=>gue,useReadPageRecord:()=>FY,useRegisterComposedChild:()=>lY,useReportAutomaticComposition:()=>fY,useResolvedAuthConfig:()=>$x,useResolvedFieldName:()=>DD,useResourceChartData:()=>hje,useResourceDisplayContext:()=>dj,useResourceEmptyStateOffersPrimaryAction:()=>$G,useResourceOperationActions:()=>XV,useResourceOperationSurface:()=>aC,useResourceReachability:()=>wm,useResourceRegistry:()=>fm,useResourceRegistrySafe:()=>ym,useResourceRoom:()=>BTe,useResourceSearch:()=>vV,useResourceSelection:()=>ZV,useSearchOperationSurface:()=>bue,useSectionLegendVoice:()=>bD,useServerErrorInjection:()=>ZR,useSettingsHubConfig:()=>Iv,useShellColumnMotion:()=>S3,useShellDialogArrival:()=>c3,useShellFrontPane:()=>g3,useShellMotion:()=>C3,useShellPaneMotion:()=>x3,useShellPlaceChanges:()=>_3,useShellPressOrigin:()=>n3,useShellStageMeasurement:()=>h3,useSidebarBehavior:()=>T7,useSidebarMobileDrawerMode:()=>w7,useSmsConsentOffered:()=>r6,useStatusBarBehavior:()=>M7,useStepUpAuth:()=>NTe,useSurfaceBodyScrollLock:()=>XE,useSurfaceFocusTrap:()=>ZE,useSurfacePolicy:()=>hc,useSurfacePolicyPortalTarget:()=>D2,useSurfacePolicyStackingClass:()=>k2,useSurfaceVariant:()=>hee,useTemplateOwnsChildComposition:()=>uY,useThemePreferenceControl:()=>k1,useToolbarBehavior:()=>N7,useTypographyScope:()=>b_,useUI:()=>Wg,useUpdateOperationSurface:()=>yue,useUserFacingErrorMessage:()=>cp,useUserOrgs:()=>pg,useUtilityPanelBehavior:()=>L7,useViewerMayListRelatedResource:()=>x9,useViewerMayPerformResourceOperation:()=>iSe,useVocabularyWord:()=>hf,useWebSocket:()=>up,utilityPanelWorkspaceSignature:()=>I7,variant:()=>_te,verifyLauncherContent:()=>Uv,verifySettingsHubContent:()=>Zv,viewerBelongsToOrganization:()=>vg,viewerHoldsOneOfRoles:()=>Im,viewerIsKnownOutsideOrganization:()=>vse,viewerMayHaveDecisionsWaiting:()=>Kv,viewerMayPerformOperation:()=>Um,viewerMayReadChart:()=>N9,visibleChartDashboardTiles:()=>yje,waitForFontsLoaded:()=>kg,whenRendered:()=>VD,wildoErrorIsShownToUser:()=>Tn,withErrorBoundary:()=>mce,withFocusedDecisionFirst:()=>UW,withNewestHistoryPage:()=>gQ,withOlderHistoryPage:()=>_Q,withPendingSend:()=>lQ,withoutHiddenParentReference:()=>lj,wrapWithAutosaveIndicator:()=>HM,zoneMutationTargetIndex:()=>Fh,zoneTabDomIds:()=>z0});export{k5 as $,wO as $a,rI as $i,D0 as $n,dx as $o,pG as $r,_6 as $t,u7 as A,QM as Aa,TR as Ai,L4 as An,zT as Ao,JZ as Ar,M8 as At,Q5 as B,tj as Ba,yL as Bi,d4 as Bn,Jw as Bo,CY as Br,g8 as Bt,j7 as C,_F as Ca,UB as Ci,k4 as Cn,KE as Co,xQ as Cr,U8 as Ct,p7 as D,gF as Da,kR as Di,D4 as Dn,PE as Do,cQ as Dr,B8 as Dt,w7 as E,hF as Ea,jR as Ei,E4 as En,cde as Eo,sQ as Er,z8 as Et,t7 as F,Zj as Fa,EL as Fi,b4 as Fn,Zw as Fo,gX as Fr,w8 as Ft,H5 as G,hA as Ga,eL as Gi,k2 as Gn,YS as Go,SJ as Gr,p8 as Gt,q5 as H,ij as Ha,ZI as Hi,l4 as Hn,UC as Ho,BJ as Hr,_8 as Ht,e7 as I,zj as Ia,TL as Ii,m4 as In,Gw as Io,pX as Ir,C8 as It,B5 as J,nk as Ja,wI as Ji,_2 as Jn,tC as Jo,bJ as Jr,X6 as Jt,z5 as K,nA as Ka,tL as Ki,C2 as Kn,XS as Ko,xJ as Kr,d8 as Kt,Y5 as L,Fj as La,DL as Li,u4 as Ln,Yw as Lo,QY as Lr,S8 as Lt,o7 as M,GM as Ma,CR as Mi,g4 as Mn,rT as Mo,_X as Mr,D8 as Mt,i7 as N,BM as Na,yR as Ni,x4 as Nn,Uw as No,hX as Nr,E8 as Nt,l7 as O,vF as Oa,ER as Oi,O4 as On,FE as Oo,pQ as Or,L8 as Ot,a7 as P,Qj as Pa,XL as Pi,C4 as Pn,Xw as Po,mX as Pr,T8 as Pt,F5 as Q,TO as Qa,lI as Qi,u2 as Qn,Cx as Qo,mG as Qr,D6 as Qt,Z5 as R,uj as Ra,PL as Ri,f4 as Rn,qw as Ro,IY as Rr,x8 as Rt,M7 as S,mF as Sa,WB as Si,A4 as Sn,vD as So,kQ as Sr,H8 as St,T7 as T,fF as Ta,vB as Ti,T4 as Tn,RE as To,yQ as Tr,R8 as Tt,W5 as U,nj as Ua,QI as Ui,R2 as Un,KC as Uo,_J as Ur,m8 as Ut,$5 as V,rj as Va,bL as Vi,p4 as Vn,Ww as Vo,zJ as Vr,v8 as Vt,U5 as W,RA as Wa,$I as Wi,D2 as Wn,VC as Wo,yJ as Wr,f8 as Wt,I5 as X,ik as Xa,xI as Xi,d2 as Xn,DS as Xo,lq as Xr,P6 as Xt,P5 as Y,rk as Ya,TI as Yi,f2 as Yn,OS as Yo,sq as Yr,Q6 as Yt,L5 as Z,CO as Za,_I as Zi,l2 as Zn,zx as Zo,cq as Zr,F6 as Zt,K7 as _,kF as _a,SV as _i,N4 as _n,jD as _o,z$ as _r,p5 as _t,v9 as a,BF as aa,rG as ai,Q3 as an,gO as ao,y1 as ar,Uy as as,T5 as at,L7 as b,wF as ba,OV as bi,z4 as bn,CD as bo,AQ as br,$8 as bt,C9 as c,LF as ca,xW as ci,V3 as cn,cO as co,_1 as cr,Pv as cs,h5 as ct,i9 as d,FF as da,JU as di,R3 as dn,oO as do,i1 as dr,vv as ds,a5 as dt,JF as ea,ZW as ei,g6 as en,bO as eo,E0 as er,Qb as es,A5 as et,n9 as f,PF as fa,eH as fi,U3 as fn,lO as fo,c1 as fr,fv as fs,s5 as ft,J7 as g,MF as ga,TV as gi,K4 as gn,WD as go,J$ as gr,d5 as gt,Z7 as h,NF as ha,wV as hi,X4 as hn,HD as ho,r1 as hr,u5 as ht,y9 as i,VF as ia,tG as ii,e6 as in,pO as io,E1 as ir,Wy as is,E5 as it,r7 as j,JM as ja,wR as ji,_4 as jn,aT as jo,VX as jr,j8 as jt,d7 as k,ZM as ka,OR as ki,G4 as kn,RT as ko,lQ as kr,I8 as kt,g9 as l,IF as la,SW as li,L3 as ln,dO as lo,g1 as lr,Cv as ls,_5 as lt,e9 as m,jF as ma,xV as mi,C3 as mn,UD as mo,s1 as mr,j_ as ms,l5 as mt,D9 as n,UF as na,iG as ni,r6 as nn,xO as no,V1 as nr,ab as ns,M5 as nt,_9 as o,zF as oa,QW as oi,F3 as on,mO as oo,u1 as or,Hy as os,S5 as ot,t9 as p,EF as pa,bV as pi,B3 as pn,uO as po,a1 as pr,ov as ps,c5 as pt,V5 as q,Yk as qa,jI as qi,S2 as qn,ZS as qo,vJ as qr,r8 as qt,E9 as r,bme as ra,nG as ri,t6 as rn,_O as ro,H1 as rr,ib as rs,C5 as rt,w9 as s,RF as sa,PW as si,W3 as sn,hO as so,f1 as sr,Ry as ss,x5 as st,Vje as t,XF as ta,$W as ti,a6 as tn,vO as to,U1 as tr,Xb as ts,j5 as tt,x9 as u,fme as ua,hW as ui,G3 as un,aO as uo,n1 as ur,xv as us,g5 as ut,B7 as v,OF as va,EV as vi,q4 as vn,ND as vo,IQ as vr,f5 as vt,k7 as w,yF as wa,IB as wi,I4 as wn,zE as wo,SQ as wr,W8 as wt,N7 as x,AF as xa,DV as xi,J4 as xn,bD as xo,OQ as xr,G8 as xt,R7 as y,DF as ya,CV as yi,M4 as yn,MD as yo,DQ as yr,o5 as yt,X5 as z,dj as za,wL as zi,h4 as zn,Kw as zo,FY as zr,b8 as zt};