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

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 (232) hide show
  1. package/dist/.vite/manifest.json +553 -564
  2. package/dist/assets/{ChartEmptyState-ZXRcbrLV.js → ChartEmptyState-DWIzkRcF.js} +1 -1
  3. package/dist/assets/ChartLoadingSkeleton-DJK8tr0I.js +1 -0
  4. package/dist/assets/{ChartView-B6f1J6Er.js → ChartView-Db94VZQx.js} +2 -2
  5. package/dist/assets/ChartWidget-YVF2hpZO.js +5 -0
  6. package/dist/assets/{abnfDiagram-VCTEODGH-BuQmdgCH.js → abnfDiagram-VCTEODGH-CM0NR9TO.js} +1 -1
  7. package/dist/assets/af-CaISKfkL.js +1 -0
  8. package/dist/assets/ar-Dd3Ww6Iw.js +1 -0
  9. package/dist/assets/{architectureDiagram-5GKGNRK7-BVyAQs-b.js → architectureDiagram-5GKGNRK7-BSvNpQhN.js} +1 -1
  10. package/dist/assets/badge-tone-CARgRBWT.js +5 -0
  11. package/dist/assets/bg-DNLi91F0.js +1 -0
  12. package/dist/assets/{blockDiagram-I7D4REHJ-R2VdOZ1H.js → blockDiagram-I7D4REHJ-BSXJV2rP.js} +1 -1
  13. package/dist/assets/bn-BGBjHoNg.js +1 -0
  14. package/dist/assets/{c4Diagram-7LVT6UL2-Bslw228e.js → c4Diagram-7LVT6UL2-B17JSkcB.js} +1 -1
  15. package/dist/assets/ca-BJH1_2-1.js +1 -0
  16. package/dist/assets/channel-CADOmcrk.js +1 -0
  17. package/dist/assets/{chunk-4HAMMTFA-DUDg3eHK.js → chunk-4HAMMTFA-CA0aHXNY.js} +1 -1
  18. package/dist/assets/{chunk-75Z2AOVW-DaeXzHyk.js → chunk-75Z2AOVW-eNHd3ECu.js} +1 -1
  19. package/dist/assets/{chunk-DU6HZSFF-B3UMRfg8.js → chunk-DU6HZSFF-DC0oD3wd.js} +2 -2
  20. package/dist/assets/{chunk-F27PBJKO-BEX6D1-n.js → chunk-F27PBJKO-CTaZkd0r.js} +1 -1
  21. package/dist/assets/{chunk-GMAD6QVW-ZsbK8Hyz.js → chunk-GMAD6QVW-DAXYHrRx.js} +1 -1
  22. package/dist/assets/{chunk-GVQU2GXP-CFgk1428.js → chunk-GVQU2GXP-pi_3BL4L.js} +1 -1
  23. package/dist/assets/{chunk-IMKFNOWR-Bl09s7a_.js → chunk-IMKFNOWR-D4wsR2Nz.js} +1 -1
  24. package/dist/assets/{chunk-L3NEJ4N5-zKVzE7OW.js → chunk-L3NEJ4N5-kKzd7vmD.js} +1 -1
  25. package/dist/assets/{chunk-OSK3NFVY-BmuNqHzQ.js → chunk-OSK3NFVY-B0dd8EQD.js} +1 -1
  26. package/dist/assets/{chunk-P2QGCYS3-C2tydC-M.js → chunk-P2QGCYS3-uHc1UExe.js} +1 -1
  27. package/dist/assets/{chunk-POPQ4Y6H-DNak0l6w.js → chunk-POPQ4Y6H-BygwP6r8.js} +1 -1
  28. package/dist/assets/{chunk-PWAF6VOD-D95y-mRG.js → chunk-PWAF6VOD-UE_jt_hM.js} +1 -1
  29. package/dist/assets/{chunk-SHT3W25Y-BK0XKr9M.js → chunk-SHT3W25Y-Cv1i544N.js} +1 -1
  30. package/dist/assets/{chunk-SVP7TREG-CD0633UP.js → chunk-SVP7TREG-Ck1iP-B9.js} +1 -1
  31. package/dist/assets/{chunk-TICWLB2K-C_TN_qXz.js → chunk-TICWLB2K-Dxy0ug7B.js} +1 -1
  32. package/dist/assets/classDiagram-ZZMXUADV-BXHE8nXn.js +1 -0
  33. package/dist/assets/classDiagram-v2-VYDZK3BY-BXHE8nXn.js +1 -0
  34. package/dist/assets/{cm6-editor-CsI0AZDl.js → cm6-editor-DhiCRNY6.js} +3 -3
  35. package/dist/assets/{code-block-IT6T5CEO-rh8d07_F.js → code-block-IT6T5CEO-DFDUp6nm.js} +1 -1
  36. package/dist/assets/context-JIvi_Be4.js +1 -0
  37. package/dist/assets/cs-QrUc_2-B.js +1 -0
  38. package/dist/assets/cy-C9ToLciu.js +1 -0
  39. package/dist/assets/{cynefinDiagram-5FMLGOSQ-DxRmh9t5.js → cynefinDiagram-5FMLGOSQ-C69B-hF_.js} +1 -1
  40. package/dist/assets/da-BeV-TIte.js +1 -0
  41. package/dist/assets/{dagre-GXQ25YYZ-w2hLzSss.js → dagre-GXQ25YYZ-CF3-iQQv.js} +1 -1
  42. package/dist/assets/de-AT-DsKGWx9m.js +1 -0
  43. package/dist/assets/de-DHWuASHw.js +1 -0
  44. package/dist/assets/{diagram-S7CK7UJ4-CNrSaCrT.js → diagram-S7CK7UJ4-fI0poyzR.js} +1 -1
  45. package/dist/assets/{diagram-UQ7AKVKN-BEoR36FG.js → diagram-UQ7AKVKN-Cejsbc8J.js} +1 -1
  46. package/dist/assets/{diagram-VSXAHHWV-Dy8S8rIp.js → diagram-VSXAHHWV-CBv4QF-r.js} +1 -1
  47. package/dist/assets/{diagram-VX7I27RA-BC8Xf9f0.js → diagram-VX7I27RA-BzXmKCQv.js} +1 -1
  48. package/dist/assets/{diagram-Z3DM3KII-CKiC1nrY.js → diagram-Z3DM3KII-DlMWqIOm.js} +1 -1
  49. package/dist/assets/{dist-DXUYhDMM.js → dist-7qRR8v9X.js} +1 -1
  50. package/dist/assets/{dist-Ble3IUnd.js → dist-AFETXPuM.js} +1 -1
  51. package/dist/assets/{dist-CY9MvaM1.js → dist-B3zMf34l.js} +1 -1
  52. package/dist/assets/{dist-Dek2gQIT.js → dist-B7LZVqmi.js} +1 -1
  53. package/dist/assets/{dist-ngz3bapC.js → dist-B8dHtIF5.js} +1 -1
  54. package/dist/assets/{dist-DChuQCpL.js → dist-BNqD4FF5.js} +1 -1
  55. package/dist/assets/{dist-DOFuKjhK.js → dist-BPi3amKg.js} +1 -1
  56. package/dist/assets/{dist-D7MnPcGE.js → dist-Bqd9H35D.js} +1 -1
  57. package/dist/assets/{dist-Cj_xL7Es.js → dist-BxMdxgPi.js} +1 -1
  58. package/dist/assets/{dist-Ciqde0Ol.js → dist-BzKBUPIc.js} +1 -1
  59. package/dist/assets/{dist-1-HCT6qM.js → dist-C1JIB7wk.js} +1 -1
  60. package/dist/assets/{dist-CgVofDKX.js → dist-CGO-gA39.js} +1 -1
  61. package/dist/assets/{dist-BuE0_QYF.js → dist-CKvrtylC.js} +1 -1
  62. package/dist/assets/{dist-jCSCdtJ7.js → dist-CnWzIIZp.js} +1 -1
  63. package/dist/assets/{dist-DBEagOph.js → dist-CvaYKnIn.js} +1 -1
  64. package/dist/assets/{dist-BQ8k61qr.js → dist-DAIjOsvl.js} +1 -1
  65. package/dist/assets/{dist-ddtYIZHC.js → dist-DHiazivQ.js} +1 -1
  66. package/dist/assets/{dist-Bi-7RiEi.js → dist-DIV2542b.js} +1 -1
  67. package/dist/assets/{dist-DCP6b5Yp.js → dist-DJE-oKsX.js} +1 -1
  68. package/dist/assets/{dist-BYbvqYeK.js → dist-DXJIV6Zs.js} +1 -1
  69. package/dist/assets/{dist-C2PLdFfo.js → dist-Da70oAVH.js} +1 -1
  70. package/dist/assets/{dist-CSrdLN_Y.js → dist-iVGPtgrw.js} +1 -1
  71. package/dist/assets/{dist-ssfnxGX1.js → dist-nXT3Wtvb.js} +1 -1
  72. package/dist/assets/{ebnfDiagram-PWID7BFC-CBnxtxcg.js → ebnfDiagram-PWID7BFC-DTMbd2mv.js} +1 -1
  73. package/dist/assets/el-DMuXcfim.js +1 -0
  74. package/dist/assets/en-AU-DjLnSRR3.js +1 -0
  75. package/dist/assets/en-CA-DXNydqY9.js +1 -0
  76. package/dist/assets/en-GB-D4GWT5GI.js +1 -0
  77. package/dist/assets/{erDiagram-RLTQ6QDP-ZW5EDEeK.js → erDiagram-RLTQ6QDP-BZEe8VTH.js} +1 -1
  78. package/dist/assets/es-lfpxt6Ut.js +1 -0
  79. package/dist/assets/esm-Cbe65KfA.js +46 -0
  80. package/dist/assets/et-Bf88JUsX.js +1 -0
  81. package/dist/assets/eu-DV_CNSeH.js +1 -0
  82. package/dist/assets/fa-IR-DNJeY-Q5.js +1 -0
  83. package/dist/assets/fi-NNzsVdSt.js +1 -0
  84. package/dist/assets/flow-execution-BwY1ThjF.js +8 -0
  85. package/dist/assets/flowDiagram-HODETNUW-DbMxzAr_.js +1 -0
  86. package/dist/assets/flows-actors-graph-runtime-D-xOavtY.js +1 -0
  87. package/dist/assets/fr-B-yJDVw6.js +1 -0
  88. package/dist/assets/fr-CA-D84edDay.js +1 -0
  89. package/dist/assets/{ganttDiagram-EL5Y4UJY-D0NWXhSy.js → ganttDiagram-EL5Y4UJY-BdBwCB1x.js} +1 -1
  90. package/dist/assets/{gitGraphDiagram-WWUBYQGX-C16HvgtP.js → gitGraphDiagram-WWUBYQGX-CIy0NCq6.js} +1 -1
  91. package/dist/assets/gl-Dp9qpDLE.js +1 -0
  92. package/dist/assets/graph-runtime-DcJcdZxk.js +1 -0
  93. package/dist/assets/he-Bq6yvypU.js +1 -0
  94. package/dist/assets/hi-CMOY0SGV.js +1 -0
  95. package/dist/assets/hr-tEZvbTHh.js +1 -0
  96. package/dist/assets/hu-4gHWGYaX.js +1 -0
  97. package/dist/assets/id-DWXCGwjx.js +1 -0
  98. package/dist/assets/index-B-LZopDR.js +202 -0
  99. package/dist/assets/{infoDiagram-27XIBGKW-BB9zejj7.js → infoDiagram-27XIBGKW-cmptKZNt.js} +1 -1
  100. package/dist/assets/is-CyAuvYgU.js +1 -0
  101. package/dist/assets/isSameWeek-BwCmz51m.js +1 -0
  102. package/dist/assets/{ishikawaDiagram-5VMMS53U-D0VdeBWj.js → ishikawaDiagram-5VMMS53U-BGkoqgNl.js} +1 -1
  103. package/dist/assets/it-D--xgPTt.js +1 -0
  104. package/dist/assets/ja-PiU5hzs0.js +1 -0
  105. package/dist/assets/{journeyDiagram-3NMN7TZE-BAlcsabK.js → journeyDiagram-3NMN7TZE-BOELkE0a.js} +1 -1
  106. package/dist/assets/{kanban-definition-UXKFOSKX-DpR1bfHx.js → kanban-definition-UXKFOSKX-DMZEjs2i.js} +1 -1
  107. package/dist/assets/katex-CI0JW3i6.js +1 -0
  108. package/dist/assets/ko-CGrMXw-3.js +1 -0
  109. package/dist/assets/{line-sQ28MnTc.js → line-s3zM1O9a.js} +1 -1
  110. package/dist/assets/linear-BUYtyba4.js +1 -0
  111. package/dist/assets/lt-wHK-2djA.js +1 -0
  112. package/dist/assets/lv-B305-5TD.js +1 -0
  113. package/dist/assets/{markdown-stream-runtime-kB8TMEpF.js → markdown-stream-runtime-JIhfRcVj.js} +33 -33
  114. package/dist/assets/match-DcrfiQ0n.js +1 -0
  115. package/dist/assets/match-szcpBoWK.js +1 -0
  116. package/dist/assets/mermaid-VLURNSYL-DDUIX3qH.js +1 -0
  117. package/dist/assets/{mermaid.core-DY7EfcRK.js → mermaid.core-a9Ql5m3p.js} +4 -4
  118. package/dist/assets/{mindmap-definition-YA3MSWOX-DAHZInIk.js → mindmap-definition-YA3MSWOX-DUzblAeW.js} +1 -1
  119. package/dist/assets/ms-DOzy1eba.js +1 -0
  120. package/dist/assets/mt-Cyhk7ljW.js +1 -0
  121. package/dist/assets/nb-CHftFpq-.js +1 -0
  122. package/dist/assets/nl-BLyVSbSF.js +1 -0
  123. package/dist/assets/{pdf-viewer-CslUZhU5.js → pdf-viewer-BZVcG_S1.js} +2 -2
  124. package/dist/assets/{pegDiagram-XKGWAZYB-Dq7UThjR.js → pegDiagram-XKGWAZYB-BZ3P1nUf.js} +1 -1
  125. package/dist/assets/{pieDiagram-E7YTZNPT-Dl3n9rSp.js → pieDiagram-E7YTZNPT-B9NGIjBe.js} +1 -1
  126. package/dist/assets/pl-DcuB_1rF.js +1 -0
  127. package/dist/assets/pt-BLKOuKD1.js +1 -0
  128. package/dist/assets/pt-BR-DDPfvEv6.js +1 -0
  129. package/dist/assets/{quadrantDiagram-AXDQQJYC-_GKiRjuD.js → quadrantDiagram-AXDQQJYC-CjNDgU43.js} +1 -1
  130. package/dist/assets/{railroadDiagram-O6MQD6OU-6CUNSmGg.js → railroadDiagram-O6MQD6OU-BBDx0rdy.js} +1 -1
  131. package/dist/assets/{requirementDiagram-BXWQKSXE-BPl-usp2.js → requirementDiagram-BXWQKSXE-BrhlVjUT.js} +1 -1
  132. package/dist/assets/ro-DbI8OToC.js +1 -0
  133. package/dist/assets/ru-BLDhwwC9.js +1 -0
  134. package/dist/assets/{sankeyDiagram-P5KCCOFB-DZKA85RO.js → sankeyDiagram-P5KCCOFB-DgJzdqPr.js} +1 -1
  135. package/dist/assets/{sequenceDiagram-WJ2MYXX4-BJQcyiuO.js → sequenceDiagram-WJ2MYXX4-nO_0feCR.js} +1 -1
  136. package/dist/assets/sk-7eBEpg_i.js +1 -0
  137. package/dist/assets/sl-D8mz35xz.js +1 -0
  138. package/dist/assets/{stateDiagram-D77RDMKH-B-0Pxnb4.js → stateDiagram-D77RDMKH-DiHY7fmj.js} +1 -1
  139. package/dist/assets/stateDiagram-v2-MP3YSRHH-B-ln1J6g.js +1 -0
  140. package/dist/assets/sv-BRKZ4Z4y.js +1 -0
  141. package/dist/assets/{swimlanes-42K2YHIH-oICSfvZv.js → swimlanes-42K2YHIH-CYk23GX2.js} +1 -1
  142. package/dist/assets/swimlanesDiagram-VR7AAH4N-Bz8yiJQl.js +8 -0
  143. package/dist/assets/ta-DKAQy049.js +1 -0
  144. package/dist/assets/th-BuRbTdYq.js +1 -0
  145. package/dist/assets/{timeline-definition-24CTP7MA-DmKkaTSI.js → timeline-definition-24CTP7MA-DoWeIqkB.js} +1 -1
  146. package/dist/assets/tr-_9-Ip53s.js +1 -0
  147. package/dist/assets/useI18n-V1cysfvg.js +171 -0
  148. package/dist/assets/value-CHmTzbgv.js +1 -0
  149. package/dist/assets/{vennDiagram-4TSXK5OY-CnK77vBm.js → vennDiagram-4TSXK5OY-be67wLzm.js} +1 -1
  150. package/dist/assets/vi-DOgzte8u.js +1 -0
  151. package/dist/assets/{wardleyDiagram-VM6X3IG4-DkkVnAra.js → wardleyDiagram-VM6X3IG4-AWMVCRIW.js} +1 -1
  152. package/dist/assets/{xychartDiagram-S5SC5T6Z-DXVlr43t.js → xychartDiagram-S5SC5T6Z-BpEpObCO.js} +1 -1
  153. package/dist/assets/zh-CN-Be160TvV.js +1 -0
  154. package/dist/assets/zh-HK-izvou4UE.js +1 -0
  155. package/dist/assets/zh-TW-B7tQDnE2.js +1 -0
  156. package/dist/index.html +9 -8
  157. package/package.json +9 -9
  158. package/dist/assets/ChartLoadingSkeleton-BRWWLwJE.js +0 -1
  159. package/dist/assets/ChartWidget-29BcqLsQ.js +0 -5
  160. package/dist/assets/af-CBNa7AYn.js +0 -1
  161. package/dist/assets/ar-RghUrw-U.js +0 -1
  162. package/dist/assets/badge-tone-Ci8vno_R.js +0 -5
  163. package/dist/assets/bg-D_WdYZi3.js +0 -1
  164. package/dist/assets/bn-Do7unCCm.js +0 -1
  165. package/dist/assets/ca-CRZTbRqC.js +0 -1
  166. package/dist/assets/channel-DxaB-rRG.js +0 -1
  167. package/dist/assets/classDiagram-ZZMXUADV-Cb5NNOFP.js +0 -1
  168. package/dist/assets/classDiagram-v2-VYDZK3BY-Cb5NNOFP.js +0 -1
  169. package/dist/assets/context-9KbckYZi.js +0 -1
  170. package/dist/assets/cs-LJwt8LR2.js +0 -1
  171. package/dist/assets/cy-BlvpCYgb.js +0 -1
  172. package/dist/assets/da-BUvDMABw.js +0 -1
  173. package/dist/assets/de-AT-CMYX-FSX.js +0 -1
  174. package/dist/assets/de-Cg_5asH4.js +0 -1
  175. package/dist/assets/el-5l_HfQh-.js +0 -1
  176. package/dist/assets/en-AU-DIy7kJ-6.js +0 -1
  177. package/dist/assets/en-CA-BY8gTlj5.js +0 -1
  178. package/dist/assets/en-GB-BGqFfEzK.js +0 -1
  179. package/dist/assets/es-Bb0Mmwm4.js +0 -1
  180. package/dist/assets/esm-CfFZhCCl.js +0 -7
  181. package/dist/assets/esm-DDY4jF6a.js +0 -46
  182. package/dist/assets/et-BSa6lvqX.js +0 -1
  183. package/dist/assets/eu-9Yfh6o5v.js +0 -1
  184. package/dist/assets/fa-IR-BlqDoYrh.js +0 -1
  185. package/dist/assets/fi-Cj9cD91h.js +0 -1
  186. package/dist/assets/flowDiagram-HODETNUW-Br3H18HF.js +0 -1
  187. package/dist/assets/flows-actors-graph-runtime-YwzVDPst.js +0 -1
  188. package/dist/assets/fr-B0qYMnPX.js +0 -1
  189. package/dist/assets/fr-CA-C2acOTEv.js +0 -1
  190. package/dist/assets/gl-Ce_1v5yA.js +0 -1
  191. package/dist/assets/graph-runtime-BDCDECWS.js +0 -1
  192. package/dist/assets/he-fssXNSLh.js +0 -1
  193. package/dist/assets/hi-wjit_WaO.js +0 -1
  194. package/dist/assets/hr-CZcH_ib_.js +0 -1
  195. package/dist/assets/hu-DmApBwDg.js +0 -1
  196. package/dist/assets/id-CaQxvUk5.js +0 -1
  197. package/dist/assets/index-Da7nRw0z.js +0 -202
  198. package/dist/assets/is-C7YkCQSO.js +0 -1
  199. package/dist/assets/isSameWeek-B-QyK2gA.js +0 -1
  200. package/dist/assets/it--OaDSi8G.js +0 -1
  201. package/dist/assets/ja-BZII__KN.js +0 -1
  202. package/dist/assets/katex-CHQwrTZL.js +0 -1
  203. package/dist/assets/ko-RpFeRS3z.js +0 -1
  204. package/dist/assets/linear-B5bg3HtL.js +0 -1
  205. package/dist/assets/lt-Mb4LqnAa.js +0 -1
  206. package/dist/assets/lv-D333_Qfx.js +0 -1
  207. package/dist/assets/match-BwzNbvxk.js +0 -1
  208. package/dist/assets/match-DQpkdx9H.js +0 -1
  209. package/dist/assets/mermaid-VLURNSYL-DUd6jtzD.js +0 -1
  210. package/dist/assets/ms-CLbOeyRX.js +0 -1
  211. package/dist/assets/mt-PLOofk2t.js +0 -1
  212. package/dist/assets/nb-DxwrcYvh.js +0 -1
  213. package/dist/assets/nl-CzRLOR7M.js +0 -1
  214. package/dist/assets/node-YCCWYXNI.js +0 -2
  215. package/dist/assets/pl-gbLhckq3.js +0 -1
  216. package/dist/assets/pt-BR-R1rW_1OL.js +0 -1
  217. package/dist/assets/pt-BwcWNQjq.js +0 -1
  218. package/dist/assets/ro-DdDjuWNa.js +0 -1
  219. package/dist/assets/ru-BawxQnYH.js +0 -1
  220. package/dist/assets/sk-MRZEZ2K_.js +0 -1
  221. package/dist/assets/sl-BBub_-u1.js +0 -1
  222. package/dist/assets/stateDiagram-v2-MP3YSRHH-Ctzs0iNL.js +0 -1
  223. package/dist/assets/sv-C4z9pgWx.js +0 -1
  224. package/dist/assets/swimlanesDiagram-VR7AAH4N-Bhf7f3Wn.js +0 -8
  225. package/dist/assets/ta-1G1MUVAA.js +0 -1
  226. package/dist/assets/th-CbVjLGeK.js +0 -1
  227. package/dist/assets/tr-CL1-pTfR.js +0 -1
  228. package/dist/assets/useI18n-DcSZnYEx.js +0 -171
  229. package/dist/assets/vi-1ZMJLve8.js +0 -1
  230. package/dist/assets/zh-CN-uOTSXSf7.js +0 -1
  231. package/dist/assets/zh-HK-CNYirMD2.js +0 -1
  232. package/dist/assets/zh-TW-DB-dAf15.js +0 -1
@@ -1,46 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChartView-B6f1J6Er.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/jsx-runtime-lTuChwRC.js","assets/react-9WV3M1gM.js","assets/useI18n-DcSZnYEx.js","assets/public-runtime-8slf2C-u.js","assets/bundle-mjs-H9shJLym.js","assets/badge-tone-Ci8vno_R.js","assets/ChartEmptyState-ZXRcbrLV.js","assets/ChartLoadingSkeleton-BRWWLwJE.js","assets/ChartWidget-29BcqLsQ.js","assets/react-dom-DQGBdIds.js","assets/preload-helper-7y9sWmk5.js","assets/flows-actors-graph-runtime-YwzVDPst.js","assets/node-YCCWYXNI.js","assets/esm-CfFZhCCl.js","assets/index-Da7nRw0z.js","assets/src-C_gRsKqw.js","assets/index-CZ5sv4PP.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,$S as s,$a as c,$i as l,$l as u,$n as d,$o as f,$p as p,$r as m,$t as h,$w as g,$x as _,$y as v,A as y,AC as b,AD as x,AE as S,AS as C,AT as w,Aa as T,Ab as E,Ad as D,Af as O,Ai as k,Al as A,Am as j,An as M,Ap as N,Ar as P,At as F,Au as I,Av as L,Aw as ee,Ay as R,B as z,BC as te,BE as ne,BT as re,Ba as ie,Bd as ae,Bf as oe,Bg as se,Bh as ce,Bi as le,Bm as ue,Bn as de,Bp as fe,Br as pe,Bt as me,Bw as he,Bx as ge,By as _e,C as ve,CD as ye,CE as B,CT as be,C_ as xe,Ca as Se,Cb as Ce,Cd as we,Cf as Te,Cg as Ee,Ch as De,Ci as Oe,Cm as ke,Cn as Ae,Co as je,Cr as Me,Ct as Ne,Cw as Pe,D as Fe,DD as Ie,DT as Le,D_ as Re,Da as ze,Db as Be,Dd as Ve,Df as He,Dg as Ue,Dm as We,Dn as Ge,Do as Ke,Dp as qe,Dr as Je,Dt as Ye,Dv as Xe,Dw as Ze,Dy as Qe,E as $e,ED as et,EE as tt,ET as nt,Ea as rt,Eb as it,Ed as at,Ef as ot,Eg as st,Ei as ct,Em as lt,En as ut,Er as dt,Et as ft,Ev as pt,Ew as mt,Ey as ht,F as gt,FS as _t,FT as vt,Fa as yt,Ff as bt,Fg as xt,Fh as St,Fi as Ct,Fm as wt,Fn as Tt,Fo as Et,Fp as Dt,Fr as Ot,Ft as V,Fu as kt,Fv as At,Fw as jt,Fx as Mt,G as Nt,GC as Pt,GE as Ft,GT as It,Ga as Lt,Gb as Rt,Gg as zt,Gi as Bt,Gn as Vt,Gr as Ht,Gt as Ut,Gu as Wt,Gv as Gt,Gw as Kt,Gx as qt,Gy as Jt,H as Yt,HE as Xt,HT as Zt,Ha as Qt,Hb as $t,Hg as en,Hh as tn,Hi as nn,Hn as rn,Hp as an,Hr as on,Ht as sn,Hw as cn,Hx as ln,Hy as un,I as dn,IC as fn,IE as pn,IS as mn,IT as hn,Ia as gn,Ib as _n,Id as vn,If as yn,Ig as bn,Ih as xn,Ii as Sn,Im as Cn,In as wn,Ir as Tn,It as En,Iv as Dn,Iw as On,Ix as kn,Iy as An,J as jn,JC as Mn,JE as Nn,JT as Pn,Ja as H,Jf as Fn,Jg as In,Jh as Ln,Ji as Rn,Jn as zn,Jp as Bn,Jr as Vn,Jt as Hn,Jx as Un,K as Wn,KC as Gn,KE as Kn,K_ as qn,Ka as Jn,Kb as Yn,Kg as Xn,Kh as Zn,Ki as Qn,Kn as $n,Ko as er,Kp as tr,Kr as nr,Kt as rr,Ku as ir,Kw as eee,Kx as ar,Ky as or,L as sr,LC as cr,LE as lr,LT as tee,L_ as nee,La as ree,Ld as ur,Lf as dr,Lh as iee,Li as aee,Lm as oee,Ln as see,Lp as fr,Lr as pr,Lt as mr,Lv as cee,Lw as lee,Lx as hr,M as gr,MC as _r,MD as vr,ME as yr,MS as br,MT as xr,Ma as uee,Mb as Sr,Mg as Cr,Mh as dee,Mi as wr,Mm as Tr,Mn as fee,Mo as pee,Mr as Er,Mt as mee,Mu as Dr,Mv as hee,Mw as Or,Mx as gee,My as kr,N as _ee,NC as Ar,ND as U,NE as jr,NT as Mr,N_ as Nr,Na as vee,Nb as yee,Ng as Pr,Nh as bee,Ni as Fr,Nm as xee,Nn as Ir,No as Lr,Np as See,Nr as Rr,Nt as W,Nu as zr,Nv as Br,Nw as Vr,Nx as Hr,Ny as Ur,O as Wr,OD as Gr,OT as Kr,Oa as qr,Ob as Jr,Oc as Cee,Of as wee,Og as Yr,Oh as Tee,Om as Xr,On as Eee,Oo as Dee,Op as Zr,Or as Oee,Ot as Qr,Ou as kee,Ov as Aee,Ow as $r,Oy as ei,P as ti,PC as ni,PE as ri,PS as ii,PT as jee,P_ as ai,Pa as oi,Pb as si,Pf as ci,Ph as li,Pi as Mee,Pm as ui,Pn as di,Po as Nee,Pp as Pee,Pr as Fee,Pt as fi,Pu as Iee,Pv as pi,Pw as mi,Px as hi,Py as gi,Q as Lee,QC as Ree,QE as _i,QS as vi,QT as yi,Qa as bi,Qb as xi,Qi as Si,Ql as Ci,Qn as zee,Qo as wi,Qp as Ti,Qr as Bee,Qt as Ei,Qw as Vee,Qx as Hee,Qy as Di,R as Oi,RC as ki,RE as Ai,RS as Uee,RT as ji,Ra as Wee,Rb as Mi,Rd as Gee,Rf as Kee,Rg as Ni,Rh as Pi,Ri as Fi,Rl as qee,Rm as Jee,Rn as Ii,Rp as Yee,Rr as Li,Rt as Ri,Ru as zi,Rv as Bi,Rw as Vi,Ry as Hi,S as Ui,SD as Wi,SE as Gi,ST as Ki,Sa as qi,Sb as Ji,Sd as Yi,Sg as Xi,Si as Zi,Sl as Xee,Sm as Qi,Sn as $i,So as Zee,Sr as Qee,Ss as $ee,St as ete,Su as tte,Sw as nte,T as ea,TD as G,TE as ta,TS as na,TT as rte,Ta as ite,Tb as ate,Td as ote,Ti as ste,Tm as cte,Tn as ra,Tr as lte,Tt as ia,Tw as aa,Ty as ute,U as oa,UC as sa,UT as dte,U_ as ca,Ua as fte,Ug as la,Uh as ua,Ui as pte,Un as mte,Uo as hte,Ur as da,Ut as gte,Uv as _te,Uw as fa,Ux as pa,V as vte,VC as ma,VE as ha,VT as yte,Va as ga,Vd as bte,Vf as xte,Vg as _a,Vi as Ste,Vm as Cte,Vn as wte,Vp as Tte,Vr as va,Vt as Ete,Vw as Dte,Vx as Ote,Vy as ya,W as ba,WC as kte,WE as xa,WT as Ate,W_ as Sa,Wa as jte,Wf as Ca,Wg as Mte,Wh as wa,Wi as Nte,Wm as Ta,Wn as Pte,Wp as Fte,Wr as Ea,Wt as Da,Wv as Oa,Ww as ka,Wx as Aa,Wy as Ite,X as ja,XC as Ma,XT as Na,Xa as Pa,Xb as Fa,Xh as Ia,Xi as La,Xn as Ra,Xo as za,Xr as Ba,Xt as Va,Xu as Ha,Xv as Ua,Xw as Lte,Xx as Wa,Y as Rte,YC as Ga,Y_ as zte,Ya as Bte,Yb as Ka,Yg as qa,Yi as Ja,Yn as Vte,Yp as Ya,Yr as Xa,Yt as Za,Yu as Qa,Yw as $a,Yx as eo,Yy as to,Z as no,ZC as ro,ZE as io,ZS as ao,ZT as oo,Za as Hte,Zb as so,Zf as co,Zi as Ute,Zl as lo,Zm as Wte,Zn as Gte,Zo as Kte,Zp as uo,Zr as qte,Zt as fo,Zv as po,Zw as mo,Zx as ho,Zy as go,_ as Jte,_D as _o,_E as vo,_S as yo,_T as Yte,_a as Xte,_g as Zte,_h as Qte,_i as $te,_l as bo,_m as xo,_n as So,_o as Co,_p as ene,_r as tne,_t as wo,_v as nne,_y as rne,a as ine,aC as ane,aD as To,aE as Eo,aT as one,a_ as Do,aa as Oo,ab as ko,ai as Ao,am as sne,an as jo,ao as cne,ar as lne,at as Mo,au as No,aw as Po,ax as Fo,b as Io,bD as Lo,bE as Ro,bS as zo,bT as Bo,b_ as Vo,ba as Ho,bb as Uo,bc as Wo,bd as une,bg as dne,bi as Go,bm as Ko,bn as fne,br as pne,bt as qo,bw as Jo,bx as mne,by as Yo,c as Xo,cC as Zo,cD as Qo,cT as hne,c_ as gne,ca as _ne,ci as vne,cl as yne,cm as bne,cn as xne,cp as $o,cr as Sne,ct as es,cu as Cne,cw as ts,cy as wne,d as Tne,dC as Ene,dD as ns,dE as Dne,dS as One,dT as kne,da as Ane,db as rs,dg as jne,dh as is,di as Mne,dm as as,dn as Nne,do as Pne,dr as Fne,dt as Ine,du as Lne,dw as Rne,dx as os,dy as zne,eE as ss,eS as Bne,eT as Vne,ea as Hne,eb as Une,ei as Wne,en as cs,eo as Gne,ep as Kne,er as qne,es as ls,eu as us,ew as ds,ex as fs,ey as Jne,f as ps,fC as Yne,fD as ms,fE as hs,fT as Xne,fa as gs,fg as _s,fi as vs,fm as ys,fn as bs,fo as xs,fp as Ss,fr as Cs,ft as ws,fu as Ts,fv as Es,fw as Ds,fy as Os,g as ks,gD as As,gT as js,ga as Ms,gh as Ns,gi as Ps,gl as Fs,gm as Is,gn as Ls,go as Rs,gr as zs,gt as Bs,gv as Vs,gw as Hs,gy as Us,h as Ws,hD as Gs,hE as Ks,hT as qs,ha as Js,hg as Ys,hh as Xs,hi as Zs,hm as Qs,hn as $s,ho as ec,hr as Zne,ht as tc,hv as Qne,hx as nc,i as rc,iC as ic,iD as ac,iE as oc,iT as $ne,i_ as sc,ia as ere,ig as tre,ii as cc,im as lc,in as uc,io as dc,ip as nre,ir as rre,it as ire,iu as are,iw as fc,j as pc,jC as ore,jD as mc,jE as hc,jS as gc,jT as sre,ja as _c,jb as vc,jf as cre,jg as yc,jh as lre,ji as ure,jn as bc,jo as dre,jr as xc,jt as Sc,ju as Cc,jv as wc,jw as fre,k as Tc,kC as Ec,kD as Dc,kE as Oc,kT as pre,ka as kc,kb as Ac,kf as mre,kg as jc,kh as Mc,ki as hre,ko as gre,kp as _re,kr as Nc,kt as Pc,ku as vre,kv as Fc,kw as yre,l as Ic,lC as Lc,lD as Rc,lE as zc,lT as bre,l_ as Bc,la as xre,lb as Vc,li as Hc,ll as Sre,lm as Uc,ln as Wc,lr as Cre,lt as wre,lu as Gc,lx as K,ly as Tre,m as Kc,mE as qc,mT as Jc,ma as Ere,md as Yc,mg as Xc,mh as Dre,mi as Zc,mn as Qc,mo as Ore,mp as kre,mr as Are,mt as jre,mu as Mre,mw as Nre,mx as Pre,n as q,nD as $c,nE as el,nS as Fre,nT as tl,na as Ire,nb as Lre,ni as nl,nn as rl,no as il,nr as Rre,nt as zre,nu as Bre,nw as al,ny as Vre,o as ol,oC as sl,oD as cl,oE as ll,oT as ul,oa as Hre,ob as Ure,oi as dl,ol as Wre,on as Gre,or as Kre,ot as fl,ox as qre,oy as pl,p as ml,pC as hl,pE as Jre,pT as gl,pa as Yre,pb as _l,pg as Xre,pi as vl,pm as yl,pn as bl,po as xl,pp as Zre,pr as Qre,pt as $re,pu as eie,pv as Sl,pw as tie,px as Cl,q as nie,qE as wl,qT as Tl,q_ as El,qa as rie,qb as iie,qg as Dl,qh as Ol,qi as kl,ql as aie,qm as Al,qn as oie,qr as sie,qt as jl,qu as Ml,qw as Nl,qx as Pl,r as Fl,rD as Il,rE as Ll,rT as cie,ra as lie,rb as Rl,ri as zl,rn as Bl,ro as uie,rr as die,rt as fie,ru as pie,s as mie,sD as Vl,sT as Hl,s_ as hie,sa as Ul,sb as Wl,sd as gie,si as Gl,sl as _ie,sm as vie,sn as Kl,sp as yie,sr as ql,su as Jl,sx as Yl,sy as Xl,t as J,tC as Zl,tD as Ql,tE as $l,tS as eu,tT as tu,ta as nu,tb as ru,th as iu,ti as au,tl as bie,tm as ou,tn as xie,to as Sie,tr as Cie,ts as su,tt as wie,tu as Tie,tv as cu,tw as lu,tx as Eie,ty as Die,u as uu,uC as du,uD as fu,uT as Oie,ua as kie,ub as Aie,ug as pu,ui as jie,ul as mu,un as Mie,uo as hu,ur as Nie,ut as Pie,uu as Fie,ux as gu,uy as _u,v as Iie,vD as vu,vE as yu,vT as Lie,va as Rie,vg as bu,vh as zie,vi as Bie,vl as xu,vn as Su,vp as Vie,vr as Hie,vu as Uie,vv as Cu,vw as wu,vy as Tu,w as Eu,wD as Du,wE as Ou,wT as ku,w_ as Au,wa as ju,wd as Mu,wg as Nu,wh as Pu,wi as Fu,wl as Iu,wm as Lu,wn as Ru,wo as zu,wr as Bu,wt as Vu,ww as Hu,wy as Uu,x as Wu,xD as Gu,xE as Ku,xT as Wie,xa as Gie,xb as Kie,xg as qu,xh as Ju,xi as qie,xm as Yu,xn as Xu,xr as Jie,xt as Yie,xw as Zu,xx as Xie,y as Zie,yD as Qu,yE as $u,yT as Qie,ya as $ie,yd as ed,yg as eae,yi as tae,yn as nae,yo as td,yp as nd,yr as rae,ys as rd,yw as id,yy as ad,z as od,zC as iae,zT as aae,za as oae,zb as sd,zg as cd,zi as ld,zm as sae,zn as cae,zp as ud,zr as dd,zs as fd,zt as lae,zw as uae,zx as pd}from"./useI18n-DcSZnYEx.js";import{B as md,C as hd,Ci as gd,Dt as dae,E as _d,En as fae,Es as pae,F as vd,I as yd,J as mae,M as bd,N as xd,O as Sd,P as Cd,S as wd,Si as Td,T as hae,Tt as Ed,U as Dd,Ur as gae,W as Od,X as kd,Xr as Ad,Y as _ae,_ as vae,at as jd,cr as Md,ct as Nd,et as yae,fr as Pd,g as bae,h as xae,it as Sae,j as Fd,li as Id,lt as Ld,m as Cae,na as Rd,ot as zd,p as wae,q as Tae,rt as Eae,st as Bd,tr as Vd,tt as Hd,u as Dae,ui as Ud,v as Oae,w as Wd,wr as kae,wt as Aae,x as jae}from"./public-runtime-8slf2C-u.js";import{$ as Mae,B as Nae,C as Pae,Ct as Y,Dt as Gd,E as Kd,Et as qd,F as Fae,G as Iae,H as Lae,I as Rae,J as zae,K as Bae,M as Vae,N as Hae,Ot as Jd,P as Yd,Q as Xd,S as Zd,St as Qd,T as $d,Tt as ef,U as tf,V as nf,W as rf,X as af,Y as of,Z as sf,_ as cf,_t as lf,a as uf,at as df,b as ff,bt as pf,c as mf,ct as hf,d as gf,dt as _f,et as vf,f as yf,ft as bf,g as xf,gt as Sf,h as Cf,ht as wf,i as Tf,it as Ef,kt as Df,l as Of,lt as kf,m as Af,mt as jf,n as Mf,nt as Nf,o as Pf,ot as Ff,p as If,pt as Lf,q as Rf,r as zf,rt as Bf,s as Vf,st as Hf,t as Uf,tt as Wf,u as Gf,ut as Kf,v as qf,vt as Jf,w as Yf,wt as Xf,x as Zf,xt as X,y as Qf,yt as $f,z as ep}from"./node-YCCWYXNI.js";import{$ as tp,$n as np,A as rp,An as ip,At as ap,B as op,Bn as Uae,Bt as Wae,C as sp,Cn as cp,Ct as Gae,D as lp,Dn as up,Dt as Kae,E as dp,En as qae,Et as fp,F as pp,Fn as mp,Ft as hp,G as gp,Gn as Jae,Gt as _p,H as Yae,Hn as vp,Ht as Xae,I as Zae,In as yp,It as Qae,J as bp,Jn as $ae,Jt as eoe,K as toe,Kn as xp,Kt as Sp,L as noe,Ln as Cp,Lt as roe,M as ioe,Mn as wp,Mt as Tp,N as Ep,Nn as Dp,Nt as Op,O as aoe,On as ooe,Ot as soe,P as kp,Pn as Ap,Pt as coe,Q as jp,Qn as Mp,Qt as Np,R as Pp,Rn as Fp,Rt as Ip,S as loe,Sn as Lp,St as uoe,T as doe,Tn as foe,Tt as Rp,U as poe,Un as moe,Ut as hoe,V as zp,Vn as Bp,Vt as goe,W as _oe,Wn as Vp,Wt as Hp,X as Up,Xn as voe,Xt as Wp,Y as Gp,Yn as yoe,Yt as Kp,Z as qp,Zn as boe,Zt as Jp,_ as xoe,_n as Yp,_t as Soe,a as Xp,an as Coe,at as Zp,b as woe,bn as Toe,bt as Eoe,c as Qp,cn as Doe,ct as $p,d as Ooe,dn as koe,dt as em,er as tm,et as Aoe,f as nm,fn as joe,ft as Moe,g as rm,gn as Noe,gt as Poe,h as im,hn as am,ht as om,i as Foe,in as sm,it as cm,j as lm,jn as Ioe,jt as Loe,k as Roe,kn as zoe,kt as um,l as Boe,ln as Voe,lt as dm,m as Hoe,mn as Uoe,mt as Woe,n as fm,nn as Goe,nt as pm,o as mm,on as hm,ot as Koe,p as gm,pn as qoe,pt as Joe,q as _m,qn as Yoe,qt as Xoe,r as vm,rn as ym,rt as bm,s as xm,sn as Zoe,st as Sm,t as Cm,tn as wm,tr as Qoe,tt as Tm,u as Em,un as $oe,ut as Dm,v as ese,vn as tse,vt as nse,w as rse,wn as Om,wt as ise,x as km,xn as ase,xt as Am,y as jm,yn as ose,yt as Mm,z as sse,zn as cse,zt as Nm}from"./ChartLoadingSkeleton-BRWWLwJE.js";import{$ as lse,$t as Pm,A as use,At as Fm,B as Im,Bt as Lm,C as Rm,Ct as zm,D as dse,Dt as Bm,E as fse,Et as pse,F as Vm,Ft as Hm,G as mse,Gt as Um,H as Wm,Ht as Gm,I as hse,It as Km,J as gse,Jt as _se,K as vse,Kt as yse,L as bse,Lt as xse,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 Sse,Ut as lh,V as uh,Vt as Cse,W as wse,Wt as dh,X as fh,Xt as ph,Yt as mh,Z as hh,Zt as Tse,_ as gh,_t as Ese,a as _h,an as Dse,at as Ose,b as kse,bt as vh,c as Ase,ct as jse,d as yh,dt as Mse,en as bh,et as Nse,f as Pse,ft as xh,g as Fse,gt as Ise,h as Sh,ht as Ch,i as wh,in as Th,it as Eh,j as Dh,jt as Oh,k as kh,kt as Ah,l as jh,lt as Mh,m as Nh,mt as Ph,nn as Fh,nt as Ih,o as Lh,on as Rh,ot as zh,p as Bh,pt as Vh,q as Hh,qt as Uh,r as Wh,rn as Gh,rt as Kh,s as qh,sn as Jh,st as Yh,t as Xh,tn as Zh,tt as Qh,u as $h,ut as eg,v as tg,vt as ng,w as rg,wt as ig,x as ag,xt as og,y as sg,yt as cg,z as lg,zt as ug}from"./ChartWidget-29BcqLsQ.js";import{t as dg}from"./jsx-runtime-lTuChwRC.js";import{A as fg,B as pg,C as mg,D as hg,E as gg,F as _g,G as vg,H as yg,I as bg,J as xg,K as Sg,L as Cg,M as wg,N as Tg,O as Eg,P as Dg,R as Og,S as kg,T as Ag,U as jg,V as Mg,W as Ng,Y as Pg,_ as Fg,a as Ig,b as Lg,c as Rg,d as zg,f as Bg,g as Vg,h as Hg,i as Ug,j as Wg,k as Gg,l as Kg,m as qg,n as Jg,o as Yg,p as Xg,q as Zg,r as Qg,s as $g,t as e_,u as t_,v as n_,w as r_,x as i_,y as a_,z as o_}from"./badge-tone-Ci8vno_R.js";import{t as s_}from"./preload-helper-7y9sWmk5.js";import{a as c_,c as l_,d as u_,f as d_,g as f_,h as p_,i as m_,l as h_,m as g_,n as __,o as v_,p as Z,r as y_,s as b_,t as x_,u as S_}from"./ChartEmptyState-ZXRcbrLV.js";function C_(e,t){return e!==void 0||t!==void 0}var w_=`frontend_sdk`,T_=function(e){return e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e}({});function E_(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 D_(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 O_(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 k_(e,t){return(e??[]).filter(e=>{let n=t?.[e];return n==null||typeof n==`string`&&n.trim()===``})}function A_(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}.${w_} in the application's configuration (per environment in its infrastructure configuration), then run \`wildo config sync\`.`}var j_=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 M_(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 j_(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 N_=[];function P_(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 F_(e){let{previousRow:t,isStoredRow:n,...r}=e;if(!e.row||!t)return{contextResourceIdentifiers:P_(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=P_({...r,row:i,callContext:c}),u=P_({...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 I_(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)=>I_(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)&&I_(n[e],r[e]))}function L_(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=>I_(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 R_(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 z_(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 B_(e){let t=R_(e),n=new Map,r=new Set(t.keys());for(let e of r)n.set(e,z_(e,t));return n}var V_=function(e){return e.UTF8=`UTF8`,e.BASE64=`BASE64`,e}({}),H_=function(e){return e.NEXT_ACTIONS=`next_actions`,e.SUMMARY=`summary`,e.FLAT=`flat`,e.DETAILED=`detailed`,e}({}),U_=`summary`;function W_(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 G_(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:W_(n,r,e=>e.fieldIdentifier)}}function K_(e,t){return!e&&!t?[]:e?t?W_(e,t,e=>e.ref):[...e??[]]:[...t??[]]}function q_(e,t){return!e&&!t?[]:Y_(e?t?W_(e,t,e=>e.ref):[...e??[]]:[...t??[]])}function J_(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===kc.NAVIGATION_LIST&&e.contentKind===kc.NAVIGATION_LIST?n=Q_(n,e.ref,e.children):n[t]=e}return Y_(n)}function Y_(e){let t;try{t=bi.isDevelopment()}catch{t=!1}if(!t)return e;let n=new Map,r=(e,t)=>{for(let i of e??[]){let e=Z_(i),a=n.get(e)??[];a.push(t),n.set(e,a),r(i.children,t)}};for(let t of e)t.contentKind===kc.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 X_(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 Z_(e){switch(e.kind){case gs.RESOURCE_OPERATION:return`resource_operation:${e.resourceType}:${e.operation}:${e.operationVariant??`default`}`;case gs.VIEW:return`${e.kind}:${e.viewRef}`;case gs.RESOURCE_VIEW:return`${e.kind}:${e.resourceType}:${e.viewRef}`;case gs.ENGINE_PAGE:return`engine_page:${e.pageRef}`;case gs.CUSTOM_COMPONENT:return`custom_component:${e.componentRef}`;case gs.SETTINGS_SECTION:return`settings_section:${e.sectionRef??`default`}`;default:throw Error(`launcherItemRefKey: no key for launcher item kind ${e.kind}`)}}function Q_(e,t,n){return e?.length?n.length?e.map(e=>{if(e.ref!==t||e.contentKind!==kc.NAVIGATION_LIST)return e;let r=e,i=new Set(r.children.map(Z_)),a=n.filter(e=>!i.has(Z_(e)));return a.length===0?e:{...r,children:[...r.children,...a]}}):[...e]:e??[]}function $_(e,t){return e?.length?t?.length?W_(e,t,Z_):[...e]:[...t??[]]}function ev(e,t){return e?.length?t?.length?W_(e,t,e=>`${Z_(e)}:${e.group??`default`}`):[...e]:[...t??[]]}function tv(e,t){return e?.length?t?.length?W_(e,t,e=>e.ref):[...e]:[...t??[]]}function Lse(...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 nv(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.fieldIdentifier,r);return Array.from(n.values())}function rv(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 iv(e){let t=new Map,n=[];for(let r of e)for(let e of r.componentRegistrations??[]){let i=e.preset??G.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 Rse(...e){return{moduleIds:e.map(e=>e.moduleId),resourceUIBehavior:Object.assign({},...e.map(e=>e.resourceUIBehavior??{})),sidebarSections:e.reduce((e,t)=>J_(e,t.sidebarSections),[]),quickSwitcherFields:e.reduce((e,t)=>nv(e,t.quickSwitcherFields??[]),[]),compositeViews:e.flatMap(e=>wp(e.compositeViews))}}function av(...e){return{...Rse(...e),menubarItems:e.flatMap(e=>e.menubarItems??[]),commandMenuItems:e.reduce((e,t)=>$_(e,t.commandMenuItems),[]),sidebarSectionItems:e.flatMap(e=>e.sidebarSectionItems??[]),appScope:e.reduce((e,t)=>({...e,...t.appScope,fields:nv(e.fields??[],t.appScope?.fields??[])}),{}),fullCustomViews:e.reduce((e,t)=>tv(e,t.fullCustomViews),[]),onboardingViews:rv([],e.flatMap(e=>e.onboardingViews??[]),e=>e.ref),guidanceFlows:rv([],e.flatMap(e=>e.guidanceFlows??[]),e=>e.ref),flowsActorsViews:rv([],e.flatMap(e=>e.flowsActorsViews??[]),e=>e.ref),componentRegistrations:zse(e)}}function zse(e){let{registrations:t,replaced:n}=iv(e);for(let e of n)il.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 ov(e){let t=nv(e.appScope.fields??[],e.quickSwitcherFields);return t.length===0?e.appScope:{...e.appScope,fields:t}}function sv(e,t){let n=q_(e,t.sidebarSections);return t.sidebarSectionItems.reduce((e,t)=>Q_(e,t.sectionRef,t.items),n)}function cv(e,t){let n=e[hr.MENUBAR],r=e[hr.SIDEBAR],i=e[hr.COMMAND_MENU];return{...e,[hr.MENUBAR]:n&&typeof n==`object`&&!Array.isArray(n)?{...n,items:ev(n.items,t.menubarItems)}:n,[hr.SIDEBAR]:r&&typeof r==`object`?{...r,contentSections:sv(r.contentSections,t)}:r,[hr.COMMAND_MENU]:i&&typeof i==`object`?{...i,commands:$_(i.commands,t.commandMenuItems)}:i}}var Q=e(r(),1),lv;(function(e){e.ENGINE_PANEL=`engine_panel`,e.RESOURCE_OPERATION=`resource_operation`,e.CUSTOM_COMPONENT=`custom_component`,e.SUB_TABS=`sub_tabs`})(lv||={});var uv;(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`})(uv||={});var dv;(function(e){e.REPRESENTS=`relationshipRepresents`,e.GRANTS=`relationshipGrants`,e.INVITES=`relationshipInvites`,e.LENDS=`relationshipLends`})(dv||={});function fv(e){return e.currentOrganizationId?e.organizations?.find(t=>t._id===e.currentOrganizationId)?.type:void 0}function pv(e){let t=fv(e),n=Cu(e.organizationRelationships,e.organizationTypes,t),r=n.some(e=>e.side===Sl.REPRESENTING);return{[dv.REPRESENTS]:r,[dv.GRANTS]:n.some(e=>e.side===Sl.GRANTING),[dv.INVITES]:r&&nne(e.organizationRelationships,t??void 0).length>0,[dv.LENDS]:n.some(t=>t.side===Sl.GRANTING&&Vs(e.organizationRelationships,t.kind))}}var mv;(function(e){e.ASKS_THE_OPERATOR=`relationshipAsksTheOperator`,e.NAMES_THE_OTHER_ORGANIZATION=`relationshipNamesTheOtherOrganization`})(mv||={});function hv(e){let t=Cu(e.organizationRelationships,e.organizationTypes,fv(e)),n=Xi(e.organizationTypes),r=t=>{let r=e.organizationRelationships?.[t];return r?Qne(r,n).standing:void 0};return{[mv.ASKS_THE_OPERATOR]:t.some(e=>e.side===Sl.GRANTING&&r(e.kind)===Es.OPERATOR_IS_PARTY),[mv.NAMES_THE_OTHER_ORGANIZATION]:t.some(e=>r(e.kind)===Es.INDEPENDENT_PARTIES)}}var gv;(function(e){e.ENABLED=`scimEnabled`,e.ORGANIZATION_TYPE_ADMITS=`scimOrganizationTypeAdmitsDirectory`,e.SETTINGS_REACHABLE=`scimSettingsReachable`})(gv||={});function _v(e){return e.organizationTypeKnown&&!(e.featureOffered&&e.organizationTypeDirectoryProvisioned)}function vv(e){let t=e.featureOffered&&e.organizationTypeDirectoryProvisioned;return{[gv.ENABLED]:t,[gv.ORGANIZATION_TYPE_ADMITS]:e.organizationTypeDirectoryProvisioned,[gv.SETTINGS_REACHABLE]:t||e.holdsUnrevokedToken}}var yv=[po.ORG_OWNER,po.ORG_ADMIN],bv=[Ua.APP_ADMIN_SUPER_ADMIN],xv=`billingEnabled`,Sv=`professionalQualificationsDeclared`,Cv=[{ref:$o.PROFILE,icon:H.PROFILE,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.USER_SELF_PROFILES,operation:K.READ}},{ref:$o.SECURITY,icon:H.LOCK,target:{kind:lv.ENGINE_PANEL,panelRef:uv.SECURITY}},{ref:$o.APPEARANCE,icon:H.PALETTE,target:{kind:lv.ENGINE_PANEL,panelRef:uv.APPEARANCE}},{ref:$o.PREFERENCES,icon:H.SLIDERS,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.USER_SELF_PREFERENCES,operation:K.READ}},{ref:$o.MY_INVITATIONS,icon:H.MAIL,target:{kind:lv.ENGINE_PANEL,panelRef:uv.INVITATIONS}},{ref:$o.DEACTIVATE_ACCOUNT,icon:H.USER_COG,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.USER_SELF,operation:qee.DEACTIVATE_ACCOUNT}},{ref:$o.MY_PROVIDER_CREDENTIALS,icon:H.PLUG,target:{kind:lv.ENGINE_PANEL,panelRef:uv.CONNECTED_ACCOUNTS}},{ref:$o.AUTHORIZED_APPS,icon:H.THIRD_PARTY_APP,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.OAUTH_CONSENT_GRANTS,operation:K.LIST}},{ref:$o.MY_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.DATA_SUBJECT_REQUESTS,operation:K.LIST}},{ref:$o.MY_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.USER_A2A_PUSH_DELIVERY_LOG,operation:K.LIST}},{ref:$o.ORGANIZATION_GENERAL,icon:H.ORGANIZATION,requiredRoles:yv,target:{kind:lv.SUB_TABS,subTabs:[{ref:`organization-general-record`,label:`Organization`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATIONS,operation:K.READ}},{ref:`organization-general-profile`,label:`Profile`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_PROFILES,operation:K.READ}},{ref:`organization-general-preferences`,label:`Preferences`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_PREFERENCES,operation:K.READ}},{ref:`organization-general-notifications`,label:`Notifications`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_NOTIFICATIONS,operation:K.READ}}]}},{ref:$o.MEMBERS,icon:H.USERS,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_MEMBERS,operation:K.LIST}},{ref:$o.ORGANIZATION_UNITS,icon:H.HIERARCHY,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_UNITS,operation:K.LIST}},{ref:$o.BILLING,icon:H.CREDIT_CARD,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[xv]},target:{kind:lv.ENGINE_PANEL,panelRef:uv.BILLING}},{ref:$o.API_KEYS,icon:H.KEY,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORG_API_KEYS,operation:K.LIST}},{ref:$o.ORGANIZATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.OAUTH_CLIENTS_ORGANIZATION,operation:K.LIST}},{ref:$o.PROVIDER_CREDENTIALS,icon:H.PLUG,requiredRoles:yv,target:{kind:lv.ENGINE_PANEL,panelRef:uv.ORGANIZATION_CONNECTED_ACCOUNTS}},{ref:$o.SSO,icon:H.LOGIN,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[`ssoEnabled`]},entitlementFeatureId:Ko.SINGLE_SIGN_ON,target:{kind:lv.SUB_TABS,subTabs:[{ref:`sso-configuration`,label:`Configuration`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SSO_CONFIG,operation:K.READ}},{ref:`sso-connections`,label:`Connections`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SSO_CONNECTIONS,operation:K.LIST}}]}},{ref:$o.SCIM,icon:H.USER_COG,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[gv.SETTINGS_REACHABLE]},entitlementFeatureId:Ko.DIRECTORY_PROVISIONING,target:{kind:lv.SUB_TABS,subTabs:[{ref:`scim-provisioning`,label:`Provisioning`,runtimeAvailability:{requiredCapabilities:[gv.ENABLED]},target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SCIM_PROVISIONING_CONFIG,operation:K.READ}},{ref:`scim-tokens`,label:`Tokens`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SCIM_TOKENS,operation:K.LIST}}]}},{ref:$o.SIEM,icon:H.ACTIVITY,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[`siemEnabled`]},entitlementFeatureId:Ko.SECURITY_EVENT_EXPORT,target:{kind:lv.SUB_TABS,subTabs:[{ref:`siem-export`,label:`Export`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:K.READ}},{ref:`siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_SIEM_DELIVERY_DLQ,operation:K.LIST}}]}},{ref:$o.WEBHOOKS,icon:H.WEBHOOK,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[`webhooksEnabled`]},entitlementFeatureId:Ko.M2M_WEBHOOK_DELIVERY,target:{kind:lv.SUB_TABS,subTabs:[{ref:`webhooks-endpoints`,label:`Endpoints`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_WEBHOOK_CONFIG,operation:K.READ}},{ref:`webhooks-delivery-log`,label:`Delivery log`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,operation:K.LIST}}]}},{ref:$o.INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_INBOUND_DELIVERIES,operation:K.LIST}},{ref:$o.AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_A2A_PUSH_DELIVERY_LOG,operation:K.LIST}},{ref:$o.RELATIONSHIPS,icon:H.HANDSHAKE,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[dv.GRANTS]},target:{kind:lv.SUB_TABS,subTabs:[{ref:`relationships-organizations`,label:`Organizations`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_RELATIONSHIPS,operation:K.LIST}},{ref:`relationships-delegated-capabilities`,label:`Delegated capabilities`,runtimeAvailability:{requiredCapabilities:[dv.LENDS]},target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.RELATIONSHIP_CAPABILITY_GRANTS,operation:K.LIST}}]}},{ref:$o.REPRESENTATIONS,icon:H.BRIEFCASE,requiredRoles:yv,runtimeAvailability:{requiredCapabilities:[dv.REPRESENTS]},target:{kind:lv.SUB_TABS,subTabs:[{ref:`representations-organizations`,label:`Organizations`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_REPRESENTATIONS,operation:K.LIST}},{ref:`representations-invitations`,label:`Invitations`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.RELATIONSHIP_INVITATIONS,operation:K.LIST}},{ref:`representations-model-cost`,label:`Model cost`,target:{kind:lv.ENGINE_PANEL,panelRef:uv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN}},{ref:`representations-activity`,label:`Activity`,target:{kind:lv.ENGINE_PANEL,panelRef:uv.REPRESENTATIVE_ACTIVITY}}]}},{ref:$o.AUDIT_LOGS,icon:H.SCROLL,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.AUDIT_LOGS,operation:K.LIST}},{ref:$o.OPERATOR_ACCESS,icon:H.SHIELD,requiredRoles:[...yv,po.ORG_DELEGATED_APPROVE_ACCESS_GRANTS],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.PLATFORM_ACCESS_GRANTS,operation:K.LIST}},{ref:$o.ORGANIZATION_ENTITLEMENTS,icon:H.BADGE_CHECK,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_FEATURES,operation:K.READ}},{ref:$o.ORGANIZATION_REFERRALS,icon:H.GIFT,requiredRoles:[po.ORG_OWNER],runtimeAvailability:{requiredCapabilities:[xv]},target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.REFERRALS,operation:K.LIST}},{ref:$o.ORGANIZATION_LEGAL_HOLDS,icon:H.SCALE,requiredRoles:[po.ORG_OWNER],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.LEGAL_HOLDS,operation:K.LIST}},{ref:$o.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,icon:H.BADGE_CHECK,requiredRoles:[po.ORG_ADMIN],runtimeAvailability:{requiredCapabilities:[Sv]},target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.PROFESSIONAL_QUALIFICATIONS,operation:K.LIST}},{ref:$o.EMAIL_DOMAINS,icon:H.GLOBE,requiredRoles:yv,requiredEngineCapabilities:[Nd.EMAIL_INBOUND],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_EMAIL_DOMAINS,operation:K.LIST}},{ref:$o.CUSTOM_DOMAINS,icon:H.GLOBE,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_CUSTOM_DOMAINS,operation:K.LIST}},{ref:$o.RELATIONSHIP_MAILBOXES,icon:H.MAILBOX,requiredRoles:yv,requiredEngineCapabilities:[Nd.EMAIL_INBOUND],runtimeAvailability:{requiredCapabilities:[dv.REPRESENTS]},target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.RELATIONSHIP_MAILBOXES,operation:K.LIST}},{ref:$o.CHAT_ACCOUNTS,icon:H.CHAT,requiredRoles:yv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.CHAT_IDENTITY_LINKS,operation:K.LIST}},{ref:$o.MY_CHAT_ACCOUNTS,icon:H.CHAT,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.CHAT_IDENTITY_LINKS,operation:K.LIST,operationVariant:`own`}},{ref:$o.AGENT_RUNS,icon:H.BRAIN,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,operation:K.LIST}},{ref:$o.AUTONOMOUS_AGENTS,icon:H.CLOCK,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.ENGINE_PANEL,panelRef:uv.AUTONOMOUS_AGENTS}},{ref:$o.CHAT_AGENTS,icon:H.CHAT,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_CHAT_SETTINGS,operation:K.LIST}},{ref:$o.AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.SUB_TABS,subTabs:[{ref:`agent-work-override-rate`,label:`Override rate`,target:{kind:lv.ENGINE_PANEL,panelRef:uv.AGENT_WORK_OVERRIDE_RATE}},{ref:`agent-work-decisions`,label:`Decisions`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_AGENT_WORK_DECISIONS,operation:K.LIST}},{ref:`agent-behavior-reports`,label:`Reports`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.AGENT_BEHAVIOR_REPORTS,operation:K.LIST}},{ref:`agent-work-content-capture`,label:`Content capture`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.AGENT_WORK_CAPTURE_SETTINGS,operation:K.READ}},{ref:`agent-work-export-authorization`,label:`Export authorisation`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.EVALUATION_EXPORT_AUTHORIZATIONS,operation:K.READ}},{ref:`agent-work-run-export`,label:`Run an export`,target:{kind:lv.ENGINE_PANEL,panelRef:uv.AGENT_WORK_EVALUATION_EXPORT}},{ref:`agent-work-exports`,label:`Exports`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.EVALUATION_DATASET_EXPORTS,operation:K.LIST}}]}},{ref:$o.AGENT_POLICY,icon:H.BRAIN,requiredRoles:yv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_AGENT_POLICIES,operation:K.READ}},{ref:$o.APPLICATION_GENERAL,icon:H.APP_WINDOW,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_METADATA,operation:K.READ}},{ref:$o.APPLICATION_VERSIONS,icon:H.HISTORY,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_VERSIONS,operation:K.LIST}},{ref:$o.APPLICATION_ENTITLEMENTS,icon:H.BADGE_CHECK,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_FEATURES,operation:K.READ}},{ref:$o.APPLICATION_API_KEYS,icon:H.KEY,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_API_KEYS,operation:K.LIST}},{ref:$o.APPLICATION_SSO,icon:H.LOGIN,requiredRoles:bv,target:{kind:lv.SUB_TABS,subTabs:[{ref:`application-sso-configuration`,label:`Configuration`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_SSO_CONFIG,operation:K.READ}},{ref:`application-sso-connections`,label:`Connections`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_SSO_CONNECTIONS,operation:K.LIST}}]}},{ref:$o.APPLICATION_SCIM,icon:H.USER_COG,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_SCIM_PROVISIONING_CONFIG,operation:K.READ}},{ref:$o.APPLICATION_SIEM,icon:H.ACTIVITY,requiredRoles:bv,target:{kind:lv.SUB_TABS,subTabs:[{ref:`application-siem-export`,label:`Export`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_SIEM_EXPORT_CONFIG,operation:K.READ}},{ref:`application-siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_SIEM_DELIVERY_DLQ,operation:K.LIST}}]}},{ref:$o.APPLICATION_WEBHOOKS,icon:H.WEBHOOK,requiredRoles:bv,target:{kind:lv.SUB_TABS,subTabs:[{ref:`application-webhooks-endpoints`,label:`Endpoints`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_WEBHOOK_CONFIG,operation:K.READ}},{ref:`application-webhooks-delivery-log`,label:`Delivery log`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,operation:K.LIST}}]}},{ref:$o.BILLING_CATALOG,icon:H.PACKAGE,requiredRoles:bv,runtimeAvailability:{requiredCapabilities:[xv]},target:{kind:lv.SUB_TABS,subTabs:[{ref:`billing-catalog-products`,label:`Products`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.PRODUCTS,operation:K.LIST}},{ref:`billing-catalog-promotions`,label:`Promotions`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.PROMOTIONS,operation:K.LIST}}]}},{ref:$o.APPLICATION_PROVIDER_CONNECTIONS,icon:H.PLUG,requiredRoles:bv,target:{kind:lv.ENGINE_PANEL,panelRef:uv.APPLICATION_CONNECTED_ACCOUNTS}},{ref:$o.APPLICATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.OAUTH_CLIENTS_APPLICATION,operation:K.LIST}},{ref:$o.APPLICATION_ACCESS_GRANTS,icon:H.SHIELD,requiredRoles:bv,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_ACCESS_GRANTS,operation:K.LIST}},{ref:$o.APPLICATION_ORGANIZATIONS,icon:H.ORGANIZATION,requiredRoles:bv,target:{kind:lv.SUB_TABS,subTabs:[{ref:`application-organizations-directory`,label:`All organizations`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.ORGANIZATIONS,operation:K.LIST,operationVariant:iu.DIRECTORY}},{ref:`application-organizations-access-grants`,label:`Access windows`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_ACCESS_GRANTS,operation:K.LIST}}]}},{ref:$o.APPLICATION_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],target:{kind:lv.SUB_TABS,subTabs:[{ref:`application-data-subject-requests-queue`,label:`Requests to answer`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.DATA_SUBJECT_REQUESTS,operation:aie.OPERATOR_QUEUE}},{ref:`application-data-subject-requests-access-grants`,label:`Access windows`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_ACCESS_GRANTS,operation:K.LIST}}]}},{ref:$o.APPLICATION_INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_INBOUND_DELIVERIES,operation:K.LIST}},{ref:$o.APPLICATION_SMS_NUMBERS,icon:H.SMARTPHONE,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Nd.SMS],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.SMS_NUMBER_ASSIGNMENTS,operation:K.LIST}},{ref:$o.APPLICATION_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_A2A_PUSH_DELIVERY_LOG,operation:K.LIST}},{ref:$o.APPLICATION_AGENT_RUNS,icon:H.BRAIN,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_FLOW_ACTOR_EXECUTIONS,operation:K.LIST}},{ref:$o.APPLICATION_AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_AGENT_WORK_DECISIONS,operation:K.LIST}},{ref:$o.APPLICATION_AGENT_POLICY,icon:H.BRAIN,requiredRoles:bv,requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_AGENT_POLICIES,operation:K.READ}},{ref:$o.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,icon:H.ORGANIZATION,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.SYSTEM_OF_RECORD_PARTITION_ASSIGNMENTS,operation:K.LIST}},{ref:$o.APPLICATION_MODEL_COSTS,icon:H.RECEIPT,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN,Ua.APP_ADMIN_BILLING_MANAGER],requiredEngineCapabilities:[Nd.AI_LLM],target:{kind:lv.SUB_TABS,subTabs:[{ref:`model-costs-by-month`,label:`By month`,target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.MODEL_COST_PERIOD_AGGREGATES,operation:K.LIST}},{ref:`model-costs-breakdown`,label:`Breakdown`,target:{kind:lv.ENGINE_PANEL,panelRef:uv.MODEL_COST_BREAKDOWN}}]}},{ref:$o.APPLICATION_RETENTION_ENFORCEMENT,icon:H.CLOCK,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN,Ua.APP_AUDIT_EVIDENCE_READER],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.RETENTION_ENFORCEMENT_RECORDS,operation:K.LIST}},{ref:$o.APPLICATION_AUDIT_LOGS,icon:H.SCROLL,requiredRoles:[Ua.APP_ADMIN_SUPER_ADMIN,Ua.APP_AUDIT_EVIDENCE_READER],target:{kind:lv.RESOURCE_OPERATION,resourceType:gu.APPLICATION_AUDIT_LOGS,operation:K.LIST}}],wv=[{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}],Bse={categories:[{ref:`account`,label:`Account`,scope:Sr.USER_SELF,order:0},{ref:`organization`,label:`Organization`,scope:Sr.ORGANIZATIONS,order:1,groups:wv},{ref:`administration`,label:`Administration`,scope:Sr.APPLICATION,order:2,groups:wv}],placements:[{destinationRef:$o.PROFILE,categoryRef:`account`,label:`Profile`,order:0},{destinationRef:$o.SECURITY,categoryRef:`account`,label:`Security`,order:1},{destinationRef:$o.APPEARANCE,categoryRef:`account`,label:`Appearance`,order:2},{destinationRef:$o.PREFERENCES,categoryRef:`account`,label:`Preferences`,order:3},{destinationRef:$o.MY_INVITATIONS,categoryRef:`account`,label:`Invitations`,order:4},{destinationRef:$o.MY_PROVIDER_CREDENTIALS,categoryRef:`account`,label:`Integrations`,order:5},{destinationRef:$o.AUTHORIZED_APPS,categoryRef:`account`,label:`Authorized apps`,order:6},{destinationRef:$o.MY_AGENT_PUSH_DELIVERIES,categoryRef:`account`,label:`Agent push deliveries`,order:7},{destinationRef:$o.MY_DATA_SUBJECT_REQUESTS,categoryRef:`account`,label:`Data requests`,order:8},{destinationRef:$o.DEACTIVATE_ACCOUNT,categoryRef:`account`,label:`Deactivate account`,order:9},{destinationRef:$o.ORGANIZATION_GENERAL,categoryRef:`organization`,label:`General`,order:0},{destinationRef:$o.MEMBERS,categoryRef:`organization`,groupRef:`people`,label:`Members`,order:1},{destinationRef:$o.ORGANIZATION_UNITS,categoryRef:`organization`,groupRef:`people`,label:`Organization units`,order:2},{destinationRef:$o.ORGANIZATION_ENTITLEMENTS,categoryRef:`organization`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:$o.BILLING,categoryRef:`organization`,groupRef:`billing`,label:`Billing`,order:4},{destinationRef:$o.ORGANIZATION_REFERRALS,categoryRef:`organization`,groupRef:`billing`,label:`Referrals`,order:5},{destinationRef:$o.API_KEYS,categoryRef:`organization`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:$o.ORGANIZATION_OAUTH_CLIENTS,categoryRef:`organization`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:$o.PROVIDER_CREDENTIALS,categoryRef:`organization`,groupRef:`integrations`,label:`Integrations`,order:8},{destinationRef:$o.SSO,categoryRef:`organization`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:9},{destinationRef:$o.SCIM,categoryRef:`organization`,groupRef:`security`,label:`SCIM provisioning`,order:10},{destinationRef:$o.SIEM,categoryRef:`organization`,groupRef:`compliance`,label:`SIEM export`,order:11},{destinationRef:$o.WEBHOOKS,categoryRef:`organization`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:$o.AGENT_PUSH_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:$o.AUDIT_LOGS,categoryRef:`organization`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:$o.OPERATOR_ACCESS,categoryRef:`organization`,groupRef:`security`,label:`Operator access`,order:15},{destinationRef:$o.INBOUND_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Inbound deliveries`,order:16},{destinationRef:$o.RELATIONSHIPS,categoryRef:`organization`,groupRef:`people`,label:`Relationships`,order:17},{destinationRef:$o.REPRESENTATIONS,categoryRef:`organization`,groupRef:`people`,label:`Representations`,order:18},{destinationRef:$o.ORGANIZATION_LEGAL_HOLDS,categoryRef:`organization`,groupRef:`compliance`,label:`Legal holds`,order:19},{destinationRef:$o.EMAIL_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Email domains`,order:20},{destinationRef:$o.RELATIONSHIP_MAILBOXES,categoryRef:`organization`,groupRef:`integrations`,label:`Relationship mailboxes`,order:21},{destinationRef:$o.MY_CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`My chat accounts`,order:22},{destinationRef:$o.CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`Chat accounts`,order:23},{destinationRef:$o.AGENT_WORK_REVIEW,categoryRef:`organization`,groupRef:`ai`,label:`Agent work review`,order:24},{destinationRef:$o.AGENT_RUNS,categoryRef:`organization`,groupRef:`ai`,label:`Agent runs`,order:25},{destinationRef:$o.AUTONOMOUS_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Autonomous agents`,order:26},{destinationRef:$o.CHAT_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Chat agents`,order:27},{destinationRef:$o.AGENT_POLICY,categoryRef:`organization`,groupRef:`ai`,label:`Agent policy`,order:28},{destinationRef:$o.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,categoryRef:`organization`,groupRef:`people`,label:`Professional qualifications`,order:29},{destinationRef:$o.CUSTOM_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Custom domains`,order:30},{destinationRef:$o.APPLICATION_GENERAL,categoryRef:`administration`,label:`General`,order:0},{destinationRef:$o.APPLICATION_ORGANIZATIONS,categoryRef:`administration`,label:`Organizations`,order:1},{destinationRef:$o.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,categoryRef:`administration`,label:`System-of-record partitions`,order:2},{destinationRef:$o.APPLICATION_ENTITLEMENTS,categoryRef:`administration`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:$o.BILLING_CATALOG,categoryRef:`administration`,groupRef:`billing`,label:`Plans & pricing`,order:4},{destinationRef:$o.APPLICATION_MODEL_COSTS,categoryRef:`administration`,groupRef:`billing`,label:`Model costs`,order:5},{destinationRef:$o.APPLICATION_API_KEYS,categoryRef:`administration`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:$o.APPLICATION_OAUTH_CLIENTS,categoryRef:`administration`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:$o.APPLICATION_SSO,categoryRef:`administration`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:8},{destinationRef:$o.APPLICATION_SCIM,categoryRef:`administration`,groupRef:`security`,label:`SCIM provisioning`,order:9},{destinationRef:$o.APPLICATION_SIEM,categoryRef:`administration`,groupRef:`compliance`,label:`SIEM export`,order:10},{destinationRef:$o.APPLICATION_PROVIDER_CONNECTIONS,categoryRef:`administration`,groupRef:`integrations`,label:`Integrations`,order:11},{destinationRef:$o.APPLICATION_WEBHOOKS,categoryRef:`administration`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:$o.APPLICATION_AGENT_PUSH_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:$o.APPLICATION_AUDIT_LOGS,categoryRef:`administration`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:$o.APPLICATION_ACCESS_GRANTS,categoryRef:`administration`,groupRef:`security`,label:`Access grants`,order:15},{destinationRef:$o.APPLICATION_VERSIONS,categoryRef:`administration`,label:`Versions`,order:16},{destinationRef:$o.APPLICATION_INBOUND_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Inbound deliveries`,order:17},{destinationRef:$o.APPLICATION_RETENTION_ENFORCEMENT,categoryRef:`administration`,groupRef:`compliance`,label:`Retention enforcement`,order:18},{destinationRef:$o.APPLICATION_AGENT_WORK_REVIEW,categoryRef:`administration`,groupRef:`ai`,label:`Agent work review`,order:19},{destinationRef:$o.APPLICATION_AGENT_RUNS,categoryRef:`administration`,groupRef:`ai`,label:`Agent runs`,order:20},{destinationRef:$o.APPLICATION_AGENT_POLICY,categoryRef:`administration`,groupRef:`ai`,label:`Agent policy`,order:21},{destinationRef:$o.APPLICATION_DATA_SUBJECT_REQUESTS,categoryRef:`administration`,groupRef:`compliance`,label:`Data subject requests`,order:22},{destinationRef:$o.APPLICATION_SMS_NUMBERS,categoryRef:`administration`,groupRef:`integrations`,label:`SMS numbers`,order:23}],defaultSectionRef:`profile`},Tv=new Map(Cv.map(e=>[e.ref,e]));function Ev(e){let t=new Map(Tv),n=new Set,r=[],i=[];for(let a of e?.destinations??[])Tv.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 Dv(e){if(e===void 0)return{categories:[],sections:[]};let t=Ev(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 Ov(e){if(e===void 0)return[];let t=Ev(e);return e.placements.map(e=>e.destinationRef).filter(e=>!t.byRef.has(e))}function kv(){let{settingsHub:e}=Ig();return(0,Q.useMemo)(()=>Dv(e),[e])}var Av;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Av||={});var jv;(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`})(jv||={});function Vse(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Map,o=(e,r)=>{e.scope===tm.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 Mv(e,t,n,r,i,a,o){let s=a===`application`?Hse(e.viewRef,r,t,i,e):Use(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:Av.ERROR,code:jv.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 Hse(e,t,n,r,i){return t.duplicateApplicationViewRefs.has(e)?(r.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.VIEW_NOT_FOUND,context:n,message:`Application view "${e}" not found in any compatible special-view definition`,item:i}),null)}function Use(e,t,n,r){if(!t.resourceConfigurations[e.resourceType])return r.push({severity:Av.ERROR,code:jv.RESOURCE_NOT_FOUND,context:n,message:`Resource type "${e.resourceType}" not found in registry`,item:e}),null;if(Dse({resourceType:e.resourceType,viewRef:e.viewRef,registry:t}).length>1)return r.push({severity:Av.ERROR,code:jv.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=Jh({resourceType:e.resourceType,viewRef:e.viewRef,registry:t});return i?i.scope===tm.RESOURCE?{family:i.family}:(r.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.VIEW_NOT_FOUND,context:n,message:`Resource view "${e.viewRef}" is not declared on resource "${e.resourceType}"`,item:e}),null)}function Nv(e,t,n,r,i,a,o){switch(e.kind){case gs.RESOURCE_OPERATION:{let r=n.resourceConfigurations[e.resourceType];if(!r){i.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.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:Av.ERROR,code:jv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}" on resource "${e.resourceType}" is ambiguous without an explicit launcher operationVariant`,item:e})}break}case gs.VIEW:Mv(e,t,n,r,i,`application`,o);break;case gs.RESOURCE_VIEW:Mv(e,t,n,r,i,`resource`,o);break;case gs.ENGINE_PAGE:e.pageRef in Oo||i.push({severity:Av.ERROR,code:jv.ENGINE_PAGE_NOT_FOUND,context:t,message:`Engine page ref "${e.pageRef}" has no entry in ENGINE_PAGE_METADATA`,item:e});break;case gs.CUSTOM_COMPONENT:o&&!o(e.componentRef)&&i.push({severity:Av.ERROR,code:jv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Custom launcher component "${e.componentRef}" is not registered in ComponentRegistryService`,item:e});break;case gs.SETTINGS_SECTION:e.sectionRef!==void 0&&!a.has(e.sectionRef)&&i.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.UNKNOWN_TARGET_KIND,context:t,message:`Unknown LauncherItemTargetKind: "${e.kind}"`,item:e})}}function Pv(e,t,n,r){e.notificationBadgeRef&&!n.notificationBadgeDefinitions.some(t=>we(t)===e.notificationBadgeRef)&&r.push({severity:Av.ERROR,code:jv.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(we).join(`, `)||`(none)`}`,item:e})}function Fv(e,t,n,r,i,a,o){for(let s of e)Nv(s,t,n,r,i,a,o),Pv(s,t,n,i),s.children&&Fv(s.children,`${t}.children`,n,r,i,a,o)}function Wse(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:Av.WARNING,code:jv.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:Av.WARNING,code:jv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`visibleInModes ref "${t}" does not match any declared appMode`,item:e})}switch(e.contentKind){case kc.NAVIGATION_LIST:Fv(e.children,s,t,n,i,a,o);break;case kc.RESOURCE_BROWSER:{let n=e,r=t.resourceConfigurations[n.resourceType];if(!r){i.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.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:Av.ERROR,code:jv.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:Av.WARNING,code:jv.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 kc.GUIDANCE_WIDGET:case kc.CUSTOM_COMPONENT:}}function Iv(e,t,n,r){let i=[],a=t.appComponentsConfiguration,o=Vse(t),s=new Set(Dv(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=Om(u);for(let e of d)i.push({severity:Av.ERROR,code:jv.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:Av.ERROR,code:jv.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[hr.SIDEBAR];if(typeof f==`object`&&f&&`contentSections`in f){let t=f.contentSections;if(t)for(let r of t)Wse(r,e,o,c,i,s,n)}let p=a[hr.COMMAND_MENU];if(typeof p==`object`&&p&&`commands`in p){let t=p.commands;if(t)for(let r of t)Nv(r,`command_menu.commands`,e,o,i,s,n)}let m=a[hr.HOTKEY];if(typeof m==`object`&&m&&`bindings`in m){let t=m.bindings;if(t)for(let r of t)Nv(r,`hotkey.bindings`,e,o,i,s,n)}let h=a[hr.QUICK_ACTION_BUTTON];if(typeof h==`object`&&h&&`actions`in h){let t=h.actions;if(t)for(let r of t)Nv(r,`quick_action_button.actions`,e,o,i,s,n)}let g=a[hr.CONTROL_PANEL];if(typeof g==`object`&&g&&`items`in g){let t=g.items;if(t)for(let r of t)Nv(r,`control_panel.items`,e,o,i,s,n)}let _=a[hr.TOOLBAR];if(typeof _==`object`&&_&&`tools`in _){let t=_.tools;if(t)for(let r of t)Nv(r,`toolbar.tools`,e,o,i,s,n)}let v=a[hr.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:Av.ERROR,code:jv.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)Nv(r,`menubar.items`,e,o,i,s,n),Pv(r,`menubar.items`,e,i)}}let y=a[hr.ACTIVITY_BAR];return typeof y==`object`&&y?l.length===0&&i.push({severity:Av.WARNING,code:jv.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:Av.WARNING,code:jv.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}),Gse(a,r?.organizationRoles,i),{errors:i,isValid:i.length===0}}function Gse(e,t,n){if(!t?.length)return;let r=new Set([...Object.values(Ua),...Object.values(po),...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:Av.WARNING,code:jv.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(hr.SIDEBAR,`contentSections`).forEach((e,t)=>i(e,`sidebar.contentSections[${t}]`)),a(hr.COMMAND_MENU,`commands`).forEach((e,t)=>i(e,`command_menu.commands[${t}]`)),a(hr.HOTKEY,`bindings`).forEach((e,t)=>i(e,`hotkey.bindings[${t}]`)),a(hr.QUICK_ACTION_BUTTON,`actions`).forEach((e,t)=>i(e,`quick_action_button.actions[${t}]`)),a(hr.CONTROL_PANEL,`items`).forEach((e,t)=>i(e,`control_panel.items[${t}]`)),a(hr.TOOLBAR,`tools`).forEach((e,t)=>i(e,`toolbar.tools[${t}]`)),a(hr.MENUBAR,`items`).forEach((e,t)=>i(e,`menubar.items[${t}]`))}function Lv(e){if(e.isValid){console.log(`[LauncherVerification] ✓ All launcher content declarations are valid`);return}let t=e.errors.filter(e=>e.severity===Av.ERROR).length,n=e.errors.filter(e=>e.severity===Av.WARNING).length;console.group(`[LauncherVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Av.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}var Rv;(function(e){e.ANSWERER=`decisionInboxAnswerer`})(Rv||={});function zv(e){let t=e.offer?.answeringRoles??[];if(t.length===0)return!1;let n=e.effectiveRoles,r=n.accessProfile;if(!r)return Lm(t,n);let i=new Set;for(let e of r.roleEntries)if(e.relatedPrimaryScope===Sr.ORGANIZATIONS&&e.relatedResourceId)for(let t of e.roles)i.add(t);return Lm(t,{...n,organizationRoles:[...i]})}function Bv(e){return{[Rv.ANSWERER]:zv(e)}}var Vv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Vv||={});var Hv;(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`})(Hv||={});var Kse={refsShadowingEngineDestinations:[],duplicateApplicationDestinationRefs:[]};function Uv(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 Wv(e,t=[],n=Kse){let r=[];e.sections.length===0&&r.push({severity:Vv.ERROR,code:Hv.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:Vv.ERROR,code:Hv.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:Vv.ERROR,code:Hv.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:Vv.ERROR,code:Hv.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 Uv(e.categories.map(e=>e.ref)))r.push({severity:Vv.ERROR,code:Hv.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 Uv(e.sections.map(e=>e.ref)))r.push({severity:Vv.ERROR,code:Hv.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:Vv.ERROR,code:Hv.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 Uv((t.groups??[]).map(e=>e.ref)))r.push({severity:Vv.ERROR,code:Hv.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:Vv.ERROR,code:Hv.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===lv.SUB_TABS)for(let e of Uv(t.target.subTabs.map(e=>e.ref)))r.push({severity:Vv.ERROR,code:Hv.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:Vv.WARNING,code:Hv.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 Gv(e){if(e.isValid){console.log(`[SettingsHubVerification] ✓ Settings Hub configuration is valid`);return}let t=e.errors.filter(e=>e.severity===Vv.ERROR).length,n=e.errors.filter(e=>e.severity===Vv.WARNING).length;console.group(`[SettingsHubVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Vv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}function qse(e){return typeof e==`object`&&!!e&&typeof e.reportCrash==`function`}function Jse(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 Yse(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.signInSucceeded==`function`&&typeof t.signInFailed==`function`}function Kv(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(En.getResourceId(e.contextResourceIdentifiers[t]).length>0)return!0;let n=e.contextualParameters[t];return n!==void 0&&String(n).length>0})})})}function qv(e,t,n){let r=Vu(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 Jv(e){let t=e.registry.resourceConfigurations[e.resourceType]?.operations??[],n=t=>{let n=V.buildContextualParameters(t,e.registry);return e=>Kv({operation:e,contextResourceIdentifiers:t,contextualParameters:n})},r=n(e.scopes.contextResourceIdentifiers),i=e.scopes.previousContextResourceIdentifiers?n(e.scopes.previousContextResourceIdentifiers):void 0;return Za(t,K.LIST).filter(e=>r(e)||(i?.(e)??!1))}function Xse(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 Zse(e){let t=e._version;return typeof t==`number`||typeof t==`string`&&/^\d+$/.test(t)}function Yv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Xv(e){let{resourceType:t,registry:n}=e,r=Vu(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=F_({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:Yv(e.row)??Yv(e.previousRow),previousRow:Yv(e.row)?Yv(e.previousRow):void 0,normalizeId:Xse,isStoredRow:Zse,typeOfFieldIdentifier:e=>n.fieldIdentifierToResourceType?.[e]}),s=qv(t,o.contextResourceIdentifiers,n);return o.previousContextResourceIdentifiers?{contextResourceIdentifiers:s,previousContextResourceIdentifiers:qv(t,o.previousContextResourceIdentifiers,n)}:{contextResourceIdentifiers:s}}function Qse(e){let{emit:t,resourceConfig:n,registry:r,resourceType:i,operation:a,resourceContext:o,isWebSocketConnected:s,result:c}=e,l=Wc(o.additionalContext),u=Ei(a),d=Vu(o.contextResourceIdentifiers),f=Ne({contextResourceIdentifiers:o.contextResourceIdentifiers,resourceType:i,result:c,isBulkOperation:a.isBulkOperation===!0});if(!$i(a,s)&&Su(a)){let e=n?.operations?[...n.operations]:[],{[i]:s,...p}=d,m=r?Xv({resourceType:i,registry:r,callContext:o.contextResourceIdentifiers,...a.isBulkOperation===!0?{}:{row:c}}).contextResourceIdentifiers:p,h=r?V.buildContextualParameters(m,r):{},g=Za(e,K.LIST).filter(e=>Kv({operation:e,contextResourceIdentifiers:r?m:o.contextResourceIdentifiers,contextualParameters:h})),_=g.length>0?g:[null];for(let e of _){let n=e??{operationIdentifier:K.LIST};t(xc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??K.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=Za(e,K.READ,{requireAddressable:!0}).filter(e=>n&&r?Uh({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:K.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(xc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??K.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(xc.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 $=dg(),Zv;(function(e){e.PARENT_RESOURCE_REQUIREMENT=`parent-resource-requirement`,e.ADDITIONAL_RESOURCE_REQUIREMENT=`additional-resource-requirement`})(Zv||={});var Qv;(function(e){e.INITIAL=`initial`,e.REFRESH=`refresh`})(Qv||={});function $v(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!==Qv.INITIAL&&e.intent!==Qv.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 ey;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`})(ey||={});function ty(e){if(e.scope===ey.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 ny(e){if(typeof e==`object`&&e&&e.contentType===va.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 ry(e){if(!e||e.contentType!==va.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 iy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`,e.PARTICIPATION_PREFETCH=`participation-prefetch`})(iy||={});function ay(e){if(e.scope===iy.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===iy.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 oy=(0,Q.createContext)(void 0);function sy(e){if(!e)throw Error(`Execution runtime context must be used within an ExecutionRuntimeProvider.`);return e}var cy=({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)(oy.Provider,{value:u,children:e})};function ly(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 uy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===iy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function dy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.wildoError==`object`&&t.wildoError!==null}function fy(e){let t=e.markedByHttpClient??dy(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===iy.LOCAL_PANE?{...r,scope:e.scope,paneId:e.paneId}:e.scope===iy.EMBEDDED_CONTENT?{...r,scope:e.scope}:e.scope===iy.PARTICIPATION_PREFETCH?{...r,scope:e.scope,prefetchKey:e.prefetchKey}:{...r,scope:iy.CUSTOM},ay(i),i}function py(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===iy.PARTICIPATION_PREFETCH&&a.prefetchKey===t?n=!0:r[i]=a;return n?r:e}var my;(function(e){e.SINGLE=`single`,e.ARRAY=`array`})(my||={});function $se(e){return e.foreignKeyField??e.resourceType}function hy(e){let t=(e.requirements??[]).filter(t=>$se(t)===e.bindingKey);return t.length===1?t[0]:void 0}function ece(e,t){let n=t.resourceConfigurations[e]?.resourceRelationships;if(!n)return[];let r=(e,t)=>Xl.ensureCompiledRelationship.call(Xl,e,t);return[...n.parentRelationships,...n.childRelationships,...n.selfRelationships].map(e=>r(e,t.allResourceFieldIdentifiers))}function gy(e){let t=hy({bindingKey:e.bindingKey,requirements:e.requirements});if(t)return{ref:e.ref,source:e.source,requirement:t,contextValue:e.contextResourceIdentifiers?.[e.bindingKey]}}function tce(e){let t=vy(e.sourceParticipation);if(t===e.definition.targetResourceType)return;let n=ece(t,e.registry).filter(n=>{if(n.resourceType1!==e.definition.targetResourceType&&n.resourceType2!==e.definition.targetResourceType||e.definition.foreignKeyField&&Xl.tryResolveRelationshipForeignKeyIdentity(n,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==e.definition.foreignKeyField)return!1;let r=n.resourceType1===t?e.sourceResourceData:void 0;return Xl.isRelationshipActiveForParent(n,r,{onMissingParentResource:`exclude`,onConditionError:`exclude`})});if(n.length===1)return{ref:e.ref,source:Mm.RELATIONSHIP_PROJECTION,fromParticipationRef:e.definition.fromParticipationRef,relationship:n[0],currentResourceType:t}}function nce(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 Mm.ANCHOR:if(e.anchor){let t=e.explicitContextResourceIdentifiers?.[e.anchor.bindingKey];if(t){let n=e.viewDefinition.anchor?.source===Am.PARENT_RESOURCE_REQUIREMENT?e.viewDefinition.parentResourcesRequirements:e.viewDefinition.additionalResourceRequirements;c={ref:a,source:Mm.ANCHOR,resourceType:e.anchor.mainResourceType,bindingKey:e.anchor.bindingKey,requirement:hy({bindingKey:e.anchor.bindingKey,requirements:n}),contextValue:t}}}break;case Mm.PARENT_RESOURCE_REQUIREMENT:c=gy({ref:a,source:Mm.PARENT_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.parentResourcesRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Mm.ADDITIONAL_RESOURCE_REQUIREMENT:c=gy({ref:a,source:Mm.ADDITIONAL_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.additionalResourceRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Mm.RELATIONSHIP_PROJECTION:{let t=i(s.fromParticipationRef);t&&(c=tce({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 _y(e){if(e.source===Mm.ANCHOR||e.source===Mm.PARENT_RESOURCE_REQUIREMENT||e.source===Mm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.contextValue}function vy(e){if(e.source===Mm.ANCHOR)return e.resourceType;if(e.source===Mm.PARENT_RESOURCE_REQUIREMENT||e.source===Mm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.resourceType;if(e.source===Mm.RELATIONSHIP_PROJECTION){let t=e.relationship;return t.resourceType1===e.currentResourceType?t.resourceType2:t.resourceType1}throw Error(`Unknown execution participation source`)}function rce(e){let t=_y(e),n=En.getResourceId(t);return n.length>0?n:void 0}function yy(e){if(e.source===Mm.PARENT_RESOURCE_REQUIREMENT||e.source===Mm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement}function by(e){return e.source===Mm.RELATIONSHIP_PROJECTION?e.relationship:void 0}function ice(e){let t=by(e);return t?Xl.getResolvedRelationshipSemantics(t):void 0}function ace(e,t){let n=by(e);return n?Xl.tryResolveRelationshipForeignKeyIdentity(n,t):void 0}function oce(e,t){if(e.source===Mm.PARENT_RESOURCE_REQUIREMENT||e.source===Mm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.relationshipEdgeKey;if(e.source!==Mm.RELATIONSHIP_PROJECTION)return;let n=ace(e,t.allResourceFieldIdentifiers);return V.buildRelationshipEdgeKey({parentResourceType:e.relationship.resourceType1,childResourceType:e.relationship.resourceType2,foreignKeyField:n?.fieldIdentifier??e.relationship.foreignKeyField})}function sce(e){if(e.source!==Mm.RELATIONSHIP_PROJECTION)return my.SINGLE;let t=e.relationship.resourceType1===e.currentResourceType?e.relationship.cardinality2:e.relationship.cardinality1;return sd(t)?my.SINGLE:my.ARRAY}function xy(e){let t=_y(e.participation);if(!t)return;let n=En.getResourceId(t);if(!n)return;let r=vy(e.participation),i=V.getResourceFieldIdentifierForType(r,e.registry),a=En.getFieldIdentifier(t),o=e.participation.source===Mm.ANCHOR?e.participation.requirement?.foreignKeyField:yy(e.participation)?.foreignKeyField,s=a??o;return s&&s!==i?{fieldIdentifier:s,resourceId:n}:n}function cce(e){let t={};for(let n of e.participationRefs){let r=e.participations[n];if(!r)throw V.buildConfigurationError(rs.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Unknown execution participation ref "${n}".`,participationRef:n});let i=xy({participation:r,registry:e.registry});if(!i)continue;let a=En.getResourceId(i);if(!a)continue;let o=En.getFieldIdentifier(i)??V.getResourceFieldIdentifierForType(vy(r),e.registry),s=t[o];if(s!==void 0&&s!==a)throw V.buildConfigurationError(rs.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 lce(e){return{participation:e.participation,resourceType:vy(e.participation),resourceId:rce(e.participation),valueShape:sce(e.participation),contextValue:_y(e.participation),contextIdentifier:xy({participation:e.participation,registry:e.registry}),requirement:yy(e.participation),relationship:ice(e.participation),rawRelationship:by(e.participation),edgeKey:oce(e.participation,e.registry)}}function Sy(e,t){return V.buildConfigurationError(rs.CONFIGURATION,{message:e,component:`useExecutionResourceOperationContextBuilder`,...t})}function uce(e){return`operationIdentifier`in e}function dce(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 Sy(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 fce(e,t,n,r,i,a){if(!e)throw Sy(`Execution resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(uce(n)){let o=dce(e,t,n),s=bl(o);if((s===K.READ||s===K.UPDATE||s===K.DELETE)&&o.isBulkOperation!==!0&&!Uh({resourceConfig:e,operation:o,registry:r,hasResourceId:En.getResourceId(i[t])!==``,contextResourceIdentifiers:i,contextualParameters:a}))throw Sy(`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===K.READ||n.operationLike===K.UPDATE||n.operationLike===K.DELETE,s=n.requireAddressable||o?ph({resourceConfig:e,operations:e.operations??[],coreOperation:n.operationLike,registry:r,hasResourceId:En.getResourceId(i[t])!==``,allowBulk:n.allowBulk,requireFrontendAddressable:n.requireAddressable===!0,contextResourceIdentifiers:i,contextualParameters:a}):Kl(e.operations??[],n.operationLike,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw Sy(`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 pce(e){let t=e.currentValue?En.getFieldIdentifier(e.currentValue):void 0;return t?{fieldIdentifier:t,resourceId:e.resourceId}:e.resourceId}function mce(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function hce(e){let t=mce(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 Cy(){let{registry:e}=pm(),t=sy((0,Q.useContext)(oy));return{buildResourceOperationContext:(0,Q.useCallback)(n=>{let r=n.participationRef?t.participations[n.participationRef]:void 0;if(n.participationRef&&!r)throw Sy(`Execution resource-operation builder cannot resolve participation "${n.participationRef}".`,{participationRef:n.participationRef});let i=n.resourceType??(r?vy(r):void 0);if(!i)throw Sy("Execution resource-operation builder requires either `resourceType` or `participationRef`.",{target:n});let a={...t.contextResourceIdentifiers??{},...n.contextResourceIdentifiers??{}};if(r){let t=xy({participation:r,registry:e});if(!t&&!n.resourceId)throw Sy(`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=hce({additionalContext:n.additionalContext,resourceConfig:o}),c=n.resourceId??s;if(c&&!r){let r=t.contextResourceIdentifiers??{};a={...Bm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:i,id:En.getResourceId(r[i])},targetResourceType:i,targetId:c,registry:e}).identifiers,...n.contextResourceIdentifiers??{}}}c&&(a[i]=pce({currentValue:a[i],resourceId:c}));let l=V.buildContextualParameters(a,e),u=fce(o,i,n,e,a,l),d=En.buildParentResourcesRequirements(i,a,e,n.relationshipFieldOverrides);return En.createFrontendResourceOperationContextFromOperation({resourceType:i,operation:u,contextResourceIdentifiers:a,additionalContext:n.additionalContext,parentResourcesRequirements:d})},[t.contextResourceIdentifiers,t.participations,e])}}function gce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-action-${crypto.randomUUID()}`:`execution-action-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function wy(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function _ce(){let e=sy((0,Q.useContext)(oy)),{registry:t}=pm(),{buildResourceOperationContext:n}=Cy(),{emit:r}=qo(),i=(0,Q.useContext)(dm)?.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,lce({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?{}:cce({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=xy({participation:i,registry:t});if(!a)return n;let o=vy(i),s=n[o];if(s){let t=En.getResourceId(s),n=En.getResourceId(a),i=En.getFieldIdentifier(s),c=En.getFieldIdentifier(a);if(t!==n||i!==c)throw V.buildConfigurationError(rs.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=Tp({viewDefinition:e.viewDefinition,resourceType:u,operation:d}),_={...Um.createOperationInitiator(e.navigationZone,d),...r.navigationInitiator??{}},v={contentType:va.RESOURCE_OPERATION,resourceContext:l},y=()=>(e.navigation.openEmbeddedContent({content:v,navigationInitiator:_}),!0),b=()=>{if(g===om.EMBED_LOCALLY)return y();let n=p?za.buildOperationFrontendRoutePaths(p,d,t.allResourceFieldIdentifiers):[],i=p&&n.length>0?En.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=wi.createOperationPathKeyFromOperation(d),S=async n=>{let i=uc({operation:d,requestData:n,additionalContext:l.additionalContext}),s={actionRuntimeId:gce(),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 Qse({emit:a.current,resourceConfig:p,registry:t,resourceType:u,operation:d,resourceContext:l,isWebSocketConnected:o.current,result:n}),n}catch(t){let n=dy(t),i=!n;i&&ut.handleError(t,{source:`promise`,resourceType:u,operationIdentifier:f,additionalContext:{executionRuntimeInstanceId:e.runtimeInstanceId,executionViewRef:e.viewDefinition.ref,operationPathKey:x}});let a={failureRuntimeId:wy(),originatingActionRuntimeId:s.actionRuntimeId,operationPathKey:x,resourceType:u,operationId:f,startedAt:s.startedAt,error:t,markedByHttpClient:n,bridgedByExecutionShell:i},o;o=r.failureScope?.scope===iy.LOCAL_PANE?{...a,scope:r.failureScope.scope,paneId:r.failureScope.paneId}:r.failureScope?.scope===iy.EMBEDDED_CONTENT?{...a,scope:r.failureScope.scope}:{...a,scope:iy.CUSTOM};let c=fy(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:K.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=dy(e.error),n=(e.bridgeToCanonicalBus??!0)&&!t;n&&ut.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:wy(),operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,error:e.error,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===iy.LOCAL_PANE?fy({...r,scope:e.scope,paneId:e.paneId}):e.scope===iy.EMBEDDED_CONTENT?fy({...r,scope:e.scope}):e.scope===iy.PARTICIPATION_PREFETCH?fy({...r,scope:e.scope,prefetchKey:e.prefetchKey}):fy({...r,scope:iy.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 Ty=(0,Q.createContext)(null);function Ey({scope:e,children:t}){let n=(0,Q.useMemo)(()=>e.scope===ey.LOCAL_PANE?{scope:ey.LOCAL_PANE,paneId:e.paneId}:e.scope===ey.EMBEDDED_CONTENT?{scope:ey.EMBEDDED_CONTENT}:{scope:ey.CUSTOM},[e.scope,e.paneId]);return(0,$.jsx)(Ty.Provider,{value:n,children:t})}function vce(){return(0,Q.useContext)(Ty)}function Dy(e){let t=(0,Q.useContext)(oy),n=(0,Q.useContext)(Ty),{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:ey.CUSTOM};if(!i){c.clearDirty(r);return}let t;return t=e.scope===ey.LOCAL_PANE?{markerId:r,scope:ey.LOCAL_PANE,paneId:e.paneId,label:a,markedAt:Date.now()}:e.scope===ey.EMBEDDED_CONTENT?{markerId:r,scope:ey.EMBEDDED_CONTENT,label:a,markedAt:Date.now()}:{markerId:r,scope:ey.CUSTOM,label:a,markedAt:Date.now()},c.markDirty(t),()=>{c.clearDirty(r)}},[c,r,i,s?.scope,s?.paneId])}function yce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-prefetch-${crypto.randomUUID()}`:`execution-prefetch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function bce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function xce(e){return!e||typeof e!=`object`?!1:e.name===`AbortError`}function Oy(e){let t=sy((0,Q.useContext)(oy)),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=yce(),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||xce(t))return;if(l(t),e.bridgeFailuresToShellAggregator===!0){let n=fy({failureRuntimeId:bce(),error:t,resourceType:e.resourceType,startedAt:c.startedAt,...e.label===void 0?{}:{label:e.label},scope:iy.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 Sce(e,t){return`participation-prefetch:${e}:${t}`}function Cce(e){let t=sy((0,Q.useContext)(oy)),{registry:n}=pm(),{buildResourceOperationContext:r}=Cy(),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=vy(i),{operationPathKey:o,contextualParameters:s,parentResourcesRequirements:c,label:l}=(0,Q.useMemo)(()=>{let t=r({participationRef:e.participationRef,operationLike:K.READ,requireAddressable:!0}),i=V.buildContextualParameters(t.contextResourceIdentifiers,n);return{operationPathKey:wi.createOperationPathKeyFromOperation(t.operation),contextualParameters:i,parentResourcesRequirements:t.parentResourcesRequirements,label:e.label}},[r,e.label,e.participationRef,n]),u=e.prefetchKey??Sce(a,e.participationRef),d=e.bridgeFailuresToShellAggregator??e.intent===Qv.INITIAL,f=t.doOperation,p=(0,Q.useCallback)(async({signal:e})=>f(o,{contextualParameters:s,parentResourcesRequirements:c,dataMode:Yl.RAW},{signal:e}),[s,f,o,c]);return Oy({prefetchKey:u,participationRefs:[e.participationRef],resourceType:a,intent:e.intent,run:p,...l===void 0?{}:{label:l},bridgeFailuresToShellAggregator:d})}function ky(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 Ay(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===ey.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function wce(e){let t={markerId:e.markerId,markedAt:e.markedAt??Date.now(),label:e.label},n;return n=e.scope===ey.LOCAL_PANE?{...t,scope:e.scope,paneId:e.paneId}:{...t,scope:e.scope},ty(n),n}function jy(e){return{navigationLayout:()=>e.navigationLayout,designSystemConfiguration:()=>e.designSystemConfiguration,appComponentsConfiguration:()=>cv(e.baseAppComponentsConfiguration,e.moduleRegistry),appScope:()=>ov(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 My(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 Ny;(function(e){e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.TABLET=`tablet`,e.API=`api`})(Ny||={});var Py;(function(e){e.STRICT=`strict`,e.LAX=`lax`,e.NONE=`none`})(Py||={});var Tce=Ud({userAgent:gd().min(1,`User agent is required`),ipAddress:gae(),deviceType:Vd(Ny).default(Ny.DESKTOP),location:gd().optional(),fingerprint:gd().optional()});function Fy(e,t){let n=URL.createObjectURL(e);try{Iy(n,t)}finally{URL.revokeObjectURL(n)}}function Iy(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n);try{n.click()}finally{n.remove()}}function Ly({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_ERROR_DISPLAY,`ErrorDisplay`)(e);return(0,$.jsx)(n,{...t})}var Ry=({error:e,errorInfo:t,resetError:n,navigateHome:r})=>{let i=bi.isDevelopment(),{tComponent:a,makeTrComponent:o,isReady:s}=J({component:U.APP_LAYOUTS_ERROR_BOUNDARY}),c=o(U.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)(Ly,{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 zy({preset:e=G.DEFAULT,...t}){let n=q(U.APP_LAYOUTS_ERROR_BOUNDARY,`AppLayout_ErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var By=il.getLogger();By.debugByType(`ErrorBoundary`),By.setDebugTypeLogging(`ErrorBoundary`,!1);function Ece(e){let t=oh(),{emit:n}=qo();return(0,$.jsx)(zy,{...e,navigateHome:()=>Mh({emit:n,routerNavigate:t})})}var Vy=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}),By.error(`ErrorBoundary caught an error:`,{error:e,errorInfo:t});let n=Ru.buildReactError(e,t);try{Ii.emit(xc.ERROR_OCCURED,{error:n})}catch(e){By.warn(`Failed to emit error event:`,{dispatchError:e})}if(this.props.onError)try{this.props.onError(e,t)}catch(e){By.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)(Ece,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return this.props.children}};function Dce(e,t){let n=n=>(0,$.jsx)(Vy,{...t,children:(0,$.jsx)(e,{...n})});return n.displayName=`withErrorBoundary(${e.displayName||e.name})`,n}function Oce(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 kce(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 Hy=({errorType:e,routeError:t,jsError:n,unknownError:r,navigate:i,navigateAction:a,navigateBack:o,navigateHome:s,errorPageConfig:c,userGuidance:l})=>{let u=bi.isDevelopment(),{tComponent:d,makeTrComponent:f,isReady:p}=J({component:U.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY}),m=f(U.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY),h=e=>Gp({tComponent:d,componentType:U.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,key:e}),g=s??(()=>i(`/`));return p?e===`route`&&t?Mce(t,i,a,o??g,g,m,h,u,c,l):e===`javascript`&&n?Nce(n,g,m,u):Pce(r,g,m,u):null};function Ace(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 jce(e){return{type:hm.NAVIGATE,target:e.target,resourceOperationPath:e.resourceOperationPath,compositeViewReference:e.compositeViewReference}}function Mce(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=Ace(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=jce(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)(Ly,{variant:`default`,iconRef:kce(u),statusCode:u,title:d,message:f,suggestion:p,actions:m,featureGuide:h,supportAccess:g,leadMagnet:_,userGuidance:l})}function Nce(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)(Ly,{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 Pce(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:Oce(e),variant:`default`}),(0,$.jsx)(Ly,{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 Uy({preset:e=G.DEFAULT,...t}){let n=q(U.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,`AppLayout_RouterErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Wy=il.getLogger();function Fce(e){return e?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}var Gy=()=>{let e=ig(),t=oh(),{emit:n}=qo(),r=(0,Q.useContext)(cm),i=Qp(),a=(0,Q.useContext)(hh),o=(0,Q.useContext)(ea),s=(0,Q.useContext)(Ic),c=vh(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=vh(e)?Ru.buildRouterError(e,e.status):Ru.buildRouterError(e);return{wildoError:t,userGuidance:t.userGuidance}},[e]);Q.useEffect(()=>{if(u){Wy.error(`RouterErrorBoundary caught error:`,{wildoError:u,error:e});try{Ii.emit(xc.ERROR_OCCURED,{error:u})}catch(e){Wy.warn(`Failed to dispatch error event:`,{dispatchError:e})}}},[u,e]);let f=(0,Q.useMemo)(()=>{let e={...i?.buildContextResourceIdentifiers?.()??{},...Fce(u?.context)};return u?.organizationId&&(e.organizationId=u.organizationId),e},[i,u]),p=Q.useCallback(()=>{Mh({emit:n,routerNavigate:t})},[n,t]),m=Q.useCallback(e=>{if(!e.content)p();else if(a)n(xc.NAVIGATION_REQUEST,{content:e.content,initiator:{sourceZone:Li},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=Um.resolveResourceUrl(i,a,f,t.allResourceFieldIdentifiers,n.parentResourcesRequirements)?.resolvedUrl;if(!o){p();return}m({content:{contentType:va.RESOURCE_OPERATION,resourceContext:En.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:va.COMPOSITE_VIEW,viewRef:e.compositeViewReference,contextResourceIdentifiers:t},urlPath:Ap(e.compositeViewReference,t)})}else!e.target||e.target===`/`?p():a?eg({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){Wy.warn(`Cannot navigate to operation: resource registry not available`,{ref:e}),p();return}let{registry:t}=r,n=Um.resolveOperationRef(e,f,t);if(!n||n.contentType!==va.RESOURCE_OPERATION){p();return}let{resourceContext:i}=n,a=t.resourceConfigurations[i.resourceType];if(!a){p();return}let o=Um.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=Um.resolveGoBackTarget({currentBrowserUrl:Um.buildBrowserUrl(window.location.pathname,window.location.search),getZoneState:a.getZoneState});if(e?.browserUrl){n(xc.NAVIGATION_POP,{zone:e.zone}),t(e.browserUrl,{replace:!0});return}}window.history.length>1?t(-1):p()},[t,p,a]);return e?vh(e)?(0,$.jsx)(Uy,{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)(Uy,{errorType:`javascript`,jsError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Uy,{errorType:`generic`,unknownError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Uy,{errorType:`route`,routeError:{status:404,statusText:`Not Found`,data:{pathname:window.location.pathname}},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l})},Ice=4e3,Ky=il.getLogger(),qy=Ky.debugByType(`GlobalErrorHandler`);Ky.setDebugTypeLogging(`GlobalErrorHandler`,!1);function Lce(e){switch(e){case Di.CRITICAL:case Di.HIGH:return`error`;case Di.MEDIUM:return`warning`;case Di.LOW:return`info`;default:return`error`}}function Jy({onError:e}){let{on:t}=qo(),{handleWildoError:n}=tp(),{endSession:r,isAuthenticated:i,getEndedSessionReason:a}=gm(),{notifyError:o,notifyWarning:s,notifyInfo:c}=Im(),{tErrorMessage:l,tErrorGuidance:u,isKeySettled:d}=J(),f=(0,Q.useRef)({tErrorMessage:l,tErrorGuidance:u});f.current={tErrorMessage:l,tErrorGuidance:u};let p=d(ac.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()?(qy(`triggerLogout requested - logging out via AuthSession`),r(zre(e))):qy(`triggerLogout requested but not authenticated - skipping logout`)},[r,i]),v=(0,Q.useCallback)(e=>{let t=D[e.type],n=e.severity||t?.severity||Di.MEDIUM,r=pp(e,{translators:f.current}),i=Lce(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})}qy(`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,Ice))},[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(qy(`Received ERROR_OCCURED event`,{errorType:r.type,customMessageReference:r.customMessageReference,triggerLogout:r.triggerLogout}),ut.shouldSuppress(r)){qy(`Error suppressed (duplicate)`,{errorType:r.type,customMessageReference:r.customMessageReference});return}let i=r.triggerLogout===!0;if(i){qy(`triggerLogout=true - calling AuthSession logout handler`),_(r);let e=r.frontendActions||[];e.includes(go.DISCONNECT)&&(r={...r,frontendActions:e.filter(e=>e!==go.DISCONNECT)})}qy(`Error occurred`,{errorType:r.type,customMessageReference:r.customMessageReference});let o=r.suppressUserDisplay===!0,s=wn(r),c=r.frontendActions||[],l=r;o||i&&a()!==null?l={...r,frontendActions:c.filter(e=>e!==go.NOTIFY&&e!==go.SHOW_TOAST&&e!==go.SHOW_MODAL)}:s&&(b(r),l={...r,frontendActions:c.filter(e=>e!==go.NOTIFY&&e!==go.SHOW_TOAST)}),e&&e(r),n(l)},[n,e,_,b,a]);return(0,Q.useEffect)(()=>{qy(`Subscribing to ERROR_OCCURED events`,{eventName:xc.ERROR_OCCURED});let e=t(xc.ERROR_OCCURED,x);return()=>{qy(`Unsubscribing from ERROR_OCCURED events`),e()}},[t,x]),null}var Rce=()=>{let e=(0,Q.useContext)($m);if(!e)throw Error(`useLoading must be used within a LoadingProvider`);return e};function Yy(){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 Xy(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 zce({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 Zy({preset:e=G.DEFAULT,...t}){let n=Xo.resolve(U.LOW_LEVEL_LOADING_SPINNER,e);return n?(0,$.jsx)(n,{...t}):(0,$.jsx)(zce,{...t})}function Qy({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_LOADING_OVERLAY,`LoadingOverlay`)(e);return(0,$.jsx)(n,{...t})}function Bce(e){switch(e){case`overlay`:return{initialLoad:Ao.OPACITY_OVERLAY,refresh:Ao.OPACITY_OVERLAY};case`spinner-only`:return{initialLoad:Ao.SPINNER,refresh:Ao.SPINNER};case`skeleton-children`:return{initialLoad:Ao.SKELETON,refresh:Ao.OPACITY_OVERLAY};default:return}}var Vce=`contents [:where([class*='space-y-'])>&]:block`,$y=new Set([Ao.OPACITY_OVERLAY,Ao.HIDDEN,Ao.INVISIBLE]);function eb({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=Sc(),u=r??Bce(l.interactiveState?.loadingDisplay),d=(0,Q.useMemo)(()=>({keys:t??[]}),[t]),{requestKeys:f,isKeySettled:p,isReady:m}=J(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)?zl.INITIAL:h.some(e=>e.isLoading&&e.hasLoadedOnce)?zl.REFRESH:zl.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??Ao.OPACITY_OVERLAY,E=u?.initialLoad??Ao.SKELETON,D=$y.has(T)||$y.has(E);if(y)return D?(0,$.jsx)(`div`,{className:Vce,"data-loading-gate":`ready`,children:s}):(0,$.jsx)($.Fragment,{children:s});let O=b===zl.REFRESH?T:E,k={phase:b,scope:h[0]?.scope??{customIdentifier:`loading-gate`}};switch(O){case Ao.CUSTOM:return(0,$.jsx)($.Fragment,{children:i?.(k)??s});case Ao.SKELETON:return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading`}),i?i(k):(0,$.jsx)(mm,{template:`auto`,density:`auto`,"aria-hidden":`true`})]});case Ao.SPINNER:return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(Zy,{size:32})});case Ao.OPACITY_OVERLAY:return(0,$.jsxs)(`div`,{className:`relative`,"data-loading-gate":`loading`,children:[s,(0,$.jsx)(Qy,{})]});case Ao.HIDDEN:return(0,$.jsx)(`div`,{style:{display:`none`},"data-loading-gate":`loading`,children:s});case Ao.INVISIBLE:return(0,$.jsx)(`div`,{style:{visibility:`hidden`},"data-loading-gate":`loading`,children:s});case Ao.FULL_SCREEN:return(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background/80`,children:(0,$.jsx)(Zy,{size:48})});default:return(0,$.jsx)($.Fragment,{children:s})}}var tb;(function(e){e.PENDING=`pending`,e.READY=`ready`,e.ERROR=`error`})(tb||={});var nb=(0,Q.createContext)(null);function Hce(){let e=(0,Q.useContext)(nb);if(!e)throw Error(`useBarrierParticipant must be used within a LoadingBarrier`);return e}function Uce({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:tb.PENDING}),a(e=>e+1)),{markReady:()=>{let t=i.current.get(e);t&&t.status!==tb.READY&&(i.current.set(e,{status:tb.READY}),a(e=>e+1))},markError:t=>{let n=i.current.get(e);n&&n.status!==tb.ERROR&&(i.current.set(e,{status:tb.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===tb.READY),m=Array.from(f.values()).some(e=>e.status===tb.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!==tb.READY),n=e.map(([e])=>({customIdentifier:e})),r=e.find(([,e])=>e.error)?.[1]?.error;return(0,$.jsx)(nb.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:tb.PENDING});l(e=>e+1),a(e=>e+1)}})})}let g=!p;return(0,$.jsx)(nb.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)(Zy,{size:32})})]})})}var rb={[vr.RESOURCES_LAYOUTS]:{initialLoad:Ao.SKELETON,refresh:Ao.OPACITY_OVERLAY},[vr.RESOURCES_FIELDS]:{initialLoad:Ao.SKELETON,refresh:Ao.OPACITY_OVERLAY},[vr.HIGH_LEVEL_VIEWS]:{initialLoad:Ao.SKELETON,refresh:Ao.OPACITY_OVERLAY},[vr.APPLICATION_LEVEL_COMPONENTS]:{initialLoad:Ao.SKELETON,refresh:Ao.HIDDEN},[vr.PUBLIC_LAYOUTS]:{initialLoad:Ao.SPINNER,refresh:Ao.SPINNER}};function Wce(e,t){let n=rb[e]??{};return{initialLoad:t?.initialLoad??n.initialLoad??Ao.SKELETON,refresh:t?.refresh??n.refresh??Ao.OPACITY_OVERLAY,customRenderer:t?.customRenderer??n.customRenderer,disableInteraction:t?.disableInteraction??n.disableInteraction,skeletonSchema:t?.skeletonSchema??n.skeletonSchema}}var ib=il.getLogger(),Gce=ib.debugByType(`AppLoadingGate`);ib.setDebugTypeLogging(`AppLoadingGate`,!1);function ab({renderLoading:e,children:t}){let{isAppLoading:n,sources:r}=Yy(),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)(()=>{Gce(`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)(Zy,{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)(Zy,{size:48})}))]})}function ob(e){return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))}function sb(e){let t=e.displayNameLabelKey??Cd(e.providerRef),n=e.translate?.(t);return n&&n!==t?n:e.displayName??e.fallbackLabel??e.providerRef}function cb(...e){let t=M_(`FrontendApp`,e);return xae(`FrontendApp`,t.modules.values()),t}var lb=`@wildo-ai/external-connectors-public`,Kce={metadata:yd({ref:`dropbox`,packageName:lb,tier:Fd.MAIN,origin:_d}),providerCapabilities:[Ld.FRONTEND_FILE_PICKER],protocols:[pu.FRONTEND_SDK],publicConfig:{},publicConfigSchema:E_({appKey:{kind:T_.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:{[Ld.FRONTEND_FILE_PICKER]:{selectionDelivery:hd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Dd.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:Od.ACCOUNT_RESIDENCY}])),vendorLegalEntityName:`Dropbox, Inc.`,storageRegionTerritories:{"United States":[`us`],Australia:[`au`,`us`],"European Union":[`eu`,`us`],Japan:[`jp`,`us`],"United Kingdom":[`gb`,`us`]},storageRegionConditions:Object.fromEntries([`Australia`,`European Union`,`Japan`,`United Kingdom`].map(e=>[e,`Holds only for an eligible team whose request for this storage location Dropbox has approved.`])),evidence:[{facts:[md.STORAGE_REGION_TERRITORIES],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-16`},{facts:[md.PROCESSING_REGIONS,md.PROCESSING_REGION_REACH],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-10`}]}},qce={metadata:yd({ref:`google-drive`,packageName:lb,tier:Fd.MAIN,origin:_d}),providerCapabilities:[Ld.FRONTEND_FILE_PICKER],protocols:[pu.FRONTEND_SDK],publicConfig:{},publicConfigSchema:E_({appId:{kind:T_.STRING,description:`Google Cloud project NUMBER the Drive Picker is registered under.`},developerKey:{kind:T_.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:{[Ld.FRONTEND_FILE_PICKER]:{selectionDelivery:hd.REMOTE_REFERENCE}},fileStorage:Oae.GOOGLE_DRIVE,complianceProfile:{deploymentModels:[Dd.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:Od.ACCOUNT_RESIDENCY}])),evidence:[{facts:[md.DEPLOYMENT_MODELS,md.PROCESSING_REGIONS],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-06`},{facts:[md.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`},{facts:[md.PROCESSING_REGION_REACH],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-10`}]}},Jce=`Google Maps`,Yce=[Kce,qce,{metadata:yd({ref:`google-places`,packageName:lb,tier:Fd.MAIN,origin:_d}),providerCapabilities:[Ld.FRONTEND_ADDRESS_LOOKUP],protocols:[],publicConfig:{},publicConfigSchema:E_({}),components:{[Ld.FRONTEND_ADDRESS_LOOKUP]:{placeIdRetention:wd.NONE,addressLookup:{suggestOperationId:`address_suggest`,retrieveOperationId:`address_retrieve`,sessionTokenInput:`sessionToken`,attributionMark:Jce}}},complianceProfile:{deploymentModels:[Dd.VENDOR_HOSTED],processingRegions:[`Servers around the world`],evidence:[{facts:[md.DEPLOYMENT_MODELS,md.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`}]}},{metadata:yd({ref:`microsoft-onedrive`,packageName:lb,tier:Fd.MAIN,origin:_d}),providerCapabilities:[Ld.FRONTEND_FILE_PICKER],protocols:[pu.FRONTEND_SDK],publicConfig:{},publicConfigSchema:E_({clientId:{kind:T_.STRING,description:`Azure application (client) id the OneDrive picker is registered under.`},pickerRedirectUri:{kind:T_.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:{[Ld.FRONTEND_FILE_PICKER]:{selectionDelivery:hd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Dd.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:Od.ACCOUNT_RESIDENCY}])),evidence:[{facts:[md.DEPLOYMENT_MODELS,md.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-06`},{facts:[md.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/o365-data-locations`,verifiedAt:`2026-11-06`},{facts:[md.PROCESSING_REGIONS],source:`https://www.microsoft.com/en-us/privacy/privacystatement`,verifiedAt:`2026-11-06`},{facts:[md.PROCESSING_REGION_REACH],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-10`}]}}];cb({modules:new Map(Yce.map(e=>[e.metadata.ref,e]))});var ub=function(e){return e.AT_SURFACE_START=`at_surface_start`,e.ON_DEMAND=`on_demand`,e}({});function db(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 fb=Object.freeze({browserHosted:!1}),pb=Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([])}),mb=Object.freeze({FRONTEND_PRODUCT_ANALYTICS:Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([Hd.ANALYTICS])}),FRONTEND_ERROR_MONITORING:pb,FRONTEND_CAPTCHA:pb,FRONTEND_SEARCH:pb,FRONTEND_FILE_PICKER:pb,FRONTEND_ADDRESS_LOOKUP:pb,FRONTEND_CHAT_SIGN_IN_COMPLETION:pb,SSO_OAUTH2:pb,BILLING:fb,EMAIL_TRANSACTIONAL:fb,EMAIL_MARKETING:fb,EMAIL_INBOUND:fb,SMS:fb,ELECTRONIC_SIGNATURE:fb,EMBEDDED_ELECTRONIC_SIGNATURE:fb,SSO_SAML:fb,LLM_CHAT:fb,LLM_EMBEDDINGS:fb,DOCUMENT_TEXT_EXTRACTION:fb,PROMPT_INJECTION_SCREENING:fb,OUTPUT_MODERATION:fb,CODING_AGENT:fb,IMAGE_GENERATION:fb,LLM_OBSERVABILITY:fb,OBSERVABILITY_TELEMETRY:fb,COMPLIANCE_AUDIT_TRAIL:fb,KEY_MANAGEMENT:fb});function hb(e){return Object.prototype.hasOwnProperty.call(mb,e)?mb[e]:void 0}function gb(e){return(e.providerCapabilities??[]).filter(e=>hb(e)?.browserHosted!==!0)}function _b(e){let t=new Set(yae);return(e.consentPurposes??[]).filter(e=>!t.has(e))}function vb(e){let t=[...e.consentPurposes??[]];for(let n of e.providerCapabilities??[]){let e=hb(n);e?.browserHosted===!0&&t.push(...e.consentPurposes)}return Bd(t)}function yb(e,t){return gb(e).length>0||_b(e).length>0?!1:zd(t,vb(e)).length===0}function bb(e,t){return zd(t,vb(e))}function xb(e,t,n){let r=gb(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=_b(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 ${bb(t,n).join(`, `)}, which has not been granted on this surface.`}function Sb(e,t){let n=vb(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 Cb(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 wb(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 Xce(e,t){if(e===void 0||t===void 0)return e===t;let n=hae(t);return jae.every(t=>wb(e[t]??[],n[t]))}function Zce(e){return e.issues!==void 0}function Qce(e,t,n,r,i){let a=vae({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(Zce(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 $ce(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&&!Xce(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&&Wd(a.sdk)!==Wd(o.sdk?.descriptor)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares ${Wd(o.sdk?.descriptor)} but its served entry says ${Wd(a.sdk)}. Regenerate with \`wildo config sync\`.`}),o!==void 0){for(let[e,n]of Object.entries(o.components??{})){let r=Cb(db(n)),o=a.components?.[e],s=o===void 0?void 0:Cb(db(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&&!wb(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&&D_(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=Sb(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=k_([...new Set([...O_(o?.publicConfigSchema),...a.requiredPublicConfigKeys??[]])],u);e.length>0&&(t({kind:`PUBLIC_CONFIG_NOT_SUPPLIED`,providerRef:i,message:A_({providerRef:i,missingKeys:e})}),o=void 0,d=void 0)}if(o?.publicConfigSchema!==void 0){let e=Qce(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 ele(e){let t=$ce(e);return cb({modules:new Map([...t].map(([e,t])=>[e,{...t,providerCapabilities:t.providerCapabilities,protocols:t.protocols,consentPurposes:t.consentPurposes}]))})}var Tb=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 Eb(e,t){let n=e.sdk;if(n?.activation!==ub.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 Db(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function tle(){return typeof globalThis<`u`&&globalThis.window!==void 0}async function Ob(e){let t=t=>{e.onDiagnostic?.(t)},n=new Map,r=e.isBrowser??tle;for(let i of e.modules){let a=i.sdk;if(a===void 0)continue;let o=i.metadata.ref,s=(a.activation??ub.AT_SURFACE_START)===ub.ON_DEMAND;if(e.onDemand===void 0){if(s)continue}else{let{verdict:n,cause:r}=Eb(i,e.onDemand);if(n===Tb.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===Tb.PREDICATE_FAILED&&t({kind:`ON_DEMAND_PREDICATE_FAILED`,providerRef:o,message:`Provider "${o}"'s servesOnDemandContext threw: ${Db(Vc(r))} Its SDK was not loaded.`,cause:r}),n!==Tb.SERVES)continue}if(!yb(i,e.grantedConsentPurposes??[])){t({kind:`WITHHELD_PENDING_CONSENT`,providerRef:o,message:`${xb(o,i,e.grantedConsentPurposes??[])} Its SDK was not loaded.`});continue}let c=Sb(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 ${Wd(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),vb(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 ${Wd(a.descriptor)}): ${Db(Vc(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 nle(){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 kb=`data-wildo-provider-script`,Ab=`data-wildo-provider-script-state`;function rle(e){if(e===void 0)return[];let t=[];for(let n of e)if(!(vb(n).length>0)&&yb(n,[]))for(let e of n.scripts??[])t.push({providerRef:n.metadata.ref,declaration:e});return t}function ile(e,t){return[...e.querySelectorAll(`script[${kb}]`)].find(e=>e.getAttribute(`src`)===t)}function ale(e,t){let{providerRef:n,declaration:r}=t,i=e.createElement(`script`);return i.src=r.src,i.setAttribute(kb,n),i.setAttribute(Ab,`loading`),i.addEventListener(`load`,()=>i.setAttribute(Ab,`loaded`),{once:!0}),i.addEventListener(`error`,()=>i.setAttribute(Ab,`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 ole(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 sle(e){let t=e.getAttribute(Ab);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 jb(e,t){let n=await Promise.all(e.map(async e=>({script:e,state:await sle(ile(t,e.declaration.src)??ale(t,e))})));return{loaded:n.filter(e=>e.state===`loaded`).map(e=>e.script),failed:n.filter(e=>e.state===`failed`).map(e=>ole(e.script))}}function cle(){return typeof document<`u`}var lle=e=>jb(e,document);function ule(e){return typeof e==`object`&&!!e&&e[Symbol.toStringTag]===`Module`}function dle(e){return typeof e==`function`||typeof e==`object`&&!!e}function fle(e){let t=t=>{e?.onDiagnostic?.(t)},n=new Map,r=new Map,i=e?.loadScripts??lle,a=e?.hasBrowserDocument??cle,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=Sb(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=yb(r,n);return{permitted:i,missingPurposes:i?[]:bb(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(!yb(p,c))return t({kind:`WITHHELD_PENDING_CONSENT`,capability:e,providerRef:o,message:`${xb(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: ${Aie(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 ule(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):dle(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 Mb(e,t){return`${e}:${t}`}function ple(e){let t=new Map;for(let n of e??[])t.set(Mb(n.capability,n.providerRef),n);return t}function mle(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(Mb(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:db(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 hle(e,t){let n=new Set;for(let e of t)n.add(e.providerRef);return rle([...e].filter(e=>!n.has(e.metadata.ref)))}var Nb=function(e){return e.NONE=`NONE`,e.LOADING=`LOADING`,e.READY=`READY`,e.UNAVAILABLE=`UNAVAILABLE`,e.CONSENT_REQUIRED=`CONSENT_REQUIRED`,e}({}),Pb=Object.freeze([]);function Fb(){return{status:`NONE`,Component:null,missingConsentPurposes:Pb}}function gle(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(Fb()),()=>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:Pb}),t.resolve(n,r,i).then(e=>{s&&a(e===null?{status:`UNAVAILABLE`,Component:null,missingConsentPurposes:Pb}:{status:`READY`,Component:e,missingConsentPurposes:Pb})}),()=>{s=!1}}var Ib=class{registry=cb({modules:new Map});initialize(e){this.registry=ele({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 Ob({surface:nc.SAAS_APP,modules:this.registry.getProvidersByProviderCapability(e.capability),onDemand:e,onDiagnostic:t})}providersServingOnDemand(e){return this.registry.getProvidersByProviderCapability(e.capability).filter(t=>Eb(t,e).verdict===Tb.SERVES).map(e=>e.metadata.ref)}};function Lb(e){let t=new Ib;return t.initialize(e),t}var Rb=il.getLogger(),zb;(function(e){e.SUCCEEDED=`succeeded`,e.FAILED=`failed`})(zb||={});function Bb(e,t){let n=0;for(let[r,i]of e.activations)if(!Yse(i.handle))Rb.warn(`A chat sign-in completion provider returned a handle that is not a FrontendChatSignInCompletionSink`,{providerRef:r});else try{t===zb.SUCCEEDED?i.handle.signInSucceeded():i.handle.signInFailed(),n+=1}catch(e){Rb.warn(`A chat sign-in completion provider failed to tell its host`,{providerRef:r,error:e})}return n}function Vb(e){let t=(0,Q.useContext)(ea)?.frontendProviderRegistry,n=(0,Q.useMemo)(()=>e===void 0?void 0:{capability:Ld.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===zb.SUCCEEDED&&e===zb.FAILED||i.current===e&&o?.repeat!==!0)return 0;i.current=e,a.current??=t.activateOnDemand(n,e=>Rb.warn(`Chat sign-in completion provider diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message}));try{let t=Bb(await a.current,e);return t===0&&(a.current=null),t}catch(e){return Rb.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 Hb=new Map;function Ub(e){Hb=ple([...Hb.values(),...e])}function Wb(){return Hb}function _le(){Hb=new Map}var Gb;(function(e){e.NOT_APPLICABLE=`notApplicable`,e.REQUIRED=`required`,e.PROMPT=`prompt`,e.SATISFIED=`satisfied`})(Gb||={});function Kb(e){let t=Bd(e.serviceConsentRequirement?.requiredPurposes),n=Bd(e.privacy?.consentedPurposes),r=zd(n,t),i=Sae({requiredPurposes:t,analyticsEnabled:e.analyticsEnabled,analyticsRequiresConsent:e.analyticsRequiresConsent,capabilityDeclaredPurposes:e.capabilityDeclaredConsentPurposes}).filter(e=>!t.includes(e)),a=Eae(e.privacy),o=i.filter(e=>!a.includes(e)),s={requiredPurposes:t,missingRequiredPurposes:r,optionalPurposes:i,promptedPurposes:o,grantedPurposes:n,gatedProcessing:t.length>0?e.serviceConsentRequirement?.gatedProcessing:void 0};return r.length>0?{...s,status:Gb.REQUIRED}:e.privacy===null||e.privacy===void 0||t.length===0&&i.length===0?{...s,status:Gb.NOT_APPLICABLE}:o.length>0?{...s,status:Gb.PROMPT}:{...s,status:Gb.SATISFIED}}function qb(e,t,n){let r=e.filter(e=>!t.includes(e)),i=t.filter(e=>n.includes(e));return Bd([...r,...i])}function Jb(e,t,n){let r=qb(e.grantedPurposes,t,n);return zd(r,e.requiredPurposes)}function Yb(){let e=(0,Q.useContext)(ah),t=e?.privacy?.consentedPurposes,n=(0,Q.useMemo)(()=>Bd(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(qb(n,e,e),e)},[n,r]);return{granted:n,grant:i?a:void 0}}function Xb(e){let{frontendProviderRegistry:t,providerComponentRegistry:n}=Eu();return n===void 0?[]:n.listProviders(e).map(e=>{let n=t?.getProviderByRef(e);return{providerRef:e,displayNameLabelKey:n?.metadata.displayNameLabelKey??Cd(e),displayName:n?.metadata.displayName,fileStorage:n?.fileStorage}})}function Zb(e,t){let{providerComponentRegistry:n}=Eu(),{granted:r}=Yb(),i=r.join(`,`),[a,o]=(0,Q.useState)(()=>Fb());return(0,Q.useEffect)(()=>gle({registry:n,capability:e,providerRef:t,grantedConsentPurposes:r,onState:o}),[e,t,n,i]),a}var Qb;(function(e){e.PROVIDER_DECLARED_NO_DELIVERY=`PROVIDER_DECLARED_NO_DELIVERY`,e.DELIVERY_CONTRADICTS_DECLARATION=`DELIVERY_CONTRADICTS_DECLARATION`})(Qb||={});function $b(e){let t=e.descriptor?.selectionDelivery;if(t===void 0)return{accepted:[],rejections:[{kind:Qb.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:Qb.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 ex;(function(e){e.PLACE_ID_CONTRADICTS_DECLARATION=`PLACE_ID_CONTRADICTS_DECLARATION`,e.ADDRESS_REFUSED_BY_FIELD=`ADDRESS_REFUSED_BY_FIELD`})(ex||={});function tx(e){let t=e.descriptor?.placeIdRetention??wd.NONE,{address:n,placeId:r}=e.selection;return r!==void 0&&t===wd.NONE?{rejection:{kind:ex.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:ex.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 nx=Ld.FRONTEND_FILE_PICKER;function rx(e){let{providerComponentRegistry:t,frontendProviderRegistry:n}=Eu(),r=Xb(nx),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}=Zb(nx,o),{grant:f}=Yb(),p=(0,Q.useMemo)(()=>o===void 0?{}:n?.getProviderByRef(o)?.publicConfig??{},[o,n]),m=e.constraints,h=e.multiple,g=(0,Q.useMemo)(()=>bae({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=$b({providerRef:o,descriptor:t?.describe(nx,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!==Nb.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 Tc().getProviderConnectionAccessToken(o))?.accessToken},[o]);if(a.length===0)return null;let T=e.renderChooser?.({choices:a,chosen:o,choose:s})??vle({choices:a,chosen:o,choose:s}),E=a.find(e=>e.providerRef===o),D=l===Nb.CONSENT_REQUIRED&&E!==void 0?(e.renderConsentRequired??yle)({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===Nb.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 vle(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 yle(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 ix;(function(e){e.VERTICAL=`vertical`,e.HORIZONTAL=`horizontal`,e.RESPONSIVE=`responsive`})(ix||={});function ax({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD,`Field`)(e);return(0,$.jsx)(n,{...t})}function ox({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_LABEL,`FieldLabel`)(e);return(0,$.jsx)(n,{...t})}function sx({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_TITLE,`FieldTitle`)(e);return(0,$.jsx)(n,{...t})}function cx({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_CONTENT,`FieldContent`)(e);return(0,$.jsx)(n,{...t})}function lx({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_DESCRIPTION,`FieldDescription`)(e);return(0,$.jsx)(n,{...t})}function ux({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_ERROR,`FieldError`)(e);return(0,$.jsx)(n,{...t})}function ble({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FIELD_SEPARATOR,`FieldSeparator`)(e);return(0,$.jsx)(n,{...t})}var dx=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=q(U.LOW_LEVEL_COMBOBOX,`Combobox`)(e);return(0,$.jsx)(r,{...t,ref:n})});dx.displayName=`Combobox`;var fx=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=q(U.LOW_LEVEL_COMBOBOX_MULTIPLE,`ComboboxMultiple`)(e);return(0,$.jsx)(r,{...t,ref:n})});fx.displayName=`ComboboxMultiple`;var xle=gd(),px=class extends Error{constructor(){super(`The chosen place has no postal address the field can hold.`),this.name=`ProviderAddressLookupPlaceWithoutAddressError`}};function mx({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 hx(e){return e instanceof Error?e:Error(String(e))}function gx(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}=J({component:[U.LOW_LEVEL_FORM_FIELD_ADDRESS]}),m=(e,t)=>p(U.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(hx(e));return}n(r).then(n=>{e===x.current&&v(t.readSuggestions(n))}).catch(t=>{e===x.current&&(v([]),o(hx(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(hx(e));return}r(a).then(e=>{let n=t.readAddress(e);n===void 0?o(new px):i({address:n})}).catch(e=>o(hx(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(Il.LOOKUP_NO_RESULTS):m(Il.LOOKUP_TYPE_MORE,{minimum:3});return(0,$.jsx)(dx,{schema:xle,name:d,value:``,options:T,onChange:D,onSearchChange:g,onOpenChange:O,shouldFilter:!1,isLoading:y,disabled:u,placeholder:m(Il.LOOKUP_PLACEHOLDER),searchPlaceholder:m(Il.LOOKUP_SEARCH_PLACEHOLDER),emptyMessage:k,listFooter:f===void 0?void 0:(0,$.jsx)(mx,{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 _x=Ld.FRONTEND_ADDRESS_LOOKUP,Sle=tu(ca).consentedPurposes,vx;(function(e){e.UNAVAILABLE=`UNAVAILABLE`,e.ADDRESS_REFUSED=`ADDRESS_REFUSED`})(vx||={});function Cle(){return globalThis.crypto.randomUUID()}function yx({host:e,addressSchema:t,fieldName:n}){let{providerComponentRegistry:r,frontendProviderRegistry:i}=Eu(),{t:a,tComponent:o,tResourceFieldEnumValue:s,currentLanguage:c}=J({component:[U.LOW_LEVEL_FORM_FIELD_ADDRESS]}),l=(e,t)=>o(U.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),u=Xb(_x),d=(0,Q.useMemo)(()=>u.filter(e=>r?.describe(_x,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:_}=Zb(_x,m),{grant:v}=Yb(),[y,b]=(0,Q.useState)(void 0),x=m===void 0?void 0:r?.describe(_x,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??=Cle(),r={...r,[n]:C.current}),(await Tc().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=tx({providerRef:m,descriptor:x,selection:n,addressSchema:t});r.accepted===void 0?b(vx.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 px?vx.ADDRESS_REFUSED:vx.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===Nb.UNAVAILABLE?vx.UNAVAILABLE:y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-address-lookup":m??``,children:[(0,$.jsx)(ox,{htmlFor:`field-${N}`,className:`text-sm text-muted-foreground`,children:l(Il.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:Gd.SM,variant:e.providerRef===m?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.providerRef===m,onClick:()=>{b(void 0),w(),p(e.providerRef)},children:M(e)},e.providerRef))}):null,h===Nb.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(gu.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Sle)).join(`, `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:l(Il.LOOKUP_CONSENT_REQUIRED,{provider:M(j),purposes:e})}),v===void 0?null:(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:Y.OUTLINE,onClick:()=>void v(_),children:l(Il.LOOKUP_CONSENT_GRANT,{purposes:e})})]})})()}):null,h===Nb.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(Il.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===vx.UNAVAILABLE?Il.LOOKUP_UNAVAILABLE:Il.LOOKUP_ADDRESS_REFUSED)})]})}function bx(){return(0,Q.useContext)(xx)}var xx=(0,Q.createContext)([]),wle=il.getLogger();function Tle(e){return[...e].sort().join(`,`)}var Sx=({children:e})=>{let t=(0,Q.useContext)(ea),n=t?.frontendProviderRegistry,{on:r}=qo(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),c=(0,Q.useRef)(nle());(0,Q.useEffect)(()=>r(xc.USER_PREFERENCES_CHANGED,e=>{if(e.privacy===null){a([]);return}let t=e.privacy?.consentedPurposes;t!==void 0&&a(Bd(t))}),[r]);let l=t?.appConfig?.analytics?.enabled===!0,u=(0,Q.useMemo)(()=>(n?.listAll()??[]).filter(e=>vb(e).length>0&&(l||!e.providerCapabilities.includes(Ld.FRONTEND_PRODUCT_ANALYTICS))),[n,l]),d=(0,Q.useMemo)(()=>{let e=i??[],t=new Set(u.flatMap(e=>vb(e)));return e.filter(e=>t.has(e))},[u,i]),f=Tle(d);return(0,Q.useEffect)(()=>{if(u.length===0||d.length===0){s([]);return}let e=c.current.start(()=>Ob({surface:nc.SAAS_APP,modules:u,grantedConsentPurposes:d,onDiagnostic:e=>{wle.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)(xx.Provider,{value:o,children:e})},Cx=il.getLogger(),wx=Cx.debugByType(`ResourceReadCache`);Cx.setDebugTypeLogging(`ResourceReadCache`,!1);var Ele=200,Dle=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(),wx(`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),wx(`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&&wx(`invalidated by resource type`,{resourceType:e,dropped:t})}clear(){let e=this.entries.size;this.entries.clear(),e>0&&wx(`cleared`,{dropped:e})}evictIfOverCapacity(){if(this.entries.size<=Ele)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 Ole(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(e instanceof Date)return`D${e.getTime()}`;if(n.has(e))throw Error(`not renderable`);if(n.add(e),Array.isArray(e))return`[${e.map(r).join(`,`)}]`;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw Error(`not renderable`);return`{${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 Tx(e,t){let n=t?.[gu.USERS];return e?.primaryKeyIdentifiesInitiator===!0&&n!==void 0&&e.resourceFieldIdentifier===n}function Ex(e,t){return e?.timeout===void 0?t.clientRequestTimeoutMs===void 0?{}:{timeout:t.clientRequestTimeoutMs}:{}}function kle(){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 Dx(e,t){return t.idempotencyKey===void 0||Object.keys(e?.headers??{}).some(e=>e.toLowerCase()===Te.IDEMPOTENCY_KEY)?{}:{headers:{...e?.headers,[Te.IDEMPOTENCY_KEY]:Fte(kle())}}}function Ale(e){return typeof e==`string`||typeof e==`number`}function Ox(e){let t=bl(e);return t===K.READ||t===K.LIST||t===K.SEARCH}function jle(e){return!Ox(e)&&bl(e)!==K.COUNT&&e.httpVerb!==Dt.GET}function kx(e){return Ox(e)&&e.hasCustomResponseDto!==!0}var Ax=class e extends ba{resourcesRegistry;errorBuilder;constructor(e,t={}){super(t),this.resourcesRegistry=e,this.errorBuilder=new Ae}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(v.INTERNAL,{customMessageReference:e,operationPathKey:t,context:n}),i=Error(e);return i.wildoError=r,i}readCache=new Dle;getReadCache(){return this.readCache}resolveCacheableRead(e,t,n){let r=t.resourceIdentifier,i=Ole(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===Sr.APPLICATION){let e=this.readCache.getApplicationId();e&&(o.applicationId=e)}if(a===Sr.ORGANIZATIONS&&!o.organizationId){let e=this.readCache.getOrganizationId();e&&(o.organizationId=e)}return{key:i,resourceType:r,scopes:sne(o,a)}}async doOperation(e,t,n){let r=wi.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(rs.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e});Ox(i)||this.readCache.invalidateResourceType(i.resourceIdentifier);let a=kx(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 E.API_CALL:return this.executeApiCallOperation(i,t,n).then(e=>(a&&this.readCache.store(a.key,e,a.resourceType,a.scopes),jle(i)&&Tx(this.resourcesRegistry.resourceConfigurations[i.resourceIdentifier],this.resourcesRegistry.allResourceFieldIdentifiers)&&this.revalidateSession(),e));default:throw i.variantType,this.buildError(rs.FRONTEND_RESOURCE_UNSUPPORTED_OPERATION_TYPE,e,{operationPathKey:e})}}async executeSearchOperation(e,t,n){let r=wi.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(rs.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e,operationType:`search`});if(bl(i)!==K.SEARCH)throw this.buildError(rs.FRONTEND_RESOURCE_SEARCH_OPERATION_INVALID,e,{operationPathKey:e,actualOperationIdentifier:i.operationIdentifier});let a=kx(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(Qte(e,n))return this.validateResponseData(n,iee,void 0,!1);if(sae(e,n))return this.validateResponseData(n,Jee,void 0,!1);let r=this.selectResponseDto(e,t);return this.validateResponseData(n,r,void 0,$t(e))}selectResponseDto(e,t){let n=Ns.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 Rd?this.buildError(rs.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=wi.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!==E.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(rs.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,...Ex(n,e),...Dx(n,e),params:o,riskLevel:e.riskLevel||Ac.MEDIUM,resourceType:e.resourceIdentifier,operationIdentifier:String(e.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:cc.COMPONENT,phase:zl.INITIAL}},c;switch(e.httpVerb){case Dt.GET:c=await this.get(i,s);break;case Dt.POST:c=await this.post(i,t.requestData,s);break;case Dt.PUT:c=await this.put(i,t.requestData,s);break;case Dt.DELETE:c=await this.delete(i,t.requestData===void 0?s:{...s,data:t.requestData});break;case Dt.PATCH:c=await this.patch(i,t.requestData,s);break;default:throw this.buildError(rs.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(rs.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!==Yl.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,...Ex(n,r),params:c,riskLevel:r.riskLevel||Ac.MEDIUM,resourceType:r.resourceIdentifier,operationIdentifier:String(r.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:cc.COMPONENT,phase:zl.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(rs.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(rs.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(Ale(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=wi.extractOperationPath(n),r=wi.createOperationPathKey(t);e.push(r)}}return e}getOperationDetails(e){let t=wi.parseOperationPathKey(e);return this.findOperation(t)}},jx=il.getLogger();jx.debugByType(`useNavigationState`),jx.setDebugTypeLogging(`useNavigationState`,!1);function Mx(){let e=(0,Q.useContext)(hh);if(!e)throw Error(`useNavigationState must be used within a NavigationProvider`);return e}var Nx;(function(e){e.ELEMENT=`element`,e.CREATE=`create`})(Nx||={});var Px=(0,Q.createContext)({isAvailable:!1,target:null,open:()=>void 0,close:()=>void 0,isElementActive:()=>!1,isCreateActive:!1});function Fx({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===Nx.ELEMENT&&n.elementId===e:!1,[n]),s=(0,Q.useMemo)(()=>({isAvailable:!0,target:n,open:i,close:a,isElementActive:o,isCreateActive:n?.kind===Nx.CREATE}),[n,i,a,o]);return(0,$.jsx)(Px.Provider,{value:s,children:t})}function Ix(){return(0,Q.useContext)(Px)}var Lx=il.getLogger(),Rx=Lx.debugByType(`useNavigationController`);Lx.setDebugTypeLogging(`useNavigationController`,!1);function zx(e){let t=e?.operationFrontendConfig?.surface;return t!==Jr.EMBEDDED&&t!==Jr.API_ONLY}function Bx(e,t,n=!1){Um.isInTransaction()||Um.beginTransaction(`controller_url_update`),e(t,{replace:n})}function Vx(e){if(!Um.isResourceOperationContent(e))return{operation:K.LIST,effectiveOperation:K.LIST,actionPresentationIsAuthored:!1};let t=e.resourceContext.operation;return{operation:t?.operationIdentifier??K.LIST,effectiveOperation:bl(t),resourceType:e.resourceContext.resourceType,operationSurface:t?.operationFrontendConfig?.surface,operationOverrides:t?.operationFrontendConfig?.navigationOverrides,actionPresentationTransition:Nne(Qc(t)),actionPresentationIsAuthored:t?.operationFrontendConfig?.actionPresentation!==void 0}}var Mle={[so.SECONDARY]:so.PRIMARY,[so.COMPANION]:so.SECONDARY};function Nle(e){let t=Ux(e);return t?.persistent===!0&&t.targetZone===e.placedZone}function Hx(e){let t=Ux(e);return t?(t.collapsedFromZone??t.targetZone)===so.PRIMARY:!1}function Ux(e){let t=Mle[e.paneZone];if(!e.layout||!t)return;let n=Um.isResourceOperationContent(e.content)?Ple(e.content.resourceContext,e.registry,e.viewport):void 0,r={[so.PRIMARY]:!0};return t===so.SECONDARY&&(r[so.SECONDARY]=!0),bh.resolve({...Vx(e.content),relationshipTransition:n,sourceZone:t,focusedZone:t,viewport:e.viewport,contentAreaWidth:e.contentAreaWidth,zoneOccupancy:r,zoneDepth:{}},e.layout)}function Ple(e,t,n){let r=(e.parentResourcesRequirements??[]).filter(e=>!e.isPrimaryScope),i=r[r.length-1];if(!i)return;let a=Um.findRelationshipBetween(i.resourceType,e.resourceType,t,i.foreignKeyField);return Zh(a?.display?.inParentNavigation?.transition,n??yi.DESKTOP)}function Wx(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:En.selfReferenceForeignKeysOf(t.resourceType,r).includes(i)?e[i]={fieldIdentifier:i,resourceId:n}:e[t.resourceType]={fieldIdentifier:i,resourceId:n}}function Gx(e){let{resourceType:t,contextResourceIdentifiers:n,parentResourcesRequirements:r,registry:i,emit:a,getZoneState:o}=e;if(!e.replaceExisting&&o(so.PRIMARY).stack.length>0)return;let s=i.resourceConfigurations?.[t];if(!s)return;let c={...n};delete c[t];let l=Kl(Za(s.operations??[],K.LIST,{allowBulk:!0}).filter(e=>Fi(e.operationFrontendConfig)),K.LIST,{allowBulk:!0});if(!l)return;let u=Um.resolveResourceUrl(s,l,Vu(c),i.allResourceFieldIdentifiers,r)?.resolvedUrl;a(xc.NAVIGATION_REPLACE,{zone:so.PRIMARY,content:{contentType:va.RESOURCE_OPERATION,resourceContext:En.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:l,contextResourceIdentifiers:c,parentResourcesRequirements:r})},...u?{urlPath:u}:{},stackEntryId:Um.generateStackEntryId(),initiator:{sourceZone:so.PRIMARY},navigationSource:e.navigationSource??Ht.URL_SYNC,transition:Ka.REPLACE})}function Kx(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===so.SECONDARY?l.push(so.PRIMARY):t===so.COMPANION&&l.push(so.SECONDARY,so.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),_=Um.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&&Wx(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=Um.resolveAncestorOperationConfig(_,h,{registry:n,contextResourceIdentifiers:S,contextualParameters:V.buildContextualParameters(S,n)}),w=Kx(C,m,s?.viewerMayPerform)?C:null;if(t===so.PRIMARY&&(!w||Um.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&&Wx(t,i,e,n)}Gx({resourceType:g,contextResourceIdentifiers:t,parentResourcesRequirements:e,registry:n,emit:i,getZoneState:o,navigationSource:Ht.CONTROLLER,replaceExisting:!!s?.overwriteExisting});continue}if(!w)continue;let T=bl(w);x&&T===K.READ&&(b[m]=x);let E=En.createFrontendResourceOperationContextFromOperation({resourceType:m,operation:w,contextResourceIdentifiers:b,parentResourcesRequirements:y}),D={contentType:va.RESOURCE_OPERATION,resourceContext:E},O;if(zx(w)){let e=Um.resolveResourceUrl(h,w,Vu(b),n.allResourceFieldIdentifiers,y);e?.resolvedUrl&&(O=e.resolvedUrl)}let k=Um.generateStackEntryId();Rx(`cascadeAncestorZones: populating ancestor zone`,{zone:t,ancestorResourceType:m,ancestorOp:T,ancestorUrl:O}),i(xc.NAVIGATION_REPLACE,{zone:t,content:D,urlPath:O,stackEntryId:k,initiator:{sourceZone:t},navigationSource:Ht.CONTROLLER,transition:Ka.REPLACE}),t===so.PRIMARY&&O&&a&&Bx(a,O,!0)}}function Fle(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 Ile(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 Lle={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0};function Jx(){let{auth:e,appConfig:t}=Eu(),n=(0,Q.useContext)(ah),r=bi.loadEnvironmentConfig().frontendServiceName;return(0,Q.useMemo)(()=>{let i=Fle(r,t.frontendServices),a=Ile(r,n?.user?.userTypes,t.frontendServices)??i,o=(a?t.userTypes?.[a]:null)?.auth??null,s=o?.passwordPolicy??Lle,c=o?.registration,l=dne.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&&hte(l.data.mode,eae.PUBLIC_SELF_SERVICE),additionalProfileQuestions:l.data.additionalProfileQuestions??[],profileNamesCollectedAt:Ue(l.data)}:{mode:qu.DISABLED,allowedMethods:[],frontendServiceAllowsRegistration:!1,publicRegistrationAvailable:!1,additionalProfileQuestions:[],profileNamesCollectedAt:bu.REGISTRATION};return{resolvedUserType:a,userTypeAuth:o,globalAuth:e,passwordPolicy:s,registrationConfig:d}},[r,t,e,n?.user?.userTypes])}var Yx=(0,Q.createContext)(void 0),Rle=`wildo:appMode:`;function zle(e,t){return`${Rle}${e??`default`}:${t??`anon`}`}function Ble(e){try{return localStorage.getItem(e)}catch{return null}}function Vle(e,t){try{localStorage.setItem(e,t)}catch{}}function Xx(e,t){if(e.length===0)return null;let n=new Set(e.map(e=>e.ref)),r=Ble(t);if(r&&n.has(r))return r;let i=e.find(e=>e.isDefault);return i?i.ref:e[0].ref}var Zx=({children:e})=>{let{frontendConfiguration:t,appConfig:n}=Eu(),{resolvedUserType:r}=Jx(),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)(()=>zle(n?.appIdentity?.appName,void 0),[n?.appIdentity?.appName]),[s,c]=(0,Q.useState)(()=>Xx(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=Xx(a,o);c(t)},[a,o]);let l=(0,Q.useCallback)(e=>{a.some(t=>t.ref===e)&&(c(e),Vle(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)(Yx.Provider,{value:u,children:e})};function Hle(){let e=(0,Q.useContext)(Yx);if(!e)throw Error(`useAppMode must be used within an AppModeProvider`);return e}function Qx(){return(0,Q.useContext)(Yx)??null}var Ule=il.getLogger(),Wle=100,$x;(function(e){e.PENDING=`pending`,e.HELD=`held`,e.NONE=`none`,e.UNKNOWN=`unknown`,e.STALE=`stale`})($x||={});function eS(e){return e?e.state===$x.HELD||(e.state===$x.PENDING||e.state===$x.STALE)&&e.previouslyHeld===!0:!1}var tS=new Map,nS=new Set;function Gle(e){return nS.add(e),()=>{nS.delete(e)}}function rS(){for(let e of nS)e()}function iS(e){let t=tS.get(e);t&&t.state!==$x.STALE&&(tS.set(e,{state:$x.STALE,previouslyHeld:eS(t)}),rS())}function Kle(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===E.API_CALL)}function qle(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 Jle(e){let t=e;return t?.wildoError?.type===v.NOT_FOUND||t?.wildoError?.context?.httpStatus===404||t?.response?.status===404||t?.status===404}function Yle(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 aS(e,t,n){let r=(0,Q.useContext)(cm),i=Qp(),a=(0,Q.useContext)(ia),o=i?.currentUserId??null,s=i?.currentOrganizationId??null,c=r?.registry,l=(0,Q.useMemo)(()=>Kle(c?.resourceConfigurations[e.resourceType]?.operations,e.operation),[c,e.resourceType,e.operation]),u=c?.resourceConfigurations[gu.ORGANIZATIONS]?.resourceFieldIdentifier,d=!!l&&Gm({...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)(Gle,()=>f?tS.get(f):void 0,()=>void 0);(0,Q.useEffect)(()=>{let t=f?tS.get(f):void 0;if(!f||t&&t.state!==$x.STALE||!l||!u||!s)return;let n=p.current;if(!n)return;let r={state:$x.PENDING,previouslyHeld:eS(t)};tS.set(f,r),rS();let i=e=>{tS.get(f)===r&&(tS.set(f,{state:e}),rS())},a=wi.buildOperationPathKeyFromOperation(l),o={[u]:s};(async()=>{try{if(e.operation===K.READ){let e=Yle(await n(a,{contextualParameters:o},{silent:!0}));i(e&&m.current(e)?$x.HELD:$x.NONE);return}for(let e=1;;e+=1){let{rows:t,totalPages:r}=qle(await n(a,{contextualParameters:o,queryParameters:{page:e,limit:Wle}},{silent:!0}));if(t.some(e=>m.current(e))){i($x.HELD);return}if(e>=r||t.length===0){i($x.NONE);return}}}catch(t){if(e.operation===K.READ&&Jle(t)){i($x.NONE);return}Ule.warn(`Could not read whether the organization holds this configuration`,{probe:e.key,organizationId:s,error:t}),i($x.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&&iS(e)},[f]),(0,Q.useEffect)(()=>{if(f)return a.on(xc.RESOURCE_OPERATION_EXECUTED,()=>iS(f),t=>t.resourceType===e.resourceType&&!er(t.operation??{operationIdentifier:t.operationIdentifier}))},[a,f,e.resourceType]),eS(h)}var Xle={key:`scim-unrevoked-token`,resourceType:gu.ORGANIZATION_SCIM_TOKENS,operation:K.LIST,matches:e=>e.isActive===!0};function Zle(e,t){return aS(Xle,e,t)}function oS(){return sS(void 0)}function sS(e){let t=(0,Q.useContext)(ah)?.permissions??null,n=Qp()?.currentOrganizationId??null,r=sg(),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 cS(){let e=sS(void 0),t=(0,Q.useRef)(e);return t.current=e,(0,Q.useCallback)(e=>Gm(e,t.current),[])}function lS(){let e=(0,Q.useContext)(ea)?.appConfig,t=e?.organizationRelationships,n=e?.organizationTypes,r=(0,Q.useContext)(ah)?.organizations,i=Qp()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>({organizationRelationships:t,organizationTypes:n,organizations:r,currentOrganizationId:i}),[t,n,r,i])}function uS(){let e=lS();return(0,Q.useMemo)(()=>pv(e),[e])}function Qle(){let e=lS();return(0,Q.useMemo)(()=>hv(e),[e])}function dS(){let e=(0,Q.useContext)(ah)?.organizations,t=Qp()?.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 $le(){let e=(0,Q.useContext)(ea)?.appConfig?.organizationTypes,t=dS();return(0,Q.useMemo)(()=>st(e,t),[e,t])}var eue={key:`sso-connection`,resourceType:gu.ORGANIZATION_SSO_CONNECTIONS,operation:K.LIST,matches:()=>!0},fS=e=>Array.isArray(e)&&e.length>0,pS=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},tue={key:`sso-policy`,resourceType:gu.ORGANIZATION_SSO_CONFIG,operation:K.READ,matches:e=>{let t=pS(e.enforcement),n=pS(e.domains),r=pS(e.emergencyAccess),i=pS(e.oauth2ProviderRestrictions);return t.requireSSO===!0||fS(n.verifiedDomains)||fS(n.ssoEnabledDomains)||fS(r.breakGlassAccounts)||fS(i.allowedProviders)||fS(i.blockedProviders)||i.requireEnterpriseSSOOnly===!0||fS(e.socialCredentialOverrides)}},nue={key:`siem-export-enabled`,resourceType:gu.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:K.READ,matches:e=>e.enabled===!0},rue={key:`webhook-config-configured`,resourceType:gu.ORGANIZATION_WEBHOOK_CONFIG,operation:K.READ,matches:e=>e.enabled===!0||fS(e.endpoints)},iue=e=>!1;function mS(){let e=Qx(),t=Qp(),n=oS(),r=(0,Q.useContext)(gh),i=r?.resolvedFeatures,a=r?.isFeatureOffered??iue,o=Bh(),s=!!r&&r.isLoading!==!0&&(t?.currentOrganizationId??null)===r.resolvedForOrganizationId,c=a(Ko.SINGLE_SIGN_ON),l=s&&!c,u=aS(eue,l,n),d=aS(tue,l,n),f=c||u||d,p=a(Ko.DIRECTORY_PROVISIONING),m=dS(),h=$le(),g=Zle(s&&_v({featureOffered:p,organizationTypeKnown:m!==void 0,organizationTypeDirectoryProvisioned:h}),n),_=(0,Q.useMemo)(()=>vv({featureOffered:p,organizationTypeDirectoryProvisioned:h,holdsUnrevokedToken:g}),[p,h,g]),v=a(Ko.SECURITY_EVENT_EXPORT),y=aS(nue,s&&!v,n),b=v||y,x=a(Ko.M2M_WEBHOOK_DELIVERY),S=aS(rue,s&&!x,n),C=x||S,w=uS(),T=Qle(),E=(0,Q.useContext)(ea)?.appConfig?.decisionInbox,D=Object.keys((0,Q.useContext)(ea)?.appConfig?.professionalQualificationKinds??{}).length>0,O=(0,Q.useMemo)(()=>Bv({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,[Sv]:D}}),[e?.activeMode,e?.availableModes,t?.allScopeValues,n,i?.features,o?.isEnabled,f,_,b,C,w,T,O,D])}function hS(e,t){return(e?.requiredCapabilities??[]).every(e=>!!t.runtimeCapabilities[e])&&Lm(e?.requiredRoles,t.effectiveRoles)}function gS(e,t){return e.flatMap(e=>hS(e.runtimeAvailability,t)?e.children?.length?[{...e,children:gS(e.children,t)}]:[e]:[])}function aue(e,t){return{...e,children:gS(e.children,t)}}function oue(e,t){if(!e?.length)return e;let n=[];for(let r of e)hS(r.runtimeAvailability,t)&&(r.contentKind===kc.NAVIGATION_LIST?n.push(aue(r,t)):n.push(r));return n}function sue(e,t){return _S(e,t)}function _S(e,t){return e?.length?e.filter(e=>hS(e.runtimeAvailability,t)):e}function cue(e,t){return _S(e,t)}function lue(e,t){return _S(e,t)}function uue(e,t){return _S(e,t)}function due(e,t){return _S(e,t)}function fue(e,t){return _S(e,t)}var vS=il.getLogger(),yS=new Set,bS=(0,Q.createContext)(null);function xS(){let{emit:e}=qo(),{resourceRelationshipDepth:t,getZoneDepth:n,getZoneState:r,contentAreaWidth:i}=Mx(),{navigationLayout:a,currentBreakpoint:o,compositeViews:s,fullCustomViews:c,flowsActorsViews:l}=Ig(),{user:u}=ag(),d=Qp(),{registry:f,getOperationContextNeeds:p}=pm(),m=oh(),h=cS(),g=(0,Q.useRef)(0),_=og(),v=(0,Q.useRef)(Um.buildBrowserUrl(_.pathname,_.search));v.current=Um.buildBrowserUrl(_.pathname,_.search);let y=Ix(),b=(0,Q.useCallback)((t=so.PRIMARY)=>{if(r(t).stack.length===0)return;if(t===Vn.OVERLAY){e(xc.NAVIGATION_POP,{zone:t});return}let n=Um.resolveGoBackTarget({zone:t,currentBrowserUrl:v.current,getZoneState:r});n&&(e(xc.NAVIGATION_POP,{zone:t}),n.browserUrl&&Bx(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(Rx(`navigate() called`,{contentType:_.contentType,sourceZone:x.sourceZone,urlPath:S}),_.contentType===va.SETTINGS_HUB){m(S??Pa.settings);return}if(!a){Rx(`navigate() aborted: no navigationLayout`);return}let t=nm.extractPrimaryScopeFromContent(_,f,s,c,l),D=nm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId}),O=nm.primaryScopeToContextIdentifiers(D,t),k=d?.buildContextResourceIdentifiers()??{},A=Um.isResourceOperationContent(_)?_.resourceContext.contextResourceIdentifiers??{}:{},j={...O,...k,...A,...C},M={};for(let[e,t]of Object.entries(j)){let n=En.getResourceId(t);if(n){M[e]=n;let r=En.getFieldIdentifier(t);r&&(M[r]=n)}}let N=!1,P=Vx(_),F=P.operationSurface,I,L,ee=_;if(Um.isResourceOperationContent(_)){let e=_.resourceContext.operation;if(F===Jr.API_ONLY){vS.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=Nse({initiatorInfos:e.initiatorInfos,targetResourceType:t,registry:f,ownIdentifiers:{...A,...C},tenancyIdentifiers:O,parentResourcesRequirements:_.resourceContext.parentResourcesRequirements}),i=Um.resolveResourceUrl(r,e,M,f.allResourceFieldIdentifiers,n??_.resourceContext.parentResourcesRequirements,n!==void 0);i&&(i.templateUrl,I=i.routePathParameters,L=i.resolvedUrl)}N=zx(e)&&!!(L??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){Rx(`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];ee={..._,resourceContext:{..._.resourceContext,contextResourceIdentifiers:{...a,...C,...o?{[t]:o}:{},..._.resourceContext.contextResourceIdentifiers}}}}else if(_.contentType===va.COMPOSITE_VIEW||_.contentType===va.CHART_VIEW||_.contentType===va.FULL_CUSTOM_VIEW||_.contentType===va.EXECUTION_VIEW||_.contentType===va.FLOWS_ACTORS_VIEW){let e={..._.contextResourceIdentifiers??{},...C};ee={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}else if(_.contentType===va.CUSTOM_COMPONENT){let e={...O,...k,..._.contextResourceIdentifiers??{},...C};ee={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}x.sourceZone===`appLevel`&&(Yh(e,`app_level_navigation`),Rx(`APP_LEVEL clean break: cleared SECONDARY + COMPANION + OVERLAY`)),Um.isResourceOperationContent(ee)&&Um.calculateResourceRelationshipDepth(ee.resourceContext.parentResourcesRequirements);let R={},z={};for(let e of dd){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!==Vn.OVERLAY?te:void 0,oe={sourceZone:te,...P,relationshipTransition:w,relationshipMaxDepth:T,viewport:o,contentAreaWidth:i,zoneOccupancy:R,zoneDepth:z,focusedZone:ae},se=bh.resolve(oe,a),ce=se.provenance.adjustments.includes(Ea.PERSISTENT_SPLIT_ESCALATED_NO_COMPANION);if(ce||se.provenance.adjustments.includes(Ea.SPLIT_ESCALATED_NO_ADJACENT_ZONE)){let e=`${ie??`view`}:${ne}`;yS.has(e)||(yS.add(e),vS.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(Rx(`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===Ka.INPLACE){let e=Um.isResourceOperationContent(ee)?pue(ee,re):void 0;if(e&&y.isAvailable){Rx(`INPLACE resolved to the element-level host`,{kind:e.kind}),y.open(e);return}Rx(`INPLACE has no element-level host here — degrading to overlay`,{hasTarget:!!e,hostAvailable:y.isAvailable}),se=bh.degradeInPlaceToOverlay(oe,a,se)}se.transition===Ka.PROMOTE&&(Yh(e,`promote_navigation`),Rx(`PROMOTE clean break: cleared SECONDARY + COMPANION + OVERLAY`)),x.sourceZone===Vn.OVERLAY&&se.targetZone!==Vn.OVERLAY&&se.transition!==Ka.PROMOTE&&(jse(e,`overlay_breakout_navigation`),Rx(`OVERLAY breakout: closed the overlay it was launched from`,{targetZone:se.targetZone,transition:se.transition})),(se.targetZone===so.SECONDARY||se.targetZone===so.COMPANION)&&Um.isResourceOperationContent(ee)&&qx(ee,se.targetZone,f,M,e,m,r,{viewerMayPerform:h});let le=Um.generateStackEntryId(),ue=L??S,de=se.targetZone!==Vn.OVERLAY,fe=ee.contentType===va.EXECUTION_VIEW&&Op({viewRef:ee.viewRef,registry:f})?.isAddressable===!0,pe=ee.contentType===va.COMPOSITE_VIEW||ee.contentType===va.CHART_VIEW||ee.contentType===va.FULL_CUSTOM_VIEW||fe||ee.contentType===va.FLOWS_ACTORS_VIEW||ee.contentType===va.ENGINE_PAGE,me=de&&!!ue&&(N||pe),he=me?ee.contentType===va.COMPOSITE_VIEW?Ap(ee.viewRef,ee.contextResourceIdentifiers):ee.contentType===va.CHART_VIEW?Hp(ee.viewRef,ee.contextResourceIdentifiers,ee.urlParamValues):ee.contentType===va.EXECUTION_VIEW?Rp(ee.viewRef,ee.contextResourceIdentifiers):ue:void 0,ge=Um.getTopEntry(r(so.PRIMARY)),_e=se.targetZone===so.SECONDARY&&me&&he!==void 0&&Um.hostedPaneApplies({paneContent:ee,primaryTop:ge}),ve={zone:se.targetZone,content:ee,urlPath:he,stackEntryId:le,initiator:x,navigationSource:Ht.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===Vn.OVERLAY&&x.sourceZone===Vn.OVERLAY,B=se.transition===Ka.PUSH||ye,be=de?r(se.targetZone):void 0,xe=be&&be.activeTabId===void 0?be.stack[be.stack.length-2]:void 0;if(se.transition===Ka.PUSH&&he!==void 0&&xe?.urlPath&&Um.urlsAddressSameDestination(xe.urlPath,he)){Rx(`PUSH names the entry beneath — going back instead`,{zone:se.targetZone,finalUrlPath:he}),b(se.targetZone);return}Rx(`Emitting navigation event`,{event:B?`PUSH`:`REPLACE`,zone:se.targetZone,finalUrlPath:he,hostedPane:_e,stacksOnOverlay:ye}),zh(()=>{if(e(B?xc.NAVIGATION_PUSH:xc.NAVIGATION_REPLACE,ve),me&&he){let e=E===!0||se.transition===Ka.REPLACE||se.transition===Ka.PROMOTE,t=_e||se.targetZone===so.COMPANION?Um.resolveBrowserUrlForZoneEntry({zone:se.targetZone,entryUrlPath:he,paneContent:ee,currentBrowserUrl:v.current,getZoneState:r})??he:he;Bx(m,t,e)}},{zone:se.targetZone})}catch(e){vS.error(`useNavigationController navigation failed`,{error:e,requestId:n,sourceZone:x.sourceZone,contentType:_.contentType,urlPath:S,resourceType:Um.isResourceOperationContent(_)?_.resourceContext.resourceType:void 0,operationIdentifier:Um.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:va.RESOURCE_OPERATION,resourceContext:e};x({content:i,initiator:t,urlPath:n,relationshipTransition:r})},[x]),C=(0,Q.useCallback)(()=>{let t=Um.getTopEntry(r(Vn.OVERLAY));t&&e(xc.NAVIGATION_CLOSE,{zone:Vn.OVERLAY,stackEntryId:t.id})},[e,r]),w=(0,Q.useCallback)(t=>{if(t===so.PRIMARY||r(t).stack.length===0)return;let n=Um.resolveZoneDismissUrl({zone:t,currentBrowserUrl:v.current,getZoneState:r});e(xc.NAVIGATION_CLEAR_ZONE,{zone:t}),n&&Bx(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 pue(e,t){let n=e.resourceContext,r=n.operation;if(!r)return;if(t===K.CREATE||t===K.CREATE_MANY)return{kind:Nx.CREATE,operation:r,resourceContext:n};let i=En.getAddressedRecordId(n);return i?{kind:Nx.ELEMENT,elementId:i,operation:r,resourceContext:n}:void 0}function SS(){let e=(0,Q.useContext)(bS),t=xS();return e??t}function CS(){let{registry:e}=pm(),{navigateToResource:t}=SS(),n=(0,Q.useCallback)(n=>{let{resourceType:r,resourceId:i,contextResourceIdentifiers:a={},sourceZone:o=so.PRIMARY}=n;if(!i)return!1;let s=e.resourceConfigurations[r];if(!s)return!1;let c=En.buildRecordIdentifiersFromCollection(a,r,i),l=mue(s,e,c);return l?(t(En.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:l,contextResourceIdentifiers:c}),{sourceZone:o,sourceOperation:K.READ}),!0):!1},[e,t]);return(0,Q.useMemo)(()=>({navigateToResourceRead:n}),[n])}function mue(e,t,n){let r=r=>ph({resourceConfig:e,operations:e?.operations??[],coreOperation:K.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===Jr.EMBEDDED?a:void 0}function wS(e,t){let n=e.filterFields;return n&&Object.keys(n).length>0||bl(e)!==K.LIST?n:t.find(e=>String(e.operationIdentifier)===K.SEARCH&&e.isOperationDefault===!0)?.filterFields}function hue(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 gue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a,board:o}=t;if(i===vs.BOARD&&!o)return`displayMode BOARD requires collectionDisplayConfig.board: { groupByField } naming the enum field its columns come from`;if(!o)return;if(i!==vs.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=wS(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&&!hue(r,o.transitionOperation))return`board.transitionOperation ${JSON.stringify(o.transitionOperation)} names no operation this resource's frontend registry holds`}var _ue=[{mode:vs.CALENDAR,configKey:`calendar`,shape:`{ dateField }`,fields:e=>e.calendar?[[`calendar.dateField`,e.calendar.dateField]]:void 0},{mode:vs.TIMELINE,configKey:`timeline`,shape:`{ startField, endField }`,fields:e=>e.timeline?[[`timeline.startField`,e.timeline.startField],[`timeline.endField`,e.timeline.endField]]:void 0}];function vue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a}=t;for(let e of _ue){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===vs.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=wS(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 TS(e){return e?._zod?.def?.type===`object`}function ES(e,t){let n=t[ha]??{},r=e[ha]??{};return Object.fromEntries(Object.entries(n).filter(([e,t])=>r[e]!==t))}function DS(e,t){let n=ss(e,[]);return n[ha]={...n[ha]??{},...t},n}function OS(e,t,n,r={}){if(n===t)return e;if(!TS(e)||!TS(t)||!TS(n))return n;let i=tu(e),a=tu(t),o=tu(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=ES(n,t);Object.keys(o).length>0&&(s[e]=DS(r,o))}let c=Object.keys(s).length===0?e:el(e,s);if(r.objectLevel){let r=ES(t,n);if(Object.keys(r).length>0){if(c===e)c=DS(e,r);else{let e=c;e[ha]={...e[ha]??{},...r}}}}return c}function yue(e,t){try{let n=tu(e),r=tu(t);return Object.entries(n).some(([e,t])=>{let n=r[e];return n?t===n||Zt(t)===n:!1})}catch{return!1}}function kS(e,t,n){if(!e)return;let r=mr.getObjectLikeFieldShape(e,{commonOnly:!1}),i=mr.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=ts(r);if(Object.keys(a).length===0)continue;let o=ts(t);Object.keys(a).some(e=>!(e in o)||o[e]!==a[e])&&(t[ha]={...o,...a})}}var bue=[wl.IS_FOREIGN_KEY,wl.FOREIGN_KEY_UI];function xue(e,t){if(!e||!t)return e;let n=mr.getObjectLikeFieldShape(e,{commonOnly:!1}),r=mr.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||!Jc(n)||Jc(t)||Kt(t)===B.ARRAY!=(Kt(n)===B.ARRAY))continue;let a=ts(n),o={};for(let e of bue)e in a&&(o[e]=a[e]);let s=ss(t,[]);s[ha]={...ts(t),...o},i.set(t,s)}return i.size===0?e:Sue(e,i)}function Sue(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=$l(e,i);return r.delete(e),n.set(e,s),s};return i(e)}function Cue(e){let t=pae.get(e)?.[xn];return typeof t==`string`?t:void 0}function wue(e,t,n){let r=new Map,i=new Map,a=new Map,o=(e,t)=>{let s=Cue(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=$l(e,e=>o(e,s));return d.delete(e),l.set(e,f),f};return o(e,t)}function AS(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))AS(e[r],t[r],n);return}for(let e of[`innerType`,`element`,`valueType`,`in`,`out`])AS(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)=>AS(e,o[t],n))}function jS(e,t){if(e===void 0)return;let n=!1,r=e.inheritedSchemas.map(e=>{let r=t(e.schema),i=jS(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 MS(e,t,n){for(let t of Object.values(tu(e)??{}))n.add(t);for(let e of t?.inheritedSchemas??[])MS(e.schema,e.inheritenceSchemaDefinition,n)}function Tue(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:jS(e,e=>r(e)?OS(e,t,n):e)}var NS=class{httpClient;registry=null;isInitialized=!1;declaredFieldInstancesByResource=new Map;presentationSubstitutionsByResource=new Map;resourcesHttpClient=null;constructor(e){this.httpClient=e}buildConfigurationError(e,t){let n=Ru.buildWildoError_Frontend(v.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,...Cl},s=[...n||[],...f],c=L_(s);if(c.length>0)throw this.buildConfigurationError(rs.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=Xl.ensureCompiledRelationships.call(Xl,s,o),u=[...r??[]].filter(e=>os.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=>!os.has(e))):r,p={};e&&Object.keys(e).length>0&&Object.entries(e).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(p[e]=t(l))});let m={};ls&&Object.keys(ls).length>0&&Object.entries(ls).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(m[e]=t(l))});let h={...m,...p};if(d&&d.size>0){h=Object.fromEntries(Object.entries(h).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(h,o);let g=this.buildFrontendResourceConfigurations(h,o,i);Zr(g,l,o),Ns.rebuildResourceConfigurationsOperationDtos(g),this.overlayUiBehaviorDtoDecorators(g,i),this.substitutePresentationIntoCustomDtos(g),this.carryReferenceIdentityOntoCustomRequestDtos(g);let _=Xl.buildFieldIdentifierToResourceTypeMap({allResourceFieldIdentifiers:o,allResourceRelationships:l,getMainSchema:e=>g[e]?.mainSchema,fieldIdentifierPriority:Pre,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.`)}}),v=Xl.buildManyToManyScopeJunctionMap(l,o);this.registry={allResourceFieldIdentifiers:o,fieldIdentifierToResourceType:_,manyToManyScopeJunctions:v,notificationBadgeDefinitions:[...N_,...a??[]],additionalUserNotificationDefinitions:[],resourceRelationships:l,resourceConfigurations:g,subtreeMap:B_(l)},this.generateUrlsForApiCallOperations(g,o),this.resourcesHttpClient=new Ax(this.registry,{baseURL:this.httpClient.getBaseURL(),timeout:3e4,enableNetworkQueue:!0}),this.validateForeignKeyResolution(g,_),this.validateResourceOwnedViewRefUniqueness(g),this.validateFileDisplayPolicyCoherence(g),this.isInitialized=!0}catch(e){throw e?.wildoError?e:this.buildConfigurationError(rs.CONFIGURATION,{message:`Failed to initialize frontend resources: ${Vc(e)}`})}}normalizeResourceConfigurationRelationships(e,t){for(let n of Object.values(e))n.resourceRelationships={parentRelationships:Xl.ensureCompiledRelationships.call(Xl,n.resourceRelationships.parentRelationships,t),childRelationships:Xl.ensureCompiledRelationships.call(Xl,n.resourceRelationships.childRelationships,t),selfRelationships:Xl.ensureCompiledRelationships.call(Xl,n.resourceRelationships.selfRelationships,t)}}carryReferenceIdentityOntoCustomRequestDtos(e){for(let t of Object.values(e))for(let e of t.operations??[])e.hasCustomRequestDto&&(e.requestDto=xue(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;AS(r,n.mainSchema,o);let s=(e,t)=>{e?.inheritedSchemas.forEach((e,n)=>{let r=t?.inheritedSchemas[n];AS(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]=wue(i,t,this.presentationSubstitutionsByResource))}}}overlayUiBehaviorDtoDecorators(e,t){if(t)for(let[n,r]of Object.entries(t)){let t=r[Fu];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||(kS(e.responseDto,t,i),kS(e.contextDto,t,i)),e.hasCustomRequestDto||kS(e.requestDto,t,i),kS(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===E.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[Fu],d=new Set;if(MS(n.mainSchema,n.inheritenceSchemaDefinition,d),this.declaredFieldInstancesByResource.set(e,d),u&&u!==n.mainSchema){let t=n.mainSchema,r=OS(t,i[Oe]??t,u,{objectLevel:!0});if(this.presentSchemas(e,n,{mainSchema:r,inheritenceSchemaDefinition:Tue(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===K.CREATE||n===K.UPDATE)&&!e.hasCustomRequestDto&&yue(e.requestDto,t)&&(e.requestDto=qe(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??Sr.ORGANIZATIONS,s),p=this.buildResourceExecutionViewDefinitions(n.resourcePrimaryScope??Sr.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?Jr.EMBEDDED:Jr.API_ONLY)};continue}if(n.operationFrontendConfig.surface===Jr.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=gue({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(r)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${r}.`);let i=vue({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:mp(e,n),scope:tm.RESOURCE,isAddressable:!0,operationLike:r.operationLike??K.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:tm.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!==yee.STANDALONE);e.length>0&&(n.length=0,n.push(...e))}if(i.foreignKeyField&&n.length>0){let e=n.filter(({rel:e})=>Xl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier===i.foreignKeyField);n.length=0,n.push(...e)}if(n.length===0){if(bi.isDevelopment()){let n=[...t.childRelationships.map(e=>`${e.resourceType2} (FK: ${Xl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.parentRelationships.map(e=>`${e.resourceType1} (FK: ${Xl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.selfRelationships.map(e=>`${e.resourceType1} (FK: ${Xl.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(bi.isDevelopment()){let t=n.map(({rel:e})=>Xl.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&&bi.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&&=Yn.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=Xl.tryResolveRelationshipForeignKeyIdentity(r,n)?.fieldIdentifier;if(!i)continue;let a=r.display?.inChildView?.parentDisplay??Rt.CONTEXT,o,s;switch(a){case Rt.CONTEXT:o=hc.LABEL,s=!0;break;case Rt.BREADCRUMB:o=hc.LABEL,s=!1;break;case Rt.BADGE:o=hc.LABEL,s=!1;break;case Rt.SUMMARY:o=hc.SUMMARY,s=!0;break;case Rt.NONE:o=hc.ID,s=!1;break;default:o=hc.LABEL,s=!0}let c={display:{mode:o,linkable:s}},l=e=>{let t=tu(e)?.[i];if(!t||!Jc(t)||ts(t)[wl.FOREIGN_KEY_UI]!==void 0)return e;let n=ss(t,[{ref:wl.FOREIGN_KEY_UI,params:c}]);return el(e,{[i]:n})};this.presentSchemas(e,t,{mainSchema:l(t.mainSchema),inheritenceSchemaDefinition:jS(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(rs.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{za.updateOperationUrls(r,t)}catch(e){console.error(`Failed to generate URLs for resource type ${n}:`,e)}}getResourcesRegistry(){if(!this.isInitialized)throw this.buildConfigurationError(rs.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(rs.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesHttpClient`});return this.resourcesHttpClient}getApplicationHttpClient(){return this.httpClient}validateForeignKeyResolution(e,t){let n=Xl.collectUnresolvableForeignKeyFields({mainSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.mainSchema])),variantSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,pl(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),bi.isDevelopment())throw this.buildConfigurationError(rs.FRONTEND_FK_RESOLUTION_FAILED,{unresolvedFKFields:n,message:t})}}validateFileDisplayPolicyCoherence(e){let t=[];for(let[n,r]of Object.entries(e)){let e=[r.mainSchema,...pl(r.inheritenceSchemaDefinition)].flatMap(e=>Object.entries(tu(e)??{})),i=new Set;for(let[r,a]of e){if(i.has(r))continue;let e=a,o=Zu(e);if(!o?.nature)continue;let s=wu(e);if(!s)continue;let c=s.presentation!==void 0&&s.presentation!==tt.CARD,l=s.activation?.policy===Ou.OVERLAY;(c||l)&&ore(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),bi.isDevelopment())throw this.buildConfigurationError(rs.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 Rh({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(rs.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 PS(e){return wi.createOperationPathKeyFromOperation(e)}function FS(e){let t=e?.requiredFeatures;return t?Array.isArray(t)||!t.appliesWhen:!1}function IS(e){return!!(e.enabledCondition||e.requiredFeatures)}function LS(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 RS(e){let{operation:t,currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0}=e,{getResourcesRegistry:s,doOperation:c}=pm(),{user:l,permissions:u}=ag(),d=Qp(),f=Bh(),p=s(),{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,isLoading:v}=yh(),y=(0,Q.useMemo)(()=>$p(t),[t]),b=LS(l?._id,d?.primaryScopeValues?.organizationId,d?.primaryScopeValues?.applicationId),x=(0,Q.useMemo)(()=>{if(v)return FS(t)?{isAvailable:!1,behavior:Qs.DISABLE}:void 0;let e=jh(u,d?.currentOrganizationId??null);return qh(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)(()=>!IS(t)),[w,T]=(0,Q.useState)(()=>IS(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),Sm({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 Eue(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 zS(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(`,`)||!Eue(r.featureAvailability,e.featureAvailability))return!1}return!0}function BS(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}=pm(),{user:f,permissions:p}=ag(),m=Qp(),h=Bh(),g=u(),{resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,isLoading:x}=yh(),S=LS(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(PS(e),{isEnabled:!0})}),w(e=>zS(e,t)?e:t);return}if(!e.length||!a){w(e=>e.size===0?e:new Map);return}let t=!1,c=jh(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=PS(e),c=x?FS(e)?{isAvailable:!1,behavior:Qs.DISABLE}:void 0:qh(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($p(e).needsUserContext&&!f)o.set(t,{isEnabled:!1,featureAvailability:c});else try{let u=t=>Sm({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:Tee(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=>zS(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 VS(e,t,n){let r=e(t,n,`title`);return r&&!r.startsWith(`resources.`)?r:n}function Due(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=za.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let i=En.selectMatchingRoutePath(e,a,n.resourceIdentifier,n.resourceFieldIdentifier,s,t.allResourceFieldIdentifiers),f=Um.resolveUrlPath(i.url,o);if(Um.hasUnresolvedPlaceholders(f))return null;let p=new URLSearchParams;p.set(pee,l),p.set(Lr,u);for(let[e,t]of Object.entries(d??{}))t!==void 0&&t!==``&&e!==`format`&&e!==`rowScope`&&HS(p,e,t);return`${c}${yn}${f}?${p.toString()}`}catch{return null}}function HS(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))HS(e,`${t}[${r}]`,i);else e.append(t,String(n))}}async function Oue(e){Fy(await e.getBlob(e.url),Nee(String(e.resourceType),e.format,new Date))}function US(e,t){if(!e)return[];let n=mr.getObjectLikeFieldShape(e,{commonOnly:!1});if(!n)return[];let r=[];for(let[e,i]of Object.entries(n))Xne(i)&&t[e]&&r.push({fieldName:e,value:t[e],schema:i});return r}var WS;(function(e){e.PANEL=`panel`,e.LIST=`list`})(WS||={});function GS(e){return e.type===`separator`?!1:e.type===`subgroup`?e.disabled===!0:e.disabled===!0||e.unavailability!==void 0}function KS(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=>!GS(e)),...i.filter(GS)].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=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_ACTION_BAR,`ActionBar`)(e);return(0,$.jsx)(n,{...t})}var JS=(0,Q.createContext)(!1);function YS({children:e}){return(0,$.jsx)(JS.Provider,{value:!0,children:e})}function XS(){return(0,Q.useContext)(JS)}function ZS(e,t,n,r){return V.buildConfigurationError(rs.CONFIGURATION,{component:e,message:`${e}() requires a ${t}-like operation host, but received "${n}" for operation "${r}".`,expectedKind:t,actualKind:n,operationIdentifier:r})}function QS(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function $S(e,t,n){if(!n)return e;let r=e[t];if(En.getResourceId(r)===n)return e;let i=r?En.getFieldIdentifier(r):void 0;return{...e,[t]:i?{fieldIdentifier:i,resourceId:n}:n}}function eC({resourceContext:e,navigationZone:t,navigationInitiator:n,updateLikeMutationFallbackMode:r}){let{registry:i,doOperation:a}=pm(),{navigateToResource:o,goBack:s}=SS(),{handleError:c}=tp(),{resourceType:l,operation:u}=e,d=r??Ja(u,i.resourceConfigurations[l]?.operations),f=String(u.operationIdentifier),p=(0,Q.useMemo)(()=>i.resourceConfigurations[l],[i,l]),m=(0,Q.useMemo)(()=>bl(u),[u]),h=(0,Q.useMemo)(()=>xie(u),[u]),g=(0,Q.useMemo)(()=>Um.createOperationInitiator(t,u),[t,u]),_=(0,Q.useMemo)(()=>QS(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)(()=>$S(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=>!!En.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(rl(u)&&!Rn(d))throw new Qn({surfaceName:`useResourceOperationSurface.executeCurrentOperation()`,resourceType:l,operationIdentifier:f});let t=wi.createOperationPathKeyFromOperation(u),n=uc({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===K.READ||e===K.UPDATE||e===K.DELETE?ph({resourceConfig:p,operations:p.operations??[],coreOperation:e,registry:i,hasResourceId:S(y),allowBulk:t?.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:y,contextualParameters:x}):Kl(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=$S(t,l,v),c=V.buildContextualParameters(s,i);if(Pm({operation:e,resourceType:l,resourceConfig:p})&&e.isBulkOperation!==!0&&!Uh({resourceConfig:p,operation:e,registry:i,hasResourceId:S(s),contextResourceIdentifiers:s,contextualParameters:c}))return!1;let u=En.createFrontendResourceOperationContextFromOperation({resourceType:l,operation:e,contextResourceIdentifiers:s,parentResourcesRequirements:n}),d=za.buildOperationFrontendRoutePaths(p,e,i.allResourceFieldIdentifiers),f=d.length>0?En.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=$S(e?.contextResourceIdentifiers??b.contextResourceIdentifiers,l,v),n=e?.parentResourcesRequirements??b.parentResourcesRequirements,r=V.buildContextualParameters(t,i),a=ph({resourceConfig:p,operations:p.operations??[],coreOperation:K.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 tC(e,t,n){let r=eC(e),i=Ls(r.operation);if(i!==t)throw ZS(n,t,i,r.operationId);return r}function kue(e){return tC(e,`read`,`useReadOperationSurface`)}function Aue(e){return tC(e,`list`,`useListOperationSurface`)}function jue(e){return tC(e,`create`,`useCreateOperationSurface`)}function Mue(e){return tC(e,`update`,`useUpdateOperationSurface`)}function Nue(e){return tC(e,`search`,`useSearchOperationSurface`)}function Pue(e){return tC(e,`action`,`useActionOperationSurface`)}var nC=(0,Q.createContext)(null);function rC(){let e=(0,Q.useContext)(nC);if(!e)throw Error(`useResourceOperationViewContext() must be used within a <ResourceOperationViewProvider>. This is provided automatically for routed resource operation layouts.`);return e}function iC(){return(0,Q.useContext)(nC)}function aC({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i}){let a=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),o=(0,Q.useMemo)(()=>({...a,inlineParentContext:r}),[r,a]);return(0,$.jsx)(nC.Provider,{value:o,children:i})}var oC=e(Ute(),1),sC=e=>e.type===`checkbox`,cC=e=>e instanceof Date,lC=e=>e==null,uC=e=>typeof e==`object`,dC=e=>!lC(e)&&!Array.isArray(e)&&uC(e)&&!cC(e),fC=e=>dC(e)&&e.target?sC(e.target)?e.target.checked:e.target.value:e,Fue=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,pC=(e,t)=>e.has(Fue(t)),Iue=e=>{let t=e.constructor&&e.constructor.prototype;return dC(t)&&t.hasOwnProperty(`isPrototypeOf`)},mC=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function hC(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(mC&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(dC(e)&&Iue(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=hC(e[t]));return r}var gC=e=>/^\w*$/.test(e),_C=e=>e===void 0,vC=e=>Array.isArray(e)?e.filter(Boolean):[],yC=e=>vC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),bC=(e,t,n)=>{if(!t||!dC(e))return n;let r=(gC(t)?[t]:yC(t)).reduce((e,t)=>lC(e)?e:e[t],e);return _C(r)||r===e?_C(e[t])?n:e[t]:r},xC=e=>typeof e==`boolean`,SC=e=>typeof e==`function`,CC=(e,t,n)=>{let r=-1,i=gC(t)?[t]:yC(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=dC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},wC={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},TC={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},EC={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},DC=Q.createContext(null);DC.displayName=`HookFormControlContext`;var OC=()=>Q.useContext(DC),kC=(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]!==TC.all&&(t._proxyFormState[i]=!r||TC.all),n&&(n[i]=!0),e[i]}});return i},AC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function jC(e){let t=OC(),{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 AC(()=>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(()=>kC(o,n,c.current,!1),[o,n])}var MC=e=>typeof e==`string`,NC=(e,t,n,r,i)=>MC(e)?(r&&t.watch.add(e),bC(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),bC(n,e))):(r&&(t.watchAll=!0),n),PC=e=>lC(e)||!uC(e);function FC(e,t,n=new WeakSet){if(PC(e)||PC(t))return Object.is(e,t);if(cC(e)&&cC(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(cC(r)&&cC(e)||dC(r)&&dC(e)||Array.isArray(r)&&Array.isArray(e)?!FC(r,e,n):!Object.is(r,e))return!1}}return!0}function IC(e){let t=OC(),{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=NC(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=NC(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);FC(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);AC(()=>(d.current===n&&FC(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=!_&&!FC(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function LC(e){let t=OC(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=pC(i._names.array,n),l=IC({control:i,name:n,defaultValue:Q.useMemo(()=>bC(i._formValues,n,bC(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=jC({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,...xC(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!bC(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!bC(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!bC(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!bC(u.validatingFields,n)},error:{enumerable:!0,get:()=>bC(u.errors,n)}}),[u,n]),h=Q.useCallback(e=>p.current.onChange({target:{value:fC(e),name:n},type:wC.CHANGE}),[n]),g=Q.useCallback(()=>p.current.onBlur({target:{value:bC(i._formValues,n),name:n},type:wC.BLUR}),[n,i._formValues]),_=Q.useCallback(e=>{let t=bC(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>SC(e.focus)&&e.focus(),select:()=>SC(e.select)&&e.select(),setCustomValidity:t=>SC(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>SC(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),v=Q.useMemo(()=>({name:n,value:l,...xC(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,...xC(d.current.disabled)?{disabled:d.current.disabled}:{}});let r=(e,t)=>{let n=bC(i._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){let e=hC(bC(i._options.defaultValues,n,d.current.defaultValue));CC(i._defaultValues,n,e),_C(bC(i._formValues,n))&&CC(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 RC=e=>e.render(LC(e)),zC=Q.createContext(null);zC.displayName=`HookFormContext`;var BC=()=>Q.useContext(zC),VC=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(zC.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(DC.Provider,{value:m},t))},HC=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},UC=e=>Array.isArray(e)?e:[e],WC=()=>{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 GC(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&dC(i)&&a){let e=GC(i,a);dC(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var KC=e=>dC(e)&&!Object.keys(e).length,qC=e=>e.type===`file`,JC=e=>{if(!mC)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},YC=e=>e.type===`select-multiple`,XC=e=>e.type===`radio`,Lue=e=>XC(e)||sC(e),ZC=e=>JC(e)&&e.isConnected;function Rue(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=_C(e)?r++:e[t[r++]];return e}function zue(e){for(let t in e)if(e.hasOwnProperty(t)&&!_C(e[t]))return!1;return!0}function QC(e,t){let n=Array.isArray(t)?t:gC(t)?[t]:yC(t),r=n.length===1?e:Rue(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(dC(r)&&KC(r)||Array.isArray(r)&&zue(r))&&QC(e,n.slice(0,-1)),e}var Bue=e=>{for(let t in e)if(SC(e[t]))return!0;return!1};function $C(e){return Array.isArray(e)||dC(e)&&!Bue(e)}function ew(e,t={}){for(let n in e){let r=e[n];$C(r)?(t[n]=Array.isArray(r)?[]:{},ew(r,t[n])):_C(r)||(t[n]=!0)}return t}function tw(e,t,n){n||=ew(t);for(let r in e){let i=e[r];if($C(i))_C(t)||PC(n[r])?n[r]=ew(i,Array.isArray(i)?[]:{}):tw(i,lC(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!FC(i,e)}}return n}var nw={value:!1,isValid:!1},rw={value:!0,isValid:!0},iw=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&&!_C(e[0].attributes.value)?_C(e[0].value)||e[0].value===``?rw:{value:e[0].value,isValid:!0}:rw:nw}return nw},aw=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>_C(e)?e:t?e===``?NaN:e&&+e:n&&MC(e)?new Date(e):r?r(e):e,ow={isValid:!1,value:null},sw=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ow):ow;function cw(e){let t=e.ref;return qC(t)?t.files:XC(t)?sw(e.refs).value:YC(t)?[...t.selectedOptions].map(({value:e})=>e):sC(t)?iw(e.refs).value:aw(_C(t.value)?e.ref.value:t.value,e)}var Vue=(e,t,n,r)=>{let i={};for(let n of e){let e=bC(t,n);e&&CC(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},lw=e=>e instanceof RegExp,uw=e=>_C(e)?e:lw(e)?e.source:dC(e)?lw(e.value)?e.value.source:e.value:e,dw=e=>({isOnSubmit:!e||e===TC.onSubmit,isOnBlur:e===TC.onBlur,isOnChange:e===TC.onChange,isOnAll:e===TC.all,isOnTouch:e===TC.onTouched}),fw=`AsyncFunction`,Hue=e=>!!e&&!!e.validate&&!!(SC(e.validate)&&e.validate.constructor.name===fw||dC(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===fw)),Uue=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),pw=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),mw=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=bC(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(mw(a,t))break}else if(dC(a)&&mw(a,t))break}}};function hw(e,t,n){let r=bC(e,n);if(r||gC(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=bC(t,r),o=bC(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 Wue=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return KC(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||TC.all))},Gue=(e,t,n)=>!e||!t||e===t||UC(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),Kue=(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,que=(e,t)=>!vC(bC(e,t)).length&&QC(e,t),gw=(e,t,n)=>{let r=UC(bC(e,n));return CC(r,`root`,t[n]),CC(e,n,r),e};function _w(e,t,n=`validate`){if(MC(e)||Array.isArray(e)&&e.every(MC)||xC(e)&&!e)return{type:n,message:MC(e)?e:``,ref:t}}var vw=e=>dC(e)&&!lw(e)?e:{value:e,message:``},yw=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=bC(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(xC(e)?``:e||``),y.reportValidity())},x={},S=XC(o),C=sC(o),w=S||C,T=(g||qC(o))&&_C(o.value)&&_C(v)||JC(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=HC.bind(null,h,r,x),D=(e,t,n,r=EC.maxLength,i=EC.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||lC(v))||xC(v)&&!v||C&&!iw(s).isValid||S&&!sw(s).isValid)){let{value:e,message:t}=MC(c)?{value:!!c,message:c}:vw(c);if(e&&(x[h]={type:EC.required,message:t,ref:y,...E(EC.required,t)},!r))return b(t),x}if(!T&&(!lC(d)||!lC(f))){let e,t,n=vw(f),i=vw(d);if(!lC(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;lC(n.value)||(e=r>n.value),lC(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`;MC(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),MC(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,EC.max,EC.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(MC(v)||a&&Array.isArray(v))){let e=vw(l),t=vw(u),n=!lC(e.value)&&v.length>+e.value,i=!lC(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&&MC(v)){let{value:e,message:t}=vw(p);if(lw(e)&&!v.match(e)&&(x[h]={type:EC.pattern,message:t,ref:o,...E(EC.pattern,t)},!r))return b(t),x}if(m){if(SC(m)){let e=_w(await m(v,n),y);if(e&&(x[h]={...e,...E(EC.validate,e.message)},!r))return b(e.message),x}else if(dC(m)){let e={};for(let t in m){if(!KC(e)&&!r)break;let i=_w(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!KC(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},Jue={mode:TC.onSubmit,reValidateMode:TC.onChange,shouldFocusError:!0};function Yue(e={}){let t={...Jue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:SC(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(dC(t.defaultValues)||dC(t.values))&&hC(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:hC(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:WC(),state:WC()},m=t.criteriaMode===TC.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=KC((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?CC(n.validatingFields,e,r):QC(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!KC(n.validatingFields)}))},v=(e,s=[],c,l,u=!0,m=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,m&&Array.isArray(bC(r,e))){let t=c(bC(r,e),l.argA,l.argB);u&&CC(r,e,t)}if(m&&Array.isArray(bC(n.errors,e))){let t=c(bC(n.errors,e),l.argA,l.argB);u&&CC(n.errors,e,t),que(n.errors,e)}if((d.touchedFields||f.touchedFields)&&m&&Array.isArray(bC(n.touchedFields,e))){let t=c(bC(n.touchedFields,e),l.argA,l.argB);u&&CC(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=tw(i,a)),p.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else CC(a,e,s)},y=(e,t)=>{CC(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=bC(r,e);if(c){let r=bC(a,e,_C(n)?bC(i,e):n);_C(r)||s&&s.defaultChecked||t?CC(a,e,t?r:cw(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=FC(bC(i,e),r);l=!!bC(n.dirtyFields,e),t?QC(n.dirtyFields,e):CC(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=bC(n.touchedFields,e);t||(CC(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=bC(n.errors,e),s=(d.isValid||f.isValid)&&xC(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?CC(n.errors,e,i):QC(n.errors,e)),(i?!FC(o,i):o)||!KC(a)||s){let t={...a,...s&&xC(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,Vue(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=bC(t,r);e?CC(n.errors,r,e):QC(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&&Hue(l._f);u&&d.validatingFields&&_([r.name],!0);let f=await yw(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&&(bC(f,r.name)?c?gw(n.errors,f,r.name):CC(n.errors,r.name,f[r.name]):QC(n.errors,r.name))}!KC(c)&&await E(c,i,o)}}return o.valid},D=()=>{for(let e of s.unMount){let t=bC(r,e);t&&(t._f.refs?t._f.refs.every(e=>!ZC(e)):!ZC(t._f.ref))&&ie(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&CC(a,e,n),!FC(L(),i)),k=(e,t,n)=>NC(e,s,{...o.mount?a:_C(t)?i:MC(e)?{[e]:t}:t},n,t),A=e=>vC(bC(o.mount?a:i,e,t.shouldUnregister?bC(i,e,[]):[])),j=(e,t,n={})=>{let i=bC(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&CC(a,e,aw(t,n)),o=JC(n.ref)&&lC(t)?``:t,YC(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?sC(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):qC(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:hC(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=bC(r,o);(s.array.has(e)||dC(a)||c&&!c._f)&&!cC(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=bC(r,e),u=s.array.has(e),m=hC(t);CC(a,e,m),u?(p.array.next({name:e,values:hC(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&p.state.next({name:e,dirtyFields:tw(i,a),isDirty:O(e,m)})):l&&!l._f&&!lC(m)?M(e,m,c):j(e,m,c),pw(e,s)?p.state.next({...n,name:e,values:hC(a)}):p.state.next({name:o.mount?e:void 0,values:hC(a)})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,u=!0,h=bC(r,l),v=e=>{u=Number.isNaN(e)||cC(e)&&isNaN(e.getTime())||FC(e,bC(a,l,e))},y=dw(t.mode),b=dw(t.reValidateMode);if(h){let o,x,T=i.type?cw(h._f):fC(e),D=e.type===wC.BLUR||e.type===wC.FOCUS_OUT,O=!Uue(h._f)&&!t.resolver&&!bC(n.errors,l)&&!h._f.deps||Kue(D,bC(n.touchedFields,l),n.isSubmitted,b,y),k=pw(l,s,D);CC(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=!KC(A)||k;if(!D&&p.state.next({name:l,type:e.type,values:hC(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=hw(n.errors,r,l),i=hw(e,r,t.name||l);o=i.error,l=i.name,x=KC(e)}}else _([l],!0),o=(await yw(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(bC(n.errors,t)&&e.focus)return e.focus(),1},I=async(e,i={})=>{let a,o,c=UC(e);if(t.resolver){let t=await T(_C(e)?e:c);a=KC(t),o=e?!c.some(e=>bC(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=bC(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({...!MC(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&mw(r,F,e?c:s.mount),o},L=(e,t)=>{let r={...o.mount?a:i};return t&&(r=GC(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),_C(e)?r:MC(e)?bC(r,e):e.map(e=>bC(r,e))},ee=(e,t)=>({invalid:!!bC((t||n).errors,e),isDirty:!!bC((t||n).dirtyFields,e),error:bC((t||n).errors,e),isValidating:!!bC(n.validatingFields,e),isTouched:!!bC((t||n).touchedFields,e)}),R=e=>{let t=e?UC(e):void 0;t?.forEach(e=>QC(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=(bC(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=bC(n.errors,e)||{};CC(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)=>SC(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=>{Gue(e.name,t.name,e.exact)&&Wue(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?UC(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(QC(r,c),QC(a,c)),!o.keepError&&QC(n.errors,c),!o.keepDirty&&QC(n.dirtyFields,c),!o.keepTouched&&QC(n.touchedFields,c),!o.keepIsValidating&&QC(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&QC(i,c);p.state.next({values:hC(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},ae=({disabled:e,name:t})=>{if(xC(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=bC(r,e),c=xC(n.disabled)||xC(t.disabled);return CC(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?ae({disabled:xC(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:uw(n.min),max:uw(n.max),minLength:uw(n.minLength),maxLength:uw(n.maxLength),pattern:uw(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){oe(e,n),a=bC(r,e);let t=_C(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Lue(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;CC(r,e,{_f:{...a._f,...o?{refs:[...s.filter(ZC),t,...Array.isArray(bC(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=bC(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(pC(s.array,e)&&o.action)&&s.unMount.add(e)}}},se=()=>t.shouldFocusError&&mw(r,F,s.mount),ce=e=>{xC(e)&&(p.state.next({disabled:e}),mw(r,(t,n)=>{let i=bC(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=hC(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=hC(t)}else await E(r);if(s.disabled.size)for(let e of s.disabled)QC(l,e);if(QC(n.errors,`root`),KC(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:KC(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ue=(e,t={})=>{bC(r,e)&&(_C(t.defaultValue)?N(e,hC(bC(i,e))):(N(e,t.defaultValue),CC(i,e,hC(t.defaultValue))),t.keepTouched||QC(n.touchedFields,e),t.keepDirty||(QC(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,hC(bC(i,e))):O()),t.keepError||(QC(n.errors,e),d.isValid&&g()),p.state.next({...n}))},de=(e,c={})=>{let l=e?hC(e):i,u=hC(l),f=KC(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(tw(i,a))]);for(let t of Array.from(e)){let e=bC(n.dirtyFields,t),r=bC(a,t),i=bC(m,t);e&&!_C(r)?CC(m,t,r):!e&&!_C(i)&&N(t,i)}}else{if(mC&&_C(e))for(let e of s.mount){let t=bC(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(JC(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,bC(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?hC(i):{}:hC(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&&!KC(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||FC(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?tw(i,a):n.dirtyFields:c.keepDefaultValues&&e?tw(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(SC(e)?e(a):e,{...t.resetOptions,...n}),pe=(e,t={})=>{let n=bC(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&SC(e.select)&&e.select()})}},me=e=>{n={...n,...e}},he={control:{register:oe,unregister:ie,getFieldState:ee,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:()=>SC(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:L,reset:fe,resetField:ue,clearErrors:R,unregister:ie,setError:z,setFocus:pe,getFieldState:ee};return{...he,formControl:he}}var bw=()=>{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)})},xw=(e,t,n={})=>n.shouldFocus||_C(n.shouldFocus)?n.focusName||`${e}.${_C(n.focusIndex)?t:n.focusIndex}.`:``,Sw=(e,t)=>[...e,...UC(t)],Cw=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function ww(e,t,n){return[...e.slice(0,t),...UC(n),...e.slice(t)]}var Tw=(e,t,n)=>Array.isArray(e)?(_C(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Ew=(e,t)=>[...UC(t),...UC(e)];function Xue(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return vC(r).length?r:[]}var Dw=(e,t)=>_C(t)?[]:Xue(e,UC(t).sort((e,t)=>e-t)),Ow=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},kw=(e,t,n)=>(e[t]=n,e);function Aw(e){let t=OC(),{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(bw)),u=Q.useRef(!1);n._names.array.add(r),Q.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),AC(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=bC(e,r);Array.isArray(t)&&(c(t),l.current=t.map(bw))}}}).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,pw(r,n._names)&&n._subjects.state.next({...n._formState}),u.current&&(!dw(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!dw(n._options.reValidateMode).isOnSubmit){if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=bC(e.errors,r),i=bC(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?CC(n._formState.errors,r,t):QC(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=bC(n._fields,r);e&&e._f&&!(dw(n._options.reValidateMode).isOnSubmit&&dw(n._options.mode).isOnSubmit)&&yw(e,n._names.disabled,n._formValues,n._options.criteriaMode===TC.all,n._options.shouldUseNativeValidation,!0).then(e=>!KC(e)&&n._subjects.state.next({errors:gw(n._formState.errors,e,r)}))}}n._subjects.state.next({name:r,values:hC(n._formValues)}),n._names.focus&&mw(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(()=>(!bC(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=bC(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);Ow(i,e,t),Ow(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Ow,{argA:e,argB:t},!1)},[d,r,n]),move:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Tw(i,e,t),Tw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Tw,{argA:e,argB:t},!1)},[d,r,n]),prepend:Q.useCallback((e,t)=>{let i=UC(hC(e)),a=Ew(n._getFieldArray(r),i);n._names.focus=xw(r,0,t),l.current=Ew(l.current,i.map(bw)),d(a),c(a),n._setFieldArray(r,a,Ew,{argA:Cw(e)})},[d,r,n]),append:Q.useCallback((e,t)=>{let i=UC(hC(e)),a=Sw(n._getFieldArray(r),i);n._names.focus=xw(r,a.length-1,t),l.current=Sw(l.current,i.map(bw)),d(a),c(a),n._setFieldArray(r,a,Sw,{argA:Cw(e)})},[d,r,n]),remove:Q.useCallback(e=>{let t=Dw(n._getFieldArray(r),e);l.current=Dw(l.current,e),d(t),c(t),!Array.isArray(bC(n._fields,r))&&CC(n._fields,r,void 0),n._setFieldArray(r,t,Dw,{argA:e})},[d,r,n]),insert:Q.useCallback((e,t,i)=>{let a=UC(hC(t)),o=ww(n._getFieldArray(r),e,a);n._names.focus=xw(r,e,i),l.current=ww(l.current,e,a.map(bw)),d(o),c(o),n._setFieldArray(r,o,ww,{argA:e,argB:Cw(t)})},[d,r,n]),update:Q.useCallback((e,t)=>{let i=hC(t),a=kw(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?bw():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,kw,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:Q.useCallback(e=>{let t=UC(hC(e));l.current=t.map(bw),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]||bw()})),[s,i])}}function jw(e={}){let t=Q.useRef(void 0),n=Q.useRef(void 0),[r,i]=Q.useState({isDirty:!1,isValidating:!1,isLoading:SC(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:SC(e.defaultValues)?void 0:e.defaultValues});if(!t.current){if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!SC(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=Yue(e);t.current={...i,formState:r}}}let a=t.current.control;return a._options=e,AC(()=>{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&&!FC(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(()=>kC(r,a),[a,r]),t.current}function Mw({preset:e=G.DEFAULT,...t}){let n=q(U.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,fr)||n?.persistenceAdapter!==Ju.HTTP_API||!i?!1:i[t]?.unitFieldName!==fr}function Que(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,readThroughCreateOrganizationUnits:i}=e;if(r&&Object.prototype.hasOwnProperty.call(r,fr)&&n?.persistenceAdapter===Ju.HTTP_API)return i?.[t]}function Nw(e){if(!e.registry.manyToManyScopeJunctions)return;let t=Xl.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 Pw(e){return e==null||e===``?[]:Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[e]}function $ue(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 Fw(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 En.buildParentResourcesRequirementsFromRouteParams(t.parameters,e.resourceType,e.registry)}async function Iw(e){let t=Nw({resourceType:e.resourceType,registry:e.registry,contextualParameters:e.contextualParameters??{}});if(t){let n=Fw({operation:V.pickDefaultOperationFromConfig(e.registry,e.resourceType,K.SEARCH)??V.pickDefaultOperationFromConfig(e.registry,e.resourceType,K.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:Ac.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&&Uh({resourceConfig:r,operation:e.readOperation,registry:e.registry,hasResourceId:En.getResourceId(i[e.resourceType]).length>0,contextResourceIdentifiers:i,contextualParameters:a})?e.readOperation:ph({resourceConfig:r,operations:r.operations??[],coreOperation:K.READ,registry:e.registry,hasResourceId:!0,contextResourceIdentifiers:i,contextualParameters:a}):e.readOperation,s=V.buildForeignKeyReadOperationPath(e.resourceType,e.registry,o),c=e.parentResourcesRequirements??Fw({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:Ac.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 ede(e){let{resourceType:t,ids:n,hostContextualParameters:r}=e,{registry:i,doOperation:a}=pm(),{t:o,formatDate:s,formatDateTime:c}=J({}),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=Kl(n.registry.resourceConfigurations?.[t]?.operations??[],K.READ)??null,{label:i}=await Iw({resourceType:t,id:e,registry:n.registry,doOperation:n.doOperation,contextualParameters:Bm({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 tde(e){if(!e.roleEntries||e.roleTables.unresolvableRoles!==Rs.INERT)return;let{appRolesConfig:t,orgRolesConfig:n}=e.roleTables;return Ore({roleEntries:e.roleEntries,organizationId:e.organizationId,resolveHierarchy:(e,r)=>Co(e,r===Sr.APPLICATION?t:n),resolveRolesWithinAuthority:ec(e.rolesWithinAuthority)})}function nde(e){let t=Kt(e)===B.ARRAY?ds(e):e;return t&&Kt(t)===B.ENUM?Hs(t):[]}function Lw(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]}function rde(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n)return;let i={};for(let[e,a]of Object.entries(t)){if(!Bo(a))continue;let t=nde(a);t.length!==0&&(i[e]={values:xl(n,t,Lw(r?.[e]))})}return Object.keys(i).length>0?i:void 0}function ide(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n||n.kind===xs.UNBOUNDED)return;let i={};for(let[e,a]of Object.entries(t))Bo(a)&&Kt(a)===B.STRING&&re(a)===Ft.ORGANIZATION_ROLE&&(i[e]=xl(n,[...n.grantableRoles],Lw(r?.[e])));return Object.keys(i).length>0?i:void 0}var Rw=rc(U.LOW_LEVEL_ALERT_DIALOG,`AlertDialog`,[`Trigger`,`Content`,`Header`,`Footer`,`Title`,`Description`,`Action`,`Cancel`]);function zw({preset:e=G.DEFAULT,...t}){let n=Rw(e);return(0,$.jsx)(n,{...t})}var Bw=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Rw(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});Bw.displayName=`AlertDialogTrigger`;var Vw=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Rw(e);return(0,$.jsx)(r.Content,{...t,ref:n})});Vw.displayName=`AlertDialogContent`;function Hw({preset:e=G.DEFAULT,...t}){let n=Rw(e);return(0,$.jsx)(n.Header,{...t})}function Uw({preset:e=G.DEFAULT,...t}){let n=Rw(e);return(0,$.jsx)(n.Footer,{...t})}var Ww=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Rw(e);return(0,$.jsx)(r.Title,{...t,ref:n})});Ww.displayName=`AlertDialogTitle`;var Gw=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Rw(e);return(0,$.jsx)(r.Description,{...t,ref:n})});Gw.displayName=`AlertDialogDescription`;function Kw({preset:e=G.DEFAULT,...t}){let n=Rw(e);return(0,$.jsx)(n.Action,{...t})}function qw({preset:e=G.DEFAULT,...t}){let n=Rw(e);return(0,$.jsx)(n.Cancel,{...t})}var Jw=(0,Q.createContext)(void 0);function Yw({formChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({formChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(Jw.Provider,{value:r,children:n})}function Xw(){return(0,Q.useContext)(Jw)??{}}function ade(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 Zw;(function(e){e.REQUEST_DTO=`request-dto`,e.MAIN_SCHEMA=`main-schema`})(Zw||={});var Qw;(function(e){e.IDLE=`idle`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(Qw||={});var $w=(0,Q.createContext)(null);function eT({schema:e,schemaKind:t=Zw.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)($w.Provider,{value:m,children:(0,$.jsx)(VC,{...n,children:d})})}var tT=`server`,nT=`server-unique`,rT=`_root`,iT=`record-duplicate-key`,aT=(e,t,n)=>{if(e&&`reportValidity`in e){let r=bC(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},oT=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?aT(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>aT(t,n,e))}},sT=(e,t)=>{t.shouldUseNativeValidation&&oT(e,t);let n={};for(let r in e){let i=bC(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(cT(t.names||Object.keys(e),r)){let e=Object.assign({},bC(n,r));CC(e,`root`,a),CC(n,r,e)}else CC(n,r,a)}return n},cT=(e,t)=>{let n=uT(t);return e.some(e=>lT(e).match(`^${n}\\.\\d+`))};function lT(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function uT(e){return lT(e).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var dT=new Set([`code`,`message`,`path`,`input`]);function fT(e){let t={};for(let[n,r]of Object.entries(e))dT.has(n)||(t[n]=r);return Object.keys(t).length>0?t:void 0}function pT(e,t){let n={};for(let r of e){let e=ade(r)||`_root`,i=r.code,a=typeof i==`string`?i:``;if(!n[e]){let t=fT(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 mT(e){return pT(e,!1)}function hT(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:sT(pT(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};let o=a.value;return i.shouldUseNativeValidation&&oT({},i),{values:t.raw?Object.assign({},n):o,errors:{}}}}function gT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function _T(e){try{return e.safeParse(void 0).success&&!e.safeParse([]).success}catch{return!1}}function vT(e){if(jt(e)!==null)return!0;let t=Zt(e);return tl(t)===`union`&&(t.options??[]).some(e=>jt(e)!==null)}function yT(e,t){if(!t||!gT(e)||!vT(t))return e;let n=w(t),r;for(let i of Object.keys(e)){let a=mi(t,i);if(!a)continue;let o=e[i],s=o;if(Array.isArray(o)){if(o.length===0){if(!n&&_T(a)){r??={...e},delete r[i];continue}}else{let e=ds(a);if(e&&vT(e)){let t=o.map(t=>yT(t,e));t.some((e,t)=>e!==o[t])&&(s=t)}}}else gT(o)&&vT(a)&&(s=yT(o,a));s!==o&&(r??={...e},r[i]=s)}return r??e}function bT(e){(0,Q.useEffect)(()=>{let t=e.watch((t,{name:n,type:r})=>{if(r!==`change`&&n===void 0)return;let i=e.getFieldState(rT).error;i&&i.type!==`server`&&i.type!==`server-unique`&&e.trigger(rT)});return()=>t.unsubscribe()},[e])}var xT=Q.createContext(void 0);function ST(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())bC(o,e)||CC(o,e,{type:`file-validation`,message:n});return Object.keys(o).length>0?{values:{},errors:o}:a}}function CT({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_CONTENT_SECTION,`ContentSection`)(e);return(0,$.jsx)(n,{...t})}function wT({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_CONTENT_SECTION_GROUP,`ContentSectionGroup`)(e);return(0,$.jsx)(n,{...t})}function TT({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_CONTENT_SECTION_LEGEND,`ContentSectionLegend`)(e);return(0,$.jsx)(n,{...t})}var ET=Kn.ON_BLUR,DT;(function(e){e.FORM=`form`,e.DISPLAY=`display`})(DT||={});var OT;(function(e){e.DISPLAY=`display`,e.EDITING=`editing`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(OT||={});function kT({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??ET,x=n??e,S=Q.useRef(new Map).current,C=hT(x),w=jw({resolver:ST(((e,t,n)=>C(yT(e,x),t,n)),S),defaultValues:r,mode:b,disabled:l});bT(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)(eT,{schema:e,schemaKind:t,form:w,resourceType:d,validationMode:o,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y,children:(0,$.jsx)(xT.Provider,{value:S,children:(0,$.jsx)(`form`,{id:u,onSubmit:T,className:c,noValidate:!0,"data-testid":`form`,children:(0,$.jsx)(CT,{disabled:l,className:`contents`,children:s})})})})}kT.displayName=`Form`;var AT=kT,jT=(0,Q.createContext)(null);function MT({value:e,children:t}){return(0,$.jsx)(jT.Provider,{value:e,children:t})}function NT(){let e=(0,Q.useContext)(jT);if(!e)throw Error(`useFormTemplateContext() must be used within a <FormTemplateProvider>. This is provided automatically by AutomatedForm.`);return e}function PT(){return(0,Q.useContext)(jT)}function FT(e,t){return e===void 0?t!==`update`:!Bl(e)}function IT(e){return e.match(/[^.[\]]+/g)??[]}function LT(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]=LT(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]=LT(a[n],r),a)}function RT(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:RT(e[t],r)}let i=e;if(Object.prototype.hasOwnProperty.call(i,n))return RT(i[n],r)}function zT(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]=zT(a[t],i,n),a}let a=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{...a,[r]:zT(a[r],i,n)}}function BT(e,t){let n={};for(let r of t){let t=IT(r);if(t.length===0)continue;let i=RT(e,t);i!==void 0&&(n=zT(n,t,i))}return n}function VT(e,t,n){let r=IT(t);return r.length===0?e:zT(e,r,n)}function HT(e,t,n){if(!n)return e;let r=new Set(t.map(IT).filter(e=>e.length===1).map(e=>e[0])),i=new Set,a=e;for(let o of t){let t=IT(o);if(t.length<2)continue;let s=t[0];if(r.has(s))continue;let c=RT(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=zT(a,t,c)}}return a}function UT(e,t){let n={};for(let[r,i]of Object.entries(e))(i!==null||WT(t,r))&&(n[r]=i);return n}function WT(e,t){if(!e)return!1;let n=mi(e,t);return n?n.safeParse(null).success:!1}function GT(e,t){let n=t.omitClearedFields?UT(e,t.schema):e;for(let e of t.hiddenFieldNames??[]){let t=IT(e);t.length!==0&&(n=LT(n,t))}if(t.contextFieldValues&&Object.keys(t.contextFieldValues).length>0)for(let[e,r]of Object.entries(t.contextFieldValues)){let t=IT(e);t.length!==0&&(n=zT(n,t,r))}return n}function KT(e){return e!==void 0&&hne(e)}function qT(e,t){let n=jt(e);return n&&Object.hasOwn(n,t)?n[t]:void 0}function JT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function YT(e,t){let n=new Set;for(let r of e){let[e,...i]=IT(r);if(e===void 0)continue;let a=e,o=t?mi(t,e):void 0;if(o!==void 0&&!o.safeParse(void 0).success)n.add(a);else{for(let e of i){if(!KT(o))break;a=`${a}.${e}`,o=qT(o,e)}n.add(a)}}let r=[...n];return r.filter(e=>!r.some(t=>t!==e&&e.startsWith(`${t}.`)))}function ode(e,t){let n=e=>e==null||e===``||e===!1||Array.isArray(e)&&e.length===0;return n(e)?!n(t):!(0,oC.default)(e,t)}function sde(e){let t=new Set(e.writtenAsHeld??[]),n=new Set(e.variantFields??[]),r={},i=(e,t,n,a)=>{if(KT(n)&&JT(e))for(let[r,o]of Object.entries(e))i(o,JT(t)?t[r]:void 0,qT(n,r),`${a}.${r}`);else ode(e,t)&&(r[a]=e===void 0||e===``?null:e)};for(let[a,o]of Object.entries(e.values)){let s=e.schema?mi(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 XT(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`))))}var ZT;(function(e){e.CLEAR=`clear`,e.EMPTY=`empty`,e.TURN_OFF=`turn_off`})(ZT||={});function cde(e,t,n,r=[]){if(!t||!n||r.includes(e))return;let i=YT([e],n);if(i.length!==1||i[0]!==e)return;let a;if(e.includes(`.`)){let n=ee(t,e);a=n?yte(n):void 0}else if(a=mi(t,e),a&&!a.safeParse(void 0).success)return;if(!a)return;let o=a,s=tl(Zt(o)),c=s===`boolean`?{kind:ZT.TURN_OFF,value:!1}:s===`array`?{kind:ZT.EMPTY,value:[]}:{kind:ZT.CLEAR,value:null};return o.safeParse(c.value).success?c:void 0}function lde(e){return e.writesRecordFields||e.hasCallerSectionHandler}function QT(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 $T(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 eE(e,t,n){return e===t?n:n===mr.unresolvedFieldLabel(e)?mr.unresolvedFieldLabel(t):n}function tE(e,t,n,r=`display`,i={}){let{t:a,tResourceFieldDisplay:o,tResourceFieldEdit:s,tResourceFieldEnumValue:c,tResourceSection:l,tResourceWizardStep:u,isReady:d}=J({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=QT(n),c;try{c=ml(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?eE(c,n,(r===`edit`?s:o)(t.resourceType,c,`label`,a)):eE(c,n,o(``,c,`label`,a))}return i},[e,t,n,r,p?.fields,h,o,s]),_=(0,Q.useMemo)(()=>{let i={},a=QT(n),c;try{c=ml(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=mr.getObjectLikeFieldShape(e,{commonOnly:!1})}catch{return{}}if(!i)return{};for(let[e,a]of Object.entries(i))if((r===`display`?wu(a)?.tooltip===!0:id(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=ml(e)}catch{return p?.enums??{}}for(let{path:e,schema:i}of r){let r=Kc(i);if(r){if(p?.enums?.[e])n[e]=p.enums[e];else if(t){let a=Hs(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($T(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($T(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 nE({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:L}=J({component:U.LOW_LEVEL_FORM_MESSAGE}),{fieldLabels:ee,fieldDescriptions:R,fieldTooltips:z,enumLabels:te,sectionLabels:ne,sectionDescriptions:re,wizardStepLabels:ie,wizardStepDescriptions:ae,groupLabels:oe,isReady:se}=tE(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=FT(m,p||f),ue=(0,Q.useContext)(ea)?.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)??mu(n,{appConfig:ue,currentObject:C,values:e,references:{}})]));return yne(e,t)},[S,C,ue]),me=(0,Q.useMemo)(()=>t=>n(GT(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?BT(r,n):r;return E(t,n,GT(pe(i),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:le,schema:e}))}},[E,_,v,le,pe]),ge=(0,Q.useMemo)(()=>({schema:e,fieldLabels:ee,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,ee,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(!L||!se){let e=Math.min(Math.max(Object.keys(ee??{}).length,1),8);return(0,$.jsx)(`div`,{className:W(`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)(mm,{className:`h-4 w-28`}),(0,$.jsx)(mm,{className:`h-9 w-full`})]},t))})}return(0,$.jsx)(AT,{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)(MT,{value:ge,children:(0,$.jsx)(Yw,{formChromeMode:T,children:(0,$.jsx)(F,{})})})})}nE.displayName=`AutomatedForm`;var rE=nE,iE=(0,Q.createContext)(null);function aE({value:e,children:t}){return(0,$.jsx)(iE.Provider,{value:e,children:t})}function oE(){return(0,Q.useContext)(iE)}function sE(){let e=oE();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 cE;(function(e){e.IDLE=`IDLE`,e.QUEUED=`QUEUED`,e.SAVING=`SAVING`,e.ERROR=`ERROR`,e.CONFLICT=`CONFLICT`,e.DELETED=`DELETED`})(cE||={});var lE;(function(e){e.MUTATION_RESULT=`mutation_result`,e.REMOTE_UPDATE=`remote_update`,e.CONFLICT_RESET=`conflict_reset`,e.RESOURCE_DELETED=`resource_deleted`})(lE||={});var uE;(function(e){e.AUTOSAVE=`autosave`,e.SUBMIT=`submit`,e.DRAFT=`draft`,e.PUBLISH=`publish`,e.SECTION=`section`,e.INLINE=`inline`,e.CUSTOM=`custom`})(uE||={});var dE;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.ORCHESTRATOR=`orchestrator`,e.CUSTOM=`custom`})(dE||={});var fE;(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`})(fE||={});var pE;(function(e){e.SUCCESS=`success`,e.ERROR=`error`})(pE||={});var mE;(function(e){e.ACCEPT_REMOTE=`accept-remote`,e.LAST_WRITE_WINS=`last-write-wins`})(mE||={});var hE;(function(e){e.VERSION_CONFLICT=`version_conflict`,e.REMOTE_UPDATE=`remote_update`})(hE||={});var gE;(function(e){e.LOCAL=`local`,e.REMOTE=`remote`})(gE||={});var _E;(function(e){e[e.LOW=0]=`LOW`,e[e.NORMAL=1]=`NORMAL`,e[e.HIGH=2]=`HIGH`,e[e.IMMEDIATE=3]=`IMMEDIATE`})(_E||={});var vE=class extends Error{name=`MutationCancelledError`;source;constructor(e){super(`Mutation cancelled`),this.source=e}},yE=class extends Error{name=`ResourceDeletedError`;constructor(){super(`Resource has been deleted`)}},bE=class extends Error{name=`BackpressureRejectedError`;constructor(){super(`Queue at maximum depth — mutation rejected`)}},xE=il.getLogger(),ude=xE.debugByType(`AutosaveContext`);xE.setDebugTypeLogging(`AutosaveContext`,!1);var SE={enabled:!1,defaultTrigger:ll.DEBOUNCE,debounceMs:500,savedStateDurationMs:2e3},CE={state:Qw.IDLE},wE=(0,Q.createContext)(null);function TE(){return(0,Q.useContext)(wE)}function EE({children:e,labels:t,validateField:n,onSave:r,rmm:i,config:a,onSaveSuccess:o,onSaveError:s}){let c=(0,Q.useMemo)(()=>({...SE,...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===Qw.SAVING),[l]),g=BC();(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]??CE,...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:Qw.SAVED,lastSavedAt:Date.now()}),m.current[e]=setTimeout(()=>{_(e,{state:Qw.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:Qw.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:Qw.IDLE});return}if(c.signal.aborted)return;_(e,{state:Qw.SAVING});try{if(r)await r(e,a,c.signal);else if(i){let n=await i.queueMutation({[e]:a},{type:uE.AUTOSAVE,priority:_E.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===fE.TRANSIENT)i=t.errorNetwork;else if(r?.type===fE.VALIDATION)i=t.errorValidation;else if(r?.type===fE.CONFLICT)i=t.errorConflict;else if(n instanceof bE){ude(`executeSave: backpressure rejection — resetting field to idle`,{fieldName:e}),_(e,{state:Qw.IDLE});return}else if(n instanceof vE){_(e,{state:Qw.IDLE});return}else if(n instanceof yE){_(e,{state:Qw.ERROR,lastError:t.errorResourceDeleted});return}else i=t.errorGeneric;_(e,{state:Qw.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===ll.NONE)return;p.current[e]={value:t,trigger:n},b(e);let r=new AbortController;if(n===ll.BLUR)w(e,t,r);else if(n===ll.DEBOUNCE){let n=c.debounceMs??SE.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??Qw.IDLE,[l]),O=(0,Q.useCallback)(e=>l[e]??CE,[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)(wE.Provider,{value:k,children:e})}function DE(e,t=ll.DEBOUNCE,n=!1){return e===void 0?t:e===!0?n?ll.DEBOUNCE:ll.BLUR:typeof e==`object`?e.enabled===!1?ll.NONE:e.trigger?e.trigger:n?ll.DEBOUNCE:ll.BLUR:t}var OE=(0,Q.createContext)(null);function dde(){return(0,Q.useContext)(OE)}var fde={[ZT.CLEAR]:{action:`bulkClearField`,pending:`bulkFieldWillBeCleared`,pendingUncounted:`bulkFieldWillBeClearedOnSelection`},[ZT.EMPTY]:{action:`bulkEmptyField`,pending:`bulkFieldWillBeEmptied`,pendingUncounted:`bulkFieldWillBeEmptiedOnSelection`},[ZT.TURN_OFF]:{action:`bulkTurnOffField`,pending:`bulkFieldWillBeTurnedOff`,pendingUncounted:`bulkFieldWillBeTurnedOffOnSelection`}};function kE({fieldName:e,label:t,disabled:n,onSaveFieldNow:r,children:i}){let a=dde(),o=TE(),{tComponent:s}=J({component:U.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=fde[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(U.LOW_LEVEL_FORM_FIELD,u.pendingUncounted):s(U.LOW_LEVEL_FORM_FIELD,u.pending,{count:f}):null}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,"aria-describedby":p,onClick:()=>{d?a.setCleared(e,!1):(o?.cancelPendingUnder(e),a.setCleared(e,!0),r?.(void 0))},children:s(U.LOW_LEVEL_FORM_FIELD,d?`bulkFieldUndoClear`:u.action)})]})]})}function AE(e){if(!e)return[];try{let t=mr.getObjectLikeFieldShape(e,{commonOnly:!0})??{};return Object.entries(t).filter(([,e])=>Oie(e)).map(([e])=>e)}catch{return[]}}function jE(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 pde(e){let{formFieldShape:t,inheritanceConfig:n,defaultValuesOverride:r}=e,i={};if(t)for(let[e,n]of Object.entries(t)){let t=Rne(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 ME(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function NE(...e){return t=>{let n=!1,r=e.map(e=>{let r=ME(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():ME(e[t],null)}}}}function PE(...e){return Q.useCallback(NE(...e),e)}var mde=Symbol.for(`react.lazy`),FE=Q.use;function hde(e){return typeof e==`object`&&!!e&&`then`in e}function IE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===mde&&`_payload`in e&&hde(e._payload)}function LE(e){let t=gde(e),n=Q.forwardRef((e,n)=>{let{children:r,...i}=e;IE(r)&&typeof FE==`function`&&(r=FE(r._payload));let a=Q.Children.toArray(r),o=a.find(vde);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 RE=LE(`Slot`);function gde(e){let t=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(IE(n)&&typeof FE==`function`&&(n=FE(n._payload)),Q.isValidElement(n)){let e=bde(n),i=yde(r,n.props);return n.type!==Q.Fragment&&(i.ref=t?NE(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 zE=Symbol(`radix.slottable`);function _de(e){let t=({children:e})=>(0,$.jsx)($.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=zE,t}function vde(e){return Q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===zE}function yde(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 bde(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 xde=il.getLogger(),BE=U.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,VE=class extends Q.Component{state={error:null,errorInfo:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){xde.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)(Sde,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.resetError,titleAs:this.props.titleAs}):this.props.children}};function Sde(e){return(0,Q.useContext)(Ic)?(0,$.jsx)(Cde,{...e}):(0,$.jsx)(HE,{...e,label:e=>`components.${BE}.${e}`})}function Cde(e){let{makeTrComponent:t,isReady:n}=J({component:BE});return n?(0,$.jsx)(HE,{...e,label:t(BE)}):e.titleAs?(0,$.jsx)(e.titleAs,{className:`sr-only`}):null}function HE({error:e,errorInfo:t,onRetry:n,titleAs:r,label:i}){let a=bi.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)(Ly,{variant:`error`,title:i(`title`),message:i(`message`),actions:[{label:i(`tryAgain`),onClick:n,variant:`primary`}],showDevInfo:a,devInfoTitle:i(`devInfoTitle`),devInfoSections:o})]})}var UE=`data-surface-scroll-lock-count`,WE,wde=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`,GE={a11y:{landmarkRole:`none`}};function KE(e){return Array.from(e.querySelectorAll(wde)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function qE(){return typeof document>`u`?0:Number(document.body.getAttribute(UE)??0)}function JE(e){typeof document<`u`&&(e<=0?(document.body.removeAttribute(UE),document.body.style.overflow=WE??``,WE=void 0):(qE()===0&&(WE=document.body.style.overflow),document.body.setAttribute(UE,String(e)),document.body.style.overflow=`hidden`))}function YE(e){Q.useEffect(()=>{if(e&&typeof document<`u`)return JE(qE()+1),()=>JE(qE()-1)},[e])}function XE(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;(KE(n)[0]??n).focus({preventScroll:!0});let i=e=>{if(e.key!==`Tab`)return;let t=KE(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 Tde=il.getLogger();function ZE(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 QE(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 Ede(e){switch(e){case`nowrap`:return`nowrap`;case`balance`:return`balance`;case`pretty`:return`pretty`;case`wrap`:return`wrap`;default:return}}function Dde(e){switch(e){case`tabular`:return`tabular-nums`;case`lining`:return`lining-nums`;case`inherit`:return`inherit`;default:return}}function Ode(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 kde(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 $E(e){switch(e){case`stack`:return`column`;case`row`:case`inherit`:return e;case`column-reverse-on-mobile`:return`row`;default:return}}function eD(e){switch(e){case`column-reverse-on-mobile`:return`column-reverse`;case`stack`:return`column`;case`row`:case`inherit`:return e;default:return}}function tD(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 nD(e){return e===void 0?void 0:{maxInlineSize:tD(e)}}function Ade(e){switch(e){case`sm`:case`md`:case`lg`:case`xl`:case`measure`:case`centered-readable`:case`content`:return`auto`;default:return`0px`}}function jde(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 Mde(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 Nde(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 Pde(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":ZE(t?.paddingBlock),"--surface-policy-padding-inline":ZE(t?.paddingInline),"--surface-policy-overflow":t?.overflow,"--surface-policy-max-height":t?.maxHeight===`none`?`none`:t?.maxHeight,"--surface-policy-gap":QE(t?.gap),"--surface-policy-header-gap":QE(t?.slotGap?.header??t?.gap),"--surface-policy-body-gap":QE(t?.slotGap?.body??t?.gap),"--surface-policy-footer-gap":QE(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":kde(o?.stackingTier),"--surface-policy-numeric-align":Dde(r?.numericAlignment),"--surface-policy-text-wrap":Ede(r?.wrapStrategy),"--surface-policy-overflow-wrap":Ode(r?.overlongTokenStrategy),"--surface-policy-safe-area":a?.safeAreaPadding?`env(safe-area-inset-bottom)`:`0px`,"--surface-policy-action-alignment":$E(a?.actionAlignment),"--surface-policy-action-alignment-mobile":eD(a?.actionAlignment),"--surface-policy-responsive-max-width":tD(a?.responsiveMaxWidth),"--surface-policy-responsive-max-width-margin":Ade(a?.responsiveMaxWidth),"--surface-policy-embedded-table-padding-inline":jde(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 Fde(e,t,n,r){Q.useRef(!1),r&&[e,t].filter(Boolean).join(` `)}function Ide(e,t,n,r,i,a){return r?{...Pde(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=C.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}=Ig(),w=x?.(_t.SURFACE,e),T=y?.(_t.SURFACE,e),E=b?.(t??w?.material),D=Q.useContext(Ye),O=Q.useMemo(()=>S?S(e,n,D?.policy):Pc(Uee[e],void 0,void 0,n,{variant:e,parentPolicy:D?.policy,logger:Tde}),[S,D?.policy,n,e]),[k,A]=Q.useState(),j=Q.useCallback(e=>{A(e)},[]),M=Q.useCallback(e=>{A(t=>t===e?void 0:t)},[]),N=Q.useMemo(()=>({headerId:k,registerHeaderId:j,unregisterHeaderId:M}),[k,j,M]),P=Q.useMemo(()=>Qr(e,O,D,N),[N,D,O,e]),F=!!D?.isInFramedAncestor,I=F?D?.nearestFramedAncestorVariant??void 0:void 0,L=Mde(O.nesting?.nestedRadiusStrategy,F);Fde(c,r&&Q.isValidElement(u)?u.props.className:void 0,n,i);let ee=r?RE:`div`,R=Q.useRef(null),z=i_(E,R),te=Q.useCallback(e=>{R.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]),ne=d??Nde(O.a11y?.landmarkRole),re=p??(O.a11y?.labelStrategy===`from-header`?k:void 0),ie={...d===void 0?{}:{role:d},...f===void 0?{}:{"aria-label":f},...p===void 0?{}:{"aria-labelledby":p}},ae=o?ie:{...ne===void 0?{}:{role:ne},...f===void 0?{}:{"aria-label":f},...re===void 0?{}:{"aria-labelledby":re}},oe=!o&&(O.a11y?.focusTrap===`on-mount`||a&&O.a11y?.focusTrap===`when-modal`),se=!o&&a&&O.a11y?.scrollContainment===`lock-body`,ce=oe&&g==null?-1:g,le=ce===void 0?{}:{tabIndex:ce};XE(R,oe),YE(se),Q.useEffect(()=>{},[o,f,p,k,O.a11y?.labelStrategy,ne,e]);let ue=i?{"data-slot":`surface`,"data-surface":``,"data-inline-size-tier":O.geometry?.responsiveMaxWidth}:{},de=O.interactiveState?.errorBoundary===`self`,fe=de?Lde(u,r,s):{children:u,boundsContent:!1},pe=(0,$.jsx)(ee,{ref:te,..._,...ue,"data-material-kind":z[`data-material-kind`],"data-material-tier":z[`data-material-tier`],"data-material-variant":z[`data-material-variant`],"data-material-depth":z[`data-material-depth`],"data-material-composition":z[`data-material-composition`],"data-material-group":z[`data-material-group`],"data-material-refractive-budget":z[`data-material-refractive-budget`],...le,"data-surface-focus-trap":oe?``:void 0,"data-surface-scroll-containment":se?``:void 0,"data-surface-framing-mode":i?rD(O.nesting?.framingMode):void 0,"data-surface-frame":i?P.rendersOwnFrame?`rendered`:`suppressed`:void 0,"data-surface-in-framed-ancestor":i&&F?``:void 0,"data-surface-nearest-framed-ancestor":i?I:void 0,"data-surface-nested-radius-strategy":i?iD(O.nesting?.nestedRadiusStrategy):void 0,"data-surface-first-child-edge-strategy":i?aD(O.nesting?.firstChildEdgeStrategy):void 0,"data-surface-divider-strategy":i?oD(O.nesting?.dividerStrategy):void 0,"data-surface-selectable-semantics":i?sD(O.interactiveState?.selectableSemantics):void 0,"data-surface-gesture-opt-in":i?cD(O.interactiveState?.gestureOptIn):void 0,"data-surface-child-adaptive-density":i&&O.composition?.childAdaptiveDensity===!0?``:void 0,"data-surface-selection-column-aware":i&&O.composition?.selectionColumnAware===!0?``:void 0,...ae,"data-surface-variant":e,className:W(T,c),style:Ide(O,z.style,l,i,P.rendersOwnFrame,L),children:fe.children});return(0,$.jsx)(Ye.Provider,{value:P,children:de&&!fe.boundsContent?(0,$.jsx)(VE,{children:pe}):pe})});function Lde(e,t,n){if(!t)return{children:(0,$.jsx)(VE,{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)(VE,{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`]:QE(r),...n}}var mD=Q.forwardRef(function({className:e,id:t,style:n,...r},i){let a=Sc(),o=Q.useContext(Ye),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:W(e),style:pD(`header`,a,n),...r})});mD.displayName=`Surface.Header`;var hD=Q.forwardRef(function({className:e,style:t,...n},r){let i=Sc();return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-body`,className:W(e),style:pD(`body`,i,t),...n})});hD.displayName=`Surface.Body`;var gD=Q.forwardRef(function({className:e,style:t,...n},r){let i=Sc(),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:W(e),style:{"--surface-policy-slot-display":uD(o||s),"--surface-policy-slot-flex-direction":dD(o),"--surface-policy-footer-gap":QE(a),"--surface-policy-action-alignment":s?$E(i.geometry?.actionAlignment):void 0,"--surface-policy-action-alignment-mobile":s?eD(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:W(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 Rde(e){return e===ii.EYEBROW?ii.EYEBROW:ii.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:Rde(t)},e)}var zde=`text-base`;function CD(e){return W(e(_t.TYPOGRAPHY,ii.HEADING).base,zde)}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 Bde(){let e=(0,Q.useContext)(OD);(0,Q.useLayoutEffect)(()=>{e?.registerWizardRoot()},[e])}var AD=rc(U.LOW_LEVEL_ALERT,`Alert`,[`Title`,`Description`]);function jD({preset:e=G.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n,{...t})}function MD({preset:e=G.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n.Title,{...t})}function ND({preset:e=G.DEFAULT,...t}){let n=AD(e);return(0,$.jsx)(n.Description,{...t})}function PD(){let e=(0,Q.useContext)($w);if(!e)throw Error(`useFormSchemaContext must be used within a FormSchemaProvider`);return e}function FD(){return(0,Q.useContext)($w)}var Vde=il.getLogger().debugByType(`FormErrorCategorization`),ID=class e{constructor(){}static ROOT_ERROR_PATHS=new Set([``,`root`,`_`]);static ROOT_ERROR_PREFIX=rT;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 Vde(`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 BC()!=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 Hde(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="${Hde(t)}"]`);if(e){n=e;break}}if(!n)return e.some(e=>ID.isFormLevelErrorPath(e))?(Ude(),!0):!1;let i=n;return BD(i)?VD(i,()=>JD(i)):JD(i),!0}function Ude(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=il.getLogger(),Wde=YD.debugByType(`FormErrorSummary`);YD.setDebugTypeLogging(`FormErrorSummary`,!1);function XD({title:e,className:t,maxErrors:n=10,stepFieldNames:r}){let{formState:i}=BC(),{renderIcon:a}=kf(),o=Sc(),s=FD(),c=s?.resourceType,{tResourceFieldEdit:l,tComponent:u,isReady:d}=J({component:U.LOW_LEVEL_FORM_MESSAGE,...c?{resource:c}:{}}),f=e??u(U.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=PT()?.fieldLabels,S=(0,Q.useMemo)(()=>mr.createFieldLabelResolver(c,l,s?.schema,x),[c,l,s?.schema,x]);if(b.length===0||!d)return null;Wde(`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:W(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:Jn.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(U.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)(mm,{"aria-hidden":`true`,className:W(`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}=BC(),o=PT(),{tComponent:s,isReady:c}=J({component:U.LOW_LEVEL_FORM_MESSAGE}),l=t===void 0&&!c,u=t??(c?s(U.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=rc(U.LOW_LEVEL_TABS,`Tabs`,[`List`,`Trigger`,`Content`]);function cO({preset:e=G.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n,{...t})}function lO({preset:e=G.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.List,{...t})}function uO({preset:e=G.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.Trigger,{...t})}function dO({preset:e=G.DEFAULT,...t}){let n=sO(e);return(0,$.jsx)(n.Content,{...t})}var fO=rc(U.LOW_LEVEL_ACCORDION,`Accordion`,[`Item`,`Trigger`,`Content`]);function pO({preset:e=G.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n,{...t})}function mO({preset:e=G.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n.Item,{...t})}function hO({preset:e=G.DEFAULT,...t}){let n=fO(e);return(0,$.jsx)(n.Trigger,{...t})}function gO({preset:e=G.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=rc(U.LOW_LEVEL_TOGGLE_GROUP,`ToggleGroup`,[`Item`]),bO=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=yO(e);return(0,$.jsx)(r,{...t,ref:n})});bO.displayName=`ToggleGroup`;function xO({preset:e=G.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Item,{...t})}var SO=rc(U.LOW_LEVEL_COLLAPSIBLE,`Collapsible`,[`Trigger`,`Content`]);function CO({preset:e=G.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n,{...t})}function wO({preset:e=G.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n.Trigger,{...t})}function TO({preset:e=G.DEFAULT,...t}){let n=SO(e);return(0,$.jsx)(n.Content,{...t})}var EO=rc(U.LOW_LEVEL_STEPPER,`Stepper`,[`Item`,`Indicator`,`Separator`,`Title`,`Description`]);function DO({preset:e=G.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n,{...t})}function OO({preset:e=G.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Item,{...t})}function kO({preset:e=G.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Indicator,{...t})}function AO({preset:e=G.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Separator,{...t})}function jO({preset:e=G.DEFAULT,...t}){let n=EO(e);return(0,$.jsx)(n.Title,{...t})}function MO({preset:e=G.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 Gde=new Set([Xt.DEFAULT,Xt.CARD,Xt.GHOST,Xt.COLLAPSIBLE]);function RO(e){return Gde.has(e)}function Kde(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??Xt.DEFAULT;if(RO(o)){i.push({type:`node`,node:a});continue}let s=o,c=qde(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 qde(e,t){switch(e){case Xt.INLINE:return JSON.stringify({mode:e,gap:t.gap});case Xt.GRID:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth});case Xt.COLUMNS:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap});case Xt.VERTICAL_TABS:return JSON.stringify({mode:e,navWidth:t.navWidth});case Xt.ACCORDION:return JSON.stringify({mode:e,allowMultiple:t.allowMultiple});case Xt.EXPANDABLE:return JSON.stringify({mode:e,initialVisibleCount:t.initialVisibleCount});case Xt.STEPPER:return JSON.stringify({mode:e,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation});case Xt.TABS:case Xt.PILLS:case Xt.TIMELINE:case Xt.STAGES:return JSON.stringify({mode:e});default:return JSON.stringify({mode:e})}}function Jde(e){let t=e.sections[0].props,n=e.mode,r={mode:n,ariaLabel:void 0,ariaLabelledBy:void 0};switch(n){case Xt.INLINE:return{...r,mode:n,gap:t.gap};case Xt.GRID:return{...r,mode:n,columnCount:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth};case Xt.COLUMNS:return{...r,mode:n,columnCount:t.columns,gap:t.gap};case Xt.TABS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case Xt.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 Xt.PILLS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case Xt.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 Xt.EXPANDABLE:return{...r,mode:n,initialVisibleCount:t.initialVisibleCount};case Xt.STEPPER:return{...r,mode:n,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation??Ks.VERTICAL};case Xt.TIMELINE:return{...r,mode:n};case Xt.STAGES:return{...r,mode:n};default:return{mode:Xt.INLINE}}}function Yde(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:Xt.DEFAULT};case`separator-only`:return{appearance:Xt.DEFAULT,className:`border-b pb-field last:border-b-0 last:pb-0`};default:return{appearance:Xt.CARD}}}var BO=({sections:e,className:t})=>{let{getRecipe:n}=Ig(),r=n(_t.SURFACE,C.CARD),i=n(_t.TYPOGRAPHY,ii.EYEBROW),a=JO();return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.CARD,policyOverride:{nesting:{framingMode:`always`}},children:(0,$.jsx)(`div`,{role:`region`,"aria-label":a(`contentSectionsRegion`),className:W(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:W(`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)(CT,{appearance:Xt.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)(CT,{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)(CT,{panel:!0,appearance:r,className:i,children:t},e.id)}function UO({section:e}){let{getRecipe:t}=Ig();return e.description==null?e.content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:W(`mb-field`,t(_t.TYPOGRAPHY,ii.DESCRIPTION).base),children:e.description}),e.content]})}var WO=({sections:e,config:t,className:n,onSectionChange:r})=>{let i=Yde(Sc().autoRender?.autoSectionWrap);if(e.length===0)return t.emptyStateMessage?(0,$.jsx)(fm,{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 Xt.DEFAULT:case Xt.CARD:case Xt.GHOST:case Xt.INLINE:return(0,$.jsx)(YO,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.GRID:return(0,$.jsx)(Zde,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.COLUMNS:return(0,$.jsx)(Qde,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.TABS:return(0,$.jsx)($de,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Xt.VERTICAL_TABS:return(0,$.jsx)(nfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Xt.PILLS:return(0,$.jsx)(rfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Xt.ACCORDION:return(0,$.jsx)(ife,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Xt.COLLAPSIBLE:return(0,$.jsx)(ofe,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.EXPANDABLE:return(0,$.jsx)(cfe,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.STEPPER:return(0,$.jsx)(lfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Xt.TIMELINE:return(0,$.jsx)(ufe,{sections:e,config:t,className:n,sectionWrapMode:i});case Xt.STAGES:return(0,$.jsx)(dfe,{sections:e,config:t,className:n,sectionWrapMode:i});default:return(0,$.jsx)(YO,{sections:e,config:{mode:Xt.INLINE},className:n,sectionWrapMode:i})}},GO={sm:`gap-element`,md:`gap-field`,lg:`gap-section`},Xde={sm:`var(--spacing-element)`,md:`var(--spacing-field)`,lg:`var(--spacing-section)`},KO=`300px`,qO=U.LOW_LEVEL_CONTENT_SECTION_CONTAINER;function JO(){let{tComponent:e}=J({component:qO});return(0,Q.useCallback)((t,n)=>{let r=e(qO,t,n);return r===`${ac.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:W(`flex flex-col`,i,n),role:`region`,"aria-label":t.ariaLabel??a(`contentSectionsRegion`),children:e.map(e=>VO(e,{wrapMode:r}))})},Zde=({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} * ${Xde[a]}) / ${i}))`:o,u={gridTemplateColumns:`repeat(${i?`auto-fill`:`auto-fit`}, minmax(min(100%, ${l}), 1fr))`};return(0,$.jsx)(`div`,{className:W(`grid`,s,n),style:u,role:`region`,"aria-label":t.ariaLabel??c(`contentGridRegion`),children:e.map(e=>VO(e,{wrapMode:r}))})},Qde=({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:W(i,n),style:{columns:o},role:`region`,"aria-label":t.ariaLabel??a(`contentColumnsRegion`),children:e.map(e=>(0,$.jsx)(`div`,{className:W(`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 $de=({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))]})},efe=36;function tfe(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 nfe=({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]=tfe(efe);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?Ks.HORIZONTAL:Ks.VERTICAL,className:W(`mt-field`,n),onValueChange:c,children:[(0,$.jsx)(lO,{className:f?void 0:W(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))]})})},rfe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(t.defaultActive??e[0]?.id),c=t.activeSection??a,l=o,{getRecipe:u}=Ig(),d=JO(),f=(0,Q.useId)(),p=(0,Q.useRef)(null),m=u(_t.SELECTABLE,s.FILLED),h=WD(),g=e=>`${f}-tab-${e}`,_=e=>`${f}-panel-${e}`,v=e=>{l(e),i?.(e)},y=HD(e=>e!==c&&(v(e),!0)),b=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(c),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];v(a),p.current?.querySelector(`#${CSS.escape(g(a))}`)?.focus()},x=e.find(e=>e.id===c),S=e=>(0,$.jsx)(`div`,{role:`tabpanel`,id:_(e.id),"aria-labelledby":g(e.id),tabIndex:0,hidden:e.id!==c,...UD(y,e.id),className:W(`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,Ag(r_.INSET)),children:HO(e,(0,$.jsx)(UO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:W(`space-y-field`,n),role:`region`,"aria-label":t.ariaLabel??d(`pillNavigationRegion`),children:[(0,$.jsx)(`div`,{ref:p,className:`flex flex-wrap items-center gap-item`,role:`tablist`,"aria-label":t.ariaLabel??d(`sectionTabsNav`),onKeyDown:b,children:e.map(e=>{let t=c===e.id;return(0,$.jsxs)(`button`,{id:g(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":_(e.id),"data-state":t?`active`:`inactive`,tabIndex:t?0:-1,disabled:e.disabled,className:W(`inline-flex items-center gap-element rounded-md px-card-sm py-item font-medium`,m.base,m.motion?.transition,m.states.focus,!t&&m.states.hover,t&&m.states.selected,e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),onClick:()=>v(e.id),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id)})}),h?e.map(S):x&&S(x)]})},ife=({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}=Ig(),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:W(e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:(0,$.jsxs)(`span`,{className:W(`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})},afe=`all`,ofe=({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:Y.GHOST,size:Gd.SM,"aria-expanded":i,children:i?s:c})})]}),(0,$.jsx)(TO,{className:`space-y-field mt-field`,...u?{forceMount:!0,hidden:!i}:{},...UD(d,afe),children:e.map(e=>VO(e,{titleTag:`h4`,wrapMode:r}))})]})},sfe=`folded`,cfe=({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}=kf(),m=HD(()=>!a&&(o(!0),!0));return(0,$.jsxs)(`div`,{className:W(`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,sfe),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:Y.GHOST,size:Gd.SM,className:`self-start`,onClick:()=>o(!a),"aria-expanded":a,children:[a?d:u,p(a?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:Jn.SM})]})]})},lfe=({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??Ks.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:W(`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:Y.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})]})]})]})},ufe=({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)(Bf,{className:`gap-section`,children:e.map((e,t)=>(0,$.jsx)(Ff,{children:(0,$.jsx)(df,{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)(Nf,{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))})})},dfe=({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:Xt.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:Ks.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=ffe(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 ffe(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(qc));function dk(e){if(typeof e==`string`)return uk.has(e)?e:qc.STACKED;let t={};for(let[n,r]of Object.entries(e))t[n]=r&&uk.has(r)?r:qc.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=il.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??Xt.DEFAULT,u=PT(),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(rs.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)(CT,{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}=Xw();return t?e===lk.FORM?(0,$.jsx)(Yw,{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=BC(),r=PT(),i=vk(),[a,o]=(0,Q.useState)(!1),{tComponent:s,isReady:c}=J({component:U.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(U.LOW_LEVEL_FORM_MESSAGE,`sectionSaving`),f=s(U.LOW_LEVEL_FORM_MESSAGE,`sectionSave`);return(0,$.jsx)(`div`,{className:`flex justify-end pt-item`,children:(0,$.jsx)(X,{type:`button`,variant:Y.SECONDARY,size:Gd.SM,onClick:u,disabled:t||a||i.length===0,children:a?d:f})})}function $k(e){return(0,Q.isValidElement)(e)&&e.type===Yk}il.getLogger();function eA(e,t){return Kde(e,$k,t)}function tA(e){return Jde(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=oE()!==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=PT();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:W(`mr-auto w-full`,e),style:{maxInlineSize:tD(i)},"data-inline-size-tier":i,"data-guidance-form":``,"data-slot":`form-layout`,children:(0,$.jsxs)(Vy,{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&&mr.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=mr.getObjectLikeFieldShape(r,{commonOnly:!1})??null;if(!i||!(t in i))return;if(r=i[t],n!=null){let e=Zt(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===yi.MOBILE||e===yi.VERT_TABLET||e===yi.DESKTOP))return e;let n=e;return n[t]??n[yi.DESKTOP]??n[yi.VERT_TABLET]??n[yi.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:ii.EYEBROW,children:(0,$.jsx)(`div`,{className:W(`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: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!==Xt.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?Hs(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([B.ARRAY,B.SET,B.TUPLE,B.RECORD,B.MAP,B.OBJECT,B.VERSIONED_OBJECT,B.CODE,B.FILE,B.ADDRESS]),SA=new Set([xa.MULTILINE,xa.MARKDOWN,xa.UNTRUSTED_HTML]);function CA(e,t,n){return n===hc.SUMMARY?!0:e?xA.has(e)?!0:e===B.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:qc.TILE,children:(0,$.jsx)(`dl`,{"data-slot":`field-tiles`,className:W(`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:qc.HIDDEN,children:(0,$.jsx)(`div`,{"data-slot":`record-state`,className:W(`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:qc.INLINE,children:(0,$.jsx)(`div`,{"data-slot":`record-keeping-facts`,className:W(`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=Ro.BADGE,kA=new Set([qc.HIDDEN,qc.COMPACT]);function AA(e){let t=wu(e)?.chromeMode;return Kt(e)!==B.OBJECT&&typeof t==`string`&&kA.has(t)}var jA=new Set([...Uo.filter(e=>!Kie.includes(e)),..._n]);function MA(e,t,n){if(V.isIdentityOnlySummaryField(e,n))return DA.IDENTITY_PLUMBING;let r=Kt(t),i=wu(t);return r===B.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[yi.DESKTOP]}var WA=(0,Q.createContext)(!1);function GA(){return(0,Q.useContext)(WA)}var KA=new Set([B.BOOLEAN,B.NUMBER,B.BIGINT,B.BIGDECIMAL,B.RANGE_NUMBER,B.RANGE_BIGDECIMAL]),qA=new Set([B.DATE,B.DATETIME,B.TIME,B.RANGE_DATE,B.RANGE_DATETIME,B.RANGE_TIME]),JA=new Set([qc.COMPACT,qc.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=rc(U.LOW_LEVEL_TOOLTIP,`Tooltip`,[`Trigger`,`Content`,`Provider`]);function tj({preset:e=G.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n,{...t})}function nj({preset:e=G.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Trigger,{...t})}function rj({preset:e=G.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Content,{...t})}function ij({preset:e=G.DEFAULT,...t}){let n=ej(e);return(0,$.jsx)(n.Provider,{...t})}function aj({provenance:e,className:t}){let n=Vie(e.system),r=(0,Q.useMemo)(()=>[n],[n]),{tComponent:i,t:a,formatDateTimeForDisplayMode:o,isReady:s}=J({component:U.LOW_LEVEL_FORM_FIELD,keys:r});if(!s)return null;let c=a(n),l=o(e.currentAsOf,Jre.AUTO);return(0,$.jsx)(lx,{className:t,"data-field-provenance":``,children:i(U.LOW_LEVEL_FORM_FIELD,`syncedFromAsOf`,{system:c,asOf:l})})}aj.displayName=`DisplayFieldProvenanceNote`;function oj(e,t){return UA(e,t)??qc.STACKED}function sj({text:e}){let{renderIcon:t}=kf(),{tComponent:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(U.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:Jn.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}=Ig(),_=bA(),v=g(_t.TYPOGRAPHY,ii.DESCRIPTION),y=g(_t.TYPOGRAPHY,ii.EYEBROW),b=(0,Q.useMemo)(()=>oj(e,m),[e,m]),x=o??(b===qc.INLINE?`start`:`top`),S=!s&&!!t&&x!==`hidden`&&b!==qc.COMPACT&&b!==qc.HIDDEN,w=!c&&!!r&&b!==qc.COMPACT&&b!==qc.HIDDEN,T=!!l,E=T?(0,$.jsx)(aj,{provenance:l}):null,D=!S&&!s&&t&&(x===`hidden`||d)?(0,$.jsx)(`span`,{className:`sr-only`,children:d?`${t}: `:t}):null;if(b===qc.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[D,p]});if(b===qc.TILE){let e=_?`dt`:`div`,n=_?`dd`:`div`,o=S?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:C.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:W(`flex min-w-0 flex-col gap-item`,f),children:[o&&(0,$.jsxs)(e,{className:W(`flex min-w-0 items-center`,S&&y.base),children:[o,S&&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(b===qc.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,p]});if(b===qc.INLINE)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:W(`flex flex-wrap items-baseline gap-x-1.5 gap-y-element-xs`,f),children:[D,S&&(0,$.jsxs)(`span`,{className:W(`shrink-0`,v.base),children:[t,`:`,i&&(0,$.jsx)(sj,{text:i})]}),(0,$.jsx)(`div`,{className:`min-w-0`,children:p}),w&&(0,$.jsx)(lx,{className:`w-full`,children:r}),T&&(0,$.jsx)(aj,{provenance:l,className:`w-full`})]});if(b===qc.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":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:W(`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`:W(`flex-row gap-section`,w?`items-start`:`items-center`),f),children:[(0,$.jsxs)(`div`,{className:W(`flex min-w-0 flex-col gap-element-xs`,!h&&`flex-1`),children:[D,S&&(0,$.jsxs)(ox,{children:[t,i&&(0,$.jsx)(sj,{text:i})]}),w&&(0,$.jsx)(lx,{children:r})]}),(0,$.jsxs)(`div`,{className:W(`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(x===`start`||x===`inline`){let e=x===`inline`;return(0,$.jsxs)(ax,{orientation:ix.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:W(e&&`flex-row-reverse`,f),children:[D,(0,$.jsxs)(cx,{children:[S&&(0,$.jsx)(sx,{children:(0,$.jsxs)(ox,{className:v.base,children:[t,i&&(0,$.jsx)(sj,{text:i})]})}),w&&(0,$.jsx)(lx,{children:r}),E]}),p]})}return(0,$.jsxs)(ax,{orientation:ix.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,S&&(n===vo.TITLE?(0,$.jsxs)(`div`,{className:W(`pt-item-xs`,y.base),children:[t,i&&(0,$.jsx)(sj,{text:i})]}):(0,$.jsxs)(ox,{className:v.base,children:[t,i&&(0,$.jsx)(sj,{text:i})]})),p,w&&(0,$.jsx)(lx,{children:r}),E]})}cj.displayName=`DisplayFieldChrome`;function lj(e){let t=e.parentReferenceConfig,n=[...e.referencedIds];if(!t||t.displayMode!==Rt.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!==it.REFERENCE&&e!==it.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===K.CREATE||e.resourceOperationLike===K.CREATE));return n.find(e=>e.variantKey===`quick-add`)??Kl(n,K.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=Xl.ensureCompiledRelationship.call(Xl,n,e.registry.allResourceFieldIdentifiers);if(Xl.tryResolveRelationshipForeignKeyIdentity(r,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==t)return[];let i=Xl.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(bi.isDevelopment())throw V.buildConfigurationError(rs.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:Xl.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===ate.NESTED_RESOURCE:Xl.resolveRelationshipNature(e).nature===it.COMPOSITION}function Sj(e){if(!Xl.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=Xl.tryResolveRelationshipForeignKeyIdentity(e.relationship,e.registry.allResourceFieldIdentifiers);if(!n?.fieldIdentifier)return;let r=e.relationship.display?.inParentNavigation,i=sd(e.relationship.cardinality2),a=e.viewport??yi.DESKTOP,o=Cj(i),s=Zh(r?.transition,a),c=e.registry.resourceConfigurations[t]?.resourceRelationships,l=c?[...c.parentRelationships,...c.selfRelationships].find(t=>t.resourceType1===e.parentResourceType&&Xl.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:Xt.INLINE}:{mode:Xt.TABS}}function wj(e){if(!e.navigationZone||!Um.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??Rt.CONTEXT,showParentLink:n?.showParentLink??!0}}}function Tj(e){let t=e.schema?tu(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===it.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=Ds(e.schema);if(!t||!e.parentData||!e.currentResourceType||!e.registry)return;let n=Oj(e.fieldName);if(!n)return;let r=Xl.getForeignKeyCandidateReferencedTypes(n,e.currentResourceType,e.registry.resourceRelationships);if(r.length!==0)return Xl.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?Pe(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 Pw(e)}function Pj(e){if(e.schema&&gl(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!==it.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:W(`text-muted-foreground italic`,n),"aria-hidden":`true`,children:`—`}),(0,$.jsx)(`span`,{className:`sr-only`,children:e})]})}var Ij=new Set([B.NUMBER,B.BIGDECIMAL,B.MONEY,B.DURATION,B.DATE,B.TIME,B.DATETIME,B.RANGE_NUMBER,B.RANGE_BIGDECIMAL,B.RANGE_MONEY,B.RANGE_DATE,B.RANGE_TIME,B.RANGE_DATETIME]);function Lj(e){return e&&Ij.has(e)?ii.DATA:void 0}function Rj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_BOOLEAN,`DisplayFieldBoolean`)(e);return(0,$.jsx)(n,{...t})}function zj({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldDisplay_ResourceReference`,mc.DISPLAY)(e);return(0,$.jsx)(n,{...t})}function Bj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_STRING,`DisplayFieldString`)(e);return(0,$.jsx)(n,{...t})}function Vj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_NUMBER,`DisplayFieldNumber`)(e);return(0,$.jsx)(n,{...t})}function Hj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_ENUM,`DisplayFieldEnum`)(e);return(0,$.jsx)(n,{...t})}function Uj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_MONEY,`DisplayFieldMoney`)(e);return(0,$.jsx)(n,{...t})}function Wj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_DURATION,`DisplayFieldDuration`)(e);return(0,$.jsx)(n,{...t})}function Gj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_PHONE,`DisplayFieldPhone`)(e);return(0,$.jsx)(n,{...t})}function Kj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_ADDRESS,`DisplayFieldAddress`)(e);return(0,$.jsx)(n,{...t})}function qj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL,`DisplayFieldBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function Jj({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_CODE,`DisplayFieldCode`)(e);return(0,$.jsx)(n,{...t})}function Yj(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 Xj({value:e,maxHeight:t,...n}){let r=(0,Q.useMemo)(()=>{let t=Yj(e);return t?{content:t,language:`json`}:null},[e]);return(0,$.jsx)(Jj,{...n,value:r,maxHeight:t,wordWrap:!0})}var Zj=gu.APPROVAL_SEALS,Qj;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(Qj||={});var $j;(function(e){e.IDLE=`idle`,e.CHECKING=`checking`,e.DONE=`done`,e.FAILED=`failed`})($j||={});function eM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_APPROVAL_SEAL,`ApprovalSeal`)(e);return(0,$.jsx)(n,{...t})}function pfe(e){return typeof e==`string`&&e.length>0?e:void 0}var mfe=3e3,hfe=20;function gfe(e){return Ir(e)&&e.errorType===v.NOT_FOUND}function tM(e){let[t,n]=(0,Q.useState)({state:Qj.LOADING}),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)({state:$j.IDLE}),[s,c]=(0,Q.useState)(!1),l=e?.key;(0,Q.useEffect)(()=>{if(!e)return;let t=!0,r=0,a;n({state:Qj.LOADING}),i(!1),o({state:$j.IDLE});let s=()=>{Promise.resolve().then(e.load).then(i=>{t&&(n({state:Qj.READY,view:i}),e.pollWhilePending&&i.state===hu.PENDING&&r<hfe&&(r+=1,a=setTimeout(s,mfe)))}).catch(r=>{t&&(e.notFoundIsNone&&gfe(r)?i(!0):n({state:Qj.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:$j.CHECKING}),Tc().checkApprovalSeal(u).then(e=>o({state:$j.DONE,outcome:Pne(e)})).catch(()=>o({state:$j.FAILED})))},[u]),onDownloadManifestedCopy:(0,Q.useCallback)(()=>{e?.download&&(c(!0),e.download().then(t=>Fy(t,e.downloadName)).catch(()=>void 0).finally(()=>c(!1)))},[l]),downloading:s}}function nM({state:e,offersCopy:t=!0,movedFieldLabels:n,description:r,className:i}){let{tResourceFieldEnumValue:a}=J(),{read:o,check:s,onCheck:c,onDownloadManifestedCopy:l,downloading:u}=e,d=o.view,f=Vre.shape;return(0,$.jsx)(eM,{readState:o.state,...d?{view:d}:{},...n?{movedFieldLabels:n}:{},...r?{description:r}:{},...d?.meaning?{meaningLabel:a(Zj,`meaning`,d.meaning,f.meaning)}:{},...d?.outcome?{outcomeLabel:a(Zj,`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 _fe({field:e,hideWhenNone:t,className:n}){let{resourceType:r,resourceId:i}=dj(),a=ik(),o=a?.data,s=pfe(o?.[e]),c=vfe(o),l=s&&r&&i?{sealId:s,resourceType:String(r),resourceId:String(i),field:e}:void 0,u=tM(l?{key:`${l.sealId}|${l.resourceType}|${l.resourceId}|${e}|${c}`,load:()=>Tc().readApprovalSealOnRecord(l),download:()=>Tc().downloadApprovalSealManifestedCopy(l),downloadName:`approval-${l.sealId}.pdf`}:void 0);if(!o)return null;if(!l)return t||!r?null:(0,$.jsx)(eM,{readState:Qj.READY,view:{sealId:``,state:hu.NO_SEAL},...n?{className:n}:{}});let d=u.read.view?.currency?.movedFields.map(e=>a?.fieldLabels?.[e]??e);return(0,$.jsx)(nM,{state:u,...d?{movedFieldLabels:d}:{},...n?{className:n}:{}})}function vfe(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 rM({fileId:e,className:t}){let n=tM({key:e,load:()=>Tc().readApprovalSealOnFile(e),download:()=>Tc().downloadApprovalSealFileManifestedCopy(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0});return n.none||n.read.state===Qj.LOADING?null:(0,$.jsx)(nM,{state:n,...t?{className:t}:{}})}function iM({decisionRef:e,description:t,className:n}){let r=tM({key:e,load:()=>Tc().readApprovalSealOfDecision(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0,pollWhilePending:!0});return r.none?null:(0,$.jsx)(nM,{state:r,offersCopy:!1,...t?{description:t}:{},...n?{className:n}:{}})}function aM({preset:e=G.DEFAULT,...t}){let{httpClient:n}=Eu(),r=(0,Q.useMemo)(()=>({get:async e=>n.get(e),getBlob:(e,t)=>n.fetchFileBlob(e,t)}),[n]),i=q(U.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)(rM,{fileId:l})]})}function oM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL,`DisplayFieldRangeBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function sM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY,`DisplayFieldRangeMoney`)(e);return(0,$.jsx)(n,{...t})}function cM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_DATE,`DisplayFieldDate`)(e);return(0,$.jsx)(n,{...t})}function lM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_DATETIME,`DisplayFieldDateTime`)(e);return(0,$.jsx)(n,{...t})}function uM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_TIME,`DisplayFieldTime`)(e);return(0,$.jsx)(n,{...t})}function dM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER,`DisplayFieldRangeNumber`)(e);return(0,$.jsx)(n,{...t})}function fM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATE,`DisplayFieldRangeDate`)(e);return(0,$.jsx)(n,{...t})}function pM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATETIME,`DisplayFieldRangeDateTime`)(e);return(0,$.jsx)(n,{...t})}function mM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_RANGE_TIME,`DisplayFieldRangeTime`)(e);return(0,$.jsx)(n,{...t})}var hM=il.getLogger(),yfe=hM.debugByType(`DisplayValueDispatcher`);hM.setDebugTypeLogging(`DisplayValueDispatcher`,!1);function bfe(e){return e?[...e.parentRelationships??[],...e.childRelationships??[],...e.selfRelationships??[]]:[]}function gM(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 _M(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 bfe(e))try{let e=Xl.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)&&gM({record:o,resourceType:s,registry:r}))return o}catch{}}let a=wne.extractBaseName(i);if(!a||a===i)return null;let o=t[a];return o&&typeof o==`object`&&!Array.isArray(o)&&gM({record:o,resourceType:r.fieldIdentifierToResourceType?.[i],registry:r})?o:null}function vM(e){let t=e.value,n=t?.fileIds?.length??+!!t?.fileId;return n>0?(0,$.jsx)(Z,{className:e.className,children:e.tComponent(U.LOW_LEVEL_FORM_FIELD,`fileCount`,{count:n})}):(0,$.jsx)(Z,{className:W(`text-muted-foreground italic`,e.className),children:e.tComponent(U.LOW_LEVEL_FORM_FIELD,`noFile`)})}function yM(e){return typeof e?.getMetadata==`string`&&e.getMetadata.trim()!==``}var xfe=5;function bM(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)(mm,{className:`h-5 w-full`});default:return(0,$.jsx)(Fj,{noValueLabel:t,typography:Lj(n)})}}function xM({schema:e,schemaType:t,value:n,fieldName:r,label:i,className:a,enumLabels:o,displayComponent:s,parentData:c,resourceLinkTrail:l,renderItem:u,emptyValue:d,fileUploadContext:f,showAllArrayItems:p,onExpandArrayItems:m,showAllObjectFields:h,onExpandObjectFields:g}){let{tComponent:_,t:v,isReady:y}=J({component:[U.LOW_LEVEL_FORM_FIELD,U.LOW_LEVEL_BUTTON]}),b=Q.useContext(cm)?.registry,{resourceType:x}=dj(),{getRecipe:S}=Ig(),{renderIcon:C}=kf(),w=S(_t.INDICATOR,ao.ERROR),T=S(_t.TYPOGRAPHY,ii.LABEL),E=S(_t.TYPOGRAPHY,ii.BODY),D=S(_t.DIVIDER),O={schema:e,label:i,className:a,forceDisplayLabel:!1,forceDisplayDescription:!1,forceHideLabel:!0,forceHideDescription:!0},k=LA(),A=l?.resourceType,j=l?.pathPrefix,M=Q.useMemo(()=>Mj({fieldName:r,resourceLinkTrail:l,currentResourceType:x,registry:b}),[r,A,j,x,b]),N=M?.objectIdentity,P=Q.useMemo(()=>{if(N)return jj(n,N.relationshipIdentifierField)},[N,n]);if(!y)return null;if((l?.linkDepth??0)>=xfe)return(0,$.jsx)(Z,{className:`text-muted-foreground italic text-sm`,children:_(U.LOW_LEVEL_FORM_FIELD,`resourceLinkLimitReached`)});let F=t=>_(U.LOW_LEVEL_FORM_FIELD,ro[vt(e,t)]),I=t===B.UNKNOWN?one(n)??B.UNKNOWN:t;if(n==null||I===B.STRING&&n===``)return bM(d,F(!1),I);if(s){let t={schema:e,className:a};switch(s){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?mr.normalizeSchemaFieldPath(r):void 0,i=e&&f?.[e];return yM(i)?(0,$.jsx)(aM,{...t,fieldName:r,value:n,endpoints:{getMetadata:i.getMetadata,serve:i.serve}}):vM({value:n,className:t.className,tComponent:_})}case`date`:return(0,$.jsx)(cM,{...t,value:n});case`time`:return(0,$.jsx)(uM,{...t,value:n});case`datetime`:return(0,$.jsx)(lM,{...t,value:n});case`range-number`:return(0,$.jsx)(dM,{...t,value:n});case`range-date`:return(0,$.jsx)(fM,{...t,value:n});case`range-time`:return(0,$.jsx)(mM,{...t,value:n});case`range-datetime`:return(0,$.jsx)(pM,{...t,value:n});case`range-bigdecimal`:return(0,$.jsx)(oM,{...t,value:n});case`range-money`:return(0,$.jsx)(sM,{...t,value:n});case`simple-text`:break;default:yfe(`Unrecognized displayComponent — falling back to schema-type dispatch`,{displayComponent:s,fieldName:r})}}if(I===B.VERSIONED_FOREIGN_KEY){let t=_M(r,c,x,b);return(0,$.jsx)(zj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:ji(e,c),displayParams:aa(e),schema:e,className:a})}if(gl(e)){let t=_M(r,c,x,b),i=kj({schema:e,fieldName:r,parentData:c,currentResourceType:x,registry:b});return(0,$.jsx)(zj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:ji(e,c),resourceType:i,displayParams:aa(e),schema:e,className:a})}if(ka(e)&&n&&typeof n==`object`&&!Array.isArray(n)){let{resourceType:t,resourceId:i}=n;if(typeof t==`string`&&t!==``&&typeof i==`string`&&i!==``)return(0,$.jsx)(zj,{fieldName:r||``,value:i,resourceType:t,schema:e,className:a})}if(M&&M.semantics.nature!==it.COMPOSITION&&N)return(0,$.jsx)(zj,{fieldName:r||``,value:P??null,data:!Array.isArray(n)&&n&&typeof n==`object`?n:void 0,resourceType:M.relatedResourceType,className:a});let L=M&&r?{resourceType:M.relatedResourceType,pathPrefix:r,linkDepth:(l?.linkDepth??0)+1}:l;if(I===B.ARRAY&&Array.isArray(n)){if(n.length===0)return bM(d,F(!0));let t=Zt(e).element,s=t?Kt(t):B.UNKNOWN,c=lu(e),l=zA(c,k),f=l?.displayMode||`vertical`,h=n,g=l?.maxItems||void 0,v=g&&!p?h.slice(0,g):h,y=g?h.length-g:0;if(l?.listStyle===oc.CHIPS&&s===B.STRING&&!u)return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(U.LOW_LEVEL_FORM_FIELD,`list`),"data-list-style":`chips`,className:W(`flex flex-row flex-wrap gap-item`,a),children:[v.map((e,t)=>(0,$.jsx)(Nf,{role:`listitem`,variant:`secondary`,children:String(e)},t)),y>0&&!p&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,"aria-label":_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]});let b=c?.objectItemLayout??Eo.CARD,x=s===B.OBJECT&&t?jt(t):null,S=b===Eo.ROW&&!!x,C=s!==B.OBJECT&&!u&&f!==`horizontal`&&(l?.listStyle===void 0||l.listStyle===oc.PLAIN);return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(U.LOW_LEVEL_FORM_FIELD,`list`),"data-list-shape":C?`primitive`:void 0,className:W(S?`flex w-full min-w-0 flex-col gap-element`:f===`horizontal`||l?.listStyle===oc.CHIPS?`flex flex-row gap-element flex-wrap`:l?.listStyle===oc.SEPARATED?`flex flex-col divide-y divide-border`:s===B.OBJECT?`flex flex-col gap-field`:`flex flex-col gap-item-xs`,a),children:[u?v.map((n,i)=>{let a=u(r?`${r}[${i}]`:`[${i}]`,t??e);return(0,$.jsx)(`div`,{role:`listitem`,className:W(s===B.OBJECT&&`py-item-xs`,l?.listStyle===oc.SEPARATED&&`py-card-sm first:pt-0 last:pb-0`),children:a??(0,$.jsx)(SR,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:L})},i)}):S&&x?v.map((e,n)=>{let i=e&&typeof e==`object`?e:{},a=Vr(t),o=mr.getArrayItemPrimaryField(t).name,s=[...a.filter(e=>Kt(x[e])===B.BOOLEAN),...a.filter(e=>Kt(x[e])!==B.BOOLEAN)];return(0,$.jsx)(`div`,{role:`listitem`,className:`flex w-full min-w-0 items-center gap-element`,children:(0,$.jsx)(ok,{displayChromeMode:qc.COMPACT,sectionChromeMode:void 0,children:s.map(e=>(0,$.jsx)(SR,{schema:x[e],schemaType:Kt(x[e]),value:i[e],hideLabel:e===o,labelPlacement:e===o?void 0:`hidden`,name:r?`${r}[${n}].${e}`:void 0,className:W(`w-auto`,e===o?`min-w-0 flex-1 [overflow-wrap:anywhere]`:Kt(x[e])===B.STRING?`min-w-0 [overflow-wrap:anywhere]`:`shrink-0`),resourceLinkTrail:L},e))})},n)}):v.map((n,i)=>(0,$.jsx)(`div`,{role:`listitem`,className:W(l?.listStyle===oc.BULLETS&&s!==B.OBJECT&&f!==`horizontal`&&`ms-4 list-item list-disc marker:text-muted-foreground/60`,s===B.OBJECT&&!S&&f!==`horizontal`&&`py-item-xs`),children:(0,$.jsx)(SR,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:L})},i)),y>0&&!p&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,className:`self-start`,"aria-label":_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if((I===B.OBJECT||I===B.VERSIONED_OBJECT)&&typeof n==`object`){let t=jee(e,n),o=t??e,s=jt(o),c=Vr(o),l=(t?On(t):void 0)??On(e),u=l?.display?.displayMode||`vertical`,f=l?.display?.maxItems||void 0;if(!s||c.length===0)return bM(d,F(!0));let p=l?.display?.primaryField,m=p&&c.includes(p)?[p,...c.filter(e=>e!==p)]:c,v=f&&!h?m.slice(0,f):m,y=f?c.length-f:0,b=p&&c.includes(p)?v.filter(e=>e!==p&&wu(s[e])?.chromeMode===qc.COMPACT):[];return(0,$.jsxs)(`div`,{role:`group`,"aria-label":i||r||_(U.LOW_LEVEL_FORM_FIELD,`object`),className:W(`ps-card relative`,u===`horizontal`?`flex flex-row gap-field flex-wrap`:`flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:W(`absolute start-0 top-0 bottom-0 w-0.5`,D.base),"aria-hidden":`true`}),(0,$.jsx)(ck,{children:v.map(e=>{let t=s[e],i=Kt(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)(SR,{schema:t,schemaType:i,value:a,name:o,hideLabel:!0,parentData:n,resourceLinkTrail:L})}),b.map(e=>(0,$.jsx)(SR,{schema:s[e],schemaType:Kt(s[e]),value:n[e],name:r?`${r}.${e}`:e,parentData:n,resourceLinkTrail:L},e))]},e):(0,$.jsx)(SR,{schema:t,schemaType:i,value:a,name:o,className:u===`horizontal`?`w-auto`:void 0,parentData:n,resourceLinkTrail:L},e)})}),y>0&&!h&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,className:`self-start`,"aria-label":_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:g,children:_(U.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if(I===B.BOOLEAN)return(0,$.jsx)(Rj,{...O,value:n});if(I===B.ENUM)return(0,$.jsx)(Hj,{...O,value:n,labels:o});if(I===B.STRING)return(0,$.jsx)(Bj,{...O,value:n});if(I===B.NUMBER||I===B.BIGINT)return(0,$.jsx)(Vj,{...O,value:n});if(I===B.MONEY)return(0,$.jsx)(Uj,{...O,value:n});if(I===B.DURATION)return(0,$.jsx)(Wj,{...O,value:n});if(I===B.PHONE)return(0,$.jsx)(Gj,{...O,value:n});if(I===B.ADDRESS)return(0,$.jsx)(Kj,{...O,value:n});if(I===B.BIGDECIMAL)return(0,$.jsx)(qj,{...O,value:n});if(I===B.CODE)return(0,$.jsx)(Jj,{...O,value:n});if(I===B.FILE){let e=r?mr.normalizeSchemaFieldPath(r):void 0,t=e&&f?.[e];return yM(t)?(0,$.jsx)(aM,{...O,fieldName:r,value:n,endpoints:{getMetadata:t.getMetadata,serve:t.serve}}):vM({value:n,className:a,tComponent:_})}if(I===B.RANGE_BIGDECIMAL)return(0,$.jsx)(oM,{...O,value:n});if(I===B.RANGE_MONEY)return(0,$.jsx)(sM,{...O,value:n});if(I===B.DATE)return(0,$.jsx)(cM,{...O,value:n});if(I===B.DATETIME)return(0,$.jsx)(lM,{...O,value:n});if(I===B.TIME)return(0,$.jsx)(uM,{...O,value:n});if(I===B.RANGE_NUMBER)return(0,$.jsx)(dM,{...O,value:n});if(I===B.RANGE_DATE)return(0,$.jsx)(fM,{...O,value:n});if(I===B.RANGE_DATETIME)return(0,$.jsx)(pM,{...O,value:n});if(I===B.RANGE_TIME)return(0,$.jsx)(mM,{...O,value:n});if(I===B.RECORD&&typeof n==`object`&&n){let t=Object.entries(n);if(t.length===0)return bM(d,F(!0));let i=fa(e),o=cn(e),s=o?mo(o):void 0,c=e=>{if(!s)return e;let t=hl(s,e),n=v(t);return n===t?e:n};return(0,$.jsxs)(`div`,{className:W(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:W(`absolute start-0 top-0 bottom-0 w-0.5`,D.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:W(T.base,`shrink-0`),children:c(e)}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(SR,{schema:i??void 0,schemaType:i?Kt(i):void 0,value:t,name:r?`${r}.${e}`:e,hideLabel:!0,parentData:n,resourceLinkTrail:L})})]},e))]})}if(I===B.SET&&(n instanceof Set||Array.isArray(n))){let t=Array.from(n);if(t.length===0)return bM(d,F(!0));let i=eee(e);return(0,$.jsx)(`div`,{className:W(`flex flex-col gap-element-xs`,a),children:t.map((e,t)=>(0,$.jsx)(SR,{schema:i??void 0,schemaType:i?Kt(i):void 0,value:e,name:r?`${r}.${t}`:String(t),hideLabel:!0,resourceLinkTrail:L},`${r??`set`}-${t}`))})}if(I===B.TUPLE&&Array.isArray(n)){if(n.length===0)return bM(d,F(!0));let t=Vee(e);return(0,$.jsx)(`div`,{className:W(`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)(SR,{schema:i??void 0,schemaType:i?Kt(i):void 0,value:e,name:r?`${r}.${n}`:String(n),hideLabel:!0,resourceLinkTrail:L})},`${r??`tuple`}-${n}`)})})}if(I===B.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 bM(d,F(!0));let i=Ze(e);return(0,$.jsxs)(`div`,{className:W(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:W(`absolute start-0 top-0 bottom-0 w-0.5`,D.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:W(T.base,`shrink-0`),children:(0,$.jsx)(SR,{schema:i?.keySchema??void 0,schemaType:i?.keySchema?Kt(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)(SR,{schema:i?.valueSchema??void 0,schemaType:i?.valueSchema?Kt(i.valueSchema):void 0,value:t,name:r?`${r}.${n}.value`:`${n}.value`,hideLabel:!0,resourceLinkTrail:L})})]},`${r??`map`}-${n}`))]})}return I===B.UNKNOWN?(0,$.jsx)(Xj,{...O,value:n}):(0,$.jsxs)(`div`,{className:W(E.base,E.sizes?.sm||E.sizes?.md,w.base,`flex items-center gap-element px-card-sm py-item-xs rounded-md`,a),children:[(0,$.jsx)(Z,{className:T.base,children:_(U.LOW_LEVEL_FORM_FIELD,`unsupportedDisplayType`)}),(0,$.jsx)(u_,{className:W(`px-item-xs rounded`,w.states.hover),children:I})]})}xM.displayName=`DisplayValueDispatcher`;function SM(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)(xM,{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)})})}SM.displayName=`DisplayFieldReadOnly`;function CM(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:y}=e,{getRecipe:b}=Ig(),x=b(_t.TYPOGRAPHY,ii.EYEBROW),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{E.current!==r&&(C(!1),T(!1),E.current=r)},[r]);let D=h===`hidden`;return(0,$.jsxs)(CT,{appearance:y,className:f,"data-field":i,children:[a!=null&&!p&&D&&(0,$.jsx)(TT,{className:`sr-only`,children:a}),a!=null&&!p&&!D&&(g===vo.TITLE?(0,$.jsx)(`div`,{className:W(`pt-item-xs`,x.base),children:a}):(0,$.jsx)(TT,{children:a})),o!=null&&!m&&(0,$.jsx)(lx,{children:o}),(0,$.jsx)(xM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:_,fileUploadContext:v,showAllArrayItems:S,onExpandArrayItems:()=>C(!0),showAllObjectFields:w,onExpandObjectFields:()=>T(!0)})]})}CM.displayName=`DisplayFieldReadOnlyArraySection`;function wM(e){return e.replace(/\[(\d+)\]/g,`.$1`)}function TM(e,t){let n=wM(e),r=wM(t);return r===n||r.startsWith(n+`.`)}function EM(e,t){return TM(e,t)||TM(t,e)}function DM(e,t){return t?wM(t).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}var OM=()=>()=>{},Sfe={lastEvent:null},kM=()=>Sfe,AM=il.getLogger(),jM=AM.debugByType(`FormErrorExtraction`);AM.setDebugTypeLogging(`FormErrorExtraction`,!1);function MM(e){if(!e||typeof e!=`object`)return jM(`extractServerValidationErrors: not an object, skipping`,{errorType:typeof e}),null;let t=e;if(t.customMessageReference===rs.VERSION_CONFLICT)return jM(`extractServerValidationErrors: version conflict, not a validation error`),null;jM(`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(NM(n)&&Cfe(r))return jM(`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(NM(e)&&t){let n=Lre(t);if(n&&Object.keys(n).length>0)return jM(`extractServerValidationErrors: MATCHED via raw response`,{httpStatus:e,fieldCount:Object.keys(n).length,fields:Object.keys(n)}),{httpStatus:e,validationErrors:n}}}return jM(`extractServerValidationErrors: NO validation errors found`),null}function NM(e){return e===400||e===409||e===422}function Cfe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}var wfe=Object.freeze([]);function Tfe(e){let{declaration:t,record:n,appConfig:r,fieldName:i}=e,a=t?.readsFields??wfe,o=IC({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=Efe(t?.readsReferences);return(0,Q.useMemo)(()=>t?mu(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)):Wre,[t,r,n,c,l,i])}function Efe(e){let t=(0,Q.useMemo)(()=>Object.keys(e??{}),[e]),n=IC({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}=pm(),{t:o,formatDate:s,formatDateTime:c}=J({}),l=FD(),u=iC(),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=Kl(i.registry.resourceConfigurations?.[t]?.operations??[],K.READ)??null;Iw({resourceType:t,id:n,registry:i.registry,doOperation:i.doOperation,contextualParameters:Bm({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 PM=(0,Q.createContext)(null);function FM(e){let t=(0,Q.useContext)(PM);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[e,t])}var IM=il.getLogger(),LM=IM.debugByType(`FieldUniquenessValidation`);IM.setDebugTypeLogging(`FieldUniquenessValidation`,!1);function Dfe({fieldName:e,fieldSchema:t}){let n=FD(),r=BC(),{httpClient:i}=Eu(),{tErrorValidation:a}=J(),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=t?be(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}LM(`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 LM(`Uniqueness check response`,{fieldName:e,valid:o.valid,error:o.error}),!o.valid&&o.error?(r.setError(e,{type:nT,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`){LM(`Uniqueness check aborted (superseded)`,{fieldName:e});return}IM.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 Ofe(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function RM(e){let t=BC(),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&&Ofe(a)?(t.setValue(e,a,{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),!0):(r(),!1)},[t,e]),noteInputReceived:(0,Q.useCallback)(()=>{n.current=!0},[])}}var zM=(0,Q.createContext)({}),BM=(0,Q.createContext)(void 0);function VM({invalid:e,describedBy:t,labelId:n,children:r}){let i=t.filter(Boolean).join(` `),a=(0,Q.useMemo)(()=>({...e?{"aria-invalid":!0}:{},...i?{"aria-describedby":i}:{}}),[e,i]);return(0,$.jsx)(zM.Provider,{value:a,children:(0,$.jsx)(BM.Provider,{value:n,children:r})})}function HM(){return(0,Q.useContext)(zM)}function UM(){return(0,Q.useContext)(BM)}function WM({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AUTOSAVE_INDICATOR,`AutosaveIndicator`)(e);return(0,$.jsx)(n,{...t})}function GM(e,t){let{saveState:n,saveErrorMessage:r,onRetrySave:i,variant:a=`block`}=t;return!n||n===Qw.IDLE?e:a===`inline`?(0,$.jsxs)(`div`,{className:`relative inline-flex`,children:[e,(0,$.jsx)(WM,{state:n,errorMessage:r,onRetry:i,position:`inline`,className:`ml-element`})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[e,(0,$.jsx)(WM,{state:n,errorMessage:r,onRetry:i,position:`absolute-right`,className:i?void 0:`pointer-events-none`})]})}function KM(e,t,n){return e==null?$u.STACKED:typeof e==`string`?e:e[t]??e[yi.DESKTOP]??$u.STACKED}function qM({text:e}){let{renderIcon:t}=kf(),{tComponent:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(U.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:Jn.XS})})}),(0,$.jsx)(rj,{children:e})]}):null}function JM({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}=Ig(),x=(0,Q.useMemo)(()=>KM(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===$u.INLINE?`inline`:`top`),D=!o&&!!t&&E!==`hidden`&&x!==$u.COMPACT&&x!==$u.HIDDEN,O=!s&&!!n&&x!==$u.COMPACT&&x!==$u.HIDDEN,k=!c&&!!r&&x!==$u.HIDDEN,A=!o&&t&&E===`hidden`?(0,$.jsx)(ox,{id:T,htmlFor:S,className:`sr-only`,children:t}):null,j=E===`start`||E===`inline`?`inline`:`block`,M=GM((0,$.jsx)(VM,{invalid:!!r,describedBy:[O?C:void 0,k?w:void 0],labelId:D||A?T:void 0,children:(0,$.jsx)(kE,{fieldName:p,label:t,disabled:m,onSaveFieldNow:f,children:v})}),{saveState:l,saveErrorMessage:u,onRetrySave:d,variant:j});if(x===$u.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[A,M]});if(x===$u.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)(ux,{id:w,children:r})]});if(E===`start`||E===`inline`){let e=(0,$.jsxs)(cx,{children:[D&&(0,$.jsx)(sx,{children:(0,$.jsxs)(ox,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(qM,{text:h})]})}),O&&(0,$.jsx)(lx,{id:C,children:n}),k&&(0,$.jsx)(ux,{id:w,children:r})]});return(0,$.jsxs)(ax,{orientation:ix.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===$u.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:W(`flex flex-col gap-field`,_),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:W(`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)(qM,{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===$u.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:W(`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`:W(`flex-row gap-section`,O?`items-start`:`items-center has-[textarea]:items-start`),_),children:[(0,$.jsxs)(`div`,{className:W(`flex min-w-0 flex-col gap-element-xs`,!e&&`flex-1`),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:W(`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)(qM,{text:h})]}),O&&(0,$.jsx)(lx,{id:C,children:n})]}),(0,$.jsxs)(`div`,{className:W(`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)(ux,{id:w,children:r})]})]})}return(0,$.jsxs)(ax,{orientation:ix.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)(ox,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(qM,{text:h})]}),M,O&&(0,$.jsx)(lx,{id:C,children:n}),k&&(0,$.jsx)(ux,{id:w,children:r})]})}JM.displayName=`FormFieldChrome`;var YM=rc(U.LOW_LEVEL_SLIDER,`Slider`,[`Root`]),kfe=Fl(U.LOW_LEVEL_RANGE_SLIDER,`RangeSlider`),XM=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=YM(e);return(0,$.jsx)(r,{...t,ref:n})});XM.displayName=`Slider`;var ZM=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=YM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});ZM.displayName=`SliderRoot`;var QM=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=kfe(e);return(0,$.jsx)(r,{...t,ref:n})});QM.displayName=`RangeSlider`;var $M=rc(U.LOW_LEVEL_INPUT,`Input`,[`Root`]),eN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$M(e);return(0,$.jsx)(r,{...t,ref:n})});eN.displayName=`Input`;var tN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$M(e);return(0,$.jsx)(r.Root,{...t,ref:n})});tN.displayName=`InputRoot`;var nN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_DATEPICKER,`DatePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});nN.displayName=`DatePicker`;var rN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_DATE}),i=n?.dateFormat;return(0,$.jsx)(nN,{ref:t,...e,dateFormat:i,calendarDate:e.schema?Hl(e.schema):!1,timeZone:n?.timezone})}),iN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_DATE,`FormFieldDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});iN.displayName=`FormFieldDate`;var aN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_DATETIME_PICKER,`DateTimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});aN.displayName=`DateTimePicker`;var oN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_DATETIME});return(0,$.jsx)(aN,{ref:t,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone})}),sN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_DATETIME,`FormFieldDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});sN.displayName=`FormFieldDateTime`;var cN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_TIMEPICKER,`TimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});cN.displayName=`TimePicker`;var lN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_TIME});return(0,$.jsx)(cN,{ref:t,...e,timeFormat:n?.timeFormat})}),uN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_TIME,`FormFieldTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});uN.displayName=`FormFieldTime`;var dN=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=Jd.MD},y)=>{let{tComponent:b,isReady:x}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER}),S=he(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=C_(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`,L=`${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)(tN,{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:L,className:`sr-only`,children:f}),(0,$.jsx)(tN,{id:L,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(U.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),fN=Q.forwardRef(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,`FormFieldRangeNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});fN.displayName=`FormFieldRangeNumber`;var pN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_DATE_RANGE_PICKER,`DateRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});pN.displayName=`DateRangePicker`;var mN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_DATE}),i=e.schema?he(e.schema):void 0,a=e.minDate??fi(i?.min),o=e.maxDate??fi(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,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=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_DATE,`FormFieldRangeDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});hN.displayName=`FormFieldRangeDate`;var gN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_DATETIME_RANGE_PICKER,`DateTimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});gN.displayName=`DateTimeRangePicker`;var _N=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME}),i=e.schema?he(e.schema):void 0,a=e.minDate??fi(i?.min),o=e.maxDate??fi(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(gN,{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})}),vN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,`FormFieldRangeDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});vN.displayName=`FormFieldRangeDateTime`;var yN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_TIME_RANGE_PICKER,`TimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});yN.displayName=`TimeRangePicker`;var bN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_TIME});return(0,$.jsx)(yN,{ref:t,schema:e.schema,name:e.name,...e,timeFormat:n?.timeFormat})}),xN=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_TIME,`FormFieldRangeTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});xN.displayName=`FormFieldRangeTime`;function SN({name:e,schema:t,label:n,hideLabel:r,description:i,disabled:a,className:o,renderField:s,fieldLabels:c={},excludedChildKeys:l}){let u=jt(t),d=Vr(t),f=PT();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)(CT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(SD,{children:(0,$.jsx)(TT,{children:n})}),i&&(0,$.jsx)(lx,{children:i}),(0,$.jsx)(wT,{children:m.map(t=>(0,$.jsx)(Q.Fragment,{children:s(`${e}.${t}`,u[t])},t))})]}):(0,$.jsxs)(CT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(SD,{children:(0,$.jsx)(TT,{children:n})}),i&&(0,$.jsx)(lx,{children:i}),(0,$.jsx)(wT,{children:m.map(t=>{let n=u[t],r=`${e}.${t}`,i=c[t]??f?.fieldLabels?.[mr.labelDictionaryPath(r)]??mr.unresolvedFieldLabel(t);return(0,$.jsx)($L,{name:r,schema:n,label:i,disabled:a},t)})})]})}SN.displayName=`FormFieldComposite`;var CN=SN,Afe=0;function wN(){return`kv-${++Afe}-${Date.now()}`}function jfe(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e])=>({id:wN(),key:e,pendingValue:void 0}))}function Mfe(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 Nfe({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}=Ig(),m=p(_t.TYPOGRAPHY,ii.DESCRIPTION),{formChromeMode:h,sectionChromeMode:g}=Xw(),_=Sc(),v=g??h??KL(_.autoRender?.autoFieldChrome),y=qL(_.autoRender?.autoLabelPlacement),b=JL(_.autoRender?.autoFieldDensity),x=_.autoRender?.autoErrorPlacement===`summary-at-surface-top`,S=(0,Q.useCallback)(t=>{s(e.id,t)},[e.id,s]),C=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:Y.GHOST,size:Gd.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:Jn.SM})}),(0,$.jsxs)(`div`,{className:`pt-item space-y-field`,children:[(0,$.jsx)(JM,{mode:v,label:l,error:o,labelPlacement:y,hideError:x,fieldName:`${r}.__key_${e.id}`,disabled:i,children:(0,$.jsx)(eN,{schema:gd(),name:`${r}.__key_${e.id}`,value:e.key,onChange:e=>S(String(e)),disabled:i,controlSize:b})}),C?(0,$.jsx)($L,{name:`${r}.${e.key}`,schema:n,label:u,disabled:i}):(0,$.jsx)(`p`,{className:W(m.base,`py-card-sm px-card-sm rounded-md border border-dashed border-border`),children:d})]})]})}function TN({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}=BC(),{renderIcon:h}=kf(),g=TE(),_=g!==null&&DE(id(t)?.autosave,g.config.defaultTrigger,!0)!==ll.NONE?g:null,{tComponent:v,isReady:y,resolvedRegionalPreferences:b}=J({component:U.LOW_LEVEL_FORM_MESSAGE}),x=b?.timezone,{getRecipe:S}=Ig(),C=S(_t.TYPOGRAPHY,ii.DESCRIPTION),w=v(U.LOW_LEVEL_FORM_MESSAGE,`recordAddEntry`),T=v(U.LOW_LEVEL_FORM_MESSAGE,`recordKeyLabel`),E=v(U.LOW_LEVEL_FORM_MESSAGE,`recordValueLabel`),D=v(U.LOW_LEVEL_FORM_MESSAGE,`recordEmptyMessage`),O=v(U.LOW_LEVEL_FORM_MESSAGE,`recordDuplicateKey`),k=v(U.LOW_LEVEL_FORM_MESSAGE,`recordEnterKeyFirst`),A=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>()=>{A.current=!1},[]);let[j,M]=(0,Q.useState)(()=>jfe(l(e))),N=(0,Q.useMemo)(()=>{let e=new Map;for(let t of j){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},[j]);(0,Q.useEffect)(()=>{N.size>0?d(e,{type:iT,message:O}):p(e,m).error?.type===`record-duplicate-key`&&f(e)},[N,e,d,f,p,m,O]);let P=(0,Q.useCallback)((t,n)=>{let r=Mfe(t,e,l,n);c(e,r,{shouldDirty:!0,shouldValidate:!0}),_&&_.triggerSave(e,r,ll.DEBOUNCE),setTimeout(()=>{A.current&&u(e)},0)},[e,c,l,u,_]),F=(0,Q.useCallback)((t,n)=>{M(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 P(s,new Map([[t,o]])),s})},[e,l,P]),I=(0,Q.useCallback)(()=>{if(i)return;let e={id:wN(),key:``,pendingValue:mr.getDefaultValueForSchema(o,{timeZone:x})};M(t=>[...t,e])},[i,o,x]),L=(0,Q.useCallback)(e=>{i||M(t=>{let n=t.filter(t=>t.id!==e);return P(n),n})},[i,P]);return y?(0,$.jsxs)(CT,{disabled:i,className:a,"data-field":e,"data-testid":`field-record-${e}`,children:[(0,$.jsx)(SD,{children:(0,$.jsx)(TT,{children:n})}),r&&(0,$.jsx)(lx,{children:r}),(0,$.jsxs)(wT,{className:`space-y-field`,children:[j.map((t,n)=>{let r=t.key.trim(),a=r!==``&&N.has(r)?O:void 0;return(0,$.jsx)(Nfe,{entry:t,index:n,valueSchema:o,parentName:e,disabled:i,canRemove:!i,keyError:a,onKeyChange:F,onRemove:L,keyLabel:T,valueLabel:E,emptyKeyPlaceholder:k,renderIcon:h},t.id)}),(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,onClick:I,disabled:i,className:`w-full`,children:[h(H.PLUS,{size:Jn.SM,className:`me-element`}),w]}),j.length===0&&(0,$.jsx)(`p`,{className:W(C.base,`text-center py-card`),children:D})]})]}):null}TN.displayName=`FormFieldRecord`;var EN=TN,DN=e(i());function Pfe(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var ON=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function kN(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function AN(e){return`nodeType`in e}function jN(e){return e?kN(e)?e:AN(e)?e.ownerDocument?.defaultView??window:window:window}function MN(e){let{Document:t}=jN(e);return e instanceof t}function NN(e){return!kN(e)&&e instanceof jN(e).HTMLElement}function PN(e){return e instanceof jN(e).SVGElement}function FN(e){return e?kN(e)?e.document:AN(e)?MN(e)?e:NN(e)||PN(e)?e.ownerDocument:document:document:document}var IN=ON?Q.useLayoutEffect:Q.useEffect;function LN(e){let t=(0,Q.useRef)(e);return IN(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ffe(){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 RN(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return IN(()=>{n.current!==e&&(n.current=e)},t),n}function zN(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function BN(e){let t=LN(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function VN(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var HN={};function UN(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=HN[e]==null?0:HN[e]+1;return HN[e]=n,e+`-`+n},[e,t])}function WN(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 GN=WN(1),KN=WN(-1);function Ife(e){return`clientX`in e&&`clientY`in e}function qN(e){if(!e)return!1;let{KeyboardEvent:t}=jN(e.target);return t&&e instanceof t}function Lfe(e){if(!e)return!1;let{TouchEvent:t}=jN(e.target);return t&&e instanceof t}function JN(e){if(Lfe(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 Ife(e)?{x:e.clientX,y:e.clientY}:null}var YN=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[YN.Translate.toString(e),YN.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),XN=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Rfe(e){return e.matches(XN)?e:e.querySelector(XN)}var zfe={display:`none`};function Bfe(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:zfe},n)}function Vfe(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 Hfe(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ZN=(0,Q.createContext)(null);function Ufe(e){let t=(0,Q.useContext)(ZN);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Wfe(){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 Gfe={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
- `},Kfe={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 qfe(e){let{announcements:t=Kfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Gfe}=e,{announce:a,announcement:o}=Hfe(),s=UN(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),Ufe((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(Bfe,{id:r,value:i.draggable}),Q.createElement(Vfe,{id:s,announcement:o}));return n?(0,DN.createPortal)(u,n):u}var QN;(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`})(QN||={});function $N(){}function eP(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function tP(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var nP=Object.freeze({x:0,y:0});function rP(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function iP(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jfe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function aP(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 oP(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function sP(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 cP=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=sP(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=rP(sP(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(iP)},Yfe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=aP(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=aP(r),o=i.reduce((e,t,r)=>e+rP(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(iP)};function Xfe(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 Zfe=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=Xfe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Jfe)};function Qfe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lP(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:nP}function $fe(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 epe=$fe(1);function tpe(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 npe(e,t,n){let r=tpe(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 rpe={ignoreTransform:!1};function uP(e,t){t===void 0&&(t=rpe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=jN(e).getComputedStyle(e);t&&(n=npe(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 dP(e){return uP(e,{ignoreTransform:!0})}function ipe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ape(e,t){return t===void 0&&(t=jN(e).getComputedStyle(e)),t.position===`fixed`}function ope(e,t){t===void 0&&(t=jN(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 fP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(MN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!NN(i)||PN(i)||n.includes(i))return n;let a=jN(e).getComputedStyle(i);return i!==e&&ope(i,a)&&n.push(i),ape(i,a)?n:r(i.parentNode)}return e?r(e):n}function pP(e){let[t]=fP(e,1);return t??null}function mP(e){return!ON||!e?null:kN(e)?e:AN(e)?MN(e)||e===FN(e).scrollingElement?window:NN(e)?e:null:null}function hP(e){return kN(e)?e.scrollX:e.scrollLeft}function gP(e){return kN(e)?e.scrollY:e.scrollTop}function _P(e){return{x:hP(e),y:gP(e)}}var vP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(vP||={});function yP(e){return!ON||!e?!1:e===document.scrollingElement}function bP(e){let t={x:0,y:0},n=yP(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 spe={x:.2,y:.2};function cpe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=spe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bP(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=vP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=vP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=vP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=vP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function lpe(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 xP(e){return e.reduce((e,t)=>GN(e,_P(t)),nP)}function upe(e){return e.reduce((e,t)=>e+hP(t),0)}function dpe(e){return e.reduce((e,t)=>e+gP(t),0)}function fpe(e,t){if(t===void 0&&(t=uP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);pP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ppe=[[`x`,[`left`,`right`],upe],[`y`,[`top`,`bottom`],dpe]],SP=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=fP(t),r=xP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ppe)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})}},CP=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 mpe(e){let{EventTarget:t}=jN(e);return e instanceof t?e:FN(e)}function wP(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 TP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(TP||={});function EP(e){e.preventDefault()}function hpe(e){e.stopPropagation()}var DP;(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`})(DP||={});var OP={start:[DP.Space,DP.Enter],cancel:[DP.Esc],end:[DP.Space,DP.Enter,DP.Tab]},gpe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case DP.Right:return{...n,x:n.x+25};case DP.Left:return{...n,x:n.x-25};case DP.Down:return{...n,y:n.y+25};case DP.Up:return{...n,y:n.y-25}}},kP=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 CP(FN(t)),this.windowListeners=new CP(jN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(TP.Resize,this.handleCancel),this.windowListeners.add(TP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(TP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&fpe(n),t(nP)}handleKeyDown(e){if(qN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=OP,coordinateGetter:a=gpe,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}:nP;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=KN(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}=bP(n),p=lpe(n),m={x:Math.min(i===DP.Right?p.right-p.width/2:p.right,Math.max(i===DP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===DP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===DP.Down?p.top:p.top+p.height/2,u.y))},h=i===DP.Right&&!s||i===DP.Left&&!c,g=i===DP.Down&&!l||i===DP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===DP.Right&&e<=d.x||i===DP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===DP.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===DP.Down&&e<=d.y||i===DP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===DP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,GN(KN(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()}};kP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=OP,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 AP(e){return!!(e&&`distance`in e)}function jP(e){return!!(e&&`delay`in e)}var MP=class{constructor(e,t,n){n===void 0&&(n=mpe(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=FN(i),this.documentListeners=new CP(this.document),this.listeners=new CP(n),this.windowListeners=new CP(jN(i)),this.initialCoordinates=JN(r)??nP,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(TP.Resize,this.handleCancel),this.windowListeners.add(TP.DragStart,EP),this.windowListeners.add(TP.VisibilityChange,this.handleCancel),this.windowListeners.add(TP.ContextMenu,EP),this.documentListeners.add(TP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(AP(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(TP.Click,hpe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(TP.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=JN(e)??nP,s=KN(n,o);if(!t&&a){if(AP(a)){if(a.tolerance!=null&&wP(s,a.tolerance))return this.handleCancel();if(wP(s,a.distance))return this.handleStart()}if(jP(a)&&wP(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===DP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},_pe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},NP=class extends MP{constructor(e){let{event:t}=e,n=FN(t.target);super(e,_pe,n)}};NP.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 vpe={move:{name:`mousemove`},end:{name:`mouseup`}},PP;(function(e){e[e.RightClick=2]=`RightClick`})(PP||={});var ype=class extends MP{constructor(e){super(e,vpe,FN(e.event.target))}};ype.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==PP.RightClick&&(r?.({event:n}),!0)}}];var FP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},bpe=class extends MP{constructor(e){super(e,FP)}static setup(){return window.addEventListener(FP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(FP.move.name,e)};function e(){}}};bpe.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 IP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(IP||={});var LP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(LP||={});function xpe(e){let{acceleration:t,activator:n=IP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=LP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Cpe({delta:d,disabled:!a}),[m,h]=Ffe(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case IP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case IP.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===LP.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}=cpe(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 Spe={x:{[vP.Backward]:!1,[vP.Forward]:!1},y:{[vP.Backward]:!1,[vP.Forward]:!1}};function Cpe(e){let{delta:t,disabled:n}=e,r=VN(t);return zN(e=>{if(n||!r||!e)return Spe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[vP.Backward]:e.x[vP.Backward]||i.x===-1,[vP.Forward]:e.x[vP.Forward]||i.x===1},y:{[vP.Backward]:e.y[vP.Backward]||i.y===-1,[vP.Forward]:e.y[vP.Forward]||i.y===1}}},[n,t,r])}function wpe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return zN(e=>t==null?null:r??e??null,[r,t])}function Tpe(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 RP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(RP||={});var zP;(function(e){e.Optimized=`optimized`})(zP||={});var BP=new Map;function Epe(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=RN(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=zN(t=>{if(d&&!n)return BP;if(!t||t===BP||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 SP(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 RP.Always:return!1;case RP.BeforeDragging:return n;default:return!n}}}function VP(e,t){return zN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Dpe(e,t){return VP(e,t)}function Ope(e){let{callback:t,disabled:n}=e,r=LN(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 HP(e){let{callback:t,disabled:n}=e,r=LN(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 kpe(e){return new SP(uP(e),e)}function UP(e,t,n){t===void 0&&(t=kpe);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=Ope({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=HP({callback:a});return IN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Ape(e){return lP(e,VP(e))}var WP=[];function jpe(e){let t=(0,Q.useRef)(e),n=zN(n=>e?n&&n!==WP&&e&&t.current&&e.parentNode===t.current.parentNode?n:fP(e):WP,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function Mpe(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=mP(e.target);t&&n(e=>e?(e.set(t,_P(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=mP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,_P(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=>{mP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>GN(e,t),nP):xP(e):nP,[e,t])}function GP(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!==nP;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?KN(e,n.current):nP}function Npe(e){(0,Q.useEffect)(()=>{if(!ON)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 Ppe(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 KP(e){return(0,Q.useMemo)(()=>e?ipe(e):null,[e])}var qP=[];function Fpe(e,t){t===void 0&&(t=uP);let[n]=e,r=KP(n?jN(n):null),[i,a]=(0,Q.useState)(qP);function o(){a(()=>e.length?e.map(e=>yP(e)?r:new SP(t(e),e)):qP)}let s=HP({callback:o});return IN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ipe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return NN(t)?t:e}function Lpe(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=HP({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(NN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=BN((0,Q.useCallback)(e=>{let n=Ipe(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 Rpe=[{sensor:NP,options:{}},{sensor:kP,options:{}}],zpe={current:{}},JP={draggable:{measure:dP},droppable:{measure:dP,strategy:RP.WhileDragging,frequency:zP.Optimized},dragOverlay:{measure:uP}},YP=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}},Bpe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new YP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$N},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:JP,measureDroppableContainers:$N,windowRect:null,measuringScheduled:!1},Vpe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:$N,draggableNodes:new Map,over:null,measureDroppableContainers:$N},XP=(0,Q.createContext)(Vpe),ZP=(0,Q.createContext)(Bpe);function Hpe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new YP}}}function Upe(e,t){switch(t.type){case QN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case QN.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 QN.DragEnd:case QN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case QN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new YP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case QN.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 YP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case QN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new YP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Wpe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(XP),a=VN(r),o=VN(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!qN(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=Rfe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Gpe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Kpe(e){return(0,Q.useMemo)(()=>({draggable:{...JP.draggable,...e?.draggable},droppable:{...JP.droppable,...e?.droppable},dragOverlay:{...JP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function qpe(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;IN(()=>{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=lP(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=pP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var QP=(0,Q.createContext)({...nP,scaleX:1,scaleY:1}),$P;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($P||={});var eF=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Rpe,collisionDetection:o=Zfe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(Upe,void 0,Hpe),[f,p]=Wfe(),[m,h]=(0,Q.useState)($P.Uninitialized),g=m===$P.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??zpe,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=RN(l,Object.values(l)),A=UN(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=Kpe(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Epe(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=wpe(v,_),L=(0,Q.useMemo)(()=>D?JN(D):null,[D]),ee=Oe(),R=Dpe(I,M.draggable.measure);qpe({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let z=UP(I,M.draggable.measure,R),te=UP(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=Lpe({measure:M.dragOverlay.measure}),ae=ie.nodeRef.current??I,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=Ape(se?null:z),le=KP(ae?jN(ae):null),ue=jpe(g?re??I:null),de=Fpe(ue),fe=Gpe(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=L?GN(L,y):null,me=Mpe(ue),he=GP(me),ge=GP(me,[z]),_e=GN(fe,he),ve=oe?epe(oe,fe):null,ye=C&&ve?o({active:C,collisionRect:ve,droppableRects:N,droppableContainers:j,pointerCoordinates:pe}):null,B=oP(ye,`id`),[be,xe]=(0,Q.useState)(null),Se=Qfe(se?fe:GN(fe,ge),be?.rect??null,z),Ce=(0,Q.useRef)(null),we=(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,DN.unstable_batchedUpdates)(()=>{r?.(i),h($P.Initializing),d({type:QN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ce.current),O(a)})},onMove(e){d({type:QN.DragMove,coordinates:e})},onEnd:s(QN.DragEnd),onCancel:s(QN.DragCancel)});Ce.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===QN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=QN.DragCancel)}w.current=null,(0,DN.unstable_batchedUpdates)(()=>{d({type:e}),h($P.Uninitialized),xe(null),E(null),O(null),Ce.current=null;let t=e===QN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Te=Tpe(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,we(n,t))},[v,we]));Npe(a),IN(()=>{z&&m===$P.Initializing&&h($P.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,DN.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(B),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,DN.unstable_batchedUpdates)(()=>{xe(s),a?.(c),f({type:`onDragOver`,event:c})})},[B]),IN(()=>{ne.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ve,collisions:ye,droppableRects:N,draggableNodes:v,draggingNode:ae,draggingNodeRect:oe,droppableContainers:b,over:be,scrollableAncestors:ue,scrollAdjustedTranslate:_e},S.current={initial:oe,translated:ve}},[C,I,ye,ve,v,ae,oe,N,b,be,ue,_e]),xpe({...ee,delta:y,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let Ee=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:z,activatorEvent:D,collisions:ye,containerNodeRect:te,dragOverlay:ie,draggableNodes:v,droppableContainers:b,droppableRects:N,over:be,measureDroppableContainers:P,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:M,measuringScheduled:F,windowRect:le}),[C,I,z,D,ye,te,ie,v,b,N,be,P,ue,de,M,F,le]),De=(0,Q.useMemo)(()=>({activatorEvent:D,activators:Te,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:be,measureDroppableContainers:P}),[D,Te,C,z,d,A,v,be,P]);return Q.createElement(ZN.Provider,{value:p},Q.createElement(XP.Provider,{value:De},Q.createElement(ZP.Provider,{value:Ee},Q.createElement(QP.Provider,{value:Se},i)),Q.createElement(Wpe,{disabled:n?.restoreFocus===!1})),Q.createElement(qfe,{...n,hiddenTextDescribedById:A}));function Oe(){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}}}),Jpe=(0,Q.createContext)(null),tF=`button`,Ype=`Draggable`;function Xpe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=UN(Ype),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(XP),{role:p=tF,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?QP:Jpe),[v,y]=BN(),[b,x]=BN(),S=Ppe(o,t),C=RN(n);return IN(()=>(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===tF?!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 Zpe(){return(0,Q.useContext)(ZP)}var Qpe=`Droppable`,$pe={timeout:25};function eme(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=UN(Qpe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(XP),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}={...$pe,...i},_=RN(h??r),v=HP({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]=BN((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=RN(t);return(0,Q.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:QN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:QN.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:QN.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 nF(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tme(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function rF(e){return e!==null&&e>=0}function nme(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 rme(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var iF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=nF(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}},aF={scaleX:1,scaleY:1},oF=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,...aF}:null}let s=ime(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...aF}:r<t&&r>=a?{x:0,y:o.height+s,...aF}:{x:0,y:0,...aF}};function ime(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 sF=`Sortable`,cF=Q.createContext({activeIndex:-1,containerId:sF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iF,disabled:{draggable:!1,droppable:!1}});function lF(e){let{children:t,id:n,items:r,strategy:i=iF,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Zpe(),d=UN(sF,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=!nme(p,_.current),y=g!==-1&&h===-1||v,b=rme(a);IN(()=>{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:tme(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(cF.Provider,{value:x},t)}var ame=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return nF(n,r,i).indexOf(t)},ome=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},sme={duration:200,easing:`ease`},uF=`transform`,cme=YN.Transition.toString({property:uF,duration:0,easing:`linear`}),lme={roleDescription:`sortable`};function ume(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return IN(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=uP(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 dF(e){let{animateLayoutChanges:t=ome,attributes:n,disabled:r,data:i,getNewIndex:a=ame,id:o,strategy:s,resizeObserverConfig:c,transition:l=sme}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(cF),y=dme(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}=eme({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}=Xpe({id:o,data:x,attributes:{...lme,...n},disabled:y.draggable}),L=Pfe(E,j),ee=!!D,R=ee&&!m&&rF(f)&&rF(g),z=!_&&N,te=R?(z&&R?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,ne=rF(f)&&rF(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:ee,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=ume({disabled:!oe,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{ee&&ie.current.newIndex!==ne&&(ie.current.newIndex=ne),d!==ie.current.containerId&&(ie.current.containerId=d),u!==ie.current.items&&(ie.current.items=u)},[ee,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:ee,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:se??te,transition:ce()};function ce(){if(se||ae&&ie.current.newIndex===b)return cme;if(!(z&&!qN(O)||!l)&&(ee||oe))return YN.Transition.toString({...l,property:uF})}}function dme(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function fF(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 fme=[DP.Down,DP.Right,DP.Up,DP.Left],pF=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(fme.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 DP.Down:r.top<a.top&&t.push(n);break;case DP.Up:r.top>a.top&&t.push(n);break;case DP.Left:r.left>a.left&&t.push(n);break;case DP.Right:r.left<a.left&&t.push(n)}});let c=Yfe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=oP(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=fP(c).some((e,t)=>s[t]!==e),i=mF(e,t),a=pme(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:KN(u,l)}}}};function mF(e,t){return!fF(e)||!fF(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function pme(e,t){return!fF(e)||!fF(t)||!mF(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var hF;(function(e){e.POPPER=`popper`,e.ITEM_ALIGNED=`item-aligned`})(hF||={});var gF=rc(U.LOW_LEVEL_SELECT,`Select`,[`Root`,`Trigger`,`Content`,`Value`,`Item`,`Group`,`Label`,`Separator`,`ScrollUpButton`,`ScrollDownButton`]),_F=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=gF(e);return(0,$.jsx)(r,{...t,ref:n})});_F.displayName=`Select`;function vF({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.Root,{...t})}var yF=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=gF(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});yF.displayName=`SelectTrigger`;var bF=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=gF(e);return(0,$.jsx)(r.Content,{...t,ref:n})});bF.displayName=`SelectContent`;function xF({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.Value,{...t})}var SF=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=gF(e);return(0,$.jsx)(r.Item,{...t,ref:n})});SF.displayName=`SelectItem`;function mme({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.Group,{...t})}function hme({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.Label,{...t})}function gme({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.Separator,{...t})}function _me({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.ScrollUpButton,{...t})}function vme({preset:e=G.DEFAULT,...t}){let n=gF(e);return(0,$.jsx)(n.ScrollDownButton,{...t})}var CF=rc(U.LOW_LEVEL_RADIO_GROUP,`RadioGroup`,[`Root`]),wF=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=CF(e);return(0,$.jsx)(r,{...t,ref:n})});wF.displayName=`RadioGroup`;function TF({preset:e=G.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Root,{...t})}function EF({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_RADIO,`RadioGroupItem`)(e);return(0,$.jsx)(n,{...t})}var DF;(function(e){e.ABSENT=`absent`})(DF||={});var OF=rc(U.LOW_LEVEL_CARD,`Card`,[`Listbox`,`Header`,`Footer`,`Title`,`Action`,`Description`,`Content`]);function kF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n,{...t})}function AF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Listbox,{...t})}function jF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Header,{...t})}function MF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Footer,{...t})}function NF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Title,{...t})}function PF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Action,{...t})}function FF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Description,{...t})}function IF({preset:e=G.DEFAULT,...t}){let n=OF(e);return(0,$.jsx)(n.Content,{...t})}var yme=Fl(U.LOW_LEVEL_SELECT_MULTIPLE,`SelectMultiple`),LF=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=yme(e);return(0,$.jsx)(r,{...t,ref:n})});LF.displayName=`SelectMultiple`;function bme(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 RF(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,xme(i,...t)]}function xme(...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 zF(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var BF=globalThis?.document?Q.useLayoutEffect:()=>{},Sme=Q.useInsertionEffect||BF;function VF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Cme({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=wme(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Cme({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),a=Q.useRef(t);return Sme(()=>{a.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function wme(e){return typeof e==`function`}function HF(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 UF(e){let[t,n]=Q.useState(void 0);return BF(()=>{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 Tme(e,t){return Q.useReducer((e,n)=>t[e][n]??e,e)}var WF=e=>{let{present:t,children:n}=e,r=Eme(t),i=typeof n==`function`?n({present:r.isPresent}):Q.Children.only(n),a=PE(r.ref,Dme(i));return typeof n==`function`||r.isPresent?Q.cloneElement(i,{ref:a}):null};WF.displayName=`Presence`;function Eme(e){let[t,n]=Q.useState(),r=Q.useRef(null),i=Q.useRef(e),a=Q.useRef(`none`),[o,s]=Tme(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Q.useEffect(()=>{let e=GF(r.current);a.current=o===`mounted`?e:`none`},[o]),BF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=GF(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),BF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=GF(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=GF(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 GF(e){return e?.animationName||`none`}function Dme(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 KF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=LE(`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 Ome(e,t){e&&DN.flushSync(()=>e.dispatchEvent(t))}var qF=`Checkbox`,[kme,Ame]=RF(qF),[jme,JF]=kme(qF);function Mme(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]=VF({prop:n,defaultProp:i??!1,onChange:c,caller:qF}),[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:!nI(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(jme,{scope:t,...b,children:Nme(d)?d(b):r})}var YF=`CheckboxTrigger`,XF=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}=JF(YF,e),h=PE(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)(KF.button,{type:`button`,role:`checkbox`,"aria-checked":nI(c)?`mixed`:c,"aria-required":l,"data-state":rI(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:zF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:zF(n,e=>{d(e=>nI(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});XF.displayName=YF;var ZF=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)(Mme,{__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)(XF,{...d,ref:t,__scopeCheckbox:n}),e&&(0,$.jsx)(tI,{__scopeCheckbox:n})]})})});ZF.displayName=qF;var QF=`CheckboxIndicator`,$F=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=JF(QF,n);return(0,$.jsx)(WF,{present:r||nI(a.checked)||a.checked===!0,children:(0,$.jsx)(KF.span,{"data-state":rI(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});$F.displayName=QF;var eI=`CheckboxBubbleInput`,tI=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}=JF(eI,e),m=PE(n,p),h=HF(a),g=UF(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=nI(a),n.call(e,!nI(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(!nI(a)&&a);return(0,$.jsx)(KF.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%)`}})});tI.displayName=eI;function Nme(e){return typeof e==`function`}function nI(e){return e===`indeterminate`}function rI(e){return nI(e)?`indeterminate`:e?`checked`:`unchecked`}var Pme=Object.freeze([]),iI=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:_}=J({keys:[`errors_validation`],component:[U.LOW_LEVEL_FORM_FIELD,U.LOW_LEVEL_FORM_MESSAGE]}),{renderIcon:v}=kf(),{getRecipe:y}=Ig(),b=y(_t.FORM_CONTROL,na.CHECKBOX),x=ds(e),S=x?S_(x):void 0,C=u??S?.edit?.editDirection??`vertical`,w=d??S?.edit?.editColumnsCount??1,T=x?Hs(x):[],E=l??T.map(e=>({value:e,label:e})),[D,O]=Q.useState(s??[]),k=C_(i,a),A=k?i??Pme: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(U.LOW_LEVEL_FORM_FIELD,`noResults`)}):null:_?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{ref:N,role:`group`,className:W(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)(ZF,{id:r,checked:t,onCheckedChange:t=>j(e.value,t===!0),onBlur:F,disabled:i,"data-slot":`checkbox`,className:W(`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)($F,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:v(H.CHECK,{size:Jn.SM})})}),(0,$.jsx)(`label`,{htmlFor:r,className:W(`text-sm font-normal cursor-pointer select-none`,i&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:e.label})]},e.value)})})}):null});iI.displayName=`FormFieldCheckboxGroup`;var Fme={[Ku.SELECT]:!1,[Ku.RADIO]:!1,[Ku.RADIO_ICON_ONLY]:!0,[Ku.TOGGLE]:!1,[Ku.TOGGLE_ICON_ONLY]:!0,[Ku.CARD]:!1,[Ku.CARD_ICON_ONLY]:!0,[Ku.COMBOBOX]:!1},Ime={[Ku.SELECT]:ri.VERTICAL,[Ku.RADIO]:ri.VERTICAL,[Ku.RADIO_ICON_ONLY]:ri.HORIZONTAL,[Ku.TOGGLE]:ri.HORIZONTAL,[Ku.TOGGLE_ICON_ONLY]:ri.HORIZONTAL,[Ku.CARD]:ri.VERTICAL,[Ku.CARD_ICON_ONLY]:ri.VERTICAL,[Ku.COMBOBOX]:ri.VERTICAL},Lme={[Gi.CHECKBOX]:!1,[Gi.SELECT]:!1,[Gi.TOGGLE]:!1,[Gi.TOGGLE_ICON_ONLY]:!0,[Gi.CARD]:!1,[Gi.CARD_ICON_ONLY]:!0,[Gi.COMBOBOX]:!1},Rme={[Gi.CHECKBOX]:ri.VERTICAL,[Gi.SELECT]:ri.VERTICAL,[Gi.TOGGLE]:ri.HORIZONTAL,[Gi.TOGGLE_ICON_ONLY]:ri.HORIZONTAL,[Gi.CARD]:ri.VERTICAL,[Gi.CARD_ICON_ONLY]:ri.VERTICAL,[Gi.COMBOBOX]:ri.VERTICAL},zme=2,Bme=4,aI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:o,onChange:s,onBlur:c,defaultValue:l,validationMode:u,options:d,placeholder:f,required:p,autoFocus:m,clearable:h,multiple:g,controlSize:_=Jd.MD},v)=>{let{renderIcon:y}=kf(),{tComponent:b,isReady:x}=J({component:U.LOW_LEVEL_FORM_FIELD}),S=o??l,C=g===!0||Array.isArray(S),w=(C?ds(e):void 0)??e,T=S_(w),E=hn(w),D=tee(w),O=C?Lme[D]??!1:Fme[E]??!1,k=C?Rme[D]:Ime[E],A=T?.edit?.editDirection??k??ri.VERTICAL,j=T?.edit?.editColumnsCount??(O?Bme:zme),M=T?.values,N=T?.defaultIcon,P=!!(M&&Object.values(M).some(e=>e.icon))||!!N,F=!!(M&&Object.values(M).some(e=>e.color))||!!T?.defaultColor,I=_===Jd.SM?`sm`:`md`,L=_===Jd.SM?Gd.SM:Gd.MD,ee=Hs(w)??[],R=d??ee.map(e=>({value:e,label:e})),z=Q.useCallback((e,t)=>{if(typeof e==`string`)return y(e,{size:Jn.SM,className:t});let n=ga[Jn.SM];return Q.createElement(e,{size:n,className:t})},[y]),te=Q.useCallback(e=>{if(!P)return null;let t=M?.[e]?.icon??N;return t?z(t,`shrink-0`):null},[M,N,P,z]),ne=Q.useCallback(e=>{let t=te(e.value);if(O&&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=M?.[e.value]?.color??T?.defaultColor;return!t||O?e.label:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:W(Xd,Wf[Qg(t)])}),e.label]})}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[t,e.label]})},[O,te,M,T?.defaultColor]),re=Q.useMemo(()=>P||O||F?ne:void 0,[P,O,F,ne]),[ie,ae]=Q.useState(l??(C?[]:``)),oe=C_(o,s),se=o??ie,ce=Q.useCallback(e=>{r||(oe?s?.(e):ae(e))},[oe,s,r]),le=Q.useCallback(()=>{c?.()},[c]),ue={schema:e,name:t,disabled:n,className:i,validationMode:u,autoFocus:m,controlSize:_},de=A===ri.HORIZONTAL?Ks.HORIZONTAL:Ks.VERTICAL;if(!x)return null;if(C){let t=Array.isArray(se)?se:se?[se]:[],o=a(e),s=o.maxLength!==void 0&&t.length>=o.maxLength,c=o.minLength!==void 0&&t.length<=o.minLength,l=o.minLength===void 0&&o.maxLength===void 0?R:R.map(e=>({...e,disabled:e.disabled===!0||(t.includes(e.value)?c:s)})),u=e=>{o.maxLength!==void 0&&e.length>o.maxLength||o.minLength!==void 0&&e.length<o.minLength&&e.length<t.length||ce(e)},d=e=>{u(t.includes(e)?t.filter(t=>t!==e):[...t,e])},h=o.minLength===void 0&&o.maxLength===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-slot":`enum-multiple-bound`,children:[o.minLength!==void 0&&o.maxLength!==void 0?o.minLength===o.maxLength?b(U.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectExactly`,{count:o.minLength}):b(U.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectRange`,{min:o.minLength,max:o.maxLength}):o.minLength===void 0?b(U.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectUpTo`,{count:o.maxLength}):b(U.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectAtLeast`,{count:o.minLength}),` `,`(`,b(U.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectedCount`,{count:t.length}),`)`]}),g=e=>h===null?e:(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-item-sm`,children:[e,h]});switch(D){case Gi.CHECKBOX:return g((0,$.jsx)(iI,{ref:v,...ue,options:l,value:t,onChange:u,onBlur:le,controlSize:_}));case Gi.SELECT:return g((0,$.jsx)(LF,{ref:v,...ue,options:l,value:t,onChange:u,onBlur:le,placeholder:f,size:_,renderOptionLabel:re}));case Gi.TOGGLE:case Gi.TOGGLE_ICON_ONLY:return g((0,$.jsx)(bO,{ref:v,type:_O.MULTIPLE,appearance:vO.CHIPS,value:t,onValueChange:e=>u(Array.isArray(e)?e:e?[e]:[]),disabled:n||r,size:L,orientation:de,className:i,children:l.map(e=>(0,$.jsx)(xO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:ne(e)},e.value))}));case Gi.CARD:case Gi.CARD_ICON_ONLY:return g((0,$.jsx)(AF,{ref:v,"aria-multiselectable":!0,"aria-disabled":n||r?!0:void 0,"aria-required":p,className:W(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`},children:l.map(e=>{let i=t.includes(e.value),a=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(kF,{"data-option":e.value,"aria-disabled":a?!0:void 0,"aria-label":O?e.label:void 0,className:W(`p-card-sm text-sm font-medium`,O&&`flex items-center justify-center`,a&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{a||d(e.value)}},selected:i,...a?{tabIndex:-1}:{},children:ne(e)},e.value)})}));case Gi.COMBOBOX:return g((0,$.jsx)(fx,{ref:v,...ue,options:l,value:t,onChange:u,onBlur:le,placeholder:f,disabled:n||r,autoFocus:m,size:I,showSelectAll:!0,emptyMessage:b(U.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:b(U.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:re?e=>re(e):void 0}));default:return g((0,$.jsx)(iI,{ref:v,...ue,options:l,value:t,onChange:u,onBlur:le,controlSize:_}))}}switch(E){case Ku.SELECT:return(0,$.jsx)(_F,{ref:v,...ue,options:R,value:se,onChange:ce,onBlur:le,placeholder:f,size:_,renderOptionLabel:re});case Ku.RADIO:case Ku.RADIO_ICON_ONLY:return(0,$.jsx)(wF,{ref:v,...ue,options:R,value:se,onValueChange:ce,onBlur:le,orientation:de,renderOptionLabel:ne});case Ku.TOGGLE:case Ku.TOGGLE_ICON_ONLY:return(0,$.jsx)(bO,{ref:v,type:_O.SINGLE,value:se,onValueChange:e=>{(e||h)&&ce(e)},disabled:n||r,size:L,orientation:de,className:i,children:R.map(e=>(0,$.jsx)(xO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:ne(e)},e.value))});case Ku.CARD:case Ku.CARD_ICON_ONLY:return(0,$.jsx)(AF,{ref:v,"aria-disabled":n||r?!0:void 0,"aria-required":p,className:W(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`},children:R.map(e=>{let t=se===e.value,i=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(kF,{"data-option":e.value,"aria-disabled":i?!0:void 0,"aria-label":O?e.label:void 0,className:W(`p-card-sm text-sm font-medium`,O&&`flex items-center justify-center`,i&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{i||ce(e.value)}},selected:t,...i?{tabIndex:-1}:{},children:ne(e)},e.value)})});case Ku.COMBOBOX:return(0,$.jsx)(dx,{ref:v,...ue,options:R,value:se,onChange:ce,onBlur:le,placeholder:f,disabled:n||r,autoFocus:m,size:I,emptyMessage:b(U.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:b(U.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:re?e=>re(e):void 0,renderSelectedValue:re});default:return(0,$.jsx)(_F,{ref:v,...ue,options:R,value:se,onChange:ce,onBlur:le,placeholder:f,size:_})}}),oI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_ENUM,`FormFieldEnum`)(e);return(0,$.jsx)(r,{...t,ref:n})});oI.displayName=`FormFieldEnum`;var sI=`file-validation`,Vme=/received (undefined|null)\b/i,Hme=/expected .+, received (undefined|null)/i;function cI(e){return Vme.test(e)||Hme.test(e)}function lI(e,t,n,r){if(!(e.error?.type===`server`||e.error?.type===`server-unique`||e.isTouched||t||(n===Kn.ON_CHANGE||n===Kn.ON_TOUCHED)&&e.isDirty)||!e.error)return;if(cI(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 uI({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_CHIPS_INPUT,`ChipsInput`)(e);return(0,$.jsx)(n,{...t})}uI.displayName=`ChipsInput`;var dI=(0,Q.createContext)(!0);function fI(e){let{setValue:t}=BC(),n=IC({name:e}),r=TE(),i=(0,Q.useContext)(dI)?r:null;return{value:n,setValue:(0,Q.useCallback)(n=>{t(e,n,{shouldDirty:!0,shouldTouch:!0}),i?.triggerSave(e,n,ll.DEBOUNCE)},[t,e,i])}}function pI(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var Ume={activationConstraint:{distance:8}},Wme={coordinateGetter:pF};function mI({listeners:e,attributes:t,disabled:n,ariaLabel:r,renderIcon:i}){return(0,$.jsx)(`button`,{type:`button`,className:W(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:text-muted-foreground hover:bg-accent/50`,Ag(r_.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:Jn.SM})})}function Gme({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}=dF({id:e,disabled:!s||i}),D={transform:pI(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)(mI,{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:Y.GHOST,size:Gd.ICON,onClick:()=>_(y),disabled:i||o||l,className:`h-5 w-5`,"aria-label":f,children:b(H.CHEVRON_UP,{size:Jn.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>v(y),disabled:i||o||u,className:`h-5 w-5`,"aria-label":p,children:b(H.CHEVRON_DOWN,{size:Jn.XS})})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:h?h(t,r):(0,$.jsx)($L,{name:t,schema:r,label:n,disabled:i})}),a&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>g(y),disabled:i||o,className:`shrink-0 mb-element`,"aria-label":m,children:b(H.DELETE,{size:Jn.SM})})]})}var hI=`w-12`,gI=`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 _I({fieldName:e,itemSchema:t,primaryFieldName:n,disabled:r,only:i}){let a=PT(),o=jt(t),s=Vr(t);if(!o||s.length===0)return null;if(ka(t))return i===`boolean`?null:(0,$.jsx)(Yw,{formChromeMode:$u.COMPACT,sectionChromeMode:void 0,children:(0,$.jsx)($L,{name:e,schema:t,labelPlacement:`hidden`,disabled:r,className:`min-w-0 flex-1`})});let c=s.filter(e=>Kt(o[e])===B.BOOLEAN),l=s.filter(e=>Kt(o[e])!==B.BOOLEAN),u=i===`boolean`?c:i===`body`?l:[...c,...l];return(0,$.jsx)(Yw,{formChromeMode:$u.COMPACT,sectionChromeMode:void 0,children:u.map(t=>{let i=`${e}.${t}`,s=a?.fieldLabels?.[mr.labelDictionaryPath(i)]??mr.unresolvedFieldLabel(t);return(0,$.jsx)($L,{name:i,schema:o[t],label:s,labelPlacement:`hidden`,disabled:r,className:W(`w-auto`,t===n?`min-w-0 flex-1`:`shrink-0`)},t)})})}function Kme({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}=dF({id:e,disabled:!l||o}),k={transform:pI(E),transition:D,opacity:O?.5:void 0,zIndex:O?10:void 0,position:`relative`},A=IC({name:i?`${t}.${i}`:t}),j=typeof A==`string`&&A.trim()!==``?A.trim():typeof A==`number`?String(A):n;return r===Eo.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:W(`absolute -left-5 top-1/2 -translate-y-1/2`,gI),children:(0,$.jsx)(mI,{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:Y.GHOST,size:Gd.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:Jn.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:Jn.XS})})]}),!_&&(0,$.jsx)(`div`,{className:W(`flex shrink-0 items-center`,hI),children:(0,$.jsx)(_I,{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)(_I,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`body`})}),s&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>v(x),disabled:o||c,className:W(`shrink-0`,gI),"aria-label":g,children:S(H.DELETE,{size:Jn.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)(mI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S}),u&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:Jn.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:Jn.XS})})]}),(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),s&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.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:Jn.SM})}),(0,$.jsx)(`div`,{className:`pt-item`,children:_?_(t,a):(0,$.jsx)($L,{name:t,schema:a,label:n,hideLabel:!0,disabled:o})})]})}function qme({primaryField:e,itemSchema:t,onAdd:n,disabled:r,addLabel:i,placeholder:a,leadingGutterClassName:o}){let{renderIcon:s}=kf(),{resolvedRegionalPreferences:c}=J(),l=c?.timezone,u=Kt(e.schema)===B.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:{...mr.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:W(`shrink-0`,o)}),(0,$.jsx)(tN,{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:Y.OUTLINE,onClick:g,disabled:!h,"aria-label":i,children:s(H.PLUS,{size:Jn.SM})})]})}function Jme({name:e,schema:t,label:n,description:r,disabled:i,className:o,renderField:s,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:y,formState:b,trigger:x}=BC(),S=RM(e),{renderIcon:C}=kf(),{tComponent:w,tErrorValidation:T,isReady:E,resolvedRegionalPreferences:D}=J({component:U.LOW_LEVEL_FORM_MESSAGE,keys:[`errors_validation`]}),O=D?.timezone,{getRecipe:k}=Ig(),A=k(_t.TYPOGRAPHY,ii.DESCRIPTION),{formChromeMode:j,sectionChromeMode:M}=Xw(),N=Sc(),P=id(t),F=P?.chromeMode??f??M??j??KL(N.autoRender?.autoFieldChrome),I=qL(N.autoRender?.autoLabelPlacement),L=JL(N.autoRender?.autoFieldDensity),ee=N.autoRender?.autoErrorPlacement===`summary-at-surface-top`,R=TE(),z=(0,Q.useContext)(dI)?R:null,te=z?t=>z.triggerSave(e,t,ll.BLUR):void 0,ne=c??w(U.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),re=l??w(U.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`),ie=w(U.LOW_LEVEL_FORM_MESSAGE,`arrayEmptyMessage`),ae=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(ae.current=!0,()=>{ae.current=!1}),[]);let[oe,se]=(0,Q.useState)(!1),{fields:ce,append:le,remove:ue,move:de}=Aw({control:_,name:e}),fe=ds(t),pe=a(t),me=fe?Kt(fe):`unknown`,he=g!==void 0&&me===B.STRING,ge=me===B.ENUM||he,_e=lu(t)?.edit,ve=m??lu(t)?.objectItemLayout??Eo.CARD,ye=_e?.isSortable,be=ye==null||!!ye&&_e?.dnd!==!1,xe=ye?_e?.upDownIcons??!1:!1,Se=u&&be&&!i&&ce.length>1,Ce=tP(eP(NP,Ume),eP(kP,Wme)),we=(0,Q.useMemo)(()=>ce.map(e=>e.id),[ce]),Te=pe.maxLength===void 0||ce.length<pe.maxLength,Ee=pe.minLength===void 0||ce.length>pe.minLength,De=(0,Q.useCallback)(()=>{se(!0),setTimeout(async()=>{if(ae.current&&(await x(e),ae.current&&(se(!1),z))){let t=y(e);z.triggerSave(e,t,ll.DEBOUNCE)}},0)},[x,e,z,y]),Oe=(0,Q.useCallback)(()=>{if(!Te||i||oe)return;let e=mr.getDefaultValueForSchema(fe,{timeZone:O});le(e),De()},[Te,i,oe,fe,le,De,O]),ke=(0,Q.useCallback)(e=>{!Te||i||oe||(le(e),De())},[Te,i,oe,le,De]),Ae=(0,Q.useCallback)(e=>{!Ee||i||oe||(ue(e),De())},[Ee,i,oe,ue,De]),je=(0,Q.useCallback)(e=>{e>0&&!i&&!oe&&(de(e,e-1),De())},[de,i,oe,De]),Me=(0,Q.useCallback)(e=>{e<ce.length-1&&!i&&!oe&&(de(e,e+1),De())},[ce.length,de,i,oe,De]),Ne=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=ce.findIndex(e=>e.id===t.id),r=ce.findIndex(e=>e.id===n.id);e!==-1&&r!==-1&&(de(e,r),De())}},[ce,de,De]);if(!fe||!E)return null;if(ge){let a=P?.validationMode??Kn.ON_BLUR,s=!he&&g!==void 0?Hs(fe).filter(e=>g.includes(e)):void 0,c=he?g.map(e=>({value:e,label:h?.[e]??e})):s?s.map(e=>({value:e,label:h?.[e]??e})):h?Hs(fe).map(e=>({value:e,label:h[e]??e})):void 0;return(0,$.jsx)(RC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:l})=>(0,$.jsx)(JM,{mode:F,label:n,description:r,error:lI(l,b.isSubmitted,a,T),labelPlacement:I,hideError:ee,saveState:z?.getFieldState(e),saveErrorMessage:z?.getFieldStateInfo(e).lastError,onRetrySave:z?()=>z.retryFieldSave(e):void 0,onSaveFieldNow:te,fieldName:e,disabled:i,className:o,children:(0,$.jsx)(oI,{multiple:!0,schema:t,options:c,name:e,disabled:i,value:Array.isArray(s.value)?s.value:[],onChange:t=>{S.noteInputReceived(),s.onChange(t),z?.triggerSave(e,t,ll.DEBOUNCE)},onBlur:()=>{S.handleFieldBlur(s.onBlur)},controlSize:L})})})}if(me===B.STRING&&lu(t)?.display?.listStyle===oc.CHIPS){let t=P?.validationMode??Kn.ON_BLUR,a=e=>{let n=fe.safeParse(e);if(n.success)return;let r=n.error.issues[0];return lI({isTouched:!0,error:{type:r?.code??`custom`,message:r?.message,params:r?fT(r):void 0}},!0,t,T)};return(0,$.jsx)(RC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:c})=>(0,$.jsx)(JM,{mode:F,label:n,description:r,error:lI(c,b.isSubmitted,t,T),labelPlacement:I,hideError:ee,saveState:z?.getFieldState(e),saveErrorMessage:z?.getFieldStateInfo(e).lastError,onRetrySave:z?()=>z.retryFieldSave(e):void 0,onSaveFieldNow:te,fieldName:e,disabled:i,className:o,children:(0,$.jsx)(uI,{id:`field-${e}`,value:Array.isArray(s.value)?s.value.filter(e=>typeof e==`string`):[],onChange:t=>{S.noteInputReceived(),s.onChange(t),z?.triggerSave(e,t,ll.DEBOUNCE)},onBlur:()=>{S.handleFieldBlur(s.onBlur)},validateItem:a,maxItems:pe.maxLength,disabled:i,invalid:!!c.error,controlSize:L})})})}let Pe=z?.getFieldStateInfo(e),Fe=z&&Pe&&Pe.state!==Qw.IDLE?(0,$.jsx)(WM,{state:Pe.state,errorMessage:Pe.lastError,onRetry:()=>z.retryFieldSave(e),position:`inline`,size:`sm`,className:`ms-element align-middle`}):null,Ie=v(e,b),Le=Ie.error?.root?.message||Ie.error?.message,Re=!(!Le||ee),ze=mr.resolveArrayAddMode(t,fe),Be=mr.getArrayItemPrimaryField(fe),Ve=ze===Ll.QUICK_ADD?Be:null,He=me!==`object`&&me!==`array`,Ue=(0,$.jsxs)($.Fragment,{children:[Re&&(0,$.jsx)(`p`,{id:`${e}-error`,className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:Le}),(0,$.jsxs)(wT,{className:W(ve===Eo.ROW?void 0:`space-y-field`),style:ve===Eo.ROW?{rowGap:`var(--spacing-element)`}:void 0,children:[(0,$.jsx)(eF,{sensors:Ce,collisionDetection:cP,onDragEnd:Ne,children:(0,$.jsx)(lF,{items:we,strategy:oF,children:ce.map((t,n)=>{let r=`${e}.${n}`,a=`${re} ${n+1}`,o=w(U.LOW_LEVEL_FORM_MESSAGE,`arrayDragHandle`,{label:a}),c=w(U.LOW_LEVEL_FORM_MESSAGE,`arrayMoveUp`,{label:a}),l=w(U.LOW_LEVEL_FORM_MESSAGE,`arrayMoveDown`,{label:a}),u=w(U.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:a});return He?(0,$.jsx)(Gme,{id:t.id,fieldName:r,fieldLabel:a,itemSchema:fe,disabled:i,canRemove:Ee,isValidating:oe,reorderable:Se,showUpDownIcons:xe,isFirst:n===0,isLast:n===ce.length-1,dragHandleAriaLabel:o,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:s,onRemove:Ae,onMoveUp:je,onMoveDown:Me,index:n,renderIcon:C},t.id):(0,$.jsx)(Kme,{id:t.id,fieldName:r,fieldLabel:a,layout:ve,primaryFieldName:Be.name,itemSchema:fe,disabled:i,canRemove:Ee,isValidating:oe,reorderable:Se,showUpDownIcons:xe,isFirst:n===0,isLast:n===ce.length-1,dragHandleAriaLabel:o,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:s,onRemove:Ae,onMoveUp:je,onMoveDown:Me,index:n,renderIcon:C},t.id)})})}),Te&&Ve?(0,$.jsx)(qme,{primaryField:Ve,itemSchema:fe,onAdd:ke,disabled:i||oe,addLabel:ne,leadingGutterClassName:ve===Eo.ROW&&!He?s?`w-7`:hI:void 0}):Te?(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,onClick:Oe,disabled:i||oe,className:`w-full`,children:[C(H.PLUS,{size:Jn.SM,className:`me-element`}),ne]}):null,ce.length===0&&(i||!Te)&&(0,$.jsx)(`p`,{className:W(A.base,`text-center py-card`),children:ie})]})]});if(F===$u.SETTINGS_ROW&&d===void 0)return(0,$.jsx)(JM,{mode:$u.SETTINGS_ROW,label:n,description:r,labelPlacement:I,onSaveFieldNow:te,fieldName:e,disabled:i,className:o,error:Le,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":Re?`${e}-error`:void 0,children:[Fe,Ue]})});let We=!p&&(d===Xt.CARD||d===Xt.COLLAPSIBLE),Ge=d!==Xt.COLLAPSIBLE;return(0,$.jsxs)(CT,{appearance:d??Xt.GHOST,legend:We?(0,$.jsxs)($.Fragment,{children:[n,Ge&&Fe]}):void 0,description:We?r:void 0,disabled:i,className:W(o,Le&&`border-destructive`),"data-field":e,"data-testid":`field-array-${e}`,"aria-invalid":!!Le,"aria-describedby":Re?`${e}-error`:void 0,children:[We?!Ge&&Fe:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(SD,{children:(0,$.jsx)(TT,{className:`sr-only`,children:n})}),Fe]}):(0,$.jsx)(SD,{children:(0,$.jsxs)(TT,{children:[n,Fe]})}),!We&&r&&!p&&(0,$.jsx)(lx,{children:r}),(0,$.jsx)(kE,{fieldName:e,label:n,disabled:i,onSaveFieldNow:te,children:Ue})]})}function vI(e){let t=TE(),n=t!==null&&DE(id(e.schema)?.autosave,t.config.defaultTrigger,!0)!==ll.NONE;return(0,$.jsx)(dI.Provider,{value:n,children:(0,$.jsx)(Jme,{...e})})}vI.displayName=`AutomatedArrayField`;var yI=vI,bI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldEdit_ResourceReference`,mc.EDIT)(e);return(0,$.jsx)(r,{...t,ref:n})});bI.displayName=`ResourceFieldEdit_ResourceReference`;function Yme(e,t){let n=e?.resourceReferenceTargets;if(n)return n[t]??[]}function Xme(e,t){if(t)return e?.resourceType===t?e:{resourceType:t}}function Zme(e,t){return e?.resourceType?t?{resourceType:e.resourceType,resourceId:t}:{resourceType:e.resourceType}:e}function Qme(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 $me=[ac.RESOURCES];function xI(e,t){return jt(Zt(e))?.[t]??e}var SI=Q.forwardRef(({types:e,value:t,onChange:n,schema:r,name:i,...a},o)=>{let{tComponent:s,tResourceHeader:c}=J({component:U.RESOURCES_FIELDS_RESOURCE_REFERENCE,keys:$me}),l=Q.useMemo(()=>Qme(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)(_F,{ref:o,...a,schema:xI(r,`resourceType`),name:`${i}.resourceType`,options:l,value:t?.resourceType||void 0,onChange:e=>n?.(Xme(t,e)),placeholder:s(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,l.length>0?`selectTypePlaceholder`:`noTypesAvailable`)}),t?.resourceType?(0,$.jsx)(bI,{...a,schema:xI(r,`resourceId`),name:`${i}.resourceId`,targetResourceType:t.resourceType,value:t.resourceId,onChange:e=>n?.(Zme(t,Array.isArray(e)?e[0]:e))}):null]})});SI.displayName=`FormFieldResourceReference`;var CI=rc(U.LOW_LEVEL_SWITCH,`Switch`,[`Root`]),wI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=CI(e);return(0,$.jsx)(r,{...t,ref:n})});wI.displayName=`Switch`;var TI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=CI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});TI.displayName=`SwitchRoot`;var EI=rc(U.LOW_LEVEL_CHECKBOX,`Checkbox`,[`Root`]),DI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=EI(e);return(0,$.jsx)(r,{...t,ref:n})});DI.displayName=`Checkbox`;var OI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=EI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});OI.displayName=`CheckboxRoot`;var kI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_TOGGLE_GROUP_BOOLEAN,`ToggleGroupBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});kI.displayName=`ToggleGroupBoolean`;var AI=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}=J({component:U.LOW_LEVEL_FORM_FIELD_BOOLEAN}),h=Po(e),g=Mr(e),_=h?.labellingValue??`yes/no`,[v,y]=Q.useState(c??!1),b=C_(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(U.LOW_LEVEL_FORM_FIELD_BOOLEAN,E),k=()=>T?_.falseValue:p(U.LOW_LEVEL_FORM_FIELD_BOOLEAN,D);if(!m)return null;switch(g){case zc.TOGGLE:return(0,$.jsx)(kI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case zc.SWITCH:return(0,$.jsx)(wI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case zc.CHECKBOX:return(0,$.jsx)(DI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case zc.RADIO:let e=[{value:`true`,label:O()},{value:`false`,label:k()}];return(0,$.jsx)(wF,{ref:f,...w,options:e,value:x?`true`:`false`,onValueChange:e=>S(e===`true`),onBlur:C});default:return(0,$.jsx)(wI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C})}}),jI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_BOOLEAN,`FormFieldBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});jI.displayName=`FormFieldBoolean`;var MI=rc(U.LOW_LEVEL_TEXTAREA,`Textarea`,[`Root`]),NI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=MI(e);return(0,$.jsx)(r,{...t,ref:n})});NI.displayName=`Textarea`;var PI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=MI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});PI.displayName=`TextareaRoot`;function FI({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_MARKDOWN_EDITOR,`MarkdownEditor`)(e);return(0,$.jsx)(n,{...t})}FI.displayName=`MarkdownEditor`;var II=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_COLOR_INPUT,`ColorInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});II.displayName=`ColorInput`;var LI=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,disabled:i,readOnly:a,className:o,autoFocus:s,controlSize:c=Jd.MD,clearable:l,labelledBy:u,controlId:d,monthPlaceholder:f},p)=>{let{tComponent:m,resolvedRegionalPreferences:h}=J({component:U.LOW_LEVEL_FORM_FIELD_STRING}),g=Ma(t),[_,v]=Q.useState(g?.month),[y,b]=Q.useState(String(g?g.year:new Date().getUTCFullYear()));Q.useEffect(()=>{let e=Ma(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(()=>ho.monthNames(h),[h]),w=(e,r)=>{if(e===void 0||!/^\d{4}$/.test(r))return;let i=Mn(Number(r),e);i!==t&&n?.(i)},T=()=>{let e=Ma(t);e&&!/^\d{4}$/.test(y)&&b(String(e.year)),r?.()},E=i||a,D=l===!0&&Ma(t)!==void 0;return(0,$.jsxs)(`div`,{className:W(`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)(vF,{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)(yF,{ref:S,id:d??`field-${e}`,size:c,className:`w-full`,"aria-label":m(U.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonth`),autoFocus:s,children:(0,$.jsx)(xF,{placeholder:f??m(U.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonthPlaceholder`)})}),(0,$.jsx)(bF,{children:C.map((e,t)=>(0,$.jsx)(SF,{value:String(t+1),textValue:e,children:e},t+1))})]})}),(0,$.jsx)(`div`,{className:`w-28 shrink-0`,children:(0,$.jsx)(tN,{type:`number`,inputMode:`numeric`,min:1,max:9999,step:1,name:`${e}.year`,controlSize:c,"aria-label":m(U.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:Y.GHOST,size:c===Jd.SM?Gd.SM:Gd.MD,disabled:E,onClick:()=>{n?.(``),x.current?.focus()},children:m(U.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthClear`)})]})});LI.displayName=`YearMonthInput`;var RI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_PASSWORD_INPUT,`PasswordInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});RI.displayName=`PasswordInput`;var zI=rc(U.LOW_LEVEL_INPUT_OTP,`InputOTP`,[`Group`,`Slot`,`Separator`]),BI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=zI(e);return(0,$.jsx)(r,{...t,ref:n})});BI.displayName=`InputOTP`;function VI({preset:e=G.DEFAULT,...t}){let n=zI(e);return(0,$.jsx)(n.Group,{...t})}function HI({preset:e=G.DEFAULT,...t}){let n=zI(e);return(0,$.jsx)(n.Slot,{...t})}function ehe({preset:e=G.DEFAULT,...t}){let n=zI(e);return(0,$.jsx)(n.Separator,{...t})}function the(e,t){let n=e?.organizationRoles;if(!n||n.length===0)return;let r=e?.organizationTypes;return!t||!r?n:n.filter(e=>Nu(r,t,e))}function nhe(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 rhe=[ac.ROLES],UI=Q.forwardRef(({roles:e,value:t,onChange:n,clearable:r,...i},a)=>{let{tComponent:o,tRole:s}=J({component:U.LOW_LEVEL_FORM_FIELD_STRING,keys:rhe}),c=Q.useMemo(()=>nhe(e,t,e=>s(e,`label`)),[e,t,s]),l=(0,$.jsx)(_F,{ref:a,...i,options:c,value:t||void 0,onChange:e=>n?.(e),placeholder:o(U.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:Y.GHOST,disabled:i.disabled||i.readOnly,onClick:()=>n?.(``),children:o(U.LOW_LEVEL_FORM_FIELD_STRING,`organizationRoleClear`)})]})});UI.displayName=`FormFieldStringOrganizationRole`;function ihe(){let{appConfig:e}=Eu(),{organizations:t,currentOrganizationId:n}=ag(),r=t.find(e=>e._id===n)?.type;return the(e,r)}function ahe(e){if(e.roleTable===lr.ANOTHER_ORGANIZATION)return e.offeredRoles;if(e.table)return e.offeredRoles?e.table.filter(t=>e.offeredRoles.includes(t)):e.table}var WI=Q.forwardRef(({fallback:e,roleTable:t=lr.CURRENT_ORGANIZATION,offeredRoles:n,...r},i)=>{let a=ahe({table:ihe(),roleTable:t,offeredRoles:n});return a?(0,$.jsx)(UI,{ref:i,roles:a,...r}):(0,$.jsx)($.Fragment,{children:e})});WI.displayName=`FormFieldStringOrganizationRoleOrFallback`;var GI=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=Jd.MD,type:m,clearable:h,offeredValues:g},_)=>{let v=m??`text`,y=Lte(e);$a(e);let b=re(e),x=y?.edit?.textareaRows??4,[S,C]=Q.useState(c??``),w=C_(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 Ft.INPUT:return(0,$.jsx)(eN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});case Ft.TEXTAREA:return(0,$.jsx)(NI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,rows:x,autoComplete:d});case Ft.MARKDOWN:return(0,$.jsx)(FI,{value:T,onChange:E,onBlur:D,placeholder:u,disabled:n,readOnly:r,autoFocus:f,minRows:x,ariaLabel:t,className:i});case Ft.COLOR:return(0,$.jsx)(II,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u});case Ft.YEAR_MONTH:return(0,$.jsx)(LI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h});case Ft.PASSWORD:return(0,$.jsx)(RI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d});case Ft.OTP:{let r=lee(e)?.maxLength??6;return(0,$.jsx)(BI,{ref:_,name:t,className:i,maxLength:r,value:T,onChange:E,onBlur:D,disabled:n,autoComplete:d,autoFocus:f,controlSize:p,children:(0,$.jsx)(VI,{children:Array.from({length:r},(e,t)=>(0,$.jsx)(HI,{index:t},t))})})}case Ft.ORGANIZATION_ROLE:{let e=(0,$.jsx)(eN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});return(0,$.jsx)(WI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h,fallback:e,roleTable:y?.edit?.organizationRoleTable??lr.CURRENT_ORGANIZATION,...g?{offeredRoles:g}:{}})}default:return(0,$.jsx)(eN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v})}}),KI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_STRING,`FormFieldString`)(e);return(0,$.jsx)(r,{...t,ref:n})});KI.displayName=`FormFieldString`;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,step:d,min:f,max:p,autoFocus:m,clearable:h,controlSize:g=Jd.MD},_)=>{let{renderIcon:v}=kf(),y=g===Jd.SM?Gd.ICON_SM:Gd.ICON;Or(e);let b=aae(e),x=fre(e),S=f??x.min,C=p??x.max,w=d??x.step??1,[T,E]=Q.useState(c??0),D=C_(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 pn.INPUT:return(0,$.jsx)(eN,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C});case pn.SLIDER:return(0,$.jsx)(XM,{ref:_,...P,value:[O],onValueChange:e=>A(e[0]),onBlur:j,min:S??0,max:C??100,step:w,showValue:!0});case pn.STEPPER:let e=t??`stepper-field`;return(0,$.jsxs)(`div`,{className:W(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:y,onClick:N,disabled:n||S!==void 0&&O<=S,children:v(H.MINUS,{size:Jn.SM})}),(0,$.jsx)(tN,{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:Y.OUTLINE,size:y,onClick:M,disabled:n||C!==void 0&&O>=C,children:v(H.PLUS,{size:Jn.SM})})]});default:return(0,$.jsx)(eN,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C})}}),JI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_NUMBER,`FormFieldNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});JI.displayName=`FormFieldNumber`;var YI=Q.forwardRef(({controlSize:e,className:t,wrapperClassName:n,children:r,disabled:i,...a},o)=>{let{getRecipe:s,fieldVariant:c}=Ig(),{renderIcon:l}=kf(),u=s(_t.FORM_CONTROL,Pg(c));return(0,$.jsxs)(`div`,{"data-slot":`native-select`,className:W(`relative flex`,n),children:[(0,$.jsx)(`select`,{ref:o,disabled:i,"data-size":e,className:W(`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:Jn.SM,className:`opacity-[var(--opacity-muted)]`})})]})});YI.displayName=`ThemedNativeSelect`;function ohe(e,t,n){return me(e,t).map(e=>{let t=_[e],r=n(e);return{value:e,label:`${t.symbol} ${r}`}}).sort((e,t)=>{let n=_[e.value],r=_[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var XI=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=Jd.MD},h)=>{let{tSystemEnum:g,tComponent:_,isReady:v}=J({component:U.LOW_LEVEL_FORM_FIELD_MONEY,keys:[`system_enums`]}),{getRecipe:y,fieldVariant:b}=Ig(),x=y(_t.FORM_CONTROL,Pg(b)),S=Q.useCallback(e=>g(_o.AVAILABLE_CURRENCY,e),[g]),C=$r(e),w=C?.currenciesAllowed,T=C?.appEnabledOnly??!0,E=C?.allowCurrencyChange??!0,D=Q.useMemo(()=>ohe(w,T,S),[w,T,S]),O=Q.useCallback(e=>eu(e)?.decimals??2,[]),k=Q.useCallback(()=>lae(e),[e]),[A,j]=Q.useState(c??k()),M=C_(a,o),N=a??A,P=Q.useMemo(()=>N.amount===0n?``:Tl(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=Pn(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:It(N.amount,N.decimals,t),currency:e,decimals:t};M?o?.(n):j(n)},[N,M,o,O]),L=Q.useCallback(()=>{s?.()},[s]),ee=`field-${t}`,R=eu(N.currency)?.symbol??N.currency;return(0,$.jsxs)(`div`,{className:W(`flex gap-element`,i),children:[(0,$.jsx)(tN,{ref:h,id:ee,type:`number`,step:10**-N.decimals,min:C?.minAmount===void 0?void 0:Tl(C.minAmount,N.decimals),max:C?.maxAmount===void 0?void 0:Tl(C.maxAmount,N.decimals),value:P,onChange:F,onBlur:L,disabled:n,readOnly:r,placeholder:u??`0.00`,prefix:R,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:f,controlSize:m}),E?(0,$.jsx)(YI,{value:N.currency,onChange:e=>I(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-32`,"aria-label":_(U.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:W(`flex items-center text-sm text-muted-foreground`,x.sizes?.[m]),children:S(N.currency)})]})}),ZI=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_MONEY,`FormFieldMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});ZI.displayName=`FormFieldMoney`;var she=[yu.SECONDS,yu.MINUTES,yu.HOURS,yu.DAYS,yu.WEEKS],QI=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=Jd.MD},m)=>{let{tSystemEnum:h,tComponent:g,isReady:_}=J({component:U.LOW_LEVEL_FORM_FIELD_DURATION,keys:[`system_enums`]}),v=Nre(e),y=v?.allowedUnits&&v.allowedUnits.length>0?v.allowedUnits:she,b=v?.minValue,x=v?.maxValue,S=Q.useCallback(e=>h(_o.DURATION_UNIT,e),[h]),C=Q.useCallback(()=>Ri(e),[e]),[w,T]=Q.useState(c??C()),E=C_(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:W(`flex gap-element`,i),children:[(0,$.jsx)(tN,{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)(YI,{value:D.unit,onChange:e=>A(e.target.value),disabled:n||r,controlSize:p,wrapperClassName:`w-32`,"aria-label":g(U.LOW_LEVEL_FORM_FIELD_DURATION,`unit`),children:y.map(e=>(0,$.jsx)(`option`,{value:e,children:S(e)},e))})]})});QI.displayName=`FormFieldDuration_Preset_Default`;var $I=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_DURATION,`FormFieldDuration`)(e);return(0,$.jsx)(r,{...t,ref:n})});$I.displayName=`FormFieldDuration`;var eL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_INPUT_GROUP,`InputGroup`)(e);return(0,$.jsx)(r,{...t,ref:n})});eL.displayName=`InputGroup`;function tL({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INPUT_GROUP_ADDON,`InputGroupAddon`)(e);return(0,$.jsx)(n,{...t})}function nL({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INPUT_GROUP_BUTTON,`InputGroupButton`)(e);return(0,$.jsx)(n,{...t})}function che({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INPUT_GROUP_TEXT,`InputGroupText`)(e);return(0,$.jsx)(n,{...t})}function rL({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INPUT_GROUP_INPUT,`InputGroupInput`)(e);return(0,$.jsx)(n,{...t})}function iL({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INPUT_GROUP_TEXTAREA,`InputGroupTextarea`)(e);return(0,$.jsx)(n,{...t})}var lhe=`US`;function uhe(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 dhe(e){let t;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{t=void 0}let n=new Intl.Collator(e);return sa().map(e=>({code:e,name:t?.of(e)??e,dialCode:Pt(e)})).sort((e,t)=>n.compare(e.name,t.name))}function fhe(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 phe(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 aL=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=Jd.MD},p)=>{let{tComponent:m,currentLanguage:h}=J({component:[U.LOW_LEVEL_FORM_FIELD_PHONE]}),g=Vi(e)?.defaultCountry??lhe,_=Q.useMemo(()=>dhe(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=Gn(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=phe(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=Gn(n,e);return r?r.format(`E.164`):`+${Pt(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?ma(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=te(t);if(e){let n=Pt(e),r=t.replace(/\D/g,``),i=r.startsWith(n)?r.slice(n.length):r,a=O(e,i),s=Gn(a),c=s?s.formatNational():ma(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:ma(t,v);C.current=i?null:fhe(t,n),x(a),T.current=a,k(v,a)},[v,k,o,O]),M=Q.useCallback(()=>{s?.()},[s]),N=Q.useMemo(()=>l||kte(v)||``,[l,v]),P=Pt(v),F=`field-${t}`,I=m(U.LOW_LEVEL_FORM_FIELD_PHONE,`country`);return(0,$.jsxs)(eL,{className:W(`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:W(`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:uhe(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)(rL,{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`})]})});aL.displayName=`FormFieldPhone_Preset_Default`;var oL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_PHONE,`FormFieldPhone`)(e);return(0,$.jsx)(r,{...t,ref:n})});oL.displayName=`FormFieldPhone`;var sL=[{part:ki.LINE1,autoComplete:`address-line1`},{part:ki.LINE2,autoComplete:`address-line2`},{part:ki.CITY,autoComplete:`address-level2`},{part:ki.STATE,autoComplete:`address-level1`},{part:ki.POSTAL_CODE,autoComplete:`postal-code`}];function cL(e,t){return{[ki.LINE1]:e?.line1??``,[ki.LINE2]:e?.line2??``,[ki.CITY]:e?.city??``,[ki.STATE]:e?.state??``,[ki.POSTAL_CODE]:e?.postalCode??``,[ki.COUNTRY]:e?.country??t??``,[cr.LATITUDE]:e?.coordinates?String(e.coordinates.latitude):``,[cr.LONGITUDE]:e?.coordinates?String(e.coordinates.longitude):``}}function lL(e){return e.trim()===``?NaN:Number(e)}function mhe(e){let t=sL.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:lL(e.latitude),longitude:lL(e.longitude)}}}}function hhe(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]:sa()).map(e=>({code:e,name:n?.of(e)??e})).sort((e,t)=>r.compare(e.name,t.name))}var uL=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=Jd.MD},m)=>{let{tComponent:h,currentLanguage:g}=J({component:[U.LOW_LEVEL_FORM_FIELD_ADDRESS]}),_=Ree(e),v=_?.defaultCountry,y=_?.withCoordinates===!0,b=a??c,[x,S]=Q.useState(()=>cL(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=cL(b,v);C.current=e,S(e)},[T,v]);let E=Q.useMemo(()=>hhe(g,_?.countriesAllowed),[g,_?.countriesAllowed]),D=Q.useCallback(e=>{C.current=e,S(e);let t=mhe(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(cL(n,v))},[D,v,k]),j=Q.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||s?.()},[s]),M=`field-${t}`,N=e=>e===ki.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)(ox,{htmlFor:r,className:`text-sm text-muted-foreground`,children:t}),n({id:r,...i&&{"aria-invalid":!0,"aria-describedby":a}}),i&&(0,$.jsx)(ux,{id:a,children:i})]},e)},F=({part:e,autoComplete:i})=>P(e,h(U.LOW_LEVEL_FORM_FIELD_ADDRESS,e),a=>(0,$.jsx)(tN,{...a,ref:e===ki.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===ki.LINE1?l:void 0,controlSize:p})),I=e=>P(`coordinates.${e}`,h(U.LOW_LEVEL_FORM_FIELD_ADDRESS,e),i=>(0,$.jsx)(tN,{...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})),[L,ee,R,z,te]=sL,ne=E.some(e=>e.code===x.country);return(0,$.jsxs)(`div`,{className:W(`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(L),F(ee),(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[F(R),F(te)]}),F(z),P(ki.COUNTRY,h(U.LOW_LEVEL_FORM_FIELD_ADDRESS,ki.COUNTRY),e=>(0,$.jsxs)(YI,{...e,name:`${t}.${ki.COUNTRY}`,value:x.country,onChange:e=>O(ki.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(U.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(cr.LATITUDE),I(cr.LONGITUDE)]})]})});uL.displayName=`FormFieldAddress_Preset_Default`;var dL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_ADDRESS,`FormFieldAddress`)(e);return(0,$.jsx)(r,{...t,ref:n})});dL.displayName=`FormFieldAddress`;var fL;(function(e){e.MAIN_SCHEMA=`main-schema`,e.PATCH_REQUEST_DTO=`patch-request-dto`,e.VALUE_OBJECT=`value-object`})(fL||={});var ghe={[fL.MAIN_SCHEMA]:{isClearable:nt,normalizeClearedValue:Le},[fL.PATCH_REQUEST_DTO]:{isClearable:xr,normalizeClearedValue:Kr},[fL.VALUE_OBJECT]:{isClearable:dte,normalizeClearedValue:pre}};function _he({schemaKind:e,rootSchema:t,fieldName:n}){if(e===Zw.MAIN_SCHEMA)return fL.MAIN_SCHEMA;if(!t)return fL.PATCH_REQUEST_DTO;let r=n.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).slice(0,-1).join(`.`),i=r?mr.resolveFieldSchemaPath(t,r):t;return i?w(i)?fL.PATCH_REQUEST_DTO:fL.VALUE_OBJECT:fL.PATCH_REQUEST_DTO}var pL=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,required:m,autoFocus:h,controlSize:g=Jd.MD},_)=>{let{formatNumber:v,isReady:y}=J({component:U.LOW_LEVEL_FORM_FIELD_BIGDECIMAL}),{renderIcon:b}=kf(),x=g===Jd.SM?Gd.ICON_SM:Gd.ICON,S=fc(e),C=Or(e),w=S?.edit?.editMode??C?.edit?.editMode??pn.INPUT,T=al(e),E=f??T.min,D=p??T.max,O=T.precision,k=d??(O===void 0?`1`:new oo(1).div(new oo(10).pow(O)).toString()),A=fc(e)?.edit?.defaultValue,[j,M]=Q.useState(c??A??`0`),N=C_(a,o),P=a??j,F=Q.useMemo(()=>{try{return parseFloat(P)}catch{return 0}},[P]),I=Q.useCallback(e=>{N?o?.(e):M(e)},[N,o]),L=Q.useCallback(()=>{s?.()},[s]),ee=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`||t===`-.`)N?o?.(t):M(t);else try{new oo(t),I(t)}catch{/^-?\d*\.?\d*$/.test(t)&&(N?o?.(t):M(t))}},[N,o,I]),R=()=>{try{let e=new oo(P||`0`),t=new oo(k),n=e.plus(t);(D===void 0||n.lte(new oo(D)))&&I(n.toString())}catch{I(k)}},z=()=>{try{let e=new oo(P||`0`),t=new oo(k),n=e.minus(t);(E===void 0||n.gte(new oo(E)))&&I(n.toString())}catch{I(new oo(k).neg().toString())}},te=Q.useCallback(e=>{let t=e[0];I(O===void 0?t.toString():t.toFixed(O))},[I,O]);switch(w){case pn.INPUT:return(0,$.jsx)(tN,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:ee,onBlur:L,disabled:n,readOnly:r,placeholder:u,className:W(`tabular-nums`,i),autoFocus:h,controlSize:g});case pn.SLIDER:let e=E?parseFloat(E):0,a=D?parseFloat(D):100,o=parseFloat(k);return(0,$.jsxs)(`div`,{ref:_,className:W(`flex items-center gap-field`,i),children:[(0,$.jsx)(ZM,{value:[F],onValueChange:te,onValueCommit:()=>L(),min:e,max:a,step:o,disabled:n,className:`flex-1`,controlSize:g}),(0,$.jsx)(`span`,{className:`min-w-[4rem] text-end text-sm tabular-nums`,children:v(F)})]});case pn.STEPPER:let s=t??`stepper-field`,c=E!==void 0&&(()=>{try{return new oo(P||`0`).lte(new oo(E))}catch{return!1}})(),l=D!==void 0&&(()=>{try{return new oo(P||`0`).gte(new oo(D))}catch{return!1}})();return(0,$.jsxs)(`div`,{className:W(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:x,onClick:z,disabled:n||r||c,children:b(H.MINUS,{size:Jn.SM})}),(0,$.jsx)(tN,{ref:_,id:s,type:`text`,inputMode:`decimal`,value:P,onChange:ee,onBlur:L,disabled:n,readOnly:r,className:`w-24 text-center tabular-nums`,autoFocus:h,controlSize:g}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:x,onClick:R,disabled:n||r||l,children:b(H.PLUS,{size:Jn.SM})})]});default:return(0,$.jsx)(tN,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:ee,onBlur:L,disabled:n,readOnly:r,placeholder:u,className:W(`tabular-nums`,i),autoFocus:h,controlSize:g})}}),mL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,`FormFieldBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});mL.displayName=`FormFieldBigDecimal`;var hL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_CODE,`FormFieldCode`)(e);return(0,$.jsx)(r,{...t,ref:n})});hL.displayName=`FormFieldCode`;var gL=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=Jd.MD},_)=>{let{tComponent:v,isReady:y}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL}),b=he(e),x=al(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=C_(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`,L=`${I}-from`,ee=`${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:L,className:`sr-only`,children:f}),(0,$.jsx)(tN,{ref:_,id:L,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:ee,className:`sr-only`,children:p}),(0,$.jsx)(tN,{id:ee,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(U.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),_L=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,`FormFieldRangeBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});_L.displayName=`FormFieldRangeBigDecimal`;function vhe(e,t){let n=Object.keys(_);return t&&(n=Fre()),n=n.filter(t=>Bne(t,e)),n.map(e=>({value:e,label:`${_[e].symbol} ${e}`})).sort((e,t)=>{let n=_[e.value],r=_[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var vL=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=Jd.MD},h)=>{let{tComponent:g,isReady:_}=J({component:U.LOW_LEVEL_FORM_FIELD_RANGE_MONEY}),{getRecipe:v,fieldVariant:y}=Ig(),b=v(_t.FORM_CONTROL,Pg(y)),x=$r(e),S=yre(e),C=he(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(()=>vhe(w,T),[w,T]),N=Q.useCallback(e=>eu(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,L]=Q.useState(c?.from?.currency??c?.to?.currency??E),ee=C_(a,o),R=a??P,z=N(I),te=Q.useMemo(()=>!R.from||!R.to||R.from.amount===0n&&R.to.amount===0n?!1:Tl(R.from.amount,R.from.decimals)>Tl(R.to.amount,R.to.decimals),[R.from,R.to]),ne=Q.useMemo(()=>!R.from||R.from.amount===0n?``:Tl(R.from.amount,R.from.decimals).toFixed(R.from.decimals),[R.from]),re=Q.useMemo(()=>!R.to||R.to.amount===0n?``:Tl(R.to.amount,R.to.decimals).toFixed(R.to.decimals),[R.to]),ie=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Pn(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,from:n};ee?o?.(r):F(r)},[R,I,z,ee,o]),ae=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Pn(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,to:n};ee?o?.(r):F(r)},[R,I,z,ee,o]),oe=Q.useCallback(e=>{let t=N(e);L(e);let n,r;R.from&&R.from.amount!==0n&&(n={amount:It(R.from.amount,R.from.decimals,t),currency:e,decimals:t}),R.to&&R.to.amount!==0n&&(r={amount:It(R.to.amount,R.to.decimals,t),currency:e,decimals:t});let i={from:n,to:r};ee?o?.(i):F(i)},[R,N,ee,o]),se=Q.useCallback(()=>{s?.()},[s]),ce=t??`range-money-field`,le=`${ce}-from`,ue=`${ce}-to`,de=eu(I)?.symbol??I;return _?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(tN,{ref:h,id:le,type:`number`,step:10**-z,value:ne,onChange:ie,onBlur:se,disabled:n,readOnly:r,placeholder:u,prefix:de,wrapperClassName:`flex-1`,className:W(`tabular-nums`,te&&`border-destructive`),"aria-invalid":te,"aria-required":!A,min:O===void 0?void 0:Tl(O,z),max:k===void 0?void 0:Tl(k,z),autoFocus:p,controlSize:m}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsx)(tN,{id:ue,type:`number`,step:10**-z,value:re,onChange:ae,onBlur:se,disabled:n,readOnly:r,placeholder:d,prefix:de,wrapperClassName:`flex-1`,className:W(`tabular-nums`,te&&`border-destructive`),"aria-invalid":te,"aria-required":!j,min:O===void 0?void 0:Tl(O,z),max:k===void 0?void 0:Tl(k,z),controlSize:m}),D?(0,$.jsx)(YI,{value:I,onChange:e=>oe(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-24`,"aria-label":g(U.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:W(`flex items-center text-sm text-muted-foreground`,b.sizes?.[m]),children:I})]}),te&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:g(U.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),yL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`FormFieldRangeMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});yL.displayName=`FormFieldRangeMoney`;var bL=class extends Error{};function xL(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 bL(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 yhe(e){let t=Date.now()+(e.timeoutMs??12e4),n=e.metadata;for(;;){if(e.signal.throwIfAborted(),n&&n.fileId!==e.fileId||n&&!Object.values(S).includes(n.readiness))throw new bL(e.unverifiedMessage);if(n?.readiness===S.READY)return n;if(n&&n.readiness!==S.PROCESSING)throw new bL(e.unavailableMessage);if(e.onPending(),!e.getMetadata||Date.now()>=t)throw new bL(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 xL(e.getMetadata,e.signal,t-Date.now(),e.unverifiedMessage)}catch{throw e.signal.throwIfAborted(),new bL(e.unverifiedMessage)}}}function SL(e,t){return t||(!e||typeof e!=`object`?Kn.ON_BLUR:$ne(e)?Kn.ON_CHANGE:Kn.ON_BLUR)}function bhe(e){return e.issues[0]?.code??`unknown`}function CL(e){let t={};for(let[n,r]of Object.entries(e))n!==`code`&&n!==`message`&&n!==`path`&&(t[n]=r);return t}function xhe(e){let t=Zu(e.schema);return t?{allowedMimeTypes:t.allowedMimeTypes,maxSize:t.maxSize,maxFiles:t.maxFiles}:{}}var She={[Oc.IMAGE]:`accepted_type_image`,[Oc.VIDEO]:`accepted_type_video`,[Oc.AUDIO]:`accepted_type_audio`,[Oc.PDF]:`accepted_type_pdf`,[Oc.OFFICE]:`accepted_type_office`,[Oc.ARCHIVE]:`accepted_type_archive`,[Oc.ALL]:`accepted_types_all`},Che={[fn.TEXT]:`accepted_type_text`,[fn.MARKDOWN]:`accepted_type_markdown`,[fn.JSON]:`accepted_type_json`,[fn.TYPESCRIPT]:`accepted_type_typescript`,[fn.TYPESCRIPT_JSX]:`accepted_type_typescript_react`,[fn.YAML]:`accepted_type_yaml`};function wL(e,t){let n=e=>t(U.LOW_LEVEL_FORM_FIELD_FILE,e);return e.length===0?n(`accepted_types_all`):e.map(e=>{switch(e.category){case Ec.NATURE:return n(She[e.nature]);case Ec.AGENT_FORMAT:return n(Che[e.format]);case Ec.MIME_SUBTYPE:return e.subtype.toUpperCase()}}).join(`, `)}var TL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_IMAGE_CROP,`ImageCrop`)(e);return(0,$.jsx)(r,{...t,ref:n})});TL.displayName=`ImageCrop`;function EL(e){return!(!e.type.startsWith(`image/`)||e.type===`image/svg+xml`)}async function DL(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 OL(e,t,n,r){return Math.max(n/e,r/t)}function kL(e,t,n,r){let i=Math.max(0,(t*n-r)/2);return Math.min(i,Math.max(-i,e))}function AL(e){let{naturalWidth:t,naturalHeight:n,viewportWidth:r,viewportHeight:i,transform:a}=e,o=OL(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 jL=`image/png`,ML=`image/jpeg`,NL=`image/webp`,PL=[jL,ML,NL],whe={[jL]:`png`,[ML]:`jpg`,[NL]:`webp`},The=[.92,.85,.78,.7,.6,.5];function FL(e){return PL.some(t=>Ar(t,e))}function Ehe(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function IL(e,t){return`${e.replace(/\.[^./\\]+$/,``)}.${t}`}async function LL(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=PL.filter(e=>Ar(e,s)),m=[];p.includes(r.type)&&r.type!==ML&&m.push(r.type);for(let e of[jL,NL,ML])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],IL(r.name,whe[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===ML&&(f.save(),f.globalCompositeOperation=`destination-over`,f.fillStyle=`#ffffff`,f.fillRect(0,0,l,u),f.restore());let t=e===jL?[void 0]:The;for(let n of t){let t=await Ehe(d,e,n);if(!t)continue;let r=_(t);if(r)return r;if(e===jL)break}}if(!g)throw Error(`image_encode_failed`);return h(g)}function Dhe(e){return e!=null&&`fileId`in e}function RL(e){return e!=null&&`fileIds`in e}var Ohe=0;function zL(){return`upload-${Date.now()}-${++Ohe}`}function BL(e){return e instanceof Error?e.code===`ERR_CANCELED`||e.name===`AbortError`:!1}function VL(e,t){return t&&e.override?e.override:e.upload}function khe(e,t){return!!VL(e,t)}function HL(e){return!!e.upload}function Ahe(e,t){return e&&e.trim()!==``?e:t}function UL(e,t){return t instanceof bL?t.message:e}var WL=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:x,isReady:C,formatByteSize:w}=J({component:U.LOW_LEVEL_FORM_FIELD_FILE,keys:[`errors_validation`,`system_enums`]}),{frontendProviderRegistry:T}=Eu(),{renderIcon:E}=kf(),{getRecipe:D}=Ig(),O=D(_t.FORM_CONTROL,na.DEFAULT),k=d??y(U.LOW_LEVEL_FORM_FIELD_FILE,`choose_file`),A=f??y(U.LOW_LEVEL_FORM_FIELD_FILE,`replace`),j=y(U.LOW_LEVEL_FORM_FIELD_FILE,`drag_and_drop`),M=y(U.LOW_LEVEL_FORM_FIELD_FILE,`remove`),N=y(U.LOW_LEVEL_FORM_FIELD_FILE,`upload_failed`),P=y(U.LOW_LEVEL_FORM_FIELD_FILE,`metadata_load_failed`),F=y(U.LOW_LEVEL_FORM_FIELD_FILE,`uploads_unavailable`),I=y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),L=Zu(e),ee=xhe({schema:e}),R=ee.allowedMimeTypes,z=ee.maxSize,te=L?.minSize,ne=L?.overridable??!0,re=R?b(R):void 0,ie=L?.multiple??!1,ae=ee.maxFiles,oe=L?.imageConstraints,se=L?.videoConstraints,ce=L?.audioConstraints,le=L?.documentConstraints,ue=SL(e,l),[de,fe]=Q.useState(a??null),[pe,me]=Q.useState(),he=Q.useRef(n);Q.useEffect(()=>{he.current!==void 0&&n==null&&pe&&me(void 0),he.current=n},[n,pe]);let[ge,_e]=Q.useState(new Map),ve=Q.useRef(ge);ve.current=ge;let[ye,B]=Q.useState(0),[be,xe]=Q.useState(new Map),[Se,Ce]=Q.useState(!1),we=Q.useRef(new Set),Te=Q.useRef(0),[Ee,De]=Q.useState(new Set),Oe=y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_processing`),ke=y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_unavailable`),Ae=y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_readiness_unverified`),je=Q.useCallback(()=>{Te.current+=1;for(let e of we.current)e.abort();for(let e of ve.current.values())e.abortController.abort();we.current.clear()},[]),Me=Q.useRef(null),Ne=C_(n,r),Pe=n??de,Fe=Array.from(ge.values()).some(e=>e.status===`uploading`),Ie=Dhe(Pe)?Pe.fileId:null,Le=RL(Pe)?Pe.fileIds:[],Re=ie?HL(u):khe(u,Ie),ze=Q.useRef(Le);ze.current=Le;let Be=Q.useMemo(()=>Le.join(`,`),[Le]),Ve=Q.useRef(be);Ve.current=be;let He=Ie?be.get(Ie)??null:null,Ue=Ie?[Ie]:Le,We=Ue.some(e=>be.get(e)?.readiness===S.UNAVAILABLE)?ke:Ue.some(e=>![S.READY,S.ATTACHED].includes(be.get(e)?.readiness))?Oe:void 0,Ge=Array.from(ge.values()).find(e=>e.status===`error`)?.error,Ke=Fe||Ee.size>0?Oe:Ge??We;Q.useEffect(()=>{p?.(pe??Ke)},[pe,Ke,p]);let qe=Q.useCallback(async e=>h.get(e),[h]),Je=Q.useCallback(async e=>h.delete(e),[h]);Q.useEffect(()=>()=>je(),[u.getMetadata,u.upload,u.override,h,qe,je]);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,xe(new Map)),e.length===0){xe(new Map),me(e=>e===P?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&&[S.READY,S.ATTACHED,S.UNAVAILABLE].includes(n.readiness))){if(!u.getMetadata)o=!0;else try{let n=await xL(()=>qe(`${u.getMetadata}/${encodeURIComponent(e)}/metadata`),r.signal,12e4,P);if(n.fileId!==e||!Object.values(S).includes(n.readiness))throw Error(`Invalid file metadata`);s.set(e,n),n.readiness===S.PROCESSING&&(t=!0)}catch{o=!0,t=!0,console.warn(`Unable to load file metadata for one or more files.`)}}})),n||(xe(e=>{let t=new Map(e);for(let[e,n]of s)t.set(e,n);return t}),me(e=>o?P:e===P?void 0:e),t&&(i=setTimeout(a,2e3)))};return a(),()=>{n=!0,r.abort(),i&&clearTimeout(i)}},[Ie,Be,u.getMetadata,qe,P]);let Xe=Q.useCallback(async(e,t)=>{let n=new AbortController,r=()=>n.abort();t?.aborted&&n.abort(),t?.addEventListener(`abort`,r,{once:!0}),we.current.add(n);try{let t=await yhe({...e,signal:n.signal,getMetadata:u.getMetadata?()=>qe(`${u.getMetadata}/${encodeURIComponent(e.fileId)}/metadata`):void 0,onPending:()=>De(t=>new Set(t).add(e.fileId)),unavailableMessage:ke,unverifiedMessage:Ae});return n.signal.throwIfAborted(),{fileId:e.fileId,metadata:t}}finally{t?.removeEventListener(`abort`,r),we.current.delete(n),De(t=>{let n=new Set(t);return n.delete(e.fileId),n})}},[qe,u.getMetadata,ke,Ae]),Ze=Q.useCallback(e=>{if(R&&R.length>0&&!Ar(e.type,R)){let e=wL(_r(R),y);return y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_type_not_allowed`,{accepted:e})}},[R,y]),Qe=Q.useCallback(e=>{let t=Ze(e);if(t)return t;if(z&&e.size>z){let e=w(z);return y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_too_large`,{max:e})}if(te&&e.size<te){let e=w(te);return y(U.LOW_LEVEL_FORM_FIELD_FILE,`file_too_small`,{min:e})}},[Ze,z,te,y,w]),$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 xL(s,a,void 0,Ae):await s();return a?.throwIfAborted(),Xe(c,a)},[h,Xe,Ae]),et=Q.useCallback(async t=>{je();let n=Te.current,i=VL(u,Ie);if(!i){me(F);return}let a=Qe(t);if(a){me(a);return}let o=zL(),s=new AbortController;_e(new Map([[o,{tempId:o,fileName:t.name,progress:0,status:`uploading`,abortController:s}]])),B(0),p?.(Oe),me(void 0);try{let a=await $e(t,i,!!Ie,Ie,e=>{B(e),_e(t=>{let n=new Map(t),r=n.get(o);return r&&n.set(o,{...r,progress:e}),n})},s.signal);if(n!==Te.current)return;let c={fileId:a.fileId,updatedAt:new Date};if(Ne||fe(c),r?.(c),a.metadata&&xe(e=>{let t=new Map(e);return t.set(a.fileId,a.metadata),t}),ue!==`onSubmit`){let t=e.safeParse(c);if(!t.success){let e=t.error.issues[0];if(e){let t={...CL(e),message:e.message},n=v(e.code,`msg`,t);me(n)}}}}catch(e){if(s.signal.aborted||n!==Te.current||BL(e))return;me(UL(N,e))}finally{_e(e=>{let t=new Map(e);return t.delete(o),t}),B(0)}},[Ie,u,Ne,r,F,Qe,ue,e,v,$e,je,p,Oe,N]),tt=Q.useCallback(async e=>{let t=Te.current;if(!HL(u)){me(F);return}let n=ze.current.length;if(ae&&n+e.length>ae){me(y(U.LOW_LEVEL_FORM_FIELD_FILE,`too_many_files`,{max:ae}));return}let i=[];for(let t of e){let e=Qe(t);if(e){me(e);return}i.push(t)}p?.(Oe),me(void 0);let a=new Map,o=[];for(let e of i){let t=zL(),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})}_e(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=>{_e(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,progress:t}),r})},r.signal);return _e(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&&xe(e=>{let n=new Map(e);return n.set(t.fileId,t.metadata),n}),t.fileId}catch(n){throw r.signal.aborted||t!==Te.current||BL(n)?(_e(t=>{let n=new Map(t);return n.delete(e),n}),n):(_e(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,status:`error`,error:UL(N,n)}),r}),n)}})),c=[];for(let e of s)e.status===`fulfilled`&&c.push(e.value);if(c.length>0&&t===Te.current){let e=[...ze.current,...c];ze.current=e;let t={fileIds:e,updatedAt:new Date};Ne||fe(t),r?.(t)}_e(e=>{let t=new Map(e);for(let[e,n]of t)n.status===`done`&&t.delete(e);return t})},[u,Ne,ae,r,y,$e,Qe,N,F,p,Oe]),nt=oe?.aspectRatio,rt=nte(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(ie)tt(e);else{let t=e[0];if(nt&&EL(t)&&FL(R)){let e=Ze(t);if(e){me(e);return}me(void 0),at(t);return}et(t)}}},[ie,tt,et,nt,Ze,R]),ut=Q.useCallback(async(e,t)=>{ie||je();let n=Te.current,i=ie?t:t.slice(0,1),a=ie?u.upload:VL(u,Ie);if(!a){me(F);return}p?.(Oe),me(void 0);let o=await Promise.allSettled(i.map(async t=>{let n=zL();De(e=>new Set(e).add(n));let r=new AbortController;we.current.add(r);try{let n=await xL(()=>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,Ae);r.signal.throwIfAborted();let i=await Xe(n,r.signal);return i.metadata&&xe(e=>{let t=new Map(e);return t.set(i.fileId,i.metadata),t}),i.fileId}finally{we.current.delete(r),De(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===Te.current){let e=ie?{fileIds:[...ze.current,...s],updatedAt:new Date}:{fileId:s[0],updatedAt:new Date};RL(e)&&(ze.current=e.fileIds),Ne||fe(e),r?.(e)}if(s.length<i.length&&n===Te.current){let e=o.find(e=>e.status===`rejected`);me(UL(y(U.LOW_LEVEL_FORM_FIELD_FILE,`provider_link_failed`),e?.status===`rejected`?e.reason:void 0))}},[Ie,u,h,Ne,ie,r,F,y,Xe,je,p,Oe,Ae]),dt=Q.useCallback(async(e,t)=>{ie||je();let n=Te.current,r=new AbortController,i=zL();we.current.add(r),p?.(Oe),De(e=>new Set(e).add(i));try{let i=[],a=[],o=!1;for(let e of t)if(e.kind===hd.BROWSER_READABLE_FILE)i.push(e.file);else if(e.kind===hd.BROWSER_READABLE_URL)try{let t=await xL(()=>fetch(e.url,{signal:r.signal}),r.signal,12e4,Ae);if(!t.ok){o=!0;continue}let n=await xL(()=>t.blob(),r.signal,12e4,Ae);i.push(new File([n],e.displayName??`file`,{type:e.mimeType??n.type}))}catch{if(r.signal.aborted||n!==Te.current)return;o=!0}else a.push(e);if(r.signal.aborted||n!==Te.current)return;if(a.length>0){await ut(e,a);return}if(o&&i.length===0){me(y(U.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`));return}if(i.length===0)return;me(o?y(U.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`):void 0),lt(i)}finally{we.current.delete(r),De(e=>{let t=new Set(e);return t.delete(i),t})}},[lt,ut,y,ie,je,p,Oe,Ae]),ft=Q.useCallback(()=>{me(y(U.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)),Me.current&&(Me.current.value=``)},[lt]),mt=o||s,ht=mt||!Re,gt=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),!ht&&!Fe&&Ce(!0)},[ht,Fe]),vt=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),Ce(!1)},[]),yt=Q.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),Ce(!1),ht||Fe)return;let t=e.dataTransfer.files;t&&t.length>0&&lt(Array.from(t))},[ht,Fe,lt]),bt=Q.useCallback(async()=>{if(je(),Ie){if(u.delete)try{let e=`${u.delete}/${encodeURIComponent(Ie)}`;await Je(e)}catch(e){if(BL(e))return;me(UL(N,e));return}me(void 0),Ne||fe(null),r?.(null),xe(e=>{let t=new Map(e);return t.delete(Ie),t})}},[Ie,u,Ne,r,Je,N]),xt=Q.useCallback(async e=>{if(je(),u.delete)try{let t=`${u.delete}/${encodeURIComponent(e)}`;await Je(t)}catch(e){if(BL(e))return;me(UL(N,e));return}me(void 0);let t=ze.current.filter(t=>t!==e);ze.current=t;let n=t.length>0?{fileIds:t,updatedAt:new Date}:null;Ne||fe(n),r?.(n),xe(t=>{let n=new Map(t);return n.delete(e),n})},[u,Ne,r,Je,N]),St=Q.useCallback(e=>{let t=ve.current.get(e);t&&t.abortController.abort(),_e(t=>{let n=new Map(t);return n.delete(e),n})},[]),Ct=Q.useCallback(()=>{!ht&&!Fe&&Me.current?.click()},[ht,Fe]),wt=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,Tt=(e,t=Jn.MD)=>E(wt(e),{size:t}),Et=wL(_r(R),y),Dt=L?.nature,Ot=(e,t=!1)=>mt?null:(0,$.jsxs)(`div`,{className:W(`flex items-center gap-element`,t?`flex-shrink-0`:``),children:[!t&&ne&&Re&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Gd.SM,onClick:Ct,disabled:Fe,children:A}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,onClick:e,disabled:Fe,className:W(`text-destructive hover:text-destructive`,t&&`h-6 w-6 p-0`),"aria-label":M,title:M,children:E(H.CLOSE,{size:Jn.SM})})]}),V=(e,t,n=!1)=>(0,$.jsxs)(`div`,{className:W(`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:W(`font-medium text-primary hover:underline truncate`,n&&`text-sm`),children:t.filename}):(0,$.jsx)(`span`,{className:W(`font-medium truncate`,n&&`text-sm`),children:Ahe(t?.filename,I)})}),(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:w(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:Tt(e.mimeType,Jn.MD)}),V(``,e),Ot(bt)]})]}),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:Tt(e.mimeType,Jn.MD)}),V(``,e),Ot(bt)]})]}),jt=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:Tt(e.mimeType,Jn.MD)}),V(``,e),Ot(bt)]}),(0,$.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]}),Mt=(e,t)=>{if(t&&![S.READY,S.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:Tt(void 0,Jn.LG)}),V(e,null),Ot(bt)]});let n=ni(Dt,t.mimeType);return n===ta.IMAGE&&(t.url||t.thumbnailUrl)?kt(t):n===ta.VIDEO&&t.url?At(t):n===ta.AUDIO&&t.url?jt(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:Tt(t.mimeType,Jn.LG)}),V(e,t),Ot(bt)]})},Nt=(e,t)=>{t&&![S.READY,S.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0});let n=ni(Dt,t?.mimeType),r=()=>xt(e);return n===ta.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:V(e,t,!0)}),Ot(r,!0)]},e):n===ta.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:Tt(t.mimeType,Jn.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:V(e,t,!0)}),Ot(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:Tt(t?.mimeType,Jn.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:V(e,t??null,!0)}),Ot(r,!0)]},e)},Pt=()=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[Le.map(e=>{let t=be.get(e);return Nt(e,t)}),Array.from(ge.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)(Zy,{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:E(H.WARNING,{size:Jn.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:Y.GHOST,size:Gd.SM,onClick:()=>St(e.tempId),className:`text-muted-foreground hover:text-destructive h-6 w-6 p-0`,"aria-label":y(U.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),title:y(U.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),children:E(H.CLOSE,{size:Jn.SM})})]},e.tempId))]}),Ft=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`},It=Q.useMemo(()=>{let e=[];if(te&&z?e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_size_range`,{min:w(te),max:w(z)})):te&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_min_size`,{min:w(te)})),oe){let{minWidth:t,maxWidth:n,minHeight:r,maxHeight:i,aspectRatio:a}=oe;if(t||r){let n=t??`–`,i=r??`–`;e.push(y(U.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(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_max_dimensions`,{width:String(t),height:String(r)}))}a&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_aspect_ratio`,{width:String(a.width),height:String(a.height)}))}return se&&se.maxDuration&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_video_max_duration`,{duration:Ft(se.maxDuration)})),ce&&ce.maxDuration&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_audio_max_duration`,{duration:Ft(ce.maxDuration)})),le&&le.maxPages&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_document_max_pages`,{pages:le.maxPages})),ie&&ae&&e.push(y(U.LOW_LEVEL_FORM_FIELD_FILE,`constraint_max_files`,{max:ae})),e},[te,z,oe,se,ce,le,ie,ae,y,w]),Lt=()=>It.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-x-group gap-y-item-xs mt-item-xs`,children:It.map((e,t)=>(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e},t))}),Rt=(e=!1)=>(0,$.jsx)(`div`,{onClick:Ct,onDragOver:gt,onDragLeave:vt,onDrop:yt,className:W(`relative flex flex-col items-center justify-center rounded-md border-2 border-dashed cursor-pointer`,e?`p-card-sm`:`p-container`,Se&&`border-primary bg-primary/5`,ht&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`,Fe&&!ie&&`pointer-events-none`,pe&&`border-destructive`,!ht&&!Fe&&`hover:border-primary hover:bg-primary/5`,O.motion.transition),children:Fe&&!ie?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Zy,{size:32,className:`text-primary mb-element`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:ye<0?y(U.LOW_LEVEL_FORM_FIELD_FILE,`uploading_indeterminate`):y(U.LOW_LEVEL_FORM_FIELD_FILE,`uploading`,{progress:ye})}),(0,$.jsx)(`div`,{className:`w-full max-w-xs h-1 bg-muted rounded-full mt-element overflow-hidden`,children:ye<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:`${ye}%`}})})]}):(0,$.jsxs)($.Fragment,{children:[!e&&(0,$.jsx)(`span`,{className:`mb-element`,"aria-hidden":`true`,children:E(H.UPLOAD,{size:Jn.XL})}),(0,$.jsx)(`span`,{className:W(`font-medium`,e?`text-xs`:`text-sm`),children:e?y(U.LOW_LEVEL_FORM_FIELD_FILE,`add_more`):k}),!e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground mt-item-xs`,children:j}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground mt-element`,children:[Et,z&&!te&&` • ${y(U.LOW_LEVEL_FORM_FIELD_FILE,`max_size`,{size:w(z)})}`]}),Lt()]})]})}),zt=ie&&(!ae||Le.length<ae),Bt=()=>(0,$.jsx)(rx,{multiple:ie,constraints:ee,acceptedStorages:L?.storageAccepted,onSelect:dt,onProviderFailure:ft,renderConsentRequired:({choice:e,missingPurposes:t,grant:n})=>{let r=t.map(e=>x(gu.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,jhe)).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(U.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_required`,{provider:i,purposes:r})}),n===void 0?null:(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:Y.OUTLINE,onClick:()=>void n(),children:y(U.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:Gd.SM,variant:e.providerRef===t?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.providerRef===t,onClick:()=>n(e.providerRef),children:_(e.displayNameLabelKey)??e.displayName??e.providerRef},e.providerRef))})});return C?(0,$.jsxs)(`div`,{ref:g,className:c,children:[(pe??Ke)&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:pe??Ke}),Ee.size>0&&(0,$.jsx)(X,{type:`button`,onClick:je,children:y(U.LOW_LEVEL_FORM_FIELD_FILE,`cancel`)}),(0,$.jsx)(`input`,{ref:Me,type:`file`,accept:re,multiple:ie,onChange:pt,className:`hidden`,disabled:ht}),ie?(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(Le.length>0||ge.size>0)&&Pt(),!ht&&zt&&Rt(Le.length>0),!ht&&Le.length===0&&!zt&&Rt(!1),!ht&&zt&&Bt()]}):Ie?Mt(Ie,He):Re?(0,$.jsxs)($.Fragment,{children:[Rt(!1),!ht&&Bt()]}):null,it&&nt&&(0,$.jsx)(TL,{file:it,aspectRatio:nt,maskShape:rt,maxOutputWidth:oe?.maxWidth,maxOutputHeight:oe?.maxHeight,maxOutputSizeBytes:z,allowedMimeTypes:R,onConfirm:ot,onCancel:st,onUncroppable:ct})]}):null}),jhe=tu(ca).consentedPurposes,GL=(0,Q.forwardRef)(({preset:e=G.DEFAULT,httpOperations:t,...n},r)=>{let{httpClient:i}=Eu(),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=Fl(U.LOW_LEVEL_FORM_FIELD_FILE,`FormFieldFile`)(e),s={...n,httpOperations:a};return(0,$.jsx)(o,{...s,ref:r})});GL.displayName=`FormFieldFile`;var Mhe=[`shipping`,`billing`],Nhe=[`home`,`work`,`mobile`,`fax`,`pager`],Phe=[`webauthn`];function Fhe(e){if(!e)return{leadingModifiers:[],trailingModifiers:[]};let t=Array.isArray(e)?e:[e],n=Array.from(new Set(t)),r=n.find(e=>Mhe.includes(e)),i=n.find(e=>Nhe.includes(e)),a=n.find(e=>Phe.includes(e));return{leadingModifiers:[...r?[r]:[],...i?[i]:[]],trailingModifiers:a?[a]:[]}}function Ihe({identifier:e,modifier:t}){if(!e)return;let{leadingModifiers:n,trailingModifiers:r}=Fhe(t);return[...n,e,...r].join(` `)}function KL(e){switch(e){case`stacked`:return $u.STACKED;case`inline`:return $u.INLINE;case`compact`:return $u.COMPACT;default:return}}function qL(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function JL(e){switch(e){case`sm`:return Jd.SM;case`md`:return Jd.MD;default:return}}var YL=300;function Lhe(e,t,n=YL){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 Rhe(e){return!!(e?.upload||e?.override)}function XL(e){return e??void 0}function zhe(e,t,n=Kn.ON_BLUR,r=!1,i,a=Kr){let{debouncedTrigger:o,cancelDebounce:s}=Lhe(e.trigger,t,YL),c=TE(),l=(i?id(i):void 0)?.autosave,u=DE(l,c?.config.defaultTrigger,r),d=c?.getFieldStateInfo(t),f=d?.state??Qw.IDLE,p=d?.lastError,m=(0,Q.useCallback)(()=>{c?.retryFieldSave?.(t)},[c,t]),{validateUniqueness:h}=Dfe({fieldName:t,fieldSchema:i}),{handleFieldBlur:g,noteInputReceived:_}=RM(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===ll.BLUR){let n=e.getValues(t);c.triggerSave(t,n,ll.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===ll.DEBOUNCE&&c.triggerSave(t,d,ll.DEBOUNCE)},[e,t,n,r,o,c,u,i,a,_]),autosaveFieldState:f,autosaveError:p,handleRetrySave:m,saveFieldNow:(0,Q.useMemo)(()=>c?.config.enabled&&u!==ll.NONE?e=>c.triggerSave(t,e,ll.BLUR):void 0,[c,u,t])}}function Bhe(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 Vhe(e){if(!Bhe(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 ZL({inputProps:e,value:t,isGeneratedPdfField:n,onBlur:r,inputRef:i}){let{tComponent:a}=J({component:U.LOW_LEVEL_FORM_FIELD_FILE}),o=Vhe(t),s=o===0?``:o>1?a(U.LOW_LEVEL_FORM_FIELD_FILE,`files_attached`,{count:o}):a(U.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),c=a(U.LOW_LEVEL_FORM_FIELD_FILE,n?`generated_pdf_read_only`:`uploads_unavailable_placeholder`);return(0,$.jsx)(eN,{...e,value:s,onChange:()=>void 0,onBlur:r,ref:i,placeholder:c,type:`text`,readOnly:!0,disabled:!0})}function Hhe(e,t,n,r){return id(e)?.validationMode||t||n||mr.getDefaultValidationMode(r)}function Uhe(e,t){return t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function Whe(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 Ghe(e,t){return mr.resolveFieldSchemaPath(e,t)}function QL({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=BC(),D=PD(),O=Sc(),{registry:k}=pm(),A=Q.useContext(ea)?.appConfig,{tErrorValidation:j,t:M,isReady:N}=J({keys:[`errors_validation`]}),P=PT(),F=DD(e),I=P?.allowedValuesByField?.[F],L=d??I?.values;FM(F),hk(F),Vk([F]);let ee=!/\.\d+(\.|$)/.test(F),R=t??Ghe(P?.schema,F),z=(0,Q.useMemo)(()=>R?Ite(A,mo(R)):void 0,[R,A]),te=Tfe({declaration:P?.requestFieldOffers?.[F],record:P?.requestFieldOfferRecord,appConfig:A,fieldName:F}),ie=(0,Q.useMemo)(()=>{if(!R)return;let e=Kt(R),t=e===B.ARRAY?ds(R):void 0,n=z??(e===B.ENUM?Hs(R):void 0)??(t&&Kt(t)===B.ENUM?Hs(t):void 0);return Sre(te,n)},[R,z,te]),ae=!!R&&!L&&Kt(R)===B.STRING&&re(R)===Ft.ORGANIZATION_ROLE,oe=ae?void 0:ie,se=ae?P?.roleGrantPickerOffersByField?.[F]:void 0,ce=(0,Q.useMemo)(()=>se?ie?ie.filter(e=>se.includes(e)):se:ie,[ie,se]),le=oe?L?L.filter(e=>oe.includes(e)):oe:L??z,ue=P?.reportRequestFieldOffer,de=!!P?.requestFieldOffers?.[F];(0,Q.useEffect)(()=>{de&&ue?.(F,te)},[de,ue,F,te]);let fe=mr.labelDictionaryPath(F),pe=n??P?.fieldLabels?.[fe]??e,me=r??P?.fieldDescriptions?.[fe],he=i??P?.fieldTooltips?.[fe],ge=u??P?.enumLabels?.[fe]??(d?void 0:I?.labels),_e=m??P?.disabled,ve=S??P?.fileUploadContext,ye=P?.generatedFieldOverrides?.[F],be=[...Object.keys(P?.contextFieldValues??{}),...P?.hiddenFieldNames??[],...Object.keys(P?.generatedFieldOverrides??{})],xe=ye==null&&Uhe(F,be),Se=R?Nl(R):void 0,Ce=F.includes(`.`)?F.slice(0,F.lastIndexOf(`.`)):``,we=Se?Whe(Se,Ce):void 0,Te=we?mr.getShowWhenWatchFields(we):[],Ee=IC({name:Te.length>0?Te:[]}),De=Array.isArray(Ee)?Ee:Te.length>0?[Ee]:[],Oe=IC({name:P?.inheritanceConfig?.discriminatorField?[P.inheritanceConfig.discriminatorField]:[]}),ke=Array.isArray(Oe)?Oe[0]:Oe,Ae=F.match(/^[^.[\]]+/)?.[0]??F,je=(0,Q.useMemo)(()=>{if(!we)return!0;let e=Object.fromEntries(Te.map((e,t)=>[e,De[t]]));return mr.evaluateShowWhen(we,e)},[we,Te,De]),Me=(0,Q.useMemo)(()=>!P?.inheritanceConfig?.discriminatorField||mr.computeFieldVisibility(P.schema,Ae,{[P.inheritanceConfig.discriminatorField]:ke},P.inheritanceConfig),[ke,P?.inheritanceConfig,P?.schema,Ae]),Ne=R?Kt(R):B.STRING,Pe=R?id(R):void 0,Fe=P?.hostResolvesRelationshipRoots===!0,Ie=(0,Q.useMemo)(()=>{if(!(Fe||!R||!D.resourceType||Ne!==B.OBJECT&&Ne!==B.ARRAY))return vj({resourceType:D.resourceType,fieldName:F,operationType:D.operationType,registry:k})},[Fe,R,D.operationType,D.resourceType,F,k,Ne]),Le=Ne===B.STRING||Ne===B.CODE||Ne===B.NUMBER||Ne===B.BIGINT||Ne===B.MONEY||Ne===B.BIGDECIMAL,Re=R?Hhe(R,p,D.validationMode,Ne):p??D.validationMode??Kn.ON_BLUR,ze=h??P?.readOnly??(R?Lie(R,D.operationType):!1),Be=ghe[_he({schemaKind:D?.schemaKind,rootSchema:P?.schema,fieldName:F})],Ve=Be.normalizeClearedValue,He=R?Be.isClearable(R):!1,{createBlurHandler:Ue,createChangeHandler:We,autosaveFieldState:Ge,autosaveError:Ke,handleRetrySave:qe,saveFieldNow:Je}=zhe(E,F,Re,Le,R,Ve),Ye=C??(P?void 0:Pe?.autoFocus),Xe=Pe,Qe=Ihe({identifier:Xe?.autoComplete,modifier:Xe?.autoCompleteModifier}),$e=(0,Q.useMemo)(()=>R?!Qie(R):!1,[R]),et=Q.useContext(xT),tt=(0,Q.useRef)(Symbol(`file-field-validation`)).current;(0,Q.useEffect)(()=>()=>{et?.delete(tt)},[et,tt,F]);let{setError:nt,clearErrors:rt,getFieldState:at}=E,ot=(0,Q.useCallback)(e=>{let t=e=>{let t=at(F).error;(t?.type!==`file-validation`||t.message!==e)&&nt(F,{type:sI,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}at(F).error?.type===`file-validation`&&rt(F)}},[nt,rt,at,F,et,tt]),st=E.getFieldState(F,E.formState),ct=lI(st,E.formState.isSubmitted,Re,j),{formChromeMode:lt,sectionChromeMode:ut}=Xw(),dt=KL(O.autoRender?.autoFieldChrome),ft=Pe?.chromeMode??ut??lt??dt,pt=a??qL(O.autoRender?.autoLabelPlacement),mt=c??JL(O.autoRender?.autoFieldDensity),ht=l!==!1&&O.autoRender?.autoErrorPlacement===`summary-at-surface-top`,gt=te.kind===_ie.NOT_OFFERED,_t=!!R&&(xe||!je||!Me||gt);if(yk(!!R&&!_t),(0,Q.useEffect)(()=>{_t&&!ee&&F&&E.getValues(F)!==void 0&&E.setValue(F,void 0,{shouldDirty:!1,shouldValidate:!1})},[_t,ee,F,E]),(0,Q.useEffect)(()=>{if(!ie||!F)return;let e=E.getValues(F);if(e==null)return;let t=new Set(ie);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})},[ie,F,E]),!R||_t)return null;if(ye!=null)return(0,$.jsx)($.Fragment,{children:ye});let vt=Pe?.forceHide,yt={mode:ft,label:pe,description:me,tooltip:he,labelPlacement:pt,error:ct,required:$e,hideLabel:o??vt?.label,hideDescription:s??vt?.description,hideError:vt?.error||ht,saveState:Ge,saveErrorMessage:Ke,onRetrySave:qe,onSaveFieldNow:Je,fieldName:F,disabled:_e,className:g},bt={schema:R,clearable:He,name:F,disabled:_e,readOnly:ze,validationMode:Re,required:$e,autoFocus:Ye||void 0,controlSize:mt},xt=!(!Ie||Ie.semantics.nature===it.COMPOSITION&&Ie.nestedMutationConfig),St=Ne===B.RANGE_NUMBER||Ne===B.RANGE_DATE||Ne===B.RANGE_DATETIME||Ne===B.RANGE_TIME||Ne===B.RANGE_BIGDECIMAL||Ne===B.RANGE_MONEY;if(St){let e=Dte(R),t=f??Pe?.component??Nn(e??ne.NUMBER);return(0,$.jsx)(RC,{name:F,control:E.control,shouldUnregister:ee,render:({field:e})=>{let n=Ue(e.onBlur),r=We(e.onChange),i={...bt,value:XL(E.getValues(F)),onBlur:n},a=(()=>{let n=e.ref;switch(t){case yr.RANGE_SLIDER:return(0,$.jsx)(QM,{...i,onValueChange:r,ref:n});case yr.DATE_RANGE:return(0,$.jsx)(hN,{...i,onChange:r,ref:n});case yr.DATETIME_RANGE:return(0,$.jsx)(vN,{...i,onChange:r,ref:n});case yr.TIME_RANGE:return(0,$.jsx)(xN,{...i,onChange:r,ref:n});case yr.BIGDECIMAL_RANGE:return(0,$.jsx)(_L,{...i,onChange:r,ref:n});case yr.MONEY_RANGE:return(0,$.jsx)(yL,{...i,onChange:r,ref:n});default:return{[B.RANGE_BIGDECIMAL]:(0,$.jsx)(_L,{...i,onChange:r,ref:n}),[B.RANGE_MONEY]:(0,$.jsx)(yL,{...i,onChange:r,ref:n}),[B.RANGE_DATE]:(0,$.jsx)(hN,{...i,onChange:r,ref:n}),[B.RANGE_DATETIME]:(0,$.jsx)(vN,{...i,onChange:r,ref:n}),[B.RANGE_TIME]:(0,$.jsx)(xN,{...i,onChange:r,ref:n}),[B.RANGE_NUMBER]:(0,$.jsx)(fN,{...i,onChange:r,ref:n})}[Ne]??(0,$.jsx)(QM,{...i,onValueChange:r,ref:n})}})();return(0,$.jsx)(JM,{...yt,children:a})}})}let Ct=e=>(0,$.jsx)(kE,{fieldName:F,label:pe,disabled:_e,onSaveFieldNow:Je,children:e});if(Ne===B.OBJECT){if(xt)return null;let e=ka(R),t=e?Yme(A,e):void 0;return t?wt(e=>(0,$.jsx)(SI,{...bt,types:t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Ct((0,$.jsx)(CN,{name:F,schema:R,label:pe,hideLabel:o,description:me,disabled:_e,className:g,renderField:y,excludedChildKeys:w}))}if(Ne===B.RECORD){let e=fa(R);return e?Ct((0,$.jsx)(EN,{name:F,schema:R,label:pe,description:me,disabled:_e,className:g,valueSchema:e,keySchema:null})):null}if(Ne===B.MAP){let e=Ze(R);return e?Ct((0,$.jsx)(EN,{name:F,schema:R,label:pe,description:me,disabled:_e,className:g,valueSchema:e.valueSchema,keySchema:e.keySchema})):null}if(Ne===B.ARRAY)return xt?null:(0,$.jsx)(yI,{name:F,schema:R,label:pe,description:me,disabled:_e,className:g,renderField:y,sectionAppearance:b,objectItemLayout:x,enumLabels:ge,allowedValues:le});function wt(e,t){return(0,$.jsx)(RC,{name:F,control:E.control,shouldUnregister:ee,render:({field:n})=>(0,$.jsx)(JM,{...yt,...t,children:e({value:XL(E.getValues(F)),onChange:We(n.onChange),onBlur:Ue(n.onBlur),ref:n.ref})})})}if(le){let e=mo(R),t=t=>{if(!e)return;let n=hl(e,t),r=M(n);return r===n?void 0:r},n=le.map(e=>({value:e,label:ge?.[e]??t(e)??e}));return wt(e=>(0,$.jsx)(oI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,options:n}))}let Tt=f;if(Tt&&!St)switch(Tt){case yr.INPUT:case yr.TEXTAREA:return wt(e=>(0,$.jsx)(KI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v}));case yr.SLIDER:return wt(e=>(0,$.jsx)(JI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));case yr.CHECKBOX:case yr.SWITCH:return wt(e=>(0,$.jsx)(jI,{...bt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case yr.SELECT:case yr.RADIO_GROUP:case yr.CHECKBOX_GROUP:{let e=ge?eR(R,ge):void 0;return wt(t=>(0,$.jsx)(oI,{...bt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}case yr.DATE:return wt(e=>(0,$.jsx)(iN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case yr.DATETIME:return wt(e=>(0,$.jsx)(sN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case yr.TIME:return wt(e=>(0,$.jsx)(uN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}))}if(Ne===B.MONEY)return wt(e=>(0,$.jsx)(ZI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===B.DURATION)return wt(e=>(0,$.jsx)($I,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===B.PHONE)return wt(e=>(0,$.jsx)(oL,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe}));if(Ne===B.ADDRESS){let e=Object.fromEntries(iae().map(e=>[e,lI({...E.getFieldState(`${F}.${e}`,E.formState),isTouched:st.isTouched,isDirty:st.isDirty},E.formState.isSubmitted,Re,j)])),t=st.error;return wt(t=>(0,$.jsx)(dL,{...bt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,partErrors:e,renderLookup:e=>(0,$.jsx)(yx,{host:e,addressSchema:R,fieldName:F})}),t!==void 0&&(t.message!==void 0||t.type!==void 0)?void 0:{error:void 0})}if(Ne===B.BIGDECIMAL)return wt(e=>(0,$.jsx)(mL,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===B.CODE)return wt(e=>(0,$.jsx)(hL,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===B.FILE){let e=mr.normalizeSchemaFieldPath(F),t=ve?.[e],n=Ki(R);return!n&&Rhe(t)?wt(e=>(0,$.jsx)(GL,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,endpoints:t,onValidationError:ot}),{wideControl:!0}):n?(0,$.jsx)(JM,{...yt,children:(0,$.jsx)(ZL,{inputProps:bt,value:E.getValues(F),isGeneratedPdfField:!0})}):wt(e=>(0,$.jsx)(JM,{...yt,children:(0,$.jsx)(ZL,{inputProps:bt,value:e.value,isGeneratedPdfField:!1,onBlur:e.onBlur,inputRef:e.ref})}))}if(gl(R))return wt(e=>(0,$.jsx)(bI,{...bt,quickCreateSourceFieldName:T,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===B.BOOLEAN)return wt(e=>(0,$.jsx)(jI,{...bt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===B.STRING)return wt(e=>(0,$.jsx)(KI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v,...ae&&ce?{offeredValues:ce}:{}}));if(Ne===B.NUMBER||Ne===B.BIGINT)return wt(e=>(0,$.jsx)(JI,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===B.ENUM){let e=ge?eR(R,ge):void 0;return wt(t=>(0,$.jsx)(oI,{...bt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}return Ne===B.DATE?wt(e=>(0,$.jsx)(iN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Ne===B.DATETIME?wt(e=>(0,$.jsx)(sN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Ne===B.TIME?wt(e=>(0,$.jsx)(uN,{...bt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):(0,$.jsx)(JM,{...yt,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:Ne}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e,`)`]})]})})}QL.displayName=`FormField`;var $L=QL;wk($L,xk.FIELD_SLOT);function eR(e,t){return Hs(e).map(e=>({value:e,label:t?.[e]??e}))}var tR=il.getLogger();function nR(e,t){let n=e instanceof fj?e.mutationError:void 0,r=n?n.validationErrors?MM({httpStatus:n.status??400,validationErrors:n.validationErrors}):null:MM(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 rR=tR.debugByType(`DisplayFieldEditable`);tR.setDebugTypeLogging(`DisplayFieldEditable`,!1);function iR(e,t){return t.some(t=>e===t||e.startsWith(t+`[`)||TM(t,e))}function Khe(e){return!!(e?.upload||e?.override)}var qhe={mode:`direct`,saveOn:`blur`,showSaveButton:!1,showCancelButton:!0};function aR(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:_,resolvedEmptyValue:v,fileUploadContext:y,wideValue:b,announceName:x,doInlineUpdate:S,rmm:C}=e,{tComponent:w,tErrorValidation:T,isReady:E}=J({component:[U.LOW_LEVEL_FORM_FIELD,U.LOW_LEVEL_BUTTON]}),{getRecipe:D}=Ig(),{renderIcon:O}=kf(),k=dj(),{registry:A}=pm(),j=D(_t.INDICATOR,ao.SUCCESS),[M,N]=(0,Q.useState)(OT.DISPLAY),[P,F]=(0,Q.useState)(null),I=(0,Q.useRef)(null),L=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),R=(0,Q.useRef)(null),[z,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(!1),ce=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{ce.current!==r&&(ae(!1),se(!1),re(null),ce.current=r)},[r]);let le=M!==OT.DISPLAY,ue=M===OT.SAVING,de=C??null,fe=(0,Q.useSyncExternalStore)(de?.subscribe??OM,de?.getSnapshot??kM),pe=mt(t)??qhe,me=(0,Q.useMemo)(()=>{if(i&&k.resourceType)return bj({resourceType:k.resourceType,fieldName:i,operationType:K.UPDATE,registry:A})},[i,A,k.resourceType]),he=(0,Q.useMemo)(()=>{if(i)return y?.[mr.normalizeSchemaFieldPath(i)]},[i,y]),ge=n!==B.FILE||!Ki(t)&&Khe(he),_e=(0,Q.useMemo)(()=>i?.includes(`.`)?i.split(`.`).pop():i??`value`,[i]),ve=(0,Q.useMemo)(()=>Ud({[_e]:t}),[_e,t]),ye=jw({resolver:hT(ve),defaultValues:{[_e]:r},mode:ET});(0,Q.useEffect)(()=>{M===OT.DISPLAY&&(ye.reset({[_e]:r}),F(null))},[r,M,ye,_e,t]),(0,Q.useEffect)(()=>{if(le&&I.current){let e=setTimeout(()=>{let e=I.current?.querySelector(`input, textarea, select, [tabindex]:not([tabindex="-1"])`);e&&e.focus()},0);return()=>clearTimeout(e)}},[le]),(0,Q.useEffect)(()=>{M===OT.ERROR&&L.current?.focus()},[M]),(0,Q.useEffect)(()=>()=>{ee.current!=null&&clearTimeout(ee.current)},[]);let be=(0,Q.useCallback)(async()=>{if(i){if(!await ye.trigger(_e))ye.setValue(_e,ye.getValues(_e),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),N(OT.EDITING);else{F(null),N(OT.SAVING);try{let e=ye.getValues(_e);await S(i,e),rR(`inline edit save`,{fieldName:i,value:e}),N(OT.SAVED),ee.current=setTimeout(()=>{N(OT.DISPLAY),ee.current=null},500)}catch(e){if(e instanceof fj&&e.mutationError?.type===fE.CONFLICT)return;let t=nR(e,i);if(t!==void 0){let e=Rl(t)?T(t.code,`msg`,t.params):t;ye.setError(_e,{type:tT,message:e}),N(OT.EDITING);return}F(w(U.LOW_LEVEL_FORM_FIELD,`save_failed`)),N(OT.ERROR)}}}},[ye,_e,i,S,w,T]);(0,Q.useEffect)(()=>{let e=ye.watch((e,{name:t})=>{t===_e&&ye.getFieldState(_e).error?.type===`server`&&ye.clearErrors(_e)});return()=>e.unsubscribe()},[ye,_e]);let xe=(0,Q.useCallback)(()=>{i&&rR(`inline edit cancel`,{fieldName:i}),ye.reset({[_e]:r}),F(null),N(OT.DISPLAY)},[ye,_e,r,i]),Se=(0,Q.useCallback)(async e=>{if(i){re(e),F(null),te(!0);try{await S(i,e),rR(`inline boolean toggle`,{fieldName:i,value:e})}catch(e){if(re(null),!(e instanceof fj&&e.mutationError?.type===fE.CONFLICT)){let t=nR(e,i);F(t===void 0?w(U.LOW_LEVEL_FORM_FIELD,`save_failed`):Rl(t)?T(t.code,`msg`,t.params):t)}}finally{te(!1)}}},[i,S,w,T]),Ce=(0,Q.useRef)(w);Ce.current=w,(0,Q.useEffect)(()=>{if(!de||!fe?.lastEvent||!i)return;let e=fe.lastEvent;if(e.id!==R.current)switch(R.current=e.id,e.type){case lE.REMOTE_UPDATE:iR(i,e.changedFields)&&M===OT.EDITING&&(rR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),xe());break;case lE.CONFLICT_RESET:{let t=DM(e.currentData,i);ye.reset({[_e]:t}),M!==OT.DISPLAY&&(rR(`RMM event resetting inline edit after conflict`,{fieldName:i,eventType:e.type}),F(Ce.current(U.LOW_LEVEL_FORM_FIELD,`field_reset_after_conflict`)),N(OT.ERROR));break}case lE.MUTATION_RESULT:e.result.success&&e.source.type!==dE.DISPLAY&&e.result.savedFields&&iR(i,e.result.savedFields)&&M===OT.EDITING&&(rR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),xe());break;case lE.RESOURCE_DELETED:M===OT.EDITING&&(rR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),xe())}},[fe?.lastEvent?.id,de,i,M,_e,ye,xe]);let we=(0,Q.useCallback)(e=>{if(pe.saveOn===`blur`&&I.current){let t=e.relatedTarget;I.current.contains(t)||be()}},[pe.saveOn,be]),Te=n===B.CODE||Yte(t),Ee=(0,Q.useCallback)(e=>{e.key===`Escape`?(e.preventDefault(),xe()):e.key===`Enter`&&(Te?(e.ctrlKey||e.metaKey)&&(e.preventDefault(),be()):e.shiftKey||(e.preventDefault(),be()))},[be,xe,Te]);function De(){return(0,$.jsx)(xM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:p,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,emptyValue:v,fileUploadContext:y,showAllArrayItems:ie,onExpandArrayItems:()=>ae(!0),showAllObjectFields:oe,onExpandObjectFields:()=>se(!0)})}function Oe(){let e=ne??!!r;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-element`,children:[z&&(0,$.jsx)(`span`,{className:`text-muted-foreground`,"aria-hidden":`true`,children:O(H.LOADER_2,{size:Jn.SM,className:`animate-spin motion-reduce:animate-none`})}),P&&!z&&(0,$.jsx)(`span`,{className:`text-destructive text-xs`,role:`alert`,children:P}),(0,$.jsx)(TI,{checked:e,onCheckedChange:Se,disabled:z,"aria-label":a||i||void 0})]})}function ke(){return(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,className:W(`group relative inline-flex items-center gap-element h-auto px-card-sm py-item-xs`),onClick:()=>{i&&rR(`inline edit start`,{fieldName:i}),N(OT.EDITING)},"aria-label":w(U.LOW_LEVEL_FORM_FIELD,`editField`,{label:a||i||``}),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:De()}),(0,$.jsx)(`span`,{className:`text-muted-foreground opacity-0 group-hover:opacity-100 motion-safe:transition-opacity`,children:O(H.EDIT,{size:Jn.SM})})]})}function Ae(){let e=i?`inline-edit-error-${i.replace(/\./g,`-`)}`:void 0,n=M===OT.ERROR&&!!P;return(0,$.jsx)(eT,{schema:ve,schemaKind:Zw.MAIN_SCHEMA,form:ye,resourceType:k.resourceType,resourceId:k.resourceId,operationType:K.UPDATE,contextResourceIdentifiers:k.contextResourceIdentifiers,navigationZone:k.navigationZone,children:(0,$.jsxs)(`div`,{ref:I,className:`inline-flex flex-col gap-item-xs min-w-[200px]`,onBlur:we,onKeyDown:Ee,"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)($L,{name:_e,quickCreateSourceFieldName:me?.sourceFieldName,schema:t,label:``,description:``,disabled:ue,placeholder:a,enumLabels:l,respectSurfaceErrorPlacement:!1,fileUploadContext:he?{[_e]:he}:void 0,className:`inline-edit-field`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-item-xs shrink-0 pt-item-xs`,children:[M===OT.SAVED&&(0,$.jsx)(`div`,{className:j.base,"aria-hidden":`true`,children:O(H.CHECK,{size:Jn.SM})}),pe.showSaveButton&&M!==OT.SAVED&&(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:Y.DEFAULT,onClick:be,disabled:ue,"aria-label":w(U.LOW_LEVEL_BUTTON,`save`),children:M===OT.SAVING?O(H.LOADER_2,{size:Jn.SM,className:`animate-spin motion-reduce:animate-none`}):O(H.CHECK,{size:Jn.SM})}),pe.showCancelButton&&(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:Y.GHOST,onClick:xe,disabled:ue,"aria-label":w(U.LOW_LEVEL_BUTTON,`cancel`),children:O(H.CLOSE,{size:Jn.SM})})]})]}),n&&(0,$.jsxs)(jD,{id:e,variant:`destructive`,role:`alert`,className:`flex items-center gap-element py-card-sm`,children:[O(H.ERROR,{size:Jn.SM,className:`shrink-0`}),(0,$.jsx)(ND,{className:`flex-1 m-0`,children:(0,$.jsx)(Z,{children:P})}),(()=>{let e=w(U.LOW_LEVEL_BUTTON,`retry`);return(0,$.jsx)(X,{ref:L,type:`button`,size:Gd.SM,variant:Y.GHOST,onClick:be,disabled:ue,"aria-label":e,title:e,children:O(H.TRY_AGAIN,{size:Jn.SM})})})()]})]})})}if(!E)return null;let je;return je=n===B.BOOLEAN&&i?Oe():le&&i&&ge?Ae():ge?ke():De(),(0,$.jsx)(cj,{mode:g,label:a,description:o,tooltip:s,provenance:c,name:i,labelPlacement:_,hideLabel:m,hideDescription:h,wide:b,announceName:x,className:p,children:je})}aR.displayName=`DisplayFieldEditable`;function oR({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)(()=>Ud({[f]:t}),[f,t]),m=(0,Q.useMemo)(()=>({[f]:Array.isArray(n)?n:[]}),[f,n]),h=jw({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=tE(p,{resourceType:v.resourceType,operationId:K.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:K.UPDATE,isExisting:!0}),[p,b]),S=d===!0||c===qc.HIDDEN||c===qc.COMPACT,C=(0,Q.useMemo)(()=>({enabled:!0}),[]),{tComponent:w}=J({component:U.RESOURCES_LAYOUTS_CREATE}),T=(0,Q.useMemo)(()=>({errorNetwork:w(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:w(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:w(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:w(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:w(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[w]),E=(0,Q.useCallback)(async()=>{await a(e,h.getValues(f))},[a,e,h,f]);return(0,$.jsx)(VC,{...h,children:(0,$.jsx)(eT,{schema:p,form:h,resourceType:v.resourceType,resourceId:v.resourceId,operationType:K.UPDATE,contextResourceIdentifiers:v.contextResourceIdentifiers,navigationZone:v.navigationZone,children:(0,$.jsx)(MT,{value:x,children:(0,$.jsx)(EE,{onSave:E,labels:T,config:C,children:(0,$.jsx)(`div`,{ref:g,children:(0,$.jsx)(yI,{name:f,schema:t,label:r,description:i,renderField:o,sectionAppearance:s,objectItemLayout:l,enumLabels:u,hideLabel:S,chromeMode:c===qc.SETTINGS_ROW?$u.SETTINGS_ROW:void 0})})})})})})}oR.displayName=`DisplayFieldEditableArray`;var Jhe=oR,Yhe=Td({slug:gd().regex(Zre,`A slot slug is lowerCamelCase with no separators.`).max(40).refine(e=>e!==Ss,{error:`"${Ss}" is reserved: the environment builder emits ${kre(`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:Pd(),description:gd().min(1)}),sR=e=>Md(Yhe).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.`})});Td({addressSlots:sR(`credential address`),secretSlots:sR(`credential secret`)});var Xhe={[nd.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."}]},[nd.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.`}]},[nd.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.`}]},[nd.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.`}]},[nd.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.`}]},[nd.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.`}]},[nd.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.`}]},[nd.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.`}]}},Zhe=function(e){return e.KEY_ID_SUPPLIED=`key-id-supplied`,e.X509_THUMBPRINT_DERIVED=`x509-thumbprint-derived`,e}({}),Qhe=function(e){return e.REQUEST_BODY=`request-body`,e.BASIC_HEADER=`basic-header`,e}({}),cR=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}({}),lR=Id().int().min(30).max(86400),uR={dialects:Md(Vd(Os)).min(1).optional()},dR=kae(`kind`,[Td({kind:Ad(nd.ODOO_API_KEY_IN_ARGS).systemEnum(`SystemOfRecordCredentialKind`),...uR}),Td({kind:Ad(nd.API_KEY_HEADER).systemEnum(`SystemOfRecordCredentialKind`),...uR,headerName:gd().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/,`A header name is an RFC 9110 token.`).max(64),valuePrefix:gd().max(32).optional()}),Td({kind:Ad(nd.API_KEY_QUERY).systemEnum(`SystemOfRecordCredentialKind`),...uR,parameterName:gd().regex(/^[A-Za-z0-9_.-]+$/,`A query parameter name is alphanumeric with -._`).max(64)}),Td({kind:Ad(nd.BASIC).systemEnum(`SystemOfRecordCredentialKind`),...uR}),Td({kind:Ad(nd.OAUTH2_CLIENT_CREDENTIALS_SECRET).systemEnum(`SystemOfRecordCredentialKind`),...uR,clientAuthentication:Vd(Qhe),tokenLifetimeFallbackSeconds:lR}),Td({kind:Ad(nd.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...uR,assertionHeaderPolicy:Vd(Zhe),assertionSigningAlgorithm:Vd(cR),assertionLifetimeSeconds:Id().int().min(30).max(600),tokenLifetimeFallbackSeconds:lR}),Td({kind:Ad(nd.OAUTH2_JWT_BEARER).systemEnum(`SystemOfRecordCredentialKind`),...uR,assertionSigningAlgorithm:Vd(cR),assertionLifetimeSeconds:Id().int().min(30).max(600),tokenLifetimeFallbackSeconds:lR}),Td({kind:Ad(nd.MTLS_CLIENT_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...uR})]),$he=function(e){return e.SKIP=`skip`,e.NEXT_LINK_ONLY=`next-link-only`,e}({}),fR=function(e){return e.FIELD=`field`,e.PATH_SEGMENT=`path-segment`,e}({}),ege=function(e){return e.SCALAR=`scalar`,e.MANY2ONE_PAIR=`many2one-pair`,e}({}),pR=Td({kind:Vd(fR),remoteField:gd().min(1).max(120),codec:Vd(Tre),valueShape:Vd(ege)}),mR=function(e){return e.CSRF_TOKEN_HANDSHAKE=`csrf-token-handshake`,e}({}),tge=`@odata.etag`;Td({vendor:gd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),dialects:Md(Vd(Os)).min(1),addressSlots:sR(`vendor address`),credentialOffers:Md(dR).min(1),odataListPaging:Vd($he).optional(),partition:pR.optional(),incrementalExtractionModes:Md(Vd(ud)).optional(),odataExpiredChangePositionErrorCodes:Md(gd().regex(mne)).optional(),actionCallShapes:Md(Vd(zne)).optional(),rowVersionField:gd().min(1).max(120).optional(),writePrerequisites:Md(Vd(mR)).optional()}).superRefine((e,t)=>{e.rowVersionField!==void 0&&e.dialects.includes(Os.ODATA)&&e.rowVersionField!==`@odata.etag`&&t.addIssue({code:`custom`,path:[`rowVersionField`],message:`An OData vendor's row version is its entity tag, "${tge}" — got "${e.rowVersionField}".`});for(let[n,r]of(e.actionCallShapes??[]).entries())e.dialects.includes(_u[r])||t.addIssue({code:`custom`,path:[`actionCallShapes`,n],message:`Action call shape "${r}" is spoken over ${_u[r]}, which this vendor's dialects do not list.`});e.odataExpiredChangePositionErrorCodes!==void 0&&!(e.incrementalExtractionModes??[]).includes(ud.ODATA_DELTA_LINK)&&t.addIssue({code:`custom`,path:[`odataExpiredChangePositionErrorCodes`],message:`An expired change-position code is read only by the "${ud.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=>nge(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 Xhe[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.`})}),Td({vendor:gd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),partition:pR.optional(),credentialOffers:Md(dR).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 nge(e,t){return e.dialects===void 0||e.dialects.includes(t)}Object.freeze({[Os.ODATA]:{translatesSort:!0,sendsRowWrites:!0},[Os.ODATA_V2]:{translatesSort:!0,sendsRowWrites:!1},[Os.ODOO_JSONRPC]:{translatesSort:!0,sendsRowWrites:!0},[Os.ODOO_JSON2]:{translatesSort:!0,sendsRowWrites:!0},[Os.REST_JSON]:{translatesSort:!1,sendsRowWrites:!0}}),Object.freeze({[mR.CSRF_TOKEN_HANDSHAKE]:!1}),Object.freeze({[fR.FIELD]:!0,[fR.PATH_SEGMENT]:!1});function rge(e){if(e.direction===fe.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!==fe.BIDIRECTIONAL||an(n)===Yee.REMOTE)&&Tte(n).length>0&&t.add(n.localField);return[...t]}var ige=`external-data-provenance`,age=Td({system:ene,currentAsOf:dae().nullable()}),oge=3e5,hR=new WeakMap;function sge(e){let t=hR.get(e);return t||(t=new Set(rge(e)),hR.set(e,t)),t}function cge(e){let{resourceConfiguration:t,contextualParameters:n}=e,r=(t.operations??[]).filter(e=>N(e,K.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=Um.resolveUrlPath(a.url,n);if(o&&!Um.hasUnresolvedPlaceholders(o))return`${o}/${ige}`}var gR=new WeakMap,_R=new Set;function lge(e){let t=gR.get(e);return t||(t={cache:new Map,inFlight:new Map},gR.set(e,t)),t}function uge(){for(let e of _R)e()}function dge(e){return _R.add(e),()=>{_R.delete(e)}}function fge(e,t,n=Date.now()){let r=e&&t?gR.get(t)?.cache.get(e):void 0;return r?Math.max(0,r.fetchedAt+oge-n):void 0}function pge(e,t){if(e&&t)return gR.get(t)?.cache.get(e)?.value}function vR(e,t,n=Date.now()){let{cache:r,inFlight:i}=lge(t),a=r.get(e);if(a&&n-a.fetchedAt<3e5||i.has(e))return;let o=(async()=>{let n;try{let r=age.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),uge()})();i.set(e,o)}function mge(e){let{resourceType:t,contextualParameters:n}=dj(),r=bm(),i=(0,Q.useContext)(ea)?.httpClient,a=t?r?.registry.resourceConfigurations[t]:void 0,o=a?.externalDataPipeline,s=e.enabled&&!!o&&!!e.fieldName&&sge(o).has(e.fieldName),c=(0,Q.useMemo)(()=>s&&a?cge({resourceConfiguration:a,contextualParameters:n??{}}):void 0,[s,a,n]),l=(0,Q.useSyncExternalStore)(dge,()=>pge(c,i));return(0,Q.useEffect)(()=>{if(!c||!i)return;vR(c,i);let e=fge(c,i);if(e===void 0)return;let t=setTimeout(()=>vR(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 yR=il.getLogger();function hge(e){switch(e){case`stacked`:return qc.STACKED;case`inline`:return qc.INLINE;case`compact`:return qc.COMPACT;default:return}}function gge(e){switch(e){case`em-dash`:case`placeholder`:case`hidden`:case`skeleton`:return e;default:return}}function _ge(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function bR(e,t){return!e||!t||t.length===0?!1:t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function xR(e){let t=ik(),{pathPrefix:n}=ED(),r=Sc(),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?Kt(s):void 0),l=e.value??(o?lA(t?.data,o):void 0),u=o===void 0?void 0:mr.labelDictionaryPath(o),d=o?mr.isArrayItemPath(o):!1,f=d?void 0:u,p=f?mr.unresolvedFieldLabel(f.split(`.`).pop()??f):void 0,m=e.label??(f?t?.fieldLabels?.[f]:void 0)??p,h=s?cie(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?Jo(s):wu(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=bR(o,t?.hiddenFieldNames),T=bR(o,t?.inlineEditDisabledFieldNames),{displayChromeMode:E,sectionChromeMode:D}=sk(),O=bA(),k=GA(),A=hge(r.autoRender?.autoFieldChrome),j=i===PA.SUMMARY&&k&&y?.chromeMode===void 0&&D===void 0&&YA(c),M=y?.chromeMode??D??(j?qc.INLINE:void 0)??E??A,N=e.labelPlacement??(y?.chromeMode===void 0?_ge(r.autoRender?.autoLabelPlacement):void 0),P=e.labelStyle??y?.labelStyle,F=CA(c,y?.displayMode,s?aa(s)?.mode:void 0),I=t?.breakpoint,L=I?pA(y?.forceHide,I):y?.forceHide,ee=L?.label===!0,R=L?.description===!0,z=e.hideLabel===!0||ee,te=e.hideDescription===!0||R||j,{canInlineEdit:ne,doInlineUpdate:re,fileUploadContext:ie,rmm:ae,defaultInlineEdit:oe,defaultEmptyValue:se,parentReferenceConfig:ce,resourceType:le}=dj(),ue=bm()?.registry,de=se??gge(r.autoRender?.autoEmptyValue),fe=mge({fieldName:!n&&!d?o:void 0,enabled:i!==PA.SUMMARY&&!e.resourceLinkTrail}),pe=o&&s&&js(s),me=!!o&&!!s&&oe===wr.WRITABLE_FIELDS&&kne(s),he=!S&&!T&&ne&&(!!pe||me);if(w||s&&qs(s))return(0,$.jsx)($.Fragment,{});let ge=UA(M,I??yi.DESKTOP),_e=O&&ge!==qc.TILE,ve=!z&&N!==`hidden`&&ge!==qc.HIDDEN&&ge!==qc.COMPACT,ye=!z&&(N===`hidden`||i===PA.SUMMARY),be=!ve&&!ye;if(t?.isLoading??!1)return(0,$.jsx)(HA,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(cj,{mode:M,label:m,labelStyle:P,name:o,labelPlacement:N,hideLabel:z,hideDescription:!0,tooltip:_,wide:F,announceName:i===PA.SUMMARY,children:(0,$.jsx)(mm,{className:`h-5 w-full`})})});let xe=s?Nl(s):void 0,Se=n&&x?x:t?.data;if(xe&&Se&&!mr.evaluateShowWhen(xe,Se))return(0,$.jsx)($.Fragment,{});if(ce?.displayMode===Rt.NONE&&o){let t=Pj({schema:s,value:l,fieldName:o,parentData:x,resourceLinkTrail:e.resourceLinkTrail,currentResourceType:le,registry:ue});if(t&&lj({parentReferenceConfig:ce,...t}).hidesWholeReference)return(0,$.jsx)($.Fragment,{})}let Ce=(O||i===PA.SUMMARY)&&!he;if((y?.hideWhenEmpty??Ce)&&BA(l))return(0,$.jsx)($.Fragment,{});if(!s||!c)return yR.error(`[DisplayField] Cannot resolve schema for field`,{name:o}),(0,$.jsx)($.Fragment,{});let we={schema:s,schemaType:c,value:l,fieldName:o,label:m,description:g,tooltip:_,provenance:fe,enumLabels:v,displayComponent:b,parentData:x,resourceLinkTrail:e.resourceLinkTrail,renderItem:e.renderField,className:C,hideLabel:z,hideDescription:te,resolvedChromeMode:M,resolvedLabelPlacement:N,resolvedLabelStyle:P,resolvedEmptyValue:de,fileUploadContext:ie,wideValue:F,announceName:i===PA.SUMMARY};return(0,$.jsx)(CR,{name:o,children:he&&c===B.ARRAY?(0,$.jsx)(HA,{active:O,name:o,label:m,children:(0,$.jsx)(Jhe,{name:o,schema:s,value:l,label:m,description:g,doInlineUpdate:re,renderField:e.renderField,sectionAppearance:e.sectionAppearance,objectItemLayout:e.objectItemLayout,enumLabels:v,hideLabel:z,displayChromeMode:I?pA(M,I):typeof M==`string`?M:void 0})}):he?(0,$.jsx)(HA,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(aR,{...we,doInlineUpdate:re,rmm:ae})}):c===B.ARRAY&&e.sectionAppearance?(0,$.jsx)(HA,{active:O,name:o,label:m,children:(0,$.jsx)(CM,{...we,sectionAppearance:e.sectionAppearance})}):(0,$.jsx)(HA,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(SM,{...we})})})}xR.displayName=`DisplayField`;var SR=xR,CR=class extends Q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){let n=this.props.name;yR.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}},wR=(0,Q.createContext)(null);function vge({value:e,children:t}){return(0,$.jsx)(wR.Provider,{value:e,children:t})}function TR(){return(0,Q.useContext)(wR)}var ER;(function(e){e.DEFAULT=`default`,e.ENTRY=`entry`,e.SECTION=`section`,e.DOCUMENT=`document`})(ER||={});var yge={[ER.DEFAULT]:void 0,[ER.ENTRY]:`h5`,[ER.SECTION]:`h4`,[ER.DOCUMENT]:`h3`};function DR({name:e,scale:t=ER.DEFAULT,className:n}){let r=TR(),{getRecipe:i}=Ig(),a=yge[t],o=i(_t.TYPOGRAPHY,ii.HEADING),s=a?W(o.base,o.sizes?.[a]):void 0;if(r?.titleMountTracker&&(r.titleMountTracker.titleMounted=!0),e)return(0,$.jsx)(p_,{className:s,children:(0,$.jsx)(`div`,{"data-summary-title":``,className:W(`min-w-0 flex-1 text-foreground`,s?`leading-tight`:`font-medium leading-tight`,n),children:(0,$.jsx)(SR,{name:e,hideLabel:!0})})});let c=r?.primaryLabel;return c?(0,$.jsx)(Z,{as:`p`,"data-summary-title":``,className:W(`min-w-0 flex-1 font-medium text-foreground`,n),truncate:!0,children:c}):null}var OR;(function(e){e.AUTO=`auto`,e.TEMPLATE_OWNED=`template-owned`})(OR||={});var kR;(function(e){e.STACK=`stack`,e.ROW=`row`})(kR||={});var bge={[kR.STACK]:`flex flex-col gap-element text-sm`,[kR.ROW]:`flex flex-wrap items-center gap-x-group gap-y-item text-sm`};function AR(e){let t=!1;return Q.Children.forEach(e,e=>{if(t||!(0,Q.isValidElement)(e))return;if(e.type===DR){t=!0;return}let n=e.props?.children;n!==void 0&&AR(n)&&(t=!0)}),t}function jR({flow:e=kR.STACK,className:t,titlePlacement:n=OR.AUTO,children:r}){let i=n===OR.AUTO&&!AR(r);return(0,$.jsx)(TD,{pathPrefix:``,children:(0,$.jsxs)(`div`,{className:W(bge[e],t),children:[i&&(0,$.jsx)(DR,{}),r]})})}function MR({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(MR,xk.FIELD_SLOT_CONTAINER);function NR({field:e,variants:t,fallback:n}){let r=IC({name:DD(e)}),i=r==null?void 0:t[String(r)];return(0,$.jsx)($.Fragment,{children:i??n??null})}function PR({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 FR(e,t,n){let r=Kt(t),i=Nl(t);return{name:e,schema:t,schemaType:r,showWhenParams:i,showWhenWatchFields:i?zR(i):void 0,isDiscriminator:n===e}}function IR(e,t){let n=mr.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];ku(r)||ul(r)||i.push(FR(e,r,t))}return i}function LR(e){return tu(e)}function RR(e){let t=Zt(e);if(!bre(t))return null;let n=Vne(t,`discriminator`),r=g(t,`options`)??[];if(!n||r.length===0)return null;let i=e=>!!e&&!ku(e)&&!ul(e),a=r.map(e=>new Set(Vr(e))),o=[...a[0]??new Set].filter(e=>e!==n&&a.every(t=>t.has(e))),s=jt(r[0]),c=s?o.filter(e=>i(s[e])).map(e=>FR(e,s[e])):[],l=[];for(let e of r){let t=jt(e);if(!t)continue;let r=tie(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=>FR(e,t[e]))})}return{discriminator:n,commonFields:c,variants:l}}function xge(e){let t=RR(e);if(t)return{discriminatorField:t.discriminator,inheritedSchemas:t.variants.map(e=>({discriminatorFieldValue:e.value,schema:e.schema}))}}function Sge(e){let t=RR(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)($L,{name:e.name},e.name))}));return(0,$.jsxs)(MR,{name:e.name,children:[(0,$.jsx)($L,{name:t.discriminator}),t.commonFields.map(e=>(0,$.jsx)($L,{name:e.name},e.name)),Object.keys(n).length>0&&(0,$.jsx)(NR,{field:t.discriminator,variants:n})]},e.name)}function zR(e){let t=Array.isArray(e.conditions)?e.conditions:[e.conditions];return[...new Set(t.map(e=>e.field))]}function BR(e,t){let n=t?.inheritanceConfig??xge(e),r=IR(e,n?.discriminatorField);DT.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=Ege(r),s=o.length>0,c=new Set(r.map(e=>e.name)),l=()=>{let e=Cge(s,o),t=PT(),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:wge(r,n,c,l,t?.generatedFieldOverrides,e,o);return!r.showWhenParams||!e||WR(r.showWhenParams,e,o)?a:null}),i&&(0,$.jsx)(rO,{})]})};return l.displayName=`GeneratedFormTemplate`,l}function Cge(e,t){let n=IC({name:e?t:[]});return e?Array.isArray(n)?n:[n]:void 0}function wge(e,t,n,r,i,a,o){return i?.[e.name]?(0,$.jsx)($L,{name:e.name},e.name):e.isDiscriminator&&t&&n&&r?Tge(e,t,n,r,i):e.schemaType===B.OBJECT?VR(e,a,o):(0,$.jsx)($L,{name:e.name},e.name)}function Tge(e,t,n,r,i){let a={};if(t.inheritedSchemas)for(let e of t.inheritedSchemas){let t=jt(e.schema),o=Vr(e.schema);if(t&&o.length>0){let s=o.filter(e=>!ku(t[e])&&!ul(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)($L,{name:e},e))}))}}let o=Object.keys(a).length>0;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)($L,{name:e.name}),o&&(0,$.jsx)(NR,{field:t.discriminatorField,variants:a})]},e.name)}function VR(e,t,n,r=``){if(e.showWhenParams&&t&&n&&!WR(UR(e.showWhenParams,r),t,n))return null;let i=Sge(e);if(i)return i;let a=LR(e.schema),o=Object.keys(a).filter(e=>{let t=a[e];return!ku(t)&&!ul(t)});if(o.length===0)return(0,$.jsx)($L,{name:e.name},e.name);let s=r?`${r}.${e.name}`:e.name;return(0,$.jsx)(MR,{name:e.name,children:o.map(e=>{let r=a[e];return Kt(r)===B.OBJECT?VR(FR(e,r),t,n,s):(0,$.jsx)($L,{name:e},e)})},e.name)}function Ege(e){let t=new Set;for(let n of e)HR(n,t);return[...t]}function HR(e,t,n=``){if(e.showWhenParams){let r=UR(e.showWhenParams,n);for(let e of zR(r))t.add(e)}if(e.schemaType!==B.OBJECT)return;let r=LR(e.schema),i=n?`${n}.${e.name}`:e.name;for(let[e,n]of Object.entries(r))ku(n)||ul(n)||HR(FR(e,n),t,i)}function UR(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 WR(e,t,n){let r={};for(let e=0;e<n.length;e++)r[n[e]]=t[e];return mr.evaluateShowWhen(e,r)}function GR(e,t={}){let n=RR(e);if(n)return()=>(0,$.jsx)(hA,{children:t.factsAsTiles?Oge(n,t.resourceConfig):XR(n,t.resourceConfig)});let r=IR(e);if(DT.DISPLAY,r.length===0)return()=>(0,$.jsx)(hA,{});let i=KR(r,t.resourceConfig);if(t.factsAsTiles)return()=>(0,$.jsxs)(hA,{children:[i.state.length>0&&(0,$.jsx)(TA,{children:i.state.map(qR)}),i.content.map(YR),i.facts.length>0&&(0,$.jsx)(wA,{children:i.facts.map(YR)}),i.recordKeeping.length>0&&(0,$.jsx)(EA,{children:i.recordKeeping.map(YR)})]});let a=[...i.state,...i.content,...i.facts,...i.recordKeeping];return()=>(0,$.jsx)(hA,{children:a.map(YR)})}function KR(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 qR(e){return(0,$.jsx)(SR,{name:e.name,labelPlacement:`hidden`},e.name)}function Dge({children:e}){let{displayChromeMode:t}=sk();return(0,$.jsx)(ok,{displayChromeMode:t,sectionChromeMode:qc.INLINE,children:e})}function JR(e){return AA(e.schema)}function Oge(e,t){let n=KR(e.commonFields,t),r={},i={};for(let t of e.variants){let e=t.fields.filter(JR),n=t.fields.filter(e=>!JR(e));e.length>0&&(r[t.value]=(0,$.jsx)($.Fragment,{children:e.map(YR)})),n.length>0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:n.map(YR)}))}return(0,$.jsxs)($.Fragment,{children:[n.state.length>0&&(0,$.jsx)(TA,{children:n.state.map(qR)}),n.content.map(YR),Object.keys(r).length>0&&(0,$.jsx)(PR,{field:e.discriminator,variants:r}),(0,$.jsxs)(wA,{children:[(0,$.jsx)(SR,{name:e.discriminator}),n.facts.map(YR),Object.keys(i).length>0&&(0,$.jsx)(PR,{field:e.discriminator,variants:i})]}),n.recordKeeping.length>0&&(0,$.jsx)(EA,{children:n.recordKeeping.map(YR)})]})}function YR(e){return e.schemaType===B.OBJECT?kge(e):(0,$.jsx)(SR,{name:e.name},e.name)}function XR(e,t){let n=KR(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(YR)}));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(SR,{name:e.discriminator}),r.map(YR),Object.keys(i).length>0&&(0,$.jsx)(PR,{field:e.discriminator,variants:i})]})}function kge(e){let t=RR(e.schema);if(t)return(0,$.jsx)(MR,{name:e.name,children:XR(t)},e.name);let n=LR(e.schema),r=Object.keys(n).filter(e=>{let t=n[e];return!ku(t)&&!ul(t)});return r.length===0?(0,$.jsx)(SR,{name:e.name},e.name):(0,$.jsx)(MR,{name:e.name,children:r.map(e=>YR(FR(e,n[e])))},e.name)}function ZR(e,t){let n=mr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return()=>(0,$.jsx)(jR,{titlePlacement:OR.AUTO});let i=e=>!V.isIdentityOnlySummaryField(e,t),a=r.filter(e=>{let t=n[e];return i(e)&&!ul(t)&&Wie(t)}),o=a.length>0?a:r.filter(e=>i(e)&&!ul(n[e])),s=t?.frontendConfiguration?.layout?.defaultChromeMode?.summary!==void 0,c=o.map(e=>Kt(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)(jR,{titlePlacement:OR.AUTO,children:o.map((e,t)=>r[t]?i[t]?(0,$.jsx)(Dge,{children:(0,$.jsx)(SR,{name:e})},e):(0,$.jsx)(SR,{name:e},e):null)})}}function Age(e,t){return t!==K.UPDATE||!e?!1:Object.values(e).some(e=>{let t=id(e)?.autosave;return t===void 0?!1:t===!0||typeof t==`object`&&t.enabled!==!1})}function QR(e,t){return e?.cause instanceof Error?e.cause:Error(e?.message??t)}var $R=(0,Q.createContext)(null);function ez(e){let{tErrorValidation:t,tErrorMessage:n,t:r}=J(),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)?rT:a,c=(Rl(o)&&o.code===Une.DECLARED_REFUSAL?kp({tErrorMessage:n,t:r},o.params?.refusalCode):void 0)??(Rl(o)?t(o.code,`msg`,o.params):o);e.current.setError(s,{type:tT,message:c}),i.current.add(s)}),qD(Object.keys(a).map(e=>ID.isFormLevelErrorPath(e)?rT:e)))},[e,t,n,r]),clearServerErrors:s}}function tz(e){let{resourceType:t,contextResourceIdentifiers:n,rowValues:r,registry:i}=e;if(!n||!r||typeof r!=`object`||Array.isArray(r))return;let a;for(let[e,o]of Object.entries(r)){if(typeof o!=`string`||o.length===0)continue;let r=i.fieldIdentifierToResourceType?.[e];if(!r||r===t)continue;let s=n[r];if(s==null)continue;let c=En.getResourceId(s);c&&c!==o&&(a??={...n},a[r]=o)}return a}function nz(e,t){if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[t?.[e]??e,n]))}function rz(e){return e?.requestFieldRowFields}function iz(e,t){let{emit:n}=qo(),r=(0,Q.useContext)(dm),{registry:i}=pm(),a=r?.isConnected??!1,o=(0,Q.useMemo)(()=>{let t=i.resourceConfigurations[e.resourceType],{[e.resourceType]:n,...r}=Vu(e.contextResourceIdentifiers),a=V.buildContextualParameters(r,i);return Za(t?.operations??[],K.LIST).filter(e=>Kv({operation:e,contextResourceIdentifiers:r,contextualParameters:a}))},[e.contextResourceIdentifiers,e.resourceType,i]);return(0,Q.useCallback)((r,i)=>{if(ue(r))return;n(xc.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:Ne({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:e.resourceType,result:r,isBulkOperation:t.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements,optionalDiscriminator:Wc(e.additionalContext),resultSummary:Xu(r),...i?.partialWrite?{isPartialWrite:!0}:{}});let s=t.admitsCrossTenantPlatformAdministration===!0;if(!t.isBulkOperation&&!s||$i(t,a))return;let{[e.resourceType]:c,...l}=Vu(e.contextResourceIdentifiers),u=o.length>0?o:[null];for(let t of u)n(xc.RESOURCE_REFRESH,{resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??K.LIST),operation:t??{operationIdentifier:K.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 jge(e){let{apiBaseUrl:t,initiatorInfo:n,contextualParameters:r}=e,i=Um.resolveUrlPath(n.url,r);if(i&&!Um.hasUnresolvedPlaceholders(i))return`${t}${i}/validate-field`}var az=il.getLogger(),oz=az.debugByType(`HttpTransportAdapter`);az.setDebugTypeLogging(`HttpTransportAdapter`,!1);function Mge(e){let t=e?.context;if(!t||typeof t!=`object`)return;let n=t,r=ru.safeParse(n.versionConflict);return r.success?r.data:void 0}function Nge(e){let t=e.httpStatus;return t!=null&&typeof t==`number`&&!Number.isNaN(t)}function Pge(e){return e>=500?fE.SERVER:e>=400&&!bc.has(e)?fE.REFUSED:fE.TRANSIENT}function sz(e,t,n){let r=e?.validationErrors;return typeof r==`object`&&r&&Object.keys(r).length>0?{type:fE.VALIDATION,status:t,validationErrors:r,message:n}:{type:fE.REFUSED,status:t,message:n}}var Fge=class{_doOperation;constructor(e){this._doOperation=e}async execute(e){oz(`execute`,{operationPathKey:e.operationPathKey,fields:e.requestData?Object.keys(e.requestData):[],expectedVersion:e.expectedVersion});try{let t={};e.expectedVersion!=null&&(t[Te.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=ue(r);if(i)return oz(`execute: held for approval`,{decisionRef:i.decisionRef}),{status:pE.SUCCESS,heldForApproval:i};let a=r,o={status:pE.SUCCESS,data:a??void 0,newVersion:a?._version,fieldMeta:a?._field_meta};return oz(`execute: success`,{newVersion:o.newVersion}),o}catch(t){let n=this._mapError(t,e.expectedVersion!=null);return oz(`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!==fE.SERVER&&n.error.type!==fE.TRANSIENT||ja(e)||fl(e)||(n.error.resendable=Lee(e,no.REDISPATCH))),n}_classifyError(e,t){if(see(e))return{status:pE.ERROR,error:{type:fE.ABORT}};if(ja(e)||fl(e))return{status:pE.ERROR,error:{type:fE.TRANSIENT,message:e.message}};let n=Nge(e)?e.httpStatus:void 0;if(n!=null)switch(n){case 400:case 422:return{status:pE.ERROR,error:{type:fE.VALIDATION,status:n,validationErrors:e.validationErrors,message:e.message??String(e)}};case 404:case 410:return{status:pE.ERROR,error:{type:fE.NOT_FOUND,status:n}};case 409:if(e?.customMessageReference===rs.VERSION_CONFLICT){let r=Mge(e);return!r&&!t?{status:pE.ERROR,error:sz(e,n,e?.message??String(e))}:r?{status:pE.ERROR,error:{type:fE.CONFLICT,status:n,conflictDetails:r}}:{status:pE.ERROR,error:{type:fE.SERVER,status:n,message:`Version conflict response missing authoritative conflict details.`}}}return{status:pE.ERROR,error:sz(e,n,e?.message??String(e))};default:return{status:pE.ERROR,error:{type:Pge(n),status:n,message:String(e)}}}return{status:pE.ERROR,error:{type:fE.TRANSIENT,message:Vc(e)}}}},Ige=15e3,Lge=3e4,Rge=[1e3,3e3],zge=2e3,Bge=3e5;function cz(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}:{},...lz(e)}}function lz(e){let t=rp(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 uz=il.getLogger(),dz=uz.debugByType(`ResourceMutationManager`);uz.setDebugTypeLogging(`ResourceMutationManager`,!1);var Vge=64;function Hge(e,t){let n=wM(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 fz(e,t){let n=Object.keys(e).filter(e=>wM(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=wM(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}mz(r,i,e[i])}return r}var pz=new Set([uE.SECTION,uE.AUTOSAVE,uE.INLINE]);function mz(e,t,n){let r=wM(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 hz;(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`})(hz||={});var gz={type:dE.FORM,subscriberId:`autosave`},_z={maxQueueDepth:5,softTimeoutMs:Ige,hardTimeoutMs:Lge},Uge=class{resourceType;_resourceId;_confirmedData=null;_version=null;_pendingFields=new Map;_queue=[];_activeMutation=null;_state=cE.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=[...Rge];_serverRetryDelay=zge;_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??_z.maxQueueDepth,softTimeoutMs:t?.softTimeoutMs??_z.softTimeoutMs,hardTimeoutMs:t?.hardTimeoutMs??_z.hardTimeoutMs},this._crdtFieldNames=Dr({mainSchema:e.resourceSchema,inheritenceSchemaDefinition:e.resourceInheritance}),this._discriminatorFieldNames=AE(e.resourceSchema),this.subscribe=this.subscribe.bind(this),this.getSnapshot=this.getSnapshot.bind(this),dz(`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=Iee(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===cE.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=Dr({mainSchema:this._config.resourceSchema,inheritenceSchemaDefinition:this._config.resourceInheritance}),this._discriminatorFieldNames=AE(this._config.resourceSchema)),dz(`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===cE.DELETED)return;this._confirmedData={...e},this._version=t,this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1;let r=n??e._field_meta;this._fieldMeta=r==null?null:kt(r),this._invalidateSnapshot(),dz(`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===cE.DELETED)return dz(`queueMutation: rejected — resource deleted`,{resourceId:this._resourceId}),Promise.reject(new yE);let n=t?.priority??_E.LOW,r=t?.type??uE.AUTOSAVE,i=t?.source??gz;return this._queue.length>=this._backpressure.maxQueueDepth&&n<=_E.LOW?(dz(`queueMutation: rejected — backpressure`,{queueDepth:this._queue.length,maxDepth:this._backpressure.maxQueueDepth}),Promise.reject(new bE)):(dz(`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>=_E.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:hz.QUEUE_MUTATION}),this._processQueue()}))}autosave(e){this.queueMutation(e,{type:uE.AUTOSAVE,priority:_E.LOW,source:gz}).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:uE.AUTOSAVE,priority:e?.priority??_E.NORMAL,source:e?.source??gz,signal:e?.signal})}cancelPendingMutations(e){if(this._state!==cE.DELETED){dz(`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 vE(e)),null);for(let t of this._queue)t.reject(new vE(e));this._queue=[],this._deferredSelfEvents=[],this._pendingFieldTimestamps.clear(),this._transition({type:hz.CANCEL})}}acknowledgeConflict(){this._state===cE.CONFLICT&&(dz(`acknowledgeConflict`,{resourceId:this._resourceId}),this._transition({type:hz.CONFLICT_ACKNOWLEDGED}),this._processQueue())}_isOwnEcho(e){return this._producedVersions.has(e)}_recordProducedVersion(e){if(e!=null&&(this._producedVersions.add(e),this._producedVersions.size>Vge)){let e=this._producedVersions.values().next().value;e!==void 0&&this._producedVersions.delete(e)}}applyRemoteUpdate(e,t,n,r){if(this._state!==cE.DELETED){if(this._isOwnEcho(t)){if(this._activeMutation!==null){dz(`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,dz(`applyRemoteUpdate: accepting settled own-echo after canonical read-back miss`,{version:t}),this._applyRemoteUpdateInternal(e,t,n,r,!0);return}dz(`applyRemoteUpdate: own-echo discarded (no in-flight mutation)`,{version:t})}else this._activeMutation!==null&&n!==void 0&&n===this._config.currentUserId?(dz(`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){dz(`handleDeletion`,{reason:e,deletedBy:t,resourceId:this._resourceId}),this._transition({type:hz.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===cE.SAVING,isDeleted:this._state===cE.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(){dz(`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){dz(`destroy: flushPendingFields failed`,{resourceId:this._resourceId,attempt:e,error:Vc(t)});break}this._pendingFields.size>0&&dz(`destroy: completing with pending fields remaining (flush exhausted or failed)`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size}),(this._activeMutation||this._queue.length>0)&&(dz(`destroy: waiting for drain`,{queueDepth:this._queue.length}),await new Promise(e=>{this._onDrainCallbacks.push(e)})),this._clearTimers(),this._clearAuthoritativeRecoveryTimer(),this._snapshotListeners.clear(),dz(`destroy: complete`,{resourceId:this._resourceId})}_transition(e){let t=this._state;switch(e.type){case hz.QUEUE_MUTATION:if(this._state===cE.IDLE)this._state=cE.QUEUED;else if(this._state===cE.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 vE(e.entry.source))}this._state=cE.QUEUED}this._invalidateSnapshot();return;case hz.START_SAVING:this._state===cE.QUEUED&&(this._state=cE.SAVING,this._lastError=null,this._startBackpressureTimers());break;case hz.SAVE_SUCCESS:{this._state=this._queue.length>0||this._pendingFields.size>0?cE.QUEUED:cE.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:lE.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 hz.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:fE.SERVER,message:`Unknown error`};if(this._lastError=n,t===fE.CONFLICT){this._clearTimers(),this._state=cE.CONFLICT;let t=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new vE);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:lE.CONFLICT_RESET,discardedFields:t,reason:hE.VERSION_CONFLICT,currentData:a,currentVersion:o,conflictDetails:r,id:++this._eventCounter};break}if(t===fE.ABORT){this._clearTimers();let e=this._queue.length>0||this._pendingFields.size>0?cE.QUEUED:cE.IDLE;this._state=e,e===cE.IDLE&&(this._lastError=null);break}if(t===fE.VALIDATION||t===fE.NOT_FOUND||t===fE.REFUSED){if(this._clearTimers(),t===fE.VALIDATION&&this._activeMutation)for(let t of e.savedFields)this._pendingFields.has(t)||this._pendingFields.set(t,this._activeMutation.savingFields[t]);this._lastEvent={type:lE.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?cE.QUEUED:cE.IDLE;break}let r=this._activeMutation?.retryCount??0,i=n.resendable===!1?0:t===fE.TRANSIENT?this._retryDelays.length:+(t===fE.SERVER);if(r<i){let a=t===fE.TRANSIENT?this._retryDelays[r]:this._serverRetryDelay;this._state=cE.ERROR,this._lastEvent={type:lE.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===cE.ERROR&&this._activeMutation&&(this._activeMutation.retryCount++,dz(`retry: attempt`,{mutationId:this._activeMutation.entry.id,retryCount:this._activeMutation.retryCount,maxRetries:i,delayMs:a}),this._transition({type:hz.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 vE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._lastEvent={type:lE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=cE.IDLE,this._emitTerminalMutationFailureNotification(n,a);break}case hz.RETRY:this._state===cE.ERROR&&(this._state=cE.SAVING);break;case hz.CONFLICT_DETECTED:this._clearTimers(),this._state=cE.CONFLICT,this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new vE),null);for(let e of this._queue)e.reject(new vE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._confirmedData={...e.currentData},this._version=e.currentVersion,this._lastEvent={type:lE.CONFLICT_RESET,discardedFields:e.discardedFields,reason:e.reason,currentData:e.currentData,currentVersion:e.currentVersion,conflictDetails:e.conflictDetails,id:++this._eventCounter};break;case hz.CONFLICT_ACKNOWLEDGED:this._state===cE.CONFLICT&&(this._state=this._queue.length>0?cE.QUEUED:cE.IDLE,this._lastError=null);break;case hz.CANCEL:this._state=cE.IDLE,this._lastError=null;break;case hz.DELETE:this._clearTimers(),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._state=cE.DELETED,this._lastEvent={type:lE.RESOURCE_DELETED,reason:e.reason,deletedBy:e.deletedBy,id:++this._eventCounter};break;case hz.REMOTE_UPDATE:this._lastEvent={type:lE.REMOTE_UPDATE,changedFields:e.changedFields,mergedFields:e.mergedFields,version:e.version,initiatorUserId:e.initiatorUserId,crdtResolutions:e.crdtResolutions,id:++this._eventCounter}}this._state!==t&&dz(`_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=wi.parseOperationPathKey(n)}catch{}try{Ii.emit(xc.NOTIFY_RESOURCE_ERROR,{resourceType:this.resourceType,parentResourcesRequirements:[],operationIdentifier:String(r.operationIdentifier??K.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===fE.TRANSIENT?rs.NETWORK:cz(e.cause).errorCustomMessageReference,errorHttpStatus:e.status,errorRefusalCode:cz(e.cause).errorRefusalCode,...lz(e.cause),mutationErrorType:e.type,discardedFields:t}})}catch(e){dz(`_emitTerminalMutationFailureNotification: emit failed`,{resourceId:this._resourceId,error:Vc(e)})}}_processQueue(){if(this._activeMutation!==null||this._queue.length===0||this._state===cE.CONFLICT||this._state===cE.DELETED||this._state===cE.ERROR)return;let e=this._queue.shift(),t;if(e.type===uE.SUBMIT||e.type===uE.DRAFT||e.type===uE.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]}dz(`_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 vE(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:hz.START_SAVING}),this._executeTransport(this._activeMutation)}_executeTransport(e){let t=e;dz(`_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??(pz.has(e.entry.type)?jE(fz(e.savingFields,this._confirmedData),this._discriminatorFieldNames,this._confirmedData):fz(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){dz(`_executeTransport: stale callback — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),i=t.entry.source,a=e.status===pE.SUCCESS&&!e.heldForApproval&&r?.readBackOnSuccess?await this._readBackConfirmedState(e):e;if(a.status===pE.SUCCESS){dz(`_executeTransport: success`,{mutationId:t.entry.id,savedFields:n,newVersion:a.newVersion});let e=a.fieldMeta??a.data?._field_meta;e!=null&&(this._fieldMeta=kt(e));for(let e of n)this._pendingFieldTimestamps.delete(e);let r=Object.entries(t.savingFields).filter(([,e])=>e===null).map(([e])=>e),o=pz.has(t.entry.type)?t.savingFields:void 0;this._transition({type:hz.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 dz(`_executeTransport: error`,{mutationId:t.entry.id,errorType:a.error?.type,errorStatus:a.error?.status,errorMessage:a.error?.message,savedFields:n}),this._transition({type:hz.SAVE_ERROR,result:a,savedFields:n,source:i}),this._state===cE.ERROR||(this._state===cE.CONFLICT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:fE.CONFLICT,conflictDetails:a.error?.conflictDetails}}),this._notifyDrained()):a.error?.type===fE.ABORT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.reject(new vE(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){dz(`_executeTransport: stale rejection — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),r=t.entry.source;dz(`_executeTransport: transport rejected`,{mutationId:t.entry.id,error:Vc(e),savedFields:n}),this._transition({type:hz.SAVE_ERROR,result:{status:pE.ERROR,error:{type:fE.TRANSIENT,message:Vc(e),cause:e}},savedFields:n,source:r}),this._state===cE.ERROR||(this._activeMutation=null,this._processDeferredSelfEvents(void 0),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:fE.TRANSIENT,message:Vc(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:Yl.RAW,signal:void 0});return n.status===pE.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(),dz(`_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&&Hge(t,r)!==void 0||mz(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))mz(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))mz(e,t,n);for(let[t,n]of this._pendingFields)mz(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===cE.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))mz(o,e,t);for(let[e,t]of this._pendingFields)mz(o,e,t);if(this._version!==null&&(i?t<this._version:t<=this._version)){dz(`_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=>EM(e,t)));dz(`_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)||(mz(g,t,e[t]),m.push(t));for(let t of f){let n=u.find(e=>EM(t,e)),i=r?.[t]?.ts??0,a=n?this._pendingFieldTimestamps.get(n)??0:0,o=zr(i,a);h[t]=o,o===Cc.INCOMING?(n&&(this._pendingFields.delete(n),this._pendingFieldTimestamps.delete(n)),mz(g,t,e[t]),m.push(t),dz(`CRDT LWW: remote wins`,{field:t,remoteTs:i,localTs:a})):dz(`CRDT LWW: local wins (keep pending)`,{field:t,remoteTs:i,localTs:a})}this._confirmedData=g,r!=null&&(this._fieldMeta={...kt(this._fieldMeta),...kt(r)}),this._version=t;let _=Object.keys(h).length>0?h:void 0;if(p.length===0||this._config.conflictPolicy.strategy===mE.LAST_WRITE_WINS){this._transition({type:hz.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=>EM(e,t)),n=t?this._pendingFieldTimestamps.get(t)??0:0,i=r?.[e]?.ts??0;if(t&&zr(i,n)===Cc.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))mz(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,DM(b,e)])),submittedValues:Object.fromEntries(d.map(e=>[e,DM(o,e)]))};this._transition({type:hz.CONFLICT_DETECTED,discardedFields:x,reason:hE.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,dz(`_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}dz(`_processDeferredSelfEvents: discarded (version matches response)`,{version:n.version})}else dz(`_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===cE.DELETED||(this._authoritativeRecoveryTimer=setTimeout(()=>{this._authoritativeRecoveryTimer=null,this._retryAuthoritativeRecovery()},this._serverRetryDelay))}_clearAuthoritativeRecoveryTimer(){this._authoritativeRecoveryTimer&&=(clearTimeout(this._authoritativeRecoveryTimer),null)}async _retryAuthoritativeRecovery(){if(this._state===cE.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:Yl.RAW,signal:void 0});if(t.status!==pE.SUCCESS||!t.data){dz(`_retryAuthoritativeRecovery: canonical reread still unavailable`,{errorType:t.error?.type,errorStatus:t.error?.status});return}let n=t.newVersion??this._version;n==null?dz(`_retryAuthoritativeRecovery: canonical reread missing version`,{resourceId:this._resourceId}):(dz(`_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&&(dz(`backpressure: soft timeout`,{mutationId:this._activeMutation.entry.id,timeoutMs:this._backpressure.softTimeoutMs}),this._lastEvent={type:lE.MUTATION_RESULT,result:{success:!1,error:{type:fE.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(),dz(`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 vE(this._activeMutation.entry.source)),null),this._deferredSelfEvents=[];let t=this._queue.length>0||this._pendingFields.size>0?cE.QUEUED:cE.IDLE;this._state=t,this._lastError=t===cE.IDLE?null:{type:fE.TRANSIENT,message:`Hard timeout exceeded`},this._lastEvent={type:lE.MUTATION_RESULT,result:{success:!1,error:{type:fE.TRANSIENT,message:`Hard timeout exceeded`},retriesRemaining:0},source:e??gz,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)}dz(`_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=[]}}},vz=il.getLogger(),yz=vz.debugByType(`RMMRegistry`);vz.setDebugTypeLogging(`RMMRegistry`,!1);var bz=class{_instances=new Map;_activeInstanceListeners=new Set;_activeInstancesEmitScheduled=!1;MAX_INSTANCES;_clockOffset=0;constructor(e){this.MAX_INSTANCES=e?.maxInstances??200,yz(`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,yz(`getOrCreate: cancelled pending destroy`,{key:r}));let e=i.rmm.readOperationPathKey;return n.readOperationPathKey!==void 0&&e!==void 0&&n.readOperationPathKey!==e&&vz.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(),yz(`getOrCreate: reused`,{key:r,refCount:i.refCount}),this._emitActiveInstancesChanged(),i.rmm}i?.destroying&&(yz(`getOrCreate: old instance mid-destroy, replacing`,{key:r}),this._instances.delete(r)),this._evictIfNeeded();let a=new Uge(n);return this._clockOffset!==0&&(a.clockOffset=this._clockOffset),this._instances.set(r,{rmm:a,refCount:1,destroyTimer:null,lastAccessedAt:Date.now(),destroying:!1}),yz(`getOrCreate: created`,{key:r,instanceCount:this._instances.size}),this._instances.size>=this.MAX_INSTANCES*.8&&vz.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--,yz(`release`,{key:e,refCount:t.refCount}),t.refCount<=0&&(t.refCount=0,t.destroyTimer||=setTimeout(()=>{t.destroyTimer=null,t.destroying=!0,yz(`release: destroy timer fired`,{key:e}),t.rmm.destroy().then(()=>this.remove(e)).catch(()=>{yz(`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),yz(`remove`,{key:e,remainingInstances:this._instances.size}),this._emitActiveInstancesChanged())}destroy(){yz(`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(()=>{yz(`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),yz(`_evictIfNeeded: evicting LRU`,{key:e,lastAccessedAt:t}),n.rmm.destroy().catch(()=>{yz(`_evictIfNeeded: eviction cleanup failed`,{key:e})}),this._instances.delete(e)}else vz.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)})))}},xz=il.getLogger(),Sz=xz.debugByType(`RMMClockSync`);xz.setDebugTypeLogging(`RMMClockSync`,!1);function Cz(e){return e.length===0?0:e.reduce((e,t)=>t.rtt<e.rtt?t:e).offset}async function wz(e){let t=[];for(let n=0;n<5;n++)try{let n=Date.now(),r=await fetch(`${e}${ci[bt.HEALTH_TIME]}`),i=Date.now(),a=r.headers.get(Te.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 Tz(e,t){let n=await wz(e);if(n.length>0){let e=Cz(n),r=n.reduce((e,t)=>Math.min(e,t.rtt),1/0);t.setClockOffset(e),Sz(`calibrated`,{offset:e,sampleCount:n.length,minRtt:r})}return Date.now()}var Ez=(0,Q.createContext)(void 0);function Dz({children:e,options:t,apiBaseUrl:n}){let r=(0,Q.useMemo)(()=>new bz(t),[]),i=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!n)return;Tz(n,r).then(e=>{i.current=e});let e=setInterval(()=>{Tz(n,r).then(e=>{i.current=e})},Bge);return()=>{clearInterval(e)}},[r,n]),(0,Q.useEffect)(()=>{if(!n)return;function e(){document.visibilityState===`visible`&&Date.now()-i.current>=3e5&&Tz(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)(Ez.Provider,{value:r,children:e})}var Oz=Yl.RAW;function kz(e,t,n){let r=t.resourceConfigurations[e],i=r?.operations??[],a=(e,n)=>ph({resourceConfig:r,operations:e,coreOperation:K.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):Kl(i,K.READ);if(s||!n||n.hasResourceId===!0)return s;let c=Za(i,K.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 Az(e,t,n){let r=t.resourceConfigurations[e]?.operations??[],i=Za(r,K.READ),a=kz(e,t,n);if(a)return wi.createOperationPathKeyFromOperation(a);if(i.length===0||n)return;let o=i.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(o.length===1)return wi.createOperationPathKeyFromOperation(o[0])}function jz(e){return e.loadedOperationPathKey===e.canonicalReadOperationPathKey&&e.dataMode===Oz}async function Mz(e){return e.doOperation(e.readOperationPathKey,{contextualParameters:e.contextualParameters,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:Oz})}var Nz=il.getLogger(),Pz=Nz.debugByType(`useListInvalidation`);Nz.setDebugTypeLogging(`useListInvalidation`,!1);function Fz(e,t){let n=(0,Q.useSyncExternalStore)(e?.subscribe??OM,e?.getSnapshot??kM),{emit:r}=qo(),i=(0,Q.useContext)(dm)?.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===lE.MUTATION_RESULT&&n.lastEvent.result.success&&!a.current){let t=n.lastEvent.result,i=Xv({resourceType:e.resourceType,registry:o.current.registry,callContext:o.current.contextResourceIdentifiers,previousRow:t.previousConfirmedData,row:t.responseData}),s=Jv({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??K.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:K.LIST}};r(xc.RESOURCE_REFRESH,n)}Pz(`list invalidation triggered`,{resourceType:e.resourceType,isConnected:a.current})}},[n.lastEvent?.id])}var Iz=il.getLogger(),Lz=Iz.debugByType(`useResourceRMM`);Iz.setDebugTypeLogging(`useResourceRMM`,!1);var Rz={strategy:mE.ACCEPT_REMOTE},zz;(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`})(zz||={});function Bz(e){let{resourceType:t,resourceId:n,doOperationRef:r,contextualParameters:i,parentResourcesRequirements:a,contextResourceIdentifiers:o,resourceSchema:s,resourceInheritance:c,enabled:l=!0,conflictPolicy:u=Rz,directFallbackAccepted:d=!1,actingOperation:f}=e,p=(0,Q.useContext)(Ez),{registry:m}=pm(),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 Fge((...e)=>r.current(...e)),[]),w=sS(nh(t,S||void 0,o)),T=(0,Q.useMemo)(()=>mh({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?wi.createOperationPathKeyFromOperation(T):null,[t,T]),D=(0,Q.useMemo)(()=>Az(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:zz.PROVIDER_MISSING:zz.NO_ELIGIBLE_UPDATE_OPERATION:zz.MISSING_RESOURCE_ID:zz.DISABLED,[l,S,p,T]),k=(0,Q.useMemo)(()=>O===zz.DISABLED?(Lz(`RMM unavailable because attachment is disabled for this surface.`,{resourceType:t,resourceId:S}),null):O===zz.MISSING_RESOURCE_ID?(Lz(`RMM unavailable because no resource id is attached to the current surface.`,{resourceType:t}),null):O===zz.NO_ELIGIBLE_UPDATE_OPERATION&&d?(Lz(`RMM unavailable because no eligible UPDATE-like operation resolves; the caller runs directly, as the operation declared.`,{resourceType:t,resourceId:S}),null):O===zz.NO_ELIGIBLE_UPDATE_OPERATION?(Iz.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===zz.PROVIDER_MISSING?(Iz.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:Vu(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:Vu(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??OM,k?.getSnapshot??kM);return Fz(k,{contextResourceIdentifiers:Vu(o),parentResourcesRequirements:a??[],registry:m}),{rmm:k,rmmSnapshot:A,rmmRegistry:p??null,rmmUnavailableReason:O,canonicalReadOperationPathKey:D}}function Vz(e,t){return e.replace(`{fields}`,t.join(`, `))}function Hz(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 Uz(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 Wz=e=>{let{renderIcon:t}=kf();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:Jn.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:Vz(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:Uz(Hz(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:Uz(Hz(e.conflictDetails?.submittedValues,t),e.labels.emptyValue)})]})]},t))})]}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.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:Jn.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,$.jsx)(ND,{children:Vz(e.labels.message,e.changedFields)}),(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:e.onDismiss,"aria-label":e.labels.dismissAriaLabel,className:`shrink-0`,children:t(H.CLOSE,{size:Jn.SM})})]})]})},Gz=`relationship.quick_create.completed`;function Kz(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`quick-create-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function qz(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 Jz(e){let{registry:t}=pm(),{on:n}=qo(),{navigate:r}=SS(),[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(xc.RESOURCE_CUSTOM_EVENT,t=>{let n=t.data;n&&n.requestId===o.current&&(o.current=null,a(!1),e.onCreated?.(n))},e=>e.eventName===Gz&&e.data?.requestId===o.current),[n,e]),(0,Q.useEffect)(()=>n(xc.NAVIGATION_CLOSE,()=>{a(!1)}),[n]);let l=(0,Q.useCallback)(()=>{if(!s||!s.allowQuickCreate||!c||!e.navigationZone||!e.sourceFieldName)return;let n=Kz();o.current=n,a(!0);let i={requestId:n,sourceResourceType:e.sourceResourceType,sourceResourceId:e.sourceResourceId,sourceFieldName:e.sourceFieldName,relatedResourceType:s.relatedResourceType},l=En.createFrontendResourceOperationContextFromOperation({resourceType:s.relatedResourceType,operation:c,contextResourceIdentifiers:En.withoutSelfReferencingParents(e.contextResourceIdentifiers??{},s.relatedResourceType,t),additionalContext:{quickCreateRequest:i},isOperationDefault:c.isOperationDefault??!0,isBulkOperation:c.isBulkOperation??!1,variantKey:c.variantKey});r({content:{contentType:va.RESOURCE_OPERATION,resourceContext:l},initiator:Um.createOperationInitiator(e.navigationZone,e.sourceOperation),relationshipTransition:e.navigationZone===`overlay`?Ka.SPLIT:{transition:Ka.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 Yz(e){e.emit(xc.RESOURCE_CUSTOM_EVENT,{resourceType:e.resourceType,resourceId:e.resourceId,eventName:Gz,data:{requestId:e.requestId,resourceType:e.resourceType,resourceId:e.resourceId,data:e.data}})}function Xz(e){return(0,$.jsx)(JM,{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 Zz=il.getLogger();function Qz(e){bi.isDevelopment()&&Zz.warn(`[${e.componentName}] ${e.message}`,e.context)}function $z(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 eB(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let t=jt(Zt(r));if(!t||(r=t[e],!r))return}return r}var tB=il.getLogger();function nB(e){let t=BC(),n=PD(),r=PT(),{registry:i,doOperation:a}=pm();hk(e.fieldName);let{formChromeMode:o,sectionChromeMode:s}=Xw(),c=Sc(),{tComponent:l}=J(),u=eB(r?.schema,e.fieldName);return{formContext:t,formSchemaContext:n,templateContext:r,registry:i,doOperation:a,fieldSchema:u,resolvedChromeMode:(u?id(u):void 0)?.chromeMode??s??o??KL(c.autoRender?.autoFieldChrome),resolvedLabelPlacement:qL(c.autoRender?.autoLabelPlacement),resolvedControlSize:JL(c.autoRender?.autoFieldDensity),hideInlineErrorForPolicy:c.autoRender?.autoErrorPlacement===`summary-at-surface-top`,fieldLabel:r?.fieldLabels?.[e.fieldName]??mr.formatFieldPathFallback(e.fieldName),fieldDescription:r?.fieldDescriptions?.[e.fieldName],fieldTooltip:r?.fieldTooltips?.[e.fieldName],disabled:r?.disabled,readOnly:r?.readOnly,labels:{saveLabel:l(U.LOW_LEVEL_BUTTON,`save`),savingLabel:l(U.LOW_LEVEL_FORM_FIELD,`saving`),clearLabel:l(U.LOW_LEVEL_FORM_FIELD,`clearSelection`),saveFailedLabel:l(U.LOW_LEVEL_FORM_FIELD,`save_failed`),saveConflictLabel:l(U.LOW_LEVEL_FORM_FIELD,`save_conflict`),saveUnavailableLabel:l(U.LOW_LEVEL_FORM_FIELD,`save_unavailable`)}}}function rB(e){(0,Q.useEffect)(()=>{!e.rmm&&bi.isDevelopment()&&(e.allowsDirectOperationFallback?tB.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are using weaker-guarantee direct-operation fallback.`,e.context):tB.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are disabled.`,e.context))},[e.allowsDirectOperationFallback,e.componentName,e.context,e.rmm])}function iB({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}}=nB({fieldName:o}),O=u.allResourceFieldIdentifiers?.[s],k=c.watch(o),A=k??n,j=!f||Kt(f)===B.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),[L,ee]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{I(void 0),ee(!1),z(void 0)},[o,l.resourceId]),(0,Q.useEffect)(()=>{I(void 0),ee(!1),z(void 0)},[P.join(`|`)]);let te=F??(j?P:P[0]),ne=(0,Q.useMemo)(()=>[...new Set(Pw(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]);rB({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{ee(!0),z(void 0);try{let{contextualParameters:n,parentResourcesRequirements:r}=$z({formSchemaContext:l,registry:u}),a=e.map(e=>N.get(e)??{[O]:e}),s=wi.createOperationPathKeyFromOperation(t),f={...jl([l.resourceId]),peerIds:e};if(i){let e=await i.queueMutation({[o]:j?a:a[0]??null},{type:uE.CUSTOM,priority:_E.NORMAL,source:{type:dE.FORM,subscriberId:`generated-association:${o}`},transportOverride:{operationPathKey:s,contextualParameters:n,parentResourcesRequirements:r,requestData:f,readBackOnSuccess:!0}});if(!e.success){z(e.error?.type===fE.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){Qz({componentName:`GeneratedAssociationRelationshipField`,message:`Failed to update association relationship`,context:{fieldName:o,action:`save`,desiredPeerIds:e,error:t}}),z(T)}finally{ee(!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)(Xz,{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)(bI,{schema:j?Md(gd()).optional():gd().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||L||re,readOnly:x,controlSize:h,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Gd.SM,className:`shrink-0`,disabled:!ie||L||x||re,onClick:()=>{ce()},children:L?C:S}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Gd.SM,className:`shrink-0`,disabled:ne.length===0||L||x||re,onClick:oe,children:w})]})})}function aB({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}}=nB({fieldName:a});o&&eB(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),[L,ee]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{P(void 0),I(void 0),ee(!1),z(void 0)},[a,l.resourceId]),(0,Q.useEffect)(()=>{P(void 0),I(void 0),ee(!1),z(void 0)},[M]);let te=F===void 0?M:F??void 0,ne=N??te;rB({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{ee(!0),z(void 0);try{let t=wi.createOperationPathKeyFromOperation(u),{contextualParameters:n,parentResourcesRequirements:i}=$z({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={...jl([l.resourceId]),...e===`set`?{targetId:p}:{}};if(r){let c=await r.queueMutation({[a]:e===`set`?s:null,[o]:e===`set`?p:null},{type:uE.CUSTOM,priority:_E.NORMAL,source:{type:dE.FORM,subscriberId:`generated-reference:${a}`},transportOverride:{operationPathKey:t,contextualParameters:n,parentResourcesRequirements:i,requestData:m,readBackOnSuccess:!0}});if(!c.success){z(c.error?.type===fE.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){Qz({componentName:`GeneratedReferenceRelationshipField`,message:`Failed to update reference relationship`,context:{fieldName:a,foreignKeyFieldName:o,action:e,error:t}}),z(E)}finally{ee(!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)(Xz,{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)(bI,{schema:gd().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||L||!r&&!i,readOnly:S,controlSize:g,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Gd.SM,className:`shrink-0`,disabled:!N||N===te||L||S||!r&&!i,onClick:()=>{ie(`set`)},children:L?w:C}),n&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Gd.SM,className:`shrink-0`,disabled:!te||L||S||!r&&!i,onClick:()=>{ie(`clear`)},children:T})]})})}var oB=il.getLogger(),sB=oB.debugByType(`ResourceAutomatedForm`);oB.setDebugTypeLogging(`ResourceAutomatedForm`,!1);function cB(e,t){return t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function lB(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=cB(e,a);o!==void 0&&(i[a]=o)}return i}function uB(e,t){let n=e=>e==null||e===``;return n(e)||n(t)?n(e)&&n(t):(0,oC.default)(e,t)}function dB(e){return e.validationErrors?MM({httpStatus:e.status??400,validationErrors:e.validationErrors})!==null:!1}function fB(e){let t=(e.userNotifications||[]).find(e=>{let t=e.channel,n=e.target;return t===ko.FRONT_END_SUCCESS&&n===Ure.USER_SELF});return t?{identifier:t.identifier,level:t.level||Wl.SUCCESS}:null}function pB(e){switch(e){case K.CREATE:return`create`;case K.UPDATE:case K.UPDATE_MANY:return`saveChanges`;case K.DELETE:return`delete`;default:return`submit`}}function mB(e){return!e.success&&e.error?.type===fE.CONFLICT}function hB(e){return bs(e.operationIdentifier,e.resourceOperationLike)===K.READ||rl(e)}function gB(e,t,n,r){if(!e||h(t))return e;let i=n?Object.keys(n):[],a=r?mr.getObjectLikeFieldShape(r):void 0;if(i.length!==0&&a)return i.every(e=>Object.prototype.hasOwnProperty.call(a,e))?e:void 0}function _B({Template:e,requestFieldNames:t}){let n=Ak(),r=PT(),[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)($L,{name:e},e))}):null,claim:c}),[c,l,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kk.Provider,{value:n,children:(0,$.jsx)($R.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:tD(`measure`)},"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)($L,{name:e},e))})]})}function vB({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:_}=pm(),{emit:y}=qo(),{tComponent:b,tResourceOperation:x,isReady:S}=J({component:U.RESOURCES_LAYOUTS_CREATE,resource:e.resourceType}),C=lp(),w=(0,Q.useRef)(g),T=(0,Q.useRef)(y),D=(0,Q.useRef)(n),O=(0,Q.useRef)(t),k=(0,Q.useRef)(null),A=(0,Q.useRef)(d);w.current=g,T.current=y,D.current=n,O.current=t,A.current=d;let j=(0,Q.useMemo)(()=>new Ae,[]),{resourceType:N,operation:P,contextResourceIdentifiers:F}=e,I=iz(e,P),L=(0,Q.useContext)(uh),ee=(0,Q.useRef)(L);ee.current=L;let R=(0,Q.useCallback)(e=>ue(e)?(ee.current?.notifyInfo(b(U.RESOURCES_LAYOUTS_CREATE,`operationSentForApproval`)),!0):!1,[b]),z=m??Ja(P,_.resourceConfigurations[N]?.operations),te=String(P.operationIdentifier),ne=P.variantKey,re=P.admitsCrossTenantPlatformAdministration===!0,ie=(0,Q.useMemo)(()=>({variantKey:ne,admitsCrossTenantPlatformAdministration:re}),[re,ne]),ae=bs(te,P.resourceOperationLike?String(P.resourceOperationLike):void 0),oe=te,se=P.resourceOperationLike?String(P.resourceOperationLike):void 0,ce=se??oe,le=FT(ae,ce),[de,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(!1),[he,ge]=(0,Q.useState)(!1),[_e,ve]=(0,Q.useState)(void 0),[ye,B]=(0,Q.useState)(`none`),[xe,Se]=(0,Q.useState)(null),we=(0,Q.useRef)(null),{initAutoClearing:Te,injectServerErrors:Ee,clearServerErrors:De}=ez(we),[Oe,ke]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(u?.isDraft??!1),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(null),Be=(0,Q.useRef)(null),Ve=(0,Q.useMemo)(()=>{let e=P.requestDto;if(!e)return oB.error(`[ResourceAutomatedForm] No requestDto found for operation ${te} on resource ${N}`),e;if(P.isBulkOperation===!0&&e instanceof fae){let t=zie.filter(t=>t in e.shape),n=t.length>0?e.omit(Object.fromEntries(t.map(e=>[e,!0]))):e;return Bl(ae)?Ate(n):n}return e},[ae,P,te,N]),He=(0,Q.useMemo)(()=>_.resourceConfigurations[N],[_,N]),Ue=(0,Q.useMemo)(()=>AE(He?.mainSchema),[He]),We=(0,Q.useMemo)(()=>ae===K.READ||te===K.UPDATE?new Set:new Set([He?.mainSchema,...pl(He?.inheritenceSchemaDefinition)].flatMap(e=>[...rte(e)])),[ae,te,He]),Ge=(0,Q.useCallback)((e,t=!0)=>{let n=f??{},r=t?{...e,...n}:{...e};for(let e of We)Object.prototype.hasOwnProperty.call(n,e)||delete r[e];return r},[f,We]);(0,Q.useMemo)(()=>P.operationFrontendConfig,[P]);let Ke=He?.frontendConfiguration?.layout?.refs,qe=He?.frontendConfiguration?.layout?.defaultChromeMode?.edit,Je=(0,Q.useMemo)(()=>{let e=He?.inheritenceSchemaDefinition;if(e)return{discriminatorField:e.discriminatorField,withoutInheritanceDiscriminatorFieldValues:e.withoutInheritanceDiscriminatorFieldValues,inheritedSchemas:e.inheritedSchemas}},[He]),Ye=(0,Q.useMemo)(()=>{if(Ve)return mr.getObjectLikeFieldShape(Ve)},[Ve]),Xe=(0,Q.useMemo)(()=>gB(He?.frontendConfiguration?.layout?.edit,P.operationIdentifier,Ye,He?.inheritenceSchemaDefinition?Ud(V.resolveFieldShapeOfAnyVariant(He)??{}):He?.mainSchema),[He,P.operationIdentifier,Ye]),Ze=He?.frontendConfiguration?.draftableConfig,Qe=(0,Q.useMemo)(()=>{if(Ze||u)return!Ze&&u?u:Ze&&!u?{enabled:!0,isDraft:!1,discriminator:Ze.discriminator,draftValue:Ze.draftValue,publishedValue:Ze.publishedValue,requireConfirmationToPublish:Ze.requireConfirmationToPublish}:{...Ze,...u,enabled:u?.enabled??!!Ze}},[Ze,u]);(0,Q.useEffect)(()=>{Qe?.isDraft!==void 0&&Fe(Qe.isDraft)},[Qe?.isDraft]);let $e=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(F),[F]),et=(0,Q.useMemo)(()=>V.buildContextualParameters(F,_),[$e,_]),tt=(0,Q.useMemo)(()=>{if(!Ye)return{};let t=V.resolveSemanticContextFieldValues({resourceType:N,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:F,contextualParameters:et,registry:_}),n={};for(let[e,r]of Object.entries(t))Ye[e]&&(n[e]=r);return n},[$e,et,Ye,_,e.parentResourcesRequirements,N]),nt=(0,Q.useMemo)(()=>{if(!Ye)return{};let e={};for(let t of Object.keys(Ye)){let n=vj({resourceType:N,fieldName:t,operationType:ce,registry:_});n&&(e[t]=n)}return e},[ce,Ye,_,N]),rt=He?.operations??[],at=(0,Q.useContext)(ah)?.permissions?.accessProfile,ot=at?.organizationUnitNarrowing,st=(0,Q.useMemo)(()=>ae===K.CREATE?Que({resourceType:N,resourceConfiguration:He,formFieldShape:Ye,readThroughCreateOrganizationUnits:at?.readThroughCreateOrganizationUnits}):void 0,[at?.readThroughCreateOrganizationUnits,ae,Ye,He,N]),ct=ede({resourceType:gu.ORGANIZATION_UNITS,ids:st,hostContextualParameters:et}),lt=sg(),ut=Qp()?.currentOrganizationId??void 0,dt=He?.resourcePrimaryScope===Sr.ORGANIZATIONS&&String(et[Ce[Sr.ORGANIZATIONS]]??ut??``)||void 0,ft=(0,Q.useMemo)(()=>tde({roleEntries:at?.roleEntries,organizationId:dt,roleTables:lt,rolesWithinAuthority:at?.rolesWithinAuthority}),[at?.roleEntries,at?.rolesWithinAuthority,dt,lt]),pt=(0,Q.useMemo)(()=>rde({fieldShape:Ye,ceiling:ft,record:_e}),[Ye,ft,_e]),mt=(0,Q.useMemo)(()=>ide({fieldShape:Ye,ceiling:ft,record:_e}),[Ye,ft,_e]),ht=(0,Q.useMemo)(()=>{let e=st?{[fr]:{values:st,labels:ct}}:void 0;return e||pt?{...pt,...e}:void 0},[st,ct,pt]),gt=(0,Q.useMemo)(()=>{if(!Ye)return[];let e=[];for(let t of Object.values(nt)){let n=t.rootFieldName,r=e=>rt.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Xl.buildRelationshipBulkOperationIdentifier(e,n));(()=>{if(t.semantics.nature===it.COMPOSITION&&t.nestedMutationConfig)return!0;if(t.semantics.nature===it.REFERENCE){let e=t.foreignKeyIdentity?.fieldIdentifier,n=e?Ye[e]:void 0;return!!(n&&gl(n)&&!Object.prototype.hasOwnProperty.call(tt,e??``))||!!r(si.SET)}return t.semantics.nature===it.ASSOCIATION&&!!r(si.REPLACE)})()?e.push(n):bi.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Keeping relationship root visible because no business-facing editor is available`,{resourceType:N,operationType:ce,fieldName:n,relationshipNature:t.semantics.nature,hasNestedMutationConfig:!!t.nestedMutationConfig})}return Zue({resourceType:N,resourceConfiguration:He,formFieldShape:Ye,organizationUnitNarrowing:ot})&&e.push(fr),e},[tt,ce,Ye,ot,nt,He,rt,N]),_t=(0,Q.useMemo)(()=>wi.createOperationPathKeyFromOperation(P),[P]),vt=(0,Q.useMemo)(()=>rl(P),[P]),yt=(0,Q.useMemo)(()=>{let e=En.getAddressedRecordId({resourceType:N,operation:P,contextResourceIdentifiers:F});if(e)return e;let t=_e&&typeof _e==`object`?_e._id:void 0;return typeof t==`string`&&t.length>0?t:null},[$e,_e,N,P]),bt=(0,Q.useMemo)(()=>JSON.stringify(e.parentResourcesRequirements??[]),[e.parentResourcesRequirements]),xt=(0,Q.useMemo)(()=>!yt||F[N]?F:{...F,[N]:yt},[$e,yt,N]),St=(0,Q.useMemo)(()=>{let e=He?.resourceFieldIdentifier;return!yt||!e||String(et[e]??``)===yt?et:{...et,[e]:yt}},[et,He?.resourceFieldIdentifier,yt]),Ct=(0,Q.useMemo)(()=>{if(!vt||ae!==K.UPDATE||P.operationIdentifier!==K.UPDATE||!He)return _t;let e=ph({resourceConfig:He,operations:rt,coreOperation:K.UPDATE,registry:_,hasResourceId:!!yt,contextResourceIdentifiers:xt,contextualParameters:St});return e?wi.createOperationPathKeyFromOperation(e):_t},[$e,xt,St,ae,vt,P.operationIdentifier,_t,_,He,yt,rt]),wt=(0,Q.useMemo)(()=>{let t=vt&&ae===K.UPDATE&&te!==K.UPDATE;return{operationPathKey:Ct,contextualParameters:St,parentResourcesRequirements:e.parentResourcesRequirements,...t?{readBackOnSuccess:!0}:{}}},[St,Ct,ae,vt,te,e.parentResourcesRequirements]),Tt=(0,Q.useCallback)(t=>uc({operation:P,requestData:t,additionalContext:e.additionalContext}),[P,e.additionalContext]),{rmm:Et,rmmSnapshot:Dt,canonicalReadOperationPathKey:Ot}=Bz({resourceType:N,resourceId:yt,doOperationRef:w,contextualParameters:St,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:xt,resourceSchema:He?.mainSchema,resourceInheritance:He?.inheritenceSchemaDefinition,enabled:vt&&!!yt,conflictPolicy:{strategy:mE.ACCEPT_REMOTE},directFallbackAccepted:Rn(z),actingOperation:ie});Dy({markerId:`rmm:${N}:${yt??``}`,isDirty:!!Et&&Dt.hasUnsavedChanges});let kt=(0,Q.useMemo)(()=>Rn(z),[z]),At=vt&&!kt,jt=(0,Q.useCallback)(e=>{if(At&&!Et)throw new Qn({surfaceName:e,resourceType:N,operationIdentifier:te})},[te,At,N,Et]);(0,Q.useEffect)(()=>{At&&!Et&&bi.isDevelopment()&&oB.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:N,operationIdentifier:te,hasResourceId:yt!==null,updateLikeMutationFallbackMode:z})},[te,At,yt,N,Et,z]);let Mt=(0,Q.useMemo)(()=>{if(!He||!vt||!yt||!Ye)return{};let e={};for(let[t,n]of Object.entries(nt)){let r=n.rootFieldName,i=e=>rt.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Xl.buildRelationshipBulkOperationIdentifier(e,r));if(n.semantics.nature===it.REFERENCE){let r=n.foreignKeyIdentity?.fieldIdentifier;if(!r)continue;let a=Ye[r];if(a&&gl(a)&&!Object.prototype.hasOwnProperty.call(tt,r))continue;let o=i(si.SET),s=i(si.CLEAR);if(!o){bi.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping reference override because generated bulk set operation is unavailable`,{resourceType:N,fieldName:t,foreignKeyFieldName:r});continue}e[t]=(0,$.jsx)(aB,{writeSurface:n,setOperation:o,clearOperation:s,rmm:Et,allowDirectOperationFallback:kt})}else if(n.semantics.nature===it.ASSOCIATION){let r=i(si.REPLACE),a=_e?cB(_e,t):void 0,o=!!(_e&&typeof _e==`object`&&Object.prototype.hasOwnProperty.call(_e,t));if(!r){bi.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping association override because generated bulk replace operation is unavailable`,{resourceType:N,fieldName:t});continue}e[t]=(0,$.jsx)(iB,{writeSurface:n,replaceOperation:r,initialRelationshipValue:a,hasHydratedInitialValue:o,rmm:Et,allowDirectOperationFallback:kt})}}return e},[tt,_e,ce,Ye,vt,_,He,yt,rt,N,nt,Et,kt]),Nt=(0,Q.useCallback)((e,t,n)=>{let r=we.current;if(r)for(let i of e){if(n&&Object.prototype.hasOwnProperty.call(n,i)&&!uB(r.getValues(i),n[i]))continue;let e=cB(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(!Et||!Dt?.lastEvent)return;let e=Dt.lastEvent;switch(e.type){case lE.MUTATION_RESULT:{let{result:t}=e;if(t.success&&t.savedFields&&Nt(t.savedFields,Dt.confirmedData,t.savedValues),!t.success&&t.error?.type===fE.VALIDATION&&t.error.validationErrors){let e=MM({httpStatus:t.error.status??400,validationErrors:t.error.validationErrors});e&&Ee(e.validationErrors)}break}case lE.REMOTE_UPDATE:if(we.current)for(let t of e.changedFields)we.current.getFieldState(t).isDirty||we.current.setValue(t,cB(Dt.confirmedData,t),{shouldDirty:!1,shouldValidate:!1});ze({changedFields:e.changedFields,initiatorUserId:e.initiatorUserId}),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{ze(null),Be.current=null},3e3);break;case lE.CONFLICT_RESET:we.current&&we.current.reset(Ge(e.currentData,!1)),De(),Le({discardedFields:e.discardedFields,conflictingFields:e.conflictDetails?.conflictingFields??e.discardedFields,reason:e.reason,conflictDetails:e.conflictDetails});break;case lE.RESOURCE_DELETED:sB(`RMM resource deleted event`,{reason:e.reason})}},[Dt?.lastEvent?.id]),(0,Q.useEffect)(()=>()=>{Be.current&&=(clearTimeout(Be.current),null)},[]);let Pt=(0,Q.useCallback)(()=>{Et?.acknowledgeConflict(),Le(null)},[Et]),Ft=(0,Q.useMemo)(()=>{let e={resourceContext:{resourceType:N,operationId:te}};return{...e,...o,navigation:{...e.navigation,...o?.navigation}}},[N,te,o]),It=(0,Q.useMemo)(()=>{let t=ae===K.CREATE,n=rl(P);if(!t&&!n)return null;try{let t=n?yt:null,r=bi.getApiUrl();if(!He?.resourceFieldIdentifier)throw V.buildConfigurationError(rs.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:e.resourceType,component:`ResourceAutomatedForm`});let i=He.resourceFieldIdentifier,a={...St};t&&(a[i]=t);let o=P.variantType===E.API_CALL?P:He&&n?ph({resourceConfig:He,operations:He.operations??[],coreOperation:K.UPDATE,registry:_,hasResourceId:!!yt,contextResourceIdentifiers:xt,contextualParameters:St}):He?Kl(He.operations??[],K.CREATE):void 0,s;if(o){let t=za.buildOperationFrontendRoutePaths(He,o,_.allResourceFieldIdentifiers);if(t.length>0){let n=En.selectMatchingRoutePath(t,xt,He.resourceIdentifier,i,e.parentResourcesRequirements);s=`${yn}${n.url}`,s=Um.resolveUrlPath(s,a),s&&Um.hasUnresolvedPlaceholders(s)&&(oB.warn(`[ResourceAutomatedForm] Unresolved placeholders in routed API basePath; disabling route-derived helpers`,{basePath:s,resourceType:N,operationIdentifier:te}),s=void 0)}}return s?{apiBaseUrl:r,basePath:s,contextualParameters:a,resourceFieldIdentifier:i}:null}catch(e){return oB.error(`[ResourceAutomatedForm] Error computing resource API base:`,e),null}},[xt,St,ae,P,_,He,e,yt,N]),Lt=(0,Q.useMemo)(()=>{if(!Ve||!It||!He?.resourceFieldIdentifier)return{};let t={},n=rl(P),{apiBaseUrl:r,contextualParameters:i}=It;try{let a=P.variantType===E.API_CALL?P:n?ph({resourceConfig:He,operations:He.operations??[],coreOperation:K.UPDATE,registry:_,hasResourceId:!!yt,contextResourceIdentifiers:xt,contextualParameters:St}):Kl(He.operations??[],K.CREATE);if(!a)return t;let o=za.buildOperationFrontendRoutePaths(He,a,_.allResourceFieldIdentifiers);if(o.length===0)return t;let s=En.selectMatchingRoutePath(o,xt,He.resourceIdentifier,He.resourceFieldIdentifier,e.parentResourcesRequirements),c=`${r}/api/v1/files`,l=mr.collectUploadableFileFieldPaths(Ve);for(let e of l){let a=za.buildFileUploadRouteForOperation({operationRouteUrl:s.url,operationParameters:s.parameters,targetResourceType:N,targetResourceFieldIdentifier:He.resourceFieldIdentifier,fieldName:e,requiresTargetResourceId:n,isFrontend:!0}),o=Um.resolveUrlPath(a.url,i);if(Um.hasUnresolvedPlaceholders(o)){oB.warn(`[ResourceAutomatedForm] Unresolved placeholders in file upload path, skipping endpoint`,{fieldName:e,uploadPath:o});continue}let l=`${r}${yn}${o}`;t[e]={upload:l,override:n?l:void 0,getMetadata:c,delete:n?void 0:c}}}catch(e){oB.error(`[ResourceAutomatedForm] Error generating file upload context:`,e)}return t},[xt,Ve,P,bt,It,He,N]),Rt=(0,Q.useMemo)(()=>{if(!It||!He)return;let t=V.resolveFieldShapeOfAnyVariant(He);if(!t||!Object.values(t).some(e=>be(e)))return;let n=Kl(He.operations??[],K.CREATE),r=n?.initiatorInfos?.length?V.selectOperationUrlInitiatorInfo({initiatorInfos:n.initiatorInfos,contextualParameters:It.contextualParameters,targetResourceType:He.resourceIdentifier,targetDefaultFieldIdentifier:It.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}):void 0;if(!r)return;let i=jge({apiBaseUrl:It.apiBaseUrl,initiatorInfo:r,contextualParameters:It.contextualParameters});return i||oB.warn(`[ResourceAutomatedForm] validate-field URL has unresolved parameters; blur-time validation disabled`,{initiatorUrl:r.url,resourceType:N}),i},[It,He,e.parentResourcesRequirements,N]),zt=(0,Q.useMemo)(()=>yt??void 0,[yt]),Bt=(0,Q.useMemo)(()=>{if(!Et)return kz(N,_,{hasResourceId:!!yt,contextResourceIdentifiers:xt,contextualParameters:St,actingOperation:ie})},[$e,xt,St,ie,_,yt,N,Et]),Vt=(0,Q.useMemo)(()=>Et?Ot:Bt?wi.createOperationPathKeyFromOperation(Bt):Az(N,_,{hasResourceId:!!yt,contextResourceIdentifiers:xt,contextualParameters:St,actingOperation:ie}),[Bt,$e,xt,St,ie,_,yt,N,Et,Ot]),Ht=(0,Q.useMemo)(()=>hB(P),[P]),Ut=(0,Q.useRef)(null),Wt=RS({operation:P,currentObject:Ht?_e:void 0,resourceType:N,enabled:Ht&&de&&!xe}),Gt=(0,Q.useMemo)(()=>_e&&Ge(_e),[_e,Ge]),Kt=P.isBulkOperation===!0&&Bl(ae),qt=(0,Q.useMemo)(()=>{if(!Ht)return Kt?f:pde({formFieldShape:Ye,inheritanceConfig:Je,defaultValuesOverride:f})},[Ht,Ye,Je,f,Kt]),Jt=(0,Q.useCallback)((e,t,n={})=>sde({values:e,seed:void 0,schema:Ve,writtenAsHeld:t,variantFields:Ue,clears:n}),[Ue,Ve]),[Yt,Xt]=(0,Q.useState)({}),Zt=(0,Q.useRef)(Yt),Qt=xne(e.additionalContext),$t=(0,Q.useMemo)(()=>{let e=new Map;return t=>{if(Kt)return e.has(t)||e.set(t,cde(t,P.requestDto,Ve,Ue)),e.get(t)}},[Ue,Ve,P.requestDto,Kt]),en=(0,Q.useCallback)((e,t)=>{let n=t?$t(e):void 0;if(t&&!n)return;let r={...Zt.current};if(n?r[e]=n.value:delete r[e],Zt.current=r,Xt(r),!n)return;let i=n.kind===ZT.EMPTY?[]:n.kind!==ZT.TURN_OFF&&void 0;we.current?.setValue(e,i,{shouldDirty:!0}),we.current?.clearErrors(e)},[$t]),tn=(0,Q.useRef)(new Map),nn=(0,Q.useCallback)(e=>{let t=tn.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)}},[]),rn=(0,Q.useRef)(Ct);(0,Q.useEffect)(()=>{rn.current!==Ct&&(rn.current=Ct,Object.keys(Zt.current).length!==0&&(Zt.current={},Xt({})))},[Ct]);let an=(0,Q.useCallback)(()=>Object.fromEntries(Object.entries(Zt.current).filter(([e])=>tn.current.has(e))),[]),on=(0,Q.useCallback)(e=>{let t=Object.keys(e);if(t.length===0)return;let n={...Zt.current};for(let e of t)delete n[e];Zt.current=n,Xt(n)},[]),sn=(0,Q.useMemo)(()=>Kt?{selectionCount:Qt,clearFor:$t,isCleared:e=>Object.hasOwn(Yt,e),setCleared:en,registerField:nn}:null,[$t,Yt,Qt,nn,en,Kt]);(0,Q.useEffect)(()=>{if(!Ht){ve(f??void 0),B(`create`),fe(!0);return}let t=JSON.stringify({canonicalReadOperationPathKey:Vt,contextResourceIdentifiersKey:$e,parentResourcesRequirementsKey:bt});if(de&&Ut.current===t){if(Et&&_e&&typeof Et.getSnapshot==`function`&&Et.getSnapshot().confirmedData===null&&typeof Et.setInitialState==`function`){let e=_e;Et.setInitialState(e,e._version??0,e._field_meta)}return}let n=!1;return(async()=>{Se(null);try{if(!Vt)throw Error(`No addressable canonical READ operation is available for this resource form context.`);let r=await Mz({doOperation:w.current,readOperationPathKey:Vt,contextualParameters:St,parentResourcesRequirements:e.parentResourcesRequirements});if(n)return;let i=r;Et&&Et.setInitialState(i,i._version??0,i._field_meta),ve(f?{...i,...f}:r),Ut.current=t,B(t),fe(!0)}catch(e){if(n)return;let t=e instanceof Error?e:Error(String(e)),r=M(e),i=j.buildWildoError_Frontend(v.NOT_FOUND,{customMessageReference:rs.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:Vt,context:{resourceType:N,operationIdentifier:te,originalErrorMessage:t.message,originalErrorStack:t.stack,httpCode:r.code,httpContext:r.context}});Se({wildoError:i,message:C(e)}),D.current?.(t)}})(),()=>{n=!0}},[Ht,Vt,N,$e,St,bt,j,te,f,Et,de,_e]);let cn=(0,Q.useCallback)(async t=>{k.current?.(),me(!0),De(),sB(`handleSubmit: starting`,{operationPathKey:_t,dataKeys:Object.keys(t||{})});try{let n;if(Et){let e=vt&&tz({resourceType:N,contextResourceIdentifiers:xt,rowValues:nz(t,rz(P)),registry:_})!==void 0,r=await Et.queueMutation(t,{type:uE.SUBMIT,priority:_E.HIGH,source:{type:dE.FORM,subscriberId:`submit`},transportOverride:e?{...wt,readBackOnSuccess:!1}:wt});if(!r.success){if(mB(r))return;if(r.error?.type===fE.VALIDATION){D.current?.(QR(r.error,`Validation failed`));return}throw QR(r.error,`Submit failed`)}n=r.heldForApproval??r.responseData}else{jt(`ResourceAutomatedForm submit`);let e=Object.keys(tt),r=Kt?an():{},i=Kt?Jt(t,e,r):t,a=te===K.UPDATE||te===K.UPDATE_MANY;if(Kt&&a&&Object.keys(i).every(t=>e.includes(t))){Ee({[rT]:b(U.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}n=await w.current(wt.operationPathKey,{contextualParameters:wt.contextualParameters,requestData:Tt(i),parentResourcesRequirements:wt.parentResourcesRequirements},{silent:!0}),on(r)}if(sB(`handleSubmit: success`,{operationPathKey:_t}),R(n)){O.current?.(n);return}let r=fB(P);if(r){let t=r.level===Wl.WARNING?xc.NOTIFY_RESOURCE_WARNING:r.level===Wl.ERROR?xc.NOTIFY_RESOURCE_ERROR:r.level===Wl.INFO?xc.NOTIFY_RESOURCE_INFO:xc.NOTIFY_RESOURCE_SUCCESS;T.current(t,{...e,contextResourceIdentifiers:Ne({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,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&&ae===K.CREATE){let e=qz({result:n,resourceType:N,registry:_});e&&Yz({emit:T.current,requestId:i.requestId,resourceType:N,resourceId:e,data:typeof n==`object`&&n&&!Array.isArray(n)?n:void 0})}O.current?.(n)}catch(t){if(t instanceof vE)return;let n=t instanceof Error?t:Error(String(t));sB(`handleSubmit: error caught`,{message:n.message,operationPathKey:_t});let r=MM(t);r?(sB(`handleSubmit: server validation errors detected`,{httpStatus:r.httpStatus,fields:Object.keys(r.validationErrors)}),Ee(r.validationErrors)):(sB(`handleSubmit: general error (not validation)`,{message:n.message}),T.current(xc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,error:n.message,...cz(t)}})),D.current?.(n)}finally{me(!1)}},[jt,tt,xt,wt,vt,_,N,Ee,Tt,te,_t,et,P,e,Et,b,Jt,on,an,Kt]),ln=e=>{sB(`handleError: client-side validation failed`,{errorCount:Object.keys(e).length,fields:Object.keys(e)}),oB.warn(`[ResourceAutomatedForm] Form validation errors`,e),qD(KD(e))};(0,Q.useEffect)(()=>{if(!f||!we.current)return;let e=_e?Ge(_e):f;we.current.reset(e)},[f]);let un=(0,Q.useCallback)(e=>{if(we.current=e,Te(e),f){let t=_e?Ge(_e):f;e.reset(t)}},[Te,f]),dn=(0,Q.useCallback)(async e=>we.current?we.current.trigger(e):(sB(`validateAutosaveField: form methods unavailable, failing closed`,{fieldName:e}),!1),[]),fn=(0,Q.useCallback)(async(e,t,n)=>{jt(`ResourceAutomatedForm autosave`);let r=()=>{if(n.aborted)throw new DOMException(`Autosave aborted`,`AbortError`)};r();let i=!Et&&Kt?XT(an(),YT([e],Ve)):{},a=!Et&&Kt?Jt(BT(VT(we.current?.getValues()??{},e,t),YT([e],Ve)),[],i):void 0;if(a&&Object.keys(a).length===0)return;let o=Et?Et.queueMutation({[e]:t},{type:uE.AUTOSAVE,priority:_E.LOW,transportOverride:wt}).then(e=>{if(!e.success)throw e.error??Error(`Autosave failed`)}):w.current(wt.operationPathKey,{contextualParameters:wt.contextualParameters,requestData:Tt(a??jE(dA(we.current?.getValues()??null,e,t),Ue,_e)),parentResourcesRequirements:wt.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(),on(i)},[jt,wt,_e,Ue,Ve,Tt,Et,Jt,on,an,Kt]),pn=(0,Q.useCallback)(async(t,n,r)=>{if(n.length===0){bi.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping section save because no fields were registered for the section.`,{resourceType:N,sectionRef:t});return}let i=GT(BT(r,n),{hiddenFieldNames:gt,contextFieldValues:tt,omitClearedFields:le,schema:Ve});try{if(A.current){await A.current(t,n,i);return}let a;if(Et){let e=await Et.queueMutation(lB(i,n),{type:uE.SECTION,priority:_E.NORMAL,source:{type:dE.FORM,subscriberId:`section:${t}`},transportOverride:wt});if(!e.success){if(mB(e)||e.error?.type===fE.VALIDATION&&dB(e.error))return;throw QR(e.error,`Section save failed`)}a=e.heldForApproval??e.responseData}else{jt(`ResourceAutomatedForm section save`);let e,t={};if(Kt){let i=Object.keys(tt);t=XT(an(),YT(n,Ve));let a={...we.current?.getValues()??r};for(let e of Object.keys(P.requestFieldOffers??{}))e in r?a[e]=r[e]:delete a[e];let o=Jt(GT(BT(a,YT(n,Ve)),{hiddenFieldNames:gt,contextFieldValues:tt,omitClearedFields:le,schema:Ve}),i,t);if((te===K.UPDATE||te===K.UPDATE_MANY)&&Object.keys(o).every(e=>i.includes(e))){Ee({[rT]:b(U.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}e=Tt(o)}else{let t=_e;e=Tt(jE(HT(i,n,t),Ue,t))}a=await w.current(wt.operationPathKey,{contextualParameters:wt.contextualParameters,requestData:e,parentResourcesRequirements:wt.parentResourcesRequirements},{silent:!0}),ue(a)||Nt(n,a,Object.fromEntries(n.map(e=>[e,cB(i,e)]))),on(t)}if(R(a))return;I(a,{partialWrite:!0}),T.current(xc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ne({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:a,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(a),additionalContext:{...e.additionalContext,sectionRef:t,fieldNames:n,notificationIdentifier:`section_saved`,notificationLevel:Wl.SUCCESS}})}catch(n){if(n instanceof vE)return;let r=MM(n);if(r){Ee(r.validationErrors);return}let i=n instanceof Error?n:Error(String(n));T.current(xc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,sectionRef:t,error:i.message,...cz(n)}})}},[I,jt,wt,tt,_e,Ue,Ve,gt,Ee,Nt,Tt,le,te,e,N,Et,b,Jt,on,an,Kt]),mn=(0,Q.useMemo)(()=>l===void 0&&Age(Ye,ce),[l,ce,Ye]),hn=Bl(ae)&&P.requiresApproval===void 0,gn=l?.enabled===!0;(0,Q.useEffect)(()=>{gn&&!hn&&bi.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] autosaveConfig is ignored: autosave saves fields of records that exist, and this form creates one or runs an action.`,{resourceType:N,operationIdentifier:te})},[hn,gn,te,N]);let _n=(0,Q.useMemo)(()=>({enabled:hn&&(l?.enabled??mn),defaultTrigger:l?.defaultTrigger??(mn?ll.NONE:ll.DEBOUNCE),debounceMs:l?.debounceMs??500,savedStateDurationMs:2e3}),[l,hn,mn]),vn=(0,Q.useMemo)(()=>{if(!Ve||!Qe?.enabled)return null;try{let e=oe===K.CREATE?`CREATE`:Bl(oe)?`UPDATE`:`CREATE`,t=se===K.CREATE?`CREATE`:se&&Bl(se)?`UPDATE`:se===K.READ?`READ`:void 0;return sre(Ve,{operationType:e,operationLike:t,isDraftMode:!0})}catch{return null}},[Ve,Qe?.enabled,oe,se]),bn=(0,Q.useCallback)(async t=>{if(Qe?.enabled){k.current?.(),ge(!0),De();try{let n,r=!0;if(Qe?.onSaveDraft)n=await Qe.onSaveDraft(t),r=n!==void 0;else{let e=Qe?.discriminator||`_isDraft`,r=Qe?.draftValue??!0,i={...t,[e]:r};if(Et){let e=await Et.queueMutation(i,{type:uE.DRAFT,priority:_E.HIGH,source:{type:dE.FORM,subscriberId:`draft`},transportOverride:{...wt,requestData:i}});if(!e.success){if(mB(e))return;throw QR(e.error,`Draft save failed`)}n=e.heldForApproval??e.responseData}else jt(`ResourceAutomatedForm draft save`),n=await w.current(wt.operationPathKey,{contextualParameters:wt.contextualParameters,requestData:Tt(i),parentResourcesRequirements:wt.parentResourcesRequirements},{silent:!0})}if(R(n)){O.current?.(n);return}Fe(!0),r&&(T.current(xc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ne({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(n),additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaved`}}),O.current?.(n))}catch(t){if(t instanceof vE)return;let n=MM(t);n?Ee(n.validationErrors):T.current(xc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaveFailed`,...cz(t)}}),D.current?.(t)}finally{ge(!1)}}},[jt,wt,Qe,Tt,e,N,Ee,Et]),xn=(0,Q.useCallback)(async t=>{if(Qe?.enabled){k.current?.(),me(!0),De();try{let n,r=!0;if(Qe?.onPublish)n=await Qe.onPublish(t),r=n!==void 0;else{let e=Qe?.discriminator||`_isDraft`,r=Qe?.publishedValue??!1,i={...t,[e]:r};if(Et){let e=await Et.queueMutation(i,{type:uE.PUBLISH,priority:_E.HIGH,source:{type:dE.FORM,subscriberId:`publish`},transportOverride:{...wt,requestData:i}});if(!e.success){if(mB(e))return;throw QR(e.error,`Publish failed`)}n=e.heldForApproval??e.responseData}else jt(`ResourceAutomatedForm publish`),n=await w.current(wt.operationPathKey,{contextualParameters:wt.contextualParameters,requestData:Tt(i),parentResourcesRequirements:wt.parentResourcesRequirements},{silent:!0})}if(R(n)){O.current?.(n);return}if(Fe(!1),r){let t=fB(P);t&&T.current(xc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ne({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Xu(n),additionalContext:{...e.additionalContext,notificationIdentifier:t.identifier}}),O.current?.(n)}}catch(t){if(t instanceof vE)return;let n=MM(t);n?Ee(n.validationErrors):T.current(xc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`publishFailed`,...cz(t)}}),D.current?.(t)}finally{me(!1)}}},[jt,wt,Qe,Tt,e,N,P,Ee,Et]),Sn=(0,Q.useCallback)(async e=>{Qe?.enabled&&(Qe?.requireConfirmationToPublish?ke(e):await xn(e))},[Qe,xn]),Cn=(0,Q.useCallback)(async()=>{Oe&&(await xn(Oe),ke(null))},[Oe,xn]),wn=(0,Q.useCallback)(()=>{ke(null)},[]),Tn=cs(P.riskLevel),Dn=P.riskLevel===Ac.CRITICAL,On=Mi(P)?void 0:null,kn=x(N,String(P.operationIdentifier),`description`)||void 0,An=(0,Q.useMemo)(()=>VS(x,N,String(P.operationIdentifier)),[x,N,P.operationIdentifier]),jn=!!(Qe?.enabled&&vn),Mn=(0,Q.useCallback)(e=>{jn?Sn(e):cn(e)},[jn,Sn,cn]),Nn=(0,Q.useCallback)(e=>{Tn?Me(e):Mn(e)},[Tn,Mn]),Pn=(0,Q.useCallback)(()=>{let e=je;Me(null),e!==null&&Mn(e)},[je,Mn]),H=(0,Q.useCallback)(()=>{Me(null)},[]),Fn=(0,Q.useMemo)(()=>{let e=h(te)?b(U.RESOURCES_LAYOUTS_CREATE,pB(ae??te)):An,t=b(U.RESOURCES_LAYOUTS_CREATE,`submitting`);if(Qe?.enabled&&vn){let e=Qe?.publishLabel?b(U.RESOURCES_LAYOUTS_CREATE,Qe.publishLabel):b(U.RESOURCES_LAYOUTS_CREATE,`publish`),t=b(U.RESOURCES_LAYOUTS_CREATE,`publishing`);return(0,$.jsx)(X,{type:`submit`,disabled:pe||he||i,children:pe?t:e})}return(0,$.jsx)(X,{type:`submit`,disabled:pe||i,children:pe?t:e})},[ae,te,An,pe,he,i,b,Qe,vn]),In=(0,Q.useMemo)(()=>{if(!r)return null;let e=b(U.RESOURCES_LAYOUTS_CREATE,`cancel`);return(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,disabled:pe||he,onClick:r,children:e})},[r,pe,he,b]),Ln=(0,Q.useMemo)(()=>{if(!Qe?.enabled||!vn)return null;let e=Qe?.saveDraftLabel?b(U.RESOURCES_LAYOUTS_CREATE,Qe.saveDraftLabel):b(U.RESOURCES_LAYOUTS_CREATE,`saveAsDraft`),t=b(U.RESOURCES_LAYOUTS_CREATE,`savingDraft`);return(0,$.jsx)(bB,{draftSchema:vn,omitClearedFields:le,submissionSchema:Ve,onSaveDraft:bn,disabled:he||pe||i,isSavingDraft:he,label:e,savingLabel:t})},[Qe,vn,bn,he,pe,i,b]),zn=Ie?{title:b(U.RESOURCES_LAYOUTS_CREATE,Ie.reason===hE.VERSION_CONFLICT?`conflictTitleVersion`:`conflictTitleRemote`),message:b(U.RESOURCES_LAYOUTS_CREATE,Ie.reason===hE.VERSION_CONFLICT?`conflictMessageVersion`:`conflictMessageRemote`),acknowledgeButton:b(U.RESOURCES_LAYOUTS_CREATE,`conflictAcknowledge`),currentValue:b(U.RESOURCES_LAYOUTS_CREATE,`conflictCurrentValue`),submittedValue:b(U.RESOURCES_LAYOUTS_CREATE,`conflictSubmittedValue`),emptyValue:b(U.LOW_LEVEL_FORM_FIELD,`noValue`)}:void 0,Bn=(0,Q.useMemo)(()=>!Ie||!zn?null:(0,$.jsx)(Wz,{type:`conflict`,discardedFields:Ie.discardedFields,conflictDetails:Ie.conflictDetails,labels:zn,onDismiss:Pt}),[Ie,zn,Pt]),[Vn,Hn]=(0,Q.useState)(0),Un=(0,Q.useCallback)(()=>(Hn(e=>e+1),()=>Hn(e=>e-1)),[]),Wn=(0,Q.useMemo)(()=>({submitButton:Fn,draftSaveButton:Ln,cancelButton:In,submissionNotice:Bn,claimFooter:Un,footerClaimed:Vn>0}),[Fn,Ln,In,Bn,Un,Vn]),Gn=(0,Q.useMemo)(()=>{if(Ht)return String(Bt?.operationIdentifier??V.resolveSingleResourceReadOperation(N,_)?.operationIdentifier??K.READ)},[Bt,Ht,N,_]),Kn=(0,Q.useMemo)(()=>!Ht||!Gn?[]:[{resourceType:N,operation:Gn}],[Ht,N,Gn]),qn=(0,Q.useMemo)(()=>[`components.${U.RESOURCES_LAYOUTS_CREATE}`],[]),Jn=(0,Q.useMemo)(()=>Ht?[{id:`form-data`,isReady:de}]:[],[Ht,de]),Yn=(0,Q.useMemo)(()=>({errorNetwork:b(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:b(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:b(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:b(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:b(U.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[b]),Xn=(0,Q.useMemo)(()=>{if(!Ve)return null;if(Xe){let e=Xe,t=h(P.operationIdentifier)?null:IR(Ve,Je?.discriminatorField).map(e=>e.name),n=()=>(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(_B,{Template:e,requestFieldNames:t}):(0,$.jsx)(e,{}),(0,$.jsx)(sE,{})]});return n.displayName=`ResourceFormTemplate(explicit)`,n}let e=BR(Ve,{inheritanceConfig:Je,includeSubmitButton:!1,includeErrorSummary:s}),t=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e,{}),(0,$.jsx)(sE,{})]});return t.displayName=`ResourceFormTemplate`,t},[Xe,Ve,Je,s,P.operationIdentifier]);if(!S)return null;if(xe){let e=b(U.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:xe.message})]})})}if(Ht&&de&&!Wt.isLoading&&!Wt.isEnabled){let e=b(U.RESOURCES_LAYOUTS_CREATE,`operationUnavailableTitle`),t=b(U.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 Zn=Ht?Gt??f:qt??f;if(!Ve){let e=b(U.RESOURCES_LAYOUTS_CREATE,`configurationError`),t=b(U.RESOURCES_LAYOUTS_CREATE,`noSchemaFound`,{operation:te,resource:N});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 $n=b(U.RESOURCES_LAYOUTS_CREATE,`confirmPublishTitle`),er=b(U.RESOURCES_LAYOUTS_CREATE,`confirmPublishMessage`),tr=b(U.RESOURCES_LAYOUTS_CREATE,`cancel`),nr=b(U.RESOURCES_LAYOUTS_CREATE,`publish`),rr=Re?{message:b(U.RESOURCES_LAYOUTS_CREATE,`remoteUpdateMessage`),dismissAriaLabel:b(U.RESOURCES_LAYOUTS_CREATE,`dismiss`)}:void 0,ir=(0,$.jsx)(eb,{i18nKeys:qn,loadingScopes:Kn,readiness:Jn,children:(0,$.jsxs)(`div`,{className:a,children:[(0,$.jsx)(zw,{open:!!Oe,onOpenChange:e=>!e&&wn(),children:(0,$.jsxs)(Vw,{children:[(0,$.jsxs)(Hw,{children:[(0,$.jsx)(Ww,{children:$n}),(0,$.jsx)(Gw,{children:er})]}),(0,$.jsxs)(Uw,{children:[(0,$.jsx)(qw,{onClick:wn,children:tr}),(0,$.jsx)(Kw,{onClick:Cn,children:nr})]})]})}),je!==null&&(0,$.jsx)(Mw,{open:!0,onOpenChange:e=>{e||H()},cancelCallback:H,validationCallback:Pn,label:An,confirmLabel:An,description:On,detail:kn,requireTypedConfirmation:Dn,confirmationPhrase:Dn?An:``}),Re&&rr&&(0,$.jsx)(Wz,{type:`remote-update`,changedFields:Re.changedFields,labels:rr,onDismiss:()=>ze(null)}),(0,$.jsx)(OE.Provider,{value:sn,children:(0,$.jsx)(aE,{value:Wn,children:(0,$.jsx)(rE,{schema:Ve,defaultValues:Zn,onSubmit:Nn,onError:ln,validationMode:c,disabled:i||pe,labels:Ft,layoutRefs:Ke,operationRef:te,operationType:oe,operationLike:se,coreOperation:ae,fileUploadContext:Lt,contextFieldValues:tt,hiddenFieldNames:gt,generatedFieldOverrides:Mt,allowedValuesByField:ht,roleGrantPickerOffersByField:mt,requestFieldOffers:P.requestFieldOffers,requestFieldOfferRecord:Ht?_e:void 0,inheritanceConfig:Je,onSectionSave:lde({writesRecordFields:Bl(ae),hasCallerSectionHandler:d!==void 0})?pn:void 0,onFormReady:un,warnOnUnsavedChanges:!0,validateFieldUrl:Rt,resourceType:N,hostResolvesRelationshipRoots:!0,resourceId:zt,contextResourceIdentifiers:xt,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:p,chromeMode:qe,layoutTemplate:Xn},ye)})})]})});return _n.enabled?(0,$.jsxs)(EE,{labels:Yn,validateField:dn,onSave:fn,rmm:Et??void 0,config:_n,children:[(0,$.jsx)(yB,{cancelRef:k}),ir]}):ir}function yB({cancelRef:e}){let t=TE();return Q.useEffect(()=>(t&&(e.current=t.cancelAllPending),()=>{e.current=null}),[t,e]),null}function bB({draftSchema:e,onSaveDraft:t,disabled:n,isSavingDraft:r,label:i,savingLabel:a,omitClearedFields:o,submissionSchema:s}){let c=BC(),l=PT(),u=(0,Q.useCallback)(async()=>{if(!c)return;let n=c.getValues(),r=e.safeParse(yT(n,e));if(r.success){let e=GT(r.data,{hiddenFieldNames:l?.hiddenFieldNames,contextFieldValues:l?.contextFieldValues,omitClearedFields:o,schema:s});c.clearErrors(),await t(e)}else{let e=mT(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:Y.OUTLINE,disabled:n,onClick:u,children:r?a:i})}var xB;(function(e){e.SHELL=`shell`,e.SURFACE=`surface`})(xB||={});function SB(e,t,n=!0){return e||(n?t:so.PRIMARY)}function CB({preset:e=G.DEFAULT,host:t=xB.SHELL,...n}){let r=(0,Q.useContext)($g)?.navigationLayout?.backAffordanceOwner;if(!(t===xB.SHELL?Fo(r):qre(r)))return null;let i=q(U.APPLICATION_LEVEL_NAVIGATION_BACK,`ApplicationLevel_NavigationBack`)(e);return(0,$.jsx)(i,{...n})}var wB=rc(U.LOW_LEVEL_BREADCRUMB,`Breadcrumb`,[`List`,`Item`,`Link`,`Page`,`Separator`,`Ellipsis`]);function TB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n,{...t})}function EB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.List,{...t})}function DB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Item,{...t})}function OB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Link,{...t})}function kB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Page,{...t})}function AB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Separator,{...t})}function jB({preset:e=G.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Ellipsis,{...t})}function MB(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 NB(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 PB=({resourceContext:e,navigationZone:t,navigationInitiator:n,maxDepth:r=5})=>{let{resourceType:i,contextResourceIdentifiers:a,parentResourcesRequirements:o}=e,{registry:s,doOperation:c}=pm(),l=cS(),{tResourceHeader:u,t:d,formatDate:f,formatDateTime:p,isReady:m}=J({resource:i}),{navigate:h}=SS(),g=(0,Q.useRef)(c);g.current=c;let _=(0,Q.useMemo)(()=>NB({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=MB({segment:e,contextResourceIdentifiers:a}),i=t?ph({resourceConfig:t,operations:(t.operations??[]).filter(t=>Kx(t,e.resourceType,l)),coreOperation:K.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=qp({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=MB({segment:e,contextResourceIdentifiers:a}),r=ph({resourceConfig:t,operations:(t.operations??[]).filter(t=>!ld(t.operationFrontendConfig)&&Kx(t,e.resourceType,l)),coreOperation:K.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=>[FB(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=En.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:o,contextResourceIdentifiers:a,isOperationDefault:!0,parentResourcesRequirements:e.ancestorRequirements}),l;if(Fi(o.operationFrontendConfig)){let t=za.buildOperationFrontendRoutePaths(i,o,s.allResourceFieldIdentifiers);l=En.selectMatchingRoutePath(t,a,i.resourceIdentifier,i.resourceFieldIdentifier,e.ancestorRequirements)?.url}h({content:{contentType:va.RESOURCE_OPERATION,resourceContext:c},urlPath:l,initiator:{sourceZone:t}})};return _.length===0||!m?null:(0,$.jsx)(TB,{children:(0,$.jsx)(EB,{children:b.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(DB,{children:S.get(FB(e))?(0,$.jsx)(OB,{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)(AB,{})]},FB(e)))})})};function FB(e){return`${e.resourceType}-${e.resourceId}`}function IB({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_BREADCRUMB,`ResourceLayout_Breadcrumb`)(e);return(0,$.jsx)(n,{...t})}var LB=il.getLogger(),RB=LB.debugByType(`AutomaticDisplayer`);LB.setDebugTypeLogging(`AutomaticDisplayer`,!1);function zB({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=kl.RMM_REQUIRED,layoutTemplate:y,isLoading:b=!1,defaultDisplayChromeMode:x,defaultInlineEdit:S,defaultEmptyValue:C,defaultSectionAppearance:w,hiddenFieldNames:T,inlineEditDisabledFieldNames:D,onFileActivationOperation:O}){let{doOperation:k,registry:A}=pm(),j=(0,Q.useContext)($g)?.UIConfig?.currentBreakpoint??yi.DESKTOP,{fieldLabels:M,fieldDescriptions:N,fieldTooltips:P,enumLabels:F,sectionLabels:I,sectionDescriptions:L,groupLabels:ee}=tE(e,r?.resourceContext,t,`display`,{layoutRefs:i,fieldPathPrefix:r?.fieldPathPrefix,overrides:{fields:r?.fields,enums:r?.enums,sections:r?.sections}}),R=sS(nh(a,o,c)),z=(0,Q.useCallback)(()=>{if(d===null)return null;if(d!==void 0){let e=d.variantType===E.API_CALL,t=d.resourceOperationLike??d.operationIdentifier,n=d.operationIdentifier===K.UPDATE;if(!e||!n||d.isBulkOperation===!0||t!==K.UPDATE)throw RB(`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=A.resourceConfigurations[a];if(!e)return null;let t=V.getResourceFieldIdentifierForType(a,A),n=En.buildRecordIdentifiersFromCollection(c,a,o),r={...s??{},[t]:o};return mh({resourceConfig:e,operations:e.operations??[],registry:A,hasResourceId:En.getResourceId(n[a]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:n,contextualParameters:r,viewer:R})??null},[c,s,d,A,o,a,R]),te=(0,Q.useMemo)(()=>z()!==null,[z]),ne=(0,Q.useMemo)(()=>AE(e),[e]),re=(0,Q.useCallback)(async(n,r)=>{let i=e?mi(e,n):void 0,c=i?Le(i,r):r;if(RB(`doInlineUpdate`,{fieldName:n,path:p?`custom`:_?`rmm`:`fallback`}),p)await p(n,c),g?.(n,c);else if(_){let e=d?{operationPathKey:wi.createOperationPathKeyFromOperation(d)}:void 0,t=await _.queueMutation({[n]:c},{type:uE.INLINE,priority:_E.LOW,source:{type:dE.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(Rn(v)&&a&&o){let e=z();if(!e)throw Error(`No UPDATE operation configured for resource "${a}". Inline editing requires an UPDATE.default operation.`);let r=wi.createOperationPathKeyFromOperation(e),i=V.getResourceFieldIdentifierForType(a,A),u={...s,[i]:o};await k(r,{contextualParameters:u,parentResourcesRequirements:l,requestData:jE(dA(t,n,c),ne,t)}),g?.(n,c)}else throw new Qn({surfaceName:`AutomaticDisplayer inline edit`,resourceType:a??`unknown`,operationIdentifier:d?.operationIdentifier??K.UPDATE})},[p,_,a,o,s,l,k,A,g,z,v,d,ne,t,e]),ie=!m&&(!!p||!!_||Rn(v)&&!!a&&!!o&&te),ae=(0,Q.useMemo)(()=>({resourceType:a,resourceId:o,doInlineUpdate:re,canInlineEdit:ie,defaultInlineEdit:S,defaultEmptyValue:C,fileUploadContext:h,contextualParameters:s,contextResourceIdentifiers:c,navigationZone:u,parentReferenceConfig:f,rmm:_}),[a,o,re,ie,S,C,h,s,c,u,f,_]),oe=(0,Q.useMemo)(()=>({schema:e,data:b?void 0:t,isLoading:b,fieldLabels:M,fieldDescriptions:N,fieldTooltips:P,enumLabels:F,sectionLabels:I,sectionDescriptions:L,groupLabels:ee,defaultSectionAppearance:w,breakpoint:j,hiddenFieldNames:T,inlineEditDisabledFieldNames:D,onFileActivationOperation:O}),[e,t,b,M,N,P,F,I,L,ee,w,j,T,D,O]);return(0,$.jsx)(uj.Provider,{value:ae,children:(0,$.jsx)(yA.Provider,{value:!1,children:(0,$.jsx)(ok,{displayChromeMode:x,children:(0,$.jsx)(nk,{value:oe,children:(0,$.jsx)(`div`,{className:W(`space-y-section`,n),children:y?Q.createElement(y):null})})})})})}zB.displayName=`AutomaticDisplayer`;var BB=zB,VB=(0,Q.createContext)(null);function HB({value:e,children:t}){return(0,$.jsx)(VB.Provider,{value:e,children:t})}function UB(){return(0,Q.useContext)(VB)}function WB({title:e,hostProvidesHeading:t,className:n}){let r=W(`min-w-0 truncate`,KB(),n);return t?(0,$.jsx)(`h2`,{className:r,children:e}):(0,$.jsx)(`h1`,{className:r,children:e})}function GB({className:e}){return(0,$.jsx)(`div`,{className:W(`min-w-0`,KB(),e),"aria-hidden":`true`,"data-resource-header-title-pending":`true`,children:(0,$.jsx)(mm,{className:`h-[1lh] w-48 max-w-full`})})}function KB(){let e=(0,Q.useContext)($g);return(e?e.getRecipe(_t.TYPOGRAPHY,ii.RESOURCE_TITLE):kg.typography?.[ii.RESOURCE_TITLE])?.base}function qB({className:e}){let t=UB();t?.titleMountTracker&&(t.titleMountTracker.titleMounted=!0);let n=t?.title,r=n?(0,$.jsx)(WB,{title:n,hostProvidesHeading:t?.hostProvidesHeading,className:e}):t?.titlePending?(0,$.jsx)(GB,{}):null;return r?t?.titleTarget===void 0?r:t.titleTarget?(0,DN.createPortal)(r,t.titleTarget):null:null}function JB({children:e}){let t=UB();return t?.leadingTarget===void 0?(0,$.jsx)($.Fragment,{children:e}):t.leadingTarget?(0,DN.createPortal)(e,t.leadingTarget):null}var YB=(0,Q.createContext)(null);function XB({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)(YB.Provider,{value:d,children:n})}function ZB(e){let t=(0,Q.useContext)(YB);return!!t&&t.zone===e}var QB;(function(e){e.OWN_ROW=`own_row`,e.IN_HEADER=`in_header`,e.OVERLAY=`overlay`})(QB||={});function $B(){let e=(0,Q.useContext)(YB);return!e||e.claimant==null?QB.OWN_ROW:e.claimantOnScreen?QB.IN_HEADER:QB.OVERLAY}function eV({children:e}){let t=$B();return t===QB.IN_HEADER?null:(0,$.jsx)(`div`,{className:W(`pointer-events-none sticky top-0 z-10 flex justify-end gap-element`,t===QB.OVERLAY&&`-mb-8`),"data-zone-chrome-presence":t,children:e})}function tV(e,t,n=!0){let r=(0,Q.useContext)(YB),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 nV=`@container/resource-header`,rV=new Set([K.READ,K.LIST,K.SEARCH,K.COUNT,K.DELETE,K.DELETE_MANY]);function iV(e,t){if(e.resourceType!==t.resourceType||e.isBulkOperation)return!1;let n=bl(e.operation??{operationIdentifier:e.operationIdentifier});return n!==void 0&&rV.has(n)?!1:oV(e,t)}function aV(e,t){return e.resourceType!==t.resourceType||e.isBulkOperation||e.relaysRowDeletion||bl(e.operation??{operationIdentifier:e.operationIdentifier})!==K.READ?!1:oV(e,t)}function oV(e,t){let n=e.contextResourceIdentifiers?.[t.resourceType];if(n==null)return!1;let r=String(En.getResourceId(n));return t.shownRowIds.some(e=>e!=null&&e!==``&&e===r)}function sV(e){let{on:t}=qo(),[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(xc.RESOURCE_OPERATION_EXECUTED,()=>r({at:Date.now(),madeElsewhere:!1}),e=>iV(e,{resourceType:a,shownRowIds:i.current})),n=t(xc.RESOURCE_REFRESH,()=>r({at:Date.now(),madeElsewhere:!0}),e=>aV(e,{resourceType:a,shownRowIds:i.current}));return()=>{e(),n()}},[o,t,a]),n}function cV({className:e,actions:t,bar:n}){return(0,$.jsxs)(`div`,{className:W(e||`flex-1`,nV,`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)(GB,{})}),t&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(YS,{children:t})})]})]})}var lV=({resourceContext:e,navigationZone:t,navigationInitiator:n,title:r,description:i,className:a,actions:o,parentReferenceConfig:s,heldRecord:c})=>{let l=qk(),u=iC(),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}=J({component:U.RESOURCES_LAYOUTS_HEADER,resource:p}),S=lp(),{registry:C,doOperation:w}=pm(),{renderIcon:T}=kf();String(m.operationIdentifier);let E=En.getPrimaryResourceIdentifier(f),D=(0,Q.useMemo)(()=>C.resourceConfigurations[p],[C,p]),O=d?.resourceConfig??D,k=V.frontendResourceLabelDefinitionOf(O),A=bl(m),j=jo(m),N=A===K.READ?O?.frontendConfiguration?.layout?.header:void 0,P=!!k&&!!E&&j,F=(!!k||!!N)&&!!E&&j,I=!!O,[L,ee]=(0,Q.useState)(void 0),[R,z]=(0,Q.useState)(!1),te=c!==void 0,ne=c?c.record:L,re=c?c.record===void 0&&!c.failed:R,[ie,ae]=(0,Q.useState)(null),oe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),se=(0,Q.useMemo)(()=>V.buildContextualParameters(h,C),[oe,C]),ce=d?.contextualParameters??se,le=(0,Q.useMemo)(()=>Object.entries(ce).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[ce]),ue=(0,Q.useMemo)(()=>JSON.stringify(f.parentResourcesRequirements??null),[f.parentResourcesRequirements]),de=(0,Q.useMemo)(()=>m.operationIdentifier===K.READ?m:d?.resolvePreferredOperation(K.READ,{requireAddressable:!0})??kz(p,C,{hasResourceId:!!E,contextResourceIdentifiers:h,contextualParameters:ce}),[m,d,p,C,E,h,ce]),fe=(0,Q.useMemo)(()=>V.tryBuildForeignKeyReadOperationPath(p,C,de),[p,C,de]),pe=Xy(lg({resourceType:p,operation:de?de.operationIdentifier??K.READ:K.READ,discriminator:E??void 0})),me=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{me.current=w},[w]);let he=sV({resourceType:p,rowIds:[E?String(E):null,L&&(typeof L._id==`string`||typeof L._id==`number`)?String(L._id):null],enabled:!te&&F&&!!E}),ge=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(te||!F||!O||!fe)return;let e=!1,t=`${fe}|${oe}|${le}|${ue}`,n=ge.current===t;return ge.current=t,(async()=>{n||(z(!0),ee(void 0)),ae(null);try{let t=await me.current(fe,{contextualParameters:ce,parentResourcesRequirements:f.parentResourcesRequirements});if(e)return;t&&typeof t==`object`&&!Array.isArray(t)&&ee(t)}catch(t){if(e)return;let r=M(t);il.getLogger().error(`[ResourceLayoutPreset_Header_Default] Error fetching resource label:`,{resourceType:p,operationPathKey:fe,...r,error:t}),ae({...r,message:S(t)}),n||ee(void 0)}finally{e||z(!1)}})(),()=>{e=!0}},[te,F,fe,oe,le,ue,I,p,he?.at]);let _e=(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]),ve=So(m.operationIdentifier,O?.operations),ye=(0,Q.useMemo)(()=>r||_(p,ve,`title`),[r,_,p,ve]),B=A===K.LIST||A===K.SEARCH,be=fne(m),xe=!be&&P?_e:null,Se=(0,Q.useMemo)(()=>i||xe||(B?Up({tResourceHeader:g,resourceType:p})??null:null),[i,xe,B,g,p]),Ce=(0,Q.useMemo)(()=>P&&be?re||pe.isInitialLoad?null:_e||(E?`#${E}`:null):null,[P,be,re,pe.isInitialLoad,_e,E]),we=m.operationFrontendConfig?.headerIconPlacement,Te=(0,Q.useMemo)(()=>we===ct.TEMPLATE_OWNED?null:T({category:Qt.RESOURCES,resourceType:p},{size:Jn.MD}),[T,p,we]),Ee=!!Ce,De=l&&!Ee,Oe=P&&be&&!Ee&&(re||pe.isInitialLoad),ke=(0,Q.useMemo)(()=>V.resolveRowSchema(O,ne),[O,ne]),Ae=(0,Q.useMemo)(()=>({resourceContext:{resourceType:p,operationId:K.READ}}),[p]),[je,Me]=(0,Q.useState)(null),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{if(!Fe||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&Re(t.isIntersecting)});if(typeof e?.observe==`function`)return e.observe(Fe),()=>e.disconnect?.()},[Fe]);let ze=ZB(t)&&!l,Be=tV(t,!l&&(x||Oe),Le),Ve=(0,Q.useMemo)(()=>{if(l||Xo.resolve(U.RESOURCES_LAYOUTS_BREADCRUMB,G.DEFAULT)!==PB)return s;let e=NB({parentResourcesRequirements:f.parentResourcesRequirements,contextResourceIdentifiers:f.contextResourceIdentifiers});if(s)return e.some(e=>e.resourceType===s.parentResourceType&&e.resourceId===s.parentResourceId)?{...s,displayMode:Rt.NONE}:s;let t=e[e.length-1];return t?{parentResourceType:t.resourceType,parentResourceId:t.resourceId,displayMode:Rt.NONE}:void 0},[s,l,f.parentResourcesRequirements,f.contextResourceIdentifiers]),He=(0,Q.useRef)({titleMounted:!1}).current,Ue=(0,Q.useMemo)(()=>({resourceType:p,title:Ee?Ce:l&&Oe?null:ye,titlePending:Oe&&(l||!ye),titleMountTracker:He,hostProvidesHeading:l,titleTarget:je,leadingTarget:Ne}),[p,Ee,Ce,ye,He,l,Oe,je,Ne]);(0,Q.useEffect)(()=>{});let We=(0,$.jsxs)(`div`,{ref:Ie,className:W(`flex min-w-0 items-center gap-element pb-item-sm`,ze?`min-h-8`:`empty:hidden`),"data-slot":`resource-header-bar`,children:[(0,$.jsx)(CB,{host:xB.SURFACE,navigationZone:t}),!l&&(0,$.jsx)(IB,{resourceContext:f,navigationZone:t,navigationInitiator:n}),Be&&(0,$.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-element`,children:Be})]});if(!x)return Oe?(0,$.jsx)(cV,{className:a,actions:o,bar:We}):o?(0,$.jsx)(`div`,{className:W(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(YS,{children:o})}):null;if(De)return Oe?(0,$.jsx)(cV,{className:a,actions:o}):o?(0,$.jsx)(`div`,{className:W(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(YS,{children:o})}):null;let Ge=!!N&&!!ke;return(0,$.jsxs)(`div`,{className:W(a||`flex-1`,nV,`flex min-w-0 flex-col`),"data-slot":`resource-header`,children:[We,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,"data-slot":`resource-header-title-line`,children:[Te&&(0,$.jsx)(`div`,{className:`shrink-0`,children:Te}),Ge&&(0,$.jsx)(`span`,{ref:Pe,className:`flex shrink-0 items-center gap-field empty:hidden`,"data-slot":`resource-header-leading`}),Ge?(0,$.jsx)(`div`,{ref:Me,className:`flex min-w-0 flex-1 basis-60 items-center`,"data-slot":`resource-header-title`}):(0,$.jsx)(WB,{title:(Ee?Ce:ye)??``,hostProvidesHeading:l,className:`flex-1 basis-60`}),o&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(YS,{children:o})})]}),Ge&&(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)(HB,{value:Ue,children:(0,$.jsx)(BB,{schema:ke,data:ne,labels:Ae,resourceType:p,resourceId:E?String(E):void 0,contextualParameters:ce,contextResourceIdentifiers:h,parentResourcesRequirements:f.parentResourcesRequirements,navigationZone:t,parentReferenceConfig:Ve,disableInlineEdit:!0,layoutTemplate:N,defaultDisplayChromeMode:qc.INLINE,isLoading:!ne})})}),!Ee&&Se&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:Se}),ie&&(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:ie.message,children:[T(H.WARNING,{size:Jn.XS}),(0,$.jsx)(`span`,{children:ie.message})]})]})};function uV({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_HEADER,`ResourceLayout_Header`)(e);return(0,$.jsx)(n,{...t})}function dV({onSuccess:e,errorMessage:t,errorComponent:n}){let{resourceContext:r,resourceType:i,operation:a,reportError:o,goBackWithinZone:s,navigateToPreferredRead:c,executeCurrentOperation:l}=rC(),{doOperation:u,registry:d}=pm(),{tComponent:f}=J({component:U.RESOURCES_LAYOUTS_ACTION,resource:i}),p=(0,Q.useRef)(u);p.current=u;let[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b=(0,Q.useMemo)(()=>rl(a),[a]),x=b&&Rn(Ja(a,d.resourceConfigurations[i]?.operations)),S=(0,Q.useMemo)(()=>JSON.stringify({contextResourceIdentifiers:V.buildContextResourceIdentifiersKey(r.contextResourceIdentifiers??{}),parentResourcesRequirements:r.parentResourcesRequirements??[]}),[r.contextResourceIdentifiers,r.parentResourcesRequirements]),C=(0,Q.useMemo)(()=>{let e=r.contextResourceIdentifiers?.[i];return e?En.getResourceId(e)??null:null},[r.contextResourceIdentifiers,i])??(v?.contextKey===S&&typeof v.row._id==`string`&&v.row._id.length>0?v.row._id:null),w=(0,Q.useMemo)(()=>!C||r.contextResourceIdentifiers?.[i]?r.contextResourceIdentifiers:{...r.contextResourceIdentifiers,[i]:C},[r.contextResourceIdentifiers,C,i]),T=(0,Q.useMemo)(()=>V.buildContextualParameters(w,d),[w,d]),E=a?.variantKey,D=a?.admitsCrossTenantPlatformAdministration===!0,O=(0,Q.useMemo)(()=>({variantKey:E,admitsCrossTenantPlatformAdministration:D}),[D,E]),k=(0,Q.useMemo)(()=>Az(i,d,{hasResourceId:!!C,contextResourceIdentifiers:w,contextualParameters:T,actingOperation:O}),[w,T,C,O,d,i]),{rmm:A}=Bz({resourceType:i,resourceId:C,doOperationRef:p,contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,contextResourceIdentifiers:w,resourceSchema:d.resourceConfigurations[i]?.mainSchema,resourceInheritance:d.resourceConfigurations[i]?.inheritenceSchemaDefinition,enabled:b&&!!C,conflictPolicy:{strategy:mE.ACCEPT_REMOTE},directFallbackAccepted:x,actingOperation:O}),j=(0,Q.useMemo)(()=>bp({tComponent:f,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),[f]),M=iz((0,Q.useMemo)(()=>w===r.contextResourceIdentifiers?r:{...r,contextResourceIdentifiers:w},[w,r]),a),N=(0,Q.useContext)(uh),P=(0,Q.useRef)(N);P.current=N;let F=(0,Q.useCallback)((t,n)=>{ue(t)&&P.current?.notifyInfo(bp({tComponent:f,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`operationSentForApproval`})),M(t),n&&!ue(t)?(e?.(t),c({contextResourceIdentifiers:n})):e?e(t):s()},[M,s,c,e,f]),I=(0,Q.useCallback)(e=>F(e,b&&!ue(e)?tz({resourceType:i,contextResourceIdentifiers:w,rowValues:e,registry:d}):void 0),[w,b,d,i,F]),L=(0,Q.useCallback)(e=>{o(e,t,n)},[n,t,o]);return(0,Q.useEffect)(()=>{if(!b||C||!k)return;let e=!1;return _(!0),Mz({doOperation:p.current,readOperationPathKey:k,contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements}).then(t=>{e||y({contextKey:S,row:t})}).catch(t=>{e||L(t instanceof Error?t:Error(String(t)))}).finally(()=>{e||_(!1)}),()=>{e=!0}},[S,k,T,r.parentResourcesRequirements,C,L,b]),(0,Q.useEffect)(()=>{if(A&&v&&v.contextKey===S&&(typeof A.getSnapshot!=`function`||A.getSnapshot().confirmedData===null)&&typeof A.setInitialState==`function`){let e=v.row;A.setInitialState(e,e._version??0,e._field_meta)}},[S,v,A]),{execute:(0,Q.useCallback)(async e=>{h(!0);try{let t,n=b?tz({resourceType:i,contextResourceIdentifiers:w,rowValues:nz(e,rz(a)),registry:d}):void 0;if(b&&(A||!x)){if(!A)throw new Qn({surfaceName:`useOperationDirectExecution`,resourceType:i,operationIdentifier:String(a.operationIdentifier)});let o=await A.queueMutation({},{type:uE.CUSTOM,priority:_E.HIGH,source:{type:dE.CUSTOM,subscriberId:`direct-execution:${String(a.operationIdentifier)}`},transportOverride:{operationPathKey:wi.createOperationPathKeyFromOperation(a),contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{},readBackOnSuccess:n===void 0}});if(!o.success)throw QR(o.error,j);t=o.heldForApproval??o.responseData}else if(b){if(!C)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 p.current(wi.createOperationPathKeyFromOperation(a),{contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{}})}else t=await l(e);F(t,n)}catch(e){L(e instanceof Error?e:Error(j))}finally{h(!1)}},[T,r.parentResourcesRequirements,w,l,L,F,x,b,C,a,i,A,j,d]),isExecuting:m,isBootstrapping:g,completeWithSuccess:I,reportFailure:L}}var fV=il.getLogger(),pV;(function(e){e.FULL=`full`,e.COMPACT=`compact`})(pV||={});function mV({...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}=rC(),p=e.resourceContext?.operation,m=p?wi.createOperationPathKeyFromOperation(p):void 0,h=f?wi.createOperationPathKeyFromOperation(f):void 0;(0,Q.useEffect)(()=>{m&&h&&m!==h&&fV.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}=J({component:U.RESOURCES_LAYOUTS_ACTION,resource:d}),y=(0,Q.useMemo)(()=>[`resources.${d}`,`components.${U.RESOURCES_LAYOUTS_ACTION}`],[d]),[b,x]=(0,Q.useState)(!1),{execute:S,isExecuting:C,isBootstrapping:w,completeWithSuccess:T,reportFailure:E}=dV({onSuccess:r,errorMessage:t,errorComponent:n}),D=(0,Q.useMemo)(()=>_(d,String(f.operationIdentifier),`title`),[f.operationIdentifier,d,_]),O=(0,Q.useMemo)(()=>bp({tComponent:g,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`runningAction`,params:{actionLabel:D}}),[D,g]),k=(0,Q.useCallback)(async()=>{await S()},[S]),A=!Gre(f)&&!Ei(f),j=f.riskLevel===Ac.CRITICAL,M=(0,Q.useMemo)(()=>VS(_,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===pV.COMPACT;return v===!1?null:(0,$.jsx)(eb,{i18nKeys:y,children:(0,$.jsxs)(`div`,{className:I?`space-y-field`:`space-y-section`,children:[!I&&(0,$.jsx)(uV,{resourceContext:c,navigationZone:l,navigationInitiator:u,actions:o}),!I&&s,A?(0,$.jsx)(vB,{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:bp({tComponent:g,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`confirmMessage`})}),(0,$.jsx)(X,{type:`button`,variant:Y.DEFAULT,onClick:N,disabled:C||w,children:C||w?O:D})]}),b&&(0,$.jsx)(Mw,{open:!0,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,requireTypedConfirmation:!0,confirmationPhrase:M})]})})}function hV({resourceContext:e,navigationZone:t,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a}){let o=_V();return(0,$.jsx)(aC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(`div`,{ref:o,className:`contents`,"data-slot":`resource-operation-detached-host`,children:(0,$.jsx)(mV,{resourceContext:e,navigationZone:t,chrome:pV.COMPACT,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a})})})}var gV=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([aria-disabled="true"])`;function _V(){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(gV);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 vV({resourceContext:e,navigationZone:t,onDismiss:n}){let{tComponent:r}=J({component:U.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n()},[n]);return(0,$.jsx)(hV,{resourceContext:e,navigationZone:t,onSuccess:i,onCancel:n,errorMessage:bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionPopoverBody`})}var yV=10,bV=300,xV=2;function SV({schema:e,name:t,value:n,targetResourceType:r}){let{registry:i,doOperation:a}=pm(),{t:o,formatDate:s,formatDateTime:c,tComponent:l,tResourceFieldEdit:u}=J({component:U.RESOURCES_FIELDS_RESOURCE_REFERENCE}),d=lp(),f=FD(),p=iC(),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:En.getAddressedRecordId(p.resourceContext)}:void 0,y=(0,Q.useRef)(v);y.current=v;let b=Kt(e)===B.ARRAY,x=b&&ds(e)||e,S=(0,Q.useMemo)(()=>Aj({explicitResourceType:r,schema:Pe(e)?e:x,fieldName:t,registry:i}),[x,t,i,e,r]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(new Map),[I,L]=(0,Q.useState)(null),ee=(0,Q.useMemo)(()=>Pw(n),[n]),R=(0,Q.useMemo)(()=>S?Kl(i.resourceConfigurations?.[S]?.operations??[],K.READ)??null:null,[i,S]),z=(0,Q.useCallback)(async e=>{if(S){O(!0),L(null);try{let t=V.buildForeignKeySearchOperationPath(S,i),n=V.buildForeignKeySearchParams(e,yV,{resourceType:S,registry:i}),r=En.withoutSelfReferencingParents(_.current,S,i),a=Nw({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($ue({items:u,resourceType:S,registry:i,t:o,formatDate:s,formatDateTime:c}))}catch(t){let n=M(t);il.getLogger().error(`[useResourceSearch] Failed to fetch options:`,{resourceType:S,query:e,...n,error:t}),L({...n,message:d(t)}),E([])}finally{O(!1)}}},[S,i,o,s,c]),te=(0,Q.useRef)(P);te.current=P;let ne=(0,Q.useCallback)(async()=>{if(!S||ee.length===0)return;let e=ee.filter(e=>!te.current.has(e));if(e.length===0)return;A(!0);let t=new Map(te.current);for(let n of e)try{let{label:e}=await Iw({resourceType:S,id:n,registry:i,doOperation:g.current,contextualParameters:Bm({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),A(!1)},[S,ee,i,R,o,s,c]);(0,Q.useEffect)(()=>{ne()},[ne]),(0,Q.useEffect)(()=>{if(C)return h.current&&clearTimeout(h.current),j.length>=xV?h.current=setTimeout(()=>{z(j)},bV):j.length===0&&z(),()=>{h.current&&clearTimeout(h.current)}},[j,C,z]);let re=(0,Q.useCallback)(e=>{N(e)},[]),ie=(0,Q.useCallback)(e=>{w(e),e?L(null):N(``)},[]),ae=(0,Q.useCallback)(e=>P.get(e)||e,[P]),oe=(0,Q.useMemo)(()=>j.length>0&&j.length<xV?l(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,`minSearchChars`,{count:String(xV)}):l(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,`noResults`),[j,l]),se=f?.resourceType;return{options:T,isLoading:D,isLoadingCurrentValue:k,isOpen:C,setIsOpen:ie,handleSearchChange:re,getDisplayLabel:ae,resourceType:S,isMultiple:b,normalizedValue:ee,emptyMessage:oe,defaultPlaceholder:(0,Q.useMemo)(()=>{if(!b&&se){let e=u(se,mr.labelDictionaryPath(t),`label`);if(e)return bp({tComponent:l,componentType:U.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`selectReferencePlaceholder`,params:{target:e}})}return l(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,`selectPlaceholder`)},[se,b,t,l,u]),fetchError:I}}var CV=rc(U.LOW_LEVEL_COMMAND,`Command`,[`Dialog`,`Input`,`List`,`Empty`,`Group`,`Item`,`Shortcut`,`Separator`]);function wV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n,{...t})}function TV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Dialog,{...t})}function EV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Input,{...t})}function DV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.List,{...t})}function OV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Empty,{...t})}function kV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Group,{...t})}function AV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Item,{...t})}function jV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Shortcut,{...t})}function MV({preset:e=G.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Separator,{...t})}var NV=7;function PV({resourceContext:e,navigationZone:t,currentValue:n,onDismiss:r}){return(0,$.jsx)(aC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(FV,{currentValue:n,onDismiss:r})})}function FV({currentValue:e,onDismiss:t}){let{operation:n,resourceType:r}=rC(),{tComponent:i}=J({component:U.RESOURCES_LAYOUTS_ACTION,resource:r}),a=(0,Q.useMemo)(()=>$s(n),[n]),{execute:o,isExecuting:s,isBootstrapping:c}=dV({onSuccess:t,errorMessage:bp({tComponent:i,componentType:U.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===Da.REFERENCE?(0,$.jsx)(LV,{choice:a,currentValue:e,busy:u,onPick:l}):(0,$.jsx)(IV,{choice:a,currentValue:e,busy:u,onPick:l})}function IV({choice:e,currentValue:t,busy:n,onPick:r}){let{resourceType:i,operation:a}=rC(),{tComponent:o,isReady:s}=J({component:U.LOW_LEVEL_FORM_FIELD}),{enumLabels:c,isReady:l}=tE(a.requestDto,{resourceType:i,operationId:String(a.operationIdentifier)},void 0,`edit`),u=(0,Q.useMemo)(()=>Hs(e.fieldSchema)??[],[e.fieldSchema]),d=c[e.fieldName],f=u.length>NV;return s===!1||l===!1?(0,$.jsx)(RV,{}):(0,$.jsxs)(wV,{shouldFilter:f,children:[f&&(0,$.jsx)(EV,{placeholder:o(U.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`)}),(0,$.jsxs)(DV,{children:[(0,$.jsx)(OV,{children:o(U.LOW_LEVEL_FORM_FIELD,`noResults`)}),(0,$.jsx)(kV,{children:u.map(e=>{let i=d?.[e]??e;return(0,$.jsx)(zV,{value:e,label:i,isCurrent:e===t,disabled:n,onPick:r},e)})})]})]})}function LV({choice:e,currentValue:t,busy:n,onPick:r}){let{tComponent:i,isReady:a}=J({component:U.LOW_LEVEL_FORM_FIELD}),{options:o,isLoading:s,setIsOpen:c,handleSearchChange:l,emptyMessage:u,fetchError:d}=SV({schema:e.fieldSchema,name:e.fieldName,value:t});return(0,Q.useEffect)(()=>(c(!0),()=>c(!1)),[]),a===!1?(0,$.jsx)(RV,{}):(0,$.jsxs)(wV,{shouldFilter:!1,children:[(0,$.jsx)(EV,{placeholder:i(U.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),onValueChange:l,autoFocus:!0}),(0,$.jsxs)(DV,{children:[(0,$.jsx)(OV,{children:s?(0,$.jsx)(RV,{}):d?.message??u}),(0,$.jsx)(kV,{children:o.map(e=>(0,$.jsx)(zV,{value:e.value,label:e.label,isCurrent:e.value===t,disabled:n||e.disabled===!0,onPick:r},e.value))})]})]})}function RV(){return(0,$.jsx)(`span`,{className:`flex justify-center py-element`,children:(0,$.jsx)(Zy,{size:16})})}function zV({value:e,label:t,isCurrent:n,disabled:r,onPick:i}){let{renderIcon:a}=kf();return(0,$.jsxs)(AV,{value:e,keywords:[t],disabled:r,onSelect:()=>i(e),"aria-current":n?`true`:void 0,"data-choice-value":e,children:[a(H.CHECK,{size:Jn.SM,className:W(`me-2 shrink-0`,n?`opacity-100`:`opacity-0`)}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})}function BV(e){return e}function VV(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(En.getResourceId(t[e]).length>0)return!0;let r=n[e];return r!==void 0&&String(r).length>0}))})}var HV={[K.UPDATE]:10,[K.CREATE]:20,[K.DELETE]:90,[K.DELETE_MANY]:90,[K.UPDATE_MANY]:10},UV=50,WV=0;function GV(e){let t=e.generatedOperation?.export;if(t?.formats?.length&&t.rowScopes?.length)return t}function KV(e){if(!e)return;let{page:t,limit:n,...r}=e;return r}function qV(e){let t=e.rowScope===De.FULL_RESULT_SET?`all rows`:`this page`;return`${e.format.toUpperCase()} — ${t}`}function JV(e){let t=e.generatedOperation?.kind===Pu.GENERATED_FILE_REGENERATE?e.generatedOperation:void 0,n=typeof t?.fieldName==`string`?t.fieldName:typeof e.operationIdentifier==`string`?Xl.parseGeneratedFileRegenerateOperationIdentifier(e.operationIdentifier)?.fieldName:void 0;return n&&n.length>0?n:void 0}function YV(e){switch(e){case Ac.CRITICAL:case Ac.HIGH:return Y.DESTRUCTIVE;default:return Y.GHOST}}function XV(e){return e?{unavailability:e}:{}}var ZV={[K.READ]:`viewDetails`,[K.UPDATE]:`edit`,[K.DELETE]:`delete`},QV=[];function $V(e,t){let n=e?.[gu.ORGANIZATIONS],r=n?En.getResourceId(n):``;return r.length>0?r:t??null}function eH(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}=pm(),{permissions:T}=ag(),D=Qp(),{navigateToResource:O}=SS(),{tComponent:k,tResourceOperation:A,tResourceFieldDisplay:j,isReady:M}=J({component:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,resource:t}),N=lp(),{renderIcon:P}=kf(),F=Ix(),{emit:I,on:L}=qo(),ee=(0,Q.useContext)(dm)?.isConnected??!1,R=(0,Q.useContext)(ea),z=(0,Q.useRef)(R);z.current=R;let te=(0,Q.useRef)(x);te.current=x;let ne=(0,Q.useContext)(uh),re=(0,Q.useRef)(ne);re.current=ne;let ie=(0,Q.useRef)(w),ae=(0,Q.useRef)(I),oe=(0,Q.useRef)(ee);ie.current=w,ae.current=I,oe.current=ee;let[se,ce]=(0,Q.useState)({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null}),[le,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(new Set),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(()=>new Set),[_e,ve]=(0,Q.useState)(null),[ye,B]=(0,Q.useState)(null),be=(0,Q.useRef)(null),xe=(0,Q.useMemo)(()=>C.resourceConfigurations[t],[C,t]),Se=n===Be.DETAIL&&Mie({resourceRelationships:xe?.resourceRelationships,currentObject:r,contextResourceIdentifiers:a}),Ce=(0,Q.useMemo)(()=>nn(n,xe?.frontendConfiguration?.layout?.actionDisclosure),[n,xe]),we=JSON.stringify(a??{}),Te=(0,Q.useMemo)(()=>a,[we]),Ee=JSON.stringify(o??[]),Oe=(0,Q.useMemo)(()=>o??[],[Ee]),ke=r?._id??(xe?.resourceFieldIdentifier?r?.[xe.resourceFieldIdentifier]:void 0),Ae=typeof ke==`string`&&ke.length>0?ke:void 0,je=(0,Q.useMemo)(()=>{if(!Ae)return Te;let e=Te[t];if(En.getResourceId(e)===Ae)return Te;let n=e?En.getFieldIdentifier(e):void 0;return{...Te,[t]:n?{fieldIdentifier:n,resourceId:Ae}:Ae}},[Te,Ae,t]),Me=JSON.stringify(l??[]),Pe=(0,Q.useMemo)(()=>l??[],[Me]),Fe=$V(Te,D?.currentOrganizationId),Ie=T?.appLevel??QV,Le=Fe?T?.organizations?.[Fe]??QV:QV,Re=Ie.join(`,`),ze=Le.join(`,`),Ve=(0,Q.useMemo)(()=>Ie,[Re]),He=sg(),Ue=(0,Q.useMemo)(()=>Le,[ze]),We=T?.accessProfile??null,Ge=(0,Q.useMemo)(()=>({applicationRoles:[...Ve],organizationRoles:[...Ue],roleTables:He,organizationId:Fe??null,accessProfile:We}),[Ve,Ue,He,Fe,We]),Ke=mS(),qe=(0,Q.useMemo)(()=>(xe?.operations??[]).filter(e=>!hS(e.operationFrontendConfig?.runtimeAvailability,Ke)).map(e=>wi.createOperationPathKeyFromOperation(e)).sort().join(`
11
- `),[xe,Ke]),Je=(0,Q.useMemo)(()=>new Set(qe?qe.split(`
12
- `):[]),[qe]),Ye=x?.isSearchActive,Xe=x?.listingVariantKeys!==void 0,Ze=x?.listingVariantKeys?.list,Qe=x?.listingVariantKeys?.search,$e=(0,Q.useMemo)(()=>Xe?{list:Ze,search:Qe}:void 0,[Xe,Ze,Qe]),et=(0,Q.useMemo)(()=>{let e=(xe?.operations??[]).filter(e=>fo(e)),t=e.some(e=>e.generatedOperation?.kind===Pu.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===K.SEARCH),n=e.some(e=>e.generatedOperation?.kind===Pu.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation!==K.SEARCH);return t&&n},[xe]),tt=(0,Q.useMemo)(()=>{if(!xe)return[];let e=xe.operations||[],n=new Set(Pe);return e.filter(e=>{let r=String(e.operationIdentifier),i=e.isBulkOperation??!1;if(n.has(r)||e.operationFrontendConfig?.actionVisibility===Gl.HIDDEN||Je.has(wi.createOperationPathKeyFromOperation(e))||ld(e.operationFrontendConfig)&&!fo(e))return!1;let a=Va(e,{addressesTheContextSingletonRecord:Se});if(p){if(!a||i)return!1}else if(a)return!1;if(!Hn(e,$e)||Ye!==void 0&&et&&fo(e)&&(e.generatedOperation?.kind===Pu.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===K.SEARCH)!==Ye||u&&!i||!u&&(i||nae(e)))return!1;let o=e.variantType;return!(o&&o!==E.API_CALL||!Gm({...e,resourceType:t,resourcePrimaryScope:xe?.resourcePrimaryScope},Ge))})},[xe,t,Pe,Je,u,p,Ge,Ye,$e,et,Se]),nt=BS(tt,{currentObject:r,resourceType:t,selectionObjects:d,...i?{subjectDataMode:i}:{},...Fe?{organizationId:Fe}:{}}),rt=(0,Q.useMemo)(()=>V.buildContextualParameters(je,C),[je,C]),it=(0,Q.useMemo)(()=>!!En.getResourceId(je[t]),[je,t]),at=v??Wc(_),ot=(0,Q.useCallback)(e=>xe?e.isBulkOperation===!0?VV(e,je,rt):!Pm({operation:e,resourceType:t,resourceConfig:xe})||Uh({resourceConfig:xe,operation:e,registry:C,hasResourceId:it,contextResourceIdentifiers:je,contextualParameters:rt}):!0,[je,rt,it,C,xe,t]),st=(0,Q.useCallback)(e=>{let n=String(e.operationIdentifier);if(fo(e)){let t=GV(e),n=t?Et(t):[],r=bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`collectionExport`});return n.length===1?`${r} ${n[0].format.toUpperCase()}`:r}if(Ei(e)){let n=JV(e);return bp(n?{tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerateNamed`,params:{field:j(t,n,`label`)}}:{tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerate`})}let r=ZV[n];return r?bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:r}):VS(A,t,n)},[k,A,j,t]),ct=(0,Q.useCallback)(e=>P({category:Qt.OPERATION_RESOURCES,resourceType:t,operationReference:String(e.operationIdentifier)},{size:Jn.SM}),[P,t]),lt=(0,Q.useCallback)(e=>{let t=e.operationFrontendConfig;return t?.displayPriority===void 0?HV[bl(e)??String(e.operationIdentifier)]??UV:t.displayPriority},[]),ut=(0,Q.useCallback)(e=>he.has(wi.createOperationPathKeyFromOperation(e)),[he]),dt=(0,Q.useCallback)(()=>g?.matchedCount??d?.length??h?.length??0,[g,h,d]),ft=(0,Q.useRef)(dt);ft.current=dt,(0,Q.useEffect)(()=>{if(at)return L(xc.RESOURCE_OPERATION_EXECUTED,e=>{let t=Pi(e.resultSummary);t&&me({jobId:t.jobId,attemptedCount:ft.current()})},e=>e.resourceType===t&&e.isBulkOperation===!0&&e.optionalDiscriminator===at)},[L,t,at]);let pt=(0,Q.useCallback)(e=>g?li(e):St(e),[g]),mt=(0,Q.useCallback)(e=>e.isBulkOperation===!0&&dt()>pt(e),[dt,pt]),ht=(0,Q.useCallback)((e,n)=>{if(mt(e))return{reason:bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`bulkSelectionTooLarge`,params:{maxSelection:pt(e),selectedCount:dt()}})};if(n.isEnabled||n.featureAvailability&&!n.featureAvailability.isAvailable)return;let r=String(e.operationIdentifier),i=lm(A,t,r),a=n.ineligibleSelectionIndices;if(e.isBulkOperation===!0&&a&&a.length>0&&d?.length){let e=bp({tComponent:k,componentType:U.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:bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`keepEligibleOnly`,params:{eligibleCount:n.length}}),onSelect:()=>f(n)}}:{}}}return{reason:i??bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForItem`})}},[mt,pt,dt,f,t,h,d,k,A]),gt=(0,Q.useCallback)(e=>{let t=PS(e);return nt.has(t)?nt.get(t):e.enabledCondition||e.requiredFeatures?{isEnabled:!1}:{isEnabled:!0}},[nt]),_t=(0,Q.useCallback)(e=>gt(e).isEnabled,[gt]),vt=(0,Q.useCallback)(e=>En.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:e,contextResourceIdentifiers:je,additionalContext:{...e.isBulkOperation===!0&&g?{[Ete]:{...g.filters?{filters:g.filters}:{},...g.search?{search:g.search}:{},...g.listing?{listing:g.listing}:{},matchedCount:g.matchedCount}}:e.isBulkOperation===!0&&h?.length?{[sn]:h}:{},...at?{[gte]:at}:{}},parentResourcesRequirements:Oe,isOperationDefault:e.isOperationDefault??!0}),[t,je,Oe,h,g,at]),yt=(0,Q.useCallback)(e=>{if(!xe)return;let t=vt(e),n=V.flattenContextIdentifiers(je),r=Um.resolveResourceUrl(xe,e,n,C.allResourceFieldIdentifiers,Oe)?.resolvedUrl;O(t,Um.createOperationInitiator(s,c),r)},[xe,vt,je,Oe,C,O,s,c]),bt=(0,Q.useCallback)(async(e,n)=>{let r=GV(e),i=z.current?.httpClient;if(!r||!i){re.current?.notifyError?.(k(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnavailable`));return}let o=te.current,s=e.resourceOperationLike===K.SEARCH;if(o?.isSearchActive&&!s){re.current?.notifyError?.(k(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportClearSearch`));return}let{format:c,rowScope:l}=n,u=Due({registry:C,resourceConfig:xe,exportOperation:e,resourceType:t,contextResourceIdentifiers:Vu(a),contextualParameters:rt,parentResourcesRequirements:Oe,apiBaseUrl:bi.getApiUrl(),format:c,rowScope:l,listingQuery:l===De.FULL_RESULT_SET?KV(o?.params):o?.params});if(!u)re.current?.notifyError?.(k(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnaddressable`));else try{await Oue({url:u,resourceType:t,format:c,getBlob:e=>i.fetchFileBlob(e)})}catch(e){re.current?.notifyError?.(N(e,k(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportFailed`)))}},[C,xe,t,a,rt,Oe,k,N]),xt=(0,Q.useCallback)(async e=>{if(!xe)return;let n=wi.createOperationPathKeyFromOperation(e);if(!fe.current.has(n)){fe.current.add(n),ge(new Set(fe.current)),de(!0);try{let n=wi.createOperationPathKeyFromOperation(e),r=e.isBulkOperation??!1,i=e.operationFrontendConfig?.rowTargetRequestField,a=i?En.getResourceId(je[t]):``,o=r&&g?rr(g):r&&h?.length?jl(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 ie.current(n,{contextualParameters:rt,parentResourcesRequirements:Oe,...o?{requestData:o}:{}},{silent:!0});if(ue(c)){re.current?.notifyInfo(bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationSentForApproval`}));return}let l=Pi(c);l&&re.current?.notifyInfo(bp({tComponent:k,componentType:U.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&&re.current?.notifySuccess(u);let d=()=>{let n=Ei(e),r=Ne({contextResourceIdentifiers:je,resourceType:t,result:c,isBulkOperation:e.isBulkOperation===!0}),i=V.buildContextualParameters(r,C),a=Xu(c);if(!$i(e,oe.current)&&Su(e)){let a=Xv({resourceType:t,registry:C,callContext:je,...e.isBulkOperation===!0?{}:{previousRow:s,row:c}}),o=Jv({resourceType:t,registry:C,scopes:a}),l=o.length>0?o:[null];for(let e of l){let n=e??{operationIdentifier:K.LIST};ae.current(xc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??K.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:Oe,...at?{optionalDiscriminator:at}:{}})}if(n){let e=Za(xe.operations??[],K.READ,{requireAddressable:!0}).filter(e=>Uh({resourceConfig:xe,operation:e,registry:C,hasResourceId:En.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:K.READ},i=[En.getResourceId(r[t]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);a.has(i)||(a.add(i),ae.current(xc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??K.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:Oe,...at?{optionalDiscriminator:at}:{}}))}}}ae.current(xc.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:Oe,resultSummary:a,...at?{optionalDiscriminator:at}:{}}),b?.(e)};if(c&&typeof c==`object`){let t=US(e.responseDto,c);if(t.length>0){B(t),be.current=d;return}}d()}catch(n){console.error(`[useResourceOperationActions] Operation ${String(e.operationIdentifier)} failed:`,n);let r=n&&typeof n==`object`?n:{};ae.current(xc.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:Vu(je),parentResourcesRequirements:Oe,additionalContext:{error:r.message??Vc(n),errorCustomMessageReference:r.customMessageReference,errorHttpStatus:r.httpStatus,errorRefusalCode:cz(n).errorRefusalCode,...lz(n)}})}finally{de(!1),fe.current.delete(n),ge(new Set(fe.current))}}},[xe,t,C,rt,je,Oe,h,at,b]),Ct=(0,Q.useCallback)(e=>{if(fo(e)){let t=GV(e),n=t?Et(t):[];n.length>0&&bt(e,n[0]);return}let n=String(e.operationIdentifier),r=e.riskLevel,i=Qc(e);if(i===Fr.INLINE&&F.isAvailable){let n=En.getResourceId(je[t]);if(n){F.open({kind:Nx.ELEMENT,elementId:n,operation:e,resourceContext:vt(e)});return}}if(i===Fr.POPOVER||i===Fr.DROPDOWN)ve(wi.createOperationPathKeyFromOperation(e));else if(Ut(i)||i===Fr.INLINE)yt(e);else if(cs(r)){let t=n===K.DELETE?bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmDelete`}):st(e),i=r===Ac.CRITICAL,a=e.isBulkOperation===!0?dt():0,o=[a>0?bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmAppliesToSelection`,params:{count:a}}):void 0,Mi(e)?bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmCannotBeUndone`}):void 0].filter(e=>!!e);ce({open:!0,label:t,requiresTypedConfirmation:i,confirmationPhrase:i?st(e):``,description:o.length>0?o.join(` `):null,confirmLabel:st(e),callback:()=>xt(e)})}else xt(e)},[yt,xt,k,st,d,h]),wt=(0,Q.useCallback)(e=>{let t=Qc(e);t===Fr.POPOVER||t===Fr.DROPDOWN?yt(e):Ct(e)},[yt,Ct]),Tt=(0,Q.useCallback)(async()=>{se.callback&&await se.callback(),ce({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[se.callback]),Dt=(0,Q.useCallback)(()=>{ce({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[]),Ot=(0,Q.useCallback)(()=>{B(null);let e=be.current;be.current=null,e?.()},[]),kt=(0,Q.useCallback)(e=>{let n=Qc(e);if(!(n===Fr.POPOVER||n===Fr.DROPDOWN||n===Fr.INLINE&&!F.isAvailable)||!xe)return;let r=wi.createOperationPathKeyFromOperation(e),i=()=>ve(null),a=A(t,So(e.operationIdentifier,xe.operations),`title`);if(n===Fr.DROPDOWN){let t=$s(e),n=e.isBulkOperation===!0||!t?void 0:S.current?.[t.rowFieldName];return{open:_e===r,onOpenChange:e=>ve(e?r:null),title:a,chrome:WS.LIST,content:Q.createElement(PV,{resourceContext:vt(e),navigationZone:s,onDismiss:i,...typeof n==`string`?{currentValue:n}:{}})}}return{open:_e===r,onOpenChange:e=>ve(e?r:null),title:a,content:Q.createElement(vV,{resourceContext:vt(e),navigationZone:s,onDismiss:i})}},[xe,t,A,_e,vt,s,F.isAvailable]);return{items:(0,Q.useMemo)(()=>{if(!xe)return[];let e=xe.operations||[],t=new Map;for(let e of tt.filter(ot)){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=>gt(e).isEnabled),t=Ge.organizationRoles.length>0?e.filter(e=>e.admitsCrossTenantPlatformAdministration!==!0):[],i=td(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=gt(a),s=a.operationFrontendConfig?.actionVisibility,c=!(!o.featureAvailability||o.featureAvailability.isAvailable);if((s??(Ce.disabledActionHandling===Zi.HIDE&&!c?Gl.WHEN_AVAILABLE:Gl.ALWAYS))===Gl.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,gt(e)])),u=a.riskLevel,f=a.operationFrontendConfig?.actionVariant??YV(u),p=ct(a),h=st(a),g=lt(a),_=a.operationFrontendConfig?.actionPlacement??(cs(u)&&Mi(a)?dl.DANGER_ZONE:dl.PRIMARY);if(m&&_!==m)continue;let v=!o.isEnabled||mt(a);if(v&&o.featureAvailability&&!o.featureAvailability.isAvailable){let e=o.featureAvailability;switch(e.behavior){case Qs.HIDE:continue;case Qs.DISABLE:break;case Qs.UPGRADE_PROMPT:case Qs.ADDON_PROMPT:case Qs.LIMIT_UPGRADE_PROMPT:case Qs.CONTACT_ADMIN:case Qs.CUSTOM:i.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>Ct(a),disabled:!0,featureLocked:!0,featureAvailability:BV(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:BV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)});continue}}let y=fo(a)?GV(a):void 0;if(y){let e=Et(y);e.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>{bt(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:qV(e),variant:f,riskLevel:u,operationIdentifier:String(a.operationIdentifier),onClick:()=>{bt(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?()=>yt(a):()=>Ct(a),...e?{popover:e}:{},disabled:v,...v?XV(ht(a,o)):{},...ut(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===Qs.HIDE)return[];let n=e.variantKey,r=n?`${h} (${n})`:h,i=e.riskLevel;return[{type:`button`,icon:ct(e),label:r,variant:YV(i),riskLevel:i,operationIdentifier:String(e.operationIdentifier),onClick:()=>wt(e),disabled:!t.isEnabled||mt(e),...!t.isEnabled||mt(e)?XV(ht(e,t)):{},...t.featureAvailability&&!t.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:BV(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?()=>yt(a):()=>Ct(a),...e?{popover:e}:{},disabled:v,...v?XV(ht(a,o)):{},...ut(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier),...o.featureAvailability&&!o.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:BV(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===Be.SUMMARY&&m!==dl.DANGER_ZONE&&!y){let t=xe?ph({resourceConfig:xe,operations:e,coreOperation:K.READ,registry:C,hasResourceId:it,requireFrontendAddressable:!0,contextResourceIdentifiers:je,contextualParameters:rt}):void 0;if(t){let e=bp({tComponent:k,componentType:U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`viewDetails`});r.push({type:`button`,icon:P(H.EYE,{size:Jn.SM}),label:e,variant:Y.GHOST,onClick:()=>yt(t),disabled:!1,_priority:WV,_group:dl.PRIMARY})}}let i=e=>+(e===dl.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===dl.DANGER_ZONE&&o===dl.PRIMARY&&a.push({type:`separator`}),a.push(n),o=t;return a},[xe,je,rt,it,Ge,ot,C,t,tt,nt,n,Ce,y,ct,st,lt,_t,gt,ht,mt,ut,Ct,wt,yt,kt,bt,k,P,d]),isConfirmDialogOpen:se.open,confirmDialogLabel:se.label,confirmDialogDescription:se.description,confirmDialogConfirmLabel:se.confirmLabel,confirmRequiresTypedConfirmation:se.requiresTypedConfirmation,confirmConfirmationPhrase:se.confirmationPhrase,onConfirm:Tt,onCancel:Dt,isExecuting:le,acceptedBackgroundRun:pe,ephemeralFields:ye,onEphemeralAcknowledge:Ot}}function tH(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 nH(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=za.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let d=En.selectMatchingRoutePath(e,s,n.resourceIdentifier,n.resourceFieldIdentifier,l,t.allResourceFieldIdentifiers),f={...c,[n.resourceFieldIdentifier]:o},p=za.buildFileUploadRouteForOperation({operationRouteUrl:d.url,operationParameters:d.parameters,targetResourceType:i,targetResourceFieldIdentifier:n.resourceFieldIdentifier,fieldName:a,requiresTargetResourceId:!0,isFrontend:!0}),m=Um.resolveUrlPath(p.url,f);return Um.hasUnresolvedPlaceholders(m)?null:`${u}${yn}${m}`}catch{return null}}function rH(e,t){return t===Ve.ORIGINAL?e:`${e}${e.includes(`?`)?`&`:`?`}variant=${encodeURIComponent(t)}`}function iH(e){return rH(e,Ve.THUMBNAIL)}function aH(e,t){let n=e.VITE_API_BASE_URL;return n?{...e,VITE_API_BASE_URL:dre(n,t)}:e}function oH(e){return Q.createElement(Ise,{flushSync:DN.flushSync,...e})}cg();var sH=`wildo:reauthentication`,cH=`wildo:reauthentication-callback`,lH;(function(e){e.POPUP_BLOCKED=`popup_blocked`,e.CANCELLED=`cancelled`,e.TIMED_OUT=`timed_out`,e.FAILED=`failed`})(lH||={});var uH=class extends Error{reason;constructor(e){super(`Federated re-authentication did not complete: ${e}`),this.reason=e,this.name=`FederatedReAuthenticationFailure`}},dH=6e5,fH=`wildo-reauthentication`,pH=`popup=yes,width=520,height=680`;function mH(){return window.open(`about:blank`,fH,pH)}function hH(e){let t=new BroadcastChannel(sH);t.postMessage({type:cH,...e}),t.close()}function gH(e,t=dH){return new Promise((n,r)=>{let i=new BroadcastChannel(sH),a=!1,o=t=>{a||(a=!0,i.close(),clearTimeout(l),e?.removeEventListener(`abort`,c),t())},s=()=>o(()=>r(new uH(lH.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 uH(lH.FAILED)))};let l=setTimeout(()=>o(()=>r(new uH(lH.TIMED_OUT))),t);e?.aborted?s():e?.addEventListener(`abort`,c)})}async function _H(e,t,n,r){if(!n)throw new uH(lH.POPUP_BLOCKED);let i=Tc();try{let{authorizationUrl:a}=await i.startFederatedReAuthentication(e,t);n.location.href=a;let o=await gH(r);return await i.exchangeFederatedReAuthentication(o)}catch(e){try{n.close()}catch{}throw e instanceof uH?e:new uH(lH.FAILED)}}var vH=[Us.PASSKEY,Us.TOTP,Us.PASSWORD],yH={[lH.POPUP_BLOCKED]:As.REAUTH_PROVIDER_POPUP_BLOCKED,[lH.CANCELLED]:As.REAUTH_PROVIDER_FAILED,[lH.TIMED_OUT]:As.REAUTH_PROVIDER_TIMED_OUT,[lH.FAILED]:As.REAUTH_PROVIDER_FAILED},bH={[Us.PASSKEY]:As.REAUTH_WITH_PASSKEY,[Us.TOTP]:As.REAUTH_WITH_TOTP,[Us.PASSWORD]:As.REAUTH_WITH_PASSWORD};async function xH(e){try{let{methods:t,identityLinks:n}=await Tc().getReAuthenticationMethods(e),r=new Set(t);return{methods:vH.filter(e=>r.has(e)),identityLinks:n??[]}}catch{return{methods:[...vH],identityLinks:[]}}}function SH(e,t){switch(e){case Us.PASSWORD:return t.password.trim()?{method:e,password:t.password}:null;case Us.TOTP:return/^\d{6,8}$/.test(t.code.trim())?{method:e,code:t.code.trim()}:null;case Us.PASSKEY:return{method:e};default:return null}}function CH(e,t){let n=t.origin===oa.GRANTING_ORGANIZATION,r=t.decisionRequirement?.minimumAssurance;return{methods:e.methods.filter(e=>!n||e!==Us.PASSWORD).filter(e=>{if(r===void 0)return!0;let t=Die(e);return t!==void 0&&Jne(t,r)}),identityLinks:n||t.decisionRequirement?[]:[...e.identityLinks]}}var wH=({open:e,purpose:t,origin:n=oa.ACCOUNT_OR_OPERATION,decisionRequirement:r,onConfirm:i,onCancel:a,failure:o,isLoading:s})=>{let c=lp(),{tComponent:l,isReady:u}=J({component:U.APP_LAYOUTS_SECURITY_SETTINGS}),d=(0,Q.useCallback)(e=>l(U.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 xH(t).then(e=>{if(i)return;let{methods:t,identityLinks:a}=CH(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)(()=>SH(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:mH()});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)(Mw,{open:e,onOpenChange:A,cancelCallback:k,validationCallback:O,label:d(As.REAUTH_TITLE),children:(0,$.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:d(n===oa.GRANTING_ORGANIZATION?As.REAUTH_GRANTING_ORGANIZATION_DESCRIPTION:As.REAUTH_DESCRIPTION)}),o!==null&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o instanceof uH?d(yH[o.reason]):c(o,d(As.ERROR))})}),D&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:d(As.REAUTH_NO_ACCEPTED_METHOD)})}),f&&f.length+m.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":d(As.REAUTH_TITLE),children:[f.map(e=>(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:e===g?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===g,disabled:s,onClick:()=>{_(e),y(null)},children:d(bH[e])},e)),m.map(e=>(0,$.jsx)(X,{type:`button`,size:Gd.SM,variant:e.identityLinkId===v?.identityLinkId?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.identityLinkId===v?.identityLinkId,disabled:s,onClick:()=>{y(e),_(null)},children:l(U.APP_LAYOUTS_SECURITY_SETTINGS,As.REAUTH_WITH_PROVIDER,{provider:e.displayName})},e.identityLinkId))]}),v&&(0,$.jsx)(Z,{className:`text-sm`,children:l(U.APP_LAYOUTS_SECURITY_SETTINGS,As.REAUTH_PROVIDER_PROMPT,{provider:v.displayName})}),g===Us.PASSWORD&&(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:d(As.REAUTH_PASSWORD)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value),placeholder:d(As.REAUTH_PASSWORD_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===Us.TOTP&&(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:d(As.REAUTH_TOTP_CODE)}),(0,$.jsx)(tN,{inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:8,value:C,onChange:e=>w(e.target.value.replace(/\D/g,``)),placeholder:d(As.REAUTH_TOTP_CODE_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===Us.PASSKEY&&(0,$.jsx)(Z,{className:`text-sm`,children:d(As.REAUTH_PASSKEY_PROMPT)})]})}):null},TH=(0,Q.createContext)(void 0),EH=({children:e})=>{let{setStepUpAuthHandler:t}=pm(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(Uu.STEP_UP),[u,d]=(0,Q.useState)(oa.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=oa.ACCOUNT_OR_OPERATION,n)=>n?(g.current&&await g.current.catch(()=>void 0),l(Uu.STEP_UP),d(t),p(n),y()):g.current?(e===Uu.STEP_UP&&l(Uu.STEP_UP),t===oa.GRANTING_ORGANIZATION&&d(oa.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)(()=>(Tc().setStepUpAuthHandler(v),b.current(v),()=>{Tc().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 DH(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)(TH.Provider,{value:C,children:[e,(0,$.jsx)(wH,{open:n,purpose:c,origin:u,...f?{decisionRequirement:f.requirement}:{},onConfirm:x,onCancel:S,failure:i,isLoading:o})]})};async function DH(e,t=Uu.STEP_UP,n,r){let i=Tc(),a=r?{decisionBinding:r}:{};switch(e.method){case Us.PASSWORD:return i.reAuthenticate(Us.PASSWORD,{password:e.password,...a},t);case Us.TOTP:return i.reAuthenticate(Us.TOTP,{code:e.code,...a},t);case Us.PASSKEY:{let e=await i.reAuthPasskeyOptions(void 0,r),n=await poe({optionsJSON:e});return i.reAuthenticate(Us.PASSKEY,{passkeyResponse:n,...a},t)}case Us.EXTERNAL_OAUTH2:case Us.ORG_OPENID_CONNECT:case Us.ORG_SAML:return _H(e.identityLinkId,t,e.popup,n)}}var OH=il.getLogger();function kH(){let e=zm(),{registry:t}=pm(),n=t.resourceConfigurations[gu.ORGANIZATIONS]?.resourceFieldIdentifier;return n?e[n]:void 0}function AH(){let e=kH(),{registry:t,doOperation:n}=pm(),{auth:r,user:i}=ag(),a=Qp(),o=(0,Q.useRef)(n);o.current=n;let s=t.resourceConfigurations[gu.ORGANIZATIONS],c=s?.resourceFieldIdentifier,l=a?.currentUserId??null,u=!!i&&(!l||i._id===l),d=!!r.accessToken&&r.sessionType!==_l.ONE_OFF&&!r.isRestoringSession&&r.sessionRestored&&u,f=!!r.accessToken&&r.sessionType!==_l.ONE_OFF&&u,p=!!e&&f&&kh(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(rg.INCONCLUSIVE);return}let r=!1;return o.current(wi.buildOperationPathKeyFromOperation(n),{contextualParameters:{[c]:e}},{silent:!0}).then(()=>{r||t(rg.ADMITTED)}).catch(n=>{if(r)return;let i=ut.isAuthorizationError(n)||ut.isNotFoundError(n);i||OH.warn(`Could not verify access to the organization addressed by the route`,{organizationId:e,error:n}),t(i?rg.REFUSED:rg.INCONCLUSIVE)}),()=>{r=!0}},[m,_,e,c,s]),e?p?rg.ACTIVE_MEMBERSHIP:d?_??rg.VERIFYING:rg.UNDECIDABLE:rg.NOT_ADDRESSED}var jH=(0,Q.createContext)(null);function MH(e){let t=kH(),n=Qp(),{user:r,organizations:i,permissions:a,followRouteOrganization:o}=ag(),{emit:s}=qo(),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=fse({routeOrganizationId:t,access:e,routeOrganizationLoaded:!!t&&i.some(e=>e._id===t),routeOrganizationConferred:use(a?.accessProfile,t),currentOrganizationId:c,arrivalSettled:m});return(0,Q.useEffect)(()=>{h===sh.FOLLOWING&&t&&l&&(p(l),o(t)&&s(xc.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:t}))},[h,t,l,o,s]),h}function NH(){let e=(0,Q.useContext)($g),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 PH({preset:e=G.DEFAULT,...t}){NH();let n=q(U.APP_LAYOUTS_MAIN_CONTAINER,`AppLayout_MainContainer`)(e);return(0,$.jsx)(n,{...t})}var FH=il.getLogger();function IH(){let{appConfig:e}=Eu(),{privacy:t,recordConsentDecision:n,logout:r}=ag(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)([]),u=(0,Q.useMemo)(()=>Kb({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=Jb(u,e,t);if(i.length>0&&!r)l(i);else{l([]),a(!0);try{await n(qb(u.grantedPurposes,e,t),e)}catch(e){FH.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 LH({preset:e=G.DEFAULT,children:t}){let n=IH();if(n.status===Gb.NOT_APPLICABLE||n.status===Gb.SATISFIED)return(0,$.jsx)($.Fragment,{children:t});let r=q(U.APP_LAYOUTS_CONSENT_GATE,`AppLayout_ConsentGate`)(e);return n.status===Gb.REQUIRED?(0,$.jsx)(r,{gate:n}):(0,$.jsxs)($.Fragment,{children:[t,(0,$.jsx)(r,{gate:n})]})}var RH;(function(e){e.NOT_APPLICABLE=`NOT_APPLICABLE`,e.CHECKING=`CHECKING`,e.SATISFIED=`SATISFIED`,e.REQUIRED=`REQUIRED`,e.UNAVAILABLE=`UNAVAILABLE`})(RH||={});function zH(){let{appConfig:e}=Eu(),{logout:t}=ag(),{resolvedUserType:n}=Jx(),r=e.compliance?.governedDocumentAcceptanceMode??Bc.EXPLICIT_CHECKBOX,i=sc(e.compliance),a=n!==null&&(e.compliance?.governedDocumentReleases??[]).some(e=>e.allowedInteractionKinds.includes(Vo.CONTRACT_ACCEPTED)&&(!i||e.approvalState===Re.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 Tc().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:Do(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?RH.UNAVAILABLE:o===void 0?RH.CHECKING:o.length===0?RH.SATISFIED:RH.REQUIRED:RH.NOT_APPLICABLE,T=r===Bc.IMPLIED_BY_REGISTERING||u,E=(0,Q.useCallback)(async()=>{if(T&&b.length!==0){h(!0),_(!1),y(!1);try{let e=await Tc().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(Ir(e)&&e.customMessageReference===rs.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)try{let e=await Tc().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===RH.REQUIRED?o?.[0]?.reason:void 0,acceptance:D,canAccept:T,isSaving:m,saveFailed:g,releaseSuperseded:v,accept:E,signOut:t}}function BH({preset:e=G.DEFAULT,children:t}){let n=zH();if(n.status!==RH.REQUIRED)return(0,$.jsx)($.Fragment,{children:t});let r=q(U.APP_LAYOUTS_DOCUMENT_ACCEPTANCE_GATE,`AppLayout_DocumentAcceptanceGate`)(e);return(0,$.jsx)(r,{gate:n})}var VH=()=>(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(Zy,{})}),HH=()=>{let e=oh(),{notifyWarning:t}=Im(),{tErrorMessage:n,tErrorGuidance:r}=J(),i=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{i.current||(i.current=!0,t(pp({type:v.AUTHORIZATION,customMessageReference:rs.AUTHORIZATION_ORGANIZATION_NOT_ACCESSIBLE},{translators:{tErrorMessage:n,tErrorGuidance:r}})),e(Pa.home,{replace:!0}))},[e,t,n,r]),(0,$.jsx)(VH,{})},UH=({redirectTo:e=Pa.login})=>{let{auth:t}=ag(),n=(0,Q.useContext)(ea)?.shellCompanions??[],r=Qp(),i=og(),a=AH(),o=MH(a),s=kH()??null,c=a===rg.VERIFYING||a===rg.REFUSED||o===sh.FOLLOWING,l=(0,Q.useMemo)(()=>({routeOrganizationId:s,routeContentHeld:c}),[s,c]),u=r?.currentOrganizationId,d=!!t.accessToken,f=od(i),p=Oi(e,f);if(!d)return(0,$.jsx)(Vh,{to:p,replace:!0});if(t.isRestoringSession||!t.sessionRestored&&!u)return(0,$.jsx)(PH,{children:(0,$.jsx)(VH,{})});let m=(0,$.jsx)(Ph,{});return a===rg.REFUSED?m=(0,$.jsx)(HH,{}):c&&(m=(0,$.jsx)(VH,{})),(0,$.jsx)(jH.Provider,{value:l,children:(0,$.jsx)(BH,{children:(0,$.jsxs)(LH,{children:[n.map((e,t)=>(0,$.jsx)(e,{},t)),(0,$.jsx)(PH,{children:m})]})})})},WH=new Set;function GH(e){let{resourceType:t,guidanceFlows:n,urlPatterns:r}=e;return n.map(e=>{let n=`${t}.${e.ref}`,i=KH(e,t,r),a=e.elements.map((e,t)=>qH(e,t)),o=a.filter(e=>e.type===yc.CHECKLIST_ITEM).map(e=>e.ref),s=0;for(let e of a)e.type===yc.CHECKLIST&&(s++,e.items=s===1?o:[]);return s>1&&o.length>0&&!WH.has(n)&&(WH.add(n),il.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??as.USER,renderMode:e.renderMode,trigger:i,audience:e.audience,priority:e.priority??100,elements:a}})}function KH(e,t,n){let r=e.trigger;switch(r.type){case`FIRST_VISIT`:{let r=n?.[e.bindToOperation];return{type:xt.ROUTE_MATCH,routePattern:r??`/${t.toLowerCase()}`}}case`MANUAL`:return{type:xt.MANUAL};case`DELAYED`:return{type:xt.DELAYED,delayMs:r.delayMs??1e3};case`EVENT`:{let n=r.eventName??`${t}:${e.bindToOperation}`;return{type:xt.EVENT,eventName:n}}default:return{type:xt.MANUAL}}}function qH(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 yc.TOOLTIP:return{...r,type:yc.TOOLTIP,targetSelector:n??``,placement:JH(e.placement)};case yc.TOUR:return{...r,type:yc.TOUR,steps:(e.steps??[]).map((e,t)=>({ref:e.ref,order:t,placement:JH(e.placement)??Ni.BOTTOM,targetSelector:e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),...e.targetField?{targetField:e.targetField}:{}}))};case yc.MODAL:return{...r,type:yc.MODAL,dismissible:!0,...e.actionRef?{ctaAction:e.actionRef}:{}};case yc.BANNER:return{...r,type:yc.BANNER,...e.actionRef?{actionRef:e.actionRef}:{}};case yc.ANNOUNCEMENT:return{...r,type:yc.ANNOUNCEMENT,...e.actionRef?{actionRef:e.actionRef}:{}};case yc.BADGE:return{...r,type:yc.BADGE,...n?{targetSelector:n}:{}};case yc.CARD:return{...r,type:yc.CARD,...e.actionRef?{actionRef:e.actionRef}:{}};case yc.SURVEY:return{...r,type:yc.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 yc.CHECKLIST:return{...r,type:yc.CHECKLIST,items:[]};case yc.CHECKLIST_ITEM:return{...r,type:yc.CHECKLIST_ITEM,...e.actionRef?{actionRef:e.actionRef}:{}};default:return{...r,type:e.type}}}function JH(e){if(!e)return;let t=e.toUpperCase();if(t in Ni)return Ni[t]}var YH={achievedMilestoneRefs:new Set,stagesReached:new Set};function XH(e,t,n){if(!e)return!0;let r=t.scopedState[n]??YH;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 ZH=(0,Q.createContext)(null),QH=[],$H={},eU=[],tU={[Lu.USER]:null,[Lu.ORGANIZATION]:null},nU={scopedStates:tU,isMilestoneAchieved:()=>!1,getMilestoneAchievement:()=>void 0,getCategoryProgress:()=>void 0,totalPoints:0,milestoneDefinitions:eU,isLoading:!1},rU={currentStage:null,stageEnteredAt:null,isEnabled:!1,isLoading:!1,hasReachedStage:()=>!1,activationProgress:{criteriaMet:{},criteria:[],totalCriteria:0,metCriteria:0,isFullyActivated:!1}},iU={activeFlows:QH,flowStates:$H,activateFlow:()=>{},recordFlowPresented:()=>{},reportFlowNotPresentable:()=>{},completeElement:async()=>{},completeFlow:()=>{},dismissFlow:()=>{},skipFlow:()=>{},isFlowActive:()=>!1,isFlowCompleted:()=>!1,isFlowPersistable:()=>!1,isLoading:!1,progression:nU,lifecycle:rU};function aU(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===E.API_CALL)??null:null}var oU;(function(e){e.LOADED=`loaded`,e.ABSENT=`absent`,e.UNAVAILABLE=`unavailable`})(oU||={});var sU=new Set;function cU(e,t){let n=`${e}:${t}`;sU.has(n)||(sU.add(n),il.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 lU(e,t){return t?{...e,flows:{...e.flows,...t.flows}}:e}async function uU(e,t,n){let r=Uc[e],i=aU(n,r,K.READ);if(!i)return cU(r,K.READ),{outcome:oU.UNAVAILABLE};let a=wi.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:oU.LOADED,state:e??{flows:{}}}}catch(e){return ut.isNotFoundError(e)?{outcome:oU.ABSENT}:{outcome:oU.UNAVAILABLE}}}async function dU(e,t,n){let r=Uc[e],i=aU(n,r,K.CREATE);if(!i)return cU(r,K.CREATE),{outcome:oU.UNAVAILABLE};let a=wi.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{},requestData:{flows:{}}},{silent:!0});return{outcome:oU.LOADED,state:e??{flows:{}}}}catch{return uU(e,t,n)}}async function fU(e,t,n,r){let i=Uc[e],a=aU(r,i,K.UPDATE);if(!a){cU(i,K.UPDATE);return}let o=wi.buildOperationPathKeyFromOperation(a);try{await n(o,{contextualParameters:{},requestData:t})}catch{}}var pU;(function(e){e.WRITTEN=`written`,e.NOT_BOUND=`not_bound`,e.NO_OPERATION=`no_operation`,e.REFUSED=`refused`})(pU||={});async function mU(e,t,n,r){if(e.type!==yc.SURVEY)return pU.NOT_BOUND;let i=e,a=i.bindTo?.resourceType;if(!a)return pU.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 pU.NOT_BOUND;let s=aU(r,a,K.UPDATE);if(!s)return il.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}),pU.NO_OPERATION;let c=wi.buildOperationPathKeyFromOperation(s);try{return await n(c,{contextualParameters:{},requestData:o}),pU.WRITTEN}catch(t){return il.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)}),pU.REFUSED}}async function hU(e,t,n){let r=ke[e],i=aU(n,r,K.READ);if(!i)return{outcome:oU.UNAVAILABLE};let a=wi.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:oU.LOADED,state:e??{milestonesAchieved:{},operationCounts:{},totalPoints:0,valueMomentsAchieved:{},categoriesProgress:{}}}}catch(e){return ut.isNotFoundError(e)?{outcome:oU.ABSENT}:{outcome:oU.UNAVAILABLE}}}async function gU(e){if(!e)return[];try{return(await Tc().getMilestoneDefinitions({silent:!0}))?.definitions??[]}catch{return[]}}var _U={[We.USER]:null,[We.ORGANIZATION]:null};async function vU(e,t,n){let r=lt[e],i=aU(n,r,K.READ);if(!i)return{outcome:oU.UNAVAILABLE};let a=wi.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return e?{outcome:oU.LOADED,state:e}:{outcome:oU.ABSENT}}catch(e){return ut.isNotFoundError(e)?{outcome:oU.ABSENT}:{outcome:oU.UNAVAILABLE}}}function yU(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 ys.OVERLAY:i||=(r.push(e),!0);break;case ys.CHECKLIST:a||=(r.push(e),!0);break;case ys.INLINE:r.push(e)}return r}var bU=({children:e})=>{let t=(0,Q.useContext)(ea),{on:n,emit:r}=qo(),i=ag(),a=Qp(),o=pm(),s=(0,Q.useContext)(gh),c=(0,Q.useRef)(o);c.current=o;let l=(0,Q.useMemo)(()=>il.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=GH({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]),p=(0,Q.useMemo)(()=>t?.frontendConfiguration?.onboardingViews??[],[t?.frontendConfiguration]),m=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,{ref:t.ref,scope:t.scope??as.USER,elements:t.elements,renderMode:t.renderMode});for(let t of p)e.has(t.ref)||e.set(t.ref,{ref:t.ref,scope:as.USER,elements:t.elements,renderMode:void 0});return e},[d,p]),h=m.size>0,g=(0,Q.useMemo)(()=>{let e={};for(let t of m.values())e[t.ref]=t.scope;return e},[m]),[_,v]=(0,Q.useState)({}),y=(0,Q.useRef)({}),b=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(b.current=!0,()=>{b.current=!1}),[]);let x=(0,Q.useRef)(new Set),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w=(0,Q.useRef)(0),[T,E]=(0,Q.useState)(new Set),[D,O]=(0,Q.useState)(!0),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(new Map),M=(0,Q.useRef)(new Set),N=(0,Q.useCallback)(e=>(y.current=e,v(e),e),[]),P=(0,Q.useCallback)(e=>{let t=e(y.current);return N(t)},[N]),[F,I]=(0,Q.useState)({...tU}),[L,ee]=(0,Q.useState)(!0),R=(0,Q.useRef)(!1),[z,te]=(0,Q.useState)(eU),ne=t?.appConfig?.lifecycle,re=!!ne?.enabled,[ie,ae]=(0,Q.useState)({..._U}),[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&&h&&!k.current,he=de&&h?D||me:!1;Ym({identifier:nl.PROGRESSION,isLoading:L}),Ym({identifier:nl.LIFECYCLE,isLoading:oe});let ge=(0,Q.useMemo)(()=>{let e=[as.USER];return a?.currentOrganizationId&&e.push(as.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{y.current=_},[_]);let _e=(0,Q.useRef)(ge);(0,Q.useEffect)(()=>{_e.current!==ge&&(k.current=!1,R.current=!1,ce.current=!1,M.current.clear(),x.current.clear(),S.current=!1,Ce.current.clear(),we.current.clear(),w.current+=1,_e.current=ge,de&&h&&O(!0),de&&ee(!0),de&&re&&se(!0),P(e=>{if(!(as.ORGANIZATION in e))return e;let t={...e};return delete t[as.ORGANIZATION],t}),I(e=>({...e,[Lu.ORGANIZATION]:null})),ae(e=>({...e,[We.ORGANIZATION]:null})),E(e=>{let t=new Set(e);for(let e of d)(e.scope??as.USER)===as.ORGANIZATION&&t.delete(e.ref);return t}))},[ge,d,h,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 A.current.values())clearTimeout(e);A.current.clear(),k.current=!1,R.current=!1,ce.current=!1,M.current.clear(),x.current.clear(),S.current=!1,Ce.current.clear(),we.current.clear(),w.current+=1,N({}),E(new Set),I({...tU}),te(eU),ae({..._U}),O(de&&h),ee(de),se(de&&re)}},[N,ue,h,de,re]);let ye=(0,Q.useMemo)(()=>{let e={};for(let t of ge){let n=_[t];n?.flows&&Object.assign(e,n.flows)}return e},[_,ge]),B=(0,Q.useMemo)(()=>{let e=new Set;for(let[t,n]of Object.entries(ye))n.status===Cr.COMPLETED&&e.add(t);let t=jh(i.permissions,a?.currentOrganizationId).filter(Boolean),n=s?.resolvedFeatures?.features??[],r=s?.resolvedFeatures?.limits??{},o=s?.resolvedFeatures?.currentUsage??{},c={};for(let e of[as.USER,as.ORGANIZATION]){let t=F[bne[e]],n=ie[vie[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(k.current||!h||!de)return;k.current=!0;let e=Symbol(`guidance-init`);C.current=e,S.current=!0;let t=!1,n=!1;return(async()=>{let e=c.current;u(`Initializing guidance state`,{scopes:ge,flowCount:m.size});let r=await Promise.allSettled(ge.map(async t=>{let n=await uU(t,e.doOperation,e.registry);return n.outcome===oU.ABSENT&&(u(`Auto-creating guidance state for scope ${t}`),n=await dU(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===oU.LOADED?(x.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]=lU(r,e[n]);return t}),n=!0,O(!1),u(`Guidance state loaded`,{scopeCount:Object.keys(i).length})})().catch(e=>{il.getLogger().warn(`GuidanceContext: guidance initialization failed`,{error:e}),k.current=!1,O(!1)}).finally(()=>{C.current===e&&(S.current=!1)}),()=>{t=!0,n||(k.current=!1),C.current===e&&(S.current=!1)}},[h,ge,de,u,P]);let be=(0,Q.useMemo)(()=>{let e=[Lu.USER];return a?.currentOrganizationId&&e.push(Lu.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:be});let[r,i]=await Promise.all([Promise.allSettled(be.map(async e=>({scope:e,read:await hU(e,n.doOperation,n.registry)}))),gU(fe&&n.hasResource(gu.USER_PROGRESSION_STATE))]);if(e)return;let a={...tU};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===oU.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,ee(!1),u(`Progression state loaded`,{scopeCount:Object.values(a).filter(Boolean).length,milestoneDefinitionCount:i.length})})().catch(e=>{il.getLogger().warn(`GuidanceContext: progression initialization failed`,{error:e}),R.current=!1,ee(!1)}),()=>{e=!0,t||(R.current=!1)}},[fe,be,de,u]);let xe=(0,Q.useMemo)(()=>{if(!re)return[];let e=[We.USER];return a?.currentOrganizationId&&e.push(We.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:xe});let r=await Promise.allSettled(xe.map(async e=>({scope:e,read:await vU(e,n.doOperation,n.registry)})));if(e)return;let i={..._U};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===oU.LOADED?i[t]=n.state:n.outcome===oU.ABSENT&&(i[t]=su.createInitialLifecycleState())}ae(e=>({...e,...i})),t=!0,se(!1),u(`Lifecycle state loaded`,{scopeCount:Object.values(i).filter(Boolean).length})})().catch(e=>{il.getLogger().warn(`GuidanceContext: lifecycle initialization failed`,{error:e}),ce.current=!1,se(!1)}),()=>{e=!0,t||(ce.current=!1)}},[xe,de,re,u]);let Se=(0,Q.useCallback)((e,t=y.current)=>{let n=[as.USER,as.ORGANIZATION].filter(n=>t[n]?.flows?.[e]!==void 0);return n.find(n=>t[n]?.flows?.[e]?.status===Cr.IN_PROGRESS)??n[0]??g[e]??as.USER},[g]),Ce=(0,Q.useRef)(new Set),we=(0,Q.useRef)(new Set),Te=(0,Q.useRef)(new Set),Ee=(0,Q.useCallback)(async e=>{if(Te.current.has(e))return;Te.current.add(e);let t=w.current;try{let n=c.current,r=await hU(e,n.doOperation,n.registry);if(r.outcome!==oU.LOADED||!b.current||w.current!==t)return;I(t=>({...t,[e]:r.state})),u(`Progression state for scope ${e} recovered after a failed read`)}finally{Te.current.delete(e)}},[u]),De=(0,Q.useCallback)(async e=>{if(x.current.has(e)||S.current||we.current.has(e))return;we.current.add(e);let t=w.current;try{let n=c.current,r=await uU(e,n.doOperation,n.registry);if(r.outcome===oU.ABSENT&&(r=await dU(e,n.doOperation,n.registry)),r.outcome!==oU.LOADED||!b.current||w.current!==t)return;x.current.add(e),il.getLogger().info(`GuidanceContext: guidance state for scope "${e}" recovered — persistence resumes for this scope.`),Ce.current.delete(e),P(t=>({...t,[e]:lU(r.state,t[e])}))}finally{we.current.delete(e)}},[P]),Oe=(0,Q.useCallback)((e,t,n)=>{let r=y.current,i=n?.scopeOverride??Se(e,r),a=x.current.has(i),s=r[i]??{flows:{}},c=t(s.flows[e]??{status:Cr.NOT_STARTED,elements:{},triggerCount:0}),l={...s,flows:{...s.flows,[e]:c}};N({...r,[i]:l}),a?fU(i,l,o.doOperation,o.registry):(Ce.current.has(i)||(Ce.current.add(i),il.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.`)),De(i))},[N,Se,o,De]),ke=(0,Q.useCallback)(e=>{let t=f.get(e);if(!t)return;let n=g[e]??as.USER;if(!ge.includes(n))return;if(pe&&t.audience?.requiredFeatures){M.current.add(e);return}let r=ye[e];cd(r?.status)||r?.status===Cr.IN_PROGRESS&&T.has(e)||XH(t.audience,B,t.scope??as.USER)&&(u(`Activating flow: ${e}`),E(t=>{let n=new Set(t);return n.add(e),n}))},[f,ye,T,B,g,ge,u,pe]),Ae=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{for(let e of Ae.current)T.has(e)||Ae.current.delete(e);let e=!1;for(let t of je.current)T.has(t)||(je.current.delete(t),e=!0);e&&Ne(new Set(je.current))},[T]);let je=(0,Q.useRef)(new Set),[Me,Ne]=(0,Q.useState)(new Set),Pe=(0,Q.useCallback)((e,t)=>{je.current.has(e)!==t&&(t?je.current.add(e):je.current.delete(e),Ne(new Set(je.current)))},[]),Fe=(0,Q.useCallback)(e=>{if(!T.has(e)||Ae.current.has(e))return;let t=f.get(e);t&&(Ae.current.add(e),Oe(e,e=>({...e,status:Cr.IN_PROGRESS,startedAt:e.startedAt??new Date,triggerCount:(e.triggerCount??0)+1})),r(xc.GUIDANCE_FLOW_ACTIVATED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:g[e]??as.USER}))},[T,f,g,Oe,r]);(0,Q.useEffect)(()=>{if(!(he||pe||d.length===0))for(let e of d){if(e.trigger.type!==xt.FIRST_VISIT)continue;let t=ye[e.ref];t&&t.triggerCount!==0||ke(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)ke(t)},[pe,ke]);let Ie=(0,Q.useMemo)(()=>d.filter(e=>e.trigger.type===xt.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||Ie.length===0))return n(xc.NAVIGATION_ZONE_CHANGED,e=>{let t=e.currentContent?.urlPath;if(t)for(let e of Ie)e._compiledPattern.test(t)&&ke(e.ref)})},[he,Ie,n,ke]);let Le=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===xt.EVENT&&e.trigger.eventName);if(e.length!==0){for(let t of e){let e=t.trigger.eventName;e.includes(`:`)||Le.current.has(t.ref)||(Le.current.add(t.ref),il.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(xc.NOTIFY_RESOURCE_SUCCESS,t=>{let n=`${t.resourceType}:${t.operationIdentifier}`;for(let t of e)t.trigger.eventName===n&&ke(t.ref)})}},[he,d,n,ke]);let Re=(0,Q.useRef)(ke);(0,Q.useEffect)(()=>{Re.current=ke},[ke]),(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===xt.DELAYED&&e.trigger.delayMs);if(e.length!==0){for(let t of e){if(A.current.has(t.ref))continue;let e=setTimeout(()=>{Re.current(t.ref),A.current.delete(t.ref)},t.trigger.delayMs);A.current.set(t.ref,e)}return()=>{for(let e of A.current.values())clearTimeout(e);A.current.clear()}}},[he,d]);let ze=(0,Q.useMemo)(()=>yU(d.filter(e=>T.has(e.ref)),Me),[d,T]),Be=(0,Q.useCallback)(e=>{he||ke(e)},[ke,he]),Ve=(0,Q.useCallback)(e=>{E(t=>{let n=new Set(t);return n.delete(e),n});let t=m.get(e),n=Se(e);t?.renderMode&&r(xc.GUIDANCE_FLOW_COMPLETED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:n}),u(`Flow completed: ${e}`)},[m,Se,r,u]),He=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ye[e];cd(t?.status)||(Oe(e,e=>({...e,status:Cr.COMPLETED,completedAt:new Date})),Ve(e))},[Oe,m,ye,Ve]),Ue=(0,Q.useCallback)(async(e,t,n)=>{if(!m.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=m.get(e)?.elements.find(e=>e.ref===t);if(a&&!n?.declineResourceBinding){let e=c.current,t=await mU(a,i,e.doOperation,e.registry);if(t===pU.REFUSED||t===pU.NO_OPERATION)throw Error(`guidance_survey_binding_write_failed:${t}`)}let o=m.get(e),s=o!==void 0&&o.elements.every(n=>n.ref===t||ye[e]?.elements?.[n.ref]?.status===Cr.COMPLETED);if(Oe(e,e=>({...e,status:s?Cr.COMPLETED:e.status===Cr.NOT_STARTED?Cr.IN_PROGRESS:e.status,...s?{completedAt:new Date}:{},elements:{...e.elements,[t]:{status:Cr.COMPLETED,completedAt:new Date,surveyAnswers:i,lastStepIndex:n?.lastStepIndex}}})),o?.renderMode){let n=o.elements.find(e=>e.ref===t);n&&r(xc.GUIDANCE_ELEMENT_COMPLETED,{flowRef:e,elementRef:t,elementType:n.type})}u(`Element completed: ${e}/${t}`),s&&Ve(e)},[Oe,m,r,u,Ve,ye]),Ge=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ye[e];if(cd(t?.status))return;Oe(e,e=>({...e,status:Cr.DISMISSED,dismissedAt:new Date})),E(t=>{let n=new Set(t);return n.delete(e),n});let n=m.get(e),i=Se(e);n?.renderMode&&r(xc.GUIDANCE_FLOW_DISMISSED,{flowRef:e,renderMode:n.renderMode,triggerSource:`frontend`,scope:i}),u(`Flow dismissed: ${e}`)},[Oe,m,ye,Se,r,u]),Ke=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ye[e];cd(t?.status)||(Oe(e,e=>({...e,status:Cr.SKIPPED})),E(t=>{let n=new Set(t);return n.delete(e),n}),u(`Flow skipped: ${e}`))},[Oe,m,ye,u]),qe=(0,Q.useCallback)(e=>T.has(e),[T]),Je=(0,Q.useCallback)(e=>ye[e]?.status===Cr.COMPLETED,[ye]),Ye=(0,Q.useCallback)(e=>m.has(e),[m]);(0,Q.useEffect)(()=>{let e=n(xc.GUIDANCE_FLOW_ACTIVATED,e=>{e.triggerSource===`backend`&&(u(`Backend activated flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.add(e.flowRef),n}))}),t=n(xc.GUIDANCE_FLOW_COMPLETED,e=>{e.triggerSource===`backend`&&(u(`Backend completed flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Oe(e.flowRef,e=>({...e,status:Cr.COMPLETED,completedAt:new Date}),{scopeOverride:e.scope}))}),r=n(xc.GUIDANCE_FLOW_DISMISSED,e=>{e.triggerSource===`backend`&&(u(`Backend dismissed flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Oe(e.flowRef,e=>({...e,status:Cr.DISMISSED,dismissedAt:new Date}),{scopeOverride:e.scope}))});return()=>{e(),t(),r()}},[n,u,Oe]),(0,Q.useEffect)(()=>{let e=n(xc.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`),Ee(t),n)}),e.reward?.type===Yu.FEATURE_UNLOCK&&(s?.refetch(),r(xc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.feature_unlock.${e.milestoneRef}`,data:{milestoneRef:e.milestoneRef,featureRef:e.reward.featureRef}})),e.reward?.type===Yu.CELEBRATION&&e.reward?.celebrationLevel){let t=cte(e.reward);r(xc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.${e.milestoneRef}`,data:{frontendDisplayHints:{celebration:{mode:t}},milestoneRef:e.milestoneRef,category:e.category,points:e.points}})}}),t=n(xc.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`),Ee(t),n)})});return()=>{e(),t()}},[n,u,r,s,Ee]),(0,Q.useEffect)(()=>{if(!re)return;let e=n(xc.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]??su.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(Lu))if(F[t]?.milestonesAchieved[e])return!0;return!1},t=e=>{for(let t of Object.values(Lu)){let n=F[t]?.milestonesAchieved[e];if(n)return n}},n=e=>{let t;for(let n of Object.values(Lu)){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(Lu)){let t=F[e];t&&(r+=t.totalPoints)}return{scopedStates:F,isMilestoneAchieved:e,getMilestoneAchievement:t,getCategoryProgress:n,totalPoints:r,milestoneDefinitions:z,isLoading:L}},[F,L,z]),Ze=(0,Q.useMemo)(()=>{if(!re)return rU;let e=ie[We.USER],t=e?.currentStage??null,n=e?.stageEnteredAt?new Date(e.stageEnteredAt):null,r=t=>e?j(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!==Xr.SIGNED_UP}}},[re,ie,oe,le]),Qe=(0,Q.useMemo)(()=>({activeFlows:ze,flowStates:ye,activateFlow:Be,recordFlowPresented:Fe,reportFlowNotPresentable:Pe,completeElement:Ue,completeFlow:He,dismissFlow:Ge,skipFlow:Ke,isFlowActive:qe,isFlowCompleted:Je,isFlowPersistable:Ye,isLoading:he,progression:Xe,lifecycle:Ze}),[ze,ye,Be,Fe,Ue,He,Ge,Ke,qe,Je,Ye,he,Xe,Ze]);return(0,$.jsx)(ZH.Provider,{value:Qe,children:e})};function xU(){return(0,Q.useContext)(ZH)??iU}function SU(){let e=(0,Q.useContext)(ZH);return(0,Q.useMemo)(()=>e?.lifecycle??rU,[e?.lifecycle])}function CU(){let e=(0,Q.useContext)(ZH);return(0,Q.useMemo)(()=>e?.progression??nU,[e?.progression])}var wU=new Set,TU;(function(e){e.ACHIEVED=`achieved`,e.IN_PROGRESS=`in-progress`,e.LOCKED=`locked`})(TU||={});function EU(e,t){return e.scopedStates[t]!=null}function DU(e,t){return e.filter(e=>EU(t,e.scope??Lu.USER)).map(e=>{let n=t.getMilestoneAchievement(e.identifier);if(n)return{definition:e,status:TU.ACHIEVED,achievement:n};if(e.dependencies?.length&&!e.dependencies.every(e=>t.isMilestoneAchieved(e)))return{definition:e,status:TU.LOCKED};let r=`${e.trigger.resourceType}:${e.trigger.operation}`,i=e.scope??Lu.USER,a=t.scopedStates[i]?.operationCounts?.[r]??0;return{definition:e,status:TU.IN_PROGRESS,currentCount:a}})}function OU(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===TU.ACHIEVED).length,totalCount:t.length,totalPoints:t.reduce((e,t)=>t.status===TU.ACHIEVED?e+(t.definition.points??0):e,0)}))}function kU(e,t){return t(e,`title`)}function AU(e,t){return t(e)}function jU(e,t){return e.filter(e=>e.status===TU.IN_PROGRESS).sort((e,t)=>MU(t)-MU(e)).slice(0,t)}function MU(e){let t=e.definition.threshold;return!t||e.definition.type!==Qi.COUNT_THRESHOLD?0:Math.min(1,(e.currentCount??0)/t)}function NU(e){return e.status===TU.IN_PROGRESS&&e.definition.type===Qi.COUNT_THRESHOLD&&e.definition.threshold!=null&&e.definition.threshold>0}function PU({item:e,name:t,tTracker:n,showPoints:r,showStatusIcon:i}){let{renderIcon:a}=kf(),o=e.status===TU.ACHIEVED?a(H.CHECK,{size:Jn.SM,className:`text-success`}):e.status===TU.LOCKED?a(H.LOCK,{size:Jn.SM,className:`text-muted-foreground`}):a(H.CLOCK,{size:Jn.SM,className:`text-primary`}),s=n(e.status===TU.ACHIEVED?`achieved`:e.status===TU.LOCKED?`locked`:`inProgress`),c=NU(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)(Nf,{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)(v_,{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 FU({completed:e,total:t,tTracker:n}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(v_,{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 IU({variant:e=U_,actionableLimit:t=3,className:n}={}){let r=CU(),{tComponent:i,tMilestone:a,tMilestoneCategory:o,isReady:s}=J({component:U.PROGRESSION_MILESTONE_TRACKER,keys:[ac.MILESTONES]}),c=(0,Q.useMemo)(()=>(e,t)=>i(U.PROGRESSION_MILESTONE_TRACKER,e,t),[i]),l=(0,Q.useMemo)(()=>DU(r.milestoneDefinitions,r),[r]),u=(0,Q.useMemo)(()=>OU(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===TU.ACHIEVED).length,f=l.length,p=c(`title`),m=c(`description`),h=e=>kU(e.definition.identifier,a),g=Object.values(H_).includes(e)?e:U_;g!==e&&!wU.has(e)&&(wU.add(e),il.getLogger().warn(`ProgressionMilestoneTracker: unknown variant "${e}" — falling back to "${U_}". Valid values: ${Object.values(H_).join(`, `)}.`));let _=(()=>{switch(g){case H_.NEXT_ACTIONS:{let e=jU(l,t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(FU,{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)(PU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1},e.definition.identifier))})]})}case H_.SUMMARY:{let[e]=jU(l,1);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(FU,{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)(PU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1})})]})]})}case H_.FLAT:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(FU,{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:AU(e.category,o)}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(PU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!0},e.definition.identifier))})]},e.category))]});case H_.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:AU(e.category,o)}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`progressDisplay`,{completed:e.completedCount,total:e.totalCount})})]}),(0,$.jsx)(v_,{value:e.totalCount>0?e.completedCount/e.totalCount*100:0,className:`h-2`,"aria-label":AU(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)(PU,{item:e,name:h(e),tTracker:c,showPoints:!0,showStatusIcon:!0},e.definition.identifier))})]},e.category))})}})(),v=g===H_.SUMMARY||g===H_.DETAILED;return(0,$.jsxs)(kF,{role:`region`,"aria-label":p,className:n,"data-progression-variant":g,children:[(0,$.jsxs)(jF,{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)(Nf,{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)(IF,{className:`pt-0`,children:_})]})}var LU=(0,Q.createContext)(null);function RU({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)(LU.Provider,{value:a,children:i})}function zU(){let e=(0,Q.useContext)(LU);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 BU(){return(0,Q.useContext)(LU)}var VU=(0,Q.createContext)(null);function HU({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)(RU,{hostResourceType:i,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r,children:(0,$.jsx)(VU.Provider,{value:s,children:o})})}function UU(){let e=(0,Q.useContext)(VU);if(!e)throw Error(`useCompositeViewContext must be used within a CompositeViewProvider`);return e}function WU(){return(0,Q.useContext)(VU)}var GU=({viewRef:e,document:t,hostResourceType:n,contextResourceIdentifiers:r,navigationZone:i,navigationInitiator:a})=>{let o=WU(),{registry:s}=pm(),c=Qp(),{UIConfig:l,compositeViews:u}=Ig(),d=l?.currentBreakpoint,f=Q.useMemo(()=>Mp(e),[e]),p=n??(f?.hostKind===Vp.RESOURCE&&f.viewKind===xp.COMPOSITE_VIEW?f.hostRef:void 0)??o?.hostResourceType,m=r??o?.contextResourceIdentifiers,h=(0,Q.useMemo)(()=>t??vp({viewRef:e,compositeViews:u,registry:s}),[t,e,u,s]);(0,Q.useEffect)(()=>{},[h,m,e]);let g=(0,Q.useMemo)(()=>{let e=nm.buildInitiatorIds({userId:c?.currentUserId,organizationId:c?.currentOrganizationId,applicationId:c?.currentApplicationId,anonymousUserId:c?.currentAnonymousUserId}),t=h?.primaryScope?nm.primaryScopeToContextIdentifiers(e,h.primaryScope):{},n=c?.buildContextResourceIdentifiers()??{},r=nm.filterCustomScopeContextResourceIdentifiers(n);if(!h)return nm.mergeContextResourceIdentifiers(t,r,m);let i=h.scope===tm.RESOURCE&&p?[{resourceType:p,requirement:vc.OPTIONAL,isPrimaryScope:!1}]:[],a=[...h.additionalResourceRequirements??[],...i],o=nm.getAllowedViewBindingKeys({primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a});return nm.resolveViewContextResourceIdentifiers({surfaceName:`CompositeView`,surfaceRef:h.ref,primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a,primaryScopeContext:t,customScopeContext:r,explicitContextResourceIdentifiers:nm.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??Vn.PRIMARY,b=a??o?.navigationInitiator;if(!h)return(0,$.jsx)(c_,{viewKind:`composite`,viewRef:e});let x=h.viewComponent;return(0,$.jsx)(HU,{viewDefinition:h,breakpoint:d,navigationZone:y,navigationInitiator:b,hostResourceType:p,contextResourceIdentifiers:v,children:(0,$.jsx)(x,{viewRef:h.ref,viewDefinition:h})})};function KU({activationProgress:e}){let{tLifecycle:t,tActivationCriterion:n,isReady:r}=J({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===nee.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 qU({stage:e}){let{tLifecycle:t,tLifecycleStage:n}=J({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 JU(){let{tLifecycle:e,isReady:t}=J({keys:[`lifecycle`]}),{milestoneDefinitions:n,isLoading:r}=CU(),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)(IU,{})})]})}function YU(){let{tComponent:e}=J({component:U.APP_LAYOUTS_HOME});return(0,$.jsx)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`,textAlign:`center`},children:(0,$.jsx)(`h2`,{children:e(U.APP_LAYOUTS_HOME,`welcomeTitle`)})})}var XU=({})=>{let{currentStage:e,isEnabled:t,isLoading:n,activationProgress:r}=SU(),{homeDefinition:i}=Ig(),{registry:a}=pm(),o=og(),{navigate:s}=SS(),c=Qp(),{tComponent:l,isReady:u}=J({component:U.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=Um.resolveResourceUrl(t,n,c?.buildContextResourceIdentifiers?.()??{},a.allResourceFieldIdentifiers,e.parentResourcesRequirements);return r?.resolvedUrl?{content:{contentType:va.RESOURCE_OPERATION,resourceContext:En.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:Li},replaceBrowserHistory:!0})},[f,o.pathname,s]),d)return(0,$.jsx)(GU,{viewRef:d,navigationZone:Vn.PRIMARY});if(!u)return null;if(n)return(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`},children:l(U.APP_LAYOUTS_HOME,`loading`)});if(!t||!e)return(0,$.jsx)(YU,{});switch(e){case Xr.SIGNED_UP:return(0,$.jsx)(KU,{activationProgress:r});case Xr.REACTIVATED:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qU,{stage:e}),(0,$.jsx)(JU,{})]});case Xr.DORMANT:case Xr.ACTIVATED:case Xr.ENGAGED:default:return(0,$.jsx)(JU,{})}};function ZU({preset:e=G.DEFAULT,...t}){let n=q(U.APP_LAYOUTS_HOME,`AppLayout_Home`)(e);return(0,$.jsx)(n,{...t})}function QU({className:e,children:t,containerConfig:n,sectionMetadata:r,onSectionChange:i}){let a=WU(),o=a?.viewDefinition.translationRef,s=(0,Q.useMemo)(()=>o?[`${ac.COMPOSITE_VIEWS}.${o}`]:[],[o]),{tCompositeViewSection:c}=J({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)(()=>$U(t,n,l,r,i),[t,n,l,r,i]);return(0,$.jsx)(Wk,{value:{sectionEntries:l},children:(0,$.jsx)(`div`,{className:W(`flex flex-col gap-section`,e),"data-composite-layout":!0,children:u})})}function $U(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 rW(o.sections,r).map((e,s)=>{let c=nW(tA({...o,sections:e}),tW(e,t,r)),l=e.map(e=>eW(e,n));return(0,$.jsx)(WO,{sections:l,config:c,onSectionChange:i},`composite-group-${o.mode}-${a}-${s}`)})})})}function eW(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 tW(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 nW(e,t){return t?{...e,...t}:e}function rW(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 iW({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_APPROVAL_REQUEST,`AI_ApprovalRequest`)(e);return(0,$.jsx)(n,{...t})}function aW({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_APPROVAL_QUEUE,`AI_ApprovalQueue`)(e);return(0,$.jsx)(n,{...t})}function oW({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_DECISION_REQUEST,`AI_DecisionRequest`)(e);return(0,$.jsx)(n,{...t})}function sW({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_HUMAN_INPUT_REQUEST,`AI_HumanInputRequest`)(e);return(0,$.jsx)(n,{...t})}var cW=il.getLogger(),lW=new Set(Object.values(ei));function uW(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 dW(e){let t=e?.response?.data;return t&&typeof t.kind==`string`&&lW.has(t.kind)?t:void 0}var fW;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(fW||={});function pW(){let{httpClient:e}=Eu(),{on:t}=dp(),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(fW.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=`${yn}${lo(dr.FLOWS_ACTORS_DECISIONS)}`,r=await e.get(n,{silent:!0});c.current&&t===d.current&&(p(r?.decisions??[]),s(fW.READY))}catch(e){cW.warn(`Pending decisions could not be read`,{error:e instanceof Error?e.message:`unknown`}),c.current&&t===d.current&&s(fW.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:ei.NOT_ACTIONABLE};let i=`${yn}${lo(dr.FLOWS_ACTORS_DECISION_ACT,{decisionRef:t,act:n})}`,a=async t=>{try{return await e.post(i,r,{silent:!0,...t?{headers:{[Te.REAUTH_TOKEN]:t}}:{}})}catch(e){let t=dW(e);if(!t)throw e;return t}},o=i=>n===Qe.ANSWER&&r.presentationId!==void 0?e.stepUpForDecision({binding:{decisionRef:t,presentationId:r.presentationId},requirement:i}):Promise.resolve(void 0),s={kind:ei.NOT_ACTIONABLE,reason:Ur.DECISION_STEP_UP_REQUIRED},c;l.current.add(t);try{let e=n===Qe.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===ei.NOT_ACTIONABLE&&c.reason===Ur.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=`${yn}${lo(dr.FLOWS_ACTORS_DECISION_CANDIDATES,{decisionRef:t})}`;try{return(await e.get(n,{silent:!0}))?.candidates??[]}catch(e){if(dW(e))return[];throw e}},[e]);return(0,Q.useEffect)(()=>{c.current=!0,m();let e=t(Bn.FLOWS_ACTORS_DECISION_ROUTED,()=>{m()}),n=t(Bn.FLOWS_ACTORS_DECISION_WITHDRAWN,e=>{if(!e?.decisionRef||l.current.has(e.decisionRef))return;let t=uW(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 mW=il.getLogger(),hW=mW.debugByType(`FlowsActorsContext`);mW.setDebugTypeLogging(`FlowsActorsContext`,!1);var gW=500;function _W(e,...t){let n=[...e,...t];return n.length>gW?n.slice(n.length-gW):n}function vW(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 _W(e,t)}var yW;(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`})(yW||={});var bW={[to.COMPLETED]:yW.COMPLETED,[to.CANCELLED]:yW.CANCELLED,[to.AWAITING_APPROVAL]:yW.AWAITING_APPROVAL,[to.PROCESSING]:yW.RUNNING,[to.PENDING]:yW.STARTING,[to.READY]:yW.STARTING,[to.FAILED]:yW.ERROR,[to.ABORTED]:yW.ERROR};function xW(e){return bW[e]??yW.ERROR}function SW(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 CW=(0,Q.createContext)(void 0),wW=({children:e})=>{let{appConfig:t,frontendConfiguration:n,httpClient:r}=Eu(),i=ag(),a=Qp(),{on:o,emit:s,isConnected:c}=dp(),l=(0,Q.useRef)(!1),u=(n?.flowsActorsViews?.length??0)>0,[d,f]=(0,Q.useState)([]),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)([]),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(new Map),[E,D]=(0,Q.useState)(!1);Ym({identifier:nl.FLOWS_ACTORS,isLoading:b,hasLoadedOnce:E});let O=(0,Q.useRef)(w);O.current=w;let k=(0,Q.useCallback)((e,t)=>{T(n=>{let r=n.get(e);if(!r)return n;let i=new Map(n);return i.set(e,t(r)),i})},[]),A=(0,Q.useCallback)(async()=>{if(!t?.runtime?.endPoints?.main_backend_api)hW(`Cannot refresh systems - API endpoint not configured`);else if(!r)hW(`Cannot refresh systems - httpClient not available`);else{x(!0),C(null);try{let e=await r.get(`${yn}${lo(dr.FLOWS_ACTORS_FRONTEND_INFO)}`);f(e.systems),h(e.autonomousAgents),_(e.chatAgents),y(e.chatConnectionRefs),D(!0),hW(`Systems refreshed`,{count:e.systems.length})}catch(e){if(ut.isNotFoundError(e)){hW(`FlowsActors backend support not available - skipping systems bootstrap`),f([]),h([]),_([]),y([]),C(null),D(!0);return}let t=e instanceof Error?e:Error(`Unknown error`);C(t),hW(`Failed to refresh systems`,{error:t.message})}finally{x(!1)}}},[t?.runtime?.endPoints?.main_backend_api,r]),j=(0,Q.useCallback)(async(e,t,n)=>{if(!r)hW(`Cannot fetch conversation history - httpClient not available`);else try{let i=`${yn}${lo(dr.FLOWS_ACTORS_HISTORY)}`,o=t===void 0?void 0:At({...a?.currentOrganizationId?{organizationId:a.currentOrganizationId}:{},...t}),s=`?systemRef=${encodeURIComponent(e)}${o===void 0?``:`&contextRef=${encodeURIComponent(o)}`}`+(n?.before?`&before=${encodeURIComponent(n.before)}`:``),c=Fse(tr,await r.get(`${i}${s}`));hW(`Conversation history fetched`,{systemRef:e,count:c.executions.length});let l=c.executions.filter(e=>e.pendingApproval!==void 0);return l.length>0&&T(e=>{let t;for(let n of l){let r=e.get(n.executionId),i=r?.status===yW.ERROR&&(r.errorCode===or.DECISION_PENDING||r.errorCode===or.DECISION_PRESENTATION_STALE||r.errorCode===or.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:yW.AWAITING_APPROVAL,messages:[],pendingApproval:SW(n.pendingApproval)}))}return t??e}),{executions:c.executions,hasOlder:c.hasOlder===!0}}catch(t){if(ut.isNotFoundError(t))return hW(`FlowsActors history surface not available - returning empty history`,{systemRef:e}),{executions:[],hasOlder:!1};mW.warn(`Failed to fetch conversation history`,{systemRef:e,error:t instanceof Error?t.message:`unknown`});return}},[r,a?.currentOrganizationId]),M=(0,Q.useCallback)(async e=>{if(!r){hW(`Cannot delete conversation - httpClient not available`);return}let t=`${yn}${lo(dr.FLOWS_ACTORS_HISTORY)}`;await r.delete(`${t}?executionId=${encodeURIComponent(e)}`),hW(`Conversation deleted`,{executionId:e})},[r]),N=(0,Q.useCallback)((e,t,n,r,i)=>{if(!c)return hW(`Cannot start execution — WebSocket not connected`,{systemRef:e}),null;let o=n??crypto.randomUUID();hW(`Starting execution`,{systemRef:e,executionId:o,hasInput:!!t,isContinuation:!!n});let l={};return a?.currentOrganizationId&&(l.organizationId=a.currentOrganizationId),Object.assign(l,r??{}),T(t=>{let n=new Map(t);return n.set(o,{executionId:o,systemRef:e,status:yW.STARTING,messages:[]}),n}),s(Bn.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]),P=(0,Q.useCallback)((e,t,n,r,i,a)=>{let o=O.current.get(e);o?c?(hW(`Responding to approval`,{executionId:e,approvalId:t,approved:n,modified:i!==void 0}),s(Bn.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}:{}}),k(e,e=>({...e,status:n?yW.RUNNING:e.status,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval,...i?{submittedToolArgs:i}:{}}:void 0}))):hW(`Cannot respond to approval — WebSocket not connected`,{executionId:e,approvalId:t}):hW(`Cannot respond to approval — execution not found`,{executionId:e,approvalId:t})},[c,s,k]),F=(0,Q.useCallback)((e,t,n,r)=>{let i=O.current.get(e),a=i?.pendingApproval;if(!i||!a?.question||!a.decisionRef||!c){hW(`Cannot answer a question — no paused question, or the WebSocket is not connected`,{executionId:e});return}let o=t===tre.ANSWER;s(Bn.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}:{}}),k(e,e=>({...e,status:yW.RUNNING,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval}:void 0}))},[c,s,k]),I=(0,Q.useCallback)(e=>O.current.get(e),[]),L=(0,Q.useCallback)(e=>d.find(t=>t.ref===e),[d]),ee=(0,Q.useCallback)(e=>{let t=O.current.get(e);t&&c&&s(Bn.FLOWS_ACTORS_CANCEL,{systemRef:t.systemRef,executionId:e})},[c,s]),R=(0,Q.useCallback)(e=>{T(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([]),h([]),_([]),y([]),C(null),T(new Map))},[i]);let z=(0,Q.useCallback)(()=>{!l.current&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,A())},[t?.runtime?.endPoints?.main_backend_api,r,i,A]);(0,Q.useEffect)(()=>{!l.current&&u&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,A())},[t?.runtime?.endPoints?.main_backend_api,u,r,i,A]);let te=(0,Q.useRef)(c);(0,Q.useEffect)(()=>{let e=te.current&&!c;te.current=c,e&&T(e=>{let t=null;for(let[n,r]of e)(r.status===yW.STARTING||r.status===yW.RUNNING)&&(t??=new Map(e),t.set(n,{...r,status:yW.ERROR,recoverable:!0,errorCode:or.CONNECTION_LOST}));return t??e})},[c]),(0,Q.useEffect)(()=>{if(!c)return;let e=o(Bn.FLOWS_ACTORS_STARTED,e=>{hW(`Execution started`,{executionId:e.executionId}),k(e.executionId,e=>({...e,status:yW.RUNNING}))}),t=o(Bn.FLOWS_ACTORS_MESSAGE,e=>{hW(`Execution message`,{executionId:e.executionId,type:e.messageType,messageId:e.messageId,isFinal:e.isFinal});let t=p.safeParse(e.data);if(t.success){let{approvalId:n,toolName:r}=t.data;hW(`Approval requested`,{executionId:e.executionId,approvalId:n,toolName:r}),k(e.executionId,e=>({...e,status:yW.AWAITING_APPROVAL,answeredApproval:void 0,pendingApproval:SW(t.data)}))}k(e.executionId,t=>({...t,messages:vW(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(Bn.FLOWS_ACTORS_COMPLETED,e=>{hW(`Execution completed`,{executionId:e.executionId,status:e.status,duration:e.duration}),k(e.executionId,t=>({...t,status:xW(e.status),pendingApproval:void 0,duration:e.duration,...e.usage?{usage:e.usage}:{}}))}),r=o(Bn.FLOWS_ACTORS_ERROR,e=>{hW(`Execution error`,{executionId:e.executionId,errorCode:e.errorCode,recoverable:e.recoverable}),k(e.executionId,t=>{if(e.recoverable&&e.errorCode===or.APPROVAL_MODIFICATION_REJECTED&&t.answeredApproval)return{...t,status:yW.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===or.APPROVAL_REASON_CODE_REJECTED&&t.answeredApproval)return{...t,status:yW.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===or.SERVICE_CONSENT_REQUIRED&&t.answeredApproval)return{...t,status:yW.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===or.DECISION_PENDING&&n!==void 0&&n===e.waitingDecisionRef?t:{...t,status:yW.ERROR,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:void 0,answeredApproval:void 0}})});return()=>{e(),t(),n(),r()}},[c,o,k]);let ne=(0,Q.useMemo)(()=>({systems:d,autonomousAgents:m,chatAgents:g,chatConnectionRefs:v,requestAgentDeclarations:z,isLoading:b,error:S,executions:w,startExecution:N,respondToApproval:P,answerQuestion:F,cancelExecution:ee,clearExecution:R,getExecution:I,getSystem:L,refreshSystems:A,fetchConversationHistory:j,deleteConversation:M}),[d,m,g,v,z,b,S,w,N,P,F,ee,R,I,L,A,j,M]);return(0,$.jsx)(CW.Provider,{value:ne,children:e})};function TW(){let e=(0,Q.useContext)(CW);if(!e)throw Error(`useFlowsActors must be used within a FlowsActorsProvider`);return e}function EW(){return(0,Q.useContext)(CW)}var DW={[Ya.AGENT_NOT_REGISTERED]:`refusalAgentNotRegistered`,[Ya.TOOL_NOT_DECLARED]:`refusalToolNotDeclared`,[Ya.TOOL_NO_LONGER_GATED]:`refusalToolNoLongerGated`,[Ya.APPROVAL_ROUTE_CHANGED]:`refusalApprovalRouteChanged`,[Ya.AGENT_NOT_ACTIVE]:`refusalAgentNotActive`,[Ya.AGENT_SUSPENDED]:`refusalAgentSuspended`,[Ya.CONTENT_POLICY_TIGHTENED]:`refusalContentPolicyTightened`,[Ya.AGENT_STANDING_UNREADABLE]:`refusalAgentStandingUnreadable`,[Ya.ARGUMENTS_INVALID]:`refusalArgumentsInvalid`,[Ya.ARGUMENTS_NOT_RUN_AS_WRITTEN]:`refusalArgumentsNotRunAsWritten`,[Ya.ARGUMENTS_CANNOT_BE_CORRECTED]:`refusalArgumentsCannotBeCorrected`,[Ya.CREDENTIAL_NOT_ACCEPTED]:`refusalCredentialNotAccepted`,[Ya.SIGNING_KEY_NOT_CONFIGURED]:`refusalSigningKeyNotConfigured`,[Ya.CALL_NOT_REWRITABLE]:`refusalCallNotRewritable`,[Ya.RECORD_NOT_REACHABLE]:`refusalRecordNotReachable`,[Ya.DELIVERABLE_FILE_NOT_EDITABLE]:`refusalDeliverableFileNotEditable`},OW=`refusalReasonUnstated`,kW=new Set(Object.values(Ya));function AW(e,t){return t(kW.has(e.reason)?DW[e.reason]:OW,{toolName:e.toolName??``,arguments:(e.argumentPaths??[]).join(`, `)})}var jW=5;function MW(e,t,n){let r={arguments:(e.argumentNames??[]).join(`, `)||t(`noticeTheseArguments`)};return{[ei.APPLIED]:void 0,[ei.NOT_ACTIONABLE]:e.reason===Ur.PRESENTATION_STALE?t(`noticePresentationStale`):e.reason===Ur.CLOCK_ALREADY_PAUSED?t(`noticeClockAlreadyPaused`):e.reason===Ur.CLOCK_NOT_PAUSED?t(`noticeClockNotPaused`):e.reason===Ur.PAUSE_STATE_NOT_DECLARED?t(`noticePauseStateNotDeclared`):t(`noticeNotActionable`),[ei.LAPSED]:t(`noticeLapsed`),[ei.REQUESTER_AUTHORITY_LAPSED]:t(`noticeRequesterAuthorityLapsed`),[ei.MODIFICATION_REJECTED]:e.reason===Ur.EDITED_CALL_NOT_REACHABLE?t(`noticeEditedCallNotReachable`,r):e.reason===Ur.CALL_NOT_RUN_AS_READ?t(`noticeCallNotRunAsRead`,r):e.reason===Ur.CREDENTIAL_NOT_ACCEPTED?t(`noticeCredentialNotAccepted`,r):e.reason===Ur.CALL_CANNOT_RUN?NW(e,t,n):e.reason===Ur.ARGUMENTS_CANNOT_BE_CORRECTED?t(`noticeArgumentsCannotBeCorrected`,r):t(`noticeModificationRejected`),[ei.REASON_CODE_REJECTED]:t(`noticeReasonCodeRejected`),[ei.CONSENT_REQUIRED]:t(`noticeConsentRequired`),[ei.TARGET_REFUSED]:e.reason===Ur.NO_TARGET?t(`noticeNoEscalationTarget`):t(`noticeTargetRefused`),[ei.SUPERSEDED]:t(`noticeSuperseded`)}[e.kind]}function NW(e,t,n){let r=e.callRefusalReason!==void 0&&Object.hasOwn(DW,e.callRefusalReason)?DW[e.callRefusalReason]:void 0;return r===void 0?t(`noticeCallCannotRun`):t(r,{toolName:n??``,arguments:(e.argumentNames??[]).join(`, `)})}function PW(e,t){let n=e.find(e=>e.decisionRef===t)?.presentationId;return n?{presentationId:n}:{}}function FW(e,t){if(e&&e.length!==0)return e.map(e=>({value:e,label:t(ute,e)}))}function IW(e,t){return t(un.HUMAN_DECISION_PAUSE_STATE,e)}var LW=[ac.SYSTEM_ENUMS,ac.ROLES],RW=[];function zW({executionId:e,...t}){let{executions:n,respondToApproval:r,answerQuestion:i}=TW(),[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}=qW(Q.useMemo(()=>f?[f]:[],[f]),RW),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=>_(U.LOW_LEVEL_AI_APPROVAL,e),[_]);if(Q.useEffect(()=>{o(null)},[d]),!u||!d)return s?(0,$.jsx)(iM,{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=UW(F?.title??wt({plane:kr.CONVERSATIONAL,toolName:E??``}).title,p,m,h,g);l.current=d.decisionRef?{decisionRef:d.decisionRef,title:I}:null;let L=j===void 0||j===An.OWNER;return P?(0,$.jsx)(iW,{approvalId:C,actionDescription:P.title,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:L,question:GW(P,S),onAnswer:x,isProcessing:a===C,...t}):(0,$.jsx)(iW,{approvalId:C,actionDescription:I,riskLevel:w,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:L,actionNotice:L?N?_(U.LOW_LEVEL_AI_APPROVAL,`noticeReasonCodeRejected`):void 0:_(U.LOW_LEVEL_AI_APPROVAL,`awaitingReview`),reasonCodeOptions:L?FW(M,v):void 0,allowArgumentModification:L,toolName:E,toolLabel:E?h(E):void 0,executionContext:D,presentedArguments:d.presentation?Tr(d.presentation):void 0,argumentsSchema:O,argumentModificationError:k?AW(k,(e,t)=>_(U.LOW_LEVEL_AI_APPROVAL,e,t)):void 0,rejectedArguments:A,onApprove:y,onDeny:b,isProcessing:a===C,...t})}function BW(e,t,n,r){return{[An.OWNER]:()=>t(`holderOwner`),[An.ASSIGNEE]:()=>e.claimedAt?t(`holderClaimedByYou`,{when:r(e.claimedAt)}):t(`holderAssignedToYou`),[An.ROLE]:()=>e.eligibleRole?t(`holderRole`,{role:n(e.eligibleRole)}):void 0}[e.kind]()}var VW={[gi.USER]:void 0,[gi.MACHINE]:`requesterAutonomousAgent`,[gi.DELEGATED_CLIENT]:`requesterConnectedApplication`};function HW(e,t){let n=VW[e];return n?t(n):void 0}function UW(e,t,n,r,i=(e,t)=>`${ac.RESOURCES}.${e}.operations.${t}.${Gs.TITLE}`){switch(e.kind){case ui.LABEL:return e.params?t(e.labelRef,Object.fromEntries(Object.entries(e.params).map(([e,a])=>[e,typeof a==`object`?UW(a,t,n,r,i):String(a)]))):t(e.labelRef);case ui.ROLE:return n(e.roleKey);case ui.TOOL:return r(e.toolName);case ui.RESOURCE_OPERATION:return i(e.resourceType,e.operationIdentifier);case ui.TEXT:return e.text;default:return e}}function WW(e,t,n=e=>e,r=e=>e,i){let a=e.presentation?{presentedArguments:Tr(e.presentation)}:{},o=UW(e.presentation?.title??wt(e).title,t,n,r,i);return e.plane===kr.OPERATION_APPROVAL&&e.operationApproval?{actionDescription:o,executionContext:e.operationApproval.requestedValues,...a}:e.plane===kr.REPRESENTATIVE_ADMISSION&&e.representativeAdmission||Cn(e)?{actionDescription:o}:{actionDescription:o,toolName:e.toolName,toolLabel:r(e.toolName),executionContext:e.toolArgs,...a}}function GW(e,t){return{description:e.description,options:e.options.map(e=>({ref:e.ref,label:UW(oee(e),t,e=>e,e=>e),intent:e.intent,...e.description?{description:e.description}:{}})),fields:e.fields,...e.form?{form:e.form}:{}}}function KW(e,t){if(e.request&&Cn(e))return GW(e.request,t)}function qW(e,t){let n=Q.useMemo(()=>[...LW,...e.map(Bi),...t.map(e=>`${ac.RESOURCES}.${e}`)],[e,t]),{t:r,tComponent:i,tRole:a,tSystemEnum:o,tResourceOperation:s,formatDateTime:c}=J({component:U.LOW_LEVEL_AI_APPROVAL,keys:n});return{t:Q.useCallback((e,t)=>i(U.LOW_LEVEL_AI_APPROVAL,e,t),[i]),roleLabel:Q.useCallback(e=>a?a(e,`label`):e,[a]),toolLabel:Q.useCallback(e=>{let t=cee(e,Aee.TITLE),n=r(t);return n===t||n.length===0?e:n},[r]),operationLabel:Q.useCallback((e,t)=>s(e,t,Gs.TITLE),[s]),tComponent:i,tSystemEnum:o,formatDateTime:c}}function JW(e,t){let n=new URLSearchParams(t).get(ht);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 YW(e){let{decisions:t,readState:n,refresh:r,act:i,candidates:a}=pW(),o=Q.useMemo(()=>JW(t,window.location.search),[t]),{t:s,roleLabel:c,toolLabel:l,operationLabel:u,tSystemEnum:d,formatDateTime:f}=qW(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.useRef(new Map),C=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===Qe.ANSWER&&a.kind===ei.APPLIED&&b(t=>[{decisionRef:e,...r?{title:r}:{}},...t.filter(t=>t.decisionRef!==e)].slice(0,jW));let o=MW(a,s,S.current.get(e));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]),w=Q.useMemo(()=>o.map(e=>({approvalId:e.decisionRef,executionId:e.executionId,systemRef:e.systemRef,systemName:e.systemDisplayName,riskLevel:e.riskLevel,question:KW(e,s),holderNotice:BW(e.route,s,c,f),requesterNotice:HW(e.requesterKind,s),...WW(e,s,c,l,u),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,createdAt:new Date(e.requestedAt),canEscalate:e.permittedActs.includes(Qe.ESCALATE)&&e.declaresEscalationTarget,canClaim:e.permittedActs.includes(Qe.CLAIM),canUnclaim:e.permittedActs.includes(Qe.UNCLAIM),canReassign:e.permittedActs.includes(Qe.REASSIGN),reassignCandidates:_.get(e.decisionRef),actionNotice:h.get(e.decisionRef),canPauseClock:e.permittedActs.includes(Qe.PAUSE_CLOCK)&&!e.clockPause&&e.pauseStates.length>0,canResumeClock:e.permittedActs.includes(Qe.RESUME_CLOCK)&&!!e.clockPause,pauseStateOptions:e.pauseStates.map(e=>({value:e,label:IW(e,d)})),deadlineNotice:e.nextDeadline?s(e.nextDeadline.kind===Hi.CLAIM?`deadlineClaimBy`:`deadlineDecisionBy`,{when:f(e.nextDeadline.dueAt)}):void 0,clockPausedNotice:e.clockPause?s(`clockPausedIn`,{pauseState:IW(e.clockPause.pauseStateRef,d)}):void 0,reasonCodeOptions:FW(e.reasonCodes,d),allowArgumentModification:e.plane===kr.CONVERSATIONAL,argumentsSchema:e.toolInputSchema})),[o,_,h,s,c,l,u,d,f]);x.current=new Map(w.flatMap(e=>typeof e.actionDescription==`string`?[[e.approvalId,e.actionDescription]]:[])),S.current=new Map(w.flatMap(e=>e.toolLabel?[[e.approvalId,e.toolLabel]]:[]));let T=Q.useCallback((e,t,n,r,i)=>{let a=o.find(t=>t.decisionRef===e)?.plane,c=a?xee[a]:void 0;if(!c){g(t=>new Map(t).set(e,s(`noticeNotActionable`)));return}let l=t?c.approve:c.deny;C(e,Qe.ANSWER,{answer:{decisionId:e,optionRef:l,values:[]},...PW(o,e),...n?{reason:n}:{},...r?{modifiedToolArgs:r}:{},...i?{reasonCode:i}:{}})},[C,o,s]),E=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)(aW,{items:w,onApprove:(e,t,n,r)=>T(e,!0,t,n,r),onDeny:(e,t,n)=>T(e,!1,t,void 0,n),onEscalate:(e,t)=>void C(e,Qe.ESCALATE,t?{reason:t}:{}),onAnswer:(e,t,n,r,i)=>void C(e,Qe.ANSWER,{answer:{decisionId:e,optionRef:t,values:[...n]},...PW(o,e),...r?{reason:r}:{},...i?{reasonCode:i}:{}}),onClaim:e=>void C(e,Qe.CLAIM,{}),onUnclaim:e=>void C(e,Qe.UNCLAIM,{}),onReassignOpen:E,onReassign:(e,t,n)=>void C(e,Qe.REASSIGN,{targetUserId:t,...n?{reason:n}:{}}),onPauseClock:(e,t)=>void C(e,Qe.PAUSE_CLOCK,{pauseStateRef:t}),onResumeClock:e=>void C(e,Qe.RESUME_CLOCK,{}),processingIds:p,isLoading:n===fW.LOADING,loadFailed:n===fW.FAILED,onRetry:()=>{r()},...e}),y.map(e=>(0,$.jsx)(iM,{decisionRef:e.decisionRef,...e.title?{description:e.title}:{}},e.decisionRef))]})}function XW(){return(0,$.jsx)(QU,{children:(0,$.jsx)(Yk,{name:`decisions`,appearance:Xt.CARD,children:(0,$.jsx)(YW,{})})})}function ZW(e){return e.operationFrontendConfig?.customView}function QW(e){return e.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey}var $W=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=J({component:U.RESOURCES_LAYOUTS_ACTION});return i?(0,$.jsx)(mV,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceLayoutPreset_Action_Default`}):null};function eG({preset:e,...t}){let n=ZW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=QW(t.resourceContext.operation),i=e??r??G.DEFAULT,a=q(U.RESOURCES_LAYOUTS_ACTION,`ResourceLayout_Action`)(i);return(0,$.jsx)(a,{...t})}var tG=rc(U.LOW_LEVEL_DIALOG,`Dialog`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function nG({preset:e=G.DEFAULT,...t}){let n=tG(e);return(0,$.jsx)(n,{...t})}var rG=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=tG(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});rG.displayName=`DialogTrigger`;var iG=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=tG(e);return(0,$.jsx)(r.Content,{...t,ref:n})});iG.displayName=`DialogContent`;function aG({preset:e=G.DEFAULT,...t}){let n=tG(e);return(0,$.jsx)(n.Close,{...t})}function oG({preset:e=G.DEFAULT,...t}){let n=tG(e);return(0,$.jsx)(n.Header,{...t})}function sG({preset:e=G.DEFAULT,...t}){let n=tG(e);return(0,$.jsx)(n.Footer,{...t})}var cG=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=tG(e);return(0,$.jsx)(r.Title,{...t,ref:n})});cG.displayName=`DialogTitle`;var lG=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=tG(e);return(0,$.jsx)(r.Description,{...t,ref:n})});lG.displayName=`DialogDescription`;function uG({open:e,onAcknowledge:t,fields:n,resourceType:r}){let{tComponent:i,tResourceFieldDisplay:a,isReady:o}=J({component:U.RESOURCES_LAYOUTS_CREATE,resource:r}),s=Q.useRef(n);if(s.current=n,(0,Q.useEffect)(()=>()=>{s.current=[]},[]),!o)return null;let c=bp({tComponent:i,componentType:U.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.title`}),l=bp({tComponent:i,componentType:U.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.warning`}),u=bp({tComponent:i,componentType:U.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.acknowledge`});return(0,$.jsx)(nG,{open:e,onOpenChange:()=>{},children:(0,$.jsxs)(iG,{className:`sm:max-w-lg`,onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),showCloseButton:!1,children:[(0,$.jsxs)(oG,{children:[(0,$.jsx)(cG,{className:`text-warning-foreground`,children:c}),(0,$.jsx)(lG,{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)(sG,{children:(0,$.jsx)(X,{onClick:t,children:u})})]})})}var dG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=J({component:U.RESOURCES_LAYOUTS_CREATE}),{resourceType:a,operation:o,resourceConfig:s,isSemanticCustomOperation:c,navigateToPreferredRead:l,reportError:u,goBackWithinZone:d}=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),f=bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_CREATE,key:`formSubmissionFailed`}),p=bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_CREATE,key:`semanticOperationFailed`}),{closeOverlay:m}=SS(),h=e.additionalContext?.defaultValuesOverride,g=!!e.additionalContext?.quickCreateRequest,[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(n=>{if(g)t===Vn.OVERLAY?m():d();else if(s){if(n){let r=n._id||n[s.resourceFieldIdentifier];if(r){l({contextResourceIdentifiers:En.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,a,String(r)),fallbackToGoBack:!1,transitionOverride:t===Vn.OVERLAY?Ka.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=US(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===Vn.OVERLAY?()=>m():void 0,[t,m]);return i?c?(0,$.jsx)(mV,{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)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(vB,{resourceContext:e,defaultValuesOverride:h,navigationZone:t,onSuccess:b,onError:S,onCancel:C,showErrorSummary:!0}),_&&(0,$.jsx)(uG,{open:!0,onAcknowledge:x,fields:_.fields,resourceType:a})]}):null};function fG({preset:e,...t}){let n=ZW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=QW(t.resourceContext.operation),i=e??r??G.DEFAULT,a=q(U.RESOURCES_LAYOUTS_CREATE,`ResourceLayout_Create`)(i);return(0,$.jsx)(a,{...t})}var pG=700;function mG(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},pG))},[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 hG=qc.HIDDEN;function gG(e){let{resourceType:t,resourceConfig:n,data:r,hostIdentifiers:i}=e,a={...i??{}},o=n?.resourcePrimaryScope;if(o){let e=r[Ce[o]];typeof e==`string`&&e.length>0&&(a[Ji[o]]=e)}let s=n?.resourceFieldIdentifier,c=s?V.getResourceObjectId(r,s):void 0;return c&&(a[t]=c),a}function _G({resourceType:e,schema:t,data:n,className:r,primaryLabel:i=null,contextResourceIdentifiers:a}){let{registry:o}=pm(),s=(0,Q.useMemo)(()=>o.resourceConfigurations[e],[o,e]),c=(0,Q.useMemo)(()=>gG({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??ZR(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:K.READ}}),[e]);return(0,$.jsx)(IA,{kind:PA.SUMMARY,children:(0,$.jsx)(vge,{value:h,children:(0,$.jsx)(WA.Provider,{value:f===void 0,children:(0,$.jsx)(BB,{schema:t,data:n,resourceType:e,resourceId:u,contextResourceIdentifiers:c,contextualParameters:l,className:r,labels:g,disableInlineEdit:!0,layoutTemplate:p,defaultDisplayChromeMode:f??hG,isLoading:!1})})})})}_G.displayName=`ResourceSummaryDisplayer`;var vG=_G;function yG({className:e,children:t}){return(0,$.jsx)(`div`,{className:W(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item`,`[&>*]:w-auto`,e),children:t})}var bG=`a[href], button, input, select, textarea, summary, [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"], [role="option"], [role="tab"]`;function xG(e){let t=e.target,n=e.currentTarget;if(!(t instanceof Element)||t===n)return!1;let r=t.closest(bG);return r!==null&&r!==n&&n.contains(r)}var SG=`15rem`,CG=`border border-border rounded-lg divide-y divide-border list-none m-0 p-0`,wG=`px-card py-card-sm`,TG=`ps-card`,EG=`flex items-start gap-element-sm`,DG=`border-s border-transparent ${TG}`,OG=`grid gap-element list-none m-0 p-0`;function kG(e){return e===void 0?CG:W(OG)}function AG(e){if(e===void 0)return;let t=Math.min(Math.max(Math.trunc(e),1),6);return{gridTemplateColumns:`repeat(auto-fill, minmax(max(${SG}, ${`calc((100% - ${t-1} * var(--spacing-element)) / ${t})`}), 1fr))`}}var jG={vertical:du.MIDDLE,horizontal:sl.END,orientation:Ks.HORIZONTAL},MG={[du.TOP]:`items-start`,[du.MIDDLE]:`items-center`,[du.BOTTOM]:`items-end`};function NG(e=jG){let{vertical:t,horizontal:n,orientation:r=Ks.HORIZONTAL}=e,i=r===Ks.VERTICAL?`flex flex-col gap-element-sm`:`flex gap-element-sm`;return n===sl.MIDDLE?{containerClass:`flex ${t===du.TOP?`flex-col-reverse`:`flex-col`} gap-element-sm`,contentClass:`min-w-0`,actionsClass:`${i} self-center`}:{containerClass:`flex ${n===sl.START?`flex-row-reverse`:``} ${MG[t]} gap-element-sm`.replace(/\s+/g,` `).trim(),contentClass:`min-w-0 flex-1`,actionsClass:`${i} shrink-0`}}var PG=async()=>{throw Error(`A collection cell does not edit in place.`)};function FG(e){let t=dj(),n=bm()?.registry,{resourceType:r,record:i,collectionContextResourceIdentifiers:a}=e;return(0,Q.useMemo)(()=>{if(!n||!i)return t;let e=gG({resourceType:r,resourceConfig:n.resourceConfigurations[r],data:i,hostIdentifiers:a??t.contextResourceIdentifiers});return{...t,resourceType:r,resourceId:En.getResourceId(e[r])||void 0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,n),canInlineEdit:!1,doInlineUpdate:PG,defaultInlineEdit:void 0,fileUploadContext:void 0,rmm:null}},[t,n,i,r,a])}function IG({fieldName:e,value:t,fieldSchema:n,fieldLabel:r,resourceType:i,record:a,collectionContextResourceIdentifiers:o,tResourceFieldEnumValue:s,fieldLabelVisible:c=!1}){let l=FG({resourceType:i,record:a,collectionContextResourceIdentifiers:o}),u=(0,Q.useMemo)(()=>{let t=n?Kc(n):void 0;if(!t)return;let r=Hs(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:br.MUTED,size:gc.XS,children:[r,`:`]}):(0,$.jsxs)(`span`,{className:`sr-only`,children:[r,`: `]})),n?(0,$.jsx)(uj.Provider,{value:l,children:(0,$.jsx)(ok,{displayChromeMode:qc.COMPACT,children:(0,$.jsx)(SR,{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 LG({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(rs.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}=J({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?mr.getObjectLikeFieldShape(T,{commonOnly:!1})??null:null,[T]),D=Q.useContext($g),O=D?.UIConfig?.currentBreakpoint??yi.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?Kt(t):void 0,present:!0,declaredChrome:t?UA(Jo(t)?.chromeMode,O):void 0}})),[k,w,E,O]),j=n?.frontendConfiguration?.layout?.summary,M=_?.hover??``,N=_?.transition??``,P=NG(u),F=D?.UIConfig?.currentBreakpoint===yi.MOBILE,I=d&&m&&F,L=mG(()=>p?.(e),{enabled:d&&!!p&&F}),ee=!!c||I,R=()=>{L.consumeLongPress()||(I?p?.(e):c?.(e))};return(0,$.jsxs)(`div`,{"data-slot":`resource-list-item`,className:W(`group/list-item`,wG,N,ee&&`relative`,ee&&M,ee&&`cursor-pointer`,f&&`bg-primary/5`,d&&`select-none`,g),onClick:ee?e=>{xG(e)||R()}:void 0,...L.handlers,children:[ee&&(0,$.jsx)(`button`,{type:`button`,"aria-label":String(C),className:W(`absolute inset-0 rounded-[inherit] outline-none`,Ag(r_.INSET)),onClick:e=>{e.stopPropagation(),R()}}),(0,$.jsxs)(`div`,{className:W(EG,ee&&`relative`),children:[d&&(0,$.jsx)(`div`,{className:W(`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)(OI,{checked:f,onCheckedChange:()=>p?.(e),"aria-label":h??String(C)})}),(0,$.jsxs)(`div`,{className:W(P.containerClass,`min-w-0 flex-1`),children:[(0,$.jsx)(`div`,{className:W(`space-y-item-xs`,P.contentClass),children:j&&T?(0,$.jsx)(vG,{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)(yG,{children:w.map((n,r)=>{let a=e[n];return(0,$.jsx)(IG,{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 RG({navigationZone:e,className:t}){let n=Ix(),{tComponent:r}=J({component:U.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:W(`p-container`,t),children:(0,$.jsx)(hV,{resourceContext:a.resourceContext,navigationZone:e,onSuccess:i,onCancel:i,errorMessage:bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceInPlaceOperationRow`})}):null}var zG;(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`})(zG||={});var BG=new Set;function VG(e,t){return HG(e,t,Hl)}function HG(e,t,n){if(!e)return BG;let r=new Set;for(let i of[e,...pl(t)]){let e=mr.getObjectLikeFieldShape(i,{commonOnly:!1});for(let[t,i]of Object.entries(e??{}))n(i)&&r.add(t)}return r.size>0?r:BG}var UG=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(!bee(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?Ce[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=HG(a?.mainSchema,a?.inheritenceSchemaDefinition,Ga),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=Kt(t),c=zG.UNKNOWN;if(lre(t)){s.push({fieldName:e,schema:t,fieldType:zG.NUMBER_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}if(dee(t)){s.push({fieldName:e,schema:t,fieldType:zG.YEAR_MONTH_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}let l,u;switch(a){case B.STRING:c=zG.STRING;break;case B.NUMBER:case B.BIGDECIMAL:c=zG.NUMBER;break;case B.BOOLEAN:c=zG.BOOLEAN;break;case B.ENUM:c=zG.ENUM;try{l=Hs(Zt(t))}catch{l=[]}break;case B.DATE:case B.DATETIME:c=zG.DATE;break;default:c=zG.STRING}if(c===zG.STRING&&n){let t=n.registry.fieldIdentifierToResourceType?.[e];t&&(c=zG.REFERENCE,u=t)}c===zG.STRING&&(Ga(t)||o.has(e))&&(c=zG.YEAR_MONTH),s.push({fieldName:e,schema:t,fieldType:c,enumValues:l,referenceTargetResourceType:u})}return s}},WG=new Set([K.LIST,K.SEARCH,K.COUNT]);function GG(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&&Xl.resolveForeignKeyHolderResourceType(t)===e.targetResourceType).map(t=>({relationship:t,foreignKeyField:Xl.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier})).filter(t=>e.selectedForeignKey===void 0||t.foreignKeyField===e.selectedForeignKey)}var KG;(function(e){e.NAMES_HOST=`names_host`,e.OTHER=`other`,e.NO_ROUTE=`no_route`})(KG||={});function qG(e){return JG(e)===KG.NAMES_HOST}function JG(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)?KG.NAMES_HOST:KG.OTHER:KG.NO_ROUTE}function YG(e,t){return V.buildConfigurationError(rs.CONFIGURATION,{message:e,component:`confineRelatedCollectionToHost`,...t})}function XG(e,t,n){let r=n.resourceConfigurations[t]?.operations??[];return new Set(Object.keys(wS(e,r)??{}))}function ZG(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??vc.MANDATORY,isPrimaryScope:r?.isPrimaryScope??!1,...r?.primaryScope?{primaryScope:r.primaryScope}:{}}}),h={...t,contextResourceIdentifiers:f,parentResourcesRequirements:m};if(qG({childContext:h,hostResourceType:n,hostResourceId:r,registry:a,edgeForeignKeyFields:i}))return h}}function QG(e){let{childContext:t,hostResourceId:n,callerPinnedFilters:r,registry:i}=e,{operation:a}=t,o=a.isBulkOperation===!0?void 0:bl(a);if(!o||!WG.has(o))return t;if(r&&Object.keys(r).length>0){let a=tK(t,r,i,eK.CALLER);if(!n)return a;try{return $G({...e,childContext:a,hostResourceId:n})}catch(e){if(e.wildoError?.context?.conflictingKey!==void 0)throw e;return a}}return n?$G({...e,hostResourceId:n}):t}function $G(e){let{childContext:t,hostResourceType:n,hostResourceId:r,hostRelationships:i,selectedForeignKey:a,registry:o}=e,{operation:s,resourceType:c}=t,l=i?GG({hostResourceType:n,hostRelationships:i,targetResourceType:c,selectedForeignKey:a,registry:o}):[];if(a!==void 0&&l.length===0)throw YG(`"${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=JG({childContext:t,hostResourceType:n,hostResourceId:r,registry:o,edgeForeignKeyFields:u});if(d===KG.NAMES_HOST)return t;let f=l.length<=1?ZG({childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:u,registry:o}):void 0;if(f)return f;if(d===KG.NO_ROUTE)return t;if(l.length===0)throw YG(`"${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 YG(`"${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 YG(`"${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 tK(t,{[p]:r},o,eK.RELATIONSHIP,n)}var eK;(function(e){e.CALLER=`caller`,e.RELATIONSHIP=`relationship`})(eK||={});function tK(e,t,n,r,i){let a=r===eK.CALLER?`the embed's own filter`:`the relationship's foreign key`,{operation:o,resourceType:s}=e;if(bl(o)===K.COUNT)throw YG(`"${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=XG(o,s,n),l=Object.keys(t).find(e=>!c.has(e));if(l!==void 0&&r===eK.CALLER)throw YG(`"${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 YG(`"${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 YG(`"${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 nK(e){let{searchOperation:t}=e;if(!t)return!1;let n=Object.keys(e.pinnedFilters??{});if(n.length>0){let r=XG(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 rK(e){let t=e?.wildoError?.context?.message;return typeof t==`string`&&t.length>0?t:e instanceof Error?e.message:void 0}var iK=({pagination:e,onPaginationChange:t,className:n})=>{let{tComponent:r,isReady:i}=J({component:U.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(U.RESOURCES_LAYOUTS_PAGINATION,`paginationLabel`),className:W(`flex items-center justify-between`,n),children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"aria-live":`polite`,children:r(U.RESOURCES_LAYOUTS_PAGINATION,`showing`,{from:a,to:o,total:e.total})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,disabled:e.page<=1,"aria-label":r(U.RESOURCES_LAYOUTS_PAGINATION,`previousPage`),onClick:s,children:r(U.RESOURCES_LAYOUTS_PAGINATION,`previous`)}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,disabled:e.page>=e.totalPages,"aria-label":r(U.RESOURCES_LAYOUTS_PAGINATION,`nextPage`),onClick:c,children:r(U.RESOURCES_LAYOUTS_PAGINATION,`next`)})]})]})};function aK({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_PAGINATION,`ResourceLayout_Pagination`)(e);return(0,$.jsx)(n,{...t})}function oK(e,t){let n=Sc();return vm(n.interactiveState?.emptyDisplay)===`placeholder`&&sK(e,t)}function sK(e,t){return e?.primaryAction!==!1&&t}var cK=q(U.RESOURCES_LAYOUTS_EMPTY_STATE,`ResourceEmptyState`);function lK({resourceType:e,config:t,hasCreateOperation:n=!1,onCreateAction:r,variant:i=`default`,title:a,description:o,preset:s=G.DEFAULT}){let{tResourceEmptyState:c,tResourceOperation:l,tComponent:u,isReady:d}=J({component:[U.RESOURCES_LAYOUTS_EMPTY_STATE,U.RESOURCES_LAYOUTS_LIST],resource:e}),{activateFlow:f}=xU(),p=Sc(),m=vm(p.interactiveState?.emptyDisplay),h=(0,Q.useMemo)(()=>a||c(e,`title`)||bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_LIST,key:`noItems`}),[a,e,c,u]),g=(0,Q.useMemo)(()=>a?o:c(e,`description`),[a,o,e,c]),_=sK(t,n),v=(0,Q.useMemo)(()=>{if(_)return l(e,K.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===k.LINK)return{label:i,onClick:()=>{window.open(r,`_blank`,`noopener,noreferrer`)}};if(n===k.GUIDANCE)return{label:i,onClick:()=>f(r)}},[t?.secondaryAction,e,c,f]),x=cK(s);return!d||m===`render-children`||Foe(m)?null:(0,$.jsx)(x,{title:h,description:g,iconRef:y,primaryActionLabel:v,onPrimaryAction:_?r:void 0,showPrimaryAction:_,secondaryAction:b,variant:i,hidden:Xp(m),style:Xp(m)?{display:`none`}:void 0})}function uK(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function dK(e){return e.isSearchActive||Object.values(e.filterValues).some(uK)}function fK(e){return!(e.hasLoadedOnce&&e.itemCount===0&&!e.isNarrowed&&e.emptyStateOffersCreate)}var pK=300;function mK({enabled:e,debounceMs:t=pK,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 hK=({query:e,onChange:t,onClear:n,resourceType:r,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s})=>{let{tComponent:c,isReady:l}=J({component:U.RESOURCES_LAYOUTS_LIST}),{renderIcon:u}=kf(),d=u(H.SEARCH,{size:Jn.SM}),f=u(H.X_MARK,{size:Jn.SM});if(!l)return null;let p=c(U.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`);return(0,$.jsx)(tN,{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:Y.GHOST,size:Gd.ICON_SM,onClick:n,"aria-label":c(U.RESOURCES_LAYOUTS_LIST,`clearSearch`),className:`me-1`,children:f}):void 0})};function gK(e){let{resolvedRegionalPreferences:t}=J(),{registry:n}=pm(),r=n.resourceConfigurations[e],i=r?.mainSchema,a=r?.inheritenceSchemaDefinition,o=(0,Q.useMemo)(()=>VG(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 _K=864e5;function vK(e,t){return new Date(e.getTime()+t*_K)}function yK(e,t,n,r){let i=e=>n?e:ho.startOfZonedDay(e,r),a={};return e!==void 0&&(a.startDate=i(e)),t!==void 0&&(a.endDate=new Date(i(vK(t,1)).getTime()-1)),a}function bK(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 xK(e,t,n){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return;let r=e,i=bK(r.startDate),a=bK(r.endDate);if(!i&&!a)return;let o=e=>ho.calendarDateToday({timezone:t?`UTC`:n},e);return{firstDay:i?o(i):void 0,lastDay:a?o(a):void 0}}function SK(e){return typeof e==`string`&&Ma(e)!==void 0?e:void 0}function CK(e){let t=SK(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=SK(n),a=SK(r);return{...i===void 0?{}:{startMonth:i},...a===void 0?{}:{endMonth:a}}}function wK(e,t,n){let r={...CK(e)},i=SK(n);return i===void 0?delete r[t]:r[t]=i,r.startMonth===void 0&&r.endMonth===void 0?void 0:r}var TK={[Ps.TODAY]:e=>({firstDay:e,lastDay:e}),[Ps.YESTERDAY]:e=>({firstDay:vK(e,-1),lastDay:vK(e,-1)}),[Ps.LAST_7_DAYS]:e=>({firstDay:vK(e,-6),lastDay:e}),[Ps.LAST_30_DAYS]:e=>({firstDay:vK(e,-29),lastDay:e}),[Ps.THIS_MONTH]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),lastDay:e}),[Ps.THIS_YEAR]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),0,1)),lastDay:e}),[Ps.BEFORE_TODAY]:e=>({lastDay:vK(e,-1)}),[Ps.BEFORE_NOW]:e=>({lastDay:vK(e,-1)}),[Ps.NEXT_7_DAYS]:e=>({firstDay:e,lastDay:vK(e,6)}),[Ps.NEXT_30_DAYS]:e=>({firstDay:e,lastDay:vK(e,29)})},EK=new Set([Ps.BEFORE_NOW]),DK;(function(e){e.EXACT_BOUNDS=`exact_bounds`,e.ENDS_EARLIER_TODAY=`ends_earlier_today`})(DK||={});function OK(e,t,n,r){let i=r.calendarDateFields.has(t);return EK.has(e)&&!i?{window:{endDate:new Date(r.now.getTime())},readBack:DK.ENDS_EARLIER_TODAY}:{window:AK(TK[e](n),i,r.timeZone),readBack:DK.EXACT_BOUNDS}}function kK(e,t,n){if(!HK(e)||e.startDate!==void 0||e.endDate===void 0)return!1;let r=yK(t,void 0,!1,n.timeZone).startDate,i=e.endDate.getTime();return r!==void 0&&i>=r.getTime()&&i<=n.now.getTime()}function AK(e,t,n){return yK(e.firstDay,e.lastDay,t,n)}var jK={[Zs.THIS_MONTH]:e=>({first:e,last:e}),[Zs.LAST_MONTH]:e=>({first:e-1,last:e-1}),[Zs.NEXT_MONTH]:e=>({first:e+1,last:e+1}),[Zs.THIS_QUARTER]:e=>({first:e-e%3,last:e-e%3+2}),[Zs.LAST_QUARTER]:e=>({first:e-e%3-3,last:e-e%3-1}),[Zs.LAST_3_MONTHS]:e=>({first:e-2,last:e}),[Zs.LAST_12_MONTHS]:e=>({first:e-11,last:e}),[Zs.YEAR_TO_DATE]:e=>({first:e-e%12,last:e}),[Zs.THIS_YEAR]:e=>({first:e-e%12,last:e-e%12+11})};function MK(e){return Mn(Math.floor(e/12),e%12+1)}function NK(e,t){let n=jK[e](t.getUTCFullYear()*12+t.getUTCMonth());return{startMonth:MK(n.first),endMonth:MK(n.last)}}var PK={[Zc.CURRENT_USER]:e=>e.userId!==void 0&&e.userId.length>0?e.userId:void 0};function FK(e){return typeof e==`object`&&!!e&&`contextValue`in e}function IK(e){return typeof e==`object`&&!!e&&`relativeMonthRange`in e}function LK(e){return typeof e==`object`&&!!e&&`relativeRange`in e}function RK(e,t){let n=ho.calendarDateToday({timezone:t.timeZone},t.now),r={};for(let[i,a]of Object.entries(e.filters))if(LK(a))r[i]=OK(a.relativeRange,i,n,t).window;else if(IK(a))r[i]=NK(a.relativeMonthRange,n);else if(FK(a)){let e=PK[a.contextValue](t.viewer);if(e===void 0)return null;r[i]=e}else r[i]=a;return r}function zK(e,t){return Object.values(e.filters).every(e=>!FK(e)||PK[e.contextValue](t)!==void 0)}function BK(e,t){if(HK(t)){if(!HK(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(UK(t))return UK(e)&&e.min===t.min&&e.max===t.max;if(VK(t)||VK(e)){let n=CK(e),r=CK(t);return(n.startMonth!==void 0||n.endMonth!==void 0)&&n.startMonth===r.startMonth&&n.endMonth===r.endMonth}return e===t}function VK(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`&&Ma(t)!==void 0)}function HK(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 UK(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 WK(e,t,n){let r=RK(e,n);if(r===null)return!1;let i=Object.entries(r),a=ho.calendarDateToday({timezone:n.timeZone},n.now);return i.length>0&&i.every(([r,i])=>{let o=e.filters[r];return o!==void 0&&LK(o)&&OK(o.relativeRange,r,a,n).readBack===DK.ENDS_EARLIER_TODAY?kK(t[r],a,n):BK(t[r],i)})}function GK(e,t,n){let r=RK(e,n);if(r===null)return t;let i={...t};if(WK(e,t,n)){for(let e of Object.keys(r))delete i[e];return i}return{...i,...r}}function KK(e,t,n){let r=new Set;for(let i of e)if(WK(i,t,n))for(let e of Object.keys(i.filters))r.add(e);return r}var qK=/^(\d{4})-(\d{2})-(\d{2})$/;function JK(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=qK.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 YK(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=JK(t.startDate,n),a=JK(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=JK(e,n);return i?r(i):null}var XK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,presetFilters:i,className:a})=>{let{tResourceFieldDisplay:o,tResourceFieldEnumValue:s,tComponent:c,formatDate:l,isReady:u}=J({component:U.RESOURCES_LAYOUTS_FILTERS,resource:e}),{renderIcon:d}=kf(),f=e=>c(U.RESOURCES_LAYOUTS_FILTERS,e),p=gK(e),m=p.calendarDateFields,h=(0,Q.useMemo)(()=>{if(!i||i.length===0)return t;let e=KK(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:Jn.XS});return(0,$.jsxs)(`div`,{className:W(`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===zG.REFERENCE)o=(0,$.jsx)(ZK,{field:t,value:String(i)});else if(t.fieldType===zG.ENUM){let n=s(e,r,String(i),t.schema);typeof n==`string`&&(o=n)}else if(t.fieldType===zG.BOOLEAN)o=f(i?`booleanYes`:`booleanNo`);else if(t.fieldType===zG.YEAR_MONTH){let e=l(String(i),{yearMonth:!0});e!==``&&(o=e)}else if(t.fieldType===zG.YEAR_MONTH_RANGE){let{startMonth:e,endMonth:t}=CK(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===zG.DATE){let e=YK(i,l,m.has(t.fieldName));e!==null&&(o=e)}else if(t.fieldType===zG.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:Y.GHOST,size:Gd.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:Y.GHOST,size:Gd.SM,onClick:v,className:`text-xs text-muted-foreground`,children:f(`clearAll`)})]})},ZK=({field:e,value:t})=>{let{getDisplayLabel:n,isLoadingCurrentValue:r}=SV({schema:e.schema,name:e.fieldName,value:t,targetResourceType:e.referenceTargetResourceType});return r?(0,$.jsx)($.Fragment,{children:`…`}):(0,$.jsx)($.Fragment,{children:n(t)})};function QK(e,t){return(t?t.map(t=>e[t]):Object.values(e)).filter(e=>e!=null&&e!==``).length}var $K=`filters-panel`,eq=({activeCount:e,isExpanded:t,onToggle:n,className:r})=>{let{tComponent:i,isReady:a}=J({component:U.RESOURCES_LAYOUTS_FILTERS}),{renderIcon:o}=kf();if(!a)return null;let s=(e=>i(U.RESOURCES_LAYOUTS_FILTERS,e))(`filters`);return(0,$.jsxs)(X,{variant:Y.GHOST,size:Gd.SM,onClick:n,"aria-expanded":t,"aria-controls":$K,"aria-label":s,title:s,"data-slot":`collection-toolbar-filters-trigger`,className:W(`gap-element-sm`,r),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(H.FILTER,{size:Jn.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})]})},tq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFieldDisplay:a,tResourceFieldEnumValue:o,tComponent:s,resolvedRegionalPreferences:c,isReady:l}=J({component:U.RESOURCES_LAYOUTS_FILTERS,resource:e}),{timeZone:u,calendarDateFields:d}=gK(e),f=e=>s(U.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:$K,className:W(`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)(oq,{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))})},nq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let[a,o]=(0,Q.useState)(!1),s=QK(n,t.map(e=>e.fieldName));return t.length===0?null:(0,$.jsxs)(`div`,{className:W(`space-y-element-sm`,i),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm flex-wrap`,children:[(0,$.jsx)(eq,{activeCount:s,isExpanded:a,onToggle:()=>o(e=>!e)}),(0,$.jsx)(XK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]}),a&&(0,$.jsx)(tq,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]})},rq={[zc.TOGGLE]:Ku.TOGGLE,[zc.RADIO]:Ku.RADIO,[zc.SWITCH]:Ku.SELECT,[zc.CHECKBOX]:Ku.SELECT},iq;(function(e){e.ANY=``,e.YES=`true`,e.NO=`false`})(iq||={});function aq(e){return Vd(iq).enumUI({edit:{editMode:rq[Mr(e)]}})}var oq=({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)(()=>aq(e.schema),[e.schema]);switch(e.fieldType){case zG.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)(bI,{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:Jd.SM})]});case zG.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)(tN,{type:`text`,value:u,onChange:m})]});case zG.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)(tN,{type:`number`,value:u,onChange:h})]});case zG.BOOLEAN:{let r=[{value:iq.ANY,label:o(`booleanAny`)},{value:iq.YES,label:o(`booleanYes`)},{value:iq.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)(oI,{name:e.fieldName,schema:g,options:r,value:t===void 0?iq.ANY:String(t),onChange:e=>i(e===iq.ANY?void 0:e===iq.YES),controlSize:Jd.SM})]})}case zG.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)(oI,{name:e.fieldName,schema:e.schema,options:s,value:t??``,onChange:e=>i(e||void 0),controlSize:Jd.SM})]})}case zG.DATE:{let r=xK(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)(pN,{name:e.fieldName,schema:e.schema,value:a,onChange:e=>{let t=e?.from??e?.to;i(t?yK(t,e?.to??t,s,c):void 0)},placeholder:o(`anyValue`),dateFormat:l,timeZone:c,controlSize:Jd.SM})]})}case zG.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)(LI,{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:Jd.SM})]});case zG.YEAR_MONTH_RANGE:{let r=CK(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)(LI,{name:`${e.fieldName}.startMonth`,schema:e.schema,value:r.startMonth,onChange:e=>i(wK(t,`startMonth`,e)),clearable:!0,labelledBy:`${p} ${a}`,controlId:`${p}-start-month`,monthPlaceholder:o(`anyValue`),controlSize:Jd.SM}),(0,$.jsx)(`span`,{id:s,className:`text-xs text-muted-foreground`,children:o(`monthRangeEnd`)}),(0,$.jsx)(LI,{name:`${e.fieldName}.endMonth`,schema:e.schema,value:r.endMonth,onChange:e=>i(wK(t,`endMonth`,e)),clearable:!0,labelledBy:`${p} ${s}`,controlId:`${p}-end-month`,monthPlaceholder:o(`anyValue`),controlSize:Jd.SM})]})}case zG.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)(tN,{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)(tN,{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)(tN,{type:`text`,value:u,onChange:m})]})}},sq=`__wildo-quick-filter-all__`,cq=gd(),lq=`@max-[32rem]/collection-toolbar:hidden`,uq=`hidden @max-[32rem]/collection-toolbar:block`,dq=({resourceType:e,field:t,value:n,onChange:r,className:i})=>{let{tComponent:a,tResourceFieldDisplay:o,tResourceFieldEnumValue:s,isReady:c}=J({component:U.RESOURCES_LAYOUTS_FILTERS}),l=(0,Q.useCallback)(e=>{typeof e==`string`&&e!==``&&r(e===sq?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(U.RESOURCES_LAYOUTS_FILTERS,`enumAll`),p=a(U.RESOURCES_LAYOUTS_FILTERS,`quickFilterLabel`,{field:d}),m=[{value:sq,label:f},...u.map(n=>({value:n,label:s(e,t.fieldName,n,t.schema)}))],h=n??sq;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bO,{type:_O.SINGLE,value:h,onValueChange:l,size:Gd.SM,rovingFocus:!0,loop:!0,className:W(`justify-start`,lq,i),"data-slot":`collection-quick-filter`,"aria-label":p,children:m.map(e=>(0,$.jsx)(xO,{value:e.value,size:Gd.SM,children:e.label},e.value))}),(0,$.jsx)(`div`,{className:W(uq,i),"data-slot":`collection-quick-filter-select`,children:(0,$.jsx)(_F,{name:`quick-filter-${t.fieldName}`,schema:cq,options:m,value:h,onChange:e=>l(e),"aria-label":p,size:Jd.SM})})]})},Wge=({resourceType:e,presets:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFilterPreset:a}=J({component:U.RESOURCES_LAYOUTS_FILTERS}),o=new Date,s=gK(e),c=(0,Q.useMemo)(()=>t.filter(e=>WK(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(GK(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:Gd.SM,orientation:Ks.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:Gd.SM,"data-preset":t.ref,disabled:!zK(t,s.viewer),children:n},t.ref)})})},fq=rc(U.LOW_LEVEL_POPOVER,`Popover`,[`Trigger`,`Content`,`Anchor`]);function pq({preset:e=G.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n,{...t})}var mq=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=fq(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});mq.displayName=`PopoverTrigger`;var hq=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=fq(e);return(0,$.jsx)(r.Content,{...t,ref:n})});hq.displayName=`PopoverContent`;function gq({preset:e=G.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n.Anchor,{...t})}function Gge(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var Kge={activationConstraint:{distance:8}},qge={coordinateGetter:pF};function Jge({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}=dF({id:e.field,disabled:!n}),_=e.direction===`asc`,v={transform:Gge(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:W(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:bg-accent/50 hover:text-muted-foreground`,Ag(r_.OFFSET),`active:cursor-grabbing`),"aria-label":i,...d,...f,children:u(H.GRIP_VERTICAL,{size:Jn.SM})}),(0,$.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:r}),(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,size:Gd.SM,onClick:()=>c(t),className:`h-6 gap-1 px-2 text-xs`,children:[u(_?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:Jn.XS}),_?a:o]}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON_SM,className:`h-5 w-5 p-0 text-muted-foreground`,onClick:()=>l(t),"aria-label":s,children:u(H.X_MARK,{size:Jn.XS})})]})}var _q=({resourceType:e,sortFields:t,currentSorts:n,onSortChange:r,className:i})=>{let{tResourceFieldDisplay:a,tComponent:o,isReady:s}=J({component:U.RESOURCES_LAYOUTS_LIST,resource:e}),{renderIcon:c}=kf(),[l,u]=(0,Q.useState)(!1),d=tP(eP(NP,Kge),eP(kP,qge)),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(nF([...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(U.RESOURCES_LAYOUTS_LIST,e),x=n.length,S=x>1,C=c(H.ARROWS_UP_DOWN,{size:Jn.SM}),w=b(`sortAsc`),T=b(`sortDesc`),E=b(`removeSort`),D=b(`reorderSort`);return(0,$.jsxs)(pq,{open:l,onOpenChange:u,children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,size:Gd.SM,"aria-label":b(`sortLabel`),"data-slot":`collection-toolbar-sort-trigger`,className:W(`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)(hq,{align:jr.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:Y.GHOST,size:Gd.SM,onClick:y,className:`h-auto py-0.5 text-xs text-muted-foreground`,children:b(`clearSort`)})]}),(0,$.jsx)(eF,{sensors:d,collisionDetection:cP,onDragEnd:_,children:(0,$.jsx)(lF,{items:m,strategy:oF,children:(0,$.jsx)(`div`,{className:`space-y-element-sm`,children:n.map((e,t)=>(0,$.jsx)(Jge,{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:Y.GHOST,size:Gd.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:Jn.XS})}),f(e)]},e))})]})]})]})},vq=[{mode:vs.CARDS,icon:H.VIEW_LIST,labelKey:`viewCards`},{mode:vs.TABLE,icon:H.VIEW_TABLE,labelKey:`viewTable`},{mode:vs.BOARD,icon:H.VIEW_BOARD,labelKey:`viewBoard`},{mode:vs.CALENDAR,icon:H.VIEW_CALENDAR,labelKey:`viewCalendar`},{mode:vs.TIMELINE,icon:H.VIEW_TIMELINE,labelKey:`viewTimeline`}],Yge=[vs.CARDS,vs.TABLE],Xge=e=>vq.some(t=>t.mode===e),Zge=({viewMode:e,onViewModeChange:t,availableModes:n=Yge,className:r})=>{let{tComponent:i,isReady:a}=J({component:U.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=kf();if(!a)return null;let s=e=>i(U.RESOURCES_LAYOUTS_LIST,e);return(0,$.jsx)(bO,{type:_O.SINGLE,value:e,onValueChange:r=>{typeof r==`string`&&Xge(r)&&n.includes(r)&&r!==e&&t(r)},size:Gd.SM,"aria-label":s(`viewModeLabel`),className:W(`shrink-0`,r),"data-slot":`collection-view-mode`,children:vq.filter(({mode:e})=>n.includes(e)).map(({mode:e,icon:t,labelKey:n})=>{let r=s(n);return(0,$.jsx)(xO,{value:e,size:Gd.SM,"aria-label":r,title:r,children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(t,{size:Jn.SM})})},e)})})};function yq({count:e,onClear:t,matchAllOffer:n,isMatchAllSelected:r,className:i}){let{tComponent:a}=J({component:U.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=kf();return(0,$.jsxs)(`div`,{className:W(`flex items-center gap-element-sm`,i),"data-slot":`collection-selection`,children:[(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:W(`text-sm font-medium text-muted-foreground whitespace-nowrap`,e===0&&`sr-only`),children:e>0?a(U.RESOURCES_LAYOUTS_LIST,r?`allMatchingSelected`:`selectedCount`,{count:e}):``}),n&&!r&&(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Gd.SM,onClick:n.onSelectAllMatching,children:a(U.RESOURCES_LAYOUTS_LIST,`selectAllMatching`,{count:n.matchedCount})}),e>0&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON_SM,onClick:t,"aria-label":a(U.RESOURCES_LAYOUTS_LIST,`clearSelection`),children:o(H.X_MARK,{size:Jn.XS})})]})}function bq(e,t){return e===0||t===0?!1:t>=e||`indeterminate`}function xq({state:e,onToggle:t,className:n}){let{tComponent:r}=J({component:U.RESOURCES_LAYOUTS_LIST}),i=r(U.RESOURCES_LAYOUTS_LIST,`selectAll`);return(0,$.jsx)(`span`,{className:W(`inline-flex shrink-0 items-center`,DG,n),"data-slot":`collection-select-all`,title:i,children:(0,$.jsx)(OI,{checked:e,onCheckedChange:()=>t(),"aria-label":i})})}var Sq;(function(e){e.LABELLED=`labelled`,e.ICONS=`icons`,e.CAPPED=`capped`})(Sq||={});var Qge={[Sq.LABELLED]:Sq.ICONS,[Sq.ICONS]:Sq.CAPPED,[Sq.CAPPED]:Sq.CAPPED},Cq=(0,Q.createContext)(null);function wq({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)(Cq.Provider,{value:i,children:r})}function $ge(){return(0,Q.useContext)(Cq)?.density??null}function e_e(e){let t=(0,Q.useContext)(Cq)?.reportActionSet;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e])}var Tq;(function(e){e.NONE=`none`,e.WORKING=`working`,e.FINISHED=`finished`})(Tq||={});function t_e(e){let t=(0,Q.useContext)(Cq)?.reportBackgroundRun;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e]),(0,Q.useLayoutEffect)(()=>()=>t?.(Tq.NONE),[t])}function Eq(e){let[t,n]=(0,Q.useState)(e);e&&!t&&n(!0);let[r,i]=(0,Q.useState)(Tq.NONE);return{isBulkBarMounted:e||t,backgroundRunState:r,onBackgroundRunChange:i}}function Dq(e,t){let[n,r]=(0,Q.useState)(Sq.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(Sq.LABELLED)},[s]),(0,Q.useLayoutEffect)(()=>{if(!t){r(Sq.LABELLED);return}let n=e.current;n&&n.scrollWidth>n.clientWidth+1&&r(e=>Qge[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(Sq.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 n_e=`motion-safe:transition-[width] motion-safe:duration-[var(--motion-duration-normal)] motion-safe:ease-[var(--motion-easing-default)] motion-reduce:transition-none`,r_e=`@container/collection-toolbar`,i_e=`@max-[32rem]/collection-toolbar:order-last @max-[32rem]/collection-toolbar:basis-full`,a_e=`@max-[32rem]/collection-toolbar:hidden`,Oq;(function(e){e.REFINE=`refine`,e.SELECTION=`selection`})(Oq||={});var o_e=({resourceType:e,quickFilter:t,presetFilters:n,search:r,filterFields:i,filterPanel:a=vl.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}=J({component:U.RESOURCES_LAYOUTS_LIST}),{renderIcon:x}=kf(),S=b(U.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!==vl.HIDDEN,D=!!c&&c.sortFields.length>0,O=QK(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=Dq(M,A),P=Eq(A);return(0,$.jsxs)(`div`,{className:W(r_e,`flex flex-col gap-element-sm`,h),"data-slot":`collection-toolbar`,children:[t&&(0,$.jsx)(dq,{resourceType:e,field:t.field,value:t.value,onChange:t.onChange}),(0,$.jsxs)(`div`,{ref:M,className:W(`flex items-center gap-element`,A?`flex-nowrap`:`flex-wrap`),"data-slot":`collection-toolbar-row`,"data-mode":A?Oq.SELECTION:Oq.REFINE,children:[f&&(0,$.jsx)(xq,{state:f.state,onToggle:f.onToggle}),!A&&(0,$.jsxs)($.Fragment,{children:[r&&!k&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.ICON_SM,onClick:()=>_(!0),"aria-label":S,title:S,"data-slot":`collection-toolbar-search-trigger`,children:x(H.SEARCH,{size:Jn.SM})}),r&&k&&(0,$.jsx)(`div`,{className:W(`overflow-hidden shrink-0 w-64 max-w-full`,n_e),"data-state":`open`,children:(0,$.jsx)(hK,{query:r.query,onChange:r.onChange,onClear:r.onClear,resourceType:e,autoFocus:!0,onFocus:()=>_(!0),onBlur:C,onKeyDown:w})}),E&&(0,$.jsx)(eq,{activeCount:O,isExpanded:v,onToggle:()=>y(e=>!e)}),D&&(0,$.jsx)(_q,{resourceType:e,sortFields:c.sortFields,currentSorts:c.sortStates,onSortChange:c.onSortChange}),j&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:W(`h-5 w-px bg-border`,a_e),"aria-hidden":`true`}),(0,$.jsx)(Wge,{resourceType:e,presets:n,currentFilters:o,onFiltersChange:s,className:i_e})]})]}),d&&(0,$.jsx)(yq,{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)(Zge,{viewMode:l.viewMode,onViewModeChange:l.onViewModeChange,availableModes:l.availableModes}),!A&&m,p&&P.isBulkBarMounted&&(0,$.jsx)(wq,{density:N.density,onActionSetChange:N.reportActionSet,onBackgroundRunChange:P.onBackgroundRunChange,children:p}),!A&&P.backgroundRunState!==Tq.WORKING&&u]})]}),E&&v&&!A&&(0,$.jsx)(tq,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s}),T&&(0,$.jsx)(XK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s,...n?{presetFilters:n}:{}})]})};function kq(e,t){return typeof e==`function`?e(t):e}function Aq(e,t){return n=>{t.setState(t=>({...t,[e]:kq(n,t[e])}))}}function jq(e){return e instanceof Function}function s_e(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function c_e(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 Mq(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 Nq(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function l_e(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:Mq(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),Nq(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function u_e(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:Mq(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],Nq(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:Mq(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},Nq(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var Pq=`debugHeaders`;function Fq(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 d_e={createTable:e=>{e.getHeaderGroups=Mq(()=>[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 Iq(t,[...a,...s,...o],e)},Nq(e.options,Pq,`getHeaderGroups`)),e.getCenterHeaderGroups=Mq(()=>[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))),Iq(t,n,e,`center`)),Nq(e.options,Pq,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=Mq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>Iq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),Nq(e.options,Pq,`getLeftHeaderGroups`)),e.getRightHeaderGroups=Mq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>Iq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),Nq(e.options,Pq,`getRightHeaderGroups`)),e.getFooterGroups=Mq(()=>[e.getHeaderGroups()],e=>[...e].reverse(),Nq(e.options,Pq,`getFooterGroups`)),e.getLeftFooterGroups=Mq(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),Nq(e.options,Pq,`getLeftFooterGroups`)),e.getCenterFooterGroups=Mq(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),Nq(e.options,Pq,`getCenterFooterGroups`)),e.getRightFooterGroups=Mq(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),Nq(e.options,Pq,`getRightFooterGroups`)),e.getFlatHeaders=Mq(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),Nq(e.options,Pq,`getFlatHeaders`)),e.getLeftFlatHeaders=Mq(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),Nq(e.options,Pq,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=Mq(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),Nq(e.options,Pq,`getCenterFlatHeaders`)),e.getRightFlatHeaders=Mq(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),Nq(e.options,Pq,`getRightFlatHeaders`)),e.getCenterLeafHeaders=Mq(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Nq(e.options,Pq,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=Mq(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Nq(e.options,Pq,`getLeftLeafHeaders`)),e.getRightLeafHeaders=Mq(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Nq(e.options,Pq,`getRightLeafHeaders`)),e.getLeafHeaders=Mq(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),Nq(e.options,Pq,`getLeafHeaders`))}};function Iq(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=Fq(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)=>Fq(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 f_e=(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:()=>c_e(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:Mq(()=>[e.getAllLeafColumns()],t=>t.map(t=>l_e(e,s,t,t.id)),Nq(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:Mq(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),Nq(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},p_e={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()}}},Lq=(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))};Lq.autoRemove=e=>qq(e);var Rq=(e,t,n)=>{var r;return!!((r=e.getValue(t))!=null&&(r=r.toString())!=null&&r.includes(n))};Rq.autoRemove=e=>qq(e);var zq=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};zq.autoRemove=e=>qq(e);var Bq=(e,t,n)=>e.getValue(t)?.includes(n);Bq.autoRemove=e=>qq(e);var Vq=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});Vq.autoRemove=e=>qq(e)||!(e!=null&&e.length);var Hq=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));Hq.autoRemove=e=>qq(e)||!(e!=null&&e.length);var Uq=(e,t,n)=>e.getValue(t)===n;Uq.autoRemove=e=>qq(e);var Wq=(e,t,n)=>e.getValue(t)==n;Wq.autoRemove=e=>qq(e);var Gq=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};Gq.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]},Gq.autoRemove=e=>qq(e)||qq(e[0])&&qq(e[1]);var Kq={includesString:Lq,includesStringSensitive:Rq,equalsString:zq,arrIncludes:Bq,arrIncludesAll:Vq,arrIncludesSome:Hq,equals:Uq,weakEquals:Wq,inNumberRange:Gq};function qq(e){return e==null||e===``}var m_e={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Aq(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?Kq.includesString:typeof n==`number`?Kq.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?Kq.equals:Array.isArray(n)?Kq.arrIncludes:Kq.weakEquals},e.getFilterFn=()=>jq(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??Kq[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=kq(n,i?i.value:void 0);if(Jq(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=>kq(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&Jq(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 Jq(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var Yq={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(!s_e(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},h_e={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:Aq(`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 Yq.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return Yq.extent},e.getAggregationFn=()=>{if(!e)throw Error();return jq(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??Yq[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 g_e(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 __e={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Aq(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=Mq(e=>[tJ(t,e)],t=>t.findIndex(t=>t.id===e.id),Nq(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>tJ(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=tJ(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=Mq(()=>[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 g_e(i,t,n)},Nq(e.options,`debugTable`,`_getOrderColumnsFn`))}},Xq=()=>({left:[],right:[]}),v_e={getInitialState:e=>({columnPinning:Xq(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Aq(`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=Mq(()=>[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))},Nq(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=Mq(()=>[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`})),Nq(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=Mq(()=>[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`})),Nq(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?Xq():e.initialState?.columnPinning??Xq()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=Mq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Nq(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=Mq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Nq(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=Mq(()=>[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))},Nq(e.options,`debugColumns`,`getCenterLeafColumns`))}};function y_e(e){return e||(typeof document<`u`?document:null)}var Zq={size:150,minSize:20,maxSize:2**53-1},Qq=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),b_e={getDefaultColumnDef:()=>Zq,getInitialState:e=>({columnSizing:{},columnSizingInfo:Qq(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:Aq(`columnSizing`,e),onColumnSizingInfoChange:Aq(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Zq.minSize,n??e.columnDef.size??Zq.size),e.columnDef.maxSize??Zq.maxSize)},e.getStart=Mq(e=>[e,tJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),Nq(t.options,`debugColumns`,`getStart`)),e.getAfter=Mq(e=>[e,tJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),Nq(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(),eJ(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=eJ(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=y_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=x_e()?{passive:!1}:!1;eJ(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?Qq():e.initialState.columnSizingInfo??Qq())},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}},$q=null;function x_e(){if(typeof $q==`boolean`)return $q;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 $q=e,$q}function eJ(e){return e.type===`touchstart`}var S_e={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Aq(`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=Mq(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),Nq(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=Mq(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],Nq(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>Mq(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),Nq(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 tJ(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var C_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()}}},w_e={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Aq(`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=()=>Kq.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return jq(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??Kq[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},T_e={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Aq(`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()}}}},nJ=0,rJ=10,iJ=()=>({pageIndex:nJ,pageSize:rJ}),E_e={getInitialState:e=>({...e,pagination:{...iJ(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Aq(`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=>kq(t,e)),e.resetPagination=t=>{e.setPagination(t?iJ():e.initialState.pagination??iJ())},e.setPageIndex=t=>{e.setPagination(n=>{let r=kq(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?nJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??nJ)},e.resetPageSize=t=>{var n;e.setPageSize(t?rJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??rJ)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,kq(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=kq(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=Mq(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},Nq(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}},aJ=()=>({top:[],bottom:[]}),D_e={getInitialState:e=>({rowPinning:aJ(),...e}),getDefaultOptions:e=>({onRowPinningChange:Aq(`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?aJ():e.initialState?.rowPinning??aJ()),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=Mq(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),Nq(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=Mq(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),Nq(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=Mq(()=>[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))},Nq(e.options,`debugRows`,`getCenterRows`))}},O_e={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Aq(`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=>{oJ(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Mq(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?sJ(e,n):{rows:[],flatRows:[],rowsById:{}},Nq(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=Mq(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?sJ(e,n):{rows:[],flatRows:[],rowsById:{}},Nq(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=Mq(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?sJ(e,n):{rows:[],flatRows:[],rowsById:{}},Nq(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 oJ(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return cJ(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return lJ(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return lJ(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)}}}},oJ=(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=>oJ(e,t.id,n,r,i))};function sJ(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=cJ(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 cJ(e,t){return t[e.id]??!1}function lJ(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()&&(cJ(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=lJ(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var uJ=/([0-9]+)/gm,k_e=(e,t,n)=>pJ(fJ(e.getValue(n)).toLowerCase(),fJ(t.getValue(n)).toLowerCase()),A_e=(e,t,n)=>pJ(fJ(e.getValue(n)),fJ(t.getValue(n))),j_e=(e,t,n)=>dJ(fJ(e.getValue(n)).toLowerCase(),fJ(t.getValue(n)).toLowerCase()),M_e=(e,t,n)=>dJ(fJ(e.getValue(n)),fJ(t.getValue(n))),N_e=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},P_e=(e,t,n)=>dJ(e.getValue(n),t.getValue(n));function dJ(e,t){return e===t?0:e>t?1:-1}function fJ(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function pJ(e,t){let n=e.split(uJ).filter(Boolean),r=t.split(uJ).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 mJ={alphanumeric:k_e,alphanumericCaseSensitive:A_e,text:j_e,textCaseSensitive:M_e,datetime:N_e,basic:P_e},F_e=[d_e,S_e,__e,v_e,p_e,m_e,C_e,w_e,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Aq(`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 mJ.datetime;if(typeof n==`string`&&(r=!0,n.split(uJ).length>1))return mJ.alphanumeric}return r?mJ.text:mJ.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return jq(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??mJ[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())}},h_e,T_e,E_e,D_e,O_e,b_e];function I_e(e){let t=[...F_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=kq(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:Mq(()=>[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}),Nq(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:Mq(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=u_e(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},Nq(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:Mq(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),Nq(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:Mq(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),Nq(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:Mq(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),Nq(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 L_e(){return e=>Mq(()=>[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=f_e(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},Nq(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function R_e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=Q.useState(()=>({current:I_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 hJ=rc(U.LOW_LEVEL_TABLE,`Table`,[`Header`,`Body`,`Footer`,`Row`,`Head`,`Cell`,`Caption`]);function gJ({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n,{...t})}function _J({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Header,{...t})}function vJ({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Body,{...t})}function z_e({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Footer,{...t})}function yJ({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Row,{...t})}function bJ({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Head,{...t})}function xJ({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Cell,{...t})}function B_e({preset:e=G.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Caption,{...t})}function SJ(e,t){return e===void 0?null:typeof e==`function`?e(t):e}var V_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:y}=J({component:U.RESOURCES_LAYOUTS_LIST,resource:t}),{renderIcon:b}=kf(),x=Ix(),{getRecipe:S}=Ig(),C=S(_t.INTERACTIVE,vi.GHOST),w=S(_t.TYPOGRAPHY,ii.EYEBROW),T=(0,Q.useMemo)(()=>V.resolveFieldShapeOfAnyVariant(n)??null,[n]),E=(0,Q.useMemo)(()=>new Set(s),[s]),D=R_e({data:e,columns:(0,Q.useMemo)(()=>{let e=[];u&&e.push({id:`__select`,header:()=>(0,$.jsx)(OI,{checked:p,onCheckedChange:()=>m?.(),"aria-label":v(U.RESOURCES_LAYOUTS_LIST,`selectAll`)}),cell:({row:e})=>(0,$.jsx)(OI,{checked:d?.(e.original)??!1,onCheckedChange:()=>f?.(e.original),"aria-label":v(U.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:e.index+1})}),size:40,enableSorting:!1});for(let n of i){let r=T?.[n],i=E.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:Y.GHOST,size:Gd.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:[b(r===`asc`?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:Jn.XS}),c.length>1&&(0,$.jsx)(`span`,{className:`text-[10px] font-semibold tabular-nums`,children:e+1})]})]})},cell:({row:e})=>(0,$.jsx)(IG,{value:e.original[n],fieldSchema:r,fieldLabel:void 0,resourceType:t,record:e.original,collectionContextResourceIdentifiers:a,fieldName:n,tResourceFieldEnumValue:y})})}return h&&e.push({id:`__actions`,header:()=>(0,$.jsx)(`span`,{className:`sr-only`,children:v(U.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,T,E,o,c,l,t,y,v,b]),getCoreRowModel:L_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(U.RESOURCES_LAYOUTS_LIST,`listLabel`),children:[(0,$.jsx)(`thead`,{className:`bg-muted/50 border-b border-border`,children:D.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsx)(`th`,{className:W(`px-card-sm py-element-sm text-start`,w.base),style:{width:e.getSize()===150?void 0:e.getSize()},children:e.isPlaceholder?null:SJ(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,$.jsx)(`tbody`,{className:`divide-y divide-border`,children:D.getRowModel().rows.map(e=>{let t=V.getResourceObjectId(e.original,n.resourceFieldIdentifier);if(x.isElementActive(t))return(0,$.jsx)(`tr`,{role:`row`,children:(0,$.jsx)(`td`,{colSpan:e.getVisibleCells().length,className:`p-0`,children:(0,$.jsx)(RG,{navigationZone:r})})},e.id);let i=!_||_(e.original);return(0,$.jsx)(`tr`,{"data-slot":`resource-list-item`,className:W(i&&(C.states.hover||`hover:bg-muted/30`),`transition-colors motion-reduce:transition-none`,i&&`cursor-pointer`,i&&Ag(r_.INSET),d?.(e.original)&&`bg-primary/5`),onClick:i?t=>{xG(t)||g(e.original)}:void 0,role:`row`,"aria-selected":u?d?.(e.original)??!1:void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{xG(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)(xJ,{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:SJ(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]})})})})},H_e=`__wildo-board-ungrouped__`;function U_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:H_e,value:null,label:null,items:[],total:o,loading:!1,failed:!1}),a}function W_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 G_e(e,t){if(e.length===0)return;let n=t(e);return n.find(e=>e.isOperationDefault===!0)??n[0]}function K_e(e,t){return{[e]:t}}async function q_e(e){let t=K_e(e.groupByField,e.targetValue);try{await e.call(t)}catch(t){return e.reportRefusal(t),!1}return e.applyMove(t),!0}function J_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 CJ=`application/x-wildo-board-card`,Y_e=[];function X_e(e,t){let n=e?.operations??Y_e,r=BS(n,{currentObject:t,resourceType:e?.resourceType,subjectDataMode:e?.subjectDataMode,organizationId:e?.organizationId});return G_e(n.filter(e=>r.get(PS(e))?.isEnabled===!0),e=>td(e))}function Z_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=X_e(i,e),f=d!==void 0&&!a;return(0,$.jsx)(`li`,{className:W(`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(CJ,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 Q_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=J_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:W(`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(CJ)||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)(Z_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:Y.GHOST,size:Gd.SM,disabled:e.loading,"data-board-load-more":e.key,onClick:()=>t(e.value),children:n(e.total-e.items.length)})]},e.key)})]})}function wJ(e){return e.toISOString().slice(0,10)}function TJ(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1))}function EJ(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function DJ(e){return wJ(e).slice(0,7)}function $_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 eve(e,t){let n=TJ(e),r=(n.getUTCDay()-t+7)%7,i=vK(EJ(n,1),-1),a=[],o=vK(n,-r);for(;o.getTime()<=i.getTime();){let e=[];for(let t=0;t<7;t++)e.push({day:o,key:wJ(o),inMonth:o.getUTCMonth()===n.getUTCMonth()}),o=vK(o,1);a.push(e)}return a}function tve(e){let t=e[0],n=e[e.length-1];return{firstDay:t[0].day,lastDay:n[n.length-1].day}}function OJ(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 ho.calendarDateToday({timezone:t?`UTC`:n},r)}function nve(e){let t=new Map;for(let n of e.items){let r=OJ(n[e.dateField],e.calendarField,e.timeZone);if(!r)continue;let i=wJ(r),a=t.get(i);a?a.push(n):t.set(i,[n])}return t}function rve(e,t,n){return yK(e.firstDay,e.lastDay,t,n)}function kJ(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 ive(e,t){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return{...t};let n=e,r=[kJ(n.startDate),t.startDate].filter(e=>e!==void 0),i=[kJ(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 ave(e,t){if(!t||Object.keys(t).length===0)return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=ive(e[r],i);return n}function ove(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 sve(e,t,n){if(`days`in t)return vK(e,t.days);if(`months`in t){let n=EJ(TJ(e),t.months),r=vK(EJ(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`?vK(e,-r):vK(e,6-r)}var cve=[];function lve({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}=kf(),S=(0,Q.useRef)(null),[C,w]=(0,Q.useState)(()=>TJ(r).getTime()===TJ(n).getTime()?r:TJ(n)),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{w(e=>TJ(e).getTime()===TJ(n).getTime()?e:TJ(n))},[n]);let E=wJ(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=TJ(e);t.getTime()!==TJ(n).getTime()&&a(t)},[n,a]),O=(e,t)=>{if(e.target!==e.currentTarget)return;let n=ove(e.key);n&&(e.preventDefault(),D(sve(t,n,i)))},k=wJ(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:Y.OUTLINE,size:Gd.ICON_SM,"aria-label":h,title:h,onClick:()=>a(EJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_LEFT,{size:Jn.SM})})}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.ICON_SM,"aria-label":g,title:g,onClick:()=>a(EJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_RIGHT,{size:Jn.SM})})}),(0,$.jsx)(`h3`,{id:b,className:`text-sm font-medium`,"aria-live":`polite`,children:o}),(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.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)??cve,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:W(`h-24 border align-top p-item-xs`,Ag(r_.INSET),!r&&`bg-muted/30 text-muted-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:W(`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:Y.GHOST,size:Gd.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 uve(e){let t=TJ(e),n=EJ(t,1),r=[];for(let e=t;e.getTime()<n.getTime();e=vK(e,1))r.push(e);return r}var AJ=864e5;function dve(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=OJ(e[n],i,o),s=OJ(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)/AJ)+1,p=Math.round((Math.min(d.getTime(),l)-c)/AJ)+1;u.push({item:e,startDay:t,endDay:d,startColumn:f,endColumn:p,continuesBefore:t.getTime()<c,continuesAfter:d.getTime()>l})}return u}function fve(e){let{startField:t,endField:n,startIsCalendarDate:r,endIsCalendarDate:i,timeZone:a,firstDay:o,lastDay:s}=e;return{[t]:yK(void 0,s,r,a),[n]:yK(o,void 0,i,a)}}var jJ=wJ;function pve(e){return{gridTemplateColumns:`minmax(8rem, 12rem) repeat(${e}, minmax(1.5rem, 1fr))`}}function mve({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:_}=kf(),v=(0,Q.useRef)(null),y=jJ(r),b=pve(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:Y.OUTLINE,size:Gd.ICON_SM,"aria-label":p,title:p,onClick:()=>i(EJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_LEFT,{size:Jn.SM})})}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.ICON_SM,"aria-label":m,title:m,onClick:()=>i(EJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_RIGHT,{size:Jn.SM})})}),(0,$.jsx)(`h3`,{className:`text-sm font-medium`,"aria-live":`polite`,children:a}),(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.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=jJ(e);return(0,$.jsx)(`span`,{"data-timeline-day":t,"data-today":t===y?`true`:void 0,className:W(`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=W(`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:Y.GHOST,size:Gd.XS,"data-timeline-bar":p,"aria-label":h,title:h,className:W(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:W(g,`flex items-center`),style:_,onKeyDown:x,children:m})]},p)})})]})})]})}function MJ(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 hve(e){let{requestPage:t,pageLimit:n,maxPages:r=5}=e,i=async e=>{let r=MJ(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 NJ(e,t,n){let r=e[t];return r!=null&&r!==``&&!(Array.isArray(r)?r.includes(n):r===n)?null:{...e,[t]:n}}function gve(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 _ve(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 PJ={items:[],total:0,page:0,loading:!1,failed:!1};function vve(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,{...PJ,items:[],loading:yve(r,o,e)}])));for(let t of n){let n=NJ(r,o,t);n&&i(n,1,a).then(n=>{if(e)return;let r=MJ(n);u(e=>new Map(e).set(t,r?{items:r.items,total:r.total,page:1,loading:!1,failed:!1}:{...PJ,items:[],failed:!0}))},()=>{e||u(e=>new Map(e).set(t,{...PJ,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=NJ(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=MJ(await n(o,c,r));u(n=>{let r=n.get(e)??s;return new Map(n).set(e,t?_ve(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=>gve(i,{itemId:e,fromValue:t,toValue:n,movedFields:r,getItemId:d.current.getItemId}))},[])}}function yve(e,t,n){return NJ(e,t,n)!==null}function bve(e){let{on:t}=qo(),[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(xc.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 xve(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 FJ=({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=Gd.ICON_SM,labelDisplayMode:f=Zl.INLINE,className:p})=>{let m=$ge(),{resourceType:h,operation:g}=e,{on:_}=qo(),v=(0,Q.useId)(),{isReady:y,tComponent:b,tErrorMessage:x,tResourceOperation:S}=J({component:U.RESOURCES_LAYOUTS_OPERATIONS_BULK,resource:h}),C=(0,Q.useMemo)(()=>Vu(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),w=(0,Q.useMemo)(()=>[`resources.${h}`,`components.${U.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:L}=eH({resourceType:h,displayMode:Be.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}),ee=bve(L),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);ee?.finished&&te?.jobId!==ee.jobId&&ne({jobId:ee.jobId,selectionKey:z});let ae=!!ee?.finished&&te?.jobId===ee.jobId&&z!==``&&z!==te.selectionKey;ae&&re!==ee.jobId&&ie(ee.jobId);let oe=ee&&!ae&&ee.jobId!==re?ee:null;return t_e(oe?oe.finished?Tq.FINISHED:Tq.WORKING:Tq.NONE),e_e((0,Q.useMemo)(()=>D.map(e=>e.type===`separator`?`|`:e.operationIdentifier??e.label).join(`,`),[D])),(0,Q.useEffect)(()=>{if(l)return _(xc.RESOURCE_OPERATION_EXECUTED,()=>l(),e=>{let t=e;return t.resourceType===h&&t.isBulkOperation===!0&&t.isPartialWrite!==!0&&t.optionalDiscriminator===v&&(0,oC.default)(Vu(t.contextResourceIdentifiers),C)})},[_,l,C,h,v]),y?oe?(0,$.jsx)(eb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,"data-slot":`bulk-background-run`,children:[!oe.finished&&(0,$.jsx)(v_,{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(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunFinished`,{succeededCount:oe.processedCount-oe.failedCount,failedCount:oe.failedCount}):b(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunProgress`,{processedCount:oe.processedCount,attemptedCount:oe.attemptedCount})}),oe.finished&&oe.failures.length>0&&(0,$.jsxs)(pq,{children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Gd.SM,children:b(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,`viewFailures`)})}),(0,$.jsxs)(hq,{className:`w-96 max-h-80 overflow-auto`,children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-element-sm`,children:xve(oe.failures,e=>Ep({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(U.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:Y.LINK,size:Gd.SM,onClick:()=>s(oe.failures.map(e=>e.resourceId)),children:b(U.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(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failuresPartialList`,{shownCount:oe.failures.length,failedCount:oe.failedCount})})]})]})]})}):!R||D.length===0?null:(0,$.jsx)(eb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{"data-slot":`operations-bulk`,className:W(`flex items-center`,p),children:[(0,$.jsx)(qS,{items:D,size:d,labelDisplayMode:m===null||m===Sq.LABELLED?f:Zl.TOOLTIP,...m===Sq.CAPPED?{maxDisplayed:2}:{}}),O&&(0,$.jsx)(Mw,{open:O,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,label:k,description:A,confirmLabel:j,requireTypedConfirmation:M,confirmationPhrase:N})]})}):null};function IJ({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,`ResourceLayout_OperationBulk`)(e);return(0,$.jsx)(n,{...t})}var Sve=({resourceContext:e,navigationZone:t,size:n=Gd.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:_}=eH({resourceType:a,displayMode:Be.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:Zl.INLINE,className:r}),c&&(0,$.jsx)(Mw,{open:c,onOpenChange:e=>{e||h()},cancelCallback:h,validationCallback:m,label:l,description:u,confirmLabel:d,requireTypedConfirmation:f,confirmationPhrase:p}),g&&(0,$.jsx)(uG,{open:!0,onAcknowledge:_,fields:g,resourceType:a})]})},Cve=`__wildo-ungrouped__`;function wve(e,t,n,r,i){let a=VG(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??Cve,l=o[o.length-1];l&&l.key===c?l.items.push(n):o.push({key:c,label:s,items:[n]})}return o}var Tve=`wildo-collection-view-mode:`;function LJ(e){return`${Tve}${e}`}function Eve(e){let t=tc(LJ(e));return t!==null&&Object.values(vs).includes(t)?t:null}function Dve(e,t){wo(LJ(e),t)}function Ove(e,t){let[n,r]=(0,Q.useState)(()=>Eve(e)??t);return{viewMode:n,setViewMode:(0,Q.useCallback)(t=>{r(t),Dve(e,t)},[e])}}function kve(e){return e instanceof Error?e:Error(String(e))}var RJ=class extends Q.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){let n=kve(e);il.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 zJ({className:e,style:t}){return(0,$.jsx)(`div`,{"aria-hidden":`true`,"data-lazy-door":`unavailable`,className:W(`rounded-md border border-dashed border-muted-foreground/40 bg-muted/30`,e),style:t})}var Ave=Q.lazy(()=>s_(()=>import(`./ChartView-B6f1J6Er.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function jve({height:e}){let{tComponent:t,isReady:n}=J({component:U.HIGH_LEVEL_VIEWS_CHART_WIDGET});return n?(0,$.jsx)(`div`,{style:{minHeight:e},"data-lazy-door":`unavailable`,children:(0,$.jsx)(fm,{variant:`compact`,iconRef:H.ERROR_APPLICATION,title:t(U.HIGH_LEVEL_VIEWS_CHART_WIDGET,`chartFailed`),respectSurfaceEmptyDisplay:!1,className:`h-full min-h-[120px] border-0`})}):null}var BJ=e=>(0,$.jsx)(RJ,{doorName:`ChartView`,fallback:(0,$.jsx)(jve,{height:e.height??400}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Cm,{height:e.height??400}),children:(0,$.jsx)(Ave,{...e})})});function Mve(e){return typeof e.resourceType==`string`&&e.resourceType.length>0}function Nve(e){return e.foreignKeyField??e.resourceType}function Pve(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===Am.PARENT_RESOURCE_REQUIREMENT?e.parentResourcesRequirements:e.additionalResourceRequirements)??[]).filter(e=>Mve(e)?Nve(e)===n:!1);return a.length===1?{mainResourceType:a[0].resourceType,mainResourceId:i,bindingKey:n,source:r===Am.PARENT_RESOURCE_REQUIREMENT?Zv.PARENT_RESOURCE_REQUIREMENT:Zv.ADDITIONAL_RESOURCE_REQUIREMENT}:null}function Fve(e){return e.explicitTemplate?e.explicitTemplate:e.displaySchema?GR(e.displaySchema,{factsAsTiles:e.defaultDisplayChromeMode===void 0,...e.resourceConfig?{resourceConfig:e.resourceConfig}:{}}):null}function VJ(e){return e??void 0}var HJ=class{resourcesRegistry;errorBuilder;constructor(e){this.resourcesRegistry=e,this.errorBuilder=new Ae}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(v.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&&(VJ(e.variantType)===void 0||t.variantType===e.variantType)&&(VJ(e.variantKey)===void 0||t.variantKey===e.variantKey)&&(VJ(e.isOperationDefault)===void 0||!!t.isOperationDefault===e.isOperationDefault)&&(VJ(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=>wi.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`&&Kte.getCoreResourceOperationFromOperation(t)!==K.READ?null:t:e.validationTarget===`canonical-read`?null:this.findOperation(e)}selectResponseDto(e,t){return Ns.selectResponseDto(e,t)}validateResourceData(e,t,n){if(!t)return e;try{return t.parse(e)}catch(t){throw t instanceof Rd?this.buildError(rs.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(rs.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(rs.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(rs.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{arrayIndex:n,originalError:e})}throw e}})}},UJ=il.getLogger(),WJ=UJ.debugByType(`RMMWebSocketBridge`);UJ.setDebugTypeLogging(`RMMWebSocketBridge`,!1);function GJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KJ(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)=>KJ(e,t[n])):GJ(e)||GJ(t)?!GJ(e)||!GJ(t)?!1:[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>KJ(e[n],t[n])):!1}function qJ(e,t,n=``,r={}){if(KJ(e,t))return r;if(Array.isArray(e)||Array.isArray(t))return n&&(r[n]=e),r;if(GJ(e)&&GJ(t)){let i=[...new Set([...Object.keys(e),...Object.keys(t)])];for(let a of i){let i=n?`${n}.${a}`:a;qJ(e[a],t[a],i,r)}return r}if(GJ(e)){for(let[t,i]of Object.entries(e))qJ(i,void 0,n?`${n}.${t}`:t,r);return r}return n&&(r[n]=e),r}function Ive(e,t){return qJ(e,t)}async function JJ(e){let{resourceType:t,resourceId:n,rmm:r,doOperation:i}=e;if(r.getSnapshot().isDeleted)return;let a=r.readOperationPathKey;if(!a){WJ(`authoritative refetch skipped: missing canonical read operation`,{resourceType:t,resourceId:n});return}let o=await Mz({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)&&(WJ(`authoritative refetch: applying newer state`,{resourceType:t,resourceId:n,localVersion:l.version,serverVersion:c}),r.setInitialState(s,c,s._field_meta))}var Lve=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=dp(),a=(0,Q.useContext)(Ez),{doOperation:o,getResourcesRegistry:s}=pm(),c=(0,Q.useMemo)(()=>s(),[s]),l=(0,Q.useMemo)(()=>new HJ(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),JJ({resourceType:e,resourceId:t,rmm:n,doOperation:u.current}).catch(n=>{WJ(`authoritative refetch failed`,{resourceType:e,resourceId:t,error:Vc(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(Bn.RESOURCE_UPDATED,e=>{if(e.deliveryTarget===ou.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!==ou.RESOURCE_ROOM_SYNC){WJ(`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(!GJ(n)||r==null){WJ(`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:Oz,validationTarget:`canonical-read`})}catch(n){WJ(`RESOURCE_UPDATED: sync payload failed canonical-read validation, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,error:Vc(n)}),m(e.resourceType,e.resourceId,t);return}let o=t.getSnapshot(),s=o.confirmedData??{},c=Ive(i,s);Object.keys(c).length===0&&r===o.version?WJ(`RESOURCE_UPDATED: no changes detected, skipping`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r}):(WJ(`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(Bn.RESOURCE_DELETED,e=>{let t=a.get(e.resourceType,e.resourceId);t&&(WJ(`RESOURCE_DELETED → handleDeletion`,{resourceType:e.resourceType,resourceId:e.resourceId,initiatorUserId:e.initiatorUserId}),t.handleDeletion(gE.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){WJ(`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},YJ=il.getLogger(),XJ=YJ.debugByType(`ResourceAutomaticDisplayer`),ZJ=2e3,QJ=3e4;YJ.setDebugTypeLogging(`ResourceAutomaticDisplayer`,!1);function $J({resourceContext:e,onError:t,className:n,labelsOverride:r,dataMode:i,onDataLoaded:a,parentReferenceConfig:o,navigationZone:s,updateLikeMutationFallbackMode:c=kl.RMM_REQUIRED,recordNameShownAbove:l=!1}){let{doOperation:u,registry:d}=pm(),{emit:f,resourceRefreshEvent:p}=qo(),{lastRefreshAt:m}=p({ctx:e}),{tComponent:h,isReady:g,t:_,formatDate:y,formatDateTime:b}=J({component:U.RESOURCES_LAYOUTS_READ,resource:e.resourceType}),[x]=ch(),S=(0,Q.useMemo)(()=>[`resources.${e.resourceType}`,`components.${U.RESOURCES_LAYOUTS_READ}`],[e.resourceType]),C=(0,Q.useRef)(u),w=(0,Q.useRef)(f),T=(0,Q.useRef)(t),E=(0,Q.useRef)(a),D=(0,Q.useRef)(e);C.current=u,w.current=f,T.current=t,E.current=a,D.current=e;let O=(0,Q.useMemo)(()=>new Ae,[]),{resourceType:k,operation:A,contextResourceIdentifiers:j}=e,M=String(A.operationIdentifier),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,ee]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),te=(0,Q.useMemo)(()=>[{resourceType:k,operation:M}],[k,M]),ne=(0,Q.useMemo)(()=>En.extractDataMode(x,i),[x,i]),re=(0,Q.useMemo)(()=>ne??Yl.RAW,[ne]),ie=(0,Q.useMemo)(()=>{let e;switch(re){case Yl.SUMMARY:e=A.summaryDto||A.responseDto;break;case Yl.CONTEXT:e=A.contextDto||A.responseDto;break;case Yl.RAW:default:e=A.responseDto}return e||YJ.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)(()=>wi.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=mr.collectFileFieldPaths(ie);if(e.length===0)return;let t=bi.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=nH({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=ZJ,r=async(i=!1)=>{i||ee(null);try{let t=await C.current(le,{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements,dataMode:re},{silent:!0});if(e)return;ee(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(v.NOT_FOUND,{customMessageReference:rs.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(ee(c),(wie(a)||fl(a))&&(t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,r(!0)},n),n=Math.min(n*2,QJ)),i)return;let l=D.current,{errorRefusalCode:u}=cz(a);w.current(xc.NOTIFY_RESOURCE_ERROR,{...l,contextResourceIdentifiers:Vu(l.contextResourceIdentifiers),parentResourcesRequirements:l.parentResourcesRequirements||[],additionalContext:{...l.additionalContext,error:o.message,errorCustomMessageReference:rs.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,...u?{errorRefusalCode:u}:{},...lz(a)}}),T.current?.(o),XJ(`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 En.getResourceId(e);if(N){let e=V.getResourceFieldIdentifierForType(k,d),t=N[e];if(t!=null)return t;let n=ae?.mainSchema?uae(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=sS(nh(ae?.resourceIdentifier,fe==null?void 0:String(fe),pe)),ge=(0,Q.useMemo)(()=>{if(ae)return mh({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]),ve=iz(e,ge??A),ye=(0,Q.useRef)(null);ye.current=ge?e=>ve(e,{partialWrite:!0}):null;let{rmm:B,rmmSnapshot:be}=Bz({resourceType:k,resourceId:fe==null?null:String(fe),doOperationRef:C,contextualParameters:me,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:pe,resourceSchema:ae?.mainSchema,resourceInheritance:ae?.inheritenceSchemaDefinition,enabled:_e&&fe!=null,conflictPolicy:{strategy:mE.ACCEPT_REMOTE}}),xe=(0,Q.useRef)(null);xe.current=typeof N?._id==`string`||typeof N?._id==`number`?String(N._id):null;let Se=B!==null&&!R,Ce=(0,Q.useRef)(!1),we=sV({resourceType:k,rowIds:[fe==null?null:String(fe),xe.current],enabled:fe!=null});(0,Q.useEffect)(()=>{if(we!=null&&fe!=null){if(Se&&B!==null&&!we.madeElsewhere){let e=String(fe);JJ({resourceType:k,resourceId:e,rmm:B,doOperation:C.current}).catch(t=>{YJ.warn(`[ResourceAutomaticDisplayer] Re-reading the row after it changed failed`,{resourceType:k,resourceId:e,error:Vc(t)})})}Se&&Ce.current||I(we.at)}},[we]);let Te=(0,Q.useMemo)(()=>B?B.readOperationPathKey:Az(k,d,{hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me}),[d,k,B,fe,pe,me]),Ee=R?null:B;(0,Q.useEffect)(()=>{XJ(`RMM obtained`,{resourceType:k,resourceId:fe==null?void 0:String(fe),rmmExists:!!B})},[B,k,fe]),(0,Q.useEffect)(()=>{z(!1)},[Te,fe,le,k]),(0,Q.useEffect)(()=>{if(!B||!N)return;let e=B.getSnapshot();if(e.confirmedData!==null&&m==null)return;if(!Te){z(!0),YJ.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=jz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}),r=n?N:await Mz({doOperation:C.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;B.setInitialState(i,a,i._field_meta),z(!1),XJ(`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),YJ.warn(`[ResourceAutomaticDisplayer] Failed to seed RMM from canonical read`,{resourceType:k,resourceId:fe==null?void 0:String(fe),error:Vc(e)})}),()=>{t=!0}},[B,N,re,le,Te,me,k,fe,m]),(0,Q.useEffect)(()=>{if(!B||!be?.lastEvent)return;let e=be.lastEvent;XJ(`RMM event`,{type:e.type,resourceType:k,resourceId:fe==null?void 0:String(fe)});let t=Te?!jz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}):!1,n=()=>{t&&C.current(le,{contextualParameters:me,parentResourcesRequirements:D.current.parentResourcesRequirements,dataMode:re}).then(e=>{P(e)}).catch(e=>{YJ.warn(`[ResourceAutomaticDisplayer] Summary/context refetch failed (RMM handler)`,{resourceType:k,error:Vc(e)})})};switch(e.type){case lE.MUTATION_RESULT:e.result.success&&(e.source.type===dE.DISPLAY&&(w.current(xc.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ne({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}),ye.current?.(e.result.responseData)),n());break;case lE.REMOTE_UPDATE:case lE.CONFLICT_RESET:n();break;case lE.RESOURCE_DELETED:}},[be?.lastEvent?.id]);let De=(0,Q.useMemo)(()=>jz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}),[Te,re,le]),Oe=re===Yl.SUMMARY||re===Yl.CONTEXT,ke=!Oe&&De&&B&&be.optimisticData?be.optimisticData:N;Ce.current=!Oe&&De&&Se;let je=Se?be.optimisticData:null;(0,Q.useEffect)(()=>{if(ke==null)return;let e=De?ke:je??void 0;E.current?.(ke,{holdsCanonicalRecord:De||Se,canonicalRecord:e})},[ke,De,Se,je]),(0,Q.useEffect)(()=>{XJ(`effectiveData source`,{dataMode:re,usingRmmData:De&&!!be?.optimisticData})},[De,re,be?.optimisticData]);let Me=(0,Q.useCallback)((e,t)=>{P(n=>n&&fA(n,e,t)),w.current(xc.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ne({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)}),ye.current?.(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)(()=>Fve({explicitTemplate:Pe,displaySchema:ie,defaultDisplayChromeMode:Fe,resourceConfig:ae}),[Pe,ie,Fe,ae]),Ve=eH({resourceType:e.resourceType,displayMode:Be.DETAIL,currentObject:ke,currentObjectDataMode:re,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s??so.PRIMARY,sourceOperation:e.operation}),He=(0,Q.useCallback)(t=>{let n=Ve.items.find(e=>e.type!==`separator`&&e.type!==`subgroup`&&e.operationIdentifier===t.operationIdentifier);n?.onClick?n.onClick():bi.isDevelopment()&&il.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.`)},[Ve.items,e.resourceType]),Ue=(0,Q.useMemo)(()=>{if(Pe)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let e=Tj({resourceType:k,schema:ie,parentData:ke,registry:d}),t=ae?.frontendConfiguration?.layout?.defaultInlineEdit===wr.WRITABLE_FIELDS,n=ie?mr.getObjectLikeFieldShape(ie,{commonOnly:!1}):void 0,r=l&&!t?NA({resourceType:k,registry:d,data:ke,t:_,formatDate:y,formatDateTime:b}).filter(e=>{let t=n?.[e];return!t||!js(t)}):[];return r.length===0?e:{...e,hiddenFieldNames:[...e.hiddenFieldNames,...r]}},[ie,ke,Pe,d,k,ae,l,_,y,b]),We=!ke,Ge=(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 C.current(wi.createOperationPathKeyFromOperation(t),{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements},{silent:!0})},[ae,k,ce]);if(g===!1)return null;if(L){let t=ae?.frontendConfiguration?.layout?.readFailure;if(t)return(0,$.jsx)(`div`,{className:n,children:(0,$.jsx)(t,{error:L,resourceContext:e,askOperation:Ge})});let r=h(U.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(U.RESOURCES_LAYOUTS_READ,`configurationError`),t=h(U.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)(eb,{i18nKeys:S,loadingScopes:te,children:(0,$.jsx)(BB,{schema:ie,data:ke,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&&Rn(c)?Me:void 0,updateLikeMutationFallbackMode:c,layoutTemplate:ze,isLoading:We,defaultDisplayChromeMode:Fe,defaultInlineEdit:Ie,defaultEmptyValue:Le,defaultSectionAppearance:Re,hiddenFieldNames:Ue.hiddenFieldNames,inlineEditDisabledFieldNames:Ue.inlineEditDisabledFieldNames,onFileActivationOperation:He})})}$J.displayName=`ResourceAutomaticDisplayer`;var eY=$J,Rve=Object.freeze(new Set),zve=Object.freeze({depth:0,visited:Rve}),tY=(0,Q.createContext)(zve);function nY(){return(0,Q.useContext)(tY)}var rY=new Set;function Bve(e,t,n,r){rY.has(`${e}:${t}`)||(rY.add(`${e}:${t}`),il.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 iY({descentKey:e,maxDepth:t=3,children:n}){let r=nY(),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?(Bve(e,i?`cycle`:`depth`,a,t),null):(0,$.jsx)(tY.Provider,{value:s,children:n})}var aY=(0,Q.createContext)(null);function oY({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)&&Vve([...e.placed])}),(0,$.jsx)(aY.Provider,{value:n,children:e})}var sY=new Set;function Vve(e){let t=e.slice().sort().join(`,`);sY.has(t)||(sY.add(t),il.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 cY(e){let t=(0,Q.useContext)(aY);t&&e&&t.placed.add(e)}function lY(){let e=(0,Q.useContext)(aY);return e?e.owned.current||e.placed.size>0:!1}function uY(){let e=(0,Q.useContext)(aY);e&&(e.owned.current=!0)}var Hve=Object.freeze(new Set);function dY(e){let t=(0,Q.useContext)(aY);t&&e&&(t.composedAutomatically.current=!0)}function Uve(){return(0,Q.useContext)(aY)?.placed??Hve}function Wve(e,t){if(!t)return;let n=En.getResourceId(e[t]);return typeof n==`string`&&n.length>0?n:void 0}function fY(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=>Wve(t.contextResourceIdentifiers,e)!==void 0||n[e]!==void 0&&String(n[e]).length>0)))}function pY(e){let t=e.operations.filter(t=>fY(t,e.childContext,e.contextualParameters));return Kl(t,K.LIST)}function Gve(e){return e.isOneToOne}function Kve(e){return e===Xt.COLLAPSIBLE}function qve(e){let t=[];for(let n of e){let e=n.contentSectionConfig.mode;if(Kve(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 mY=new Set;function hY(e,t,n){let r=`${e}->${t}`;mY.has(r)||(mY.add(r),il.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: ${Vc(n)}`))}var gY=new Set;function Jve(e,t){let n=`${e}->${t.childResourceType}`;gY.has(n)||(gY.add(n),il.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 _Y=({resourceContext:e,navigationZone:t,navigationInitiator:n,parentData:r})=>{let{resourceType:i}=e,{registry:a}=pm(),{tResourceHeader:o,isReady:s}=J({component:U.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:i}),{navigate:c}=SS(),{currentBreakpoint:l}=Ig(),u=lY(),d=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${U.RESOURCES_LAYOUTS_CONTAINER_NESTED}`],[i]),f=(0,Q.useMemo)(()=>a.resourceConfigurations[i],[a,i]),p=(0,Q.useMemo)(()=>f?.resourceRelationships?Mc(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=En.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:d?K.READ:K.LIST,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){hY(i,c,e);continue}let m=V.buildContextualParameters(p.contextResourceIdentifiers,a),h=d?ph({resourceConfig:u,operations:u.operations??[],coreOperation:K.READ,registry:a,hasResourceId:!!En.getResourceId(p.contextResourceIdentifiers?.[c]),contextResourceIdentifiers:p.contextResourceIdentifiers,contextualParameters:m}):p&&m?pY({operations:u.operations??[],childContext:p,contextualParameters:m}):void 0;if(!d&&h){let t;try{t=En.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:String(h.operationIdentifier),operation:h,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){hY(i,c,e);continue}let n=En.getResourceId(e.contextResourceIdentifiers?.[i])||void 0,r=s.relationship.isPrimaryScope===!0;if(n!==void 0)try{r=QG({childContext:t,hostResourceType:i,hostResourceId:n,hostRelationships:f?.resourceRelationships,selectedForeignKey:s.foreignKeyField,registry:a})===t}catch{r=!1}if(!r)continue}if(!h){Jve(i,s);continue}let g=qp({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)(()=>qve(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)=>En.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=En.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:K.READ,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return ph({resourceConfig:n,operations:n.operations??[],coreOperation:K.READ,registry:a,hasResourceId:!!En.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=En.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:K.LIST,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return pY({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:va.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:t,sourceOperation:bl(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:Y.OUTLINE,onClick:()=>b(e),children:e.label},e.relationshipEdgeKey);let r=a.resourceConfigurations[e.childResourceType];if(Gve(e)){let t=r?v(e):void 0;if(t){let n=_(e,t);return(0,$.jsx)(eY,{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)(uX,{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)(iY,{descentKey:`nested:${e.relationshipEdgeKey}::${g||`no-row`}`,children:(0,$.jsx)(Kk.Provider,{value:!0,children:x(e)})})}),[x,g]);return dY(m.length>0&&s&&!u),m.length===0||!s||u?null:(0,$.jsx)(eb,{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===Xt.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 vY({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_CONTAINER_NESTED,`ResourceLayout_ContainerNested`)(e);return(0,$.jsx)(n,{...t})}var yY=(0,Q.memo)(({resourceContext:e,navigationZone:t,navigationInitiator:n,currentObject:r,currentObjectDataMode:i,displayMode:a=Be.DETAIL,onOperationExecuted:o,size:s=Gd.ICON_SM,maxDisplayed:c,excludeOperations:l,placementFilter:u,hostRowOpensRead:d=!1,orientation:f,className:p})=>{let{resourceType:m,operation:h}=e,g=bm()?.getResourceConfiguration(m)?.frontendConfiguration?.layout,_=g?.actionLabelDisplayMode?.[a],v=Q.useContext($g)?.UIConfig?.currentBreakpoint===yi.MOBILE,y=g?.actionDisclosure?.[a]?.maxPrimaryActions??c??(v?a===Be.SUMMARY?0:1:void 0)??nn(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}=eH({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)(Mw,{open:x,onOpenChange:e=>{e||O()},cancelCallback:O,validationCallback:D,label:S,description:C,confirmLabel:w,requireTypedConfirmation:T,confirmationPhrase:E}),k&&(0,$.jsx)(uG,{open:!0,onAcknowledge:A,fields:k,resourceType:m})]})});function bY({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`ResourceLayout_OperationsItems`)(e);return(0,$.jsx)(n,{...t})}function xY({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DANGER_ZONE,`DangerZone`)(e);return(0,$.jsx)(n,{...t})}function SY({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_HEADING,`Heading`)(e);return(0,$.jsx)(n,{...t})}function CY({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_SUBHEADING,`Subheading`)(e);return(0,$.jsx)(n,{...t})}var wY=({resourceContext:e,navigationZone:t,currentObject:n,onOperationExecuted:r,className:i,responsiveMaxWidth:a})=>{let{resourceType:o,operation:s}=e,{tComponent:c,tResourceOperation:l}=J({component:U.RESOURCES_LAYOUTS_DANGER_ZONE,resource:o}),{items:u,isConfirmDialogOpen:d,confirmDialogLabel:f,confirmDialogDescription:p,confirmDialogConfirmLabel:m,confirmRequiresTypedConfirmation:h,confirmConfirmationPhrase:g,onConfirm:_,onCancel:v}=eH({resourceType:o,displayMode:Be.DETAIL,currentObject:n,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:s,placementFilter:dl.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(U.RESOURCES_LAYOUTS_DANGER_ZONE,e),x=b(`title`),S=e=>{switch(e){case Ac.CRITICAL:return b(`descriptionCritical`);case Ac.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:W(`mr-auto w-full flex flex-col gap-field-sm`,i),style:nD(a),children:[(0,$.jsx)(SY,{level:3,children:x}),(0,$.jsx)(xY,{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)(d_,{children:e.label}),(0,$.jsx)(Z,{variant:br.MUTED,size:gc.SM,children:C(e)})]}),(0,$.jsx)(X,{variant:qd(e.variant,GS(e)),disabled:e.disabled,onClick:e.onClick,className:`shrink-0 self-start sm:self-auto`,"data-operation-id":e.operationIdentifier,children:e.label})]},t))}),d&&(0,$.jsx)(Mw,{open:d,onOpenChange:e=>{e||v()},cancelCallback:v,validationCallback:_,label:f,description:p,confirmLabel:m,requireTypedConfirmation:h,confirmationPhrase:g})]})};function TY({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_DANGER_ZONE,`ResourceLayout_DangerZone`)(e);return(0,$.jsx)(n,{...t})}var Yve=il.getLogger(),EY;(function(e){e.IDLE=`idle`,e.LOADING=`loading`,e.READY=`ready`,e.NOT_SHAREABLE=`not_shareable`,e.FAILED=`failed`})(EY||={});function DY(e,t){return(e?.resourceConfigurations[gu.ORGANIZATION_RELATIONSHIPS]?.operations)?.find(e=>String(e.operationIdentifier)===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===E.API_CALL)}function OY(e,t,n,r){let i=gu.ORGANIZATION_RELATIONSHIPS,a={...nm.buildResourceOperationContextIdentifiers({currentOrganizationId:n,primaryScope:e.resourceConfigurations[i]?.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),...r?{[i]:r}:{}};return{operationPathKey:wi.buildOperationPathKeyFromOperation(t),contextualParameters:V.buildContextualParameters(a,e),parentResourcesRequirements:En.buildParentResourcesRequirements(i,a,e)}}function Xve(e){let t=e;return(t?.response?.data?.error?.details?.code??t?.context?.code)===Cte.RELATIONSHIP_RECORD_NOT_SHAREABLE}var kY={relationships:[],viaRelationshipId:null,sharedWithRelationshipIds:[],commonToEveryRelationship:!1};function Zve(e){let t=(0,Q.useContext)(cm),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)(EY.IDLE),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(kY),{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=DY(n,Ta.READ_RECORD_SHARING);if(!f||!n||!e||!p||!h||!t){y.current=void 0,_(void 0),s(EY.IDLE),l(!1),d(kY);return}let i=!1,a=`${p}|${m}|${h}`;return y.current===a?l(!0):(y.current=void 0,l(!1),d(kY),s(EY.LOADING)),(async()=>{try{let r=OY(n,t,p),o=Al.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(EY.READY),l(!1)}catch(e){if(i)return;if(y.current=void 0,_(a),l(!1),d(kY),Xve(e)){s(EY.NOT_SHAREABLE);return}Yve.warn(`[RecordSharing] The record's sharing could not be read`,{resourceType:m,backendRefusal:Ir(e)}),s(EY.FAILED)}})(),()=>{i=!0}},[f,n,p,m,h,i]);let b=(0,Q.useCallback)(async(e,t)=>{let i=r.current,o=DY(n,e);if(!n||!i||!o||!p||!h)throw Error(`The ${e} operation of organization relationships is not available in this frontend.`);let s=OY(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(Ta.SHARE_RECORD,e),[b]),S=(0,Q.useCallback)(e=>b(Ta.UNSHARE_RECORD,e),[b]);return o!==EY.IDLE&&o!==EY.LOADING&&g!==v?{readState:EY.LOADING,refreshing:!1,relationships:kY.relationships,viaRelationshipId:kY.viaRelationshipId,sharedWithRelationshipIds:kY.sharedWithRelationshipIds,commonToEveryRelationship:kY.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 Qve(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 AY(e){let t=e.registry?.resourceConfigurations[e.resourceType];if(!t||!Pee(e.resourceType,t.resourcePrimaryScope)||See.includes(e.resourceType)||!e.recordId||!e.currentOrganizationId||e.recordOrganizationId!==e.currentOrganizationId||!e.grants)return!1;let n=e.registry?.resourceConfigurations[gu.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope,r=t=>!!t&&Gm({...t,resourceType:gu.ORGANIZATION_RELATIONSHIPS,resourcePrimaryScope:n},e.viewer);return r(DY(e.registry,Ta.READ_RECORD_SHARING))&&r(DY(e.registry,Ta.SHARE_RECORD))&&!!DY(e.registry,Ta.UNSHARE_RECORD)}var jY=({resourceContext:e,currentObject:t,className:n,responsiveMaxWidth:r})=>{let{resourceType:i}=e,{tComponent:a,formatList:o}=J({component:U.RESOURCES_LAYOUTS_RECORD_SHARING,resource:i}),s=(e,t)=>a(U.RESOURCES_LAYOUTS_RECORD_SHARING,e,t),c=(0,Q.useContext)(cm)?.registry,l=Qp()?.currentOrganizationId??void 0,u=Qve(t,c?.resourceConfigurations[i]?.resourceFieldIdentifier),d=(typeof t?.organizationId==`string`&&t.organizationId.length>0?t.organizationId:void 0)??nh(i,u,e.contextResourceIdentifiers),f=sS(d),p=uS()[dv.GRANTS],m=AY({registry:c,resourceType:i,recordId:u,recordOrganizationId:d,currentOrganizationId:l,grants:p,viewer:f}),h=Zve({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!==EY.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!==EY.READY&&h.readState!==EY.FAILED||h.readState===EY.READY&&h.viaRelationshipId===null&&h.sharedWithRelationshipIds.length===0&&D.length===0&&M.length===0)return null;let L=b||h.refreshing,ee=e=>{x(!0),e().then(()=>_(void 0)).catch(()=>void 0).finally(()=>x(!1))},R=DY(c,Ta.SHARE_RECORD),z=e=>{cs(R?.riskLevel)?y(e):ee(()=>h.share(e))};return(0,$.jsxs)(`section`,{"data-slot":`record-sharing-section`,"data-inline-size-tier":r,className:W(`mr-auto w-full flex flex-col gap-field-sm`,n),style:nD(r),children:[(0,$.jsx)(SY,{level:3,children:s(`title`)}),(0,$.jsx)(kF,{className:`rounded-xl p-0 overflow-hidden divide-y divide-border`,children:h.readState===EY.FAILED?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:br.MUTED,size:gc.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:gc.SM,children:h.viaRelationshipId===null?s(`ownRecord`):s(`createdThrough`,{relationship:E(h.viaRelationshipId)})}),h.viaRelationshipId!==null&&!F?.confersNow&&(0,$.jsx)(Z,{variant:br.MUTED,size:gc.SM,children:s(`relationshipInactive`)}),h.viaRelationshipId!==null&&F?.confersNow&&!F.rolesReachRecord&&(0,$.jsx)(Z,{variant:br.MUTED,size:gc.SM,children:s(`creatorCannotRead`)}),(0,$.jsx)(Z,{variant:br.MUTED,size:gc.SM,children:h.commonToEveryRelationship?s(`commonToEveryRelationship`):s(P?`notReadableByRelationships`:`description`)}),M.length>0&&!h.commonToEveryRelationship&&(0,$.jsx)(Z,{variant:br.MUTED,size:gc.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:br.MUTED,size:gc.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)(d_,{children:E(e)}),t!==void 0&&(0,$.jsx)(Z,{variant:br.MUTED,size:gc.SM,children:t})]}),(0,$.jsx)(X,{variant:Y.OUTLINE,disabled:L,onClick:()=>ee(()=>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)(_F,{name:`recordSharingRelationship`,schema:gd(),options:D.map(e=>({value:e.relationshipId,label:E(e.relationshipId)})),value:A,onChange:_,placeholder:s(`chooseRelationship`),size:Jd.SM,disabled:L}),(0,$.jsx)(X,{variant:Y.SECONDARY,disabled:L||!A,onClick:()=>{A&&z(A)},className:`shrink-0 self-start sm:self-auto`,children:s(`share`)})]})]})}),j!==void 0&&(0,$.jsx)(Mw,{open:!0,onOpenChange:e=>{e||y(void 0)},cancelCallback:()=>y(void 0),validationCallback:()=>{let e=j;y(void 0),ee(()=>h.share(e))},label:s(`confirmShareTitle`,{relationship:E(j)}),description:s(`confirmShareDescription`),confirmLabel:s(`share`)})]})};function MY({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_RECORD_SHARING,`ResourceLayout_RecordSharing`)(e);return(0,$.jsx)(n,{...t})}var NY=(0,Q.createContext)(void 0);function PY(){return(0,Q.useContext)(NY)}function $ve(e){let{registry:t,doOperation:n}=pm(),[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?Mc(n.resourceRelationships):[]).some(e=>e.discriminator!=null||e.condition!=null)},[e.enabled,e.resourceContext.resourceType,t]),o=sV({resourceType:e.resourceContext.resourceType,rowIds:[En.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=En.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),l=ph({resourceConfig:r,operations:r.operations??[],coreOperation:K.READ,registry:t,hasResourceId:!!c,contextResourceIdentifiers:e.resourceContext.contextResourceIdentifiers,contextualParameters:o});if(!l){i(void 0);return}let u=wi.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 FY=({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i,showCharts:a=!0})=>{let{goBack:o,canGoBack:s,navigate:c}=SS(),{getZoneState:l}=Mx(),{registry:u}=pm(),{tComponent:d,isReady:f}=J({component:U.RESOURCES_LAYOUTS_READ}),{resourceContext:p,resourceType:m,operation:h,isSemanticCustomOperation:g,reportError:_,resolvePreferredOperation:v,navigateToResourceOperation:y}=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),[b,x]=(0,Q.useState)(void 0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(void 0),[E,D]=(0,Q.useState)(void 0),O=(0,Q.useCallback)((e,t)=>{x(e),C(!1),T(t.canonicalRecord),D(t.holdsCanonicalRecord)},[]),k=E??String(p.operation.operationIdentifier)===K.READ,A=(0,Q.useMemo)(()=>k?{record:w,failed:S}:void 0,[k,w,S]),j=bp({tComponent:d,componentType:U.RESOURCES_LAYOUTS_READ,key:`displayFailed`}),M=bp({tComponent:d,componentType:U.RESOURCES_LAYOUTS_READ,key:`semanticOperationFailed`}),N=$ve({resourceContext:p,enabled:g}),P=(0,Q.useMemo)(()=>wj({inlineParentContext:r,navigationZone:t,navigationInitiator:n,getZoneState:l}),[r,t,n,l]),F=(0,Q.useCallback)(e=>{let n=P?.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===va.RESOURCE_OPERATION&&a.content.resourceContext.resourceType===r&&En.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):En.buildParentResourcesRequirements(r,f,u),g={};for(let e of h){let t=e.foreignKeyField??e.resourceType,n=f[t]??f[e.resourceType],r=En.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:K.READ,registry:u,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:g,contextualParameters:_});if(!v)return!1;let y=En.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:v,contextResourceIdentifiers:g,parentResourcesRequirements:h}),b=Um.resolveResourceUrl(d,v,Vu(g),u.allResourceFieldIdentifiers,h);return c({content:{contentType:va.RESOURCE_OPERATION,resourceContext:y},initiator:{sourceZone:t},urlPath:b?.resolvedUrl}),!0},[s,p.contextResourceIdentifiers,p.parentResourcesRequirements,l,o,c,P,t,u]),I=(0,Q.useMemo)(()=>{let e=P?.parentReference;if(e)return{parentResourceType:e.parentResourceType,parentResourceId:e.parentResourceId,displayMode:e.parentDisplay??Rt.CONTEXT,showParentLink:e.showParentLink,onNavigateToParent:F}},[P,F]),L=(0,Q.useCallback)(e=>{C(!0),_(e,j,`ResourceLayoutPreset_Read_Default`)},[j,_]),ee=(0,Q.useCallback)(e=>{let n=bl(e);if(n!==K.DELETE&&n!==K.DELETE_MANY)return;if(s(t)||t!==so.PRIMARY){o(t);return}let r=v(K.LIST);if(!r)return;let{[m]:i,...a}=p.contextResourceIdentifiers??{};y({operation:r,contextResourceIdentifiers:a,parentResourcesRequirements:p.parentResourcesRequirements})},[o,s,t,v,y,m,p.contextResourceIdentifiers,p.parentResourcesRequirements]),R=(0,Q.useMemo)(()=>V.flattenContextIdentifiers(p.contextResourceIdentifiers),[p.contextResourceIdentifiers]);return f===!1?null:g?(0,$.jsx)(RU,{hostResourceType:p.resourceType,contextResourceIdentifiers:R,navigationZone:t,navigationInitiator:n,children:(0,$.jsxs)(oY,{children:[(0,$.jsx)(mV,{resourceContext:p,navigationZone:t,navigationInitiator:n,errorMessage:M,errorComponent:`ResourceLayoutPreset_Read_Default`,headerActions:(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:nX.ACTION_BAR}),recordNavigation:(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:nX.RECORD_NAVIGATION})}),(0,$.jsxs)(xD,{voice:ii.EYEBROW,children:[(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:nX.CONTENT}),(0,$.jsx)(vY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:N})]})]})}):(0,$.jsx)(RU,{hostResourceType:p.resourceType,contextResourceIdentifiers:R,navigationZone:t,navigationInitiator:n,children:(0,$.jsx)(oY,{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)(uV,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentReferenceConfig:I,heldRecord:A,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:nX.ACTION_BAR}),(0,$.jsx)(bY,{resourceContext:p,currentObject:b,navigationZone:t,navigationInitiator:n,displayMode:Be.DETAIL,placementFilter:dl.PRIMARY,size:Gd.ICON_SM,onOperationExecuted:ee})]})}),(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:nX.RECORD_NAVIGATION}),(0,$.jsx)(`div`,{"data-record-body":!0,children:(0,$.jsx)(eY,{resourceContext:p,navigationZone:t,onError:L,onDataLoaded:O,parentReferenceConfig:I,recordNameShownAbove:!0})}),(0,$.jsx)(iX,{resourceContext:p,navigationZone:t,showCharts:a,renderSlot:nX.CONTENT}),(0,$.jsxs)(xD,{voice:ii.EYEBROW,children:[(0,$.jsx)(NY.Provider,{value:b,children:i}),(0,$.jsx)(vY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:b})]}),(0,$.jsx)(MY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,className:`[max-inline-size:var(--record-body-max-inline-size)]`}),(0,$.jsx)(TY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,onOperationExecuted:ee,className:`[max-inline-size:var(--record-body-max-inline-size)]`})]})})})},IY=(0,Q.createContext)(new Set);function LY({preset:e,...t}){let n=ZW(t.resourceContext.operation),r=QW(t.resourceContext.operation),i=e??r??Gr.DEFAULT,a=(0,Q.useContext)(IY),o=(0,Q.useMemo)(()=>wi.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)(IY.Provider,{value:c,children:(0,$.jsx)(n,{...t})});let l=q(U.RESOURCES_LAYOUTS_READ,`ResourceLayout_Read`)(i);return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(l,{...t})})}var RY=il.getLogger(),zY=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r})=>{let{resourceType:i,operation:a,resourceConfig:o,operationInitiator:s,contextualParameters:c,navigateToResourceOperation:l}=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tComponent:u,tResourceFieldDisplay:d,tResourceFieldEnumValue:f}=J({component:[U.RESOURCES_LAYOUTS_SEARCH,U.RESOURCES_LAYOUTS_LIST],resource:i}),p=lp(),m=e=>u(U.RESOURCES_LAYOUTS_SEARCH,e),{renderIcon:h}=kf(),{getRecipe:g}=Ig(),_=g(_t.INTERACTIVE,vi.GHOST),{registry:v,doOperation:y}=pm(),[b]=ch(),x=a.operationFrontendConfig?.collectionDisplayConfig,S=x?.cardLayout,C=x?.cardActionPlacement,w=x?.selectable??!1,T=S?.style===Hc.GRID,E=S?.style===Hc.GRID?S.columns:void 0,D=o?.resourceFieldIdentifier,O=tH({idField:D}),k=Ix(),[A,j]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)([]),L=(0,Q.useRef)(null),ee=Dq(L,O.selectionCount>0),R=Eq(O.selectionCount>0),z=F.length>0&&F.every(e=>O.isSelected(e)),te=(0,Q.useCallback)(()=>{F.length>0&&F.every(e=>O.isSelected(e))?F.forEach(e=>O.deselectItem(e)):F.forEach(e=>O.selectItem(e))},[F,O]),[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)(()=>{O.clearSelection()},[N,fe]);let me=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${U.RESOURCES_LAYOUTS_SEARCH}`],[i]),he=a?.operationIdentifier??K.SEARCH,{isInitialLoad:ge,isRefreshing:_e}=Xy(lg({resourceType:i,operation:he})),ve=(0,Q.useRef)(y),ye=(0,Q.useRef)(e),B=(0,Q.useRef)(ue),be=(0,Q.useRef)(fe);ve.current=y,ye.current=e,B.current=ue,be.current=fe;let xe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),Se=(0,Q.useMemo)(()=>UG.searchOperationAcceptsATerm(a),[a]),Ce=(0,Q.useMemo)(()=>UG.detectSummaryFields(o),[o]),we=(0,Q.useMemo)(()=>bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_SEARCH,key:`resultsLabel`}),[u]),Te=(0,Q.useMemo)(()=>{let e={};for(let t of Ce)e[t]=d(i,t,`label`);return e},[Ce,i,d]),Ee=(0,Q.useCallback)(e=>o?ph({resourceConfig:o,operations:o.operations??[],coreOperation:K.READ,registry:v,hasResourceId:En.getResourceId(e[i]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,v)})??null:null,[v,o,i]),{sortFields:De,filterFields:Oe,filtersEnabled:ke}=(0,Q.useMemo)(()=>{let t=a,n=t?.sortFields??[],r=UG.parseFilterFieldDefinitions(t?.filterFields,o?{registry:v,resourceConfig:o,operation:a,contextualParameters:c,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),i=UG.withoutPinnedFilterFields(r,e.pinnedFilters);return{sortFields:n,filterFields:i,filtersEnabled:i.length>0}},[a,v,o,c,e.parentResourcesRequirements,e.pinnedFilters]),Ae=(0,Q.useMemo)(()=>En.extractDataMode(b,r),[b,r]),je=(0,Q.useMemo)(()=>wi.createOperationPathKeyFromOperation(a),[a]),Me=UG.matchListingOf(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{P(A)},300);return()=>clearTimeout(e)},[A]);let Ne=ue.map(e=>`${e.field}:${e.direction}`).join(`,`),Pe=(0,Q.useMemo)(()=>JSON.stringify(fe),[fe]),Fe=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]),{emit:Ie}=qo();(0,Q.useEffect)(()=>{Ie(xc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:i,filterValues:be.current})},[Pe,i,Ie]);let Le=`${i}|${je}|${xe}|${N}|${oe.page}|${oe.limit}|${Ne}|${Pe}|${Fe}|${Se}`;(0,Q.useEffect)(()=>{if(!N&&!ie&&Se)return;let e=!1,t=!1,n=()=>{t||(t=!0,le(!1))};return(async()=>{le(!0),re(null),ae(!0);try{let t=UG.withPinnedFilters(be.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:B.current.length?[...B.current]:void 0,parentResourcesRequirements:ye.current.parentResourcesRequirements,dataMode:Ae},i=await ve.current(je,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=M(t);re({message:p(t)}),RY.error(`[ResourceLayoutPreset_Search_Default] Search error:`,{...n,error:t})}finally{e||n()}})(),()=>{e=!0,n()}},[Le]);let Re=(0,Q.useCallback)(e=>{if(!o)return;let t=V.getResourceObjectId(e,o.resourceFieldIdentifier);if(!t){RY.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=En.buildRecordIdentifiersFromCollection(ye.current.contextResourceIdentifiers,i,t),r=Ee(n);r&&l({operation:r,contextResourceIdentifiers:n,parentResourcesRequirements:ye.current.parentResourcesRequirements,initiatorOverride:s})},[o,o?.resourceFieldIdentifier,i,l,s,Ee]),ze=(0,Q.useCallback)(e=>{de(e),se(e=>({...e,page:1}))},[]),Be=(0,Q.useCallback)(e=>{pe(e),se(e=>({...e,page:1}))},[]),Ve=(0,Q.useCallback)(e=>{e.preventDefault(),P(A)},[A]),He=h(H.SEARCH,{size:Jn.SM});return(0,$.jsx)(eb,{i18nKeys:me,readiness:[{id:`search-initial-load`,isReady:!ge}],renderLoading:()=>(0,$.jsx)(mm,{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)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),Se&&(0,$.jsxs)(`form`,{onSubmit:Ve,role:`search`,className:`flex gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(tN,{type:`text`,value:A,onChange:e=>j(e.target.value),placeholder:m(`placeholder`),"aria-label":m(`placeholder`),prefix:He})}),(0,$.jsx)(X,{type:`submit`,disabled:ce,children:m(`search`)})]}),(ke||De.length>0&&ie)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[ke&&Oe.length>0&&(0,$.jsx)(nq,{resourceType:i,filterFields:Oe,currentFilters:fe,onFiltersChange:Be}),De.length>0&&ie&&(0,$.jsx)(_q,{resourceType:i,sortFields:De,currentSorts:ue,onSortChange:ze})]}),w&&ie&&(F.length>0||O.selectionCount>0||R.backgroundRunState!==Tq.NONE)&&(0,$.jsxs)(`div`,{ref:L,className:`flex flex-nowrap items-center gap-element`,"data-slot":`collection-selection-row`,children:[F.length>0&&(0,$.jsx)(xq,{state:bq(F.length,F.filter(e=>O.isSelected(e)).length),onToggle:te}),(0,$.jsx)(yq,{count:O.selectionCount,onClear:O.clearSelection,...z&&!O.matchAllSelection&&oe.total>F.length&&Me?{matchAllOffer:{matchedCount:oe.total,onSelectAllMatching:()=>O.selectAllMatching({filters:UG.withPinnedFilters(fe,e.pinnedFilters),...N?{search:N}:{},listing:Me,matchedCount:oe.total})}}:{},...O.matchAllSelection?{isMatchAllSelected:!0}:{}}),R.isBulkBarMounted&&(0,$.jsx)(`div`,{className:`ms-auto min-w-0`,children:(0,$.jsx)(wq,{density:ee.density,onActionSetChange:ee.reportActionSet,onBackgroundRunChange:R.onBackgroundRunChange,children:(0,$.jsx)(IJ,{resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:O.selectedItems,selectedItemsDataMode:Ae,matchAllSelection:O.matchAllSelection,explicitIdSelection:O.explicitIdSelection,onSelectIds:O.selectIds,idField:D,onSelectionClear:O.clearSelection,onSelectionReplace:O.selectAll})})})]}),ne&&(0,$.jsx)(Ly,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_SEARCH,key:`errorLoading`}),message:ne.message}),k.isCreateActive&&(0,$.jsx)(RG,{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:bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`})}):(0,$.jsx)(`div`,{className:`space-y-item-sm`,children:(0,$.jsx)(`ul`,{role:`list`,"aria-label":we,style:AG(E),className:W(kG(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(rs.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:i,component:`ResourceLayoutPreset_Search`});let s=V.getResourceObjectId(n,a);return k.isElementActive(s)?(0,$.jsx)(`li`,{className:W(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(RG,{navigationZone:t})},s||r):(0,$.jsx)(`li`,{className:W(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(LG,{item:n,resourceType:i,resourceConfig:o,registry:v,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:Ce,fieldLabelsMap:Te,tResourceFieldEnumValue:f,onItemClick:Re,cardActionPlacement:C,selectable:w,isSelected:O.isSelected(n),selectionActive:O.selectionCount>0,onToggleSelect:O.toggleSelection,selectAriaLabel:u(U.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:r+1}),interactiveClasses:{hover:_.states.hover,transition:_.motion.transition}})},s||r)})})}),(0,$.jsx)(aK,{pagination:oe,onPaginationChange:se})]})]})})};function BY({preset:e,...t}){let n=ZW(t.resourceContext.operation),r=QW(t.resourceContext.operation),i=e??r??x.DEFAULT,a=n?(0,$.jsx)(n,{...t}):Q.createElement(q(U.RESOURCES_LAYOUTS_SEARCH,`ResourceLayout_Search`)(i),t);return(0,$.jsx)(Fx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[mA]:!0,children:a})})}var VY=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=J({component:U.RESOURCES_LAYOUTS_UPDATE}),{resourceContext:a,operation:o,isSemanticCustomOperation:s,navigateToPreferredRead:c,goBackWithinZone:l,reportError:u}=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),d=bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_UPDATE,key:`formUpdateFailed`}),f=bp({tComponent:r,componentType:U.RESOURCES_LAYOUTS_UPDATE,key:`semanticOperationFailed`}),{closeOverlay:p}=SS(),m=(0,Q.useCallback)(()=>{o.isBulkOperation?l():c({transitionOverride:t===Vn.OVERLAY?Ka.PROMOTE:void 0})},[l,c,t,o.isBulkOperation]),h=iz(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===Vn.OVERLAY?()=>p():void 0,[t,p]);return i?s?(0,$.jsx)(mV,{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)(uV,{resourceContext:a,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(vB,{resourceContext:a,navigationZone:t,onSuccess:g,onError:_,onCancel:v,showErrorSummary:!0})]}):null};function HY({preset:e,...t}){let n=ZW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=QW(t.resourceContext.operation),i=e??r??G.DEFAULT,a=q(U.RESOURCES_LAYOUTS_UPDATE,`ResourceLayout_Update`)(i);return(0,$.jsx)(a,{...t})}function UY({resourceContext:e,navigationZone:t,navigationInitiator:n}){let r={resourceContext:e,navigationZone:t,navigationInitiator:n},i=Ls(e.operation),a;switch(i){case`create`:a=(0,$.jsx)(fG,{...r});break;case`list`:a=(0,$.jsx)(uX,{...r});break;case`read`:a=(0,$.jsx)(LY,{...r});break;case`update`:a=(0,$.jsx)(HY,{...r});break;case`search`:a=(0,$.jsx)(BY,{...r});break;default:a=(0,$.jsx)(eG,{...r})}return(0,$.jsx)(aC,{...r,children:a})}function WY(e){return`${ac.COMPOSITE_VIEWS}.${e}`}function GY(e){return`${ac.VIEWS}.${e.family}.${e.translationRef}`}function KY(e){return`app.${e}`}function qY(e,t){return`resources.${e}.${t}`}function JY(e){let t=Mp(e);if(!t)return Dp(e);if(t.viewKind===xp.COMPOSITE_VIEW)return t.hostKind===Vp.RESOURCE?mp(t.hostRef,t.localRef):Dp(t.localRef)}function YY(e){let t=Mp(e.viewRef);if(e.contentType===va.CHART_VIEW)return t?.viewKind===xp.CHART_VIEW?{family:Vl.CHART,translationRef:qY(t.hostRef,t.localRef)}:{family:Vl.CHART,translationRef:KY(e.viewRef)};if(e.contentType===va.EXECUTION_VIEW)return t?.viewKind===xp.EXECUTION_VIEW?{family:Vl.EXECUTION,translationRef:qY(t.hostRef,t.localRef)}:{family:Vl.EXECUTION,translationRef:KY(e.viewRef)};if(e.contentType===va.FULL_CUSTOM_VIEW)return{family:Vl.FULL_CUSTOM,translationRef:KY(e.viewRef)};if(e.contentType===va.FLOWS_ACTORS_VIEW)return{family:Vl.FLOWS_ACTORS,translationRef:KY(e.viewRef)}}function XY(e){if(e.contentType===va.COMPOSITE_VIEW){let t=JY(e.viewRef);return t?e.tCompositeView(t,`title`):e.viewRef}let t=YY({viewRef:e.viewRef,contentType:e.contentType});return t?e.tView(t.family,t.translationRef,`title`):e.viewRef}var eye={[va.FULL_CUSTOM_VIEW]:`view-custom-`,[va.EXECUTION_VIEW]:`view-execution-`,[va.FLOWS_ACTORS_VIEW]:`view-flows-`,[va.CHART_VIEW]:`view-chart-`},ZY=({viewRef:e,contentType:t,hasAuthoredIcon:n=!1,iconViewRef:r,navigationZone:i=Vn.PRIMARY,className:a})=>{let o=qk(),s=(0,Q.useMemo)(()=>{if(t===va.COMPOSITE_VIEW){let t=JY(e);return t?[WY(t)]:[]}let n=YY({viewRef:e,contentType:t});return n?[GY(n)]:[]},[e,t]),{tCompositeView:c,tView:l,isReady:u}=J({keys:s}),{renderIcon:d}=kf(),{title:f,description:p}=(0,Q.useMemo)(()=>{if(t===va.COMPOSITE_VIEW){let t=JY(e);return t?{title:c(t,`title`),description:c(t,`description`)}:{title:``,description:``}}let n=YY({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=eye[t];return i?d({category:Qt.CUSTOM,customReference:`${i}${r??e}`},{size:Jn.LG}):null},[n,t,e,r,d]);return!u||o||!f?null:(0,$.jsxs)(`div`,{className:W(a),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-field`,children:[(0,$.jsx)(CB,{host:xB.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 tye(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-${crypto.randomUUID()}`:`execution-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var QY=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=Vn.PRIMARY})=>{let i=Qp(),{doOperation:a,registry:o}=pm(),{navigate:s}=SS(),{tComponent:c,isReady:l}=J({component:U.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??Op({viewRef:e,registry:o}),C=(0,Q.useMemo)(()=>tye(),[S?.ref]);(0,Q.useEffect)(()=>{},[n,S,e]);let w=(0,Q.useMemo)(()=>{let e=nm.buildInitiatorIds({userId:i?.currentUserId,organizationId:i?.currentOrganizationId,applicationId:i?.currentApplicationId,anonymousUserId:i?.currentAnonymousUserId}),t=S?.primaryScope?nm.primaryScopeToContextIdentifiers(e,S.primaryScope):{},r=i?.buildContextResourceIdentifiers()??{},a=nm.filterCustomScopeContextResourceIdentifiers(r);if(!S)return nm.mergeContextResourceIdentifiers(t,a,n);let o=nm.getAllowedViewBindingKeys({primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements});return nm.resolveViewContextResourceIdentifiers({surfaceName:`ExecutionView`,surfaceRef:S.ref,primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:a,explicitContextResourceIdentifiers:nm.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?Pve(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?nce({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=>{ry(e.content),d(e),y(e=>ky(e,ey.EMBEDDED_CONTENT)),x(e=>ly(e,iy.EMBEDDED_CONTENT))},closeEmbeddedContent:()=>{d(null),y(e=>ky(e,ey.EMBEDDED_CONTENT)),x(e=>ly(e,iy.EMBEDDED_CONTENT))},openLocalPane:(e,t)=>{ny(t),p({paneId:e,payload:t}),y(t=>Ay(t,e)),x(t=>uy(t,e))},closeLocalPane:()=>{p(null),y(e=>Ay(e,null)),x(e=>uy(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=>{$v(e),_(t=>({...t,[e.prefetchRuntimeId]:e}))},endParticipationPrefetch:e=>{_(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},markDirty:e=>{ty(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=>{ay(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=>py(t,e))}}),[s,r]);if(!S)return(0,$.jsx)(c_,{viewKind:`execution`,viewRef:e});if(!l)return null;let k=e=>bp({tComponent:c,componentType:U.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)(cy,{viewDefinition:S,contextResourceIdentifiers:w,runtimeInstanceId:C,navigationZone:r,doOperation:a,navigation:O,anchor:T,participations:D,runtimeState:E,children:[(0,$.jsx)(ZY,{viewRef:e??S.ref,iconViewRef:S.ref,contentType:va.EXECUTION_VIEW,hasAuthoredIcon:!!S.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Vy,{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:Y.LINK,size:Gd.SM,onClick:()=>{O.closeEmbeddedContent()},children:k(`embeddedClose`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,$.jsx)(Ey,{scope:{scope:ey.EMBEDDED_CONTENT},children:(0,$.jsx)(UY,{resourceContext:M.resourceContext,navigationZone:r,navigationInitiator:j?.navigationInitiator})})})]})]}):N})]})};function $Y(e){let t={};for(let[n,r]of Object.entries(e.contextResourceIdentifiers)){let e=En.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 eX(e,t){return!e||e.length===0||e.every(e=>{if(e.requirement!==vc.MANDATORY||e.isPrimaryScope)return!0;let n=e.foreignKeyField?t[e.foreignKeyField]:void 0,r=t[e.resourceType];return!!(n??r)})}function tX({resourceContext:e,viewRef:t,navigationZone:n,navigationInitiator:r}){let i=(0,Q.useMemo)(()=>yp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>$Y(e),[e]);return(0,$.jsx)(GU,{viewRef:i.insertedViewRef,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r})}function nye({resourceContext:e,viewRef:t,inputs:n,urlParamValues:r,className:i}){let{registry:a}=pm(),o=(0,Q.useMemo)(()=>Sp(e.resourceType,{ref:t}),[e.resourceType,t]),s=(0,Q.useMemo)(()=>$Y(e),[e]),c=a.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(e=>e.ref===t);if(!c)throw iye(`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)(Wh,{requiredFeatures:c.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewRef:o.insertedViewRef,viewDefinition:c,runtimeDescriptor:_p({identity:o,chartView:c,contextResourceIdentifiers:s}),contextResourceIdentifiers:s,inputs:n,urlParamValues:r,localErrorOnly:!0})})})}function rye({resourceContext:e,viewRef:t,navigationZone:n,className:r}){let i=(0,Q.useMemo)(()=>fp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>$Y(e),[e]);return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(QY,{viewRef:i.insertedViewRef,navigationZone:n,contextResourceIdentifiers:a})})}function iye(e,t){return V.buildConfigurationError(rs.CONFIGURATION,{component:`ResourceOwnedViewEmbeds`,message:e,...t})}var nX;(function(e){e.ACTION_BAR=`action_bar`,e.RECORD_NAVIGATION=`record_navigation`,e.CONTENT=`content`,e.ALL=`all`})(nX||={});var rX=(0,Q.createContext)(new Set);function iX({resourceContext:e,navigationZone:t,navigationInitiator:n,className:r=``,chartHeight:i=320,showCharts:a=!0,renderSlot:o=nX.ALL}){let{registry:s}=pm(),c=(0,Q.useContext)(rX),{navigate:l}=SS(),{renderIcon:u}=kf(),d=s.resourceConfigurations[e.resourceType]?.frontendConfiguration,f=(0,Q.useMemo)(()=>(d?.compositeViews??[]).map(e=>WY(e.translationRef)),[d?.compositeViews]),p=(0,Q.useMemo)(()=>[...(d?.chartViews??[]).map(t=>GY({family:Vl.CHART,translationRef:qY(e.resourceType,t.ref)})),...(d?.executionViews??[]).map(t=>GY({family:Vl.EXECUTION,translationRef:qY(e.resourceType,t.ref)}))],[d?.chartViews,d?.executionViews,e.resourceType]),{tCompositeView:m,tResourceHeader:h,tResourceOperation:g,tView:_}=J({keys:[...f,...p]}),v=(0,Q.useMemo)(()=>$Y(e),[e]),y=e.operation,b=y.isOperationDefault===!0||!y.variantKey,x=String(y.operationIdentifier),S=bD(),C=x===K.READ?ii.EYEBROW:S,{getRecipe:w}=Ig(),T=(0,Q.useMemo)(()=>b?x:hp([x,String(y.variantKey)]),[x,b,y.variantKey]),E=(0,Q.useMemo)(()=>b?(d?.compositeViews??[]).filter(e=>String(e.operationLike)===x&&eX(e.parentResourcesRequirements,v)):[],[v,x,d?.compositeViews,b]),D=(0,Q.useMemo)(()=>b?(d?.chartViews??[]).filter(e=>String(e.operationLike)===x&&eX(e.parentResourcesRequirements,v)):[],[v,x,d?.chartViews,b]),O=(0,Q.useMemo)(()=>(d?.executionViews??[]).filter(e=>(e.surfaceInOperations??[]).some(e=>hp(e)===T)&&eX(e.parentResourcesRequirements,v)),[v,T,d?.executionViews]),k=(0,Q.useMemo)(()=>{if(E.length===0&&D.length===0&&O.length===0)return[];let t={registry:s,contextResourceIdentifiers:v,views:{},tResourceHeader:h,tResourceOperation:g,tViewTitle:(e,t)=>XY({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 E)r.isAddressable?aX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:y.operationIdentifier,familyLabel:`composite`,launcher:r.launcher}):c.has(r.ref)||n.push({type:`embedded-composite`,ref:r.ref});if(a)for(let t of D)n.push({type:`chart`,ref:t.ref,chartView:t,title:_(Vl.CHART,qY(e.resourceType,t.ref),`title`)});for(let r of O)aX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:y.operationIdentifier,familyLabel:`execution`,launcher:r.launcher});return n},[c,E,D,O,v,y.operationIdentifier,s,e.resourceType,a,m,_,h,g]),A=(0,Q.useCallback)(e=>{l({content:{contentType:e.kind,viewRef:e.ref,contextResourceIdentifiers:e.contextResourceIdentifiers},initiator:{sourceZone:t},urlPath:e.urlPath})},[l,t]),j=(0,Q.useMemo)(()=>{if(o===nX.ALL)return k;let e={[Ip.ACTION_BAR]:nX.ACTION_BAR,[Ip.RECORD_NAVIGATION]:nX.RECORD_NAVIGATION,[Ip.CONTENT_CARD]:nX.CONTENT};return k.flatMap(t=>{if(t.type!==`launcher-group`)return o===nX.CONTENT?[t]:[];let n=t.views.filter(t=>e[t.presentation.placement]===o);return n.length>0?[{...t,views:n}]:[]})},[k,o]);return j.length===0?null:(0,$.jsx)(xD,{voice:C,children:(0,$.jsx)(`div`,{className:W(`space-y-section`,r),"data-testid":`resource-layout-inserted-views`,children:j.map((r,a)=>r.type===`embedded-composite`?(0,$.jsx)(rX.Provider,{value:new Set([...c,r.ref]),children:(0,$.jsx)(tX,{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:W(`mb-element-sm`,C?w(_t.TYPOGRAPHY,C).base:`text-sm font-medium text-foreground`),children:r.title}),(0,$.jsx)(Wh,{requiredFeatures:r.chartView.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewDefinition:r.chartView,runtimeDescriptor:_p({identity:Sp(e.resourceType,r.chartView),chartView:r.chartView,contextResourceIdentifiers:v}),height:i,localErrorOnly:!0})})]},`chart:${r.ref}:${a}`):(0,$.jsx)(aye,{renderSlot:o,children:r.views.map(e=>(0,$.jsx)(Wh,{requiredFeatures:e.requiredFeatures,children:(0,$.jsxs)(X,{"data-testid":`inserted-view-launcher-${e.ref}`,type:`button`,variant:e.presentation.emphasized?Y.DEFAULT:o===nX.RECORD_NAVIGATION?Y.GHOST:Y.OUTLINE,size:Gd.SM,onClick:()=>A(e),"aria-label":e.presentation.showLabel?void 0:e.label,title:e.presentation.showLabel&&o!==nX.ACTION_BAR?void 0:e.label,children:[e.iconReference?u(e.iconReference,{size:Jn.SM}):e.kind===va.COMPOSITE_VIEW?u({category:Qt.COMPOSITE_VIEW,viewReference:e.ref},{size:Jn.SM}):u({category:Qt.CUSTOM,customReference:`view-execution-${e.ref}`},{size:Jn.SM}),e.presentation.showLabel&&(0,$.jsx)(`span`,{className:o===nX.ACTION_BAR?`@max-[48rem]/resource-header:sr-only`:void 0,children:e.label})]})},`${e.kind}:${e.ref}`))},`launcher-group:${a}`))})})}function aye({renderSlot:e,children:t}){return e===nX.ACTION_BAR?(0,$.jsx)($.Fragment,{children:t}):e===nX.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 oye(e){return e?.contentType===va.COMPOSITE_VIEW||e?.contentType===va.EXECUTION_VIEW}function aX(e){let{resolvedSegments:t,resolutionContext:n,resourceType:r,viewRef:i,operationIdentifier:a,familyLabel:o,launcher:s}=e,c=Jm({kind:gs.RESOURCE_VIEW,resourceType:r,viewRef:i},n);if(!c)throw oX(`Operation "${String(a)}" on resource "${r}" could not resolve resource-owned ${o} view "${i}".`);if(!oye(c))throw oX(`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:Nm(s)},u=t[t.length-1];u?.type===`launcher-group`?u.views.push(l):t.push({type:`launcher-group`,views:[l]})}function oX(e){return V.buildConfigurationError(rs.CONFIGURATION,{component:`ResourceLayout_InsertedViews`,message:e})}var sX=il.getLogger(),cX=sX.debugByType(`ResourceLayoutPreset_List_Default`);sX.setDebugTypeLogging(`ResourceLayoutPreset_List_Default`,!1);var lX=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r,sourceRelationship:i,showCharts:a=!0,defaultViewMode:o=vs.CARDS})=>{let{resourceType:s,operation:c,operationId:l,resourceConfig:u,operationInitiator:d,contextualParameters:f,resolvePreferredOperation:p,navigateToResourceOperation:m}=eC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tResourceHeader:h,tResourceFieldDisplay:g,tResourceFieldEnumValue:_,tResourceOperation:v,tComponent:y,formatDate:b,formatDateTime:x,isReady:S,resolvedRegionalPreferences:C}=J({component:U.RESOURCES_LAYOUTS_LIST,resource:s}),{t:w}=J({resource:s}),T=lp(),{renderIcon:E}=kf(),{registry:D,doOperation:O}=pm(),[k]=ch(),{getRecipe:A}=Ig(),j=A(_t.INTERACTIVE,vi.GHOST),N=(0,Q.useMemo)(()=>({...d,sourceRelationship:i??n?.sourceRelationship}),[d,i,n?.sourceRelationship]),P=c.operationFrontendConfig?.collectionDisplayConfig,F=P?.displayMode??o??vs.CARDS,I=P?.userSwitchableDisplayMode??!1,L=P?.quickFilterField,ee=UG.withoutPresetsAssigningPinnedFields(P?.presetFilters,e.pinnedFilters),R=e.collectionToolbar!==Go.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===Hc.GRID,ue=oe?.style===Hc.GRID?oe.columns:void 0,{viewMode:de,setViewMode:fe}=Ove(s,F),pe=I?de:F,me=(0,Q.useMemo)(()=>[vs.CARDS,vs.TABLE,...re?[vs.BOARD]:[],...ie?[vs.CALENDAR]:[],...ae?[vs.TIMELINE]:[]],[re,ie,ae]),he=me.includes(pe)?pe:vs.CARDS,ge=u?.resourceFieldIdentifier,_e=Ix(),ve=tH({idField:ge}),[ye,B]=(0,Q.useState)([]),be=ye.length>0&&ye.every(e=>ve.isSelected(e)),xe=bq(ye.length,ye.filter(e=>ve.isSelected(e)).length),{isSelected:Se,selectItem:Ce,deselectItem:we,toggleSelection:Te}=ve,Ee=(0,Q.useCallback)(()=>{ye.length>0&&ye.every(e=>Se(e))?ye.forEach(e=>we(e)):ye.forEach(e=>Ce(e))},[ye,Se,Ce,we]),[De,Oe]=(0,Q.useState)(null),[ke,Ae]=(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}}),[je,Me]=(0,Q.useState)(!1),[Ne,Pe]=(0,Q.useState)([]),[Fe,Ie]=(0,Q.useState)({}),Le=(0,Q.useMemo)(()=>[`resources.${s}`,`components.${U.RESOURCES_LAYOUTS_LIST}`],[s]),Re=(0,Q.useMemo)(()=>[{id:`initial-data`,isReady:je}],[je]),ze=(0,Q.useCallback)(()=>{Ae(e=>({...e,page:1}))},[]),Ve=(0,Q.useRef)(O),He=(0,Q.useRef)(Ne),Ue=(0,Q.useRef)(Fe);Ve.current=O,He.current=Ne,Ue.current=Fe,(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]);let We=(0,Q.useMemo)(()=>Object.entries(f).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[f]),Ge=sS($V(e.contextResourceIdentifiers,void 0)??void 0),Ke=(0,Q.useMemo)(()=>{if(!u)return{create:null,read:null,search:null};let t=p(K.CREATE,{requireLiteralIdentifier:!0}),n=t?.operationFrontendConfig;return{create:t&&n&&!ld(n)&&n.actionVisibility!==Gl.HIDDEN&&Gm({...t,resourceType:e.resourceType,resourcePrimaryScope:u.resourcePrimaryScope},Ge)?t:null,read:p(K.READ,{requireAddressable:!0})||null,search:p(K.SEARCH)||null}},[u,p,Ge,e.resourceType]),qe=(0,Q.useCallback)(e=>{if(!u)return null;let t=t=>ph({resourceConfig:u,operations:u.operations??[],coreOperation:K.READ,registry:D,hasResourceId:En.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&&!ld(r.operationFrontendConfig)?r:null},[c,D,u,s]),Je=(0,Q.useMemo)(()=>{let e=[{resourceType:s,operation:l}];return Ke.search&&e.push({resourceType:s,operation:String(Ke.search.operationIdentifier)}),e},[s,l,Ke.search]),Ye=(0,Q.useMemo)(()=>u?.frontendConfiguration?.emptyState,[u]),{sortFields:Xe,filterFields:Ze,searchEnabled:Qe,filtersEnabled:$e}=(0,Q.useMemo)(()=>{let t=c,n=Ke.search,r=(t?.sortFields?.length?t.sortFields:n?.sortFields)??[],i=t?.filterFields&&Object.keys(t.filterFields).length>0?t.filterFields:n?.filterFields,a=UG.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:UG.withoutPinnedFilterFields(a,e.pinnedFilters),searchEnabled:o,filtersEnabled:s}},[Ke.search,c,D,u,f,e.parentResourcesRequirements,e.pinnedFilters]),et=C?.timezone,tt=(0,Q.useMemo)(()=>$_e(C?.locale),[C?.locale]),nt=ho.calendarDateToday({timezone:et}),[rt,it]=(0,Q.useState)(()=>TJ(nt)),at=(0,Q.useCallback)(e=>it(TJ(e)),[]),ot=ie&&he===vs.CALENDAR?Ze.find(e=>e.fieldName===ie.dateField&&e.fieldType===zG.DATE):void 0,st=(0,Q.useMemo)(()=>ie?VG(u?.mainSchema,u?.inheritenceSchemaDefinition).has(ie.dateField):!1,[ie,u]),ct=(0,Q.useMemo)(()=>eve(rt,tt),[rt,tt]),lt=!!ae&&he===vs.TIMELINE&&[ae.startField,ae.endField].every(e=>Ze.some(t=>t.fieldName===e&&t.fieldType===zG.DATE)),ut=(0,Q.useMemo)(()=>VG(u?.mainSchema,u?.inheritenceSchemaDefinition),[u]),dt=(0,Q.useMemo)(()=>uve(rt),[rt]),ft=(0,Q.useMemo)(()=>{if(ie&&ot)return{[ie.dateField]:rve(tve(ct),st,et)};if(ae&&lt)return fve({startField:ae.startField,endField:ae.endField,startIsCalendarDate:ut.has(ae.startField),endIsCalendarDate:ut.has(ae.endField),timeZone:et,firstDay:dt[0],lastDay:dt[dt.length-1]})},[ie,ot,ct,st,et,ae,lt,ut,dt]),pt=(0,Q.useRef)(ft);pt.current=ft;let mt=(0,Q.useMemo)(()=>JSON.stringify(ft??{}),[ft]);(0,Q.useEffect)(()=>{Ae(e=>e.page===1?e:{...e,page:1})},[mt]);let{quickFilterDef:ht,panelFilterFields:gt}=(0,Q.useMemo)(()=>{if(!L)return{quickFilterDef:void 0,panelFilterFields:Ze};let e=Ze.find(e=>e.fieldName===L&&e.fieldType===zG.ENUM&&(e.enumValues?.length??0)>0);return e?{quickFilterDef:e,panelFilterFields:Ze.filter(t=>t!==e)}:{quickFilterDef:void 0,panelFilterFields:Ze}},[Ze,L]),vt=(0,Q.useMemo)(()=>UG.detectSummaryFields(u),[u]),yt=(0,Q.useMemo)(()=>bp({tComponent:y,componentType:U.RESOURCES_LAYOUTS_LIST,key:`errorLoading`}),[y]),bt=(0,Q.useMemo)(()=>v(s,K.CREATE,`title`),[v,s]),xt=(0,Q.useMemo)(()=>bp({tComponent:y,componentType:U.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`}),[y]),St=(0,Q.useMemo)(()=>bp({tComponent:y,componentType:U.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)(()=>En.extractDataMode(k,r,Yl.SUMMARY),[k,r]),Tt=(0,Q.useMemo)(()=>wi.createOperationPathKeyFromOperation(c),[c]),Et=(0,Q.useMemo)(()=>UG.searchOperationAcceptsATerm(Ke.search)&&nK({listOperation:c,searchOperation:Ke.search??void 0,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements,pinnedFilters:e.pinnedFilters,resourceType:s,resourceFieldIdentifier:String(u?.resourceFieldIdentifier??``),registry:D}),[Ke.search,f,c,D,u,e.parentResourcesRequirements,e.pinnedFilters,s]),Dt=(0,Q.useMemo)(()=>!Ke.search||!Et?null:wi.createOperationPathKeyFromOperation(Ke.search),[Ke.search,Et]),Ot=mK({enabled:Qe&&!!Ke.search&&Et,onDebouncedChange:ze}),kt=Ot.debouncedQuery;(0,Q.useEffect)(()=>{ve.clearSelection()},[Fe,kt]);let At=(0,Q.useRef)(e);At.current=e;let jt=Ne.map(e=>`${e.field}:${e.direction}`).join(`,`),Mt=(0,Q.useMemo)(()=>JSON.stringify(Fe),[Fe]),Nt=e.pinnedFilters,Pt=(0,Q.useMemo)(()=>JSON.stringify(Nt??{}),[Nt]),{emit:Ft,resourceCollectionRefreshEvent:It}=qo(),{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(xc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:s,filterValues:Ue.current})},[Mt,s,Ft]);let Rt=kt.length>0&&!!Dt,zt=`${s}|${Rt?Dt:Tt}|${We}|${ke.limit}|${jt}|${Mt}|${Pt}|${mt}|${kt}|${Lt??0}`,Bt=`${zt}|page:${ke.page}`,Vt=(0,Q.useCallback)(async(e,t,n)=>{let r=UG.withPinnedFilters(e,At.current.pinnedFilters);if(Rt&&Dt){cX(`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:He.current.length?[...He.current]:void 0,parentResourcesRequirements:At.current.parentResourcesRequirements,dataMode:wt};return Ve.current(Dt,e)}cX(`Calling doOperation (LIST)`,{operationPathKey:Tt});let i={page:t,limit:n};return He.current.length&&(i.sort=He.current.map(e=>`${e.field}:${e.direction}`).join(`,`)),Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&(i[e]=t)}),Ve.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?Ke.search?.maxPaginatedResultPerPageLimit??50:c?.maxPaginatedResultPerPageLimit??100,[Wt,Gt]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{cX(`useEffect triggered`,{fetchKey:Bt,resourceType:s});let e=!1;return(async()=>{cX(`fetchData started`,{fetchKey:Bt,operationPathKey:Tt,contextualParameters:f}),Oe(null);try{let t=ave(Ue.current,pt.current);if(pt.current){let n=await hve({requestPage:(e,n)=>Ht.current(t,e,n),pageLimit:Ut});if(e)return;B(n.items),Gt(n.notShown),Me(!0);return}let n=await Ht.current(t,ke.page,ke.limit);if(cX(`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;B(e.data),Ae(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)&&(B(n),Ae(e=>e.total===n.length&&e.totalPages===1?e:{...e,total:n.length,totalPages:1}));Me(!0)}catch(t){if(e){cX(`Fetch cancelled after error`,{fetchKey:Bt});return}let n=M(t);Oe({message:T(t)}),sX.error(`Fetch error`,{...n,error:t,fetchKey:Bt})}finally{cX(`fetchData finally block`,{cancelled:e,fetchKey:Bt})}})(),()=>{cX(`useEffect cleanup`,{cancelled:e,fetchKey:Bt}),e=!0}},[Bt]);let Kt=(0,Q.useCallback)(e=>{Pe(e),Ae(e=>({...e,page:1}))},[]),qt=(0,Q.useCallback)(e=>{Ie(e),Ae(e=>({...e,page:1}))},[]),Jt=(0,Q.useCallback)(e=>{L&&(Ie(t=>{let n={...t};return e===void 0?delete n[L]:n[L]=e,n}),Ae(e=>({...e,page:1})))},[L]),Yt=(0,Q.useMemo)(()=>{if(!ne||he!==vs.CARDS)return null;let e=Ze.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,Ze,_,s]),Xt=(0,Q.useMemo)(()=>Yt||!te||he!==vs.CARDS?null:wve(ye,te,u?.mainSchema,b,u?.inheritenceSchemaDefinition),[ye,te,he,b,Yt,u]),Zt=Yt??Xt,Qt=re&&he===vs.BOARD?Ze.find(e=>e.fieldName===re.groupByField):void 0,$t=(0,Q.useMemo)(()=>Qt?.fieldType===zG.ENUM?Qt.enumValues??[]:[],[Qt]),en=(0,Q.useCallback)(e=>V.getResourceObjectId(e,String(u?.resourceFieldIdentifier??``))??``,[u?.resourceFieldIdentifier]),tn=vve({enabled:$t.length>0,vocabulary:$t,groupByField:re?.groupByField??``,readerFilters:Fe,reloadKey:zt,pageSize:ke.limit,requestPage:Vt,getItemId:en}),nn=(0,Q.useMemo)(()=>!re||!Qt?null:U_e({vocabulary:$t,labelOf:e=>_(s,re.groupByField,e,Qt.schema),pages:tn.pages,collectionTotal:je?ke.total:void 0}),[re,Qt,$t,tn.pages,je,ke.total,_,s]),rn=(0,Q.useMemo)(()=>{if(!re||!u)return;let t=W_e(u.operations??[],re.transitionOperation).filter(e=>Gm({...e,resourceType:s,resourcePrimaryScope:u.resourcePrimaryScope},Ge));if(t.length!==0)return{operations:t,resourceType:s,subjectDataMode:wt,organizationId:$V(e.contextResourceIdentifiers,void 0)??void 0}},[re,u,s,Ge,wt,e.contextResourceIdentifiers]),an=(0,Q.useCallback)(async(t,n,r)=>{if(!re)return;let i=en(t);if(!i)return;let a=En.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,i);await q_e({groupByField:re.groupByField,targetValue:n,call:t=>O(wi.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,O,D,T]),on=(0,Q.useMemo)(()=>!ie||!ot?new Map:nve({items:ye,dateField:ie.dateField,calendarField:st,timeZone:et}),[ie,ot,ye,st,et]),sn=(0,Q.useMemo)(()=>!ae||!lt?[]:dve({items:ye,startField:ae.startField,endField:ae.endField,startIsCalendarDate:ut.has(ae.startField),endIsCalendarDate:ut.has(ae.endField),timeZone:et,days:dt}),[ae,lt,ye,ut,et,dt]),cn=C?.locale,ln=(0,Q.useMemo)(()=>{let e=new Intl.DateTimeFormat(cn||void 0,{weekday:`short`,timeZone:`UTC`});return(ct[0]??[]).map(({day:t})=>e.format(t))},[cn,ct]),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?Ke.create?m({operation:Ke.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,Ke.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?qe(En.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n))!==null:!1},[u,e.contextResourceIdentifiers,s,qe]),mn=(0,Q.useCallback)(t=>{if(!u)return;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);if(!n){sX.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=En.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n),i=qe(r);i&&m({operation:i,contextResourceIdentifiers:r,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N})},[u,m,u?.resourceFieldIdentifier,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,N,qe]),hn=(0,Q.useCallback)((n,r)=>{let i=u?.resourceFieldIdentifier;if(!i)return null;let a=V.getResourceObjectId(n,i),o=a?En.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,a):e.contextResourceIdentifiers,c=qe(o),l=En.createFrontendResourceOperationContextFromOperation({resourceType:s,operation:c??e.operation,contextResourceIdentifiers:o});return(0,$.jsx)(bY,{resourceContext:l,navigationZone:t,navigationInitiator:N,currentObject:n,currentObjectDataMode:wt,displayMode:Be.SUMMARY,size:Gd.ICON_SM,orientation:r,hostRowOpensRead:!0})},[u,s,e.contextResourceIdentifiers,e.operation,qe,t,N,wt]),gn=(e,n)=>{let r=u?.resourceFieldIdentifier;if(!r)throw V.buildConfigurationError(rs.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:W(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(RG,{navigationZone:t})},i||n):(0,$.jsx)(`li`,{className:W(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:_n(e,n)},i||n)},_n=(t,n)=>(0,$.jsx)(LG,{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(U.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:n+1}),operationsSlot:hn(t,se?.orientation),interactiveClasses:{hover:`hover:bg-muted/50`,transition:j.motion.transition}}),vn=E(H.PLUS,{size:Jn.SM}),yn=Ke.create?(0,$.jsxs)(X,{onClick:fn,size:Gd.SM,"data-slot":`collection-create`,className:`inline-flex items-center gap-element`,children:[vn,(0,$.jsx)(`span`,{children:bt})]}):void 0,bn=dK({isSearchActive:Rt,filterValues:Fe}),xn=R&&!!Ke.create,Sn=oK(Ye,xn),Cn=fK({hasLoadedOnce:je,itemCount:ye.length,isNarrowed:bn,emptyStateOffersCreate:Sn})?yn:void 0,wn=(0,Q.useMemo)(()=>(u?.operations??[]).some(e=>Va(e)),[u]),Tn=(0,Q.useMemo)(()=>{let e={page:ke.page,limit:ke.limit};Ne.length&&(e.sort=Ne.map(e=>`${e.field}:${e.direction}`).join(`,`));for(let[t,n]of Object.entries(UG.withPinnedFilters(Fe,Nt)))n!=null&&n!==``&&(e[t]=n);Rt&&(e.q=kt);let t={list:UG.variantKeyOf(c),...Ke.search?{search:UG.variantKeyOf(Ke.search)}:{}};return{params:e,isSearchActive:!!kt,listingVariantKeys:t}},[ke.page,ke.limit,Ne,Fe,Nt,kt,Rt,c,Ke.search]),Dn=UG.matchListingOf(UG.listingOperationShown({inlineSearchTerm:kt,listOperation:c,searchOperation:Ke.search})),On=wn?(0,$.jsx)(Sve,{resourceContext:e,navigationZone:t,navigationInitiator:N,collectionExportQuery:Tn}):void 0;return S?De?(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(uV,{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:De.message})]})]}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),R&&(0,$.jsx)(o_e,{resourceType:s,quickFilter:ht?{field:ht,value:Fe[ht.fieldName],onChange:Jt}:void 0,presetFilters:ee,search:Ot.isVisible?{query:Ot.query,onChange:Ot.handleChange,onClear:Ot.handleClear}:void 0,filterFields:$e?gt:[],filterPanel:z,filterValues:Fe,onFiltersChange:qt,sort:he===vs.CARDS&&Xe.length>0?{sortFields:Xe,sortStates:Ne,onSortChange:Kt}:void 0,viewMode:I?{viewMode:he,onViewModeChange:fe,availableModes:me}:void 0,primaryAction:Cn,collectionActions:On,...ce&&he!==vs.TABLE&&ye.length>0?{selectAll:{state:xe,onToggle:Ee}}:{},selection:ce?{count:ve.selectionCount,onClear:ve.clearSelection,...be&&!ve.matchAllSelection&&ke.total>ye.length&&Dn?{matchAllOffer:{matchedCount:ke.total,onSelectAllMatching:()=>ve.selectAllMatching({filters:UG.withPinnedFilters(Fe,Nt),...kt?{search:kt}:{},listing:Dn,matchedCount:ke.total})}}:{},...ve.matchAllSelection?{isMatchAllSelected:!0}:{}}:void 0,bulkActions:ce?(0,$.jsx)(IJ,{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)(eb,{i18nKeys:Le,loadingScopes:Je,readiness:Re,renderLoading:()=>(0,$.jsx)(mm,{template:he===vs.TABLE?`table`:le?`card`:`list`,density:`auto`,count:ke.limit,"aria-hidden":`true`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(iX,{resourceContext:e,navigationZone:t,showCharts:a}),_e.isCreateActive&&(0,$.jsx)(RG,{navigationZone:t,className:`border border-border rounded-lg`}),ft&&Wt>0&&(0,$.jsx)(jD,{variant:`warning`,"data-slot":`collection-window-not-shown`,children:(0,$.jsx)(ND,{children:y(U.RESOURCES_LAYOUTS_LIST,`displayWindowRowsNotShown`,{count:Wt})})}),ie&&ot?(0,$.jsx)(lve,{weeks:ct,itemsByDay:on,month:rt,today:nt,firstDayOfWeek:tt,onMonthChange:at,monthHeading:b(DJ(rt),{yearMonth:!0}),weekdayLabels:ln,dayNumberLabel:e=>un.format(e),dayLabel:(e,t)=>y(U.RESOURCES_LAYOUTS_LIST,`calendarDayItemCount`,{date:b(e,{calendarDate:!0}),count:t}),getItemId:en,getItemLabel:dn,canOpenItem:pn,onOpenItem:mn,calendarLabel:St,previousMonthLabel:y(U.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(U.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(U.RESOURCES_LAYOUTS_LIST,`displayToday`),keyboardHint:y(U.RESOURCES_LAYOUTS_LIST,`calendarKeyboardHint`)}):ae&&lt?(0,$.jsx)(mve,{days:dt,placements:sn,month:rt,today:nt,onMonthChange:at,monthHeading:b(DJ(rt),{yearMonth:!0}),dayNumberLabel:e=>un.format(e),getItemId:en,getItemLabel:dn,barLabel:(e,t,n)=>y(U.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(U.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(U.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(U.RESOURCES_LAYOUTS_LIST,`displayToday`),emptyMonthLabel:y(U.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)(lK,{resourceType:s,config:Ye,hasCreateOperation:xn,onCreateAction:fn,variant:R?`default`:`compact`,title:e.emptyStateWords?.title,description:e.emptyStateWords?.description}):he===vs.TABLE?(0,$.jsx)(V_e,{items:ye,resourceType:s,resourceConfig:u,navigationZone:t,summaryFields:vt,contextResourceIdentifiers:e.contextResourceIdentifiers,fieldLabelsMap:Ct,sortFields:Xe,sortStates:Ne,onSortChange:Kt,selectable:ce,isRowSelected:Se,onToggleRow:Te,allSelected:be,onToggleAll:Ee,renderRowActions:hn,onRowClick:mn,canOpenRow:pn}):nn?(0,$.jsx)(Q_e,{columns:nn,onLoadMore:e=>{tn.loadMore(e)},loadMoreLabel:e=>y(U.RESOURCES_LAYOUTS_LIST,`boardLoadMore`,{count:e}),columnLoadFailedLabel:y(U.RESOURCES_LAYOUTS_LIST,`boardColumnLoadFailed`),ungroupedNote:e=>y(U.RESOURCES_LAYOUTS_LIST,`boardUngroupedNote`,{count:e}),renderCard:_n,getItemId:en,transition:rn,onMoveItem:an,boardLabel:St,ungroupedLabel:y(U.RESOURCES_LAYOUTS_LIST,`boardUngrouped`),columnCountLabel:e=>y(U.RESOURCES_LAYOUTS_LIST,`boardColumnCount`,{count:e}),moveHint:y(U.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:kG(ue),style:AG(ue),children:e.items.map((e,t)=>gn(e,n+t))})]},`${e.key}:${t}`)})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":St,className:kG(ue),style:AG(ue),children:ye.map(gn)}),!nn&&!ft&&(0,$.jsx)(aK,{pagination:ke,onPaginationChange:Ae})]})})]}):null};function uX({preset:e,...t}){let n=ZW(t.resourceContext.operation),r=e??QW(t.resourceContext.operation)??Ie.DEFAULT,i=n?(0,$.jsx)(n,{...t}):Q.createElement(q(U.RESOURCES_LAYOUTS_LIST,`ResourceLayout_List`)(r),t);return(0,$.jsx)(Fx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[mA]:!0,children:i})})}var dX=il.getLogger(),sye=dX.debugByType(`PublicLayout_MainContainer`);dX.setDebugTypeLogging(`PublicLayout_MainContainer`,!1);function fX({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_MAIN_CONTAINER,`PublicLayout_MainContainer`)(e);return sye(`Render preset=${e} card=${t.useCardLayout?`yes`:`no`} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var pX;(function(e){e.DEFAULT=`default`,e.MUTED=`muted`,e.CONTRAST=`contrast`,e.DESTRUCTIVE=`destructive`,e.SUCCESS=`success`,e.INHERIT=`inherit`})(pX||={});var mX;(function(e){e.HOVER=`hover`,e.ALWAYS=`always`,e.NONE=`none`})(mX||={});var hX;(function(e){e.NORMAL=`normal`,e.MEDIUM=`medium`,e.SEMIBOLD=`semibold`})(hX||={});function gX({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_LINK,`Link`)(e);return(0,$.jsx)(n,{...t})}var _X=({href:e,onClick:t,children:n})=>(0,$.jsx)(Z,{children:(0,$.jsx)(gX,{href:e,onClick:t,children:n})}),vX=({code:e,errorParam:t,errorDescription:n})=>{let{handleAuthCodeExchange:r,auth:i}=gm(),{tComponent:a,isReady:o}=J({component:U.PUBLIC_LAYOUTS_AUTH_CALLBACK}),s=lp(),c=og(),l=e=>a(U.PUBLIC_LAYOUTS_AUTH_CALLBACK,e),u=(0,Q.useMemo)(()=>z(c.search),[c.search]),d=(0,Q.useMemo)(()=>Oi(Pa.login,u),[u]),f=(0,Q.useMemo)(()=>Yt(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(io.ERROR_GENERIC))):e?i.accessToken||i.onboardingSessionId?h.current=!0:(h.current=!0,r(e).catch(e=>{m(s(e,l(io.ERROR_EXCHANGE_FAILED)))})):(h.current=!0,m(l(io.ERROR_NO_CODE))))},[e,t,n,i.accessToken,i.onboardingSessionId,r]);let g=zp(i,u);return g?(0,$.jsx)(Vh,{to:g,replace:!0}):i.accessToken&&!i.isLoading?(0,$.jsx)(Vh,{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)(SY,{children:l(io.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:p})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(_X,{href:d,children:l(io.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(io.VERIFYING)})]}):null};function yX({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_AUTH_CALLBACK,`Auth_AuthCallback`)(e);return(0,$.jsx)(n,{...t})}var cye=()=>{let[e]=ch(),t=e.get(`code`),n=e.get(`error`),r=e.get(`error_description`);return(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(yX,{code:t,errorParam:n,errorDescription:r})})},bX;(function(e){e.REPORTED=`reported`,e.NOTHING_TO_REPORT=`nothing_to_report`})(bX||={});var lye=()=>{let[e]=ch(),{tComponent:t,isReady:n}=J({component:U.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(bX.NOTHING_TO_REPORT):(hH(t?{code:t}:{error:n??void 0}),i(bX.REPORTED),window.close())},[e]),!n||r===null?null:(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(Z,{className:`text-sm`,children:t(U.PUBLIC_LAYOUTS_AUTH_CALLBACK,r===bX.REPORTED?io.REAUTH_RETURNING:io.REAUTH_NO_RESULT)})})};function xX({mfaRequired:e,mfaSessionId:t,usableSecondFactorMethods:n,email:r,authRedirectTarget:i}){let a=oh();(0,Q.useEffect)(()=>{e&&t&&(n.length===0?a(Oi(Pa.enrollmentRequired,i),{replace:!0}):a(Oi(`${Pa.mfaChallenge}?sessionId=${t}&email=${encodeURIComponent(r||``)}`,i),{replace:!0}))},[e,t,n,a,r,i])}var SX=({token:e,email:t,redirect:n})=>{let r=vte(n)?n:void 0,{handleMagicLinkVerify:i,auth:a}=gm(),{tComponent:o,isReady:s}=J({component:U.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY}),c=lp(),l=e=>o(U.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,e),u=Pa.login,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{p.current||(!e||!t?(p.current=!0,f(l(To.ERROR_INVALID_LINK))):a.accessToken?p.current=!0:(p.current=!0,i(e,t).then(e=>{!e.success&&!e.requiresMFA&&f(c(null,l(To.ERROR_VERIFICATION_FAILED)))}).catch(e=>{f(c(e,l(To.ERROR_EXPIRED)))})))},[e,t,a.accessToken,i]),xX({mfaRequired:a.mfaRequired,mfaSessionId:a.mfaSessionId,usableSecondFactorMethods:a.usableSecondFactorMethods,email:t??void 0,authRedirectTarget:r});let m=zp(a,r);return m?(0,$.jsx)(Vh,{to:m,replace:!0}):a.accessToken&&!a.isLoading?(0,$.jsx)(Vh,{to:r??Pa.home,replace:!0}):s?d?(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)(SY,{children:l(To.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(_X,{href:u,children:l(To.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(To.VERIFYING)})]}):null};function CX({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,`Auth_MagicLinkVerify`)(e);return(0,$.jsx)(n,{...t})}var uye=()=>{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)(fX,{useCardLayout:!0,children:(0,$.jsx)(CX,{token:t,email:n,redirect:r})})},dye=()=>{let{auth:e}=ag(),{tComponent:t,isReady:n}=J({component:U.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`email`}),(0,$.jsx)($L,{name:`password`}),e.error&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.error})}),(0,$.jsx)(rO,{label:(e=>t(U.PUBLIC_LAYOUTS_USER_AUTH,e))(vu.SUBMIT),submittingLabel:`…`,fullWidth:!0})]}):null},fye=({email:e,onSuccess:t,onError:n,isLoading:r,t:i})=>{let{authenticateWithPassword:a}=ag(),o=lp(),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)(rE,{schema:No,defaultValues:c,onSubmit:s,validationMode:Kn.ON_BLUR,disabled:r,labels:{fields:{email:i(vu.EMAIL_ADDRESS),password:i(vu.PASSWORD)}},layoutTemplate:dye},`password-auth`)},wX={[Us.PASSWORD]:H.KEY,[Us.PASSKEY]:H.FINGERPRINT,[Us.MAGIC_LINK]:H.MAIL,[Us.EMAIL_OTP]:H.MAIL,[Us.SMS_OTP]:H.MESSAGE_CIRCLE,[Us.TOTP]:H.SMARTPHONE,[Us.ORG_SAML]:H.ORGANIZATION,[Us.ORG_OPENID_CONNECT]:H.ORGANIZATION,[Us.EXTERNAL_OAUTH2]:H.LINK},pye={[Us.PASSWORD]:vu.METHOD_PASSWORD,[Us.MAGIC_LINK]:vu.METHOD_MAGIC_LINK,[Us.PASSKEY]:vu.METHOD_PASSKEY,[Us.SMS_OTP]:vu.METHOD_SMS_OTP,[Us.ORG_SAML]:vu.METHOD_ORG_SSO,[Us.ORG_OPENID_CONNECT]:vu.METHOD_ORG_SSO,[Us.EXTERNAL_OAUTH2]:vu.METHOD_EXTERNAL_OAUTH2};function mye(e,t,n){if(e===Us.ORG_SAML||e===Us.ORG_OPENID_CONNECT)return t.offeredMethod?.config?.displayName?.trim()||void 0;if(e!==Us.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 TX(e,t){let n=mye(e,t,t.resolveSocialProviderLabel);if(n&&t.continueWithTemplate.includes(`{provider}`))return t.continueWithTemplate.replace(`{provider}`,n);let r=pye[e];return r?t.translateLabel(r):e}var EX=({method:e})=>{let{renderIcon:t}=kf();return t(wX[e],{size:Jn.SM})},hye=({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 Tc().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)(SY,{children:n(vu.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:n(vu.MAGIC_LINK_SENT_DESCRIPTION)}),(0,$.jsx)(Z,{children:(0,$.jsx)(gX,{href:`#`,onClick:e=>{e.preventDefault(),a(!1)},children:n(vu.MAGIC_LINK_TRY_ANOTHER_METHOD)})})]}):(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:Qd.WRAP,onClick:c,disabled:o||t,children:[(0,$.jsx)(EX,{method:Us.MAGIC_LINK}),o?`…`:n(vu.MAGIC_LINK_SEND)]})})};function DX({fieldName:e,submitLabel:t,submittingLabel:n,fieldProps:r}){let{formState:i}=BC();return(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{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 OX=5e3,gye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=gm(),a=lp(),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 Tc().smsOTPDelivery(e);if(t)return;if(n){g(!0);return}}catch{}!t&&Date.now()-n<12e4&&(r=setTimeout(()=>{i()},OX))}};return r=setTimeout(()=>{i()},OX),()=>{t=!0,r!==void 0&&clearTimeout(r)}},[p,e]);let _=(0,Q.useMemo)(()=>()=>(0,$.jsx)(DX,{fieldName:`code`,submitLabel:r(cl.VERIFY_BUTTON),submittingLabel:r(cl.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 Tc().smsOTPSend(e),g(!1),c(!0),m(e=>e+1)}catch(e){let t=a(e,r(cl.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,Us.SMS_OTP,n.code.trim());o.success?t(o):b(a(null,r(cl.ERROR_INVALID_CODE)))}catch(e){b(a(e,r(cl.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(cl.SMS_OTP_SENT)}),h&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:r(cl.SMS_OTP_UNDELIVERED)})}),(0,$.jsx)(rE,{schema:Ts,defaultValues:{code:``},onSubmit:S,validationMode:Kn.ON_BLUR,disabled:n||l,onFormReady:v,labels:{fields:{code:r(cl.SMS_OTP_CODE_LABEL)}},layoutTemplate:_},`sms-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:x,disabled:l,children:r(cl.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(cl.SMS_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:Qd.WRAP,onClick:x,disabled:l||n,children:[(0,$.jsx)(EX,{method:Us.SMS_OTP}),r(l?cl.SMS_OTP_SENDING:cl.SMS_OTP_SEND)]}),d&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})})]})},_ye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=gm(),a=lp(),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)(DX,{fieldName:`code`,submitLabel:r(cl.VERIFY_BUTTON),submittingLabel:r(cl.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 Tc().mfaEmailOTPSend(e),c(!0)}catch(e){let t=a(e,r(cl.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,Us.EMAIL_OTP,n.code.trim());o.success?t(o):g(a(null,r(cl.ERROR_INVALID_CODE)))}catch(e){g(a(e,r(cl.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(cl.EMAIL_OTP_SENT)}),(0,$.jsx)(rE,{schema:Jl,defaultValues:{code:``},onSubmit:v,validationMode:Kn.ON_BLUR,disabled:n||l,onFormReady:m,labels:{fields:{code:r(cl.EMAIL_OTP_CODE_LABEL)}},layoutTemplate:p},`email-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:_,disabled:l,children:r(cl.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(cl.EMAIL_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:Qd.WRAP,onClick:_,disabled:l||n,children:[(0,$.jsx)(EX,{method:Us.EMAIL_OTP}),r(l?cl.EMAIL_OTP_SENDING:cl.EMAIL_OTP_SEND)]}),d&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})})]})},vye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=gm(),a=lp(),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>()=>(0,$.jsx)(DX,{fieldName:`code`,submitLabel:r(cl.VERIFY_BUTTON),submittingLabel:r(cl.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,Us.TOTP,n.code.trim());o.success?t(o):u(a(null,r(cl.ERROR_INVALID_CODE)))}catch(e){u(a(e,r(cl.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(cl.TOTP_DESCRIPTION)}),(0,$.jsx)(rE,{schema:eie,defaultValues:{code:``},onSubmit:d,validationMode:Kn.ON_BLUR,disabled:n,onFormReady:c,labels:{fields:{code:r(cl.TOTP_CODE_LABEL)}},layoutTemplate:s},`totp-challenge`)]})},yye=({sessionId:e,onSuccess:t,onError:n,isLoading:r,t:i,factorLevel:a})=>{let{handlePasskeyAuth:o}=gm(),s=lp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>a===`first`?vu:cl,[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:Qd.WRAP,onClick:m,disabled:c||r,children:[(0,$.jsx)(EX,{method:Us.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)})})})},bye=yn,xye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=og(),l=e.config?.displayName||`SSO`,u=e.config?.connectionId,d=od(c),f=(0,Q.useCallback)(()=>{if(!u){s(n(vu.SSO_CONFIGURATION_ERROR));return}a(!0);let e=lo(dr.AUTH_SAML_LOGIN,{connectionId:u}),t=Tc().getBaseURL(),r=t===window.location.origin?window.location.origin:``;window.location.href=`${t}${bye}${e}?returnUrl=${encodeURIComponent(`${r}${d}`)}`},[u,d,n]),p=r===`first`?n(vu.CONTINUE_WITH).replace(`{provider}`,l):l;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:Qd.WRAP,onClick:f,disabled:t||i,children:[(0,$.jsx)(EX,{method:Us.ORG_SAML}),i?`…`:p]}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},Sye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=og(),l=lp(),u=e.config?.displayName||`SSO`,d=e.config?.connectionId,f=e.config?.scopeType,p=e.config?.scopeId,m=f===ad.ORGANIZATION?p:void 0,h=od(c),g=f===ad.APPLICATION?p:void 0,_=(0,Q.useCallback)(async()=>{if(!d)s(n(vu.SSO_CONFIGURATION_ERROR));else{a(!0),s(null);try{let e=Tc();if(!m&&!g){s(n(vu.SSO_CONFIGURATION_ERROR)),a(!1);return}let t=m?await e.getEnterpriseSSOAuthorizationUrl(m,d,h):await e.getAppEnterpriseSSOAuthorizationUrl(d,h,{headers:{[Te.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(vu.CONTINUE_WITH).replace(`{provider}`,u):u;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:Qd.WRAP,onClick:_,disabled:t||i,children:[(0,$.jsx)(EX,{method:Us.ORG_OPENID_CONNECT}),i?`…`:v]}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},kX=({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 AX(e){return sb({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,fallbackLabel:e.brandLabel,translate:e.translate})}function jX(e){let t=e.publicProviders;return t?Object.entries(t).map(([e,t])=>({key:e,providerRef:e,displayName:t.displayName,displayNameLabelKey:Cd(e)})):[]}var MX={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`})})}},NX={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`})]})},PX=({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=MX[o]??null,u=AX({providerRef:o,displayName:s,displayNameLabelKey:c,brandLabel:l?.label,translate:a}),d=l?.brandClass??NX.brandClass,f=l?.icon??NX.icon;return(0,$.jsxs)(X,{type:`button`,variant:Y.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)(kX,{label:o})]}),Cye=({methodConfig:e,isLoading:t,t:n})=>{let{initiateOAuth2Login:r}=ag(),{appConfig:i}=Eu(),a=og(),[o,s]=(0,Q.useState)(null),c=lp(),l=e.oauth2ProviderRefs||[],u=(0,Q.useMemo)(()=>jX({publicProviders:Object.fromEntries(l.map(e=>[e,i.auth?.socialOAuth2Providers?.[e]??{}]))}),[i.auth?.socialOAuth2Providers,l]),d=(0,Q.useMemo)(()=>ob(u.map(e=>e.displayNameLabelKey)),[u]),{t:f}=J({keys:d}),p=(0,Q.useMemo)(()=>od(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)(PX,{providers:u,onProviderClick:m,isLoading:t,continueWithLabel:n(vu.CONTINUE_WITH),translate:f}),o&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o})})]})},FX={};FX[Us.PASSWORD]=fye,FX[Us.MAGIC_LINK]=hye,FX[Us.SMS_OTP]=gye,FX[Us.EMAIL_OTP]=_ye,FX[Us.TOTP]=vye,FX[Us.PASSKEY]=yye,FX[Us.ORG_SAML]=xye,FX[Us.ORG_OPENID_CONNECT]=Sye,FX[Us.EXTERNAL_OAUTH2]=Cye;var IX={};function LX(e,t){IX[e]=t}var RX;(function(e){e.REFLOW=`reflow`,e.LIST=`list`})(RX||={});var zX=({methods:e,labelFor:t,onSelect:n,disabled:r,layout:i=RX.REFLOW,className:a})=>{if(e.length===0)return null;let o=i===RX.REFLOW;return(0,$.jsx)(`div`,{className:W(o?`flex flex-wrap gap-element`:`flex flex-col gap-item`,a),children:e.map(e=>(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,labelOverflow:Qd.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)(EX,{method:e}),(0,$.jsx)(`span`,{children:t(e)})]},e))})};function BX({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_LABEL,`Label`)(e);return(0,$.jsx)(n,{...t})}var wye=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),VX=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)}})),HX=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}}})),Tye=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})),Eye=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})),Dye=n((e=>{var t=VX().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}})),Oye=n((e=>{var t=VX().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),kye=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}})),UX=n((e=>{var t=HX(),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}}})),Aye=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]]}})),jye=n((e=>{var t=Aye();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=jye();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})),WX=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),GX=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)}})),KX=n((e=>{var t=WX(),n=GX();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}}})),Nye=n((e=>{var t=VX(),n=UX(),r=HX(),i=KX(),a=WX(),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}})),Pye=n((e=>{var t=VX(),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}})),Fye=n(((e,t)=>{var n=KX();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})),Iye=n(((e,t)=>{var n=KX(),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})),Lye=n(((e,t)=>{var n=KX();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})),Rye=n(((e,t)=>{var n=KX(),r=VX();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})),zye=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)})),Bye=n((e=>{var t=KX(),n=Fye(),r=Iye(),i=Lye(),a=Rye(),o=GX(),s=VX(),c=zye();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()))}})),Vye=n((e=>{var t=VX(),n=HX(),r=Tye(),i=Eye(),a=Dye(),o=Oye(),s=kye(),c=UX(),l=Mye(),u=Nye(),d=Pye(),f=KX(),p=Bye();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)}})),qX=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}}})),Hye=n((e=>{var t=qX();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)}})),Uye=n((e=>{var t=qX();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}})),Wye=e(n((e=>{var t=wye(),n=Vye(),r=Hye(),i=Uye();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 JX(e){return e?{[Te.AUTH_SESSION_ID]:e}:void 0}var YX=({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=lp(),x=(0,Q.useRef)(null),S=(0,Q.useMemo)(()=>()=>(0,$.jsx)(DX,{fieldName:`code`,submitLabel:i(Ql.TOTP_VERIFY_BUTTON),submittingLabel:i(Ql.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=JX(e);x.current={sessionId:e,promise:Tc().mfaTOTPSetup(t?{headers:t}:void 0)}}let n=x.current.promise;return(async()=>{try{let e=await n;if(t)return;let r=await Wye.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(Ql.ENROLL_ERROR));_(n),v.current(n)}})(),()=>{t=!0}},[e]);let E=(0,Q.useCallback)(async r=>{w();try{let n=JX(e),a=await Tc().mfaTOTPVerifySetup(r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):T(i(Ql.ENROLL_ERROR))}catch(e){let t=b(e,i(Ql.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(Ql.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(Ql.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(Ql.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)(kF,{children:(0,$.jsxs)(IF,{className:`space-y-2 pt-4`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:i(Ql.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)(BX,{className:`flex items-center gap-2 cursor-pointer mt-2`,children:[(0,$.jsx)(OI,{checked:m,onCheckedChange:e=>h(e===!0)}),(0,$.jsx)(Z,{className:`text-xs`,children:i(Ql.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(Ql.TOTP_VERIFY_LABEL)}),(0,$.jsx)(rE,{schema:Mre,defaultValues:{code:``},onSubmit:E,validationMode:Kn.ON_BLUR,disabled:r||D,onFormReady:C,labels:{fields:{code:i(Ql.TOTP_VERIFY_LABEL)}},layoutTemplate:S},`totp-enrollment-verify`)]}),g&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:g})})]})};LX(Us.TOTP,YX);function Gye(e){return e?{[Te.AUTH_SESSION_ID]:e}:void 0}LX(Us.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=lp(),u=typeof window<`u`&&!!window.PublicKeyCredential,d=(0,Q.useCallback)(async()=>{o(!0),c(null);try{let n=Gye(e),r=await Tc().passkeyRegisterOptions(n?{headers:n}:void 0),i=await gp({optionsJSON:r});t((await Tc().passkeyRegisterVerify({response:i},n?{headers:n}:void 0)).enrollmentSession)}catch(e){let t=e?.name===`NotAllowedError`?i(Ql.PASSKEY_CANCELLED):l(e,i(Ql.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(Ql.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?Ql.PASSKEY_REGISTERING:Ql.PASSKEY_REGISTER_BUTTON)})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:i(Ql.PASSKEY_UNSUPPORTED)})})})});function XX(e){return e?{[Te.AUTH_SESSION_ID]:e}:void 0}var ZX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=lp(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(DX,{fieldName:`phoneNumber`,submitLabel:i(Ql.PHONE_SEND_CODE),submittingLabel:i(Ql.PHONE_SENDING),fieldProps:{type:`tel`,placeholder:`+1 555 123 4567`,autoFocus:!0}}),[i]),h=(0,Q.useMemo)(()=>()=>(0,$.jsx)(DX,{fieldName:`code`,submitLabel:i(Ql.PHONE_VERIFY_BUTTON),submittingLabel:i(Ql.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=XX(e);await Tc().phoneVerifySend(a,t?{headers:t}:void 0),l(a),d(!0)}catch(e){let t=s(e,i(Ql.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=XX(e),a=await Tc().phoneVerifyConfirm(c.trim(),r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):x(i(Ql.ENROLL_ERROR))}catch(e){let t=s(e,i(Ql.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(Ql.PHONE_CODE_SENT)}),(0,$.jsx)(rE,{schema:Lne,defaultValues:{code:``},onSubmit:T,validationMode:Kn.ON_BLUR,disabled:f||r,onFormReady:_,labels:{fields:{code:i(Ql.PHONE_CODE_LABEL)}},layoutTemplate:h},`phone-enrollment-verify`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:w,disabled:f,children:i(Ql.PHONE_RESEND)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Ql.PHONE_DESCRIPTION)}),(0,$.jsx)(rE,{schema:Fie,defaultValues:{phoneNumber:c},onSubmit:C,validationMode:Kn.ON_BLUR,disabled:f||r,onFormReady:g,labels:{fields:{phoneNumber:i(Ql.PHONE_NUMBER_LABEL)}},layoutTemplate:m},`phone-enrollment-start`)]})};LX(Us.SMS_OTP,ZX);var Kye={[Us.SMS_OTP]:cl.SMS_OTP_TITLE,[Us.EMAIL_OTP]:cl.EMAIL_OTP_TITLE,[Us.TOTP]:cl.TOTP_TITLE,[Us.PASSKEY]:cl.PASSKEY_TITLE},QX=({sessionId:e,sessionEmail:t=``})=>{let{getSessionState:n,auth:r}=gm(),i=(0,Q.useMemo)(()=>[U.PUBLIC_LAYOUTS_MFA_CHALLENGE,U.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:a,isReady:o}=J({component:i}),s=og(),c=e=>a(U.PUBLIC_LAYOUTS_MFA_CHALLENGE,e),l=(0,Q.useMemo)(()=>_m(a,U.PUBLIC_LAYOUTS_USER_AUTH),[a]),u=(0,Q.useMemo)(()=>z(s.search),[s.search]),d=(0,Q.useMemo)(()=>Oi(Pa.login,u),[u]),f=(0,Q.useMemo)(()=>Yt(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=>FX[e.method]);n.length===0?(e.availableEnrollmentMethods||[]).filter(e=>IX[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=zp(r,u);if(D)return(0,$.jsx)(Vh,{to:D,replace:!0});if(r.accessToken&&!r.isLoading)return(0,$.jsx)(Vh,{to:f,replace:!0});if(x&&e)return(0,$.jsx)(Vh,{to:Oi(`${Pa.enrollmentRequired}?sessionId=${encodeURIComponent(e)}&email=${encodeURIComponent(t)}`,u),replace:!0});if(!o)return null;if(!e||y){let e={expired:cl.ERROR_EXPIRED,no_methods:cl.ERROR_NO_METHODS,generic:cl.ERROR_GENERIC},t=y?e[y]:cl.ERROR_GENERIC;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(SY,{children:c(cl.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)(_X,{href:d,children:c(cl.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`text-muted-foreground`,children:c(cl.VERIFYING)})]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:c(cl.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto text-muted-foreground`,children:c(cl.SUB_TITLE)})]}),!h&&p.length>1&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c(cl.SELECT_METHOD)}),(0,$.jsx)(zX,{layout:RX.LIST,methods:p.map(e=>e.method),labelFor:e=>{let t=Kye[e];return t?c(t):e},onSelect:g})]}),h&&(()=>{let n=FX[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:Y.GHOST,size:Gd.SM,onClick:E,children:c(cl.CHANGE_METHOD)})}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:d,children:c(cl.BACK_TO_LOGIN)})})]})};function $X({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_MFA_CHALLENGE,`Auth_MfaChallenge`)(e);return(0,$.jsx)(n,{...t})}var qye=()=>{let[e]=ch(),t=e.get(`sessionId`),n=e.get(`email`)||``;return(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)($X,{sessionId:t,sessionEmail:n})})},eZ={[Us.TOTP]:Ql.TOTP_TITLE,[Us.PASSKEY]:Ql.PASSKEY_TITLE,[Us.SMS_OTP]:Ql.PHONE_TITLE},tZ=e=>{let{auth:t,completeEnrollmentSession:n,getSessionState:r,adoptPendingMfaSession:i}=gm(),{logout:a}=ag(),{tComponent:o,isReady:s}=J({component:U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED}),c=oh(),l=og(),u=e=>o(U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e),d=(0,Q.useMemo)(()=>z(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)(()=>noe()),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&&Zae()};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)(()=>Oi(Pa.login,d),[d]),S=(0,Q.useMemo)(()=>Yt(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=>IX[e]),[t.availableEnrollmentMethods]),A=(0,Q.useMemo)(()=>{let e=t.mfaSessionId;if(!e)return Oi(Pa.mfaChallenge,d);let n=t.identification?.email||g;return Oi(`${Pa.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=zp(t,d);if(N)return(0,$.jsx)(Vh,{to:N,replace:!0});if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Vh,{to:S,replace:!0});if(!t.mfaRequired)return _&&!v?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(Vh,{to:x,replace:!0});let P=t.usableSecondFactorMethods.length>0;if(t.mfaSessionId&&k.length===0&&P)return(0,$.jsx)(Vh,{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)(SY,{children:u(Ql.TITLE)})}),(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:u(Ql.NO_METHODS_AVAILABLE)})}),(0,$.jsx)(X,{variant:Y.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Ql.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(Ql.ENROLL_SUCCESS)})}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:u(Ql.LOADING)})]});let F=C?IX[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)(SY,{children:u(Ql.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:u(Ql.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(Ql.SELECT_METHOD)}),(0,$.jsx)(zX,{layout:RX.LIST,methods:k,labelFor:e=>u(eZ[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:Y.GHOST,size:Gd.SM,onClick:()=>{w(null),O(null)},children:`←`}),(0,$.jsx)(Z,{className:`text-sm font-medium`,children:u(eZ[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:Y.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Ql.LOGOUT_BUTTON)})})]})};function nZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,`Auth_EnrollmentRequired`)(e);return(0,$.jsx)(n,{...t})}var Jye=()=>(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(nZ,{})}),rZ=U.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,iZ=Q.createContext(null),Yye=()=>{let{tComponent:e,isReady:t}=J({component:rZ}),n=Q.useContext(iZ);return t?(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`organizationName`}),n&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n})}),(0,$.jsx)(rO,{label:e(rZ,ns.SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null},Xye=()=>{let{tComponent:e,isReady:t}=J({component:rZ}),n=Q.useContext(iZ);return t?(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`firstName`}),(0,$.jsx)($L,{name:`lastName`}),n&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:n})}),(0,$.jsx)(rO,{label:e(rZ,ns.PROFILE_SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null};function aZ(e){let t=e?.pendingObligations;if(!Array.isArray(t))return[Gc.ORGANIZATION];let n=new Set(Object.values(Gc));return t.filter(e=>typeof e==`string`&&n.has(e))}var oZ=e=>{let{auth:t,completeOrganizationOnboarding:n,completeProfileOnboarding:r,abandonOrganizationOnboarding:i,getSessionState:a}=gm(),{tComponent:o,isReady:s}=J({component:rZ}),c=e=>o(rZ,e),l=lp(),d=og(),f=oh(),p=(0,Q.useMemo)(()=>z(d.search),[d.search]),m=(0,Q.useMemo)(()=>Yt(d.search),[d.search]),h=(0,Q.useMemo)(()=>Oi(Pa.login,p),[p]),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=t.onboardingSessionId;if(!e){y(null);return}let n=!1;return a(e).then(e=>{n||y(aZ(e))}).catch(()=>{n||y([Gc.ORGANIZATION])}),()=>{n=!0}},[t.onboardingSessionId]);let b=v?.[0],x=(0,Q.useCallback)(async e=>{_(null);try{let t=await r(e.firstName.trim(),e.lastName.trim());t.signedIn||y(t.pendingObligations)}catch(e){_(l(e,c(ns.COMPLETION_ERROR)))}},[r,c]),S=(0,Q.useCallback)(async e=>{_(null);try{let t=await n(e.organizationName.trim());t.signedIn||y(t.pendingObligations)}catch(e){_(l(e,c(ns.COMPLETION_ERROR)))}},[n,c]),C=(0,Q.useCallback)(()=>{i(),f(h,{replace:!0})},[i,f,h]);if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Vh,{to:m,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)(SY,{children:c(ns.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ns.SESSION_EXPIRED)})]}),(0,$.jsx)(Z,{className:`text-sm`,children:(0,$.jsx)(gX,{href:h,children:c(ns.SIGN_IN_AGAIN_LINK)})})]});if(v===null)return null;let w=(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,onClick:C,children:c(ns.USE_DIFFERENT_ACCOUNT)})});return b===Gc.PROFILE_NAMES?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:c(ns.PROFILE_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ns.PROFILE_DESCRIPTION)})]}),(0,$.jsx)(iZ.Provider,{value:g,children:(0,$.jsx)(rE,{schema:u,defaultValues:{firstName:``,lastName:``},onSubmit:x,validationMode:Kn.ON_BLUR,disabled:t.isLoading,layoutTemplate:Xye,labels:{fields:{firstName:c(ns.FIRST_NAME),lastName:c(ns.LAST_NAME)}}},Gc.PROFILE_NAMES)}),w]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:c(ns.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ns.DESCRIPTION)})]}),(0,$.jsx)(iZ.Provider,{value:g,children:(0,$.jsx)(rE,{schema:Ci,defaultValues:{organizationName:``},onSubmit:S,validationMode:Kn.ON_BLUR,disabled:t.isLoading,layoutTemplate:Yye,labels:{fields:{organizationName:c(ns.ORGANIZATION_NAME)}}},Gc.ORGANIZATION)}),w]})};function sZ({preset:e=G.DEFAULT,...t}){let n=q(rZ,`Auth_OrganizationOnboarding`)(e);return(0,$.jsx)(n,{...t})}var Zye=()=>(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(sZ,{})}),cZ=({label:e})=>{let{appConfig:t}=Eu(),n=hie(t.compliance,mae.PRIVACY_NOTICE,new Date().toISOString());return n===void 0?null:(0,$.jsx)(Z,{children:(0,$.jsx)(gX,{href:n,external:!0,"data-privacy-notice-link":``,children:e})})},lZ=il.getLogger(),uZ=lZ.debugByType(`Auth_Main`);lZ.setDebugTypeLogging(`Auth_Main`,!1);var Qye=()=>{let{auth:e}=ag(),{tComponent:t,isReady:n}=J({component:U.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`email`}),e.error&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.error})}),(0,$.jsx)(rO,{label:(e=>t(U.PUBLIC_LAYOUTS_USER_AUTH,e))(vu.CONTINUE),submittingLabel:`…`,fullWidth:!0})]}):null};function $ye(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 ebe=3e3,tbe={[Tu.SAML_LOGIN_FAILED]:{label:vu.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Tu.SAML_AUTH_FAILED]:{label:vu.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Tu.MISSING_PARAMS]:{label:vu.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Tu.OAUTH_FAILED]:{label:vu.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Tu.SAML_SLO_FAILED]:{label:vu.PROVIDER_SIGN_OUT_FAILED,variant:`warning`}},dZ=({})=>{let{auth:e,identifyByEmail:t,initiateOAuth2Login:n}=ag(),{signInWithPasskey:r,endedSessionReason:i}=gm(),a=Jx(),o=og(),s=(0,Q.useMemo)(()=>jX({publicProviders:a.globalAuth?.socialOAuth2Providers}),[a.globalAuth?.socialOAuth2Providers]),c=(0,Q.useMemo)(()=>ob(s.map(e=>e.displayNameLabelKey)),[s]),{t:l,tComponent:u,isReady:d}=J({component:U.PUBLIC_LAYOUTS_USER_AUTH,keys:c}),f=e=>u(U.PUBLIC_LAYOUTS_USER_AUTH,e),p=Pa,m=(0,Q.useMemo)(()=>Yt(o.search),[o.search]),h=(0,Q.useMemo)(()=>z(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}=tbe[e]??{label:vu.PROVIDER_SIGN_IN_FAILED,variant:`destructive`};return{text:u(U.PUBLIC_LAYOUTS_USER_AUTH,t),variant:n}},[o.search,u]),_=i===Er.ACCOUNT_NOT_ACTIVE?{text:f(vu.ACCOUNT_NOT_ACTIVE_NOTICE),variant:`destructive`}:i===Er.SESSION_ENDED?{text:f(vu.SESSION_ENDED_NOTICE),variant:`info`}:null,v=(0,Q.useMemo)(()=>Oi(p.passwordLost,h),[h,p.passwordLost]),y=(0,Q.useMemo)(()=>Oi(p.register,h),[h,p.register]),[b,x]=(0,Q.useState)(null);xX({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=>FX[e.method]),[S,e.identification]),E=(0,Q.useMemo)(()=>{if(T.length===0)return null;let t=e.identification?.defaultFirstFactorMethod;return t&&FX[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{}},j=async e=>{await t(e.email)},M=(0,Q.useCallback)(e=>{},[]),N=(0,Q.useCallback)(e=>{},[]),P=s.length>0,F=!S||!e.identification?.userExists,I=P&&F,L=(0,Q.useMemo)(()=>{let e=wee(a.userTypeAuth?.authMethodsEnabled);return P||e.delete(Us.EXTERNAL_OAUTH2),e},[P,a.userTypeAuth?.authMethodsEnabled]),ee=!a.userTypeAuth?.authMethodsEnabled||L.size>0,R=I&&ee,te=mre(a.userTypeAuth?.authMethodsEnabled).has(Us.PASSKEY)&&e.purpose!==Yo.REAUTH&&typeof window<`u`&&!!window.PublicKeyCredential,ne=F&&!ee&&!te&&!I,re=!F&&T.length===0,ie=(0,Q.useRef)(!1),[ae,oe]=(0,Q.useState)(0),se=(0,Q.useCallback)(async()=>{ie.current=!0;try{await r(km.MODAL)}catch{}finally{ie.current=!1,oe(e=>e+1)}},[r]),ce=(0,Q.useRef)(r);ce.current=r,(0,Q.useEffect)(()=>{if(!d||!F||!te)return;let e=!1;return(async()=>{if(await _oe())for(await $ye(ebe);!e;)try{await ce.current(km.CONDITIONAL);return}catch(e){if(!(e instanceof jm)||ie.current)return}})(),()=>{e=!0,toe.cancelCeremony()}},[d,F,te,ae]),(0,Q.useEffect)(()=>{uZ(`Render isReady=${d} accessToken=${e.accessToken?`yes`:`no`} authLoading=${e.isLoading?`yes`:`no`} identification=${S?`yes`:`no`} showIdentify=${F?`yes`:`no`} activeMethod=${D??`none`}`)},[d,e.accessToken,e.isLoading,S,F,D]);let le=zp(e,h);return le?(0,$.jsx)(Vh,{to:le,replace:!0}):e.accessToken?(0,$.jsx)(Vh,{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)(SY,{children:e.purpose===Yo.REAUTH?f(vu.REAUTH_TITLE):f(vu.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:e.purpose===Yo.REAUTH?f(vu.REAUTH_SUB_TITLE):f(vu.SUB_TITLE)})]}),I&&(0,$.jsx)(PX,{providers:s,onProviderClick:A,isLoading:e.isLoading,continueWithLabel:f(vu.CONTINUE_WITH),translate:l,dividerLabel:f(vu.DIVIDER_OR),showDivider:R}),!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})}),F&&ee&&(0,$.jsx)(rE,{schema:are,defaultValues:{email:``},onSubmit:j,validationMode:Kn.ON_BLUR,disabled:e.isLoading,labels:{fields:{email:f(vu.EMAIL_ADDRESS)}},layoutTemplate:Qye},`identify`),F&&te&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kX,{label:f(vu.DIVIDER_OR)}),(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:Qd.WRAP,onClick:se,disabled:e.isLoading,"data-passkey-sign-in":``,children:[(0,$.jsx)(EX,{method:Us.PASSKEY}),f(vu.PASSKEY_SIGN_IN)]})]}),D&&!F&&(()=>{let t=FX[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:M,onError:N,factorLevel:`first`,isLoading:e.isLoading,t:f,authRedirectTarget:h};return(0,$.jsx)(t,{...r})})(),k&&O.length>0&&!F&&(0,$.jsx)(Z,{children:f(vu.ORGANIZATION_ENFORCED_METHOD)}),O.length>0&&!F&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kX,{label:f(vu.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(zX,{methods:O.map(e=>e.method),labelFor:e=>TX(e,{offeredMethod:O.find(t=>t.method===e),socialProviders:s,continueWithTemplate:f(vu.CONTINUE_WITH),translateLabel:e=>f(e),resolveSocialProviderLabel:e=>AX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:MX[e.providerRef]?.label,translate:l})}),onSelect:x,disabled:e.isLoading})]}),ne&&(0,$.jsx)(jD,{"data-auth-no-entry-point":``,children:(0,$.jsx)(ND,{children:f(vu.NO_SIGN_IN_METHOD_AVAILABLE)})}),re&&(0,$.jsx)(jD,{"data-auth-no-method-for-address":``,children:(0,$.jsx)(ND,{children:f(vu.NO_SIGN_IN_METHOD_FOR_ADDRESS)})}),!ee&&!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===Us.PASSWORD&&!F&&(0,$.jsx)(Z,{children:(0,$.jsx)(gX,{href:v,children:f(vu.FORGOT_PASSWORD)})}),e.purpose!==Yo.REAUTH&&a.registrationConfig.publicRegistrationAvailable&&(0,$.jsxs)(Z,{children:[f(vu.NO_ACCOUNT),` `,(0,$.jsx)(gX,{href:y,children:f(vu.SIGNUP_LINK)})]}),(0,$.jsx)(cZ,{label:f(vu.PRIVACY_NOTICE_LINK)})]})]}):null};function fZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_USER_AUTH,`Auth_Main`)(e);return uZ(`Resolve wrapper preset=${e} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var pZ=il.getLogger(),nbe=pZ.debugByType(`AuthPage_Main`);pZ.setDebugTypeLogging(`AuthPage_Main`,!1);var rbe=()=>{let{auth:e}=gm(),{isReady:t}=J({component:[U.PUBLIC_LAYOUTS_USER_AUTH,U.LOW_LEVEL_FORM_MESSAGE],keys:[`errors_validation`]});return nbe(`Render ready=${t}`),t?(0,$.jsx)(fX,{useCardLayout:!0,organizationBranding:e.identification?.organizationBranding,children:(0,$.jsx)(fZ,{})}):(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(Zy,{size:48})})},ibe=60,mZ=({token:e,email:t})=>{let{auth:n,handleEmailVerification:r}=gm(),{tComponent:i,isReady:a}=J({component:U.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL}),o=lp(),s=e=>i(U.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,e),c=Pa.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(Qu.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]),xX({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 Tc().resendVerificationEmail(m),_(`sent`),y(ibe)}catch(e){_(`error`),x(o(e,s(Qu.ERROR_MESSAGE)))}}},[m,v]),w=zp(n,void 0);return w?(0,$.jsx)(Vh,{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)(SY,{children:s(Qu.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Qu.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:c,children:s(Qu.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)(SY,{children:s(Qu.SESSION_CONFLICT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Qu.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(Qu.SESSION_CONFLICT_VERIFY_BUTTON).replace(`{email}`,t)}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:()=>{window.location.href=Pa.home},children:s(Qu.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)(SY,{children:s(Qu.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Qu.SUCCESS_MESSAGE)})]}),(0,$.jsx)(Vh,{to:Pa.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)(SY,{children:s(Qu.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(Qu.RESEND_DESCRIPTION)}),(0,$.jsxs)(`div`,{className:`flex gap-item-xs`,children:[(0,$.jsx)(eN,{name:`__display`,schema:gd(),type:`email`,placeholder:s(Qu.RESEND_EMAIL_PLACEHOLDER),value:m,onChange:e=>h(String(e)),disabled:g===`sending`||v>0}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:C,disabled:!m||g===`sending`||v>0,children:g===`sending`?s(Qu.RESEND_SENDING):v>0?`${s(Qu.RESEND_COOLDOWN)} (${v}s)`:s(Qu.RESEND_BUTTON)})]}),g===`sent`&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:s(Qu.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)(_X,{href:c,children:s(Qu.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(SY,{children:s(Qu.TITLE)}),(0,$.jsxs)(Z,{className:`max-w-sm mx-auto`,children:[s(Qu.VERIFYING),` `,t]})]})}):null};function hZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,`Auth_ConfirmEmail`)(e);return(0,$.jsx)(n,{...t})}var abe=()=>{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)(fX,{useCardLayout:!0,children:(0,$.jsx)(hZ,{token:t,email:n})})},gZ={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0},_Z=({fieldName:e,policy:t,t:n,blocklistContext:r})=>{let{watch:i}=BC(),a=i(e)||``,o=(0,Q.useMemo)(()=>{if(!a)return[];let e=[];return e.push({label:n(ms.MIN_LENGTH).replace(`{minLength}`,String(t.minLength)),passed:a.length>=t.minLength}),e.push({label:n(ms.MAX_LENGTH).replace(`{maxLength}`,String(t.maxLength)),passed:a.length<=t.maxLength}),t.requireUppercase&&e.push({label:n(ms.UPPERCASE),passed:/[A-Z]/.test(a)}),t.requireLowercase&&e.push({label:n(ms.LOWERCASE),passed:/[a-z]/.test(a)}),t.requireNumbers&&e.push({label:n(ms.NUMBER),passed:/\d/.test(a)}),t.requireSpecialChars&&e.push({label:n(ms.SPECIAL_CHAR),passed:/[^A-Za-z0-9]/.test(a)}),e.push({label:n(ms.BLOCKLISTED),passed:!cre(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 vZ({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 yZ(e,t,n){return e.map(e=>{let r=t(e);return e===Xc.MIN_LENGTH?r.replace(`{minLength}`,String(n.minLength??8)):e===Xc.MAX_LENGTH?r.replace(`{maxLength}`,String(n.maxLength??128)):r})}function bZ(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;if(r.message!==rs.VALIDATION_PASSWORD_POLICY_VIOLATION)return null;let i=r.context,a=i?.violations;return!Array.isArray(a)||a.length===0?null:yZ(a,t,{minLength:i.minLength??n.minLength??8,maxLength:i.maxLength??n.maxLength??128}).join(`. `)}var obe=new Set([Us.PASSWORD,Us.ORG_SAML,Us.ORG_OPENID_CONNECT,Us.EXTERNAL_OAUTH2,Us.MAGIC_LINK,Us.PASSKEY]),sbe=({invitationEmail:e,passwordPolicy:t})=>{let{formState:n}=BC(),{tComponent:r,isReady:i}=J({component:U.PUBLIC_LAYOUTS_USER_INVITATION}),a=e=>r(U.PUBLIC_LAYOUTS_USER_INVITATION,e);return i?(0,$.jsxs)(nA,{children:[(0,$.jsx)(vZ,{email:e}),(0,$.jsx)($L,{name:`firstName`}),(0,$.jsx)($L,{name:`lastName`}),(0,$.jsx)($L,{name:`password`}),(0,$.jsx)($L,{name:`confirmPassword`}),(0,$.jsx)(_Z,{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(Lo.ACCEPT_INVITATION),submittingLabel:a(Lo.ACCEPTING_INVITATION),fullWidth:!0})]}):null},cbe=({invitationEmail:e,t,tAuth:n})=>{let{formState:r}=BC();return(0,$.jsxs)(nA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)($L,{name:`firstName`}),(0,$.jsx)($L,{name:`lastName`}),r.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:r.errors.root.message})}),(0,$.jsx)(rO,{label:n(vu.MAGIC_LINK_SEND),submittingLabel:n(vu.MAGIC_LINK_SEND),fullWidth:!0})]})},lbe=({invitationEmail:e,disabled:t,onSubmit:n,t:r,tAuth:i})=>{let a=(0,Q.useRef)(null),o=lp(),s=(0,Q.useMemo)(()=>us.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(Lo.UNEXPECTED_ERROR))})}},[n,r,o]);return(0,$.jsx)(rE,{schema:s,defaultValues:{firstName:``,lastName:``},onSubmit:c,validationMode:Kn.ON_BLUR,disabled:t,onFormReady:e=>{a.current=e},labels:{fields:{firstName:r(Lo.FIRST_NAME),lastName:r(Lo.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(cbe,{invitationEmail:e,t:r,tAuth:i})})},ube=({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(Lo.PASSKEY_DESCRIPTION)}),(0,$.jsx)($L,{name:`firstName`}),(0,$.jsx)($L,{name:`lastName`}),t&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:t})}),(0,$.jsx)(rO,{label:n(Lo.PASSKEY_CREATE),submittingLabel:n(Lo.PASSKEY_CREATING),fullWidth:!0})]}),dbe=({invitationEmail:e,disabled:t,error:n,onSubmit:r,t:i})=>{let a=typeof window<`u`&&!!window.PublicKeyCredential,o=(0,Q.useMemo)(()=>us.pick({firstName:!0,lastName:!0}),[]);return a?(0,$.jsx)(rE,{schema:o,defaultValues:{firstName:``,lastName:``},onSubmit:e=>r(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0),validationMode:Kn.ON_BLUR,disabled:t,labels:{fields:{firstName:i(Lo.FIRST_NAME),lastName:i(Lo.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(ube,{invitationEmail:e,error:n,t:i})}):(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:i(Lo.PASSKEY_UNAVAILABLE_HINT)})})},xZ=({token:e,email:t})=>{let{auth:n,acceptInvitation:r}=gm(),{handleError:i}=tp(),a=lp(),o=Jx(),s=(0,Q.useMemo)(()=>[U.PUBLIC_LAYOUTS_USER_INVITATION,U.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:c,isReady:l}=J({component:s}),u=og(),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),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),L=(0,Q.useCallback)(e=>c(U.PUBLIC_LAYOUTS_USER_INVITATION,e),[c]),ee=(0,Q.useCallback)(e=>c(U.PUBLIC_LAYOUTS_USER_AUTH,e),[c]),R=(0,Q.useMemo)(()=>_m(c,U.PUBLIC_LAYOUTS_USER_AUTH),[c]),te=Pa.login,ne=(0,Q.useMemo)(()=>Yt(u.search),[u.search]),re=(0,Q.useMemo)(()=>z(u.search),[u.search]),ie=k?.inviteeEmail??t,ae=(0,Q.useMemo)(()=>k?.passwordPolicy??o.passwordPolicy??gZ,[k?.passwordPolicy,o.passwordPolicy]),oe=(0,Q.useMemo)(()=>us.refine(e=>!e.password||e.password===e.confirmPassword,{message:L(Lo.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[L]),se=(0,Q.useCallback)(e=>{d.current=e},[]);(0,Q.useEffect)(()=>{if(!e||n.accessToken){M(!1);return}let t=!1;return M(!0),P(null),Tc().getInvitationInfo(e).then(e=>{t||A(e)}).catch(e=>{t||P(a(e,L(Lo.UNEXPECTED_ERROR)))}).finally(()=>{t||M(!1)}),()=>{t=!0}},[e,n.accessToken]);let ce=(0,Q.useMemo)(()=>(k?.availableFirstFactorMethods??[]).filter(e=>obe.has(e.method)),[k]),le=ce.length>0,ue=n.isLoading||E||v,de=(0,Q.useMemo)(()=>ce[0]?.method??null,[ce]),fe=F??de,pe=ce.filter(e=>e.method!==fe);xX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:ie||void 0,authRedirectTarget:re});let me=(0,Q.useCallback)(async t=>{if(d.current?.clearErrors(`root`),t.password){let e=O.validatePasswordAgainstPolicy(t.password,ae);if(!e.valid){d.current?.setError(`root`,{type:`policy`,message:yZ(e.violations,L,ae).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,L(Lo.UNEXPECTED_ERROR))})}},[r,ae,L,e,a]),he=(0,Q.useCallback)(async(t,n)=>{x(null),y(!0);try{let i=await r({invitationToken:e,firstName:t,lastName:n,credentialMethod:Us.PASSKEY});if(i?.signInRequired){T(!0);return}let a=i?.passkeyRegistrationOptions;if(a)try{let e=await gp({optionsJSON:a});await Tc().passkeyRegisterVerify({response:e})}catch{}}catch(e){x(a(e,L(Lo.UNEXPECTED_ERROR)))}finally{y(!1)}},[r,e,L,a]),ge=(0,Q.useCallback)(async(t,n)=>{D(!0);try{(await Tc().acceptInvitation({invitationToken:e,firstName:t,lastName:n,credentialMethod:Us.MAGIC_LINK,redirect:re})).nextStep===rne.SIGN_IN_REQUIRED?T(!0):C(!0)}catch(e){throw i(e,`Invitation acceptance failed (magic link)`,{credentialMethod:Us.MAGIC_LINK}),e}finally{D(!1)}},[e,i,re]),_e=(0,Q.useCallback)(async()=>{if(_(null),!e)_(L(Lo.INVALID_LINK));else{p(!0);try{await Tc().rejectInvitation({invitationToken:e}),h(!0)}catch(e){_(a(e,L(Lo.UNEXPECTED_ERROR)))}finally{p(!1)}}},[L,e,a]),ve=(0,Q.useCallback)(e=>{},[]),ye=(0,Q.useCallback)(e=>{},[]);return n.accessToken&&!v?(0,$.jsx)(Vh,{to:ne,replace:!0}):l?e?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.DECLINE_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(Lo.DECLINE_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:te,children:L(Lo.CONTINUE_LINK)})})]}):w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.SIGN_IN_REQUIRED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(Lo.SIGN_IN_REQUIRED_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)})})]}):S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:ee(vu.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:ee(vu.MAGIC_LINK_SENT_DESCRIPTION)}),ie&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ie})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)})})]}):j?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-group`,children:(0,$.jsx)(Zy,{size:40})}):N||!k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:N||L(Lo.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)})})]}):k.managementMode===Cne.SCIM?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.SCIM_MANAGED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(Lo.SCIM_MANAGED_MESSAGE)}),ie&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ie})]}),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:Y.OUTLINE,onClick:_e,disabled:f,className:`w-full`,children:L(f?Lo.DECLINING_INVITATION:Lo.DECLINE_INVITATION)}),(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)}),(0,$.jsx)(cZ,{label:ee(vu.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(Lo.SUB_TITLE)}),k.organizationName&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:k.organizationName}),ie&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ie})]}),le?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:L(Lo.METHOD_CHOICE_HINT)}),(()=>{if(!fe)return null;let e=ce.find(e=>e.method===fe);if(!e)return null;if(fe===Us.PASSWORD)return(0,$.jsx)(rE,{schema:oe,defaultValues:{firstName:``,lastName:``,password:``,confirmPassword:``},onSubmit:me,validationMode:Kn.ON_BLUR,disabled:n.isLoading||f,onFormReady:se,labels:{fields:{firstName:L(Lo.FIRST_NAME),lastName:L(Lo.LAST_NAME),password:L(Lo.PASSWORD),confirmPassword:L(Lo.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(sbe,{invitationEmail:ie,passwordPolicy:ae})});if(fe===Us.MAGIC_LINK)return(0,$.jsx)(lbe,{invitationEmail:ie,disabled:n.isLoading||f,onSubmit:ge,t:L,tAuth:ee});if(fe===Us.PASSKEY)return(0,$.jsx)(dbe,{invitationEmail:ie,disabled:n.isLoading||f,error:b,onSubmit:he,t:L});let t=FX[fe];if(!t)return null;let r={sessionId:``,email:ie??``,methodConfig:e,onSuccess:ve,onError:ye,factorLevel:`first`,isLoading:n.isLoading||f,t:R};return(0,$.jsx)(t,{...r})})(),pe.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kX,{label:ee(vu.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(zX,{methods:pe.map(e=>e.method),labelFor:e=>TX(e,{offeredMethod:pe.find(t=>t.method===e),continueWithTemplate:ee(vu.CONTINUE_WITH),translateLabel:e=>ee(e),resolveSocialProviderLabel:e=>e.displayName??e.providerRef}),onSelect:e=>{I(e),x(null)},disabled:ue||f})]})]}):(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:L(Lo.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:Y.OUTLINE,onClick:_e,disabled:ue||f,className:`w-full`,children:L(f?Lo.DECLINING_INVITATION:Lo.DECLINE_INVITATION)}),(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)}),(0,$.jsx)(cZ,{label:ee(vu.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:L(Lo.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(Lo.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:te,children:L(Lo.LOGIN_LINK)})})]}):null};function SZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_USER_INVITATION,`Auth_Invitation`)(e);return(0,$.jsx)(n,{...t})}var fbe=()=>{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)(fX,{useCardLayout:!0,children:(0,$.jsx)(SZ,{token:t,email:n})})};function pbe(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)&&Fi(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 Um.resolveResourceUrl(r,i,a,n.allResourceFieldIdentifiers)?.resolvedUrl??void 0}function mbe(e){return!e||!wae(e)||e.includes(`..`)||e.includes(`\\`)||e.includes(`://`)||/[<>"]/.test(e)||e.length>256?Pa.home:e}var CZ=({token:e,mode:t=`one-off-session`,returnPathFromUrl:n})=>{let{handleOneOffTokenExchange:r,handleAuthCodeExchange:i,clearCrossFrontendHandoffContext:a,auth:o,tokenStorage:s}=gm(),{registry:c}=pm(),{tComponent:l,isReady:u}=J({component:U.PUBLIC_LAYOUTS_ONE_OFF_SESSION}),d=lp(),f=e=>l(U.PUBLIC_LAYOUTS_ONE_OFF_SESSION,e),p=Pa.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`?mbe(o.crossFrontendHandoffContext?.returnPath??n):o.oneOffContext?pbe(o.oneOffContext.tokenType,o.oneOffContext.scopedInitiatorIds,c)??Pa.home:Pa.home:Pa.home,[t,o.oneOffContext,o.accessToken,o.crossFrontendHandoffContext,n,c]);return(0,Q.useEffect)(()=>{g.current||(t===`one-off-session`&&!(s instanceof rm)?(g.current=!0,h(f(fu.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(fu.ERROR_GENERIC)))}).finally(()=>{v(!0)})):(g.current=!0,h(f(fu.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)(Vh,{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)(SY,{children:f(fu.ERROR_TITLE)})]}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:m})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(_X,{href:p,children:f(fu.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:f(fu.VERIFYING)})]}):null};function wZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_ONE_OFF_SESSION,`Auth_OneOffSession`)(e);return(0,$.jsx)(n,{...t})}var TZ=()=>{let{token:e}=zm();return(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(wZ,{token:e})})},EZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.UPLOADING=`uploading`,e.DONE=`done`,e.FAILED=`failed`})(EZ||={});function DZ(e,t){if(e.length===0||t===``)return!0;let n=t.split(`/`)[0];return e.some(e=>e===t||e===`${n}/*`)}function hbe(e){let t=e,n=t?.status??t?.statusCode??t?.response?.status;return typeof n==`number`?n:void 0}var OZ=({token:e})=>{let{tComponent:t,isReady:n,formatDateTime:r,formatByteSize:i}=J({component:U.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT}),a=lp(),o=(0,Q.useCallback)((e,n)=>t(U.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,e,n),[t]),[s,c]=(0,Q.useState)(EZ.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:$c.ERROR_NOT_FOUND,cause:void 0}),c(EZ.FAILED),null;try{let t=await Tc().readFileUploadGrantStatus(e);return u(t),t}catch(e){let t=hbe(e)===404?$c.ERROR_NOT_FOUND:$c.ERROR_GENERIC;return f({kind:t,cause:t===$c.ERROR_GENERIC?e:void 0}),c(EZ.FAILED),null}},[e]);(0,Q.useEffect)(()=>{let e=!1;return v().then(t=>{!e&&t&&c(EZ.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:$c.ERROR_TOO_LARGE,cause:void 0}),c(EZ.FAILED)):DZ(l.constraints.allowedMimeTypes,e.type)?(f(null),m(e),c(EZ.READY)):(m(null),f({kind:$c.ERROR_TYPE_NOT_ACCEPTED,cause:void 0}),c(EZ.FAILED)))},[l]),x=(0,Q.useCallback)(async()=>{if(e&&l&&p){c(EZ.UPLOADING),g(0);try{await Tc().uploadWithFileUploadGrant(l,e,p,{onUploadProgress:e=>g(e<0?0:e)}),await v()&&c(EZ.DONE)}catch(e){f({kind:$c.ERROR_GENERIC,cause:e}),c(EZ.FAILED)}}},[e,l,p,v]),S=(0,Q.useCallback)(()=>{f(null),m(null),g(0),l?c(EZ.READY):(c(EZ.LOADING),v().then(e=>{e&&c(EZ.READY)}))},[l,v]);if(!n)return null;if(s===EZ.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)(Zy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o($c.LOADING)})]});if(s===EZ.FAILED&&d){let e=o($c.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)(SY,{children:o($c.ERROR_TITLE)})}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsxs)(ND,{children:[o(d.kind,d.kind===$c.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===$c.ERROR_NOT_FOUND?null:(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:S,children:o($c.RETRY)})})]})}if(!l)return null;if(l.state!==at.PENDING){let e=s===EZ.DONE,t=e?$c.SUCCESS_TITLE:l.state===at.REDEEMED?$c.STATE_REDEEMED_TITLE:l.state===at.EXPIRED?$c.STATE_EXPIRED_TITLE:$c.STATE_REVOKED_TITLE,n=e?$c.SUCCESS_MESSAGE:l.state===at.REDEEMED?$c.STATE_REDEEMED:l.state===at.EXPIRED?$c.STATE_EXPIRED:$c.STATE_REVOKED;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(SY,{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($c.FILE_ID)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{"data-testid":`upload-grant-file-id`,children:l.file.fileId})})]}):null]})}let C=s===EZ.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)(SY,{children:o($c.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o($c.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($c.MAX_SIZE)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-max-size`,children:y}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($c.ACCEPTED_TYPES)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-accepted-types`,children:w.length>0?w.join(`, `):o($c.ANY_TYPE)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($c.EXPIRES_AT)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:l.expiresAt,children:r(l.expiresAt)})})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":o($c.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($c.DROPZONE_PROMPT)}),(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-choose`,variant:Y.OUTLINE,disabled:C,onClick:()=>_.current?.click(),children:o($c.CHOOSE_FILE)}),(0,$.jsx)(Z,{className:`mt-element text-sm`,"data-testid":`upload-grant-selected-file`,children:p?`${p.name} · ${i(p.size)}`:o($c.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($c.UPLOADING,{percent:h}):o($c.UPLOAD)})})]})};function kZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,`Files_UploadGrantDrop`)(e);return(0,$.jsx)(n,{...t})}var AZ=()=>{let{token:e}=zm();return(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(kZ,{token:e})})},gbe=()=>{let[e]=ch(),t=e.get(`code`)??void 0,n=e.get(`return`)??void 0;return(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(wZ,{token:t,mode:`cross-frontend-handoff`,returnPathFromUrl:n})})},_be=()=>{let{formState:e}=BC(),{tComponent:t,isReady:n}=J({component:U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),r=e=>t(U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e);return n?(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`email`}),e.errors.root&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:e.errors.root.message})}),(0,$.jsx)(rO,{label:r(Wi.SEND_RESET_PASSWORD_LINK),submittingLabel:r(Wi.SENDING),fullWidth:!0})]}):null},vbe=({resetEmail:e})=>{let t=Jx(),{formState:n}=BC(),{tComponent:r,isReady:i}=J({component:U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),a=e=>r(U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),o=t.passwordPolicy??gZ;return i?(0,$.jsxs)(nA,{children:[(0,$.jsx)(vZ,{email:e}),(0,$.jsx)($L,{name:`newPassword`}),(0,$.jsx)($L,{name:`confirmPassword`}),(0,$.jsx)(_Z,{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(Wi.RESET_BUTTON),submittingLabel:a(Wi.RESETTING),fullWidth:!0})]}):null},jZ=({resetToken:e,email:t})=>{let{auth:n}=ag(),r=Jx(),i=lp(),{tComponent:a,isReady:o}=J({component:U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),s=e=>a(U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),c=Pa.login,l=(0,Q.useRef)(null),{initAutoClearing:u,injectServerErrors:d,clearServerErrors:f}=ez(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??gZ,[r.passwordPolicy]),x=(0,Q.useMemo)(()=>Bre.refine(e=>e.newPassword===e.confirmPassword,{message:s(Wi.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[s]);return n.accessToken?(0,$.jsx)(Vh,{to:Pa.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)(SY,{children:s(Wi.RESET_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Wi.RESET_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:c,children:s(Wi.LOGIN_LINK)})})]}):e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:s(Wi.RESET_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Wi.RESET_SUB_TITLE)})]}),(0,$.jsx)(rE,{schema:x,defaultValues:{newPassword:``,confirmPassword:``},onSubmit:async t=>{h(!0),l.current?.clearErrors(`root`),f();let n=O.validatePasswordAgainstPolicy(t.newPassword,b);if(!n.valid)l.current?.setError(`root`,{type:`policy`,message:yZ(n.violations,s,b).join(`. `)}),h(!1);else try{await Tc().completePasswordReset(e,t.newPassword),y(!0)}catch(e){let t=MM(e);if(t)d(t.validationErrors);else{let t=bZ(e,s,b);l.current?.setError(`root`,{type:`server`,message:t??i(e,s(Wi.INVALID_TOKEN))})}}finally{h(!1)}},onFormReady:p,validationMode:Kn.ON_BLUR,disabled:m,labels:{fields:{newPassword:s(Wi.NEW_PASSWORD),confirmPassword:s(Wi.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(vbe,{resetEmail:t})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(_X,{href:c,children:s(Wi.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)(SY,{children:s(Wi.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Wi.SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:c,children:s(Wi.BACK_TO_LOGIN)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:s(Wi.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Wi.SUB_TITLE)})]}),(0,$.jsx)(rE,{schema:pie,defaultValues:{email:``},onSubmit:async e=>{h(!0),l.current?.clearErrors(`root`),f();try{await Tc().requestPasswordReset(e.email),_(!0)}catch(e){let t=MM(e);t?d(t.validationErrors):l.current?.setError(`root`,{type:`server`,message:i(e,s(Wi.UNEXPECTED_ERROR))})}finally{h(!1)}},onFormReady:p,validationMode:Kn.ON_BLUR,disabled:m,labels:{fields:{email:s(Wi.EMAIL_ADDRESS)}},layoutTemplate:_be}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(_X,{href:c,children:s(Wi.BACK_TO_LOGIN)})})]}):null};function MZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,`Auth_PasswordLost`)(e);return(0,$.jsx)(n,{...t})}var ybe=()=>{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)(fX,{useCardLayout:!0,children:(0,$.jsx)(MZ,{resetToken:t,email:n})})},bbe=[`response_type`,`client_id`,`redirect_uri`,`code_challenge`,`code_challenge_method`,`scope`,`resource`,`state`,`nonce`],NZ=e=>{let{auth:t}=ag(),{tComponent:n,isReady:r}=J({component:U.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(U.PUBLIC_LAYOUTS_OAUTH_CONSENT,e,t),h=(0,Q.useRef)(!1),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams;for(let t of bbe){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),Tc().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(Gu.ERROR_INVALID)))}).catch(()=>{e||(o(`error`),u(Gu.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 Tc().oauthConsentDecision(s.consent_token,e,e===I.APPROVE&&d);window.location.assign(t)}catch{h.current=!1,o(`error`),u(Gu.ERROR_DECISION)}}},[s,d]);if(!p){let e=od({pathname:Pa.oauthConsent,search:`?${i.toString()}`});return(0,$.jsx)(Vh,{to:Oi(Pa.login,e),replace:!0})}return a===`loading`||a===`submitting`||!r?(0,$.jsx)(`div`,{className:`py-region flex justify-center`,children:(0,$.jsx)(Zy,{})}):a===`error`||!s?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:m(l??Gu.ERROR_GENERIC)})}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:m(Gu.TITLE,{clientName:s.client.name})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:m(Gu.SUB_TITLE)})]}),s.scopes.length>0&&(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:m(Gu.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(Gu.AGENT_ENDPOINT,{resource:s.resource})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-item-xs cursor-pointer`,children:[(0,$.jsx)(OI,{checked:d,onCheckedChange:e=>f(e===!0)}),(0,$.jsx)(Z,{children:m(Gu.REMEMBER)})]}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,className:`flex-1`,onClick:()=>_(I.DENY),children:m(Gu.DENY)}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,onClick:()=>_(I.APPROVE),children:m(Gu.APPROVE)})]})]})};function PZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_OAUTH_CONSENT,`Auth_OAuthConsent`)(e);return(0,$.jsx)(n,{...t})}var xbe=()=>(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)(fX,{useCardLayout:!0,children:(0,$.jsx)(PZ,{})})),FZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.LINKING=`linking`,e.LINKED=`linked`,e.ERROR=`error`})(FZ||={});var IZ=U.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK;function LZ(e){return wi.createOperationPathKey({resourceIdentifier:gu.CHAT_IDENTITY_LINKS,operationIdentifier:e,variantType:E.API_CALL,isOperationDefault:!0,isBulkOperation:!1})}var RZ=e=>{let{auth:t}=ag(),n=t?.accessToken,{tComponent:r,isReady:i,formatDateTime:a}=J({component:IZ}),o=(e,t)=>r(IZ,e,t),{doOperation:s}=pm(),c=lp(),l=oh(),[u,d]=ch(),[f]=(0,Q.useState)(()=>({organizationId:u.get(ir.ORGANIZATION_ID),token:u.get(ir.TOKEN),host:Cae(u.get(ir.HOST))})),p=Vb(f.host),[m,h]=(0,Q.useState)(FZ.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(ir.TOKEN)&&d({},{replace:!0}),!f.organizationId||!f.token){h(FZ.ERROR),y(null);return}let e=!1;return h(FZ.LOADING),x.current(LZ(Qa.PREVIEW_LINK),C()).then(t=>{e||(_(t),h(FZ.READY))}).catch(t=>{e||(y(S.current(t)),h(FZ.ERROR))}),()=>{e=!0}},[w,f,C]);let T=(0,Q.useCallback)(async()=>{if(!b.current){b.current=!0,h(FZ.LINKING);try{await x.current(LZ(Qa.COMPLETE_LINK),C()),h(FZ.LINKED)}catch(e){b.current=!1,y(S.current(e)),h(FZ.ERROR)}}},[C]),E=m===FZ.LINKED||m===FZ.READY&&g?.standing===Ml.LINKED_TO_YOU,D=p.tell;(0,Q.useEffect)(()=>{E&&D(zb.SUCCEEDED)},[E,D]);let O=(e,t)=>p.hostServed?(0,$.jsx)(X,{variant:Y.OUTLINE,className:t,onClick:()=>{D(E?zb.SUCCEEDED:zb.FAILED,{repeat:!0}).then(e=>{e===0&&l(Pa.home)})},children:o(_i.CLOSE_HOST_WINDOW)}):(0,$.jsx)(X,{variant:Y.OUTLINE,className:t,onClick:()=>l(Pa.home),children:o(e)}),k=O(_i.BACK_TO_APP);if(!n){let e=od({pathname:Wt,search:`?${u.toString()}`});return(0,$.jsx)(Vh,{to:Oi(Pa.login,e),replace:!0})}if(!i||m===FZ.LOADING||m===FZ.LINKING)return(0,$.jsxs)(`div`,{className:`py-region flex flex-col items-center gap-element`,children:[(0,$.jsx)(Zy,{}),i&&(0,$.jsx)(Z,{children:o(m===FZ.LINKING?_i.LINKING:_i.LOADING)})]});if(m===FZ.ERROR||!g)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(SY,{children:o(_i.ERROR_TITLE)}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:v??o(_i.ERROR_INCOMPLETE_LINK)})}),k]});if(m===FZ.LINKED)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(SY,{children:o(_i.SUCCESS_TITLE)}),(0,$.jsx)(Z,{children:o(_i.SUCCESS_MESSAGE)}),k]});if(g.standing===Ml.LINKED_TO_YOU)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(SY,{children:o(_i.ALREADY_LINKED_TITLE)}),(0,$.jsx)(Z,{children:o(_i.ALREADY_LINKED)}),k]});if(g.standing===Ml.LINKED_TO_ANOTHER_MEMBER)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(SY,{children:o(_i.LINKED_TO_ANOTHER_TITLE)}),(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(_i.LINKED_TO_ANOTHER)})}),k]});let A=g.chatUserDisplayName&&g.workspaceDisplayName?o(_i.ACCOUNT_NAMED,{chatUser:g.chatUserDisplayName,workspace:g.workspaceDisplayName}):void 0,j=o(_i.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)(SY,{children:o(_i.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(_i.INTRO)})]}),(0,$.jsxs)(`dl`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`dt`,{children:(0,$.jsx)(Z,{className:`font-medium`,children:o(_i.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(_i.WARNING_NOT_YOURS)})}),(0,$.jsx)(Z,{className:`text-sm`,children:o(_i.EXPIRES_AT,{expiresAt:a(g.expiresAt)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[O(_i.CANCEL,`flex-1`),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,onClick:T,children:o(_i.CONFIRM)})]})]})};function zZ({preset:e=G.DEFAULT,...t}){let n=q(IZ,`Auth_ChatIdentityLink`)(e);return(0,$.jsx)(n,{...t})}var Sbe=()=>(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)(fX,{useCardLayout:!0,children:(0,$.jsx)(zZ,{})})),BZ=e=>{let{tComponent:t,isReady:n}=J({component:U.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT}),r=oh(),i=e=>t(U.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)(SY,{children:i(Qo.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:i(Qo.SUB_TITLE)})]}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`w-full`,onClick:()=>r(Pa.login),children:i(Qo.RETURN_TO_SIGN_IN)})]}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(Zy,{})})};function VZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,`Auth_OAuthLoggedOut`)(e);return(0,$.jsx)(n,{...t})}var Cbe=()=>(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(VZ,{})}),HZ;(function(e){e.READY=`ready`,e.SUBMITTING=`submitting`,e.ERROR=`error`})(HZ||={});var UZ=e=>{let{tComponent:t,isReady:n}=J({component:U.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM}),[r]=ch(),[i,a]=(0,Q.useState)(HZ.READY),o=e=>t(U.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(HZ.SUBMITTING);try{let{redirect_to:e}=await Tc().oauthEndSessionConfirm(s);window.location.assign(e)}catch{c.current=!1,a(HZ.ERROR)}}},[s]),u=(0,Q.useCallback)(()=>{window.location.assign(Pa.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)(SY,{children:o(Rc.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:o(Rc.SUB_TITLE)})]}),i===HZ.ERROR&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(Rc.ERROR)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,className:`flex-1`,disabled:i===HZ.SUBMITTING,onClick:u,children:o(Rc.CANCEL)}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,disabled:i===HZ.SUBMITTING,onClick:l,children:o(Rc.CONFIRM)})]})]}):(0,$.jsx)(Vh,{to:Pa.oauthLoggedOut,replace:!0}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(Zy,{})})};function WZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,`Auth_OAuthLogoutConfirm`)(e);return(0,$.jsx)(n,{...t})}var wbe=()=>(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)(fX,{useCardLayout:!0,children:(0,$.jsx)(WZ,{})})),GZ=(e,t)=>e.kind===Au.RELEASED?`${String(t)}:${e.release.identity.releaseId}@${String(e.release.identity.releaseVersion)}:${e.content.title}`:`${String(t)}:${e.content.title}`,Tbe=({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:W(`max-h-64 overflow-y-auto rounded-md border border-border bg-muted/30 p-element text-sm`,Ag(r_.FIELD)),children:[(0,$.jsx)(`h2`,{className:`font-medium`,children:e.content.title}),e.kind===Au.UNRELEASED_DRAFT&&(0,$.jsx)(Z,{role:`note`,className:`mt-element-sm text-xs font-medium`,children:t(ye.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===xe.NOT_YET_ESTABLISHED&&(0,$.jsx)(Z,{role:`note`,className:`text-xs`,children:`${t(ye.TERMS_CLAUSE_NOT_ESTABLISHED)} ${e.missingInformation??``}`.trim()})]},e.clauseRef))]},e.sectionRef))]})},KZ=({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:kd(e.release.identity.document.documentRef),path:vre(e.release),title:e.document?.content.title??kd(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:kd(e.kind===Au.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(GZ(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)(gX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:e.content.locale,children:n(U.PUBLIC_LAYOUTS_USER_REGISTER,ye.TERMS_OPEN_DOCUMENT,{documentTitle:e.content.title})},t)),f.map(({release:e,path:t,title:r,locale:i})=>(0,$.jsx)(gX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:i,children:n(U.PUBLIC_LAYOUTS_USER_REGISTER,ye.TERMS_OPEN_DOCUMENT,{documentTitle:r})},e.identity.releaseId))]});if(!Nr(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(ye.TERMS_ACCEPTANCE_IMPLIED)}),g]});let _=a.every(e=>e.document!==void 0)&&a.length>0,v=ai(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(ye.TERMS_READ_PROMPT)}),d.map((e,n)=>(0,$.jsx)(Tbe,{document:e,t,paneKey:GZ(e,n),onReachedEnd:u},GZ(e,n)))]}),(0,$.jsxs)(`label`,{className:W(`flex items-start gap-element`,y?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(OI,{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(ye.TERMS_ACCEPTANCE)})]}),(0,$.jsx)(Z,{"aria-live":`polite`,className:`sr-only`,children:v&&h?t(ye.TERMS_READ_COMPLETE):``}),g]})},Ebe=60,Dbe=[Us.PASSWORD,Us.MAGIC_LINK,Us.PASSKEY],qZ=Q.createContext({requiredReleases:[],acceptanceMode:Bc.EXPLICIT_CHECKBOX,requiredDocuments:[],servedDocuments:[],accepted:!1,setAccepted:()=>{},documentsRead:[],markDocumentRead:()=>{},method:Us.PASSWORD}),JZ=({t:e,tComponent:t})=>{let{method:n,...r}=Q.useContext(qZ);return(0,$.jsx)(KZ,{state:r,t:e,tComponent:t})},Obe=()=>{let e=Jx(),{formState:t}=BC(),{tComponent:n,isReady:r}=J({component:U.PUBLIC_LAYOUTS_USER_REGISTER}),i=e=>n(U.PUBLIC_LAYOUTS_USER_REGISTER,e),a=e.passwordPolicy??gZ,{requiredReleases:o,acceptanceMode:s,accepted:c,method:l}=Q.useContext(qZ),u=l===Us.PASSWORD;if(!r)return null;let d=u?ye.REGISTER_BUTTON:l===Us.PASSKEY?ye.PASSKEY_SIGNUP_BUTTON:ye.MAGIC_LINK_SIGNUP_BUTTON,f=u?ye.REGISTERING:ye.MAGIC_LINK_SIGNUP_SENDING;return(0,$.jsxs)(nA,{children:[(0,$.jsx)($L,{name:`email`}),(0,$.jsx)($L,{name:`firstName`}),(0,$.jsx)($L,{name:`lastName`}),(0,$.jsx)($L,{name:`organizationName`}),(e.registrationConfig.additionalProfileQuestions??[]).map(e=>(0,$.jsx)($L,{name:e.id},e.id)),(0,$.jsx)($L,{name:`password`}),(0,$.jsx)($L,{name:`confirmPassword`}),u&&(0,$.jsx)(_Z,{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)(JZ,{t:i,tComponent:n}),(0,$.jsx)(rO,{label:i(d),submittingLabel:i(f),fullWidth:!0,disabled:o.length>0&&Nr(s)&&!c})]})},YZ=({})=>{let{auth:e,initiateOAuth2Login:t}=ag(),{registerAccount:n}=gm(),r=lp(),{appConfig:i}=Eu(),[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,d]=(0,Q.useState)(null),f=i.compliance?.governedDocumentAcceptanceMode??Bc.EXPLICIT_CHECKBOX,p=sc(i.compliance),m=(0,Q.useMemo)(()=>(u===null?gne(i.compliance?.governedDocumentReleases??[],new Date().toISOString(),{requireApproved:p}):(i.compliance?.governedDocumentReleases??[]).filter(e=>u.some(t=>t.releaseId===e.identity.releaseId&&t.releaseVersion===e.identity.releaseVersion))).filter(e=>e.allowedInteractionKinds.includes(Vo.CONTRACT_ACCEPTED)),[i.compliance?.governedDocumentReleases,p,u]),h=(0,Q.useMemo)(()=>m.map(e=>({release:e,document:Do(i.compliance?.publicDocuments??[],e,{requireApproved:p})})),[m,i.compliance?.publicDocuments,p]),g=(0,Q.useMemo)(()=>i.compliance?.publicDocuments??[],[i.compliance?.publicDocuments]),_=(0,Q.useMemo)(()=>({requiredReleases:m,acceptanceMode:f,requiredDocuments:h,servedDocuments:g,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:Us.EXTERNAL_OAUTH2}),[m,f,h,g,a,s,l]),v=m.length>0&&Nr(f)&&!a,y=(0,Q.useMemo)(()=>m.length===0||Nr(f)&&!a?[]:m.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})),[m,f,a]),b=(0,Q.useCallback)(e=>{if(!Ir(e)||e.customMessageReference!==rs.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))?(d(n),o(!1),c([]),!0):(window.location.reload(),!0)},[i.compliance?.governedDocumentReleases]),x=Jx(),S=og(),C=(0,Q.useMemo)(()=>x.registrationConfig.allowedMethods.includes(Us.EXTERNAL_OAUTH2)?jX({publicProviders:x.globalAuth?.socialOAuth2Providers}):[],[x.globalAuth?.socialOAuth2Providers,x.registrationConfig.allowedMethods]),w=(0,Q.useMemo)(()=>ob(C.map(e=>e.displayNameLabelKey)),[C]),T=(0,Q.useMemo)(()=>[U.PUBLIC_LAYOUTS_USER_REGISTER,U.PUBLIC_LAYOUTS_USER_AUTH],[]),{t:E,tComponent:D,isReady:k}=J({component:T,keys:w}),A=e=>D(U.PUBLIC_LAYOUTS_USER_REGISTER,e),j=e=>D(U.PUBLIC_LAYOUTS_USER_AUTH,e),M=(0,Q.useMemo)(()=>z(S.search),[S.search]),N=(0,Q.useMemo)(()=>new URLSearchParams(S.search).get(`email`)?.trim()??``,[S.search]),P=(0,Q.useMemo)(()=>Oi(Pa.login,M),[M]),F=(0,Q.useMemo)(()=>Yt(S.search),[S.search]),I=C.length>0,L=(0,Q.useCallback)(async e=>{try{await t(e,M,y)}catch(e){b(e)}},[y,M,t,b]),ee=(0,Q.useRef)(null),{initAutoClearing:R,injectServerErrors:te,clearServerErrors:ne}=ez(ee),re=(0,Q.useCallback)(e=>{ee.current=e,R(e)},[R]),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(``);xX({mfaRequired:oe===Pp.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 Tc().resendVerificationEmail(ce),de(`sent`),pe(Ebe)}catch(e){de(`error`),he(r(e,A(ye.UNEXPECTED_ERROR)))}}},[ce,fe]),_e=(0,Q.useMemo)(()=>x.passwordPolicy??gZ,[x.passwordPolicy]),ve=(0,Q.useMemo)(()=>{if(!x.resolvedUserType)return!1;let e=Ee(i.organizationTypes,x.resolvedUserType);return e.length===1&&e[0]?.definition.creationPolicy?.orgNameSource===Zte.ASK},[i.organizationTypes,x.resolvedUserType]),B=(0,Q.useMemo)(()=>x.registrationConfig,[x.registrationConfig]).allowedMethods,be=(0,Q.useMemo)(()=>Dbe.filter(e=>B.includes(e)),[B]),[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,De=Te&&Ce!==null,Oe=Ce===Us.PASSWORD,ke=I&&Te,Ae=x.registrationConfig.additionalProfileQuestions??[],je=x.registrationConfig.profileNamesCollectedAt!==bu.ONBOARDING,Me=(0,Q.useMemo)(()=>{let e={};for(let t of Ae){let n=t.type===Pr.RATING?Id():gd().min(1);e[t.id]=t.required?n:n.optional()}let t=Tie.extend(e),n=je?t:t.omit({firstName:!0,lastName:!0}),r=ve?n:n.omit({organizationName:!0});return Oe?r.refine(e=>!e.password||e.password===e.confirmPassword,{message:A(ye.PASSWORD_MISMATCH),path:[`confirmPassword`]}):r.omit({password:!0,confirmPassword:!0})},[A,ve,Oe,Ae,je]),Ne=zp(e,M);if(Ne)return(0,$.jsx)(Vh,{to:Ne,replace:!0});if(!k)return null;if(oe===Pp.SIGNED_IN)return e.accessToken?(0,$.jsx)(Vh,{to:F,replace:!0}):null;if(oe===Pp.MFA_ENROLLMENT_REQUIRED)return null;if(oe!==null){let e=oe===Pp.SSO_REDIRECT_REQUIRED,t=e?ye.SSO_REGISTRATION_TITLE:ye.SUCCESS_TITLE,n=e?ye.SSO_REGISTRATION_MESSAGE:oe===Pp.UNFINISHED?ye.REGISTRATION_UNFINISHED:oe===Pp.MAGIC_LINK_SENT?ye.MAGIC_LINK_SENT_MESSAGE:oe===Pp.PASSKEY_ENROLLMENT_PENDING?ye.PASSKEY_ENROLLMENT_PENDING_MESSAGE:ye.SUCCESS_MESSAGE,r=oe===Pp.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)(SY,{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(ye.RESEND_PROMPT),` `,(0,$.jsx)(X,{variant:Y.LINK,className:`p-0 h-auto text-sm`,onClick:ge,disabled:ue===`sending`||fe>0,children:ue===`sending`?A(ye.RESEND_SENDING):fe>0?`${A(ye.RESEND_COOLDOWN)} (${fe}s)`:A(ye.RESEND_LINK)})]}),ue===`sent`&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:A(ye.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)(_X,{href:P,children:A(ye.SIGNIN_LINK)})})]})}let Pe=async e=>{ae(!0),ee.current?.clearErrors(`root`),ne();let t=Ce??Us.PASSWORD;if(t===Us.PASSWORD&&e.password){let t=O.validatePasswordAgainstPolicy(e.password,_e);if(!t.valid){ee.current?.setError(`root`,{type:`policy`,message:yZ(t.violations,A,_e).join(`. `)}),ae(!1);return}}try{let r=await n({email:e.email,...je?{firstName:e.firstName,lastName:e.lastName}:{},password:t===Us.PASSWORD&&e.password?.trim()||void 0,organizationName:e.organizationName?.trim()||void 0,profileAnswers:Ae.length>0?Object.fromEntries(Ae.map(t=>[t.id,e[t.id]]).filter(([,e])=>e!==void 0&&e!==``)):void 0,method:t,...M?{redirect:M}:{},...y.length>0?{acceptedGovernedDocumentReleases:y}:{}});le(e.email),se(r)}catch(e){b(e);let t=MM(e);if(t)te(t.validationErrors);else{let t=bZ(e,A,_e);ee.current?.setError(`root`,{type:`server`,message:t??r(e,A(ye.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)(SY,{children:A(ye.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(ye.REGISTRATION_DISABLED)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:P,children:A(ye.SIGNIN_LINK)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:A(ye.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(ye.SUB_TITLE)})]}),C.length>0&&m.length>0&&!De&&(0,$.jsx)(qZ.Provider,{value:_,children:(0,$.jsx)(JZ,{t:A,tComponent:D})}),(0,$.jsx)(PX,{providers:C,onProviderClick:L,isLoading:ie||e.isLoading,disabled:v,continueWithLabel:A(ye.CONTINUE_WITH),translate:E,dividerLabel:A(ye.DIVIDER_OR),showDivider:ke}),Te&&Ce!==null&&(0,$.jsx)(qZ.Provider,{value:{requiredReleases:m,acceptanceMode:f,requiredDocuments:h,servedDocuments:g,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:Ce},children:(0,$.jsx)(rE,{schema:Me,defaultValues:{email:N,...je&&{firstName:``,lastName:``},...ve&&{organizationName:``},...Oe&&{password:``,confirmPassword:``}},onSubmit:Pe,onFormReady:re,validationMode:Kn.ON_BLUR,disabled:ie,layoutTemplate:Obe,labels:{fields:{email:A(ye.EMAIL_ADDRESS),...je&&{firstName:A(ye.FIRST_NAME),lastName:A(ye.LAST_NAME)},...ve&&{organizationName:A(ye.ORGANIZATION_NAME)},...Oe&&{password:A(ye.PASSWORD),confirmPassword:A(ye.CONFIRM_PASSWORD)}}}},Ce)}),we.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kX,{label:j(vu.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:A(ye.METHOD_CHOICE_HINT)}),(0,$.jsx)(zX,{methods:we,labelFor:e=>TX(e,{socialProviders:C,continueWithTemplate:j(vu.CONTINUE_WITH),translateLabel:e=>j(e),resolveSocialProviderLabel:e=>AX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:MX[e.providerRef]?.label,translate:E})}),onSelect:Se,disabled:ie})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsxs)(Z,{className:`text-sm`,children:[A(ye.ALREADY_HAVE_ACCOUNT),` `,(0,$.jsx)(gX,{href:P,children:A(ye.SIGNIN_LINK)})]})})]})};function kbe({mode:e}){let t=og(),{tComponent:n,isReady:r}=J({component:U.PUBLIC_LAYOUTS_USER_REGISTER}),i=(0,Q.useMemo)(()=>z(t.search),[t.search]),a=(0,Q.useMemo)(()=>Oi(Pa.login,i),[i]);if(!r)return null;let o=e===qu.INVITATION_ONLY?ye.INVITATION_ONLY:e===qu.ADMIN_ONLY?ye.ADMIN_ONLY:ye.REGISTRATION_DISABLED,s=e=>n(U.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)(SY,{children:s(ye.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(o)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(_X,{href:a,children:s(ye.SIGNIN_LINK)})})]})}function XZ({preset:e=G.DEFAULT,...t}){let{auth:n}=ag(),r=Jx(),i=og(),a=(0,Q.useMemo)(()=>Yt(i.search),[i.search]);if(n.accessToken)return(0,$.jsx)(Vh,{to:a,replace:!0});if(!r.registrationConfig.publicRegistrationAvailable)return(0,$.jsx)(kbe,{mode:r.registrationConfig.mode});let o=q(U.PUBLIC_LAYOUTS_USER_REGISTER,`Auth_Register`)(e);return(0,$.jsx)(o,{...t})}var Abe=()=>(0,$.jsx)(fX,{useCardLayout:!0,children:(0,$.jsx)(XZ,{})});function ZZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_TERMS,`PublicLayout_Terms`)(e);return(0,$.jsx)(n,{...t})}function QZ({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_LEGAL_NOTICE,`PublicLayout_LegalNotice`)(e);return(0,$.jsx)(n,{...t})}function jbe(){let{on:e}=qo(),{navigate:t}=SS(),{registry:n}=pm(),r=oh();return(0,Q.useEffect)(()=>e(xc.NAVIGATION_REQUEST,e=>{let i;e.operationRef?i=Um.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 $Z(e){let t=(0,Q.useSyncExternalStore)(Um.subscribeToTransactionState,Um.getTransactionEpoch,Um.getTransactionEpoch),n=(0,Q.useCallback)(()=>void 0,[]);return{retryTick:t,scheduleRetry:n,clearRetry:n}}function eQ(){let e=og(),t=(0,Q.useContext)(Mse)?.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 tQ(e){let t=eQ();return t.pathname!==e.pathname||t.search!==e.search}function Mbe(e,t,n){let r=og(),i=tQ(r),a=zm(),{registry:o}=pm(),{emit:s}=qo(),{getZoneState:c,contentAreaWidth:l}=Mx(),u=Qp(),d=cS(),{navigationLayout:f,currentBreakpoint:p}=Ig(),m=(0,Q.useMemo)(()=>Um.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}=$Z(m),x=(0,Q.useMemo)(()=>{if(!e||!t)return[];let n=o.resourceConfigurations?.[e];return n?za.buildOperationFrontendRoutePaths(n,t,o.allResourceFieldIdentifiers).map(e=>e.url):[]},[e,t,o]);(0,Q.useEffect)(()=>{if(!e||!t)return;if(Rx(`useRouterSync: effect fired`,{resourceType:e,operationId:t.operationIdentifier,locationPathname:r.pathname,lastSyncedPath:_.current,routePatternsCount:x.length}),Um.isInTransaction()){Rx(`useRouterSync: SKIP — navigation transaction active`,{source:Um.getTransactionSource()}),y();return}if(b(),i){Rx(`useRouterSync: SKIP — the router is ahead of the committed location`,{committedUrl:m});return}if(_.current===m){Rx(`useRouterSync: SKIP — already synced this path`,{currentBrowserUrl:m});return}if(x.length>0&&!x.some(e=>Um.matchUrlPattern(e,r.pathname))){Rx(`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?En.buildParentResourcesRequirementsFromRouteParams(n,e,o):[],S=f?.zones,C=!!S?.secondary,w=!!S?.companion,T=Um.calculateResourceRelationshipDepth(v),E=T===0&&C&&t!==void 0&&Um.layoutSplitsOperationFromPrimary(f,t,p),D=Um.resolveResourceTargetZone(T,{hasSecondary:C,hasCompanion:w,prefersAdjacentZoneForDetail:E}),O=T>=1&&D!==so.PRIMARY&&Hx({content:{contentType:va.RESOURCE_OPERATION,resourceContext:En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:{},parentResourcesRequirements:v})},paneZone:D,layout:f,registry:o,viewport:p,contentAreaWidth:l})?so.PRIMARY:D,k=Gh({zone:O,layout:f,viewport:p,contentAreaWidth:l})?O:so.PRIMARY;k!==O&&Rx(`useRouterSync: adjacent zone is collapsed at this viewport — restoring into PRIMARY`,{preferredZone:O,viewport:p,contentAreaWidth:l});let A=Um.zoneOwnsBrowserUrl(k,m,c);if(Rx(`useRouterSync: checking guards`,{currentBrowserUrl:m,targetZone:k,targetZoneOwnsUrl:A,targetZoneTopUrlPath:Um.getTopEntry(c(k))?.urlPath}),A){Rx(`useRouterSync: SKIP — target zone already owns current URL`,{targetZone:k}),_.current=m;return}let j=Um.findStructuralRouteOwner(m,c);if(j&&j.zone!==k){Rx(`useRouterSync: SKIP — another structural zone already shows this destination`,{owningZone:j.zone,targetZone:k,currentBrowserUrl:m}),_.current=m;return}let M=En.extractResourceIdentifiersFromUrlParams(a,o,n),N=nm.buildResourceOperationContextIdentifiers({currentUserId:u?.currentUserId,currentOrganizationId:u?.currentOrganizationId,currentApplicationId:u?.currentApplicationId,currentAnonymousUserId:u?.currentAnonymousUserId,primaryScope:g,liveAppScopeContextResourceIdentifiers:h,explicitContextResourceIdentifiers:M}),P=En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:N,parentResourcesRequirements:v}),F={contentType:va.RESOURCE_OPERATION,resourceContext:P},I=Um.generateStackEntryId();Rx(`useRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{resourceType:e,operationId:t.operationIdentifier,currentBrowserUrl:m,mergedContextIdentifiers:N,depth:T,targetZone:k}),T>=1&&Um.beginTransaction(`url_reverse_cascade`);let L=k!==O,ee=Nle({content:F,paneZone:O,placedZone:k,layout:f,registry:o,viewport:p,contentAreaWidth:l});if(L&&E&&O===so.SECONDARY&&Gx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),s(L?xc.NAVIGATION_PUSH:xc.NAVIGATION_REPLACE,{zone:k,content:F,urlPath:m,stackEntryId:I,initiator:{sourceZone:k},navigationSource:Ht.URL_SYNC,transition:Ka.REPLACE,...L?{collapsedFromZone:O}:{},...ee?{persistent:!0}:{}}),E&&k===so.SECONDARY&&Gx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),T>=1){let e=Vu(N);qx(F,k,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 nQ(e,t){let n=og(),r=tQ(n),{emit:i}=qo(),{getZoneState:a}=Mx(),{registry:o}=pm(),{fullCustomViews:s,flowsActorsViews:c}=Ig(),l=(0,Q.useRef)(null),u=Um.buildBrowserUrl(n.pathname,n.search),{retryTick:d,scheduleRetry:f,clearRetry:p}=$Z(u);(0,Q.useEffect)(()=>{if(!e)return;if(Um.isInTransaction()){f();return}if(p(),r||l.current===u)return;if(Um.zoneOwnsBrowserUrl(so.PRIMARY,u,a)){l.current=u;return}let d,m=t===va.COMPOSITE_VIEW?Fp(new URLSearchParams(n.search)):void 0,h=t===va.CHART_VIEW?Kp(new URLSearchParams(n.search)):void 0,g=t===va.CHART_VIEW?Wp(new URLSearchParams(n.search)):void 0,_=t===va.EXECUTION_VIEW?um(new URLSearchParams(n.search)):void 0,v=t===va.FULL_CUSTOM_VIEW?s?.find(t=>t.ref===e):void 0,y=t===va.FLOWS_ACTORS_VIEW?c?.find(t=>t.ref===e):void 0,b=t===va.EXECUTION_VIEW?Op({viewRef:e,registry:o}):void 0;switch(t){case va.COMPOSITE_VIEW:d={contentType:va.COMPOSITE_VIEW,viewRef:e,contextResourceIdentifiers:m};break;case va.CHART_VIEW:d={contentType:va.CHART_VIEW,viewRef:e,contextResourceIdentifiers:h,urlParamValues:g};break;case va.FULL_CUSTOM_VIEW:if(!v)return;d={contentType:va.FULL_CUSTOM_VIEW,viewRef:e,fullCustomComponentRef:v.componentRef};break;case va.FLOWS_ACTORS_VIEW:if(!y)return;d={contentType:va.FLOWS_ACTORS_VIEW,viewRef:e,flowsActorsSystemRef:y.systemRef};break;case va.EXECUTION_VIEW:if(!b||b.isAddressable!==!0)return;d={contentType:va.EXECUTION_VIEW,viewRef:e,contextResourceIdentifiers:_};break;default:return}let x=Um.generateStackEntryId();Rx(`useViewRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{viewRef:e,contentType:t,locationPathname:n.pathname,locationSearch:n.search}),i(xc.NAVIGATION_REPLACE,{zone:so.PRIMARY,content:d,urlPath:Um.decomposeHostedPaneBrowserUrl(u).hostUrl,stackEntryId:x,initiator:{sourceZone:so.PRIMARY},navigationSource:Ht.URL_SYNC,transition:Ka.REPLACE}),l.current=u},[e,t,i,a,s,c,o,u,r,d,f,p])}function Nbe(e){let t=og(),n=tQ(t),{emit:r}=qo(),{getZoneState:i}=Mx(),a=(0,Q.useRef)(null),o=Um.buildBrowserUrl(t.pathname,t.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=$Z(o);(0,Q.useEffect)(()=>{if(!e)return;if(Um.isInTransaction()){c();return}if(l(),n||a.current===o)return;if(Um.zoneOwnsBrowserUrl(so.PRIMARY,o,i)){a.current=o;return}let t=Um.generateStackEntryId();r(xc.NAVIGATION_REPLACE,{zone:so.PRIMARY,content:{contentType:va.ENGINE_PAGE,pageRef:e},urlPath:Um.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:t,initiator:{sourceZone:so.PRIMARY},navigationSource:Ht.URL_SYNC,transition:Ka.REPLACE}),a.current=o},[e,r,i,o,n,s,c,l])}function Pbe(){let e=eQ(),{emit:t}=qo(),{getZoneState:n}=Mx(),r=(0,Q.useRef)(null),i=Um.buildBrowserUrl(e.pathname,e.search),{retryTick:a,scheduleRetry:o,clearRetry:s}=$Z(i);(0,Q.useEffect)(()=>{if(Um.isInTransaction()){o();return}if(s(),r.current===i)return;if(rQ(e.pathname).isSettings){r.current=i;return}let a=Um.findStructuralStackEntryOwningUrl(i,n);if(a?.isTop){if(a.searchDiffers){let{hostUrl:e,paneUrl:r}=Um.decomposeHostedPaneBrowserUrl(i),o=r===void 0?[{zone:a.zone,entry:a.entry,urlPath:i}]:[{zone:so.PRIMARY,entry:Um.getTopEntry(n(so.PRIMARY)),urlPath:e},{zone:so.SECONDARY,entry:a.entry,urlPath:r}];for(let e of o)e.entry&&e.entry.urlPath!==e.urlPath&&(Rx(`useStructuralZoneBackForwardSync: refreshing entry urlPath for a view-state change`,{zone:e.zone,stackEntryId:e.entry.id,from:e.entry.urlPath,to:e.urlPath}),t(xc.NAVIGATION_URL_PATH_UPDATED,{zone:e.zone,stackEntryId:e.entry.id,urlPath:e.urlPath}))}r.current=i}else if(a)Rx(`useStructuralZoneBackForwardSync: POP to backstack entry`,{zone:a.zone,toStackEntryId:a.entry.id,currentUrl:i}),t(xc.NAVIGATION_POP,{zone:a.zone,toStackEntryId:a.entry.id}),r.current=i;else{if(dd.some(e=>n(e).stack.length>0)){Rx(`useStructuralZoneBackForwardSync: clearing structural zones for URL rebuild`,{currentUrl:i}),Um.beginTransaction(`backforward_url_rebuild`);for(let e of dd)t(xc.NAVIGATION_CLEAR_ZONE,{zone:e})}r.current=i}},[i,e.pathname,t,n,a,o,s])}function Fbe(){let e=eQ(),{emit:t}=qo(),{getZoneState:n}=Mx(),{registry:r}=pm(),i=Qp(),a=(0,Q.useRef)(null),o=Um.buildBrowserUrl(e.pathname,e.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=$Z(o),u=(0,Q.useMemo)(()=>i?.buildContextResourceIdentifiers?.()??{},[i]);(0,Q.useEffect)(()=>{if(Um.isInTransaction()){c();return}if(l(),a.current===o)return;if(rQ(e.pathname).isSettings){a.current=o;return}let{paneUrl:s}=Um.decomposeHostedPaneBrowserUrl(o),d=n(so.SECONDARY),f=Um.getTopEntry(d);if(s===void 0){f?.hostedPane&&(Rx(`useHostedPaneRouteSync: pane left the URL — clearing SECONDARY`,{currentUrl:o}),t(xc.NAVIGATION_CLEAR_ZONE,{zone:so.SECONDARY})),a.current=o;return}if(f?.hostedPane&&Um.urlsAddressSameDestination(f.urlPath,s)){a.current=o;return}let p=Um.getTopEntry(n(so.PRIMARY));if(Um.isHeldHostedPane(p)&&Um.urlsAddressSameDestination(p?.urlPath,s)){a.current=o;return}let m=[...d.stack].reverse().find(e=>e.hostedPane&&Um.urlsAddressSameDestination(e.urlPath,s));if(m){Rx(`useHostedPaneRouteSync: POP to a buried pane`,{toStackEntryId:m.id,paneUrl:s}),t(xc.NAVIGATION_POP,{zone:so.SECONDARY,toStackEntryId:m.id}),a.current=o;return}let h=Um.resolveResourceRouteForUrl(s,r);if(!h){Rx(`useHostedPaneRouteSync: pane URL matches no addressable resource route — ignored`,{paneUrl:s}),a.current=o;return}let g=En.buildParentResourcesRequirementsFromRouteParams(h.routePathParameters,h.resourceType,r),_=En.extractResourceIdentifiersFromUrlParams(h.urlParameters,r,h.routePathParameters),v=r.resourceConfigurations?.[h.resourceType]?.resourcePrimaryScope,y=nm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:i?.currentApplicationId,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:v,liveAppScopeContextResourceIdentifiers:u,explicitContextResourceIdentifiers:_}),b=En.createFrontendResourceOperationContextFromOperation({resourceType:h.resourceType,operation:h.operation,contextResourceIdentifiers:y,parentResourcesRequirements:g});Rx(`useHostedPaneRouteSync: EMITTING NAVIGATION_REPLACE (URL_SYNC) for the hosted pane`,{paneUrl:s,resourceType:h.resourceType,operationId:h.operation.operationIdentifier}),t(xc.NAVIGATION_REPLACE,{zone:so.SECONDARY,content:{contentType:va.RESOURCE_OPERATION,resourceContext:b},urlPath:s,stackEntryId:Um.generateStackEntryId(),initiator:{sourceZone:so.PRIMARY},navigationSource:Ht.URL_SYNC,transition:Ka.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 rQ(e){if(e===Pa.settings)return{isSettings:!0};let t=`${Pa.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 Ibe(){let e=eQ(),{emit:t}=qo(),{state:n}=Mx(),{retryTick:r,scheduleRetry:i,clearRetry:a}=$Z(e.pathname),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(Um.isInTransaction()){i();return}a();let{isSettings:r,sectionRef:s,subTabRef:c}=rQ(e.pathname),l=n.overlay,u=l.length>0?l[l.length-1]:void 0,d=!1,f,p;if(u&&u.content.contentType===va.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?xc.NAVIGATION_REPLACE:xc.NAVIGATION_PUSH,r=`${n}|${e.pathname}|${s??``}|${c??``}|${l.length}`;if(o.current===r)return;o.current=r,t(n,{zone:Vn.OVERLAY,content:{contentType:va.SETTINGS_HUB,sectionRef:s,subTabRef:c},urlPath:Um.buildBrowserUrl(e.pathname,e.search),stackEntryId:Um.generateStackEntryId(),initiator:{sourceZone:Vn.OVERLAY},navigationSource:Ht.URL_SYNC,transition:Ka.OVERLAY,appearance:xi.DIALOG,ephemeral:!1})}else if(d){let e=`${xc.NAVIGATION_CLOSE}|${l.length}`;if(o.current===e)return;o.current=e,t(xc.NAVIGATION_CLOSE,{zone:Vn.OVERLAY})}else o.current=null},[e.pathname,e.search,t,n.overlay,r,i,a])}var iQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=Vn.PRIMARY})=>{let{fullCustomViews:i}=Ig(),a=Qp(),o=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,o,e]);let s=(0,Q.useMemo)(()=>{let e=nm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=o?.primaryScope?nm.primaryScopeToContextIdentifiers(e,o.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=nm.filterCustomScopeContextResourceIdentifiers(r);return o?nm.resolveViewContextResourceIdentifiers({surfaceName:`FullCustomView`,surfaceRef:o.ref,primaryScope:o.primaryScope,parentResourcesRequirements:o.parentResourcesRequirements,additionalResourceRequirements:o.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n}):nm.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)(c_,{viewKind:`full-custom`,viewRef:e});let c=Xo.resolve(o.componentRef,G.DEFAULT);return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ZY,{viewRef:o.ref,contentType:va.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)(ol,{componentType:o.componentRef,componentName:o.componentRef})},aQ;(function(e){e.TURN=`turn`,e.TOOL=`tool`,e.REASONING=`reasoning`,e.HOST=`host`})(aQ||={});var oQ;(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`})(oQ||={});function sQ(e,t){return[...e??[],t]}function Lbe(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 cQ=new Set([L.TEXT,L.MARKDOWN]);function lQ(e){if(e==null)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t}function Rbe(e){if(e.role===Fc.TOOL){let t=Br.safeParse(e.data);return t.success?{kind:aQ.TOOL,key:`tool:${t.data.toolCallId}`,trace:t.data,fromRecordOnly:!0}:null}if(e.role!==Fc.USER&&e.role!==Fc.ASSISTANT)return null;if(e.contentType===L.REASONING)return{kind:aQ.REASONING,key:`reasoning:${e.id}`,content:e.content};if(e.contentType!==void 0&&!cQ.has(e.contentType))return null;let t=wc.safeParse(e.data).data?.sources;return{kind:aQ.TURN,key:`message:${e.id}`,storedMessageId:e.id,role:e.role,content:e.content,markdown:e.role===Fc.ASSISTANT||e.contentType===L.MARKDOWN,...t&&t.length>0?{sources:t}:{}}}var uQ;(function(e){e.NONE=`none`,e.REASONING=`reasoning`,e.TOOL=`tool`,e.REPLY=`reply`})(uQ||={});function zbe(e,t){let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>{let t=e.role===Fc.TOOL?Br.safeParse(e.data):null;return t?.success?[t.data.toolCallId]:[]})),i=e.status===yW.RUNNING||e.status===yW.STARTING,a=new Map,o=new Map,s=new Map,c=uQ.NONE;e.messages.forEach((t,r)=>{let i=t.messageId??`${e.executionId}:${r}`;if(t.type===L.REASONING){let e=a.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,a.set(i,e),n.has(i)||(c=uQ.REASONING)}else if(t.type===L.PROGRESS){let e=Br.safeParse(t.data);if(!e.success)return;s.set(e.data.toolCallId,{...s.get(e.data.toolCallId),...e.data}),c=uQ.TOOL}else if(cQ.has(t.type)){let e=o.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,e.sources.push(...wc.safeParse(t.data).data?.sources??[]),o.set(i,e),n.has(i)||(c=uQ.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:aQ.REASONING,key:`live-reasoning:${e.id}`,content:e.content,streaming:i&&t===u.length-1&&c===uQ.REASONING}));let p=new Map;for(let e of s.values())r.has(e.toolCallId)?p.set(e.toolCallId,e):f.push({kind:aQ.TOOL,key:`tool:${e.toolCallId}`,trace:e});return d.forEach((e,t)=>f.push({kind:aQ.TURN,key:`live-reply:${e.id}`,role:Fc.ASSISTANT,content:e.content,markdown:!0,...i&&t===d.length-1&&c===uQ.REPLY?{streaming:!0}:{},...e.sources.length>0?{sources:e.sources}:{}})),{entries:f,calls:[...s.values()],recordedCallUpdates:p,activity:c}}function Bbe(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if((n.role===Fc.USER||n.role===Fc.ASSISTANT)&&(n.contentType===void 0||cQ.has(n.contentType)))return n.role}}function dQ(e){let t=e.thread?.messages??[],n=[],r=new Map;for(let e of t){let t=Rbe(e);if(t){if(t.kind===aQ.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:lQ(e.createdAt),entry:t})}}let i=e.live,a=i?zbe(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 Lbe(e.sent,new Set(t.map(e=>e.id))))n.push({at:r.sentAt.getTime(),entry:{kind:aQ.TURN,key:`sent-pending:${r.id}`,role:Fc.USER,content:r.text,markdown:!1,pending:!0}});let o=(e.hostEntries??[]).map((e,t)=>({at:lQ(e.at),index:t,entry:{kind:aQ.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===to.AWAITING_APPROVAL&&r&&e.thread?.pendingApproval!==void 0)return{entries:s,turnState:oQ.AWAITING_DECISION,activeExecutionId:r,stoppable:!1};let i=e.thread?.failureCode;return n===to.FAILED&&i!==void 0?{entries:s,turnState:oQ.FAILED,stoppable:!1,recoverable:!1,errorCode:i}:n===to.FAILED&&Bbe(t)===Fc.USER?{entries:s,turnState:oQ.INTERRUPTED,stoppable:!1}:n===to.CANCELLED?{entries:s,turnState:oQ.STOPPED,stoppable:!1}:{entries:s,turnState:oQ.IDLE,stoppable:!1}}switch(s.push(...a.entries),i.status){case yW.STARTING:case yW.RUNNING:{if(a.activity===uQ.REPLY)return{entries:s,turnState:oQ.ANSWERING,activeExecutionId:i.executionId,stoppable:!0};let e=a.activity===uQ.TOOL?a.calls.at(-1):void 0;return{entries:s,turnState:oQ.WORKING,activeExecutionId:i.executionId,stoppable:!0,...e?.phase===hee.CALL?{currentCall:e}:{}}}case yW.AWAITING_APPROVAL:return{entries:s,turnState:oQ.AWAITING_DECISION,activeExecutionId:i.executionId,stoppable:!1,...i.errorCode?{errorCode:i.errorCode}:{}};case yW.CANCELLED:return{entries:s,turnState:oQ.STOPPED,stoppable:!1};case yW.ERROR:return{entries:s,turnState:oQ.FAILED,stoppable:!1,recoverable:i.recoverable===!0,...i.errorCode?{errorCode:i.errorCode}:{}};case yW.IDLE:case yW.COMPLETED:return{entries:s,turnState:oQ.IDLE,stoppable:!1}}}function fQ(e){return new Date(e.createdAt).getTime()}function pQ(e){return[...e].sort((e,t)=>fQ(t)-fQ(e))}function mQ(e,t){if(!t.hasOlder)return{threads:pQ(t.executions),hasOlder:!1};let n=Math.min(...t.executions.map(fQ)),r=new Set(t.executions.map(e=>e.executionId)),i=e.threads.filter(e=>fQ(e)<n&&!r.has(e.executionId));return{threads:pQ([...t.executions,...i]),hasOlder:i.length>0?e.hasOlder:!0}}function hQ(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:pQ(n.values()),hasOlder:t.hasOlder}}function gQ(e){let t=e.threads.at(-1);return t?new Date(t.createdAt).toISOString():void 0}async function _Q(e){let t=await e();if(!t)return;let n=mQ({threads:[],hasOlder:!1},t);for(;n.hasOlder;){let t=gQ(n),r=await e(t?{before:t}:void 0);if(!r)return;let i=hQ(n,r);if(i.threads.length===n.threads.length)break;n=i}return n.threads}var vQ=rc(U.LOW_LEVEL_AI_CONVERSATION_THREAD,`AI_ConversationThread`,[`Composer`,`Discussions`]);function yQ({preset:e=G.DEFAULT,...t}){let n=vQ(e);return(0,$.jsx)(n,{...t})}function bQ({preset:e=G.DEFAULT,...t}){let n=vQ(e);return(0,$.jsx)(n.Composer,{...t})}function xQ({preset:e=G.DEFAULT,...t}){let n=vQ(e);return(0,$.jsx)(n.Discussions,{...t})}var SQ=new Map;function CQ(e,t,n,r){return`${e??``}\u0000${t}\u0000${n}\u0000${r}`}function Vbe(e){return SQ.get(e)??null}function Hbe(e,t){t?SQ.set(e,t):SQ.delete(e)}var wQ=rc(U.LOW_LEVEL_AI_MESSAGE,`AI_Message`,[`Content`,`Response`,`Actions`,`Action`,`Branch`,`BranchContent`,`BranchSelector`,`BranchPrevious`,`BranchNext`,`BranchPage`,`Attachment`,`Attachments`,`Toolbar`]);function TQ({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n,{...t})}function EQ({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Content,{...t})}function DQ({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Response,{...t})}function OQ({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Actions,{...t})}function kQ({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Action,{...t})}function Ube({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Branch,{...t})}function Wbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.BranchContent,{...t})}function Gbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.BranchSelector,{...t})}function Kbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.BranchPrevious,{...t})}function qbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.BranchNext,{...t})}function Jbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.BranchPage,{...t})}function Ybe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Attachment,{...t})}function Xbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Attachments,{...t})}function Zbe({preset:e=G.DEFAULT,...t}){let n=wQ(e);return(0,$.jsx)(n.Toolbar,{...t})}var Qbe=wi.createOperationPathKey({resourceIdentifier:gu.AGENT_BEHAVIOR_REPORTS,operationIdentifier:K.CREATE,variantType:E.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),AQ;(function(e){e.IDLE=`idle`,e.SENDING=`sending`,e.SENT=`sent`})(AQ||={});function $be({executionId:e,messageId:t,organizationId:n}){let{tComponent:r,tResourceFieldEnumValue:i}=J({component:U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,resource:gu.AGENT_BEHAVIOR_REPORTS}),a=(0,Q.useMemo)(()=>_m(r,U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[r]),{doOperation:o}=pm(),s=lp(),{renderIcon:c}=kf(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(void 0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(AQ.IDLE),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b=(0,Q.useMemo)(()=>Object.values(xte).map(e=>({value:e,label:i(gu.AGENT_BEHAVIOR_REPORTS,`category`,e,Ca.shape.category)})),[i]),x=(0,Q.useCallback)(async()=>{if(d&&!y.current){y.current=!0,g(AQ.SENDING),v(null);try{let r=p.trim();await o(Qbe,{contextualParameters:{organizationId:n},requestData:{executionRef:{kind:Oa.CONVERSATIONAL_EXECUTION,id:e},turnMessageId:t,category:d,...r?{comment:r}:{}}},{silent:!0}),g(AQ.SENT),u(!1)}catch(e){v(s(e)),g(AQ.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===AQ.SENT,T=a(w?`replyReported`:`reportReply`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kQ,{tooltip:T,label:T,disabled:w,onClick:()=>{v(null),u(!0)},"data-agent-reply-report":h,children:c(H.WARNING,{size:Jn.SM})}),(0,$.jsx)(nG,{open:l,onOpenChange:e=>{h!==AQ.SENDING&&u(e)},children:(0,$.jsxs)(iG,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(oG,{children:[(0,$.jsx)(cG,{children:a(`reportDialogTitle`)}),(0,$.jsx)(lG,{children:a(`reportDialogDescription`)})]}),(0,$.jsxs)(cx,{className:`gap-field py-field`,children:[(0,$.jsxs)(ax,{children:[(0,$.jsx)(sx,{id:S,children:a(`reportCategoryLabel`)}),(0,$.jsx)(wF,{"aria-labelledby":S,name:`agent-reply-report-category-${t}`,schema:Ca.shape.category,options:b,value:d,onValueChange:e=>f(e),orientation:Ks.VERTICAL,disabled:h===AQ.SENDING,required:!0})]}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{htmlFor:`field-${C}`,children:a(`reportCommentLabel`)}),(0,$.jsx)(NI,{name:C,schema:Ca.shape.comment,value:p,onChange:e=>m((e??``).slice(0,oe)),placeholder:a(`reportCommentPlaceholder`),rows:3,disabled:h===AQ.SENDING})]}),_?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:_})}):null]}),(0,$.jsxs)(sG,{children:[(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>u(!1),disabled:h===AQ.SENDING,children:a(`reportCancel`)}),(0,$.jsx)(X,{onClick:()=>{x()},disabled:!d||h===AQ.SENDING,children:a(`reportSend`)})]})]})})]})}function jQ(e,t=40){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t)}…`:n}function exe(e){return jQ(e.messages.find(e=>e.role===Fc.USER)?.content??``)}function MQ(){let{tComponent:e}=J({component:U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS});return(0,Q.useMemo)(()=>_m(e,U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[e])}var txe=new Set([yW.COMPLETED,yW.CANCELLED,yW.ERROR,yW.AWAITING_APPROVAL]),NQ={threads:[],hasOlder:!1},nxe=({system:e,contextResourceIdentifiers:t,preset:n,caseRef:r})=>{let i=MQ(),{startExecution:a,cancelExecution:o,executions:s,fetchConversationHistory:c,deleteConversation:l}=TW(),u=Qp(),d=u?.currentUserId??null,f=At(t),p=(0,Q.useRef)(t);p.current=t;let[m,h]=(0,Q.useState)(NQ),g=m.threads,[_,v]=(0,Q.useState)(!1),y=r?`${r.resourceType}:${r.resourceId}`:``,b=CQ(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 Hbe(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=>mQ(e,n))},[e.ref,c]),A=(0,Q.useRef)(0),j=(0,Q.useCallback)(async()=>{let t=gQ(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=>hQ(e,r))}finally{n===A.current&&v(!1)}},[m,_,e.ref,c]);(0,Q.useEffect)(()=>{let e=T.current;e&&m!==NQ&&(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(NQ),v(!1);let t=Vbe(CQ(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&&txe.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)(()=>dQ({...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:exe(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:jQ(t[0].text)})),...e]},[g,E]),L=(0,Q.useCallback)(()=>w(null),[w]),ee=(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]:sQ(e[i],{id:n,text:t,sentAt:new Date})})),w(i))},[a,e.ref,x,r,w]),te=F.turnState===oQ.WORKING||F.turnState===oQ.ANSWERING||F.turnState===oQ.AWAITING_DECISION,ne=F.stoppable?F.activeExecutionId:void 0,re=Fn(t,u?.currentOrganizationId??void 0),ie=N?x:null,ae=(0,Q.useMemo)(()=>ie&&re?({messageId:e})=>(0,$.jsx)($be,{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)(xQ,{preset:n,discussions:I,currentId:x,onNew:L,onSelect:ee,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)(yQ,{preset:n,model:F,...ae?{renderReplyActions:ae}:{},emptyState:{title:e.displayName,description:e.description||i(`emptyStateDescription`)}}),(0,$.jsx)(bQ,{preset:n,placeholder:i(`promptPlaceholder`,{assistant:e.displayName}),onSubmit:z,sendDisabled:te,...ne?{onStop:()=>o(ne)}:{}})]})]})})},rxe=({system:e})=>{let t=MQ(),{executions:n}=TW(),r=(0,Q.useMemo)(()=>Array.from(n.values()).some(t=>t.systemRef===e.ref&&(t.status===yW.RUNNING||t.status===yW.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:W(`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`)})]})},PQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,caseRef:r})=>{let{flowsActorsViews:i}=Ig(),a=Qp(),{systems:o,isLoading:s}=TW(),{isReady:c}=J({component:U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),l=MQ(),u=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,u,e]);let d=(0,Q.useMemo)(()=>{let e=nm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=u?.primaryScope?nm.primaryScopeToContextIdentifiers(e,u.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=nm.filterCustomScopeContextResourceIdentifiers(r);return u?nm.resolveViewContextResourceIdentifiers({surfaceName:`FlowsActorsView`,surfaceRef:u.ref,primaryScope:u.primaryScope,parentResourcesRequirements:u.parentResourcesRequirements,additionalResourceRequirements:u.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n})??{}:nm.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)(rxe,{system:f}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col pt-card-sm`,children:(0,$.jsx)(nxe,{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)(c_,{viewKind:`flows-actors`})},ixe=Q.lazy(()=>s_(()=>import(`./ChartView-B6f1J6Er.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function axe(e){let{insertedIdentity:t,contextResourceIdentifiers:n,urlParamValues:r,registry:i}=e;if(t.hostKind!==Vp.RESOURCE||t.viewKind!==xp.CHART_VIEW)return;let a=Np({viewRef:t.insertedViewRef,registry:i})?.chartView;if(!a||!Jp(a))return;let o=n??{};return{routeViewRef:t.insertedViewRef,viewDefinition:a,contextResourceIdentifiers:o,urlParamValues:r,runtimeDescriptor:_p({identity:t,chartView:a,contextResourceIdentifiers:o}),requiredFeatures:a.chartDefinition.requiredFeatures}}function oxe(e){let{viewRef:t,registry:n,contextResourceIdentifiers:r,urlParamValues:i}=e;if(!t)return;let a=Mp(t);if(a)return axe({insertedIdentity:a,contextResourceIdentifiers:r,urlParamValues:i,registry:n})}function sxe(e){let t=og(),n=tQ(t),{emit:r}=qo(),{getZoneState:i}=Mx(),a=Q.useRef(null),o=`${t.pathname}${t.search}`,{retryTick:s,scheduleRetry:c,clearRetry:l}=$Z(o);Q.useEffect(()=>{e&&(Um.isInTransaction()?c():(l(),n||a.current!==o&&(Um.zoneOwnsBrowserUrl(so.PRIMARY,o,i)||r(xc.NAVIGATION_REPLACE,{zone:so.PRIMARY,content:{contentType:va.CHART_VIEW,viewRef:e.routeViewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor,requiredFeatures:e.requiredFeatures},urlPath:Um.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:Um.generateStackEntryId(),initiator:{sourceZone:so.PRIMARY},navigationSource:Ht.URL_SYNC,transition:Ka.REPLACE}),a.current=o)))},[r,i,e,o,n,s,c,l])}var cxe=new Set(Object.values(K).map(e=>String(e).toLowerCase()));function lxe(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}`):cxe.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 uxe=il.getLogger(),dxe=({resourceType:e,operation:t,PageComponent:n,routePathParameters:r})=>{let{registry:i}=pm(),a=Qp(),{navigationLayout:o,currentBreakpoint:s}=Ig(),{contentAreaWidth:c}=Mx(),l=zm(),u=Q.useMemo(()=>lxe(l,e),[l,e]);Mbe(u.isValid?e:void 0,u.isValid?t:void 0,r),Q.useEffect(()=>{!u.isValid&&u.message&&uxe.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(()=>En.buildParentResourcesRequirementsFromRouteParams(r,e,i),[r,e,i]);if(!u.isValid)return(0,$.jsx)(Gy,{});let f=En.extractResourceIdentifiersFromUrlParams(l,i,r),p=i.resourceConfigurations?.[e]?.resourcePrimaryScope,m=nm.buildResourceOperationContextIdentifiers({currentUserId:a?.currentUserId,currentOrganizationId:a?.currentOrganizationId,currentApplicationId:a?.currentApplicationId,currentAnonymousUserId:a?.currentAnonymousUserId,primaryScope:p,liveAppScopeContextResourceIdentifiers:a?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:f}),h=En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:m,parentResourcesRequirements:d}),g=Um.calculateResourceRelationshipDepth(d),_=g===0&&!!o?.zones?.secondary&&Um.layoutSplitsOperationFromPrimary(o,t,s),v=Um.resolveResourceTargetZone(g,{hasSecondary:!!o?.zones?.secondary,hasCompanion:!!o?.zones?.companion,prefersAdjacentZoneForDetail:_}),y=g>=1&&v!==so.PRIMARY&&Hx({content:{contentType:va.RESOURCE_OPERATION,resourceContext:h},paneZone:v,layout:o,registry:i,viewport:s,contentAreaWidth:c})?so.PRIMARY:v,b=Gh({zone:y,layout:o,viewport:s,contentAreaWidth:c})?y:so.PRIMARY;return(0,$.jsx)(n,{resourceContext:h,navigationZone:b,navigationInitiator:{sourceZone:b}})};function FQ(e,t){let{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Ig(),{registry:a}=pm();return Q.useMemo(()=>{if(e)switch(t){case va.COMPOSITE_VIEW:return vp({viewRef:e,compositeViews:n,registry:a})?.requiredFeatures;case va.CHART_VIEW:return Np({viewRef:e,registry:a})?.chartView.chartDefinition.requiredFeatures;case va.FULL_CUSTOM_VIEW:return r?.find(t=>t.ref===e)?.requiredFeatures;case va.FLOWS_ACTORS_VIEW:return i?.find(t=>t.ref===e)?.requiredFeatures;case va.EXECUTION_VIEW:return Op({viewRef:e,registry:a})?.requiredFeatures;default:return}},[e,t,n,r,i,a])}var IQ=({ViewComponent:e,contentType:t,viewProps:n})=>{let{viewRef:r}=zm();nQ(r,t);let i=FQ(r,t);return(0,$.jsx)(Wh,{requiredFeatures:i,children:(0,$.jsx)(e,{viewRef:r,...n})})},fxe=({viewProps:e})=>{let{viewRef:t}=zm(),n=og(),{compositeViews:r}=Ig(),{registry:i}=pm(),a=Q.useMemo(()=>Fp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>vp({viewRef:t,compositeViews:r,registry:i}),[t,r,i]),s=!!t&&Bp(o);nQ(s?t:void 0,va.COMPOSITE_VIEW);let c=FQ(s?t:void 0,va.COMPOSITE_VIEW);return s?(0,$.jsx)(Wh,{requiredFeatures:c,children:(0,$.jsx)(GU,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(c_,{viewKind:`composite`,viewRef:t})},pxe=({viewProps:e})=>{let{viewRef:t}=zm(),n=og(),{registry:r}=pm(),i=Q.useMemo(()=>Op({viewRef:t,registry:r}),[t,r]),a=Q.useMemo(()=>um(new URLSearchParams(n.search)),[n.search]),o=!!t&&!!i&&ap(i);nQ(o?t:void 0,va.EXECUTION_VIEW);let s=FQ(o?t:void 0,va.EXECUTION_VIEW);return o?(0,$.jsx)(Wh,{requiredFeatures:s,children:(0,$.jsx)(QY,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(c_,{viewKind:`execution`,viewRef:t})},mxe=({viewProps:e})=>{let{viewRef:t}=zm(),n=og(),{registry:r}=pm(),i=Q.useMemo(()=>Kp(new URLSearchParams(n.search)),[n.search]),a=Q.useMemo(()=>Wp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>oxe({viewRef:t,registry:r,contextResourceIdentifiers:i,urlParamValues:a}),[t,r,i,a]);return sxe(o),o?(0,$.jsx)(Wh,{requiredFeatures:o.requiredFeatures,children:(0,$.jsx)(ixe,{viewRef:o.routeViewRef,viewDefinition:o.viewDefinition,contextResourceIdentifiers:o.contextResourceIdentifiers,urlParamValues:o.urlParamValues,runtimeDescriptor:o.runtimeDescriptor,...e})}):(0,$.jsx)(c_,{viewKind:`chart`,viewRef:t})},LQ=({pageRef:e,PageComponent:t})=>(Nbe(e),(0,$.jsx)(t,{})),RQ=()=>(0,$.jsx)(ZU,{});function hxe({documentRef:e}){let[t]=ch(),n=kee(t);return(0,$.jsx)(ZZ,{documentRef:e,...n?{namedRelease:n}:{}})}var gxe=()=>{let{registry:e}=pm();bi.isDevelopment();let t=[];return Object.values(e.resourceConfigurations).forEach(n=>{(Array.isArray(n.operations)?n.operations:[]).forEach(r=>{if(!Fi(r.operationFrontendConfig))return;let i=za.buildOperationFrontendRoutePaths(n,r,e.allResourceFieldIdentifiers),a=Ls(r),o;switch(a){case`create`:o=fG;break;case`list`:o=uX;break;case`read`:o=LY;break;case`update`:o=HY;break;case`search`:o=BY;break;default:o=eG}i.forEach((e,i)=>{let a=(0,$.jsx)(Wh,{operation:r,children:(0,$.jsx)(dxe,{resourceType:n.resourceIdentifier,operation:r,PageComponent:o,routePathParameters:e.parameters})}),s=`${n.resourceIdentifier}-${String(r.operationIdentifier)}-${i}`;t.push((0,$.jsx)(Ch,{path:e.url,element:a,errorElement:(0,$.jsx)(Gy,{})},s))})})}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jbe,{}),(0,$.jsxs)(Ese,{children:[(0,$.jsx)(Ch,{path:Pa.authCallback,element:(0,$.jsx)(cye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.reAuthenticationCallback,element:(0,$.jsx)(lye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.magicLinkVerify,element:(0,$.jsx)(uye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.mfaChallenge,element:(0,$.jsx)(qye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.enrollmentRequired,element:(0,$.jsx)(Jye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.organizationOnboarding,element:(0,$.jsx)(Zye,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.oneOffSession,element:(0,$.jsx)(TZ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.fileUploadGrant,element:(0,$.jsx)(AZ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.authExchange,element:(0,$.jsx)(gbe,{}),errorElement:(0,$.jsx)(Gy,{})}),Object.entries(_ae).map(([e,t])=>(0,$.jsx)(Ch,{path:t,element:(0,$.jsx)(hxe,{documentRef:e}),errorElement:(0,$.jsx)(Gy,{})},e)),(0,$.jsx)(Ch,{path:Tae,element:(0,$.jsx)(QZ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.login,element:(0,$.jsx)(rbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.register,element:(0,$.jsx)(Abe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.passwordLost,element:(0,$.jsx)(ybe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.oauthConsent,element:(0,$.jsx)(xbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.chatIdentityLink,element:(0,$.jsx)(Sbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.oauthLoggedOut,element:(0,$.jsx)(Cbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.oauthLogoutConfirm,element:(0,$.jsx)(wbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.invitation,element:(0,$.jsx)(fbe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.confirmEmail,element:(0,$.jsx)(abe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsxs)(Ch,{element:(0,$.jsx)(UH,{}),errorElement:(0,$.jsx)(Gy,{}),children:[(0,$.jsx)(Ch,{path:Pa.home,element:(0,$.jsx)(LQ,{pageRef:Ul.HOME,PageComponent:ZU}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.decisions,element:(0,$.jsx)(LQ,{pageRef:Ul.DECISIONS,PageComponent:XW}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.settings,element:(0,$.jsx)(RQ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.settingsSection,element:(0,$.jsx)(RQ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:Pa.settingsSectionSubTab,element:(0,$.jsx)(RQ,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:`/composite/:viewRef`,element:(0,$.jsx)(fxe,{}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:`/custom/:viewRef`,element:(0,$.jsx)(IQ,{ViewComponent:iQ,contentType:va.FULL_CUSTOM_VIEW}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:`/flows-actors/:viewRef`,element:(0,$.jsx)(IQ,{ViewComponent:PQ,contentType:va.FLOWS_ACTORS_VIEW}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{path:`/execution/:viewRef`,element:(0,$.jsx)(pxe,{viewProps:{navigationZone:Vn.PRIMARY}}),errorElement:(0,$.jsx)(Gy,{})}),(0,$.jsx)(Ch,{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)(mxe,{})}),errorElement:(0,$.jsx)(Gy,{})}),t]}),(0,$.jsx)(Ch,{path:`*`,element:(0,$.jsx)(Gy,{})})]})]})},zQ=Aae.EN,BQ={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 _xe(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function VQ(e){let t=e.trim().toLowerCase();if(t)return Object.keys(BQ).find(e=>e.toLowerCase()===t)}function HQ(e){let t=BQ[e]??BQ[zQ],n=Hee[e]?.direction??Ed.LTR;return{...t,languageTag:e,direction:n}}function vxe(e){for(let t of e){if(typeof t!=`string`)continue;let e=VQ(t);if(e)return HQ(e);let n=VQ(_xe(t));if(n)return HQ(n)}return HQ(zQ)}function yxe({onRetry:e}){let t=(0,Q.useMemo)(()=>vxe(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 bxe(e){let t=[...Sxe(e.appConfig),...wxe(e.resourcesRegistry)],n=uie({definitions:e.featureConfiguration.definitions,usages:t}),r=[...xxe(e.featureConfiguration,e.isComponentRegistered),...n.unknownIssues.map(e=>`${e.surface}: unknown feature reference(s): ${Exe(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 xxe(e,t){let n=[];for(let r of e.definitions??[]){let e=r.unavailability;if(!e||!(e.behavior===Qs.CUSTOM||Object.values(e.byRole??{}).includes(Qs.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 Sxe(e){return[...UQ(e.compositeViews,e=>`frontend composite view '${e.ref}'`),...UQ(e.fullCustomViews,e=>`frontend full custom view '${e.ref}'`),...UQ(e.flowsActorsViews,e=>`frontend flows/actors view '${e.ref}'`),...UQ(e.onboardingViews,e=>`frontend onboarding view '${e.ref}'`),...Cxe(e)]}function Cxe(e){return(e.guidanceFlows??[]).flatMap(e=>{let t=dc(e.audience?.requiredFeatures);return t.length===0?[]:[{surface:`frontend guidance flow '${e.ref}' audience`,references:t}]})}function UQ(e,t){return e?e.flatMap((e,n)=>{let r=dc(e.requiredFeatures);return r.length===0?[]:[{surface:t(e,n),references:r}]}):[]}function wxe(e){return Object.entries(e.resourceConfigurations).flatMap(([e,t])=>Txe(e,t))}function Txe(e,t){let n=t.frontendConfiguration;return[...(n?.compositeViews??[]).flatMap(t=>{let n=dc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' composite view '${t.ref}'`,references:n}]}),...(n?.chartViews??[]).flatMap(t=>{let n=dc(t.chartDefinition.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' chart '${t.ref}'`,references:n}]}),...(n?.executionViews??[]).flatMap(t=>{let n=dc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' execution view '${t.ref}'`,references:n}]}),...(n?.guidance??[]).flatMap(t=>{let n=dc(t.audience?.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' guidance flow '${t.ref}' audience`,references:n}]})]}function Exe(e){return e.map(e=>`'${e.featureId}' via ${e.slotLabel}`).join(`, `)}var WQ;(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`})(WQ||={});function Dxe(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 Oxe(e){let t=t=>{e.onDiagnostic?.(t)},n=[];for(let r of e.modules){if(!r.providerCapabilities.includes(Ld.FRONTEND_ERROR_MONITORING))continue;let i=r.metadata.ref,a=e.activations.get(i);a===void 0?t({kind:WQ.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.`}):qse(a.handle)?n.push({providerRef:i,sink:a.handle}):t({kind:WQ.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??Ii.on.bind(Ii))(xc.ERROR_OCCURED,e=>{if(n.length===0)return;let r=Dxe(e.error);for(let{providerRef:e,sink:i}of n)try{i.reportCrash(r)}catch(n){t({kind:WQ.REPORT_FAILED,providerRef:e,message:`Provider "${e}" threw while reporting a crash; the crash itself is unaffected.`,cause:n})}})}function GQ(e){return typeof e==`object`&&!!e}function kxe(e){if(!GQ(e)||!(`cause`in e))return;let t=e.cause;if(t instanceof Error)return t.message;if(typeof t==`string`)return t}function Axe(e,t){let n=e instanceof Error?e:Error(String(e)),r=GQ(n)&&GQ(n.wildoError)?n.wildoError:void 0;return n.initializationDiagnostics={...t,errorName:n.name,errorMessage:n.message,stack:n.stack,causeMessage:kxe(n),wildoError:r?{type:r.type,customMessageReference:r.customMessageReference,context:GQ(r.context)?r.context:void 0}:void 0},n}var KQ=class{services=null;isInitialized=!1;initializationPromise=null;logger=null;logDebug=null;reportNavigationLayoutDiagnostics(e){if(!e)return;let t;try{t=Eie(e)}catch(e){this.logger.warn(`Navigation layout diagnostics could not run`,{error:Vc(e)});return}if(t.length!==0)for(let e of t){let t={path:e.path,code:e.code,remedy:e.remedy};e.severity===iie.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:Vc(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=il.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 ba({baseURL:t.apiBaseUrl});l=`manual backend client setup`,this.logDebug(`Fetching application configuration from backend...`);let i=new Wr({baseURL:t.apiBaseUrl});try{l=`environment configuration loading`,u=bi.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=jne.parse(await i.getApplicationConfig(u.frontendServiceName));f=Lb({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=Xre.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}es(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=My(p,e.frontendConfigOverrides),this.logDebug(`Applied frontend config overrides`,{sections:Object.keys(e.frontendConfigOverrides)})),p=wm.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 NS(n);await m.initializeResources(a,o,s,e.excludedResourceTypes,e.resourceUIBehavior,e.notificationBadgeDefinitions);let h=m.getResourcesRegistry();if(l=`component preset registration`,await c(),bi.isDevelopment()&&(l=`development launcher verification`,Lv(Iv(h,p,e=>Xo.hasComponentType(e),{organizationRoles:d.organizationRoles})),Gv(Wv(Dv(p?.settingsHub),Ov(p?.settingsHub),Ev(p?.settingsHub))),e.featureConfiguration)){let t=bxe({resourcesRegistry:h,appConfig:p,featureConfiguration:e.featureConfiguration,isComponentRegistered:e=>Xo.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??Lb(),_=await Ob({surface:nc.SAAS_APP,modules:g.listAll().filter(e=>vb(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`,Oxe({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=mle(g.listAll(),{contributedLoaders:Wb(),onDiagnostic:v}),b=fle({registrations:y,onDiagnostic:v});l=`frontend provider script loading`;let x=hle(g.listAll(),y);x.length>0&&jb(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=Axe(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})}}}},qQ=typeof globalThis<`u`?globalThis:window;qQ.__START_APPLICATION_FRONTEND_SERVICE__||=new KQ;var JQ=qQ.__START_APPLICATION_FRONTEND_SERVICE__,jxe=q(U.LOW_LEVEL_CELEBRATION_OVERLAY,`CelebrationOverlay`),YQ=({preset:e=G.DEFAULT})=>{let{celebration:t,dismissCelebration:n}=Im(),{tComponent:r,isReady:i}=J({component:U.LOW_LEVEL_CELEBRATION_OVERLAY}),a=r(U.LOW_LEVEL_CELEBRATION_OVERLAY,`dismiss`),o=r(U.LOW_LEVEL_CELEBRATION_OVERLAY,`ariaLabel`),s=jxe(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})};YQ.displayName=`AppCelebrationOverlay`;function XQ({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_TOAST,`Toaster`)(e);return(0,$.jsx)(n,{...t})}var ZQ=({children:e})=>{let{registry:t}=pm(),{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Ig(),a=(0,Q.useMemo)(()=>QQ({registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}),[t,n,r,i]);return(0,$.jsx)(_f,{customRegistry:a,children:e})};function QQ(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=$Q(t);r&&a.set(e,r);let i=n.frontendConfiguration?.compositeViews??[];for(let e of i){let t=$Q(e.icon);t&&s.set(e.ref,t)}let l=n.frontendConfiguration?.executionViews??[];for(let e of l){let t=$Q(e.icon);t&&c.set(`view-execution-${e.ref}`,t)}let u=n.frontendConfiguration?.chartViews??[];for(let e of u){let t=$Q(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=$Q(n);if(!r)continue;let i=`${e}:${String(t.operationIdentifier)}`;o.set(i,r)}}for(let e of n??[]){let t=$Q(e.icon);t&&s.set(e.ref,t)}for(let e of r??[]){let t=$Q(e.icon);t&&c.set(`view-custom-${e.ref}`,t)}for(let e of i??[]){let t=$Q(e.icon);t&&c.set(`view-flows-${e.ref}`,t)}return{resources:a,operationResources:o,compositeView:s,custom:c}}function $Q(e){if(e)return typeof e==`string`?bf.standard.get(e):{icon:e}}var Mxe=2e3,e$=new Map;function t$(e,t){let n=Mu(t.badgeReference);n&&e$.set(n,t.badgeCount),e(xc.BADGE_COUNT_CHANGED,t)}function n$(){e$.clear()}function r$(){let e=Qp(),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)&&n$()},[t,n]),null}var i$=()=>{let{on:e}=qo(),[t,n]=(0,Q.useState)(()=>Object.fromEntries(e$)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(Object.fromEntries(e$));return(0,Q.useEffect)(()=>e(xc.BADGE_COUNT_CHANGED,e=>{let t=Mu(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}))},Mxe))}),[e]),{getBadgeState:(0,Q.useCallback)(e=>{let n=we(e),i=t[n]??0,a=!1;switch(e.display.pulse){case ed.WHILE_ACTIVE:a=i>0;break;case ed.ON_INCREASE:a=!!r[n];break;case ed.NONE:default:a=!1}return{count:i,pulse:a}},[t,r])}},a$=()=>{let{on:e,isConnected:t}=dp(),n=qo(),{getResourcesRegistry:r}=pm(),i=(0,Q.useMemo)(()=>r(),[r]),a=(0,Q.useMemo)(()=>new HJ(i),[i]);return(0,Q.useEffect)(()=>{if(!t)return;let r=e=>{switch(e){case Ti.CREATED:return uo.SUCCESS;case Ti.UPDATED:return uo.INFO;case Ti.DELETED:return uo.WARNING;default:return uo.INFO}},o=e=>{let t=i.resourceConfigurations[e.resourceType]?.operations??[];if(e.operationPathKey){let n=t.find(t=>{try{return wi.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)=>qv(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=Jv({resourceType:e,registry:i,scopes:d?{contextResourceIdentifiers:u,previousContextResourceIdentifiers:d}:{contextResourceIdentifiers:u}}),p=f.length>0?f:[null],m=En.buildParentResourcesRequirements(e,u,i);for(let t of p)n.emit(xc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(t?.operationIdentifier??K.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:u,parentResourcesRequirements:m,operation:t??{operationIdentifier:K.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=Za(l?.operations??[],K.READ,{requireAddressable:!0}),_=new Set;for(let t of h){let r={...u,[e]:t},a=V.buildContextualParameters(r,i),o=En.buildParentResourcesRequirements(e,r,i),s=g.filter(e=>!l||Uh({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:K.READ},s=[t,String(a.operationIdentifier),a.variantType??``,a.variantKey??``,a.isBulkOperation??!1].join(`:`);_.has(s)||(_.add(s),n.emit(xc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(a.operationIdentifier??K.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(Bn.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!==uo.ERROR&&c({resourceType:e.resourceType,resourceIds:e.affectedIds,contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.affectedIds.length>0&&!(e.isBulkOperation??!1)}),a){case uo.SUCCESS:n.emit(xc.NOTIFY_RESOURCE_SUCCESS,i);break;case uo.WARNING:n.emit(xc.NOTIFY_RESOURCE_WARNING,i);break;case uo.ERROR:n.emit(xc.NOTIFY_RESOURCE_ERROR,i);break;case uo.INFO:default:n.emit(xc.NOTIFY_RESOURCE_INFO,i)}}),u=e(Bn.RESOURCE_UPDATED,e=>{c({resourceType:e.resourceType,resourceIds:e.deliveryTarget===ou.SCOPE_ROOM_NOTIFICATION?e.affectedIds??[]:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.deliveryTarget===ou.SCOPE_ROOM_NOTIFICATION?(e.affectedIds?.length??0)>0:!!e.resourceId})}),d=e(Bn.RESOURCE_DELETED,e=>{c({resourceType:e.resourceType,resourceIds:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:!!e.resourceId,relaysRowDeletion:!0})}),f=e(Bn.BADGE_UPDATE,e=>{let t={badgeReference:e.badgeReference,badgeCount:e.badgeCount};t$(n.emit,t)}),p=e(Bn.BULK_JOB_PROGRESS,e=>{n.emit(xc.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(Bn.RESOURCE_EDITING_START,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(xc.RESOURCE_EDITING_START,t)}}),h=e(Bn.RESOURCE_EDITING_END,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(xc.RESOURCE_EDITING_END,t)}}),g=e(Bn.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(xc.RESOURCE_CUSTOM_EVENT,r)}),_=e(Bn.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 uo.INFO:n.emit(xc.NOTIFY_CUSTOM_INFO,t);break;case uo.SUCCESS:n.emit(xc.NOTIFY_CUSTOM_SUCCESS,t);break;case uo.WARNING:n.emit(xc.NOTIFY_CUSTOM_WARNING,t);break;case uo.ERROR:n.emit(xc.NOTIFY_CUSTOM_ERROR,t);break;default:n.emit(xc.NOTIFY_CUSTOM_INFO,t)}}),v=e(Bn.ANALYTICS_MOMENT_ACHIEVED,e=>{let t={momentIdentifier:e.momentIdentifier,role:e.role,scope:e.scope,triggerSource:la.BACKEND};n.emit(xc.ANALYTICS_MOMENT_ACHIEVED,t)}),y=e(Bn.GUIDANCE_STATE_CHANGED,e=>{let t={flowRef:e.flowRef,triggerSource:e.triggerSource,scope:e.scope,renderMode:e.renderMode};switch(e.status){case Cr.IN_PROGRESS:n.emit(xc.GUIDANCE_FLOW_ACTIVATED,t);break;case Cr.COMPLETED:n.emit(xc.GUIDANCE_FLOW_COMPLETED,t);break;case Cr.DISMISSED:n.emit(xc.GUIDANCE_FLOW_DISMISSED,t)}}),b=e(Bn.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(xc.MILESTONE_ACHIEVED,t)}),x=e(Bn.PROGRESSION_UPDATED,e=>{let t={scope:e.scope,operationCounts:e.operationCounts,totalPoints:e.totalPoints,updatedAt:e.updatedAt};n.emit(xc.PROGRESSION_UPDATED,t)}),S=e(Bn.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(xc.LIFECYCLE_STAGE_CHANGED,t)});return()=>{l(),u(),d(),f(),p(),m(),h(),g(),_(),v(),y(),b(),x(),S()}},[t,e,n,i,a]),null},o$=`wildo:connectivity-status`,Nxe=3e3,Pxe={connectionReconnectingNotice:`Connection lost — reconnecting…`,connectionLostNotice:`Connection lost. Please check your network and reload the page.`},s$=e=>e===em.RECONNECTING||e===em.ERROR,c$=()=>{let{status:e}=dp(),{showPersistentToast:t,dismissPersistentToast:n}=Im(),{tComponent:r,isReady:i}=J({component:U.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)(()=>{s$(c.current)||s.current(o$)},[]),(0,Q.useEffect)(()=>{let t=()=>{l.current&&=(clearTimeout(l.current),null)},n=()=>{let e=c.current===em.ERROR,t=e?`connectionLostNotice`:`connectionReconnectingNotice`,n=a.current(U.APPLICATION_LEVEL_STATUS_BAR,t),r=n.startsWith(`components.`)?Pxe[t]:n;o.current(o$,e?`error`:`loading`,r),u.current=!0};s$(e)?i&&(u.current?n():l.current||=setTimeout(()=>{l.current=null,n()},Nxe)):(t(),u.current&&=(s.current(o$),!1))},[e,i]),(0,Q.useEffect)(()=>()=>{l.current&&=(clearTimeout(l.current),null),u.current&&=(s.current(o$),!1)},[]),null},l$=class{name=_s.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`)}},Fxe=50,Ixe=1e4,Lxe=20,u$=class{name=_s.BACKEND_PROXY;buffer=[];flushInterval=null;httpClient;identity=null;generation=0;constructor(e){this.httpClient=e}async initialize(e){let t=e?.flushIntervalMs??Ixe;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>=Lxe&&this.flush()}page(e,t){this.track({name:_a.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 Moe(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,Fxe)}}},Rxe={[_s.CONSOLE]:()=>new l$,[_s.BACKEND_PROXY]:e=>new u$(e)},d$=class{resolveFromConfig(e,t){return e.map(e=>Rxe[e.providerType](t,e.config))}},zxe={current:null};function f$(){return(0,Q.useContext)(p$)||{track:()=>{},page:()=>{},isActive:!1,sessionStartTimestamp:Date.now(),achievedMoments:new Set,markMomentAchieved:()=>!1,_onTrackRef:zxe}}var Bxe=({config:e,valueMoments:t,identity:n,progress:r})=>{let{track:i,page:a,isActive:o,sessionStartTimestamp:s,achievedMoments:c,markMomentAchieved:l,_onTrackRef:u}=f$(),{on:d,emit:f}=qo(),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===In.ORGANIZATION?n.organizationId:n.userId,e]),[n.applicationId,n.userId,n.organizationId]),C=(0,Q.useCallback)(e=>{if((e.scope===In.ORGANIZATION?!n.organizationId:!n.userId)||e.role!==Dl.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===Dl.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!==Xn.ANY&&i.size!==e.signals.length)return;e.role!==Dl.ANTI_PATTERN&&h.current.add(r);let a=()=>{if(!p.current)return;let r=e.role===Dl.ANTI_PATTERN?Dl.ANTI_PATTERN:Mte;y.current(`${r}.${n}`,{signalIndex:e.mode===Xn.ANY?t:void 0,signalType:e.mode===Xn.ANY?e.signals[t].signalType:zt,elapsedMs:Date.now()-s,role:e.role,scope:e.scope}),e.onAchieved?.frontendEvent&&f(xc.ANALYTICS_MOMENT_ACHIEVED,{momentIdentifier:n,role:e.role,scope:e.scope??In.USER,triggerSource:la.FRONTEND})};e.role===Dl.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,[]);(0,Q.useEffect)(()=>{if(!o)return;let e=Tc();for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==qa.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${yn}/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=Tc(),t=()=>{if(document.visibilityState===`visible`)for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==qa.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${yn}/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]);let E=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(o)return d(xc.NAVIGATION_ZONE_CHANGED,t=>{let n=window.location.pathname;if(e?.pageViews&&n!==E.current&&(E.current=n,a(n,{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===qa.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(xc.NOTIFY_RESOURCE_SUCCESS,t=>{e?.resourceOperations&&i(_a.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===qa.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=Tc();for(let e of x)for(let n of e.signals){if(n.signalType!==qa.RESOURCE_STATE||t.resourceType!==n.resourceType)continue;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;r.get(`${yn}/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(xc.ERROR_OCCURED,e=>{i(_a.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(xc.USER_STATUS_CHANGED,e=>i(_a.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(xc.NOTIFY_CUSTOM_INFO,e=>i(_a.NOTIFICATION,{level:Wl.INFO,identifier:e.identifier})),d(xc.NOTIFY_CUSTOM_SUCCESS,e=>i(_a.NOTIFICATION,{level:Wl.SUCCESS,identifier:e.identifier})),d(xc.NOTIFY_CUSTOM_WARNING,e=>i(_a.NOTIFICATION,{level:Wl.WARNING,identifier:e.identifier})),d(xc.NOTIFY_CUSTOM_ERROR,e=>i(_a.NOTIFICATION,{level:Wl.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(xc.HOTKEY_COMMAND_MENU_OPEN,()=>i(_a.HOTKEY_USED,{key:en.COMMAND_MENU})),d(xc.HOTKEY_SIDEBAR_TOGGLE,()=>i(_a.HOTKEY_USED,{key:en.SIDEBAR_TOGGLE})),d(xc.HOTKEY_NOTIFICATIONS_OPEN,()=>i(_a.HOTKEY_USED,{key:en.NOTIFICATIONS})),d(xc.HOTKEY_QUICK_SWITCHER_OPEN,()=>i(_a.HOTKEY_USED,{key:en.QUICK_SWITCHER})),d(xc.HOTKEY_SHORTCUTS_HELP,()=>i(_a.HOTKEY_USED,{key:en.SHORTCUTS_HELP}))];return()=>t.forEach(e=>e())},[o,e?.hotkeys,d,i]),(0,Q.useEffect)(()=>{if(!o)return;let e=[d(xc.MILESTONE_ACHIEVED,e=>{i(`milestone_achieved`,{milestoneRef:e.milestoneRef,category:e.category,points:e.points,scope:e.scope})}),d(xc.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===qa.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===qa.FEATURE_ACCESS&&e===_a.FEATURE_ACCESSED&&r.featureId===t?.featureId&&w(n,i)})},()=>{u.current=null}},[o,x,w,C,S,u]),null},p$=(0,Q.createContext)(null),m$=(0,Q.createContext)(null),Vxe=new d$,Hxe=`signed_in_at`,Uxe=1e4,h$=({children:e})=>{let t=(0,Q.useContext)(ea),{on:n}=qo(),r=Tm(gu.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]),f=(0,Q.useRef)(null),p=(0,Q.useCallback)(e=>{let t=f.current;t!==null&&(f.current=null,clearTimeout(t.timer),e&&t.held.forEach(e=>e()))},[]),m=(0,Q.useRef)(null),h=(0,Q.useCallback)(e=>{let t=f.current;t&&clearTimeout(t.timer),f.current={held:t?.held??[],timer:setTimeout(()=>p(!1),Uxe),readId:e??m.current}},[p]);(0,Q.useEffect)(()=>n(xc.OWN_PREFERENCES_REREAD_STARTED,({readId:e})=>{m.current=e,queueMicrotask(()=>{m.current===e&&(m.current=null)}),h(e)}),[n,h]),(0,Q.useEffect)(()=>n(xc.OWN_PREFERENCES_REREAD_SETTLED,({readId:e,privacy:t})=>{f.current?.readId===e&&p(t!==null&&jd(Bd(t.consentedPurposes),[Hd.ANALYTICS]))}),[n,p]),(0,Q.useEffect)(()=>()=>p(!1),[p]),(0,Q.useEffect)(()=>n(xc.USER_PREFERENCES_CHANGED,e=>{let t=()=>{E.current&&i.current.forEach(e=>e.discard())};if(e.privacy===null){p(!1),t(),u([]);return}let n=e.privacy?.consentedPurposes;if(n!==void 0){let e=Bd(n);jd(e,[Hd.ANALYTICS])||(p(!1),t()),u(e)}}),[n,p]);let g=(0,Q.useRef)(null),[_,v]=(0,Q.useState)(0),y=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!c?.enabled){o(!1);return}if(!(c.requiresConsent===!1||jd(d,[Hd.ANALYTICS]))){i.current.forEach(e=>e.reset()),o(!1);return}let e=!1,t=Tc(),n=[...Vxe.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=g.current;t!==null&&n.forEach(e=>e.identify({userId:t})),o(!0),v(e=>e+1)}),()=>{e=!0,n.forEach(e=>e.shutdown().catch(()=>{})),i.current=[]}},[c,d]);let b=bx(),x=(0,Q.useMemo)(()=>c?.enabled?b.filter(e=>e.providerCapabilities.includes(Ld.FRONTEND_PRODUCT_ANALYTICS)).map(e=>e.activation.handle).filter(Jse):[],[c?.enabled,b]),S=a||x.length>0,C=c?.autoInstrumentation?.userLifecycle===!0,w=(0,Q.useRef)(C);w.current=C;let T=c?.requiresConsent!==!1,E=(0,Q.useRef)(T);E.current=T;let D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(0),A=(0,Q.useCallback)(e=>{D.current=e,k(e=>e+1)},[]);(0,Q.useEffect)(()=>n(xc.USER_LOGIN,e=>{g.current=e.userId,i.current.forEach(t=>t.identify({userId:e.userId})),e.establishment===Rr.SIGNED_IN&&A({occurredAt:Date.now(),decided:!E.current,owedToBuiltIns:!0,owedToVendorSinks:!0})}),[n,A]),(0,Q.useEffect)(()=>n(xc.USER_PREFERENCES_CHANGED,e=>{let t=D.current;if(t===null||!E.current||!e.privacy)return;let n=e.privacy.consentedPurposes;n!==void 0&&A(jd(Bd(n),[Hd.ANALYTICS])?{...t,decided:!0}:null)}),[n,A]),(0,Q.useEffect)(()=>n(xc.USER_LOGOUT,e=>{e.reason===Er.SIGNED_OUT&&w.current&&y.current(_a.USER_LOGOUT),A(null),g.current=null,i.current.forEach(e=>e.reset())}),[n,A]);let[j,M]=(0,Q.useState)(null),N=(0,Q.useRef)(null),P=(0,Q.useCallback)(e=>{let t=Symbol();return N.current=t,M(e),()=>{N.current===t&&(N.current=null,M(null))}},[]),F=JSON.stringify(j),I=j?.userId??null;(0,Q.useEffect)(()=>{x.length!==0&&(I===null?x.forEach(e=>e.reset()):x.forEach(e=>e.identify({userId:I})))},[x,I]);let L=(0,Q.useRef)(F);L.current=F;let ee=(0,Q.useRef)({signals:new Map,counts:new Map,lastFired:new Map,completed:new Set}),R=j?.userId?`${se}${JSON.stringify([j.applicationId,In.USER,j.userId])}`:null,z=j?.organizationId?`${se}${JSON.stringify([j.applicationId,In.ORGANIZATION,j.organizationId])}`:null,te=JSON.stringify([R,z]),ne=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.scope===In.ORGANIZATION,[c?.valueMoments]),re=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.role!==Dl.ANTI_PATTERN,[c?.valueMoments]),[ie,ae]=(0,Q.useState)({key:F,moments:new Set}),oe=(0,Q.useMemo)(()=>ie.key===F?ie.moments:new Set,[ie,F]),ce=(0,Q.useCallback)(e=>{ae(t=>({key:F,moments:typeof e==`function`?e(t.key===F?t.moments:new Set):e}))},[F]),le=(0,Q.useCallback)(e=>{try{R&&localStorage.setItem(R,JSON.stringify([...e].filter(e=>!ne(e)))),z&&localStorage.setItem(z,JSON.stringify([...e].filter(ne)))}catch{}},[R,z,ne]);(0,Q.useEffect)(()=>{if(ce(new Set),c?.enabled&&j&&(j.userId||j.organizationId)){try{let e=new Set;for(let[t,n]of[[R,!1],[z,!0]]){if(!t)continue;let r=localStorage.getItem(t);if(r)for(let t of JSON.parse(r))re(t)&&ne(t)===n&&e.add(t)}ce(e)}catch{}if(c?.persistence?.backendSync&&r){let e=!1;return Tc().getAnalyticsMomentsAchieved().then(t=>{if(e||L.current!==F)return;let n=t;n.moments&&ce(e=>{let t=new Set([...e,...n.moments].filter(re));return le(t),t})}).catch(()=>{}),()=>{e=!0}}}},[c?.enabled,c?.persistence?.backendSync,r,te,F,le,re,ne]),(0,Q.useEffect)(()=>n(xc.ANALYTICS_MOMENT_ACHIEVED,e=>{j&&e.triggerSource!==la.FRONTEND&&e.role!==Dl.ANTI_PATTERN&&re(e.momentIdentifier)&&ce(t=>{let n=new Set(t);return n.add(e.momentIdentifier),le(n),n})}),[n,le,F,re]);let ue=(0,Q.useCallback)(e=>{if(!j||!re(e))return!1;let t=c?.valueMoments?.find(t=>t.identifier===e);if(t?.requires?.some(e=>!oe.has(e))||t?.beforeStage?.some(e=>oe.has(e)))return!1;let n=()=>L.current===F&&(ce(t=>{let n=new Set(t);return n.add(e),le(n),n}),!0);return c?.persistence?.backendSync?Tc().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,le,F,re,oe]),de=(0,Q.useRef)(null),fe=(0,Q.useCallback)((e,t)=>{if(!S)return;let n={name:e,properties:t,timestamp:Date.now()};a&&i.current.forEach(e=>e.track(n)),e===_a.RESOURCE_OPERATION&&t?.resourceType===gu.USER_SELF_PREFERENCES&&h();let r=()=>x.forEach(n=>n.track({name:e,properties:t}));f.current?f.current.held.push(r):r(),de.current?.(e,t)},[a,S,x,h]);y.current=fe,(0,Q.useEffect)(()=>{let e=D.current;if(e===null||!e.decided||!C)return;let t={name:_a.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&&x.length>0&&(x.forEach(n=>n.track({name:t.name,properties:{[Hxe]:new Date(e.occurredAt).toISOString()}})),r=!1),(n!==e.owedToBuiltIns||r!==e.owedToVendorSinks)&&(D.current=n||r?{...e,owedToBuiltIns:n,owedToVendorSinks:r}:null)},[O,_,a,x,C]);let pe=(0,Q.useCallback)((e,t)=>{if(!S)return;a&&i.current.forEach(n=>n.page(e,t));let n=()=>x.forEach(n=>n.page(e,t));f.current?f.current.held.push(n):n()},[a,S,x]),me=(0,Q.useMemo)(()=>({track:fe,page:pe,isActive:S,sessionStartTimestamp:s,achievedMoments:oe,markMomentAchieved:ue,_onTrackRef:de}),[fe,pe,S,s,oe,ue]);return(0,$.jsx)(m$.Provider,{value:P,children:(0,$.jsxs)(p$.Provider,{value:me,children:[S&&j&&c&&(0,$.jsx)(Bxe,{identity:j,progress:ee.current,config:c.autoInstrumentation,valueMoments:c.valueMoments},`${F}:${JSON.stringify(c.valueMoments)}`),e]})})};function Wxe(){let e=xm(),t=(0,Q.useContext)(m$);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 g$=il.getLogger(),_$=g$.debugByType(`ResourceReadCacheBridge`);g$.setDebugTypeLogging(`ResourceReadCacheBridge`,!1);var v$=`read-cache`,y$=`VITE_RESOURCE_READ_CACHE`,Gxe=`off`,Kxe=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=dp(),{getReadCache:a}=pm(),o=a();(0,Q.useEffect)(()=>{let e=bi.readOptionalEnvironmentValue(y$)?.toLowerCase()===Gxe;o.setEnabled(!e),e&&g$.info(`Resource read cache disabled by environment`,{flag:y$})},[o]);let s=Qp(),c=s?.currentOrganizationId??null,l=(0,Q.useContext)(ea)?.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:`${v$}:${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),_$(`scope room confirmed`,{roomName:e})):(d.current.delete(e),_$(`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:`${v$}:${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(lc(e,t.scopeKey,t.scopeId))),requestCoverage:(e,t)=>{for(let n of t){let t=lc(e,n.scopeKey,n.scopeId);d.current.has(t)||(p.current?h.current(t,{...n,resourceType:e}):(f.current.set(t,{...n,resourceType:e}),_$(`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(),_$(`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(),_$(`reconnected; coverage and cache reset`,{connectionCount:n}))},[n,o]),(0,Q.useEffect)(()=>{o.clear(),g(),_$(`organization scope changed; cache cleared`,{currentOrganizationId:c})},[c,o,g]),(0,Q.useEffect)(()=>{if(!t)return;let n=e(Bn.RESOURCE_UPDATED,e=>{o.invalidateResourceType(e.resourceType),_$(`invalidated by resource update`,{resourceType:e.resourceType,deliveryTarget:e.deliveryTarget,isScopeRoom:e.deliveryTarget===ou.SCOPE_ROOM_NOTIFICATION})}),r=e(Bn.RESOURCE_DELETED,e=>{o.invalidateResourceType(e.resourceType)});return()=>{n(),r()}},[e,t,o]),null},b$;(function(e){e.CTRL=`ctrl`,e.ALT=`alt`,e.SHIFT=`shift`,e.META=`meta`,e.MOD=`mod`})(b$||={});function x$(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var S$=-100,C$={[pa.COMPONENT]:2,[pa.PAGE]:1,[pa.GLOBAL]:0};function w$(e){return e.length===1&&!/[a-z0-9]/i.test(e)}function T$(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(b$.CTRL);break;case`alt`:case`option`:n.push(b$.ALT);break;case`shift`:n.push(b$.SHIFT);break;case`meta`:case`cmd`:case`command`:case`win`:case`windows`:n.push(b$.META);break;case`mod`:n.push(b$.MOD);break;default:r=e}w$(r)&&(n=n.filter(e=>e!==b$.SHIFT));let i=x$(),a=[];return n.includes(b$.MOD)&&a.push(i?`⌘`:`Ctrl`),n.includes(b$.CTRL)&&a.push(i?`⌃`:`Ctrl`),n.includes(b$.ALT)&&a.push(i?`⌥`:`Alt`),n.includes(b$.SHIFT)&&a.push(i?`⇧`:`Shift`),n.includes(b$.META)&&a.push(i?`⌘`:`Win`),a.push(r.toUpperCase()),{modifiers:n,key:r,chord:[...[...n].sort(),r].join(`+`),display:a.join(i?``:`+`)}}function E$(e,t){let n=e.ctrlKey,r=e.altKey,i=e.shiftKey,a=e.metaKey,o=t.modifiers.includes(b$.MOD),s=x$(),c=t.modifiers.includes(b$.CTRL)||o&&!s,l=t.modifiers.includes(b$.ALT),u=t.modifiers.includes(b$.SHIFT),d=t.modifiers.includes(b$.META)||o&&s;return n!==c||r!==l||!w$(t.key)&&i!==u||a!==d?!1:e.key.toLowerCase()===t.key}var D$=(0,Q.createContext)(null);function O$(e,t){return e===t||e===pa.GLOBAL||t===pa.GLOBAL}var k$=({children:e,initialScope:t=pa.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=T$(e.shortcut),n=Array.from(o.current.values()).filter(n=>n.id!==e.id&&n.parsed.chord===t.chord&&O$(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&&O$(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===pa.PAGE&&n!==pa.PAGE||t.scope===pa.COMPONENT&&n!==pa.COMPONENT||r&&t.scope!==pa.GLOBAL||!E$(e,t.parsed))continue;let i=[t.priority??0,C$[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)(D$.Provider,{value:_,children:e})};function A$(){let e=(0,Q.useContext)(D$);if(!e)throw Error(`useHotkeyRegistry must be used within a HotkeyRegistryProvider`);return e}var j$=0;function qxe(e,t,n={}){let{register:r}=A$(),i=(0,Q.useMemo)(()=>n.id??`hotkey-${++j$}`,[n.id]);return(0,Q.useEffect)(()=>{let a={id:i,shortcut:e,handler:t,description:n.description??e,scope:n.scope??pa.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)(()=>T$(e),[e])}function Jxe(e){let{register:t}=A$();(0,Q.useEffect)(()=>{let n=[];for(let r of e){let e={id:r.id??`hotkey-batch-${++j$}`,shortcut:r.shortcut,handler:r.handler,description:r.description??r.shortcut,scope:r.scope??pa.GLOBAL,enabled:r.enabled!==!1,group:r.group};n.push(t(e))}return()=>{for(let e of n)e()}},[e,t])}function Yxe(){let{pause:e,resume:t,isPaused:n}=A$();return{pause:e,resume:t,isPaused:n}}function Xxe(){let{activeScope:e,setActiveScope:t}=A$();return{activeScope:e,setActiveScope:t}}function M$(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 Zxe(e,t){switch(e){case void 0:return!0;case Sr.USER_SELF:return!!t.currentUserId;case Sr.ORGANIZATIONS:return!!t.currentOrganizationId;case Sr.APPLICATION:return!!t.currentApplicationId;case Sr.ANONYMOUS:return!!t.currentAnonymousUserId}}function Qxe(e,t){return Lm(e,t)}function $xe(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 eSe(e,t){return(e??[]).every(e=>t.includes(e))}function tSe(e,t){return eSe(e.requiredEngineCapabilities,t.enabledEngineCapabilities)&&hS(e.runtimeAvailability,t.runtimeContext)&&Qxe(e.requiredRoles,t.runtimeContext.effectiveRoles)&&$xe(e.requiredFeatures,t.enabledFeatures)}function nSe(e,t){if(e.target.kind!==lv.SUB_TABS)return e;let n=e.target.subTabs.filter(e=>hS(e.runtimeAvailability,t.runtimeContext));return n.length===0?null:n.length===e.target.subTabs.length?e:{...e,target:{...e.target,subTabs:n}}}function rSe(e,t){let n=e.categories.filter(e=>Zxe(e.scope,t.scopeIds)),r=new Set(n.map(e=>e.ref)),i=e.sections.flatMap(e=>{if(!r.has(e.categoryRef)||!tSe(e,t))return[];let n=nSe(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 iSe=[];function N$(){let e=kv(),t=Qp(),n=(0,Q.useContext)(gh)?.resolvedFeatures,r=mS(),i=(0,Q.useContext)(ea),a=i?.appIdentity?.applicationId??t?.currentApplicationId??null,o=i?.appConfig?.enabledEngineCapabilities??iSe;return(0,Q.useMemo)(()=>rSe(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 aSe=Object.values(Oo).map(e=>`${e.i18nKey}.title`);function P$(){let{registry:e}=pm(),{compositeViews:t,fullCustomViews:n,flowsActorsViews:r}=Ig(),i=Qp(),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=>WY(e.translationRef)),r=e?.resourceConfigurations?Object.values(e.resourceConfigurations).flatMap(e=>e.frontendConfiguration?.compositeViews?.map(e=>WY(e.translationRef))??[]):[];return Array.from(new Set([...n,...r]))},[t,e]),s=(0,Q.useMemo)(()=>{let t=[...(n??[]).map(e=>GY({family:Vl.FULL_CUSTOM,translationRef:KY(e.ref)})),...(r??[]).map(e=>GY({family:Vl.FLOWS_ACTORS,translationRef:KY(e.ref)}))],i=e?.resourceConfigurations?Object.entries(e.resourceConfigurations).flatMap(([e,t])=>[...t.frontendConfiguration?.chartViews?.map(t=>GY({family:Vl.CHART,translationRef:qY(e,t.ref)}))??[],...t.frontendConfiguration?.executionViews?.map(t=>GY({family:Vl.EXECUTION,translationRef:qY(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}=J({resource:a,keys:[...o,...s,...aSe,Qm]}),h=oS(),{sections:g}=kv(),_=(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}=N$(),b=(0,Q.useMemo)(()=>ih(g.map(e=>e.ref),y.map(e=>e.ref)),[g,y]),x=(0,Q.useMemo)(()=>(e,t)=>XY({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 oSe={[ge.HOTKEY_SIDEBAR_TOGGLE]:`engine.hotkeys.sidebarToggle`,[ge.HOTKEY_NOTIFICATIONS_OPEN]:`engine.hotkeys.notificationsOpen`,[ge.HOTKEY_QUICK_SWITCHER_OPEN]:`engine.hotkeys.quickSwitcherOpen`,[ge.HOTKEY_SHORTCUTS_HELP]:`engine.hotkeys.shortcutsHelp`},F$=[{event:ge.HOTKEY_SIDEBAR_TOGGLE,shortcut:`Mod+B`,scope:pa.GLOBAL,group:ln.NAVIGATION},{event:ge.HOTKEY_QUICK_SWITCHER_OPEN,shortcut:`Mod+P`,scope:pa.GLOBAL,group:ln.NAVIGATION},{event:ge.HOTKEY_NOTIFICATIONS_OPEN,shortcut:`Mod+I`,scope:pa.GLOBAL,group:ln.NAVIGATION}];function sSe(e){return F$.includes(e)}function cSe(e){switch(e){case ge.HOTKEY_QUICK_SWITCHER_OPEN:return hr.QUICK_SWITCHER;case ge.HOTKEY_NOTIFICATIONS_OPEN:return hr.NOTIFICATION_CENTER;default:return}}function I$(){let{register:e}=A$(),{emit:t}=qo(),n=P$(),{navigate:r}=SS(),{appComponentsConfiguration:i}=Ig(),a=mS(),o=i?.[hr.HOTKEY],s=typeof o==`object`&&o?o.bindings:void 0,c=(0,Q.useMemo)(()=>due(s,a),[s,a]),l=typeof o==`object`&&o?o.emitShortcuts:void 0,u=(0,Q.useMemo)(()=>M$(F$,l),[l]),d=(0,Q.useMemo)(()=>!c||!n?[]:Oh(c,n),[c,n]);return(0,Q.useEffect)(()=>{let i=[],a=e=>{let t=e.descriptionLabellingRef??oSe[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??pa.GLOBAL,group:n.group,handler:()=>{switch(n.event){case ge.HOTKEY_SIDEBAR_TOGGLE:t(xc.HOTKEY_SIDEBAR_TOGGLE,{});break;case ge.HOTKEY_NOTIFICATIONS_OPEN:t(xc.HOTKEY_NOTIFICATIONS_OPEN,{});break;case ge.HOTKEY_QUICK_SWITCHER_OPEN:t(xc.HOTKEY_QUICK_SWITCHER_OPEN,{});break;case ge.HOTKEY_SHORTCUTS_HELP:t(xc.HOTKEY_SHORTCUTS_HELP,{})}},launcher:cSe(n.event),preventDefault:n.preventDefault!==!1,priority:sSe(n)?S$: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??pa.GLOBAL,group:ln.ACTIONS,handler:()=>{Um.dispatchNavigationForResolvedTarget(r,t,hr.HOTKEY)},launcher:hr.HOTKEY,preventDefault:!0}));return()=>{for(let e of i)e()}},[e,t,d,r,u,n]),null}function L$({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_KBD,`Kbd`)(e);return(0,$.jsx)(n,{...t})}L$.displayName=`Kbd`;var R$=[ln.NAVIGATION,ln.ACTIONS,ln.HELP,`other`];function lSe(e,t){switch(e){case ln.NAVIGATION:return t(`navigation`);case ln.ACTIONS:return t(`actions`);case ln.HELP:return t(`help`);default:return t(`other`)}}function z$(e,t){switch(e){case pa.GLOBAL:return t(`shortcutsHelpScopeGlobal`);case pa.PAGE:return t(`shortcutsHelpScopePage`);case pa.COMPONENT:return t(`shortcutsHelpScopeComponent`);default:return t(`shortcutsHelpScopeUnknown`)}}function B$(){let[e,t]=(0,Q.useState)(!1),{on:n}=qo(),{getHotkeys:r,getConflicts:i,activeScope:a,isPaused:o}=A$(),{t:s,tComponent:c,isReady:l}=J({component:U.APPLICATION_LEVEL_COMMAND_MENU});(0,Q.useEffect)(()=>n(xc.HOTKEY_SHORTCUTS_HELP,()=>{t(e=>!e)}),[n]);let u=(e,t)=>bp({tComponent:c,componentType:U.APPLICATION_LEVEL_COMMAND_MENU,key:e,params:t}),d=(0,Q.useMemo)(()=>e?r().slice().sort((e,t)=>{let n=R$.indexOf(e.group??`other`),r=R$.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 R$.map(t=>({group:t,label:lSe(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=jp({t:s,key:`engine.hotkeys.shortcutsHelp`});return(0,$.jsx)(nG,{open:e,onOpenChange:t,children:(0,$.jsxs)(iG,{className:`max-w-3xl pt-10`,children:[(0,$.jsx)(oG,{children:(0,$.jsx)(cG,{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`),`: `,z$(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)(of,{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:z$(e.scope,u)}),e.launcher&&(0,$.jsx)(`span`,{children:e.launcher}),(0,$.jsx)(`span`,{children:e.id})]})]}),(0,$.jsx)(L$,{children:e.parsed.display})]},e.id))})]},e))})})]})]})})}function uSe(e){return typeof e==`string`?e:wi.createOperationPathKey(e)}function dSe(e,t){let n=e.resourceConfigurations[t.resourceIdentifier];return n&&n.operations.find(e=>{let n=wi.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!==E.API_CALL||n.isBulkOperation===!0==(t.isBulkOperation===!0)})||null}function fSe({children:e}){let t=pm(),n=Qp(),r=(0,Q.useCallback)(async(e,r,i)=>{if(!n)return t.doOperation(e,r,i);let a=uSe(e),o=null;try{o=wi.parseOperationPathKey(a)}catch{o=null}let s=o?dSe(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:lse({initiatorInfos:s.initiatorInfos,targetResourceType:s.resourceIdentifier,registry:t.registry,ownContextualParameters:{...Object.fromEntries(Object.entries(c).filter(([e])=>pse.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=>Koe.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)(cm.Provider,{value:a,children:e})}function pSe(){let e=Bh(),{notifyError:t}=Im(),n=lp(),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 mSe(){let{currentOrganizationId:e}=ag(),{isLoading:t,isFeatureEnabled:n,resolvedForOrganizationId:r}=yh(),{doOperation:i,registry:a}=pm(),{emit:o,on:s}=qo(),{httpClient:c}=Eu(),[l,u]=(0,Q.useState)(0),d=e??null,f=d!==null&&!t&&r===d&&n(Ko.CUSTOM_BRANDING);return(0,Q.useEffect)(()=>s(xc.RESOURCE_OPERATION_EXECUTED,()=>u(e=>e+1),e=>e.resourceType===gu.ORGANIZATION_PROFILES&&!er(e.operation??{operationIdentifier:e.operationIdentifier})),[s]),(0,Q.useEffect)(()=>{let e=!1,t=t=>{if(e)return;let n=d===null?void 0:Iu(t?.logo),r=n&&d!==null?`${c.getBaseURL().replace(/\/+$/,``)}${yn}${Kee(d,Xee.LOGO,n.updatedAt)}`:null;o(xc.ORGANIZATION_BRANDING_CHANGED,{organizationId:d,primaryColor:t?.primaryColor??null,secondaryColor:t?.secondaryColor??null,logoUrl:r,productName:t?.productName??null})},n=Zm(a.resourceConfigurations[gu.ORGANIZATION_PROFILES]);return!f||d===null||!n?(t(null),()=>{e=!0}):(i(wi.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(xc.ORGANIZATION_BRANDING_CHANGED,{organizationId:null,primaryColor:null,secondaryColor:null,logoUrl:null,productName:null}),[o]),null}var V$=[{componentType:U.APP_LAYOUTS_MAIN_CONTAINER,preset:G.DEFAULT},{componentType:U.PUBLIC_LAYOUTS_MAIN_CONTAINER,preset:G.DEFAULT}];function hSe({children:e}){let{frontendConfiguration:t,markComponentInitialized:n}=Eu(),{on:r}=qo(),i=(0,Q.useCallback)(e=>r(xc.USER_PREFERENCES_CHANGED,t=>{Object.prototype.hasOwnProperty.call(t,`uiPreferences`)&&e(t.uiPreferences??null)}),[r]),a=(0,Q.useCallback)(e=>r(xc.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(Fe.UI),[n]);return(0,$.jsx)(Rg,{frontendConfiguration:t,subscribeToUserPreferences:i,subscribeToOrganizationBranding:a,markInitialized:o,children:e})}function H$(e){return typeof e==`object`&&!!e}function U$(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 gSe(e){return e.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function W$(e){if(typeof e==`string`&&e.trim().length!==0)return gSe(e.trim())}function _Se(e){if(H$(e)&&H$(e.initializationDiagnostics))return e.initializationDiagnostics}function vSe(e,t){if(t&&H$(t.wildoError))return t.wildoError;if(H$(e)&&H$(e.wildoError))return e.wildoError}function ySe(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 bSe(e,t,n){return t&&typeof t.errorMessage==`string`&&t.errorMessage.trim().length>0?t.errorMessage:n&&H$(n.context)&&typeof n.context.message==`string`?n.context.message:e instanceof Error?e.message:typeof e==`string`?e:U$(e)}function xSe(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 G$(e){let t=[{label:`Application`,value:e.startupAppName}],n=W$(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 SSe(e){return!e||e.length===0?`root`:e.map(e=>typeof e==`string`?e:String(e)).join(` > `)}function CSe(e,t){let n=_Se(e),r=vSe(e,n),i=bSe(e,n,r),a=ySe(i),o=U$(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=>`${SSe(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:G$({diagnostics:n,wildoError:r,startupAppName:t})}}let s=xSe(r&&H$(r.context)?r.context:void 0),c=W$(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:G$({diagnostics:n,wildoError:r,startupAppName:t})}}function K$(e){return window.location.pathname===`/signing/returned`?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(wSe,{...e})}function wSe({options:e}){let t=(0,Q.useMemo)(()=>cne(e.featureConfiguration),[e.featureConfiguration]),n=(0,Q.useMemo)(()=>il.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)({[Fe.MAIN_CONTEXT]:!1,[Fe.UI]:!1,[Fe.LOADER]:!1,[Fe.ERRORS]:!1,[Fe.ROUTER]:!1,[Fe.I18N]:!1,[Fe.APP_MAIN_CONTAINER]:!1,[Fe.PUBLIC_APP_CONTAINER]:!1}),m=(0,Q.useCallback)(e=>e[Fe.MAIN_CONTEXT]&&e[Fe.UI]&&e[Fe.APP_MAIN_CONTAINER]&&e[Fe.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?CSe(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(Fe.MAIN_CONTEXT),h(Fe.LOADER),h(Fe.ERRORS),h(Fe.ROUTER),h(Fe.APP_MAIN_CONTAINER),h(Fe.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{ra.initializeGlobalErrorHandlers(),bi.injectEnvironmentVariables(aH(e.env,window.location));let i=bi.loadEnvironmentConfig(),a={apiBaseUrl:e.apiBaseUrl??i.apiBaseUrl};d(a);let o=await JQ.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(),Xo.assertRequiredRegistrations(`SaaS application`,V$)},onInitialized:()=>{r(`Application initialized successfully`)},onError:e=>{n.error(`Application initialization failed`,{error:e.message,details:e}),s(e)}});Xo.assertRequiredRegistrations(`SaaS application`,V$),l(o),h(Fe.MAIN_CONTEXT),h(Fe.LOADER),h(Fe.ERRORS),h(Fe.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 rm:void 0,[]);if(o&&b)return bi.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)(yxe,{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)(Zy,{size:48})})}let w=(0,$.jsx)(Vy,{children:(0,$.jsx)(Vm,{children:(0,$.jsx)(ab,{children:(0,$.jsx)(sp,{children:(0,$.jsxs)(im,{tokenStorage:C,children:[(0,$.jsx)(Jy,{}),(0,$.jsx)(EH,{children:(0,$.jsxs)(Em,{children:[(0,$.jsx)(Kxe,{}),(0,$.jsx)(r$,{}),(0,$.jsx)(Wxe,{}),(0,$.jsx)(kse,{customRoles:e.customRoles,children:(0,$.jsx)(Rm,{children:(0,$.jsx)(Zx,{children:(0,$.jsxs)(Sh,{productDefinitions:e.productDefinitions,children:[(0,$.jsx)(pSe,{}),(0,$.jsxs)(tg,{featureConfiguration:t,children:[(0,$.jsx)(mSe,{}),(0,$.jsx)(fSe,{children:(0,$.jsx)(bU,{children:(0,$.jsx)(wW,{children:(0,$.jsxs)(th,{children:[(0,$.jsx)(I$,{}),(0,$.jsx)(B$,{}),(0,$.jsx)(gxe,{})]})})})})]})]})})})})]})})]})})})})});v.current===null&&(v.current=ng([{path:`/*`,element:w,errorElement:(0,$.jsx)(Gy,{})}]));let T=v.current;return(0,$.jsx)(ft,{children:(0,$.jsx)(Dm,{children:(0,$.jsx)(ea.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)(hSe,{children:(0,$.jsx)(Ui,{children:(0,$.jsx)(uu,{children:(0,$.jsx)(Wm,{children:(0,$.jsx)(k$,{children:(0,$.jsx)(Zp,{resourcesRepository:c.resourceRepository,children:(0,$.jsx)(Sx,{children:(0,$.jsx)(h$,{children:(0,$.jsx)(ZQ,{children:(0,$.jsxs)(Dz,{apiBaseUrl:u.apiBaseUrl,children:[(0,$.jsx)(a$,{}),(0,$.jsx)(Lve,{}),(0,$.jsx)(c$,{}),(0,$.jsx)(YQ,{}),(0,$.jsx)(XQ,{}),(0,$.jsx)(oH,{router:T})]})})})})})})})})})})})})})}function TSe(e){let t=bm()?.registry,n=oS(),{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||_re.includes(e.variantType)).some(e=>Gm({...e,resourceType:r},n)):!1},[t,r,i,a,n])}var ESe=[so.SECONDARY,so.COMPANION];function DSe(e){let{zones:t,viewport:n,contentAreaWidth:r,reconcileCollapsedZones:i,navigationState:a}=e;(0,Q.useEffect)(()=>{i(ESe.map(e=>({zone:e,mode:Fh({zoneConfig:t?.[e],viewport:n,contentAreaWidth:r}),contentModel:t?.[e]?.contentModel})))},[t,n,r,i,a])}function q$(e){return e.contentType===va.COMPOSITE_VIEW||e.contentType===va.CHART_VIEW||e.contentType===va.FULL_CUSTOM_VIEW||e.contentType===va.FLOWS_ACTORS_VIEW||e.contentType===va.EXECUTION_VIEW}function J$(e,t={}){let{keepOperationTitle:n=!1}=t,r=e?.content?.contentType===va.RESOURCE_OPERATION?e.content.resourceContext.resourceType:void 0,i=(0,Q.useMemo)(()=>{if(e?.content.contentType!==va.COMPOSITE_VIEW)return[];let t=JY(e.content.viewRef);return t?[WY(t)]:[]},[e]),a=(0,Q.useMemo)(()=>{let t=e?.content;if(!t||!q$(t)||t.contentType===va.COMPOSITE_VIEW)return[];let n=YY({viewRef:t.viewRef,contentType:t.contentType});return n?[GY(n)]:[]},[e]),o=bm()?.registry.resourceConfigurations[r??``]?.operations,{tResourceOperation:s,tCompositeView:c,tView:l}=J({resource:r,keys:[...i,...a]});return(0,Q.useMemo)(()=>{if(!e)return{title:``};let{content:t}=e;if(t.contentType===va.RESOURCE_OPERATION){let{resourceType:e,operationIdentifier:r}=t.resourceContext,i=n?String(r):So(r,o);return{title:s(e,i,`title`)}}return q$(t)?{title:XY({viewRef:t.viewRef,contentType:t.contentType,tCompositeView:c,tView:l})}:t.contentType===va.SETTINGS_HUB?{title:`Settings`}:{title:``}},[e,o,n,c,s,l])}function OSe(){let e=(0,Q.useContext)(jH),t=Qp()?.currentOrganizationId,{getZoneState:n}=Mx();return(0,Q.useCallback)(r=>dse({entryOrganizationId:Qh(r.content),entryOwnsBrowserUrl:Ih(r,n),currentOrganizationId:t,routeDecision:e}),[e,t,n])}var kSe=({wildoError:e})=>{let t=lp();return(0,$.jsx)(`div`,{className:`space-y-element`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground whitespace-pre-wrap`,children:t(e)})})},Y$=rc(U.LOW_LEVEL_RESIZABLE_PANEL_GROUP,`ResizablePanelGroup`,[`Panel`,`Handle`]);function X$({preset:e=G.DEFAULT,...t}){let n=Y$(e);return(0,$.jsx)(n,{...t})}function Z$({preset:e=G.DEFAULT,...t}){let n=Y$(e);return(0,$.jsx)(n.Panel,{...t})}function Q$({preset:e=G.DEFAULT,...t}){let n=Y$(e);return(0,$.jsx)(n.Handle,{...t})}var $$=rc(U.LOW_LEVEL_SHEET,`Sheet`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function e1({preset:e=G.DEFAULT,...t}){let n=$$(e);return(0,$.jsx)(n,{...t})}var t1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$$(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});t1.displayName=`SheetTrigger`;var n1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$$(e);return(0,$.jsx)(r.Content,{...t,ref:n})});n1.displayName=`SheetContent`;function ASe({preset:e=G.DEFAULT,...t}){let n=$$(e);return(0,$.jsx)(n.Close,{...t})}function r1({preset:e=G.DEFAULT,...t}){let n=$$(e);return(0,$.jsx)(n.Header,{...t})}function i1({preset:e=G.DEFAULT,...t}){let n=$$(e);return(0,$.jsx)(n.Footer,{...t})}var a1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$$(e);return(0,$.jsx)(r.Title,{...t,ref:n})});a1.displayName=`SheetTitle`;var o1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=$$(e);return(0,$.jsx)(r.Description,{...t,ref:n})});o1.displayName=`SheetDescription`;var s1=rc(U.LOW_LEVEL_DRAWER,`Drawer`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function c1({preset:e=G.DEFAULT,...t}){let n=s1(e);return(0,$.jsx)(n,{...t})}var l1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=s1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});l1.displayName=`DrawerTrigger`;var u1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=s1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});u1.displayName=`DrawerContent`;function d1({preset:e=G.DEFAULT,...t}){let n=s1(e);return(0,$.jsx)(n.Close,{...t})}function f1({preset:e=G.DEFAULT,...t}){let n=s1(e);return(0,$.jsx)(n.Header,{...t})}function p1({preset:e=G.DEFAULT,...t}){let n=s1(e);return(0,$.jsx)(n.Footer,{...t})}var m1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=s1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});m1.displayName=`DrawerTitle`;var h1=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=s1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});h1.displayName=`DrawerDescription`;function g1({requestedMode:e,isMobileViewport:t,mobileShape:n}){if(e===Ai.DIALOG&&t){if(n===`drawer`)return Ai.DRAWER;if(n===`sheet`)return Ai.SHEET}return e}function _1(){let e=null;return{resolve(t){let n=g1(t);return t.open===!0?(e??=n,e):(e=null,n)},reset(){e=null}}}var v1=({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,w=(0,Q.useCallback)(n=>{e===void 0&&x(n),t?.(n)},[t,e]),{isMobile:T,getSurfacePolicy:E}=Ig(),D=(0,Q.useRef)(null);D.current===null&&(D.current=_1());let O=E?.(C.OVERLAY,u),k=D.current.resolve({open:S,requestedMode:v,isMobileViewport:T,mobileShape:O?.geometry?.mobileShape}),{tComponent:A,isReady:j}=J({component:[U.LOW_LEVEL_OVERLAY_CONTAINER,U.LOW_LEVEL_DIALOG,U.LOW_LEVEL_SHEET,U.LOW_LEVEL_DRAWER]}),M=(e,t)=>bp({tComponent:A,componentType:U.LOW_LEVEL_OVERLAY_CONTAINER,key:e,params:t}),N=f??M(`cancel`),P=p??M(`confirm`),F=g??M(`commandPlaceholder`),I=M(`commandEmpty`),L=M(`commandGroup`),ee=M(`close`),R=zSe(k,A),z=i||R,te=a||!i,ne=(0,Q.useMemo)(()=>l.closeOnEscape===!1?e=>e.preventDefault():void 0,[l.closeOnEscape]);if(!j)return null;switch(k){case Ai.DIALOG:return(0,$.jsx)(b1,{open:e,onOpenChange:w,trigger:n,title:z,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s});case Ai.ALERT:return(0,$.jsx)(jSe,{open:e,onOpenChange:w,trigger:n,title:z,titleVisuallyHidden:te,description:o,cancelText:N,confirmText:P,onConfirm:m,onCancel:h,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s});case Ai.SHEET:return(0,$.jsx)(MSe,{open:e,onOpenChange:w,trigger:n,title:z,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s});case Ai.DRAWER:return(0,$.jsx)(NSe,{open:e,onOpenChange:w,trigger:n,title:z,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,children:s});case Ai.COMMAND:return(0,$.jsx)(PSe,{open:e,onOpenChange:w,placeholder:F,emptyLabel:I,groupLabel:L,items:_,config:y,surfacePolicyOverride:u,className:d,children:s});case Ai.POPOVER:return(0,$.jsx)(FSe,{open:e,onOpenChange:w,trigger:n,anchor:r,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s});case Ai.LIGHTBOX:return(0,$.jsx)(ISe,{open:e,onOpenChange:w,trigger:n,title:z,titleVisuallyHidden:te,closeLabel:ee,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s});case Ai.ACTION_SHEET:return(0,$.jsx)(LSe,{open:e,onOpenChange:w,trigger:n,title:z,cancelText:N,config:y,surfacePolicyOverride:u,className:d,children:s});case Ai.TOAST:return null;default:return(0,$.jsx)(b1,{open:e,onOpenChange:w,trigger:n,title:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ne,children:s})}};function y1(e){return e?{}:{"aria-describedby":void 0}}var b1=({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=RSe(s.size);return(0,$.jsxs)(nG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(rG,{asChild:!0,children:n}),(0,$.jsxs)(iG,{surfacePolicyOverride:c,className:W(f,l),...y1(a),onEscapeKeyDown:d,children:[i&&!a?r&&(0,$.jsx)(cG,{className:`sr-only`,children:r}):(r||a)&&(0,$.jsxs)(oG,{children:[r&&(0,$.jsx)(cG,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(lG,{children:a})]}),u,o&&(0,$.jsx)(sG,{children:o})]})]})},jSe=({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)(zw,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(Bw,{asChild:!0,children:n}),(0,$.jsxs)(Vw,{surfacePolicyOverride:u,className:d,onEscapeKeyDown:p,children:[(0,$.jsxs)(Hw,{children:[r&&(0,$.jsx)(Ww,{children:r}),i&&(0,$.jsx)(Gw,{children:i})]}),f,(0,$.jsxs)(Uw,{children:[(0,$.jsx)(qw,{onClick:c,children:a}),(0,$.jsx)(Kw,{onClick:s,children:o})]})]})]}),MSe=({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??Zo.END,p=typeof f==`string`&&!Object.values(Zo).includes(f)?f:Ene(f,document.documentElement.dir===`rtl`?`rtl`:`ltr`);return(0,$.jsxs)(e1,{open:e,onOpenChange:t,modal:s.modal??!0,children:[n&&(0,$.jsx)(t1,{asChild:!0,children:n}),(0,$.jsxs)(n1,{surfacePolicyOverride:c,side:p,className:l,...y1(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)(r1,{children:[r&&(0,$.jsx)(a1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(o1,{children:a})]}),u,o&&(0,$.jsx)(i1,{children:o})]})]})},NSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u})=>(0,$.jsxs)(c1,{open:e,onOpenChange:t,direction:`bottom`,snapPoints:s.snapPoints,dismissible:s.closeOnEscape!==!1&&s.dismissible,children:[n&&(0,$.jsx)(l1,{asChild:!0,children:n}),(0,$.jsxs)(u1,{surfacePolicyOverride:c,className:l,...y1(a),children:[(r||a)&&(0,$.jsxs)(f1,{children:[r&&(0,$.jsx)(m1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(h1,{children:a})]}),(0,$.jsx)(`div`,{className:`px-container pb-card`,children:u}),o&&(0,$.jsx)(p1,{children:o})]})]}),PSe=({open:e,onOpenChange:t,placeholder:n,emptyLabel:r,groupLabel:i,items:a,surfacePolicyOverride:o,className:s,children:c})=>(0,$.jsxs)(TV,{open:e,onOpenChange:t,surfacePolicyOverride:o,children:[(0,$.jsx)(EV,{placeholder:n}),(0,$.jsxs)(DV,{className:s,children:[(0,$.jsx)(OV,{children:r}),a.length>0&&(0,$.jsx)(kV,{heading:i,children:a.map(e=>(0,$.jsxs)(AV,{onSelect:e.onSelect,children:[(0,$.jsx)(`span`,{children:e.label}),e.shortcut&&(0,$.jsx)(L$,{className:`ms-auto`,children:e.shortcut})]},e.id))}),c]})]}),FSe=({open:e,onOpenChange:t,trigger:n,anchor:r,surfacePolicyOverride:i,className:a,children:o,onEscapeKeyDown:s})=>(0,$.jsxs)(pq,{open:e,onOpenChange:t,children:[r&&(0,$.jsx)(gq,{asChild:!0,children:(0,$.jsx)(`span`,{ref:r})}),n&&(0,$.jsx)(mq,{asChild:!0,children:n}),(0,$.jsx)(hq,{surfacePolicyOverride:i,className:a,onEscapeKeyDown:s,children:o})]}),ISe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,closeLabel:a,surfacePolicyOverride:o,className:s,children:c,onEscapeKeyDown:l})=>{let{getRecipe:u}=Ig(),d=u(_t.OVERLAY_BACKDROP);return(0,$.jsxs)(nG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(rG,{asChild:!0,children:n}),(0,$.jsxs)(iG,{surfacePolicyOverride:o,showCloseButton:!1,onEscapeKeyDown:l,...y1(void 0),className:W(`max-w-[90vw] max-h-[90vh] p-0 overflow-hidden`,d.base,s),children:[(0,$.jsxs)(aG,{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)(cG,{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)(cG,{className:`text-white text-center text-base font-normal tracking-normal leading-normal`,children:r})})]})]})},LSe=({open:e,onOpenChange:t,trigger:n,title:r,cancelText:i,surfacePolicyOverride:a,className:o,children:s})=>(0,$.jsxs)(c1,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(l1,{asChild:!0,children:n}),(0,$.jsxs)(u1,{surfacePolicyOverride:a,className:o,children:[r&&(0,$.jsx)(f1,{className:`text-center`,children:(0,$.jsx)(m1,{className:`text-sm font-normal text-muted-foreground`,children:r})}),(0,$.jsx)(`div`,{className:`px-card-sm pb-card`,children:s}),(0,$.jsx)(p1,{className:`pt-element border-t`,children:(0,$.jsx)(d1,{asChild:!0,children:(0,$.jsx)(X,{variant:Y.OUTLINE,className:`w-full`,children:i})})})]})]});function RSe(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 zSe(e,t){switch(e){case Ai.DIALOG:return bp({tComponent:t,componentType:U.LOW_LEVEL_DIALOG,key:`defaultTitle`});case Ai.SHEET:return bp({tComponent:t,componentType:U.LOW_LEVEL_SHEET,key:`defaultTitle`});case Ai.DRAWER:return bp({tComponent:t,componentType:U.LOW_LEVEL_DRAWER,key:`defaultTitle`});default:return``}}v1.displayName=`OverlayContainer`;var BSe=`w-full max-w-md overflow-y-auto`,VSe=`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`,x1=`w-full h-[min(92vh,56rem)] p-0 gap-0 overflow-hidden`,HSe=`${x1} max-w-6xl`,USe=`${x1} max-w-[min(94vw,88rem)]`;function WSe(e){return e?USe:HSe}function S1(e){switch(e){case xi.SHEET:return Ai.SHEET;case xi.DRAWER:return Ai.DRAWER;case xi.DIALOG:default:return Ai.DIALOG}}function GSe(e){return e===Ai.SHEET?BSe:VSe}var KSe=[K.LIST,K.SEARCH];function C1(e){return e.kind===lv.SUB_TABS?e.subTabs.map(e=>e.target):[e]}function qSe(e){return e===Xt.VERTICAL_TABS}var JSe={[uv.SECURITY]:!1,[uv.APPEARANCE]:!1,[uv.INVITATIONS]:!1,[uv.BILLING]:!0,[uv.CONNECTED_ACCOUNTS]:!1,[uv.ORGANIZATION_CONNECTED_ACCOUNTS]:!1,[uv.APPLICATION_CONNECTED_ACCOUNTS]:!1,[uv.AGENT_WORK_OVERRIDE_RATE]:!1,[uv.AUTONOMOUS_AGENTS]:!1,[uv.MODEL_COST_BREAKDOWN]:!1,[uv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN]:!1,[uv.REPRESENTATIVE_ACTIVITY]:!1,[uv.AGENT_WORK_EVALUATION_EXPORT]:!1};function YSe(e){return e.kind===lv.ENGINE_PANEL?JSe[e.panelRef]:e.kind===lv.RESOURCE_OPERATION&&KSe.includes(String(e.operation))}function XSe(e){return C1(e).some(YSe)}function ZSe(e,t,n){if(!t)return!1;let r=e.find(e=>e.ref===t);return r?XSe(r.target)?!0:C1(r.target).some(e=>e.kind===lv.RESOURCE_OPERATION&&qSe(n(e.resourceType))):!1}function w1({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_SEPARATOR,`Separator`)(e);return(0,$.jsx)(n,{...t})}var T1;(function(e){e.ACTIVE=`active`,e.INACTIVE=`inactive`,e.UNAVAILABLE=`unavailable`})(T1||={});var QSe={[T1.ACTIVE]:`success`,[T1.INACTIVE]:`outline`,[T1.UNAVAILABLE]:`secondary`},E1=({icon:e,title:t,description:n,state:r,statusLabel:i,meta:a,action:o,children:s})=>{let{renderIcon:c}=kf(),l=r===T1.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:W(`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:Jn.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)(Nf,{variant:QSe[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})]})},$Se=()=>{let{auth:e}=Eu(),{auth:t,signOutEverywhere:n}=gm(),{user:r}=ag(),i=Jx(),a=lp(),[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)(()=>ob(u.map(e=>Cd(e.providerRef))),[u]),{tComponent:T,t:E,isReady:D,formatDate:k}=J({component:[U.APP_LAYOUTS_SECURITY_SETTINGS,U.PUBLIC_LAYOUTS_USER_REGISTER,U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED],keys:w}),A=(0,Q.useCallback)((e,t)=>T(U.APP_LAYOUTS_SECURITY_SETTINGS,e,t),[T]),j=(0,Q.useCallback)(e=>T(U.PUBLIC_LAYOUTS_USER_REGISTER,e),[T]),M=e?.passkeyConfig,N=i.userTypeAuth?.methodManagement,P=i.passwordPolicy,F=M?.maxPasskeysPerUser??10,I=N?.allowUserMethodRemoval??!0,L=(0,Q.useCallback)(async()=>{p(!0),h(null);try{let e=Tc(),[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,A(As.ERROR)))}finally{p(!1)}},[A,a]);(0,Q.useEffect)(()=>{L()},[L]),(0,Q.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>_(null),5e3);return()=>clearTimeout(e)},[g]);let ee=O.getEnrollableSecondFactorMethods(),R=o.filter(e=>e.enrolled&&ee.includes(e.method)).map(e=>e.method),z=qm.evaluateAccountCompleteness(t.identification?.requiresMFA??!1,t.identification?.secondFactorMethods?.map(e=>e.method)??[],R.length>0?R:t.enrolledSecondFactorMethods,i.userTypeAuth?.mfaPolicy?.acceptableMFAMethods??[]),te=o.some(e=>e.method===Us.PASSWORD&&e.enrolled),ne=o.some(e=>e.method===Us.TOTP&&e.enrolled),re=o.find(e=>e.method===Us.SMS_OTP),ie=re?.enrolled??!1,ae=re?.details?.phoneNumber,oe=(0,Q.useMemo)(()=>u.map(t=>({...t,providerLabel:sb({providerRef:t.providerRef,displayName:e?.socialOAuth2Providers?.[t.providerRef]?.displayName,translate:E})})),[e?.socialOAuth2Providers,u,E]),se=(0,Q.useCallback)(async()=>{if(!(c.length>=F)&&typeof window<`u`&&window.PublicKeyCredential){C(!0),h(null);try{let e=Tc(),t=await e.passkeyRegisterOptions(),n=await gp({optionsJSON:t});await e.passkeyRegisterVerify({response:n}),_(A(As.SUCCESS)),L()}catch(e){if(di(e))return;let t=e?.name===`NotAllowedError`?A(As.PASSKEY_CANCELLED):a(e,A(As.ERROR));h(t)}finally{C(!1)}}},[F,c.length,L,A,a]),ce=(0,Q.useCallback)(async e=>{if(I)try{await Tc().passkeyRemove(e),_(A(As.SUCCESS)),L()}catch(e){di(e)||h(a(e,A(As.ERROR)))}},[I,L,A,a]),le=(0,Q.useCallback)(async()=>{try{await Tc().mfaTOTPDisable(),_(A(As.SUCCESS)),y(!1),L()}catch(e){di(e)||h(a(e,A(As.ERROR)))}},[L,A,a]),ue=(0,Q.useCallback)(async e=>{if(I)try{await Tc().unlinkIdentityLink(e),_(A(As.SUCCESS)),L()}catch(e){di(e)||h(a(e,A(As.ERROR)))}},[I,L,A,a]);if(!D)return null;let de=typeof window<`u`&&!!window.PublicKeyCredential,fe=de?c.length>0?T1.ACTIVE:T1.INACTIVE:T1.UNAVAILABLE,pe=e=>{switch(e){case T1.ACTIVE:return A(As.STATUS_ACTIVE);case T1.UNAVAILABLE:return A(As.STATUS_UNAVAILABLE);case T1.INACTIVE:return A(As.STATUS_NOT_CONFIGURED)}},me=(0,$.jsxs)(E1,{icon:wX[Us.PASSKEY],title:A(As.SECTION_PASSKEYS),description:A(As.PASSKEYS_DESCRIPTION),state:fe,statusLabel:pe(fe),action:de&&c.length<F?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:se,disabled:S,children:A(S?As.PASSKEY_ADDING:As.PASSKEY_ADD)}):void 0,children:[!de&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:A(As.PASSKEY_UNSUPPORTED)})}),de&&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:A(As.PASSKEY_ADDED,{date:k(e.createdAt)})})]}),I&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,onClick:()=>ce(e.credentialId),children:A(As.PASSKEY_REMOVE)})]},e.credentialId))})]}),he=ne?T1.ACTIVE:T1.INACTIVE,ge=(0,$.jsx)(E1,{icon:wX[Us.TOTP],title:A(As.SECTION_TOTP),description:A(As.TOTP_DESCRIPTION),state:he,statusLabel:pe(he),action:ne?I?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:le,children:A(As.TOTP_DISABLE)}):void 0:v?void 0:(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>y(!0),children:A(As.TOTP_SETUP)}),children:ne?(0,$.jsx)($.Fragment,{children:z.enrolledMethods.length===1&&z.enrolledMethods.includes(Us.TOTP)&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:A(As.TOTP_ONLY_MFA_WARNING)})})}):v?(0,$.jsx)(YX,{onComplete:()=>{y(!1),L()},onError:e=>h(e),isLoading:!1,t:e=>T(U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null}),_e=ie?T1.ACTIVE:T1.INACTIVE,ve=(0,$.jsx)(E1,{icon:wX[Us.SMS_OTP],title:A(As.SECTION_PHONE),description:A(As.PHONE_DESCRIPTION),state:_e,statusLabel:pe(_e),meta:ie&&ae?(0,$.jsx)(Z,{className:`text-sm`,children:ae}):void 0,action:ie?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>x(!0),children:A(As.PHONE_CHANGE)}):b?void 0:(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>x(!0),children:A(As.PHONE_VERIFY)}),children:ie&&!b?null:b?(0,$.jsx)(ZX,{onComplete:()=>{x(!1),L()},onError:e=>h(e),isLoading:!1,t:e=>T(U.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:A(As.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:A(As.LOADING)}):(0,$.jsx)(kF,{children:(0,$.jsxs)(IF,{className:`flex flex-col divide-y divide-border p-card`,children:[me,ge,ve,(0,$.jsx)(eCe,{hasPassword:te,passwordPolicy:P,userEmail:r?.email,t:A,tPolicy:j,onSuccess:()=>{_(A(As.SUCCESS)),L()},onError:e=>h(e)}),(0,$.jsx)(nCe,{links:oe,allowRemoval:I,t:A,onUnlink:ue})]})}),!f&&(0,$.jsx)(kF,{children:(0,$.jsx)(IF,{className:`flex flex-col divide-y divide-border p-card`,children:(0,$.jsx)(tCe,{t:A,formatDate:k,onSignOutEverywhere:n,onError:e=>h(a(e))})})})]})},eCe=({hasPassword:e,passwordPolicy:t,userEmail:n,t:r,tPolicy:i,onSuccess:a,onError:o})=>{let s=lp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=jw({defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),p=jw({defaultValues:{newPassword:``,confirmPassword:``}}),m=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(As.PASSWORD_MISMATCH));else{l(!0);try{await Tc().passwordChange(e.currentPassword,e.newPassword),a(),f.reset(),d(!1)}catch(e){di(e)||o(s(e,r(As.ERROR)))}finally{l(!1)}}},[f,o,a,r,s]),h=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(As.PASSWORD_MISMATCH));else{l(!0);try{await Tc().passwordSet(e.newPassword),a(),p.reset(),d(!1)}catch(e){di(e)||o(s(e,r(As.ERROR)))}finally{l(!1)}}},[o,a,p,r,s]),g=e?T1.ACTIVE:T1.INACTIVE;return(0,$.jsx)(E1,{icon:wX[Us.PASSWORD],title:r(As.SECTION_PASSWORD),description:r(As.PASSWORD_DESCRIPTION),state:g,statusLabel:r(e?As.STATUS_ACTIVE:As.STATUS_NOT_CONFIGURED),action:u?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>{d(!1),f.reset(),p.reset()},children:r(As.CANCEL)}):(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>d(!0),children:r(e?As.PASSWORD_CHANGE:As.PASSWORD_SET)}),children:u?e?(0,$.jsx)(VC,{...f,children:(0,$.jsxs)(`form`,{onSubmit:f.handleSubmit(m),className:`space-y-4`,children:[(0,$.jsx)(vZ,{email:n}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:r(As.PASSWORD_CURRENT)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`current-password`,...f.register(`currentPassword`,{required:!0})})]}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:r(As.PASSWORD_NEW)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`new-password`,...f.register(`newPassword`,{required:!0})}),(0,$.jsx)(_Z,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:r(As.PASSWORD_CONFIRM)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`new-password`,...f.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(As.PASSWORD_CHANGE)})]})}):(0,$.jsx)(VC,{...p,children:(0,$.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,$.jsx)(vZ,{email:n}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:r(As.PASSWORD_NEW)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`new-password`,...p.register(`newPassword`,{required:!0})}),(0,$.jsx)(_Z,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(ax,{children:[(0,$.jsx)(ox,{children:r(As.PASSWORD_CONFIRM)}),(0,$.jsx)(tN,{type:`password`,autoComplete:`new-password`,...p.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(As.PASSWORD_SET)})]})}):null})},tCe=({t:e,formatDate:t,onSignOutEverywhere:n,onError:r})=>{let{renderIcon:i}=kf(),{t:a}=J(),[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 Tc().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 Tc().revokeMySession(e),t()}catch(e){e?.httpStatus===404?t():m.current(e)}finally{p(null)}},[]),g=(e,t)=>{let n=hl(e,t),r=a(n);return r===n?ps(t):r},_=t=>e(As.SESSION_DEVICE,{browser:g(zu.BROWSER,t.browser??Zee.OTHER),operatingSystem:g(zu.OPERATING_SYSTEM,t.operatingSystem??je.OTHER)}),v=n=>n.ipAddress?e(As.SESSION_DETAILS,{address:n.ipAddress,lastActive:t(n.lastActiveAt)}):e(As.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:Jn.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(As.SECTION_SESSIONS)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e(As.SIGN_OUT_EVERYWHERE_DESCRIPTION)})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,onClick:()=>s(!0),disabled:c,children:e(As.SIGN_OUT_EVERYWHERE)})}),(0,$.jsx)(zw,{open:o,onOpenChange:e=>{!e&&!c&&s(!1)},children:(0,$.jsxs)(Vw,{children:[(0,$.jsxs)(Hw,{children:[(0,$.jsx)(Ww,{children:e(As.SIGN_OUT_EVERYWHERE_CONFIRM_TITLE)}),(0,$.jsx)(Gw,{children:e(As.SIGN_OUT_EVERYWHERE_CONFIRM_DESCRIPTION)})]}),(0,$.jsxs)(Uw,{children:[(0,$.jsx)(qw,{disabled:c,children:e(As.CANCEL)}),(0,$.jsx)(Kw,{disabled:c,onClick:e=>{e.preventDefault(),y()},children:e(As.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(As.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)(Nf,{variant:`secondary`,children:e(As.SESSION_THIS_DEVICE)})]}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:v(t)})]}),!t.isCurrent&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,disabled:f===t.sessionId,onClick:()=>{h(t.sessionId)},children:e(As.SESSION_SIGN_OUT)})]},t.sessionId))})]})},nCe=({links:e,allowRemoval:t,t:n,onUnlink:r})=>(0,$.jsx)(E1,{icon:wX[Us.EXTERNAL_OAUTH2],title:n(As.SECTION_IDENTITY_LINKS),description:n(As.IDENTITY_LINKS_DESCRIPTION),state:e.length>0?T1.ACTIVE:T1.INACTIVE,statusLabel:n(e.length>0?As.STATUS_ACTIVE:As.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:Y.OUTLINE,size:Gd.SM,onClick:()=>r(e._id),children:n(As.IDENTITY_LINKS_UNLINK)})]},e._id))})});function rCe(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===E.API_CALL)??null:null}function D1(){let{themePreference:e,setTheme:t}=Ig(),{doOperation:n,registry:r}=pm();return{themePreference:e,selectTheme:(0,Q.useCallback)(e=>{t(e);let i=rCe(r,gu.USER_SELF_PREFERENCES,K.UPDATE);if(!i)return;let a=wi.buildOperationPathKeyFromOperation(i);n(a,{contextualParameters:{},requestData:{ui:{theme:e}}}).catch(()=>{})},[n,r,t])}}var iCe=[Yc.LIGHT,Yc.DARK,Yc.AUTO],aCe={[Yc.LIGHT]:`themeLight`,[Yc.DARK]:`themeDark`,[Yc.AUTO]:`themeSystem`},oCe=[yo.BACKGROUND,yo.FOREGROUND,yo.MUTED,yo.MUTED_FOREGROUND,yo.PRIMARY,yo.BORDER];function O1(e,t,n){let r=r=>{let i=e?.[r]??t?.[r];return i?mn(i,n):`var(--${r})`};return oCe.reduce((e,t)=>({...e,[t]:r(t)}),{})}var k1=({palette:e,className:t})=>(0,$.jsxs)(`div`,{className:W(`flex h-full w-full gap-[3px] p-[5px]`,t),style:{backgroundColor:e[yo.BACKGROUND]},children:[(0,$.jsxs)(`div`,{className:`flex w-1/4 shrink-0 flex-col gap-[3px] rounded-[3px] p-[3px]`,style:{backgroundColor:e[yo.MUTED]},children:[(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[yo.PRIMARY]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-3/4 rounded-full`,style:{backgroundColor:e[yo.MUTED_FOREGROUND],opacity:.5}}),(0,$.jsx)(`div`,{className:`h-[3px] w-2/3 rounded-full`,style:{backgroundColor:e[yo.MUTED_FOREGROUND],opacity:.5}})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-[4px] rounded-[3px] border p-[4px]`,style:{backgroundColor:e[yo.MUTED],borderColor:e[yo.BORDER]},children:[(0,$.jsx)(`div`,{className:`h-[4px] w-2/3 rounded-full`,style:{backgroundColor:e[yo.FOREGROUND]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[yo.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`h-[3px] w-4/5 rounded-full`,style:{backgroundColor:e[yo.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`mt-auto h-[6px] w-2/5 rounded-[2px]`,style:{backgroundColor:e[yo.PRIMARY]}})]})]}),sCe=({option:e,light:t,dark:n})=>e===Yc.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)(k1,{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)(k1,{palette:n})})})]}):(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-16 w-full overflow-hidden rounded-md border`,children:(0,$.jsx)(k1,{palette:e===Yc.DARK?n:t})}),cCe=()=>{let{tComponent:e,isReady:t}=J({component:U.APP_LAYOUTS_APPEARANCE_SETTINGS}),{designSystemConfiguration:n}=Ig(),{themePreference:r,selectTheme:i}=D1(),a=(0,Q.useCallback)(t=>e(U.APP_LAYOUTS_APPEARANCE_SETTINGS,t),[e]),o=(0,Q.useMemo)(()=>O1(n?.tokens,n?.customTokens,zo.LIGHT),[n]),s=(0,Q.useMemo)(()=>O1(n?.tokens,n?.customTokens,zo.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)(TF,{value:r,onValueChange:e=>i(e),"aria-label":a(`themeHeading`),className:`grid-cols-1 gap-item sm:grid-cols-3`,children:iCe.map(e=>{let t=`appearance-theme-${e}`;return(0,$.jsxs)(BX,{htmlFor:t,className:W(`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)(sCe,{option:e,light:o,dark:s}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-xs`,children:[(0,$.jsx)(EF,{id:t,value:e}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:a(aCe[e])})]})]},e)})})]}):null},lCe=[ac.ROLES],uCe=gd().min(1),dCe=()=>{let{tComponent:e,tRole:t,isReady:n,formatDateTime:r}=J({component:U.APP_LAYOUTS_INVITATIONS_SETTINGS,keys:lCe}),{refreshOrganizations:i}=ag(),a=(0,Q.useCallback)((t,n)=>e(U.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=Tc(),[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 Tc().acceptMyInvitation(e),await i(),y(a(`acceptSuccess`)),await x()}catch(e){di(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,i,a]),C=(0,Q.useCallback)(async e=>{h(e),_(null);try{await Tc().rejectMyInvitation(e),y(a(`rejectSuccess`)),await x()}catch(e){di(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){Ir(e)&&await x(),di(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 Tc().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 Tc().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)(kF,{children:(0,$.jsx)(IF,{className:`p-card`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(f?`loading`:`empty`)})})}),!f&&o.length>0&&(0,$.jsx)(kF,{children:(0,$.jsx)(IF,{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:Y.OUTLINE,size:Gd.SM,disabled:m===e.membershipId,onClick:()=>C(e.membershipId),children:a(`rejectButton`)}),(0,$.jsx)(X,{size:Gd.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)(kF,{children:(0,$.jsx)(IF,{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)(BX,{htmlFor:`field-receiving-organization-${e.invitationId}`,children:a(`relationshipReceivingOrganizationLabel`)}),(0,$.jsx)(_F,{name:`receiving-organization-${e.invitationId}`,schema:uCe,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:Y.OUTLINE,size:Gd.SM,disabled:o,onClick:()=>E(e),children:a(`relationshipDeclineButton`)}),n.length>0&&(0,$.jsx)(X,{size:Gd.SM,disabled:o||!i,onClick:()=>T(e),children:a(`relationshipReceiveButton`)})]})]},e.invitationId)})})})})]})]})};function A1(e){return ob([e?Cd(e):void 0])}function j1(e){if(e.providerRef)return sb({providerRef:e.providerRef,translate:e.translate})}function M1({preset:e=G.DEFAULT,...t}){let n=Bh(),r=lp(),i=_h(),a=(0,Q.useMemo)(()=>A1(n?.billingProviderRef),[n?.billingProviderRef]),{tBillingProduct:o,t:s,isReady:c}=J({keys:[`billing_products`,...a]}),l=q(U.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??j1({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(Wo.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(Wo.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),v=t.unavailable??(!!n?.isEnabled&&(t.status===void 0||t.planName===void 0||t.currentPeriodEnd===void 0)&&[Wo.SUBSCRIPTION,Wo.PRODUCTS,Wo.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 N1({preset:e=G.DEFAULT,...t}){let n=Bh(),r=lp(),i=_h(),a=Q.useMemo(()=>A1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=J({keys:a}),s=q(U.LOW_LEVEL_BILLING_PORTAL_LINK,`BillingPortalLink`)(e),c=t.onOpenPortal??(()=>{n&&i(()=>n.openCustomerPortal())}),l=t.providerName??j1({providerRef:n?.billingProviderRef,translate:o}),u=t.unavailable??(!!n?.isEnabled&&t.onOpenPortal===void 0&&[Wo.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 P1;(function(e){e.IDLE=`idle`,e.PREVIEWING=`previewing`,e.READY=`ready`,e.CONFIRMING=`confirming`,e.FAILED=`failed`})(P1||={});function fCe(e){let t=e.currency.toUpperCase(),n=Na(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 pCe(e){let[t,n]=(0,Q.useState)({phase:P1.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&&[Wo.BILLING_ACCOUNT,Wo.SUBSCRIPTION,Wo.PRODUCTS,Wo.PRICES].every(e.isSliceAvailable);return(0,Q.useEffect)(()=>(r.current+=1,i.current?.abort(),n({phase:P1.IDLE}),()=>{r.current+=1,i.current?.abort()}),[s]),(0,Q.useEffect)(()=>{let e=o.current;a.current||e.phase===P1.READY&&e.hasError||l||(r.current+=1,i.current?.abort(),n({phase:P1.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:P1.PREVIEWING});try{let i=await e.previewPlanChange(t,{signal:u.signal}),a=fCe(i);if(!i.previewToken)throw Error(`The invoice estimate has no confirmation binding.`);if(r.current!==o||c.current!==s)return;n({...d,phase:P1.READY,response:i,preview:a})}catch{if(r.current!==o||u.signal.aborted)return;n({...d,phase:P1.FAILED})}},[e,l,s]),cancel:(0,Q.useCallback)(()=>{a.current||(r.current+=1,i.current?.abort(),n({phase:P1.IDLE}))},[]),confirm:(0,Q.useCallback)(async()=>{let t=o.current;if(!e||!l||a.current||t.phase!==P1.READY||t.scopeIdentity!==c.current)return;a.current=!0;let i=r.current;n({...t,phase:P1.CONFIRMING,hasError:!1});try{await e.confirmPlanChange({...t.target,previewToken:t.response.previewToken}),r.current===i&&n({phase:P1.IDLE})}catch{r.current===i&&n({...t,phase:P1.READY,hasError:!0})}finally{a.current=!1}},[e,l])}}function F1({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW,`PlanChangePreview`)(e);return(0,$.jsx)(n,{...t})}function I1({preset:e=G.DEFAULT,...t}){let n=Bh(),r=lp(),i=pCe(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=i.state.phase!==P1.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}=J({keys:[`billing_products`,`billing_features`,`billing_limits`]}),f=q(U.LOW_LEVEL_BILLING_PRICING_TABLE,`PricingTable`)(e),p=(0,Q.useMemo)(()=>t.plans?t.plans:n?.products?n.products.filter(e=>e.type===cu.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&&Cee(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&&[Wo.BILLING_ACCOUNT,Wo.SUBSCRIPTION,Wo.PRODUCTS,Wo.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&&[Wo.PRODUCTS,Wo.PRICES,Wo.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===P1.CONFIRMING||!!g,pendingPlanChange:g,onKeepCurrentPlan:y,isKeepingCurrentPlan:t.isKeepingCurrentPlan??_}),i.state.phase!==P1.IDLE&&(0,$.jsx)(F1,{targetPlanName:c(i.state.target.newProductKey,`name`),preview:`preview`in i.state?i.state.preview:null,isLoading:i.state.phase===P1.PREVIEWING,isConfirming:i.state.phase===P1.CONFIRMING,hasError:i.state.phase===P1.FAILED||`hasError`in i.state&&i.state.hasError,onCancel:i.cancel,onConfirm:i.state.phase===P1.READY||i.state.phase===P1.CONFIRMING?()=>{i.confirm()}:void 0,onRetry:i.state.phase===P1.FAILED?()=>{i.state.phase===P1.FAILED&&i.select(i.state.target)}:void 0})]}):null}function L1({preset:e=G.DEFAULT,...t}){let n=Bh(),r=lp(),i=_h(),{tBillingProduct:a,tBillingCreditPool:o,isReady:s}=J({keys:[`billing_products`,`billing_credit_pools`]}),c=q(U.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||![Wo.BILLING_ACCOUNT,Wo.PRODUCTS,Wo.PRICES,Wo.CREDIT_POOLS].every(n.isSliceAvailable))return;let r=n.products.find(t=>t.type===cu.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(Wo.USAGE)),p=t.creditPoolsUnavailable??(!!n?.isEnabled&&t.creditPools===void 0&&!n.isSliceAvailable(Wo.CREDIT_POOLS)),m=!!t.onTopUp||!!n&&[Wo.BILLING_ACCOUNT,Wo.PRODUCTS,Wo.PRICES,Wo.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 R1({preset:e=G.DEFAULT,...t}){let n=Bh(),r=lp(),i=_h(),a=Q.useMemo(()=>A1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=J({keys:a}),s=q(U.LOW_LEVEL_BILLING_INVOICE_HISTORY,`InvoiceHistory`)(e),c=t.invoices??n?.invoices??[],l=t.onViewAll??(n?.isSliceAvailable(Wo.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),u=t.providerName??j1({providerRef:n?.billingProviderRef,translate:o}),d=t.unavailable??(!!n?.isEnabled&&t.invoices===void 0&&[Wo.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 mCe=()=>{let e=Bh(),{tComponent:t,isReady:n}=J({component:U.APP_LAYOUTS_BILLING_SETTINGS}),r=(0,Q.useCallback)(e=>t(U.APP_LAYOUTS_BILLING_SETTINGS,e),[t]);if(!n)return null;if(!e?.isEnabled)return(0,$.jsxs)(kF,{children:[(0,$.jsx)(jF,{children:(0,$.jsx)(NF,{children:r(`disabledTitle`)})}),(0,$.jsx)(IF,{children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:r(`disabledDescription`)})})]});let i=e.isSliceAvailable(Wo.BILLING_ACCOUNT),a=[Wo.SUBSCRIPTION,Wo.PRODUCTS,Wo.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)(M1,{}),i&&!a&&(0,$.jsx)(N1,{}),(0,$.jsx)(I1,{}),(0,$.jsx)(L1,{}),(0,$.jsx)(R1,{})]})};function z1({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DESCRIPTION_LIST,`DescriptionList`)(e);return(0,$.jsx)(n,{...t})}function B1({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DESCRIPTION_TERM,`DescriptionTerm`)(e);return(0,$.jsx)(n,{...t})}function V1({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DESCRIPTION_DETAILS,`DescriptionDetails`)(e);return(0,$.jsx)(n,{...t})}function H1(e){switch(e){case hi.USER:return gu.USER_PROVIDER_CREDENTIALS;case hi.ORGANIZATION:return gu.ORG_PROVIDER_CREDENTIALS;case hi.APPLICATION:return}}function hCe(e){return H1(e)!==void 0}function gCe(e,t){return e===hi.APPLICATION?e:t===null?null:`${e}:${t}`}function U1(e){let t=H1(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===E.API_CALL);if(!r)return;let i={...nm.buildResourceOperationContextIdentifiers({...e.ownerScope===hi.USER?{currentUserId:e.ownerId}:{currentOrganizationId:e.ownerId},primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),[t]:e.credentialId};return{operationPathKey:wi.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e.registry),parentResourcesRequirements:En.buildParentResourcesRequirements(t,i,e.registry)}}function _Ce(e,t){let{registry:n,doOperation:r}=pm(),[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=gCe(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 Tc().listLinkedProviderConnections(e===hi.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===hi.APPLICATION)try{await Tc().disconnectApplicationProviderConnection(i.connectionRef)}finally{m()}else if(t!==null)try{for(let a of i.credentials){let i=U1({registry:n,ownerScope:e,ownerId:t,credentialId:a.credentialId,operation:K.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})}pc({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=U1({registry:n,ownerScope:e,ownerId:t,credentialId:o.credentialId,operation:K.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=U1({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,K.UPDATE,{description:t.trim()===``?null:t.trim()}),[_]),y=(0,Q.useCallback)(e=>_(e,K.DELETE),[_]);return{connections:i,loading:o,failed:c,reload:m,disconnect:h,holdsCredentialResource:hCe(e),setEnabled:g,setCredentialDescription:v,removeCredential:y}}var W1=U.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,vCe={[hi.USER]:bte.shape.description.unwrap().maxLength??void 0,[hi.ORGANIZATION]:vn.shape.description.unwrap().maxLength??void 0},G1=gd().min(1),K1=Pd(),yCe=gd().min(1),bCe=(e,t)=>e.filter(e=>e.admissibleConnections.some(e=>e.ownerScope===t)),q1=(e,t)=>{let n=new Set(Object.values(Hr)),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},xCe=(e,t)=>{let n=q1(e,t);return t===hi.APPLICATION?n.filter(e=>e===Hr.SERVICE):n},J1=e=>({ownerScope:e.ownerScope,delegation:e.delegation,...e.ownerScope===hi.APPLICATION||e.ownerId===null?{}:{ownerId:e.ownerId},...kn(e)&&e.signedInUserId!==null?{actingForUserId:e.signedInUserId}:{}}),SCe=(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)}`}),Y1;(function(e){e.SUPERSEDED=`SUPERSEDED`,e.DISABLED=`DISABLED`,e.NEEDS_REAUTHORIZATION=`NEEDS_REAUTHORIZATION`,e.WORKING=`WORKING`,e.NOT_YET_USED=`NOT_YET_USED`})(Y1||={});var X1;(function(e){e.DISCONNECTED=`DISCONNECTED`,e.FAILED=`FAILED`})(X1||={});var CCe=e=>{if(e.supersededByConnectionRef!==void 0)return Y1.SUPERSEDED;if(!e.enabled)return Y1.DISABLED;switch(e.validationState){case ae.INVALID:return Y1.NEEDS_REAUTHORIZATION;case ae.VALID:return Y1.WORKING;case ae.UNVALIDATED:return Y1.NOT_YET_USED}},wCe={[Y1.SUPERSEDED]:`warning`,[Y1.DISABLED]:`secondary`,[Y1.NEEDS_REAUTHORIZATION]:`destructive`,[Y1.WORKING]:`success`,[Y1.NOT_YET_USED]:`secondary`},TCe={[Y1.SUPERSEDED]:`statusSuperseded`,[Y1.DISABLED]:`statusDisabled`,[Y1.NEEDS_REAUTHORIZATION]:`statusNeedsReauthorization`,[Y1.WORKING]:`statusWorking`,[Y1.NOT_YET_USED]:`statusNotYetUsed`},ECe=(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}},DCe=(e,t)=>ob([...[...e.flatMap(e=>[e.providerRef,...e.servesRefs??[]]),...t.flatMap(e=>[e.connectionRef,...e.servesRefs,...e.supersededByConnectionRef===void 0?[]:[e.supersededByConnectionRef]])].map(Cd),...e.flatMap(e=>(e.credentialFields??[]).flatMap(t=>[xd(e.providerRef,t.slug,Sd.LABEL),xd(e.providerRef,t.slug,Sd.DESCRIPTION)])),...e.flatMap(e=>(e.connectionParameters??[]).flatMap(t=>[bd(e.providerRef,t,Sd.LABEL),bd(e.providerRef,t,Sd.DESCRIPTION)])),...t.flatMap(e=>e.credentials.map(e=>xd(e.providerRef,e.secretSlug,Sd.LABEL)))]),Z1=(e,t,n,r)=>{let i=xd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===Sd.LABEL?t:i},Q1=(e,t,n,r)=>{let i=bd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===Sd.LABEL?t:i},OCe=(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}))]},kCe=()=>{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}},ACe=()=>{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())},jCe=({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?[]:q1(n,r),y=v.length===1?v[0]:v.find(e=>e===u),b=y!==void 0&&Mt({ownerScope:r,delegation:y}),x=r===hi.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 Tc().startProviderConnection(t.offer.providerRef,{target:J1({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),di(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)(_F,{name:`delegation-${e.connectionRef}`,schema:G1,options:v.map(e=>({value:e,label:s(e===Hr.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)(DI,{name:`organizationWideUseAcknowledged-${e.connectionRef}`,schema:K1,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:Gd.SM,variant:Y.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`)})})]})},MCe={[gee.MESSAGING_ENDPOINT]:`vendorRegistrationMessagingEndpointLabel`},NCe=new Set([rs.PROVIDER_VENDOR_REGISTRATION_DEPLOYMENT_INCOMPLETE]),$1=e=>Tt(e)||Ir(e)&&e.customMessageReference!==void 0&&NCe.has(e.customMessageReference);function PCe(e){if(e.encoding===V_.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 FCe=({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=lp(),g=(0,Q.useMemo)(()=>[...new Set((s?.steps??[]).map(t=>vd(e,t.ref)))],[e,s]),{t:_,isReady:v}=J({keys:g}),y=(0,Q.useCallback)(async()=>{o(!0),u(!0),f(null),c(null);try{c(await Tc().getProviderVendorRegistration(e,{ownerScope:hi.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:Ir(d)?h(d,r($1(d)?`vendorRegistrationRefused`:`vendorRegistrationFailed`)):r(`vendorRegistrationFailed`)}),$1(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:Gd.SM,variant:Y.OUTLINE,disabled:l,onClick:()=>{y()},children:r(`vendorRegistrationRetryButton`)})})]}),s!==null&&(0,$.jsxs)($.Fragment,{children:[(s.addresses??[]).length>0&&(0,$.jsx)(z1,{children:(s.addresses??[]).map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(B1,{children:r(MCe[e.kind]??e.kind)}),(0,$.jsx)(V1,{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:Gd.SM,variant:Y.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:_(vd(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:Gd.SM,variant:Y.GHOST,onClick:()=>{o(!1),m(null)},children:r(`vendorRegistrationHideButton`)}),s?.file!==void 0&&(0,$.jsx)(X,{size:Gd.SM,variant:Y.DEFAULT,onClick:()=>Fy(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:Gd.SM,variant:Y.OUTLINE,"aria-label":i(`vendorRegistrationAccessibleName`,{provider:n}),onClick:()=>{y()},children:r(`vendorRegistrationButton`)})})},ICe=({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=Z1(e.providerRef,e.secretSlug,Sd.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:Gd.SM,variant:Y.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:Gd.SM,variant:Y.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)(tN,{"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:Gd.SM,variant:Y.DEFAULT,disabled:h,onClick:()=>{_(e.credentialId)},children:r(`saveDescriptionButton`)}),(0,$.jsx)(X,{size:Gd.SM,variant:Y.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:Gd.SM,variant:Y.DESTRUCTIVE,disabled:h,"aria-label":i(`removeSlotConfirmAccessibleName`,{provider:n,slot:y}),autoFocus:!0,onClick:()=>{v(e.credentialId)},children:r(`removeSlotConfirmButton`)}),(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,disabled:h,onClick:()=>p(null),children:r(`removeSlotCancelButton`)})]})]},e.credentialId)})})]})},e0=({ownerScope:e=hi.USER})=>{let{tComponent:t,isReady:n,formatDateTime:r}=J({component:W1}),{user:i,currentOrganizationId:a}=ag(),o=(0,Q.useCallback)(e=>t(W1,e),[t]),s=(0,Q.useCallback)((e,n)=>t(W1,e,n),[t]),c=(0,Q.useId)(),l=e===hi.USER?i?._id??null:e===hi.ORGANIZATION?a??null:null,u=e===hi.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)(kCe),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&&(ACe(),j.current=Tc().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 Tc().listConnectableProviders(e===hi.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)(()=>bCe(d,e),[d,e]),{connections:N,loading:P,failed:F,reload:I,disconnect:L,holdsCredentialResource:ee,setEnabled:R,setCredentialDescription:z,removeCredential:te}=_Ce(e,l),ne=sr(),re=(0,Q.useMemo)(()=>DCe(d,N),[d,N]),{t:ie}=J({keys:re}),ae=(0,Q.useCallback)(e=>sb({providerRef:e,translate:ie}),[ie]),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),fe=(0,Q.useCallback)(async e=>{le(e.connectionRef),de(null);try{await L(e),de(X1.DISCONNECTED),g(null)}catch(e){di(e)||de(X1.FAILED)}finally{le(null),se(null)}},[L]),[pe,me]=(0,Q.useState)(null),he=(0,Q.useCallback)(async(e,t)=>{me(e.connectionRef),de(null);try{await R(e,t),g(null)}catch(e){di(e)||g(o(`errorGeneric`))}finally{me(null)}},[R,o]),ge=(0,Q.useCallback)(async e=>{de(null);try{return await e(),g(null),!0}catch(e){return di(e)||g(o(`errorGeneric`)),!1}},[o]),_e=(0,Q.useCallback)((e,t)=>ge(()=>z(e,t)),[ge,z]),ve=(0,Q.useCallback)(e=>ge(()=>te(e)),[ge,te]),ye=(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]),B=(0,Q.useMemo)(()=>d.filter(e=>(e.missingRegistration??[]).length>0).map(e=>({providerRef:e.providerRef,envVarNames:(e.missingRegistration??[]).map(e=>e.envVarName)})),[d]),be=(0,Q.useMemo)(()=>M.find(e=>e.providerRef===y),[M,y]),xe=(0,Q.useCallback)(e=>{b(e),O({}),w(``),E(!1),g(null)},[]),Se=(0,Q.useMemo)(()=>be===void 0?[]:xCe(be,e),[e,be]),Ce=Se.length===1?Se[0]:Se.find(e=>e===C),[we,Te]=(0,Q.useState)(null),Ee=Ce!==void 0&&Mt({ownerScope:e,delegation:Ce}),De=(0,Q.useCallback)(async()=>{if(be===void 0||!u||Ce===void 0)return;S(!0),g(null),Te(null);let t=J1({ownerScope:e,ownerId:l,delegation:Ce,signedInUserId:i?._id??null});try{if(be.authMethods?.includes(ur.OAUTH2_AUTHORIZATION_CODE)??!1){let{authorizeUrl:e}=await Tc().startProviderConnection(be.providerRef,{target:t,connectionParameters:D,...Ee?{acknowledgesOrganizationWideUse:T}:{}});window.location.href=e;return}let e=new Set((be.credentialFields??[]).map(e=>e.slug)),n=Object.fromEntries(Object.entries(D).filter(([t,n])=>e.has(t)&&n.trim()!==``)),r=new Set(be.connectionParameters??[]),i=Object.fromEntries(Object.entries(D).filter(([e,t])=>r.has(e)&&t.trim()!==``));await Tc().storeProviderCredential(be.providerRef,{target:t,values:n,...Object.keys(i).length===0?{}:{connectionParameters:i},...Ee?{acknowledgesOrganizationWideUse:T}:{}}),O({}),Te(o(`credentialStoredNotice`)),S(!1),b(``),I()}catch(e){S(!1),di(e)||g(o(`errorGeneric`))}},[D,Ce,Ee,T,l,u,e,I,be,o,i?._id]);if(!n)return null;let Oe=OCe(M,N),ke=be?.authMethods?.includes(ur.OAUTH2_AUTHORIZATION_CODE)??!1,Ae=be?.missingRegistration??[],je=be?.connectionParameters??[],Me=be?.connectionParameterChoices??{},Ne=be?.credentialFields??[],Pe=be?.scopes??[],Fe=[...je,...ke?[]:Ne.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`)})}),we&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:we})}),_&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:o(`catalogueFailed`)})}),h&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:h})}),ue===X1.DISCONNECTED&&(0,$.jsx)(jD,{children:(0,$.jsx)(ND,{children:o(`disconnectedNotice`)})}),ue===X1.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)(CY,{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`)})}),Oe.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:Oe.map(({connectionRef:t,connection:n,catalogueEntry:a})=>{let c=ae(n===void 0?a?.providerRef??t:n.connectionRef),d=n===void 0?void 0:CCe(n),f=n===void 0||d===Y1.SUPERSEDED?void 0:ECe(n,l===null?void 0:gr(ne,{ownerScope:e,ownerId:l},n.connectionRef)),p=oe===t,m=ce===t,h=pe===t,g=a!==void 0&&be?.providerRef===a.providerRef,_=a!==void 0&&!(a.authMethods?.includes(ur.OAUTH2_AUTHORIZATION_CODE)??!1),v=n!==void 0&&_&&d!==Y1.SUPERSEDED;return(0,$.jsx)(`li`,{children:(0,$.jsx)(kF,{children:(0,$.jsxs)(IF,{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)(Nf,{variant:`outline`,children:o(`notConnectedBadge`)}):(0,$.jsx)(Nf,{variant:wCe[d],children:o(TCe[d])})]}),n!==void 0&&(0,$.jsxs)(z1,{children:[n.servesRefs.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`servesLabel`)}),(0,$.jsx)(V1,{children:n.servesRefs.map(ae).join(`, `)})]}),(n.grantedScopes??[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`grantedScopesLabel`)}),(0,$.jsx)(V1,{children:(n.grantedScopes??[]).join(`, `)})]}),n.connectedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`connectedAtLabel`)}),(0,$.jsx)(V1,{children:r(n.connectedAt)})]}),n.validationError!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`lastRefusalLabel`)}),(0,$.jsx)(V1,{children:n.validationError})]}),n.lastValidatedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`lastValidatedAtLabel`)}),(0,$.jsx)(V1,{children:r(n.lastValidatedAt)})]}),n.lastUsedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`lastUsedAtLabel`)}),(0,$.jsx)(V1,{children:r(n.lastUsedAt)})]}),n.linkedByUserId!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B1,{children:o(`linkedByLabel`)}),(0,$.jsx)(V1,{children:n.linkedByUserName??n.linkedByUserId})]})]}),n!==void 0&&d!==Y1.SUPERSEDED&&ee&&(0,$.jsx)(ICe,{connection:n,descriptionMaxLength:vCe[e],label:c,t:o,tWith:s,translateProvider:ie,onSaveDescription:_e,onRemove:ve}),e===hi.ORGANIZATION&&l!==null&&(a?.vendorRegistrationOwnerScopes??[]).includes(hi.ORGANIZATION)&&(0,$.jsx)(FCe,{providerRef:a.providerRef,organizationId:l,label:c,t:o,tWith:s}),n!==void 0&&d===Y1.SUPERSEDED&&n.supersededByConnectionRef!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`supersededNotice`,{connection:ae(n.supersededByConnectionRef)})}),n!==void 0&&!n.enabled&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`disabledNotice`)}),d===Y1.NEEDS_REAUTHORIZATION&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`needsReauthorizationNotice`)}),n!==void 0&&f!==void 0&&(0,$.jsx)(jCe,{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:Gd.SM,variant:Y.GHOST,disabled:m,onClick:()=>se(null),children:o(`disconnectCancelButton`)}),(0,$.jsx)(X,{size:Gd.SM,variant:Y.DESTRUCTIVE,"aria-label":s(`disconnectConfirmAccessibleName`,{provider:c}),disabled:m,onClick:()=>{fe(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:Gd.SM,variant:Y.DEFAULT,"aria-label":s(`connectAccessibleName`,{provider:c}),onClick:()=>xe(a.providerRef),children:o(`connectButton`)}),a!==void 0&&!g&&v&&(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,"aria-label":s(`replaceCredentialAccessibleName`,{provider:c}),onClick:()=>xe(a.providerRef),children:o(`replaceCredentialButton`)}),a!==void 0&&!g&&d===Y1.NEEDS_REAUTHORIZATION&&!v&&(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,"aria-label":s(`reconnectAccessibleName`,{provider:c}),onClick:()=>xe(a.providerRef),children:o(`reconnectButton`)}),n!==void 0&&d!==Y1.SUPERSEDED&&ee&&(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,"aria-label":s(n.enabled?`disableAccessibleName`:`enableAccessibleName`,{provider:c}),disabled:h||ce!==null,onClick:()=>{he(n,!n.enabled)},children:o(n.enabled?`disableButton`:`enableButton`)}),n!==void 0&&(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,"aria-label":s(`disconnectAccessibleName`,{provider:c}),disabled:ce!==null,onClick:()=>{se(t),de(null)},children:o(`disconnectButton`)})]}),g&&be!==void 0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,children:[(be.servesRefs??[]).length>1&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`servesLabel`),` `,(be.servesRefs??[]).map(ae).join(`, `)]}),!ke&&Ae.length===0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`pastedCredentialNotice`)}),Se.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)(_F,{name:`delegation`,schema:G1,options:Se.map(e=>({value:e,label:o(e===Hr.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:C,placeholder:o(`delegationPlaceholder`),onChange:e=>{w(e),E(!1)}})]}),ke&&Pe.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`scopesPrefix`),` `,SCe(Pe,D,o(`scopeChosenBelow`)).join(`, `)]}),(je.length>0||!ke&&Ne.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`)})]}),[...ke||be===void 0?[]:Ne.map(e=>({key:e.slug,label:Z1(be.providerRef,e.slug,Sd.LABEL,ie),description:Z1(be.providerRef,e.slug,Sd.DESCRIPTION,ie),choices:void 0,secret:!0})),...be===void 0?[]:je.map(e=>({key:e,label:Q1(be.providerRef,e,Sd.LABEL,ie),description:Q1(be.providerRef,e,Sd.DESCRIPTION,ie),choices:Me[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)(_F,{name:e.key,schema:yCe,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===Xie.ORIGIN?`https://*${t}`:`*${t}`)].join(`, `)]}),(0,$.jsx)(tN,{"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)),Ee&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(DI,{name:`organizationWideUseAcknowledged`,schema:K1,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:Gd.SM,variant:Y.GHOST,disabled:x,onClick:()=>xe(``),children:o(`connectCancelButton`)}),(0,$.jsx)(X,{size:Gd.SM,variant:Y.DEFAULT,disabled:x||!u||be.notConnectableBecause!==void 0&&be.notConnectableBecause!==Gee.NO_AUTHORIZATION_FLOW||Fe||Ce===void 0||Ee&&!T,onClick:De,children:o(x?`connectingButton`:`connectButton`)})]})]})]})})},t)})})]})]}),B.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:B.map(e=>(0,$.jsxs)(`li`,{className:`text-xs`,children:[ae(e.providerRef),`: `,e.envVarNames.join(`, `)]},e.providerRef))})]})})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(ye)})]})},t0=U.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,n0;(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`})(n0||={});var LCe=[n0.LAST_30_DAYS,n0.LAST_90_DAYS,n0.LAST_365_DAYS],RCe=Object.values(co);function r0(e){return`groupBy_${e}`}function i0(e){return`window_${e}`}function zCe(e,t){switch(t){case co.AGENT:return e.key.agentRef;case co.TOOL:return e.key.toolName;case co.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType}:${e.key.caseRef.resourceId}`:void 0;case co.DECIDER:return e.key.deciderUserId}}function BCe(e,t){return e===null?null:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}var VCe=()=>{let{tComponent:e,isReady:t,currentLanguage:n}=J({component:t0}),{currentOrganizationId:r}=ag(),i=(0,Q.useCallback)(t=>e(t0,t),[e]),[a,o]=(0,Q.useState)(co.AGENT),[s,c]=(0,Q.useState)(n0.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),Tc().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:RCe.map(e=>(0,$.jsx)(uO,{value:e,"data-ref":e,children:i(r0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:LCe.map(e=>(0,$.jsx)(X,{size:Gd.SM,variant:e===s?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(i0(e))},e))})]}),p&&(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:p})}),!(p&&h.length===0)&&(0,$.jsx)(kF,{children:(0,$.jsx)(IF,{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)(gJ,{children:[(0,$.jsx)(_J,{children:(0,$.jsxs)(yJ,{children:[(0,$.jsx)(bJ,{children:i(r0(a))}),(0,$.jsx)(bJ,{children:i(`columnAccepted`)}),(0,$.jsx)(bJ,{children:i(`columnAcceptedWithModifications`)}),(0,$.jsx)(bJ,{children:i(`columnRejected`)}),(0,$.jsx)(bJ,{children:i(`columnNotDecided`)}),(0,$.jsx)(bJ,{children:i(`columnOverrideRate`)})]})}),(0,$.jsx)(vJ,{children:h.map((e,t)=>{let r=zCe(e,a),o=BCe(e.overrideRate,n);return(0,$.jsxs)(yJ,{children:[(0,$.jsx)(xJ,{children:r??i(`unattributed`)}),(0,$.jsx)(xJ,{children:e.accepted}),(0,$.jsx)(xJ,{children:e.acceptedWithModifications}),(0,$.jsx)(xJ,{children:e.rejected}),(0,$.jsx)(xJ,{children:e.notDecided}),(0,$.jsx)(xJ,{children:o??i(`nothingDecided`)})]},r??`unattributed-${t}`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})})})]}):null},a0=U.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,o0=mo(pt.shape.status),s0=mo(pt.shape.autonomousTrigger);function HCe(e){return`reason_${e}`}function UCe(e){return`concurrency_${e}`}function WCe(e){if(e.caseLimit!==void 0&&e.matchedCaseCount!==void 0)return{matched:e.matchedCaseCount,limit:e.caseLimit}}var c0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(c0||={});var GCe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=J({component:a0,keys:[`system_enums`]}),{currentOrganizationId:i}=ag(),a=(0,Q.useCallback)((t,n)=>e(a0,t,n),[e]),o=(0,Q.useCallback)((e,n)=>{if(!e)return n;let r=hl(e,n),i=t(r);return i===r?n:i},[t]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(c0.LOADING);if((0,Q.useEffect)(()=>{if(!i)return;let e=!1;return u(c0.LOADING),Tc().readAutonomousAgentsOverview(i).then(t=>{e||(c(t),u(c0.READY))}).catch(()=>{e||u(c0.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===c0.FAILED?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:a(`errorGeneric`)})}):l===c0.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)(KCe,{agent:e,scannedSince:m,tc:a,word:o,formatDateTime:r},e.ref)),p.map(e=>(0,$.jsx)(kF,{"data-autonomous-agent-undeclared":e.autonomousAgentRef,children:(0,$.jsxs)(IF,{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)(u0,{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 l0(e,t){return e?e.organizationRelationshipId===null?t(`partyOwn`):e.representingOrganizationName??t(`partyUnnamedRelationship`):null}function KCe({agent:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){let a=l_(o0??``)?.values;return(0,$.jsx)(kF,{"data-autonomous-agent":e.ref,children:(0,$.jsxs)(IF,{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(UCe(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)(gJ,{children:[(0,$.jsx)(_J,{children:(0,$.jsxs)(yJ,{children:[(0,$.jsx)(bJ,{children:n(`columnStatus`)}),(0,$.jsx)(bJ,{children:n(`columnParty`)}),(0,$.jsx)(bJ,{children:n(`columnTrigger`)}),(0,$.jsx)(bJ,{children:n(`columnCase`)}),(0,$.jsx)(bJ,{children:n(`columnStarted`)}),(0,$.jsx)(bJ,{children:n(`columnFinished`)})]})}),(0,$.jsx)(vJ,{children:e.recentRuns.map(e=>(0,$.jsxs)(yJ,{"data-autonomous-run":e.executionId,children:[(0,$.jsx)(xJ,{children:(0,$.jsx)(Nf,{variant:a?.[e.status]?.color??`outline`,dot:!0,children:r(o0,e.status)})}),(0,$.jsx)(xJ,{"data-autonomous-party":!0,children:l0(e.party,n)}),(0,$.jsx)(xJ,{children:e.trigger?r(s0,e.trigger):null}),(0,$.jsx)(xJ,{className:`font-mono`,children:e.caseRef?.resourceId??null}),(0,$.jsx)(xJ,{children:i(e.createdAt)}),(0,$.jsx)(xJ,{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)(u0,{refusals:e.recentRefusals,scannedSince:t,tc:n,word:r,formatDateTime:i})]})})}function u0({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)(gJ,{children:[(0,$.jsx)(_J,{children:(0,$.jsxs)(yJ,{children:[(0,$.jsx)(bJ,{children:n(`columnRefusedAt`)}),(0,$.jsx)(bJ,{children:n(`columnParty`)}),(0,$.jsx)(bJ,{children:n(`columnTrigger`)}),(0,$.jsx)(bJ,{children:n(`columnReason`)})]})}),(0,$.jsx)(vJ,{children:e.map(e=>(0,$.jsxs)(yJ,{"data-autonomous-refusal":e.reason,children:[(0,$.jsx)(xJ,{children:i(e.refusedAt)}),(0,$.jsx)(xJ,{"data-autonomous-party":!0,children:l0(e.party,n)}),(0,$.jsx)(xJ,{children:r(s0,e.trigger)}),(0,$.jsx)(xJ,{children:n(HCe(e.reason),WCe(e))})]},`${e.occurrenceKey}:${e.refusedAt}:${e.party?e.party.organizationRelationshipId??`own`:`unknown`}`))})]})]})}function d0(e,t,n){let r=Na(t);if(r!==void 0)return n(Tl(BigInt(e),r),{style:`currency`,currency:t,minimumFractionDigits:r,maximumFractionDigits:r})}var f0=U.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,p0;(function(e){e.APPLICATION=`application`,e.REPRESENTING_ORGANIZATION=`representing-organization`})(p0||={});var m0;(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`})(m0||={});var qCe=[m0.LAST_30_DAYS,m0.LAST_90_DAYS,m0.LAST_365_DAYS],JCe=Object.values(Gt),h0;(function(e){e.GENERIC=`generic`,e.ACCESS_GRANT_REQUIRED=`accessGrantRequired`})(h0||={});function YCe(e){return e===h0.ACCESS_GRANT_REQUIRED?`errorAccessGrantRequired`:`errorGeneric`}function g0(e){return`groupBy_${e}`}function XCe(e){return`window_${e}`}function ZCe(e){return`decisionTime_${e}`}function QCe(e,t){switch(t){case Gt.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType} · ${e.key.caseRef.resourceId}`:void 0;case Gt.ORGANIZATION:return e.key.organizationId;case Gt.AGENT:return e.key.agentRef;case Gt.MODEL:return e.key.model?[e.key.provider,e.key.model].filter(Boolean).join(` · `):void 0}}function $Ce(e){if(e.availability===_te.JOINED)return{decisions:e.decisionCount??0,minutes:Math.round((e.reviewDurationMs??0)/6e4)}}var _0=({scope:e})=>{let{tComponent:t,isReady:n,formatNumber:r}=J({component:f0}),i=(0,Q.useCallback)((e,n)=>t(f0,e,n),[t]),{currentOrganizationId:a}=ag(),o=e===p0.REPRESENTING_ORGANIZATION?a??void 0:void 0,s=e===p0.REPRESENTING_ORGANIZATION&&!o,[c,l]=(0,Q.useState)(Gt.CASE),[u,d]=(0,Q.useState)(m0.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),Tc().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||(Ir(t)&&t.customMessageReference===rs.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?_(h0.ACCESS_GRANT_REQUIRED):_(h0.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=d0(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===p0.REPRESENTING_ORGANIZATION?`representingPageTitle`:`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(e===p0.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:JCe.map(e=>(0,$.jsx)(uO,{value:e,"data-ref":e,children:i(g0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:qCe.map(e=>(0,$.jsx)(X,{size:Gd.SM,variant:e===u?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===u,onClick:()=>d(e),children:i(XCe(e))},e))})]}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)}):g?(0,$.jsx)(jD,{variant:g===h0.ACCESS_GRANT_REQUIRED?`default`:`destructive`,children:(0,$.jsx)(ND,{children:i(YCe(g))})}):(0,$.jsx)(kF,{children:(0,$.jsxs)(IF,{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)(gJ,{children:[(0,$.jsx)(_J,{children:(0,$.jsxs)(yJ,{children:[(0,$.jsx)(bJ,{children:i(g0(c))}),(0,$.jsx)(bJ,{children:i(`columnCost`)}),(0,$.jsx)(bJ,{children:i(`columnCalls`)}),(0,$.jsx)(bJ,{children:i(`columnUnpriced`)}),(0,$.jsx)(bJ,{children:i(`columnTokens`)}),(0,$.jsx)(bJ,{children:i(`columnClassifierCalls`)}),(0,$.jsx)(bJ,{children:i(`columnDocumentExtractionCalls`)}),(0,$.jsx)(bJ,{children:i(`columnPersonalDataWithheld`)}),c===Gt.CASE?(0,$.jsx)(bJ,{children:i(`columnDecisionTime`)}):null]})}),(0,$.jsx)(vJ,{children:y.map((e,t)=>{let n=QCe(e,c);return(0,$.jsxs)(yJ,{"data-model-cost-group":n??`unattributed`,children:[(0,$.jsx)(xJ,{className:n?`font-mono`:`text-muted-foreground`,children:n??i(`unattributed`)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:x(e)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.callCount)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.unpricedCallCount)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(S(e))}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.classifierCallCount)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.documentExtractionCallCount)}),(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.personalDataFieldsWithheld)}),c===Gt.CASE?(0,$.jsx)(xJ,{children:e.decisionTime?i(ZCe(e.decisionTime.availability),$Ce(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]})})]})},v0=U.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,y0;(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`})(y0||={});var ewe=[y0.LAST_7_DAYS,y0.LAST_30_DAYS,y0.LAST_365_DAYS];function twe(e){return`window_${e}`}function b0(e){return`disclosure_${e}`}function nwe(e){return`outcome_${e}`}function rwe(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 iwe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=J({component:v0}),i=(0,Q.useCallback)((t,n)=>e(v0,t,n),[e]),{currentOrganizationId:a}=ag(),o=a??void 0,[s,c]=(0,Q.useState)(y0.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=>Tc().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=hl(yie.CORE_AUDITABLE_EVENT_TYPE,e),r=t(n);return r===n?ps(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:ewe.map(e=>(0,$.jsx)(X,{size:Gd.SM,variant:e===s?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(twe(e))},e))}),o?p?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:i(`errorGeneric`)})}):(0,$.jsx)(kF,{children:(0,$.jsxs)(IF,{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)(gJ,{children:[(0,$.jsx)(_J,{children:(0,$.jsxs)(yJ,{children:[(0,$.jsx)(bJ,{children:i(`columnWhen`)}),(0,$.jsx)(bJ,{children:i(`columnOrganization`)}),(0,$.jsx)(bJ,{children:i(`columnPerson`)}),(0,$.jsx)(bJ,{children:i(`columnEvent`)}),(0,$.jsx)(bJ,{children:i(`columnTarget`)}),(0,$.jsx)(bJ,{children:i(`columnOutcome`)}),(0,$.jsx)(bJ,{children:i(`columnDetail`)})]})}),(0,$.jsx)(vJ,{children:S.map(e=>{let t=rwe(e),n=_===e.eventId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(yJ,{"data-representative-activity-row":e.eventId,"data-disclosure":e.disclosure,children:[(0,$.jsx)(xJ,{className:`tabular-nums`,children:r(e.createdAt)}),(0,$.jsx)(xJ,{className:e.grantingOrganizationName?void 0:`font-mono`,children:e.grantingOrganizationName??e.grantingOrganizationId}),(0,$.jsx)(xJ,{className:e.userName?void 0:e.userId?`font-mono`:`text-muted-foreground`,children:e.userName??e.userId??e.agentRef??i(`automatedActor`)}),(0,$.jsx)(xJ,{children:C(e.eventType)}),(0,$.jsx)(xJ,{className:`font-mono`,children:t??null}),(0,$.jsx)(xJ,{className:e.outcome===Uie.FAILURE?`text-destructive`:void 0,children:i(nwe(e.outcome))}),(0,$.jsx)(xJ,{children:e.disclosure===is.FULL?(0,$.jsx)(X,{size:Gd.SM,variant:Y.OUTLINE,"aria-expanded":n,onClick:()=>v(n?null:e.eventId),children:i(n?`hideDetail`:b0(is.FULL))}):(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(b0(is.METADATA))})})]}),n&&e.eventData?(0,$.jsx)(yJ,{children:(0,$.jsx)(xJ,{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:Gd.SM,variant:Y.OUTLINE,disabled:d,onClick:b,children:i(`loadMore`)})}):null]})}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})]})},x0=U.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,S0=864e5,awe=n0.LAST_365_DAYS,owe=[n0.LAST_30_DAYS,n0.LAST_90_DAYS,n0.LAST_365_DAYS],swe=Kne.shape.destination.maxLength??void 0,cwe=gd().min(1);function lwe(e,t){return`evaluation-dataset-${e}-${t}.jsonl`}function uwe(e,t){let n=e.resourceConfigurations[gu.EVALUATION_EXPORT_AUTHORIZATIONS],r=n?.operations.find(e=>e.operationIdentifier===K.READ&&e.isOperationDefault===!0&&e.variantType===E.API_CALL);if(!n||!r)return;let i=nm.buildResourceOperationContextIdentifiers({currentOrganizationId:t,primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}});return{operationPathKey:wi.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e)}}var dwe=()=>{let{tComponent:e,isReady:t}=J({component:x0}),{currentOrganizationId:n}=ag(),{registry:r,doOperation:i}=pm(),a=(0,Q.useCallback)(t=>e(x0,t),[e]),o=(0,Q.useCallback)((t,n)=>e(x0,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)(n0.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=uwe(r,n);if(e===void 0)return;let t=!1;return i(e.operationPathKey,{contextualParameters:e.contextualParameters},{silent:!0,riskLevel:Ac.LOW}).then(e=>{t||T(e?.status===nre.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),Tc().summarizeAgentWorkOverrideRate({from:new Date(t.getTime()-awe*S0).toISOString(),to:t.toISOString(),groupBy:co.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 Tc().exportEvaluationDataset({organizationId:n,agentRef:f,from:new Date(e.getTime()-m*S0).toISOString(),to:e.toISOString(),destination:g.trim()});Fy(new Blob([t.jsonl],{type:`application/x-ndjson`}),lwe(f,t.exportId)),x({exportId:t.exportId,recordCount:t.recordCount})}catch(e){di(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)(kF,{children:(0,$.jsx)(IF,{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)(_F,{name:`agentRef`,schema:cwe,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:owe.map(e=>(0,$.jsx)(X,{size:Gd.SM,variant:e===m?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===m,onClick:()=>h(e),children:a(i0(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)(tN,{"aria-label":a(`destinationLabel`),type:`text`,maxLength:swe,value:g,onChange:e=>_(e.target.value)})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Gd.SM,variant:Y.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},C0=new Set;function w0(e){let{resolvedFeatures:t,resolvedFeaturesResponse:n,featureDefinitions:r,unavailabilityPolicy:i,isLoading:a}=yh(),{permissions:o}=ag(),{track:s,isActive:c}=f$(),l=Bh(),u=Qp(),d=(0,Q.useMemo)(()=>{if(a)return{isAvailable:!0,behavior:Qs.DISABLE};let s=r.get(e);if(!s){let{behavior:t,debugTrace:n}=$h({reason:Is.NOT_CONFIGURED,featureDef:void 0,policy:i,userRoles:[],billingEnabled:l?.isEnabled??!1});return{isAvailable:!1,reason:Is.NOT_CONFIGURED,behavior:t,missingFeatures:[e],debugTrace:bi.isDevelopment()?n:void 0}}let c=jh(o,u?.currentOrganizationId??null);if(s.valueType===xo.BOOLEAN){if(new Set(t.features).has(e))return{isAvailable:!0,behavior:Qs.DISABLE};let r=Is.FEATURE_NOT_ENABLED,{behavior:a,suggestedProductRef:o,customComponentRef:u,debugTrace:d}=$h({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:bi.isDevelopment()?d:void 0}}if(s.valueType===xo.LIMIT){let r=t.limits[e];if(r===void 0||r===-1)return{isAvailable:!0,behavior:Qs.DISABLE};let a=t.currentUsage[e]??0;if(a<r)return{isAvailable:!0,behavior:Qs.DISABLE};let o=Is.LIMIT_EXCEEDED,{behavior:u,suggestedProductRef:d,customComponentRef:f,debugTrace:p}=$h({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:bi.isDevelopment()?p:void 0}}return{isAvailable:!0,behavior:Qs.DISABLE}},[e,a,t,n,r,i,o,u?.currentOrganizationId,l?.isEnabled]);return(0,Q.useEffect)(()=>{if(!c)return;let t=`${e}:${d.isAvailable}`;C0.has(t)||(C0.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 T0({featureId:e,children:t,renderUnavailable:n}){let r=w0(e),i=wh();return r.isAvailable?(0,$.jsx)($.Fragment,{children:t}):r.behavior===Qs.HIDE?null:n?(0,$.jsx)($.Fragment,{children:n(r)}):(0,$.jsx)(Lh,{behavior:r.behavior,missingFeatures:r.missingFeatures,limitInfo:r.limitInfo,upgradeOptionsCount:r.upgradeOptions?.length,customComponentRef:r.customComponentRef,onDismiss:void 0,onAction:()=>i(r)})}function fwe(e,t){switch(t.type){case`push`:return[...e,{id:Um.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 pwe(e){return{navigate:t=>{Um.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 mwe({rootContext:e}){let t=xS(),[n,r]=(0,Q.useReducer)(fwe,e,e=>[{id:Um.generateStackEntryId(),context:e}]),i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useMemo)(()=>pwe({dispatch:r,getDepth:()=>i.current.length,globalController:t}),[t]),o=n[n.length-1];return(0,$.jsx)(bS.Provider,{value:a,children:(0,$.jsx)(UY,{resourceContext:o.context,navigationZone:Vn.OVERLAY,navigationInitiator:{sourceZone:Vn.OVERLAY}},o.id)})}function hwe(e,t,n,r){return t!==Sr.APPLICATION||!r||e[gu.ORGANIZATIONS]!==void 0?e:(n.initiatorInfos??[]).some(e=>e.parameters?.some(e=>e.resourceType===gu.ORGANIZATIONS))?{...e,[gu.ORGANIZATIONS]:r}:e}function gwe(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 _we({message:e}){return(0,$.jsx)(`div`,{className:`p-card text-sm text-muted-foreground`,children:e})}function vwe({resourceType:e,operation:t,operationVariant:n}){let{registry:r}=pm(),i=Qp(),a=(0,Q.useContext)(ea)?.appIdentity?.applicationId??i?.currentApplicationId??null,o=(0,Q.useMemo)(()=>{let o=r.resourceConfigurations[e];if(!o)return;let s=gwe(o,t,n);if(!s)return;let c=hwe(nm.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=Tx(o,r.allResourceFieldIdentifiers)&&jo(s)&&c[e]===void 0?c[gu.USERS]:void 0,u=typeof l==`string`?{...c,[e]:l}:c,d=En.buildParentResourcesRequirements(e,u,r);return En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:s,contextResourceIdentifiers:u,parentResourcesRequirements:d})},[r,e,t,n,i,a]);if(!o)return(0,$.jsx)(_we,{message:`Settings surface unavailable for ${e} (${t}).`});let s=[e,t,n??``,i?.currentOrganizationId??``,i?.currentUserId??``,a??``].join(`|`);return(0,$.jsx)(mwe,{rootContext:o},s)}function ywe(e){return[...e.categories].sort((e,t)=>(e.order??0)-(t.order??0))}function bwe(e,t){return e.sections.filter(e=>e.categoryRef===t).sort((e,t)=>(e.order??0)-(t.order??0))}function xwe(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 Swe(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 Cwe({panelRef:e}){switch(e){case uv.SECURITY:return(0,$.jsx)($Se,{});case uv.APPEARANCE:return(0,$.jsx)(cCe,{});case uv.INVITATIONS:return(0,$.jsx)(dCe,{});case uv.BILLING:return(0,$.jsx)(mCe,{});case uv.CONNECTED_ACCOUNTS:return(0,$.jsx)(e0,{ownerScope:hi.USER});case uv.ORGANIZATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(e0,{ownerScope:hi.ORGANIZATION});case uv.APPLICATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(e0,{ownerScope:hi.APPLICATION});case uv.AGENT_WORK_OVERRIDE_RATE:return(0,$.jsx)(VCe,{});case uv.AUTONOMOUS_AGENTS:return(0,$.jsx)(GCe,{});case uv.MODEL_COST_BREAKDOWN:return(0,$.jsx)(_0,{scope:p0.APPLICATION});case uv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN:return(0,$.jsx)(_0,{scope:p0.REPRESENTING_ORGANIZATION});case uv.REPRESENTATIVE_ACTIVITY:return(0,$.jsx)(iwe,{});case uv.AGENT_WORK_EVALUATION_EXPORT:return(0,$.jsx)(dwe,{})}}function E0({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){switch(e.kind){case lv.ENGINE_PANEL:return(0,$.jsx)(Cwe,{panelRef:e.panelRef});case lv.CUSTOM_COMPONENT:{let t=Xo.resolve(e.componentRef,G.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)(ol,{componentType:e.componentRef,componentName:e.componentRef})}case lv.RESOURCE_OPERATION:return(0,$.jsx)(vwe,{resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant});case lv.SUB_TABS:return(0,$.jsx)(wwe,{target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r})}}function wwe({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)(E0,{target:e.target,resolveSubTabLabel:t})},e.ref))]})}var Twe=`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 Ewe({sectionRef:e,subTabRef:t}){let n=N$(),r=(0,Q.useMemo)(()=>ywe(n),[n]),i=(0,Q.useMemo)(()=>Swe(n,e),[n,e]),a=oh(),o=(0,Q.useCallback)(e=>{i&&a(`${Pa.settings}/${i}/${e}`,{replace:!0})},[i,a]),{UIConfig:c,getRecipe:l}=Ig(),u=l(_t.SELECTABLE,s.FILLED),d=l(_t.TYPOGRAPHY,ii.EYEBROW),f=l(_t.TYPOGRAPHY,ii.LABEL),{renderIcon:p}=kf(),m=c?.currentBreakpoint===yi.MOBILE,h=m&&!!e,g=(0,Q.useCallback)(()=>{a(Pa.settings,{replace:!0})},[a]),{tComponent:_,tSettingsHubCategory:v,tSettingsHubGroup:y,tSettingsHubSection:b,isReady:x}=J({component:U.APP_LAYOUTS_SETTINGS_HUB}),S=(0,Q.useCallback)(e=>_(U.APP_LAYOUTS_SETTINGS_HUB,e),[_]),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)(eb,{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:[h&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.ICON_SM,"aria-label":S(`backToSections`),onClick:g,children:p(H.BACK,{size:Jn.SM})}),(0,$.jsx)(`h2`,{className:`truncate text-base font-semibold tracking-tight`,children:h?C??S(`title`):S(`title`)})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsx)(`nav`,{"aria-label":S(`sectionsNavLabel`),className:W(`overflow-y-auto px-card-sm py-card`,m?`w-full flex-1`:`w-60 shrink-0 border-e`,h&&`hidden`),children:r.map((e,t)=>{let r=bwe(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)(w1,{className:`my-item`}),(0,$.jsx)(`div`,{id:a,className:W(`px-card-sm py-card-sm`,d.base),children:v(e.ref,e.label)}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,children:xwe(e,r).map(t=>(0,$.jsxs)(Q.Fragment,{children:[t.group&&(0,$.jsx)(`div`,{id:`${a}-group-${t.group.ref}`,className:W(`px-card-sm pt-card-sm pb-item-xs text-muted-foreground`,f.base),children:y(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)(xh,{ref:t?w:void 0,to:`${Pa.settings}/${e.ref}`,replace:!0,"data-ref":e.ref,"aria-current":t?`page`:void 0,"data-state":t?`active`:`inactive`,className:W(Twe,u.base,u.states.focus,u.states.selected,u.motion.transition),children:[e.icon&&p(e.icon,{size:Jn.SM}),b(e.ref,e.label)]},e.ref)})})]},t.group?.ref??`__ungrouped`))})]},e.ref)})}),(0,$.jsx)(`div`,{className:W(`min-w-0 flex-1 overflow-y-auto p-card-lg`,m&&!h&&`hidden`),children:n.sections.filter(e=>e.ref===i).map(e=>(0,$.jsx)(Q.Fragment,{children:e.entitlementFeatureId?(0,$.jsx)(Dwe,{featureId:e.entitlementFeatureId,keptConfigurationNotice:S(`entitlementLapsedConfigurationKept`),children:(0,$.jsx)(E0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})}):(0,$.jsx)(E0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})},e.ref))})]})]})})}function Dwe({featureId:e,keptConfigurationNotice:t,children:n}){let r=w0(e),i=!r.isAvailable&&r.behavior!==Qs.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)(T0,{featureId:e,children:null}),n]}):(0,$.jsx)(`div`,{className:`space-y-card`,children:(0,$.jsx)(T0,{featureId:e,children:n})})}function Owe(e){return e.requested===null||e.isMobile?null:e.requested===so.SECONDARY?e.secondaryShown&&e.secondaryHasContent?so.SECONDARY:null:e.requested===so.COMPANION&&e.companionShown&&e.companionHasContent?so.COMPANION:null}function kwe(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 Awe(e){let{homeCompositeViewRef:t,isAppRootPath:n,primaryStackTop:r}=e;if(n&&t&&!(r&&r.contentType!==va.ENGINE_PAGE))return{contentType:va.COMPOSITE_VIEW,viewRef:t}}function jwe(e){let{primaryContent:t,compositeViews:n}=e;return t?t.contentType===va.COMPOSITE_VIEW?n?.some(e=>e.ref===t.viewRef)??!1:!0:!1}function D0(e){let{primaryContent:t,compositeViews:n,resolveExecutionView:r}=e;if(t){if(t.contentType===va.RESOURCE_OPERATION)return t.resourceContext?.operation?.operationFrontendConfig;if(t.contentType===va.COMPOSITE_VIEW)return n?.find(e=>e.ref===t.viewRef);if(t.contentType===va.EXECUTION_VIEW)return r?.(t.viewRef)}}function O0({zone:e,zones:t,destinationOverride:n}){return e===so.PRIMARY?fs.COLLAPSE:n??t?.[e]?.onEmpty??fs.COLLAPSE}function k0(e){return e===fs.EMPTY_STATE}function A0(e){return e.hasContent&&!k0(e.behavior)}function Mwe(e){return D0(e)?.adjacentZoneOnEmpty}var j0={maxWidth:`content`,fillsHeight:!1};function Nwe(e){let t=D0(e);return{maxWidth:t?.zoneContentMaxWidth??j0.maxWidth,fillsHeight:t?.zoneContentFillsHeight??j0.fillsHeight}}function M0(e){return{maxWidth:D0({primaryContent:e.zoneContent,compositeViews:e.compositeViews,resolveExecutionView:e.resolveExecutionView})?.zoneContentMaxWidth??j0.maxWidth,fillsHeight:!1}}function Pwe(e,t){return e.maxWidth===j0.maxWidth?t:{...t,geometry:{responsiveMaxWidth:e.maxWidth}}}function Fwe(e){return e.fillsHeight?`flex h-full min-h-0 flex-col`:void 0}var Iwe=Q.lazy(()=>s_(()=>import(`./ChartView-B6f1J6Er.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),N0=il.getLogger(),P0=N0.debugByType(`NavigationContentAreas`);N0.setDebugTypeLogging(`NavigationContentAreas`,!1);var Lwe={[Ul.HOME]:ZU,[Ul.DECISIONS]:XW},Rwe=`no-entry`;function F0(e,t){let n=t||Rwe,r=e=>Object.entries(e??{}).map(([e,t])=>`${e}:${t}`).join(`|`);switch(e.contentType){case va.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 va.COMPOSITE_VIEW:case va.CHART_VIEW:case va.FULL_CUSTOM_VIEW:case va.FLOWS_ACTORS_VIEW:case va.EXECUTION_VIEW:return`${e.contentType}-${e.viewRef}-${e.contentType===va.CHART_VIEW?e.runtimeDescriptor?.identity.insertedViewRef??``:``}-${r(e.contextResourceIdentifiers)}-${e.contentType===va.CHART_VIEW?r(e.urlParamValues):``}-${n}`;case va.CUSTOM_COMPONENT:return`${e.contentType}-${e.componentRef}-${r(e.contextResourceIdentifiers)}-${n}`;case va.ENGINE_PAGE:return`${e.contentType}-${e.pageRef}-${n}`;case va.INLINE_CREATE:return`${e.contentType}-${e.resourceContext.resourceType}-${e.resourceContext.operationIdentifier}-${n}`;case va.ERROR_MODAL:return`${e.contentType}-${e.errorType}-${n}`;case va.SETTINGS_HUB:return e.contentType;default:return`unknown-${e.contentType}-${n}`}}var I0=({content:e,zone:t,initiator:n,entryId:r})=>{let{tComponent:i,isReady:a}=J({component:U.HIGH_LEVEL_VIEWS_CHART}),{registry:o}=pm(),s=F0(e,r);if(P0(`Rendering content`,{contentType:e.contentType,zone:t,contentKey:s}),e.contentType===va.RESOURCE_OPERATION)return(0,$.jsx)(UY,{resourceContext:e.resourceContext,navigationZone:t,navigationInitiator:n},s);if(e.contentType===va.COMPOSITE_VIEW)return(0,$.jsx)(GU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n},s);if(e.contentType===va.CHART_VIEW){if(!a)return null;let t=e.runtimeDescriptor?.chartDefinition.requiredFeatures??e.viewDefinition?.chartDefinition.requiredFeatures??e.requiredFeatures??Np({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(U.HIGH_LEVEL_VIEWS_CHART,`loading`)})}),children:(0,$.jsx)(Wh,{requiredFeatures:t,children:(0,$.jsx)(Iwe,{viewRef:e.viewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor})})},s)}if(e.contentType===va.FULL_CUSTOM_VIEW)return(0,$.jsx)(iQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===va.FLOWS_ACTORS_VIEW)return(0,$.jsx)(PQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers},s);if(e.contentType===va.EXECUTION_VIEW)return(0,$.jsx)(QY,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===va.CUSTOM_COMPONENT){let t=Xo.resolve(e.componentRef,G.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)(ol,{componentType:e.componentRef,componentName:e.componentRef})}if(e.contentType===va.ENGINE_PAGE){let t=Lwe[e.pageRef];return t?(0,$.jsx)(t,{},s):(0,$.jsx)(ol,{componentType:String(e.pageRef),componentName:String(e.pageRef)},s)}if(e.contentType===va.SETTINGS_HUB)return(0,$.jsx)(Ewe,{sectionRef:e.sectionRef,subTabRef:e.subTabRef},s);if(e.contentType===va.INLINE_CREATE){let r={...e.resourceContext,additionalContext:{...e.resourceContext.additionalContext,defaultValuesOverride:e.defaultValues}};return(0,$.jsx)(UY,{resourceContext:r,navigationZone:t,navigationInitiator:n},s)}return e.contentType===va.ERROR_MODAL?(0,$.jsx)(kSe,{wildoError:e.wildoError},s):null};function L0(e,t){let n=`${e}-${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`;return{tabId:`nav-zone-tab-${n}`,panelId:`nav-zone-tabpanel-${n}`}}var zwe=({zone:e,entry:t})=>{let{title:n}=J$(t,{keepOperationTitle:!0}),{tabId:r,panelId:i}=L0(e,t.id);return(0,$.jsx)(uO,{value:t.id,id:r,"aria-controls":i,children:n})},Bwe=({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)(zwe,{zone:e,entry:t},t.id))})}),R0=({zone:e,fallback:t,emptyState:n})=>{let{getTopEntry:r,getZoneState:i,setActiveTab:a}=Mx(),{navigationLayout:o}=Ig(),s=OSe(),c=r(e),l=i(e),u=o?.zones?.[e]?.contentModel===Fa.TABBED,d=Kh(l.stack,o?.zones?.[e]?.contentModel,l.activeTabId);P0(`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?(P0(`ZoneContentRenderer → rendering persistent stack`,{zone:e,stackDepth:f.length}),(0,$.jsxs)($.Fragment,{children:[u&&f.length>0&&(0,$.jsx)(Bwe,{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}=L0(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)(Zy,{})}):(0,$.jsx)(I0,{content:t.content,zone:t.zone,initiator:t.initiator,entryId:t.id})},F0(t.content,t.id))})]})):t?(P0(`ZoneContentRenderer → rendering fallback (routerChildren / Outlet)`,{zone:e}),(0,$.jsx)($.Fragment,{children:t})):n?(P0(`ZoneContentRenderer → rendering empty state (onEmpty: EMPTY_STATE)`,{zone:e}),(0,$.jsx)($.Fragment,{children:n})):(P0(`ZoneContentRenderer → rendering null (no entry, no fallback)`,{zone:e}),null)};function z0(e){return e===Ks.HORIZONTAL?Ks.VERTICAL:Ks.HORIZONTAL}var Vwe=1280,B0=25,V0=B0;function H0(e,t){return Math.round(Math.max(5,Math.min(70,e/t*100)))}function Hwe(e){let[t,n]=(0,Q.useState)(Vwe);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 U0(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),n)}function W0(e){if(!e.isResizable)return{minSize:e.defaultSize,maxSize:e.defaultSize};let t=e.maxWidthPx?H0(e.maxWidthPx,e.containerWidth):75,n=e.minWidthPx?H0(e.minWidthPx,e.containerWidth):Math.min(V0,e.defaultSize);return{minSize:Math.min(n,t),maxSize:t}}var G0=1e-9;function Uwe(e,t){let n=e.map(e=>e.defaultSize),r=e.map(e=>e.frozen?1/0:Math.floor(e.maxSize+G0)),i=e.map((e,t)=>Math.min(Math.ceil((e.frozen?Math.min(V0,e.defaultSize):e.minSize)-G0),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]-G0?[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+G0)),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 K0;(function(e){e.SINGLE_ZONE=`single-zone`,e.MULTI_ZONE_STATIC=`multi-zone-static`,e.MULTI_ZONE_RESIZABLE=`multi-zone-resizable`})(K0||={});function q0(e){return!e.hasSecondaryZone&&!e.hasCompanionZone?K0.SINGLE_ZONE:e.hasSecondaryZone&&e.split?.resizable||e.hasCompanionZone&&e.split?.companion?.resizable?K0.MULTI_ZONE_RESIZABLE:K0.MULTI_ZONE_STATIC}function J0(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 Y0(e){return{primary:e.showSecondary||e.showCompanion,secondary:e.showSecondary&&e.showCompanion}}function X0(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}=W0({isResizable:r,defaultSize:s,minWidthPx:c,maxWidthPx:n?.maxWidth,containerWidth:i}),d=U0(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}=W0({isResizable:o,defaultSize:c,minWidthPx:l,maxWidthPx:n?.maxWidth,containerWidth:i}),f=U0(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&&Uwe(c,75),{primaryDefault:100-c.reduce((e,t)=>e+t.defaultSize,0),secondary:o,companion:s}}var Wwe={...GE,geometry:{responsiveMaxWidth:`content`},containment:{gap:`none`}};function Z0({children:e,geometry:t}){return(0,$.jsx)(vD,{variant:C.SHELL,emitPolicyVars:!0,policyOverride:Pwe(t,Wwe),className:W(`bg-transparent text-inherit`,Fwe(t)),children:e})}var Gwe=()=>{let{tComponent:e,isReady:t}=J({component:U.APP_LAYOUTS_MAIN_CONTAINER}),n=t?bp({tComponent:e,componentType:U.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})})},Q0=`pointer-events-auto bg-surface-raised/80 backdrop-blur-sm`,$0=({emphasized:e,onToggle:t,floating:n=!0})=>{let{tComponent:r,isReady:i}=J({component:U.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:a}=kf(),o=i?bp({tComponent:r,componentType:U.APP_LAYOUTS_MAIN_CONTAINER,key:e?`zoneRestore`:`zoneExpand`}):``;return(0,$.jsx)(X,{type:`button`,size:Gd.ICON_SM,variant:Y.GHOST,className:n?Q0: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:Jn.SM})})},e2=({onDismiss:e,floating:t=!0})=>{let{tComponent:n,isReady:r}=J({component:U.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:i}=kf(),a=r?bp({tComponent:n,componentType:U.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneDismiss`}):``;return(0,$.jsx)(X,{type:`button`,size:Gd.ICON_SM,variant:Y.GHOST,className:t?Q0:void 0,"aria-label":a||void 0,title:a||void 0,"data-zone-dismiss":`true`,onClick:e,children:i(H.CLOSE,{size:Jn.SM})})};function Kwe(){let{tComponent:e,isReady:t}=J({component:U.APP_LAYOUTS_MAIN_CONTAINER}),n=(0,Q.useCallback)(n=>t&&bp({tComponent:e,componentType:U.APP_LAYOUTS_MAIN_CONTAINER,key:n})||void 0,[e,t]);return{regionProps:(0,Q.useCallback)(e=>({role:`region`,"aria-label":n(qwe[e])}),[n]),resizeHandleLabel:n(`zoneResizeHandle`)}}var qwe={[so.PRIMARY]:`zoneRegionPrimary`,[so.SECONDARY]:`zoneRegionSecondary`,[so.COMPANION]:`zoneRegionCompanion`},Jwe=({emphasized:e,onToggleEmphasis:t,onDismiss:n})=>(0,$.jsxs)(eV,{children:[(0,$.jsx)($0,{emphasized:e,onToggle:t}),n&&(0,$.jsx)(e2,{onDismiss:n})]}),t2=({zone:e,emphasized:t,onToggleEmphasis:n,onDismiss:r,children:i})=>(0,$.jsxs)(XB,{zone:e,controls:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($0,{emphasized:t,onToggle:n,floating:!1}),r&&(0,$.jsx)(e2,{onDismiss:r,floating:!1})]}),children:[(0,$.jsx)(Jwe,{emphasized:t,onToggleEmphasis:n,onDismiss:r}),i]}),n2=({routerChildren:e})=>{Ibe(),Pbe(),Fbe();let{isZoneVisible:t,getZoneDepth:n,getTopContent:r,setFocusedZone:i,emphasizedZone:a,setEmphasizedZone:o,reconcileCollapsedZones:s,state:c}=Mx(),{dismissZone:l}=SS(),{setContentAreaWidth:u}=Mx(),{regionProps:d,resizeHandleLabel:f}=Kwe(),{navigationLayout:p,UIConfig:m,shellAppearance:h,compositeViews:g,homeDefinition:_}=Ig(),v=og(),{registry:y}=pm(),b=(0,Q.useCallback)(e=>Op({viewRef:e,registry:y}),[y]),x=(0,Q.useRef)(null),S=Hwe(x);(0,Q.useEffect)(()=>{u(S>0?S:void 0)},[S,u]);let w=m?.currentBreakpoint===yi.MOBILE,T=p?.zones,E=p?.split,D=h===ic.CONTINUOUS?`bg-transparent text-foreground`:`bg-surface-raised text-surface-raised-foreground`,O=!!T?.secondary,k=!!T?.companion,A=t(so.SECONDARY)||n(so.SECONDARY)>0,j=t(so.COMPANION)||n(so.COMPANION)>0,M=r(so.PRIMARY),N=Awe({homeCompositeViewRef:_?.compositeViewReference,isAppRootPath:v.pathname===`/`,primaryStackTop:M})??M,P=(0,Q.useMemo)(()=>Mwe({primaryContent:N,compositeViews:g,resolveExecutionView:b}),[N,g,b]),F=(0,Q.useMemo)(()=>Nwe({primaryContent:N,compositeViews:g,resolveExecutionView:b}),[N,g,b]),I=(0,Q.useMemo)(()=>M0({zoneContent:r(so.SECONDARY),compositeViews:g,resolveExecutionView:b}),[r,g,b]),L=(0,Q.useMemo)(()=>M0({zoneContent:r(so.COMPANION),compositeViews:g,resolveExecutionView:b}),[r,g,b]),ee=O0({zone:so.SECONDARY,zones:T,destinationOverride:P}),R=O0({zone:so.COMPANION,zones:T,destinationOverride:P}),z=(0,$.jsx)(Gwe,{}),te=(0,Q.useMemo)(()=>jwe({primaryContent:N,compositeViews:g}),[N,g]),ne=Th({zoneConfig:T?.secondary,viewport:m?.currentBreakpoint,contentAreaWidth:S}),re=Th({zoneConfig:T?.companion,viewport:m?.currentBreakpoint,contentAreaWidth:S});DSe({zones:T,viewport:m?.currentBreakpoint,contentAreaWidth:S,reconcileCollapsedZones:s,navigationState:c});let ie=!ne&&O&&(A||te&&k0(ee)),ae=!re&&k&&(j||te&&k0(R)),oe=q0({hasSecondaryZone:O,hasCompanionZone:k,split:E}),se=(0,Q.useCallback)(()=>i(so.PRIMARY),[i]),ce=(0,Q.useCallback)(()=>i(so.SECONDARY),[i]),le=(0,Q.useCallback)(()=>i(so.COMPANION),[i]),ue=Owe({requested:a,isMobile:w,secondaryShown:ie,companionShown:ae,secondaryHasContent:A,companionHasContent:j}),de=n(Vn.OVERLAY)>0;(0,Q.useEffect)(()=>{if(ue===null)return;let e=e=>{kwe({key:e.key,emphasized:!0,overlayOpen:de,target:e.target})&&o(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ue,de,o]);let fe=(0,Q.useCallback)(()=>o(ue===so.SECONDARY?null:so.SECONDARY),[ue,o]),pe=(0,Q.useCallback)(()=>o(ue===so.COMPANION?null:so.COMPANION),[ue,o]),me=(0,Q.useCallback)(()=>{o(null),l(so.SECONDARY)},[l,o]),he=(0,Q.useCallback)(()=>{o(null),l(so.COMPANION)},[l,o]),ge=A0({hasContent:A,behavior:ee}),_e=A0({hasContent:j,behavior:R}),ve=ue!==null,ye=ue!==null&&ue!==so.SECONDARY,B=ue!==null&&ue!==so.COMPANION,be=(0,Q.useMemo)(()=>T?X0(T,E,ie,ae,S):null,[T,E,ie,ae,S]);if(oe===K0.SINGLE_ZONE)return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.SHELL,policyOverride:GE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full overflow-auto p-container ${D}`,"data-content-area":`primary`,onPointerDown:se,onFocus:se,...d(so.PRIMARY),children:(0,$.jsx)(Z0,{geometry:F,children:(0,$.jsx)(R0,{zone:so.PRIMARY,fallback:e})})})});if(oe===K0.MULTI_ZONE_RESIZABLE&&be){let t=z0(E?.orientation);return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.SHELL,policyOverride:GE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full ${D}`,children:(0,$.jsxs)(X$,{direction:t,autoSaveId:`nav-zones`,className:`h-full`,children:[(0,$.jsx)(Z$,{defaultSize:be.primaryDefault,minSize:B0,id:`nav-primary`,order:1,className:W(`h-full`,ve&&`hidden`),"data-zone-hidden":ve||void 0,children:(0,$.jsx)(`div`,{className:`h-full p-container ${F.fillsHeight?`overflow-hidden`:`overflow-auto`}`,"data-content-area":`primary`,onPointerDown:se,onFocus:se,...d(so.PRIMARY),children:(0,$.jsx)(Z0,{geometry:F,children:(0,$.jsx)(R0,{zone:so.PRIMARY,fallback:e})})})}),ie&&be.secondary&&(0,$.jsxs)($.Fragment,{children:[ue===null&&(0,$.jsx)(Q$,{withHandle:!0,disabled:be.secondary.frozen,"aria-label":f}),(0,$.jsx)(Z$,{defaultSize:be.secondary.defaultSize,minSize:be.secondary.minSize,maxSize:be.secondary.maxSize,id:`nav-secondary`,order:2,className:W(`h-full`,ye&&`hidden`),"data-zone-hidden":ye||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`secondary`,"data-zone-emphasized":ue===so.SECONDARY||void 0,onPointerDown:ce,onFocus:ce,...d(so.SECONDARY),children:(0,$.jsx)(t2,{zone:so.SECONDARY,emphasized:ue===so.SECONDARY,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)(Z0,{geometry:I,children:(0,$.jsx)(R0,{zone:so.SECONDARY,emptyState:z})})})})})]}),ae&&be.companion&&(0,$.jsxs)($.Fragment,{children:[ue===null&&(0,$.jsx)(Q$,{withHandle:!0,disabled:be.companion.frozen,"aria-label":f}),(0,$.jsx)(Z$,{defaultSize:be.companion.defaultSize,minSize:be.companion.minSize,maxSize:be.companion.maxSize,id:`nav-companion`,order:3,className:W(`h-full`,B&&`hidden`),"data-zone-hidden":B||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`companion`,"data-zone-emphasized":ue===so.COMPANION||void 0,onPointerDown:le,onFocus:le,...d(so.COMPANION),children:(0,$.jsx)(t2,{zone:so.COMPANION,emphasized:ue===so.COMPANION,onToggleEmphasis:pe,onDismiss:_e?he:void 0,children:(0,$.jsx)(Z0,{geometry:L,children:(0,$.jsx)(R0,{zone:so.COMPANION,emptyState:z})})})})})]})]})})})}let xe=z0(E?.orientation)===Ks.VERTICAL,Se=J0({secondaryPercent:E?.ratio?.[1]??50,companionPercent:E?.companion?.ratio?.[1]??30,showSecondary:ie,showCompanion:ae}),Ce=(e,t)=>xe?{height:t?`100%`:`${e}%`}:{width:t?`100%`:`${e}%`},we=Y0({showSecondary:ie,showCompanion:ae});return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.SHELL,policyOverride:GE,children:(0,$.jsxs)(`div`,{ref:x,className:W(`h-full flex`,xe?`flex-col`:`flex-row`,D),children:[(0,$.jsx)(`div`,{className:W(`flex-1 h-full overflow-auto p-container`,we.primary&&ue===null&&(xe?`border-b border-border`:`border-e border-border`),ve&&`hidden`),"data-content-area":`primary`,"data-zone-hidden":ve||void 0,onPointerDown:se,onFocus:se,...d(so.PRIMARY),children:(0,$.jsx)(Z0,{geometry:F,children:(0,$.jsx)(R0,{zone:so.PRIMARY,fallback:e})})}),ie&&(0,$.jsx)(`div`,{className:W(`h-full overflow-auto p-container`,we.secondary&&ue===null&&(xe?`border-b border-border`:`border-e border-border`),ye&&`hidden`),style:Ce(Se.secondary,ue===so.SECONDARY),"data-content-area":`secondary`,"data-zone-hidden":ye||void 0,"data-zone-emphasized":ue===so.SECONDARY||void 0,onPointerDown:ce,onFocus:ce,...d(so.SECONDARY),children:(0,$.jsx)(t2,{zone:so.SECONDARY,emphasized:ue===so.SECONDARY,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)(Z0,{geometry:I,children:(0,$.jsx)(R0,{zone:so.SECONDARY,emptyState:z})})})}),ae&&(0,$.jsx)(`div`,{className:W(`h-full overflow-auto p-container`,B&&`hidden`),style:Ce(Se.companion,ue===so.COMPANION),"data-content-area":`companion`,"data-zone-hidden":B||void 0,"data-zone-emphasized":ue===so.COMPANION||void 0,onPointerDown:le,onFocus:le,...d(so.COMPANION),children:(0,$.jsx)(t2,{zone:so.COMPANION,emphasized:ue===so.COMPANION,onToggleEmphasis:pe,onDismiss:_e?he:void 0,children:(0,$.jsx)(Z0,{geometry:L,children:(0,$.jsx)(R0,{zone:so.COMPANION,emptyState:z})})})})]})})},Ywe=()=>{let{state:e,getZoneState:t}=Mx(),{closeOverlay:n}=SS(),r=oh(),i=e.overlay,a=i.length>0?i[i.length-1]:void 0,o=i.length>0,s=S1(a?.appearance??xi.DIALOG),{title:c}=J$(a),l=(0,Q.useCallback)(i=>{if(!i){if(a?.content.contentType===va.SETTINGS_HUB){let n=e.zones[so.PRIMARY]?.stack??[],i=e.zones[so.SECONDARY]?.stack??[],a=i[i.length-1],o=n[n.length-1]?.urlPath,s=(a?.hostedPane&&o?Um.resolveBrowserUrlForZoneEntry({zone:so.SECONDARY,entryUrlPath:a.urlPath,paneContent:a.content,currentBrowserUrl:o,getZoneState:t}):o)??Pa.home;r(s,{replace:!0})}else n()}},[n,r,a,e.zones,t]),u=N$(),{registry:d}=pm(),f=(0,Q.useCallback)(e=>d.resourceConfigurations[e]?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,[d]),p=a?.content.contentType===va.SETTINGS_HUB?WSe(ZSe(u.sections,a.content.sectionRef??u.defaultSectionRef,f)):GSe(s);return(0,$.jsx)(v1,{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:Zo.END},className:p,children:a&&(0,$.jsx)(I0,{content:a.content,zone:Vn.OVERLAY,initiator:a.initiator,entryId:a.id})})},r2=()=>(0,$.jsx)(Ywe,{});function i2(e){return typeof e==`object`&&!!e&&`placement`in e&&`collapsible`in e}function a2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o2(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.position===void 0||t.position===sl.START||t.position===sl.END,r=t.items===void 0||Array.isArray(t.items);return n&&r}var s2;(function(e){e.ENUM=`enum`,e.RESOURCE_REFERENCE=`resource_reference`,e.RAW=`raw`})(s2||={});var c2;(function(e){e.STATIC=`static`,e.LINK=`link`,e.BUTTON=`button`})(c2||={});var l2;(function(e){e.BUTTON=`button`,e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.SELECT=`select`})(l2||={});var u2;(function(e){e.COMMANDS=`commands`,e.RECORDS=`records`})(u2||={});function d2(e){switch(e){case hr.COMMAND_MENU:return U.APPLICATION_LEVEL_COMMAND_MENU;case hr.QUICK_ACTION_BUTTON:return U.APPLICATION_LEVEL_QUICK_ACTION_BUTTON;case hr.NOTIFICATION_CENTER:return U.APPLICATION_LEVEL_NOTIFICATION_CENTER;case hr.USER_DROPDOWN:return U.APPLICATION_LEVEL_USER_DROPDOWN;case hr.CONTROL_PANEL:return U.APPLICATION_LEVEL_CONTROL_PANEL;case hr.QUICK_SWITCHER:return U.APPLICATION_LEVEL_QUICK_SWITCHER;case hr.NAVIGATION_CONTROL:return U.APPLICATION_LEVEL_NAVIGATION_BACK;case hr.UTILITY_PANEL:return U.APPLICATION_LEVEL_UTILITY_PANEL;default:return null}}function f2(e,t){if(e.startsWith(`data:`)||e.startsWith(`blob:`))return!0;try{return new URL(e,t).origin===t}catch{return!1}}function p2(e){let{httpClient:t}=Eu(),n=e!==void 0&&f2(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 m2(e={}){let{composition:t=Sa.SYMBOL,purpose:n=qn.PRIMARY,theme:r,includeOrganizationBrand:i=!0}=e,{appConfig:a}=Eu(),{isDark:o,shellIdentity:s,organizationLogoUrl:c,organizationProductName:l}=Ig(),u=s?s.brandAssets:a.brandAssets,d=s?s.name:a.appIdentity?Ys(a.appIdentity):``,f=(0,Q.useMemo)(()=>{if(u?.length)return zte(u,{composition:t,theme:r??(o?El.DARK:El.LIGHT),purpose:n})},[u,t,n,r,o]),p=i&&!s,m=p2(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===El.MONOCHROME&&o}}function h2(e){let t=e?.logoUrl,n=e?.name??``,[r,i]=(0,Q.useState)(void 0);r!==void 0&&r!==t&&i(void 0);let a=r!==void 0&&r===t,o=(0,Q.useCallback)(()=>i(t),[t]),s=!!t&&!a,c=s&&e?.logoComposition!==void 0&&e.logoComposition!==Sa.SYMBOL;return{name:n,logoUrl:s?t:void 0,hasMark:s,markCarriesName:c,drawMarkLight:s&&e?.markIsSingleColourOnDarkUi===!0,isEmpty:!s&&n.length===0,onMarkError:o}}function g2(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===hr.NAVIGATION_CONTROL&&!Fo(a?.backAffordanceOwner))continue;let l=d2(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 _2(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)=>g2(i,r(i),t,n,a).some(t=>t.component===e);return!!t?.[hr.MENUBAR]&&i(hr.MENUBAR,sl.START)||!!t?.[hr.SIDEBAR]&&i(hr.SIDEBAR,du.TOP)}var v2=new Set;function y2(e){let t=typeof e==`string`?e:a2(e)?e.placement:void 0;if(t===void 0)return du.BOTTOM;if(Wa(t))return t;let n=String(t);return v2.has(n)||(v2.add(n),il.getLogger().warn(`[app-shell] the status bar is configured at '${n}', which no shell layout places (only '${du.TOP}' and '${du.BOTTOM}'); it is shown at '${du.BOTTOM}'.`)),du.BOTTOM}function b2(){let{UIConfig:e,navigationLayout:t,appComponentsConfiguration:n}=Ig(),{markComponentInitialized:r}=Eu(),i=!!(t&&n);return(0,Q.useEffect)(()=>{i&&r(Fe.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:sl.START,statusBarPlacement:du.BOTTOM,utilityPanelPlacement:sl.END,isLayoutReady:!1};let r=n[hr.SIDEBAR],a=n[hr.STATUS_BAR],o=n[hr.UTILITY_PANEL],s=i2(r)?r.placement:sl.START;return{hasMenubar:!!n[hr.MENUBAR],hasSidebar:!!r,hasStatusBar:!!a,hasToolbar:!!n[hr.TOOLBAR],hasActivityBar:!!n[hr.ACTIVITY_BAR],hasQuickActionButton:!!n[hr.QUICK_ACTION_BUTTON],hasUtilityPanel:!!o,quickActionButtonHostedInChrome:_2(hr.QUICK_ACTION_BUTTON,n,e?.currentBreakpoint),utilityPanelHostedInChrome:_2(hr.UTILITY_PANEL,n,e?.currentBreakpoint),sidebarPlacement:s,statusBarPlacement:y2(a),utilityPanelPlacement:o2(o)?o.position??sl.END:sl.END,isLayoutReady:!0}},[i,t,n,e?.currentBreakpoint])}function Xwe(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 x2(e=!1,t){let{markComponentInitialized:n,frontendConfiguration:r}=Eu();(0,Q.useEffect)(()=>{n(Fe.PUBLIC_APP_CONTAINER)},[n]);let i=m2({includeOrganizationBrand:!1}),{shellIdentity:a}=Ig(),o=e&&!a?t:void 0,s=p2(o?.logoUrl||void 0),c=p2(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===am.BRAND_HEADER?l:void 0;return Xwe(c),{useCardLayout:e,isReady:!0,brandHeader:u,brandAccentColor:u?o?.primaryColor:void 0}}var Zwe=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function S2(e){return!e||typeof document>`u`?null:document.getElementById(e)}var C2=(0,Q.createContext)(null);function w2(){return(0,Q.useContext)(C2)??void 0}function T2(e,t){let n=w2(),{getSurfacePolicy:r}=Ig(),i=r?.(e,t)?.stacking?.portalTarget,a=typeof i==`string`&&i!==`inline`&&i!==`app-portal`&&i!==`reset`?i:null,[o,s]=(0,Q.useState)(()=>S2(a));return Zwe(()=>{if(!a||typeof document>`u`){s(null);return}let e=S2(a);if(s(e),e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{let e=S2(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 E2(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 D2(e,t){let{getSurfacePolicy:n}=Ig(),r=n?.(e,t)?.stacking?.stackingTier;return E2(r)}function O2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_ACTIVITY_BAR,`ApplicationLevel_ActivityBar`)(e);return(0,$.jsx)(n,{...t})}function k2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_MENUBAR,`ApplicationLevel_MenuBar`)(e);return(0,$.jsx)(n,{...t})}function A2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_QUICK_ACTION_BUTTON,`ApplicationLevel_QuickActionButton`)(e);return(0,$.jsx)(n,{...t})}function j2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_SIDEBAR,`ApplicationLevel_Sidebar`)(e);return(0,$.jsx)(n,{...t})}function M2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_STATUS_BAR,`ApplicationLevel_StatusBar`)(e);return(0,$.jsx)(n,{...t})}function N2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_TOOLBAR,`ApplicationLevel_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function P2({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_UTILITY_PANEL,`ApplicationLevel_UtilityPanel`)(e);return(0,$.jsx)(n,{...t})}var F2=(0,Q.createContext)({getHostedComponentProps:()=>({})});function I2(){return(0,Q.useContext)(F2)}function L2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qwe(e){return L2(e)}var $we=new Set([hr.COMMAND_MENU,hr.NOTIFICATION_CENTER,hr.QUICK_SWITCHER]);function R2({children:e}){let{appComponentsConfiguration:t,UIConfig:n,navigationLayout:r}=Ig(),i=n?.currentBreakpoint,{on:a,emit:o}=qo(),{register:s}=A$(),{t:c}=J(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(0),h=t?.[hr.MENUBAR],g=t?.[hr.SIDEBAR],_=(0,Q.useMemo)(()=>{let e=t,n=L2(h)?g2(hr.MENUBAR,h.hostedComponents,e,i,sl.START,r):[],a=L2(g)?g2(hr.SIDEBAR,g.hostedComponents,e,i,du.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 _)$we.has(t.component)&&(e.has(t.component)||e.set(t.component,t.instanceId));return e},[_]),b=e=>v.has(e),x=t?.[hr.COMMAND_MENU],S=Qwe(x)?x.openShortcut:void 0;(0,Q.useEffect)(()=>{if(b(hr.COMMAND_MENU))return a(xc.HOTKEY_COMMAND_MENU_OPEN,()=>{u(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(hr.NOTIFICATION_CENTER))return a(xc.HOTKEY_NOTIFICATIONS_OPEN,()=>{f(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(hr.QUICK_SWITCHER))return a(xc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{m(e=>e+1)})},[a,v]),(0,Q.useEffect)(()=>{if(b(hr.COMMAND_MENU)&&S&&x!==!1)return s({id:`shell-hosted-command-menu-open-shortcut`,shortcut:S,description:c(`engine.hotkeys.commandMenuOpen`),scope:pa.GLOBAL,group:ln.NAVIGATION,launcher:hr.COMMAND_MENU,preventDefault:!0,handler:()=>{o(xc.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 hr.COMMAND_MENU:return{listenForHotkeys:!1,isOpen:l,onOpenChange:u,renderDialog:n};case hr.NOTIFICATION_CENTER:return{listenForHotkeys:!1,...n?{isOpen:d,onOpenChange:f}:{}};case hr.QUICK_SWITCHER:return{focusTrigger:n?p:0};default:return{}}}}),[y,l,d,p]);return(0,$.jsx)(F2.Provider,{value:C,children:e})}var z2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a,children:o})=>{let{tComponent:s,isReady:c}=J({component:U.GUIDANCE_CHECKLIST}),{renderIcon:l}=kf(),{flowStates:u}=xU(),[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===Cr.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(U.GUIDANCE_CHECKLIST,`headerTitle`),C=s(U.GUIDANCE_CHECKLIST,`progress`,{completed:h,total:g}),w=d?s(U.GUIDANCE_CHECKLIST,`expand`):s(U.GUIDANCE_CHECKLIST,`collapse`),T=s(U.GUIDANCE_CHECKLIST,`dismiss`);return(0,$.jsxs)(kF,{className:`w-80 max-w-[calc(100vw-3rem)] overflow-hidden`,role:`region`,"aria-label":S||b,children:[(0,$.jsxs)(jF,{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:Y.GHOST,size:Gd.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:Y.GHOST,size:Gd.ICON_SM,onClick:y,"aria-label":T,children:l(H.CLOSE,{size:Jn.SM})})]}),p.showProgress&&(0,$.jsxs)(`div`,{className:`px-4 pb-2 flex items-center gap-2.5`,children:[(0,$.jsx)(v_,{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)(IF,{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})]})]})},B2=({element:e,flowRef:t,state:n,onComplete:r,onAction:i,t:a})=>{let{tComponent:o,isReady:s}=J({component:U.GUIDANCE_CHECKLIST_ITEM}),c=e,l=n?.status===Cr.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)(DI,{name:`__display`,schema:Pd(),checked:l,onCheckedChange:u,disabled:l,"aria-label":l?o(U.GUIDANCE_CHECKLIST_ITEM,`completed`):o(U.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:Y.OUTLINE,size:Gd.SM,onClick:d,className:`shrink-0`,children:p})]})},V2=({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}=J({component:U.GUIDANCE_TOUR,keys:o}),{getRecipe:u}=Ig(),{renderIcon:d}=kf(),f=w2(),p=e,m=u(_t.SURFACE,C.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],w=h.length,T=g===w-1,E=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 D=(0,Q.useCallback)(()=>{T?r(p.ref,{lastStepIndex:g}):_(e=>e+1)},[T,r,p.ref,g]),O=(0,Q.useCallback)(()=>{E||_(e=>e-1)},[E]),k=(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(),k())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[k]),XE(b,!0),!l)return null;let A=s(U.GUIDANCE_TOUR,`next`),j=s(U.GUIDANCE_TOUR,`previous`),M=s(U.GUIDANCE_TOUR,`skip`),N=s(U.GUIDANCE_TOUR,`finish`),P=s(U.GUIDANCE_TOUR,`close`),F=s(U.GUIDANCE_TOUR,`stepProgress`,{current:g+1,total:w}),I=S?c(t,p.ref,S.ref,`title`):``,L=S?c(t,p.ref,S.ref,`description`):``;if(!S||typeof document>`u`)return null;let ee=eTe(S.placement??Ni.BOTTOM,v),R=f??document.body;return DN.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:C.OVERLAY,children:(0,$.jsxs)(`div`,{ref:b,style:ee,role:`dialog`,"aria-modal":`true`,tabIndex:-1,"aria-label":I,className:W(`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:Y.GHOST,size:Gd.ICON_SM,onClick:k,"aria-label":P,className:`absolute top-2 end-2 z-[calc(var(--z-guidance)+2)]`,children:d(H.CLOSE,{size:Jn.SM})}),(0,$.jsxs)(`div`,{className:`px-5 pt-5 pb-3`,children:[I&&(0,$.jsx)(`h3`,{className:`m-0 text-base font-semibold leading-tight pe-6`,children:I}),L&&(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground leading-normal`,children:L})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-4`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:F}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p.allowSkip&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:k,children:M}),!E&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,onClick:O,children:j}),(0,$.jsx)(X,{size:Gd.SM,onClick:D,children:T?N:A})]})]})]})})]}),R)};function eTe(e,t){if(!t)return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};switch(e){case Ni.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case Ni.BOTTOM:return{position:`fixed`,top:t.bottom+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case Ni.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+12,transform:`translateY(-50%)`};case Ni.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+12,transform:`translateY(-50%)`};case Ni.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var H2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let{tComponent:o,isReady:s}=J({component:U.GUIDANCE_TOOLTIP}),{getRecipe:c}=Ig(),l=w2(),u=e,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(null),h=c(_t.SURFACE,C.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!==Cr.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(U.GUIDANCE_TOOLTIP,`dismiss`),S=o(U.GUIDANCE_TOOLTIP,`gotIt`),w=tTe(u.placement??Ni.BOTTOM,d);return DN.createPortal((0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.RAISED,children:(0,$.jsxs)(`div`,{style:w,role:`dialog`,"aria-label":y||b||void 0,"data-guidance-tooltip":u.ref,className:W(`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:Y.GHOST,size:Gd.SM,onClick:g,children:x}),(0,$.jsx)(X,{size:Gd.SM,onClick:_,children:S})]})]})}),v)};function tTe(e,t){switch(e){case Ni.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case Ni.BOTTOM:return{position:`fixed`,top:t.bottom+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case Ni.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+10,transform:`translateY(-50%)`};case Ni.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+10,transform:`translateY(-50%)`};case Ni.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var U2=({element:e,t,onAction:n,onDismiss:r,onComplete:i})=>{let{tComponent:a,isReady:o}=J({component:U.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(U.GUIDANCE_MODAL,`defaultTitle`);return(0,$.jsx)(nG,{open:!0,onOpenChange:m,children:(0,$.jsxs)(iG,{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)(oG,{children:[(0,$.jsx)(cG,{className:h?void 0:`sr-only`,children:y}),g&&(0,$.jsx)(lG,{children:g})]}):(0,$.jsx)(cG,{className:`sr-only`,children:y}),_&&(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:_}),(0,$.jsxs)(sG,{children:[l&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,onClick:p,children:a(U.GUIDANCE_MODAL,`dismiss`)}),v&&(0,$.jsx)(X,{size:Gd.SM,onClick:f,children:v})]})]})})},nTe={[bn.INFO]:`info`,[bn.SUCCESS]:`success`,[bn.WARNING]:`warning`,[bn.ERROR]:`destructive`},W2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=J({component:U.GUIDANCE_BANNER}),{renderIcon:o}=kf(),s=e,c=s.variant??bn.INFO,l=s.position??jc.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===jc.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:nTe[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:Gd.SM,onClick:()=>n(d),children:h}),u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.ICON_SM,onClick:f,"aria-label":i(U.GUIDANCE_BANNER,`ariaClose`),title:i(U.GUIDANCE_BANNER,`dismiss`),children:o(H.CLOSE,{size:Jn.SM})})]})]})})},rTe={[bn.INFO]:`info`,[bn.SUCCESS]:`success`,[bn.WARNING]:`warning`,[bn.ERROR]:`destructive`},G2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=J({component:U.GUIDANCE_ANNOUNCEMENT}),{renderIcon:o}=kf(),s=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let c=e,l=c.variant??bn.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:rTe[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:Gd.SM,onClick:()=>n(m),children:p})})]}),u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.ICON_SM,onClick:s,"aria-label":i(U.GUIDANCE_ANNOUNCEMENT,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:Jn.SM})})]})},iTe={[Yr.DEFAULT]:ao.NEUTRAL,[Yr.PRIMARY]:ao.INFO,[Yr.SECONDARY]:ao.NEUTRAL,[Yr.SUCCESS]:ao.SUCCESS,[Yr.WARNING]:ao.WARNING,[Yr.ERROR]:ao.ERROR},K2=({element:e,t})=>{let n=e,r=n.variant??Yr.DEFAULT,i=n.unlocked??!1,a=t(`title`),o=t(`content`),s=n.icon;return(0,$.jsxs)(Nf,{variant:Ug(iTe[r]),className:i?``:`opacity-[var(--opacity-disabled)]`,children:[s&&(0,$.jsx)(`span`,{className:`text-xs leading-none`,"aria-hidden":`true`,children:s}),a||o]})},q2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=J({component:U.GUIDANCE_CARD}),{renderIcon:o}=kf(),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)(kF,{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)(jF,{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)(IF,{children:(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:h})}),g&&l&&(0,$.jsx)(MF,{children:(0,$.jsx)(X,{size:Gd.SM,onClick:()=>n(l),children:g})}),c&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.ICON_SM,onClick:f,"aria-label":i(U.GUIDANCE_CARD,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:Jn.SM})})]})},aTe=gd(),J2=({element:e,flowRef:t,t:n,onComplete:r})=>{let i=Q.useMemo(()=>t?[`guidance.${t}`]:[],[t]),{tComponent:a,tGuidanceSurveyQuestion:o,isReady:s}=J({component:U.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 Pr.TEXT:return(0,$.jsx)(tN,{value:t??``,onChange:t=>T(e.id,t.target.value)});case Pr.TEXTAREA:return(0,$.jsx)(PI,{value:t??``,onChange:t=>T(e.id,t.target.value),rows:3});case Pr.RADIO:case Pr.SINGLE_CHOICE:{let n=(e.options??[]).map(t=>({value:t.ref,label:w(e,t.ref)}));return(0,$.jsx)(wF,{schema:aTe,name:`survey-${e.id}`,value:t??``,onValueChange:t=>T(e.id,t),options:n,orientation:Ks.VERTICAL})}case Pr.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)(DI,{name:`__display`,schema:Pd(),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 Pr.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:Y.GHOST,size:Gd.ICON,onClick:()=>T(e.id,t),"aria-label":a(U.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)(kF,{className:`pointer-events-auto`,children:[(j||M)&&(0,$.jsxs)(jF,{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)(IF,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(v_,{value:N,className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:a(U.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(U.GUIDANCE_SURVEY,`required`)})]}),A(y,p[y.id]),h[y.id]&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:a(U.GUIDANCE_SURVEY,`required`)})]}),_&&(0,$.jsx)(jD,{variant:`destructive`,role:`alert`,children:(0,$.jsx)(ND,{children:a(U.GUIDANCE_SURVEY,`submissionFailed`)})})]}),(0,$.jsxs)(MF,{className:`flex justify-between items-center`,children:[(0,$.jsx)(`div`,{children:!x&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Gd.SM,onClick:O,children:a(U.GUIDANCE_SURVEY,`previous`)})}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:k,children:a(U.GUIDANCE_SURVEY,`skip`)}),(0,$.jsx)(X,{size:Gd.SM,onClick:D,children:b?a(U.GUIDANCE_SURVEY,`submit`):a(U.GUIDANCE_SURVEY,`next`)})]})]})]})},Y2=()=>null,oTe={[yc.CHECKLIST]:z2,[yc.CHECKLIST_ITEM]:B2,[yc.TOUR]:V2,[yc.TOOLTIP]:H2,[yc.MODAL]:U2,[yc.BANNER]:W2,[yc.ANNOUNCEMENT]:G2,[yc.BADGE]:K2,[yc.CARD]:q2,[yc.SURVEY]:J2},X2={[yc.CHECKLIST]:U.GUIDANCE_CHECKLIST,[yc.CHECKLIST_ITEM]:U.GUIDANCE_CHECKLIST_ITEM,[yc.TOUR]:U.GUIDANCE_TOUR,[yc.TOOLTIP]:U.GUIDANCE_TOOLTIP,[yc.MODAL]:U.GUIDANCE_MODAL,[yc.BANNER]:U.GUIDANCE_BANNER,[yc.ANNOUNCEMENT]:U.GUIDANCE_ANNOUNCEMENT,[yc.BADGE]:U.GUIDANCE_BADGE,[yc.CARD]:U.GUIDANCE_CARD,[yc.SURVEY]:U.GUIDANCE_SURVEY};function Z2(e,t){return t?.[e]||Xo.resolve(X2[e],G.DEFAULT)||oTe[e]}var Q2=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){il.getLogger().error(`GuidanceRenderer: element "${this.props.elementRef}" threw an error`,e)}render(){return this.state.hasError?null:this.props.children}};function $2(e){return`targetSelector`in e&&typeof e.targetSelector==`string`?e.targetSelector:e.targetField?`[data-guidance-field="${e.targetField}"]`:null}function e4(e){try{return!!document.querySelector(e)}catch{return t4.has(e)||(t4.add(e),il.getLogger().warn(`GuidanceRenderer: "${e}" is not a valid CSS selector, so the element targeting it can never be shown.`)),!1}}var t4=new Set;function sTe(e,t){if(typeof document>`u`)return!1;if(t.type===yc.TOOLTIP){let e=t.targetSelector;return typeof e==`string`&&e4(e)}if(t.type===yc.TOUR){let e=t.steps;return Array.isArray(e)&&e.length>0}if(e.renderMode===ys.INLINE){let e=$2(t);return e===null||e4(e)}return!0}function cTe(e,t){let n=e=>{let n=t[e.type];return!!n&&n!==Y2};return e.renderMode===ys.CHECKLIST?e.elements.filter(e=>e.type===yc.CHECKLIST&&n(e)).length===0?[]:e.elements.filter(e=>(e.type===yc.CHECKLIST||e.type===yc.CHECKLIST_ITEM)&&n(e)):e.elements.filter(t=>n(t)&&sTe(e,t))}var lTe=({targetSelector:e,children:t})=>{let n=typeof document<`u`&&e4(e)?document.querySelector(e):null;return n?DN.createPortal((0,$.jsx)(`div`,{className:`absolute z-[calc(var(--z-guidance)-2)]`,children:t}),n):null},n4=({customRenderers:e})=>{let{activeFlows:t,flowStates:n,completeElement:r,dismissFlow:i,recordFlowPresented:a,reportFlowNotPresentable:o}=xU(),s=(0,Q.useMemo)(()=>t.map(e=>`guidance.${e.ref}`),[t]),{makeTrGuidanceElement:c,tGuidanceElement:l,isReady:u}=J({keys:s}),{emit:d}=qo(),f=w2(),p=Xo.getRegistrationCount(),m=(0,Q.useRef)(null),h=(0,Q.useMemo)(()=>{let t={};for(let n of Object.values(yc)){let r=Z2(n,e);r&&(t[n]=r)}let n=t,r=m.current;return r&&Object.values(yc).every(e=>r[e]===n[e])?r:(m.current=n,n)},[e,p]),g=(0,Q.useCallback)(e=>{d(xc.NAVIGATION_REQUEST,{operationRef:e,initiator:{sourceZone:Li}})},[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===ys.CHECKLIST){let e=a.elements.filter(e=>e.type===yc.CHECKLIST),n=a.elements.filter(e=>e.type===yc.CHECKLIST_ITEM);for(let r of e){let e=h[yc.CHECKLIST];if(!e||e===Y2)continue;let o=t?.elements?.[r.ref],s=c(a.ref,r.ref,yl(r)),l=h[yc.CHECKLIST_ITEM],u=l&&l!==Y2?n.map(e=>{let n=t?.elements?.[e.ref],r=c(a.ref,e.ref,yl(e));return(0,$.jsx)(Q2,{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)(Q2,{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===Y2)continue;let o=t?.elements?.[n.ref],s=c(a.ref,n.ref,yl(n)),l=(0,$.jsx)(Q2,{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 ys.OVERLAY:e.push(l);break;case ys.INLINE:{let e=$2(n);e?r.push((0,$.jsx)(lTe,{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=cTe(e,h);if(o(e.ref,t.length===0),t.length===0)continue;let n=t.flatMap(t=>yl(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),il.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&&DN.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&&DN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`checklist`,className:`${T} bottom-6 end-6 z-[calc(var(--z-guidance)-1)]`,children:C}),w)]})},r4=(0,Q.createContext)(null),i4=(0,Q.createContext)(null),a4=(0,Q.createContext)(null);function o4(e){let t=(0,Q.useContext)(r4);if(!t)throw Error(`${e} must be rendered inside <AppShellProviders>, which supplies the layout it places regions from.`);return t}function s4(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{e&&n(!0)},[e]),t}function c4(){return(0,$.jsx)(vD,{asChild:!0,emitPolicyVars:!1,variant:C.SHELL,policyOverride:GE,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)(Zy,{size:32,className:`text-primary mx-auto mb-field`,"aria-hidden":`true`})})})})}function l4({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)(r4.Provider,{value:e,children:(0,$.jsx)(i4.Provider,{value:o,children:(0,$.jsx)(a4.Provider,{value:s,children:(0,$.jsx)(C2.Provider,{value:i??n,children:(0,$.jsx)(R2,{children:t})})})})})}function u4(){let e=(0,Q.useContext)(a4);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 d4(e){let t=o4(`AppShellRegionOutlet`),{region:n,placement:r}=e,i=e=>r===void 0||r===e?e:null;switch(n){case Lc.ACTIVITY_BAR:return t.hasActivityBar?(0,$.jsx)(O2,{}):null;case Lc.MENUBAR:return t.hasMenubar?(0,$.jsx)(k2,{}):null;case Lc.TOOLBAR:return t.hasToolbar?(0,$.jsx)(N2,{}):null;case Lc.SIDEBAR:{let e=i(t.sidebarPlacement);return t.hasSidebar&&e?(0,$.jsx)(j2,{placement:e}):null}case Lc.UTILITY_PANEL:{let e=i(t.utilityPanelPlacement);return t.hasUtilityPanel&&e&&!t.utilityPanelHostedInChrome?(0,$.jsx)(P2,{position:e}):null}case Lc.STATUS_BAR:{let e=i(t.statusBarPlacement);return t.hasStatusBar&&e?(0,$.jsx)(M2,{placement:e}):null}default:throw Error(`AppShellRegionOutlet has no rendering for region "${String(n)}".`)}}function f4({className:e,children:t}){let n=o4(`AppShellContentOutlet`),r=(0,Q.useContext)(i4);return(0,$.jsxs)(`main`,{ref:r??void 0,"data-component-area":Lc.CONTENT,className:e,children:[(0,$.jsx)(n2,{routerChildren:t}),n.hasQuickActionButton&&!n.quickActionButtonHostedInChrome&&(0,$.jsx)(A2,{placement:`floating`})]})}function p4(){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(r2,{}),(0,$.jsx)(n4,{})]})}var m4;(function(e){e.INHERIT=`inherit`,e.COMPOSED=`composed`})(m4||={});var h4;(function(e){e.SHELL=`shell`,e.LAYOUT_2D=`layout-2d`,e.LAYOUT_3D=`layout-3d`})(h4||={});var g4=Symbol.for(`@wildo-ai/saas-frontend-lib/shell-layout-main-container`);function _4(e){return typeof e==`function`&&e[g4]===!0}function v4(e,t){switch(t.placement.kind){case m4.INHERIT:return e;case m4.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 y4(e,t,n,r,i){return Object.assign(e,{...i??{},[g4]:!0,captured:t,layout:n,layoutFamily:r})}function b4(e,t,n=h4.SHELL){let r=v4(e,t);function i(e){return(0,$.jsx)(r,{...e})}return y4(i,e,t,n)}function x4(e,t={}){let n=t.callerName??`registerShellLayout()`,r=!1;return{componentRef:U.APP_LAYOUTS_MAIN_CONTAINER,preset:G.DEFAULT,get isConfigurable(){return r},loadComponent:async()=>{let i=Xo.resolve(U.APP_LAYOUTS_MAIN_CONTAINER,G.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??h4.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(_4(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=Xo.getMetadata(U.APP_LAYOUTS_MAIN_CONTAINER,G.DEFAULT)?.isConfigurable??!1;let s=_4(i)?i.captured:i,c=t.createContainer?t.createContainer(s,e):b4(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 S4;(function(e){e.APPEARED=`appeared`,e.CHANGED=`changed`})(S4||={});var C4;(function(e){e.REST=`rest`,e.BEHIND=`behind`,e.DISCARDED=`discarded`})(C4||={});var w4;(function(e){e.PANE_SWAP=`pane-swap`,e.COLUMN_RESIZE=`column-resize`})(w4||={});var T4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(T4||={});var E4;(function(e){e.INSTANT=`instant`,e.GROW=`grow`})(E4||={});var D4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(D4||={});var O4=.55,k4=`data-shell-proxy`,A4=`data-shell-object`,j4=`data-shell-ghost-layer`,M4=`data-shell-ghost`,N4=[`id`,`data-content-area`,`data-panel-id`,`data-zone-hidden`,`data-zone-emphasized`,`data-component-area`,A4,`data-navigation-back`,`data-operation-id`,`data-nav-item-id`,`data-ref`],P4;(function(e){e.DISCARDED=`discarded`,e.BEHIND=`behind`})(P4||={});var F4;(function(e){e.BACK=`back`,e.FRONT=`front`})(F4||={});function I4(e){return`[data-component-area="${e}"]`}var L4=I4(Lc.CONTENT),R4=`${L4} [data-content-area]:not([data-panel-id] *), ${L4} [data-panel-id^="nav-"]`;function z4(e){return`${L4} [data-content-area="${e}"]:not([data-panel-id] *), ${L4} [data-panel-id="nav-${e}"]`}function B4(e){if(e instanceof HTMLElement)return e.dataset.contentArea??e.dataset.panelId?.replace(/^nav-/,``)}var V4=new Set([so.SECONDARY,so.COMPANION]);function H4(e){let t=B4(e);return t!==void 0&&V4.has(t)}function U4(e){return V4.has(e)}var W4;(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`})(W4||={});var G4={[W4.DROPDOWN_MENU]:`--radix-dropdown-menu-content-transform-origin`,[W4.DROPDOWN_MENU_SUB]:`--radix-dropdown-menu-content-transform-origin`,[W4.CONTEXT_MENU]:`--radix-context-menu-content-transform-origin`,[W4.CONTEXT_MENU_SUB]:`--radix-context-menu-content-transform-origin`,[W4.POPOVER]:`--radix-popover-content-transform-origin`,[W4.HOVER_CARD]:`--radix-hover-card-content-transform-origin`,[W4.TOOLTIP]:`--radix-tooltip-content-transform-origin`,[W4.SELECT]:`--radix-select-content-transform-origin`,[W4.MENUBAR]:`--radix-menubar-content-transform-origin`,[W4.MENUBAR_SUB]:`--radix-menubar-content-transform-origin`},uTe=[W4.DIALOG,W4.ALERT_DIALOG],K4=[W4.DIALOG,W4.ALERT_DIALOG,W4.SHEET,W4.DRAWER],q4=[`open`,`delayed-open`,`instant-open`];function dTe(){return`:has([data-shell-overlay-layer] :is(${K4.map(e=>`[data-slot="${e}"]`).join(`, `)})[data-state="open"])`}var J4=new Map;function Y4(e,t,n=document){let r=J4.get(e)??{sheet:null,users:0};if(J4.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();J4.delete(e)}}var fTe=24,pTe=220,mTe=.5,X4=24,hTe=28,gTe=1500,Z4=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function _Te(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[...N4,`data-slot`,`data-state`])e.removeAttribute(t);for(let e of t.querySelectorAll(`iframe, video, audio`))e.remove();return t}function Q4(e,t){if(!(e instanceof HTMLElement))return!1;let n=e.offsetHeight;return n>=fTe&&n<=pTe&&e.offsetWidth>=t*mTe}function $4(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 vTe(e,t){return(e.parentElement?[...e.parentElement.children]:[]).some(n=>n!==e&&Q4(n,t)&&$4(n,e))}function e3(e){let t=e.closest(R4);if(!t)return null;let n=t.clientWidth;for(let r=e;r&&r!==t;r=r.parentElement)if(Q4(r,n)&&vTe(r,n))return r;return null}var yTe=`button, a, [role="button"], [role="menuitem"], [role="option"]`;function t3(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=e3(e),r=e.closest(yTe)??e;t.current={row:n?{...Z4(n.getBoundingClientRect()),picture:_Te(n),element:n}:null,control:Z4(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 n3(e,t,n,r,i){let a=Math.round(r.durationMs*O4);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(k4,``),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:O4},{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 r3(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 i3(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 a3(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=>Q4(e,t)),i=[];for(let t of e){let e=i.find(e=>$4(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 o3(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 a3(e).slice(0,X4))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,X4)*hTe,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()},gTe);return()=>{clearTimeout(s),cancelAnimationFrame(a),o.disconnect()}}function s3(e,t,n){(0,Q.useEffect)(()=>{let r=e.current?.querySelector(`[data-shell-overlay-layer]`),i=e.current;if(!i||!r||t.dialogArrival!==D4.FROM_PRESSED_ELEMENT||t.durationMs===0)return;let a=new WeakSet,o=K4.filter(e=>e!==W4.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&&n3(i,r,Z4(e.getBoundingClientRect()),t,e)}});return s.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>s.disconnect()},[e,t,n])}var c3=`shell-pane-arrival`,l3=`data-shell-view-transition`,bTe=`
25
- html[${l3}]::view-transition-old(root),
26
- html[${l3}]::view-transition-new(root) { animation: none; }
27
- ::view-transition-group(${c3}) {
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(${c3}),
32
- ::view-transition-new(${c3}) { height: 100%; object-fit: none; object-position: left top; }
33
- html:dir(rtl)::view-transition-old(${c3}),
34
- html:dir(rtl)::view-transition-new(${c3}) { object-position: right top; }
35
- ::view-transition-old(${c3}) { animation: shell-vt-out calc(var(--shell-vt-duration, 320ms) * 0.6) ease-out both; }
36
- ::view-transition-new(${c3}) { 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
- `,xTe=il.getLogger(),u3=null;function STe(e=document){return typeof e.startViewTransition==`function`}function d3(e,t){for(let n of e.querySelectorAll(z4(t)))if(!n.hasAttribute(`data-zone-hidden`)&&n.offsetWidth>0)return n;return null}function CTe(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||!U4(r)||d3(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={};u3=c;let l=null,u=()=>{o.style.removeProperty(`view-transition-name`),l?.style.removeProperty(`view-transition-name`),u3===c&&(u3=null,s.removeAttribute(l3),s.style.removeProperty(`--shell-vt-duration`),s.style.removeProperty(`--shell-vt-ease`))};s.setAttribute(l3,``),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`,c3);try{a.call(t,()=>{o.style.removeProperty(`view-transition-name`);try{(0,DN.flushSync)(n)}catch(e){xTe.error(`A navigation commit failed inside the view-transition arrival`,{error:e,zone:r});return}let e=d3(i,r);if(e){for(let e of i.querySelectorAll(z4(r)))for(let t of e.getAnimations?.()??[])`animationName`in t&&t.finish();e.style.setProperty(`view-transition-name`,c3),l=e}}).finished.then(u,u)}catch{u(),n()}}}var wTe=`[${A4}], ${R4}`,f3=new WeakMap;function p3(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 m3(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(wTe));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=p3(r,t);n.current?.(r,e,t),r.offsetWidth>0&&r.offsetHeight>0&&f3.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 h3(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(`${I4(Lc.CONTENT)} :is([data-content-area], [data-panel-id^="nav-"])`),n=t?B4(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 TTe=new Set(dd);function g3(e,t){let n=Object.keys(e.state.zones).filter(e=>TTe.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===``?S4.APPEARED:S4.CHANGED)}},[i])}function _3(e){e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of N4)t.removeAttribute(e);for(let t of e.querySelectorAll(`iframe, video, audio`))t.remove()}function v3(e,t){for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}function y3(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function b3(e,t){(0,Q.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let r=n.querySelector(`[${j4}="${F4.BACK}"]`),i=n.querySelector(`[${j4}="${F4.FRONT}"]`);if(!r||!i)return;let a=new Map,o=t.durationMs,s=(e,r)=>{let i=document.createElement(`div`);return i.setAttribute(M4,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`}),v3(i,t.ghostPose(C4.REST,{rect:r,stage:n})),i},c=e=>{let r=f3.get(e);if(!r||o===0||e.isConnected)return;let a=s(P4.DISCARDED,r);_3(e),a.appendChild(e),i.appendChild(a),y3(()=>{v3(a,t.ghostPose(C4.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(R4)].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=f3.get(r);s&&v3(i,t.ghostPose(C4.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=f3.get(i);if(!e)continue;let c=s(P4.BEHIND,e),l=i.cloneNode(!0);_3(l),l.classList.remove(`hidden`),l.style.width=`100%`,l.style.height=`100%`,c.appendChild(l),a.set(i,c),o===0?(v3(c,t.ghostPose(C4.BEHIND,{rect:e,stage:n})),r.appendChild(c)):(c.style.opacity=`0`,r.appendChild(c),y3(()=>{v3(c,t.ghostPose(C4.BEHIND,{rect:e,stage:n})),c.style.opacity=`1`}))}},u=e=>e.matches(R4)?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===E4.GROW){let e=r.target instanceof Element?u(r.target):null,i=e?f3.get(e):void 0;e&&i&&(r.target.hasAttribute(`data-zone-emphasized`)?r3(e,i,n,t):i3(e,i,n,t))}else if(r.type===`childList`)for(let e of r.removedNodes)e instanceof HTMLElement&&f3.has(e)&&H4(e)&&c(e);l()}),f=n.querySelector(I4(Lc.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(z4(n));i&&typeof i.animate==`function`&&i.animate([t.dipPeak(w4.PANE_SWAP,{stage:r})],{duration:t.durationMs,easing:t.easing})}},[e,t]),{dip:e=>n.current(e)}}var ETe=24;function x3(e,t){(0,Q.useEffect)(()=>{let n=e.current;if(!n||t.durationMs===0||typeof ResizeObserver>`u`)return;let r=[...n.querySelectorAll(`[${A4}]`)].filter(e=>e.querySelector(`:scope > ${I4(Lc.SIDEBAR)}, :scope > ${I4(Lc.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)<=ETe)continue;i.set(e,o);let c=performance.now();c-(a.get(e)??0)<t.durationMs||(a.set(e,c),e.animate([t.dipPeak(w4.COLUMN_RESIZE,{stage:n})],{duration:t.durationMs,easing:t.easing}))}});for(let e of r)o.observe(e);return()=>o.disconnect()},[e,t])}function S3(e,{axis:t,navigation:n,onObjectMeasured:r}){m3(e,r);let{dip:i}=b3(e,t),a=h3(e,n.focusedZone);x3(e,t);let o=t3(t.paneArrival===T4.FROM_PRESSED_ELEMENT||t.dialogArrival===D4.FROM_PRESSED_ELEMENT);s3(e,t,o),(0,Q.useEffect)(()=>{if(t.paneArrival!==T4.FROM_PRESSED_ELEMENT||!t.paneArrivalByViewTransition||t.durationMs===0||!STe())return;let n=Y4(`shell-view-transition`,bTe),r=Ose(CTe({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()},[]),g3(n,(n,r)=>{r===S4.CHANGED&&i(n),a.bringForward(n);let c=e.current,l=c?.querySelector(z4(n));if(c&&l&&t.durationMs!==0){if(r===S4.APPEARED&&t.paneArrival===T4.FROM_PRESSED_ELEMENT&&H4(l)){let e=o.takeRow(800);e&&n3(c,e,l.getBoundingClientRect(),t,l)}t.cascadesRows&&(s.current.get(n)?.(),s.current.set(n,o3(l,t)))}}),{frontZone:a.zone}}var C3=il.getLogger(),DTe=C3.debugByType(`ComponentRegistryLoaderService`);C3.setDebugTypeLogging(`ComponentRegistryLoaderService`,!1);function OTe(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||G.DEFAULT;Xo.isRegistered(r,n,e.category)||(Xo.register(r,n,e.component,{isConfigurable:e.isConfigurable!==!1,category:e.category}),t++)})})}),t>0&&DTe(`✅ Custom components loaded: ${t} components registered`)}function kTe(){let e=Xo.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:Xo.getRegistrationCount(),byCategory:t}}async function ATe(e){for(let t of e){let e=await t.loadComponent();Xo.register(t.componentRef,t.preset??G.DEFAULT,e,{isConfigurable:t.isConfigurable??!1})}}var w3=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,schema:i,disabled:a,readOnly:o,className:s,placeholder:c,controlSize:l=Jd.MD,targetResourceType:u,optionDisplayMode:d,onClear:f,leadingAdornment:p,quickCreateSourceFieldName:m,onQuickCreateCreated:h},g)=>{let _=FD(),{tComponent:v,isReady:y}=J({component:[U.RESOURCES_FIELDS_RESOURCE_REFERENCE,U.RESOURCES_LAYOUTS_LIST]}),{renderIcon:b}=kf(),x=l===Jd.SM?`sm`:`md`,S=l===Jd.SM?Gd.XS:Gd.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}=SV({schema:i,name:e,value:t,targetResourceType:u}),{registry:F}=pm(),I=d??Hu(i)?.edit?.optionDisplayMode??hs,L=k?F.resourceConfigurations[k]:void 0,ee=L?.mainSchema,R=P?bp({tComponent:v,componentType:U.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`fetchErrorEmptyMessage`,params:{message:P.message}}):M,z=Jz({sourceResourceType:PT()?.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&&ee&&e.data&&typeof e.data==`object`?(0,$.jsx)(vG,{resourceType:k,schema:V.resolveRowSchema(L,e.data)??ee,data:e.data,primaryLabel:e.label,contextResourceIdentifiers:_?.contextResourceIdentifiers}):e.label,[k,L,ee,_?.contextResourceIdentifiers]),ae=I===hc.SUMMARY?ie:void 0;return k?y?A?(0,$.jsxs)(`div`,{className:W(`flex items-start gap-element`,s),children:[(0,$.jsx)(fx,{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:Y.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(U.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:Jn.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:Jn.SM})})]}):(0,$.jsxs)(`div`,{className:W(`flex items-start gap-element`,s),children:[(0,$.jsx)(dx,{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:Y.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(U.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:Jn.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:Jn.SM})})]}):null:(0,$.jsx)(`div`,{className:W(`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]})})});w3.displayName=`ResourceFieldEditPreset_ResourceReference_Default`;var jTe=w3;function MTe(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 T3=W(`block rounded-md text-inherit no-underline transition-colors hover:bg-muted/40`,Ag(r_.OFFSET));function E3({label:e}){return(0,$.jsx)(Z,{as:`span`,variant:br.INHERIT,children:e})}var NTe=({fieldName:e,value:t,resourceType:n,data:r,displayParams:i,labelFallback:a,schema:o,className:s})=>{let{registry:c,doOperation:l}=pm(),{emit:u}=qo(),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}=J({component:U.RESOURCES_FIELDS_RESOURCE_REFERENCE,resource:p}),y=lp(),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??Dne,E=d?.parentReferenceConfig,{hidesWholeReference:D,visibleIds:O}=Q.useMemo(()=>lj({parentReferenceConfig:E,referencedResourceType:p,referencedIds:Pw(t)}),[E,p,t]),k=!!(E&&p&&E.parentResourceType===p&&E.displayMode!==Rt.NONE),A=(0,Q.useMemo)(()=>{if(!k||!E)return T;switch(E.displayMode){case Rt.CONTEXT:case Rt.BREADCRUMB:return T;case Rt.BADGE:case Rt.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===Rt.CONTEXT||E?.displayMode===Rt.BREADCRUMB)return!0}return i?.linkable??!0},[k,E,i?.linkable]),M=d?.navigationZone??f?.navigationZone,N=(0,Q.useContext)(bS),P=(0,Q.useCallback)(e=>{N?N.navigate(e):u(xc.NAVIGATION_REQUEST,{content:e.content,initiator:e.initiator,urlPath:e.urlPath})},[u,N]),F=Q.useMemo(()=>{if(!r||typeof r!=`object`||!p||Array.isArray(t))return null;let e=MTe({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,_]),I=(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]),L=(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?En.buildParentResourcesRequirements(n,t,c):[];return{refResourceConfig:e,ownFieldIdentifier:c.allResourceFieldIdentifiers?.[p],currentParentRequirements:r}},[p,c,d?.contextResourceIdentifiers,d?.resourceType,f?.contextResourceIdentifiers,f?.resourceType]),ee=d?.resourceType?{resourceType:d.resourceType,id:d.resourceId}:f?{resourceType:f.resourceType,id:f.resourceId}:void 0,R=ee?.resourceType,z=ee?.id,te=(0,Q.useCallback)(e=>Bm({hostIdentifiers:I,hostContextualParameters:b,hostParentRequirements:L?.currentParentRequirements,hostRecord:{resourceType:R,id:z},targetResourceType:p??``,targetId:e,registry:c}),[I,b,L?.currentParentRequirements,R,z,p,c]),ne=sS(nh(R,z==null?void 0:String(z),I)),re=Qp()?.currentUserId??null,ie=(0,Q.useCallback)((e,t,n)=>{let r=p===gu.USERS||p===gu.USER_SELF,i=n[Cl[gu.USERS]],a=r?t:typeof i==`string`?i:null;return(e.operations??[]).filter(t=>lh({...t,resourcePrimaryScope:t.resourcePrimaryScope??e.resourcePrimaryScope},{subjectUserId:a,viewerUserId:re},ne))},[p,ne,re]),ae=(0,Q.useCallback)(e=>{if(!L||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=L,r=te(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=ph({resourceConfig:t,operations:ie(t,e,a),coreOperation:K.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a});if(!o)return null;let s=za.buildOperationFrontendRoutePaths(t,o,c.allResourceFieldIdentifiers);if(s.length===0)return null;try{let t=En.selectMatchingRoutePath(s,i,p,n,r.parentRequirements,c.allResourceFieldIdentifiers);if(!t?.url)return null;let a=En.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=Um.resolveUrlPath(t.url,l);if(u&&!Um.hasUnresolvedPlaceholders(u))return{url:u,parentResourcesRequirements:a,readOp:o}}catch{}return null},[L,c,p,te,ie]),oe=(0,Q.useCallback)(e=>{if(!L||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=L,r=te(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=ph({resourceConfig:t,operations:ie(t,e,a),coreOperation:K.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:i,contextualParameters:a});return!o||o.operationFrontendConfig?.surface!==Jr.EMBEDDED?null:{readOp:o}},[L,c,p,te,ie]),se=(0,Q.useCallback)(e=>{let t=ae(e);if(t)return{readOp:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements};if(!L||!p)return null;let{refResourceConfig:n,ownFieldIdentifier:r}=L,i=te(e),a={...i.contextualParameters,...r?{[r]:e}:{}},o=ph({resourceConfig:n,operations:n.operations??[],coreOperation:K.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:En.buildParentResourcesRequirementsFromRouteParams(s.parameters,p,c)}:null},[ae,L,p,te,c]),ce=(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=se(e),{record:n,label:r}=await Iw({resourceType:p,id:e,registry:c,doOperation:l,...t?{readOperation:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements}:{},contextualParameters:te(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,_,te,y,se]);(0,Q.useEffect)(()=>{p&&O.length!==0&&A!==hc.ID&&(F&&O.length===1&&!C.current.has(O[0])?w(O[0],{id:O[0],label:F,data:r,error:null,isLoading:!1}):O.forEach(e=>{e&&!C.current.has(e)&&ce(e)}))},[p,O,A,ce,w,F]);let le=(0,Q.useCallback)((e,t)=>{if(!j||!p)return t;let n=A===hc.SUMMARY,r=ae(e),i=!!((M||N)&&r?.readOp&&r?.url),a=t=>{if(!i||!r||t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;let n={...te(e).identifiers,[p]:e},a=En.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:r.readOp,contextResourceIdentifiers:n,parentResourcesRequirements:r.parentResourcesRequirements});t.preventDefault(),P({content:{contentType:va.RESOURCE_OPERATION,resourceContext:a},initiator:{sourceZone:M??Vn.PRIMARY},urlPath:r.url})};if(k&&E?.onNavigateToParent)return r?.url?(0,$.jsx)(xh,{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)(xh,{to:r.url,className:n?T3:`text-primary hover:underline`,onClick:a,children:t});let o=oe(e);return o?(0,$.jsx)(`button`,{type:`button`,className:n?W(T3,`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=te(e),r=En.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:o.readOp,contextResourceIdentifiers:{...n.identifiers,[p]:e},parentResourcesRequirements:n.parentRequirements});P({content:{contentType:va.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:M??Vn.PRIMARY}})},children:t}):t},[P,N,A,L,j,k,M,E,ae,oe,p,te]),ue=(0,Q.useCallback)(e=>{if(A===hc.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)(mm,{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(U.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===Rt.BADGE){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(Nf,{variant:`secondary`,className:t?`cursor-pointer hover:opacity-[var(--opacity-hover)]`:void 0,onClick:t,children:r})}if(A===Rt.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)(vG,{resourceType:p,schema:i,data:t.data,primaryLabel:r,contextResourceIdentifiers:te(e).identifiers});return j?le(e,n):n}}return le(e,(0,$.jsx)(E3,{label:r}))}return hc.LABEL,le(e,(0,$.jsx)(E3,{label:r}))},[A,x,p,k,E,le,c,j,m,h,g,_,a]);return D?null:O.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):!p&&A!==hc.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:ue(O[0])}):(0,$.jsx)(`ul`,{className:W(`list-disc ps-4 space-y-item-xs`,s),children:O.map(e=>(0,$.jsx)(`li`,{children:ue(e)},e))})};function PTe(e,t){let n=S1(e),r={size:Df.LG,closeOnEscape:!0,closeOnOutsideClick:t?.closeOnOutsideClick??!0,modal:t?.modal??!0,showBackdrop:t?.showBackdrop??!0};return n===Ai.SHEET?{mode:n,side:Zo.END,...r}:{mode:n,...r}}var FTe=()=>{let{state:e}=Mx(),{closeOverlay:t}=SS(),n=e.overlay,r=n.length>0?n[n.length-1]:void 0,i=n.length>0,{title:a,description:o}=J$(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)(v1,{open:i,onOpenChange:c,title:a||void 0,description:o,config:s,children:r&&(0,$.jsx)(I0,{content:r.content,zone:Vn.OVERLAY,initiator:r.initiator,entryId:r.id})})},D3=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(FTe,{});function ITe({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,`ResourceLayout_ContainerDialogs`)(e);return(0,$.jsx)(n,{...t})}var O3=({resourceContext:e,onFiltersChange:t})=>{let{registry:n}=pm(),{resourceType:r}=e,[i,a]=(0,Q.useState)({}),o=(0,Q.useMemo)(()=>n.resourceConfigurations[r],[n,r]),s=(0,Q.useMemo)(()=>UG.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)(nq,{resourceType:r,filterFields:s,currentFilters:i,onFiltersChange:c})};function LTe({preset:e=G.DEFAULT,...t}){let n=q(U.RESOURCES_LAYOUTS_FILTERS,`ResourceLayout_Filters`)(e);return(0,$.jsx)(n,{...t})}var RTe=e=>(0,$.jsx)(lX,{...e,defaultViewMode:vs.TABLE}),k3=e=>(0,$.jsx)(FY,{...e,showCharts:!1}),A3=(0,Q.memo)(({resourceContext:e,item:t,onNavigate:n,className:r})=>{let{resourceType:i}=e,{registry:a}=pm(),{t:o,formatDate:s,formatDateTime:c,isReady:l}=J({component:U.RESOURCES_LAYOUTS_READ_SUMMARY,resource:i}),u=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${U.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)(eb,{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)(vG,{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)(vG,{resourceType:i,schema:p,data:t,contextResourceIdentifiers:e.contextResourceIdentifiers})]})})}):null});function zTe({preset:e,...t}){let n=t.resourceContext.operation.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey,r=e??n??Dc.DEFAULT,i=q(U.RESOURCES_LAYOUTS_READ_SUMMARY,`ResourceLayout_ReadSummary`)(r);return(0,$.jsx)(i,{...t})}var BTe=({resourceContext:e,item:t,summaryFields:n,fieldLabelsMap:r,onItemClick:i,operationsSlot:a,isSelected:o,className:s})=>{let{resourceType:c}=e,{registry:l}=pm(),{t:u,formatDate:d,formatDateTime:f,tResourceFieldEnumValue:p}=J({resource:c}),{tComponent:m}=J({component:U.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?mr.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?Ag(r_.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)(xJ,{className:`px-card py-element text-sm align-middle`,truncate:!0,"aria-label":r[n],children:i==null?(0,$.jsx)(Fj,{noValueLabel:m(U.LOW_LEVEL_FORM_FIELD,`noValue`),typography:Lj(_?.[n]?Kt(_[n]):void 0)}):(0,$.jsx)(IG,{fieldName:n,value:i,fieldSchema:_?.[n],fieldLabel:void 0,resourceType:c,record:t,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,tResourceFieldEnumValue:p})},n)}),a&&(0,$.jsx)(xJ,{className:`px-card py-element text-sm align-middle text-end`,onClick:e=>e.stopPropagation(),children:a})]})},VTe=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(zY,{resourceContext:e,navigationZone:t,navigationInitiator:n}),j3=({children:e=null})=>(0,$.jsx)(fX,{children:`PublicLayoutPreset_StaticContentContainer_Default`});function HTe({preset:e=G.DEFAULT,...t}){let n=q(U.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,`PublicLayout_StaticContentContainer`)(e);return(0,$.jsx)(n,{...t})}var UTe=Q.lazy(()=>s_(()=>import(`./ChartView-B6f1J6Er.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),WTe=Q.lazy(()=>s_(()=>import(`./ChartWidget-29BcqLsQ.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,9,4,5,6,11,12])));function GTe(){Xo.register(U.HIGH_LEVEL_VIEWS_CHART_ECHARTS,G.DEFAULT,UTe,{isConfigurable:!1}),Xo.register(U.HIGH_LEVEL_VIEWS_CHART_WIDGET,G.DEFAULT,WTe,{isConfigurable:!1}),Xo.register(U.APP_LAYOUTS_ERROR_BOUNDARY,G.DEFAULT,Ry,{isConfigurable:!0}),Xo.register(U.APP_LAYOUTS_HOME,G.DEFAULT,XU,{isConfigurable:!0}),Xo.register(U.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,G.DEFAULT,Hy,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,G.DEFAULT,j3,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_USER_AUTH,G.DEFAULT,dZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,G.DEFAULT,mZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_USER_INVITATION,G.DEFAULT,xZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,G.DEFAULT,jZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_USER_REGISTER,G.DEFAULT,YZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_ONE_OFF_SESSION,G.DEFAULT,CZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,G.DEFAULT,OZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_AUTH_CALLBACK,G.DEFAULT,vX,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,G.DEFAULT,SX,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,G.DEFAULT,tZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,G.DEFAULT,oZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_MFA_CHALLENGE,G.DEFAULT,QX,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_OAUTH_CONSENT,G.DEFAULT,NZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,G.DEFAULT,BZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,G.DEFAULT,UZ,{isConfigurable:!0}),Xo.register(U.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK,G.DEFAULT,RZ,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_BREADCRUMB,G.DEFAULT,PB,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,G.DEFAULT,D3,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_CONTAINER_NESTED,G.DEFAULT,_Y,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_CREATE,G.DEFAULT,dG,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_ACTION,G.DEFAULT,$W,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_FILTERS,G.DEFAULT,O3,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_HEADER,G.DEFAULT,lV,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_LIST,Ie.DEFAULT,lX,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_LIST,Ie.TABLE,RTe,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_OPERATIONS_BULK,G.DEFAULT,FJ,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,G.DEFAULT,yY,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_RECORD_SHARING,G.DEFAULT,jY,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_DANGER_ZONE,G.DEFAULT,wY,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_PAGINATION,G.DEFAULT,iK,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_READ,Gr.DEFAULT,FY,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_READ,Gr.EXPANDABLE,k3,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_READ_SUMMARY,Dc.DEFAULT,A3,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_READ_SUMMARY,Dc.TABLE_ROW,BTe,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_SEARCH,x.DEFAULT,zY,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_SEARCH,x.TABLE,VTe,{isConfigurable:!0}),Xo.register(U.RESOURCES_LAYOUTS_UPDATE,G.DEFAULT,VY,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,G.DEFAULT,pL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_BOOLEAN,G.DEFAULT,AI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_DATE,G.DEFAULT,rN,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_DATETIME,G.DEFAULT,oN,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_ENUM,G.DEFAULT,aI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_FILE,G.DEFAULT,WL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_MONEY,G.DEFAULT,XI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_DURATION,G.DEFAULT,QI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_PHONE,G.DEFAULT,aL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_ADDRESS,G.DEFAULT,uL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_NUMBER,G.DEFAULT,qI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,G.DEFAULT,gL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_DATE,G.DEFAULT,mN,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,G.DEFAULT,_N,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,G.DEFAULT,vL,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,G.DEFAULT,dN,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_RANGE_TIME,G.DEFAULT,bN,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_STRING,G.DEFAULT,GI,{isConfigurable:!0}),Xo.register(U.LOW_LEVEL_FORM_FIELD_TIME,G.DEFAULT,lN,{isConfigurable:!0}),Xo.register(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,G.DEFAULT,w3,{isConfigurable:!0,category:mc.EDIT}),Xo.register(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,et.SEARCH,jTe,{isConfigurable:!0,category:mc.EDIT}),Xo.register(U.RESOURCES_FIELDS_RESOURCE_REFERENCE,G.DEFAULT,NTe,{isConfigurable:!0,category:mc.DISPLAY})}var KTe=il.getLogger(),M3=new Set([U.LOW_LEVEL_CONTENT_SECTION_CONTAINER,U.LOW_LEVEL_OVERLAY_CONTAINER,U.LOW_LEVEL_AI_FLOW_NODE,U.LOW_LEVEL_AI_FLOW_EXECUTION,U.LOW_LEVEL_AI_SYSTEM_CATALOG,U.LOW_LEVEL_AI_ACTOR,U.LOW_LEVEL_AI_EXECUTION_PLAN,U.LOW_LEVEL_AI_TASK_DETAIL,U.LOW_LEVEL_AI_TASK_MEMORY,U.LOW_LEVEL_AI_EXECUTION_USAGE,U.LOW_LEVEL_AI_GRAPH_VIEWER,U.LOW_LEVEL_AI_APPROVAL,U.LOW_LEVEL_AI_DECISION,U.LOW_LEVEL_AI_EXECUTION_STREAM,U.LOW_LEVEL_AI_ARTIFACT_BROWSER,U.LOW_LEVEL_AI_AGENT_CONFIG,U.GUIDANCE_CHECKLIST,U.GUIDANCE_CHECKLIST_ITEM,U.GUIDANCE_TOUR,U.GUIDANCE_TOOLTIP,U.GUIDANCE_MODAL,U.GUIDANCE_BANNER,U.GUIDANCE_ANNOUNCEMENT,U.GUIDANCE_BADGE,U.GUIDANCE_CARD,U.GUIDANCE_SURVEY,U.GUIDANCE_ONBOARDING_VIEW,U.PROGRESSION_MILESTONE_TRACKER,U.PROGRESSION_ACHIEVEMENT_BADGE,U.LIFECYCLE_HOME_ACTIVATION_PROGRESS,U.LIFECYCLE_HOME_WELCOME_BACK,U.LIFECYCLE_HOME_DASHBOARD,U.HIGH_LEVEL_VIEWS_COMPOSITE,U.HIGH_LEVEL_VIEWS_CHART,U.HIGH_LEVEL_VIEWS_FULL_CUSTOM,U.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,U.HIGH_LEVEL_VIEWS_EXECUTION,U.HIGH_LEVEL_VIEWS_NOT_FOUND,U.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,U.APP_LAYOUTS_TEST_COMPONENT,U.APP_LAYOUTS_SECURITY_SETTINGS,U.APP_LAYOUTS_SETTINGS_HUB,U.APP_LAYOUTS_APPEARANCE_SETTINGS,U.APP_LAYOUTS_INVITATIONS_SETTINGS,U.APP_LAYOUTS_BILLING_SETTINGS,U.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,U.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,U.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,U.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,U.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,U.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,U.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,U.LOW_LEVEL_FORM_FIELD_FOREIGN_KEY,U.LOW_LEVEL_DISPLAY_FIELD_FOREIGN_KEY]);function N3(){let e=Object.values(U),t=[],n=0;for(let r of e)M3.has(r)||(Xo.hasComponentType(r)?n+=1:t.push(r));return{totalEnumValues:e.length,registeredCount:n,denyListedCount:M3.size,missing:t}}function qTe(e){let t=N3();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 KTe.warn(`component-registry.completeness-check.failed`,{message:n,missing:t.missing}),t}function JTe(e){return One(e)}var P3;(function(e){e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`})(P3||={});var YTe=/^#([0-9a-f]{6})$/i,XTe=/^#([0-9a-f]{3})$/i,ZTe=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/i,QTe=/^hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*(?:,\s*[\d.]+\s*)?\)$/i;function F3(e,t,n){return Math.min(n,Math.max(t,e))}function I3(e){let t=e.trim();if(t.length===0)return null;let n=YTe.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=XTe.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=ZTe.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=QTe.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:V3(e,t,n)}return null}function L3(e){let t=R3(e);return t===null?null:I3(t)}function R3(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 z3({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 B3({h:e,s:t,v:n}){let r=(e%360+360)%360,i=F3(t,0,100)/100,a=F3(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 V3(e,t,n){let r=(e%360+360)%360,i=F3(t,0,100)/100,a=F3(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 H3({r:e,g:t,b:n}){let r=e=>F3(Math.round(e),0,255).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function U3(e,t){if(t===P3.RGB)return`rgb(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)})`;if(t===P3.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 H3(e)}function $Te(e,t){return U3(B3(e),t)}function W3({r:e,g:t,b:n}){let r=e=>{let t=F3(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 eEe=()=>{let e=(0,Q.useContext)(TH);if(!e)throw Error(`useStepUpAuth must be used within a StepUpAuthProvider`);return e},G3=class extends Error{code;httpStatus;constructor(e,t,n){super(t),this.name=`CrossFrontendHandoffClientError`,this.code=e,this.httpStatus=n}};async function K3(e,t){let n;try{n=await Tc().crossFrontendHandoff(e,t)}catch(e){throw nEe(e)}if(!n||typeof n.handoffUrl!=`string`||typeof n.expiresAt!=`string`)throw new G3(`malformed_response`,`Cross-frontend handoff response missing required fields`,null);return{handoffUrl:n.handoffUrl,expiresAt:n.expiresAt}}var tEe=new Set(Object.values(Dae));function nEe(e){if(e instanceof G3)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 G3(`network`,t?.message??`Cross-frontend handoff request failed (no response)`,null);if(n===401)return new G3(`unauthenticated`,`Cross-frontend handoff requires an authenticated session`,401);let r=t?.response?.data?.error?.details?.code??t?.context?.code;return typeof r==`string`&&tEe.has(r)?new G3(r,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n):new G3(`malformed_response`,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n)}function rEe(){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 K3(e,n);return!o.current&&i===s.current&&(r(a),t(`success`)),a}catch(e){let n=e instanceof G3?e:new G3(`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 q3(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 J3(e,t,n,r=!1){let i=e.filter(e=>q3(e,t,n));return r&&i.length===0&&e.length>0&&(e.some(e=>e.contentKind===kc.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 Y3(e,t,n){return{appScopeValues:e,activeMode:t,availableModes:n}}function X3(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=q3(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 iEe(e){return w0(e)}function aEe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FEATURE_UNAVAILABLE_DIALOG,`FeatureUnavailableDialog`)(e);return(0,$.jsx)(n,{...t})}function oEe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FEATURE_LOCK_BADGE,`FeatureLockBadge`)(e);return(0,$.jsx)(n,{...t})}function Z3({featureId:e,showLabel:t=!0,size:n=`sm`,preset:r=G.DEFAULT}){let{getLimit:i,getCurrentUsage:a}=yh(),{t:o}=J(),s=i(e),c=a(e)??0;if(s===void 0||s===-1)return null;let l=hl(Yne.LIMIT,e),u=o(l),d=u===l?e:u,f=q(U.LOW_LEVEL_FEATURE_LIMIT_INDICATOR,`FeatureLimitIndicator`)(r);return(0,$.jsx)(f,{usage:c,limit:s,label:d,showLabel:t,size:n})}var Q3=$o.BILLING,$3={kind:gs.SETTINGS_SECTION,sectionRef:Q3,category:o.BILLING,searchKeywords:[`billing`,`subscription`,`plan`,`payment`,`invoice`,`upgrade`],runtimeAvailability:{requiredCapabilities:[`billingEnabled`]}};function e6(e){let t=bm(),n=oS(),r=(0,Q.useContext)(ah)?.user?._id,i=e!==void 0&&e===r;return(0,Q.useMemo)(()=>t?gie(t.getAvailableResourceTypes().flatMap(e=>{let n=t.getResourceConfiguration(e);return n?[{resourceIdentifier:e,operations:n.operations??[]}]:[]}),i?{initiatorMayPerform:e=>Gm({resourceType:e.resourceIdentifier,roles:e.roles,operationIdentifier:e.operationIdentifier,resourceOperationLike:e.resourceOperationLike},n)}:{}):[],[t,n,i])}function t6(e){for(let t of e)for(let e of t)if(e.userNotifications?.some(e=>e.channel===ko.SMS))return!0;return!1}function n6(e){let t=bm(),n=(0,Q.useContext)(ah)?.user?._id,r=e!==void 0&&e===n,i=(0,Q.useMemo)(()=>t?t6(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 Tc().getMyMethods().then(t=>{e||o((t.methods??[]).some(e=>e.method===Us.SMS_OTP&&e.enrolled))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[i,r]),i&&r&&a}var sEe=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=dp(),[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(Bn.RESOURCE_UPDATED,e=>{if(e.resourceType===t){if(n){if(e.resourceId!==n||e.deliveryTarget!==ou.RESOURCE_ROOM_SYNC&&e.deliveryTarget!==ou.RESOURCE_ROOM_NOTIFICATION)return}else if(e.deliveryTarget!==ou.SCOPE_ROOM_NOTIFICATION)return;s?.(e)}}),r=f.on(Bn.RESOURCE_DELETED,e=>{e.resourceType===t&&n&&e.resourceId===n&&c?.(e)}),i=f.on(Bn.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(Bn.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(Bn.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}},r6=`this-session`;function i6(e,t){let{emit:n}=qo(),{registry:r}=pm(),i=(0,Q.useRef)(!1),a=r.notificationBadgeDefinitions.find(t=>we(t)===e),o=a?.source.kind===une.FRONTEND_PRODUCED;(0,Q.useEffect)(()=>{if(!o){!i.current&&bi.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=ote(e);r&&t$(n,{badgeReference:Yi(r.scope,r6,r.identifier),badgeCount:Math.max(0,Math.trunc(t))})},[e,t,o,a,n])}function cEe({milestoneRef:e,className:t}){let n=CU(),{tComponent:r,isReady:i}=J({component:U.PROGRESSION_ACHIEVEMENT_BADGE}),{renderIcon:a}=kf(),o=(0,Q.useMemo)(()=>(e,t)=>r(U.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:Jn.XS,className:`text-success`}):a(H.LOCK,{size:Jn.XS});return(0,$.jsxs)(Nf,{variant:s?`default`:`outline`,className:W(`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 a6=U.LOW_LEVEL_AI_ACTOR;function o6(e){return`role_${e}`}function s6(e){return`mode_${e}`}function c6(e){return`modeDesc_${e}`}var lEe={[Ol.COORDINATOR]:H.USERS,[Ol.TASK_PLANNER]:H.BOOK,[Ol.OPERATOR]:H.WRENCH,[Ol.ANALYZER]:H.SEARCH,[Ol.REVIEWER]:H.CHECK_CIRCLE,[Ol.HUMAN_IN_THE_LOOP]:H.LOCK,[Ol.FLOW_EXECUTION]:H.ARROW_RIGHT},uEe={[Zn.AGENTIC]:H.BRAIN,[Zn.FLOW_EXECUTION]:H.ARROW_RIGHT,[Zn.HUMAN_INTERACTION]:H.USERS,[Zn.PROGRAMMATIC]:H.SETTINGS},dEe={[Ol.COORDINATOR]:`default`,[Ol.TASK_PLANNER]:`default`,[Ol.OPERATOR]:`secondary`,[Ol.ANALYZER]:`secondary`,[Ol.REVIEWER]:`outline`,[Ol.HUMAN_IN_THE_LOOP]:`destructive`,[Ol.FLOW_EXECUTION]:`outline`},l6=e=>Object.values(Ol).includes(e),fEe=e=>Object.values(Zn).includes(e),u6;(function(e){e.IDLE=`idle`,e.EXECUTING=`executing`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`})(u6||={});var pEe={[u6.IDLE]:ao.NEUTRAL,[u6.EXECUTING]:ao.INFO,[u6.AWAITING_APPROVAL]:ao.WARNING,[u6.COMPLETED]:ao.SUCCESS};function mEe(e){return W(Wf[pEe[e]],e===u6.EXECUTING&&`motion-safe:animate-pulse`)}function d6(e){return`status_${e}`}var hEe=({systemName:e,actors:t,systemRef:n,executions:r,className:i,children:a,...o})=>{let{tComponent:s,isReady:c}=J({component:a6}),l=EW(),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:W(`flex flex-col gap-card`,i),"aria-label":s(a6,`loading`),...o,children:[(0,$.jsx)(mm,{className:`h-6 w-48`}),(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:[(0,$.jsx)(mm,{className:`h-40`}),(0,$.jsx)(mm,{className:`h-40`}),(0,$.jsx)(mm,{className:`h-40`})]})]}):u&&u.length===0?(0,$.jsx)(`div`,{className:W(`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(a6,`noActors`)})}):(0,$.jsxs)(`div`,{className:W(`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(a6,`teamTitle`,{name:e})}),u&&(0,$.jsx)(Z,{as:`span`,size:gc.XS,variant:br.MUTED,children:s(a6,`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)(Nf,{variant:`outline`,className:`text-2xs`,children:s(a6,`roleCount`,{role:l6(e)?s(a6,o6(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)(f6,{actor:e,status:gEe(e,Ln(u)?.ref,n,d)},e.ref)):a})]}):null};function gEe(e,t,n,r){if(!r||!n||e.ref!==t)return u6.IDLE;let i=!1;for(let e of r.values())if(e.systemRef===n){if(e.status===yW.RUNNING||e.status===yW.STARTING)return u6.EXECUTING;if(e.status===yW.AWAITING_APPROVAL)return u6.AWAITING_APPROVAL;e.status===yW.COMPLETED&&(i=!0)}return i?u6.COMPLETED:u6.IDLE}var f6=({actor:e,actorRef:t,displayName:n,roleCategory:r,executionMode:i,description:a,agentRef:o,flowRef:s,status:c=u6.IDLE,currentTask:l,onAgentClick:u,onFlowClick:d,className:f,...p})=>{let{tComponent:m,isReady:h}=J({component:a6}),{renderIcon:g}=kf();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(a6,d6(c));return(0,$.jsxs)(kF,{className:W(`flex flex-col`,f),...p,children:[(0,$.jsxs)(jF,{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)(p6,{role:y}),(0,$.jsx)(m6,{mode:b})]}),(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:(0,$.jsx)(`span`,{role:`img`,"aria-label":w,className:W(`inline-block size-2.5 shrink-0 rounded-full`,mEe(c))})}),(0,$.jsx)(rj,{side:Zo.TOP,className:`text-xs`,children:w})]})]}),(0,$.jsx)(NF,{className:`text-sm`,children:v}),(0,$.jsx)(FF,{className:`text-xs`,children:_})]}),(0,$.jsxs)(IF,{className:`flex flex-col gap-element`,children:[x&&(0,$.jsx)(Z,{size:gc.XS,variant:br.MUTED,"aria-label":m(a6,`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(a6,`currentTask`),children:[g(H.LOADER_2,{size:Jn.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(a6,`linkedAgent`)}: ${S}`,children:[g(H.BRAIN,{size:Jn.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(a6,`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(a6,`linkedFlow`)}: ${C}`,children:[g(H.ARROW_RIGHT,{size:Jn.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(a6,`linkedFlow`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:C})]})]})]})]})},p6=({role:e,className:t})=>{let{tComponent:n,isReady:r}=J({component:a6}),{renderIcon:i}=kf();if(!r)return null;let a=l6(e),o=a?lEe[e]:void 0,s=a?n(a6,o6(e)):e;return(0,$.jsxs)(Nf,{variant:a?dEe[e]:`secondary`,className:W(`text-2xs gap-1`,t),children:[o&&i(o,{size:Jn.XS}),s]})},m6=({mode:e,className:t})=>{let{tComponent:n,isReady:r}=J({component:a6}),{renderIcon:i}=kf();if(!r)return null;let a=fEe(e),o=a?uEe[e]:void 0,s=a?n(a6,s6(e)):e,c=a?n(a6,c6(e)):void 0,l=(0,$.jsxs)(Nf,{variant:`outline`,className:W(`text-2xs gap-1`,t),children:[o&&i(o,{size:Jn.XS}),s]});return c?(0,$.jsxs)(tj,{children:[(0,$.jsx)(nj,{asChild:!0,children:l}),(0,$.jsx)(rj,{side:Zo.TOP,className:`text-xs`,children:c})]}):l},_Ee=Q.lazy(()=>s_(()=>import(`./flows-actors-graph-runtime-YwzVDPst.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]))),vEe=Q.lazy(()=>s_(()=>import(`./flows-actors-graph-runtime-YwzVDPst.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]))),yEe=Q.lazy(()=>s_(()=>import(`./flows-actors-graph-runtime-YwzVDPst.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]))),bEe=Q.lazy(()=>s_(()=>import(`./flows-actors-graph-runtime-YwzVDPst.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]))),xEe=Q.lazy(()=>s_(()=>import(`./flows-actors-graph-runtime-YwzVDPst.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]))),h6=e=>(0,$.jsx)(RJ,{doorName:`AI_GraphViewer`,fallback:(0,$.jsx)(zJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(mm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(xEe,{...e})})}),SEe=e=>(0,$.jsx)(RJ,{doorName:`AI_FlowExecutionCanvas`,fallback:(0,$.jsx)(zJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(mm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(_Ee,{...e})})}),CEe=e=>(0,$.jsx)(RJ,{doorName:`AI_FlowExecutionSummary`,fallback:(0,$.jsx)(zJ,{className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(mm,{"aria-hidden":`true`,className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(vEe,{...e})})}),g6=e=>(0,$.jsx)(RJ,{doorName:`AI_FlowExecutionTimeline`,fallback:(0,$.jsx)(zJ,{className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(mm,{"aria-hidden":`true`,className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(yEe,{...e})})}),wEe=e=>(0,$.jsx)(RJ,{doorName:`AI_FlowExecutionTimelineItem`,fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(zJ,{className:`h-8 w-full`})}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(mm,{className:`h-8 w-full`})}),children:(0,$.jsx)(bEe,{...e})})}),_6=U.LOW_LEVEL_AI_SYSTEM_CATALOG,TEe=[`all`,`draft`,`active`,`inactive`,`deprecated`,`archived`];function EEe(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 DEe=({className:e,defaultKindFilter:t=`all`,defaultStatusFilter:n=`all`,defaultViewMode:r=`grid`,onSelectSystem:i,onLaunch:a,...o})=>{let{tComponent:s,isReady:c}=J({component:_6}),{systems:l,isLoading:u,error:d,refreshSystems:f}=TW(),[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&&!EEe(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)(b6,{system:w,onBack:E,onLaunch:a,className:e,...o}):c?d?(0,$.jsxs)(`div`,{className:W(`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:br.DESTRUCTIVE,children:s(_6,`errorState`)}),(0,$.jsx)(X,{type:`button`,variant:Y.SECONDARY,size:Gd.SM,onClick:()=>void f(),children:s(_6,`retry`)})]}):(0,$.jsxs)(`div`,{className:W(`flex flex-col gap-card`,e),...o,children:[(0,$.jsx)(OEe,{searchQuery:p,onSearchChange:m,kindFilter:h,onKindFilterChange:g,statusFilter:_,onStatusFilterChange:v,viewMode:y,onViewModeChange:b,systemCount:C.length,totalCount:l.length}),u?(0,$.jsx)(kEe,{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:br.MUTED,children:l.length===0?s(_6,`emptyState`):s(_6,`emptyFilteredState`)})}):y===`grid`?(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,$.jsx)(v6,{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)(y6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))})]}):null},OEe=({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}=J({component:_6});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)(tN,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:u(_6,`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(_6,`allKinds`)}),(0,$.jsx)(uO,{value:`flow`,children:u(_6,`kindFlow`)}),(0,$.jsx)(uO,{value:`actor`,children:u(_6,`kindActor`)})]})}),(0,$.jsx)(_F,{name:`statusFilter`,schema:gd(),options:TEe.map(e=>({value:e,label:u(_6,`status_${e}`)})),value:i,onChange:e=>a(e),placeholder:u(_6,`filterByStatus`),size:Jd.SM})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Z,{as:`span`,size:gc.XS,variant:br.MUTED,children:u(_6,`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(_6,`gridView`)}),(0,$.jsx)(uO,{value:`list`,children:u(_6,`listView`)})]})})]})]}):null},kEe=({viewMode:e})=>e===`list`?(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:Array.from({length:4},(e,t)=>(0,$.jsx)(mm,{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)(mm,{className:`h-52 w-full rounded-lg`},t))}),v6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=J({component:_6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(kF,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:W(`flex cursor-pointer flex-col transition-shadow hover:shadow-[var(--shadow-md)]`,Ag(r_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(jF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(S6,{kind:e.kind}),(0,$.jsx)(C6,{status:e.status}),s.riskLevel!==`low`&&(0,$.jsx)(w6,{level:s.riskLevel})]}),(0,$.jsx)(NF,{className:`text-sm`,children:e.displayName}),(0,$.jsx)(FF,{className:`line-clamp-2 text-xs`,children:e.description})]}),(0,$.jsxs)(IF,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-element`,children:(0,$.jsx)(Nf,{variant:`outline`,className:`text-2xs`,children:i(_6,`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)(Nf,{variant:`outline`,className:`text-2xs`,children:e.category}),e.tags?.map(e=>(0,$.jsx)(Nf,{variant:`secondary`,className:`text-2xs`,children:e},e))]})]}),t&&(0,$.jsx)(MF,{className:`mt-auto`,children:(0,$.jsx)(X,{type:`button`,variant:o?Y.DEFAULT:Y.SECONDARY,disabled:!o,onClick:n=>{n.stopPropagation(),t(e.ref)},className:`w-full`,children:i(_6,`launch`)})})]}):null},y6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=J({component:_6}),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:W(`flex cursor-pointer items-center gap-card rounded-lg border bg-card p-card-sm transition-shadow hover:shadow-[var(--shadow-md)]`,Ag(r_.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)(S6,{kind:e.kind}),(0,$.jsx)(C6,{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)(w6,{level:s.riskLevel})})]}),t&&(0,$.jsx)(X,{type:`button`,variant:o?Y.DEFAULT:Y.SECONDARY,disabled:!o,size:Gd.SM,onClick:n=>{n.stopPropagation(),t(e.ref)},children:i(_6,`launch`)})]}):null},b6=({system:e,onBack:t,onLaunch:n,className:r,...i})=>{let{tComponent:a,isReady:o}=J({component:_6}),s=EW(),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:W(`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:Y.GHOST,size:Gd.SM,onClick:t,className:`self-start`,children:a(_6,`backToCatalog`)}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.displayName}),(0,$.jsx)(Z,{variant:br.MUTED,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(S6,{kind:e.kind}),(0,$.jsx)(C6,{status:e.status}),c.riskLevel!==`low`&&(0,$.jsx)(w6,{level:c.riskLevel})]})]}),n&&(0,$.jsx)(X,{type:`button`,variant:l?Y.DEFAULT:Y.SECONDARY,disabled:!l,onClick:()=>n(e.ref),children:a(_6,`launch`)})]}),(0,$.jsxs)(cO,{defaultValue:`config`,children:[(0,$.jsxs)(lO,{children:[(0,$.jsx)(uO,{value:`config`,children:a(_6,`detailConfig`)}),e.kind===`flow`&&(0,$.jsx)(uO,{value:`preview`,children:a(_6,`flowPreview`)}),e.kind===`actor`&&(0,$.jsx)(uO,{value:`preview`,children:a(_6,`actorTeamPreview`)}),(0,$.jsx)(uO,{value:`executions`,children:a(_6,`executionHistory`)})]}),(0,$.jsx)(dO,{value:`config`,children:(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2`,children:[(0,$.jsxs)(kF,{children:[(0,$.jsx)(jF,{children:(0,$.jsx)(NF,{className:`text-sm`,children:a(_6,`detailConfig`)})}),(0,$.jsxs)(IF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(x6,{label:a(_6,`scope`),value:a(_6,`scope_${c.primaryScope}`)}),(0,$.jsx)(x6,{label:a(_6,`riskLevel`),value:(0,$.jsx)(w6,{level:c.riskLevel})})]})]}),(0,$.jsxs)(kF,{children:[(0,$.jsx)(jF,{children:(0,$.jsx)(NF,{className:`text-sm`,children:a(_6,`detailMetadata`)})}),(0,$.jsxs)(IF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(x6,{label:a(_6,`detailRef`),value:e.ref}),(0,$.jsx)(x6,{label:a(_6,`detailKind`),value:e.kind}),(0,$.jsx)(x6,{label:a(_6,`detailStatus`),value:e.status}),e.category&&(0,$.jsx)(x6,{label:a(_6,`detailCategory`),value:e.category}),e.tags&&e.tags.length>0&&(0,$.jsx)(x6,{label:a(_6,`detailTags`),value:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-element`,children:e.tags.map(e=>(0,$.jsx)(Nf,{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)(x6,{label:e,value:t},e))})]})]})]})}),(0,$.jsx)(dO,{value:`preview`,children:(0,$.jsx)(kF,{children:(0,$.jsx)(IF,{className:`p-card`,children:(0,$.jsx)(Z,{variant:br.MUTED,children:e.kind===`flow`?a(_6,`flowPreviewPlaceholder`):a(_6,`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:br.MUTED,children:a(_6,`noExecutions`)})}):(0,$.jsx)(of,{className:`max-h-96`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:u.map(e=>(0,$.jsx)(jEe,{execution:e},e.executionId))})})})]})]}):null},x6=({label:e,value:t})=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsx)(Z,{as:`span`,size:gc.XS,variant:br.MUTED,className:`font-medium`,children:e}),(0,$.jsx)(Z,{as:`span`,size:gc.XS,className:`text-end`,children:t})]}),AEe={[yW.IDLE]:`outline`,[yW.STARTING]:`secondary`,[yW.RUNNING]:`default`,[yW.AWAITING_APPROVAL]:`secondary`,[yW.COMPLETED]:`default`,[yW.CANCELLED]:`outline`,[yW.ERROR]:`destructive`},jEe=({execution:e})=>{let{tComponent:t,isReady:n}=J({component:_6});return n?(0,$.jsxs)(`div`,{className:`flex items-center gap-card rounded-lg border bg-card p-card-sm`,children:[(0,$.jsx)(Nf,{variant:AEe[e.status]??`secondary`,className:`text-2xs`,children:t(_6,`execStatus_${e.status}`)}),(0,$.jsx)(Z,{as:`span`,size:gc.XS,variant:br.MUTED,className:`flex-1 truncate`,children:e.executionId})]}):null},S6=({kind:e,className:t})=>{let{tComponent:n,isReady:r}=J({component:_6});return r?(0,$.jsx)(Nf,{variant:e===`flow`?`default`:`secondary`,className:W(`text-2xs`,t),children:e===`flow`?n(_6,`kindFlow`):n(_6,`kindActor`)}):null},MEe={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)]`}},C6=({status:e,className:t})=>{let{tComponent:n,isReady:r}=J({component:_6}),i=MEe[e]??{variant:`secondary`};return r?(0,$.jsx)(Nf,{variant:i.variant,className:W(`text-2xs`,i.extraClass,t),children:n(_6,`status_${e}`)}):null},NEe={low:{variant:`outline`},medium:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},high:{variant:`destructive`},critical:{variant:`destructive`,extraClass:`animate-pulse`}},w6=({level:e,className:t})=>{let{tComponent:n,isReady:r}=J({component:_6}),i=NEe[e]??{variant:`outline`};return r?(0,$.jsx)(Nf,{variant:i.variant,className:W(`text-2xs`,i.extraClass,t),children:n(_6,`riskLevel_${e}`)}):null},T6=U.LOW_LEVEL_AI_EXECUTION_PLAN,PEe=[to.COMPLETED,to.PROCESSING,to.AWAITING_APPROVAL,to.FAILED],E6=({plan:e,className:t,...n})=>{let{tComponent:r,isReady:i}=J({component:T6}),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:W(`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(T6,`title`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.goalDescription})]}),(0,$.jsx)(gf,{status:e.status})]}),(0,$.jsx)(O6,{total:e.planSteps.length,statusCounts:o}),(0,$.jsx)(of,{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)(D6,{step:e,index:t,resolvedStatus:n?.status??e.status,statusChanges:n?.statusChanges,nameOfStep:s},e._id)})})})]}):null},D6=({step:e,index:t,resolvedStatus:n,statusChanges:r,nameOfStep:i,className:a,...o})=>{let{tComponent:s,isReady:c,formatTime:l,formatList:u}=J({component:T6}),{statusWord:d,isReady:f}=Qf(),{word:p,isReady:m}=ff(Gf),{renderIcon:h}=kf(),g=Q.useMemo(()=>ce(e),[e]),[_,v]=Q.useState(!1),y=g.length>0||r&&r.length>0;return!c||!f||!m?null:(0,$.jsxs)(`li`,{className:W(`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:W(`size-2.5 shrink-0 rounded-full`,cf(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)(Nf,{variant:`outline`,className:`text-2xs`,children:p(e.topic)}),(0,$.jsx)(gf,{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:Y.LINK,size:Gd.SM,className:`h-auto p-0 text-2xs`,children:[h(_?H.CHEVRON_DOWN:H.CHEVRON_RIGHT,{size:Jn.XS}),s(T6,`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(T6,`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:W(`size-1.5 rounded-full`,cf(e.status))}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:d(e.status)}),(0,$.jsx)(`time`,{className:`text-muted-foreground`,dateTime:e.timestamp,children:Kd.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(T6,`stepCreatedAt`,{time:Kd.formatTimestamp(e.createdAt,l)})})})]})]})]})]})},O6=({total:e,statusCounts:t,className:n,...r})=>{let{tComponent:i,isReady:a}=J({component:T6}),{statusWord:o,isReady:s}=Qf(),c=t[to.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(to).flatMap(e=>{let n=t[e]??0;return e!==to.COMPLETED&&n>0?[{status:e,count:n}]:[]});return!a||!s?null:(0,$.jsxs)(`div`,{className:W(`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(T6,`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:W(`h-full motion-safe:transition-all`,cf(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:W(`inline-block size-1.5 rounded-full`,cf(e))}),i(T6,`progressLegendEntry`,{status:o(e),count:t})]},e))})]})},k6=U.LOW_LEVEL_AI_TASK_DETAIL;function A6(e){switch(e.kind){case Jt.TASK:return e.taskId;case Jt.PLAN_STEP:return e.planStepId;case Jt.PLAN:return e.planId;case Jt.ACTOR:return e.actorId;case Jt.ACTOR_SYSTEM:return e.actorSystemId;case Jt.FLOW:return e.flowId;case Jt.FLOW_STEP:return e.stepId}}var j6=({task:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a,formatDateTime:o}=J({component:k6}),{word:s,isReady:c}=ff(Gf),{word:l,isReady:u}=ff(If),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)(kF,{statusEdge:Cf(e.status),className:W(`flex flex-col`,n),...r,children:[(0,$.jsxs)(jF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Nf,{variant:`outline`,className:`text-2xs`,children:s(e.topic)}),(0,$.jsx)(gf,{status:e.status}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:i(k6,`actor`)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.actors.actorRef})]})]}),(0,$.jsx)(NF,{className:`text-sm`,children:e.title}),(0,$.jsx)(FF,{className:`text-xs`,children:e.description})]}),(0,$.jsxs)(IF,{className:`flex flex-col gap-card-sm`,children:[e.input!==void 0&&(0,$.jsx)(M6,{label:i(k6,`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)(M6,{label:i(k6,`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)(M6,{label:i(k6,`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(k6,`contextEmpty`)})}),f&&(0,$.jsx)(M6,{label:i(k6,`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)??A6(e)})]},n))})}),p&&(0,$.jsx)(M6,{label:i(k6,`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)(Nf,{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)(P6,{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(k6,`started`)}),(0,$.jsx)(`span`,{children:Kd.formatTimestamp(e.startedAt,o)})]}),e.completedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(k6,`completed`)}),(0,$.jsx)(`span`,{children:Kd.formatTimestamp(e.completedAt,o)})]}),e.startedAt&&(0,$.jsx)(`span`,{className:`font-mono`,children:Kd.formatDuration(e.startedAt,e.completedAt)})]})]})]})};function M6({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:Y.GHOST,size:Gd.SM,className:`h-auto justify-start p-0 text-xs font-medium`,children:e})}),(0,$.jsx)(TO,{className:`mt-1`,children:t})]})}var N6=({tasks:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a}=J({component:k6}),{statusWord:o,isReady:s}=Qf(),{word:c,isReady:l}=ff(Gf),[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:W(`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(k6,`filterByStatus`)}),(0,$.jsx)(X,{type:`button`,variant:u===null?Y.SECONDARY:Y.GHOST,size:Gd.SM,className:`h-6 text-2xs`,onClick:()=>d(null),children:i(k6,`filterAll`)}),g.map(e=>(0,$.jsx)(X,{type:`button`,variant:u===e?Y.SECONDARY:Y.GHOST,size:Gd.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(k6,`filterByTopic`)}),(0,$.jsx)(X,{type:`button`,variant:f===null?Y.SECONDARY:Y.GHOST,size:Gd.SM,className:`h-6 text-2xs`,onClick:()=>p(null),children:i(k6,`filterAll`)}),_.map(e=>(0,$.jsx)(X,{type:`button`,variant:f===e?Y.SECONDARY:Y.GHOST,size:Gd.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(k6,`sortBy`)}),(0,$.jsx)(X,{type:`button`,variant:m===`createdAt`?Y.SECONDARY:Y.GHOST,size:Gd.SM,className:`h-6 text-2xs`,onClick:()=>h(`createdAt`),children:i(k6,`sortDate`)}),(0,$.jsx)(X,{type:`button`,variant:m===`status`?Y.SECONDARY:Y.GHOST,size:Gd.SM,className:`h-6 text-2xs`,onClick:()=>h(`status`),children:i(k6,`sortStatus`)})]})]}),(0,$.jsx)(of,{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(k6,`noTasks`)}),v.map(e=>(0,$.jsx)(j6,{task:e,...t?{nameOf:t}:{}},e._id))]})})]})},P6=({events:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatTime:a}=J({component:k6}),o=Q.useMemo(()=>[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[e]);return i?(0,$.jsxs)(`div`,{className:W(`flex flex-col gap-1`,t),...n,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:r(k6,`timeline`)}),(0,$.jsx)(of,{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?Kd.formatDuration(o[t-1].timestamp,e.timestamp):void 0;return(0,$.jsxs)(`li`,{className:`ms-4`,children:[(0,$.jsx)(`div`,{className:W(`absolute -start-1.5 mt-1.5 size-3 rounded-full`,cf(e.status))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(gf,{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:Kd.formatTimestamp(e.timestamp,a)})]},`${e.status}-${e.timestamp}-${t}`)})})})]}):null},F6=U.LOW_LEVEL_AI_TASK_MEMORY,FEe={short_term:`⚡`,long_term:`📦`,working:`🔧`},IEe=({memory:e,className:t,...n})=>{let{tComponent:r,isReady:i}=J({component:F6}),a=e.shortTerm.entries.length+e.longTerm.entries.length+e.working.entries.length;return i?(0,$.jsxs)(`div`,{className:W(`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(F6,`title`)}),(0,$.jsx)(Nf,{variant:`secondary`,className:`text-2xs`,children:a})]}),(0,$.jsx)(I6,{scope:`short_term`,label:r(F6,`shortTerm`),store:e.shortTerm,defaultOpen:!0}),(0,$.jsx)(I6,{scope:`long_term`,label:r(F6,`longTerm`),store:e.longTerm}),(0,$.jsx)(I6,{scope:`working`,label:r(F6,`working`),store:e.working})]}):null},I6=({scope:e,label:t,store:n,defaultOpen:r=!1,className:i,...a})=>{let{tComponent:o,isReady:s}=J({component:F6}),c=FEe[e]??`📋`;return s?(0,$.jsxs)(CO,{defaultOpen:r,className:W(`rounded-md border`,i),...a,children:[(0,$.jsx)(wO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:Y.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)(Nf,{variant:`secondary`,className:`text-2xs`,children:n.entries.length})]})}),(0,$.jsx)(TO,{children:(0,$.jsx)(of,{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)(L6,{entry:e},e.key)),n.entries.length===0&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:o(F6,`scopeEmpty`)})]})})})]}):null},L6=({entry:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatDateTime:a}=J({component:F6}),o=e.expiresAt?new Date(e.expiresAt).getTime()<Date.now():!1;return i?(0,$.jsxs)(`div`,{className:W(`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)(Nf,{variant:`outline`,className:`text-2xs`,children:e.type}),o&&(0,$.jsx)(Nf,{variant:`destructive`,className:`text-2xs`,children:r(F6,`expired`)}),e.expiresAt&&!o&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(F6,`expires`),`: `,(0,$.jsx)(`time`,{dateTime:e.expiresAt,children:Kd.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(F6,`metadata`),`:`]}),Object.entries(e.metadata).map(([e,t])=>(0,$.jsxs)(Nf,{variant:`outline`,className:`text-2xs`,children:[e,`: `,String(t)]},e))]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground/60`,dateTime:e.timestamp,children:Kd.formatTimestamp(e.timestamp,a)})]}):null},R6=new WeakMap;function LEe(e){let{doOperation:t,operationPathKey:n,contextualParameters:r,executionId:i}=e,a=R6.get(t);a||(a=new Map,R6.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),REe(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 REe(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 zEe=Object.freeze({});function z6(e,t){return V.buildConfigurationError(rs.CONFIGURATION,{message:e,component:`useEmbeddedResourceContext`,...t})}function B6(e){return typeof e.operationIdentifier==`string`}function BEe(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 z6(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?Pm({operation:s,resourceType:t,resourceConfig:e}):!1;if(e&&c&&s.isBulkOperation!==!0&&!Uh({resourceConfig:e,operation:s,registry:r,hasResourceId:En.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw z6(`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 V6(e){return e.hostResourceType!==void 0&&e.target.resourceType===e.hostResourceType&&!e.target.resourceId&&!jo(e.operation)&&En.selfReferenceForeignKeysOf(e.hostResourceType,e.registry).length>0}function H6(){let e=BU(),{registry:t}=pm(),n=e?.hostResourceType,r=e?.contextResourceIdentifiers??zEe,i=(0,Q.useMemo)(()=>{if(!n)return;let e=t.resourceConfigurations[n];if(!e)throw z6(`Composite resource runtime cannot resolve host resource "${n}" from the registry.`,{hostResourceType:n});return e},[n,t.resourceConfigurations]),a=(0,Q.useMemo)(()=>n?En.buildParentResourcesRequirements(n,r,t):[],[r,n,t]),o=(0,Q.useMemo)(()=>{if(i)return ph({resourceConfig:i,operations:i.operations??[],coreOperation:K.READ,registry:t,hasResourceId:n?En.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 z6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let o=a===n?i:t.resourceConfigurations[a];if(B6(e))return BEe(o,a,e,t,r);let s=e.operationLike===K.READ||e.operationLike===K.UPDATE||e.operationLike===K.DELETE,c=e.requireAddressable||s?o?ph({resourceConfig:o,operations:o.operations??[],coreOperation:e.operationLike,registry:t,hasResourceId:En.getResourceId(r[a]).length>0,allowBulk:e.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)}):void 0:Kl(o?.operations??[],e.operationLike,{requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});if(!c)throw z6(`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 z6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let l=e.resourceType??n,u=s({resourceType:l,...B6(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=V6({target:e,hostResourceType:n,operation:u,registry:t});if(l===n&&!d){let i=En.getResourceId(r[n]),a=e.resourceId?{...Bm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:n,id:i},targetResourceType:n,targetId:e.resourceId,registry:t}).identifiers,[n]:e.resourceId}:r,o=En.buildParentResourcesRequirements(n,a,t,e.relationshipFieldOverrides),s=En.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:u,contextResourceIdentifiers:a,additionalContext:e.additionalContext,parentResourcesRequirements:o});return c&&e.pinnedFilters&&Object.keys(e.pinnedFilters).length>0?QG({childContext:s,hostResourceType:n,hostResourceId:void 0,hostRelationships:void 0,selectedForeignKey:void 0,callerPinnedFilters:e.pinnedFilters,registry:t}):s}if(!o)throw z6(`Composite resource runtime cannot derive related resource operations from host "${n}" because no host operation is configured.`,{hostResourceType:n,targetResourceType:l});let f=En.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:o,contextResourceIdentifiers:r,parentResourcesRequirements:a}),p=En.deriveChildResourceContext(f,{resourceType:l,operationIdentifier:String(u.operationIdentifier),operation:u,resourceId:e.resourceId,relationshipFieldOverrides:e.relationshipFieldOverrides,additionalContext:e.additionalContext},t);return c?QG({childContext:p,hostResourceType:n,hostResourceId:En.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:En.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 U6(){let e=H6();if(!e)throw z6(`useEmbeddedResourceContext() must be used within a resource-scoped CompositeView.`);return e}var W6=U.LOW_LEVEL_AI_EXECUTION_USAGE,G6;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(G6||={});function K6(e,t){return e.disclosure===pi.TOKENS_AND_COST?e.costs.flatMap(e=>{let n=d0(e.costMinor,e.currency,t);return n===void 0?[]:[{currency:e.currency,amount:n}]}):[]}function q6(e){return(t,n)=>e(W6,t,n)}function J6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=J({component:W6}),a=q6(i.tComponent);if(e===G6.LOADING)return null;if(e===G6.FAILED||!t)return(0,$.jsx)(`p`,{role:`status`,className:W(`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:W(`text-sm text-muted-foreground`,n),"data-execution-usage":`empty`,children:a(`noCalls`)});let o=K6(t,r),s=t.disclosure===pi.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:W(`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 Y6({className:e}){let t=H6(),{registry:n,doOperation:r}=pm(),i=(0,Q.useMemo)(()=>{if(!t?.hostResourceId)return;let e={resourceType:t.hostResourceType,resourceId:t.hostResourceId,operationIdentifier:Xe.USAGE,isOperationDefault:!0};if(!t.canBuildOperationContext(e))return;let r=t.buildOperationContext(e);return{operationPathKey:wi.createOperationPathKeyFromOperation(r.operation),contextualParameters:V.buildContextualParameters(r.contextResourceIdentifiers,n),parentResourcesRequirements:r.parentResourcesRequirements}},[t,n]),[a,o]=(0,Q.useState)({state:G6.LOADING});return(0,Q.useEffect)(()=>{if(!i)return;let e=!0;return o({state:G6.LOADING}),r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements}).then(t=>{e&&o({state:G6.READY,usage:t})}).catch(()=>{e&&o({state:G6.FAILED})}),()=>{e=!1}},[i,r]),i?(0,$.jsx)(J6,{readState:a.state,...a.usage?{usage:a.usage}:{},...e?{className:e}:{}}):null}function X6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=J({component:W6}),a=q6(i.tComponent);if(e===G6.LOADING)return null;let o=(e,t)=>(0,$.jsx)(`span`,{className:W(`text-xs text-muted-foreground tabular-nums`,n),"data-execution-usage-summary":t,children:e});return e===G6.FAILED||!t?o(a(`readFailed`),G6.FAILED):t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0?o(a(`noCalls`),`empty`):o([a(`summaryTokens`,{tokens:r(t.totalTokens)}),...K6(t,r).map(e=>e.amount)].join(` · `),e)}function Z6({className:e}){let t=TR()?.resourceType,n=ik()?.data,r=dj().contextualParameters,{registry:i,doOperation:a}=pm(),o=typeof n?.executionId==`string`&&n.executionId!==``?n.executionId:void 0,s=(0,Q.useMemo)(()=>[...Dn.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===Xe.USAGES&&e.isOperationDefault):void 0;return e?wi.createOperationPathKeyFromOperation(e):void 0},[i,t]),[u,d]=(0,Q.useState)({state:G6.LOADING});return(0,Q.useEffect)(()=>{if(!o||!l||!s||typeof c!=`string`||c===``)return;let e=!0;return d({state:G6.LOADING}),LEe({doOperation:a,operationPathKey:l,contextualParameters:{[s]:c},executionId:o}).then(t=>{e&&d(t?{state:G6.READY,usage:t}:{state:G6.FAILED})}).catch(()=>{e&&d({state:G6.FAILED})}),()=>{e=!1}},[a,o,l,s,c]),!o||!l||typeof c!=`string`||c===``?null:(0,$.jsx)(X6,{readState:u.state,...u.usage?{usage:u.usage}:{},...e?{className:e}:{}})}function Q6(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===R.CHOICE?i[a.key]=Object.fromEntries((a.request.options??[]).map(e=>[e,_e(a.request,e)])):a.request.kind===R.CONFIRM&&(i[a.key]={...t});let a=e.layout.kind===ya.SECTIONS?e.layout.sections:e.layout.kind===ya.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 $6=Q.createContext(null);function e8(){let e=Q.useContext($6),{control:t}=BC(),n=IC({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 VEe(){let e=Q.useContext($6);if(!e)return null;let{layout:t,fields:n}=e.compiled;if(t.kind===ya.FLAT)return(0,$.jsxs)(nA,{autoInjectSubmitButton:!1,children:[n.map(e=>(0,$.jsx)($L,{name:e.key},e.key)),(0,$.jsx)(e8,{})]});let r=t.kind===ya.SECTIONS?t.appearance:Xt.STEPPER,i=t.kind===ya.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)($L,{name:e},e))},e.name)),(0,$.jsx)(e8,{})]})}var HEe=()=>void 0;function t8(e){let t=JSON.stringify(e);return Q.useMemo(()=>e,[t])}function n8({fields:e,form:t,confirmWords:n,disabled:r,onReady:i,onCompleteChange:a,className:o}){let s=t8(e),c=t8(t),l=t8(n),u=Q.useMemo(()=>Dre({fields:[...s],form:c}),[s,c]),d=Q.useMemo(()=>Q6(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:Xs(n[e.key])}))}})},[u,i]);return(0,$.jsx)(`div`,{className:o,"data-human-decision-form":``,children:(0,$.jsx)($6.Provider,{value:p,children:(0,$.jsx)(rE,{schema:u.schema,onSubmit:HEe,labels:d,disabled:r,layoutTemplate:VEe,onFormReady:m})})})}var r8=rc(U.LOW_LEVEL_AI_ARTIFACT_LIST,`AI_ArtifactList`,[`Item`,`Origin`,`TextContent`,`FileContent`,`StructuredContent`]);function i8({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n,{...t})}function a8({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.Item,{...t})}function UEe({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.Origin,{...t})}function WEe({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.TextContent,{...t})}function GEe({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.FileContent,{...t})}function KEe({preset:e=G.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.StructuredContent,{...t})}var qEe={[Ia.TEXT]:`TEXT`,[Ia.FILE]:`FILE`,[Ia.RAW_DATA]:`RAW_DATA`,[Ia.STRUCTURED]:`STRUCTURED`};function o8(e){let t=e.content;return{ref:e.ref,name:e.name,type:qEe[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 JEe({artifacts:e,...t}){let n=Q.useMemo(()=>e.map(o8),[e]);return(0,$.jsx)(i8,{items:n,...t})}function YEe({artifact:e,...t}){let n=Q.useMemo(()=>o8(e),[e]);return(0,$.jsx)(a8,{item:n,...t})}function s8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_AGENT_LIST,`AI_AgentList`)(e);return(0,$.jsx)(n,{...t})}function c8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_AGENT_CARD,`AI_AgentCard`)(e);return(0,$.jsx)(n,{...t})}function XEe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_AGENT_PROMPT_SPEC,`AI_AgentPromptSpec`)(e);return(0,$.jsx)(n,{...t})}function ZEe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_AGENT_CAPABILITIES,`AI_AgentCapabilities`)(e);return(0,$.jsx)(n,{...t})}var QEe={[wa.ACTIVE]:`ACTIVE`,[wa.INACTIVE]:`INACTIVE`,[wa.DEPRECATED]:`DEPRECATED`},$Ee={[ua.GENERATION]:`GENERATION`,[ua.ANALYSIS]:`ANALYSIS`,[ua.TRANSFORMATION]:`TRANSFORMATION`,[ua.DECISION]:`DECISION`,[ua.CHAT]:`CHAT`,[ua.CUSTOM]:`CUSTOM`},eDe={[tn.SECURITY]:`SECURITY`,[tn.SAFETY]:`SAFETY`,[tn.PRIVACY]:`PRIVACY`,[tn.SCOPE]:`SCOPE`,[tn.COMPLIANCE]:`COMPLIANCE`};function l8(e){let t=e.promptSpec;return{ref:e.ref,displayName:e.displayName,status:QEe[e.status]??`INACTIVE`,promptSpec:{role:t.role,persona:t.persona,skillType:$Ee[t.skillType]??`CUSTOM`,constraints:t.constraints?.map(e=>({id:e.id,text:e.text,type:eDe[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 tDe({agents:e,...t}){let n=Q.useMemo(()=>e.map(l8),[e]);return(0,$.jsx)(s8,{agents:n,...t})}function nDe({agent:e,...t}){let n=Q.useMemo(()=>l8(e),[e]);return(0,$.jsx)(c8,{agent:n,...t})}var u8=Q.forwardRef(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_ACTION_BUTTON,`ActionButton`)(e);return(0,$.jsx)(r,{...t,ref:n})});u8.displayName=`ActionButton`;function d8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_BUTTON_GROUP,`ButtonGroup`)(e);return(0,$.jsx)(n,{...t})}function f8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_BUTTON_GROUP_TEXT,`ButtonGroupText`)(e);return(0,$.jsx)(n,{...t})}function rDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_BUTTON_GROUP_SEPARATOR,`ButtonGroupSeparator`)(e);return(0,$.jsx)(n,{...t})}function p8({as:e=`span`,children:t,className:n,textClassName:r,maxWidth:i=`100%`,tooltipSide:a=Zo.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:W(`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:W(`inline-block w-full`,n),children:m})}),(0,$.jsx)(rj,{side:a,children:t})]}):(0,$.jsx)(f,{className:W(`inline-block w-full`,n),children:m})}var m8=rc(U.LOW_LEVEL_AVATAR,`Avatar`,[`Image`,`Fallback`]);function h8({preset:e=G.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n,{...t})}function g8({preset:e=G.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n.Image,{...t})}function _8({preset:e=G.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n.Fallback,{...t})}function v8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_NOTIFICATION_INDICATOR,`NotificationIndicator`)(e);return(0,$.jsx)(n,{...t})}v8.displayName=`NotificationIndicator`;function y8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_IDENTIFIER,`Identifier`)(e);return(0,$.jsx)(n,{...t})}y8.displayName=`Identifier`;function b8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DURATION,`Duration`)(e);return(0,$.jsx)(n,{...t})}b8.displayName=`Duration`;function x8({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{Fy(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 Ou.NONE:return;case Ou.OVERLAY:i?.();return;case Ou.DOWNLOAD:c();return;case Ou.NEW_TAB:t.url&&window.open(t.url,`_blank`,`noopener,noreferrer`);return;case Ou.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!==Ou.NONE&&(e.policy===Ou.OVERLAY?i:e.policy===Ou.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:Ou.NONE},[l,e.policy,s,t.url,o,i])}function S8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE,`DisplayFieldFileImage`)(e);return(0,$.jsx)(n,{...t})}function C8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO,`DisplayFieldFileVideo`)(e);return(0,$.jsx)(n,{...t})}function w8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO,`DisplayFieldFileAudio`)(e);return(0,$.jsx)(n,{...t})}function T8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT,`DisplayFieldFileDocument`)(e);return(0,$.jsx)(n,{...t})}function E8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY,`DisplayFieldFileGallery`)(e);return(0,$.jsx)(n,{...t})}var iDe=q(U.APPLICATION_LEVEL_NOTIFICATION_CENTER,`NotificationCenter`),D8=({preset:e=G.DEFAULT})=>{let{notifications:t,removeNotification:n,clearAll:r}=Im(),{tComponent:i,isReady:a}=J({component:U.APPLICATION_LEVEL_NOTIFICATION_CENTER}),o=(0,Q.useMemo)(()=>_m(i,U.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=iDe(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};D8.displayName=`AppNotificationCenter`;var O8=({preset:e})=>{let{notifications:t}=Im(),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:eo(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)(D8,{preset:e})})]})};O8.displayName=`AppLayout_NotificationCenter`;function k8({name:e,renderItem:t,sectionAppearance:n,objectItemLayout:r,className:i}){return(0,$.jsx)($L,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,className:i})}k8.displayName=`FormFieldArray`,wk(k8,xk.FIELD_SLOT);function A8({name:e,renderItem:t,sectionAppearance:n=Xt.GHOST,objectItemLayout:r,className:i,hideLabel:a,labelPlacement:o,hideDescription:s,labelStyle:c}){return(0,$.jsx)(SR,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,labelStyle:c,className:i,hideLabel:a,labelPlacement:o,hideDescription:s})}A8.displayName=`DisplayFieldArray`;var aDe=Fl(U.LOW_LEVEL_CALENDAR,`Calendar`),oDe=Fl(U.LOW_LEVEL_CALENDAR_DAY_BUTTON,`CalendarDayButton`),j8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=aDe(e);return(0,$.jsx)(r,{...t,ref:n})});j8.displayName=`Calendar`;var M8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=oDe(e);return(0,$.jsx)(r,{...t,ref:n})});M8.displayName=`CalendarDayButton`;function N8({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_INLINE_EDIT_TEXT,`InlineEditText`)(e);return(0,$.jsx)(n,{...t})}N8.displayName=`InlineEditText`;var P8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_FILE_UPLOAD,`FileUpload`)(e);return(0,$.jsx)(r,{...t,ref:n})});P8.displayName=`FileUpload`;var F8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(F8||={});var I8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=Fl(U.LOW_LEVEL_TOGGLE,`Toggle`)(e);return(0,$.jsx)(r,{...t,ref:n})});I8.displayName=`Toggle`;function sDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM,`FormRoot`)(e);return(0,$.jsx)(n,{...t})}function cDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_ITEM,`FormItem`)(e);return(0,$.jsx)(n,{...t})}function lDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_LABEL,`FormLabel`)(e);return(0,$.jsx)(n,{...t})}function uDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_CONTROL,`FormControl`)(e);return(0,$.jsx)(n,{...t})}function dDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_DESCRIPTION,`FormDescription`)(e);return(0,$.jsx)(n,{...t})}function fDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_MESSAGE,`FormMessage`)(e);return(0,$.jsx)(n,{...t})}function pDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_FORM_FIELD,`FormFieldPrimitive`)(e);return(0,$.jsx)(n,{...t})}var L8=Q.createContext({}),R8=Q.createContext({}),z8=()=>{let e=Q.useContext(L8),t=Q.useContext(R8),{getFieldState:n}=BC(),r=jC({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 mDe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_ASPECT_RATIO,`AspectRatio`)(e);return(0,$.jsx)(n,{...t})}var B8=rc(U.LOW_LEVEL_CAROUSEL,`Carousel`,[`Content`,`Item`,`Previous`,`Next`]);function V8({preset:e=G.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n,{...t})}function H8({preset:e=G.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Content,{...t})}function U8({preset:e=G.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Item,{...t})}function hDe({preset:e=G.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Previous,{...t})}function gDe({preset:e=G.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Next,{...t})}function _De({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_DIVIDER,`Divider`)(e);return(0,$.jsx)(n,{...t})}function W8({notificationBadgeRef:e,label:t,className:n}){let{registry:r}=pm(),{getBadgeState:i}=i$(),a=e?r.notificationBadgeDefinitions.find(t=>we(t)===e):void 0;if(!a)return null;let{count:o,pulse:s}=i(a),c=t?.trim()?t:ps(we(a));return(0,$.jsx)(v8,{mode:a.display.mode,tone:a.display.tone,count:o,pulse:s,label:c,className:n})}W8.displayName=`NavigationItemBadge`;var G8=rc(U.LOW_LEVEL_MENU_BAR,`Menubar`,[`Menu`,`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function vDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n,{...t})}function yDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Menu,{...t})}var K8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});K8.displayName=`MenubarTrigger`;var q8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.Content,{...t,ref:n})});q8.displayName=`MenubarContent`;function bDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Group,{...t})}function xDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Item,{...t})}function SDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function CDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.RadioGroup,{...t})}function wDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.RadioItem,{...t})}function TDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Label,{...t})}function EDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Separator,{...t})}function DDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Shortcut,{...t})}function ODe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Sub,{...t})}function kDe({preset:e=G.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.SubTrigger,{...t})}var J8=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});J8.displayName=`MenubarSubContent`;var Y8=rc(U.LOW_LEVEL_NAVBAR,`NavigationMenu`,[`List`,`Item`,`Content`,`Trigger`,`Link`,`Indicator`,`Viewport`]);function ADe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n,{...t})}function jDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.List,{...t})}function MDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Item,{...t})}function NDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Content,{...t})}function PDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Trigger,{...t})}function FDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Link,{...t})}function IDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Indicator,{...t})}function LDe({preset:e=G.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Viewport,{...t})}var X8;(function(e){e.SIDEBAR=`sidebar`,e.FLOATING=`floating`,e.INSET=`inset`})(X8||={});var Z8;(function(e){e.OFFCANVAS=`offcanvas`,e.ICON=`icon`,e.NONE=`none`})(Z8||={});var Q8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(Q8||={});var $8=rc(U.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 RDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n,{...t})}function zDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Content,{...t})}function BDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Footer,{...t})}function VDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Group,{...t})}function HDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupAction,{...t})}function UDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupContent,{...t})}function WDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupLabel,{...t})}function GDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Header,{...t})}function KDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Input,{...t})}function qDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Inset,{...t})}function JDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Menu,{...t})}function YDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuAction,{...t})}function XDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuBadge,{...t})}function ZDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuButton,{...t})}function QDe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuItem,{...t})}function $De({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSkeleton,{...t})}function eOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSub,{...t})}function tOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSubButton,{...t})}function nOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSubItem,{...t})}function rOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Provider,{...t})}function iOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Rail,{...t})}function aOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Separator,{...t})}function oOe({preset:e=G.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Trigger,{...t})}var e5=rc(U.LOW_LEVEL_CONTEXT_MENU,`ContextMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function sOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n,{...t})}function cOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Trigger,{...t})}var t5=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=e5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});t5.displayName=`ContextMenuContent`;function lOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Group,{...t})}function uOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Item,{...t})}function dOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function fOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function pOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.RadioItem,{...t})}function mOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Label,{...t})}function hOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Separator,{...t})}function gOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Shortcut,{...t})}function _Oe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Sub,{...t})}function vOe({preset:e=G.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var n5=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=e5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});n5.displayName=`ContextMenuSubContent`;var r5=rc(U.LOW_LEVEL_DROPDOWN_MENU,`DropdownMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function i5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n,{...t})}var a5=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});a5.displayName=`DropdownMenuTrigger`;var o5=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});o5.displayName=`DropdownMenuContent`;function yOe({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Group,{...t})}function s5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Item,{...t})}function bOe({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function xOe({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function SOe({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.RadioItem,{...t})}function c5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Label,{...t})}function l5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Separator,{...t})}function COe({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Shortcut,{...t})}function u5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Sub,{...t})}function d5({preset:e=G.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var f5=(0,Q.forwardRef)(({preset:e=G.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});f5.displayName=`DropdownMenuSubContent`;var p5=rc(U.LOW_LEVEL_HOVER_CARD,`HoverCard`,[`Trigger`,`Content`]);function m5({preset:e=G.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n,{...t})}function h5({preset:e=G.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n.Trigger,{...t})}function g5({preset:e=G.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n.Content,{...t})}var _5=rc(U.LOW_LEVEL_PAGINATION,`Pagination`,[`Content`,`Item`,`Link`,`Previous`,`Next`,`Ellipsis`]);function wOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n,{...t})}function TOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Content,{...t})}function EOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Item,{...t})}function DOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Link,{...t})}function OOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Previous,{...t})}function kOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Next,{...t})}function AOe({preset:e=G.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Ellipsis,{...t})}var v5=rc(U.LOW_LEVEL_STACKED_LAYOUT,`StackedLayout`,[`Header`,`Title`,`Subtitle`,`Actions`,`Toolbar`,`Body`,`Aside`,`Content`,`Section`]);function jOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n,{...t})}function MOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Header,{...t})}function NOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Title,{...t})}function POe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Subtitle,{...t})}function FOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Actions,{...t})}function IOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Toolbar,{...t})}function LOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Body,{...t})}function ROe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Aside,{...t})}function zOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Content,{...t})}function BOe({preset:e=G.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Section,{...t})}var y5=rc(U.LOW_LEVEL_AI_ARTIFACT,`AI_Artifact`,[`Header`,`Close`,`Content`,`Title`,`Description`,`Actions`,`Action`]);function VOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n,{...t})}function HOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Header,{...t})}function UOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Close,{...t})}function WOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Content,{...t})}function GOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Title,{...t})}function KOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Description,{...t})}function qOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Actions,{...t})}function JOe({preset:e=G.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Action,{...t})}function b5({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_CODE_BLOCK,`AI_CodeBlock`)(e);return(0,$.jsx)(n,{...t})}function x5({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_DIFF_BLOCK,`AI_DiffBlock`)(e);return(0,$.jsx)(n,{...t})}var S5;(function(e){e.CONTEXT=`context`,e.ADDED=`added`,e.REMOVED=`removed`,e.NOTE=`note`})(S5||={});var YOe=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,XOe=/^diff --git (?:a\/)?(\S+) (?:b\/)?(\S+)$/,ZOe=/^--- (?:a\/)?(.*)$/,QOe=/^\+\+\+ (?:b\/)?(.*)$/,$Oe=/^Binary files .* differ$/,eke=`/dev/null`;function C5(e){if(e===void 0)return;let t=e.trim();return t===eke||t===``?void 0:t}function w5(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=XOe.exec(e);if(t){l(),r.oldPath=C5(t[1]),r.newPath=C5(t[2]);continue}let n=i===null?ZOe.exec(e):null;if(n){(!r||r.pathHeaderSeen||r.hunks.length>0)&&l(),r.pathHeaderSeen=!0,r.oldPath=C5(n[1]);continue}let c=i===null?QOe.exec(e):null;if(c){r||l(),r.newPath=C5(c[1]);continue}if($Oe.test(e)){r||l(),r.isBinary=!0;continue}let u=YOe.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:S5.ADDED,text:f,newNumber:o}),o+=1,r.added+=1;break;case`-`:i.lines.push({kind:S5.REMOVED,text:f,oldNumber:a}),a+=1,r.removed+=1;break;case`\\`:i.lines.push({kind:S5.NOTE,text:f.trim()});break;default:i.lines.push({kind:S5.CONTEXT,text:d===` `?f:e,oldNumber:a,newNumber:o}),a+=1,o+=1}}return c(),n}function T5(e){return e.hunks.reduce((e,t)=>e+t.lines.length+1,0)}function tke({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_IMAGE,`AI_Image`)(e);return(0,$.jsx)(n,{...t})}var E5=rc(U.LOW_LEVEL_AI_WEB_PREVIEW,`AI_WebPreview`,[`Navigation`,`NavigationButton`,`Url`,`Body`,`Console`]);function nke({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n,{...t})}function rke({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Navigation,{...t})}function ike({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.NavigationButton,{...t})}function ake({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Url,{...t})}function oke({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Body,{...t})}function ske({preset:e=G.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Console,{...t})}var D5=rc(U.LOW_LEVEL_AI_CONVERSATION,`AI_Conversation`,[`Content`,`EmptyState`,`ScrollButton`]);function O5({preset:e=G.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n,{...t})}function k5({preset:e=G.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Content,{...t})}function A5({preset:e=G.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.EmptyState,{...t})}function j5({preset:e=G.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.ScrollButton,{...t})}var M5=rc(U.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 N5({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n,{...t})}function cke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Provider,{...t})}function lke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Attachment,{...t})}function uke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Attachments,{...t})}function dke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Body,{...t})}function P5({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Textarea,{...t})}function fke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Header,{...t})}function F5({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Footer,{...t})}function pke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Tools,{...t})}function mke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Button,{...t})}function I5({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Submit,{...t})}function hke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenu,{...t})}function gke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuTrigger,{...t})}function _ke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuContent,{...t})}function vke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuItem,{...t})}function yke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionAddAttachments,{...t})}function bke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SpeechButton,{...t})}function xke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Select,{...t})}function Ske({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectTrigger,{...t})}function Cke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectContent,{...t})}function wke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectItem,{...t})}function Tke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectValue,{...t})}function Eke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Command,{...t})}function Dke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandInput,{...t})}function Oke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandList,{...t})}function kke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandEmpty,{...t})}function Ake({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandGroup,{...t})}function jke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandItem,{...t})}function Mke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandSeparator,{...t})}function Nke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCard,{...t})}function Pke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCardTrigger,{...t})}function Fke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCardContent,{...t})}function Ike({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabsList,{...t})}function Lke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Tab,{...t})}function Rke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabLabel,{...t})}function zke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabBody,{...t})}function Bke({preset:e=G.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabItem,{...t})}var L5=rc(U.LOW_LEVEL_AI_SOURCES,`AI_Sources`,[`Trigger`,`Content`,`Source`]);function R5({preset:e=G.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n,{...t})}function z5({preset:e=G.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Trigger,{...t})}function B5({preset:e=G.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Content,{...t})}function V5({preset:e=G.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Source,{...t})}function H5({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_SUGGESTIONS,`AI_Suggestions`)(e);return(0,$.jsx)(n,{...t})}function U5({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_SUGGESTION,`AI_Suggestion`)(e);return(0,$.jsx)(n,{...t})}function Vke({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_CONFIRMATION,`AI_Confirmation`)(e);return(0,$.jsx)(n,{...t})}var W5=rc(U.LOW_LEVEL_AI_QUEUE,`AI_Queue`,[`List`,`Item`,`ItemIndicator`,`ItemContent`,`ItemDescription`,`ItemActions`,`ItemAction`,`ItemAttachment`,`ItemImage`,`ItemFile`,`Section`,`SectionTrigger`,`SectionLabel`,`SectionContent`,`TodoItem`,`MessageItem`]);function Hke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n,{...t})}function Uke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.List,{...t})}function Wke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.Item,{...t})}function Gke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemIndicator,{...t})}function Kke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemContent,{...t})}function qke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemDescription,{...t})}function Jke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemActions,{...t})}function Yke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemAction,{...t})}function Xke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemAttachment,{...t})}function Zke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemImage,{...t})}function Qke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemFile,{...t})}function $ke({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.Section,{...t})}function eAe({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionTrigger,{...t})}function tAe({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionLabel,{...t})}function nAe({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionContent,{...t})}function rAe({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.TodoItem,{...t})}function iAe({preset:e=G.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.MessageItem,{...t})}var G5=rc(U.LOW_LEVEL_AI_TASK,`AI_Task`,[`Trigger`,`Content`,`Item`,`ItemFile`]);function aAe({preset:e=G.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n,{...t})}function oAe({preset:e=G.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Trigger,{...t})}function sAe({preset:e=G.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Content,{...t})}function cAe({preset:e=G.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Item,{...t})}function K5({preset:e=G.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemFile,{...t})}var q5=rc(U.LOW_LEVEL_AI_TOOL,`AI_Tool`,[`Header`,`Content`,`Input`,`Output`]);function J5({preset:e=G.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n,{...t})}function Y5({preset:e=G.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Header,{...t})}function X5({preset:e=G.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Content,{...t})}function Z5({preset:e=G.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Input,{...t})}function Q5({preset:e=G.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Output,{...t})}function lAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_EXECUTION_STREAM,`AI_ExecutionStream`)(e);return(0,$.jsx)(n,{...t})}function uAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_CONNECTION,`AI_Connection`)(e);return(0,$.jsx)(n,{...t})}function dAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_EDGE,`AI_Edge`)(e);return(0,$.jsx)(n,{...t})}function $5({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_PANEL,`AI_Panel`)(e);return(0,$.jsx)(n,{...t})}function fAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_TOOLBAR,`AI_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function pAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_CONTEXT,`AI_Context`)(e);return(0,$.jsx)(n,{...t})}function mAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_MODEL_SELECTOR,`AI_ModelSelector`)(e);return(0,$.jsx)(n,{...t})}function hAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_OPEN_IN_CHAT,`AI_OpenInChat`)(e);return(0,$.jsx)(n,{...t})}function gAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_LOADER,`AI_Loader`)(e);return(0,$.jsx)(n,{...t})}function e7({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_SHIMMER,`AI_Shimmer`)(e);return(0,$.jsx)(n,{...t})}var t7=rc(U.LOW_LEVEL_AI_CHAIN_OF_THOUGHT,`AI_ChainOfThought`,[`Header`,`Step`,`SearchResults`,`SearchResult`,`Content`,`Image`]);function n7({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n,{...t})}function r7({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Header,{...t})}function i7({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Step,{...t})}function _Ae({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.SearchResults,{...t})}function vAe({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.SearchResult,{...t})}function a7({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Content,{...t})}function yAe({preset:e=G.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Image,{...t})}function bAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_CHECKPOINT,`AI_Checkpoint`)(e);return(0,$.jsx)(n,{...t})}function xAe({preset:e=G.DEFAULT,...t}){let n=q(U.LOW_LEVEL_AI_INLINE_CITATION,`AI_InlineCitation`)(e);return(0,$.jsx)(n,{...t})}var o7=rc(U.LOW_LEVEL_AI_PLAN,`AI_Plan`,[`Header`,`Trigger`,`Content`,`Title`,`Description`,`Action`,`Footer`]);function SAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n,{...t})}function CAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Header,{...t})}function wAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Trigger,{...t})}function TAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Content,{...t})}function EAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Title,{...t})}function DAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Description,{...t})}function OAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Action,{...t})}function kAe({preset:e=G.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Footer,{...t})}var s7=rc(U.LOW_LEVEL_AI_REASONING,`AI_Reasoning`,[`Trigger`,`Content`]);function c7({preset:e=G.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n,{...t})}function l7({preset:e=G.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Trigger,{...t})}function u7({preset:e=G.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Content,{...t})}function d7(){let e=oh(),t=og(),n=Oo[Ul.HOME].route,{navigate:r}=SS(),{isNavigationItemActive:i}=Mx(),{emit:a}=qo();return{isNavigationItemActive:i,handleNavigationClick:(0,Q.useCallback)((e,t)=>{Um.dispatchNavigationForItem(r,e,t)},[r]),handleHomeClick:(0,Q.useCallback)(()=>{Mh({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 AAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jAe(e){switch(e){case Si.VERTICAL_RAIL:return{direction:ri.VERTICAL,borderSide:Zo.END,tooltipSide:Zo.END,orientation:ri.VERTICAL};case Si.HORIZONTAL_BAR:return{direction:ri.HORIZONTAL,borderSide:Zo.BOTTOM,tooltipSide:Zo.TOP,orientation:ri.HORIZONTAL};case Si.BOTTOM_TAB_BAR:return{direction:ri.HORIZONTAL,borderSide:Zo.TOP,tooltipSide:Zo.TOP,orientation:ri.HORIZONTAL};default:return{direction:ri.VERTICAL,borderSide:Zo.END,tooltipSide:Zo.END,orientation:ri.VERTICAL}}}function f7(){let{UIConfig:e,appComponentsConfiguration:t}=Ig(),n=Qx(),r=t?.[hr.ACTIVITY_BAR],i=e?.currentBreakpoint===yi.MOBILE,a=(0,Q.useMemo)(()=>AAe(r)?i?r.mobileRendering??Si.BOTTOM_TAB_BAR:r.desktopRendering??Si.VERTICAL_RAIL:i?Si.BOTTOM_TAB_BAR:Si.VERTICAL_RAIL,[r,i]),o=(0,Q.useMemo)(()=>jAe(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 p7=`engine:primary`;function m7(){return{requiredCapabilities:[Rv.ANSWERER]}}function h7(e,t){return(e??[]).some(e=>e.kind===gs.ENGINE_PAGE&&e.pageRef===t||h7(e.children,t))}function MAe(e,t){if(!t||(e??[]).some(e=>e.contentKind===kc.NAVIGATION_LIST&&h7(e.children,Ul.DECISIONS)))return e;let n={kind:gs.ENGINE_PAGE,pageRef:Ul.DECISIONS,runtimeAvailability:m7()},r=(e??[]).findIndex(e=>e.contentKind===kc.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:kc.NAVIGATION_LIST,ref:p7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e;return{...i,children:[n,...i.children]}})}function NAe(e,t){return!t||(e??[]).some(e=>e.kind===gs.ENGINE_PAGE&&e.pageRef===Ul.DECISIONS)?e:[...e??[],{kind:gs.ENGINE_PAGE,pageRef:Ul.DECISIONS,runtimeAvailability:m7()}]}function g7(){return{kind:gs.RESOURCE_OPERATION,resourceType:gu.ORGANIZATION_REPRESENTATIONS,operation:K.LIST,runtimeAvailability:{requiredCapabilities:[dv.REPRESENTS]}}}function _7(e){return(e??[]).some(e=>e.kind===gs.RESOURCE_OPERATION&&e.resourceType===gu.ORGANIZATION_REPRESENTATIONS&&e.operation===K.LIST||_7(e.children))}function PAe(e,t){if(t?.includes(sm.CLIENTS)||(e??[]).some(e=>e.contentKind===kc.NAVIGATION_LIST&&_7(e.children)))return e;let n=g7(),r=(e??[]).findIndex(e=>e.contentKind===kc.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:kc.NAVIGATION_LIST,ref:p7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e,a=i.children.findIndex(e=>e.kind!==gs.ENGINE_PAGE||e.pageRef!==Ul.DECISIONS),o=a===-1?i.children.length:a;return{...i,children:[...i.children.slice(0,o),n,...i.children.slice(o)]}})}function FAe(e,t){return t?.includes(sm.CLIENTS)||(e??[]).some(e=>e.kind===gs.RESOURCE_OPERATION&&e.resourceType===gu.ORGANIZATION_REPRESENTATIONS&&e.operation===K.LIST)?e:[...e??[],g7()]}var v7=il.getLogger(),y7=v7.debugByType(`SidebarBehavior`);v7.setDebugTypeLogging(`SidebarBehavior`,!1);var b7=[yi.MOBILE,yi.VERT_TABLET,yi.DESKTOP];function x7(e,t){return b7.indexOf(e)<=b7.indexOf(t)}function S7(e,t){if(e===!1||!t)return!1;let n=i2(e)?e:void 0;return(n?.policy??rt.BURGER)===rt.BURGER&&x7(t,n?.responsiveBreakpoint??yi.MOBILE)}function C7(){let{UIConfig:e,appComponentsConfiguration:t}=Ig(),n=t?.[hr.SIDEBAR];return n!==!1&&n!==void 0&&S7(n,e?.currentBreakpoint)}function IAe(){let e=tc(ws.SIDEBAR_COLLAPSED);return e===null?null:e===`true`}function w7(e={}){let{placement:t=sl.START,isCollapsed:n,onToggleCollapse:r}=e,i=d7(),{isNavigationItemActive:a}=i,o=P$(),s=Qp(),c=mS(),{UIConfig:l,appComponentsConfiguration:u,sidebarCompactLabelMode:d,navigationLayout:f,suppressedEngineNavigationEntries:p}=Ig(),{navigate:m,navigateToResource:h}=SS(),{registry:g}=pm(),_=u?.[hr.SIDEBAR],v=_!==!1,y=l?.currentBreakpoint,{on:b}=qo(),x=Eu().appConfig.decisionInbox,S=i2(_)?_.contentSections:void 0,C=(0,Q.useMemo)(()=>v?PAe(MAe(S,x),p):S,[v,S,x,p]),w=i2(_)?_.defaultSection:void 0,T=(i2(_)?_.homeDisplayMode:void 0)??Se.NAVIGATION_ITEM,E=m2({theme:i2(_)?_.brandMarkTheme:void 0}),D=T===Se.BRAND_HEADER?E:void 0,O=(0,Q.useMemo)(()=>{let e=i2(_)?_.hostedComponents:void 0;return g2(hr.SIDEBAR,e,u,y,du.TOP,f)},[_,u,y,f]),k=c.activeMode,A=c.availableModes,j=c.allScopeValues,M=(0,Q.useMemo)(()=>{if(!C)return;let e=Y3(j,k,A);return oue(J3(C,k,e,bi.isDevelopment()),c)},[C,k,A,j,c]);(0,Q.useEffect)(()=>{if(!bi.isDevelopment()||!C||!window.__WILDO_DEBUG_SIDEBAR__)return;let e=Y3(j,k,A);X3(C,k,e)},[C,k,A,j]);let N=(0,Q.useRef)(IAe()),P=i2(_)?_.defaultCollapsed:void 0,[F,I]=(0,Q.useState)(N.current),L=F??P??!1,ee=(0,Q.useCallback)(e=>{I(e),wo(ws.SIDEBAR_COLLAPSED,String(e))},[]),R=n===void 0?L:n,z=v&&S7(_,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(ws.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=tc(ws.SIDEBAR_FAVORITES),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}});(0,Q.useEffect)(()=>{wo(ws.SIDEBAR_FAVORITES,JSON.stringify(de))},[de]),(0,Q.useEffect)(()=>{try{localStorage.setItem(ws.SIDEBAR_SECTION_COLLAPSED,JSON.stringify(re))}catch{}},[re]);let pe=(0,Q.useMemo)(()=>{let e=y===yi.MOBILE,t=i2(_)?_:void 0,n=d===ane.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=i2(_)?_:void 0;if(e?.policy!==rt.DRAWER||!y)return;let t=e.responsiveBreakpoint??yi.MOBILE,r=x7(y,t),i=me.current;me.current=r,i===!0&&!r&&n===void 0&&ee(!1)},[y,_,n,ee]);let he=(0,Q.useMemo)(()=>!M||!o?[]:Hm(M,o),[M,o]),ge=(0,Q.useMemo)(()=>{let e=he.map((e,t)=>LAe(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===kc.NAVIGATION_LIST&&t.section.behavior!==qr.FAVORITES&&(n(t.items),n(t.moreMenuItems));let r=e.map(e=>{if(e.contentKind!==kc.NAVIGATION_LIST||e.section.behavior!==qr.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!==kc.NAVIGATION_LIST||e.items.length>0||e.moreMenuItems.length>0||e.section.inlineCreate!==_c.NONE),i=e=>e.section.isPrimary?0:e.section.behavior===qr.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)(()=>Um.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]),B=(0,Q.useCallback)(e=>!!ye&&e.id===ye,[ye]),be=!z&&R,xe=(0,Q.useMemo)(()=>({isCollapsible:!i2(_)||_.collapsible!==!1,responsivePolicy:i2(_)?_.policy:rt.BURGER,currentWidth:be?pe.collapsedWidth:pe.width}),[_,be,pe]),Ce=(0,Q.useCallback)(()=>{z?ne(e=>!e):r?r():ee(!R)},[z,R,r,ee]),we=(0,Q.useCallback)(()=>{ne(!1)},[]),Te=(0,Q.useRef)(Ce);Te.current=Ce,(0,Q.useEffect)(()=>{if(v)return b(xc.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=>{y7(`handleNavigationClick`,{itemId:e.id,itemLabel:e.label,urlPath:e.urlPath}),i.handleNavigationClick(e,hr.SIDEBAR),z&&ne(!1)},[i.handleNavigationClick,z]),Ae=(0,Q.useCallback)(()=>{y7(`handleHomeClick: START`),i.handleHomeClick(),z&&ne(!1),y7(`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=(i2(_)?_.contentSections:void 0)?.find(t=>t.ref===e),r=n?.contentKind===kc.NAVIGATION_LIST&&n.inlineCreate===_c.DIALOG;if(!r&&!le.trim())return;let i=(n?.contentKind===kc.NAVIGATION_LIST?n.inlineCreateField:void 0)??`title`,a=g.resourceConfigurations[t],o=a?.operations?.find(e=>String(e.operationIdentifier)===K.CREATE);if(!a||!o)return;let c=En.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:o,contextResourceIdentifiers:s?.buildContextResourceIdentifiers()??{},...r?{}:{additionalContext:{defaultValuesOverride:{[i]:le.trim()}}}});r?h(c,Um.createAppLevelInitiator(hr.SIDEBAR),void 0,Ka.OVERLAY):(m({content:{contentType:va.RESOURCE_OPERATION,resourceContext:c},initiator:Um.createAppLevelInitiator(hr.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]),Ie=(0,Q.useCallback)(e=>{let t=e.favoriteId??e.id;fe(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},[]),Le=(0,Q.useMemo)(()=>(M??[]).some(e=>e.contentKind===kc.NAVIGATION_LIST&&e.behavior===qr.FAVORITES),[M]);return{groupedSections:ge,hostedComponents:O,isCollapsed:be,isHomeActive:i.isHomeActive,dimensions:pe,sidebarConfig:xe,isNavigationLoading:!o,hasItems:ge.length>0||T===Se.NAVIGATION_ITEM,placement:t,isMobileDrawerMode:z,isMobileDrawerOpen:te,closeMobileDrawer:we,homeDisplayMode:T,brandHeader:D,isNavigationItemActive:B,isSectionCollapsed:De,isItemCollapsed:Pe,handleNavigationClick:ke,handleHomeClick:Ae,handleToggleCollapse:Ce,handleSetSectionCollapsed:Ee,handleToggleItemCollapse:Oe,isItemFavorite:Fe,handleToggleItemFavorite:Ie,hasFavoritesSection:Le,inlineCreate:{activeSection:se,value:le,start:je,cancel:Me,submit:Ne,setValue:ue}}}function LAe(e,t){let n={ref:e.ref,label:e.label,showLabel:e.showLabel!==!1,collapsible:e.collapsible??!1,defaultCollapsed:e.defaultCollapsed??!1,behavior:qr.STATIC,inlineCreate:_c.NONE,nested:!1,maxNestingDepth:1};switch(e.contentKind){case kc.NAVIGATION_LIST:{let t={...n,behavior:e.behavior??qr.STATIC,inlineCreate:e.inlineCreate??_c.NONE,inlineCreateResourceType:e.inlineCreateResourceType,nested:e.nested??!0,maxNestingDepth:e.maxNestingDepth??1,isPrimary:e.isPrimary??!1,...e.isPrimary?{showLabel:!1,collapsible:!1}:{}},r=T7(e.items.map(e=>E7(e)).filter(e=>e!==null),t.nested??!0,t.maxNestingDepth??1);return{section:t,items:r.filter(e=>e.displayPolicy!==ar.SECTION_MORE_MENU),moreMenuItems:r.filter(e=>e.displayPolicy===ar.SECTION_MORE_MENU),contentKind:kc.NAVIGATION_LIST}}case kc.RESOURCE_BROWSER:return{section:n,items:[],moreMenuItems:[],contentKind:kc.RESOURCE_BROWSER,resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant,navigateOperation:e.navigateOperation,navigateOperationVariant:e.navigateOperationVariant,instanceFilter:e.instanceFilter,onInstanceClick:e.onInstanceClick};case kc.GUIDANCE_WIDGET:return{section:n,items:[],moreMenuItems:[],contentKind:kc.GUIDANCE_WIDGET,guidanceRef:e.guidanceRef};case kc.CUSTOM_COMPONENT:return{section:n,items:[],moreMenuItems:[],contentKind:kc.CUSTOM_COMPONENT,componentRef:e.componentRef}}}function T7(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 RAe(e,t){v7.warn(`Navigation item "${e.id}" ${t} — dropped from the sidebar`,{itemId:e.id,ref:e.ref,contentType:e.contentType})}function E7(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(E7).filter(e=>e!==null)};return e.operation&&e.resourceContext?(bi.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:da.RESOURCE,resourceType:e.resourceType??``,operationIdentifier:e.operationIdentifier??``,operation:e.operation,resourceContext:e.resourceContext}):e.contentType===va.ENGINE_PAGE?e.pageRef?{...t,itemType:da.ENGINE_PAGE,pageRef:e.pageRef}:(RAe(e,"declares contentType ENGINE_PAGE with no `pageRef`"),null):e.contentType===va.SETTINGS_HUB?{...t,itemType:da.SETTINGS_HUB,sectionRef:e.sectionRef}:e.componentRef?{...t,itemType:da.CUSTOM_COMPONENT,componentRef:e.componentRef,contextResourceIdentifiers:e.contextResourceIdentifiers}:{...t,itemType:da.VIEW,viewRef:e.viewRef??e.ref,contentType:e.contentType??va.COMPOSITE_VIEW,contextResourceIdentifiers:e.contextResourceIdentifiers,flowsActorsSystemRef:e.flowsActorsSystemRef,fullCustomComponentRef:e.fullCustomComponentRef,requiredFeatures:e.requiredFeatures}}function D7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O7(e={}){let{mode:t}=e,{UIConfig:n,appComponentsConfiguration:r,navigationLayout:i,homeDefinition:a}=Ig(),o=P$(),{navigate:s}=SS(),c=mS(),{isNavigationItemActive:l,isHomeActive:u,handleHomeClick:d}=d7(),f=a?.compositeViewReference,p=r?.[hr.MENUBAR],m=n?.currentBreakpoint,h=m2({theme:D7(p)?p.brandMarkTheme:void 0}),g=D7(p)&&p.brandHeader===!0?h:void 0,_=(0,Q.useMemo)(()=>D7(p)?g2(hr.MENUBAR,p.hostedComponents,r,m,sl.START,i):[],[r,p,m,i]),v=(0,Q.useMemo)(()=>D7(p)?fue(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=Um.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:()=>{Um.dispatchNavigationForResolvedTarget(s,e,hr.MENUBAR)}}))},[v,o,s,l,u,f]),menubarConfig:(0,Q.useMemo)(()=>{let e=t||(D7(p)?p.displayPolicy??`FIXED`:typeof p==`string`?p:`FIXED`),n=e===`OVERLAY`;return{mode:e,isOverlay:n,showMobileLayout:m===yi.MOBILE&&n}},[p,t,m]),mapToFrontendComponentType:d2}}function k7(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 A7(e={}){let t=Qp(),{on:n}=qo(),{registry:r}=pm(),[i,a]=(0,Q.useState)(0),o=e.focusTrigger??i;(0,Q.useEffect)(()=>{if(e.focusTrigger===void 0)return n(xc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{a(e=>e+1)})},[n,e.focusTrigger]);let s=jw({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=k7(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?Kt(a)===B.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}=J({component:U.APPLICATION_LEVEL_QUICK_SWITCHER,resource:f}),m=(0,Q.useMemo)(()=>u.map(e=>e.fieldIdentifier),[u]),h=IC({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?Kt(a)===B.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:pr.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 bi.isDevelopment()&&console.warn(`[QuickSwitcher] No schema found for scope field "${t}" — field will not render.`),[];let{schema:r,isPrimaryKeyFallback:i}=n,a=Kt(r)===B.ARRAY,o=a?ds(r)??r:r,c=Kt(o),l=gl(o)||i?s2.RESOURCE_REFERENCE:c===B.ENUM?s2.ENUM:s2.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??hs,presentation:e.presentation??Yp.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===hr.SIDEBAR?`vertical`:`horizontal`,[e.containerType]),focusTrigger:o}}function j7(e=du.BOTTOM){let{UIConfig:t,appComponentsConfiguration:n,shellAppearance:r}=Ig(),{tComponent:i}=J({component:U.APPLICATION_LEVEL_STATUS_BAR}),{status:a}=dp(),{notifications:o}=Im(),s=n?.[hr.STATUS_BAR],c=t?.currentBreakpoint,l=a2(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 Pl.LINK:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:c2.LINK,href:e.href}};case Pl.BUTTON:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:c2.BUTTON,onClick:e.onClick}};case Pl.TEXT:default:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:c2.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===yi.MOBILE;return{height:l?.height??(e?28:32)}},[c,l]),v=(0,Q.useMemo)(()=>{let t=e===du.TOP,n=e===du.BOTTOM,i=c===yi.MOBILE,a=r===ic.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===yi.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)(()=>eo(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(U.APPLICATION_LEVEL_STATUS_BAR,`notificationCount`,{count:S}),[S,i]),connectionStatusLabel:(0,Q.useMemo)(()=>{switch(a){case em.CONNECTED:return i(U.APPLICATION_LEVEL_STATUS_BAR,`connected`);case em.CONNECTING:case em.RECONNECTING:return i(U.APPLICATION_LEVEL_STATUS_BAR,`reconnecting`);case em.DISCONNECTED:case em.ERROR:default:return i(U.APPLICATION_LEVEL_STATUS_BAR,`disconnected`)}},[a,i]),statusItems:h,dimensions:_,statusBarConfig:v,authoredAppearance:g,currentBreakpoint:c}}function zAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function M7(){let{UIConfig:e,appComponentsConfiguration:t}=Ig(),n=P$(),{navigate:r}=SS(),i=mS(),a=t?.[hr.TOOLBAR],o=e?.currentBreakpoint,s=o===yi.MOBILE,c=zAe(a)?a:void 0,l=(0,Q.useMemo)(()=>lue(c?.tools,i),[c?.tools,i]),u=(0,Q.useMemo)(()=>!l?.length||!n?[]:Km(l,n),[l,n]),d=(0,Q.useMemo)(()=>u.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,iconOnly:e.iconOnly,onClick:()=>Um.dispatchNavigationForResolvedTarget(r,e,hr.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 N7(e){return Xo.isRegistered(e,G.DEFAULT)}function P7(e,t,n=N7){return e.map(e=>{if(e.kind===gs.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:gs.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:gs.CUSTOM_COMPONENT,componentRef:e.componentRef,resolvedComponentRef:r?e.componentRef:null,icon:e.icon,label:e.label}})}function F7(e){if(e)return dd.map(t=>`${t}:${e.zones[t].stack.map(e=>e.id).join(`,`)}#${e.zones[t].activeTabId??``}`).join(`|`)}function I7(e=sl.END,t){let{UIConfig:n,appComponentsConfiguration:r,flowsActorsViews:i}=Ig(),[a,o]=(0,Q.useState)(!1),s=F7((0,Q.useContext)(hh)?.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?.[hr.UTILITY_PANEL],d=o2(u)?u:void 0,f=(0,Q.useMemo)(()=>P7(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===gs.VIEW?KY(m.viewRef):void 0,g=(0,Q.useMemo)(()=>h?[GY({family:Vl.FLOWS_ACTORS,translationRef:h})]:[],[h]),{tComponent:_,tView:v,isReady:y}=J({component:U.APPLICATION_LEVEL_UTILITY_PANEL,keys:g}),b=h?v(Vl.FLOWS_ACTORS,h,`title`):m?.kind===gs.CUSTOM_COMPONENT?m.label:bp({tComponent:_,componentType:U.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 BAe(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function L7(e=sl.END,t=[]){let{UIConfig:n,appComponentsConfiguration:r}=Ig(),i=P$(),{navigate:a}=SS(),{tComponent:o}=J({component:U.APPLICATION_LEVEL_CONTROL_PANEL}),s=mS(),[c,l]=(0,Q.useState)(!1),u=n?.currentBreakpoint,d=r?.[hr.CONTROL_PANEL],f=typeof d==`object`&&d?d.items:void 0,p=(0,Q.useMemo)(()=>uue(f,s),[f,s]),m=(0,Q.useMemo)(()=>!p||!i?[]:Fm(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 l2.BUTTON:return{id:e.id,label:e.label,type:l2.BUTTON,disabled:t,onTrigger:()=>e.onChange?.(!0)};case l2.TOGGLE:{let n=e.value===!0;return{id:e.id,label:e.label,type:l2.TOGGLE,disabled:t,value:n,onToggle:()=>e.onChange?.(!n)}}case l2.SELECT:return{id:e.id,label:e.label,type:l2.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 l2.SLIDER:{let n=e.min??0,r=e.max??100,i=e.step??1,a=BAe(e.value,n);return{id:e.id,label:e.label,type:l2.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(U.APPLICATION_LEVEL_CONTROL_PANEL,`actions`):o(U.APPLICATION_LEVEL_CONTROL_PANEL,e),items:t})),[h,o]),controls:g,handleItemClick:(0,Q.useCallback)(e=>{l(!1),Um.dispatchNavigationForResolvedTarget(a,e,hr.CONTROL_PANEL)},[a]),sheetSide:(0,Q.useMemo)(()=>{let t=e;return t===sl.START?Zo.START:t===sl.END?Zo.END:t===du.TOP?Zo.TOP:t===du.BOTTOM?Zo.BOTTOM:Zo.END},[e]),isNavigationLoading:!i,navigationItemCount:m.length,currentBreakpoint:u}}function R7(e,t,n,r){let i=U.APPLICATION_LEVEL_NOTIFICATION_CENTER,a=e(i,t,r);return a===`components.${i}.${t}`?n??a:a}function VAe(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?R7(n,`timeJustNow`):a<60?R7(n,`timeMinutesAgo`,void 0,{count:a}):o<24?R7(n,`timeHoursAgo`,void 0,{count:o}):s<7?R7(n,`timeDaysAgo`,void 0,{count:s}):r(e)}function HAe(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 z7(e,t,n={}){let{notifications:r,clearAll:i,removeNotification:a}=Im(),{on:o}=qo(),{tComponent:s,formatDate:c}=J({component:U.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(xc.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=R7(s,`resourceNotificationTitle`,e.resourceContext.resourceType,{resourceType:e.resourceContext.resourceType}),n||=R7(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(U.APPLICATION_LEVEL_NOTIFICATION_CENTER,`title`),{id:e.id,type:e.type,source:e.source,timestamp:e.timestamp,displayTitle:t,displayMessage:n,relativeTimeLabel:VAe(e.timestamp,d,s,c),iconReference:HAe(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 UAe=[o.NAVIGATION,o.ACTIONS],B7=0,WAe=1e3,GAe=300,KAe=2,qAe=5,V7=il.getLogger(),JAe={[K.CREATE]:`keywordsCreate`,[K.CREATE_MANY]:`keywordsCreate`,[K.LIST]:`keywordsList`,[K.SEARCH]:`keywordsSearch`,[K.READ]:`keywordsRead`,[K.UPDATE]:`keywordsUpdate`,[K.UPDATE_MANY]:`keywordsUpdate`,[K.DELETE]:`keywordsDelete`,[K.DELETE_MANY]:`keywordsDelete`};function H7(e,t){let n=U.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 YAe(e,t){if(!t)return[];let n=bl(t),r=n?JAe[n]:void 0;return r?H7(e,r):[]}function U7(e,t,n){return Du(n)?t(U.APPLICATION_LEVEL_COMMAND_MENU,n):e(`${ac.COMMAND_CATEGORIES}.${n}.label`)}function W7(e,t,n){return n.category===void 0?e(`${ac.RESOURCES}.${n.resourceType}.header.title`):U7(e,t,n.category)}function XAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G7(e,t,n={}){let r=P$(),{navigate:i,navigateToResource:a}=SS(),{registry:s,doOperation:c}=pm(),l=Qp(),{appComponentsConfiguration:u,suppressedEngineNavigationEntries:d}=Ig(),{on:f,emit:p}=qo(),{register:m}=A$(),{t:h,tComponent:g,formatDate:_,formatDateTime:v}=J({component:U.APPLICATION_LEVEL_COMMAND_MENU}),y=u?.[hr.COMMAND_MENU],b=XAe(y)?y:void 0,x=b?.openShortcut,S=b?.showRecent!==!1,C=b?.maxRecentItems??5,w=b?.showShortcuts!==!1,T=b?.defaultCategory??o.NAVIGATION,E=b?.categoryOrder??UAe,D=b?.policy===ym.OMNIBOX,O=b?.searchResources,k=b?.dialogWidth,A=mS(),j=(0,Q.useContext)(ea)?.appConfig?.decisionInbox,N=(0,Q.useMemo)(()=>sue(FAe(NAe(b?.commands,j),d),A),[b?.commands,j,d,A]),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(``),[ee,R]=(0,Q.useState)([]),z=e!==void 0&&t!==void 0,te=z?e:P,ne=(0,Q.useRef)(te);ne.current=te;let re=n.listenForHotkeys!==!1,ie=(0,Q.useCallback)(e=>{z&&t?t(e):F(e),e||L(``)},[z,t]);(0,Q.useEffect)(()=>{if(re)return f(xc.HOTKEY_COMMAND_MENU_OPEN,()=>{ie(!ne.current)})},[f,ie,re]),(0,Q.useEffect)(()=>{if(re&&x&&y!==!1)return m({id:`app-command-menu-open-shortcut`,shortcut:x,description:h(`engine.hotkeys.commandMenuOpen`),scope:pa.GLOBAL,group:ln.NAVIGATION,launcher:hr.COMMAND_MENU,preventDefault:!0,handler:()=>{p(xc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[x,y,m,p,h,re]);let ae=(0,Q.useMemo)(()=>!N||!r?[]:Ah(N,r),[N,r]),oe=(0,Q.useMemo)(()=>ae.filter(e=>{let t=e.displayPolicy;return t===void 0||t===pd.ALWAYS?!0:t===pd.NEVER?!1:t===pd.RECENT?!0:t===pd.CONTEXTUAL?(bi.isDevelopment()&&console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for "${e.id}"`),!1):(bi.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??T,keywords:[...YAe(g,e.operation),...e.searchKeywords??[]],displayPolicy:e.displayPolicy,onExecute:()=>{ie(!1),R(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,C)),e.urlPath&&Um.dispatchNavigationForResolvedTarget(i,e,hr.COMMAND_MENU)}})),[ae,ie,i,C,T,g]),se=(0,Q.useMemo)(()=>{let e=new Map;for(let t of oe){if(t.displayPolicy===pd.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 E){let r=e.get(n);r&&(t.push({category:n,label:U7(h,g,n),items:r}),e.delete(n))}for(let[n,r]of e.entries())t.push({category:n,label:U7(h,g,n),items:r});return t},[oe,E,h,g]),ce=(0,Q.useMemo)(()=>{if(ee.length===0)return[];let e=new Map(oe.map(e=>[e.id,e]));return ee.map(t=>e.get(t)).filter(Boolean)},[oe,ee]),[le,ue]=(0,Q.useState)([]),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(c);pe.current=c;let me=(0,Q.useRef)(s);me.current=s;let he=(0,Q.useRef)(l);he.current=l;let ge=(0,Q.useRef)(a);ge.current=a;let _e=(0,Q.useRef)(ie);_e.current=ie;let ve=(0,Q.useRef)(h);ve.current=h;let ye=(0,Q.useRef)(_);ye.current=_;let B=(0,Q.useRef)(v);B.current=v;let be=(0,Q.useRef)(g);be.current=g;let xe=(0,Q.useRef)(O);xe.current=O;let Se=(0,Q.useRef)(null),Ce=(0,Q.useCallback)(e=>{let t=he.current,n=nm.buildInitiatorIds({userId:t?.currentUserId,organizationId:t?.currentOrganizationId,applicationId:t?.currentApplicationId,anonymousUserId:t?.currentAnonymousUserId});return{...nm.primaryScopeToContextIdentifiers(n,e),...t?.buildContextResourceIdentifiers()??{}}},[]),we=(0,Q.useCallback)((e,t)=>{let n=me.current,r=n.resourceConfigurations[e];if(!r)return;let i=Kl(r.operations??[],K.READ);if(!i){V7.warn(`[CommandMenu] Omnibox result has no addressable READ operation`,{resourceType:e,recordId:t});return}let a=K7({scopeIdentifiers:Ce(r.resourcePrimaryScope),resourceType:e,recordId:t,registry:n}),o=En.buildParentResourcesRequirements(e,a,n),s=En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:i,contextResourceIdentifiers:a,parentResourcesRequirements:o});_e.current(!1),ge.current(s,Um.createAppLevelInitiator(hr.COMMAND_MENU))},[Ce]),Te=(0,Q.useMemo)(()=>JSON.stringify(O??[]),[O]),Ee=D&&!!O&&O.length>0;(0,Q.useEffect)(()=>{if(Se.current&&=(clearTimeout(Se.current),null),!te||!Ee||I.trim().length<KAe){ue([]),fe(!1);return}let e=!1,t=I.trim();fe(!0);let n=async()=>{let n=me.current,r=xe.current??[],i=await Promise.all(r.map(async e=>{let r=n.resourceConfigurations[e.resourceType];if(!r)return V7.warn(`[CommandMenu] Omnibox searchResource not in registry — skipped`,{resourceType:e.resourceType}),null;let i;try{i=V.buildForeignKeySearchOperationPath(e.resourceType,n)}catch{return V7.warn(`[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped`,{resourceType:e.resourceType}),null}let a=V.buildForeignKeySearchParams(t,e.maxResults??qAe,{resourceType:e.resourceType,registry:n}),o;try{o=await pe.current(i,{contextualParameters:Ce(r.resourcePrimaryScope),queryParameters:a.queryParameters,dataMode:a.dataMode})}catch(t){return V7.error(`[CommandMenu] Omnibox search failed`,{resourceType:e.resourceType,...M(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===hc.LABEL||e.resultDisplay===hc.ID?hc.LABEL:hc.SUMMARY,d=[t,...H7(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:ve.current,formatDate:ye.current,formatDateTime:B.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:W7(ve.current,be.current,e),displayMode:u,items:f}}));e||(ue(i.filter(e=>e!==null)),fe(!1))};return Se.current=setTimeout(()=>{n()},GAe),()=>{e=!0,Se.current&&=(clearTimeout(Se.current),null)}},[te,I,Ee,Te,Ce,we]);let De=(0,Q.useMemo)(()=>{let e=new Map;return(O??[]).forEach((t,n)=>{let r=t.category??t.resourceType;e.set(r,t.order??B7+n)}),e},[O]),Oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of O??[])e.set(t.category??t.resourceType,t);return e},[O]),ke=(0,Q.useMemo)(()=>le.map(e=>{let t=Oe.get(e.category);return t?{...e,label:W7(h,g,t)}:e}),[le,Oe,h,g]);return{isOpen:te,handleOpenChange:ie,searchQuery:I,setSearchQuery:L,commandItems:oe,groupedItems:se,recentItems:ce,searchResultGroups:ke,orderedGroups:(0,Q.useMemo)(()=>{let e=[];return ke.forEach((t,n)=>{e.push({kind:u2.RECORDS,order:De.get(t.category)??B7+n,group:t})}),se.forEach((t,n)=>{e.push({kind:u2.COMMANDS,order:WAe+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,se,De]),isSearching:de,isNavigationLoading:!r,showRecent:S,showShortcuts:w,openShortcut:x,authoredDialogWidth:k}}function K7(e){return{...Bm({hostIdentifiers:e.scopeIdentifiers,hostContextualParameters:{},targetResourceType:e.resourceType,targetId:e.recordId,registry:e.registry}).identifiers,[e.resourceType]:e.recordId}}function ZAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q7(){let{UIConfig:e,appComponentsConfiguration:t}=Ig(),n=P$(),{navigate:r}=SS(),i=mS(),a=t?.[hr.QUICK_ACTION_BUTTON],o=ZAe(a)?a:void 0,s=(0,Q.useMemo)(()=>cue(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:()=>Um.dispatchNavigationForResolvedTarget(r,e,hr.QUICK_ACTION_BUTTON)})),[c,r]),{primaryAction:u,menuActions:d}=(0,Q.useMemo)(()=>({primaryAction:l.find(e=>e.displayPolicy===Aa.PRIMARY)??null,menuActions:l.filter(e=>e.displayPolicy!==Aa.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 QAe(e){let{registry:t,doOperation:n}=pm(),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?.[gu.ORGANIZATIONS]?.operations.find(e=>e.operationIdentifier===K.SEARCH&&e.variantType===E.API_CALL&&e.variantKey===A.MINE);return e?wi.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:gu.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;il.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 $Ae(e){let{httpClient:t}=Eu(),[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 J7=Object.freeze([]);function eje(e){return typeof e==`object`&&!!e}var Y7=[cp.USER_INFO,cp.ORG_SWITCHER,cp.SETTINGS,cp.LOGOUT];function X7(e,t){let{appComponentsConfiguration:n}=Ig(),{user:r,organizations:i,getCurrentOrganization:a,setCurrentOrganization:o,logout:s,isAuthenticated:c,permissions:l}=ag(),{registry:u}=pm(),d=P$(),f=oh(),p=mS(),[m,h]=(0,Q.useState)(!1),g=n?.[hr.USER_DROPDOWN],_=(0,Q.useMemo)(()=>{let e=eje(g)?g:void 0;if(e)return{avatarDisplay:e.avatarDisplay??Lp.AVATAR_ONLY,sections:e.sections??Y7,showOrgSwitcher:e.showOrgSwitcher??!0,showLogout:e.showLogout??!0,settingsEntries:e.settingsEntries??J7}},[g]),v=a(),y=_?.sections??Y7,b=_?.avatarDisplay??Lp.AVATAR_ONLY,x=_?.showOrgSwitcher!==!1,S=_?.showLogout!==!1,C=_?.settingsEntries??J7;p.activeMode,p.availableModes,p.allScopeValues;let w=(0,Q.useMemo)(()=>e===hr.MENUBAR?t===sl.END?{align:jr.END,side:Zo.BOTTOM}:{align:jr.START,side:Zo.BOTTOM}:e===hr.SIDEBAR?t===du.BOTTOM?{align:jr.END,side:Zo.END}:{align:jr.START,side:Zo.END}:{align:jr.END,side:Zo.BOTTOM},[e,t]),T=(0,Q.useMemo)(()=>d?C.flatMap(e=>{let t=Jm({kind:gs.SETTINGS_SECTION,sectionRef:e},d);return t?[t]:[]}):[],[d,C]),E=(0,Q.useMemo)(()=>d?Jm({kind:gs.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 Dh(l?.accessProfile).filter(t=>!e.has(t)).length},[i,l?.accessProfile]),j=QAe(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||Pa.settings)},[f]),F=D?.avatar,I=$Ae((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?.[gu.USER_SELF_PROFILES],a=V.resolveSingleResourceReadOperation(gu.USER_SELF_PROFILES,u);if(!i||!a)return null;let o={[gu.USER_SELF]:e},s=nH({registry:u,resourceConfig:i,operation:a,resourceType:gu.USER_SELF_PROFILES,fieldName:`avatar`,recordId:t,contextResourceIdentifiers:o,contextualParameters:V.buildContextualParameters(o,u),apiBaseUrl:bi.getApiUrl()});return s?iH(`${s}/${encodeURIComponent(n)}`):null},[u,r,D,F?.fileId]))??void 0,L=r?.email??``,ee=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r?.organizationMembers??[]){if(!Wte(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:L,avatarUrl:I,currentOrganization:v?{_id:v._id,name:v.name}:void 0,organizations:(i??[]).map(e=>{let t=ee.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 tje({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_COMMAND_MENU,`ApplicationLevel_CommandMenu`)(e);return(0,$.jsx)(n,{...t})}function nje({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_CONTROL_PANEL,`ApplicationLevel_ControlPanel`)(e);return(0,$.jsx)(n,{...t})}function rje({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_USER_DROPDOWN,`ApplicationLevel_MenuUserOrg`)(e);return(0,$.jsx)(n,{...t})}function ije(e){return e.tResourceEmptyState(e.resourceType,`title`)||e.tComponent(U.RESOURCES_LAYOUTS_LIST,`noItems`)}var Z7=il.getLogger(),Q7=Z7.debugByType(`sidebar-resource-browser`);Z7.setDebugTypeLogging(`sidebar-resource-browser`,!1);var aje=[U.APPLICATION_LEVEL_SIDEBAR,U.RESOURCES_LAYOUTS_LIST],$7=({resourceType:e,operation:t,operationVariant:n,navigateOperation:r,navigateOperationVariant:i,instanceFilter:a,onInstanceClick:o,isCollapsed:s=!1})=>{let{registry:c,doOperation:l}=pm(),{navigateToResource:u}=SS(),d=Qp(),{tResourceHeader:f,tResourceEmptyState:p,t:m,tComponent:h,formatDate:g,formatDateTime:_}=J({resource:e,component:aje}),v=lp(),{renderIcon:y}=kf(),[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 dh(k,t??K.LIST,n)},[k,t,n]),j=(0,Q.useMemo)(()=>{if(k)return r?dh(k,r,i):t&&t!==K.LIST?dh(k,t,n):dh(k,K.READ)??A},[k,r,i,t,n,A]),M=(0,Q.useMemo)(()=>{if(!k)return{};let e=nm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId});return{...nm.primaryScopeToContextIdentifiers(e,k.resourcePrimaryScope),...d?.buildContextResourceIdentifiers()??{}}},[k,d?.currentUserId,d?.currentOrganizationId,d?.currentApplicationId,d?.currentAnonymousUserId,d]),N=(0,Q.useMemo)(()=>A?wi.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??K.LIST}" on resource "${e}".`;T(null),Z7.warn(r,{resourceType:e,operationIdentifier:t??K.LIST,operationVariant:n})}else k||Z7.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{Q7(`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),Q7(`Fetched instances`,{count:n.length})}catch(t){if(r)return;T(v(t)),Z7.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)(()=>qp({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=En.buildParentResourcesRequirements(e,t,c),i=En.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:j,contextResourceIdentifiers:t,parentResourcesRequirements:r});u(i,Um.createAppLevelInitiator(hr.SIDEBAR))}else Z7.warn(`SidebarResourceBrowser navigation skipped: no navigation operation resolved`,{resourceType:e,fetchOperationIdentifier:A?.operationIdentifier,navigationOperationIdentifier:r??K.READ,navigationOperationVariant:i,instanceId:n})},[e,o,k,j,r,i,M,c,u,A]),L=(0,Q.useCallback)(t=>V.computeFrontendResourceLabel({resourceType:e,registry:c,currentObject:t,t:m,formatDate:g,formatDateTime:_})??String(t._id??``),[e,c,m,g,_]),ee=(0,Q.useMemo)(()=>y({category:Qt.RESOURCES,resourceType:e},{size:Jn.SM}),[y,e]),R=(0,Q.useMemo)(()=>A?[lg({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(U.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(U.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`):w}):P.length===0?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-muted-foreground`,children:ije({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:ee}),(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=L(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:W(`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`,Ag(r_.INSET)),children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:ee}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:n})]},String(r))})});return(0,$.jsx)(eb,{i18nKeys:z,loadingScopes:R,readiness:[{id:`sidebar-resource-browser-data`,isReady:!S||w!==null}],renderLoading:te,children:ne})};function oje({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_NOTIFICATION_CENTER,`ApplicationLevel_NotificationCenter`)(e);return(0,$.jsx)(n,{...t})}function sje({preset:e=G.DEFAULT,...t}){let n=q(U.APPLICATION_LEVEL_QUICK_SWITCHER,`ApplicationLevel_QuickSwitcher`)(e);return(0,$.jsx)(n,{...t})}var e9;(function(e){e.OPENING=`opening`,e.SIGNING=`signing`,e.NOTHING=`nothing`,e.FAILED=`failed`})(e9||={});var cje=wi.createOperationPathKey({resourceIdentifier:gu.SIGNATURE_REQUEST_SIGNERS,operationIdentifier:He.OPEN_SIGNING_SESSION,variantType:E.API_CALL,isOperationDefault:!0,isBulkOperation:!1});function lje(e){try{return e?.contentWindow?.location.pathname===ot}catch{return!1}}function uje({linkedResourceType:e,linkedResourceId:t,title:n,onSigningReturned:r,className:i}){let{doOperation:a}=pm(),o=lp(),[s,c]=(0,Q.useState)(e9.OPENING),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(o);h.current=o;let g=(0,Q.useRef)(r);g.current=r,(0,Q.useEffect)(()=>{let n=!1;return c(e9.OPENING),m.current(cje,{contextualParameters:{},requestData:{linkedResourceType:e,linkedResourceId:t,returnUrl:`${window.location.origin}${ot}`}},{silent:!0}).then(e=>{n||(u(e.url),c(e9.SIGNING))}).catch(e=>{n||(Ir(e)&&(e.errorType===v.NOT_FOUND||e.errorType===v.CONFLICT)?c(e9.NOTHING):(f(h.current(e)),c(e9.FAILED)))}),()=>{n=!0}},[e,t]);let _=(0,Q.useCallback)(()=>{lje(p.current)&&(c(e9.NOTHING),u(null),g.current?.())},[]);return s===e9.NOTHING?null:s===e9.OPENING?(0,$.jsx)(Zy,{}):s===e9.FAILED?(0,$.jsx)(jD,{variant:`destructive`,children:(0,$.jsx)(ND,{children:d})}):(0,$.jsx)(`iframe`,{ref:p,src:l??void 0,title:n,onLoad:_,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,referrerPolicy:`strict-origin`,className:W(`h-[80vh] w-full rounded-md border-0`,i)})}var t9=({resourceContext:e})=>{let{registry:t,doOperation:n}=pm(),{resourceContext:r,navigationZone:i,navigationInitiator:a,resourceType:o,contextualParameters:s,reportError:c,navigateToPreferredRead:l,goBackWithinZone:u}=rC(),{closeOverlay:d}=SS(),{makeTrComponent:f,isReady:p}=J({component:U.RESOURCES_LAYOUTS_CREATE}),m=f(U.RESOURCES_LAYOUTS_CREATE),h=lp(),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=wi.createOperationPathKey({resourceIdentifier:o,operationIdentifier:rd.DISCOVER_ENDPOINTS,variantType:E.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:$ee.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]),D=(0,Q.useCallback)(e=>{if(g){i===Vn.OVERLAY?d():u();return}let n=qz({result:e,resourceType:o,registry:t});n&&l({contextResourceIdentifiers:En.buildRecordIdentifiersFromCollection(r.contextResourceIdentifiers,o,n),fallbackToGoBack:!1})||u()},[d,r.contextResourceIdentifiers,u,g,l,i,t,o]),O=(0,Q.useCallback)(e=>{c(e,`Form submission failed`,`ResourceLayoutPreset_Create_SamlWizard`)},[c]);if(!p)return null;let k=m(`saml.import`);return(0,$.jsx)(xD,{voice:void 0,children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(uV,{resourceContext:r,navigationZone:i,navigationInitiator:a}),(0,$.jsxs)(CT,{className:`max-w-2xl`,children:[(0,$.jsx)(TT,{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)(eN,{name:`saml-metadata-url`,schema:gd(),type:`url`,placeholder:m(`saml.metadataUrlPlaceholder`),value:_,onChange:e=>v(String(e)),className:`flex-1`}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:T,disabled:y,children:y?m(`saml.importing`):k})]}),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)(vB,{resourceContext:r,navigationZone:i,onSuccess:D,onError:O,onCancel:i===Vn.OVERLAY?()=>d():void 0,showErrorSummary:!0,className:`max-w-2xl`,defaultValuesOverride:C})]})})};function dje({resourceContext:e}){let{resourceType:t,contextResourceIdentifiers:n}=e,{registry:r,doOperation:i}=pm(),{makeTrComponent:a,isReady:o}=J({component:U.RESOURCES_LAYOUTS_READ}),s=a(U.RESOURCES_LAYOUTS_READ),c=lp(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=n,m=p.organizations?En.getResourceId(p.organizations):void 0,h=p.applications?En.getResourceId(p.applications):void 0,g=m==null?ad.APPLICATION:ad.ORGANIZATION,_=String(m??h??``),v=(0,Q.useMemo)(()=>_?`${bi.getApiUrl()}/auth/saml/metadata/${g}/${_}`:null,[g,_]),y=(0,Q.useCallback)(async()=>{f(!0),u(null);try{let a=wi.createOperationPathKey({resourceIdentifier:t,operationIdentifier:rd.TEST_CONNECTION,variantType:E.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),o=V.buildContextualParameters(n,r),s=p[t]?En.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)(CT,{children:[(0,$.jsx)(TT,{children:s(`saml.samlTools`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-field`,children:[v&&(0,$.jsx)(X,{variant:Y.OUTLINE,asChild:!0,children:(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,children:x})}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:y,disabled:d,children:d?s(`saml.testing`):b})]})]}),l&&(0,$.jsxs)(CT,{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)(TT,{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)(FY,{...e,showCharts:!1,children:(0,$.jsx)(dje,{resourceContext:e.resourceContext})});function r9(e,t){return V.buildConfigurationError(rs.CONFIGURATION,{message:e,component:`useCompositeResourceOperationContextBuilder`,...t})}function fje(e){return`operationIdentifier`in e}function pje(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 mje(e,t,n,r,i){if(!e)throw r9(`Composite resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(fje(n)){let a=pje(e,t,n);if(Pm({operation:a,resourceType:t,resourceConfig:e})&&a.isBulkOperation!==!0&&!Uh({resourceConfig:e,operation:a,registry:r,hasResourceId:En.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===K.READ||a===K.UPDATE||a===K.DELETE,s=n.requireAddressable||o?ph({resourceConfig:e,operations:e.operations??[],coreOperation:a,registry:r,hasResourceId:En.getResourceId(i[t]).length>0,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}):Kl(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}=pm(),t=WU(),n=Qp();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=nm.mergeContextResourceIdentifiers(void 0,n?.buildContextResourceIdentifiers()??{},o)??{},c=r.resourceId?{...Bm({hostIdentifiers:r.contextResourceIdentifiers?n?.buildContextResourceIdentifiers()??{}:s,hostContextualParameters:{},hostRecord:{resourceType:r.resourceType,id:r.contextResourceIdentifiers?``:En.getResourceId(o?.[r.resourceType])},targetResourceType:r.resourceType,targetId:r.resourceId,registry:e}).identifiers,...r.contextResourceIdentifiers?o:{},[r.resourceType]:r.resourceId}:s,l=mje(i,r.resourceType,r,e,c),u=En.buildParentResourcesRequirements(r.resourceType,c,e,r.relationshipFieldOverrides);return En.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}=pm(),{t:s,formatDate:c,formatDateTime:l,tComponent:u,isReady:d}=J({component:U.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&&bl(e.operation)===K.LIST?e.operation:n?Kl((n.operations??[]).filter(t=>fY(t,e,i)),K.LIST):void 0,s=e.pinnedFilters;if(s&&o&&o!==e.operation&&il.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=wi.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)(Zy,{size:20,className:`text-muted-foreground`})});if(v)return(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:u(U.RESOURCES_LAYOUTS_CONTAINER_NESTED,`previewLoadFailed`)});if(!d)return null;if(x===0){if(!n)return null;let e=bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAll`});return(0,$.jsx)(X,{variant:Y.LINK,size:Gd.SM,className:`px-0`,onClick:i,children:e})}if(f.length===0){let e=bp({tComponent:u,componentType:U.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`emptyState`});return(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})}let w=m>x,T=bp({tComponent:u,componentType:U.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:Y.LINK,size:Gd.SM,className:`px-0`,onClick:i,children:T})]})}function hje({resourceType:e,limit:t,showViewAllLink:n=!0,viaForeignKey:r,className:i}){cY(e);let{buildOperationContext:a}=U6(),{navigationZone:o}=zU(),{navigate:s}=SS(),c=(0,Q.useMemo)(()=>a({resourceType:e,operationLike:K.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:va.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}=xU(),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}=J({component:U.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:Cr.IN_PROGRESS,elements:{},triggerCount:1}),A=T.length;(0,Q.useEffect)(()=>{D(0),k({status:Cr.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===Cr.COMPLETED).length:0,[j]),P=(0,Q.useCallback)((e,t,n)=>{let r=t===Cr.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===Cr.COMPLETED?t:n.completedAt,dismissedAt:e===Cr.DISMISSED?t:n.dismissedAt}))},[]),I=(0,Q.useCallback)(async(e,t)=>{P(e,Cr.COMPLETED,t),_&&c(g,e,t),r?.(e,Cr.COMPLETED),E<A-1?D(e=>e+1):(F(Cr.COMPLETED),_&&l(g))},[c,l,E,_,g,r,P,F,A]),L=(0,Q.useCallback)(e=>{P(e,Cr.DISMISSED),r?.(e,Cr.DISMISSED),w.allowDismiss&&(F(Cr.DISMISSED),_&&u(g))},[u,_,g,w.allowDismiss,r,P,F]),ee=(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(Cr.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(Cr.SKIPPED),_&&d(g)},[_,g,F,d]);if(!C||_&&p)return null;if(T.length===0)return(0,$.jsx)(`div`,{className:W(`p-container-xl text-center text-muted-foreground`,n),children:S(U.GUIDANCE_ONBOARDING_VIEW,`empty`)});if(cd(j?.status))return null;let ne=T[E];if(!ne)return null;let re=Z2(ne.type),ie=M(ne.ref),ae=x(y,ne.ref,yl(ne));return(0,$.jsxs)(`div`,{className:W(`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(U.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A})}),(0,$.jsxs)(`span`,{className:`text-xs`,children:[N,`/`,A]})]}),(0,$.jsx)(v_,{value:A>0?(E+1)/A*100:0,className:`h-1`,"aria-label":S(U.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:L,onAction:ee,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:Y.OUTLINE,size:Gd.SM,onClick:z,children:S(U.GUIDANCE_ONBOARDING_VIEW,`back`)})}),(0,$.jsxs)(`div`,{className:`flex gap-item items-center`,children:[w.allowSkip&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:te,children:S(U.GUIDANCE_ONBOARDING_VIEW,`skip`)}),(0,$.jsx)(X,{variant:Y.DEFAULT,size:Gd.SM,onClick:R,children:E===A-1?S(U.GUIDANCE_ONBOARDING_VIEW,`complete`):S(U.GUIDANCE_ONBOARDING_VIEW,`next`)})]})]}),A===1&&(0,$.jsxs)(`div`,{className:`flex justify-end gap-item items-center`,children:[w.allowDismiss&&(0,$.jsx)(X,{variant:Y.GHOST,size:Gd.SM,onClick:()=>L(ne.ref),children:S(U.GUIDANCE_ONBOARDING_VIEW,`dismiss`)}),(0,$.jsx)(X,{variant:Y.DEFAULT,size:Gd.SM,onClick:R,children:S(U.GUIDANCE_ONBOARDING_VIEW,`complete`)})]})]})},s9=Object.freeze({});function gje(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}=pm(),[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=En.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=sV({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:K.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:c,contextualParameters:e});if(!r){i(s9);return}let m=wi.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=gje(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}=pm(),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=Sp(e.resourceType,{ref:e.viewRef});return(0,$.jsx)(`div`,{className:e.className,children:(0,$.jsx)(Wh,{requiredFeatures:n.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewRef:r.insertedViewRef,viewDefinition:n,runtimeDescriptor:_p({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=zU();return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:{...s.contextResourceIdentifiers??{},...n??{}},inputs:r,urlParamValues:i,className:a,height:o})}function _je({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 vje({viewRef:e,className:t}){let n=BU(),r=n?.hostResourceType?n.contextResourceIdentifiers?.[n.hostResourceType]??`no-row`:`no-host`;return(0,$.jsx)(`div`,{className:t,children:(0,$.jsx)(iY,{descentKey:`composite:${e}::${r}`,children:(0,$.jsx)(GU,{viewRef:e})})})}function f9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(iY,{descentKey:`execution:${e}::${Object.values(n??{}).join(`,`)||`no-row`}`,children:(0,$.jsx)(QY,{viewRef:e,navigationZone:t,contextResourceIdentifiers:n})})})}function yje({viewRef:e,contextResourceIdentifiers:t,className:n}){let r=zU();return f9(e,r.navigationZone,{...r.contextResourceIdentifiers??{},...t??{}},n)}function p9(e,t){return V.buildConfigurationError(rs.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)(iY,{descentKey:m9(e),children:(0,$.jsx)(Kk.Provider,{value:!0,children:(0,$.jsx)(UY,{resourceContext:e,navigationZone:t,navigationInitiator:n})})})})}function g9({resourceContext:e,className:t}){let{navigationZone:n,navigationInitiator:r}=zU();return h9(e,n,r,t)}function bje({className:e,...t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=U6();return h9((0,Q.useMemo)(()=>i.buildOperationContext(t),[i,JSON.stringify(t)]),n,r,e)}function _9({className:e,...t}){cY(t.resourceType);let{navigationZone:n,navigationInitiator:r}=zU(),i=U6(),{registry:a}=pm(),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&&!V6({target:t,hostResourceType:e,operation:o.operation,registry:a});if(!t.resourceType||s||!r?.resourceRelationships)return;let c=t.relationshipFieldOverrides?.[e],l=Mc(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:K.LIST,relationshipFieldOverrides:t,className:n})}function xje({className:e}){let{navigationZone:t,navigationInitiator:n}=zU(),r=U6(),{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:gu.CONVERSATION_THREADS,operationLike:K.LIST,requireAddressable:!1,pinnedFilters:{[Ha.RESOURCE_TYPE]:i,[Ha.RESOURCE_ID]:a}})},[r,i,a]),t,n,e)}var Sje={[gu.USER_FLOW_ACTOR_EXECUTIONS]:gu.USER_AGENT_WORK_DECISIONS,[gu.ORGANIZATION_FLOW_ACTOR_EXECUTIONS]:gu.ORGANIZATION_AGENT_WORK_DECISIONS,[gu.APPLICATION_FLOW_ACTOR_EXECUTIONS]:gu.APPLICATION_AGENT_WORK_DECISIONS};function y9({executionId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=U6(),{hostResourceType:a}=i;return h9((0,Q.useMemo)(()=>{let t=Sje[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:K.LIST,requireAddressable:!1,pinnedFilters:{[fd.KIND]:Oa.CONVERSATIONAL_EXECUTION,[fd.ID]:e}})},[i,a,e]),n,r,t)}var b9=new Set;function Cje(e,t,n){let r=`${e}::${t}`;b9.has(r)||(b9.add(r),il.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=U6(),r=oS(),i=t?JSON.stringify(t):``;return(0,Q.useMemo)(()=>{if(t===null)return!1;let a;try{a=n.buildOperationContext({resourceType:e,operationLike:K.LIST,requireAddressable:!1,pinnedFilters:t?JSON.parse(i):void 0})}catch(t){return Cje(n.hostResourceType,e,rK(t)),!1}let o=a.operation;return Gm({...o,resourceType:e},r)},[n,e,r,i,t===null])}function S9(e){let t=U6(),{hostResourceType:n}=t,{embedName:r,resourceType:i,pinnedFilters:a}=e,o=x9(i,a),s=JSON.stringify(a);return(0,Q.useMemo)(()=>{if(n!==gu.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:K.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}=zU(),i=S9({embedName:`EmbedRepresentationTeam`,resourceType:gu.REPRESENTATIVE_ASSIGNMENTS,pinnedFilters:{[bie]:e}});return i?h9(i,n,r,t):null}function w9({organizationRelationshipId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=S9({embedName:`EmbedRepresentationMailboxes`,resourceType:gu.RELATIONSHIP_MAILBOXES,pinnedFilters:{[zi]:e}});return i?h9(i,n,r,t):null}function wje({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:K.SEARCH,relationshipFieldOverrides:t,className:n})}function Tje({viewRef:e,inputs:t,urlParamValues:n,className:r,...i}){let a=U6(),o=a.buildOperationContext({...i,operationLike:K.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 Eje({resourceType:e,viewRef:t,inputs:n,urlParamValues:r,className:i,...a}){if(!e)throw p9(`EmbedRelatedChart() requires a target resourceType.`,{target:a});let o=U6().deriveRelatedScopeIdentifiers({...a,resourceType:e,operationLike:K.LIST});return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:o,inputs:n,urlParamValues:r,className:i})}function Dje({viewRef:e,className:t,...n}){let{navigationZone:r}=zU(),i=U6(),a=i.buildOperationContext({...n,operationLike:K.READ}),o=c9(i);return f9(fp(i.hostResourceType,{ref:e}).insertedViewRef,r,l9(V.flattenContextIdentifiers(a.contextResourceIdentifiers),o),t)}function Oje({resourceType:e,viewRef:t,className:n,...r}){let{navigationZone:i}=zU(),a=U6();if(!e)throw p9(`EmbedRelatedExecution() requires a target resourceType.`,{target:{resourceType:e,viewRef:t,...r}});let o=a.buildOperationContext({...r,resourceType:e,operationLike:K.READ});return f9(fp(e,{ref:t}).insertedViewRef,i,V.flattenContextIdentifiers(o.contextResourceIdentifiers),n)}function kje(e){if(!e.hostRelationships)return!1;let t=Mc(e.hostRelationships).filter(t=>(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType);return t.length>0&&t.every(t=>!Xl.isRelationshipActiveForParent(t,e.hostRecord,{onMissingParentResource:`exclude`,onConditionError:`exclude`}))}var T9=new Set;function Aje(e,t,n){let r=`${e}::${t}`;T9.has(r)||(T9.add(r),il.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}){uY();let r=(0,Q.useMemo)(()=>e.map(e=>typeof e==`string`?{resourceType:e}:e),[e]),i=H6(),a=i?.hostResourceType??``,o=i?.hostResourceConfig?.resourceRelationships,s=ik(),c=s?.data,{tResourceHeader:l,isReady:u}=J({component:U.RESOURCES_LAYOUTS_CONTAINER_NESTED}),d=(0,Q.useMemo)(()=>r.filter(e=>{if(!i)return!0;if(s&&kje({hostResourceType:a,hostRelationships:o,targetResourceType:e.resourceType,hostRecord:c}))return!1;try{return i.buildOperationContext({resourceType:e.resourceType,operationLike:e.operationLike??K.LIST,relationshipFieldOverrides:e.viaForeignKey}),!0}catch(t){return Aje(a,e.resourceType,rK(t)),!1}}),[r,i,a,o,s,c]),f=(0,Q.useMemo)(()=>d.map(e=>({id:e.resourceType,title:qp({tResourceHeader:l,resourceType:e.resourceType,key:`title`}),content:(0,$.jsx)(Kk.Provider,{value:!0,children:(0,$.jsx)(_9,{resourceType:e.resourceType,operationLike:e.operationLike??K.LIST,relationshipFieldOverrides:e.viaForeignKey})})})),[d,l]);if(f.length===0)return null;let p=d.some(e=>{let t=e.operationLike??K.LIST;return t===K.LIST||t===K.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:W(`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)(PM.Provider,{value:l,children:(0,$.jsxs)(`div`,{className:W(`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 jje=il.getLogger(),Mje=new Set;function Nje(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}var Pje=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`,`range`,`color`,`hidden`]),Fje=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)?jje.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 Ije({className:e,initialStep:t=0,validateOnStepChange:n=!0,onStepChange:r,submitButton:i,children:a}){Bde();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)(Mje),g=BC(),_=PT(),v=oE(),y=v?.claimFooter,b=(0,Q.useContext)($R),x=b?.claim;(0,Q.useLayoutEffect)(()=>x?.(),[x]),(0,Q.useLayoutEffect)(()=>y?.(),[y]);let{tComponent:S,isReady:C}=J({component:U.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(U.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=>bC(e,t)!==void 0)&&t.add(r)}),h(e=>Nje(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 L(E,e)||N(e)},L=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)},ee=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&&!Pje.has(t.type)&&(e.preventDefault(),ee())},ne=e=>{e.detail>1&&Date.now()-d.current<Fje&&(e.preventDefault(),e.stopPropagation())};if(!C)return null;let re=S(U.LOW_LEVEL_FORM_MESSAGE,`wizardPrevious`),ie=S(U.LOW_LEVEL_FORM_MESSAGE,`wizardNext`),ae=i??v?.submitButton??(0,$.jsx)(X,{type:`submit`,disabled:_?.disabled,children:S(U.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:Ks.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)(Vy,{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:Y.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?Y.OUTLINE:void 0,onClick:ee,disabled:_?.disabled,children:ie},`next`)]})]})]})})}function A9({name:e,className:t,children:n}){let r=PT(),i=ik(),{getRecipe:a}=Ig(),o=r?.groupLabels?.[e]??i?.groupLabels?.[e];return(0,$.jsxs)(`div`,{className:t,"data-guidance-group":e,children:[o&&(0,$.jsx)(`h3`,{className:W(`col-span-full mb-element`,a(_t.TYPOGRAPHY,ii.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}=BC(),{fields:l,append:u,remove:d}=Aw({control:c,name:s});hk(s),FM(s);let{tComponent:f,isReady:p}=J({component:U.LOW_LEVEL_FORM_MESSAGE});if(!p)return null;let m=Lje(o),h=a===void 0||l.length<a,g=i===void 0||l.length>i,_=n??f(U.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),v=f(U.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:Y.GHOST,onClick:()=>d(t),className:`mt-1`,children:r??f(U.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:`${v} ${t+1}`})})]},e.id)),h&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:()=>u({}),className:`mt-2`,children:_})]})}function Lje(e){let t=null;return Q.Children.forEach(e,e=>{!t&&Q.isValidElement(e)&&e.type===j9&&(t=e)}),t}Nk(M9);function Rje({className:e}){return(0,$.jsx)(`hr`,{className:e})}function zje(e){let{resourceType:t,viewRef:n,contextResourceIdentifiers:r,inputs:i,urlParamValues:a,localErrorOnly:o=!1}=e,{registry:s}=pm(),{resolvedRegionalPreferences:c}=J(),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)(()=>_p({identity:Sp(t,{ref:n}),chartView:l,contextResourceIdentifiers:r??{}}),[t,n,l,r]),d=y_({surfaceDefinition:l,runtimeDescriptor:u,explicitContextResourceIdentifiers:r,explicitInputs:i,urlParamValues:a});return m_(d?.chartDefinition,d?.executionChartRef,d?.resolvedInputs,d?.contextResourceIdentifiers,a,o,c.timezone)}function Bje(e,t){let n=(Array.isArray(e?.operations)?e.operations:[]).find(e=>String(e.operationIdentifier)===K.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 Vje(e,t){let n=e.accessProfile,r=gre(n?.organizationOwnRows,t),i=Dee(n?.organizationAssignedRows,t);if(!r&&!i)return e.organizationRoles;let a=t=>Co(t,e.roleTables.orgRolesConfig);return e.organizationRoles.filter(e=>Ke({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=Bje(t.resourceConfigurations[r],e.accessControl?.roles);return!i||i.length===0?!1:Lm(i,{...n,organizationRoles:Vje(n,r)})})}function P9(e){return e.rows??Fs.ONE}function Hje(e,t){if(e.height!==void 0)return t===P9(e)?e.height:t===Fs.TWO?e.height*2+32:Math.max(1,Math.round((e.height-32)/2))}function F9(e,t,n){let r=Hje(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=>[xu(e),e])),r=new Set,i=[];for(let e of t){let t=xu(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(xu(t))||i.push({tile:t,declared:t,hidden:!1});return i}function Uje(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??bo.ONE,rows:P9(e),hidden:t}))}function R9(e,t){let n=e?Gje:Wje;return t===Fs.TWO&&!e?n*2+32:n}var Wje=280,Gje=64,Kje=il.getLogger(),z9=gu.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===E.API_CALL)}function W9(e){return t=>{throw H9(e),t}}function qje(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}function Jje(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}=pm(),i=Qp()?.currentOrganizationId??null,a=n.resourceConfigurations[z9],o=a?.operations,s=n.resourceConfigurations[gu.ORGANIZATIONS]?.resourceFieldIdentifier??`organizationId`,c=a?.resourceFieldIdentifier,l=(0,Q.useMemo)(()=>({list:U9(o,K.LIST),create:U9(o,K.CREATE),update:U9(o,K.UPDATE),remove:U9(o,K.DELETE)}),[o]),u=e=>!!e&&Gm({...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(wi.buildOperationPathKeyFromOperation(l.list),{contextualParameters:{[s]:i},queryParameters:{dashboardRef:e,page:1,limit:1}},{silent:!0}).then(t=>n(qje(t).find(t=>t.dashboardRef===e))).catch(t=>{Kje.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=Jje(await(y?v.current(wi.buildOperationPathKeyFromOperation(l.update),{contextualParameters:{...n,[c]:y._id},requestData:{tiles:t}}):v.current(wi.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(wi.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=U.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,q9=Vd(bo),J9=Vd(Fs),Yje=Object.values(bo),Xje=Object.values(Fs);function Zje(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}=J({component:K9}),{renderIcon:o}=kf(),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)(()=>Yje.map(e=>({value:e,label:s(`span_${e}`)})),[s]),_=(0,Q.useMemo)(()=>Xje.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=Zje(e.tile),r=i(Vl.CHART,`resources.${e.tile.resourceType}.${e.tile.chartViewRef}`,`title`)||n,a=e.tile.span??bo.ONE,d=e.tile.rows??Fs.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:Y.GHOST,size:Gd.ICON_SM,"aria-label":s(`moveUp`),disabled:u||t===0,onClick:()=>l(e=>Y9(e,t,-1)),children:o(H.CHEVRON_UP,{size:Jn.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Gd.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:Jn.XS})})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(Z,{as:`div`,typography:ii.BODY,children:r}),(0,$.jsx)(Z,{as:`div`,typography:ii.DESCRIPTION,children:s(`tilePosition`,{position:t+1,count:c.length})})]}),(0,$.jsx)(wI,{name:`${n}:shown`,schema:Pd(),"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:ii.DESCRIPTION,children:s(`widthLabel`)}),(0,$.jsx)(_F,{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:ii.DESCRIPTION,children:s(`heightLabel`)}),(0,$.jsx)(_F,{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)(sG,{children:[t.stored&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,disabled:u,onClick:()=>void h(t.reset),"data-chart-dashboard-layout-reset":!0,children:s(`resetButton`)}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,disabled:u,onClick:n,children:s(`cancelButton`)}),(0,$.jsx)(X,{type:`button`,variant:Y.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}=J({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:Y.GHOST,size:Gd.SM,onClick:()=>a(!0),"data-chart-dashboard-layout-open":!0,children:n(K9,`customizeButton`)}),(0,$.jsx)(nG,{open:i,onOpenChange:a,children:(0,$.jsxs)(iG,{children:[(0,$.jsxs)(oG,{children:[(0,$.jsx)(cG,{children:n(K9,`title`)}),(0,$.jsx)(lG,{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}=pm(),a=oS(),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===tte.KPI}]}),[s,i,a]);if(o.readState===B9.LOADING||c.length===0&&!o.canEdit)return null;let l=Qje[t];return(0,$.jsxs)(`div`,{className:W(`@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:W(`grid grid-cols-1 gap-group`,l.columns),children:c.map(({tile:e,isFigure:t})=>(0,$.jsx)(eMe,{tile:e,isFigure:t,grid:l},`${e.resourceType}:${e.chartViewRef}`))})]})}var Qje={[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 $je(e,t){let n=e.span??bo.ONE;return W(n===bo.TWO&&t.spanTwo,n===bo.FULL&&`col-span-full`,e.rows===Fs.TWO&&t.rowsTwo)}function eMe({tile:e,isFigure:t,grid:n}){let{tView:r}=J(),i=r(Vl.CHART,`resources.${e.resourceType}.${e.chartViewRef}`,`title`);return(0,$.jsxs)(`section`,{className:W(`flex min-w-0 flex-col gap-element`,$je(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:ii.EYEBROW,children:i}),(0,$.jsx)(d9,{resourceType:e.resourceType,viewRef:e.chartViewRef,height:e.height??R9(t,e.rows)})]})}function tMe(e){let{tiles:t,columns:n,layoutRef:r,...i}=e;function a(){return(0,$.jsx)(QU,{children:(0,$.jsx)($9,{tiles:t,columns:n,layoutRef:r})})}return Cp(a,i)}function nMe(e,t=tm.APPLICATION){return up.parse({ref:e,scope:t,options:{showProgress:!0,allowDismiss:!0,persistState:!0},elements:[]})}function rMe(e,t){return{...e,elements:[...e.elements,t]}}function iMe(e,t){return{...e,elements:e.elements.filter(e=>e.ref!==t)}}function aMe(e,t,n){return{...e,elements:e.elements.map(e=>e.ref===t?{...e,status:n}:e)}}function oMe(e){if(e.elements.length===0)return 0;let t=e.elements.filter(e=>e.status===Cr.COMPLETED).length;return Math.round(t/e.elements.length*100)}function sMe(e){return e.elements.every(e=>e.status===Cr.COMPLETED)}function cMe(e,t){return e.elements.filter(e=>e.type===t)}function lMe(e){return JSON.stringify(e,null,2)}function uMe(e){let t=JSON.parse(e);return up.parse(t)}var dMe=t({ACTOR_TASK_TOPICS_VOCABULARY:()=>Gf,AI_ActorCard:()=>f6,AI_ActorExecutionModeBadge:()=>m6,AI_ActorRoleBadge:()=>p6,AI_ActorTeam:()=>hEe,AI_AgentCapabilities:()=>ZEe,AI_AgentCard:()=>c8,AI_AgentList:()=>s8,AI_AgentPromptSpec:()=>XEe,AI_ApprovalQueue:()=>aW,AI_ApprovalRequest:()=>iW,AI_Artifact:()=>VOe,AI_ArtifactAction:()=>JOe,AI_ArtifactActions:()=>qOe,AI_ArtifactClose:()=>UOe,AI_ArtifactContent:()=>WOe,AI_ArtifactDescription:()=>KOe,AI_ArtifactFileContent:()=>GEe,AI_ArtifactHeader:()=>HOe,AI_ArtifactItem:()=>a8,AI_ArtifactList:()=>i8,AI_ArtifactOrigin:()=>UEe,AI_ArtifactStructuredContent:()=>KEe,AI_ArtifactTextContent:()=>WEe,AI_ArtifactTitle:()=>GOe,AI_Canvas:()=>uf,AI_ChainOfThought:()=>n7,AI_ChainOfThoughtContent:()=>a7,AI_ChainOfThoughtHeader:()=>r7,AI_ChainOfThoughtImage:()=>yAe,AI_ChainOfThoughtSearchResult:()=>vAe,AI_ChainOfThoughtSearchResults:()=>_Ae,AI_ChainOfThoughtStep:()=>i7,AI_Checkpoint:()=>bAe,AI_CodeBlock:()=>b5,AI_Confirmation:()=>Vke,AI_Connection:()=>uAe,AI_Context:()=>pAe,AI_Controls:()=>Tf,AI_Conversation:()=>O5,AI_ConversationContent:()=>k5,AI_ConversationEmptyState:()=>A5,AI_ConversationScrollButton:()=>j5,AI_ConversationThread:()=>yQ,AI_ConversationThreadComposer:()=>bQ,AI_ConversationThreadDiscussions:()=>xQ,AI_DecisionRequest:()=>oW,AI_DiffBlock:()=>x5,AI_Edge:()=>dAe,AI_ExecutionPlan:()=>E6,AI_ExecutionPlanProgress:()=>O6,AI_ExecutionPlanStep:()=>D6,AI_ExecutionStream:()=>lAe,AI_ExecutionUsage:()=>J6,AI_ExecutionUsageSummary:()=>X6,AI_FlowExecutionCanvas:()=>SEe,AI_FlowExecutionSummary:()=>CEe,AI_FlowExecutionTimeline:()=>g6,AI_FlowExecutionTimelineItem:()=>wEe,AI_FlowNodeStatusBadge:()=>gf,AI_FlowNodeStepBadge:()=>yf,AI_GraphViewer:()=>h6,AI_HumanInputRequest:()=>sW,AI_Image:()=>tke,AI_InlineCitation:()=>xAe,AI_Loader:()=>gAe,AI_Message:()=>TQ,AI_MessageAction:()=>kQ,AI_MessageActions:()=>OQ,AI_MessageAttachment:()=>Ybe,AI_MessageAttachments:()=>Xbe,AI_MessageBranch:()=>Ube,AI_MessageBranchContent:()=>Wbe,AI_MessageBranchNext:()=>qbe,AI_MessageBranchPage:()=>Jbe,AI_MessageBranchPrevious:()=>Kbe,AI_MessageBranchSelector:()=>Gbe,AI_MessageContent:()=>EQ,AI_MessageResponse:()=>DQ,AI_MessageToolbar:()=>Zbe,AI_ModelSelector:()=>mAe,AI_Node:()=>Uf,AI_OpenInChat:()=>hAe,AI_Panel:()=>$5,AI_Plan:()=>SAe,AI_PlanAction:()=>OAe,AI_PlanContent:()=>TAe,AI_PlanDescription:()=>DAe,AI_PlanFooter:()=>kAe,AI_PlanHeader:()=>CAe,AI_PlanTitle:()=>EAe,AI_PlanTrigger:()=>wAe,AI_PromptInput:()=>N5,AI_PromptInputActionAddAttachments:()=>yke,AI_PromptInputActionMenu:()=>hke,AI_PromptInputActionMenuContent:()=>_ke,AI_PromptInputActionMenuItem:()=>vke,AI_PromptInputActionMenuTrigger:()=>gke,AI_PromptInputAttachment:()=>lke,AI_PromptInputAttachments:()=>uke,AI_PromptInputBody:()=>dke,AI_PromptInputButton:()=>mke,AI_PromptInputCommand:()=>Eke,AI_PromptInputCommandEmpty:()=>kke,AI_PromptInputCommandGroup:()=>Ake,AI_PromptInputCommandInput:()=>Dke,AI_PromptInputCommandItem:()=>jke,AI_PromptInputCommandList:()=>Oke,AI_PromptInputCommandSeparator:()=>Mke,AI_PromptInputFooter:()=>F5,AI_PromptInputHeader:()=>fke,AI_PromptInputHoverCard:()=>Nke,AI_PromptInputHoverCardContent:()=>Fke,AI_PromptInputHoverCardTrigger:()=>Pke,AI_PromptInputProvider:()=>cke,AI_PromptInputSelect:()=>xke,AI_PromptInputSelectContent:()=>Cke,AI_PromptInputSelectItem:()=>wke,AI_PromptInputSelectTrigger:()=>Ske,AI_PromptInputSelectValue:()=>Tke,AI_PromptInputSpeechButton:()=>bke,AI_PromptInputSubmit:()=>I5,AI_PromptInputTab:()=>Lke,AI_PromptInputTabBody:()=>zke,AI_PromptInputTabItem:()=>Bke,AI_PromptInputTabLabel:()=>Rke,AI_PromptInputTabsList:()=>Ike,AI_PromptInputTextarea:()=>P5,AI_PromptInputTools:()=>pke,AI_Queue:()=>Hke,AI_QueueItem:()=>Wke,AI_QueueItemAction:()=>Yke,AI_QueueItemActions:()=>Jke,AI_QueueItemAttachment:()=>Xke,AI_QueueItemContent:()=>Kke,AI_QueueItemDescription:()=>qke,AI_QueueItemFile:()=>Qke,AI_QueueItemImage:()=>Zke,AI_QueueItemIndicator:()=>Gke,AI_QueueList:()=>Uke,AI_QueueMessageItem:()=>iAe,AI_QueueSection:()=>$ke,AI_QueueSectionContent:()=>nAe,AI_QueueSectionLabel:()=>tAe,AI_QueueSectionTrigger:()=>eAe,AI_QueueTodoItem:()=>rAe,AI_Reasoning:()=>c7,AI_ReasoningContent:()=>u7,AI_ReasoningTrigger:()=>l7,AI_RiskLevelBadge:()=>w6,AI_Shimmer:()=>e7,AI_Source:()=>V5,AI_Sources:()=>R5,AI_SourcesContent:()=>B5,AI_SourcesTrigger:()=>z5,AI_Suggestion:()=>U5,AI_Suggestions:()=>H5,AI_SystemCard:()=>v6,AI_SystemCardCompact:()=>y6,AI_SystemCatalog:()=>DEe,AI_SystemDetail:()=>b6,AI_SystemKindBadge:()=>S6,AI_SystemStatusBadge:()=>C6,AI_Task:()=>aAe,AI_TaskContent:()=>sAe,AI_TaskDetail:()=>j6,AI_TaskItem:()=>cAe,AI_TaskItemFile:()=>K5,AI_TaskList:()=>N6,AI_TaskMemory:()=>IEe,AI_TaskMemoryEntryItem:()=>L6,AI_TaskMemoryScope:()=>I6,AI_TaskTimeline:()=>P6,AI_TaskTrigger:()=>oAe,AI_Tool:()=>J5,AI_ToolContent:()=>X5,AI_ToolHeader:()=>Y5,AI_ToolInput:()=>Z5,AI_ToolOutput:()=>Q5,AI_Toolbar:()=>fAe,AI_WebPreview:()=>nke,AI_WebPreviewBody:()=>oke,AI_WebPreviewConsole:()=>ske,AI_WebPreviewNavigation:()=>rke,AI_WebPreviewNavigationButton:()=>ike,AI_WebPreviewUrl:()=>ake,APP_LEVEL_NAVIGATION_SOURCE:()=>Li,APP_SCOPE_FIELD_DEFAULT_POSITION:()=>999,ARRAY_ROW_TEMPLATE_GUTTER_CLASS:()=>`w-7`,Accordion:()=>pO,AccordionContent:()=>gO,AccordionItem:()=>mO,AccordionTrigger:()=>hO,ActionBar:()=>qS,ActionBarPopoverChrome:()=>WS,ActionButton:()=>u8,ActionPlacement:()=>dl,ActionVisibility:()=>Gl,ActivityBarRendering:()=>Si,ActivityBarRenderingSchema:()=>l,ActorActivity:()=>u6,Alert:()=>jD,AlertDescription:()=>ND,AlertDialog:()=>zw,AlertDialogAction:()=>Kw,AlertDialogCancel:()=>qw,AlertDialogContent:()=>Vw,AlertDialogDescription:()=>Gw,AlertDialogFooter:()=>Uw,AlertDialogHeader:()=>Hw,AlertDialogTitle:()=>Ww,AlertDialogTrigger:()=>Bw,AlertTitle:()=>MD,AnalyticsContext:()=>p$,AnalyticsContextProvider:()=>h$,AnalyticsIdentityPublisherContext:()=>m$,AnalyticsProviderRegistry:()=>d$,AnonymousSessionProvider:()=>sp,AnonymousSessionStatus:()=>rse,ApiNotReadyError:()=>fie,ApiReadinessChecker:()=>ire,AppCelebrationOverlay:()=>YQ,AppConfiguration_Frontend_Schema:()=>wm,AppLayoutPreset_ErrorBoundary_Default:()=>Ry,AppLayoutPreset_Home_Default:()=>XU,AppLayoutPreset_RouterErrorBoundary_Default:()=>Hy,AppLayout_AuthenticatedRoute:()=>UH,AppLayout_ConsentGate:()=>LH,AppLayout_DocumentAcceptanceGate:()=>BH,AppLayout_ErrorBoundary:()=>zy,AppLayout_Home:()=>ZU,AppLayout_MainContainer:()=>PH,AppLayout_NotificationCenter:()=>O8,AppLayout_RouterErrorBoundary:()=>Uy,AppLevelComponentConfigurationSchema:()=>Goe,AppLoadingGate:()=>ab,AppLoadingIdentifier:()=>au,AppModeDefinitionSchema:()=>Hne,AppModeProvider:()=>Zx,AppNotificationCenter:()=>D8,AppScopeContext:()=>Boe,AppScopeProvider:()=>Em,AppScopeSessionMode:()=>Fee,AppShellContentOutlet:()=>f4,AppShellLoadingState:()=>c4,AppShellOverlayPortalLayer:()=>u4,AppShellOverlaysOutlet:()=>p4,AppShellProviders:()=>l4,AppShellRegionOutlet:()=>d4,ApplicationContext:()=>ea,ApplicationLevelComponentType:()=>hr,ApplicationLevel_ActivityBar:()=>O2,ApplicationLevel_CommandMenu:()=>tje,ApplicationLevel_ControlPanel:()=>nje,ApplicationLevel_MenuBar:()=>k2,ApplicationLevel_MenuUserOrg:()=>rje,ApplicationLevel_NavigationBack:()=>CB,ApplicationLevel_NotificationCenter:()=>oje,ApplicationLevel_QuickActionButton:()=>A2,ApplicationLevel_QuickSwitcher:()=>sje,ApplicationLevel_Sidebar:()=>j2,ApplicationLevel_StatusBar:()=>M2,ApplicationLevel_Toolbar:()=>N2,ApplicationLevel_UtilityPanel:()=>P2,ApplicationMainProvider:()=>K$,ApprovalSeal:()=>eM,ApprovalSealCheckState:()=>$j,ApprovalSealReadState:()=>Qj,ArrayAutosavesContext:()=>dI,ArrayField:()=>M9,ArrayItemTemplate:()=>j9,AspectRatio:()=>mDe,AuthPage_OneOffSession:()=>TZ,AuthSessionContext:()=>Hoe,AuthSessionProvider:()=>im,AuthSessionUtils:()=>qm,Auth_AuthCallback:()=>yX,Auth_ChatIdentityLink:()=>zZ,Auth_ConfirmEmail:()=>hZ,Auth_EnrollmentRequired:()=>nZ,Auth_Invitation:()=>SZ,Auth_MagicLinkVerify:()=>CX,Auth_Main:()=>fZ,Auth_MfaChallenge:()=>$X,Auth_OAuthConsent:()=>PZ,Auth_OAuthLoggedOut:()=>VZ,Auth_OAuthLogoutConfirm:()=>WZ,Auth_OneOffSession:()=>wZ,Auth_OrganizationOnboarding:()=>sZ,Auth_PasswordLost:()=>MZ,Auth_Register:()=>XZ,AutomatedArrayField:()=>yI,AutomatedForm:()=>rE,AutomatedLayoutFrontendUtils:()=>mr,AutomatedLayoutTemplateKind:()=>DT,AutomaticDisplayer:()=>BB,AutosaveFieldState:()=>Qw,AutosaveIndicator:()=>WM,AutosaveProvider:()=>EE,AutosaveTrigger:()=>ll,Avatar:()=>h8,AvatarFallback:()=>_8,AvatarImage:()=>g8,BADGE_DISPLAY_CAP:()=>99,BADGE_VARIANT_INDICATOR:()=>e_,BILLING_COMMAND_MENU_ITEM:()=>$3,BILLING_SETTINGS_SECTION_REF:()=>Q3,BackendProxyAnalyticsProvider:()=>u$,Badge:()=>Nf,BillingContext:()=>Nh,BillingPortalLink:()=>N1,BillingProvider:()=>Sh,Breadcrumb:()=>TB,BreadcrumbEllipsis:()=>jB,BreadcrumbItem:()=>DB,BreadcrumbLink:()=>OB,BreadcrumbList:()=>EB,BreadcrumbPage:()=>kB,BreadcrumbSeparator:()=>AB,Button:()=>X,ButtonGroup:()=>d8,ButtonGroupSeparator:()=>rDe,ButtonGroupText:()=>f8,ButtonLabelOverflow:()=>Qd,ButtonVariants_Variant:()=>Y,CATEGORY_LOADING_DEFAULTS:()=>rb,CHART_DASHBOARD_ROW_GAP_PX:()=>32,CHART_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Wae,CHART_ROUTE_PATH_PREFIX:()=>goe,COLLECTION_SURFACE_ATTRIBUTE:()=>mA,COMMON_ENUM_DISPLAY_CONFIG:()=>b_,COMPOSITE_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>ooe,Calendar:()=>j8,CalendarDayButton:()=>M8,Card:()=>kF,CardAction:()=>PF,CardActionPlacementSchema:()=>vne,CardContent:()=>IF,CardDescription:()=>FF,CardFooter:()=>MF,CardHeader:()=>jF,CardLayoutStyle:()=>Hc,CardListbox:()=>AF,CardStatusEdge:()=>DF,CardTitle:()=>NF,Carousel:()=>V8,CarouselContent:()=>H8,CarouselItem:()=>U8,CarouselNext:()=>gDe,CarouselPrevious:()=>hDe,ChartDashboard:()=>$9,ChartDashboardColumns:()=>Q9,ChartDashboardLayoutControl:()=>Z9,ChartDashboardLayoutEditor:()=>X9,ChartDashboardLayoutReadState:()=>B9,ChartEmptyState:()=>x_,ChartErrorState:()=>__,ChartLoadingSkeleton:()=>Cm,ChartView:()=>BJ,ChartWidget:()=>Xh,ChatSignInCompletionOutcome:()=>zb,Checkbox:()=>DI,CheckboxRoot:()=>OI,ChipsInput:()=>uI,Code:()=>u_,Collapsible:()=>CO,CollapsibleContent:()=>TO,CollapsibleTrigger:()=>wO,CollectionBoardConfigSchema:()=>jie,CollectionCalendarConfigSchema:()=>Mne,CollectionDisplayMode:()=>vs,CollectionFilterPanelVisibility:()=>vl,CollectionFilterPresetContextValue:()=>Zc,CollectionFilterPresetRelativeMonthRange:()=>Zs,CollectionFilterPresetRelativeRange:()=>Ps,CollectionFilterPresetSchema:()=>$te,CollectionFilterPresetValueSchema:()=>Bie,CollectionTimelineConfigSchema:()=>tae,CollectionToolbarPresence:()=>Go,ColorInput:()=>II,ColorNotation:()=>P3,Combobox:()=>dx,ComboboxMultiple:()=>fx,Command:()=>wV,CommandBarPolicy:()=>ym,CommandDialog:()=>TV,CommandEmpty:()=>OV,CommandGroup:()=>kV,CommandInput:()=>EV,CommandItem:()=>AV,CommandList:()=>DV,CommandMenuCommandSchema:()=>nu,CommandMenuDisplayPolicy:()=>pd,CommandMenuPaletteGroupKind:()=>u2,CommandMenuSearchResourceSchema:()=>Ire,CommandSeparator:()=>MV,CommandShortcut:()=>jV,ComponentNotInjected:()=>ol,ComponentRegistryKeyBuilder:()=>mie,ComponentRegistryService:()=>Xo,ComponentsViewportProvider:()=>Yg,ComposedChildrenRegistryProvider:()=>oY,CompositeLayout:()=>QU,CompositeView:()=>GU,CompositeViewDefinitionBaseSchema:()=>zoe,CompositeViewDefinitionSchema:()=>ip,CompositeViewProvider:()=>HU,CompositeView_BaseFieldsSchema:()=>Ioe,ConnectionStatusNotifier:()=>c$,ConsentBasedProviderActivationsContext:()=>xx,ConsentBasedProviderSdksProvider:()=>Sx,ConsentGateStatus:()=>Gb,ConsoleAnalyticsProvider:()=>l$,ContentAreaRenderBranch:()=>K0,ContentSection:()=>CT,ContentSectionContainer:()=>WO,ContentSectionGroup:()=>wT,ContentSectionLegend:()=>TT,ContextLoadingIdentifier:()=>nl,ContextMenu:()=>sOe,ContextMenuCheckboxItem:()=>dOe,ContextMenuContent:()=>t5,ContextMenuGroup:()=>lOe,ContextMenuItem:()=>uOe,ContextMenuLabel:()=>mOe,ContextMenuRadioGroup:()=>fOe,ContextMenuRadioItem:()=>pOe,ContextMenuSeparator:()=>hOe,ContextMenuShortcut:()=>gOe,ContextMenuSub:()=>_Oe,ContextMenuSubContent:()=>n5,ContextMenuSubTrigger:()=>vOe,ContextMenuTrigger:()=>cOe,ControlPanelControlType:()=>l2,ControlPanelItemSchema:()=>lie,ConversationThreadEntryKind:()=>aQ,ConversationTurnState:()=>oQ,CoreIconRegistry:()=>bf,CrossFrontendHandoffClientError:()=>G3,CustomComponentItemRefSchema:()=>ere,DEFAULT_ACTION_DISCLOSURE:()=>qie,DEFAULT_BUTTON_COMPONENT_REQUIREMENT:()=>Xf,DEFAULT_CHART_STYLE_PRESET:()=>gg,DEFAULT_ICON_CONFIG:()=>Lf,DEFAULT_INSERTED_VIEW_LAUNCHER:()=>Qae,DEFAULT_MATERIAL_RUNTIME_POLICY:()=>Kg,DEFAULT_MAX_EMBEDDED_RESOURCE_DEPTH:()=>3,DEFAULT_SUMMARY_CHROME_MODE:()=>hG,DEFAULT_VALIDATION_MODE:()=>ET,DUPLICATE_KEY_ERROR_TYPE:()=>iT,DangerZone:()=>xY,DatePicker:()=>nN,DateRangePicker:()=>pN,DateTimePicker:()=>aN,DateTimeRangePicker:()=>gN,DecisionApprovalSeal:()=>iM,DecisionInboxCapability:()=>Rv,DefaultHotkeyHandler:()=>I$,DescriptionDetails:()=>V1,DescriptionList:()=>z1,DescriptionTerm:()=>B1,DeviceInfoSchema:()=>Tce,DeviceType:()=>Ny,Dialog:()=>nG,DialogClose:()=>aG,DialogContent:()=>iG,DialogDescription:()=>lG,DialogFooter:()=>sG,DialogHeader:()=>oG,DialogTitle:()=>cG,DialogTrigger:()=>rG,DiffLineKind:()=>S5,DirectoryProvisioningCapability:()=>gv,DisabledActionHandling:()=>Zi,DiscriminatorSwitch:()=>NR,DisplayChromeContext:()=>ak,DisplayChromeProvider:()=>ok,DisplayContextKind:()=>PA,DisplayContextKindProvider:()=>IA,DisplayDiscriminatorSwitch:()=>PR,DisplayField:()=>SR,DisplayFieldAddress:()=>Kj,DisplayFieldArray:()=>A8,DisplayFieldBigDecimal:()=>qj,DisplayFieldBoolean:()=>Rj,DisplayFieldChrome:()=>cj,DisplayFieldCode:()=>Jj,DisplayFieldDate:()=>cM,DisplayFieldDateTime:()=>lM,DisplayFieldDuration:()=>Wj,DisplayFieldEditable:()=>aR,DisplayFieldEnum:()=>Hj,DisplayFieldErrorBoundary:()=>CR,DisplayFieldFile:()=>aM,DisplayFieldFileAudio:()=>w8,DisplayFieldFileDocument:()=>T8,DisplayFieldFileGallery:()=>E8,DisplayFieldFileImage:()=>S8,DisplayFieldFileVideo:()=>C8,DisplayFieldJson:()=>Xj,DisplayFieldMoney:()=>Uj,DisplayFieldNumber:()=>Vj,DisplayFieldPhone:()=>Gj,DisplayFieldRangeBigDecimal:()=>oM,DisplayFieldRangeDate:()=>fM,DisplayFieldRangeDateTime:()=>pM,DisplayFieldRangeMoney:()=>sM,DisplayFieldRangeNumber:()=>dM,DisplayFieldRangeTime:()=>mM,DisplayFieldReadOnly:()=>SM,DisplayFieldString:()=>Bj,DisplayFieldTime:()=>uM,DisplayLayout:()=>hA,DisplayTemplateProvider:()=>nk,DisplayValueDispatcher:()=>xM,Divider:()=>_De,DocumentAcceptanceGateStatus:()=>RH,Drawer:()=>c1,DrawerClose:()=>d1,DrawerContent:()=>u1,DrawerDescription:()=>h1,DrawerFooter:()=>p1,DrawerHeader:()=>f1,DrawerTitle:()=>m1,DrawerTrigger:()=>l1,DropdownMenu:()=>i5,DropdownMenuCheckboxItem:()=>bOe,DropdownMenuContent:()=>o5,DropdownMenuGroup:()=>yOe,DropdownMenuItem:()=>s5,DropdownMenuLabel:()=>c5,DropdownMenuRadioGroup:()=>xOe,DropdownMenuRadioItem:()=>SOe,DropdownMenuSeparator:()=>l5,DropdownMenuShortcut:()=>COe,DropdownMenuSub:()=>u5,DropdownMenuSubContent:()=>f5,DropdownMenuSubTrigger:()=>d5,DropdownMenuTrigger:()=>a5,Duration:()=>b8,EMPTY_AUTH_STATE:()=>ese,ENGINE_DEFAULT_HOTKEY_EMIT_SHORTCUTS:()=>F$,ENGINE_PAGE_METADATA:()=>Oo,ENGINE_SETTINGS_DESTINATIONS:()=>Cv,ERROR_DEDUPLICATION_WINDOW_MS:()=>Eee,ERROR_MAX_DUPLICATES:()=>3,EXECUTION_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Joe,EmbedChart:()=>d9,EmbedComposite:()=>vje,EmbedExecution:()=>yje,EmbedExecutionDecisions:()=>y9,EmbedHostChart:()=>Tje,EmbedHostExecution:()=>Dje,EmbedHostResourceOperation:()=>bje,EmbedLinkedConversations:()=>xje,EmbedOnboarding:()=>_je,EmbedRelatedChart:()=>Eje,EmbedRelatedExecution:()=>Oje,EmbedRelatedResourceList:()=>v9,EmbedRelatedResourceOperation:()=>_9,EmbedRelatedResourceSearch:()=>wje,EmbedRepresentationMailboxes:()=>w9,EmbedRepresentationTeam:()=>C9,EmbedResourceOperation:()=>g9,EmbedResourceOwnedChartView:()=>nye,EmbedResourceOwnedCompositeView:()=>tX,EmbedResourceOwnedExecutionView:()=>rye,EmbeddedResourceDescentBoundary:()=>iY,EmbeddedResourceHostProvider:()=>RU,EmbeddedSigningFrame:()=>uje,EmphasisedActionLabelsProvider:()=>YS,EmptyState:()=>fm,EmptyValueMark:()=>Fj,EngineNavigationEntry:()=>sm,EnginePageItemRefSchema:()=>Hre,EnginePageRef:()=>Ul,EnginePageRefSchema:()=>_ne,EnvVariableLoaderFrontendService:()=>Hte,EphemeralSessionTokenStorage:()=>rm,ErrorBoundary:()=>Vy,ErrorBuilderFrontend:()=>Ae,ErrorContext:()=>Wu,ErrorDisplay:()=>Ly,ErrorManagementService:()=>ra,ErrorPageActionSchema:()=>Coe,ErrorPageActionType:()=>hm,ErrorPageConfigDefinitionSchema:()=>Zoe,ErrorPageConfigSchema:()=>Doe,ErrorPageFeatureGuideItemSchema:()=>Voe,ErrorPageLeadMagnetType:()=>$oe,ErrorPageSupportAccessSchema:()=>koe,ErrorPageSupportType:()=>joe,ErrorProvider:()=>Ui,EventBusContext:()=>ia,EventBusProvider:()=>ft,ExecutionAnchorSource:()=>Zv,ExecutionConcreteOperationIdentitySchema:()=>Woe,ExecutionDirtyMarkerScope:()=>ey,ExecutionDirtyMarkerScopeContext:()=>Ty,ExecutionDirtyMarkerScopeProvider:()=>Ey,ExecutionFailedActionScope:()=>iy,ExecutionNavigationHandlingMode:()=>om,ExecutionNavigationPolicyDefinitionSchema:()=>Poe,ExecutionNavigationPolicyExceptionRuleSchema:()=>Soe,ExecutionParticipationDefinitionSchema:()=>nse,ExecutionParticipationPrefetchIntent:()=>Qv,ExecutionParticipationSource:()=>Mm,ExecutionRuntimeContext:()=>oy,ExecutionRuntimeProvider:()=>cy,ExecutionSurfaceInOperationSchema:()=>Eoe,ExecutionUsageReadState:()=>G6,ExecutionView:()=>QY,ExecutionViewAnchorBindingSource:()=>Am,ExecutionViewAnchorDefinitionSchema:()=>uoe,ExecutionViewDefinitionSchema:()=>Gae,FILE_VALIDATION_ERROR_TYPE:()=>sI,FLOWS_ACTORS_RELATION_VOCABULARY:()=>If,FLOWS_ACTORS_STATUS_VOCABULARY:()=>Af,FLOW_STEP_CATEGORY_ICONS:()=>Zf,FLOW_TRIGGER_TYPE_LABEL_KEYS:()=>Zd,FOCUS_INDICATOR_CLASSES:()=>mg,FORM_ERROR_SUMMARY_ATTRIBUTE:()=>GD,FORM_LEVEL_ERROR_PATH:()=>rT,FRONTEND_DECLARED_SCHEMA_KEY:()=>Oe,FRONTEND_PRODUCED_BADGE_SCOPE_ID:()=>r6,FRONTEND_SCHEMA_KEY:()=>Fu,FeatureGate:()=>T0,FeatureLimitIndicator:()=>Z3,FeatureLockBadge:()=>oEe,FeatureRouteGuard:()=>Wh,FeatureUnavailableDialog:()=>aEe,FeatureUnavailablePrompt:()=>Lh,FeaturesContext:()=>gh,FeaturesProvider:()=>tg,Field:()=>ax,FieldContent:()=>cx,FieldControlAriaProvider:()=>VM,FieldDescription:()=>lx,FieldError:()=>ux,FieldLabel:()=>ox,FieldScopeProvider:()=>TD,FieldSeparator:()=>ble,FieldTiles:()=>wA,FieldTitle:()=>sx,FieldValueMembersChromeBoundary:()=>ck,FieldVariants_Orientation:()=>ix,FileApprovalSeal:()=>rM,FileUpload:()=>P8,FilesPage_UploadGrant:()=>AZ,Files_UploadGrantDrop:()=>kZ,FlowStepCategory:()=>Pae,FlowsActorsContext:()=>CW,FlowsActorsExecutionStatus:()=>yW,FlowsActorsProvider:()=>wW,FlowsActorsUIUtils:()=>Kd,FlowsActorsView:()=>PQ,FlowsActorsViewDefinitionSchema:()=>qae,FlowsActors_AgentCard:()=>nDe,FlowsActors_AgentList:()=>tDe,FlowsActors_ApprovalQueue:()=>YW,FlowsActors_ApprovalRequest:()=>zW,FlowsActors_ArtifactItem:()=>YEe,FlowsActors_ArtifactList:()=>JEe,FlowsActors_ExecutionUsage:()=>Y6,FlowsActors_ExecutionUsageSummary:()=>Z6,FocusIndicatorShape:()=>r_,Form:()=>AT,FormChromeContext:()=>Jw,FormChromeProvider:()=>Yw,FormContextUtils:()=>ID,FormControl:()=>uDe,FormDescription:()=>dDe,FormErrorSummary:()=>ZD,FormErrorSummarySlot:()=>tO,FormField:()=>$L,FormFieldAddress:()=>dL,FormFieldAddress_Preset_Default:()=>uL,FormFieldArray:()=>k8,FormFieldBigDecimal:()=>mL,FormFieldBigDecimal_Preset_Default:()=>pL,FormFieldBoolean:()=>jI,FormFieldBoolean_Preset_Default:()=>AI,FormFieldCheckboxGroup:()=>iI,FormFieldChrome:()=>JM,FormFieldCode:()=>hL,FormFieldComposite:()=>CN,FormFieldContext:()=>L8,FormFieldDate:()=>iN,FormFieldDateTime:()=>sN,FormFieldDateTime_Preset_Default:()=>oN,FormFieldDate_Preset_Default:()=>rN,FormFieldDuration:()=>$I,FormFieldDuration_Preset_Default:()=>QI,FormFieldEnum:()=>oI,FormFieldEnum_Preset_Default:()=>aI,FormFieldFile:()=>GL,FormFieldFile_Preset_Default:()=>WL,FormFieldLegendVoice:()=>SD,FormFieldMoney:()=>ZI,FormFieldMoney_Preset_Default:()=>XI,FormFieldNumber:()=>JI,FormFieldNumber_Preset_Default:()=>qI,FormFieldPhone:()=>oL,FormFieldPhone_Preset_Default:()=>aL,FormFieldPrimitive:()=>pDe,FormFieldRangeBigDecimal:()=>_L,FormFieldRangeBigDecimal_Preset_Default:()=>gL,FormFieldRangeDate:()=>hN,FormFieldRangeDateTime:()=>vN,FormFieldRangeDateTime_Preset_Default:()=>_N,FormFieldRangeDate_Preset_Default:()=>mN,FormFieldRangeMoney:()=>yL,FormFieldRangeMoney_Preset_Default:()=>vL,FormFieldRangeNumber:()=>fN,FormFieldRangeNumber_Preset_Default:()=>dN,FormFieldRangeTime:()=>xN,FormFieldRangeTime_Preset_Default:()=>bN,FormFieldString:()=>KI,FormFieldString_Preset_Default:()=>GI,FormFieldTime:()=>uN,FormFieldTime_Preset_Default:()=>lN,FormItem:()=>cDe,FormItemContext:()=>R8,FormLabel:()=>lDe,FormLayout:()=>nA,FormMessage:()=>fDe,FormRoot:()=>sDe,FormSchemaContext:()=>$w,FormSchemaKind:()=>Zw,FormSchemaProvider:()=>eT,FormTemplateProvider:()=>MT,FrontEndEvent_BasicUser_Schema:()=>cae,FrontendEventBadgeCountChangedSchema:()=>de,FrontendEventBulkJobProgressSchema:()=>wte,FrontendEventCategory:()=>rn,FrontendEventCategoryMap:()=>mte,FrontendEventCustomSchema:()=>Pte,FrontendEventErrorOccuredSchema:()=>Vt,FrontendEventLoadingResourceSchema:()=>$n,FrontendEventNoDataSchema:()=>oie,FrontendEventNotifyCustomSchema:()=>zn,FrontendEventOrgBillingStatusChangedSchema:()=>Vte,FrontendEventOrgStatusChangedSchema:()=>Ra,FrontendEventOrganizationBrandingChangedSchema:()=>Gte,FrontendEventOwnPreferencesRereadSettledSchema:()=>zee,FrontendEventOwnPreferencesRereadStartedSchema:()=>d,FrontendEventResourceCustomSchema:()=>qne,FrontendEventResourceEditingSchema:()=>Cie,FrontendEventResourceOperationSchema:()=>Rre,FrontendEventSchemas:()=>die,FrontendEventUserLoginSchema:()=>rre,FrontendEventUserLogoutSchema:()=>lne,FrontendEventUserPreferencesChangedSchema:()=>Kre,FrontendEventUserStatusChangedSchema:()=>ql,FrontendEvent_AnalyticsMomentAchievedSchema:()=>Sne,FrontendEvent_AppScopeChangedSchema:()=>Cre,FrontendEvent_GuidanceElementSchema:()=>Nie,FrontendEvent_GuidanceFlowSchema:()=>Fne,FrontendEvent_HotkeyCommandMenuOpenSchema:()=>Cs,FrontendEvent_HotkeyNotificationsOpenSchema:()=>Qre,FrontendEvent_HotkeyQuickSwitcherOpenSchema:()=>Are,FrontendEvent_HotkeyShortcutsHelpSchema:()=>Zne,FrontendEvent_HotkeySidebarToggleSchema:()=>zs,FrontendEvent_LifecycleStageChangedSchema:()=>tne,FrontendEvent_MilestoneAchievedSchema:()=>Hie,FrontendEvent_NavigationClearZoneSchema:()=>rae,FrontendEvent_NavigationCloseSchema:()=>pne,FrontendEvent_NavigationOrganizationFollowedSchema:()=>Jie,FrontendEvent_NavigationPopSchema:()=>Qee,FrontendEvent_NavigationPushSchema:()=>Me,FrontendEvent_NavigationReplaceSchema:()=>Bu,FrontendEvent_NavigationRequestSchema:()=>lte,FrontendEvent_NavigationUrlPathUpdatedSchema:()=>dt,FrontendEvent_NavigationZoneChangedSchema:()=>Je,FrontendEvent_PrimaryScopeChangedSchema:()=>Oee,FrontendEvent_ProgressionUpdatedSchema:()=>Nc,FrontendEvent_ResourceCollectionFiltersChangedSchema:()=>P,FrontendEvents:()=>xc,FrontendInsertedViewHostKind:()=>Vp,FrontendInsertedViewIdentitySchema:()=>Jae,FrontendInsertedViewKind:()=>xp,FrontendResourceOperationAddressingMode:()=>yse,FrontendResourceOperationContextSchema:()=>ste,FrontendResourceOperationPathSchema:()=>c,FrontendResourcePathSchema:()=>Gne,FrontendResource_ParentResourceRequirementSchema:()=>Sie,FrontendView_DefinitionSchema:()=>np,FrontendView_ScopeMode:()=>tm,FullCustomView:()=>iQ,FullCustomViewDefinitionSchema:()=>foe,GENERIC_ERROR_WORDING_BY_ERROR_TYPE:()=>aoe,GRAPH_VIEW_ADMITS_PORT:()=>Fae,GRAPH_VIEW_GATE_PORT:()=>Rae,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:()=>X2,GUIDANCE_FALLBACK:()=>iU,GenericErrorWording:()=>Roe,GlobalErrorHandler:()=>Jy,GoogleFontPresets:()=>hg,GovernedDocumentAcceptanceControl:()=>KZ,GraphCanvasInteraction:()=>Pf,GraphHandleRole:()=>Mf,GraphLegendMark:()=>Vf,GraphNodeSide:()=>zf,GraphViewEdgeKind:()=>ep,GraphViewLayoutDirection:()=>Vae,GraphViewNodeKind:()=>Nae,GraphViewerPresentation:()=>mf,Group:()=>A9,GroupedSectionBody:()=>Xk,GuidanceAnnouncement:()=>G2,GuidanceBadge:()=>K2,GuidanceBanner:()=>W2,GuidanceCard:()=>q2,GuidanceChecklist:()=>z2,GuidanceChecklistItem:()=>B2,GuidanceContext:()=>ZH,GuidanceContextProvider:()=>bU,GuidanceModal:()=>U2,GuidanceRenderer:()=>n4,GuidanceSurvey:()=>J2,GuidanceTooltip:()=>H2,GuidanceTour:()=>V2,HOTKEY_DEFAULT_PRIORITY:()=>0,HOTKEY_FRAMEWORK_DEFAULT_PRIORITY:()=>S$,HOTKEY_SCOPE_SPECIFICITY:()=>C$,HTTP_ERROR_BEHAVIOR_MATRIX:()=>Ge,HeaderIconPlacement:()=>ct,Heading:()=>SY,HomeDefinitionSchema:()=>qoe,HostFormActionsFooter:()=>sE,HostedComponentInteractionsProvider:()=>R2,HostedTriggerAppearance:()=>xre,HotkeyBindingSchema:()=>kie,HotkeyDispatchableEvent:()=>ge,HotkeyEmitShortcutSchema:()=>Ote,HotkeyGroup:()=>ln,HotkeyRegistryContext:()=>D$,HotkeyRegistryProvider:()=>k$,HotkeyScope:()=>pa,HotkeyShortcutsHelpDialog:()=>B$,HoverCard:()=>m5,HoverCardContent:()=>g5,HoverCardTrigger:()=>h5,HumanDecisionForm:()=>n8,I18nContext:()=>Ic,I18nProvider:()=>uu,ICON_SIZE_MAP:()=>ga,INDICATOR_BADGE_VARIANT:()=>Jg,IconCategory:()=>Qt,IconCategorySchema:()=>fte,IconPropsSchema:()=>jte,IconRegistryBridge:()=>ZQ,IconRegistryContext:()=>Kf,IconRegistryProvider:()=>_f,IconRequestSchema:()=>Lt,IconSize:()=>Jn,IconSizeSchema:()=>rie,Identifier:()=>y8,ImageCrop:()=>TL,InMemoryFrontendProviderRegistryFrontendService:()=>Ib,InitializationStatusSchema:()=>$e,InlineEditMutationError:()=>fj,InlineEditState:()=>OT,InlineEditText:()=>N8,Input:()=>eN,InputGroup:()=>eL,InputGroupAddon:()=>tL,InputGroupButton:()=>nL,InputGroupInput:()=>rL,InputGroupText:()=>che,InputGroupTextarea:()=>iL,InputOTP:()=>BI,InputOTPGroup:()=>VI,InputOTPSeparator:()=>ehe,InputOTPSlot:()=>HI,InputRoot:()=>tN,InsertedChartDeclarationSchema:()=>Xae,InsertedViewInputBindingSchema:()=>Yoe,InsertedViewInputBindingSource:()=>$ae,InsertedViewLauncherConfigSchema:()=>roe,InsertedViewLauncherPlacement:()=>Ip,InsertedViewRenderSlot:()=>nX,InvoiceHistory:()=>R1,Kbd:()=>L$,LIFECYCLE_DEFAULTS:()=>rU,LOCAL_STORAGE_KEYS:()=>ws,Label:()=>BX,LauncherItemRefSchema:()=>Ane,LauncherItemTargetKind:()=>gs,LauncherItemTargetKindSchema:()=>Yre,LauncherRuntimeAvailabilityConfigSchema:()=>Ere,LauncherVerificationErrorCode:()=>jv,LauncherVerificationSeverity:()=>Av,LayoutDivider:()=>Rje,LazyDoorErrorBoundary:()=>RJ,LazyDoorUnavailableFrame:()=>zJ,Link:()=>gX,LinkVariants_Underline:()=>mX,LinkVariants_Variant:()=>pX,LinkVariants_Weight:()=>hX,LoadingBarrier:()=>Uce,LoadingContext:()=>$m,LoadingGate:()=>eb,LoadingOverlay:()=>Qy,LoadingPhase:()=>zl,LoadingProvider:()=>Vm,LoadingSpinner:()=>Zy,LoadingTier:()=>cc,LoadingTreatment:()=>Ao,LoggerFrontendService:()=>il,MOBILE_DETAIL_MAX_PRIMARY_ACTIONS:()=>1,MOBILE_SUMMARY_MAX_PRIMARY_ACTIONS:()=>0,MainContextInitComponents:()=>Fe,MarkdownEditor:()=>FI,MaterialRefractiveBudgetManager:()=>t_,MaterialRuntimeGroup:()=>zg,MaterialRuntimePolicyProvider:()=>Bg,MenuBarDisplayPolicy:()=>Uoe,Menubar:()=>vDe,MenubarCheckboxItem:()=>SDe,MenubarContent:()=>q8,MenubarGroup:()=>bDe,MenubarHostedComponentSchema:()=>Js,MenubarItem:()=>xDe,MenubarLabel:()=>TDe,MenubarLauncherItemSchema:()=>Ms,MenubarMenu:()=>yDe,MenubarRadioGroup:()=>CDe,MenubarRadioItem:()=>wDe,MenubarSeparator:()=>EDe,MenubarShortcut:()=>DDe,MenubarSub:()=>ODe,MenubarSubContent:()=>J8,MenubarSubTrigger:()=>kDe,MenubarTrigger:()=>K8,MilestoneStatus:()=>TU,MissingRMMRuntimeError:()=>Qn,ModifierKey:()=>b$,NAVIGATION_STRUCTURAL_ZONES:()=>dd,NON_CANONICAL_SHELL_SURFACE_POLICY_OVERRIDE:()=>GE,NOTIFICATION_DISPLAY_POLICY:()=>vse,NOTIFICATION_SOURCE_OVERRIDES:()=>Hh,NavigationBackHost:()=>xB,NavigationContentAreas:()=>n2,NavigationContentRenderer:()=>I0,NavigationContentSchema:()=>pe,NavigationContentType:()=>va,NavigationContext:()=>hh,NavigationInitiatorContextSchema:()=>on,NavigationItemBadge:()=>W8,NavigationItemType:()=>da,NavigationMenu:()=>ADe,NavigationMenuContent:()=>NDe,NavigationMenuIndicator:()=>IDe,NavigationMenuItem:()=>MDe,NavigationMenuLink:()=>FDe,NavigationMenuList:()=>jDe,NavigationMenuTrigger:()=>PDe,NavigationMenuViewport:()=>LDe,NavigationOperationOverrideSchema:()=>hre,NavigationOverlays:()=>r2,NavigationPlacementAdjustment:()=>Ea,NavigationProvider:()=>th,NavigationSource:()=>Ht,NavigationStackEntrySchema:()=>nr,NavigationTransitionSource:()=>sie,NavigationUtils:()=>Um,NavigationZone:()=>Vn,NavigationZoneSchema:()=>Xa,NetworkOfflineError:()=>Wn,NetworkOfflineReason:()=>nie,NotificationBadgeMemoryBoundary:()=>r$,NotificationContext:()=>uh,NotificationIndicator:()=>v8,NotificationProvider:()=>Wm,ObjectScope:()=>MR,OfflineReplayPolicy:()=>jn,OnboardingView:()=>o9,OnboardingViewDefinitionSchema:()=>up,OperationsConfirmCritical:()=>Mw,OverlayContainer:()=>v1,PRIMARY_SCOPE_FIELDS:()=>Ot,PROFESSIONAL_QUALIFICATIONS_DECLARED_CAPABILITY:()=>Sv,PROGRESSION_DEFAULTS:()=>nU,PROVIDER_ADDRESS_LOOKUP_DEBOUNCE_MS:()=>300,PROVIDER_ADDRESS_LOOKUP_MINIMUM_QUERY_LENGTH:()=>3,Pagination:()=>wOe,PaginationContent:()=>TOe,PaginationEllipsis:()=>AOe,PaginationItem:()=>EOe,PaginationLink:()=>DOe,PaginationNext:()=>kOe,PaginationPrevious:()=>OOe,PasskeyAutofillExpiredError:()=>jm,PasskeyAutofillSupersededError:()=>woe,PasskeySignInMediation:()=>km,PasswordInput:()=>RI,PendingDecisionsReadState:()=>fW,PersistentSessionTokenStorage:()=>xoe,PlanChangePreview:()=>F1,Popover:()=>pq,PopoverAnchor:()=>gq,PopoverContent:()=>hq,PopoverTrigger:()=>mq,PortalContainerContext:()=>C2,PricingTable:()=>I1,Progress:()=>v_,ProgressionAchievementBadge:()=>cEe,ProgressionMilestoneTracker:()=>IU,ProviderAddressLookupAttribution:()=>mx,ProviderAddressLookupCombobox:()=>gx,ProviderAddressLookupHost:()=>yx,ProviderAddressLookupNotice:()=>vx,ProviderAddressLookupPlaceWithoutAddressError:()=>px,ProviderAddressLookupRejectionKind:()=>ex,ProviderFilePickerHost:()=>rx,ProviderFileSelectionRejectionKind:()=>Qb,PublicLayoutPreset_AuthCallback_Default:()=>vX,PublicLayoutPreset_ChatIdentityLink_Default:()=>RZ,PublicLayoutPreset_EnrollmentRequired_Default:()=>tZ,PublicLayoutPreset_FileUploadGrant_Default:()=>OZ,PublicLayoutPreset_MagicLinkVerify_Default:()=>SX,PublicLayoutPreset_MfaChallenge_Default:()=>QX,PublicLayoutPreset_OAuthConsent_Default:()=>NZ,PublicLayoutPreset_OAuthLoggedOut_Default:()=>BZ,PublicLayoutPreset_OAuthLogoutConfirm_Default:()=>UZ,PublicLayoutPreset_OneOffSession_Default:()=>CZ,PublicLayoutPreset_OrganizationOnboarding_Default:()=>oZ,PublicLayoutPreset_StaticContentContainer_Default:()=>j3,PublicLayoutPreset_UserAuth_Default:()=>dZ,PublicLayoutPreset_UserConfirmEmail_Default:()=>mZ,PublicLayoutPreset_UserInvitation_Default:()=>xZ,PublicLayoutPreset_UserPasswordLost_Default:()=>jZ,PublicLayoutPreset_UserRegister_Default:()=>YZ,PublicLayout_LegalNotice:()=>QZ,PublicLayout_MainContainer:()=>fX,PublicLayout_StaticContentContainer:()=>HTe,PublicLayout_Terms:()=>ZZ,PublicShellIdentityMode:()=>am,QuickActionButtonPlacement:()=>Xte,QuickActionButtonPlacementSchema:()=>Rie,QuickActionDisplayPolicy:()=>Aa,QuickActionItemSchema:()=>$ie,QuickActionPlacement:()=>Noe,QuickSwitcherFieldControlKind:()=>s2,QuickSwitcherFieldPresentation:()=>Yp,QuickSwitcherPlacement:()=>tse,QuickSwitcherScopeFieldSchema:()=>ose,READ_RETRY_FIRST_DELAY_MS:()=>ZJ,READ_RETRY_MAX_DELAY_MS:()=>QJ,REGIONAL_PREFERENCE_FRAMEWORK_FLOOR:()=>ks,RETRYABLE_CLIENT_ERROR_STATUSES:()=>bc,REVEAL_FIELD_EVENT:()=>LD,RUNTIME_SCOPED_STORAGE_KEYS:()=>$re,RadioGroup:()=>wF,RadioGroupItem:()=>EF,RadioGroupRoot:()=>TF,RangeSlider:()=>QM,RecordApprovalSeal:()=>_fe,RecordFactRole:()=>DA,RecordKeepingFacts:()=>EA,RecordState:()=>TA,RegionalReaderStanding:()=>Jte,RegionalReaderStandingPublisherContext:()=>Tne,RegistrationOutcome:()=>Pp,RelatedResourcePreview:()=>hje,RelatedResourcePreviewSurface:()=>a9,RelatedResourceSections:()=>E9,RelationshipShapeCapability:()=>mv,RelationshipSideCapability:()=>dv,ResizableHandle:()=>Q$,ResizablePanel:()=>Z$,ResizablePanelGroup:()=>X$,ResolvedInsertedChartDescriptorSchema:()=>hoe,ResolvedInsertedViewDescriptorSchema:()=>yoe,ResourceAutomatedForm:()=>vB,ResourceAutomaticDisplayer:()=>eY,ResourceCollectionQuickFilterTabs:()=>dq,ResourceDisplayContext:()=>uj,ResourceEmptyState:()=>lK,ResourceFieldDisplay_ResourceReference:()=>zj,ResourceFieldEdit_ResourceReference:()=>bI,ResourceFormActionsProvider:()=>aE,ResourceFrontend_EmptyStateSecondaryActionType:()=>k,ResourceFrontend_GuidanceFlowTriggerType:()=>ure,ResourceHeaderContextProvider:()=>HB,ResourceHeaderLeading:()=>JB,ResourceHeaderTitle:()=>qB,ResourceHeaderTitleHeading:()=>WB,ResourceHeaderTitlePlaceholder:()=>GB,ResourceLayoutInlineEditDefault:()=>wr,ResourceLayoutPreset_Action_Default:()=>$W,ResourceLayoutPreset_Breadcrumb_Default:()=>PB,ResourceLayoutPreset_ContainerDialogs_Default:()=>D3,ResourceLayoutPreset_ContainerNested_Default:()=>_Y,ResourceLayoutPreset_Create_Default:()=>dG,ResourceLayoutPreset_Create_SamlWizard:()=>t9,ResourceLayoutPreset_DangerZone_Default:()=>wY,ResourceLayoutPreset_Filters_Default:()=>O3,ResourceLayoutPreset_Header_Default:()=>lV,ResourceLayoutPreset_List_Default:()=>lX,ResourceLayoutPreset_OperationsBulk_Default:()=>FJ,ResourceLayoutPreset_OperationsItems_Default:()=>yY,ResourceLayoutPreset_Pagination_Default:()=>iK,ResourceLayoutPreset_ReadSummary_Default:()=>A3,ResourceLayoutPreset_Read_Default:()=>FY,ResourceLayoutPreset_Read_Expandable:()=>k3,ResourceLayoutPreset_Read_SsoSaml:()=>n9,ResourceLayoutPreset_RecordSharing_Default:()=>jY,ResourceLayoutPreset_Search_Default:()=>zY,ResourceLayoutPreset_Update_Default:()=>VY,ResourceLayout_Action:()=>eG,ResourceLayout_Breadcrumb:()=>IB,ResourceLayout_ContainerDialogs:()=>ITe,ResourceLayout_ContainerNested:()=>vY,ResourceLayout_Create:()=>fG,ResourceLayout_DangerZone:()=>TY,ResourceLayout_Filters:()=>LTe,ResourceLayout_Header:()=>uV,ResourceLayout_InsertedViews:()=>iX,ResourceLayout_List:()=>uX,ResourceLayout_OperationBulk:()=>IJ,ResourceLayout_OperationsItems:()=>bY,ResourceLayout_Pagination:()=>aK,ResourceLayout_Read:()=>LY,ResourceLayout_ReadSummary:()=>zTe,ResourceLayout_RecordSharing:()=>MY,ResourceLayout_Search:()=>BY,ResourceLayout_Update:()=>HY,ResourceOperationActionPresentation:()=>Fr,ResourceOperationActionScope:()=>Mee,ResourceOperationFrontendConfigSchema:()=>Ct,ResourceOperationItemRefSchema:()=>Ho,ResourceRegistryContext:()=>cm,ResourceRegistryProvider:()=>Zp,ResourceSummaryDisplayer:()=>vG,ResourceViewItemRefSchema:()=>Gie,ResourcesRepositoryFrontendService:()=>NS,RouterErrorBoundary:()=>Gy,SCAFFOLD_SETTINGS_HUB_CONFIG:()=>Bse,SCAFFOLD_SETTINGS_RAIL_GROUPS:()=>wv,SCOPE_PARAM_PREFIX:()=>Tn,SERVER_ERROR_TYPE:()=>tT,SESSION_STORAGE_KEYS:()=>jre,SETTINGS_HUB_TITLE_LABEL_KEY:()=>Qm,SHELL_ANCHORED_POPUP_ORIGINS:()=>G4,SHELL_CENTRED_POPUP_SLOTS:()=>uTe,SHELL_GHOST_ATTRIBUTE:()=>M4,SHELL_GHOST_LAYER_ATTRIBUTE:()=>j4,SHELL_MODAL_POPUP_SLOTS:()=>K4,SHELL_OBJECT_ATTRIBUTE:()=>A4,SHELL_PANE_SELECTOR:()=>R4,SHELL_PICTURE_STRIPPED_ATTRIBUTES:()=>N4,SHELL_POPUP_OPEN_STATES:()=>q4,SHELL_PRESS_ORIGIN_MAX_AGE_MS:()=>800,SHELL_PROXY_ATTRIBUTE:()=>k4,SHELL_PROXY_FLIGHT_SHARE:()=>O4,STATUS_BAR_PLACEMENTS:()=>qt,SameSite:()=>Py,ScopeChangeInitiator:()=>pr,ScopeUtilsService:()=>nm,ScopedNavigationControllerContext:()=>bS,ScrollArea:()=>of,ScrollAreaType:()=>af,ScrollBar:()=>sf,Section:()=>Yk,SectionLegendVoiceHost:()=>xD,SectionSaveButton:()=>Qk,SectionStageBindingError:()=>PO,SectionStageState:()=>NO,Select:()=>_F,SelectContent:()=>bF,SelectGroup:()=>mme,SelectItem:()=>SF,SelectLabel:()=>hme,SelectMultiple:()=>LF,SelectPosition:()=>hF,SelectRoot:()=>vF,SelectScrollDownButton:()=>vme,SelectScrollUpButton:()=>_me,SelectSeparator:()=>gme,SelectTrigger:()=>yF,SelectValue:()=>xF,Separator:()=>w1,SessionEndReason:()=>Er,SessionEstablishment:()=>Rr,SettingsHubVerificationErrorCode:()=>Hv,SettingsHubVerificationSeverity:()=>Vv,SettingsPanelRef:()=>uv,SettingsSectionItemRefSchema:()=>qi,SettingsSectionTargetKind:()=>lv,Sheet:()=>e1,SheetClose:()=>ASe,SheetContent:()=>n1,SheetDescription:()=>o1,SheetFooter:()=>i1,SheetHeader:()=>r1,SheetTitle:()=>a1,SheetTrigger:()=>t1,ShellDialogArrival:()=>D4,ShellGhostKind:()=>P4,ShellGhostLayer:()=>F4,ShellGhostPose:()=>C4,ShellIdentitySchema:()=>Toe,ShellLayoutFamily:()=>h4,ShellLayoutPlacementKind:()=>m4,ShellMotionDip:()=>w4,ShellPaneArrival:()=>T4,ShellPaneResize:()=>E4,ShellPlaceChange:()=>S4,ShellPopupSlot:()=>W4,Sidebar:()=>RDe,SidebarCollapsible:()=>Z8,SidebarContent:()=>zDe,SidebarFooter:()=>BDe,SidebarGroup:()=>VDe,SidebarGroupAction:()=>HDe,SidebarGroupContent:()=>UDe,SidebarGroupLabel:()=>WDe,SidebarHeader:()=>GDe,SidebarHomeDisplayMode:()=>Se,SidebarHostedComponentSchema:()=>ju,SidebarInput:()=>KDe,SidebarInset:()=>qDe,SidebarItemDisplayPolicy:()=>ar,SidebarItemSchema:()=>ite,SidebarMenu:()=>JDe,SidebarMenuAction:()=>YDe,SidebarMenuBadge:()=>XDe,SidebarMenuButton:()=>ZDe,SidebarMenuButtonVariant:()=>Q8,SidebarMenuItem:()=>QDe,SidebarMenuSkeleton:()=>$De,SidebarMenuSub:()=>eOe,SidebarMenuSubButton:()=>tOe,SidebarMenuSubItem:()=>nOe,SidebarProvider:()=>rOe,SidebarRail:()=>iOe,SidebarResourceBrowser:()=>$7,SidebarResponsivePolicy:()=>rt,SidebarResponsivePolicySchema:()=>ze,SidebarSectionBehavior:()=>qr,SidebarSectionContentKind:()=>kc,SidebarSectionContentKindSchema:()=>T,SidebarSectionInlineCreate:()=>_c,SidebarSectionSchema:()=>uee,SidebarSection_CustomComponentSchema:()=>vee,SidebarSection_GuidanceWidgetSchema:()=>oi,SidebarSection_NavigationListSchema:()=>yt,SidebarSection_ResourceBrowserSchema:()=>gn,SidebarSeparator:()=>aOe,SidebarTrigger:()=>oOe,SidebarVariant:()=>X8,Skeleton:()=>mm,Slider:()=>XM,SliderRoot:()=>ZM,StackedActions:()=>FOe,StackedAside:()=>ROe,StackedBody:()=>LOe,StackedContent:()=>zOe,StackedHeader:()=>MOe,StackedLayout:()=>jOe,StackedSection:()=>BOe,StackedSubtitle:()=>POe,StackedTitle:()=>NOe,StackedToolbar:()=>IOe,StandardIconReference:()=>H,StandardIconReferenceSchema:()=>Bte,StartApplicationFrontendService:()=>KQ,StatusBarDisplayInteractionType:()=>c2,StatusBarItemSchema:()=>ase,StatusBarItemType:()=>Pl,StatusBarPlacementSchema:()=>Un,StepUpAuthContext:()=>TH,StepUpAuthProvider:()=>EH,StepUpRefusalOrigin:()=>oa,Stepper:()=>DO,StepperDescription:()=>MO,StepperIndicator:()=>kO,StepperItem:()=>OO,StepperSeparator:()=>AO,StepperTitle:()=>jO,Strong:()=>d_,Subheading:()=>CY,SubmitButton:()=>rO,SubscriptionStatus:()=>M1,SummaryFlow:()=>kR,SummaryHeader:()=>D9,SummaryLayout:()=>jR,SummaryMeta:()=>yG,SummaryTitle:()=>DR,SummaryTitlePlacement:()=>OR,SummaryTitleScale:()=>ER,Surface:()=>vD,SurfaceAction:()=>_D,SurfaceBody:()=>hD,SurfaceErrorBoundary:()=>VE,SurfaceFooter:()=>gD,SurfaceHeader:()=>mD,SurfacePolicyContext:()=>Ye,SurveyBindingWriteOutcome:()=>pU,Switch:()=>wI,SwitchRoot:()=>TI,TONE_DOT_CLASS:()=>Xd,TONE_INK:()=>Mae,TONE_MARKER_COLOUR:()=>vf,TONE_MARKER_FILL:()=>Wf,Table:()=>gJ,TableBody:()=>vJ,TableCaption:()=>B_e,TableCell:()=>xJ,TableFooter:()=>z_e,TableHead:()=>bJ,TableHeader:()=>_J,TableRow:()=>yJ,Tabs:()=>cO,TabsActivationMode:()=>iO,TabsContent:()=>dO,TabsLevel:()=>aO,TabsLevelContext:()=>oO,TabsList:()=>lO,TabsTrigger:()=>uO,Text:()=>Z,TextDirection:()=>Ed,TextLink:()=>g_,TextSize:()=>gc,TextVariant:()=>br,Textarea:()=>NI,TextareaRoot:()=>PI,TimePicker:()=>cN,TimeRangePicker:()=>yN,Timeline:()=>Bf,TimelineActions:()=>Ef,TimelineBody:()=>df,TimelineEntry:()=>Ff,TimelineMarker:()=>Hf,TimelineTime:()=>hf,Toaster:()=>XQ,Toggle:()=>I8,ToggleGroup:()=>bO,ToggleGroupAppearance:()=>vO,ToggleGroupBoolean:()=>kI,ToggleGroupItem:()=>xO,ToggleGroupType:()=>_O,ToggleVariants_Variant:()=>F8,ToolbarItemRefSchema:()=>ree,ToolbarItemSchema:()=>Wee,Tooltip:()=>tj,TooltipContent:()=>rj,TooltipProvider:()=>ij,TooltipTrigger:()=>nj,TruncatedText:()=>p8,TypographyScope:()=>p_,UIContext:()=>$g,UIProvider:()=>Rg,UNIQUE_ERROR_TYPE:()=>nT,UpdateLikeMutationFallbackMode:()=>kl,UsageDashboard:()=>L1,UserDropdownAvatarDisplay:()=>Lp,UserDropdownSection:()=>cp,UserOrgsContext:()=>ah,UserOrgsProvider:()=>Rm,UtilityPanelItemSchema:()=>oae,ValidationMode:()=>Kn,ViewItemRefSchema:()=>ie,ViewLayout_Header:()=>ZY,ViewNotFound:()=>c_,WINDOW_EVENTS_SLUGS:()=>ve,WebSocketContext:()=>dm,WebSocketEventBridge:()=>a$,WebSocketProvider:()=>Dm,WebSocketResourceValidationService:()=>HJ,WebSocketStatus:()=>em,WildoBackendHttpClient:()=>ba,WildoBackendHttpClient_ManualCalls:()=>Wr,WildoBackendHttpClient_Resources:()=>Ax,WizardLayout:()=>Ije,WizardStep:()=>O9,ZoneContentRenderer:()=>R0,_clearContributedProviderComponentLoaders:()=>_le,actionBarItemCannotRun:()=>GS,actorActivityLabelKey:()=>d6,actorModeDescriptionKey:()=>c6,actorModeLabelKey:()=>s6,actorRoleLabelKey:()=>o6,actorSystemExecutionGraph:()=>nf,addElement:()=>rMe,allocateActionBarSlots:()=>KS,allowsDirectOperationFallback:()=>Rn,appendFileServeVariant:()=>rH,appendNavChildrenToSidebarSection:()=>Q_,applyChartColorPalette:()=>Eg,applyCustomTokens:()=>Gg,applyDesignSystemConfiguration:()=>fg,applyDesignTokens:()=>Wg,applyFrontendConfigOverrides:()=>My,applyTypographyConfiguration:()=>wg,arrangeChartDashboardTiles:()=>I9,assertExecutionDirtyMarkerShape:()=>ty,assertExecutionEmbeddableContent:()=>ry,assertExecutionFailedActionShape:()=>ay,assertExecutionLocalPanePayloadIsNotEmbeddableContent:()=>ny,assertExecutionPendingPrefetchShape:()=>$v,assertExecutionRuntimeContext:()=>sy,assertRegistryCompleteness:()=>qTe,assertSectionStageBinding:()=>FO,attachBackendErrorEnvelope:()=>fee,authFactorLevelForUiLevel:()=>loe,backendNotificationDestination:()=>Sse,backendNotificationI18nParams:()=>wse,badgeVariantIndicator:()=>Qg,brandShellLayoutMainContainer:()=>y4,buildAppLoadingScope:()=>hse,buildApplicationCompositeViewDefinitions:()=>wp,buildApplicationCompositeViewTranslationRef:()=>Dp,buildApplicationViewTranslationRef:()=>Qoe,buildAuthoredIconRegistry:()=>QQ,buildChartRouteUrlPath:()=>Hp,buildCompositeRouteUrlPath:()=>Ap,buildContextLoadingScope:()=>bse,buildExecutionConcreteOperationIdentity:()=>ise,buildExecutionDirtyMarker:()=>wce,buildExecutionFailedAction:()=>fy,buildExecutionRouteUrlPath:()=>Rp,buildFileServeThumbnailUrl:()=>iH,buildFrontendInsertedViewRef:()=>voe,buildFrontendModuleAppComponentsConfiguration:()=>cv,buildFrontendModuleAppScope:()=>ov,buildFrontendModuleConfigOverrides:()=>jy,buildFrontendModuleRegistry:()=>av,buildFrontendModuleSidebarSections:()=>sv,buildLoadingScopeKey:()=>rh,buildOmniboxRecordContextIdentifiers:()=>K7,buildResolvedInsertedChartDescriptor:()=>_p,buildResourceCompositeViewTranslationRef:()=>mp,buildResourceFileServeBaseUrl:()=>nH,buildResourceInsertedChartIdentity:()=>Sp,buildResourceInsertedCompositeIdentity:()=>yp,buildResourceInsertedExecutionIdentity:()=>fp,buildResourceLoadingScope:()=>lg,buildScopeConditionParams:()=>Y3,buildSummaryRecordIdentifiers:()=>gG,calculateGlassBezelResponse:()=>Xg,calculateGlassBoundaryCoverage:()=>qg,calculateGlassEdgeResponse:()=>Hg,calculateGlassRefractionProfile:()=>Vg,calculateRoundedRectangleOutwardNormal:()=>Fg,canExportWithinAllowedMimeTypes:()=>FL,cardsAfterWithdrawal:()=>uW,cascadeShellRows:()=>o3,choreographyGraph:()=>Lae,clampCropOffset:()=>kL,clampStaticSidePanels:()=>J0,classifyRecordFact:()=>MA,classifyRegistrationOutcome:()=>sse,clearAllProviderScopeReauthorizationOffers:()=>y,clearAppliedDesignTokens:()=>Tg,clearProviderScopeReauthorizationOffer:()=>pc,clickDownloadLink:()=>Iy,cn:()=>W,collectBillingProviderLabelKeys:()=>A1,collectErroredFieldPaths:()=>KD,collectExecutionViewSurfaceRefsByOperation:()=>Kae,collectFrontendChartRegistrationRefs:()=>Xoe,collectFrontendChartRegistrationRefsFromUIBehavior:()=>eoe,collectFrontendProviderDisplayLabelKeys:()=>ob,collectOperationLikeViewRefs:()=>soe,collectResourceLabelFieldEntries:()=>ml,combineModuleSidebarSections:()=>J_,composeConsentDecision:()=>qb,composeUiBehaviorPresentation:()=>OS,computeCoverScale:()=>OL,computeCropSourceRect:()=>AL,computePanelSizes:()=>X0,computeRegistryCompleteness:()=>N3,computeSurfacePolicyContextValue:()=>Qr,configureClientInstanceIdPolicy:()=>es,consentWithdrawalCost:()=>Jb,contributeProviderComponentLoaders:()=>Ub,conversationThreadModel:()=>dQ,countDiffLines:()=>T5,createComponentResolver:()=>q,createComponentResolverWithRef:()=>Fl,createCompoundComponentResolver:()=>rc,createCompoundPreset:()=>ine,createDesignSystemConfigurationFromSourceConfig:()=>JTe,createEmojiIcon:()=>jf,createEmptyOnboardingView:()=>nMe,createFrontendInsertedViewIdentity:()=>boe,createFrontendProviderRegistryFrontendService:()=>Lb,createOpenSessionOverlayModeResolver:()=>_1,createPolymorphicFrontendPreset:()=>Sn,createShellLayoutMainContainer:()=>b4,darkModeUtils:()=>Dg,debugSectionVisibility:()=>X3,decisionQuestionOf:()=>KW,decisionStepUpRequestOfRefusal:()=>Nt,defaultChartDashboardTileHeight:()=>R9,defaultOfflineReplayPolicyForMethod:()=>Rte,defaultTheme:()=>kg,defineChartDashboardView:()=>tMe,defineCompositeView:()=>Cp,deriveBreadcrumbAncestors:()=>NB,deriveConsentGateState:()=>Kb,deriveDecisionInboxCapabilities:()=>Bv,deriveDirectoryProvisioningCapabilities:()=>vv,deriveRegionalReaderStanding:()=>Iie,deriveRelationshipShapeCapabilities:()=>hv,deriveRelationshipSideCapabilities:()=>pv,describeDecisionHolder:()=>BW,describeDecisionRequester:()=>HW,describePauseState:()=>IW,describeReasonCodeOptions:()=>FW,deserializeOnboardingView:()=>uMe,determineValidationMode:()=>SL,documentReadKey:()=>GZ,embeddedResourceDescentKey:()=>m9,emptyValueTypographyFor:()=>Lj,envLoader:()=>bi,errorManagement:()=>ut,evaluateGlassSurfaceHeight:()=>n_,executionPlanGraph:()=>tf,exportCroppedImageFile:()=>LL,extractChartRouteContextResourceIdentifiers:()=>Kp,extractChartRouteUrlParamValues:()=>Wp,extractCompositeRouteContextResourceIdentifiers:()=>Fp,extractEphemeralFields:()=>US,extractErrorInfo:()=>M,extractExecutionRouteContextResourceIdentifiers:()=>um,extractPrimaryFontFamily:()=>_g,extractSchemaFieldList:()=>IR,fieldRevealPanelAttributes:()=>UD,fieldsHoldingTheRecordName:()=>NA,fileTypeIsAccepted:()=>DZ,filterVisibleSections:()=>J3,findDuplicateAppScopeResourceTypes:()=>Om,findProviderScopeReauthorizationOffer:()=>gr,findUnknownDestinationRefs:()=>Ov,flowGraph:()=>rf,flowGraphInputOf:()=>Iae,flowGraphNodeId:()=>Bae,flowNodeStatusIndicator:()=>Cf,flowStepCategory:()=>Yf,flowTriggerTypeVisual:()=>$d,flowsActorsStatusColour:()=>xf,flowsActorsStatusDotClass:()=>cf,flowsActorsStatusIsMoving:()=>qf,flyShellProxy:()=>n3,focusIndicatorClasses:()=>Ag,fontConfigToGoogleFontConfig:()=>bg,forgetNotificationBadgeCounts:()=>n$,formatBadgeCount:()=>eo,formatHsvAsCssColor:()=>$Te,formatRgbAsCssColor:()=>U3,generateChartConfig:()=>Cg,generateDefaultDisplayTemplate:()=>GR,generateDefaultFormTemplate:()=>BR,generateDefaultSummaryTemplate:()=>ZR,generateGoogleFontsUrl:()=>Og,generateTokensCSS:()=>o_,getChartColorPaletteFromCSS:()=>pg,getChartColors:()=>Mg,getClientInstanceId:()=>wre,getClientInstanceIdScope:()=>Pie,getCommonEnumDisplayConfig:()=>l_,getCompletionPercentage:()=>oMe,getContentKey:()=>F0,getElementsByType:()=>cMe,getFieldError:()=>lI,getIconAnimation:()=>wf,getLoadingStats:()=>kTe,getLocalStorageItem:()=>tc,getManualCallsHttpClient:()=>Tc,getNotificationDisplayBehavior:()=>gse,getProviderScopeReauthorizationOffers:()=>_ee,getReadinessChecker:()=>Mo,getTailwindColor:()=>yg,getZodErrorCode:()=>bhe,getZodErrorParams:()=>CL,graphViewParentOf:()=>Hae,graphViewerEdgeLabelKey:()=>Of,growShellPane:()=>r3,hasValidAnimationSource:()=>Sf,hslToRgb:()=>V3,hsvToRgb:()=>B3,humanDecisionFormLabels:()=>Q6,humanDecisionQuestionOf:()=>GW,indicatorBadgeVariant:()=>Ug,installShellLayoutStylesheet:()=>Y4,isApiNotReadyError:()=>fl,isBackendRefusal:()=>Ir,isBackendRefusalShownToUser:()=>di,isCollectionScopedOperation:()=>aee,isCroppableRasterImageFile:()=>EL,isCustomComponentNavigationItem:()=>Ba,isDirectlyDisplayableImageUrl:()=>f2,isEmphasisButtonVariant:()=>ef,isEnginePageNavigationItem:()=>qte,isErrorMarkedByHttpClient:()=>dy,isFinalBackendRefusal:()=>Tt,isFrontendOperationAddressableForCurrentContext:()=>Uh,isGlyphKey:()=>w$,isGoogleFont:()=>jg,isHostedInShellChrome:()=>_2,isNamelessDisplayContent:()=>AA,isNetworkOfflineRejection:()=>ja,isOnboardingComplete:()=>sMe,isOperationAddressable:()=>Fi,isOperationHeadless:()=>ld,isRecordSharingOffered:()=>AY,isRequiredFieldError:()=>cI,isResourceNavigationItem:()=>Bee,isResourceReachable:()=>Aoe,isSectionVisible:()=>q3,isSelfReferencingRelatedCollectionTarget:()=>V6,isSettingsHubNavigationItem:()=>m,isShellLayoutMainContainer:()=>_4,isShellSidePane:()=>H4,isShellSideZone:()=>U4,isSidebarConfigObject:()=>i2,isSpentOrganizationOnboardingSession:()=>op,isStandaloneRoutableCompositeView:()=>cse,isStandaloneRoutableExecutionView:()=>ap,isStandaloneRoutableInsertedChartView:()=>Jp,isStandaloneRoutableInsertedCompositeView:()=>Uae,isStandaloneRoutableResolvedCompositeView:()=>Bp,isStatusBarConfigObject:()=>a2,isStatusBarPlacement:()=>Wa,isUnrevokedScimTokenProbeNeeded:()=>_v,isUtilityPanelComponentRegistered:()=>N7,isUtilityPanelConfigObject:()=>o2,isViewNavigationItem:()=>Wne,launcherItemRefKey:()=>Z_,layoutGraphView:()=>Yd,listContributedProviderComponentLoaders:()=>Wb,loadCroppableImage:()=>DL,loadCustomComponents:()=>OTe,loadFontsFromTypography:()=>Ng,loadGoogleFonts:()=>vg,makeComponentLabelResolver:()=>_m,makeShellPicture:()=>_3,mapApplicationLevelToFrontendComponentType:()=>d2,matchesExecutionConcreteOperationIdentity:()=>Loe,matchesShortcut:()=>E$,mergeAppModes:()=>K_,mergeAppScope:()=>G_,mergeCommandMenuCommandLists:()=>$_,mergeDesignSystemConfiguration:()=>Sg,mergeFrontendComponentRegistrations:()=>iv,mergeFrontendDomainModules:()=>Lse,mergeFullCustomViewsByRef:()=>tv,mergeHotkeyEmitShortcuts:()=>M$,mergeMenubarLauncherItems:()=>ev,mergeQuickSwitcherFields:()=>X_,mergeSidebarSections:()=>q_,mergeSurfacePolicy:()=>Pc,noticeOfOutcome:()=>MW,obtainStepUpToken:()=>DH,offsetWithin:()=>p3,olderHistoryCursor:()=>gQ,onboardingObligationsFromSessionState:()=>aZ,operationTargetsCurrentResource:()=>_se,optionalMaxInlineSizeStyle:()=>nD,organizationOnboardingNavigationTarget:()=>zp,parkedOrganizationOnboardingSessionId:()=>Yae,parseChartColorPalette:()=>Zg,parseCssColorToRgb:()=>I3,parseFrontendInsertedViewRef:()=>Mp,parseShortcut:()=>T$,parseUnifiedDiff:()=>w5,pickInlineFieldWriteOperation:()=>mh,pickPreferredOperationForCoreSemanticAddressability:()=>ph,playbookCatalogGraph:()=>Rf,playbookCatalogNodeId:()=>zae,polymorphicResourceUIBehavior:()=>le,polymorphicResourceUIBehaviorFrom:()=>Ste,providerScopeReauthorizationOfferKey:()=>ti,pruneDirtyMarkersForPaneTransition:()=>Ay,pruneDirtyMarkersForScopeChange:()=>ky,pruneFailedActionsForPaneTransition:()=>uy,pruneFailedActionsForPrefetchSettlement:()=>py,pruneFailedActionsForScopeChange:()=>ly,publishNotificationBadgeCount:()=>t$,readAllConversationHistory:()=>_Q,readBrowserRegionalEvidence:()=>Zie,readComputedCssColorViaDom:()=>R3,readDisplayableErrorFacts:()=>rp,readProviderScopeReauthorizationOffer:()=>gt,receiveProviderAddressLookupSelection:()=>tx,receiveProviderFileSelections:()=>$b,recordProviderScopeReauthorizationOffer:()=>dn,registerCommonEnum:()=>h_,registerFrameworkLayouts:()=>GTe,registerFrontendComponentRegistrations:()=>ATe,registerIconAnimation:()=>lf,registerIconAnimations:()=>Jf,registerShellLayout:()=>x4,registerStandardIcon:()=>$f,registerStandardIcons:()=>pf,registryDeclaresSmsNotification:()=>t6,relationshipTargetRef:()=>A6,relativeLuminance:()=>W3,removeElement:()=>iMe,removeLocalStorageItem:()=>Bs,replaceFileExtension:()=>IL,reportLauncherVerificationResults:()=>Lv,reportSettingsHubVerificationResults:()=>Gv,requestCrossFrontendHandoff:()=>K3,requestFieldReveal:()=>BD,resetClientInstanceIdPolicy:()=>Ine,resizeChartDashboardTile:()=>F9,resolveActionDisclosure:()=>nn,resolveActionSurfaceOrganizationId:()=>$V,resolveApplicationLevelNavigationBackZone:()=>SB,resolveAuthoredOperationUnavailableReason:()=>lm,resolveAutomaticRelationshipDisplayShaping:()=>Tj,resolveBillingProviderDisplayName:()=>j1,resolveCommandMenuCommands:()=>Ah,resolveComponentLabel:()=>bp,resolveCompositeViewDefinition:()=>vp,resolveCompositeViewPrimaryScope:()=>moe,resolveContentAreaRenderBranch:()=>q0,resolveContextualDisplayParams:()=>zA,resolveControlPanelItems:()=>Fm,resolveCssColorViaDom:()=>L3,resolveCurrentSectionStage:()=>IO,resolveDrawnActionVariant:()=>qd,resolveEffectiveChromeMode:()=>KM,resolveEffectiveDisplayChromeMode:()=>oj,resolveEnumDisplayConfig:()=>S_,resolveErrorReferenceLabel:()=>ioe,resolveExecutionNavigationHandlingMode:()=>Tp,resolveExecutionViewDefinition:()=>Op,resolveFieldAutosaveTrigger:()=>DE,resolveFieldControlVariant:()=>Pg,resolveFrontendProviderDisplayLabel:()=>sb,resolveFrontendResourceOperationAddressability:()=>Tse,resolveGuidanceElementRenderer:()=>Z2,resolveHostedComponents:()=>g2,resolveHotkeyBindings:()=>Oh,resolveInsertedChartView:()=>Np,resolveInsertedViewLauncherConfig:()=>Nm,resolveItemRef:()=>Jm,resolveLoadingPolicy:()=>Wce,resolveMenubarContent:()=>Xm,resolveMilestoneLabel:()=>mse,resolveOperationFeatureAvailability:()=>qh,resolveOperationIdempotencyHeaders:()=>Dx,resolveOperationRefusalLabel:()=>Ep,resolveOperationRequestTimeout:()=>Ex,resolveOptionalComponentLabel:()=>Gp,resolveOptionalResourceHeaderDescription:()=>Up,resolveQuickActions:()=>eh,resolveQuickSwitcherFieldSchema:()=>k7,resolveRecordOrganizationId:()=>nh,resolveRefusalCodeLabel:()=>kp,resolveRegionalFormatting:()=>Io,resolveRelationshipInlineEditSurface:()=>bj,resolveRelationshipNavigationSurface:()=>wj,resolveRelationshipNestedReadSurface:()=>Sj,resolveRelationshipQuickCreateCreateOperation:()=>hj,resolveRelationshipReadSurface:()=>yj,resolveRelationshipSurfaceRuntime:()=>Ej,resolveRelationshipWriteSurface:()=>vj,resolveResourceHeaderLabel:()=>qp,resolveResourceLabelEnumSchema:()=>Kc,resolveResourceLabelSystemEnumName:()=>Ws,resolveSearchGroupLabel:()=>W7,resolveSectionStageStates:()=>LO,resolveSettingsDestinationCatalog:()=>Ev,resolveSettingsHubConfig:()=>Dv,resolveShellLayoutPlacement:()=>v4,resolveSidebarMobileDrawerMode:()=>S7,resolveSidebarSections:()=>Hm,resolveStatusBarPlacement:()=>y2,resolveSurfaceAutoFieldDensity:()=>JL,resolveSurfaceAutoLabelPlacement:()=>qL,resolveSurfaceFormChromeMode:()=>KL,resolveSurfaceOverlayMode:()=>g1,resolveSurfacePolicyStackingClass:()=>E2,resolveToolbarTools:()=>Km,resolveTranslationKey:()=>jp,resolveUpdateLikeMutationFallbackMode:()=>Ja,resolveUserFacingErrorMessage:()=>pp,resolveUtilityPanelItems:()=>P7,resolveVisibleEntryIndex:()=>Kh,resourceExecutionView:()=>coe,resourceHasFieldWriteRoute:()=>La,resourceUIBehavior:()=>pte,resourceUIBehaviorFrom:()=>Nte,responsiveMaxWidthToCssValue:()=>tD,rgbToHex:()=>H3,rgbToHsv:()=>z3,sampleGlassRefractionProfile:()=>a_,saveBlobAsFile:()=>Fy,scrollAndFocusFirstErroredField:()=>qD,sectionHeadingClassName:()=>CD,selectMaterialCapabilityTier:()=>Lg,serializeOnboardingView:()=>lMe,serializeSurfaceOperation:()=>hp,setLocalStorageItem:()=>wo,settingsHubSectionLabelKey:()=>xse,settingsSectionVisibilityOf:()=>ih,shapeSectionNesting:()=>T7,sharedErrorBuilder:()=>Ru,shellModalOpenClause:()=>dTe,shellPaneRows:()=>a3,shellPaneSelectorForZone:()=>z4,shellPaneZone:()=>B4,shellRegionSelector:()=>I4,shellRowBox:()=>e3,shellStageRects:()=>f3,shouldRequireCurrentContextAddressabilityForOperation:()=>Pm,slideShellPaneHome:()=>i3,splitDividerOrientationToPanelGroupDirection:()=>z0,startApplicationService:()=>JQ,staticZoneDividers:()=>Y0,storedLayoutTilesOf:()=>L9,tellChatSignInCompletionSinks:()=>Bb,toDateOrUndefined:()=>fi,toast:()=>fh,turnStatusFromServer:()=>xW,unresolvedLabel:()=>ps,updateElementStatus:()=>aMe,useActionOperationSurface:()=>Pue,useActivityBarBehavior:()=>f7,useAnalytics:()=>f$,useAnonymousSession:()=>doe,useAppLoading:()=>Yy,useAppMode:()=>Hle,useAppModeSafe:()=>Qx,useAppScope:()=>xm,useAppScopeInternal:()=>Ooe,useAppScopeSafe:()=>Qp,useAppShellFirstReady:()=>s4,useAppShellLayout:()=>b2,useApplication:()=>Eu,useArrayItemAutosaveField:()=>fI,useAuthSession:()=>gm,useBarrierParticipant:()=>Hce,useBilling:()=>Pse,useBillingAction:()=>wh,useBillingSafe:()=>Bh,useBrandIdentity:()=>m2,useBrandPresentation:()=>h2,useChartDashboardLayout:()=>G9,useChartData:()=>m_,useChatSignInCompletion:()=>Vb,useClaimChildComposition:()=>uY,useCommandMenuBehavior:()=>G7,useComponentLoading:()=>Xy,useComposedChildren:()=>Uve,useCompositeResourceOperationContextBuilder:()=>i9,useCompositeViewContext:()=>UU,useConsentBasedProviderActivations:()=>bx,useConsentGateBehavior:()=>IH,useContextualDisplayParams:()=>RA,useControlPanelBehavior:()=>L7,useCreateOperationSurface:()=>jue,useCrossFrontendHandoff:()=>rEe,useDisplayChromeContext:()=>sk,useDisplayContextKind:()=>LA,useDisplayTemplateContext:()=>rk,useDisplayableImageUrl:()=>p2,useDocumentAcceptanceGateBehavior:()=>zH,useEmbeddedResourceContext:()=>U6,useEmbeddedResourceDescent:()=>nY,useEmbeddedResourceHostContext:()=>zU,useEmitLoadingScope:()=>Ym,useEmphasisedActionLabels:()=>XS,useError:()=>tp,useEventBus:()=>qo,useEventEmit:()=>Yie,useEventSubscription:()=>ete,useExecution:()=>_ce,useExecutionDirtyBridge:()=>Dy,useExecutionDirtyMarkerScope:()=>vce,useExecutionParticipationDataPrefetch:()=>Cce,useExecutionParticipationPrefetch:()=>Oy,useFeatureAvailability:()=>w0,useFeatureGate:()=>iEe,useFeatures:()=>yh,useFieldControlAria:()=>HM,useFieldControlLabelId:()=>UM,useFieldRevealRequests:()=>HD,useFieldScope:()=>ED,useFileActivation:()=>x8,useFlowsActors:()=>TW,useFlowsActorsSafe:()=>EW,useFlowsActorsStatusWord:()=>Qf,useFormChromeContext:()=>Xw,useFormField:()=>z8,useFormSchemaContext:()=>PD,useFormTemplateContext:()=>NT,useGlobalNavigationController:()=>xS,useGrantedConsentPurposes:()=>Yb,useGuidance:()=>xU,useHostedComponentInteractions:()=>I2,useHostlessResourceNavigation:()=>CS,useHotkey:()=>qxe,useHotkeyPause:()=>Yxe,useHotkeyRegistry:()=>A$,useHotkeyScope:()=>Xxe,useHotkeys:()=>Jxe,useI18n:()=>J,useIconRegistry:()=>kf,useIsInFramedAncestor:()=>F,useKeepsHiddenPanelsMounted:()=>WD,useLauncherResolutionContext:()=>P$,useLifecycle:()=>SU,useListOperationSurface:()=>Aue,useLoading:()=>Rce,useMaterialRuntime:()=>i_,useMenuBarBehavior:()=>O7,useMenuUserOrgBehavior:()=>X7,useMfaContinuationNavigation:()=>xX,useNavigationBehaviors:()=>d7,useNavigationController:()=>SS,useNavigationState:()=>Mx,useNotification:()=>Im,useNotificationBadges:()=>i$,useNotificationCenterBehavior:()=>z7,useNotificationPreferenceKinds:()=>e6,useOperationEnabled:()=>RS,useOperationFeatureAvailability:()=>Ase,useOperationsEnabled:()=>BS,useOptionalAutosave:()=>TE,useOptionalCompositeResourceContext:()=>H6,useOptionalCompositeViewContext:()=>WU,useOptionalDisplayTemplateContext:()=>ik,useOptionalEmbeddedResourceHostContext:()=>BU,useOptionalFormSchemaContext:()=>FD,useOptionalFormTemplateContext:()=>PT,useOptionalResourceFormActions:()=>oE,useOptionalResourceHeaderContext:()=>UB,useOverlayTitle:()=>J$,usePendingDecisions:()=>pW,usePortalContainer:()=>w2,useProgression:()=>CU,useProviderComponent:()=>Zb,useProviderComponentChoices:()=>Xb,useProviderScopeReauthorizationOffers:()=>sr,usePublicShellLayout:()=>x2,usePublishNotificationBadgeCount:()=>i6,useQuickActionButtonBehavior:()=>q7,useQuickSwitcherBehavior:()=>A7,useReadOperationSurface:()=>kue,useReadPageRecord:()=>PY,useRegisterComposedChild:()=>cY,useReportAutomaticComposition:()=>dY,useResolvedAuthConfig:()=>Jx,useResolvedFieldName:()=>DD,useResourceChartData:()=>zje,useResourceDisplayContext:()=>dj,useResourceEmptyStateOffersPrimaryAction:()=>oK,useResourceOperationActions:()=>eH,useResourceOperationSurface:()=>eC,useResourceReachability:()=>Tm,useResourceRegistry:()=>pm,useResourceRegistrySafe:()=>bm,useResourceRoom:()=>sEe,useResourceSearch:()=>SV,useResourceSelection:()=>tH,useSearchOperationSurface:()=>Nue,useSectionLegendVoice:()=>bD,useServerErrorInjection:()=>ez,useSettingsHubConfig:()=>kv,useShellColumnMotion:()=>x3,useShellDialogArrival:()=>s3,useShellFrontPane:()=>h3,useShellMotion:()=>S3,useShellPaneMotion:()=>b3,useShellPlaceChanges:()=>g3,useShellPressOrigin:()=>t3,useShellStageMeasurement:()=>m3,useSidebarBehavior:()=>w7,useSidebarMobileDrawerMode:()=>C7,useSmsConsentOffered:()=>n6,useStatusBarBehavior:()=>j7,useStepUpAuth:()=>eEe,useSurfaceBodyScrollLock:()=>YE,useSurfaceFocusTrap:()=>XE,useSurfacePolicy:()=>Sc,useSurfacePolicyPortalTarget:()=>T2,useSurfacePolicyStackingClass:()=>D2,useSurfaceVariant:()=>mee,useTemplateOwnsChildComposition:()=>lY,useThemePreferenceControl:()=>D1,useToolbarBehavior:()=>M7,useTypographyScope:()=>f_,useUI:()=>Ig,useUpdateOperationSurface:()=>Mue,useUserFacingErrorMessage:()=>lp,useUserOrgs:()=>ag,useUtilityPanelBehavior:()=>I7,useViewerMayListRelatedResource:()=>x9,useViewerMayPerformResourceOperation:()=>TSe,useVocabularyWord:()=>ff,useWebSocket:()=>dp,utilityPanelWorkspaceSignature:()=>F7,variant:()=>Bt,verifyLauncherContent:()=>Iv,verifySettingsHubContent:()=>Wv,viewerBelongsToOrganization:()=>ug,viewerHoldsOneOfRoles:()=>Lm,viewerIsKnownOutsideOrganization:()=>Cse,viewerMayHaveDecisionsWaiting:()=>zv,viewerMayPerformOperation:()=>Gm,viewerMayReadChart:()=>N9,viewerReachesUserSubject:()=>lh,visibleChartDashboardTiles:()=>Uje,waitForFontsLoaded:()=>xg,whenRendered:()=>VD,wildoErrorIsShownToUser:()=>wn,withErrorBoundary:()=>Dce,withFocusedDecisionFirst:()=>JW,withNewestHistoryPage:()=>mQ,withOlderHistoryPage:()=>hQ,withPendingSend:()=>sQ,withoutHiddenParentReference:()=>lj,wrapWithAutosaveIndicator:()=>GM,zoneMutationTargetIndex:()=>Eh,zoneTabDomIds:()=>L0});export{O5 as $,TO as $a,oI as $i,T0 as $n,gx as $o,vG as $r,g6 as $t,l7 as A,tN as Aa,OR as Ai,I4 as An,NT as Ao,KZ as Ar,j8 as At,Z5 as B,dj as Ba,SL as Bi,l4 as Bn,Hw as Bo,SY as Br,h8 as Bt,A7 as C,bF as Ca,qB as Ci,D4 as Cn,vD as Co,yQ as Cr,H8 as Ct,f7 as D,yF as Da,MR as Di,T4 as Dn,_de as Do,oQ as Dr,z8 as Dt,C7 as E,vF as Ea,PR as Ei,w4 as En,LE as Eo,aQ as Er,R8 as Et,e7 as F,$j as Fa,kL as Fi,v4 as Fn,Kw as Fo,hX as Fr,C8 as Ft,V5 as G,RA as Ga,rL as Gi,D2 as Gn,IC as Go,xJ as Gr,f8 as Gt,K5 as H,rj as Ha,eL as Hi,s4 as Hn,Bw as Ho,zJ as Hr,g8 as Ht,$5 as I,Qj as Ia,OL as Ii,f4 as In,qw as Io,fX as Ir,S8 as It,z5 as J,Yk as Ja,DI as Ji,h2 as Jn,KS as Jo,yJ as Jr,Y6 as Jt,R5 as K,hA as Ka,iL as Ki,x2 as Kn,WS as Ko,bJ as Kr,u8 as Kt,J5 as L,zj as La,AL as Li,c4 as Ln,Vw as Lo,ZY as Lr,x8 as Lt,a7 as M,JM as Ma,ER as Mi,m4 as Mn,eT as Mo,gX as Mr,E8 as Mt,r7 as N,HM as Na,SR as Ni,y4 as Nn,Qw as No,mX as Nr,T8 as Nt,c7 as O,xF as Oa,kR as Oi,E4 as On,NE as Oo,dQ as Or,I8 as Ot,i7 as P,UM as Pa,$L as Pi,x4 as Pn,zw as Po,pX as Pr,w8 as Pt,P5 as Q,CO as Qa,fI as Qi,c2 as Qn,Mx as Qo,yG as Qr,E6 as Qt,X5 as R,Fj as Ra,LL as Ri,u4 as Rn,Gw as Ro,FY as Rr,b8 as Rt,j7 as S,_F as Sa,JB as Si,O4 as Sn,bD as So,DQ as Sr,V8 as St,w7 as T,hF as Ta,SB as Ti,C4 as Tn,RE as To,_Q as Tr,L8 as Tt,U5 as U,ij as Ua,tL as Ui,I2 as Un,RC as Uo,gJ as Ur,p8 as Ut,Q5 as V,tj as Va,CL as Vi,d4 as Vn,Ww as Vo,RJ as Vr,_8 as Vt,H5 as W,nj as Wa,nL as Wi,T2 as Wn,VC as Wo,vJ as Wr,d8 as Wt,F5 as X,rk as Xa,wI as Xi,l2 as Xn,CS as Xo,hq as Xr,N6 as Xt,N5 as Y,nk as Ya,OI as Yi,u2 as Yn,XS as Yo,pq as Yr,Z6 as Yt,I5 as Z,ik as Za,bI as Zi,s2 as Zn,SS as Zo,mq as Zr,P6 as Zt,G7 as _,MF as _a,EV as _i,j4 as _n,WD as _o,L$ as _r,f5 as _t,v9 as a,UF as aa,cG as ai,Z3 as an,pO as ao,_1 as ar,Ly as as,w5 as at,I7 as b,DF as ba,MV as bi,R4 as bn,MD as bo,OQ as br,Q8 as bt,C9 as c,BF as ca,TW as ci,B3 as cn,hO as co,h1 as cr,jy as cs,m5 as ct,i9 as d,RF as da,QU as di,L3 as dn,aO as do,n1 as dr,mv as ds,i5 as dt,ZF as ea,nG as ei,h6 as en,wO as eo,w0 as er,ix as es,k5 as et,n9 as f,LF as fa,iH as fi,H3 as fn,oO as fo,o1 as fr,dv as fs,o5 as ft,q7 as g,FF as ga,kV as gi,G4 as gn,HD as go,K$ as gr,u5 as gt,X7 as h,IF as ha,OV as hi,Y4 as hn,UD as ho,t1 as hr,C_ as hs,l5 as ht,y9 as i,WF as ia,oG as ii,$3 as in,_O as io,w1 as ir,Zy as is,T5 as it,n7 as j,ZM as ja,DR as ji,h4 as jn,PT as jo,BX as jr,A8 as jt,u7 as k,eN as ka,jR as ki,W4 as kn,PE as ko,sQ as kr,F8 as kt,g9 as l,zF as la,EW as li,I3 as ln,cO as lo,m1 as lr,Dv as ls,g5 as lt,$7 as m,PF as ma,TV as mi,S3 as mn,uO as mo,a1 as mr,$_ as ms,c5 as mt,D9 as n,KF as na,lG as ni,n6 as nn,vO as no,z1 as nr,Ub as ns,j5 as nt,_9 as o,HF as oa,rG as oi,P3 as on,gO as oo,c1 as or,Iy as os,x5 as ot,t9 as p,kF as pa,wV as pi,z3 as pn,lO as po,r1 as pr,av as ps,s5 as pt,B5 as q,nA as qa,PI as qi,b2 as qn,GS as qo,_J as qr,n8 as qt,E9 as r,Ome as ra,sG as ri,e6 as rn,xO as ro,B1 as rr,Qy as rs,S5 as rt,w9 as s,VF as sa,zW as si,U3 as sn,mO as so,u1 as sr,Fy as ss,b5 as st,dMe as t,$F as ta,iG as ti,i6 as tn,bO as to,V1 as tr,Gb as ts,A5 as tt,x9 as u,bme as ua,yW as ui,W3 as un,dO as uo,e1 as ur,gv as us,h5 as ut,z7 as v,jF as va,AV as vi,K4 as vn,jD as vo,PQ as vr,d5 as vt,O7 as w,SF as wa,BB as wi,F4 as wn,GE as wo,bQ as wr,U8 as wt,M7 as x,NF as xa,jV as xi,q4 as xn,CD as xo,EQ as xr,W8 as xt,L7 as y,AF as ya,DV as yi,A4 as yn,ND as yo,TQ as yr,a5 as yt,Y5 as z,uj as za,DL as zi,p4 as zn,Uw as zo,PY as zr,y8 as zt};