@wildo-ai/application-creation-workbench 1.1.14 → 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 (238) hide show
  1. package/dist/.vite/manifest.json +568 -579
  2. package/dist/assets/{ChartEmptyState-DOlrd3QL.js → ChartEmptyState-DWIzkRcF.js} +1 -1
  3. package/dist/assets/ChartLoadingSkeleton-DJK8tr0I.js +1 -0
  4. package/dist/assets/{ChartView-nQvehKAl.js → ChartView-Db94VZQx.js} +2 -2
  5. package/dist/assets/ChartWidget-YVF2hpZO.js +5 -0
  6. package/dist/assets/{abnfDiagram-VCTEODGH-BOSMF_iF.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-F_DICN7K.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-vdakidUW.js → blockDiagram-I7D4REHJ-BSXJV2rP.js} +1 -1
  13. package/dist/assets/bn-BGBjHoNg.js +1 -0
  14. package/dist/assets/{c4Diagram-7LVT6UL2-cnHP-5K7.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-C6G-f7n3.js → chunk-4HAMMTFA-CA0aHXNY.js} +1 -1
  18. package/dist/assets/{chunk-75Z2AOVW-DiyJkf0q.js → chunk-75Z2AOVW-eNHd3ECu.js} +1 -1
  19. package/dist/assets/{chunk-DU6HZSFF-Dy7jxNH_.js → chunk-DU6HZSFF-DC0oD3wd.js} +2 -2
  20. package/dist/assets/{chunk-F27PBJKO-CkvHG7F6.js → chunk-F27PBJKO-CTaZkd0r.js} +1 -1
  21. package/dist/assets/{chunk-GMAD6QVW-DsY6Jtz4.js → chunk-GMAD6QVW-DAXYHrRx.js} +1 -1
  22. package/dist/assets/{chunk-GVQU2GXP-BE5D92zU.js → chunk-GVQU2GXP-pi_3BL4L.js} +1 -1
  23. package/dist/assets/{chunk-IMKFNOWR-CAwOIW4R.js → chunk-IMKFNOWR-D4wsR2Nz.js} +1 -1
  24. package/dist/assets/{chunk-L3NEJ4N5-B1mDlHi1.js → chunk-L3NEJ4N5-kKzd7vmD.js} +1 -1
  25. package/dist/assets/{chunk-OSK3NFVY-iylVXGs0.js → chunk-OSK3NFVY-B0dd8EQD.js} +1 -1
  26. package/dist/assets/{chunk-P2QGCYS3-CvcRZ6j9.js → chunk-P2QGCYS3-uHc1UExe.js} +1 -1
  27. package/dist/assets/{chunk-POPQ4Y6H-CNbcNXVN.js → chunk-POPQ4Y6H-BygwP6r8.js} +1 -1
  28. package/dist/assets/{chunk-PWAF6VOD-BorA01Hz.js → chunk-PWAF6VOD-UE_jt_hM.js} +1 -1
  29. package/dist/assets/{chunk-SHT3W25Y-DNWg7N7_.js → chunk-SHT3W25Y-Cv1i544N.js} +1 -1
  30. package/dist/assets/{chunk-SVP7TREG-C_gZGZzY.js → chunk-SVP7TREG-Ck1iP-B9.js} +1 -1
  31. package/dist/assets/{chunk-TICWLB2K-CG8L7csD.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-BrI954sl.js → cm6-editor-DhiCRNY6.js} +3 -3
  35. package/dist/assets/{code-block-IT6T5CEO-P8OONT1n.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-Drk0vtFB.js → cynefinDiagram-5FMLGOSQ-C69B-hF_.js} +1 -1
  40. package/dist/assets/da-BeV-TIte.js +1 -0
  41. package/dist/assets/{dagre-GXQ25YYZ-CLrGf0om.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-B-ZdgPTX.js → diagram-S7CK7UJ4-fI0poyzR.js} +1 -1
  45. package/dist/assets/{diagram-UQ7AKVKN-BkKvmg4L.js → diagram-UQ7AKVKN-Cejsbc8J.js} +1 -1
  46. package/dist/assets/{diagram-VSXAHHWV-HiaAFHhk.js → diagram-VSXAHHWV-CBv4QF-r.js} +1 -1
  47. package/dist/assets/{diagram-VX7I27RA-DwkAZ58D.js → diagram-VX7I27RA-BzXmKCQv.js} +1 -1
  48. package/dist/assets/{diagram-Z3DM3KII-D-cMFf4d.js → diagram-Z3DM3KII-DlMWqIOm.js} +1 -1
  49. package/dist/assets/{dist-OpJd06F1.js → dist-7qRR8v9X.js} +1 -1
  50. package/dist/assets/{dist-BHvGeTYl.js → dist-AFETXPuM.js} +1 -1
  51. package/dist/assets/{dist-7Nz9yNhS.js → dist-B3zMf34l.js} +1 -1
  52. package/dist/assets/{dist-DgFx0nHw.js → dist-B7LZVqmi.js} +1 -1
  53. package/dist/assets/{dist-CFrG-Mt_.js → dist-B8dHtIF5.js} +1 -1
  54. package/dist/assets/{dist-Cuhv1Fm_.js → dist-BNqD4FF5.js} +1 -1
  55. package/dist/assets/{dist-KJ6-32V3.js → dist-BPi3amKg.js} +1 -1
  56. package/dist/assets/{dist-DlNJgHFc.js → dist-Bqd9H35D.js} +1 -1
  57. package/dist/assets/{dist-BCRkZyjz.js → dist-BxMdxgPi.js} +1 -1
  58. package/dist/assets/{dist-CRpxTWEh.js → dist-BzKBUPIc.js} +1 -1
  59. package/dist/assets/{dist-BgSqI6_g.js → dist-C1JIB7wk.js} +1 -1
  60. package/dist/assets/{dist-CE3k7Kha.js → dist-CGO-gA39.js} +1 -1
  61. package/dist/assets/{dist-tfb1xShq.js → dist-CKvrtylC.js} +1 -1
  62. package/dist/assets/{dist-CPhv_Fl3.js → dist-CnWzIIZp.js} +1 -1
  63. package/dist/assets/{dist-5fOMJ27f.js → dist-CvaYKnIn.js} +1 -1
  64. package/dist/assets/{dist-DJ3oXpIs.js → dist-DAIjOsvl.js} +1 -1
  65. package/dist/assets/{dist-CstXuejQ.js → dist-DHiazivQ.js} +1 -1
  66. package/dist/assets/{dist-kKXf1Bjx.js → dist-DIV2542b.js} +1 -1
  67. package/dist/assets/{dist-BxwAVf7j.js → dist-DJE-oKsX.js} +1 -1
  68. package/dist/assets/{dist-CPuGLmxI.js → dist-DXJIV6Zs.js} +1 -1
  69. package/dist/assets/{dist-CJxRNwMR.js → dist-Da70oAVH.js} +1 -1
  70. package/dist/assets/{dist-Dy2TKEdf.js → dist-iVGPtgrw.js} +1 -1
  71. package/dist/assets/{dist-ByMsVuIk.js → dist-nXT3Wtvb.js} +1 -1
  72. package/dist/assets/{dropbox-picker-C9r5F3kM.js → dropbox-picker-YaUvIgU1.js} +1 -1
  73. package/dist/assets/{ebnfDiagram-PWID7BFC-DrvpEZ_f.js → ebnfDiagram-PWID7BFC-DTMbd2mv.js} +1 -1
  74. package/dist/assets/el-DMuXcfim.js +1 -0
  75. package/dist/assets/en-AU-DjLnSRR3.js +1 -0
  76. package/dist/assets/en-CA-DXNydqY9.js +1 -0
  77. package/dist/assets/en-GB-D4GWT5GI.js +1 -0
  78. package/dist/assets/{erDiagram-RLTQ6QDP-aafi4jCY.js → erDiagram-RLTQ6QDP-BZEe8VTH.js} +1 -1
  79. package/dist/assets/es-lfpxt6Ut.js +1 -0
  80. package/dist/assets/esm-Cbe65KfA.js +46 -0
  81. package/dist/assets/et-Bf88JUsX.js +1 -0
  82. package/dist/assets/eu-DV_CNSeH.js +1 -0
  83. package/dist/assets/fa-IR-DNJeY-Q5.js +1 -0
  84. package/dist/assets/fi-NNzsVdSt.js +1 -0
  85. package/dist/assets/flow-execution-BwY1ThjF.js +8 -0
  86. package/dist/assets/flowDiagram-HODETNUW-DbMxzAr_.js +1 -0
  87. package/dist/assets/flows-actors-graph-runtime-D-xOavtY.js +1 -0
  88. package/dist/assets/fr-B-yJDVw6.js +1 -0
  89. package/dist/assets/fr-CA-D84edDay.js +1 -0
  90. package/dist/assets/{ganttDiagram-EL5Y4UJY-CRmnjbyh.js → ganttDiagram-EL5Y4UJY-BdBwCB1x.js} +1 -1
  91. package/dist/assets/{gitGraphDiagram-WWUBYQGX-C4ebHhmy.js → gitGraphDiagram-WWUBYQGX-CIy0NCq6.js} +1 -1
  92. package/dist/assets/gl-Dp9qpDLE.js +1 -0
  93. package/dist/assets/{google-drive-picker-3-SZkSfN.js → google-drive-picker-DL6kxOGz.js} +1 -1
  94. package/dist/assets/graph-runtime-DcJcdZxk.js +1 -0
  95. package/dist/assets/he-Bq6yvypU.js +1 -0
  96. package/dist/assets/hi-CMOY0SGV.js +1 -0
  97. package/dist/assets/hr-tEZvbTHh.js +1 -0
  98. package/dist/assets/hu-4gHWGYaX.js +1 -0
  99. package/dist/assets/id-DWXCGwjx.js +1 -0
  100. package/dist/assets/index-B-LZopDR.js +202 -0
  101. package/dist/assets/index-CZ5sv4PP.css +2 -0
  102. package/dist/assets/{infoDiagram-27XIBGKW-CplMaWp5.js → infoDiagram-27XIBGKW-cmptKZNt.js} +1 -1
  103. package/dist/assets/is-CyAuvYgU.js +1 -0
  104. package/dist/assets/isSameWeek-BwCmz51m.js +1 -0
  105. package/dist/assets/{ishikawaDiagram-5VMMS53U-BREas_JM.js → ishikawaDiagram-5VMMS53U-BGkoqgNl.js} +1 -1
  106. package/dist/assets/it-D--xgPTt.js +1 -0
  107. package/dist/assets/ja-PiU5hzs0.js +1 -0
  108. package/dist/assets/{journeyDiagram-3NMN7TZE-DWHGp6os.js → journeyDiagram-3NMN7TZE-BOELkE0a.js} +1 -1
  109. package/dist/assets/{kanban-definition-UXKFOSKX-CP-1mPST.js → kanban-definition-UXKFOSKX-DMZEjs2i.js} +1 -1
  110. package/dist/assets/katex-CI0JW3i6.js +1 -0
  111. package/dist/assets/ko-CGrMXw-3.js +1 -0
  112. package/dist/assets/{line-C_Dg3XTF.js → line-s3zM1O9a.js} +1 -1
  113. package/dist/assets/linear-BUYtyba4.js +1 -0
  114. package/dist/assets/lt-wHK-2djA.js +1 -0
  115. package/dist/assets/lv-B305-5TD.js +1 -0
  116. package/dist/assets/{markdown-stream-runtime-CMB_Qu0K.js → markdown-stream-runtime-JIhfRcVj.js} +33 -33
  117. package/dist/assets/match-DcrfiQ0n.js +1 -0
  118. package/dist/assets/match-szcpBoWK.js +1 -0
  119. package/dist/assets/mermaid-VLURNSYL-DDUIX3qH.js +1 -0
  120. package/dist/assets/{mermaid.core-D_DICvzX.js → mermaid.core-a9Ql5m3p.js} +4 -4
  121. package/dist/assets/{mindmap-definition-YA3MSWOX-C20ANuWc.js → mindmap-definition-YA3MSWOX-DUzblAeW.js} +1 -1
  122. package/dist/assets/ms-DOzy1eba.js +1 -0
  123. package/dist/assets/mt-Cyhk7ljW.js +1 -0
  124. package/dist/assets/nb-CHftFpq-.js +1 -0
  125. package/dist/assets/nl-BLyVSbSF.js +1 -0
  126. package/dist/assets/{onedrive-picker-C_4mWMyM.js → onedrive-picker-B79jNUe8.js} +1 -1
  127. package/dist/assets/{pdf-viewer-By7fQHYQ.js → pdf-viewer-BZVcG_S1.js} +2 -2
  128. package/dist/assets/{pegDiagram-XKGWAZYB-DVbFO1Fa.js → pegDiagram-XKGWAZYB-BZ3P1nUf.js} +1 -1
  129. package/dist/assets/{pieDiagram-E7YTZNPT-DWtaagpj.js → pieDiagram-E7YTZNPT-B9NGIjBe.js} +1 -1
  130. package/dist/assets/pl-DcuB_1rF.js +1 -0
  131. package/dist/assets/pt-BLKOuKD1.js +1 -0
  132. package/dist/assets/pt-BR-DDPfvEv6.js +1 -0
  133. package/dist/assets/{public-runtime-f4VjjFok.js → public-runtime-8slf2C-u.js} +1 -1
  134. package/dist/assets/{quadrantDiagram-AXDQQJYC-CJvBFA_c.js → quadrantDiagram-AXDQQJYC-CjNDgU43.js} +1 -1
  135. package/dist/assets/{railroadDiagram-O6MQD6OU-Dygrn5Zv.js → railroadDiagram-O6MQD6OU-BBDx0rdy.js} +1 -1
  136. package/dist/assets/{requirementDiagram-BXWQKSXE-BpnohlUt.js → requirementDiagram-BXWQKSXE-BrhlVjUT.js} +1 -1
  137. package/dist/assets/ro-DbI8OToC.js +1 -0
  138. package/dist/assets/ru-BLDhwwC9.js +1 -0
  139. package/dist/assets/{sankeyDiagram-P5KCCOFB-Cyy3VaYL.js → sankeyDiagram-P5KCCOFB-DgJzdqPr.js} +1 -1
  140. package/dist/assets/{sequenceDiagram-WJ2MYXX4-GaYcTb-c.js → sequenceDiagram-WJ2MYXX4-nO_0feCR.js} +1 -1
  141. package/dist/assets/sk-7eBEpg_i.js +1 -0
  142. package/dist/assets/sl-D8mz35xz.js +1 -0
  143. package/dist/assets/{stateDiagram-D77RDMKH-DGiRCD9r.js → stateDiagram-D77RDMKH-DiHY7fmj.js} +1 -1
  144. package/dist/assets/stateDiagram-v2-MP3YSRHH-B-ln1J6g.js +1 -0
  145. package/dist/assets/sv-BRKZ4Z4y.js +1 -0
  146. package/dist/assets/{swimlanes-42K2YHIH-D7xJP0pw.js → swimlanes-42K2YHIH-CYk23GX2.js} +1 -1
  147. package/dist/assets/swimlanesDiagram-VR7AAH4N-Bz8yiJQl.js +8 -0
  148. package/dist/assets/ta-DKAQy049.js +1 -0
  149. package/dist/assets/th-BuRbTdYq.js +1 -0
  150. package/dist/assets/{timeline-definition-24CTP7MA-DTJnlCQe.js → timeline-definition-24CTP7MA-DoWeIqkB.js} +1 -1
  151. package/dist/assets/tr-_9-Ip53s.js +1 -0
  152. package/dist/assets/useI18n-V1cysfvg.js +171 -0
  153. package/dist/assets/value-CHmTzbgv.js +1 -0
  154. package/dist/assets/{vennDiagram-4TSXK5OY-CFat-M74.js → vennDiagram-4TSXK5OY-be67wLzm.js} +1 -1
  155. package/dist/assets/vi-DOgzte8u.js +1 -0
  156. package/dist/assets/{wardleyDiagram-VM6X3IG4-h29SCI73.js → wardleyDiagram-VM6X3IG4-AWMVCRIW.js} +1 -1
  157. package/dist/assets/{xychartDiagram-S5SC5T6Z-B8S8taDj.js → xychartDiagram-S5SC5T6Z-BpEpObCO.js} +1 -1
  158. package/dist/assets/zh-CN-Be160TvV.js +1 -0
  159. package/dist/assets/zh-HK-izvou4UE.js +1 -0
  160. package/dist/assets/zh-TW-B7tQDnE2.js +1 -0
  161. package/dist/index.html +11 -10
  162. package/package.json +9 -9
  163. package/dist/assets/ChartLoadingSkeleton-BlVB40sh.js +0 -1
  164. package/dist/assets/ChartWidget-CZ5NXj5y.js +0 -5
  165. package/dist/assets/af-1WnNPqq-.js +0 -1
  166. package/dist/assets/ar-I_OTuA6g.js +0 -1
  167. package/dist/assets/badge-tone-B1Pd5hFs.js +0 -5
  168. package/dist/assets/bg-BNynXrJg.js +0 -1
  169. package/dist/assets/bn-IoUqFxhs.js +0 -1
  170. package/dist/assets/ca-CWN_9uem.js +0 -1
  171. package/dist/assets/channel-Dn5Kml0R.js +0 -1
  172. package/dist/assets/classDiagram-ZZMXUADV-DZBHmNh2.js +0 -1
  173. package/dist/assets/classDiagram-v2-VYDZK3BY-DZBHmNh2.js +0 -1
  174. package/dist/assets/context-BNM55Snb.js +0 -1
  175. package/dist/assets/cs-CmgNpjMj.js +0 -1
  176. package/dist/assets/cy-zQX_QEXD.js +0 -1
  177. package/dist/assets/da-CjOdj32R.js +0 -1
  178. package/dist/assets/de-AT-BLeHD7-g.js +0 -1
  179. package/dist/assets/de-CwLcXmDQ.js +0 -1
  180. package/dist/assets/el-CWW60iH9.js +0 -1
  181. package/dist/assets/en-AU-BossA0Rn.js +0 -1
  182. package/dist/assets/en-CA-DATw2cVB.js +0 -1
  183. package/dist/assets/en-GB-CUli1ZoP.js +0 -1
  184. package/dist/assets/es-qp1wsCMr.js +0 -1
  185. package/dist/assets/esm-B3AZ9HP5.js +0 -7
  186. package/dist/assets/esm-GB9ACU6Q.js +0 -46
  187. package/dist/assets/et-CuSdGi0t.js +0 -1
  188. package/dist/assets/eu-xCnVjdHU.js +0 -1
  189. package/dist/assets/fa-IR-DZ3ibPOw.js +0 -1
  190. package/dist/assets/fi-g4XjAI_I.js +0 -1
  191. package/dist/assets/flowDiagram-HODETNUW-RzRAndm9.js +0 -1
  192. package/dist/assets/flows-actors-graph-runtime-DeTt1QCB.js +0 -1
  193. package/dist/assets/fr-BhOuGXkV.js +0 -1
  194. package/dist/assets/fr-CA-BYF9Kaol.js +0 -1
  195. package/dist/assets/gl-BLfeYzoG.js +0 -1
  196. package/dist/assets/graph-runtime-BbbtydnB.js +0 -1
  197. package/dist/assets/he-BXMp0P82.js +0 -1
  198. package/dist/assets/hi-BmH5--Ew.js +0 -1
  199. package/dist/assets/hr-CsQDZ0KK.js +0 -1
  200. package/dist/assets/hu-DiL5YUSE.js +0 -1
  201. package/dist/assets/id-1Vn21CD0.js +0 -1
  202. package/dist/assets/index-Bcdys-EF.css +0 -2
  203. package/dist/assets/index-TNOEipJX.js +0 -202
  204. package/dist/assets/is-CByKTwFK.js +0 -1
  205. package/dist/assets/isSameWeek-Bf15BL-p.js +0 -1
  206. package/dist/assets/it-CPNWwvi0.js +0 -1
  207. package/dist/assets/ja-D9Jm250G.js +0 -1
  208. package/dist/assets/katex-Dp9rtsw4.js +0 -1
  209. package/dist/assets/ko-CpsoMmES.js +0 -1
  210. package/dist/assets/linear-DMyAYyr-.js +0 -1
  211. package/dist/assets/lt-Ckx9bY2o.js +0 -1
  212. package/dist/assets/lv-DZt3HT5G.js +0 -1
  213. package/dist/assets/match-CLYNQBt4.js +0 -1
  214. package/dist/assets/match-_OgMbUjy.js +0 -1
  215. package/dist/assets/mermaid-VLURNSYL-DXNPK6wv.js +0 -1
  216. package/dist/assets/ms-C7UJy830.js +0 -1
  217. package/dist/assets/mt-8KsNOVwG.js +0 -1
  218. package/dist/assets/nb-C7YQIAOB.js +0 -1
  219. package/dist/assets/nl-UadnkhJV.js +0 -1
  220. package/dist/assets/node-nqfXDpgr.js +0 -2
  221. package/dist/assets/pl-DaJL5jLd.js +0 -1
  222. package/dist/assets/pt-BHQDKf9o.js +0 -1
  223. package/dist/assets/pt-BR-zn9BrDVb.js +0 -1
  224. package/dist/assets/ro-BdQOzb6t.js +0 -1
  225. package/dist/assets/ru-BmbP3F22.js +0 -1
  226. package/dist/assets/sk-Deobe1dz.js +0 -1
  227. package/dist/assets/sl-DDWo-_WQ.js +0 -1
  228. package/dist/assets/stateDiagram-v2-MP3YSRHH-CZRVHb2L.js +0 -1
  229. package/dist/assets/sv-DQUMehtC.js +0 -1
  230. package/dist/assets/swimlanesDiagram-VR7AAH4N-C2KDCowk.js +0 -8
  231. package/dist/assets/ta-CzkRFNns.js +0 -1
  232. package/dist/assets/th-DR6hfS-t.js +0 -1
  233. package/dist/assets/tr-ECW9jg6T.js +0 -1
  234. package/dist/assets/useI18n-CrrUk_L3.js +0 -171
  235. package/dist/assets/vi-D2nRiUXf.js +0 -1
  236. package/dist/assets/zh-CN-Cn0aI883.js +0 -1
  237. package/dist/assets/zh-HK-DxBG0PaI.js +0 -1
  238. package/dist/assets/zh-TW-DHK1J7Rs.js +0 -1
@@ -1,46 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChartView-nQvehKAl.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/jsx-runtime-lTuChwRC.js","assets/react-9WV3M1gM.js","assets/useI18n-CrrUk_L3.js","assets/public-runtime-f4VjjFok.js","assets/bundle-mjs-H9shJLym.js","assets/badge-tone-B1Pd5hFs.js","assets/ChartEmptyState-DOlrd3QL.js","assets/ChartLoadingSkeleton-BlVB40sh.js","assets/ChartWidget-CZ5NXj5y.js","assets/react-dom-DQGBdIds.js","assets/preload-helper-7y9sWmk5.js","assets/flows-actors-graph-runtime-DeTt1QCB.js","assets/node-nqfXDpgr.js","assets/esm-B3AZ9HP5.js","assets/index-TNOEipJX.js","assets/src-C_gRsKqw.js","assets/index-Bcdys-EF.css"])))=>i.map(i=>d[i]);
2
- import{a as e,r as t,t as n}from"./rolldown-runtime-BWaJ3C7D.js";import{t as r}from"./react-9WV3M1gM.js";import{t as i}from"./react-dom-DQGBdIds.js";import{$C as a,$E as o,$T as s,$a as c,$c as l,$i as u,$l as d,$n as f,$o as p,$r as m,$t as h,$w as g,$y as _,A as v,AS as y,AT as b,A_ as x,Aa as S,Ab as C,Af as w,Ah as T,Ai as E,Am as D,An as O,Ao as k,Ap as A,Ar as j,At as M,Au as N,Av as P,Aw as F,Ax as I,Ay as ee,B as L,BC as R,BE as z,BT as te,B_ as ne,Ba as re,Bf as ie,Bg as ae,Bh as oe,Bi as se,Bm as ce,Bn as le,Bp as ue,Br as de,Bt as fe,Bv as pe,Bw as me,Bx as he,By as ge,C as _e,CD as ve,CT as ye,C_ as be,Ca as xe,Cb as Se,Cd as Ce,Cg as we,Ci as Te,Cm as Ee,Cn as De,Cp as Oe,Cr as ke,Ct as Ae,Cv as je,Cw as Me,Cy as Ne,D as Pe,DC as Fe,DD as B,DE as Ie,DS as Le,DT as Re,Da as ze,Db as Be,Df as Ve,Dg as He,Dh as Ue,Di as We,Dn as Ge,Do as Ke,Dr as qe,Dt as Je,Du as Ye,Dv as Xe,Dw as Ze,E as Qe,EC as $e,ED as et,EE as tt,ES as nt,ET as rt,Ea as it,Eb as at,Ec as ot,Ef as st,Em as ct,En as lt,Eo as ut,Ep as dt,Er as ft,Et as pt,Eu as mt,Ev as ht,Ew as gt,Ey as _t,F as vt,FC as yt,FE as bt,FT as xt,Fa as St,Fb as Ct,Fd as wt,Fg as Tt,Fi as Et,Fm as Dt,Fn as Ot,Fp as kt,Fr as At,Ft as V,Fw as jt,Fx as Mt,G as Nt,GC as Pt,GT as Ft,G_ as It,Ga as Lt,Gb as Rt,Gg as zt,Gi as Bt,Gl as Vt,Gn as Ht,Gp as Ut,Gr as Wt,Gt,Gu as Kt,Gw as qt,Gx as Jt,Gy as Yt,H as Xt,HE as Zt,HT as Qt,H_ as $t,Ha as en,Hb as tn,Hg as nn,Hh as rn,Hi as an,Hn as on,Hp as sn,Hr as cn,Ht as ln,Hw as un,Hx as dn,Hy as fn,I as pn,IC as mn,IE as hn,IT as gn,Ia as _n,Id as vn,If as yn,Ig as bn,Ih as xn,Ii as Sn,Il as Cn,Im as wn,In as Tn,Ip as En,Ir as Dn,It as On,Iu as kn,Iw as An,Ix as jn,Iy as Mn,J as Nn,JC as Pn,JE as Fn,JS as In,Ja as Ln,Jb as Rn,Ji as zn,Jn as Bn,Jo as Vn,Jp as Hn,Jr as Un,Jt as Wn,Ju as Gn,Jw as Kn,Jx as qn,Jy as Jn,K as Yn,KC as Xn,KE as Zn,KT as Qn,Ka as H,Kb as $n,Kh as er,Ki as tr,Kn as nr,Kr as rr,Kt as eee,Kv as ir,Kw as ar,Kx as or,L as sr,LE as cr,LT as lr,La as ur,Lf as tee,Lg as dr,Li as fr,Lm as nee,Ln as ree,Lp as iee,Lr as pr,Ls as mr,Lt as hr,Lw as aee,Lx as oee,Ly as gr,M as _r,MC as vr,ME as yr,MS as see,MT as cee,Ma as lee,Mb as uee,Mf as br,Mg as xr,Mh as dee,Mi as Sr,Mm as Cr,Mn as fee,Mo as pee,Mr as mee,Mt as hee,Mu as gee,Mv as _ee,Mw as vee,Mx as wr,My as Tr,N as Er,NC as Dr,NE as Or,NT as kr,N_ as yee,Na as bee,Nf as Ar,Nh as xee,Ni as See,Nm as Cee,Nn as jr,No as Mr,Np as Nr,Nr as wee,Nt as U,Nu as Pr,Nv as Tee,Nw as Eee,Nx as Fr,O as Ir,OC as Lr,OE as Rr,OS as zr,OT as Br,Oa as Dee,Ob as Vr,Od as Oee,Og as Hr,Oh as Ur,Oi as Wr,Ol as kee,Om as Gr,On as Aee,Or as jee,Ot as Kr,Ou as qr,Ov as Mee,Ow as Jr,Ox as Nee,Oy as Yr,P as Xr,PC as Zr,PS as Qr,PT as $r,Pa as ei,Pb as ti,Pd as Pee,Pf as Fee,Pg as ni,Ph as ri,Pi as Iee,Pm as Lee,Pn as ii,Pp as Ree,Pr as zee,Pt as ai,Pv as Bee,Pw as Vee,Py as Hee,Q as Uee,QE as oi,QT as Wee,Qa as Gee,Qi as si,Ql as ci,Qn as li,Qo as ui,Qr as Kee,Qt as di,Qv as qee,Qw as Jee,Qx as Yee,Qy as Xee,R as fi,RC as pi,RT as Zee,Ra as Qee,Rb as $ee,Rd as mi,Rg as hi,Rh as gi,Ri as ete,Rn as _i,Rp as tte,Rr as nte,Rt as rte,Rw as vi,Rx as yi,Ry as ite,S as bi,SD as xi,ST as Si,Sa as Ci,Sb as wi,Sd as Ti,Sg as Ei,Si as Di,Sl as Oi,Sm as ki,Sn as Ai,So as ji,Sr as Mi,St as ate,Sv as Ni,Sw as Pi,Sy as ote,T as Fi,TC as ste,TD as Ii,TE as Li,TT as Ri,Ta as cte,Tb as zi,Td as Bi,Tf as lte,Tg as Vi,Th as Hi,Tn as Ui,To as ute,Tp as dte,Tr as fte,Tt as Wi,Tv as Gi,Tw as pte,U as Ki,UC as qi,UE as mte,UT as Ji,U_ as Yi,Ua as hte,Ub as gte,Ug as Xi,Uh as Zi,Ui as _te,Um as vte,Un as yte,Ur as Qi,Ut as bte,Uu as xte,Ux as $i,V as Ste,VC as ea,VE as ta,Va as Cte,Vb as na,Vg as wte,Vi as Tte,Vn as Ete,Vo as Dte,Vr as ra,Vt as Ote,Vv as ia,Vw as kte,Vx as Ate,Vy as aa,W as oa,WC as sa,Wa as ca,Wf as jte,Wg as la,Wh as Mte,Wi as ua,Wn as Nte,Wo as da,Wp as fa,Wr as Pte,Wt as pa,Wu as ma,Ww as Fte,Wx as Ite,X as ha,XC as ga,XE as _a,XT as va,Xa as ya,Xb as ba,Xf as Lte,Xi as xa,Xl as Rte,Xn as Sa,Xo as Ca,Xr as wa,Xt as Ta,Xv as Ea,Xw as Da,Xx as Oa,Xy as ka,Y as Aa,YC as ja,YE as Ma,YS as Na,YT as Pa,Ya as zte,Yi as Bte,Yl as Fa,Yn as Vte,Yo as Hte,Yp as Ute,Yr as Wte,Yt as Ia,Yw as La,Yx as Ra,Yy as za,Z as Ba,ZC as Va,ZE as Ha,ZS as Ua,ZT as Wa,Z_ as Ga,Za as Ka,Zb as Gte,Zi as Kte,Zl as qte,Zm as Jte,Zn as Yte,Zo as Xte,Zp as qa,Zr as Zte,Zt as Ja,Zv as Qte,Zw as Ya,Zx as Xa,Zy as $te,_ as ene,_D as Za,_E as Qa,_T as $a,_a as tne,_b as nne,_d as eo,_g as to,_h as no,_i as rne,_m as ro,_n as io,_o as ao,_r as ine,_s as oo,_t as so,_w as ane,_x as one,a as sne,aC as co,aD as lo,aT as cne,a_ as uo,aa as fo,ab as po,ad as lne,ai as mo,al as une,am as ho,an as go,ar as dne,at as fne,au as pne,ax as W,ay as mne,b as _o,bD as vo,bE as yo,bT as bo,b_ as xo,ba as So,bd as Co,bg as wo,bh as To,bi as Eo,bl as Do,bm as Oo,bn as ko,bo as hne,br as gne,bs as _ne,bt as Ao,bu as vne,bw as jo,by as Mo,c as No,cC as yne,cE as bne,cT as Po,ca as xne,cg as Fo,ci as Sne,cl as Io,cm as Lo,cn as Cne,co as Ro,cp as zo,cr as wne,ct as Bo,cu as Tne,cv as Vo,cw as Ene,cy as Ho,d as Dne,dD as Uo,dT as Wo,da as One,dg as kne,dh as Ane,di as Go,dm as Ko,dn as jne,do as qo,dr as Mne,dt as Nne,du as Pne,dv as Fne,dw as Jo,dx as Yo,eC as Xo,eD as Zo,eE as Qo,eT as Ine,e_ as $o,ea as Lne,eg as Rne,ei as es,em as ts,en as ns,eo as rs,ep as zne,er as Bne,eu as Vne,ew as Hne,f as is,fD as as,fE as os,fT as Une,fa as Wne,fd as ss,fh as cs,fi as ls,fm as us,fn as ds,fo as Gne,fr as Kne,ft as fs,fu as ps,fv as ms,fy as hs,g as gs,gD as _s,gE as vs,gS as ys,gT as bs,g_ as xs,ga as Ss,gb as Cs,gg as ws,gi as Ts,gl as Es,gm as Ds,gn as Os,gr as ks,gt as As,gu as js,gw as Ms,gx as Ns,gy as Ps,h as Fs,hD as Is,hE as Ls,hT as Rs,ha as zs,hg as Bs,hi as Vs,hl as Hs,hn as Us,ho as Ws,hp as Gs,hr as Ks,ht as qs,hw as Js,hy as Ys,i as Xs,iC as Zs,iD as Qs,iE as $s,iT as qne,i_ as Jne,ia as Yne,ii as ec,il as Xne,im as Zne,in as tc,ip as nc,ir as Qne,it as $ne,iy as ere,j as rc,jC as ic,jE as ac,jS as oc,jT as tre,ja as nre,jf as rre,jg as sc,jh as ire,ji as cc,jm as lc,jn as uc,jo as are,jp as dc,jr as fc,jt as pc,ju as mc,jv as hc,jw as gc,jx as _c,k as vc,kC as yc,kE as bc,kT as ore,k_ as xc,ka as Sc,kb as sre,kg as Cc,kh as cre,ki as lre,km as ure,ko as dre,kp as fre,kr as wc,kt as Tc,ku as Ec,kv as Dc,kw as Oc,kx as kc,ky as Ac,l as jc,lC as Mc,lD as Nc,lE as Pc,lT as Fc,la as pre,lb as Ic,lg as mre,li as hre,lm as Lc,ln as Rc,lo as gre,lp as _re,lr as vre,lt as yre,lu as bre,lv as zc,lw as xre,lx as Bc,m as Vc,mD as Hc,mE as Uc,mT as Sre,ma as Cre,mg as Wc,mh as wre,mi as Gc,ml as Kc,mn as qc,mo as Tre,mp as Ere,mr as Dre,mt as Ore,mv as Jc,mw as Yc,my as Xc,n as G,nC as Zc,nD as Qc,nT as $c,na as kre,nb as Are,ni as el,nn as tl,no as nl,nr as jre,nt as Mre,nu as Nre,nx as Pre,ny as rl,o as il,oC as al,oD as ol,oE as Fre,oT as Ire,oa as Lre,ob as Rre,og as sl,oi as zre,ol as Bre,on as Vre,or as Hre,ot as cl,ou as Ure,ow as Wre,ox as ll,oy as ul,p as dl,pD as fl,pE as pl,pS as ml,pT as Gre,pa as Kre,pg as qre,ph as Jre,pi as hl,pm as gl,pn as _l,po as Yre,pp as Xre,pr as Zre,pt as Qre,pv as $re,pw as vl,py as eie,q as tie,qC as nie,qE as yl,qS as bl,qT as xl,qa as rie,qb as Sl,qf as Cl,qi as wl,qm as Tl,qn as iie,qp as El,qr as aie,qt as Dl,qu as Ol,qv as kl,qw as oie,qx as Al,qy as jl,r as Ml,rD as Nl,rT as sie,r_ as cie,ra as Pl,rb as Fl,ri as Il,rm as lie,rn as Ll,ro as uie,rp as die,rr as fie,rt as pie,ru as mie,rw as Rl,rx as zl,ry as Bl,s as Vl,sC as Hl,sE as Ul,sS as Wl,sT as Gl,sa as Kl,sb as ql,sg as Jl,sh as Yl,si as Xl,sl as Zl,sm as Ql,sn as $l,sr as eu,su as tu,sw as nu,sx as ru,sy as hie,t as K,tC as gie,tD as iu,tE as au,tT as ou,t_ as su,ta as _ie,tb as cu,ti as lu,tm as vie,tn as yie,to as bie,tr as xie,tt as Sie,tu as Cie,tx as uu,u as du,uD as fu,uE as pu,uT as wie,ua as mu,ug as hu,uh as Tie,ui as gu,un as Eie,uo as Die,up as Oie,ur as kie,ut as Aie,uu as jie,ux as Mie,v as Nie,vD as Pie,vE as _u,vT as vu,va as Fie,vb as Iie,vc as yu,vd as Lie,vg as Rie,vi as bu,vm as xu,vn as Su,vr as Cu,vw as wu,w as Tu,wC as Eu,wD as Du,wE as Ou,wT as ku,wa as Au,wb as ju,wd as Mu,wf as Nu,wg as Pu,wh as Fu,wi as Iu,wm as Lu,wn as Ru,wp as zu,wr as Bu,wt as Vu,wv as zie,ww as Bie,wy as Hu,x as Vie,xD as Uu,xE as Hie,xS as Wu,xT as Uie,xa as Gu,xb as Wie,xd as Ku,xf as qu,xi as Ju,xm as Gie,xn as Yu,xo as Kie,xr as qie,xt as Jie,xw as Yie,xy as Xie,y as Zie,yD as q,yE as Xu,yT as Zu,y_ as Qie,ya as $ie,yb as Qu,yg as eae,yh as $u,yi as tae,ym as nae,yn as rae,yr as iae,yw as aae,z as ed,zC as oae,zE as td,zT as sae,z_ as nd,za as rd,zd as cae,zg as id,zh as ad,zi as lae,zn as uae,zr as od,zt as dae,zv as fae,zw as sd,zx as cd}from"./useI18n-CrrUk_L3.js";import{B as ld,C as ud,Cr as pae,Ct as mae,E as dd,Et as hae,F as fd,Hr as gae,I as pd,J as _ae,M as md,N as hd,O as gd,P as _d,S as vd,Si as yd,T as vae,Tn as yae,Ts as bae,U as bd,W as xd,X as Sd,Y as xae,Yr as Cd,_ as Sae,at as wd,ci as Td,ct as Ed,dr as Dd,er as Od,et as Cae,g as wae,h as Tae,it as kd,j as Ad,li as jd,m as Eae,ot as Md,p as Dae,q as Oae,rt as kae,sr as Nd,st as Pd,ta as Fd,tt as Id,u as Aae,v as jae,w as Ld,wt as Rd,x as Mae,xi as zd}from"./public-runtime-f4VjjFok.js";import{$ as Nae,B as Pae,C as Fae,Ct as J,Dt as Y,E as Bd,Et as Vd,F as Iae,G as Lae,H as Rae,I as Hd,J as Ud,K as Wd,M as Gd,N as Kd,Ot as qd,P as Jd,Q as Yd,S as Xd,St as Zd,T as Qd,Tt as $d,U as ef,V as tf,W as nf,X as rf,Y as af,Z as of,_ as sf,_t as cf,a as lf,at as uf,b as df,bt as ff,c as pf,ct as mf,d as hf,dt as gf,et as _f,f as vf,ft as yf,g as bf,gt as xf,h as Sf,ht as Cf,i as wf,it as Tf,kt as Ef,l as Df,lt as Of,m as kf,mt as Af,n as jf,nt as Mf,o as Nf,ot as Pf,p as Ff,pt as If,q as Lf,r as Rf,rt as zf,s as Bf,st as Vf,t as Hf,tt as Uf,u as Wf,ut as Gf,v as Kf,vt as qf,w as Jf,wt as Yf,x as Xf,xt as X,y as Zf,yt as Qf,z as $f}from"./node-nqfXDpgr.js";import{$ as ep,$n as zae,A as tp,An as Bae,At as np,B as Vae,Bn as Hae,Bt as Uae,C as rp,Cn as ip,Ct as Wae,D as ap,Dn as op,Dt as Gae,E as sp,En as Kae,Et as cp,F as lp,Fn as up,Ft as dp,G as fp,Gn as qae,Gt as pp,H as Jae,Hn as mp,Ht as Yae,I as Xae,In as hp,It as Zae,J as gp,Jn as Qae,Jt as $ae,K as eoe,Kn as _p,Kt as vp,L as toe,Ln as yp,Lt as noe,M as roe,Mn as bp,Mt as xp,N as Sp,Nn as Cp,Nt as wp,O as ioe,On as aoe,Ot as ooe,P as Tp,Pn as Ep,Pt as soe,Q as Dp,Qn as Op,Qt as kp,R as Ap,Rn as jp,Rt as Mp,S as coe,Sn as Np,St as loe,T as uoe,Tn as doe,Tt as Pp,U as foe,Un as poe,Ut as moe,V as Fp,Vn as Ip,Vt as hoe,W as goe,Wn as Lp,Wt as Rp,X as zp,Xn as _oe,Xt as Bp,Y as Vp,Yn as voe,Yt as Hp,Z as Up,Zn as yoe,Zt as Wp,_ as boe,_n as Gp,_t as xoe,a as Kp,an as Soe,at as qp,b as Coe,bn as woe,bt as Toe,c as Jp,cn as Eoe,ct as Yp,d as Doe,dn as Ooe,dt as Xp,er as Zp,et as koe,f as Qp,fn as Aoe,ft as joe,g as $p,gn as Moe,gt as Noe,h as em,hn as tm,ht as nm,i as Poe,in as rm,it as im,j as am,jn as Foe,jt as Ioe,k as Loe,kn as Roe,kt as om,l as zoe,ln as Boe,lt as sm,m as Voe,mn as Hoe,mt as Uoe,n as cm,nn as Woe,nt as lm,o as um,on as dm,ot as Goe,p as fm,pn as Koe,pt as qoe,q as pm,qn as Joe,qt as Yoe,r as mm,rn as hm,rt as gm,s as _m,sn as Xoe,st as vm,t as ym,tn as bm,tr as Zoe,tt as xm,u as Sm,un as Qoe,ut as Cm,v as $oe,vn as ese,vt as tse,w as nse,wn as wm,wt as rse,x as Tm,xn as ise,xt as Em,y as Dm,yn as ase,yt as Om,z as ose,zn as sse,zt as km}from"./ChartLoadingSkeleton-BlVB40sh.js";import{$ as cse,$t as Am,A as lse,At as jm,B as Mm,Bt as Nm,C as Pm,Ct as Fm,D as use,Dt as Im,E as dse,Et as fse,F as Lm,Ft as Rm,G as pse,Gt as zm,H as Bm,Ht as Vm,I as mse,It as Hm,J as hse,Jt as gse,K as _se,Kt as vse,L as yse,Lt as bse,M as Um,Mt as Wm,N as Gm,Nt as Km,O as qm,Ot as Jm,P as Ym,Pt as Xm,Q as Zm,Qt as Qm,R as $m,Rt as eh,S as th,St as nh,T as rh,Tt as ih,U as xse,Ut as ah,V as oh,Vt as Sse,W as Cse,Wt as sh,X as ch,Xt as lh,Yt as uh,Z as dh,Zt as wse,_ as fh,_t as Tse,a as ph,an as Ese,at as Dse,b as Ose,bt as mh,c as kse,ct as hh,d as gh,dt as _h,en as vh,et as yh,f as bh,ft as xh,g as Sh,gt as Ch,h as wh,ht as Th,i as Eh,in as Dh,it as Oh,j as kh,jt as Ah,k as jh,kt as Mh,l as Nh,lt as Ph,m as Fh,mt as Ih,nn as Lh,nt as Rh,o as zh,on as Bh,ot as Vh,p as Hh,pt as Uh,q as Wh,qt as Gh,r as Kh,rn as qh,rt as Jh,s as Yh,sn as Xh,st as Zh,t as Qh,tn as $h,tt as eg,u as tg,ut as ng,v as rg,vt as ig,w as ag,wt as og,x as sg,xt as cg,y as lg,yt as ug,z as dg,zt as fg}from"./ChartWidget-CZ5NXj5y.js";import{t as pg}from"./jsx-runtime-lTuChwRC.js";import{A as mg,B as hg,C as gg,D as _g,E as vg,F as yg,G as bg,H as xg,I as Sg,J as Cg,K as wg,L as Tg,M as Eg,N as Dg,O as Og,P as kg,R as Ag,S as jg,T as Mg,U as Ng,V as Pg,W as Fg,Y as Ig,_ as Lg,a as Rg,b as zg,c as Bg,d as Vg,f as Hg,g as Ug,h as Wg,i as Gg,j as Kg,k as qg,l as Jg,m as Yg,n as Xg,o as Zg,p as Qg,q as $g,r as e_,s as t_,t as n_,u as r_,v as i_,w as a_,x as o_,y as s_,z as c_}from"./badge-tone-B1Pd5hFs.js";import{t as l_}from"./preload-helper-7y9sWmk5.js";import{a as u_,c as d_,d as f_,f as p_,g as m_,h as h_,i as g_,l as __,m as v_,n as y_,o as b_,p as Z,r as x_,s as S_,t as C_,u as w_}from"./ChartEmptyState-DOlrd3QL.js";function T_(e,t){return e!==void 0||t!==void 0}var E_=`frontend_sdk`,D_=function(e){return e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e}({});function O_(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 k_(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 A_(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 j_(e,t){return(e??[]).filter(e=>{let n=t?.[e];return n==null||typeof n==`string`&&n.trim()===``})}function M_(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}.${E_} in the application's configuration (per environment in its infrastructure configuration), then run \`wildo config sync\`.`}var N_=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 P_(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 N_(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 F_=[];function I_(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 L_(e){let{previousRow:t,isStoredRow:n,...r}=e;if(!e.row||!t)return{contextResourceIdentifiers:I_(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=I_({...r,row:i,callContext:c}),u=I_({...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 R_(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)=>R_(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)&&R_(n[e],r[e]))}function z_(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=>R_(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 B_(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 V_(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 H_(e){let t=B_(e),n=new Map,r=new Set(t.keys());for(let e of r)n.set(e,V_(e,t));return n}var U_=function(e){return e.UTF8=`UTF8`,e.BASE64=`BASE64`,e}({}),W_=function(e){return e.NEXT_ACTIONS=`next_actions`,e.SUMMARY=`summary`,e.FLAT=`flat`,e.DETAILED=`detailed`,e}({}),G_=`summary`;function K_(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 q_(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:K_(n,r,e=>e.fieldIdentifier)}}function J_(e,t){return!e&&!t?[]:e?t?K_(e,t,e=>e.ref):[...e??[]]:[...t??[]]}function Y_(e,t){return!e&&!t?[]:Z_(e?t?K_(e,t,e=>e.ref):[...e??[]]:[...t??[]])}function X_(e,t){if(!t?.length)return e;let n=[...e];for(let e of t){let t=n.findIndex(t=>t.ref===e.ref);t===-1?n.push(e):n[t].contentKind===ze.NAVIGATION_LIST&&e.contentKind===ze.NAVIGATION_LIST?n=ev(n,e.ref,e.children):n[t]=e}return Z_(n)}function Z_(e){let t;try{t=ya.isDevelopment()}catch{t=!1}if(!t)return e;let n=new Map,r=(e,t)=>{for(let i of e??[]){let e=$_(i),a=n.get(e)??[];a.push(t),n.set(e,a),r(i.children,t)}};for(let t of e)t.contentKind===ze.NAVIGATION_LIST&&r(t.children,t.ref);for(let[e,t]of n)t.length>1&&console.warn(`[sidebar sections] Launcher target "${e}" appears ${t.length} times in the merged sidebar (sections: ${t.join(`, `)}). Only one occurrence will highlight as active. If this duplication is unintentional, remove the extra item from one of the contributing configs.`);return e}function Q_(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 $_(e){switch(e.kind){case mu.RESOURCE_OPERATION:return`resource_operation:${e.resourceType}:${e.operation}:${e.operationVariant??`default`}`;case mu.VIEW:return`${e.kind}:${e.viewRef}`;case mu.RESOURCE_VIEW:return`${e.kind}:${e.resourceType}:${e.viewRef}`;case mu.ENGINE_PAGE:return`engine_page:${e.pageRef}`;case mu.CUSTOM_COMPONENT:return`custom_component:${e.componentRef}`;case mu.SETTINGS_SECTION:return`settings_section:${e.sectionRef??`default`}`;default:throw Error(`launcherItemRefKey: no key for launcher item kind ${e.kind}`)}}function ev(e,t,n){return e?.length?n.length?e.map(e=>{if(e.ref!==t||e.contentKind!==ze.NAVIGATION_LIST)return e;let r=e,i=new Set(r.children.map($_)),a=n.filter(e=>!i.has($_(e)));return a.length===0?e:{...r,children:[...r.children,...a]}}):[...e]:e??[]}function tv(e,t){return e?.length?t?.length?K_(e,t,$_):[...e]:[...t??[]]}function nv(e,t){return e?.length?t?.length?K_(e,t,e=>`${$_(e)}:${e.group??`default`}`):[...e]:[...t??[]]}function rv(e,t){return e?.length?t?.length?K_(e,t,e=>e.ref):[...e]:[...t??[]]}function Ase(...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 iv(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.fieldIdentifier,r);return Array.from(n.values())}function av(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 ov(e){let t=new Map,n=[];for(let r of e)for(let e of r.componentRegistrations??[]){let i=e.preset??q.DEFAULT,a=`${e.componentRef}\u0000${i}`,o=t.get(a);o&&n.push({componentRef:e.componentRef,preset:i,replacedModuleId:o.moduleId,byModuleId:r.moduleId}),t.set(a,{registration:e,moduleId:r.moduleId})}return{registrations:Array.from(t.values(),e=>e.registration),replaced:n}}function jse(...e){return{moduleIds:e.map(e=>e.moduleId),resourceUIBehavior:Object.assign({},...e.map(e=>e.resourceUIBehavior??{})),sidebarSections:e.reduce((e,t)=>X_(e,t.sidebarSections),[]),quickSwitcherFields:e.reduce((e,t)=>iv(e,t.quickSwitcherFields??[]),[]),compositeViews:e.flatMap(e=>bp(e.compositeViews))}}function sv(...e){return{...jse(...e),menubarItems:e.flatMap(e=>e.menubarItems??[]),commandMenuItems:e.reduce((e,t)=>tv(e,t.commandMenuItems),[]),sidebarSectionItems:e.flatMap(e=>e.sidebarSectionItems??[]),appScope:e.reduce((e,t)=>({...e,...t.appScope,fields:iv(e.fields??[],t.appScope?.fields??[])}),{}),fullCustomViews:e.reduce((e,t)=>rv(e,t.fullCustomViews),[]),onboardingViews:av([],e.flatMap(e=>e.onboardingViews??[]),e=>e.ref),guidanceFlows:av([],e.flatMap(e=>e.guidanceFlows??[]),e=>e.ref),flowsActorsViews:av([],e.flatMap(e=>e.flowsActorsViews??[]),e=>e.ref),componentRegistrations:Mse(e)}}function Mse(e){let{registrations:t,replaced:n}=ov(e);for(let e of n)rs.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 cv(e){let t=iv(e.appScope.fields??[],e.quickSwitcherFields);return t.length===0?e.appScope:{...e.appScope,fields:t}}function lv(e,t){let n=Y_(e,t.sidebarSections);return t.sidebarSectionItems.reduce((e,t)=>ev(e,t.sectionRef,t.items),n)}function uv(e,t){let n=e[Fr.MENUBAR],r=e[Fr.SIDEBAR],i=e[Fr.COMMAND_MENU];return{...e,[Fr.MENUBAR]:n&&typeof n==`object`&&!Array.isArray(n)?{...n,items:nv(n.items,t.menubarItems)}:n,[Fr.SIDEBAR]:r&&typeof r==`object`?{...r,contentSections:lv(r.contentSections,t)}:r,[Fr.COMMAND_MENU]:i&&typeof i==`object`?{...i,commands:tv(i.commands,t.commandMenuItems)}:i}}var Q=e(r(),1),dv;(function(e){e.ENGINE_PANEL=`engine_panel`,e.RESOURCE_OPERATION=`resource_operation`,e.CUSTOM_COMPONENT=`custom_component`,e.SUB_TABS=`sub_tabs`})(dv||={});var fv;(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`})(fv||={});var pv;(function(e){e.REPRESENTS=`relationshipRepresents`,e.GRANTS=`relationshipGrants`,e.INVITES=`relationshipInvites`,e.LENDS=`relationshipLends`})(pv||={});function mv(e){return e.currentOrganizationId?e.organizations?.find(t=>t._id===e.currentOrganizationId)?.type:void 0}function hv(e){let t=mv(e),n=Jc(e.organizationRelationships,e.organizationTypes,t),r=n.some(e=>e.side===zc.REPRESENTING);return{[pv.REPRESENTS]:r,[pv.GRANTS]:n.some(e=>e.side===zc.GRANTING),[pv.INVITES]:r&&$re(e.organizationRelationships,t??void 0).length>0,[pv.LENDS]:n.some(t=>t.side===zc.GRANTING&&ms(e.organizationRelationships,t.kind))}}var gv;(function(e){e.ASKS_THE_OPERATOR=`relationshipAsksTheOperator`,e.NAMES_THE_OTHER_ORGANIZATION=`relationshipNamesTheOtherOrganization`})(gv||={});function _v(e){let t=Jc(e.organizationRelationships,e.organizationTypes,mv(e)),n=Rie(e.organizationTypes),r=t=>{let r=e.organizationRelationships?.[t];return r?Fne(r,n).standing:void 0};return{[gv.ASKS_THE_OPERATOR]:t.some(e=>e.side===zc.GRANTING&&r(e.kind)===Vo.OPERATOR_IS_PARTY),[gv.NAMES_THE_OTHER_ORGANIZATION]:t.some(e=>r(e.kind)===Vo.INDEPENDENT_PARTIES)}}var vv;(function(e){e.ENABLED=`scimEnabled`,e.ORGANIZATION_TYPE_ADMITS=`scimOrganizationTypeAdmitsDirectory`,e.SETTINGS_REACHABLE=`scimSettingsReachable`})(vv||={});function yv(e){return e.organizationTypeKnown&&!(e.featureOffered&&e.organizationTypeDirectoryProvisioned)}function bv(e){let t=e.featureOffered&&e.organizationTypeDirectoryProvisioned;return{[vv.ENABLED]:t,[vv.ORGANIZATION_TYPE_ADMITS]:e.organizationTypeDirectoryProvisioned,[vv.SETTINGS_REACHABLE]:t||e.holdsUnrevokedToken}}var xv=[kl.ORG_OWNER,kl.ORG_ADMIN],Sv=[ir.APP_ADMIN_SUPER_ADMIN],Cv=`billingEnabled`,wv=`professionalQualificationsDeclared`,Tv=[{ref:nc.PROFILE,icon:H.PROFILE,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.USER_SELF_PROFILES,operation:W.READ}},{ref:nc.SECURITY,icon:H.LOCK,target:{kind:dv.ENGINE_PANEL,panelRef:fv.SECURITY}},{ref:nc.APPEARANCE,icon:H.PALETTE,target:{kind:dv.ENGINE_PANEL,panelRef:fv.APPEARANCE}},{ref:nc.PREFERENCES,icon:H.SLIDERS,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.USER_SELF_PREFERENCES,operation:W.READ}},{ref:nc.MY_INVITATIONS,icon:H.MAIL,target:{kind:dv.ENGINE_PANEL,panelRef:fv.INVITATIONS}},{ref:nc.DEACTIVATE_ACCOUNT,icon:H.USER_COG,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.USER_SELF,operation:Cn.DEACTIVATE_ACCOUNT}},{ref:nc.MY_PROVIDER_CREDENTIALS,icon:H.PLUG,target:{kind:dv.ENGINE_PANEL,panelRef:fv.CONNECTED_ACCOUNTS}},{ref:nc.AUTHORIZED_APPS,icon:H.THIRD_PARTY_APP,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.OAUTH_CONSENT_GRANTS,operation:W.LIST}},{ref:nc.MY_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.DATA_SUBJECT_REQUESTS,operation:W.LIST}},{ref:nc.MY_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.USER_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:nc.ORGANIZATION_GENERAL,icon:H.ORGANIZATION,requiredRoles:xv,target:{kind:dv.SUB_TABS,subTabs:[{ref:`organization-general-record`,label:`Organization`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATIONS,operation:W.READ}},{ref:`organization-general-profile`,label:`Profile`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_PROFILES,operation:W.READ}},{ref:`organization-general-preferences`,label:`Preferences`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_PREFERENCES,operation:W.READ}},{ref:`organization-general-notifications`,label:`Notifications`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_NOTIFICATIONS,operation:W.READ}}]}},{ref:nc.MEMBERS,icon:H.USERS,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_MEMBERS,operation:W.LIST}},{ref:nc.ORGANIZATION_UNITS,icon:H.HIERARCHY,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_UNITS,operation:W.LIST}},{ref:nc.BILLING,icon:H.CREDIT_CARD,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[Cv]},target:{kind:dv.ENGINE_PANEL,panelRef:fv.BILLING}},{ref:nc.API_KEYS,icon:H.KEY,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORG_API_KEYS,operation:W.LIST}},{ref:nc.ORGANIZATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.OAUTH_CLIENTS_ORGANIZATION,operation:W.LIST}},{ref:nc.PROVIDER_CREDENTIALS,icon:H.PLUG,requiredRoles:xv,target:{kind:dv.ENGINE_PANEL,panelRef:fv.ORGANIZATION_CONNECTED_ACCOUNTS}},{ref:nc.SSO,icon:H.LOGIN,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[`ssoEnabled`]},entitlementFeatureId:Ds.SINGLE_SIGN_ON,target:{kind:dv.SUB_TABS,subTabs:[{ref:`sso-configuration`,label:`Configuration`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SSO_CONFIG,operation:W.READ}},{ref:`sso-connections`,label:`Connections`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:nc.SCIM,icon:H.USER_COG,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[vv.SETTINGS_REACHABLE]},entitlementFeatureId:Ds.DIRECTORY_PROVISIONING,target:{kind:dv.SUB_TABS,subTabs:[{ref:`scim-provisioning`,label:`Provisioning`,runtimeAvailability:{requiredCapabilities:[vv.ENABLED]},target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:`scim-tokens`,label:`Tokens`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SCIM_TOKENS,operation:W.LIST}}]}},{ref:nc.SIEM,icon:H.ACTIVITY,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[`siemEnabled`]},entitlementFeatureId:Ds.SECURITY_EVENT_EXPORT,target:{kind:dv.SUB_TABS,subTabs:[{ref:`siem-export`,label:`Export`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:nc.WEBHOOKS,icon:H.WEBHOOK,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[`webhooksEnabled`]},entitlementFeatureId:Ds.M2M_WEBHOOK_DELIVERY,target:{kind:dv.SUB_TABS,subTabs:[{ref:`webhooks-endpoints`,label:`Endpoints`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`webhooks-delivery-log`,label:`Delivery log`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:nc.INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:nc.AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:nc.RELATIONSHIPS,icon:H.HANDSHAKE,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[pv.GRANTS]},target:{kind:dv.SUB_TABS,subTabs:[{ref:`relationships-organizations`,label:`Organizations`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_RELATIONSHIPS,operation:W.LIST}},{ref:`relationships-delegated-capabilities`,label:`Delegated capabilities`,runtimeAvailability:{requiredCapabilities:[pv.LENDS]},target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.RELATIONSHIP_CAPABILITY_GRANTS,operation:W.LIST}}]}},{ref:nc.REPRESENTATIONS,icon:H.BRIEFCASE,requiredRoles:xv,runtimeAvailability:{requiredCapabilities:[pv.REPRESENTS]},target:{kind:dv.SUB_TABS,subTabs:[{ref:`representations-organizations`,label:`Organizations`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_REPRESENTATIONS,operation:W.LIST}},{ref:`representations-invitations`,label:`Invitations`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.RELATIONSHIP_INVITATIONS,operation:W.LIST}},{ref:`representations-model-cost`,label:`Model cost`,target:{kind:dv.ENGINE_PANEL,panelRef:fv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN}},{ref:`representations-activity`,label:`Activity`,target:{kind:dv.ENGINE_PANEL,panelRef:fv.REPRESENTATIVE_ACTIVITY}}]}},{ref:nc.AUDIT_LOGS,icon:H.SCROLL,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.AUDIT_LOGS,operation:W.LIST}},{ref:nc.OPERATOR_ACCESS,icon:H.SHIELD,requiredRoles:[...xv,kl.ORG_DELEGATED_APPROVE_ACCESS_GRANTS],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.PLATFORM_ACCESS_GRANTS,operation:W.LIST}},{ref:nc.ORGANIZATION_ENTITLEMENTS,icon:H.BADGE_CHECK,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_FEATURES,operation:W.READ}},{ref:nc.ORGANIZATION_REFERRALS,icon:H.GIFT,requiredRoles:[kl.ORG_OWNER],runtimeAvailability:{requiredCapabilities:[Cv]},target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.REFERRALS,operation:W.LIST}},{ref:nc.ORGANIZATION_LEGAL_HOLDS,icon:H.SCALE,requiredRoles:[kl.ORG_OWNER],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.LEGAL_HOLDS,operation:W.LIST}},{ref:nc.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,icon:H.BADGE_CHECK,requiredRoles:[kl.ORG_ADMIN],runtimeAvailability:{requiredCapabilities:[wv]},target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.PROFESSIONAL_QUALIFICATIONS,operation:W.LIST}},{ref:nc.EMAIL_DOMAINS,icon:H.GLOBE,requiredRoles:xv,requiredEngineCapabilities:[Pd.EMAIL_INBOUND],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_EMAIL_DOMAINS,operation:W.LIST}},{ref:nc.CUSTOM_DOMAINS,icon:H.GLOBE,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_CUSTOM_DOMAINS,operation:W.LIST}},{ref:nc.RELATIONSHIP_MAILBOXES,icon:H.MAILBOX,requiredRoles:xv,requiredEngineCapabilities:[Pd.EMAIL_INBOUND],runtimeAvailability:{requiredCapabilities:[pv.REPRESENTS]},target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.RELATIONSHIP_MAILBOXES,operation:W.LIST}},{ref:nc.CHAT_ACCOUNTS,icon:H.CHAT,requiredRoles:xv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.CHAT_IDENTITY_LINKS,operation:W.LIST}},{ref:nc.MY_CHAT_ACCOUNTS,icon:H.CHAT,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.CHAT_IDENTITY_LINKS,operation:W.LIST,operationVariant:`own`}},{ref:nc.AGENT_RUNS,icon:H.BRAIN,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:nc.AUTONOMOUS_AGENTS,icon:H.CLOCK,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.ENGINE_PANEL,panelRef:fv.AUTONOMOUS_AGENTS}},{ref:nc.CHAT_AGENTS,icon:H.CHAT,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_CHAT_SETTINGS,operation:W.LIST}},{ref:nc.AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.SUB_TABS,subTabs:[{ref:`agent-work-override-rate`,label:`Override rate`,target:{kind:dv.ENGINE_PANEL,panelRef:fv.AGENT_WORK_OVERRIDE_RATE}},{ref:`agent-work-decisions`,label:`Decisions`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:`agent-behavior-reports`,label:`Reports`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.AGENT_BEHAVIOR_REPORTS,operation:W.LIST}},{ref:`agent-work-content-capture`,label:`Content capture`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.AGENT_WORK_CAPTURE_SETTINGS,operation:W.READ}},{ref:`agent-work-export-authorization`,label:`Export authorisation`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.EVALUATION_EXPORT_AUTHORIZATIONS,operation:W.READ}},{ref:`agent-work-run-export`,label:`Run an export`,target:{kind:dv.ENGINE_PANEL,panelRef:fv.AGENT_WORK_EVALUATION_EXPORT}},{ref:`agent-work-exports`,label:`Exports`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.EVALUATION_DATASET_EXPORTS,operation:W.LIST}}]}},{ref:nc.AGENT_POLICY,icon:H.BRAIN,requiredRoles:xv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_AGENT_POLICIES,operation:W.READ}},{ref:nc.APPLICATION_GENERAL,icon:H.APP_WINDOW,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_METADATA,operation:W.READ}},{ref:nc.APPLICATION_VERSIONS,icon:H.HISTORY,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_VERSIONS,operation:W.LIST}},{ref:nc.APPLICATION_ENTITLEMENTS,icon:H.BADGE_CHECK,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_FEATURES,operation:W.READ}},{ref:nc.APPLICATION_API_KEYS,icon:H.KEY,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_API_KEYS,operation:W.LIST}},{ref:nc.APPLICATION_SSO,icon:H.LOGIN,requiredRoles:Sv,target:{kind:dv.SUB_TABS,subTabs:[{ref:`application-sso-configuration`,label:`Configuration`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_SSO_CONFIG,operation:W.READ}},{ref:`application-sso-connections`,label:`Connections`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:nc.APPLICATION_SCIM,icon:H.USER_COG,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:nc.APPLICATION_SIEM,icon:H.ACTIVITY,requiredRoles:Sv,target:{kind:dv.SUB_TABS,subTabs:[{ref:`application-siem-export`,label:`Export`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`application-siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:nc.APPLICATION_WEBHOOKS,icon:H.WEBHOOK,requiredRoles:Sv,target:{kind:dv.SUB_TABS,subTabs:[{ref:`application-webhooks-endpoints`,label:`Endpoints`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`application-webhooks-delivery-log`,label:`Delivery log`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:nc.BILLING_CATALOG,icon:H.PACKAGE,requiredRoles:Sv,runtimeAvailability:{requiredCapabilities:[Cv]},target:{kind:dv.SUB_TABS,subTabs:[{ref:`billing-catalog-products`,label:`Products`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.PRODUCTS,operation:W.LIST}},{ref:`billing-catalog-promotions`,label:`Promotions`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.PROMOTIONS,operation:W.LIST}}]}},{ref:nc.APPLICATION_PROVIDER_CONNECTIONS,icon:H.PLUG,requiredRoles:Sv,target:{kind:dv.ENGINE_PANEL,panelRef:fv.APPLICATION_CONNECTED_ACCOUNTS}},{ref:nc.APPLICATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.OAUTH_CLIENTS_APPLICATION,operation:W.LIST}},{ref:nc.APPLICATION_ACCESS_GRANTS,icon:H.SHIELD,requiredRoles:Sv,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_ACCESS_GRANTS,operation:W.LIST}},{ref:nc.APPLICATION_ORGANIZATIONS,icon:H.ORGANIZATION,requiredRoles:Sv,target:{kind:dv.SUB_TABS,subTabs:[{ref:`application-organizations-directory`,label:`All organizations`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.ORGANIZATIONS,operation:W.LIST,operationVariant:Jte.DIRECTORY}},{ref:`application-organizations-access-grants`,label:`Access windows`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:nc.APPLICATION_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:dv.SUB_TABS,subTabs:[{ref:`application-data-subject-requests-queue`,label:`Requests to answer`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.DATA_SUBJECT_REQUESTS,operation:Vt.OPERATOR_QUEUE}},{ref:`application-data-subject-requests-access-grants`,label:`Access windows`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:nc.APPLICATION_INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:nc.APPLICATION_SMS_NUMBERS,icon:H.SMARTPHONE,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Pd.SMS],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.SMS_NUMBER_ASSIGNMENTS,operation:W.LIST}},{ref:nc.APPLICATION_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:nc.APPLICATION_AGENT_RUNS,icon:H.BRAIN,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:nc.APPLICATION_AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:nc.APPLICATION_AGENT_POLICY,icon:H.BRAIN,requiredRoles:Sv,requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_AGENT_POLICIES,operation:W.READ}},{ref:nc.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,icon:H.ORGANIZATION,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.SYSTEM_OF_RECORD_PARTITION_ASSIGNMENTS,operation:W.LIST}},{ref:nc.APPLICATION_MODEL_COSTS,icon:H.RECEIPT,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_ADMIN_BILLING_MANAGER],requiredEngineCapabilities:[Pd.AI_LLM],target:{kind:dv.SUB_TABS,subTabs:[{ref:`model-costs-by-month`,label:`By month`,target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.MODEL_COST_PERIOD_AGGREGATES,operation:W.LIST}},{ref:`model-costs-breakdown`,label:`Breakdown`,target:{kind:dv.ENGINE_PANEL,panelRef:fv.MODEL_COST_BREAKDOWN}}]}},{ref:nc.APPLICATION_RETENTION_ENFORCEMENT,icon:H.CLOCK,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_AUDIT_EVIDENCE_READER],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.RETENTION_ENFORCEMENT_RECORDS,operation:W.LIST}},{ref:nc.APPLICATION_AUDIT_LOGS,icon:H.SCROLL,requiredRoles:[ir.APP_ADMIN_SUPER_ADMIN,ir.APP_AUDIT_EVIDENCE_READER],target:{kind:dv.RESOURCE_OPERATION,resourceType:ll.APPLICATION_AUDIT_LOGS,operation:W.LIST}}],Ev=[{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}],Nse={categories:[{ref:`account`,label:`Account`,scope:Vr.USER_SELF,order:0},{ref:`organization`,label:`Organization`,scope:Vr.ORGANIZATIONS,order:1,groups:Ev},{ref:`administration`,label:`Administration`,scope:Vr.APPLICATION,order:2,groups:Ev}],placements:[{destinationRef:nc.PROFILE,categoryRef:`account`,label:`Profile`,order:0},{destinationRef:nc.SECURITY,categoryRef:`account`,label:`Security`,order:1},{destinationRef:nc.APPEARANCE,categoryRef:`account`,label:`Appearance`,order:2},{destinationRef:nc.PREFERENCES,categoryRef:`account`,label:`Preferences`,order:3},{destinationRef:nc.MY_INVITATIONS,categoryRef:`account`,label:`Invitations`,order:4},{destinationRef:nc.MY_PROVIDER_CREDENTIALS,categoryRef:`account`,label:`Integrations`,order:5},{destinationRef:nc.AUTHORIZED_APPS,categoryRef:`account`,label:`Authorized apps`,order:6},{destinationRef:nc.MY_AGENT_PUSH_DELIVERIES,categoryRef:`account`,label:`Agent push deliveries`,order:7},{destinationRef:nc.MY_DATA_SUBJECT_REQUESTS,categoryRef:`account`,label:`Data requests`,order:8},{destinationRef:nc.DEACTIVATE_ACCOUNT,categoryRef:`account`,label:`Deactivate account`,order:9},{destinationRef:nc.ORGANIZATION_GENERAL,categoryRef:`organization`,label:`General`,order:0},{destinationRef:nc.MEMBERS,categoryRef:`organization`,groupRef:`people`,label:`Members`,order:1},{destinationRef:nc.ORGANIZATION_UNITS,categoryRef:`organization`,groupRef:`people`,label:`Organization units`,order:2},{destinationRef:nc.ORGANIZATION_ENTITLEMENTS,categoryRef:`organization`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:nc.BILLING,categoryRef:`organization`,groupRef:`billing`,label:`Billing`,order:4},{destinationRef:nc.ORGANIZATION_REFERRALS,categoryRef:`organization`,groupRef:`billing`,label:`Referrals`,order:5},{destinationRef:nc.API_KEYS,categoryRef:`organization`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:nc.ORGANIZATION_OAUTH_CLIENTS,categoryRef:`organization`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:nc.PROVIDER_CREDENTIALS,categoryRef:`organization`,groupRef:`integrations`,label:`Integrations`,order:8},{destinationRef:nc.SSO,categoryRef:`organization`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:9},{destinationRef:nc.SCIM,categoryRef:`organization`,groupRef:`security`,label:`SCIM provisioning`,order:10},{destinationRef:nc.SIEM,categoryRef:`organization`,groupRef:`compliance`,label:`SIEM export`,order:11},{destinationRef:nc.WEBHOOKS,categoryRef:`organization`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:nc.AGENT_PUSH_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:nc.AUDIT_LOGS,categoryRef:`organization`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:nc.OPERATOR_ACCESS,categoryRef:`organization`,groupRef:`security`,label:`Operator access`,order:15},{destinationRef:nc.INBOUND_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Inbound deliveries`,order:16},{destinationRef:nc.RELATIONSHIPS,categoryRef:`organization`,groupRef:`people`,label:`Relationships`,order:17},{destinationRef:nc.REPRESENTATIONS,categoryRef:`organization`,groupRef:`people`,label:`Representations`,order:18},{destinationRef:nc.ORGANIZATION_LEGAL_HOLDS,categoryRef:`organization`,groupRef:`compliance`,label:`Legal holds`,order:19},{destinationRef:nc.EMAIL_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Email domains`,order:20},{destinationRef:nc.RELATIONSHIP_MAILBOXES,categoryRef:`organization`,groupRef:`integrations`,label:`Relationship mailboxes`,order:21},{destinationRef:nc.MY_CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`My chat accounts`,order:22},{destinationRef:nc.CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`Chat accounts`,order:23},{destinationRef:nc.AGENT_WORK_REVIEW,categoryRef:`organization`,groupRef:`ai`,label:`Agent work review`,order:24},{destinationRef:nc.AGENT_RUNS,categoryRef:`organization`,groupRef:`ai`,label:`Agent runs`,order:25},{destinationRef:nc.AUTONOMOUS_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Autonomous agents`,order:26},{destinationRef:nc.CHAT_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Chat agents`,order:27},{destinationRef:nc.AGENT_POLICY,categoryRef:`organization`,groupRef:`ai`,label:`Agent policy`,order:28},{destinationRef:nc.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,categoryRef:`organization`,groupRef:`people`,label:`Professional qualifications`,order:29},{destinationRef:nc.CUSTOM_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Custom domains`,order:30},{destinationRef:nc.APPLICATION_GENERAL,categoryRef:`administration`,label:`General`,order:0},{destinationRef:nc.APPLICATION_ORGANIZATIONS,categoryRef:`administration`,label:`Organizations`,order:1},{destinationRef:nc.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,categoryRef:`administration`,label:`System-of-record partitions`,order:2},{destinationRef:nc.APPLICATION_ENTITLEMENTS,categoryRef:`administration`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:nc.BILLING_CATALOG,categoryRef:`administration`,groupRef:`billing`,label:`Plans & pricing`,order:4},{destinationRef:nc.APPLICATION_MODEL_COSTS,categoryRef:`administration`,groupRef:`billing`,label:`Model costs`,order:5},{destinationRef:nc.APPLICATION_API_KEYS,categoryRef:`administration`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:nc.APPLICATION_OAUTH_CLIENTS,categoryRef:`administration`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:nc.APPLICATION_SSO,categoryRef:`administration`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:8},{destinationRef:nc.APPLICATION_SCIM,categoryRef:`administration`,groupRef:`security`,label:`SCIM provisioning`,order:9},{destinationRef:nc.APPLICATION_SIEM,categoryRef:`administration`,groupRef:`compliance`,label:`SIEM export`,order:10},{destinationRef:nc.APPLICATION_PROVIDER_CONNECTIONS,categoryRef:`administration`,groupRef:`integrations`,label:`Integrations`,order:11},{destinationRef:nc.APPLICATION_WEBHOOKS,categoryRef:`administration`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:nc.APPLICATION_AGENT_PUSH_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:nc.APPLICATION_AUDIT_LOGS,categoryRef:`administration`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:nc.APPLICATION_ACCESS_GRANTS,categoryRef:`administration`,groupRef:`security`,label:`Access grants`,order:15},{destinationRef:nc.APPLICATION_VERSIONS,categoryRef:`administration`,label:`Versions`,order:16},{destinationRef:nc.APPLICATION_INBOUND_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Inbound deliveries`,order:17},{destinationRef:nc.APPLICATION_RETENTION_ENFORCEMENT,categoryRef:`administration`,groupRef:`compliance`,label:`Retention enforcement`,order:18},{destinationRef:nc.APPLICATION_AGENT_WORK_REVIEW,categoryRef:`administration`,groupRef:`ai`,label:`Agent work review`,order:19},{destinationRef:nc.APPLICATION_AGENT_RUNS,categoryRef:`administration`,groupRef:`ai`,label:`Agent runs`,order:20},{destinationRef:nc.APPLICATION_AGENT_POLICY,categoryRef:`administration`,groupRef:`ai`,label:`Agent policy`,order:21},{destinationRef:nc.APPLICATION_DATA_SUBJECT_REQUESTS,categoryRef:`administration`,groupRef:`compliance`,label:`Data subject requests`,order:22},{destinationRef:nc.APPLICATION_SMS_NUMBERS,categoryRef:`administration`,groupRef:`integrations`,label:`SMS numbers`,order:23}],defaultSectionRef:`profile`},Dv=new Map(Tv.map(e=>[e.ref,e]));function Ov(e){let t=new Map(Dv),n=new Set,r=[],i=[];for(let a of e?.destinations??[])Dv.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 kv(e){if(e===void 0)return{categories:[],sections:[]};let t=Ov(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 Av(e){if(e===void 0)return[];let t=Ov(e);return e.placements.map(e=>e.destinationRef).filter(e=>!t.byRef.has(e))}function jv(){let{settingsHub:e}=Rg();return(0,Q.useMemo)(()=>kv(e),[e])}var Mv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Mv||={});var Nv;(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`})(Nv||={});function Pse(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Map,o=(e,r)=>{e.scope===Zp.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 Pv(e,t,n,r,i,a,o){let s=a===`application`?Fse(e.viewRef,r,t,i,e):Ise(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:Mv.ERROR,code:Nv.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 Fse(e,t,n,r,i){return t.duplicateApplicationViewRefs.has(e)?(r.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.VIEW_NOT_FOUND,context:n,message:`Application view "${e}" not found in any compatible special-view definition`,item:i}),null)}function Ise(e,t,n,r){if(!t.resourceConfigurations[e.resourceType])return r.push({severity:Mv.ERROR,code:Nv.RESOURCE_NOT_FOUND,context:n,message:`Resource type "${e.resourceType}" not found in registry`,item:e}),null;if(Ese({resourceType:e.resourceType,viewRef:e.viewRef,registry:t}).length>1)return r.push({severity:Mv.ERROR,code:Nv.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=Xh({resourceType:e.resourceType,viewRef:e.viewRef,registry:t});return i?i.scope===Zp.RESOURCE?{family:i.family}:(r.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.VIEW_NOT_FOUND,context:n,message:`Resource view "${e.viewRef}" is not declared on resource "${e.resourceType}"`,item:e}),null)}function Fv(e,t,n,r,i,a,o){switch(e.kind){case mu.RESOURCE_OPERATION:{let r=n.resourceConfigurations[e.resourceType];if(!r){i.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}" on resource "${e.resourceType}" is ambiguous without an explicit launcher operationVariant`,item:e})}break}case mu.VIEW:Pv(e,t,n,r,i,`application`,o);break;case mu.RESOURCE_VIEW:Pv(e,t,n,r,i,`resource`,o);break;case mu.ENGINE_PAGE:e.pageRef in Pl||i.push({severity:Mv.ERROR,code:Nv.ENGINE_PAGE_NOT_FOUND,context:t,message:`Engine page ref "${e.pageRef}" has no entry in ENGINE_PAGE_METADATA`,item:e});break;case mu.CUSTOM_COMPONENT:o&&!o(e.componentRef)&&i.push({severity:Mv.ERROR,code:Nv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Custom launcher component "${e.componentRef}" is not registered in ComponentRegistryService`,item:e});break;case mu.SETTINGS_SECTION:e.sectionRef!==void 0&&!a.has(e.sectionRef)&&i.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.UNKNOWN_TARGET_KIND,context:t,message:`Unknown LauncherItemTargetKind: "${e.kind}"`,item:e})}}function Iv(e,t,n,r){e.notificationBadgeRef&&!n.notificationBadgeDefinitions.some(t=>Ku(t)===e.notificationBadgeRef)&&r.push({severity:Mv.ERROR,code:Nv.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(Ku).join(`, `)||`(none)`}`,item:e})}function Lv(e,t,n,r,i,a,o){for(let s of e)Fv(s,t,n,r,i,a,o),Iv(s,t,n,i),s.children&&Lv(s.children,`${t}.children`,n,r,i,a,o)}function Lse(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:Mv.WARNING,code:Nv.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:Mv.WARNING,code:Nv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`visibleInModes ref "${t}" does not match any declared appMode`,item:e})}switch(e.contentKind){case ze.NAVIGATION_LIST:Lv(e.children,s,t,n,i,a,o);break;case ze.RESOURCE_BROWSER:{let n=e,r=t.resourceConfigurations[n.resourceType];if(!r){i.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.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:Mv.WARNING,code:Nv.RESOURCE_BROWSER_MISSING_LABEL_CONFIG,context:s,message:`RESOURCE_BROWSER for "${n.resourceType}" has no record label configured (recordLabelFields on the resource, or getFrontendResourceLabel in its frontendConfiguration) — instance labels will fall back to the record's summary fields, then its id`,item:e});break}case ze.GUIDANCE_WIDGET:case ze.CUSTOM_COMPONENT:}}function Rv(e,t,n,r){let i=[],a=t.appComponentsConfiguration,o=Pse(t),s=new Set(kv(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=wm(u);for(let e of d)i.push({severity:Mv.ERROR,code:Nv.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:Mv.ERROR,code:Nv.VIEW_REF_COLLISION,context:`applicationViews`,message:`Application view ref "${e}" is declared by multiple special-view families. View refs must be unique per launcher scope.`,item:e});let f=a[Fr.SIDEBAR];if(typeof f==`object`&&f&&`contentSections`in f){let t=f.contentSections;if(t)for(let r of t)Lse(r,e,o,c,i,s,n)}let p=a[Fr.COMMAND_MENU];if(typeof p==`object`&&p&&`commands`in p){let t=p.commands;if(t)for(let r of t)Fv(r,`command_menu.commands`,e,o,i,s,n)}let m=a[Fr.HOTKEY];if(typeof m==`object`&&m&&`bindings`in m){let t=m.bindings;if(t)for(let r of t)Fv(r,`hotkey.bindings`,e,o,i,s,n)}let h=a[Fr.QUICK_ACTION_BUTTON];if(typeof h==`object`&&h&&`actions`in h){let t=h.actions;if(t)for(let r of t)Fv(r,`quick_action_button.actions`,e,o,i,s,n)}let g=a[Fr.CONTROL_PANEL];if(typeof g==`object`&&g&&`items`in g){let t=g.items;if(t)for(let r of t)Fv(r,`control_panel.items`,e,o,i,s,n)}let _=a[Fr.TOOLBAR];if(typeof _==`object`&&_&&`tools`in _){let t=_.tools;if(t)for(let r of t)Fv(r,`toolbar.tools`,e,o,i,s,n)}let v=a[Fr.MENUBAR];if(typeof v==`object`&&v){if(`hostedComponents`in v){let e=v.hostedComponents;if(e)for(let t of e)t.componentType in a||i.push({severity:Mv.ERROR,code:Nv.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)Fv(r,`menubar.items`,e,o,i,s,n),Iv(r,`menubar.items`,e,i)}}let y=a[Fr.ACTIVITY_BAR];return typeof y==`object`&&y?l.length===0&&i.push({severity:Mv.WARNING,code:Nv.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:Mv.WARNING,code:Nv.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}),Rse(a,r?.organizationRoles,i),{errors:i,isValid:i.length===0}}function Rse(e,t,n){if(!t?.length)return;let r=new Set([...Object.values(ir),...Object.values(kl),...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:Mv.WARNING,code:Nv.REQUIRED_ROLES_UNKNOWN_ROLE,context:t,message:`requiredRoles names "${i}", which is neither a core role nor one of the application's organization roles: nobody holds it, so the entry is shown to none of the roles meant by it. Check the spelling (a custom application-level role is also reported here).`,item:e});Array.isArray(a.children)&&a.children.forEach((e,n)=>i(e,`${t}.children[${n}]`))},a=(t,n)=>{let r=e[t];if(typeof r!=`object`||!r)return[];let i=r[n];return Array.isArray(i)?i:[]};a(Fr.SIDEBAR,`contentSections`).forEach((e,t)=>i(e,`sidebar.contentSections[${t}]`)),a(Fr.COMMAND_MENU,`commands`).forEach((e,t)=>i(e,`command_menu.commands[${t}]`)),a(Fr.HOTKEY,`bindings`).forEach((e,t)=>i(e,`hotkey.bindings[${t}]`)),a(Fr.QUICK_ACTION_BUTTON,`actions`).forEach((e,t)=>i(e,`quick_action_button.actions[${t}]`)),a(Fr.CONTROL_PANEL,`items`).forEach((e,t)=>i(e,`control_panel.items[${t}]`)),a(Fr.TOOLBAR,`tools`).forEach((e,t)=>i(e,`toolbar.tools[${t}]`)),a(Fr.MENUBAR,`items`).forEach((e,t)=>i(e,`menubar.items[${t}]`))}function zv(e){if(e.isValid){console.log(`[LauncherVerification] ✓ All launcher content declarations are valid`);return}let t=e.errors.filter(e=>e.severity===Mv.ERROR).length,n=e.errors.filter(e=>e.severity===Mv.WARNING).length;console.group(`[LauncherVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Mv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}var Bv;(function(e){e.ANSWERER=`decisionInboxAnswerer`})(Bv||={});function Vv(e){let t=e.offer?.answeringRoles??[];if(t.length===0)return!1;let n=e.effectiveRoles,r=n.accessProfile;if(!r)return Nm(t,n);let i=new Set;for(let e of r.roleEntries)if(e.relatedPrimaryScope===Vr.ORGANIZATIONS&&e.relatedResourceId)for(let t of e.roles)i.add(t);return Nm(t,{...n,organizationRoles:[...i]})}function Hv(e){return{[Bv.ANSWERER]:Vv(e)}}var Uv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Uv||={});var Wv;(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`})(Wv||={});var zse={refsShadowingEngineDestinations:[],duplicateApplicationDestinationRefs:[]};function Gv(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 Kv(e,t=[],n=zse){let r=[];e.sections.length===0&&r.push({severity:Uv.ERROR,code:Wv.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:Uv.ERROR,code:Wv.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:Uv.ERROR,code:Wv.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:Uv.ERROR,code:Wv.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 Gv(e.categories.map(e=>e.ref)))r.push({severity:Uv.ERROR,code:Wv.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 Gv(e.sections.map(e=>e.ref)))r.push({severity:Uv.ERROR,code:Wv.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:Uv.ERROR,code:Wv.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 Gv((t.groups??[]).map(e=>e.ref)))r.push({severity:Uv.ERROR,code:Wv.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:Uv.ERROR,code:Wv.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===dv.SUB_TABS)for(let e of Gv(t.target.subTabs.map(e=>e.ref)))r.push({severity:Uv.ERROR,code:Wv.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:Uv.WARNING,code:Wv.DEFAULT_SECTION_REF_UNKNOWN,context:`settingsHub.defaultSectionRef`,message:`Settings Hub defaultSectionRef "${e.defaultSectionRef}" does not match any declared section; the hub will fall back to the first section.`,item:e.defaultSectionRef}),{errors:r,isValid:r.length===0}}function qv(e){if(e.isValid){console.log(`[SettingsHubVerification] ✓ Settings Hub configuration is valid`);return}let t=e.errors.filter(e=>e.severity===Uv.ERROR).length,n=e.errors.filter(e=>e.severity===Uv.WARNING).length;console.group(`[SettingsHubVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Uv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}function Bse(e){return typeof e==`object`&&!!e&&typeof e.reportCrash==`function`}function Vse(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 Hse(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.signInSucceeded==`function`&&typeof t.signInFailed==`function`}function Jv(e){let t=e.operation.initiatorInfos??[];return t.length===0||t.some(t=>{let n=t.parameters??[];return n.length===0||n.every(t=>{let n=[t.fieldIdentifier,t.relationshipField,t.resourceType].filter(e=>typeof e==`string`&&e.length>0);return n.length!==0&&n.some(t=>{if(On.getResourceId(e.contextResourceIdentifiers[t]).length>0)return!0;let n=e.contextualParameters[t];return n!==void 0&&String(n).length>0})})})}function Yv(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 Xv(e){let t=e.registry.resourceConfigurations[e.resourceType]?.operations??[],n=t=>{let n=V.buildContextualParameters(t,e.registry);return e=>Jv({operation:e,contextResourceIdentifiers:t,contextualParameters:n})},r=n(e.scopes.contextResourceIdentifiers),i=e.scopes.previousContextResourceIdentifiers?n(e.scopes.previousContextResourceIdentifiers):void 0;return Ia(t,W.LIST).filter(e=>r(e)||(i?.(e)??!1))}function Use(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 Wse(e){let t=e._version;return typeof t==`number`||typeof t==`string`&&/^\d+$/.test(t)}function Zv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Qv(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=L_({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:Zv(e.row)??Zv(e.previousRow),previousRow:Zv(e.row)?Zv(e.previousRow):void 0,normalizeId:Use,isStoredRow:Wse,typeOfFieldIdentifier:e=>n.fieldIdentifierToResourceType?.[e]}),s=Yv(t,o.contextResourceIdentifiers,n);return o.previousContextResourceIdentifiers?{contextResourceIdentifiers:s,previousContextResourceIdentifiers:Yv(t,o.previousContextResourceIdentifiers,n)}:{contextResourceIdentifiers:s}}function Gse(e){let{emit:t,resourceConfig:n,registry:r,resourceType:i,operation:a,resourceContext:o,isWebSocketConnected:s,result:c}=e,l=Rc(o.additionalContext),u=di(a),d=Vu(o.contextResourceIdentifiers),f=Ae({contextResourceIdentifiers:o.contextResourceIdentifiers,resourceType:i,result:c,isBulkOperation:a.isBulkOperation===!0});if(!Ai(a,s)&&Su(a)){let e=n?.operations?[...n.operations]:[],{[i]:s,...p}=d,m=r?Qv({resourceType:i,registry:r,callContext:o.contextResourceIdentifiers,...a.isBulkOperation===!0?{}:{row:c}}).contextResourceIdentifiers:p,h=r?V.buildContextualParameters(m,r):{},g=Ia(e,W.LIST).filter(e=>Jv({operation:e,contextResourceIdentifiers:r?m:o.contextResourceIdentifiers,contextualParameters:h})),_=g.length>0?g:[null];for(let e of _){let n=e??{operationIdentifier:W.LIST};t(wc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:m,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}})}if(u){let a=Ia(e,W.READ,{requireAddressable:!0}).filter(e=>n&&r?Gh({resourceConfig:n,operation:e,registry:r,hasResourceId:f[i]!==void 0,contextResourceIdentifiers:f,contextualParameters:r?V.buildContextualParameters(f,r):h}):!0),s=a.length>0?a:[null],c=new Set;for(let e of s){let n=e??{operationIdentifier:W.READ},r=[V.getInstance().getResourceId(f[i]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);c.has(r)||(c.add(r),t(wc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:f,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}}))}}}t(wc.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:Yu(c),...l?{optionalDiscriminator:l}:{}})}var $=pg(),$v;(function(e){e.PARENT_RESOURCE_REQUIREMENT=`parent-resource-requirement`,e.ADDITIONAL_RESOURCE_REQUIREMENT=`additional-resource-requirement`})($v||={});var ey;(function(e){e.INITIAL=`initial`,e.REFRESH=`refresh`})(ey||={});function ty(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!==ey.INITIAL&&e.intent!==ey.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 ny;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`})(ny||={});function ry(e){if(e.scope===ny.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 iy(e){if(typeof e==`object`&&e&&e.contentType===od.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 ay(e){if(!e||e.contentType!==od.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 oy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`,e.PARTICIPATION_PREFETCH=`participation-prefetch`})(oy||={});function sy(e){if(e.scope===oy.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===oy.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 cy=(0,Q.createContext)(void 0);function ly(e){if(!e)throw Error(`Execution runtime context must be used within an ExecutionRuntimeProvider.`);return e}var uy=({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)(cy.Provider,{value:u,children:e})};function dy(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 fy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===oy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function py(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.wildoError==`object`&&t.wildoError!==null}function my(e){let t=e.markedByHttpClient??py(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===oy.LOCAL_PANE?{...r,scope:e.scope,paneId:e.paneId}:e.scope===oy.EMBEDDED_CONTENT?{...r,scope:e.scope}:e.scope===oy.PARTICIPATION_PREFETCH?{...r,scope:e.scope,prefetchKey:e.prefetchKey}:{...r,scope:oy.CUSTOM},sy(i),i}function hy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===oy.PARTICIPATION_PREFETCH&&a.prefetchKey===t?n=!0:r[i]=a;return n?r:e}var gy;(function(e){e.SINGLE=`single`,e.ARRAY=`array`})(gy||={});function Kse(e){return e.foreignKeyField??e.resourceType}function _y(e){let t=(e.requirements??[]).filter(t=>Kse(t)===e.bindingKey);return t.length===1?t[0]:void 0}function qse(e,t){let n=t.resourceConfigurations[e]?.resourceRelationships;if(!n)return[];let r=(e,t)=>Bl.ensureCompiledRelationship.call(Bl,e,t);return[...n.parentRelationships,...n.childRelationships,...n.selfRelationships].map(e=>r(e,t.allResourceFieldIdentifiers))}function vy(e){let t=_y({bindingKey:e.bindingKey,requirements:e.requirements});if(t)return{ref:e.ref,source:e.source,requirement:t,contextValue:e.contextResourceIdentifiers?.[e.bindingKey]}}function Jse(e){let t=by(e.sourceParticipation);if(t===e.definition.targetResourceType)return;let n=qse(t,e.registry).filter(n=>{if(n.resourceType1!==e.definition.targetResourceType&&n.resourceType2!==e.definition.targetResourceType||e.definition.foreignKeyField&&Bl.tryResolveRelationshipForeignKeyIdentity(n,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==e.definition.foreignKeyField)return!1;let r=n.resourceType1===t?e.sourceResourceData:void 0;return Bl.isRelationshipActiveForParent(n,r,{onMissingParentResource:`exclude`,onConditionError:`exclude`})});if(n.length===1)return{ref:e.ref,source:Om.RELATIONSHIP_PROJECTION,fromParticipationRef:e.definition.fromParticipationRef,relationship:n[0],currentResourceType:t}}function Yse(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 Om.ANCHOR:if(e.anchor){let t=e.explicitContextResourceIdentifiers?.[e.anchor.bindingKey];if(t){let n=e.viewDefinition.anchor?.source===Em.PARENT_RESOURCE_REQUIREMENT?e.viewDefinition.parentResourcesRequirements:e.viewDefinition.additionalResourceRequirements;c={ref:a,source:Om.ANCHOR,resourceType:e.anchor.mainResourceType,bindingKey:e.anchor.bindingKey,requirement:_y({bindingKey:e.anchor.bindingKey,requirements:n}),contextValue:t}}}break;case Om.PARENT_RESOURCE_REQUIREMENT:c=vy({ref:a,source:Om.PARENT_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.parentResourcesRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Om.ADDITIONAL_RESOURCE_REQUIREMENT:c=vy({ref:a,source:Om.ADDITIONAL_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.additionalResourceRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Om.RELATIONSHIP_PROJECTION:{let t=i(s.fromParticipationRef);t&&(c=Jse({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 yy(e){if(e.source===Om.ANCHOR||e.source===Om.PARENT_RESOURCE_REQUIREMENT||e.source===Om.ADDITIONAL_RESOURCE_REQUIREMENT)return e.contextValue}function by(e){if(e.source===Om.ANCHOR)return e.resourceType;if(e.source===Om.PARENT_RESOURCE_REQUIREMENT||e.source===Om.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.resourceType;if(e.source===Om.RELATIONSHIP_PROJECTION){let t=e.relationship;return t.resourceType1===e.currentResourceType?t.resourceType2:t.resourceType1}throw Error(`Unknown execution participation source`)}function Xse(e){let t=yy(e),n=On.getResourceId(t);return n.length>0?n:void 0}function xy(e){if(e.source===Om.PARENT_RESOURCE_REQUIREMENT||e.source===Om.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement}function Sy(e){return e.source===Om.RELATIONSHIP_PROJECTION?e.relationship:void 0}function Zse(e){let t=Sy(e);return t?Bl.getResolvedRelationshipSemantics(t):void 0}function Qse(e,t){let n=Sy(e);return n?Bl.tryResolveRelationshipForeignKeyIdentity(n,t):void 0}function $se(e,t){if(e.source===Om.PARENT_RESOURCE_REQUIREMENT||e.source===Om.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.relationshipEdgeKey;if(e.source!==Om.RELATIONSHIP_PROJECTION)return;let n=Qse(e,t.allResourceFieldIdentifiers);return V.buildRelationshipEdgeKey({parentResourceType:e.relationship.resourceType1,childResourceType:e.relationship.resourceType2,foreignKeyField:n?.fieldIdentifier??e.relationship.foreignKeyField})}function ece(e){if(e.source!==Om.RELATIONSHIP_PROJECTION)return gy.SINGLE;let t=e.relationship.resourceType1===e.currentResourceType?e.relationship.cardinality2:e.relationship.cardinality1;return Ct(t)?gy.SINGLE:gy.ARRAY}function Cy(e){let t=yy(e.participation);if(!t)return;let n=On.getResourceId(t);if(!n)return;let r=by(e.participation),i=V.getResourceFieldIdentifierForType(r,e.registry),a=On.getFieldIdentifier(t),o=e.participation.source===Om.ANCHOR?e.participation.requirement?.foreignKeyField:xy(e.participation)?.foreignKeyField,s=a??o;return s&&s!==i?{fieldIdentifier:s,resourceId:n}:n}function tce(e){let t={};for(let n of e.participationRefs){let r=e.participations[n];if(!r)throw V.buildConfigurationError(ql.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Unknown execution participation ref "${n}".`,participationRef:n});let i=Cy({participation:r,registry:e.registry});if(!i)continue;let a=On.getResourceId(i);if(!a)continue;let o=On.getFieldIdentifier(i)??V.getResourceFieldIdentifierForType(by(r),e.registry),s=t[o];if(s!==void 0&&s!==a)throw V.buildConfigurationError(ql.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 nce(e){return{participation:e.participation,resourceType:by(e.participation),resourceId:Xse(e.participation),valueShape:ece(e.participation),contextValue:yy(e.participation),contextIdentifier:Cy({participation:e.participation,registry:e.registry}),requirement:xy(e.participation),relationship:Zse(e.participation),rawRelationship:Sy(e.participation),edgeKey:$se(e.participation,e.registry)}}function wy(e,t){return V.buildConfigurationError(ql.CONFIGURATION,{message:e,component:`useExecutionResourceOperationContextBuilder`,...t})}function rce(e){return`operationIdentifier`in e}function ice(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 wy(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 ace(e,t,n,r,i,a){if(!e)throw wy(`Execution resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(rce(n)){let o=ice(e,t,n),s=_l(o);if((s===W.READ||s===W.UPDATE||s===W.DELETE)&&o.isBulkOperation!==!0&&!Gh({resourceConfig:e,operation:o,registry:r,hasResourceId:On.getResourceId(i[t])!==``,contextResourceIdentifiers:i,contextualParameters:a}))throw wy(`Execution resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but the current context cannot address it.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return o}let o=n.operationLike===W.READ||n.operationLike===W.UPDATE||n.operationLike===W.DELETE,s=n.requireAddressable||o?lh({resourceConfig:e,operations:e.operations??[],coreOperation:n.operationLike,registry:r,hasResourceId:On.getResourceId(i[t])!==``,allowBulk:n.allowBulk,requireFrontendAddressable:n.requireAddressable===!0,contextResourceIdentifiers:i,contextualParameters:a}):$l(e.operations??[],n.operationLike,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw wy(`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 oce(e){let t=e.currentValue?On.getFieldIdentifier(e.currentValue):void 0;return t?{fieldIdentifier:t,resourceId:e.resourceId}:e.resourceId}function sce(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function cce(e){let t=sce(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 Ty(){let{registry:e}=lm(),t=ly((0,Q.useContext)(cy));return{buildResourceOperationContext:(0,Q.useCallback)(n=>{let r=n.participationRef?t.participations[n.participationRef]:void 0;if(n.participationRef&&!r)throw wy(`Execution resource-operation builder cannot resolve participation "${n.participationRef}".`,{participationRef:n.participationRef});let i=n.resourceType??(r?by(r):void 0);if(!i)throw wy("Execution resource-operation builder requires either `resourceType` or `participationRef`.",{target:n});let a={...t.contextResourceIdentifiers??{},...n.contextResourceIdentifiers??{}};if(r){let t=Cy({participation:r,registry:e});if(!t&&!n.resourceId)throw wy(`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=cce({additionalContext:n.additionalContext,resourceConfig:o}),c=n.resourceId??s;if(c&&!r){let r=t.contextResourceIdentifiers??{};a={...Im({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:i,id:On.getResourceId(r[i])},targetResourceType:i,targetId:c,registry:e}).identifiers,...n.contextResourceIdentifiers??{}}}c&&(a[i]=oce({currentValue:a[i],resourceId:c}));let l=V.buildContextualParameters(a,e),u=ace(o,i,n,e,a,l),d=On.buildParentResourcesRequirements(i,a,e,n.relationshipFieldOverrides);return On.createFrontendResourceOperationContextFromOperation({resourceType:i,operation:u,contextResourceIdentifiers:a,additionalContext:n.additionalContext,parentResourcesRequirements:d})},[t.contextResourceIdentifiers,t.participations,e])}}function lce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-action-${crypto.randomUUID()}`:`execution-action-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Ey(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function uce(){let e=ly((0,Q.useContext)(cy)),{registry:t}=lm(),{buildResourceOperationContext:n}=Ty(),{emit:r}=Ao(),i=(0,Q.useContext)(sm)?.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,nce({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?{}:tce({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=Cy({participation:i,registry:t});if(!a)return n;let o=by(i),s=n[o];if(s){let t=On.getResourceId(s),n=On.getResourceId(a),i=On.getFieldIdentifier(s),c=On.getFieldIdentifier(a);if(t!==n||i!==c)throw V.buildConfigurationError(ql.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=xp({viewDefinition:e.viewDefinition,resourceType:u,operation:d}),_={...zm.createOperationInitiator(e.navigationZone,d),...r.navigationInitiator??{}},v={contentType:od.RESOURCE_OPERATION,resourceContext:l},y=()=>(e.navigation.openEmbeddedContent({content:v,navigationInitiator:_}),!0),b=()=>{if(g===nm.EMBED_LOCALLY)return y();let n=p?Vn.buildOperationFrontendRoutePaths(p,d,t.allResourceFieldIdentifiers):[],i=p&&n.length>0?On.selectMatchingRoutePath(n,l.contextResourceIdentifiers,u,p.resourceFieldIdentifier,l.parentResourcesRequirements).url:void 0;return e.navigation.delegateToParent({content:v,urlPath:i,relationshipTransition:r.relationshipTransition,initiator:{...r.navigationInitiator,sourceOperation:_.sourceOperation,..._.sourceRelationship?{sourceRelationship:_.sourceRelationship}:{},..._.launcher?{launcher:_.launcher}:{}}}),!0},x=Ca.createOperationPathKeyFromOperation(d),S=async n=>{let i=tc({operation:d,requestData:n,additionalContext:l.additionalContext}),s={actionRuntimeId:lce(),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 Gse({emit:a.current,resourceConfig:p,registry:t,resourceType:u,operation:d,resourceContext:l,isWebSocketConnected:o.current,result:n}),n}catch(t){let n=py(t),i=!n;i&&lt.handleError(t,{source:`promise`,resourceType:u,operationIdentifier:f,additionalContext:{executionRuntimeInstanceId:e.runtimeInstanceId,executionViewRef:e.viewDefinition.ref,operationPathKey:x}});let a={failureRuntimeId:Ey(),originatingActionRuntimeId:s.actionRuntimeId,operationPathKey:x,resourceType:u,operationId:f,startedAt:s.startedAt,error:t,markedByHttpClient:n,bridgedByExecutionShell:i},o;o=r.failureScope?.scope===oy.LOCAL_PANE?{...a,scope:r.failureScope.scope,paneId:r.failureScope.paneId}:r.failureScope?.scope===oy.EMBEDDED_CONTENT?{...a,scope:r.failureScope.scope}:{...a,scope:oy.CUSTOM};let c=my(o);throw e.navigation.captureFailedAction(c),t}finally{e.navigation.endPendingAction(s.actionRuntimeId)}},C=()=>{try{return m({resourceType:r.resourceType,resourceId:r.resourceId,participationRef:r.participationRef,contextParticipationRefs:r.contextParticipationRefs,contextResourceIdentifiers:r.contextResourceIdentifiers,relationshipFieldOverrides:r.relationshipFieldOverrides,additionalContext:r.additionalContext,navigationInitiator:r.navigationInitiator,relationshipTransition:r.relationshipTransition,operationLike:W.READ,requireAddressable:!0}).navigate()}catch{return!1}},w=null,T=null,E=()=>{let e=s.current;if(w===e&&T!==null)return T;let t=[];for(let n of Object.values(e.pendingActions))n.operationPathKey===x&&t.push(n);let n=[];for(let t of Object.values(e.failedActions))t.operationPathKey===x&&n.push(t);let i=[];if(r.dirtyPredicate)for(let t of Object.values(e.dirtyMarkers))r.dirtyPredicate(t)&&i.push(t);let a;for(let e of n)(!a||e.capturedAt>a.capturedAt)&&(a=e);return T={pendingActions:t,failedActions:n,dirtyMarkers:i,isPending:t.length>0,isErrored:n.length>0,isDirty:i.length>0,latestFailure:a},w=e,T},D=()=>{let t=s.current;for(let n of Object.values(t.failedActions))n.operationPathKey===x&&e.navigation.clearFailedAction(n.failureRuntimeId)};return{target:c,resourceContext:l,resourceType:u,operation:d,operationId:f,operationPathKey:x,contextualParameters:h,navigationHandlingMode:g,get status(){return E()},execute:S,embed:y,navigate:b,navigateToRead:C,retry:async e=>(D(),S(e)),clearMyFailures:D,clearMyDirty:()=>{if(!r.dirtyPredicate)return;let t=s.current;for(let n of Object.values(t.dirtyMarkers))r.dirtyPredicate(n)&&e.navigation.clearDirty(n.markerId)}}},[n,e.doOperation,e.navigation,e.participations,e.viewDefinition,t]),h=(0,Q.useMemo)(()=>({all:c,get:l,require:f}),[l,c,f]),g=(0,Q.useCallback)(e=>Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=e=>{let n={...t,...e,contextResourceIdentifiers:{...t.contextResourceIdentifiers??{},...e?.contextResourceIdentifiers??{}},additionalContext:{...t.additionalContext??{},...e?.additionalContext??{}},navigationInitiator:{...t.navigationInitiator??{},...e?.navigationInitiator??{}}};return m(n)};return[e,{execute:(e,t)=>n(e).execute(t),embed:e=>n(e).embed(),navigate:e=>n(e).navigate(),navigateToRead:e=>n(e).navigateToRead(),bind:e=>n(e)}]})),[m]),_=(0,Q.useMemo)(()=>({operation:m,dictionary:g}),[g,m]),v=(0,Q.useMemo)(()=>({open:e.navigation.openEmbeddedContent,close:e.navigation.closeEmbeddedContent,openResource:e=>m(e).embed()}),[m,e.navigation.closeEmbeddedContent,e.navigation.openEmbeddedContent]),y=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.pendingActions),n=Object.values(e.runtimeState.participationPrefetchActions),r=t.length>0,i=n.length>0;return{pendingActions:t,participationPrefetchActions:n,isBusy:r||i,isAnyPending:r,isPending:e=>e?t.some(e):r,isAnyParticipationPrefetching:i,isParticipationPrefetching:e=>e?n.some(e):i}},[e.runtimeState.pendingActions,e.runtimeState.participationPrefetchActions]),b=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.dirtyMarkers),n=t.length>0;return{markers:t,isAnyDirty:n,isDirty:e=>e?t.some(e):n,mark:e.navigation.markDirty,clear:e.navigation.clearDirty,clearAll:e.navigation.clearAllDirty}},[e.navigation.clearAllDirty,e.navigation.clearDirty,e.navigation.markDirty,e.runtimeState.dirtyMarkers]),x=(0,Q.useRef)(e.navigation.captureFailedAction),S=(0,Q.useRef)(e.runtimeInstanceId),C=(0,Q.useRef)(e.viewDefinition.ref);x.current=e.navigation.captureFailedAction,S.current=e.runtimeInstanceId,C.current=e.viewDefinition.ref;let w=(0,Q.useCallback)(e=>{let t=py(e.error),n=(e.bridgeToCanonicalBus??!0)&&!t;n&&lt.handleError(e.error,{source:`manual`,resourceType:e.resourceType,operationIdentifier:e.operationId,additionalContext:{executionRuntimeInstanceId:S.current,executionViewRef:C.current,...e.operationPathKey?{operationPathKey:e.operationPathKey}:{}}});let r={failureRuntimeId:Ey(),operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,error:e.error,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===oy.LOCAL_PANE?my({...r,scope:e.scope,paneId:e.paneId}):e.scope===oy.EMBEDDED_CONTENT?my({...r,scope:e.scope}):e.scope===oy.PARTICIPATION_PREFETCH?my({...r,scope:e.scope,prefetchKey:e.prefetchKey}):my({...r,scope:oy.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 Dy=(0,Q.createContext)(null);function Oy({scope:e,children:t}){let n=(0,Q.useMemo)(()=>e.scope===ny.LOCAL_PANE?{scope:ny.LOCAL_PANE,paneId:e.paneId}:e.scope===ny.EMBEDDED_CONTENT?{scope:ny.EMBEDDED_CONTENT}:{scope:ny.CUSTOM},[e.scope,e.paneId]);return(0,$.jsx)(Dy.Provider,{value:n,children:t})}function dce(){return(0,Q.useContext)(Dy)}function ky(e){let t=(0,Q.useContext)(cy),n=(0,Q.useContext)(Dy),{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:ny.CUSTOM};if(!i){c.clearDirty(r);return}let t;return t=e.scope===ny.LOCAL_PANE?{markerId:r,scope:ny.LOCAL_PANE,paneId:e.paneId,label:a,markedAt:Date.now()}:e.scope===ny.EMBEDDED_CONTENT?{markerId:r,scope:ny.EMBEDDED_CONTENT,label:a,markedAt:Date.now()}:{markerId:r,scope:ny.CUSTOM,label:a,markedAt:Date.now()},c.markDirty(t),()=>{c.clearDirty(r)}},[c,r,i,s?.scope,s?.paneId])}function fce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-prefetch-${crypto.randomUUID()}`:`execution-prefetch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function pce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function mce(e){return!e||typeof e!=`object`?!1:e.name===`AbortError`}function Ay(e){let t=ly((0,Q.useContext)(cy)),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=fce(),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||mce(t))return;if(l(t),e.bridgeFailuresToShellAggregator===!0){let n=my({failureRuntimeId:pce(),error:t,resourceType:e.resourceType,startedAt:c.startedAt,...e.label===void 0?{}:{label:e.label},scope:oy.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 hce(e,t){return`participation-prefetch:${e}:${t}`}function gce(e){let t=ly((0,Q.useContext)(cy)),{registry:n}=lm(),{buildResourceOperationContext:r}=Ty(),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=by(i),{operationPathKey:o,contextualParameters:s,parentResourcesRequirements:c,label:l}=(0,Q.useMemo)(()=>{let t=r({participationRef:e.participationRef,operationLike:W.READ,requireAddressable:!0}),i=V.buildContextualParameters(t.contextResourceIdentifiers,n);return{operationPathKey:Ca.createOperationPathKeyFromOperation(t.operation),contextualParameters:i,parentResourcesRequirements:t.parentResourcesRequirements,label:e.label}},[r,e.label,e.participationRef,n]),u=e.prefetchKey??hce(a,e.participationRef),d=e.bridgeFailuresToShellAggregator??e.intent===ey.INITIAL,f=t.doOperation,p=(0,Q.useCallback)(async({signal:e})=>f(o,{contextualParameters:s,parentResourcesRequirements:c,dataMode:zl.RAW},{signal:e}),[s,f,o,c]);return Ay({prefetchKey:u,participationRefs:[e.participationRef],resourceType:a,intent:e.intent,run:p,...l===void 0?{}:{label:l},bridgeFailuresToShellAggregator:d})}function jy(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 My(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===ny.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function _ce(e){let t={markerId:e.markerId,markedAt:e.markedAt??Date.now(),label:e.label},n;return n=e.scope===ny.LOCAL_PANE?{...t,scope:e.scope,paneId:e.paneId}:{...t,scope:e.scope},ry(n),n}function Ny(e){return{navigationLayout:()=>e.navigationLayout,designSystemConfiguration:()=>e.designSystemConfiguration,appComponentsConfiguration:()=>uv(e.baseAppComponentsConfiguration,e.moduleRegistry),appScope:()=>cv(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 Py(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 Fy;(function(e){e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.TABLET=`tablet`,e.API=`api`})(Fy||={});var Iy;(function(e){e.STRICT=`strict`,e.LAX=`lax`,e.NONE=`none`})(Iy||={});var vce=jd({userAgent:yd().min(1,`User agent is required`),ipAddress:gae(),deviceType:Od(Fy).default(Fy.DESKTOP),location:yd().optional(),fingerprint:yd().optional()});function Ly(e,t){let n=URL.createObjectURL(e);try{Ry(n,t)}finally{URL.revokeObjectURL(n)}}function Ry(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n);try{n.click()}finally{n.remove()}}function zy({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ERROR_DISPLAY,`ErrorDisplay`)(e);return(0,$.jsx)(n,{...t})}var By=({error:e,errorInfo:t,resetError:n,navigateHome:r})=>{let i=ya.isDevelopment(),{tComponent:a,makeTrComponent:o,isReady:s}=K({component:B.APP_LAYOUTS_ERROR_BOUNDARY}),c=o(B.APP_LAYOUTS_ERROR_BOUNDARY);if(!s)return null;let l=[{label:c(`tryAgain`),onClick:n,variant:`destructive`,iconRef:H.TRY_AGAIN},{label:c(`goHome`),onClick:()=>{n(),r?.()},variant:`secondary`,iconRef:H.HOME}],u=[];return i&&(u.push({label:c(`errorMessageLabel`),content:e.message,variant:`error`}),e.stack&&u.push({label:c(`stackTraceLabel`),content:e.stack,variant:`default`}),t.componentStack&&u.push({label:c(`componentStackLabel`),content:t.componentStack,variant:`info`})),(0,$.jsx)(zy,{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 Vy({preset:e=q.DEFAULT,...t}){let n=G(B.APP_LAYOUTS_ERROR_BOUNDARY,`AppLayout_ErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Hy=rs.getLogger();Hy.debugByType(`ErrorBoundary`),Hy.setDebugTypeLogging(`ErrorBoundary`,!1);function yce(e){let t=nh(),{emit:n}=Ao();return(0,$.jsx)(Vy,{...e,navigateHome:()=>Ph({emit:n,routerNavigate:t})})}var Uy=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}),Hy.error(`ErrorBoundary caught an error:`,{error:e,errorInfo:t});let n=Ru.buildReactError(e,t);try{_i.emit(wc.ERROR_OCCURED,{error:n})}catch(e){Hy.warn(`Failed to emit error event:`,{dispatchError:e})}if(this.props.onError)try{this.props.onError(e,t)}catch(e){Hy.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)(yce,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return this.props.children}};function bce(e,t){let n=n=>(0,$.jsx)(Uy,{...t,children:(0,$.jsx)(e,{...n})});return n.displayName=`withErrorBoundary(${e.displayName||e.name})`,n}function xce(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 Sce(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 Wy=({errorType:e,routeError:t,jsError:n,unknownError:r,navigate:i,navigateAction:a,navigateBack:o,navigateHome:s,errorPageConfig:c,userGuidance:l})=>{let u=ya.isDevelopment(),{tComponent:d,makeTrComponent:f,isReady:p}=K({component:B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY}),m=f(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY),h=e=>Vp({tComponent:d,componentType:B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,key:e}),g=s??(()=>i(`/`));return p?e===`route`&&t?Tce(t,i,a,o??g,g,m,h,u,c,l):e===`javascript`&&n?Ece(n,g,m,u):Dce(r,g,m,u):null};function Cce(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 wce(e){return{type:dm.NAVIGATE,target:e.target,resourceOperationPath:e.resourceOperationPath,compositeViewReference:e.compositeViewReference}}function Tce(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=Cce(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=wce(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)(zy,{variant:`default`,iconRef:Sce(u),statusCode:u,title:d,message:f,suggestion:p,actions:m,featureGuide:h,supportAccess:g,leadMagnet:_,userGuidance:l})}function Ece(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)(zy,{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 Dce(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:xce(e),variant:`default`}),(0,$.jsx)(zy,{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 Gy({preset:e=q.DEFAULT,...t}){let n=G(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,`AppLayout_RouterErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Ky=rs.getLogger();function Oce(e){return e?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}var qy=()=>{let e=og(),t=nh(),{emit:n}=Ao(),r=(0,Q.useContext)(im),i=Jp(),a=(0,Q.useContext)(dh),o=(0,Q.useContext)(Fi),s=(0,Q.useContext)(jc),c=mh(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=mh(e)?Ru.buildRouterError(e,e.status):Ru.buildRouterError(e);return{wildoError:t,userGuidance:t.userGuidance}},[e]);Q.useEffect(()=>{if(u){Ky.error(`RouterErrorBoundary caught error:`,{wildoError:u,error:e});try{_i.emit(wc.ERROR_OCCURED,{error:u})}catch(e){Ky.warn(`Failed to dispatch error event:`,{dispatchError:e})}}},[u,e]);let f=(0,Q.useMemo)(()=>{let e={...i?.buildContextResourceIdentifiers?.()??{},...Oce(u?.context)};return u?.organizationId&&(e.organizationId=u.organizationId),e},[i,u]),p=Q.useCallback(()=>{Ph({emit:n,routerNavigate:t})},[n,t]),m=Q.useCallback(e=>{if(!e.content)p();else if(a)n(wc.NAVIGATION_REQUEST,{content:e.content,initiator:{sourceZone:Dn},urlPath:e.urlPath,replaceBrowserHistory:!0});else{if(!e.urlPath){p();return}t(e.urlPath,{replace:!0})}},[n,t,p,a]),h=Q.useCallback(e=>{if(e.type===`navigate`){if(e.resourceOperationPath){if(!r){p();return}let{registry:t}=r,n=e.resourceOperationPath,i=t.resourceConfigurations[n.resourceType];if(!i){p();return}let a=i.operations.find(e=>String(e.operationIdentifier)===String(n.operationIdentifier)&&!!(e.isOperationDefault??!0)===n.isOperationDefault&&!!(e.isBulkOperation??!1)===n.isBulkOperation&&String(e.variantKey??``)===String(n.variantKey??``));if(!a){p();return}let o=zm.resolveResourceUrl(i,a,f,t.allResourceFieldIdentifiers,n.parentResourcesRequirements)?.resolvedUrl;if(!o){p();return}m({content:{contentType:od.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:n.resourceType,operation:a,contextResourceIdentifiers:f,parentResourcesRequirements:n.parentResourcesRequirements})},urlPath:o})}else if(e.compositeViewReference){let t=Object.keys(f).length>0?f:void 0;m({content:{contentType:od.COMPOSITE_VIEW,viewRef:e.compositeViewReference,contextResourceIdentifiers:t},urlPath:Ep(e.compositeViewReference,t)})}else!e.target||e.target===`/`?p():a?ng({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){Ky.warn(`Cannot navigate to operation: resource registry not available`,{ref:e}),p();return}let{registry:t}=r,n=zm.resolveOperationRef(e,f,t);if(!n||n.contentType!==od.RESOURCE_OPERATION){p();return}let{resourceContext:i}=n,a=t.resourceConfigurations[i.resourceType];if(!a){p();return}let o=zm.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=zm.resolveGoBackTarget({currentBrowserUrl:zm.buildBrowserUrl(window.location.pathname,window.location.search),getZoneState:a.getZoneState});if(e?.browserUrl){n(wc.NAVIGATION_POP,{zone:e.zone}),t(e.browserUrl,{replace:!0});return}}window.history.length>1?t(-1):p()},[t,p,a]);return e?mh(e)?(0,$.jsx)(Gy,{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)(Gy,{errorType:`javascript`,jsError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Gy,{errorType:`generic`,unknownError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(Gy,{errorType:`route`,routeError:{status:404,statusText:`Not Found`,data:{pathname:window.location.pathname}},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l})},kce=4e3,Jy=rs.getLogger(),Yy=Jy.debugByType(`GlobalErrorHandler`);Jy.setDebugTypeLogging(`GlobalErrorHandler`,!1);function Ace(e){switch(e){case Jn.CRITICAL:case Jn.HIGH:return`error`;case Jn.MEDIUM:return`warning`;case Jn.LOW:return`info`;default:return`error`}}function Xy({onError:e}){let{on:t}=Ao(),{handleWildoError:n}=ep(),{endSession:r,isAuthenticated:i,getEndedSessionReason:a}=fm(),{notifyError:o,notifyWarning:s,notifyInfo:c}=Mm(),{tErrorMessage:l,tErrorGuidance:u,isKeySettled:d}=K(),f=(0,Q.useRef)({tErrorMessage:l,tErrorGuidance:u});f.current={tErrorMessage:l,tErrorGuidance:u};let p=d(oi.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()?(Yy(`triggerLogout requested - logging out via AuthSession`),r(Mre(e))):Yy(`triggerLogout requested but not authenticated - skipping logout`)},[r,i]),v=(0,Q.useCallback)(e=>{let t=Oee[e.type],n=e.severity||t?.severity||Jn.MEDIUM,r=lp(e,{translators:f.current}),i=Ace(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})}Yy(`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,kce))},[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(Yy(`Received ERROR_OCCURED event`,{errorType:r.type,customMessageReference:r.customMessageReference,triggerLogout:r.triggerLogout}),lt.shouldSuppress(r)){Yy(`Error suppressed (duplicate)`,{errorType:r.type,customMessageReference:r.customMessageReference});return}let i=r.triggerLogout===!0;if(i){Yy(`triggerLogout=true - calling AuthSession logout handler`),_(r);let e=r.frontendActions||[];e.includes(jl.DISCONNECT)&&(r={...r,frontendActions:e.filter(e=>e!==jl.DISCONNECT)})}Yy(`Error occurred`,{errorType:r.type,customMessageReference:r.customMessageReference});let o=r.suppressUserDisplay===!0,s=Tn(r),c=r.frontendActions||[],l=r;o||i&&a()!==null?l={...r,frontendActions:c.filter(e=>e!==jl.NOTIFY&&e!==jl.SHOW_TOAST&&e!==jl.SHOW_MODAL)}:s&&(b(r),l={...r,frontendActions:c.filter(e=>e!==jl.NOTIFY&&e!==jl.SHOW_TOAST)}),e&&e(r),n(l)},[n,e,_,b,a]);return(0,Q.useEffect)(()=>{Yy(`Subscribing to ERROR_OCCURED events`,{eventName:wc.ERROR_OCCURED});let e=t(wc.ERROR_OCCURED,x);return()=>{Yy(`Unsubscribing from ERROR_OCCURED events`),e()}},[t,x]),null}var jce=()=>{let e=(0,Q.useContext)(Ym);if(!e)throw Error(`useLoading must be used within a LoadingProvider`);return e};function Zy(){let e=(0,Q.useContext)(Ym);if(!e)throw Error(`useAppLoading must be used within a LoadingProvider`);return{isAppLoading:e.isAppLoading,sources:e.appLoadingSources}}function Qy(e,t){let n=(0,Q.useContext)(Ym);if(!n)throw Error(`useComponentLoading must be used within a LoadingProvider`);let r=$m(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 Mce({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 $y({preset:e=q.DEFAULT,...t}){let n=No.resolve(B.LOW_LEVEL_LOADING_SPINNER,e);return n?(0,$.jsx)(n,{...t}):(0,$.jsx)(Mce,{...t})}function eb({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LOADING_OVERLAY,`LoadingOverlay`)(e);return(0,$.jsx)(n,{...t})}function Nce(e){switch(e){case`overlay`:return{initialLoad:Il.OPACITY_OVERLAY,refresh:Il.OPACITY_OVERLAY};case`spinner-only`:return{initialLoad:Il.SPINNER,refresh:Il.SPINNER};case`skeleton-children`:return{initialLoad:Il.SKELETON,refresh:Il.OPACITY_OVERLAY};default:return}}var Pce=`contents [:where([class*='space-y-'])>&]:block`,tb=new Set([Il.OPACITY_OVERLAY,Il.HIDDEN,Il.INVISIBLE]);function nb({loadingScopes:e,i18nKeys:t,readiness:n,policy:r,renderLoading:i,renderError:a,timeoutMs:o,children:s}){let c=(0,Q.useContext)(Ym);if(!c)throw Error(`LoadingGate must be used within a LoadingProvider`);let l=pc(),u=r??Nce(l.interactiveState?.loadingDisplay),d=(0,Q.useMemo)(()=>({keys:t??[]}),[t]),{requestKeys:f,isKeySettled:p,isReady:m}=K(d),h=(0,Q.useMemo)(()=>e?.length?e.map(e=>{let t=$m(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)?lu.INITIAL:h.some(e=>e.isLoading&&e.hasLoadedOnce)?lu.REFRESH:lu.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($m(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??Il.OPACITY_OVERLAY,E=u?.initialLoad??Il.SKELETON,D=tb.has(T)||tb.has(E);if(y)return D?(0,$.jsx)(`div`,{className:Pce,"data-loading-gate":`ready`,children:s}):(0,$.jsx)($.Fragment,{children:s});let O=b===lu.REFRESH?T:E,k={phase:b,scope:h[0]?.scope??{customIdentifier:`loading-gate`}};switch(O){case Il.CUSTOM:return(0,$.jsx)($.Fragment,{children:i?.(k)??s});case Il.SKELETON:return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading`}),i?i(k):(0,$.jsx)(um,{template:`auto`,density:`auto`,"aria-hidden":`true`})]});case Il.SPINNER:return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)($y,{size:32})});case Il.OPACITY_OVERLAY:return(0,$.jsxs)(`div`,{className:`relative`,"data-loading-gate":`loading`,children:[s,(0,$.jsx)(eb,{})]});case Il.HIDDEN:return(0,$.jsx)(`div`,{style:{display:`none`},"data-loading-gate":`loading`,children:s});case Il.INVISIBLE:return(0,$.jsx)(`div`,{style:{visibility:`hidden`},"data-loading-gate":`loading`,children:s});case Il.FULL_SCREEN:return(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background/80`,children:(0,$.jsx)($y,{size:48})});default:return(0,$.jsx)($.Fragment,{children:s})}}var rb;(function(e){e.PENDING=`pending`,e.READY=`ready`,e.ERROR=`error`})(rb||={});var ib=(0,Q.createContext)(null);function Fce(){let e=(0,Q.useContext)(ib);if(!e)throw Error(`useBarrierParticipant must be used within a LoadingBarrier`);return e}function Ice({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:rb.PENDING}),a(e=>e+1)),{markReady:()=>{let t=i.current.get(e);t&&t.status!==rb.READY&&(i.current.set(e,{status:rb.READY}),a(e=>e+1))},markError:t=>{let n=i.current.get(e);n&&n.status!==rb.ERROR&&(i.current.set(e,{status:rb.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===rb.READY),m=Array.from(f.values()).some(e=>e.status===rb.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!==rb.READY),n=e.map(([e])=>({customIdentifier:e})),r=e.find(([,e])=>e.error)?.[1]?.error;return(0,$.jsx)(ib.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:rb.PENDING});l(e=>e+1),a(e=>e+1)}})})}let g=!p;return(0,$.jsx)(ib.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)($y,{size:32})})]})})}var ab={[et.RESOURCES_LAYOUTS]:{initialLoad:Il.SKELETON,refresh:Il.OPACITY_OVERLAY},[et.RESOURCES_FIELDS]:{initialLoad:Il.SKELETON,refresh:Il.OPACITY_OVERLAY},[et.HIGH_LEVEL_VIEWS]:{initialLoad:Il.SKELETON,refresh:Il.OPACITY_OVERLAY},[et.APPLICATION_LEVEL_COMPONENTS]:{initialLoad:Il.SKELETON,refresh:Il.HIDDEN},[et.PUBLIC_LAYOUTS]:{initialLoad:Il.SPINNER,refresh:Il.SPINNER}};function Lce(e,t){let n=ab[e]??{};return{initialLoad:t?.initialLoad??n.initialLoad??Il.SKELETON,refresh:t?.refresh??n.refresh??Il.OPACITY_OVERLAY,customRenderer:t?.customRenderer??n.customRenderer,disableInteraction:t?.disableInteraction??n.disableInteraction,skeletonSchema:t?.skeletonSchema??n.skeletonSchema}}var ob=rs.getLogger(),Rce=ob.debugByType(`AppLoadingGate`);ob.setDebugTypeLogging(`AppLoadingGate`,!1);function sb({renderLoading:e,children:t}){let{isAppLoading:n,sources:r}=Zy(),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)(()=>{Rce(`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)($y,{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)($y,{size:48})}))]})}function cb(e){return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))}function lb(e){let t=e.displayNameLabelKey??_d(e.providerRef),n=e.translate?.(t);return n&&n!==t?n:e.displayName??e.fallbackLabel??e.providerRef}function ub(...e){let t=P_(`FrontendApp`,e);return Tae(`FrontendApp`,t.modules.values()),t}var db=`@wildo-ai/external-connectors-public`,zce={metadata:pd({ref:`dropbox`,packageName:db,tier:Ad.MAIN,origin:dd}),providerCapabilities:[Ed.FRONTEND_FILE_PICKER],protocols:[sl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:O_({appKey:{kind:D_.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:{[Ed.FRONTEND_FILE_PICKER]:{selectionDelivery:ud.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[bd.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:xd.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:[ld.STORAGE_REGION_TERRITORIES],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-16`},{facts:[ld.PROCESSING_REGIONS,ld.PROCESSING_REGION_REACH],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-10`}]}},Bce={metadata:pd({ref:`google-drive`,packageName:db,tier:Ad.MAIN,origin:dd}),providerCapabilities:[Ed.FRONTEND_FILE_PICKER],protocols:[sl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:O_({appId:{kind:D_.STRING,description:`Google Cloud project NUMBER the Drive Picker is registered under.`},developerKey:{kind:D_.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:{[Ed.FRONTEND_FILE_PICKER]:{selectionDelivery:ud.REMOTE_REFERENCE}},fileStorage:jae.GOOGLE_DRIVE,complianceProfile:{deploymentModels:[bd.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:xd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[ld.DEPLOYMENT_MODELS,ld.PROCESSING_REGIONS],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-06`},{facts:[ld.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`},{facts:[ld.PROCESSING_REGION_REACH],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-10`}]}},Vce=`Google Maps`,Hce=[zce,Bce,{metadata:pd({ref:`google-places`,packageName:db,tier:Ad.MAIN,origin:dd}),providerCapabilities:[Ed.FRONTEND_ADDRESS_LOOKUP],protocols:[],publicConfig:{},publicConfigSchema:O_({}),components:{[Ed.FRONTEND_ADDRESS_LOOKUP]:{placeIdRetention:vd.NONE,addressLookup:{suggestOperationId:`address_suggest`,retrieveOperationId:`address_retrieve`,sessionTokenInput:`sessionToken`,attributionMark:Vce}}},complianceProfile:{deploymentModels:[bd.VENDOR_HOSTED],processingRegions:[`Servers around the world`],evidence:[{facts:[ld.DEPLOYMENT_MODELS,ld.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`}]}},{metadata:pd({ref:`microsoft-onedrive`,packageName:db,tier:Ad.MAIN,origin:dd}),providerCapabilities:[Ed.FRONTEND_FILE_PICKER],protocols:[sl.FRONTEND_SDK],publicConfig:{},publicConfigSchema:O_({clientId:{kind:D_.STRING,description:`Azure application (client) id the OneDrive picker is registered under.`},pickerRedirectUri:{kind:D_.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:{[Ed.FRONTEND_FILE_PICKER]:{selectionDelivery:ud.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[bd.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:xd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[ld.DEPLOYMENT_MODELS,ld.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-06`},{facts:[ld.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/o365-data-locations`,verifiedAt:`2026-11-06`},{facts:[ld.PROCESSING_REGIONS],source:`https://www.microsoft.com/en-us/privacy/privacystatement`,verifiedAt:`2026-11-06`},{facts:[ld.PROCESSING_REGION_REACH],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-10`}]}}];ub({modules:new Map(Hce.map(e=>[e.metadata.ref,e]))});var fb=function(e){return e.AT_SURFACE_START=`at_surface_start`,e.ON_DEMAND=`on_demand`,e}({});function pb(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 mb=Object.freeze({browserHosted:!1}),hb=Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([])}),gb=Object.freeze({FRONTEND_PRODUCT_ANALYTICS:Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([Id.ANALYTICS])}),FRONTEND_ERROR_MONITORING:hb,FRONTEND_CAPTCHA:hb,FRONTEND_SEARCH:hb,FRONTEND_FILE_PICKER:hb,FRONTEND_ADDRESS_LOOKUP:hb,FRONTEND_CHAT_SIGN_IN_COMPLETION:hb,SSO_OAUTH2:hb,BILLING:mb,EMAIL_TRANSACTIONAL:mb,EMAIL_MARKETING:mb,EMAIL_INBOUND:mb,SMS:mb,ELECTRONIC_SIGNATURE:mb,SSO_SAML:mb,LLM_CHAT:mb,LLM_EMBEDDINGS:mb,DOCUMENT_TEXT_EXTRACTION:mb,PROMPT_INJECTION_SCREENING:mb,OUTPUT_MODERATION:mb,CODING_AGENT:mb,IMAGE_GENERATION:mb,LLM_OBSERVABILITY:mb,OBSERVABILITY_TELEMETRY:mb,COMPLIANCE_AUDIT_TRAIL:mb,KEY_MANAGEMENT:mb});function _b(e){return Object.prototype.hasOwnProperty.call(gb,e)?gb[e]:void 0}function vb(e){return(e.providerCapabilities??[]).filter(e=>_b(e)?.browserHosted!==!0)}function yb(e){let t=new Set(Cae);return(e.consentPurposes??[]).filter(e=>!t.has(e))}function bb(e){let t=[...e.consentPurposes??[]];for(let n of e.providerCapabilities??[]){let e=_b(n);e?.browserHosted===!0&&t.push(...e.consentPurposes)}return Md(t)}function xb(e,t){return vb(e).length>0||yb(e).length>0?!1:wd(t,bb(e)).length===0}function Sb(e,t){return wd(t,bb(e))}function Cb(e,t,n){let r=vb(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=yb(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 ${Sb(t,n).join(`, `)}, which has not been granted on this surface.`}function wb(e,t){let n=bb(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 Tb(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 Eb(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 Uce(e,t){if(e===void 0||t===void 0)return e===t;let n=vae(t);return Mae.every(t=>Eb(e[t]??[],n[t]))}function Wce(e){return e.issues!==void 0}function Gce(e,t,n,r,i){let a=Sae({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(Wce(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 Kce(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&&!Uce(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&&Ld(a.sdk)!==Ld(o.sdk?.descriptor)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares ${Ld(o.sdk?.descriptor)} but its served entry says ${Ld(a.sdk)}. Regenerate with \`wildo config sync\`.`}),o!==void 0){for(let[e,n]of Object.entries(o.components??{})){let r=Tb(pb(n)),o=a.components?.[e],s=o===void 0?void 0:Tb(pb(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&&!Eb(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&&k_(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=wb(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=j_([...new Set([...A_(o?.publicConfigSchema),...a.requiredPublicConfigKeys??[]])],u);e.length>0&&(t({kind:`PUBLIC_CONFIG_NOT_SUPPLIED`,providerRef:i,message:M_({providerRef:i,missingKeys:e})}),o=void 0,d=void 0)}if(o?.publicConfigSchema!==void 0){let e=Gce(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 qce(e){let t=Kce(e);return ub({modules:new Map([...t].map(([e,t])=>[e,{...t,providerCapabilities:t.providerCapabilities,protocols:t.protocols,consentPurposes:t.consentPurposes}]))})}var Db=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 Ob(e,t){let n=e.sdk;if(n?.activation!==fb.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 kb(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function Jce(){return typeof globalThis<`u`&&globalThis.window!==void 0}async function Ab(e){let t=t=>{e.onDiagnostic?.(t)},n=new Map,r=e.isBrowser??Jce;for(let i of e.modules){let a=i.sdk;if(a===void 0)continue;let o=i.metadata.ref,s=(a.activation??fb.AT_SURFACE_START)===fb.ON_DEMAND;if(e.onDemand===void 0){if(s)continue}else{let{verdict:n,cause:r}=Ob(i,e.onDemand);if(n===Db.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===Db.PREDICATE_FAILED&&t({kind:`ON_DEMAND_PREDICATE_FAILED`,providerRef:o,message:`Provider "${o}"'s servesOnDemandContext threw: ${kb(po(r))} Its SDK was not loaded.`,cause:r}),n!==Db.SERVES)continue}if(!xb(i,e.grantedConsentPurposes??[])){t({kind:`WITHHELD_PENDING_CONSENT`,providerRef:o,message:`${Cb(o,i,e.grantedConsentPurposes??[])} Its SDK was not loaded.`});continue}let c=wb(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 ${Ld(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),bb(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 ${Ld(a.descriptor)}): ${kb(po(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 Yce(){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 jb=`data-wildo-provider-script`,Mb=`data-wildo-provider-script-state`;function Xce(e){if(e===void 0)return[];let t=[];for(let n of e)if(!(bb(n).length>0)&&xb(n,[]))for(let e of n.scripts??[])t.push({providerRef:n.metadata.ref,declaration:e});return t}function Zce(e,t){return[...e.querySelectorAll(`script[${jb}]`)].find(e=>e.getAttribute(`src`)===t)}function Qce(e,t){let{providerRef:n,declaration:r}=t,i=e.createElement(`script`);return i.src=r.src,i.setAttribute(jb,n),i.setAttribute(Mb,`loading`),i.addEventListener(`load`,()=>i.setAttribute(Mb,`loaded`),{once:!0}),i.addEventListener(`error`,()=>i.setAttribute(Mb,`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 $ce(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 ele(e){let t=e.getAttribute(Mb);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 Nb(e,t){let n=await Promise.all(e.map(async e=>({script:e,state:await ele(Zce(t,e.declaration.src)??Qce(t,e))})));return{loaded:n.filter(e=>e.state===`loaded`).map(e=>e.script),failed:n.filter(e=>e.state===`failed`).map(e=>$ce(e.script))}}function tle(){return typeof document<`u`}var nle=e=>Nb(e,document);function rle(e){return typeof e==`object`&&!!e&&e[Symbol.toStringTag]===`Module`}function ile(e){return typeof e==`function`||typeof e==`object`&&!!e}function ale(e){let t=t=>{e?.onDiagnostic?.(t)},n=new Map,r=new Map,i=e?.loadScripts??nle,a=e?.hasBrowserDocument??tle,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=wb(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=xb(r,n);return{permitted:i,missingPurposes:i?[]:Sb(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(!xb(p,c))return t({kind:`WITHHELD_PENDING_CONSENT`,capability:e,providerRef:o,message:`${Cb(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: ${Rre(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 rle(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):ile(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 Pb(e,t){return`${e}:${t}`}function ole(e){let t=new Map;for(let n of e??[])t.set(Pb(n.capability,n.providerRef),n);return t}function sle(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(Pb(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:pb(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 cle(e,t){let n=new Set;for(let e of t)n.add(e.providerRef);return Xce([...e].filter(e=>!n.has(e.metadata.ref)))}var Fb=function(e){return e.NONE=`NONE`,e.LOADING=`LOADING`,e.READY=`READY`,e.UNAVAILABLE=`UNAVAILABLE`,e.CONSENT_REQUIRED=`CONSENT_REQUIRED`,e}({}),Ib=Object.freeze([]);function Lb(){return{status:`NONE`,Component:null,missingConsentPurposes:Ib}}function lle(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(Lb()),()=>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:Ib}),t.resolve(n,r,i).then(e=>{s&&a(e===null?{status:`UNAVAILABLE`,Component:null,missingConsentPurposes:Ib}:{status:`READY`,Component:e,missingConsentPurposes:Ib})}),()=>{s=!1}}var Rb=class{registry=ub({modules:new Map});initialize(e){this.registry=qce({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 Ab({surface:Yo.SAAS_APP,modules:this.registry.getProvidersByProviderCapability(e.capability),onDemand:e,onDiagnostic:t})}providersServingOnDemand(e){return this.registry.getProvidersByProviderCapability(e.capability).filter(t=>Ob(t,e).verdict===Db.SERVES).map(e=>e.metadata.ref)}};function zb(e){let t=new Rb;return t.initialize(e),t}var Bb=rs.getLogger(),Vb;(function(e){e.SUCCEEDED=`succeeded`,e.FAILED=`failed`})(Vb||={});function Hb(e,t){let n=0;for(let[r,i]of e.activations)if(!Hse(i.handle))Bb.warn(`A chat sign-in completion provider returned a handle that is not a FrontendChatSignInCompletionSink`,{providerRef:r});else try{t===Vb.SUCCEEDED?i.handle.signInSucceeded():i.handle.signInFailed(),n+=1}catch(e){Bb.warn(`A chat sign-in completion provider failed to tell its host`,{providerRef:r,error:e})}return n}function Ub(e){let t=(0,Q.useContext)(Fi)?.frontendProviderRegistry,n=(0,Q.useMemo)(()=>e===void 0?void 0:{capability:Ed.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===Vb.SUCCEEDED&&e===Vb.FAILED||i.current===e&&o?.repeat!==!0)return 0;i.current=e,a.current??=t.activateOnDemand(n,e=>Bb.warn(`Chat sign-in completion provider diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message}));try{let t=Hb(await a.current,e);return t===0&&(a.current=null),t}catch(e){return Bb.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 Wb=new Map;function Gb(e){Wb=ole([...Wb.values(),...e])}function Kb(){return Wb}function ule(){Wb=new Map}var qb;(function(e){e.NOT_APPLICABLE=`notApplicable`,e.REQUIRED=`required`,e.PROMPT=`prompt`,e.SATISFIED=`satisfied`})(qb||={});function Jb(e){let t=Md(e.serviceConsentRequirement?.requiredPurposes),n=Md(e.privacy?.consentedPurposes),r=wd(n,t),i=kae({requiredPurposes:t,analyticsEnabled:e.analyticsEnabled,analyticsRequiresConsent:e.analyticsRequiresConsent,capabilityDeclaredPurposes:e.capabilityDeclaredConsentPurposes}).filter(e=>!t.includes(e)),a={requiredPurposes:t,missingRequiredPurposes:r,optionalPurposes:i,grantedPurposes:n,gatedProcessing:t.length>0?e.serviceConsentRequirement?.gatedProcessing:void 0};return r.length>0?{...a,status:qb.REQUIRED}:e.privacy===null||e.privacy===void 0||t.length===0&&i.length===0?{...a,status:qb.NOT_APPLICABLE}:i.length>0&&e.privacy?.consentDecidedAt===void 0?{...a,status:qb.PROMPT}:{...a,status:qb.SATISFIED}}function Yb(e,t,n){let r=e.filter(e=>!t.includes(e)),i=t.filter(e=>n.includes(e));return Md([...r,...i])}function Xb(e,t,n){let r=Yb(e.grantedPurposes,t,n);return wd(r,e.requiredPurposes)}function Zb(){let e=(0,Q.useContext)(th),t=e?.privacy?.consentedPurposes,n=(0,Q.useMemo)(()=>Md(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(Yb(n,e,e))},[n,r]);return{granted:n,grant:i?a:void 0}}function Qb(e){let{frontendProviderRegistry:t,providerComponentRegistry:n}=Tu();return n===void 0?[]:n.listProviders(e).map(e=>{let n=t?.getProviderByRef(e);return{providerRef:e,displayNameLabelKey:n?.metadata.displayNameLabelKey??_d(e),displayName:n?.metadata.displayName,fileStorage:n?.fileStorage}})}function $b(e,t){let{providerComponentRegistry:n}=Tu(),{granted:r}=Zb(),i=r.join(`,`),[a,o]=(0,Q.useState)(()=>Lb());return(0,Q.useEffect)(()=>lle({registry:n,capability:e,providerRef:t,grantedConsentPurposes:r,onState:o}),[e,t,n,i]),a}var ex;(function(e){e.PROVIDER_DECLARED_NO_DELIVERY=`PROVIDER_DECLARED_NO_DELIVERY`,e.DELIVERY_CONTRADICTS_DECLARATION=`DELIVERY_CONTRADICTS_DECLARATION`})(ex||={});function tx(e){let t=e.descriptor?.selectionDelivery;if(t===void 0)return{accepted:[],rejections:[{kind:ex.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:ex.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 nx;(function(e){e.PLACE_ID_CONTRADICTS_DECLARATION=`PLACE_ID_CONTRADICTS_DECLARATION`,e.ADDRESS_REFUSED_BY_FIELD=`ADDRESS_REFUSED_BY_FIELD`})(nx||={});function rx(e){let t=e.descriptor?.placeIdRetention??vd.NONE,{address:n,placeId:r}=e.selection;return r!==void 0&&t===vd.NONE?{rejection:{kind:nx.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:nx.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 ix=Ed.FRONTEND_FILE_PICKER;function ax(e){let{providerComponentRegistry:t,frontendProviderRegistry:n}=Tu(),r=Qb(ix),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}=$b(ix,o),{grant:f}=Zb(),p=(0,Q.useMemo)(()=>o===void 0?{}:n?.getProviderByRef(o)?.publicConfig??{},[o,n]),m=e.constraints,h=e.multiple,g=(0,Q.useMemo)(()=>wae({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=tx({providerRef:o,descriptor:t?.describe(ix,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!==Fb.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 vc().getProviderConnectionAccessToken(o))?.accessToken},[o]);if(a.length===0)return null;let T=e.renderChooser?.({choices:a,chosen:o,choose:s})??dle({choices:a,chosen:o,choose:s}),E=a.find(e=>e.providerRef===o),D=l===Fb.CONSENT_REQUIRED&&E!==void 0?(e.renderConsentRequired??fle)({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===Fb.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 dle(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 fle(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 ox;(function(e){e.VERTICAL=`vertical`,e.HORIZONTAL=`horizontal`,e.RESPONSIVE=`responsive`})(ox||={});function sx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD,`Field`)(e);return(0,$.jsx)(n,{...t})}function cx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_LABEL,`FieldLabel`)(e);return(0,$.jsx)(n,{...t})}function lx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_TITLE,`FieldTitle`)(e);return(0,$.jsx)(n,{...t})}function ux({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_CONTENT,`FieldContent`)(e);return(0,$.jsx)(n,{...t})}function dx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_DESCRIPTION,`FieldDescription`)(e);return(0,$.jsx)(n,{...t})}function fx({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_ERROR,`FieldError`)(e);return(0,$.jsx)(n,{...t})}function ple({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FIELD_SEPARATOR,`FieldSeparator`)(e);return(0,$.jsx)(n,{...t})}var px=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(B.LOW_LEVEL_COMBOBOX,`Combobox`)(e);return(0,$.jsx)(r,{...t,ref:n})});px.displayName=`Combobox`;var mx=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(B.LOW_LEVEL_COMBOBOX_MULTIPLE,`ComboboxMultiple`)(e);return(0,$.jsx)(r,{...t,ref:n})});mx.displayName=`ComboboxMultiple`;var mle=yd(),hx=class extends Error{constructor(){super(`The chosen place has no postal address the field can hold.`),this.name=`ProviderAddressLookupPlaceWithoutAddressError`}};function gx({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 _x(e){return e instanceof Error?e:Error(String(e))}function vx(e){let{adapter:t,suggest:n,retrieve:r,onSelect:i,onCancel:a,onError:o,countriesAllowed:s,defaultCountry:c,languageCode:l,disabled:u,name:d,attribution:f}=e,{tComponent:p}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),m=(e,t)=>p(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(0),S=(0,Q.useRef)(!1),C=h.trim(),w=C.length>=3;(0,Q.useEffect)(()=>{let e=++x.current;if(!w||u){v([]),b(!1);return}b(!0);let r=setTimeout(()=>{let r;try{r=t.buildSuggestInput({query:C,countriesAllowed:s,defaultCountry:c,languageCode:l})}catch(e){b(!1),o(_x(e));return}n(r).then(n=>{e===x.current&&v(t.readSuggestions(n))}).catch(t=>{e===x.current&&(v([]),o(_x(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(_x(e));return}r(a).then(e=>{let n=t.readAddress(e);n===void 0?o(new hx):i({address:n})}).catch(e=>o(_x(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(Ha.LOOKUP_NO_RESULTS):m(Ha.LOOKUP_TYPE_MORE,{minimum:3});return(0,$.jsx)(px,{schema:mle,name:d,value:``,options:T,onChange:D,onSearchChange:g,onOpenChange:O,shouldFilter:!1,isLoading:y,disabled:u,placeholder:m(Ha.LOOKUP_PLACEHOLDER),searchPlaceholder:m(Ha.LOOKUP_SEARCH_PLACEHOLDER),emptyMessage:k,listFooter:f===void 0?void 0:(0,$.jsx)(gx,{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 yx=Ed.FRONTEND_ADDRESS_LOOKUP,hle=Da(nd).consentedPurposes,bx;(function(e){e.UNAVAILABLE=`UNAVAILABLE`,e.ADDRESS_REFUSED=`ADDRESS_REFUSED`})(bx||={});function gle(){return globalThis.crypto.randomUUID()}function xx({host:e,addressSchema:t,fieldName:n}){let{providerComponentRegistry:r,frontendProviderRegistry:i}=Tu(),{t:a,tComponent:o,tResourceFieldEnumValue:s,currentLanguage:c}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),l=(e,t)=>o(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),u=Qb(yx),d=(0,Q.useMemo)(()=>u.filter(e=>r?.describe(yx,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:_}=$b(yx,m),{grant:v}=Zb(),[y,b]=(0,Q.useState)(void 0),x=m===void 0?void 0:r?.describe(yx,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??=gle(),r={...r,[n]:C.current}),(await vc().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=rx({providerRef:m,descriptor:x,selection:n,addressSchema:t});r.accepted===void 0?b(bx.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 hx?bx.ADDRESS_REFUSED:bx.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===Fb.UNAVAILABLE?bx.UNAVAILABLE:y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-address-lookup":m??``,children:[(0,$.jsx)(cx,{htmlFor:`field-${N}`,className:`text-sm text-muted-foreground`,children:l(Ha.LOOKUP_LABEL)}),d.length>1?(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs`,children:d.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.providerRef===m?J.DEFAULT:J.OUTLINE,"aria-pressed":e.providerRef===m,onClick:()=>{b(void 0),w(),p(e.providerRef)},children:M(e)},e.providerRef))}):null,h===Fb.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(ll.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,hle)).join(`, `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:l(Ha.LOOKUP_CONSENT_REQUIRED,{provider:M(j),purposes:e})}),v===void 0?null:(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.OUTLINE,onClick:()=>void v(_),children:l(Ha.LOOKUP_CONSENT_GRANT,{purposes:e})})]})})()}):null,h===Fb.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(Ha.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===bx.UNAVAILABLE?Ha.LOOKUP_UNAVAILABLE:Ha.LOOKUP_ADDRESS_REFUSED)})]})}function Sx(){return(0,Q.useContext)(Cx)}var Cx=(0,Q.createContext)([]),_le=rs.getLogger();function vle(e){return[...e].sort().join(`,`)}var wx=({children:e})=>{let t=(0,Q.useContext)(Fi),n=t?.frontendProviderRegistry,{on:r}=Ao(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),c=(0,Q.useRef)(Yce());(0,Q.useEffect)(()=>r(wc.USER_PREFERENCES_CHANGED,e=>{if(e.privacy===null){a([]);return}let t=e.privacy?.consentedPurposes;t!==void 0&&a(Md(t))}),[r]);let l=t?.appConfig?.analytics?.enabled===!0,u=(0,Q.useMemo)(()=>(n?.listAll()??[]).filter(e=>bb(e).length>0&&(l||!e.providerCapabilities.includes(Ed.FRONTEND_PRODUCT_ANALYTICS))),[n,l]),d=(0,Q.useMemo)(()=>{let e=i??[],t=new Set(u.flatMap(e=>bb(e)));return e.filter(e=>t.has(e))},[u,i]),f=vle(d);return(0,Q.useEffect)(()=>{if(u.length===0||d.length===0){s([]);return}let e=c.current.start(()=>Ab({surface:Yo.SAAS_APP,modules:u,grantedConsentPurposes:d,onDiagnostic:e=>{_le.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)(Cx.Provider,{value:o,children:e})},Tx=rs.getLogger(),Ex=Tx.debugByType(`ResourceReadCache`);Tx.setDebugTypeLogging(`ResourceReadCache`,!1);var yle=200,ble=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(),Ex(`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),Ex(`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&&Ex(`invalidated by resource type`,{resourceType:e,dropped:t})}clear(){let e=this.entries.size;this.entries.clear(),e>0&&Ex(`cleared`,{dropped:e})}evictIfOverCapacity(){if(this.entries.size<=yle)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 xle(e,t){let n=new WeakSet,r=e=>{if(e===void 0)return`u`;if(e===null)return`n`;if(typeof e==`function`||typeof e==`bigint`)throw Error(`not renderable`);if(typeof e!=`object`)return JSON.stringify(e)??`u`;if(n.has(e))throw Error(`not renderable`);return n.add(e),Array.isArray(e)?`[${e.map(r).join(`,`)}]`:`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${r(t)}`).join(`,`)}}`};try{return`${e}${r(t)}`}catch{return null}}function Dx(e,t){let n=t?.[ll.USERS];return e?.primaryKeyIdentifiesInitiator===!0&&n!==void 0&&e.resourceFieldIdentifier===n}function Ox(e,t){return e?.timeout===void 0?t.clientRequestTimeoutMs===void 0?{}:{timeout:t.clientRequestTimeoutMs}:{}}function Sle(){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 kx(e,t){return t.idempotencyKey===void 0||Object.keys(e?.headers??{}).some(e=>e.toLowerCase()===qu.IDEMPOTENCY_KEY)?{}:{headers:{...e?.headers,[qu.IDEMPOTENCY_KEY]:ue(Sle())}}}function Cle(e){return typeof e==`string`||typeof e==`number`}function Ax(e){let t=_l(e);return t===W.READ||t===W.LIST||t===W.SEARCH}function wle(e){return!Ax(e)&&_l(e)!==W.COUNT&&e.httpVerb!==dc.GET}function jx(e){return Ax(e)&&e.hasCustomResponseDto!==!0}var Mx=class e extends oa{resourcesRegistry;errorBuilder;constructor(e,t={}){super(t),this.resourcesRegistry=e,this.errorBuilder=new De}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(za.INTERNAL,{customMessageReference:e,operationPathKey:t,context:n}),i=Error(e);return i.wildoError=r,i}readCache=new ble;getReadCache(){return this.readCache}resolveCacheableRead(e,t,n){let r=t.resourceIdentifier,i=xle(e,n);if(i===null)return null;let a=t.resourcePrimaryScope;if(!a)return null;let o={};for(let[e,t]of Object.entries(n.contextualParameters??{}))typeof t==`string`?o[e]=t:typeof t==`number`&&(o[e]=String(t));if(a===Vr.APPLICATION){let e=this.readCache.getApplicationId();e&&(o.applicationId=e)}if(a===Vr.ORGANIZATIONS&&!o.organizationId){let e=this.readCache.getOrganizationId();e&&(o.organizationId=e)}return{key:i,resourceType:r,scopes:vie(o,a)}}async doOperation(e,t,n){let r=Ca.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(ql.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e});Ax(i)||this.readCache.invalidateResourceType(i.resourceIdentifier);let a=jx(i)?this.resolveCacheableRead(e,i,t):null;if(a){let e=this.readCache.read(a.key);if(e!==void 0)return structuredClone(e)}switch(i.variantType){case at.API_CALL:return this.executeApiCallOperation(i,t,n).then(e=>(a&&this.readCache.store(a.key,e,a.resourceType,a.scopes),wle(i)&&Dx(this.resourcesRegistry.resourceConfigurations[i.resourceIdentifier],this.resourcesRegistry.allResourceFieldIdentifiers)&&this.revalidateSession(),e));default:throw i.variantType,this.buildError(ql.FRONTEND_RESOURCE_UNSUPPORTED_OPERATION_TYPE,e,{operationPathKey:e})}}async executeSearchOperation(e,t,n){let r=Ca.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(ql.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e,operationType:`search`});if(_l(i)!==W.SEARCH)throw this.buildError(ql.FRONTEND_RESOURCE_SEARCH_OPERATION_INVALID,e,{operationPathKey:e,actualOperationIdentifier:i.operationIdentifier});let a=jx(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(Jre(e,n))return this.validateResponseData(n,xee,void 0,!1);if(Dt(e,n))return this.validateResponseData(n,Lee,void 0,!1);let r=this.selectResponseDto(e,t);return this.validateResponseData(n,r,void 0,$ee(e))}selectResponseDto(e,t){let n=cs.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 Fd?this.buildError(ql.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=Ca.extractOperationPath(t);if(n.operationIdentifier!==e.operationIdentifier||n.variantType!==e.variantType)return!1;if(e.isOperationDefault){if(!n.isOperationDefault)return!1}else{let t=e.variantKey;if((n.variantKey??void 0)!==(t??void 0))return!1}return n.variantType!==at.API_CALL||n.isBulkOperation===!0==(e.isBulkOperation===!0)})||null}async executeApiCallOperation(e,t,n){let r=this.resourcesRegistry.resourceConfigurations[e.resourceIdentifier]?.resourceFieldIdentifier??``,{url:i,missingParameters:a}=this.buildUrlFromInitiatorInfos(e.initiatorInfos||[],t.contextualParameters,e.resourceIdentifier,r,t.parentResourcesRequirements,t.parentChainIsExact);if(a.length>0)throw this.buildError(ql.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,...Ox(n,e),...kx(n,e),params:o,riskLevel:e.riskLevel||zi.MEDIUM,resourceType:e.resourceIdentifier,operationIdentifier:String(e.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:el.COMPONENT,phase:lu.INITIAL}},c;switch(e.httpVerb){case dc.GET:c=await this.get(i,s);break;case dc.POST:c=await this.post(i,t.requestData,s);break;case dc.PUT:c=await this.put(i,t.requestData,s);break;case dc.DELETE:c=await this.delete(i,t.requestData===void 0?s:{...s,data:t.requestData});break;case dc.PATCH:c=await this.patch(i,t.requestData,s);break;default:throw this.buildError(ql.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(ql.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!==zl.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,...Ox(n,r),params:c,riskLevel:r.riskLevel||zi.MEDIUM,resourceType:r.resourceIdentifier,operationIdentifier:String(r.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:el.COMPONENT,phase:lu.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(ql.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(ql.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(Cle(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=Ca.extractOperationPath(n),r=Ca.createOperationPathKey(t);e.push(r)}}return e}getOperationDetails(e){let t=Ca.parseOperationPathKey(e);return this.findOperation(t)}},Nx=rs.getLogger();Nx.debugByType(`useNavigationState`),Nx.setDebugTypeLogging(`useNavigationState`,!1);function Px(){let e=(0,Q.useContext)(dh);if(!e)throw Error(`useNavigationState must be used within a NavigationProvider`);return e}var Fx;(function(e){e.ELEMENT=`element`,e.CREATE=`create`})(Fx||={});var Ix=(0,Q.createContext)({isAvailable:!1,target:null,open:()=>void 0,close:()=>void 0,isElementActive:()=>!1,isCreateActive:!1});function Lx({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===Fx.ELEMENT&&n.elementId===e:!1,[n]),s=(0,Q.useMemo)(()=>({isAvailable:!0,target:n,open:i,close:a,isElementActive:o,isCreateActive:n?.kind===Fx.CREATE}),[n,i,a,o]);return(0,$.jsx)(Ix.Provider,{value:s,children:t})}function Rx(){return(0,Q.useContext)(Ix)}var zx=rs.getLogger(),Bx=zx.debugByType(`useNavigationController`);zx.setDebugTypeLogging(`useNavigationController`,!1);function Vx(e){let t=e?.operationFrontendConfig?.surface;return t!==ju.EMBEDDED&&t!==ju.API_ONLY}function Hx(e,t,n=!1){zm.isInTransaction()||zm.beginTransaction(`controller_url_update`),e(t,{replace:n})}function Ux(e){if(!zm.isResourceOperationContent(e))return{operation:W.LIST,effectiveOperation:W.LIST,actionPresentationIsAuthored:!1};let t=e.resourceContext.operation;return{operation:t?.operationIdentifier??W.LIST,effectiveOperation:_l(t),resourceType:e.resourceContext.resourceType,operationSurface:t?.operationFrontendConfig?.surface,operationOverrides:t?.operationFrontendConfig?.navigationOverrides,actionPresentationTransition:jne(qc(t)),actionPresentationIsAuthored:t?.operationFrontendConfig?.actionPresentation!==void 0}}var Tle={[Sl.SECONDARY]:Sl.PRIMARY,[Sl.COMPANION]:Sl.SECONDARY};function Ele(e){let t=Gx(e);return t?.persistent===!0&&t.targetZone===e.placedZone}function Wx(e){let t=Gx(e);return t?(t.collapsedFromZone??t.targetZone)===Sl.PRIMARY:!1}function Gx(e){let t=Tle[e.paneZone];if(!e.layout||!t)return;let n=zm.isResourceOperationContent(e.content)?Dle(e.content.resourceContext,e.registry,e.viewport):void 0,r={[Sl.PRIMARY]:!0};return t===Sl.SECONDARY&&(r[Sl.SECONDARY]=!0),vh.resolve({...Ux(e.content),relationshipTransition:n,sourceZone:t,focusedZone:t,viewport:e.viewport,contentAreaWidth:e.contentAreaWidth,zoneOccupancy:r,zoneDepth:{}},e.layout)}function Dle(e,t,n){let r=(e.parentResourcesRequirements??[]).filter(e=>!e.isPrimaryScope),i=r[r.length-1];if(!i)return;let a=zm.findRelationshipBetween(i.resourceType,e.resourceType,t,i.foreignKeyField);return $h(a?.display?.inParentNavigation?.transition,n??xl.DESKTOP)}function Kx(e,t,n,r){let i=t.foreignKeyField,a=r.allResourceFieldIdentifiers?.[t.resourceType]??r.resourceConfigurations?.[t.resourceType]?.resourceFieldIdentifier;!i||i===a?e[t.resourceType]=n:On.selfReferenceForeignKeysOf(t.resourceType,r).includes(i)?e[i]={fieldIdentifier:i,resourceId:n}:e[t.resourceType]={fieldIdentifier:i,resourceId:n}}function qx(e){let{resourceType:t,contextResourceIdentifiers:n,parentResourcesRequirements:r,registry:i,emit:a,getZoneState:o}=e;if(!e.replaceExisting&&o(Sl.PRIMARY).stack.length>0)return;let s=i.resourceConfigurations?.[t];if(!s)return;let c={...n};delete c[t];let l=$l(Ia(s.operations??[],W.LIST,{allowBulk:!0}).filter(e=>Sn(e.operationFrontendConfig)),W.LIST,{allowBulk:!0});if(!l)return;let u=zm.resolveResourceUrl(s,l,Vu(c),i.allResourceFieldIdentifiers,r)?.resolvedUrl;a(wc.NAVIGATION_REPLACE,{zone:Sl.PRIMARY,content:{contentType:od.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:l,contextResourceIdentifiers:c,parentResourcesRequirements:r})},...u?{urlPath:u}:{},stackEntryId:zm.generateStackEntryId(),initiator:{sourceZone:Sl.PRIMARY},navigationSource:e.navigationSource??Qi.URL_SYNC,transition:Rt.REPLACE})}function Jx(e,t,n){return e?.admitsCrossTenantPlatformAdministration!==!0||n?.({...e,resourceType:t})===!0}function Yx(e,t,n,r,i,a,o,s){let c=e.resourceContext.parentResourcesRequirements;if(!c||c.length===0)return;let l=[];if(t===Sl.SECONDARY?l.push(Sl.PRIMARY):t===Sl.COMPANION&&l.push(Sl.SECONDARY,Sl.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),_=zm.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&&Kx(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=zm.resolveAncestorOperationConfig(_,h,{registry:n,contextResourceIdentifiers:S,contextualParameters:V.buildContextualParameters(S,n)}),w=Jx(C,m,s?.viewerMayPerform)?C:null;if(t===Sl.PRIMARY&&(!w||zm.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&&Kx(t,i,e,n)}qx({resourceType:g,contextResourceIdentifiers:t,parentResourcesRequirements:e,registry:n,emit:i,getZoneState:o,navigationSource:Qi.CONTROLLER,replaceExisting:!!s?.overwriteExisting});continue}if(!w)continue;let T=_l(w);x&&T===W.READ&&(b[m]=x);let E=On.createFrontendResourceOperationContextFromOperation({resourceType:m,operation:w,contextResourceIdentifiers:b,parentResourcesRequirements:y}),D={contentType:od.RESOURCE_OPERATION,resourceContext:E},O;if(Vx(w)){let e=zm.resolveResourceUrl(h,w,Vu(b),n.allResourceFieldIdentifiers,y);e?.resolvedUrl&&(O=e.resolvedUrl)}let k=zm.generateStackEntryId();Bx(`cascadeAncestorZones: populating ancestor zone`,{zone:t,ancestorResourceType:m,ancestorOp:T,ancestorUrl:O}),i(wc.NAVIGATION_REPLACE,{zone:t,content:D,urlPath:O,stackEntryId:k,initiator:{sourceZone:t},navigationSource:Qi.CONTROLLER,transition:Rt.REPLACE}),t===Sl.PRIMARY&&O&&a&&Hx(a,O,!0)}}function Ole(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 kle(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 Ale={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0};function Xx(){let{auth:e,appConfig:t}=Tu(),n=(0,Q.useContext)(th),r=ya.loadEnvironmentConfig().frontendServiceName;return(0,Q.useMemo)(()=>{let i=Ole(r,t.frontendServices),a=kle(r,n?.user?.userTypes,t.frontendServices)??i,o=(a?t.userTypes?.[a]:null)?.auth??null,s=o?.passwordPolicy??Ale,c=o?.registration,l=ws.safeParse(c),u=!!(a&&t.frontendServices?.[r]?.usersManagement?.[a]?.register===!0),d=l.success?{mode:l.data.mode,allowedMethods:l.data.allowedMethods,frontendServiceAllowsRegistration:u,publicRegistrationAvailable:u&&Dte(l.data.mode,Bs.PUBLIC_SELF_SERVICE),additionalProfileQuestions:l.data.additionalProfileQuestions??[],profileNamesCollectedAt:we(l.data)}:{mode:to.DISABLED,allowedMethods:[],frontendServiceAllowsRegistration:!1,publicRegistrationAvailable:!1,additionalProfileQuestions:[],profileNamesCollectedAt:Wc.REGISTRATION};return{resolvedUserType:a,userTypeAuth:o,globalAuth:e,passwordPolicy:s,registrationConfig:d}},[r,t,e,n?.user?.userTypes])}var Zx=(0,Q.createContext)(void 0),jle=`wildo:appMode:`;function Mle(e,t){return`${jle}${e??`default`}:${t??`anon`}`}function Nle(e){try{return localStorage.getItem(e)}catch{return null}}function Ple(e,t){try{localStorage.setItem(e,t)}catch{}}function Qx(e,t){if(e.length===0)return null;let n=new Set(e.map(e=>e.ref)),r=Nle(t);if(r&&n.has(r))return r;let i=e.find(e=>e.isDefault);return i?i.ref:e[0].ref}var $x=({children:e})=>{let{frontendConfiguration:t,appConfig:n}=Tu(),{resolvedUserType:r}=Xx(),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)(()=>Mle(n?.appIdentity?.appName,void 0),[n?.appIdentity?.appName]),[s,c]=(0,Q.useState)(()=>Qx(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=Qx(a,o);c(t)},[a,o]);let l=(0,Q.useCallback)(e=>{a.some(t=>t.ref===e)&&(c(e),Ple(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)(Zx.Provider,{value:u,children:e})};function Fle(){let e=(0,Q.useContext)(Zx);if(!e)throw Error(`useAppMode must be used within an AppModeProvider`);return e}function eS(){return(0,Q.useContext)(Zx)??null}var Ile=rs.getLogger(),Lle=100,tS;(function(e){e.PENDING=`pending`,e.HELD=`held`,e.NONE=`none`,e.UNKNOWN=`unknown`,e.STALE=`stale`})(tS||={});function nS(e){return e?e.state===tS.HELD||(e.state===tS.PENDING||e.state===tS.STALE)&&e.previouslyHeld===!0:!1}var rS=new Map,iS=new Set;function Rle(e){return iS.add(e),()=>{iS.delete(e)}}function aS(){for(let e of iS)e()}function oS(e){let t=rS.get(e);t&&t.state!==tS.STALE&&(rS.set(e,{state:tS.STALE,previouslyHeld:nS(t)}),aS())}function zle(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function Ble(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 Vle(e){let t=e;return t?.wildoError?.type===za.NOT_FOUND||t?.wildoError?.context?.httpStatus===404||t?.response?.status===404||t?.status===404}function Hle(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 sS(e,t,n){let r=(0,Q.useContext)(im),i=Jp(),a=(0,Q.useContext)(Wi),o=i?.currentUserId??null,s=i?.currentOrganizationId??null,c=r?.registry,l=(0,Q.useMemo)(()=>zle(c?.resourceConfigurations[e.resourceType]?.operations,e.operation),[c,e.resourceType,e.operation]),u=c?.resourceConfigurations[ll.ORGANIZATIONS]?.resourceFieldIdentifier,d=!!l&&Vm({...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)(Rle,()=>f?rS.get(f):void 0,()=>void 0);(0,Q.useEffect)(()=>{let t=f?rS.get(f):void 0;if(!f||t&&t.state!==tS.STALE||!l||!u||!s)return;let n=p.current;if(!n)return;let r={state:tS.PENDING,previouslyHeld:nS(t)};rS.set(f,r),aS();let i=e=>{rS.get(f)===r&&(rS.set(f,{state:e}),aS())},a=Ca.buildOperationPathKeyFromOperation(l),o={[u]:s};(async()=>{try{if(e.operation===W.READ){let e=Hle(await n(a,{contextualParameters:o},{silent:!0}));i(e&&m.current(e)?tS.HELD:tS.NONE);return}for(let e=1;;e+=1){let{rows:t,totalPages:r}=Ble(await n(a,{contextualParameters:o,queryParameters:{page:e,limit:Lle}},{silent:!0}));if(t.some(e=>m.current(e))){i(tS.HELD);return}if(e>=r||t.length===0){i(tS.NONE);return}}}catch(t){if(e.operation===W.READ&&Vle(t)){i(tS.NONE);return}Ile.warn(`Could not read whether the organization holds this configuration`,{probe:e.key,organizationId:s,error:t}),i(tS.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&&oS(e)},[f]),(0,Q.useEffect)(()=>{if(f)return a.on(wc.RESOURCE_OPERATION_EXECUTED,()=>oS(f),t=>t.resourceType===e.resourceType&&!da(t.operation??{operationIdentifier:t.operationIdentifier}))},[a,f,e.resourceType]),nS(h)}var Ule={key:`scim-unrevoked-token`,resourceType:ll.ORGANIZATION_SCIM_TOKENS,operation:W.LIST,matches:e=>e.isActive===!0};function Wle(e,t){return sS(Ule,e,t)}function cS(){return lS(void 0)}function lS(e){let t=(0,Q.useContext)(th)?.permissions??null,n=Jp()?.currentOrganizationId??null,r=lg(),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 uS(){let e=lS(void 0),t=(0,Q.useRef)(e);return t.current=e,(0,Q.useCallback)(e=>Vm(e,t.current),[])}function dS(){let e=(0,Q.useContext)(Fi)?.appConfig,t=e?.organizationRelationships,n=e?.organizationTypes,r=(0,Q.useContext)(th)?.organizations,i=Jp()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>({organizationRelationships:t,organizationTypes:n,organizations:r,currentOrganizationId:i}),[t,n,r,i])}function fS(){let e=dS();return(0,Q.useMemo)(()=>hv(e),[e])}function Gle(){let e=dS();return(0,Q.useMemo)(()=>_v(e),[e])}function pS(){let e=(0,Q.useContext)(th)?.organizations,t=Jp()?.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 Kle(){let e=(0,Q.useContext)(Fi)?.appConfig?.organizationTypes,t=pS();return(0,Q.useMemo)(()=>Ei(e,t),[e,t])}var qle={key:`sso-connection`,resourceType:ll.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST,matches:()=>!0},mS=e=>Array.isArray(e)&&e.length>0,hS=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Jle={key:`sso-policy`,resourceType:ll.ORGANIZATION_SSO_CONFIG,operation:W.READ,matches:e=>{let t=hS(e.enforcement),n=hS(e.domains),r=hS(e.emergencyAccess),i=hS(e.oauth2ProviderRestrictions);return t.requireSSO===!0||mS(n.verifiedDomains)||mS(n.ssoEnabledDomains)||mS(r.breakGlassAccounts)||mS(i.allowedProviders)||mS(i.blockedProviders)||i.requireEnterpriseSSOOnly===!0||mS(e.socialCredentialOverrides)}},Yle={key:`siem-export-enabled`,resourceType:ll.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ,matches:e=>e.enabled===!0},Xle={key:`webhook-config-configured`,resourceType:ll.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ,matches:e=>e.enabled===!0||mS(e.endpoints)},Zle=e=>!1;function gS(){let e=eS(),t=Jp(),n=cS(),r=(0,Q.useContext)(fh),i=r?.resolvedFeatures,a=r?.isFeatureOffered??Zle,o=Hh(),s=!!r&&r.isLoading!==!0&&(t?.currentOrganizationId??null)===r.resolvedForOrganizationId,c=a(Ds.SINGLE_SIGN_ON),l=s&&!c,u=sS(qle,l,n),d=sS(Jle,l,n),f=c||u||d,p=a(Ds.DIRECTORY_PROVISIONING),m=pS(),h=Kle(),g=Wle(s&&yv({featureOffered:p,organizationTypeKnown:m!==void 0,organizationTypeDirectoryProvisioned:h}),n),_=(0,Q.useMemo)(()=>bv({featureOffered:p,organizationTypeDirectoryProvisioned:h,holdsUnrevokedToken:g}),[p,h,g]),v=a(Ds.SECURITY_EVENT_EXPORT),y=sS(Yle,s&&!v,n),b=v||y,x=a(Ds.M2M_WEBHOOK_DELIVERY),S=sS(Xle,s&&!x,n),C=x||S,w=fS(),T=Gle(),E=(0,Q.useContext)(Fi)?.appConfig?.decisionInbox,D=Object.keys((0,Q.useContext)(Fi)?.appConfig?.professionalQualificationKinds??{}).length>0,O=(0,Q.useMemo)(()=>Hv({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,[wv]:D}}),[e?.activeMode,e?.availableModes,t?.allScopeValues,n,i?.features,o?.isEnabled,f,_,b,C,w,T,O,D])}function _S(e,t){return(e?.requiredCapabilities??[]).every(e=>!!t.runtimeCapabilities[e])&&Nm(e?.requiredRoles,t.effectiveRoles)}function vS(e,t){return e.flatMap(e=>_S(e.runtimeAvailability,t)?e.children?.length?[{...e,children:vS(e.children,t)}]:[e]:[])}function Qle(e,t){return{...e,children:vS(e.children,t)}}function $le(e,t){if(!e?.length)return e;let n=[];for(let r of e)_S(r.runtimeAvailability,t)&&(r.contentKind===ze.NAVIGATION_LIST?n.push(Qle(r,t)):n.push(r));return n}function eue(e,t){return yS(e,t)}function yS(e,t){return e?.length?e.filter(e=>_S(e.runtimeAvailability,t)):e}function tue(e,t){return yS(e,t)}function nue(e,t){return yS(e,t)}function rue(e,t){return yS(e,t)}function iue(e,t){return yS(e,t)}function aue(e,t){return yS(e,t)}var bS=rs.getLogger(),xS=new Set,SS=(0,Q.createContext)(null);function CS(){let{emit:e}=Ao(),{resourceRelationshipDepth:t,getZoneDepth:n,getZoneState:r,contentAreaWidth:i}=Px(),{navigationLayout:a,currentBreakpoint:o,compositeViews:s,fullCustomViews:c,flowsActorsViews:l}=Rg(),{user:u}=sg(),d=Jp(),{registry:f,getOperationContextNeeds:p}=lm(),m=nh(),h=uS(),g=(0,Q.useRef)(0),_=cg(),v=(0,Q.useRef)(zm.buildBrowserUrl(_.pathname,_.search));v.current=zm.buildBrowserUrl(_.pathname,_.search);let y=Rx(),b=(0,Q.useCallback)((t=Sl.PRIMARY)=>{if(r(t).stack.length===0)return;if(t===rr.OVERLAY){e(wc.NAVIGATION_POP,{zone:t});return}let n=zm.resolveGoBackTarget({zone:t,currentBrowserUrl:v.current,getZoneState:r});n&&(e(wc.NAVIGATION_POP,{zone:t}),n.browserUrl&&Hx(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(Bx(`navigate() called`,{contentType:_.contentType,sourceZone:x.sourceZone,urlPath:S}),_.contentType===od.SETTINGS_HUB){m(S??Ln.settings);return}if(!a){Bx(`navigate() aborted: no navigationLayout`);return}let t=Qp.extractPrimaryScopeFromContent(_,f,s,c,l),D=Qp.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId}),O=Qp.primaryScopeToContextIdentifiers(D,t),k=d?.buildContextResourceIdentifiers()??{},A=zm.isResourceOperationContent(_)?_.resourceContext.contextResourceIdentifiers??{}:{},j={...O,...k,...A,...C},M={};for(let[e,t]of Object.entries(j)){let n=On.getResourceId(t);if(n){M[e]=n;let r=On.getFieldIdentifier(t);r&&(M[r]=n)}}let N=!1,P=Ux(_),F=P.operationSurface,I,ee,L=_;if(zm.isResourceOperationContent(_)){let e=_.resourceContext.operation;if(F===ju.API_ONLY){bS.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=yh({initiatorInfos:e.initiatorInfos,targetResourceType:t,registry:f,ownIdentifiers:{...A,...C},tenancyIdentifiers:O,parentResourcesRequirements:_.resourceContext.parentResourcesRequirements}),i=zm.resolveResourceUrl(r,e,M,f.allResourceFieldIdentifiers,n??_.resourceContext.parentResourcesRequirements,n!==void 0);i&&(i.templateUrl,I=i.routePathParameters,ee=i.resolvedUrl)}N=Vx(e)&&!!(ee??S);let i=new Set((I??[]).map(e=>e.resourceType));if(`enabledCondition`in e&&e.enabledCondition&&p(e).needsUserContext&&!u){console.warn(`[useNavigationController] Navigation blocked: enabledCondition requires user context but user is missing`,{resourceType:t,operationIdentifier:e.operationIdentifier});return}if(n!==g.current){Bx(`navigate() aborted: superseded before state mutation`,{requestId:n,latestRequestId:g.current,sourceZone:x.sourceZone});return}let a={};for(let[e,t]of Object.entries({...O,...k}))(i.size===0||i.has(e))&&(a[e]=t);let o=_.resourceContext.contextResourceIdentifiers?.[t];L={..._,resourceContext:{..._.resourceContext,contextResourceIdentifiers:{...a,...C,...o?{[t]:o}:{},..._.resourceContext.contextResourceIdentifiers}}}}else if(_.contentType===od.COMPOSITE_VIEW||_.contentType===od.CHART_VIEW||_.contentType===od.FULL_CUSTOM_VIEW||_.contentType===od.EXECUTION_VIEW||_.contentType===od.FLOWS_ACTORS_VIEW){let e={..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}else if(_.contentType===od.CUSTOM_COMPONENT){let e={...O,...k,..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}x.sourceZone===`appLevel`&&(Zh(e,`app_level_navigation`),Bx(`APP_LEVEL clean break: cleared SECONDARY + COMPANION + OVERLAY`)),zm.isResourceOperationContent(L)&&zm.calculateResourceRelationshipDepth(L.resourceContext.parentResourcesRequirements);let R={},z={};for(let e of pr){let t=r(e).stack.length;z[e]=t,R[e]=t>0}let te=x.sourceZone,ne=P.operation,re=P.effectiveOperation,ie=P.resourceType,ae=te!==`appLevel`&&te!==rr.OVERLAY?te:void 0,oe={sourceZone:te,...P,relationshipTransition:w,relationshipMaxDepth:T,viewport:o,contentAreaWidth:i,zoneOccupancy:R,zoneDepth:z,focusedZone:ae},se=vh.resolve(oe,a),ce=se.provenance.adjustments.includes(cn.PERSISTENT_SPLIT_ESCALATED_NO_COMPANION);if(ce||se.provenance.adjustments.includes(cn.SPLIT_ESCALATED_NO_ADJACENT_ZONE)){let e=`${ie??`view`}:${ne}`;xS.has(e)||(xS.add(e),bS.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(Bx(`Policy resolved`,{targetZone:se.targetZone,transition:se.transition,decidedBy:se.provenance.transitionSource,authoredAs:se.provenance.authoredTransition,adjustments:se.provenance.adjustments,appearance:se.appearance,collapsed:se.collapsed,collapsedFromZone:se.collapsedFromZone,ephemeral:se.ephemeral,persistent:se.persistent}),se.transition===Rt.INPLACE){let e=zm.isResourceOperationContent(L)?oue(L,re):void 0;if(e&&y.isAvailable){Bx(`INPLACE resolved to the element-level host`,{kind:e.kind}),y.open(e);return}Bx(`INPLACE has no element-level host here — degrading to overlay`,{hasTarget:!!e,hostAvailable:y.isAvailable}),se=vh.degradeInPlaceToOverlay(oe,a,se)}se.transition===Rt.PROMOTE&&(Zh(e,`promote_navigation`),Bx(`PROMOTE clean break: cleared SECONDARY + COMPANION + OVERLAY`)),x.sourceZone===rr.OVERLAY&&se.targetZone!==rr.OVERLAY&&se.transition!==Rt.PROMOTE&&(hh(e,`overlay_breakout_navigation`),Bx(`OVERLAY breakout: closed the overlay it was launched from`,{targetZone:se.targetZone,transition:se.transition})),(se.targetZone===Sl.SECONDARY||se.targetZone===Sl.COMPANION)&&zm.isResourceOperationContent(L)&&Yx(L,se.targetZone,f,M,e,m,r,{viewerMayPerform:h});let le=zm.generateStackEntryId(),ue=ee??S,de=se.targetZone!==rr.OVERLAY,fe=L.contentType===od.EXECUTION_VIEW&&wp({viewRef:L.viewRef,registry:f})?.isAddressable===!0,pe=L.contentType===od.COMPOSITE_VIEW||L.contentType===od.CHART_VIEW||L.contentType===od.FULL_CUSTOM_VIEW||fe||L.contentType===od.FLOWS_ACTORS_VIEW||L.contentType===od.ENGINE_PAGE,me=de&&!!ue&&(N||pe),he=me?L.contentType===od.COMPOSITE_VIEW?Ep(L.viewRef,L.contextResourceIdentifiers):L.contentType===od.CHART_VIEW?Rp(L.viewRef,L.contextResourceIdentifiers,L.urlParamValues):L.contentType===od.EXECUTION_VIEW?Pp(L.viewRef,L.contextResourceIdentifiers):ue:void 0,ge=zm.getTopEntry(r(Sl.PRIMARY)),_e=se.targetZone===Sl.SECONDARY&&me&&he!==void 0&&zm.hostedPaneApplies({paneContent:L,primaryTop:ge}),ve={zone:se.targetZone,content:L,urlPath:he,stackEntryId:le,initiator:x,navigationSource:Qi.CONTROLLER,transition:se.transition,appearance:se.appearance,overlayBehavior:se.overlayBehavior,ephemeral:se.ephemeral,persistent:se.persistent,..._e?{hostedPane:!0}:{},...se.collapsedFromZone?{collapsedFromZone:se.collapsedFromZone}:{}},ye=se.targetZone===rr.OVERLAY&&x.sourceZone===rr.OVERLAY,be=se.transition===Rt.PUSH||ye,xe=de?r(se.targetZone):void 0,Se=xe&&xe.activeTabId===void 0?xe.stack[xe.stack.length-2]:void 0;if(se.transition===Rt.PUSH&&he!==void 0&&Se?.urlPath&&zm.urlsAddressSameDestination(Se.urlPath,he)){Bx(`PUSH names the entry beneath — going back instead`,{zone:se.targetZone,finalUrlPath:he}),b(se.targetZone);return}Bx(`Emitting navigation event`,{event:be?`PUSH`:`REPLACE`,zone:se.targetZone,finalUrlPath:he,hostedPane:_e,stacksOnOverlay:ye}),Vh(()=>{if(e(be?wc.NAVIGATION_PUSH:wc.NAVIGATION_REPLACE,ve),me&&he){let e=E===!0||se.transition===Rt.REPLACE||se.transition===Rt.PROMOTE,t=_e||se.targetZone===Sl.COMPANION?zm.resolveBrowserUrlForZoneEntry({zone:se.targetZone,entryUrlPath:he,paneContent:L,currentBrowserUrl:v.current,getZoneState:r})??he:he;Hx(m,t,e)}},{zone:se.targetZone})}catch(e){bS.error(`useNavigationController navigation failed`,{error:e,requestId:n,sourceZone:x.sourceZone,contentType:_.contentType,urlPath:S,resourceType:zm.isResourceOperationContent(_)?_.resourceContext.resourceType:void 0,operationIdentifier:zm.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:od.RESOURCE_OPERATION,resourceContext:e};x({content:i,initiator:t,urlPath:n,relationshipTransition:r})},[x]),C=(0,Q.useCallback)(()=>{let t=zm.getTopEntry(r(rr.OVERLAY));t&&e(wc.NAVIGATION_CLOSE,{zone:rr.OVERLAY,stackEntryId:t.id})},[e,r]),w=(0,Q.useCallback)(t=>{if(t===Sl.PRIMARY||r(t).stack.length===0)return;let n=zm.resolveZoneDismissUrl({zone:t,currentBrowserUrl:v.current,getZoneState:r});e(wc.NAVIGATION_CLEAR_ZONE,{zone:t}),n&&Hx(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 oue(e,t){let n=e.resourceContext,r=n.operation;if(!r)return;if(t===W.CREATE||t===W.CREATE_MANY)return{kind:Fx.CREATE,operation:r,resourceContext:n};let i=On.getAddressedRecordId(n);return i?{kind:Fx.ELEMENT,elementId:i,operation:r,resourceContext:n}:void 0}function wS(){let e=(0,Q.useContext)(SS),t=CS();return e??t}function TS(){let{registry:e}=lm(),{navigateToResource:t}=wS(),n=(0,Q.useCallback)(n=>{let{resourceType:r,resourceId:i,contextResourceIdentifiers:a={},sourceZone:o=Sl.PRIMARY}=n;if(!i)return!1;let s=e.resourceConfigurations[r];if(!s)return!1;let c=On.buildRecordIdentifiersFromCollection(a,r,i),l=sue(s,e,c);return l?(t(On.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:l,contextResourceIdentifiers:c}),{sourceZone:o,sourceOperation:W.READ}),!0):!1},[e,t]);return(0,Q.useMemo)(()=>({navigateToResourceRead:n}),[n])}function sue(e,t,n){let r=r=>lh({resourceConfig:e,operations:e?.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:r,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,t)}),i=r(!0);if(i)return i;let a=r(!1);return a?.operationFrontendConfig?.surface===ju.EMBEDDED?a:void 0}function ES(e,t){let n=e.filterFields;return n&&Object.keys(n).length>0||_l(e)!==W.LIST?n:t.find(e=>String(e.operationIdentifier)===W.SEARCH&&e.isOperationDefault===!0)?.filterFields}function cue(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 lue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a,board:o}=t;if(i===gu.BOARD&&!o)return`displayMode BOARD requires collectionDisplayConfig.board: { groupByField } naming the enum field its columns come from`;if(!o)return;if(i!==gu.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=ES(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&&!cue(r,o.transitionOperation))return`board.transitionOperation ${JSON.stringify(o.transitionOperation)} names no operation this resource's frontend registry holds`}var uue=[{mode:gu.CALENDAR,configKey:`calendar`,shape:`{ dateField }`,fields:e=>e.calendar?[[`calendar.dateField`,e.calendar.dateField]]:void 0},{mode:gu.TIMELINE,configKey:`timeline`,shape:`{ startField, endField }`,fields:e=>e.timeline?[[`timeline.startField`,e.timeline.startField],[`timeline.endField`,e.timeline.endField]]:void 0}];function due(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a}=t;for(let e of uue){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===gu.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=ES(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 DS(e){return e?._zod?.def?.type===`object`}function OS(e,t){let n=t[hn]??{},r=e[hn]??{};return Object.fromEntries(Object.entries(n).filter(([e,t])=>r[e]!==t))}function kS(e,t){let n=Pa(e,[]);return n[hn]={...n[hn]??{},...t},n}function AS(e,t,n,r={}){if(n===t)return e;if(!DS(e)||!DS(t)||!DS(n))return n;let i=Da(e),a=Da(t),o=Da(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=OS(n,t);Object.keys(o).length>0&&(s[e]=kS(r,o))}let c=Object.keys(s).length===0?e:Wa(e,s);if(r.objectLevel){let r=OS(t,n);if(Object.keys(r).length>0){if(c===e)c=kS(e,r);else{let e=c;e[hn]={...e[hn]??{},...r}}}}return c}function fue(e,t){try{let n=Da(e),r=Da(t);return Object.entries(n).some(([e,t])=>{let n=r[e];return n?t===n||lr(t)===n:!1})}catch{return!1}}function jS(e,t,n){if(!e)return;let r=hr.getObjectLikeFieldShape(e,{commonOnly:!1}),i=hr.getObjectLikeFieldShape(t,{commonOnly:!1});if(r&&i)for(let[e,t]of Object.entries(r)){let r=i[e];if(!r||!t||t===r||n.has(t))continue;let a=Rl(r);if(Object.keys(a).length===0)continue;let o=Rl(t);Object.keys(a).some(e=>!(e in o)||o[e]!==a[e])&&(t[hn]={...o,...a})}}var pue=[Zt.IS_FOREIGN_KEY,Zt.FOREIGN_KEY_UI];function mue(e,t){if(!e||!t)return e;let n=hr.getObjectLikeFieldShape(e,{commonOnly:!1}),r=hr.getObjectLikeFieldShape(t,{commonOnly:!1});if(!n||!r)return e;let i=new Map;for(let[e,t]of Object.entries(n)){let n=r[e];if(!t||!n||!Fc(n)||Fc(t)||me(t)===_u.ARRAY!=(me(n)===_u.ARRAY))continue;let a=Rl(n),o={};for(let e of pue)e in a&&(o[e]=a[e]);let s=Pa(t,[]);s[hn]={...Rl(t),...o},i.set(t,s)}return i.size===0?e:hue(e,i)}function hue(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=va(e,i);return r.delete(e),n.set(e,s),s};return i(e)}function gue(e){let t=bae.get(e)?.[dee];return typeof t==`string`?t:void 0}function _ue(e,t,n){let r=new Map,i=new Map,a=new Map,o=(e,t)=>{let s=gue(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=va(e,e=>o(e,s));return d.delete(e),l.set(e,f),f};return o(e,t)}function MS(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))MS(e[r],t[r],n);return}for(let e of[`innerType`,`element`,`valueType`,`in`,`out`])MS(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)=>MS(e,o[t],n))}function NS(e,t){if(e===void 0)return;let n=!1,r=e.inheritedSchemas.map(e=>{let r=t(e.schema),i=NS(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 PS(e,t,n){for(let t of Object.values(Da(e)??{}))n.add(t);for(let e of t?.inheritedSchemas??[])PS(e.schema,e.inheritenceSchemaDefinition,n)}function vue(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:NS(e,e=>r(e)?AS(e,t,n):e)}var FS=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(za.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,...Bc},s=[...n||[],...Xte],c=z_(s);if(c.length>0)throw this.buildConfigurationError(ql.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=Bl.ensureCompiledRelationships.call(Bl,s,o),u=[...r??[]].filter(e=>ru.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=>!ru.has(e))):r,f={};e&&Object.keys(e).length>0&&Object.entries(e).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(f[e]=t(l))});let p={};ui&&Object.keys(ui).length>0&&Object.entries(ui).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(p[e]=t(l))});let m={...p,...f};if(d&&d.size>0){m=Object.fromEntries(Object.entries(m).filter(([e])=>!d.has(e))),l=l.filter(e=>!d.has(e.resourceType1)&&!d.has(e.resourceType2));for(let e of d)delete o[e]}this.normalizeResourceConfigurationRelationships(m,o);let h=this.buildFrontendResourceConfigurations(m,o,i);zu(h,l,o),cs.rebuildResourceConfigurationsOperationDtos(h),this.overlayUiBehaviorDtoDecorators(h,i),this.substitutePresentationIntoCustomDtos(h),this.carryReferenceIdentityOntoCustomRequestDtos(h);let g=Bl.buildFieldIdentifierToResourceTypeMap({allResourceFieldIdentifiers:o,allResourceRelationships:l,getMainSchema:e=>h[e]?.mainSchema,fieldIdentifierPriority:Mie,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.`)}}),_=Bl.buildManyToManyScopeJunctionMap(l,o);this.registry={allResourceFieldIdentifiers:o,fieldIdentifierToResourceType:g,manyToManyScopeJunctions:_,notificationBadgeDefinitions:[...F_,...a??[]],additionalUserNotificationDefinitions:[],resourceRelationships:l,resourceConfigurations:h,subtreeMap:H_(l)},this.generateUrlsForApiCallOperations(h,o),this.resourcesHttpClient=new Mx(this.registry,{baseURL:this.httpClient.getBaseURL(),timeout:3e4,enableNetworkQueue:!0}),this.validateForeignKeyResolution(h,g),this.validateResourceOwnedViewRefUniqueness(h),this.validateFileDisplayPolicyCoherence(h),this.isInitialized=!0}catch(e){throw e?.wildoError?e:this.buildConfigurationError(ql.CONFIGURATION,{message:`Failed to initialize frontend resources: ${po(e)}`})}}normalizeResourceConfigurationRelationships(e,t){for(let n of Object.values(e))n.resourceRelationships={parentRelationships:Bl.ensureCompiledRelationships.call(Bl,n.resourceRelationships.parentRelationships,t),childRelationships:Bl.ensureCompiledRelationships.call(Bl,n.resourceRelationships.childRelationships,t),selfRelationships:Bl.ensureCompiledRelationships.call(Bl,n.resourceRelationships.selfRelationships,t)}}carryReferenceIdentityOntoCustomRequestDtos(e){for(let t of Object.values(e))for(let e of t.operations??[])e.hasCustomRequestDto&&(e.requestDto=mue(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;MS(r,n.mainSchema,o);let s=(e,t)=>{e?.inheritedSchemas.forEach((e,n)=>{let r=t?.inheritedSchemas[n];MS(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]=_ue(i,t,this.presentationSubstitutionsByResource))}}}overlayUiBehaviorDtoDecorators(e,t){if(t)for(let[n,r]of Object.entries(t)){let t=r[Di];if(!t)continue;let i=this.declaredFieldInstancesByResource.get(n)??new Set,a=e[n];if(a?.operations)for(let e of a.operations)e.hasCustomResponseDto||(jS(e.responseDto,t,i),jS(e.contextDto,t,i)),e.hasCustomRequestDto||jS(e.requestDto,t,i),jS(e.summaryDto,t,i)}}buildFrontendResourceConfigurations(e,t,n){let r={};for(let[t,n]of Object.entries(e))r[t]={...n,operations:(n.operations??[]).filter(e=>e.variantType===at.API_CALL).map(e=>({...e,operationFrontendConfig:void 0})),frontendConfiguration:void 0};if(n)for(let[e,i]of Object.entries(n)){let n=r[e];if(!n){console.warn(`[ResourcesRegistry] Frontend preset references resource "${e}" which has no backend configuration. Skipping.`);continue}let{views:a,relationshipOverrides:o,compositeViews:s,executionViews:c,...l}=i,u=i[Di],d=new Set;if(PS(n.mainSchema,n.inheritenceSchemaDefinition,d),this.declaredFieldInstancesByResource.set(e,d),u&&u!==n.mainSchema){let t=n.mainSchema,r=AS(t,i[Ju]??t,u,{objectLevel:!0});if(this.presentSchemas(e,n,{mainSchema:r,inheritenceSchemaDefinition:vue(n.inheritenceSchemaDefinition,t,r)}),r!==t)for(let e of n.operations){if(!e.requestDto)continue;let n=e.resourceOperationLike?String(e.resourceOperationLike):String(e.operationIdentifier);(n===W.CREATE||n===W.UPDATE)&&!e.hasCustomRequestDto&&fue(e.requestDto,t)&&(e.requestDto=Oe(n,r,void 0))}}if((n.recordLabelFields?.length??0)>0&&l.getFrontendResourceLabel!==void 0)throw Error(`[ResourcesRegistry] Resource "${e}" names its records twice: \`recordLabelFields\` (${n.recordLabelFields.join(`, `)}) and its ui-behavior's getFrontendResourceLabel. A record has one name, which a chat shows too: remove getFrontendResourceLabel (the application names it by recordLabelFields), or remove recordLabelFields if the resource has no chat command that names its records.`);let f=this.buildResourceCompositeViewDefinitions(e,n.resourcePrimaryScope??Vr.ORGANIZATIONS,s),p=this.buildResourceExecutionViewDefinitions(n.resourcePrimaryScope??Vr.ORGANIZATIONS,c);if(n.frontendConfiguration={...l,...f.length>0&&{compositeViews:f},...p.length>0&&{executionViews:p}},a)for(let[e,t]of a){let r=this.findOperationByPresetKey(n.operations,e);r&&(r.operationFrontendConfig=t)}o&&o.length>0&&this.resolveRelationshipDisplayOverrides(e,n.resourceRelationships,o,t)}for(let[e,t]of Object.entries(r))for(let n of t.operations){if(n.operationFrontendConfig===void 0){n.operationFrontendConfig={surface:n.defaultFrontendPosture??(n.isBulkOperation?ju.EMBEDDED:ju.API_ONLY)};continue}if(n.operationFrontendConfig.surface===ju.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=lue({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(r)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${r}.`);let i=due({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:up(e,n),scope:Zp.RESOURCE,isAddressable:!0,operationLike:r.operationLike??W.READ,primaryScope:t,sectionRefs:r.sectionRefs,viewComponent:r.viewComponent,icon:r.icon})):[]}buildResourceExecutionViewDefinitions(e,t){return t?Object.entries(t).map(([t,n])=>({ref:t,scope:Zp.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!==sre.STANDALONE);e.length>0&&(n.length=0,n.push(...e))}if(i.foreignKeyField&&n.length>0){let e=n.filter(({rel:e})=>Bl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier===i.foreignKeyField);n.length=0,n.push(...e)}if(n.length===0){if(ya.isDevelopment()){let n=[...t.childRelationships.map(e=>`${e.resourceType2} (FK: ${Bl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.parentRelationships.map(e=>`${e.resourceType1} (FK: ${Bl.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.selfRelationships.map(e=>`${e.resourceType1} (FK: ${Bl.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(ya.isDevelopment()){let t=n.map(({rel:e})=>Bl.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&&ya.isDevelopment()&&console.warn(`[RelationshipDisplay] Resource "${e}" has ${n.length} relationships with "${i.target}" even after FK field "${i.foreignKeyField}" filtering. Applying to first match.`);let{bucket:a,index:o,rel:s}=n[0],c={...s,display:s.display?{...s.display}:void 0};i.inParentNavigation&&(c.display={...c.display,inParentNavigation:{...c.display?.inParentNavigation,...i.inParentNavigation}}),i.inChildView&&(c.display={...c.display,inChildView:{...c.display?.inChildView,...i.inChildView}}),c.display&&=tn.parse(c.display),a[o]=c}}deriveForeignKeyDisplayFromRelationships(e,t,n){let{parentRelationships:r,selfRelationships:i}=t.resourceRelationships,a=[...r,...i];for(let r of a){if(r.resourceType1===r.resourceType2&&!r.foreignKeyField)continue;let i=Bl.tryResolveRelationshipForeignKeyIdentity(r,n)?.fieldIdentifier;if(!i)continue;let a=r.display?.inChildView?.parentDisplay??na.CONTEXT,o,s;switch(a){case na.CONTEXT:o=tt.LABEL,s=!0;break;case na.BREADCRUMB:o=tt.LABEL,s=!1;break;case na.BADGE:o=tt.LABEL,s=!1;break;case na.SUMMARY:o=tt.SUMMARY,s=!0;break;case na.NONE:o=tt.ID,s=!1;break;default:o=tt.LABEL,s=!0}let c={display:{mode:o,linkable:s}},l=e=>{let t=Da(e)?.[i];if(!t||!Fc(t)||Rl(t)[Zt.FOREIGN_KEY_UI]!==void 0)return e;let n=Pa(t,[{ref:Zt.FOREIGN_KEY_UI,params:c}]);return Wa(e,{[i]:n})};this.presentSchemas(e,t,{mainSchema:l(t.mainSchema),inheritenceSchemaDefinition:NS(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(ql.CONFIGURATION,{operationIdentifier:t,candidateVariants:i.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation})),message:`Frontend preset operation key resolves to multiple URL-bearing variants. Use an explicit [operationIdentifier, variantKey] tuple or make the default operation identity unique.`})}generateUrlsForApiCallOperations(e,t){for(let[n,r]of Object.entries(e))try{Vn.updateOperationUrls(r,t)}catch(e){console.error(`Failed to generate URLs for resource type ${n}:`,e)}}getResourcesRegistry(){if(!this.isInitialized)throw this.buildConfigurationError(ql.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(ql.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesHttpClient`});return this.resourcesHttpClient}getApplicationHttpClient(){return this.httpClient}validateForeignKeyResolution(e,t){let n=Bl.collectUnresolvableForeignKeyFields({mainSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.mainSchema])),variantSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,rl(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),ya.isDevelopment())throw this.buildConfigurationError(ql.FRONTEND_FK_RESOLUTION_FAILED,{unresolvedFKFields:n,message:t})}}validateFileDisplayPolicyCoherence(e){let t=[];for(let[n,r]of Object.entries(e)){let e=[r.mainSchema,...rl(r.inheritenceSchemaDefinition)].flatMap(e=>Object.entries(Da(e)??{})),i=new Set;for(let[r,a]of e){if(i.has(r))continue;let e=a,o=Ms(e);if(!o?.nature)continue;let s=vl(e);if(!s)continue;let c=s.presentation!==void 0&&s.presentation!==Hie.CARD,l=s.activation?.policy===Xu.OVERLAY;(c||l)&&$e(o.nature)===!1&&(i.add(r),t.push({resourceType:n,fieldName:r,nature:String(o.nature),requested:c?`presentation ${s.presentation}`:`activation overlay`}))}}if(t.length===0)return;let n=t.map(({resourceType:e,fieldName:t,nature:n,requested:r})=>` - ${e}.${t} (nature ${n}) requests ${r}`).join(`
6
- `),r=`[ResourcesRegistry] ${t.length} file field(s) request a display no displayer can satisfy:\n${n}\nFix: use presentation CARD (with a DOWNLOAD/NEW_TAB activation) for natures that have no viewer, or widen the declared FileNature if the field genuinely holds displayable files.`;if(console.error(r),ya.isDevelopment())throw this.buildConfigurationError(ql.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 Bh({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(ql.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 IS(e){return Ca.createOperationPathKeyFromOperation(e)}function LS(e){let t=e?.requiredFeatures;return t?Array.isArray(t)||!t.appliesWhen:!1}function RS(e){return!!(e.enabledCondition||e.requiredFeatures)}function zS(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 BS(e){let{operation:t,currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0}=e,{getResourcesRegistry:s,doOperation:c}=lm(),{user:l,permissions:u}=sg(),d=Jp(),f=Hh(),p=s(),{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,isLoading:v}=gh(),y=(0,Q.useMemo)(()=>Yp(t),[t]),b=zS(l?._id,d?.primaryScopeValues?.organizationId,d?.primaryScopeValues?.applicationId),x=(0,Q.useMemo)(()=>{if(v)return LS(t)?{isAvailable:!1,behavior:Ko.DISABLE}:void 0;let e=Nh(u,d?.currentOrganizationId??null);return Yh(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)(()=>!RS(t)),[w,T]=(0,Q.useState)(()=>RS(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),vm({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 yue(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 VS(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(`,`)||!yue(r.featureAvailability,e.featureAvailability))return!1}return!0}function HS(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}=lm(),{user:f,permissions:p}=sg(),m=Jp(),h=Hh(),g=u(),{resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,isLoading:x}=gh(),S=zS(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(IS(e),{isEnabled:!0})}),w(e=>VS(e,t)?e:t);return}if(!e.length||!a){w(e=>e.size===0?e:new Map);return}let t=!1,c=Nh(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=IS(e),c=x?LS(e)?{isAvailable:!1,behavior:Ko.DISABLE}:void 0:Yh(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(Yp(e).needsUserContext&&!f)o.set(t,{isEnabled:!1,featureAvailability:c});else try{let u=t=>vm({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:Fu(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=>VS(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 US(e,t,n){let r=e(t,n,`title`);return r&&!r.startsWith(`resources.`)?r:n}function WS(e){let{registry:t,resourceConfig:n,exportOperation:r,resourceType:i,contextResourceIdentifiers:a,contextualParameters:o,parentResourcesRequirements:s,apiBaseUrl:c,format:l,rowScope:u,listingQuery:d}=e;if(!n?.resourceFieldIdentifier||!r)return null;try{let e=Vn.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let i=On.selectMatchingRoutePath(e,a,n.resourceIdentifier,n.resourceFieldIdentifier,s,t.allResourceFieldIdentifiers),f=zm.resolveUrlPath(i.url,o);if(zm.hasUnresolvedPlaceholders(f))return null;let p=new URLSearchParams;p.set(k,l),p.set(are,u);for(let[e,t]of Object.entries(d??{}))t!==void 0&&t!==``&&e!==`format`&&e!==`rowScope`&&GS(p,e,t);return`${c}${br}${f}?${p.toString()}`}catch{return null}}function GS(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))GS(e,`${t}[${r}]`,i);else e.append(t,String(n))}}async function bue(e){Ly(await e.getBlob(e.url),pee(String(e.resourceType),e.format,new Date))}function KS(e,t){if(!e)return[];let n=hr.getObjectLikeFieldShape(e,{commonOnly:!1});if(!n)return[];let r=[];for(let[e,i]of Object.entries(n))Gl(i)&&t[e]&&r.push({fieldName:e,value:t[e],schema:i});return r}var qS;(function(e){e.PANEL=`panel`,e.LIST=`list`})(qS||={});function JS(e){return e.type===`separator`?!1:e.type===`subgroup`?e.disabled===!0:e.disabled===!0||e.unavailability!==void 0}function YS(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=>!JS(e)),...i.filter(JS)].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 XS({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ACTION_BAR,`ActionBar`)(e);return(0,$.jsx)(n,{...t})}var ZS=(0,Q.createContext)(!1);function QS({children:e}){return(0,$.jsx)(ZS.Provider,{value:!0,children:e})}function $S(){return(0,Q.useContext)(ZS)}function eC(e,t,n,r){return V.buildConfigurationError(ql.CONFIGURATION,{component:e,message:`${e}() requires a ${t}-like operation host, but received "${n}" for operation "${r}".`,expectedKind:t,actualKind:n,operationIdentifier:r})}function tC(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function nC(e,t,n){if(!n)return e;let r=e[t];if(On.getResourceId(r)===n)return e;let i=r?On.getFieldIdentifier(r):void 0;return{...e,[t]:i?{fieldIdentifier:i,resourceId:n}:n}}function rC({resourceContext:e,navigationZone:t,navigationInitiator:n,updateLikeMutationFallbackMode:r}){let{registry:i,doOperation:a}=lm(),{navigateToResource:o,goBack:s}=wS(),{handleError:c}=ep(),{resourceType:l,operation:u}=e,d=r??wl(u,i.resourceConfigurations[l]?.operations),f=String(u.operationIdentifier),p=(0,Q.useMemo)(()=>i.resourceConfigurations[l],[i,l]),m=(0,Q.useMemo)(()=>_l(u),[u]),h=(0,Q.useMemo)(()=>yie(u),[u]),g=(0,Q.useMemo)(()=>zm.createOperationInitiator(t,u),[t,u]),_=(0,Q.useMemo)(()=>tC(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)(()=>nC(e.contextResourceIdentifiers,l,v),[v,e.contextResourceIdentifiers,l]),b=(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:y}),[y,e]),x=(0,Q.useMemo)(()=>V.buildContextualParameters(y,i),[y,i]),S=(0,Q.useCallback)(e=>!!On.getResourceId(e[l]),[l]),C=(0,Q.useCallback)(()=>{s(t)},[s,t]),w=(0,Q.useCallback)((e,n,r)=>{c(e,n,{resourceType:l,operationId:f,navigationZone:t,component:r})},[c,t,f,l]),T=(0,Q.useCallback)(async e=>{if(tl(u)&&!tr(d))throw new ua({surfaceName:`useResourceOperationSurface.executeCurrentOperation()`,resourceType:l,operationIdentifier:f});let t=Ca.createOperationPathKeyFromOperation(u),n=tc({operation:u,requestData:e,additionalContext:b.additionalContext});return a(t,{contextualParameters:x,parentResourcesRequirements:b.parentResourcesRequirements,...n?{requestData:n}:{}})},[x,a,u,f,b.additionalContext,b.parentResourcesRequirements,l,d]),E=(0,Q.useCallback)((e,t)=>{if(p)return e===W.READ||e===W.UPDATE||e===W.DELETE?lh({resourceConfig:p,operations:p.operations??[],coreOperation:e,registry:i,hasResourceId:S(y),allowBulk:t?.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:y,contextualParameters:x}):$l(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=nC(t,l,v),c=V.buildContextualParameters(s,i);if(Am({operation:e,resourceType:l,resourceConfig:p})&&e.isBulkOperation!==!0&&!Gh({resourceConfig:p,operation:e,registry:i,hasResourceId:S(s),contextResourceIdentifiers:s,contextualParameters:c}))return!1;let u=On.createFrontendResourceOperationContextFromOperation({resourceType:l,operation:e,contextResourceIdentifiers:s,parentResourcesRequirements:n}),d=Vn.buildOperationFrontendRoutePaths(p,e,i.allResourceFieldIdentifiers),f=d.length>0?On.selectMatchingRoutePath(d,u.contextResourceIdentifiers,l,p.resourceFieldIdentifier,n,i.allResourceFieldIdentifiers).url:void 0;return o(u,r??g,f,a),!0},[o,g,i,p,b.contextResourceIdentifiers,b.parentResourcesRequirements,l,S,v]);return{resourceContext:b,navigationZone:t,navigationInitiator:n,resourceType:l,operation:u,operationId:f,resourceConfig:p,effectiveCoreOperation:m,isSemanticCustomOperation:h,operationInitiator:g,contextualParameters:x,goBackWithinZone:C,reportError:w,executeCurrentOperation:T,resolvePreferredOperation:E,navigateToResourceOperation:D,navigateToPreferredRead:(0,Q.useCallback)(e=>{if(!p)return e?.fallbackToGoBack!==!1&&C(),!1;let t=nC(e?.contextResourceIdentifiers??b.contextResourceIdentifiers,l,v),n=e?.parentResourcesRequirements??b.parentResourcesRequirements,r=V.buildContextualParameters(t,i),a=lh({resourceConfig:p,operations:p.operations??[],coreOperation:W.READ,registry:i,hasResourceId:S(t),requireFrontendAddressable:!0,contextResourceIdentifiers:t,contextualParameters:r});return a?D({operation:a,contextResourceIdentifiers:t,parentResourcesRequirements:n,initiatorOverride:e?.initiatorOverride,transitionOverride:e?.transitionOverride}):(e?.fallbackToGoBack!==!1&&C(),!1)},[v,C,S,D,i,p,l,b.contextResourceIdentifiers,b.parentResourcesRequirements])}}function iC(e,t,n){let r=rC(e),i=Os(r.operation);if(i!==t)throw eC(n,t,i,r.operationId);return r}function xue(e){return iC(e,`read`,`useReadOperationSurface`)}function Sue(e){return iC(e,`list`,`useListOperationSurface`)}function Cue(e){return iC(e,`create`,`useCreateOperationSurface`)}function wue(e){return iC(e,`update`,`useUpdateOperationSurface`)}function Tue(e){return iC(e,`search`,`useSearchOperationSurface`)}function Eue(e){return iC(e,`action`,`useActionOperationSurface`)}var aC=(0,Q.createContext)(null);function oC(){let e=(0,Q.useContext)(aC);if(!e)throw Error(`useResourceOperationViewContext() must be used within a <ResourceOperationViewProvider>. This is provided automatically for routed resource operation layouts.`);return e}function sC(){return(0,Q.useContext)(aC)}function cC({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i}){let a=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),o=(0,Q.useMemo)(()=>({...a,inlineParentContext:r}),[r,a]);return(0,$.jsx)(aC.Provider,{value:o,children:i})}var lC=e(Bte(),1),uC=e=>e.type===`checkbox`,dC=e=>e instanceof Date,fC=e=>e==null,pC=e=>typeof e==`object`,mC=e=>!fC(e)&&!Array.isArray(e)&&pC(e)&&!dC(e),hC=e=>mC(e)&&e.target?uC(e.target)?e.target.checked:e.target.value:e,Due=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,gC=(e,t)=>e.has(Due(t)),Oue=e=>{let t=e.constructor&&e.constructor.prototype;return mC(t)&&t.hasOwnProperty(`isPrototypeOf`)},_C=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function vC(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(_C&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(mC(e)&&Oue(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=vC(e[t]));return r}var yC=e=>/^\w*$/.test(e),bC=e=>e===void 0,xC=e=>Array.isArray(e)?e.filter(Boolean):[],SC=e=>xC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),CC=(e,t,n)=>{if(!t||!mC(e))return n;let r=(yC(t)?[t]:SC(t)).reduce((e,t)=>fC(e)?e:e[t],e);return bC(r)||r===e?bC(e[t])?n:e[t]:r},wC=e=>typeof e==`boolean`,TC=e=>typeof e==`function`,EC=(e,t,n)=>{let r=-1,i=yC(t)?[t]:SC(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=mC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},DC={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},OC={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},kC={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},AC=Q.createContext(null);AC.displayName=`HookFormControlContext`;var jC=()=>Q.useContext(AC),MC=(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]!==OC.all&&(t._proxyFormState[i]=!r||OC.all),n&&(n[i]=!0),e[i]}});return i},NC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function PC(e){let t=jC(),{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 NC(()=>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(()=>MC(o,n,c.current,!1),[o,n])}var FC=e=>typeof e==`string`,IC=(e,t,n,r,i)=>FC(e)?(r&&t.watch.add(e),CC(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),CC(n,e))):(r&&(t.watchAll=!0),n),LC=e=>fC(e)||!pC(e);function RC(e,t,n=new WeakSet){if(LC(e)||LC(t))return Object.is(e,t);if(dC(e)&&dC(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(dC(r)&&dC(e)||mC(r)&&mC(e)||Array.isArray(r)&&Array.isArray(e)?!RC(r,e,n):!Object.is(r,e))return!1}}return!0}function zC(e){let t=jC(),{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=IC(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=IC(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);RC(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);NC(()=>(d.current===n&&RC(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=!_&&!RC(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function BC(e){let t=jC(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=gC(i._names.array,n),l=zC({control:i,name:n,defaultValue:Q.useMemo(()=>CC(i._formValues,n,CC(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=PC({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,...wC(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!CC(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!CC(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!CC(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!CC(u.validatingFields,n)},error:{enumerable:!0,get:()=>CC(u.errors,n)}}),[u,n]),h=Q.useCallback(e=>p.current.onChange({target:{value:hC(e),name:n},type:DC.CHANGE}),[n]),g=Q.useCallback(()=>p.current.onBlur({target:{value:CC(i._formValues,n),name:n},type:DC.BLUR}),[n,i._formValues]),_=Q.useCallback(e=>{let t=CC(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>TC(e.focus)&&e.focus(),select:()=>TC(e.select)&&e.select(),setCustomValidity:t=>TC(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>TC(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),v=Q.useMemo(()=>({name:n,value:l,...wC(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,...wC(d.current.disabled)?{disabled:d.current.disabled}:{}});let r=(e,t)=>{let n=CC(i._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){let e=vC(CC(i._options.defaultValues,n,d.current.defaultValue));EC(i._defaultValues,n,e),bC(CC(i._formValues,n))&&EC(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 VC=e=>e.render(BC(e)),HC=Q.createContext(null);HC.displayName=`HookFormContext`;var UC=()=>Q.useContext(HC),WC=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(HC.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(AC.Provider,{value:m},t))},kue=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},GC=e=>Array.isArray(e)?e:[e],KC=()=>{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 qC(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&mC(i)&&a){let e=qC(i,a);mC(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var JC=e=>mC(e)&&!Object.keys(e).length,YC=e=>e.type===`file`,XC=e=>{if(!_C)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ZC=e=>e.type===`select-multiple`,QC=e=>e.type===`radio`,Aue=e=>QC(e)||uC(e),$C=e=>XC(e)&&e.isConnected;function jue(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=bC(e)?r++:e[t[r++]];return e}function Mue(e){for(let t in e)if(e.hasOwnProperty(t)&&!bC(e[t]))return!1;return!0}function ew(e,t){let n=Array.isArray(t)?t:yC(t)?[t]:SC(t),r=n.length===1?e:jue(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(mC(r)&&JC(r)||Array.isArray(r)&&Mue(r))&&ew(e,n.slice(0,-1)),e}var Nue=e=>{for(let t in e)if(TC(e[t]))return!0;return!1};function tw(e){return Array.isArray(e)||mC(e)&&!Nue(e)}function nw(e,t={}){for(let n in e){let r=e[n];tw(r)?(t[n]=Array.isArray(r)?[]:{},nw(r,t[n])):bC(r)||(t[n]=!0)}return t}function rw(e,t,n){n||=nw(t);for(let r in e){let i=e[r];if(tw(i))bC(t)||LC(n[r])?n[r]=nw(i,Array.isArray(i)?[]:{}):rw(i,fC(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!RC(i,e)}}return n}var iw={value:!1,isValid:!1},aw={value:!0,isValid:!0},ow=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&&!bC(e[0].attributes.value)?bC(e[0].value)||e[0].value===``?aw:{value:e[0].value,isValid:!0}:aw:iw}return iw},sw=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>bC(e)?e:t?e===``?NaN:e&&+e:n&&FC(e)?new Date(e):r?r(e):e,cw={isValid:!1,value:null},lw=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,cw):cw;function uw(e){let t=e.ref;return YC(t)?t.files:QC(t)?lw(e.refs).value:ZC(t)?[...t.selectedOptions].map(({value:e})=>e):uC(t)?ow(e.refs).value:sw(bC(t.value)?e.ref.value:t.value,e)}var Pue=(e,t,n,r)=>{let i={};for(let n of e){let e=CC(t,n);e&&EC(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},dw=e=>e instanceof RegExp,fw=e=>bC(e)?e:dw(e)?e.source:mC(e)?dw(e.value)?e.value.source:e.value:e,pw=e=>({isOnSubmit:!e||e===OC.onSubmit,isOnBlur:e===OC.onBlur,isOnChange:e===OC.onChange,isOnAll:e===OC.all,isOnTouch:e===OC.onTouched}),mw=`AsyncFunction`,Fue=e=>!!e&&!!e.validate&&!!(TC(e.validate)&&e.validate.constructor.name===mw||mC(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===mw)),Iue=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hw=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),gw=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=CC(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(gw(a,t))break}else if(mC(a)&&gw(a,t))break}}};function _w(e,t,n){let r=CC(e,n);if(r||yC(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=CC(t,r),o=CC(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 Lue=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return JC(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||OC.all))},Rue=(e,t,n)=>!e||!t||e===t||GC(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),zue=(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,Bue=(e,t)=>!xC(CC(e,t)).length&&ew(e,t),vw=(e,t,n)=>{let r=GC(CC(e,n));return EC(r,`root`,t[n]),EC(e,n,r),e};function yw(e,t,n=`validate`){if(FC(e)||Array.isArray(e)&&e.every(FC)||wC(e)&&!e)return{type:n,message:FC(e)?e:``,ref:t}}var bw=e=>mC(e)&&!dw(e)?e:{value:e,message:``},xw=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=CC(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(wC(e)?``:e||``),y.reportValidity())},x={},S=QC(o),C=uC(o),w=S||C,T=(g||YC(o))&&bC(o.value)&&bC(v)||XC(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=kue.bind(null,h,r,x),D=(e,t,n,r=kC.maxLength,i=kC.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||fC(v))||wC(v)&&!v||C&&!ow(s).isValid||S&&!lw(s).isValid)){let{value:e,message:t}=FC(c)?{value:!!c,message:c}:bw(c);if(e&&(x[h]={type:kC.required,message:t,ref:y,...E(kC.required,t)},!r))return b(t),x}if(!T&&(!fC(d)||!fC(f))){let e,t,n=bw(f),i=bw(d);if(!fC(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;fC(n.value)||(e=r>n.value),fC(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`;FC(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),FC(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,kC.max,kC.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(FC(v)||a&&Array.isArray(v))){let e=bw(l),t=bw(u),n=!fC(e.value)&&v.length>+e.value,i=!fC(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&&FC(v)){let{value:e,message:t}=bw(p);if(dw(e)&&!v.match(e)&&(x[h]={type:kC.pattern,message:t,ref:o,...E(kC.pattern,t)},!r))return b(t),x}if(m){if(TC(m)){let e=yw(await m(v,n),y);if(e&&(x[h]={...e,...E(kC.validate,e.message)},!r))return b(e.message),x}else if(mC(m)){let e={};for(let t in m){if(!JC(e)&&!r)break;let i=yw(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!JC(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},Vue={mode:OC.onSubmit,reValidateMode:OC.onChange,shouldFocusError:!0};function Hue(e={}){let t={...Vue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:TC(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(mC(t.defaultValues)||mC(t.values))&&vC(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:vC(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:KC(),state:KC()},m=t.criteriaMode===OC.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=JC((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?EC(n.validatingFields,e,r):ew(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!JC(n.validatingFields)}))},v=(e,s=[],c,l,u=!0,m=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,m&&Array.isArray(CC(r,e))){let t=c(CC(r,e),l.argA,l.argB);u&&EC(r,e,t)}if(m&&Array.isArray(CC(n.errors,e))){let t=c(CC(n.errors,e),l.argA,l.argB);u&&EC(n.errors,e,t),Bue(n.errors,e)}if((d.touchedFields||f.touchedFields)&&m&&Array.isArray(CC(n.touchedFields,e))){let t=c(CC(n.touchedFields,e),l.argA,l.argB);u&&EC(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=rw(i,a)),p.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else EC(a,e,s)},y=(e,t)=>{EC(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=CC(r,e);if(c){let r=CC(a,e,bC(n)?CC(i,e):n);bC(r)||s&&s.defaultChecked||t?EC(a,e,t?r:uw(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=RC(CC(i,e),r);l=!!CC(n.dirtyFields,e),t?ew(n.dirtyFields,e):EC(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=CC(n.touchedFields,e);t||(EC(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=CC(n.errors,e),s=(d.isValid||f.isValid)&&wC(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?EC(n.errors,e,i):ew(n.errors,e)),(i?!RC(o,i):o)||!JC(a)||s){let t={...a,...s&&wC(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,Pue(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=CC(t,r);e?EC(n.errors,r,e):ew(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&&Fue(l._f);u&&d.validatingFields&&_([r.name],!0);let f=await xw(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&&(CC(f,r.name)?c?vw(n.errors,f,r.name):EC(n.errors,r.name,f[r.name]):ew(n.errors,r.name))}!JC(c)&&await E(c,i,o)}}return o.valid},D=()=>{for(let e of s.unMount){let t=CC(r,e);t&&(t._f.refs?t._f.refs.every(e=>!$C(e)):!$C(t._f.ref))&&ie(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&EC(a,e,n),!RC(ee(),i)),k=(e,t,n)=>IC(e,s,{...o.mount?a:bC(t)?i:FC(e)?{[e]:t}:t},n,t),A=e=>xC(CC(o.mount?a:i,e,t.shouldUnregister?CC(i,e,[]):[])),j=(e,t,n={})=>{let i=CC(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&EC(a,e,sw(t,n)),o=XC(n.ref)&&fC(t)?``:t,ZC(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?uC(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):YC(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:vC(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=CC(r,o);(s.array.has(e)||mC(a)||c&&!c._f)&&!dC(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=CC(r,e),u=s.array.has(e),m=vC(t);EC(a,e,m),u?(p.array.next({name:e,values:vC(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&p.state.next({name:e,dirtyFields:rw(i,a),isDirty:O(e,m)})):l&&!l._f&&!fC(m)?M(e,m,c):j(e,m,c),hw(e,s)?p.state.next({...n,name:e,values:vC(a)}):p.state.next({name:o.mount?e:void 0,values:vC(a)})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,u=!0,h=CC(r,l),v=e=>{u=Number.isNaN(e)||dC(e)&&isNaN(e.getTime())||RC(e,CC(a,l,e))},y=pw(t.mode),b=pw(t.reValidateMode);if(h){let o,x,T=i.type?uw(h._f):hC(e),D=e.type===DC.BLUR||e.type===DC.FOCUS_OUT,O=!Iue(h._f)&&!t.resolver&&!CC(n.errors,l)&&!h._f.deps||zue(D,CC(n.touchedFields,l),n.isSubmitted,b,y),k=hw(l,s,D);EC(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=!JC(A)||k;if(!D&&p.state.next({name:l,type:e.type,values:vC(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=_w(n.errors,r,l),i=_w(e,r,t.name||l);o=i.error,l=i.name,x=JC(e)}}else _([l],!0),o=(await xw(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(CC(n.errors,t)&&e.focus)return e.focus(),1},I=async(e,i={})=>{let a,o,c=GC(e);if(t.resolver){let t=await T(bC(e)?e:c);a=JC(t),o=e?!c.some(e=>CC(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=CC(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({...!FC(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&gw(r,F,e?c:s.mount),o},ee=(e,t)=>{let r={...o.mount?a:i};return t&&(r=qC(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),bC(e)?r:FC(e)?CC(r,e):e.map(e=>CC(r,e))},L=(e,t)=>({invalid:!!CC((t||n).errors,e),isDirty:!!CC((t||n).dirtyFields,e),error:CC((t||n).errors,e),isValidating:!!CC(n.validatingFields,e),isTouched:!!CC((t||n).touchedFields,e)}),R=e=>{let t=e?GC(e):void 0;t?.forEach(e=>ew(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=(CC(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=CC(n.errors,e)||{};EC(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)=>TC(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=>{Rue(e.name,t.name,e.exact)&&Lue(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?GC(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(ew(r,c),ew(a,c)),!o.keepError&&ew(n.errors,c),!o.keepDirty&&ew(n.dirtyFields,c),!o.keepTouched&&ew(n.touchedFields,c),!o.keepIsValidating&&ew(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&ew(i,c);p.state.next({values:vC(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},ae=({disabled:e,name:t})=>{if(wC(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=CC(r,e),c=wC(n.disabled)||wC(t.disabled);return EC(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?ae({disabled:wC(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:fw(n.min),max:fw(n.max),minLength:fw(n.minLength),maxLength:fw(n.maxLength),pattern:fw(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){oe(e,n),a=CC(r,e);let t=bC(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Aue(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;EC(r,e,{_f:{...a._f,...o?{refs:[...s.filter($C),t,...Array.isArray(CC(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=CC(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(gC(s.array,e)&&o.action)&&s.unMount.add(e)}}},se=()=>t.shouldFocusError&&gw(r,F,s.mount),ce=e=>{wC(e)&&(p.state.next({disabled:e}),gw(r,(t,n)=>{let i=CC(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=vC(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=vC(t)}else await E(r);if(s.disabled.size)for(let e of s.disabled)ew(l,e);if(ew(n.errors,`root`),JC(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:JC(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ue=(e,t={})=>{CC(r,e)&&(bC(t.defaultValue)?N(e,vC(CC(i,e))):(N(e,t.defaultValue),EC(i,e,vC(t.defaultValue))),t.keepTouched||ew(n.touchedFields,e),t.keepDirty||(ew(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,vC(CC(i,e))):O()),t.keepError||(ew(n.errors,e),d.isValid&&g()),p.state.next({...n}))},de=(e,c={})=>{let l=e?vC(e):i,u=vC(l),f=JC(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(rw(i,a))]);for(let t of Array.from(e)){let e=CC(n.dirtyFields,t),r=CC(a,t),i=CC(m,t);e&&!bC(r)?EC(m,t,r):!e&&!bC(i)&&N(t,i)}}else{if(_C&&bC(e))for(let e of s.mount){let t=CC(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(XC(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,CC(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?vC(i):{}:vC(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&&!JC(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||RC(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?rw(i,a):n.dirtyFields:c.keepDefaultValues&&e?rw(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(TC(e)?e(a):e,{...t.resetOptions,...n}),pe=(e,t={})=>{let n=CC(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&TC(e.select)&&e.select()})}},me=e=>{n={...n,...e}},he={control:{register:oe,unregister:ie,getFieldState:L,handleSubmit:le,setError:z,_subscribe:ne,_runSchema:w,_updateIsValidating:_,_focusError:se,_getWatch:k,_getDirty:O,_setValid:g,_setFieldArray:v,_setDisabledField:ae,_setErrors:b,_getFieldArray:A,_reset:de,_resetDefaultValues:()=>TC(t.defaultValues)&&t.defaultValues().then(e=>{fe(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:ce,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:re,trigger:I,register:oe,handleSubmit:le,watch:te,setValue:N,getValues:ee,reset:fe,resetField:ue,clearErrors:R,unregister:ie,setError:z,setFocus:pe,getFieldState:L};return{...he,formControl:he}}var Sw=()=>{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)})},Cw=(e,t,n={})=>n.shouldFocus||bC(n.shouldFocus)?n.focusName||`${e}.${bC(n.focusIndex)?t:n.focusIndex}.`:``,ww=(e,t)=>[...e,...GC(t)],Tw=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function Ew(e,t,n){return[...e.slice(0,t),...GC(n),...e.slice(t)]}var Dw=(e,t,n)=>Array.isArray(e)?(bC(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Ow=(e,t)=>[...GC(t),...GC(e)];function Uue(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return xC(r).length?r:[]}var kw=(e,t)=>bC(t)?[]:Uue(e,GC(t).sort((e,t)=>e-t)),Aw=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},jw=(e,t,n)=>(e[t]=n,e);function Mw(e){let t=jC(),{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(Sw)),u=Q.useRef(!1);n._names.array.add(r),Q.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),NC(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=CC(e,r);Array.isArray(t)&&(c(t),l.current=t.map(Sw))}}}).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,hw(r,n._names)&&n._subjects.state.next({...n._formState}),u.current&&(!pw(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!pw(n._options.reValidateMode).isOnSubmit){if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=CC(e.errors,r),i=CC(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?EC(n._formState.errors,r,t):ew(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=CC(n._fields,r);e&&e._f&&!(pw(n._options.reValidateMode).isOnSubmit&&pw(n._options.mode).isOnSubmit)&&xw(e,n._names.disabled,n._formValues,n._options.criteriaMode===OC.all,n._options.shouldUseNativeValidation,!0).then(e=>!JC(e)&&n._subjects.state.next({errors:vw(n._formState.errors,e,r)}))}}n._subjects.state.next({name:r,values:vC(n._formValues)}),n._names.focus&&gw(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(()=>(!CC(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=CC(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);Aw(i,e,t),Aw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Aw,{argA:e,argB:t},!1)},[d,r,n]),move:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Dw(i,e,t),Dw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Dw,{argA:e,argB:t},!1)},[d,r,n]),prepend:Q.useCallback((e,t)=>{let i=GC(vC(e)),a=Ow(n._getFieldArray(r),i);n._names.focus=Cw(r,0,t),l.current=Ow(l.current,i.map(Sw)),d(a),c(a),n._setFieldArray(r,a,Ow,{argA:Tw(e)})},[d,r,n]),append:Q.useCallback((e,t)=>{let i=GC(vC(e)),a=ww(n._getFieldArray(r),i);n._names.focus=Cw(r,a.length-1,t),l.current=ww(l.current,i.map(Sw)),d(a),c(a),n._setFieldArray(r,a,ww,{argA:Tw(e)})},[d,r,n]),remove:Q.useCallback(e=>{let t=kw(n._getFieldArray(r),e);l.current=kw(l.current,e),d(t),c(t),!Array.isArray(CC(n._fields,r))&&EC(n._fields,r,void 0),n._setFieldArray(r,t,kw,{argA:e})},[d,r,n]),insert:Q.useCallback((e,t,i)=>{let a=GC(vC(t)),o=Ew(n._getFieldArray(r),e,a);n._names.focus=Cw(r,e,i),l.current=Ew(l.current,e,a.map(Sw)),d(o),c(o),n._setFieldArray(r,o,Ew,{argA:e,argB:Tw(t)})},[d,r,n]),update:Q.useCallback((e,t)=>{let i=vC(t),a=jw(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?Sw():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,jw,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:Q.useCallback(e=>{let t=GC(vC(e));l.current=t.map(Sw),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]||Sw()})),[s,i])}}function Nw(e={}){let t=Q.useRef(void 0),n=Q.useRef(void 0),[r,i]=Q.useState({isDirty:!1,isValidating:!1,isLoading:TC(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:TC(e.defaultValues)?void 0:e.defaultValues});if(!t.current){if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!TC(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=Hue(e);t.current={...i,formState:r}}}let a=t.current.control;return a._options=e,NC(()=>{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&&!RC(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(()=>MC(r,a),[a,r]),t.current}function Pw({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_OPERATIONS_CONFIRM_CRITICAL,`OperationsConfirmCritical`)(e);return(0,$.jsx)(n,{...t})}function Wue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,organizationUnitNarrowing:i}=e;return!r||!Object.prototype.hasOwnProperty.call(r,Nr)||n?.persistenceAdapter!==no.HTTP_API||!i?!1:i[t]?.unitFieldName!==Nr}function Gue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,readThroughCreateOrganizationUnits:i}=e;if(r&&Object.prototype.hasOwnProperty.call(r,Nr)&&n?.persistenceAdapter===no.HTTP_API)return i?.[t]}function Fw(e){if(!e.registry.manyToManyScopeJunctions)return;let t=Bl.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 Iw(e){return e==null||e===``?[]:Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[e]}function Kue(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 Lw(e){if(!e.operation)return;let t=V.selectOperationUrlInitiatorInfo({initiatorInfos:e.operation.initiatorInfos??[],contextualParameters:e.contextualParameters,targetResourceType:e.resourceType,targetDefaultFieldIdentifier:e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]??``});if(t)return On.buildParentResourcesRequirementsFromRouteParams(t.parameters,e.resourceType,e.registry)}async function Rw(e){let t=Fw({resourceType:e.resourceType,registry:e.registry,contextualParameters:e.contextualParameters??{}});if(t){let n=Lw({operation:V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.SEARCH)??V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.LIST),resourceType:e.resourceType,registry:e.registry,contextualParameters:t}),r=await e.doOperation(V.buildForeignKeySearchOperationPath(e.resourceType,e.registry),{contextualParameters:t,...n?{parentResourcesRequirements:n,parentChainIsExact:!0}:{},queryParameters:{_id:e.id,limit:1},dataMode:V.foreignKeyReferenceDataMode(e.resourceType,e.registry)},{silent:!0,riskLevel:zi.LOW}),i=(Array.isArray(r)?r:r?.data??r?.items??[]).find(t=>t._id===e.id);if(!i)throw Error(`Reference ${e.resourceType}:${e.id} is not reachable within its scope.`);return{record:i,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:i,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}let n=V.buildForeignKeyFetchParams(e.resourceType,e.id,e.registry),r=e.registry.resourceConfigurations[e.resourceType],i={[e.resourceType]:e.id},a={...e.contextualParameters??{},...n.contextualParameters||{}},o=r?e.readOperation&&Gh({resourceConfig:r,operation:e.readOperation,registry:e.registry,hasResourceId:On.getResourceId(i[e.resourceType]).length>0,contextResourceIdentifiers:i,contextualParameters:a})?e.readOperation:lh({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:e.registry,hasResourceId:!0,contextResourceIdentifiers:i,contextualParameters:a}):e.readOperation,s=V.buildForeignKeyReadOperationPath(e.resourceType,e.registry,o),c=e.parentResourcesRequirements??Lw({operation:V.resolveSingleResourceReadOperation(e.resourceType,e.registry,o),resourceType:e.resourceType,registry:e.registry,contextualParameters:a}),l=await e.doOperation(s,{contextualParameters:a,...c?{parentResourcesRequirements:c,parentChainIsExact:!0}:{}},{silent:!0,riskLevel:zi.LOW});return{record:l,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:l,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}function que(e){let{resourceType:t,ids:n,hostContextualParameters:r}=e,{registry:i,doOperation:a}=lm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=(0,Q.useRef)({registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r});l.current={registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r};let[u,d]=(0,Q.useState)({}),f=(n??[]).join(`|`);return(0,Q.useEffect)(()=>{let e=!1,r=(e,n)=>console.warn(`[useReferenceRecordLabels] The ${t} "${e}" could not be read; the choice shows its id.`,n),i=async e=>{let n=l.current,r=$l(n.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null,{label:i}=await Rw({resourceType:t,id:e,registry:n.registry,doOperation:n.doOperation,contextualParameters:Im({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 Jue(e){if(!e.roleEntries||e.roleTables.unresolvableRoles!==Tre.INERT)return;let{appRolesConfig:t,orgRolesConfig:n}=e.roleTables;return Gne({roleEntries:e.roleEntries,organizationId:e.organizationId,resolveHierarchy:(e,r)=>Ws(e,r===Vr.APPLICATION?t:n),resolveRolesWithinAuthority:Yre(e.rolesWithinAuthority)})}function Yue(e){let t=me(e)===_u.ARRAY?ja(e):e;return t&&me(t)===_u.ENUM?Jo(t):[]}function zw(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]}function Xue(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n)return;let i={};for(let[e,a]of Object.entries(t)){if(!Rs(a))continue;let t=Yue(a);t.length!==0&&(i[e]={values:qo(n,t,zw(r?.[e]))})}return Object.keys(i).length>0?i:void 0}function Zue(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n||n.kind===Die.UNBOUNDED)return;let i={};for(let[e,a]of Object.entries(t))Rs(a)&&me(a)===_u.STRING&&xt(a)===z.ORGANIZATION_ROLE&&(i[e]=qo(n,[...n.grantableRoles],zw(r?.[e])));return Object.keys(i).length>0?i:void 0}var Bw=Xs(B.LOW_LEVEL_ALERT_DIALOG,`AlertDialog`,[`Trigger`,`Content`,`Header`,`Footer`,`Title`,`Description`,`Action`,`Cancel`]);function Vw({preset:e=q.DEFAULT,...t}){let n=Bw(e);return(0,$.jsx)(n,{...t})}var Hw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Bw(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});Hw.displayName=`AlertDialogTrigger`;var Uw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Bw(e);return(0,$.jsx)(r.Content,{...t,ref:n})});Uw.displayName=`AlertDialogContent`;function Ww({preset:e=q.DEFAULT,...t}){let n=Bw(e);return(0,$.jsx)(n.Header,{...t})}function Gw({preset:e=q.DEFAULT,...t}){let n=Bw(e);return(0,$.jsx)(n.Footer,{...t})}var Kw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Bw(e);return(0,$.jsx)(r.Title,{...t,ref:n})});Kw.displayName=`AlertDialogTitle`;var qw=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Bw(e);return(0,$.jsx)(r.Description,{...t,ref:n})});qw.displayName=`AlertDialogDescription`;function Jw({preset:e=q.DEFAULT,...t}){let n=Bw(e);return(0,$.jsx)(n.Action,{...t})}function Yw({preset:e=q.DEFAULT,...t}){let n=Bw(e);return(0,$.jsx)(n.Cancel,{...t})}var Xw=(0,Q.createContext)(void 0);function Zw({formChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({formChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(Xw.Provider,{value:r,children:n})}function Qw(){return(0,Q.useContext)(Xw)??{}}function $w(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 eT;(function(e){e.REQUEST_DTO=`request-dto`,e.MAIN_SCHEMA=`main-schema`})(eT||={});var tT;(function(e){e.IDLE=`idle`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(tT||={});var nT=(0,Q.createContext)(null);function rT({schema:e,schemaKind:t=eT.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)(nT.Provider,{value:m,children:(0,$.jsx)(WC,{...n,children:d})})}var iT=`server`,aT=`server-unique`,oT=`_root`,sT=`record-duplicate-key`,cT=(e,t,n)=>{if(e&&`reportValidity`in e){let r=CC(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},lT=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?cT(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>cT(t,n,e))}},uT=(e,t)=>{t.shouldUseNativeValidation&&lT(e,t);let n={};for(let r in e){let i=CC(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(dT(t.names||Object.keys(e),r)){let e=Object.assign({},CC(n,r));EC(e,`root`,a),EC(n,r,e)}else EC(n,r,a)}return n},dT=(e,t)=>{let n=pT(t);return e.some(e=>fT(e).match(`^${n}\\.\\d+`))};function fT(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function pT(e){return fT(e).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var mT=new Set([`code`,`message`,`path`,`input`]);function hT(e){let t={};for(let[n,r]of Object.entries(e))mT.has(n)||(t[n]=r);return Object.keys(t).length>0?t:void 0}function gT(e,t){let n={};for(let r of e){let e=$w(r)||`_root`,i=r.code,a=typeof i==`string`?i:``;if(!n[e]){let t=hT(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 _T(e){return gT(e,!1)}function vT(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:uT(gT(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};let o=a.value;return i.shouldUseNativeValidation&&lT({},i),{values:t.raw?Object.assign({},n):o,errors:{}}}}function yT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function bT(e){try{return e.safeParse(void 0).success&&!e.safeParse([]).success}catch{return!1}}function xT(e){if(F(e)!==null)return!0;let t=lr(e);return Ya(t)===`union`&&(t.options??[]).some(e=>F(e)!==null)}function ST(e,t){if(!t||!yT(e)||!xT(t))return e;let n=Ri(t),r;for(let i of Object.keys(e)){let a=Oc(t,i);if(!a)continue;let o=e[i],s=o;if(Array.isArray(o)){if(o.length===0){if(!n&&bT(a)){r??={...e},delete r[i];continue}}else{let e=ja(a);if(e&&xT(e)){let t=o.map(t=>ST(t,e));t.some((e,t)=>e!==o[t])&&(s=t)}}}else yT(o)&&xT(a)&&(s=ST(o,a));s!==o&&(r??={...e},r[i]=s)}return r??e}function CT(e){(0,Q.useEffect)(()=>{let t=e.watch((t,{name:n,type:r})=>{if(r!==`change`&&n===void 0)return;let i=e.getFieldState(oT).error;i&&i.type!==`server`&&i.type!==`server-unique`&&e.trigger(oT)});return()=>t.unsubscribe()},[e])}var wT=Q.createContext(void 0);function TT(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())CC(o,e)||EC(o,e,{type:`file-validation`,message:n});return Object.keys(o).length>0?{values:{},errors:o}:a}}function ET({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION,`ContentSection`)(e);return(0,$.jsx)(n,{...t})}function DT({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION_GROUP,`ContentSectionGroup`)(e);return(0,$.jsx)(n,{...t})}function OT({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CONTENT_SECTION_LEGEND,`ContentSectionLegend`)(e);return(0,$.jsx)(n,{...t})}var kT=ta.ON_BLUR,AT;(function(e){e.FORM=`form`,e.DISPLAY=`display`})(AT||={});var jT;(function(e){e.DISPLAY=`display`,e.EDITING=`editing`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(jT||={});function MT({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??kT,x=n??e,S=Q.useRef(new Map).current,C=vT(x),w=Nw({resolver:TT(((e,t,n)=>C(ST(e,x),t,n)),S),defaultValues:r,mode:b,disabled:l});CT(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)(rT,{schema:e,schemaKind:t,form:w,resourceType:d,validationMode:o,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y,children:(0,$.jsx)(wT.Provider,{value:S,children:(0,$.jsx)(`form`,{id:u,onSubmit:T,className:c,noValidate:!0,"data-testid":`form`,children:(0,$.jsx)(ET,{disabled:l,className:`contents`,children:s})})})})}MT.displayName=`Form`;var NT=MT,PT=(0,Q.createContext)(null);function FT({value:e,children:t}){return(0,$.jsx)(PT.Provider,{value:e,children:t})}function IT(){let e=(0,Q.useContext)(PT);if(!e)throw Error(`useFormTemplateContext() must be used within a <FormTemplateProvider>. This is provided automatically by AutomatedForm.`);return e}function LT(){return(0,Q.useContext)(PT)}function RT(e,t){return e===void 0?t!==`update`:!Ll(e)}function zT(e){return e.match(/[^.[\]]+/g)??[]}function BT(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]=BT(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]=BT(a[n],r),a)}function VT(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:VT(e[t],r)}let i=e;if(Object.prototype.hasOwnProperty.call(i,n))return VT(i[n],r)}function HT(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]=HT(a[t],i,n),a}let a=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{...a,[r]:HT(a[r],i,n)}}function UT(e,t){let n={};for(let r of t){let t=zT(r);if(t.length===0)continue;let i=VT(e,t);i!==void 0&&(n=HT(n,t,i))}return n}function Que(e,t,n){let r=zT(t);return r.length===0?e:HT(e,r,n)}function $ue(e,t,n){if(!n)return e;let r=new Set(t.map(zT).filter(e=>e.length===1).map(e=>e[0])),i=new Set,a=e;for(let o of t){let t=zT(o);if(t.length<2)continue;let s=t[0];if(r.has(s))continue;let c=VT(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=HT(a,t,c)}}return a}function ede(e,t){let n={};for(let[r,i]of Object.entries(e))(i!==null||tde(t,r))&&(n[r]=i);return n}function tde(e,t){if(!e)return!1;let n=Oc(e,t);return n?n.safeParse(null).success:!1}function WT(e,t){let n=t.omitClearedFields?ede(e,t.schema):e;for(let e of t.hiddenFieldNames??[]){let t=zT(e);t.length!==0&&(n=BT(n,t))}if(t.contextFieldValues&&Object.keys(t.contextFieldValues).length>0)for(let[e,r]of Object.entries(t.contextFieldValues)){let t=zT(e);t.length!==0&&(n=HT(n,t,r))}return n}function GT(e){return e!==void 0&&sie(e)}function KT(e,t){let n=F(e);return n&&Object.hasOwn(n,t)?n[t]:void 0}function qT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function JT(e,t){let n=new Set;for(let r of e){let[e,...i]=zT(r);if(e===void 0)continue;let a=e,o=t?Oc(t,e):void 0;if(o!==void 0&&!o.safeParse(void 0).success)n.add(a);else{for(let e of i){if(!GT(o))break;a=`${a}.${e}`,o=KT(o,e)}n.add(a)}}let r=[...n];return r.filter(e=>!r.some(t=>t!==e&&e.startsWith(`${t}.`)))}function nde(e,t){let n=e=>e==null||e===``||e===!1||Array.isArray(e)&&e.length===0;return n(e)?!n(t):!(0,lC.default)(e,t)}function rde(e){let t=new Set(e.writtenAsHeld??[]),n=new Set(e.variantFields??[]),r={},i=(e,t,n,a)=>{if(GT(n)&&qT(e))for(let[r,o]of Object.entries(e))i(o,qT(t)?t[r]:void 0,KT(n,r),`${a}.${r}`);else nde(e,t)&&(r[a]=e===void 0||e===``?null:e)};for(let[a,o]of Object.entries(e.values)){let s=e.schema?Oc(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 YT(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`))))}var XT;(function(e){e.CLEAR=`clear`,e.EMPTY=`empty`,e.TURN_OFF=`turn_off`})(XT||={});function ide(e,t,n,r=[]){if(!t||!n||r.includes(e))return;let i=JT([e],n);if(i.length!==1||i[0]!==e)return;let a;if(e.includes(`.`)){let n=pte(t,e);a=n?gn(n):void 0}else if(a=Oc(t,e),a&&!a.safeParse(void 0).success)return;if(!a)return;let o=a,s=Ya(lr(o)),c=s===`boolean`?{kind:XT.TURN_OFF,value:!1}:s===`array`?{kind:XT.EMPTY,value:[]}:{kind:XT.CLEAR,value:null};return o.safeParse(c.value).success?c:void 0}function ade(e){return e.writesRecordFields||e.hasCallerSectionHandler}function ZT(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 QT(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 $T(e,t,n){return e===t?n:n===hr.unresolvedFieldLabel(e)?hr.unresolvedFieldLabel(t):n}function eE(e,t,n,r=`display`,i={}){let{t:a,tResourceFieldDisplay:o,tResourceFieldEdit:s,tResourceFieldEnumValue:c,tResourceSection:l,tResourceWizardStep:u,isReady:d}=K({resource:t?.resourceType}),{layoutRefs:f,overrides:p,fieldPathPrefix:m}=i,h=(0,Q.useCallback)(e=>m?`${m}.${e}`:e,[m]),g=(0,Q.useMemo)(()=>{let i={},a=ZT(n),c;try{c=dl(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?$T(c,n,(r===`edit`?s:o)(t.resourceType,c,`label`,a)):$T(c,n,o(``,c,`label`,a))}return i},[e,t,n,r,p?.fields,h,o,s]),_=(0,Q.useMemo)(()=>{let i={},a=ZT(n),c;try{c=dl(e)}catch{return p?.descriptions??{}}for(let{path:e}of c)if(p?.descriptions?.[e])i[e]=p.descriptions[e];else if(t){let n=(r===`edit`?s:o)(t.resourceType,h(e),`description`,a);n&&(i[e]=n)}return i},[e,t,n,r,p?.descriptions,h,o,s]),v=(0,Q.useMemo)(()=>{let n={},i;try{i=hr.getObjectLikeFieldShape(e,{commonOnly:!1})}catch{return{}}if(!i)return{};for(let[e,a]of Object.entries(i))if((r===`display`?vl(a)?.tooltip===!0:Yc(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=dl(e)}catch{return p?.enums??{}}for(let{path:e,schema:i}of r){let r=Vc(i);if(r){if(p?.enums?.[e])n[e]=p.enums[e];else if(t){let a=Jo(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(QT(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(QT(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 tE({schema:e,defaultValues:t,onSubmit:n,onError:r,validationMode:i,className:a,disabled:o,readOnly:s,id:c,warnOnUnsavedChanges:l=!1,labels:u,operationRef:d,operationType:f,operationLike:p,coreOperation:m,layoutRefs:h,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,inheritanceConfig:w,chromeMode:T,onSectionSave:E,onFormReady:D,validateFieldUrl:O,resourceType:k,hostResolvesRelationshipRoots:A,resourceId:j,contextResourceIdentifiers:M,parentResourcesRequirements:N,navigationZone:P,layoutTemplate:F}){let{tComponent:I,isReady:ee}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),{fieldLabels:L,fieldDescriptions:R,fieldTooltips:z,enumLabels:te,sectionLabels:ne,sectionDescriptions:re,wizardStepLabels:ie,wizardStepDescriptions:ae,groupLabels:oe,isReady:se}=eE(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=RT(m,p||f),ue=(0,Q.useContext)(Fi)?.appConfig,de=(0,Q.useRef)(new Map),fe=(0,Q.useCallback)((e,t)=>{de.current.set(e,t)},[]),pe=(0,Q.useCallback)(e=>{if(!S)return e;let t=Object.fromEntries(Object.entries(S).map(([t,n])=>[t,(n.readsReferences?de.current.get(t):void 0)??Io(n,{appConfig:ue,currentObject:C,values:e,references:{}})]));return Bre(e,t)},[S,C,ue]),me=(0,Q.useMemo)(()=>t=>n(WT(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?UT(r,n):r;return E(t,n,WT(pe(i),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:le,schema:e}))}},[E,_,v,le,pe]),ge=(0,Q.useMemo)(()=>({schema:e,fieldLabels:L,fieldDescriptions:R,fieldTooltips:z,enumLabels:te,sectionLabels:ne,sectionDescriptions:re,groupLabels:oe,wizardStepLabels:ie,wizardStepDescriptions:ae,readOnly:s,disabled:o,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,reportRequestFieldOffer:fe,onSectionSave:he,operationType:p||f,operationRef:d,isExisting:(p||f)===`update`,inheritanceConfig:w,hostResolvesRelationshipRoots:A}),[e,L,R,z,te,ne,re,oe,ie,ae,s,o,g,_,v,y,b,x,S,C,fe,w,A,he,p,f,d]);if(!ee||!se){let e=Math.min(Math.max(Object.keys(L??{}).length,1),8);return(0,$.jsx)(`div`,{className:U(`space-y-section`,a),role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:Array.from({length:e}).map((e,t)=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(um,{className:`h-4 w-28`}),(0,$.jsx)(um,{className:`h-9 w-full`})]},t))})}return(0,$.jsx)(NT,{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)(FT,{value:ge,children:(0,$.jsx)(Zw,{formChromeMode:T,children:(0,$.jsx)(F,{})})})})}tE.displayName=`AutomatedForm`;var nE=tE,rE=(0,Q.createContext)(null);function iE({value:e,children:t}){return(0,$.jsx)(rE.Provider,{value:e,children:t})}function aE(){return(0,Q.useContext)(rE)}function oE(){let e=aE();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 sE;(function(e){e.IDLE=`IDLE`,e.QUEUED=`QUEUED`,e.SAVING=`SAVING`,e.ERROR=`ERROR`,e.CONFLICT=`CONFLICT`,e.DELETED=`DELETED`})(sE||={});var cE;(function(e){e.MUTATION_RESULT=`mutation_result`,e.REMOTE_UPDATE=`remote_update`,e.CONFLICT_RESET=`conflict_reset`,e.RESOURCE_DELETED=`resource_deleted`})(cE||={});var lE;(function(e){e.AUTOSAVE=`autosave`,e.SUBMIT=`submit`,e.DRAFT=`draft`,e.PUBLISH=`publish`,e.SECTION=`section`,e.INLINE=`inline`,e.CUSTOM=`custom`})(lE||={});var uE;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.ORCHESTRATOR=`orchestrator`,e.CUSTOM=`custom`})(uE||={});var dE;(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`})(dE||={});var fE;(function(e){e.SUCCESS=`success`,e.ERROR=`error`})(fE||={});var pE;(function(e){e.ACCEPT_REMOTE=`accept-remote`,e.LAST_WRITE_WINS=`last-write-wins`})(pE||={});var mE;(function(e){e.VERSION_CONFLICT=`version_conflict`,e.REMOTE_UPDATE=`remote_update`})(mE||={});var hE;(function(e){e.LOCAL=`local`,e.REMOTE=`remote`})(hE||={});var gE;(function(e){e[e.LOW=0]=`LOW`,e[e.NORMAL=1]=`NORMAL`,e[e.HIGH=2]=`HIGH`,e[e.IMMEDIATE=3]=`IMMEDIATE`})(gE||={});var _E=class extends Error{name=`MutationCancelledError`;source;constructor(e){super(`Mutation cancelled`),this.source=e}},vE=class extends Error{name=`ResourceDeletedError`;constructor(){super(`Resource has been deleted`)}},yE=class extends Error{name=`BackpressureRejectedError`;constructor(){super(`Queue at maximum depth — mutation rejected`)}},bE=rs.getLogger(),ode=bE.debugByType(`AutosaveContext`);bE.setDebugTypeLogging(`AutosaveContext`,!1);var xE={enabled:!1,defaultTrigger:au.DEBOUNCE,debounceMs:500,savedStateDurationMs:2e3},SE={state:tT.IDLE},CE=(0,Q.createContext)(null);function wE(){return(0,Q.useContext)(CE)}function TE({children:e,labels:t,validateField:n,onSave:r,rmm:i,config:a,onSaveSuccess:o,onSaveError:s}){let c=(0,Q.useMemo)(()=>({...xE,...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===tT.SAVING),[l]),g=UC();(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]??SE,...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:tT.SAVED,lastSavedAt:Date.now()}),m.current[e]=setTimeout(()=>{_(e,{state:tT.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:tT.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:tT.IDLE});return}if(c.signal.aborted)return;_(e,{state:tT.SAVING});try{if(r)await r(e,a,c.signal);else if(i){let n=await i.queueMutation({[e]:a},{type:lE.AUTOSAVE,priority:gE.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===dE.TRANSIENT)i=t.errorNetwork;else if(r?.type===dE.VALIDATION)i=t.errorValidation;else if(r?.type===dE.CONFLICT)i=t.errorConflict;else if(n instanceof yE){ode(`executeSave: backpressure rejection — resetting field to idle`,{fieldName:e}),_(e,{state:tT.IDLE});return}else if(n instanceof _E){_(e,{state:tT.IDLE});return}else if(n instanceof vE){_(e,{state:tT.ERROR,lastError:t.errorResourceDeleted});return}else i=t.errorGeneric;_(e,{state:tT.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===au.NONE)return;p.current[e]={value:t,trigger:n},b(e);let r=new AbortController;if(n===au.BLUR)w(e,t,r);else if(n===au.DEBOUNCE){let n=c.debounceMs??xE.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??tT.IDLE,[l]),O=(0,Q.useCallback)(e=>l[e]??SE,[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)(CE.Provider,{value:k,children:e})}function EE(e,t=au.DEBOUNCE,n=!1){return e===void 0?t:e===!0?n?au.DEBOUNCE:au.BLUR:typeof e==`object`?e.enabled===!1?au.NONE:e.trigger?e.trigger:n?au.DEBOUNCE:au.BLUR:t}var DE=(0,Q.createContext)(null);function sde(){return(0,Q.useContext)(DE)}var cde={[XT.CLEAR]:{action:`bulkClearField`,pending:`bulkFieldWillBeCleared`,pendingUncounted:`bulkFieldWillBeClearedOnSelection`},[XT.EMPTY]:{action:`bulkEmptyField`,pending:`bulkFieldWillBeEmptied`,pendingUncounted:`bulkFieldWillBeEmptiedOnSelection`},[XT.TURN_OFF]:{action:`bulkTurnOffField`,pending:`bulkFieldWillBeTurnedOff`,pendingUncounted:`bulkFieldWillBeTurnedOffOnSelection`}};function OE({fieldName:e,label:t,disabled:n,onSaveFieldNow:r,children:i}){let a=sde(),o=wE(),{tComponent:s}=K({component:B.LOW_LEVEL_FORM_FIELD}),c=a&&e&&!n?a.clearFor(e):void 0,l=c&&e?a?.registerField:void 0;if((0,Q.useEffect)(()=>l&&e?l(e):void 0,[l,e]),!a||!e||!c)return(0,$.jsx)($.Fragment,{children:i});let u=cde[c.kind],d=a.isCleared(e),f=a.selectionCount,p=t?`bulk-clear-${e}-label`:void 0;return(0,$.jsxs)(`div`,{"data-slot":`bulk-field-clear`,"data-bulk-clear-kind":c.kind,"data-bulk-cleared":d||void 0,className:`flex flex-col gap-1`,children:[p&&(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:t}),!d&&i,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{role:`status`,className:`text-sm text-muted-foreground empty:sr-only`,children:d?f===void 0?s(B.LOW_LEVEL_FORM_FIELD,u.pendingUncounted):s(B.LOW_LEVEL_FORM_FIELD,u.pending,{count:f}):null}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-describedby":p,onClick:()=>{d?a.setCleared(e,!1):(o?.cancelPendingUnder(e),a.setCleared(e,!0),r?.(void 0))},children:s(B.LOW_LEVEL_FORM_FIELD,d?`bulkFieldUndoClear`:u.action)})]})]})}function kE(e){if(!e)return[];try{let t=hr.getObjectLikeFieldShape(e,{commonOnly:!0})??{};return Object.entries(t).filter(([,e])=>cne(e)).map(([e])=>e)}catch{return[]}}function AE(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 lde(e){let{formFieldShape:t,inheritanceConfig:n,defaultValuesOverride:r}=e,i={};if(t)for(let[e,n]of Object.entries(t)){let t=Wre(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 jE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ME(...e){return t=>{let n=!1,r=e.map(e=>{let r=jE(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():jE(e[t],null)}}}}function NE(...e){return Q.useCallback(ME(...e),e)}var ude=Symbol.for(`react.lazy`),PE=Q.use;function dde(e){return typeof e==`object`&&!!e&&`then`in e}function FE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ude&&`_payload`in e&&dde(e._payload)}function IE(e){let t=fde(e),n=Q.forwardRef((e,n)=>{let{children:r,...i}=e;FE(r)&&typeof PE==`function`&&(r=PE(r._payload));let a=Q.Children.toArray(r),o=a.find(mde);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 LE=IE(`Slot`);function fde(e){let t=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(FE(n)&&typeof PE==`function`&&(n=PE(n._payload)),Q.isValidElement(n)){let e=gde(n),i=hde(r,n.props);return n.type!==Q.Fragment&&(i.ref=t?ME(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 RE=Symbol(`radix.slottable`);function pde(e){let t=({children:e})=>(0,$.jsx)($.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=RE,t}function mde(e){return Q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===RE}function hde(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 gde(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 _de=rs.getLogger(),zE=B.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,BE=class extends Q.Component{state={error:null,errorInfo:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){_de.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)(vde,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.resetError,titleAs:this.props.titleAs}):this.props.children}};function vde(e){return(0,Q.useContext)(jc)?(0,$.jsx)(yde,{...e}):(0,$.jsx)(VE,{...e,label:e=>`components.${zE}.${e}`})}function yde(e){let{makeTrComponent:t,isReady:n}=K({component:zE});return n?(0,$.jsx)(VE,{...e,label:t(zE)}):e.titleAs?(0,$.jsx)(e.titleAs,{className:`sr-only`}):null}function VE({error:e,errorInfo:t,onRetry:n,titleAs:r,label:i}){let a=ya.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)(zy,{variant:`error`,title:i(`title`),message:i(`message`),actions:[{label:i(`tryAgain`),onClick:n,variant:`primary`}],showDevInfo:a,devInfoTitle:i(`devInfoTitle`),devInfoSections:o})]})}var HE=`data-surface-scroll-lock-count`,UE,bde=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`,WE={a11y:{landmarkRole:`none`}};function GE(e){return Array.from(e.querySelectorAll(bde)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function KE(){return typeof document>`u`?0:Number(document.body.getAttribute(HE)??0)}function qE(e){typeof document<`u`&&(e<=0?(document.body.removeAttribute(HE),document.body.style.overflow=UE??``,UE=void 0):(KE()===0&&(UE=document.body.style.overflow),document.body.setAttribute(HE,String(e)),document.body.style.overflow=`hidden`))}function JE(e){Q.useEffect(()=>{if(e&&typeof document<`u`)return qE(KE()+1),()=>qE(KE()-1)},[e])}function YE(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;(GE(n)[0]??n).focus({preventScroll:!0});let i=e=>{if(e.key!==`Tab`)return;let t=GE(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 xde=rs.getLogger();function XE(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 ZE(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 Sde(e){switch(e){case`nowrap`:return`nowrap`;case`balance`:return`balance`;case`pretty`:return`pretty`;case`wrap`:return`wrap`;default:return}}function Cde(e){switch(e){case`tabular`:return`tabular-nums`;case`lining`:return`lining-nums`;case`inherit`:return`inherit`;default:return}}function wde(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 Tde(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 QE(e){switch(e){case`stack`:return`column`;case`row`:case`inherit`:return e;case`column-reverse-on-mobile`:return`row`;default:return}}function $E(e){switch(e){case`column-reverse-on-mobile`:return`column-reverse`;case`stack`:return`column`;case`row`:case`inherit`:return e;default:return}}function eD(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 tD(e){return e===void 0?void 0:{maxInlineSize:eD(e)}}function Ede(e){switch(e){case`sm`:case`md`:case`lg`:case`xl`:case`measure`:case`centered-readable`:case`content`:return`auto`;default:return`0px`}}function Dde(e){switch(e){case`strip`:return`0px`;default:return`var(--surface-policy-padding-inline)`}}function nD(e){switch(e){case`always`:case`when-orphan`:case`never`:return e;default:return}}function rD(e){switch(e){case`inherit`:case`one-tier-tighter`:case`fixed`:return e;default:return}}function iD(e){switch(e){case`collapse`:case`preserve`:return e;default:return}}function aD(e){switch(e){case`border`:case`gap`:case`rule`:case`none`:return e;default:return}}function Ode(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 oD(e){switch(e){case`wrap-children`:case`self-selectable`:case`forbidden`:return e;default:return}}function sD(e){switch(e){case`self`:case`children`:case`none`:return e;default:return}}function kde(e){switch(e){case`region`:case`dialog`:case`alertdialog`:case`complementary`:case`navigation`:case`status`:case`main`:return e;default:return}}function cD(e){return!!(e&&e!==`none`)}function lD(e){return e?`flex`:`block`}function uD(e){return e?`column`:`row`}function Ade(e){let t=e.containment,n=e.nesting,r=e.content,i=e.interactiveState,a=e.geometry,o=e.stacking,s=e.composition,c=cD(t?.gap);return{"--surface-policy-display":lD(c),"--surface-policy-flex-direction":uD(c),"--surface-policy-padding-block":XE(t?.paddingBlock),"--surface-policy-padding-inline":XE(t?.paddingInline),"--surface-policy-overflow":t?.overflow,"--surface-policy-max-height":t?.maxHeight===`none`?`none`:t?.maxHeight,"--surface-policy-gap":ZE(t?.gap),"--surface-policy-header-gap":ZE(t?.slotGap?.header??t?.gap),"--surface-policy-body-gap":ZE(t?.slotGap?.body??t?.gap),"--surface-policy-footer-gap":ZE(t?.slotGap?.footer??t?.gap),"--surface-policy-framing-mode":nD(n?.framingMode),"--surface-policy-nested-radius-strategy":rD(n?.nestedRadiusStrategy),"--surface-policy-first-child-edge-strategy":iD(n?.firstChildEdgeStrategy),"--surface-policy-divider-strategy":aD(n?.dividerStrategy),"--surface-policy-z-tier":Tde(o?.stackingTier),"--surface-policy-numeric-align":Cde(r?.numericAlignment),"--surface-policy-text-wrap":Sde(r?.wrapStrategy),"--surface-policy-overflow-wrap":wde(r?.overlongTokenStrategy),"--surface-policy-safe-area":a?.safeAreaPadding?`env(safe-area-inset-bottom)`:`0px`,"--surface-policy-action-alignment":QE(a?.actionAlignment),"--surface-policy-action-alignment-mobile":$E(a?.actionAlignment),"--surface-policy-responsive-max-width":eD(a?.responsiveMaxWidth),"--surface-policy-responsive-max-width-margin":Ede(a?.responsiveMaxWidth),"--surface-policy-embedded-table-padding-inline":Dde(s?.embeddedTablePadding),"--surface-policy-child-adaptive-gap":s?.childAdaptiveDensity?`var(--sp-field)`:void 0,"--surface-policy-selectable-semantics":oD(i?.selectableSemantics),"--surface-policy-gesture-opt-in":sD(i?.gestureOptIn)}}function jde(e,t,n,r){Q.useRef(!1),r&&[e,t].filter(Boolean).join(` `)}function Mde(e,t,n,r,i,a){return r?{...Ade(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 dD=Q.forwardRef(function({variant:e=nt.BASE,materialRoleOverride:t,policyOverride:n,asChild:r=!1,emitPolicyVars:i=!0,modal:a=!1,a11yManagedByHost:o=!1,errorFallbackTitleAs:s,className:c,style:l,children:u,role:d,"aria-label":f,"aria-labelledby":p,"data-slot":m,"data-surface":h,tabIndex:g,..._},v){let{getComposedClasses:y,getMaterialProfile:b,getRecipe:x,getSurfacePolicy:S}=Rg(),C=x?.(oc.SURFACE,e),w=y?.(oc.SURFACE,e),T=b?.(t??C?.material),E=Q.useContext(Je),D=Q.useMemo(()=>S?S(e,n,E?.policy):Tc(Qr[e],void 0,void 0,n,{variant:e,parentPolicy:E?.policy,logger:xde}),[S,E?.policy,n,e]),[O,k]=Q.useState(),A=Q.useCallback(e=>{k(e)},[]),j=Q.useCallback(e=>{k(t=>t===e?void 0:t)},[]),M=Q.useMemo(()=>({headerId:O,registerHeaderId:A,unregisterHeaderId:j}),[O,A,j]),N=Q.useMemo(()=>Kr(e,D,E,M),[M,E,D,e]),P=!!E?.isInFramedAncestor,F=P?E?.nearestFramedAncestorVariant??void 0:void 0,I=Ode(D.nesting?.nestedRadiusStrategy,P);jde(c,r&&Q.isValidElement(u)?u.props.className:void 0,n,i);let ee=r?LE:`div`,L=Q.useRef(null),R=o_(T,L),z=Q.useCallback(e=>{L.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]),te=d??kde(D.a11y?.landmarkRole),ne=p??(D.a11y?.labelStrategy===`from-header`?O:void 0),re={...d===void 0?{}:{role:d},...f===void 0?{}:{"aria-label":f},...p===void 0?{}:{"aria-labelledby":p}},ie=o?re:{...te===void 0?{}:{role:te},...f===void 0?{}:{"aria-label":f},...ne===void 0?{}:{"aria-labelledby":ne}},ae=!o&&(D.a11y?.focusTrap===`on-mount`||a&&D.a11y?.focusTrap===`when-modal`),oe=!o&&a&&D.a11y?.scrollContainment===`lock-body`,se=ae&&g==null?-1:g,ce=se===void 0?{}:{tabIndex:se};YE(L,ae),JE(oe),Q.useEffect(()=>{},[o,f,p,O,D.a11y?.labelStrategy,te,e]);let le=i?{"data-slot":`surface`,"data-surface":``,"data-inline-size-tier":D.geometry?.responsiveMaxWidth}:{},ue=D.interactiveState?.errorBoundary===`self`,de=ue?Nde(u,r,s):{children:u,boundsContent:!1},fe=(0,$.jsx)(ee,{ref:z,..._,...le,"data-material-kind":R[`data-material-kind`],"data-material-tier":R[`data-material-tier`],"data-material-variant":R[`data-material-variant`],"data-material-depth":R[`data-material-depth`],"data-material-composition":R[`data-material-composition`],"data-material-group":R[`data-material-group`],"data-material-refractive-budget":R[`data-material-refractive-budget`],...ce,"data-surface-focus-trap":ae?``:void 0,"data-surface-scroll-containment":oe?``:void 0,"data-surface-framing-mode":i?nD(D.nesting?.framingMode):void 0,"data-surface-frame":i?N.rendersOwnFrame?`rendered`:`suppressed`:void 0,"data-surface-in-framed-ancestor":i&&P?``:void 0,"data-surface-nearest-framed-ancestor":i?F:void 0,"data-surface-nested-radius-strategy":i?rD(D.nesting?.nestedRadiusStrategy):void 0,"data-surface-first-child-edge-strategy":i?iD(D.nesting?.firstChildEdgeStrategy):void 0,"data-surface-divider-strategy":i?aD(D.nesting?.dividerStrategy):void 0,"data-surface-selectable-semantics":i?oD(D.interactiveState?.selectableSemantics):void 0,"data-surface-gesture-opt-in":i?sD(D.interactiveState?.gestureOptIn):void 0,"data-surface-child-adaptive-density":i&&D.composition?.childAdaptiveDensity===!0?``:void 0,"data-surface-selection-column-aware":i&&D.composition?.selectionColumnAware===!0?``:void 0,...ie,"data-surface-variant":e,className:U(w,c),style:Mde(D,R.style,l,i,N.rendersOwnFrame,I),children:de.children});return(0,$.jsx)(Je.Provider,{value:N,children:ue&&!de.boundsContent?(0,$.jsx)(BE,{children:fe}):fe})});function Nde(e,t,n){if(!t)return{children:(0,$.jsx)(BE,{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)(BE,{titleAs:n,children:r})),boundsContent:!0}}dD.displayName=`Surface`;function fD(e,t,n){let r=t.containment?.slotGap?.[e]??t.containment?.gap,i=cD(r);return{"--surface-policy-slot-display":lD(i),"--surface-policy-slot-flex-direction":uD(i),[`--surface-policy-${e}-gap`]:ZE(r),...n}}var pD=Q.forwardRef(function({className:e,id:t,style:n,...r},i){let a=pc(),o=Q.useContext(Je),s=o?.registerHeaderId,c=o?.unregisterHeaderId,l=Q.useId(),u=t??l;return Q.useEffect(()=>(s?.(u),()=>c?.(u)),[s,u,c]),(0,$.jsx)(`div`,{ref:i,id:u,"data-slot":`surface-header`,className:U(e),style:fD(`header`,a,n),...r})});pD.displayName=`Surface.Header`;var mD=Q.forwardRef(function({className:e,style:t,...n},r){let i=pc();return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-body`,className:U(e),style:fD(`body`,i,t),...n})});mD.displayName=`Surface.Body`;var hD=Q.forwardRef(function({className:e,style:t,...n},r){let i=pc(),a=i.containment?.slotGap?.footer??i.containment?.gap,o=cD(a),s=!!(i.geometry?.actionAlignment&&i.geometry.actionAlignment!==`inherit`);return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-footer`,className:U(e),style:{"--surface-policy-slot-display":lD(o||s),"--surface-policy-slot-flex-direction":uD(o),"--surface-policy-footer-gap":ZE(a),"--surface-policy-action-alignment":s?QE(i.geometry?.actionAlignment):void 0,"--surface-policy-action-alignment-mobile":s?$E(i.geometry?.actionAlignment):void 0,...t},...n})});hD.displayName=`Surface.Footer`;var gD=Q.forwardRef(function({className:e,...t},n){return(0,$.jsx)(`div`,{ref:n,"data-slot":`surface-action`,className:U(e),...t})});gD.displayName=`Surface.Action`;var _D=Object.assign(dD,{Header:pD,Body:mD,Footer:hD,Action:gD}),vD=Q.createContext(void 0);function Pde(e){return e===y.EYEBROW?y.EYEBROW:y.LABEL}function yD(){return Q.useContext(vD)}function bD({voice:e,children:t}){return Q.createElement(vD.Provider,{value:e},t)}function xD({children:e}){let t=yD();return Q.createElement(vD.Provider,{value:Pde(t)},e)}var Fde=`text-base`;function SD(e){return U(e(oc.TYPOGRAPHY,y.HEADING).base,Fde)}var CD=(0,Q.createContext)({pathPrefix:``});function wD({pathPrefix:e,children:t}){return(0,$.jsx)(CD.Provider,{value:{pathPrefix:e},children:t})}function TD(){return(0,Q.useContext)(CD)}function ED(e){let{pathPrefix:t}=TD();return t?`${t}.${e}`:e}var DD=(0,Q.createContext)(null);function OD(e){let t=(0,Q.useContext)(DD);(0,Q.useLayoutEffect)(()=>{t?.registerSlot(e)},[e,t])}function Ide(){let e=(0,Q.useContext)(DD);(0,Q.useLayoutEffect)(()=>{e?.registerWizardRoot()},[e])}var kD=Xs(B.LOW_LEVEL_ALERT,`Alert`,[`Title`,`Description`]);function AD({preset:e=q.DEFAULT,...t}){let n=kD(e);return(0,$.jsx)(n,{...t})}function jD({preset:e=q.DEFAULT,...t}){let n=kD(e);return(0,$.jsx)(n.Title,{...t})}function MD({preset:e=q.DEFAULT,...t}){let n=kD(e);return(0,$.jsx)(n.Description,{...t})}function ND(){let e=(0,Q.useContext)(nT);if(!e)throw Error(`useFormSchemaContext must be used within a FormSchemaProvider`);return e}function PD(){return(0,Q.useContext)(nT)}var Lde=rs.getLogger().debugByType(`FormErrorCategorization`),FD=class e{constructor(){}static ROOT_ERROR_PATHS=new Set([``,`root`,`_`]);static ROOT_ERROR_PREFIX=oT;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 Lde(`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}}},ID=`wildo:reveal-field`,LD=`data-reveal-container`,RD=`data-reveal-panel`;function zD(e){let t={revealed:!1};return e.dispatchEvent(new CustomEvent(ID,{bubbles:!0,detail:t})),t.revealed}function BD(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 VD(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(LD)!==t)continue;let e=i.getAttribute(RD);e!==null&&n.current(e)&&r&&(r.revealed=!0);return}};return document.addEventListener(ID,e),()=>document.removeEventListener(ID,e)},[t]),t}function HD(e,t){return{[LD]:e,[RD]:t}}function UD(){return UC()!=null}var WD=`data-form-error-summary`;function GD(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 Rde(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function KD(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="${Rde(t)}"]`);if(e){n=e;break}}if(!n)return e.some(e=>FD.isFormLevelErrorPath(e))?(zde(),!0):!1;let i=n;return zD(i)?BD(i,()=>qD(i)):qD(i),!0}function zde(e=20){let t=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),n=0,r=()=>{let i=document.querySelector(`[${WD}]`);i?(i.scrollIntoView({behavior:`smooth`,block:`center`}),i.focus({preventScroll:!0})):n<e&&(n+=1,t(r))};r()}function qD(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 JD=rs.getLogger(),Bde=JD.debugByType(`FormErrorSummary`);JD.setDebugTypeLogging(`FormErrorSummary`,!1);function YD({title:e,className:t,maxErrors:n=10,stepFieldNames:r}){let{formState:i}=UC(),{renderIcon:a}=Of(),o=pc(),s=PD(),c=s?.resourceType,{tResourceFieldEdit:l,tComponent:u,isReady:d}=K({component:B.LOW_LEVEL_FORM_MESSAGE,...c?{resource:c}:{}}),f=e??u(B.LOW_LEVEL_FORM_MESSAGE,`formErrorsTitle`),{fieldErrors:p,crossFieldErrors:m,serverErrors:h}=FD.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=>FD.isFormLevelErrorPath(e.path)||_(e.path)),[h,_]),y=(0,Q.useMemo)(()=>g?p.filter(e=>_(e.path)):[],[p,g,_]),b=[...m,...v,...y],x=LT()?.fieldLabels,S=(0,Q.useMemo)(()=>hr.createFieldLabelResolver(c,l,s?.schema,x),[c,l,s?.schema,x]);if(b.length===0||!d)return null;Bde(`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)(AD,{variant:`destructive`,className:U(t),role:`alert`,"data-testid":`form-error-summary`,[WD]:``,tabIndex:-1,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[a(H.ERROR,{size:ca.SM,className:`mt-0.5`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(jD,{className:`mb-element`,children:f}),(0,$.jsxs)(MD,{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:[FD.isFormLevelErrorPath(e)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[S(e),`:`]}),` `]}),t]},`${e}-${n}`))}),w&&(0,$.jsx)(`p`,{className:`mt-item text-sm opacity-[var(--opacity-hover)]`,children:u(B.LOW_LEVEL_FORM_MESSAGE,`moreErrors`,{count:b.length-n})})]})]})]})})}YD.displayName=`FormErrorSummary`;var XD=YD,ZD=(0,Q.createContext)(null),QD=(0,Q.createContext)(null);function $D(){return(0,Q.useContext)(ZD)}function eO({className:e}){OD(`errorSummary`);let t=$D();return(0,$.jsx)(XD,{className:e,stepFieldNames:t?.getCurrentStepFieldNames()})}function tO({loading:e,children:t,width:n=`4em`,className:r}){return e?(0,$.jsx)(um,{"aria-hidden":`true`,className:U(`inline-block h-[1em] align-[-0.125em] rounded-sm`,r),style:{width:n}}):t}tO.displayName=`SkeletonText`;function nO({className:e,label:t,submittingLabel:n,fullWidth:r,disabled:i}){OD(`submitButton`);let{formState:a}=UC(),o=LT(),{tComponent:s,isReady:c}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),l=t===void 0&&!c,u=t??(c?s(B.LOW_LEVEL_FORM_MESSAGE,`submitSave`):void 0),d=a.isSubmitting||!!o?.disabled||l||i===!0,f=a.isSubmitting&&n?n:u;return(0,$.jsx)(`div`,{className:e,children:(0,$.jsx)(X,{type:`submit`,disabled:d,className:r?`w-full`:void 0,children:(0,$.jsx)(tO,{loading:l,width:`5em`,children:f})})})}nO.displayName=`SubmitButton`;var rO;(function(e){e.AUTOMATIC=`automatic`,e.MANUAL=`manual`})(rO||={});var iO;(function(e){e.PRIMARY=`primary`,e.SECONDARY=`secondary`})(iO||={});var aO=Q.createContext(null),oO=Xs(B.LOW_LEVEL_TABS,`Tabs`,[`List`,`Trigger`,`Content`]);function sO({preset:e=q.DEFAULT,...t}){let n=oO(e);return(0,$.jsx)(n,{...t})}function cO({preset:e=q.DEFAULT,...t}){let n=oO(e);return(0,$.jsx)(n.List,{...t})}function lO({preset:e=q.DEFAULT,...t}){let n=oO(e);return(0,$.jsx)(n.Trigger,{...t})}function uO({preset:e=q.DEFAULT,...t}){let n=oO(e);return(0,$.jsx)(n.Content,{...t})}var dO=Xs(B.LOW_LEVEL_ACCORDION,`Accordion`,[`Item`,`Trigger`,`Content`]);function fO({preset:e=q.DEFAULT,...t}){let n=dO(e);return(0,$.jsx)(n,{...t})}function pO({preset:e=q.DEFAULT,...t}){let n=dO(e);return(0,$.jsx)(n.Item,{...t})}function mO({preset:e=q.DEFAULT,...t}){let n=dO(e);return(0,$.jsx)(n.Trigger,{...t})}function hO({preset:e=q.DEFAULT,...t}){let n=dO(e);return(0,$.jsx)(n.Content,{...t})}var gO;(function(e){e.SINGLE=`single`,e.MULTIPLE=`multiple`})(gO||={});var _O;(function(e){e.SEGMENTED=`segmented`,e.CHIPS=`chips`})(_O||={});var vO=Xs(B.LOW_LEVEL_TOGGLE_GROUP,`ToggleGroup`,[`Item`]),yO=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=vO(e);return(0,$.jsx)(r,{...t,ref:n})});yO.displayName=`ToggleGroup`;function bO({preset:e=q.DEFAULT,...t}){let n=vO(e);return(0,$.jsx)(n.Item,{...t})}var xO=Xs(B.LOW_LEVEL_COLLAPSIBLE,`Collapsible`,[`Trigger`,`Content`]);function SO({preset:e=q.DEFAULT,...t}){let n=xO(e);return(0,$.jsx)(n,{...t})}function CO({preset:e=q.DEFAULT,...t}){let n=xO(e);return(0,$.jsx)(n.Trigger,{...t})}function wO({preset:e=q.DEFAULT,...t}){let n=xO(e);return(0,$.jsx)(n.Content,{...t})}var TO=Xs(B.LOW_LEVEL_STEPPER,`Stepper`,[`Item`,`Indicator`,`Separator`,`Title`,`Description`]);function EO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n,{...t})}function DO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n.Item,{...t})}function OO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n.Indicator,{...t})}function kO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n.Separator,{...t})}function AO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n.Title,{...t})}function jO({preset:e=q.DEFAULT,...t}){let n=TO(e);return(0,$.jsx)(n.Description,{...t})}var MO;(function(e){e.REACHED=`reached`,e.CURRENT=`current`,e.NOT_REACHED=`not_reached`})(MO||={});var NO=class extends Error{constructor(e){super(`[Section STAGES] ${e}`),this.name=`SectionStageBindingError`}};function PO(e,t,n){let r=t.join(`, `);if(e===void 0)throw new NO(`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 NO(`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 NO(`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 NO(`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 NO(`stageBinding.stageOfValue names ${c.map(e=>`"${e}"`).join(`, `)}, which ${c.length===1?`is not a section`:`are not sections`} of the group (${r}).`)}function FO(e,t){return typeof t==`string`&&Object.prototype.hasOwnProperty.call(e.stageOfValue,t)?e.stageOfValue[t]:null}function IO(e,t){let n=t===null?-1:e.indexOf(t);return e.map((e,t)=>n<0||t>n?MO.NOT_REACHED:t===n?MO.CURRENT:MO.REACHED)}var Vde=new Set([cr.DEFAULT,cr.CARD,cr.GHOST,cr.COLLAPSIBLE]);function LO(e){return Vde.has(e)}function Hde(e,t,n){let r=Q.Children.toArray(e),i=[];for(let e=0;e<r.length;e++){let a=r[e];if(!t(a)){i.push({type:`node`,node:a});continue}let o=a.props.appearance??n??cr.DEFAULT;if(LO(o)){i.push({type:`node`,node:a});continue}let s=o,c=Ude(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 Ude(e,t){switch(e){case cr.INLINE:return JSON.stringify({mode:e,gap:t.gap});case cr.GRID:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth});case cr.COLUMNS:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap});case cr.VERTICAL_TABS:return JSON.stringify({mode:e,navWidth:t.navWidth});case cr.ACCORDION:return JSON.stringify({mode:e,allowMultiple:t.allowMultiple});case cr.EXPANDABLE:return JSON.stringify({mode:e,initialVisibleCount:t.initialVisibleCount});case cr.STEPPER:return JSON.stringify({mode:e,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation});case cr.TABS:case cr.PILLS:case cr.TIMELINE:case cr.STAGES:return JSON.stringify({mode:e});default:return JSON.stringify({mode:e})}}function Wde(e){let t=e.sections[0].props,n=e.mode,r={mode:n,ariaLabel:void 0,ariaLabelledBy:void 0};switch(n){case cr.INLINE:return{...r,mode:n,gap:t.gap};case cr.GRID:return{...r,mode:n,columnCount:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth};case cr.COLUMNS:return{...r,mode:n,columnCount:t.columns,gap:t.gap};case cr.TABS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case cr.VERTICAL_TABS:{let i=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:i?.props.name??e.sections[0].props.name,navWidth:t.navWidth}}case cr.PILLS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case cr.ACCORDION:{let i=e.sections.filter(e=>e.props.defaultFocus).map(e=>e.props.name);return{...r,mode:n,allowMultiple:t.allowMultiple,defaultExpanded:i.length>0?i:[e.sections[0].props.name]}}case cr.EXPANDABLE:return{...r,mode:n,initialVisibleCount:t.initialVisibleCount};case cr.STEPPER:return{...r,mode:n,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation??pu.VERTICAL};case cr.TIMELINE:return{...r,mode:n};case cr.STAGES:return{...r,mode:n};default:return{mode:cr.INLINE}}}function Gde(e){switch(e){case`grouped`:case`flat`:case`separator-only`:return e;default:return`card-each`}}function RO(e){switch(e){case`flat`:return{appearance:cr.DEFAULT};case`separator-only`:return{appearance:cr.DEFAULT,className:`border-b pb-field last:border-b-0 last:pb-0`};default:return{appearance:cr.CARD}}}var zO=({sections:e,className:t})=>{let{getRecipe:n}=Rg(),r=n(oc.SURFACE,nt.CARD),i=n(oc.TYPOGRAPHY,y.EYEBROW),a=qO();return(0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.CARD,policyOverride:{nesting:{framingMode:`always`}},children:(0,$.jsx)(`div`,{role:`region`,"aria-label":a(`contentSectionsRegion`),className:U(r.base,`divide-y divide-border`,t),children:e.map(e=>(0,$.jsxs)(`section`,{"data-slot":`content-group`,className:`space-y-field p-card`,children:[(e.title!=null||e.icon!=null)&&(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-xs`,i.base),children:[e.icon!=null&&(0,$.jsx)(`span`,{className:`inline-flex items-center`,children:e.icon}),e.title]}),e.description!=null&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,$.jsx)(ET,{appearance:cr.DEFAULT,disabled:e.disabled,children:e.content})]},e.id))})})};function BO(e,t){let{appearance:n,className:r}=RO(t?.wrapMode??`card-each`);return(0,$.jsx)(ET,{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 VO(e,t=e.content,n=`card-each`){let{appearance:r,className:i}=RO(n);return(0,$.jsx)(ET,{panel:!0,appearance:r,className:i,children:t},e.id)}function HO({section:e}){let{getRecipe:t}=Rg();return e.description==null?e.content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:U(`mb-field`,t(oc.TYPOGRAPHY,y.DESCRIPTION).base),children:e.description}),e.content]})}var UO=({sections:e,config:t,className:n,onSectionChange:r})=>{let i=Gde(pc().autoRender?.autoSectionWrap);if(e.length===0)return t.emptyStateMessage?(0,$.jsx)(cm,{title:t.emptyStateMessage,variant:`compact`,className:n}):null;if(e.length===1&&!t.showSingleSectionNav)return i===`grouped`?(0,$.jsx)(zO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:n,children:BO(e[0],{wrapMode:i})});switch(t.mode){case cr.DEFAULT:case cr.CARD:case cr.GHOST:case cr.INLINE:return(0,$.jsx)(JO,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.GRID:return(0,$.jsx)(qde,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.COLUMNS:return(0,$.jsx)(Jde,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.TABS:return(0,$.jsx)(Yde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.VERTICAL_TABS:return(0,$.jsx)(Qde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.PILLS:return(0,$.jsx)($de,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.ACCORDION:return(0,$.jsx)(efe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.COLLAPSIBLE:return(0,$.jsx)(nfe,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.EXPANDABLE:return(0,$.jsx)(ife,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.STEPPER:return(0,$.jsx)(afe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case cr.TIMELINE:return(0,$.jsx)(ofe,{sections:e,config:t,className:n,sectionWrapMode:i});case cr.STAGES:return(0,$.jsx)(sfe,{sections:e,config:t,className:n,sectionWrapMode:i});default:return(0,$.jsx)(JO,{sections:e,config:{mode:cr.INLINE},className:n,sectionWrapMode:i})}},WO={sm:`gap-element`,md:`gap-field`,lg:`gap-section`},Kde={sm:`var(--spacing-element)`,md:`var(--spacing-field)`,lg:`var(--spacing-section)`},GO=`300px`,KO=B.LOW_LEVEL_CONTENT_SECTION_CONTAINER;function qO(){let{tComponent:e}=K({component:KO});return(0,Q.useCallback)((t,n)=>{let r=e(KO,t,n);return r===`${oi.COMPONENTS}.${KO}.${t}`?``:r},[e])}var JO=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=WO[(`gap`in t?t.gap:void 0)??`md`],a=qO();return r===`grouped`?(0,$.jsx)(zO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:U(`flex flex-col`,i,n),role:`region`,"aria-label":t.ariaLabel??a(`contentSectionsRegion`),children:e.map(e=>BO(e,{wrapMode:r}))})},qde=({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=WO[a],c=qO(),l=i?`max(${o}, calc((100% - ${i-1} * ${Kde[a]}) / ${i}))`:o,u={gridTemplateColumns:`repeat(${i?`auto-fill`:`auto-fit`}, minmax(min(100%, ${l}), 1fr))`};return(0,$.jsx)(`div`,{className:U(`grid`,s,n),style:u,role:`region`,"aria-label":t.ariaLabel??c(`contentGridRegion`),children:e.map(e=>BO(e,{wrapMode:r}))})},Jde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=WO[t.gap??`md`],a=qO(),o=t.columnCount===`auto`||t.columnCount===void 0?GO:`${t.columnCount} ${GO}`;return(0,$.jsx)(`div`,{className:U(i,n),style:{columns:o},role:`region`,"aria-label":t.ariaLabel??a(`contentColumnsRegion`),children:e.map(e=>(0,$.jsx)(`div`,{className:U(`break-inside-avoid mb-field`,r===`separator-only`&&`border-b pb-field last:border-b-0 last:pb-0`),children:BO(e,{wrapMode:r===`separator-only`?`flat`:r})},e.id))})};function YO(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:VD(e=>e!==a&&(o(e),!0))}}var Yde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=qO(),o=UD(),{active:s,select:c,revealContainerId:l}=YO(t,e,i);return(0,$.jsxs)(sO,{value:s,className:n,onValueChange:c,children:[(0,$.jsx)(cO,{"aria-label":t.ariaLabel??a(`sectionTabsNav`),children:e.map(e=>(0,$.jsxs)(lO,{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)(uO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...HD(l,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:VO(e,(0,$.jsx)(HO,{section:e}),r)},e.id))]})},Xde=36;function Zde(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!t||typeof ResizeObserver>`u`)return;let n=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,r=t=>i(t>0&&t<e*n);r(t.getBoundingClientRect().width);let a=new ResizeObserver(([e])=>{e&&r(e.contentRect.width)});return a.observe(t),()=>a.disconnect()},[t,e]),[n,r]}var Qde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=qO(),o=UD(),{active:s,select:c,revealContainerId:l}=YO(t,e,i),u=t.navWidth??`w-48`,[d,f]=Zde(Xde);return(0,$.jsx)(`div`,{ref:d,className:`min-w-0`,"data-vertical-tabs-stacked":f||void 0,children:(0,$.jsxs)(sO,{value:s,orientation:f?pu.HORIZONTAL:pu.VERTICAL,className:U(`mt-field`,n),onValueChange:c,children:[(0,$.jsx)(cO,{className:f?void 0:U(u,`shrink-0 self-start border-e pe-card`),"aria-label":t.ariaLabel??a(`verticalTabsRegion`),children:e.map(e=>(0,$.jsxs)(lO,{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)(uO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...HD(l,e.id),className:`min-w-0 flex-1 animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:VO(e,(0,$.jsx)(HO,{section:e}),r)},e.id))]})})},$de=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(t.defaultActive??e[0]?.id),s=t.activeSection??a,c=o,{getRecipe:l}=Rg(),u=qO(),d=(0,Q.useId)(),f=(0,Q.useRef)(null),p=l(oc.SELECTABLE,Na.FILLED),m=UD(),h=e=>`${d}-tab-${e}`,g=e=>`${d}-panel-${e}`,_=e=>{c(e),i?.(e)},v=VD(e=>e!==s&&(_(e),!0)),y=t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key))return;let n=e.filter(e=>!e.disabled).map(e=>e.id);if(n.length===0)return;t.preventDefault();let r=n.indexOf(s),i=r<0?0:r;t.key===`ArrowRight`?i=(r+1)%n.length:t.key===`ArrowLeft`?i=(r-1+n.length)%n.length:t.key===`Home`?i=0:t.key===`End`&&(i=n.length-1);let a=n[i];_(a),f.current?.querySelector(`#${CSS.escape(h(a))}`)?.focus()},b=e.find(e=>e.id===s),x=e=>(0,$.jsx)(`div`,{role:`tabpanel`,id:g(e.id),"aria-labelledby":h(e.id),tabIndex:0,hidden:e.id!==s,...HD(v,e.id),className:U(`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,Mg(a_.INSET)),children:VO(e,(0,$.jsx)(HO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`space-y-field`,n),role:`region`,"aria-label":t.ariaLabel??u(`pillNavigationRegion`),children:[(0,$.jsx)(`div`,{ref:f,className:`flex flex-wrap items-center gap-item`,role:`tablist`,"aria-label":t.ariaLabel??u(`sectionTabsNav`),onKeyDown:y,children:e.map(e=>{let t=s===e.id;return(0,$.jsxs)(`button`,{id:h(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":g(e.id),"data-state":t?`active`:`inactive`,tabIndex:t?0:-1,disabled:e.disabled,className:U(`inline-flex items-center gap-element rounded-md px-card-sm py-item font-medium`,p.base,p.motion?.transition,p.states.focus,!t&&p.states.hover,t&&p.states.selected,e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),onClick:()=>_(e.id),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id)})}),m?e.map(x):b&&x(b)]})},efe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=t.defaultExpanded??[e[0]?.id],o=t.allowMultiple??!1,s=UD(),{getRecipe:c}=Rg(),l=SD(c),[u,d]=(0,Q.useState)(o?a:a.slice(0,1)),f=e=>{d(e),i?.(o?e:e[0]??``)},p=VD(e=>!u.includes(e)&&(f(o?[...u,e]:[e]),!0)),m=e.map(e=>(0,$.jsxs)(pO,{value:e.id,disabled:e.disabled,children:[(0,$.jsx)(mO,{className:U(e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:(0,$.jsxs)(`span`,{className:U(`flex items-center gap-element`,l),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]})}),(0,$.jsx)(hO,{...s?{forceMount:!0,hidden:!u.includes(e.id)}:{},...HD(p,e.id),children:VO(e,(0,$.jsx)(HO,{section:e}),`flat`)})]},e.id));return o?(0,$.jsx)(fO,{type:gO.MULTIPLE,value:u,className:n,onValueChange:e=>f(e),children:m}):(0,$.jsx)(fO,{type:gO.SINGLE,value:u[0]??``,className:n,collapsible:!0,onValueChange:e=>f(e?[e]:[]),children:m})},tfe=`all`,nfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let[i,a]=(0,Q.useState)(!0),o=qO(),s=t.triggerLabel?.open??o(`accordionCollapseAll`),c=t.triggerLabel?.closed??o(`accordionExpandAll`),l=o(`accordionSectionCount`,{count:e.length}),u=UD(),d=VD(()=>!i&&(a(!0),!0));return(0,$.jsxs)(SO,{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)(CO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-expanded":i,children:i?s:c})})]}),(0,$.jsx)(wO,{className:`space-y-field mt-field`,...u?{forceMount:!0,hidden:!i}:{},...HD(d,tfe),children:e.map(e=>BO(e,{titleTag:`h4`,wrapMode:r}))})]})},rfe=`folded`,ife=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.initialVisibleCount??3,[a,o]=(0,Q.useState)(!1),s=qO(),c=a?e:e.slice(0,i),l=e.length-i,u=t.showMoreLabel??s(`expandableShowMore`,{count:l}),d=t.showLessLabel??s(`expandableShowLess`),f=UD(),{renderIcon:p}=Of(),m=VD(()=>!a&&(o(!0),!0));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,n),children:[f?(0,$.jsxs)($.Fragment,{children:[e.slice(0,i).map(e=>BO(e,{wrapMode:r})),l>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,hidden:!a,...HD(m,rfe),children:e.slice(i).map(e=>BO(e,{wrapMode:r}))})]}):c.map(e=>BO(e,{wrapMode:r})),l>0&&(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,onClick:()=>o(!a),"aria-expanded":a,children:[a?d:u,p(a?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.SM})]})]})},afe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(0),s=qO(),c=(0,Q.useId)(),l=t.orientation??pu.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=UD(),_=VD(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,...HD(_,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:VO(e,(0,$.jsx)(HO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-section`,n),children:[(0,$.jsx)(`nav`,{id:c,"aria-label":t.ariaLabel??s(`stepperProgressNav`),children:(0,$.jsx)(EO,{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)(DO,{step:n,role:`listitem`,"aria-current":n===a?`step`:void 0,children:[(0,$.jsx)(OO,{step:n,"aria-hidden":`true`}),(0,$.jsx)(AO,{step:n,children:t.title})]}),n<e.length-1&&(0,$.jsx)(kO,{step:n,"aria-hidden":`true`})]},t.id))})}),u&&(0,$.jsx)(`div`,{className:`w-full bg-muted rounded-full h-2`,children:(0,$.jsx)(`div`,{className:`bg-primary h-2 rounded-full transition-[width]`,style:{width:`${(a+1)/e.length*100}%`},role:`progressbar`,"aria-labelledby":c,"aria-valuenow":a+1,"aria-valuemin":1,"aria-valuemax":e.length})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-field`,children:[g?e.map(y):v&&y(v,a),(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>h(a-1),disabled:a===0,children:p}),a<e.length-1&&(0,$.jsx)(X,{type:`button`,onClick:()=>h(a+1),children:f})]})]})]})},ofe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=qO();return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`timelineRegion`),children:(0,$.jsx)(zf,{className:`gap-section`,children:e.map((e,t)=>(0,$.jsx)(Pf,{children:(0,$.jsx)(uf,{children:VO(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)(Mf,{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))})})},sfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=qO(),a=t.currentStage;if(a===void 0)return e.map(e=>e.id).join(`|`),(0,$.jsx)(JO,{sections:e,config:{mode:cr.INLINE},className:n,sectionWrapMode:r});let o=IO(e.map(e=>e.id),a),s=o.indexOf(MO.CURRENT);return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`stagesRegion`),"data-current-stage":a??void 0,children:(0,$.jsx)(EO,{currentStep:s,totalSteps:e.length,orientation:pu.VERTICAL,role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(DO,{step:n,role:`listitem`,"data-stage":t.id,"data-stage-state":o[n],"aria-current":o[n]===MO.CURRENT?`step`:void 0,children:[(0,$.jsx)(OO,{step:n,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(AO,{step:n,children:t.title}),t.description!=null&&(0,$.jsx)(jO,{step:n,children:t.description}),(0,$.jsx)(`div`,{className:`mt-field`,children:t.content})]})]}),n<e.length-1&&(0,$.jsx)(kO,{step:n,"aria-hidden":`true`,className:`ms-[calc(1rem-1px)] my-element`})]},t.id))})})};UO.displayName=`ContentSectionContainer`;function XO(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))XO(i,e===`root`?t:`${t}.${e}`,n)}function ZO(e,t){let n=[];for(let r of t)XO(e.getFieldState(r).error,r,n);return n}var QO=e=>e.type===`server`||e.type===`server-unique`;async function $O(e,t){if(t.length===0)return!0;let n=ZO(e,t).filter(e=>QO(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=ZO(e,t),a=e,o=cfe(a);for(let e of i)QO(e.error)||o.has(e.path)||a.setValue(e.path,a.getValues(e.path),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1});return KD(i.map(e=>e.path)),!1}function cfe(e){let t=e.control._names?.array;return t instanceof Set?t:new Set}var ek=(0,Q.createContext)(null);function tk({value:e,children:t}){return(0,$.jsx)(ek.Provider,{value:e,children:t})}function nk(){let e=(0,Q.useContext)(ek);if(!e)throw Error(`useDisplayTemplateContext() must be used within a <DisplayTemplateProvider>. This is provided automatically by AutomaticDisplayer / ResourceAutomaticDisplayer.`);return e}function rk(){return(0,Q.useContext)(ek)}var ik=(0,Q.createContext)(void 0);function ak({displayChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({displayChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(ik.Provider,{value:r,children:n})}function ok(){return(0,Q.useContext)(ik)??{}}function sk({children:e}){let{displayChromeMode:t}=ok();return(0,$.jsx)(ak,{displayChromeMode:t,sectionChromeMode:void 0,children:e})}var ck;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.COMPOSITE=`composite`})(ck||={});var lk=new Set(Object.values(Pc));function uk(e){if(typeof e==`string`)return lk.has(e)?e:Pc.STACKED;let t={};for(let[n,r]of Object.entries(e))t[n]=r&&lk.has(r)?r:Pc.STACKED;return t}function dk(e){return LO(e)}var fk=(0,Q.createContext)(null);function pk(){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 mk(e){let t=(0,Q.useContext)(fk);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[t,e])}var hk=[],gk=()=>()=>{};function _k(){let e=(0,Q.useContext)(fk);return(0,Q.useSyncExternalStore)(e?e.subscribeToRegisteredFields:gk,e?e.getRegisteredFields:()=>hk)}function vk(e){let t=(0,Q.useContext)(fk),[n]=(0,Q.useState)(()=>({}));(0,Q.useLayoutEffect)(()=>()=>{t?.clearSlotPresence(n)},[t,n]),(0,Q.useLayoutEffect)(()=>{t?.reportSlotPresence(n,e)},[t,n,e])}function yk(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 bk;(function(e){e.FIELD_SLOT=`field_slot`,e.FIELD_SLOT_CONTAINER=`field_slot_container`})(bk||={});var xk=Symbol.for(`wildo.sectionContentRole`);function Sk(e){return e!==null&&(typeof e==`function`||typeof e==`object`)?e[xk]:void 0}function Ck(e,t){Object.defineProperty(e,xk,{value:t,enumerable:!1})}var wk;(function(e){e.FIELD_SLOTS=`field_slots`,e.NOTHING=`nothing`,e.CONTENT=`content`})(wk||={});function Tk(e,t,n){let r=!1;for(let i of Q.Children.toArray(e)){if(!(0,Q.isValidElement)(i))return wk.CONTENT;let e=i.props,a;if(i.type===Q.Fragment)a=Tk(e.children,t,n);else if(typeof i.type==`string`)a=!i.type.includes(`-`)&&Tk(e.children,t,n)===wk.FIELD_SLOTS?wk.FIELD_SLOTS:wk.CONTENT;else{let r=i.type[xk],o=typeof e.name==`string`?e.name:void 0,s=o?t?`${t}.${o}`:o:t;r===bk.FIELD_SLOT?(n.push({path:s,hasOwnSchema:e.schema!==void 0}),a=wk.FIELD_SLOTS):a=r===bk.FIELD_SLOT_CONTAINER?Tk(e.children,s,n):wk.CONTENT}if(a===wk.CONTENT)return wk.CONTENT;a===wk.FIELD_SLOTS&&(r=!0)}return r?wk.FIELD_SLOTS:wk.NOTHING}function Ek(e){return Tk(e,``,[])===wk.FIELD_SLOTS}function Dk(e,t=``){let n=[];return Tk(e,t,n)===wk.FIELD_SLOTS?n:null}var Ok=(0,Q.createContext)(null);function kk(){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 Ak(e){return e.match(/^[^.[\]]+/)?.[0]??e}var jk=Symbol.for(`wildo.placesNamedField`);function Mk(e){Object.defineProperty(e,jk,{value:!0,enumerable:!1})}var Nk=1e4,Pk=5e4,Fk=200;function Ik(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<Nk;)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>Fk||++a>Pk)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(zk(t,`children`),a,0,o+1);return}let c=Lk(e);if(c===bk.FIELD_SLOT||Rk(e)){n.push(r(zk(t,`name`),a));return}let l=c===bk.FIELD_SLOT_CONTAINER?r(zk(t,`name`),a):a;for(let e of i)s(zk(t,e),l,e===`children`?0:1,o+1)};return s(e,t,0,0),n.filter(e=>e!==``)}function Lk(e){try{return Sk(e)}catch{return}}function Rk(e){try{return e!==null&&(typeof e==`function`||typeof e==`object`)&&e[jk]===!0}catch{return!1}}function zk(e,t){try{return e[t]}catch{return}}function Bk(e){let t=(0,Q.useContext)(Ok),n=e.map(Ak).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 Vk(e,t){let n=(0,Q.useContext)(Ok);Bk((0,Q.useMemo)(()=>n?Ik(e,t):[],[n,e,t]))}var Hk=(0,Q.createContext)(null);function Uk({value:e,children:t}){let n=(0,Q.useMemo)(()=>e,[e]);return(0,$.jsx)(Hk.Provider,{value:n,children:t})}function Wk(){return(0,Q.useContext)(Hk)}var Gk=(0,Q.createContext)(!1);function Kk(){return(0,Q.useContext)(Gk)}var qk=rs.getLogger();function Jk(e){let{name:t,className:n,saveable:r,chromeMode:i,children:a,defaultFocus:o=!0,hideTitle:s=!1,hideDescription:c=!1}=e,l=e.appearance??cr.DEFAULT,u=LT(),d=rk(),f=Wk(),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?ck.FORM:d?ck.DISPLAY:f?ck.COMPOSITE:ck.DISPLAY;if(S===ck.COMPOSITE&&i)throw V.buildConfigurationError(ql.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=pk(),w=yk(C),{pathPrefix:T}=TD();Vk(a,T);let E=w&&Ek(a);if(!dk(l))return(0,$.jsx)($.Fragment,{children:a});let D=(0,$.jsx)(Gk.Provider,{value:!!_,children:(0,$.jsxs)(fk.Provider,{value:C,children:[(0,$.jsx)(Xk,{hostKind:S,chromeMode:i,children:a}),x&&(0,$.jsx)(Zk,{sectionName:t,disabled:y})]})});return(0,$.jsx)(ET,{appearance:l,legend:_,description:v,disabled:y,defaultOpen:o,className:n,"data-guidance-section":t,"data-composite-section":S===ck.COMPOSITE?t:void 0,hidden:E||void 0,children:D})}Jk.displayName=`Section`;function Yk({hostKind:e,sectionProps:t,providesHeading:n=!1}){let{children:r,chromeMode:i,saveable:a,name:o,className:s,disabled:c}=t,l=pk(),u=r;return u=e===ck.FORM?(0,$.jsxs)(fk.Provider,{value:l,children:[(0,$.jsx)(Xk,{hostKind:e,chromeMode:i,children:r}),a&&(0,$.jsx)(Zk,{sectionName:o,disabled:c})]}):(0,$.jsx)(Xk,{hostKind:e,chromeMode:i,children:r}),(0,$.jsx)(Gk.Provider,{value:n,children:(0,$.jsx)(`div`,{className:s?`space-y-field ${s}`:`space-y-field`,"data-guidance-section":o,"data-composite-section":e===ck.COMPOSITE?o:void 0,children:u})})}function Xk({hostKind:e,chromeMode:t,children:n}){let{displayChromeMode:r}=ok(),{formChromeMode:i}=Qw();return t?e===ck.FORM?(0,$.jsx)(Zw,{formChromeMode:i,sectionChromeMode:t,children:n}):e===ck.DISPLAY?(0,$.jsx)(ak,{displayChromeMode:r,sectionChromeMode:uk(t),children:n}):n:n}function Zk({sectionName:e,disabled:t}){let n=UC(),r=LT(),i=_k(),[a,o]=(0,Q.useState)(!1),{tComponent:s,isReady:c}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),l=r?.onSectionSave;if(!l||!c)return null;let u=async()=>{if(i.length!==0&&await $O(n,i)){o(!0);try{let t=n.getValues();await l(e,i,t)}catch(t){qk.error(`[SectionSaveButton] The section save handler threw.`,{sectionName:e,error:t})}finally{o(!1)}}},d=s(B.LOW_LEVEL_FORM_MESSAGE,`sectionSaving`),f=s(B.LOW_LEVEL_FORM_MESSAGE,`sectionSave`);return(0,$.jsx)(`div`,{className:`flex justify-end pt-item`,children:(0,$.jsx)(X,{type:`button`,variant:J.SECONDARY,size:Y.SM,onClick:u,disabled:t||a||i.length===0,children:a?d:f})})}function Qk(e){return(0,Q.isValidElement)(e)&&e.type===Jk}rs.getLogger();function $k(e,t){return Hde(e,Qk,t)}function eA(e){return Wde(e)}function tA({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=aE()!==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=LT();Vk(t,``);let m=(0,Q.useMemo)(()=>rA(t,p),[t,p]);return(0,$.jsx)(DD.Provider,{value:f,children:(0,$.jsx)(bD,{voice:void 0,children:(0,$.jsx)(wD,{pathPrefix:``,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full`,e),style:{maxInlineSize:eD(i)},"data-inline-size-tier":i,"data-guidance-form":``,"data-slot":`form-layout`,children:(0,$.jsxs)(Uy,{children:[s.errorSummary?(0,$.jsx)(eO,{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)(nO,{className:`mt-6`}):null]})})})})})}function nA(e,t){if(!t)return!1;let n=Dk(e);return n!==null&&n.length>0&&n.every(e=>!e.hasOwnSchema&&hr.resolveFieldSchemaPath(t,e.path)===void 0)}function rA(e,t){let n=$k(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=>!nA(e.props.children,t?.schema));if(r.length===0)return null;let i={...e.group,sections:r},a=eA(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)(iA,{sectionProps:e.props,providesHeading:!!o[e.props.name]})}));return(0,$.jsx)(UO,{sections:c,config:a},`group-${i.mode}-${n}`)})})}function iA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Yk,{hostKind:ck.FORM,sectionProps:e,providesHeading:t})}function aA(e){let t=e.match(/^(.+)\[(\d+)]$/);return t?{key:t[1],index:parseInt(t[2],10)}:{key:e}}function oA(e,t){return Array.isArray(e)?[...e]:typeof e==`object`&&e?{...e}:t?.index==null?{}:[]}function sA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let{key:t,index:n}=aA(e),i=hr.getObjectLikeFieldShape(r,{commonOnly:!1})??null;if(!i||!(t in i))return;if(r=i[t],n!=null){let e=lr(r).element;if(!e)return;r=e}}return r}function cA(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}=aA(e);if(r=r[t],n!=null){if(!Array.isArray(r))return;r=r[n]}}return r}function lA(e,t){if(!t||!e)return e;let n=cA(e,t);if(typeof n==`object`&&n&&!Array.isArray(n))return n}function uA(e,t,n){let r=aA(t.split(`.`)[0]).key,i=dA(e??{},t,n);return{[r]:i[r]}}function dA(e,t,n){let r=t.split(`.`).map(aA),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=oA(r[e.index],o);r[e.index]=s,a=s;return}if(i){a[e.key]=n;return}let s=oA(a[e.key],o);a[e.key]=s,a=s}),i}function fA(e,t){if(e==null)return;if(typeof e!=`object`||Array.isArray(e)||!Object.keys(e).some(e=>e===xl.MOBILE||e===xl.VERT_TABLET||e===xl.DESKTOP))return e;let n=e;return n[t]??n[xl.DESKTOP]??n[xl.VERT_TABLET]??n[xl.MOBILE]}var pA=`data-collection-surface`;function mA({className:e,children:t,responsiveMaxWidth:n}){let r=rk(),i=(0,Q.useMemo)(()=>hA(t,r),[t,r]);return(0,$.jsx)(wD,{pathPrefix:``,children:(0,$.jsx)(bD,{voice:y.EYEBROW,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full space-y-section`,`[&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0`,n===void 0&&`[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]`,e),style:tD(n),"data-inline-size-tier":n??`derived`,"data-guidance-display":!0,children:i})})})}function hA(e,t){let n=$k(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=gA(eA(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)(_A,{sectionProps:e.props,providesHeading:!!a[e.props.name]})}));return(0,$.jsx)(UO,{sections:s,config:i},`group-${r.mode}-${n}`)})})}function gA(e,t,n){if(e.mode!==cr.STAGES||n===null)return e;let[r,...i]=t.sections,a=t.sections.map(e=>e.props.name),o=e=>`stageBinding`in e?e.stageBinding:void 0,s=i.find(e=>o(e.props)!==void 0);if(s!==void 0)throw new NO(`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?sA(n.schema,c.field):void 0;PO(c,a,l?Jo(l):void 0);let u=n.isLoading?null:FO(c,cA(n.data,c.field));return{...e,currentStage:u}}function _A({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Yk,{hostKind:ck.DISPLAY,sectionProps:e,providesHeading:t})}var vA=(0,Q.createContext)(!1);function yA(){return(0,Q.useContext)(vA)}var bA=new Set([_u.ARRAY,_u.SET,_u.TUPLE,_u.RECORD,_u.MAP,_u.OBJECT,_u.VERSIONED_OBJECT,_u.CODE,_u.FILE,_u.ADDRESS]),xA=new Set([td.MULTILINE,td.MARKDOWN,td.UNTRUSTED_HTML]);function SA(e,t,n){return n===tt.SUMMARY?!0:e?bA.has(e)?!0:e===_u.STRING&&!!t&&xA.has(t):!1}function CA({className:e,children:t}){let{displayChromeMode:n}=ok();return(0,$.jsx)(vA.Provider,{value:!0,children:(0,$.jsx)(ak,{displayChromeMode:n,sectionChromeMode:Pc.TILE,children:(0,$.jsx)(`dl`,{"data-slot":`field-tiles`,className:U(`m-0 grid gap-field-sm grid-cols-[repeat(auto-fill,minmax(min(100%,9rem),1fr))] [&>[data-tile-span=full]]:col-span-full empty:hidden`,e),children:t})})})}CA.displayName=`FieldTiles`;function wA({className:e,children:t}){let{displayChromeMode:n}=ok();return(0,$.jsx)(ak,{displayChromeMode:n,sectionChromeMode:Pc.HIDDEN,children:(0,$.jsx)(`div`,{"data-slot":`record-state`,className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item [&>*]:w-auto empty:hidden`,e),children:t})})}wA.displayName=`RecordState`;function TA({className:e,children:t}){let{displayChromeMode:n}=ok();return(0,$.jsx)(ak,{displayChromeMode:n,sectionChromeMode:Pc.INLINE,children:(0,$.jsx)(`div`,{"data-slot":`record-keeping-facts`,className:U(`flex min-w-0 flex-wrap items-baseline gap-x-group gap-y-item border-t border-border pt-element text-xs text-foreground-subtle [&_*]:text-xs [&_*]:text-foreground-subtle [&>*]:w-auto [&:not(:has(*))]:hidden`,e),children:t})})}TA.displayName=`RecordKeepingFacts`;var EA;(function(e){e.STATE=`state`,e.CONTENT=`content`,e.FACT=`fact`,e.RECORD_KEEPING=`record_keeping`,e.IDENTITY_PLUMBING=`identity_plumbing`})(EA||={});var DA=Ls.BADGE,OA=new Set([Pc.HIDDEN,Pc.COMPACT]);function kA(e){let t=vl(e)?.chromeMode;return me(e)!==_u.OBJECT&&typeof t==`string`&&OA.has(t)}var AA=new Set([...Cs.filter(e=>!nne.includes(e)),...uee]);function jA(e,t,n){if(V.isIdentityOnlySummaryField(e,n))return EA.IDENTITY_PLUMBING;let r=me(t),i=vl(t);return r===_u.ENUM&&i?.displayMode===DA?EA.STATE:AA.has(e)?EA.RECORD_KEEPING:kA(t)?EA.CONTENT:EA.FACT}function MA(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 NA;(function(e){e.DISPLAY=`display`,e.SUMMARY=`summary`})(NA||={});var PA=(0,Q.createContext)(NA.DISPLAY);function FA({kind:e,children:t}){return(0,$.jsx)(PA.Provider,{value:e,children:t})}function IA(){return(0,Q.useContext)(PA)}function LA(e){return RA(e,(0,Q.useContext)(PA))}function RA(e,t){if(t!==NA.SUMMARY)return e?.display;if(e?.display||e?.summaryOverride)return{...e?.display,...e?.summaryOverride}}function zA(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 BA({children:e}){let{displayChromeMode:t}=ok();return(0,$.jsx)(vA.Provider,{value:!1,children:(0,$.jsx)(ak,{displayChromeMode:t,sectionChromeMode:void 0,children:e})})}function VA({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)(BA,{children:i})})]}):(0,$.jsx)($.Fragment,{children:i})}function HA(e,t){if(e!=null)return typeof e==`string`?e:e[t]??e[xl.DESKTOP]}var UA=(0,Q.createContext)(!1);function WA(){return(0,Q.useContext)(UA)}var GA=new Set([_u.BOOLEAN,_u.NUMBER,_u.BIGINT,_u.BIGDECIMAL,_u.RANGE_NUMBER,_u.RANGE_BIGDECIMAL]),KA=new Set([_u.DATE,_u.DATETIME,_u.TIME,_u.RANGE_DATE,_u.RANGE_DATETIME,_u.RANGE_TIME]),qA=new Set([Pc.COMPACT,Pc.HIDDEN]);function JA(e){return e!==void 0&&GA.has(e)}function YA(e){return!zA(e)}function XA(e){let t=0;return e.map(({schemaType:e,present:n})=>!n||e===void 0||!KA.has(e)?!1:(t+=1,t>1))}function ZA(e){let t=XA(e);return e.map(({schemaType:e,present:n},r)=>n&&(JA(e)||t[r]))}function QA(e,t){let n=ZA(t);return t.map(({present:t,declaredChrome:r},i)=>{if(!t)return!1;let a=r??e;return a===void 0?n[i]:!qA.has(a)})}var $A=Xs(B.LOW_LEVEL_TOOLTIP,`Tooltip`,[`Trigger`,`Content`,`Provider`]);function ej({preset:e=q.DEFAULT,...t}){let n=$A(e);return(0,$.jsx)(n,{...t})}function tj({preset:e=q.DEFAULT,...t}){let n=$A(e);return(0,$.jsx)(n.Trigger,{...t})}function nj({preset:e=q.DEFAULT,...t}){let n=$A(e);return(0,$.jsx)(n.Content,{...t})}function rj({preset:e=q.DEFAULT,...t}){let n=$A(e);return(0,$.jsx)(n.Provider,{...t})}function ij({provenance:e,className:t}){let n=Ere(e.system),r=(0,Q.useMemo)(()=>[n],[n]),{tComponent:i,t:a,formatDateTimeForDisplayMode:o,isReady:s}=K({component:B.LOW_LEVEL_FORM_FIELD,keys:r});if(!s)return null;let c=a(n),l=o(e.currentAsOf,bne.AUTO);return(0,$.jsx)(dx,{className:t,"data-field-provenance":``,children:i(B.LOW_LEVEL_FORM_FIELD,`syncedFromAsOf`,{system:c,asOf:l})})}ij.displayName=`DisplayFieldProvenanceNote`;function aj(e,t){return HA(e,t)??Pc.STACKED}function oj({text:e}){let{renderIcon:t}=Of(),{tComponent:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(ej,{children:[(0,$.jsx)(tj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(B.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:ca.XS})})}),(0,$.jsx)(nj,{children:e})]}):null}function sj({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}=Rg(),_=yA(),v=g(oc.TYPOGRAPHY,y.DESCRIPTION),b=g(oc.TYPOGRAPHY,y.EYEBROW),x=(0,Q.useMemo)(()=>aj(e,m),[e,m]),S=o??(x===Pc.INLINE?`start`:`top`),C=!s&&!!t&&S!==`hidden`&&x!==Pc.COMPACT&&x!==Pc.HIDDEN,w=!c&&!!r&&x!==Pc.COMPACT&&x!==Pc.HIDDEN,T=!!l,E=T?(0,$.jsx)(ij,{provenance:l}):null,D=!C&&!s&&t&&(S===`hidden`||d)?(0,$.jsx)(`span`,{className:`sr-only`,children:d?`${t}: `:t}):null;if(x===Pc.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[D,p]});if(x===Pc.TILE){let e=_?`dt`:`div`,n=_?`dd`:`div`,o=C?t:t?(0,$.jsx)(`span`,{className:`sr-only`,children:t}):null,s=[i,w?r:void 0].filter(e=>!!e).join(` — `)||void 0;return(0,$.jsx)(_D,{asChild:!0,variant:nt.TILE,children:(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`tile`,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,"data-tile-span":u?`full`:void 0,className:U(`flex min-w-0 flex-col gap-item`,f),children:[o&&(0,$.jsxs)(e,{className:U(`flex min-w-0 items-center`,C&&b.base),children:[o,C&&s&&(0,$.jsx)(oj,{text:s})]}),(0,$.jsxs)(n,{className:`m-0 min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,$.jsx)(BA,{children:p}),E]})]})})}if(x===Pc.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,p]});if(x===Pc.INLINE)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex flex-wrap items-baseline gap-x-1.5 gap-y-element-xs`,f),children:[D,C&&(0,$.jsxs)(`span`,{className:U(`shrink-0`,v.base),children:[t,`:`,i&&(0,$.jsx)(oj,{text:i})]}),(0,$.jsx)(`div`,{className:`min-w-0`,children:p}),w&&(0,$.jsx)(dx,{className:`w-full`,children:r}),T&&(0,$.jsx)(ij,{provenance:l,className:`w-full`})]});if(x===Pc.SETTINGS_ROW)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":h?`stacked`:void 0,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,h?`flex-col gap-element-xs`:U(`flex-row gap-section`,w?`items-start`:`items-center`),f),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!h&&`flex-1`),children:[D,C&&(0,$.jsxs)(cx,{children:[t,i&&(0,$.jsx)(oj,{text:i})]}),w&&(0,$.jsx)(dx,{children:r})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs font-medium`,`[&>[data-list-shape=primitive]]:flex-row [&>[data-list-shape=primitive]]:flex-wrap [&>[data-list-shape=primitive]]:gap-x-element`,h?`w-full items-start text-start`:`w-72 max-w-[55%] shrink items-end text-end [&>[data-list-shape=primitive]]:justify-end`),children:[p,E]})]});if(S===`start`||S===`inline`){let e=S===`inline`;return(0,$.jsxs)(sx,{orientation:ox.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(e&&`flex-row-reverse`,f),children:[D,(0,$.jsxs)(ux,{children:[C&&(0,$.jsx)(lx,{children:(0,$.jsxs)(cx,{className:v.base,children:[t,i&&(0,$.jsx)(oj,{text:i})]})}),w&&(0,$.jsx)(dx,{children:r}),E]}),p]})}return(0,$.jsxs)(sx,{orientation:ox.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":S,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[D,C&&(n===os.TITLE?(0,$.jsxs)(`div`,{className:U(`pt-item-xs`,b.base),children:[t,i&&(0,$.jsx)(oj,{text:i})]}):(0,$.jsxs)(cx,{className:v.base,children:[t,i&&(0,$.jsx)(oj,{text:i})]})),p,w&&(0,$.jsx)(dx,{children:r}),E]})}sj.displayName=`DisplayFieldChrome`;function cj(e){let t=e.parentReferenceConfig,n=[...e.referencedIds];if(!t||t.displayMode!==na.NONE||!e.referencedResourceType||e.referencedResourceType!==t.parentResourceType)return{hidesWholeReference:!1,visibleIds:n};if(t.parentResourceId===void 0)return{hidesWholeReference:!0,visibleIds:[]};let r=n.filter(e=>String(e)!==t.parentResourceId);return{hidesWholeReference:n.length>0&&r.length===0,visibleIds:r}}var lj=(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 uj(){return(0,Q.useContext)(lj)}var dj=class extends Error{name=`InlineEditMutationError`;mutationError;constructor(e,t){super(e),this.mutationError=t}};function fj(e,t){return e!==wi.REFERENCE&&e!==wi.ASSOCIATION?!1:t??!0}function pj(e,t){let n=t.resourceConfigurations?.[e];return n?[...n.resourceRelationships.parentRelationships,...n.resourceRelationships.childRelationships,...n.resourceRelationships.selfRelationships]:[]}function mj(e){let t=e.registry.resourceConfigurations?.[e.relatedResourceType];if(!t)return;let n=(t.operations??[]).filter(e=>!e.isBulkOperation&&(e.operationIdentifier===W.CREATE||e.resourceOperationLike===W.CREATE));return n.find(e=>e.variantKey===`quick-add`)??$l(n,W.CREATE)??n[0]}function hj(e,t){let n=fj(e.semantics.nature,e.relationship.display?.interaction?.allowQuickCreate);return{sourceKind:`relationshipObject`,relatedResourceType:e.relatedResourceType,relationshipNature:e.semantics.nature,allowQuickCreate:n,relatedCreateOperation:mj({relatedResourceType:e.relatedResourceType,registry:t})}}function gj(e){let t=e.fieldName.split(`.`)[0],n=pj(e.resourceType,e.registry).flatMap(n=>{if(n.resourceType1!==e.resourceType&&n.resourceType2!==e.resourceType)return[];let r=Bl.ensureCompiledRelationship.call(Bl,n,e.registry.allResourceFieldIdentifiers);if(Bl.tryResolveRelationshipForeignKeyIdentity(r,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==t)return[];let i=Bl.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:fj(i.nature,r.display?.interaction?.allowQuickCreate),relatedCreateOperation:mj({relatedResourceType:a,registry:e.registry})}]});if(n.length<=1)return n[0];if(ya.isDevelopment())throw V.buildConfigurationError(ql.CONFIGURATION,{resourceType:e.resourceType,fieldName:e.fieldName,reason:`Ambiguous FK relationship quick-create mapping.`,matchCount:n.length})}function _j(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,quickCreate:hj(t,e.registry)}}function vj(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,objectIdentity:Bl.resolveRelationshipObjectIdentityForResource(t.relationship,e.resourceType,e.registry.allResourceFieldIdentifiers)}}function yj(e){let t=_j(e);if(t)return e.relatedResourceType&&t.relatedResourceType!==e.relatedResourceType?void 0:{sourceFieldName:e.fieldName,quickCreate:t.quickCreate};let n=gj({resourceType:e.resourceType,fieldName:e.fieldName,relatedResourceType:e.relatedResourceType,registry:e.registry});if(n)return{sourceFieldName:e.fieldName,quickCreate:n}}function bj(e){let t=e.resolvedSemantics?.handling?.dtoModelMode;return t?t===Wie.NESTED_RESOURCE:Bl.resolveRelationshipNature(e).nature===wi.COMPOSITION}function xj(e){if(!Bl.isRelationshipActiveForParent(e.relationship,e.parentData,{onMissingParentResource:`exclude`,onConditionError:`exclude`})||!bj(e.relationship))return;let t=e.relationship.resourceType1===e.parentResourceType?e.relationship.resourceType2:e.relationship.resourceType1,n=Bl.tryResolveRelationshipForeignKeyIdentity(e.relationship,e.registry.allResourceFieldIdentifiers);if(!n?.fieldIdentifier)return;let r=e.relationship.display?.inParentNavigation,i=Ct(e.relationship.cardinality2),a=e.viewport??xl.DESKTOP,o=Sj(i),s=$h(r?.transition,a),c=e.registry.resourceConfigurations[t]?.resourceRelationships,l=c?[...c.parentRelationships,...c.selfRelationships].find(t=>t.resourceType1===e.parentResourceType&&Bl.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 Sj(e){return e?{mode:cr.INLINE}:{mode:cr.TABS}}function Cj(e){if(!e.navigationZone||!zm.shouldShowParentReference(e.inlineParentContext,e.navigationZone,e.navigationInitiator,e.getZoneState))return;let t=e.navigationInitiator?.sourceRelationship;if(!t?.parentResourceType)return;let n=t.inChildView;return{parentReference:{parentResourceType:t.parentResourceType,parentResourceId:t.parentResourceId,parentDisplay:n?.parentDisplay??na.CONTEXT,showParentLink:n?.showParentLink??!0}}}function wj(e){let t=e.schema?Da(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=vj({resourceType:e.resourceType,fieldName:i,registry:e.registry});if(!a)continue;if(r.add(a.rootFieldName),xj({parentResourceType:e.resourceType,relationship:a.relationship,parentData:e.parentData,registry:e.registry})){n.add(a.rootFieldName);continue}if(a.semantics.nature===wi.COMPOSITION)continue;let o=a.foreignKeyIdentity?.fieldIdentifier;o&&o!==a.rootFieldName&&Object.prototype.hasOwnProperty.call(t,o)&&n.add(a.rootFieldName)}return{hiddenFieldNames:[...n],inlineEditDisabledFieldNames:[...r]}}function Tj(e){let t={};return e.resourceType&&e.fieldName&&(t.writeSurface=_j({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry}),t.readSurface=vj({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry}),t.inlineEditSurface=yj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:e.registry})),t.navigationSurface=Cj({inlineParentContext:e.inlineParentContext,navigationZone:e.navigationZone,navigationInitiator:e.navigationInitiator,getZoneState:e.getZoneState}),t}function Ej(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 Dj(e){if(e)return e.includes(`.`)?e.split(`.`).pop():e}function Oj(e){let t=nu(e.schema);if(!t||!e.parentData||!e.currentResourceType||!e.registry)return;let n=Dj(e.fieldName);if(!n)return;let r=Bl.getForeignKeyCandidateReferencedTypes(n,e.currentResourceType,e.registry.resourceRelationships);if(r.length!==0)return Bl.resolveDiscriminatedPolymorphicForeignKeyTarget({record:e.parentData,discriminatorField:t.discriminatorField,variants:t.variants,candidateReferencedTypes:r,getResourcePrimaryScope:t=>e.registry?.resourceConfigurations[t]?.resourcePrimaryScope})}function kj(e){return e.explicitResourceType||(e.schema?wu(e.schema)?.referencedResourceType:void 0)||(e.fieldName?e.registry?.fieldIdentifierToResourceType?.[e.fieldName]:void 0)||void 0}function Aj(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 jj(e){let t=e.resourceLinkTrail?.resourceType??e.currentResourceType,n=Ej(e.fieldName,e.resourceLinkTrail);if(t&&n&&e.registry)return vj({resourceType:t,fieldName:n,registry:e.registry})}function Mj(e){return Iw(e)}function Nj(e){if(e.schema&&Po(e.schema))return{referencedResourceType:kj({explicitResourceType:Oj({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:Mj(e.value)};let t=jj(e);if(t&&t.semantics.nature!==wi.COMPOSITION&&t.objectIdentity)return{referencedResourceType:t.relatedResourceType,referencedIds:Mj(Aj(e.value,t.objectIdentity.relationshipIdentifierField))}}function Pj({noValueLabel:e,typography:t,className:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{typography:t,className:U(`text-muted-foreground italic`,n),"aria-hidden":`true`,children:`—`}),(0,$.jsx)(`span`,{className:`sr-only`,children:e})]})}var Fj=new Set([_u.NUMBER,_u.BIGDECIMAL,_u.MONEY,_u.DURATION,_u.DATE,_u.TIME,_u.DATETIME,_u.RANGE_NUMBER,_u.RANGE_BIGDECIMAL,_u.RANGE_MONEY,_u.RANGE_DATE,_u.RANGE_TIME,_u.RANGE_DATETIME]);function Ij(e){return e&&Fj.has(e)?y.DATA:void 0}function Lj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_BOOLEAN,`DisplayFieldBoolean`)(e);return(0,$.jsx)(n,{...t})}function Rj({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldDisplay_ResourceReference`,Ii.DISPLAY)(e);return(0,$.jsx)(n,{...t})}function zj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_STRING,`DisplayFieldString`)(e);return(0,$.jsx)(n,{...t})}function Bj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_NUMBER,`DisplayFieldNumber`)(e);return(0,$.jsx)(n,{...t})}function Vj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_ENUM,`DisplayFieldEnum`)(e);return(0,$.jsx)(n,{...t})}function Hj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_MONEY,`DisplayFieldMoney`)(e);return(0,$.jsx)(n,{...t})}function Uj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DURATION,`DisplayFieldDuration`)(e);return(0,$.jsx)(n,{...t})}function Wj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_PHONE,`DisplayFieldPhone`)(e);return(0,$.jsx)(n,{...t})}function Gj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_ADDRESS,`DisplayFieldAddress`)(e);return(0,$.jsx)(n,{...t})}function Kj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL,`DisplayFieldBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function qj({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_CODE,`DisplayFieldCode`)(e);return(0,$.jsx)(n,{...t})}function Jj(e){if(e===void 0)return``;let t=e;if(typeof e==`string`){let n=e.trim();if(n.startsWith(`{`)||n.startsWith(`[`))try{t=JSON.parse(n)}catch{}}try{return JSON.stringify(t,(e,t)=>typeof t==`bigint`?t.toString():t,2)??String(t)}catch{return String(t)}}function Yj({value:e,maxHeight:t,...n}){let r=(0,Q.useMemo)(()=>{let t=Jj(e);return t?{content:t,language:`json`}:null},[e]);return(0,$.jsx)(qj,{...n,value:r,maxHeight:t,wordWrap:!0})}var Xj=ll.APPROVAL_SEALS,Zj;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(Zj||={});var Qj;(function(e){e.IDLE=`idle`,e.CHECKING=`checking`,e.DONE=`done`,e.FAILED=`failed`})(Qj||={});function $j({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_APPROVAL_SEAL,`ApprovalSeal`)(e);return(0,$.jsx)(n,{...t})}function lfe(e){return typeof e==`string`&&e.length>0?e:void 0}var ufe=3e3,dfe=20;function ffe(e){return jr(e)&&e.errorType===za.NOT_FOUND}function eM(e){let[t,n]=(0,Q.useState)({state:Zj.LOADING}),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)({state:Qj.IDLE}),[s,c]=(0,Q.useState)(!1),l=e?.key;(0,Q.useEffect)(()=>{if(!e)return;let t=!0,r=0,a;n({state:Zj.LOADING}),i(!1),o({state:Qj.IDLE});let s=()=>{Promise.resolve().then(e.load).then(i=>{t&&(n({state:Zj.READY,view:i}),e.pollWhilePending&&i.state===Ro.PENDING&&r<dfe&&(r+=1,a=setTimeout(s,ufe)))}).catch(r=>{t&&(e.notFoundIsNone&&ffe(r)?i(!0):n({state:Zj.FAILED}))})};return s(),()=>{t=!1,a&&clearTimeout(a)}},[l]);let u=t.view?.jws;return{read:t,none:r,check:a,onCheck:(0,Q.useCallback)(()=>{u&&(o({state:Qj.CHECKING}),vc().checkApprovalSeal(u).then(e=>o({state:Qj.DONE,outcome:gre(e)})).catch(()=>o({state:Qj.FAILED})))},[u]),onDownloadManifestedCopy:(0,Q.useCallback)(()=>{e?.download&&(c(!0),e.download().then(t=>Ly(t,e.downloadName)).catch(()=>void 0).finally(()=>c(!1)))},[l]),downloading:s}}function tM({state:e,offersCopy:t=!0,movedFieldLabels:n,description:r,className:i}){let{tResourceFieldEnumValue:a}=K(),{read:o,check:s,onCheck:c,onDownloadManifestedCopy:l,downloading:u}=e,d=o.view,f=qee.shape;return(0,$.jsx)($j,{readState:o.state,...d?{view:d}:{},...n?{movedFieldLabels:n}:{},...r?{description:r}:{},...d?.meaning?{meaningLabel:a(Xj,`meaning`,d.meaning,f.meaning)}:{},...d?.outcome?{outcomeLabel:a(Xj,`outcome`,d.outcome,f.outcome)}:{},checkState:s.state,...s.outcome?{checkOutcome:s.outcome}:{},...d?.jws?{onCheck:c}:{},...t&&d?.deliverable?.manifestedCopyAvailable?{onDownloadManifestedCopy:l,downloadingManifestedCopy:u}:{},...i?{className:i}:{}})}function pfe({field:e,hideWhenNone:t,className:n}){let{resourceType:r,resourceId:i}=uj(),a=rk(),o=a?.data,s=lfe(o?.[e]),c=mfe(o),l=s&&r&&i?{sealId:s,resourceType:String(r),resourceId:String(i),field:e}:void 0,u=eM(l?{key:`${l.sealId}|${l.resourceType}|${l.resourceId}|${e}|${c}`,load:()=>vc().readApprovalSealOnRecord(l),download:()=>vc().downloadApprovalSealManifestedCopy(l),downloadName:`approval-${l.sealId}.pdf`}:void 0);if(!o)return null;if(!l)return t||!r?null:(0,$.jsx)($j,{readState:Zj.READY,view:{sealId:``,state:Ro.NO_SEAL},...n?{className:n}:{}});let d=u.read.view?.currency?.movedFields.map(e=>a?.fieldLabels?.[e]??e);return(0,$.jsx)(tM,{state:u,...d?{movedFieldLabels:d}:{},...n?{className:n}:{}})}function mfe(e){let t=e?.updatedAt,n=t instanceof Date?t.toISOString():typeof t==`string`?t:``,[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{a.current!==e&&(a.current=e,n||i(e=>e+1))},[e,n]),n||String(r)}function nM({fileId:e,className:t}){let n=eM({key:e,load:()=>vc().readApprovalSealOnFile(e),download:()=>vc().downloadApprovalSealFileManifestedCopy(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0});return n.none||n.read.state===Zj.LOADING?null:(0,$.jsx)(tM,{state:n,...t?{className:t}:{}})}function rM({decisionRef:e,description:t,className:n}){let r=eM({key:e,load:()=>vc().readApprovalSealOfDecision(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0,pollWhilePending:!0});return r.none?null:(0,$.jsx)(tM,{state:r,offersCopy:!1,...t?{description:t}:{},...n?{className:n}:{}})}function iM({preset:e=q.DEFAULT,...t}){let{httpClient:n}=Tu(),r=(0,Q.useMemo)(()=>({get:async e=>n.get(e),getBlob:(e,t)=>n.fetchFileBlob(e,t)}),[n]),i=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE,`DisplayFieldFile`)(e),a=IA(),o=rk(),s=a===NA.DISPLAY&&o!==null,c=t.value&&`fileId`in t.value?t.value.fileId:void 0,l=typeof c==`string`&&c.length>0?c:void 0;return!s||!l?(0,$.jsx)(i,{...t,httpOperations:r}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{...t,httpOperations:r}),(0,$.jsx)(nM,{fileId:l})]})}function aM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL,`DisplayFieldRangeBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function oM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY,`DisplayFieldRangeMoney`)(e);return(0,$.jsx)(n,{...t})}function sM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DATE,`DisplayFieldDate`)(e);return(0,$.jsx)(n,{...t})}function cM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_DATETIME,`DisplayFieldDateTime`)(e);return(0,$.jsx)(n,{...t})}function lM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_TIME,`DisplayFieldTime`)(e);return(0,$.jsx)(n,{...t})}function uM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER,`DisplayFieldRangeNumber`)(e);return(0,$.jsx)(n,{...t})}function dM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATE,`DisplayFieldRangeDate`)(e);return(0,$.jsx)(n,{...t})}function fM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATETIME,`DisplayFieldRangeDateTime`)(e);return(0,$.jsx)(n,{...t})}function pM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_RANGE_TIME,`DisplayFieldRangeTime`)(e);return(0,$.jsx)(n,{...t})}var mM=rs.getLogger(),hfe=mM.debugByType(`DisplayValueDispatcher`);mM.setDebugTypeLogging(`DisplayValueDispatcher`,!1);function gfe(e){return e?[...e.parentRelationships??[],...e.childRelationships??[],...e.selfRelationships??[]]:[]}function hM(e){if(!e.registry)return typeof e.record._id==`string`?e.record._id:typeof e.record.id==`string`?e.record.id:void 0;let t=e.resourceType?e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]:void 0,n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}function gM(e,t,n,r){if(!e||!t||!r)return null;let i=Dj(e);if(!i)return null;if(n){let e=r.resourceConfigurations[n]?.resourceRelationships;for(let a of gfe(e))try{let e=Bl.resolveRelationshipObjectIdentityForResource(a,n,r.allResourceFieldIdentifiers);if(e.relationshipIdentifierField!==i)continue;let o=t[e.objectFieldName],s=a.resourceType1===n?a.resourceType2:a.resourceType1;if(o&&typeof o==`object`&&!Array.isArray(o)&&hM({record:o,resourceType:s,registry:r}))return o}catch{}}let a=ere.extractBaseName(i);if(!a||a===i)return null;let o=t[a];return o&&typeof o==`object`&&!Array.isArray(o)&&hM({record:o,resourceType:r.fieldIdentifierToResourceType?.[i],registry:r})?o:null}function _M(e){let t=e.value,n=t?.fileIds?.length??+!!t?.fileId;return n>0?(0,$.jsx)(Z,{className:e.className,children:e.tComponent(B.LOW_LEVEL_FORM_FIELD,`fileCount`,{count:n})}):(0,$.jsx)(Z,{className:U(`text-muted-foreground italic`,e.className),children:e.tComponent(B.LOW_LEVEL_FORM_FIELD,`noFile`)})}function vM(e){return typeof e?.getMetadata==`string`&&e.getMetadata.trim()!==``}var _fe=5;function yM(e,t,n){switch(e){case`hidden`:return null;case`placeholder`:return(0,$.jsx)(Z,{className:`text-muted-foreground italic`,children:t});case`skeleton`:return(0,$.jsx)(um,{className:`h-5 w-full`});default:return(0,$.jsx)(Pj,{noValueLabel:t,typography:Ij(n)})}}function bM({schema:e,schemaType:t,value:n,fieldName:r,label:i,className:a,enumLabels:o,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:f,fileUploadContext:p,showAllArrayItems:m,onExpandArrayItems:h,showAllObjectFields:g,onExpandObjectFields:_}){let{tComponent:v,t:x,isReady:S}=K({component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_BUTTON]}),C=Q.useContext(im)?.registry,{resourceType:w}=uj(),{getRecipe:T}=Rg(),{renderIcon:E}=Of(),D=T(oc.INDICATOR,bl.ERROR),O=T(oc.TYPOGRAPHY,y.LABEL),k=T(oc.TYPOGRAPHY,y.BODY),A=T(oc.DIVIDER),j={schema:e,label:i,className:a,forceDisplayLabel:!1,forceDisplayDescription:!1,forceHideLabel:!0,forceHideDescription:!0},M=IA(),N=u?.resourceType,P=u?.pathPrefix,I=Q.useMemo(()=>jj({fieldName:r,resourceLinkTrail:u,currentResourceType:w,registry:C}),[r,N,P,w,C]),ee=I?.objectIdentity,L=Q.useMemo(()=>{if(ee)return Aj(n,ee.relationshipIdentifierField)},[ee,n]);if(!S)return null;if((u?.linkDepth??0)>=_fe)return(0,$.jsx)(Z,{className:`text-muted-foreground italic text-sm`,children:v(B.LOW_LEVEL_FORM_FIELD,`resourceLinkLimitReached`)});let R=t=>v(B.LOW_LEVEL_FORM_FIELD,Xn[b(e,t)]),z=t===_u.UNKNOWN?Ine(n)??_u.UNKNOWN:t;if(n==null||z===_u.STRING&&n===``)return yM(f,R(!1),z);if(c){let t={schema:e,className:a};switch(c){case`string`:return(0,$.jsx)(zj,{...t,value:n});case`number`:return(0,$.jsx)(Bj,{...t,value:n});case`boolean`:return(0,$.jsx)(Lj,{...t,value:n});case`enum`:return(0,$.jsx)(Vj,{...t,value:n,labels:o});case`code`:return(0,$.jsx)(qj,{...t,value:n});case`money`:return(0,$.jsx)(Hj,{...t,value:n});case`duration`:return(0,$.jsx)(Uj,{...t,value:n});case`phone`:return(0,$.jsx)(Wj,{...t,value:n});case`address`:return(0,$.jsx)(Gj,{...t,value:n});case`bigdecimal`:return(0,$.jsx)(Kj,{...t,value:n});case`file`:{let e=r?hr.normalizeSchemaFieldPath(r):void 0,i=e&&p?.[e];return vM(i)?(0,$.jsx)(iM,{...t,fieldName:r,value:n,endpoints:{getMetadata:i.getMetadata,serve:i.serve}}):_M({value:n,className:t.className,tComponent:v})}case`date`:return(0,$.jsx)(sM,{...t,value:n});case`time`:return(0,$.jsx)(lM,{...t,value:n});case`datetime`:return(0,$.jsx)(cM,{...t,value:n});case`range-number`:return(0,$.jsx)(uM,{...t,value:n});case`range-date`:return(0,$.jsx)(dM,{...t,value:n});case`range-time`:return(0,$.jsx)(pM,{...t,value:n});case`range-datetime`:return(0,$.jsx)(fM,{...t,value:n});case`range-bigdecimal`:return(0,$.jsx)(aM,{...t,value:n});case`range-money`:return(0,$.jsx)(oM,{...t,value:n});case`simple-text`:break;default:hfe(`Unrecognized displayComponent — falling back to schema-type dispatch`,{displayComponent:c,fieldName:r})}}if(z===_u.VERSIONED_FOREIGN_KEY){let t=gM(r,l,w,C);return(0,$.jsx)(Rj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:kr(e,l),displayParams:jo(e),schema:e,className:a})}if(Po(e)){let t=gM(r,l,w,C),i=Oj({schema:e,fieldName:r,parentData:l,currentResourceType:w,registry:C});return(0,$.jsx)(Rj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:kr(e,l),resourceType:i,displayParams:jo(e),schema:e,className:a})}if(sd(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)(Rj,{fieldName:r||``,value:i,resourceType:t,schema:e,className:a})}if(I&&I.semantics.nature!==wi.COMPOSITION&&ee)return(0,$.jsx)(Rj,{fieldName:r||``,value:L??null,data:!Array.isArray(n)&&n&&typeof n==`object`?n:void 0,resourceType:I.relatedResourceType,className:a});let te=I&&r?{resourceType:I.relatedResourceType,pathPrefix:r,linkDepth:(u?.linkDepth??0)+1}:u;if(z===_u.ARRAY&&Array.isArray(n)){if(n.length===0)return yM(f,R(!0));let t=lr(e).element,c=t?me(t):_u.UNKNOWN,l=ga(e),u=RA(l,M),p=u?.displayMode||`vertical`,g=n,_=u?.maxItems||void 0,y=_&&!m?g.slice(0,_):g,b=_?g.length-_:0;if(u?.listStyle===s.CHIPS&&c===_u.STRING&&!d)return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`list`),"data-list-style":`chips`,className:U(`flex flex-row flex-wrap gap-item`,a),children:[y.map((e,t)=>(0,$.jsx)(Mf,{role:`listitem`,variant:`secondary`,children:String(e)},t)),b>0&&!m&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b}),onClick:h,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b})})]});let x=l?.objectItemLayout??Qo.CARD,S=c===_u.OBJECT&&t?F(t):null,C=x===Qo.ROW&&!!S,w=c!==_u.OBJECT&&!d&&p!==`horizontal`&&(u?.listStyle===void 0||u.listStyle===s.PLAIN);return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`list`),"data-list-shape":w?`primitive`:void 0,className:U(C?`flex w-full min-w-0 flex-col gap-element`:p===`horizontal`||u?.listStyle===s.CHIPS?`flex flex-row gap-element flex-wrap`:u?.listStyle===s.SEPARATED?`flex flex-col divide-y divide-border`:c===_u.OBJECT?`flex flex-col gap-field`:`flex flex-col gap-item-xs`,a),children:[d?y.map((n,i)=>{let a=d(r?`${r}[${i}]`:`[${i}]`,t??e);return(0,$.jsx)(`div`,{role:`listitem`,className:U(c===_u.OBJECT&&`py-item-xs`,u?.listStyle===s.SEPARATED&&`py-card-sm first:pt-0 last:pb-0`),children:a??(0,$.jsx)(xR,{schema:t??e,schemaType:c,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:te})},i)}):C&&S?y.map((e,n)=>{let i=e&&typeof e==`object`?e:{},a=Jr(t),o=hr.getArrayItemPrimaryField(t).name,s=[...a.filter(e=>me(S[e])===_u.BOOLEAN),...a.filter(e=>me(S[e])!==_u.BOOLEAN)];return(0,$.jsx)(`div`,{role:`listitem`,className:`flex w-full min-w-0 items-center gap-element`,children:(0,$.jsx)(ak,{displayChromeMode:Pc.COMPACT,sectionChromeMode:void 0,children:s.map(e=>(0,$.jsx)(xR,{schema:S[e],schemaType:me(S[e]),value:i[e],hideLabel:e===o,labelPlacement:e===o?void 0:`hidden`,name:r?`${r}[${n}].${e}`:void 0,className:U(`w-auto`,e===o?`min-w-0 flex-1 [overflow-wrap:anywhere]`:me(S[e])===_u.STRING?`min-w-0 [overflow-wrap:anywhere]`:`shrink-0`),resourceLinkTrail:te},e))})},n)}):y.map((n,i)=>(0,$.jsx)(`div`,{role:`listitem`,className:U(u?.listStyle===s.BULLETS&&c!==_u.OBJECT&&p!==`horizontal`&&`ms-4 list-item list-disc marker:text-muted-foreground/60`,c===_u.OBJECT&&!C&&p!==`horizontal`&&`py-item-xs`),children:(0,$.jsx)(xR,{schema:t??e,schemaType:c,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:te})},i)),b>0&&!m&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b}),onClick:h,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:b})})]})}if((z===_u.OBJECT||z===_u.VERSIONED_OBJECT)&&typeof n==`object`){let t=ore(e,n),o=t??e,s=F(o),c=Jr(o),l=(t?gc(t):void 0)??gc(e),u=l?.display?.displayMode||`vertical`,d=l?.display?.maxItems||void 0;if(!s||c.length===0)return yM(f,R(!0));let p=l?.display?.primaryField,m=p&&c.includes(p)?[p,...c.filter(e=>e!==p)]:c,h=d&&!g?m.slice(0,d):m,y=d?c.length-d:0,b=p&&c.includes(p)?h.filter(e=>e!==p&&vl(s[e])?.chromeMode===Pc.COMPACT):[];return(0,$.jsxs)(`div`,{role:`group`,"aria-label":i||r||v(B.LOW_LEVEL_FORM_FIELD,`object`),className:U(`ps-card relative`,u===`horizontal`?`flex flex-row gap-field flex-wrap`:`flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),(0,$.jsx)(sk,{children:h.map(e=>{let t=s[e],i=me(t),a=n[e],o=r?`${r}.${e}`:e,c=e===p;return b.includes(e)?null:c?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1 font-medium`,children:(0,$.jsx)(xR,{schema:t,schemaType:i,value:a,name:o,hideLabel:!0,parentData:n,resourceLinkTrail:te})}),b.map(e=>(0,$.jsx)(xR,{schema:s[e],schemaType:me(s[e]),value:n[e],name:r?`${r}.${e}`:e,parentData:n,resourceLinkTrail:te},e))]},e):(0,$.jsx)(xR,{schema:t,schemaType:i,value:a,name:o,className:u===`horizontal`?`w-auto`:void 0,parentData:n,resourceLinkTrail:te},e)})}),y>0&&!g&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`self-start`,"aria-label":v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:_,children:v(B.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if(z===_u.BOOLEAN)return(0,$.jsx)(Lj,{...j,value:n});if(z===_u.ENUM)return(0,$.jsx)(Vj,{...j,value:n,labels:o});if(z===_u.STRING)return(0,$.jsx)(zj,{...j,value:n});if(z===_u.NUMBER||z===_u.BIGINT)return(0,$.jsx)(Bj,{...j,value:n});if(z===_u.MONEY)return(0,$.jsx)(Hj,{...j,value:n});if(z===_u.DURATION)return(0,$.jsx)(Uj,{...j,value:n});if(z===_u.PHONE)return(0,$.jsx)(Wj,{...j,value:n});if(z===_u.ADDRESS)return(0,$.jsx)(Gj,{...j,value:n});if(z===_u.BIGDECIMAL)return(0,$.jsx)(Kj,{...j,value:n});if(z===_u.CODE)return(0,$.jsx)(qj,{...j,value:n});if(z===_u.FILE){let e=r?hr.normalizeSchemaFieldPath(r):void 0,t=e&&p?.[e];return vM(t)?(0,$.jsx)(iM,{...j,fieldName:r,value:n,endpoints:{getMetadata:t.getMetadata,serve:t.serve}}):_M({value:n,className:a,tComponent:v})}if(z===_u.RANGE_BIGDECIMAL)return(0,$.jsx)(aM,{...j,value:n});if(z===_u.RANGE_MONEY)return(0,$.jsx)(oM,{...j,value:n});if(z===_u.DATE)return(0,$.jsx)(sM,{...j,value:n});if(z===_u.DATETIME)return(0,$.jsx)(cM,{...j,value:n});if(z===_u.TIME)return(0,$.jsx)(lM,{...j,value:n});if(z===_u.RANGE_NUMBER)return(0,$.jsx)(uM,{...j,value:n});if(z===_u.RANGE_DATE)return(0,$.jsx)(dM,{...j,value:n});if(z===_u.RANGE_DATETIME)return(0,$.jsx)(fM,{...j,value:n});if(z===_u.RANGE_TIME)return(0,$.jsx)(pM,{...j,value:n});if(z===_u.RECORD&&typeof n==`object`&&n){let t=Object.entries(n);if(t.length===0)return yM(f,R(!0));let i=vi(e),o=aee(e),s=o?ar(o):void 0,c=e=>{if(!s)return e;let t=Mc(s,e),n=x(t);return n===t?e:n};return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),t.map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(Z,{className:U(O.base,`shrink-0`),children:c(e)}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(xR,{schema:i??void 0,schemaType:i?me(i):void 0,value:t,name:r?`${r}.${e}`:e,hideLabel:!0,parentData:n,resourceLinkTrail:te})})]},e))]})}if(z===_u.SET&&(n instanceof Set||Array.isArray(n))){let t=Array.from(n);if(t.length===0)return yM(f,R(!0));let i=kte(e);return(0,$.jsx)(`div`,{className:U(`flex flex-col gap-element-xs`,a),children:t.map((e,t)=>(0,$.jsx)(xR,{schema:i??void 0,schemaType:i?me(i):void 0,value:e,name:r?`${r}.${t}`:String(t),hideLabel:!0,resourceLinkTrail:te},`${r??`set`}-${t}`))})}if(z===_u.TUPLE&&Array.isArray(n)){if(n.length===0)return yM(f,R(!0));let t=oie(e);return(0,$.jsx)(`div`,{className:U(`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,a),children:n.map((e,n)=>{let i=t?.[n];return(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(xR,{schema:i??void 0,schemaType:i?me(i):void 0,value:e,name:r?`${r}.${n}`:String(n),hideLabel:!0,resourceLinkTrail:te})},`${r??`tuple`}-${n}`)})})}if(z===_u.MAP&&(n instanceof Map||typeof n==`object`&&n)){let t=n instanceof Map?Array.from(n.entries()):Object.entries(n);if(t.length===0)return yM(f,R(!0));let i=Pi(e);return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,A.base),"aria-hidden":`true`}),t.map(([e,t],n)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:U(O.base,`shrink-0`),children:(0,$.jsx)(xR,{schema:i?.keySchema??void 0,schemaType:i?.keySchema?me(i.keySchema):void 0,value:e,name:r?`${r}.${n}.key`:`${n}.key`,hideLabel:!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(xR,{schema:i?.valueSchema??void 0,schemaType:i?.valueSchema?me(i.valueSchema):void 0,value:t,name:r?`${r}.${n}.value`:`${n}.value`,hideLabel:!0,resourceLinkTrail:te})})]},`${r??`map`}-${n}`))]})}return z===_u.UNKNOWN?(0,$.jsx)(Yj,{...j,value:n}):(0,$.jsxs)(`div`,{className:U(k.base,k.sizes?.sm||k.sizes?.md,D.base,`flex items-center gap-element px-card-sm py-item-xs rounded-md`,a),children:[(0,$.jsx)(Z,{className:O.base,children:v(B.LOW_LEVEL_FORM_FIELD,`unsupportedDisplayType`)}),(0,$.jsx)(f_,{className:U(`px-item-xs rounded`,D.states.hover),children:z})]})}bM.displayName=`DisplayValueDispatcher`;function xM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,className:m,hideLabel:h,hideDescription:g,resolvedChromeMode:_,resolvedLabelPlacement:v,resolvedLabelStyle:y,resolvedEmptyValue:b,fileUploadContext:x,wideValue:S,announceName:C}=e,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(r);return(0,Q.useEffect)(()=>{O.current!==r&&(T(!1),D(!1),O.current=r)},[r]),(0,$.jsx)(sj,{mode:_,label:a,labelStyle:y,description:o,tooltip:s,provenance:c,name:i,labelPlacement:v,hideLabel:h,hideDescription:g,wide:S,announceName:C,className:m,children:(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:m,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,emptyValue:b,fileUploadContext:x,showAllArrayItems:w,onExpandArrayItems:()=>T(!0),showAllObjectFields:E,onExpandObjectFields:()=>D(!0)})})}xM.displayName=`DisplayFieldReadOnly`;function SM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,className:f,hideLabel:p,hideDescription:m,resolvedLabelPlacement:h,resolvedLabelStyle:g,resolvedEmptyValue:_,fileUploadContext:v,sectionAppearance:b}=e,{getRecipe:x}=Rg(),S=x(oc.TYPOGRAPHY,y.EYEBROW),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{D.current!==r&&(w(!1),E(!1),D.current=r)},[r]);let O=h===`hidden`;return(0,$.jsxs)(ET,{appearance:b,className:f,"data-field":i,children:[a!=null&&!p&&O&&(0,$.jsx)(OT,{className:`sr-only`,children:a}),a!=null&&!p&&!O&&(g===os.TITLE?(0,$.jsx)(`div`,{className:U(`pt-item-xs`,S.base),children:a}):(0,$.jsx)(OT,{children:a})),o!=null&&!m&&(0,$.jsx)(dx,{children:o}),(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:_,fileUploadContext:v,showAllArrayItems:C,onExpandArrayItems:()=>w(!0),showAllObjectFields:T,onExpandObjectFields:()=>E(!0)})]})}SM.displayName=`DisplayFieldReadOnlyArraySection`;function CM(e){return e.replace(/\[(\d+)\]/g,`.$1`)}function wM(e,t){let n=CM(e),r=CM(t);return r===n||r.startsWith(n+`.`)}function TM(e,t){return wM(e,t)||wM(t,e)}function EM(e,t){return t?CM(t).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}var DM=()=>()=>{},vfe={lastEvent:null},OM=()=>vfe,kM=rs.getLogger(),AM=kM.debugByType(`FormErrorExtraction`);kM.setDebugTypeLogging(`FormErrorExtraction`,!1);function jM(e){if(!e||typeof e!=`object`)return AM(`extractServerValidationErrors: not an object, skipping`,{errorType:typeof e}),null;let t=e;if(t.customMessageReference===ql.VERSION_CONFLICT)return AM(`extractServerValidationErrors: version conflict, not a validation error`),null;AM(`extractServerValidationErrors: inspecting error shape`,{httpStatus:t.httpStatus,hasValidationErrors:!!t.validationErrors,errorType:t.errorType,hasResponse:!!t.response,message:t.message});let n=t.httpStatus,r=t.validationErrors;if(MM(n)&&yfe(r))return AM(`extractServerValidationErrors: MATCHED via interceptor properties`,{httpStatus:n,fieldCount:Object.keys(r).length,fields:Object.keys(r)}),{httpStatus:n,validationErrors:r};let i=t.response;if(i){let e=i.status,t=i.data;if(MM(e)&&t){let n=Xee(t);if(n&&Object.keys(n).length>0)return AM(`extractServerValidationErrors: MATCHED via raw response`,{httpStatus:e,fieldCount:Object.keys(n).length,fields:Object.keys(n)}),{httpStatus:e,validationErrors:n}}}return AM(`extractServerValidationErrors: NO validation errors found`),null}function MM(e){return e===400||e===409||e===422}function yfe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}var bfe=Object.freeze([]);function xfe(e){let{declaration:t,record:n,appConfig:r,fieldName:i}=e,a=t?.readsFields??bfe,o=zC({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=Sfe(t?.readsReferences);return(0,Q.useMemo)(()=>t?Io(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)):Xne,[t,r,n,c,l,i])}function Sfe(e){let t=(0,Q.useMemo)(()=>Object.keys(e??{}),[e]),n=zC({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}=lm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=PD(),u=sC(),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=$l(i.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null;Rw({resourceType:t,id:n,registry:i.registry,doOperation:i.doOperation,contextualParameters:Im({hostIdentifiers:{},hostContextualParameters:i.contextualParameters,hostRecord:i.hostRecord,targetResourceType:t,targetId:n,registry:i.registry}).contextualParameters,readOperation:a,t:i.t,formatDate:i.formatDate,formatDateTime:i.formatDateTime}).then(({record:t})=>{e||h(e=>({...e,[r]:t}))}).catch(e=>{console.warn(`[requestFieldOffers] The ${t} "${n}" a request field references could not be read; its offer narrows nothing by it.`,e)})}return()=>{e=!0}},[g]),(0,Q.useMemo)(()=>Object.fromEntries(r.map(({field:e,resourceType:t,id:n})=>[e,n?m[`${t}:${n}`]:void 0])),[r,m])}var NM=(0,Q.createContext)(null);function PM(e){let t=(0,Q.useContext)(NM);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[e,t])}var FM=rs.getLogger(),IM=FM.debugByType(`FieldUniquenessValidation`);FM.setDebugTypeLogging(`FieldUniquenessValidation`,!1);function Cfe({fieldName:e,fieldSchema:t}){let n=PD(),r=UC(),{httpClient:i}=Tu(),{tErrorValidation:a}=K(),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=t?vu(t):!1,l=n?.validateFieldUrl,u=n?.resourceId;return{validateUniqueness:(0,Q.useCallback)(async()=>{if(!c||!l||!i)return;let t=r.getValues(e);if(t==null||t===``){r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e);return}IM(`Starting uniqueness check`,{fieldName:e,value:t,validateFieldUrl:l,resourceId:u}),o.current&&o.current.abort();let n=new AbortController;o.current=n,s.current=!0;try{let o=await i.post(l,{fieldName:e,value:t,excludeId:u},{signal:n.signal,silent:!0});return IM(`Uniqueness check response`,{fieldName:e,valid:o.valid,error:o.error}),!o.valid&&o.error?(r.setError(e,{type:aT,message:a(o.error.code,`msg`,o.error.params)}),!1):(r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e),!0)}catch(t){if(t?.name===`AbortError`||t?.code===`ERR_CANCELED`){IM(`Uniqueness check aborted (superseded)`,{fieldName:e});return}FM.warn(`Uniqueness pre-validation failed`,{fieldName:e,error:t?.message});return}finally{s.current=!1,o.current===n&&(o.current=null)}},[e,c,l,u,i,r,a]),isChecking:s.current}}function wfe(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function LM(e){let t=UC(),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&&wfe(a)?(t.setValue(e,a,{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),!0):(r(),!1)},[t,e]),noteInputReceived:(0,Q.useCallback)(()=>{n.current=!0},[])}}var RM=(0,Q.createContext)({}),zM=(0,Q.createContext)(void 0);function BM({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)(RM.Provider,{value:a,children:(0,$.jsx)(zM.Provider,{value:n,children:r})})}function VM(){return(0,Q.useContext)(RM)}function HM(){return(0,Q.useContext)(zM)}function UM({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AUTOSAVE_INDICATOR,`AutosaveIndicator`)(e);return(0,$.jsx)(n,{...t})}function WM(e,t){let{saveState:n,saveErrorMessage:r,onRetrySave:i,variant:a=`block`}=t;return!n||n===tT.IDLE?e:a===`inline`?(0,$.jsxs)(`div`,{className:`relative inline-flex`,children:[e,(0,$.jsx)(UM,{state:n,errorMessage:r,onRetry:i,position:`inline`,className:`ml-element`})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[e,(0,$.jsx)(UM,{state:n,errorMessage:r,onRetry:i,position:`absolute-right`,className:i?void 0:`pointer-events-none`})]})}function GM(e,t,n){return e==null?Uc.STACKED:typeof e==`string`?e:e[t]??e[xl.DESKTOP]??Uc.STACKED}function KM({text:e}){let{renderIcon:t}=Of(),{tComponent:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(ej,{children:[(0,$.jsx)(tj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(B.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:ca.XS})})}),(0,$.jsx)(nj,{children:e})]}):null}function qM({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}=Rg(),x=(0,Q.useMemo)(()=>GM(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===Uc.INLINE?`inline`:`top`),D=!o&&!!t&&E!==`hidden`&&x!==Uc.COMPACT&&x!==Uc.HIDDEN,O=!s&&!!n&&x!==Uc.COMPACT&&x!==Uc.HIDDEN,k=!c&&!!r&&x!==Uc.HIDDEN,A=!o&&t&&E===`hidden`?(0,$.jsx)(cx,{id:T,htmlFor:S,className:`sr-only`,children:t}):null,j=E===`start`||E===`inline`?`inline`:`block`,M=WM((0,$.jsx)(BM,{invalid:!!r,describedBy:[O?C:void 0,k?w:void 0],labelId:D||A?T:void 0,children:(0,$.jsx)(OE,{fieldName:p,label:t,disabled:m,onSaveFieldNow:f,children:v})}),{saveState:l,saveErrorMessage:u,onRetrySave:d,variant:j});if(x===Uc.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[A,M]});if(x===Uc.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)(fx,{id:w,children:r})]});if(E===`start`||E===`inline`){let e=(0,$.jsxs)(ux,{children:[D&&(0,$.jsx)(lx,{children:(0,$.jsxs)(cx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(KM,{text:h})]})}),O&&(0,$.jsx)(dx,{id:C,children:n}),k&&(0,$.jsx)(fx,{id:w,children:r})]});return(0,$.jsxs)(sx,{orientation:ox.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===Uc.RELAXED)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`relaxed`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex flex-col gap-field`,_),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-lg font-semibold leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-1`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(KM,{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===Uc.SETTINGS_ROW){let e=!!g||b;return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":g?`wide`:b?`stacked`:void 0,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,e?`flex-col gap-element-xs`:U(`flex-row gap-section`,O?`items-start`:`items-center has-[textarea]:items-start`),_),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!e&&`flex-1`),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-sm font-medium leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(KM,{text:h})]}),O&&(0,$.jsx)(dx,{id:C,children:n})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,e?`w-full`:`w-72 max-w-[55%] shrink items-end`),children:[M,k&&(0,$.jsx)(fx,{id:w,children:r})]})]})}return(0,$.jsxs)(sx,{orientation:ox.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)(cx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(KM,{text:h})]}),M,O&&(0,$.jsx)(dx,{id:C,children:n}),k&&(0,$.jsx)(fx,{id:w,children:r})]})}qM.displayName=`FormFieldChrome`;var JM=Xs(B.LOW_LEVEL_SLIDER,`Slider`,[`Root`]),Tfe=Ml(B.LOW_LEVEL_RANGE_SLIDER,`RangeSlider`),YM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=JM(e);return(0,$.jsx)(r,{...t,ref:n})});YM.displayName=`Slider`;var XM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=JM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});XM.displayName=`SliderRoot`;var ZM=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Tfe(e);return(0,$.jsx)(r,{...t,ref:n})});ZM.displayName=`RangeSlider`;var QM=Xs(B.LOW_LEVEL_INPUT,`Input`,[`Root`]),$M=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=QM(e);return(0,$.jsx)(r,{...t,ref:n})});$M.displayName=`Input`;var eN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=QM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});eN.displayName=`InputRoot`;var tN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_DATEPICKER,`DatePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});tN.displayName=`DatePicker`;var nN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_DATE}),i=n?.dateFormat;return(0,$.jsx)(tN,{ref:t,...e,dateFormat:i,calendarDate:e.schema?$c(e.schema):!1,timeZone:n?.timezone})}),rN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_DATE,`FormFieldDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});rN.displayName=`FormFieldDate`;var iN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_DATETIME_PICKER,`DateTimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});iN.displayName=`DateTimePicker`;var aN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_DATETIME});return(0,$.jsx)(iN,{ref:t,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone})}),oN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_DATETIME,`FormFieldDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});oN.displayName=`FormFieldDateTime`;var sN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_TIMEPICKER,`TimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});sN.displayName=`TimePicker`;var cN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_TIME});return(0,$.jsx)(sN,{ref:t,...e,timeFormat:n?.timeFormat})}),lN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_TIME,`FormFieldTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});lN.displayName=`FormFieldTime`;var uN=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=qd.MD},y)=>{let{tComponent:b,isReady:x}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER}),S=jt(e),C=m??S?.min,w=h??S?.max,T=S?.fromOptional??!0,E=S?.toOptional??!0,[D,O]=Q.useState(c??{from:void 0,to:void 0}),k=T_(a,o),A=a??D,j=Q.useMemo(()=>A.from==null||A.to==null?!1:A.from>A.to,[A.from,A.to]),M=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,from:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),N=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,to:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),P=Q.useCallback(()=>{s?.()},[s]),F=t??`range-number-field`,I=`${F}-from`,ee=`${F}-to`;return x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:I,className:`sr-only`,children:d}),(0,$.jsx)(eN,{ref:y,id:I,type:`number`,value:A.from??``,onChange:M,onBlur:P,disabled:n,readOnly:r,placeholder:l,"aria-invalid":j,"aria-required":!T,step:p,min:C,max:w,className:`tabular-nums`,autoFocus:_,controlSize:v})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(eN,{id:ee,type:`number`,value:A.to??``,onChange:N,onBlur:P,disabled:n,readOnly:r,placeholder:u,"aria-invalid":j,"aria-required":!E,step:p,min:C,max:w,className:`tabular-nums`,controlSize:v})]})]}),j&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:b(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),dN=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,`FormFieldRangeNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});dN.displayName=`FormFieldRangeNumber`;var fN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_DATE_RANGE_PICKER,`DateRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});fN.displayName=`DateRangePicker`;var pN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_DATE}),i=e.schema?jt(e.schema):void 0,a=e.minDate??ai(i?.min),o=e.maxDate??ai(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(fN,{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})}),mN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_DATE,`FormFieldRangeDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});mN.displayName=`FormFieldRangeDate`;var hN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_DATETIME_RANGE_PICKER,`DateTimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});hN.displayName=`DateTimeRangePicker`;var gN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME}),i=e.schema?jt(e.schema):void 0,a=e.minDate??ai(i?.min),o=e.maxDate??ai(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(hN,{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})}),_N=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,`FormFieldRangeDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});_N.displayName=`FormFieldRangeDateTime`;var vN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_TIME_RANGE_PICKER,`TimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});vN.displayName=`TimeRangePicker`;var yN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_TIME});return(0,$.jsx)(vN,{ref:t,schema:e.schema,name:e.name,...e,timeFormat:n?.timeFormat})}),bN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_TIME,`FormFieldRangeTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});bN.displayName=`FormFieldRangeTime`;function xN({name:e,schema:t,label:n,hideLabel:r,description:i,disabled:a,className:o,renderField:s,fieldLabels:c={},excludedChildKeys:l}){let u=F(t),d=Jr(t),f=LT();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)(ET,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(xD,{children:(0,$.jsx)(OT,{children:n})}),i&&(0,$.jsx)(dx,{children:i}),(0,$.jsx)(DT,{children:m.map(t=>(0,$.jsx)(Q.Fragment,{children:s(`${e}.${t}`,u[t])},t))})]}):(0,$.jsxs)(ET,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(xD,{children:(0,$.jsx)(OT,{children:n})}),i&&(0,$.jsx)(dx,{children:i}),(0,$.jsx)(DT,{children:m.map(t=>{let n=u[t],r=`${e}.${t}`,i=c[t]??f?.fieldLabels?.[hr.labelDictionaryPath(r)]??hr.unresolvedFieldLabel(t);return(0,$.jsx)(QL,{name:r,schema:n,label:i,disabled:a},t)})})]})}xN.displayName=`FormFieldComposite`;var SN=xN,Efe=0;function CN(){return`kv-${++Efe}-${Date.now()}`}function Dfe(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e])=>({id:CN(),key:e,pendingValue:void 0}))}function Ofe(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 kfe({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}=Rg(),m=p(oc.TYPOGRAPHY,y.DESCRIPTION),{formChromeMode:h,sectionChromeMode:g}=Qw(),_=pc(),v=g??h??GL(_.autoRender?.autoFieldChrome),b=KL(_.autoRender?.autoLabelPlacement),x=qL(_.autoRender?.autoFieldDensity),S=_.autoRender?.autoErrorPlacement===`summary-at-surface-top`,C=(0,Q.useCallback)(t=>{s(e.id,t)},[e.id,s]),w=e.key.trim()!==``;return(0,$.jsxs)(`div`,{className:`relative rounded-lg border border-border p-card`,"data-testid":`record-entry-${t}`,children:[a&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>c(e.id),disabled:i,className:`absolute -top-3 end-3 h-6 w-6 bg-background`,"aria-label":`Remove entry ${e.key||t+1}`,children:f(H.CLOSE,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`pt-item space-y-field`,children:[(0,$.jsx)(qM,{mode:v,label:l,error:o,labelPlacement:b,hideError:S,fieldName:`${r}.__key_${e.id}`,disabled:i,children:(0,$.jsx)($M,{schema:yd(),name:`${r}.__key_${e.id}`,value:e.key,onChange:e=>C(String(e)),disabled:i,controlSize:x})}),w?(0,$.jsx)(QL,{name:`${r}.${e.key}`,schema:n,label:u,disabled:i}):(0,$.jsx)(`p`,{className:U(m.base,`py-card-sm px-card-sm rounded-md border border-dashed border-border`),children:d})]})]})}function wN({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}=UC(),{renderIcon:h}=Of(),g=wE(),_=g!==null&&EE(Yc(t)?.autosave,g.config.defaultTrigger,!0)!==au.NONE?g:null,{tComponent:v,isReady:b,resolvedRegionalPreferences:x}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),S=x?.timezone,{getRecipe:C}=Rg(),w=C(oc.TYPOGRAPHY,y.DESCRIPTION),T=v(B.LOW_LEVEL_FORM_MESSAGE,`recordAddEntry`),E=v(B.LOW_LEVEL_FORM_MESSAGE,`recordKeyLabel`),D=v(B.LOW_LEVEL_FORM_MESSAGE,`recordValueLabel`),O=v(B.LOW_LEVEL_FORM_MESSAGE,`recordEmptyMessage`),k=v(B.LOW_LEVEL_FORM_MESSAGE,`recordDuplicateKey`),A=v(B.LOW_LEVEL_FORM_MESSAGE,`recordEnterKeyFirst`),j=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>()=>{j.current=!1},[]);let[M,N]=(0,Q.useState)(()=>Dfe(l(e))),P=(0,Q.useMemo)(()=>{let e=new Map;for(let t of M){let n=t.key.trim();n!==``&&e.set(n,(e.get(n)||0)+1)}let t=new Set;for(let[n,r]of e)r>1&&t.add(n);return t},[M]);(0,Q.useEffect)(()=>{P.size>0?d(e,{type:sT,message:k}):p(e,m).error?.type===`record-duplicate-key`&&f(e)},[P,e,d,f,p,m,k]);let F=(0,Q.useCallback)((t,n)=>{let r=Ofe(t,e,l,n);c(e,r,{shouldDirty:!0,shouldValidate:!0}),_&&_.triggerSave(e,r,au.DEBOUNCE),setTimeout(()=>{j.current&&u(e)},0)},[e,c,l,u,_]),I=(0,Q.useCallback)((t,n)=>{N(r=>{let i=r.find(e=>e.id===t);if(!i)return r;let a=i.key.trim(),o=a===``?i.pendingValue:l(`${e}.${a}`),s=r.map(e=>e.id===t?{...e,key:n,pendingValue:o}:e);return F(s,new Map([[t,o]])),s})},[e,l,F]),ee=(0,Q.useCallback)(()=>{if(i)return;let e={id:CN(),key:``,pendingValue:hr.getDefaultValueForSchema(o,{timeZone:S})};N(t=>[...t,e])},[i,o,S]),L=(0,Q.useCallback)(e=>{i||N(t=>{let n=t.filter(t=>t.id!==e);return F(n),n})},[i,F]);return b?(0,$.jsxs)(ET,{disabled:i,className:a,"data-field":e,"data-testid":`field-record-${e}`,children:[(0,$.jsx)(xD,{children:(0,$.jsx)(OT,{children:n})}),r&&(0,$.jsx)(dx,{children:r}),(0,$.jsxs)(DT,{className:`space-y-field`,children:[M.map((t,n)=>{let r=t.key.trim(),a=r!==``&&P.has(r)?k:void 0;return(0,$.jsx)(kfe,{entry:t,index:n,valueSchema:o,parentName:e,disabled:i,canRemove:!i,keyError:a,onKeyChange:I,onRemove:L,keyLabel:E,valueLabel:D,emptyKeyPlaceholder:A,renderIcon:h},t.id)}),(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,onClick:ee,disabled:i,className:`w-full`,children:[h(H.PLUS,{size:ca.SM,className:`me-element`}),T]}),M.length===0&&(0,$.jsx)(`p`,{className:U(w.base,`text-center py-card`),children:O})]})]}):null}wN.displayName=`FormFieldRecord`;var TN=wN,EN=e(i());function Afe(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var DN=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ON(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function kN(e){return`nodeType`in e}function AN(e){return e?ON(e)?e:kN(e)?e.ownerDocument?.defaultView??window:window:window}function jN(e){let{Document:t}=AN(e);return e instanceof t}function MN(e){return!ON(e)&&e instanceof AN(e).HTMLElement}function NN(e){return e instanceof AN(e).SVGElement}function PN(e){return e?ON(e)?e.document:kN(e)?jN(e)?e:MN(e)||NN(e)?e.ownerDocument:document:document:document}var FN=DN?Q.useLayoutEffect:Q.useEffect;function IN(e){let t=(0,Q.useRef)(e);return FN(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function jfe(){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 LN(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return FN(()=>{n.current!==e&&(n.current=e)},t),n}function RN(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function zN(e){let t=IN(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function BN(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var VN={};function HN(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=VN[e]==null?0:VN[e]+1;return VN[e]=n,e+`-`+n},[e,t])}function UN(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 WN=UN(1),GN=UN(-1);function Mfe(e){return`clientX`in e&&`clientY`in e}function KN(e){if(!e)return!1;let{KeyboardEvent:t}=AN(e.target);return t&&e instanceof t}function Nfe(e){if(!e)return!1;let{TouchEvent:t}=AN(e.target);return t&&e instanceof t}function qN(e){if(Nfe(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 Mfe(e)?{x:e.clientX,y:e.clientY}:null}var JN=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[JN.Translate.toString(e),JN.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),YN=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Pfe(e){return e.matches(YN)?e:e.querySelector(YN)}var Ffe={display:`none`};function Ife(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:Ffe},n)}function Lfe(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 Rfe(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var XN=(0,Q.createContext)(null);function zfe(e){let t=(0,Q.useContext)(XN);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Bfe(){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 Vfe={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
- `},Hfe={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 Ufe(e){let{announcements:t=Hfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Vfe}=e,{announce:a,announcement:o}=Rfe(),s=HN(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),zfe((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(Ife,{id:r,value:i.draggable}),Q.createElement(Lfe,{id:s,announcement:o}));return n?(0,EN.createPortal)(u,n):u}var ZN;(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`})(ZN||={});function QN(){}function $N(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function eP(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var tP=Object.freeze({x:0,y:0});function nP(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function rP(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Wfe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function iP(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 aP(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function oP(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 sP=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=oP(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=nP(oP(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(rP)},Gfe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=iP(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=iP(r),o=i.reduce((e,t,r)=>e+nP(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(rP)};function Kfe(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 qfe=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=Kfe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Wfe)};function Jfe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function cP(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:tP}function Yfe(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 Xfe=Yfe(1);function Zfe(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 Qfe(e,t,n){let r=Zfe(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 $fe={ignoreTransform:!1};function lP(e,t){t===void 0&&(t=$fe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=AN(e).getComputedStyle(e);t&&(n=Qfe(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 uP(e){return lP(e,{ignoreTransform:!0})}function epe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function tpe(e,t){return t===void 0&&(t=AN(e).getComputedStyle(e)),t.position===`fixed`}function npe(e,t){t===void 0&&(t=AN(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 dP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(jN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!MN(i)||NN(i)||n.includes(i))return n;let a=AN(e).getComputedStyle(i);return i!==e&&npe(i,a)&&n.push(i),tpe(i,a)?n:r(i.parentNode)}return e?r(e):n}function fP(e){let[t]=dP(e,1);return t??null}function pP(e){return!DN||!e?null:ON(e)?e:kN(e)?jN(e)||e===PN(e).scrollingElement?window:MN(e)?e:null:null}function mP(e){return ON(e)?e.scrollX:e.scrollLeft}function hP(e){return ON(e)?e.scrollY:e.scrollTop}function gP(e){return{x:mP(e),y:hP(e)}}var _P;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(_P||={});function vP(e){return!DN||!e?!1:e===document.scrollingElement}function yP(e){let t={x:0,y:0},n=vP(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 rpe={x:.2,y:.2};function ipe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=rpe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=yP(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=_P.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=_P.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=_P.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=_P.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function ape(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 bP(e){return e.reduce((e,t)=>WN(e,gP(t)),tP)}function ope(e){return e.reduce((e,t)=>e+mP(t),0)}function spe(e){return e.reduce((e,t)=>e+hP(t),0)}function cpe(e,t){if(t===void 0&&(t=lP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);fP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var lpe=[[`x`,[`left`,`right`],ope],[`y`,[`top`,`bottom`],spe]],xP=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=dP(t),r=bP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of lpe)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})}},SP=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 upe(e){let{EventTarget:t}=AN(e);return e instanceof t?e:PN(e)}function CP(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 wP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(wP||={});function TP(e){e.preventDefault()}function dpe(e){e.stopPropagation()}var EP;(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`})(EP||={});var DP={start:[EP.Space,EP.Enter],cancel:[EP.Esc],end:[EP.Space,EP.Enter,EP.Tab]},fpe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case EP.Right:return{...n,x:n.x+25};case EP.Left:return{...n,x:n.x-25};case EP.Down:return{...n,y:n.y+25};case EP.Up:return{...n,y:n.y-25}}},OP=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 SP(PN(t)),this.windowListeners=new SP(AN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(wP.Resize,this.handleCancel),this.windowListeners.add(wP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(wP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&cpe(n),t(tP)}handleKeyDown(e){if(KN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=DP,coordinateGetter:a=fpe,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}:tP;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=GN(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}=yP(n),p=ape(n),m={x:Math.min(i===EP.Right?p.right-p.width/2:p.right,Math.max(i===EP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===EP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===EP.Down?p.top:p.top+p.height/2,u.y))},h=i===EP.Right&&!s||i===EP.Left&&!c,g=i===EP.Down&&!l||i===EP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===EP.Right&&e<=d.x||i===EP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===EP.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===EP.Down&&e<=d.y||i===EP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===EP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,WN(GN(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()}};OP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=DP,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 kP(e){return!!(e&&`distance`in e)}function AP(e){return!!(e&&`delay`in e)}var jP=class{constructor(e,t,n){n===void 0&&(n=upe(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=PN(i),this.documentListeners=new SP(this.document),this.listeners=new SP(n),this.windowListeners=new SP(AN(i)),this.initialCoordinates=qN(r)??tP,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(wP.Resize,this.handleCancel),this.windowListeners.add(wP.DragStart,TP),this.windowListeners.add(wP.VisibilityChange,this.handleCancel),this.windowListeners.add(wP.ContextMenu,TP),this.documentListeners.add(wP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(AP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(kP(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(wP.Click,dpe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(wP.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=qN(e)??tP,s=GN(n,o);if(!t&&a){if(kP(a)){if(a.tolerance!=null&&CP(s,a.tolerance))return this.handleCancel();if(CP(s,a.distance))return this.handleStart()}if(AP(a)&&CP(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===EP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},ppe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},MP=class extends jP{constructor(e){let{event:t}=e,n=PN(t.target);super(e,ppe,n)}};MP.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 mpe={move:{name:`mousemove`},end:{name:`mouseup`}},NP;(function(e){e[e.RightClick=2]=`RightClick`})(NP||={});var hpe=class extends jP{constructor(e){super(e,mpe,PN(e.event.target))}};hpe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==NP.RightClick&&(r?.({event:n}),!0)}}];var PP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},gpe=class extends jP{constructor(e){super(e,PP)}static setup(){return window.addEventListener(PP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(PP.move.name,e)};function e(){}}};gpe.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 FP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(FP||={});var IP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(IP||={});function _pe(e){let{acceleration:t,activator:n=FP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=IP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=ype({delta:d,disabled:!a}),[m,h]=jfe(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case FP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case FP.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===IP.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}=ipe(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 vpe={x:{[_P.Backward]:!1,[_P.Forward]:!1},y:{[_P.Backward]:!1,[_P.Forward]:!1}};function ype(e){let{delta:t,disabled:n}=e,r=BN(t);return RN(e=>{if(n||!r||!e)return vpe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[_P.Backward]:e.x[_P.Backward]||i.x===-1,[_P.Forward]:e.x[_P.Forward]||i.x===1},y:{[_P.Backward]:e.y[_P.Backward]||i.y===-1,[_P.Forward]:e.y[_P.Forward]||i.y===1}}},[n,t,r])}function bpe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return RN(e=>t==null?null:r??e??null,[r,t])}function xpe(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 LP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(LP||={});var RP;(function(e){e.Optimized=`optimized`})(RP||={});var zP=new Map;function Spe(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=LN(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=RN(t=>{if(d&&!n)return zP;if(!t||t===zP||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 xP(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 LP.Always:return!1;case LP.BeforeDragging:return n;default:return!n}}}function BP(e,t){return RN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Cpe(e,t){return BP(e,t)}function wpe(e){let{callback:t,disabled:n}=e,r=IN(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 VP(e){let{callback:t,disabled:n}=e,r=IN(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 Tpe(e){return new xP(lP(e),e)}function HP(e,t,n){t===void 0&&(t=Tpe);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=wpe({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=VP({callback:a});return FN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Epe(e){return cP(e,BP(e))}var UP=[];function Dpe(e){let t=(0,Q.useRef)(e),n=RN(n=>e?n&&n!==UP&&e&&t.current&&e.parentNode===t.current.parentNode?n:dP(e):UP,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function Ope(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=pP(e.target);t&&n(e=>e?(e.set(t,gP(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=pP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,gP(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=>{pP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>WN(e,t),tP):bP(e):tP,[e,t])}function WP(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!==tP;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?GN(e,n.current):tP}function kpe(e){(0,Q.useEffect)(()=>{if(!DN)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 Ape(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 GP(e){return(0,Q.useMemo)(()=>e?epe(e):null,[e])}var KP=[];function jpe(e,t){t===void 0&&(t=lP);let[n]=e,r=GP(n?AN(n):null),[i,a]=(0,Q.useState)(KP);function o(){a(()=>e.length?e.map(e=>vP(e)?r:new xP(t(e),e)):KP)}let s=VP({callback:o});return FN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Mpe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return MN(t)?t:e}function Npe(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=VP({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(MN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=zN((0,Q.useCallback)(e=>{let n=Mpe(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 Ppe=[{sensor:MP,options:{}},{sensor:OP,options:{}}],Fpe={current:{}},qP={draggable:{measure:uP},droppable:{measure:uP,strategy:LP.WhileDragging,frequency:RP.Optimized},dragOverlay:{measure:lP}},JP=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}},Ipe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new JP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:QN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qP,measureDroppableContainers:QN,windowRect:null,measuringScheduled:!1},Lpe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:QN,draggableNodes:new Map,over:null,measureDroppableContainers:QN},YP=(0,Q.createContext)(Lpe),XP=(0,Q.createContext)(Ipe);function Rpe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new JP}}}function zpe(e,t){switch(t.type){case ZN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ZN.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 ZN.DragEnd:case ZN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ZN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new JP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case ZN.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 JP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case ZN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new JP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Bpe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(YP),a=BN(r),o=BN(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!KN(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=Pfe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Vpe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Hpe(e){return(0,Q.useMemo)(()=>({draggable:{...qP.draggable,...e?.draggable},droppable:{...qP.droppable,...e?.droppable},dragOverlay:{...qP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Upe(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;FN(()=>{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=cP(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=fP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var ZP=(0,Q.createContext)({...tP,scaleX:1,scaleY:1}),QP;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(QP||={});var $P=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ppe,collisionDetection:o=qfe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(zpe,void 0,Rpe),[f,p]=Bfe(),[m,h]=(0,Q.useState)(QP.Uninitialized),g=m===QP.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??Fpe,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=LN(l,Object.values(l)),A=HN(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=Hpe(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Spe(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=bpe(v,_),ee=(0,Q.useMemo)(()=>D?qN(D):null,[D]),L=ke(),R=Cpe(I,M.draggable.measure);Upe({activeNode:_==null?null:v.get(_),config:L.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let z=HP(I,M.draggable.measure,R),te=HP(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=Npe({measure:M.dragOverlay.measure}),ae=ie.nodeRef.current??I,oe=g?ie.rect??z:null,se=!!(ie.nodeRef.current&&ie.rect),ce=Epe(se?null:z),le=GP(ae?AN(ae):null),ue=Dpe(g?re??I:null),de=jpe(ue),fe=Vpe(c,{transform:{x:y.x-ce.x,y:y.y-ce.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:oe,over:ne.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ue,scrollableAncestorRects:de,windowRect:le}),pe=ee?WN(ee,y):null,me=Ope(ue),he=WP(me),ge=WP(me,[z]),_e=WN(fe,he),ve=oe?Xfe(oe,fe):null,ye=C&&ve?o({active:C,collisionRect:ve,droppableRects:N,droppableContainers:j,pointerCoordinates:pe}):null,be=aP(ye,`id`),[xe,Se]=(0,Q.useState)(null),Ce=Jfe(se?fe:WN(fe,ge),xe?.rect??null,z),we=(0,Q.useRef)(null),Te=(0,Q.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:ne,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,EN.unstable_batchedUpdates)(()=>{r?.(i),h(QP.Initializing),d({type:ZN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:ZN.DragMove,coordinates:e})},onEnd:s(ZN.DragEnd),onCancel:s(ZN.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ne.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===ZN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=ZN.DragCancel)}w.current=null,(0,EN.unstable_batchedUpdates)(()=>{d({type:e}),h(QP.Uninitialized),Se(null),E(null),O(null),we.current=null;let t=e===ZN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=xpe(a,(0,Q.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));kpe(a),FN(()=>{z&&m===QP.Initializing&&h(QP.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,EN.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[_e.x,_e.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ne.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,EN.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),FN(()=>{ne.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ve,collisions:ye,droppableRects:N,draggableNodes:v,draggingNode:ae,draggingNodeRect:oe,droppableContainers:b,over:xe,scrollableAncestors:ue,scrollAdjustedTranslate:_e},S.current={initial:oe,translated:ve}},[C,I,ye,ve,v,ae,oe,N,b,xe,ue,_e]),_pe({...L,delta:y,draggingRect:ve,pointerCoordinates:pe,scrollableAncestors:ue,scrollableAncestorRects:de});let De=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:z,activatorEvent:D,collisions:ye,containerNodeRect:te,dragOverlay:ie,draggableNodes:v,droppableContainers:b,droppableRects:N,over:xe,measureDroppableContainers:P,scrollableAncestors:ue,scrollableAncestorRects:de,measuringConfiguration:M,measuringScheduled:F,windowRect:le}),[C,I,z,D,ye,te,ie,v,b,N,xe,P,ue,de,M,F,le]),Oe=(0,Q.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:xe,measureDroppableContainers:P}),[D,Ee,C,z,d,A,v,xe,P]);return Q.createElement(XN.Provider,{value:p},Q.createElement(YP.Provider,{value:Oe},Q.createElement(XP.Provider,{value:De},Q.createElement(ZP.Provider,{value:Ce},i)),Q.createElement(Bpe,{disabled:n?.restoreFocus===!1})),Q.createElement(Ufe,{...n,hiddenTextDescribedById:A}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Wpe=(0,Q.createContext)(null),eF=`button`,Gpe=`Draggable`;function Kpe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=HN(Gpe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(YP),{role:p=eF,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?ZP:Wpe),[v,y]=zN(),[b,x]=zN(),S=Ape(o,t),C=LN(n);return FN(()=>(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===eF?!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 qpe(){return(0,Q.useContext)(XP)}var Jpe=`Droppable`,Ype={timeout:25};function Xpe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=HN(Jpe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(YP),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}={...Ype,...i},_=LN(h??r),v=VP({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]=zN((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=LN(t);return(0,Q.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:ZN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:ZN.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:ZN.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 tF(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Zpe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function nF(e){return e!==null&&e>=0}function Qpe(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 $pe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var rF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=tF(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}},iF={scaleX:1,scaleY:1},aF=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,...iF}:null}let s=eme(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...iF}:r<t&&r>=a?{x:0,y:o.height+s,...iF}:{x:0,y:0,...iF}};function eme(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 oF=`Sortable`,sF=Q.createContext({activeIndex:-1,containerId:oF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:rF,disabled:{draggable:!1,droppable:!1}});function cF(e){let{children:t,id:n,items:r,strategy:i=rF,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=qpe(),d=HN(oF,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=!Qpe(p,_.current),y=g!==-1&&h===-1||v,b=$pe(a);FN(()=>{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:Zpe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(sF.Provider,{value:x},t)}var tme=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return tF(n,r,i).indexOf(t)},nme=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},rme={duration:200,easing:`ease`},lF=`transform`,ime=JN.Transition.toString({property:lF,duration:0,easing:`linear`}),ame={roleDescription:`sortable`};function ome(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return FN(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=lP(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 uF(e){let{animateLayoutChanges:t=nme,attributes:n,disabled:r,data:i,getNewIndex:a=tme,id:o,strategy:s,resizeObserverConfig:c,transition:l=rme}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(sF),y=sme(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}=Xpe({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}=Kpe({id:o,data:x,attributes:{...ame,...n},disabled:y.draggable}),ee=Afe(E,j),L=!!D,R=L&&!m&&nF(f)&&nF(g),z=!_&&N,te=R?(z&&R?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,ne=nF(f)&&nF(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,re=D?.id,ie=(0,Q.useRef)({activeId:re,items:u,newIndex:ne,containerId:d}),ae=u!==ie.current.items,oe=t({active:D,containerId:d,isDragging:N,isSorting:L,id:o,index:b,items:u,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:l,wasDragging:ie.current.activeId!=null}),se=ome({disabled:!oe,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{L&&ie.current.newIndex!==ne&&(ie.current.newIndex=ne),d!==ie.current.containerId&&(ie.current.containerId=d),u!==ie.current.items&&(ie.current.items=u)},[L,ne,d,u]),(0,Q.useEffect)(()=>{if(re===ie.current.activeId)return;if(re!=null&&ie.current.activeId==null){ie.current.activeId=re;return}let e=setTimeout(()=>{ie.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:ne,items:u,isOver:T,isSorting:L,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:se??te,transition:ce()};function ce(){if(se||ae&&ie.current.newIndex===b)return ime;if(!(z&&!KN(O)||!l)&&(L||oe))return JN.Transition.toString({...l,property:lF})}}function sme(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function dF(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 cme=[EP.Down,EP.Right,EP.Up,EP.Left],fF=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(cme.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 EP.Down:r.top<a.top&&t.push(n);break;case EP.Up:r.top>a.top&&t.push(n);break;case EP.Left:r.left>a.left&&t.push(n);break;case EP.Right:r.left<a.left&&t.push(n)}});let c=Gfe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=aP(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=dP(c).some((e,t)=>s[t]!==e),i=pF(e,t),a=lme(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:GN(u,l)}}}};function pF(e,t){return!dF(e)||!dF(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function lme(e,t){return!dF(e)||!dF(t)||!pF(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var mF;(function(e){e.POPPER=`popper`,e.ITEM_ALIGNED=`item-aligned`})(mF||={});var hF=Xs(B.LOW_LEVEL_SELECT,`Select`,[`Root`,`Trigger`,`Content`,`Value`,`Item`,`Group`,`Label`,`Separator`,`ScrollUpButton`,`ScrollDownButton`]),gF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=hF(e);return(0,$.jsx)(r,{...t,ref:n})});gF.displayName=`Select`;function _F({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.Root,{...t})}var vF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=hF(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});vF.displayName=`SelectTrigger`;var yF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=hF(e);return(0,$.jsx)(r.Content,{...t,ref:n})});yF.displayName=`SelectContent`;function bF({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.Value,{...t})}var xF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=hF(e);return(0,$.jsx)(r.Item,{...t,ref:n})});xF.displayName=`SelectItem`;function ume({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.Group,{...t})}function dme({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.Label,{...t})}function fme({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.Separator,{...t})}function pme({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.ScrollUpButton,{...t})}function mme({preset:e=q.DEFAULT,...t}){let n=hF(e);return(0,$.jsx)(n.ScrollDownButton,{...t})}var SF=Xs(B.LOW_LEVEL_RADIO_GROUP,`RadioGroup`,[`Root`]),CF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=SF(e);return(0,$.jsx)(r,{...t,ref:n})});CF.displayName=`RadioGroup`;function wF({preset:e=q.DEFAULT,...t}){let n=SF(e);return(0,$.jsx)(n.Root,{...t})}function TF({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_RADIO,`RadioGroupItem`)(e);return(0,$.jsx)(n,{...t})}var EF;(function(e){e.ABSENT=`absent`})(EF||={});var DF=Xs(B.LOW_LEVEL_CARD,`Card`,[`Listbox`,`Header`,`Footer`,`Title`,`Action`,`Description`,`Content`]);function OF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n,{...t})}function kF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Listbox,{...t})}function AF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Header,{...t})}function jF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Footer,{...t})}function MF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Title,{...t})}function NF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Action,{...t})}function PF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Description,{...t})}function FF({preset:e=q.DEFAULT,...t}){let n=DF(e);return(0,$.jsx)(n.Content,{...t})}var hme=Ml(B.LOW_LEVEL_SELECT_MULTIPLE,`SelectMultiple`),IF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=hme(e);return(0,$.jsx)(r,{...t,ref:n})});IF.displayName=`SelectMultiple`;function gme(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 LF(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,_me(i,...t)]}function _me(...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 RF(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var zF=globalThis?.document?Q.useLayoutEffect:()=>{},vme=Q.useInsertionEffect||zF;function BF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=yme({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=bme(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function yme({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),a=Q.useRef(t);return vme(()=>{a.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function bme(e){return typeof e==`function`}function VF(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 HF(e){let[t,n]=Q.useState(void 0);return zF(()=>{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 xme(e,t){return Q.useReducer((e,n)=>t[e][n]??e,e)}var UF=e=>{let{present:t,children:n}=e,r=Sme(t),i=typeof n==`function`?n({present:r.isPresent}):Q.Children.only(n),a=NE(r.ref,Cme(i));return typeof n==`function`||r.isPresent?Q.cloneElement(i,{ref:a}):null};UF.displayName=`Presence`;function Sme(e){let[t,n]=Q.useState(),r=Q.useRef(null),i=Q.useRef(e),a=Q.useRef(`none`),[o,s]=xme(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Q.useEffect(()=>{let e=WF(r.current);a.current=o===`mounted`?e:`none`},[o]),zF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=WF(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),zF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=WF(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=WF(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 WF(e){return e?.animationName||`none`}function Cme(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 GF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=IE(`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 wme(e,t){e&&EN.flushSync(()=>e.dispatchEvent(t))}var KF=`Checkbox`,[Tme,Eme]=LF(KF),[Dme,qF]=Tme(KF);function Ome(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]=BF({prop:n,defaultProp:i??!1,onChange:c,caller:KF}),[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:!tI(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(Dme,{scope:t,...b,children:kme(d)?d(b):r})}var JF=`CheckboxTrigger`,YF=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}=qF(JF,e),h=NE(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)(GF.button,{type:`button`,role:`checkbox`,"aria-checked":tI(c)?`mixed`:c,"aria-required":l,"data-state":nI(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:RF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:RF(n,e=>{d(e=>tI(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});YF.displayName=JF;var XF=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)(Ome,{__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)(YF,{...d,ref:t,__scopeCheckbox:n}),e&&(0,$.jsx)(eI,{__scopeCheckbox:n})]})})});XF.displayName=KF;var ZF=`CheckboxIndicator`,QF=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=qF(ZF,n);return(0,$.jsx)(UF,{present:r||tI(a.checked)||a.checked===!0,children:(0,$.jsx)(GF.span,{"data-state":nI(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});QF.displayName=ZF;var $F=`CheckboxBubbleInput`,eI=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}=qF($F,e),m=NE(n,p),h=VF(a),g=HF(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=tI(a),n.call(e,!tI(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(!tI(a)&&a);return(0,$.jsx)(GF.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%)`}})});eI.displayName=$F;function kme(e){return typeof e==`function`}function tI(e){return e===`indeterminate`}function nI(e){return tI(e)?`indeterminate`:e?`checked`:`unchecked`}var Ame=Object.freeze([]),rI=Q.forwardRef(({schema:e,name:t,disabled:n,className:r,value:i,onChange:a,onBlur:o,defaultValue:s,validationMode:c,options:l,orientation:u,columns:d,required:f,autoFocus:p},m)=>{let{tErrorValidation:h,tComponent:g,isReady:_}=K({keys:[`errors_validation`],component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_FORM_MESSAGE]}),{renderIcon:v}=Of(),{getRecipe:y}=Rg(),b=y(oc.FORM_CONTROL,Wu.CHECKBOX),x=ja(e),S=x?w_(x):void 0,C=u??S?.edit?.editDirection??`vertical`,w=d??S?.edit?.editColumnsCount??1,T=x?Jo(x):[],E=l??T.map(e=>({value:e,label:e})),[D,O]=Q.useState(s??[]),k=T_(i,a),A=k?i??Ame:D,j=Q.useCallback((e,t)=>{let n=t?[...A,e]:A.filter(t=>t!==e);k?a?.(n):O(n)},[A,k,a]),M=Q.useRef(null),N=Q.useCallback(e=>{M.current=e,typeof m==`function`?m(e):m&&(m.current=e)},[m]),P=Q.useRef(null),F=Q.useCallback(()=>{P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{M.current&&!M.current.contains(document.activeElement)&&o?.()},0)},[o]);Q.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);let I=t??`checkbox-group-field`;return E.length===0?l===void 0?(0,$.jsx)(`div`,{className:`text-sm text-destructive`,children:`CHECKBOX_GROUP requires an array of enum values. No enum options found.`}):_?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g(B.LOW_LEVEL_FORM_FIELD,`noResults`)}):null:_?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{ref:N,role:`group`,className:U(C===`horizontal`?`flex flex-wrap gap-field`:w>1?`grid gap-group`:`flex flex-col gap-group`,r),style:C===`vertical`&&w>1?{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`}:void 0,children:E.map(e=>{let t=A.includes(e.value),r=`${I}-${e.value}`,i=n===!0||e.disabled===!0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(XF,{id:r,checked:t,onCheckedChange:t=>j(e.value,t===!0),onBlur:F,disabled:i,"data-slot":`checkbox`,className:U(`peer size-4 shrink-0 rounded-sm outline-none`,b.base,b.states.focus,b.states.selected,b.states.disabled,b.states.invalid,b.motion.transition),children:(0,$.jsx)(QF,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:v(H.CHECK,{size:ca.SM})})}),(0,$.jsx)(`label`,{htmlFor:r,className:U(`text-sm font-normal cursor-pointer select-none`,i&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:e.label})]},e.value)})})}):null});rI.displayName=`FormFieldCheckboxGroup`;var jme={[vs.SELECT]:!1,[vs.RADIO]:!1,[vs.RADIO_ICON_ONLY]:!0,[vs.TOGGLE]:!1,[vs.TOGGLE_ICON_ONLY]:!0,[vs.CARD]:!1,[vs.CARD_ICON_ONLY]:!0,[vs.COMBOBOX]:!1},Mme={[vs.SELECT]:bc.VERTICAL,[vs.RADIO]:bc.VERTICAL,[vs.RADIO_ICON_ONLY]:bc.HORIZONTAL,[vs.TOGGLE]:bc.HORIZONTAL,[vs.TOGGLE_ICON_ONLY]:bc.HORIZONTAL,[vs.CARD]:bc.VERTICAL,[vs.CARD_ICON_ONLY]:bc.VERTICAL,[vs.COMBOBOX]:bc.VERTICAL},Nme={[Qa.CHECKBOX]:!1,[Qa.SELECT]:!1,[Qa.TOGGLE]:!1,[Qa.TOGGLE_ICON_ONLY]:!0,[Qa.CARD]:!1,[Qa.CARD_ICON_ONLY]:!0,[Qa.COMBOBOX]:!1},Pme={[Qa.CHECKBOX]:bc.VERTICAL,[Qa.SELECT]:bc.VERTICAL,[Qa.TOGGLE]:bc.HORIZONTAL,[Qa.TOGGLE_ICON_ONLY]:bc.HORIZONTAL,[Qa.CARD]:bc.VERTICAL,[Qa.CARD_ICON_ONLY]:bc.VERTICAL,[Qa.COMBOBOX]:bc.VERTICAL},Fme=2,Ime=4,iI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,options:u,placeholder:d,required:f,autoFocus:p,clearable:m,multiple:h,controlSize:g=qd.MD},_)=>{let{renderIcon:v}=Of(),{tComponent:y,isReady:b}=K({component:B.LOW_LEVEL_FORM_FIELD}),x=a??c,S=h===!0||Array.isArray(x),C=(S?ja(e):void 0)??e,w=w_(C),T=tre(C),E=cee(C),D=S?Nme[E]??!1:jme[T]??!1,O=S?Pme[E]:Mme[T],k=w?.edit?.editDirection??O??bc.VERTICAL,A=w?.edit?.editColumnsCount??(D?Ime:Fme),j=w?.values,M=w?.defaultIcon,N=!!(j&&Object.values(j).some(e=>e.icon))||!!M,P=!!(j&&Object.values(j).some(e=>e.color))||!!w?.defaultColor,F=g===qd.SM?`sm`:`md`,I=g===qd.SM?Y.SM:Y.MD,ee=Jo(C)??[],L=u??ee.map(e=>({value:e,label:e})),R=Q.useCallback((e,t)=>{if(typeof e==`string`)return v(e,{size:ca.SM,className:t});let n=rd[ca.SM];return Q.createElement(e,{size:n,className:t})},[v]),z=Q.useCallback(e=>{if(!N)return null;let t=j?.[e]?.icon??M;return t?R(t,`shrink-0`):null},[j,M,N,R]),te=Q.useCallback(e=>{let t=z(e.value);if(D&&t!==null)return(0,$.jsxs)(ej,{children:[(0,$.jsx)(tj,{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)(nj,{children:e.label})]});if(t===null){let t=j?.[e.value]?.color??w?.defaultColor;return!t||D?e.label:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(Yd,Uf[e_(t)])}),e.label]})}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[t,e.label]})},[D,z,j,w?.defaultColor]),ne=Q.useMemo(()=>N||D||P?te:void 0,[N,D,P,te]),[re,ie]=Q.useState(c??(S?[]:``)),ae=T_(a,o),oe=a??re,se=Q.useCallback(e=>{r||(ae?o?.(e):ie(e))},[ae,o,r]),ce=Q.useCallback(()=>{s?.()},[s]),le={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:p,controlSize:g},ue=k===bc.HORIZONTAL?pu.HORIZONTAL:pu.VERTICAL;if(!b)return null;if(S){let t=Array.isArray(oe)?oe:oe?[oe]:[],a=Pn(e),o=a.maxLength!==void 0&&t.length>=a.maxLength,s=a.minLength!==void 0&&t.length<=a.minLength,c=a.minLength===void 0&&a.maxLength===void 0?L:L.map(e=>({...e,disabled:e.disabled===!0||(t.includes(e.value)?s:o)})),l=e=>{a.maxLength!==void 0&&e.length>a.maxLength||a.minLength!==void 0&&e.length<a.minLength&&e.length<t.length||se(e)},u=e=>{l(t.includes(e)?t.filter(t=>t!==e):[...t,e])},m=a.minLength===void 0&&a.maxLength===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-slot":`enum-multiple-bound`,children:[a.minLength!==void 0&&a.maxLength!==void 0?a.minLength===a.maxLength?y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectExactly`,{count:a.minLength}):y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectRange`,{min:a.minLength,max:a.maxLength}):a.minLength===void 0?y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectUpTo`,{count:a.maxLength}):y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectAtLeast`,{count:a.minLength}),` `,`(`,y(B.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectedCount`,{count:t.length}),`)`]}),h=e=>m===null?e:(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-item-sm`,children:[e,m]});switch(E){case Qa.CHECKBOX:return h((0,$.jsx)(rI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}));case Qa.SELECT:return h((0,$.jsx)(IF,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne}));case Qa.TOGGLE:case Qa.TOGGLE_ICON_ONLY:return h((0,$.jsx)(yO,{ref:_,type:gO.MULTIPLE,appearance:_O.CHIPS,value:t,onValueChange:e=>l(Array.isArray(e)?e:e?[e]:[]),disabled:n||r,size:I,orientation:ue,className:i,children:c.map(e=>(0,$.jsx)(bO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:te(e)},e.value))}));case Qa.CARD:case Qa.CARD_ICON_ONLY:return h((0,$.jsx)(kF,{ref:_,"aria-multiselectable":!0,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:c.map(e=>{let i=t.includes(e.value),a=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(OF,{"data-option":e.value,"aria-disabled":a?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,a&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{a||u(e.value)}},selected:i,...a?{tabIndex:-1}:{},children:te(e)},e.value)})}));case Qa.COMBOBOX:return h((0,$.jsx)(mx,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,showSelectAll:!0,emptyMessage:y(B.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0}));default:return h((0,$.jsx)(rI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}))}}switch(T){case vs.SELECT:return(0,$.jsx)(gF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne});case vs.RADIO:case vs.RADIO_ICON_ONLY:return(0,$.jsx)(CF,{ref:_,...le,options:L,value:oe,onValueChange:se,onBlur:ce,orientation:ue,renderOptionLabel:te});case vs.TOGGLE:case vs.TOGGLE_ICON_ONLY:return(0,$.jsx)(yO,{ref:_,type:gO.SINGLE,value:oe,onValueChange:e=>{(e||m)&&se(e)},disabled:n||r,size:I,orientation:ue,className:i,children:L.map(e=>(0,$.jsx)(bO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:te(e)},e.value))});case vs.CARD:case vs.CARD_ICON_ONLY:return(0,$.jsx)(kF,{ref:_,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:L.map(e=>{let t=oe===e.value,i=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(OF,{"data-option":e.value,"aria-disabled":i?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,i&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{i||se(e.value)}},selected:t,...i?{tabIndex:-1}:{},children:te(e)},e.value)})});case vs.COMBOBOX:return(0,$.jsx)(px,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,emptyMessage:y(B.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0,renderSelectedValue:ne});default:return(0,$.jsx)(gF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g})}}),aI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_ENUM,`FormFieldEnum`)(e);return(0,$.jsx)(r,{...t,ref:n})});aI.displayName=`FormFieldEnum`;var oI=`file-validation`,Lme=/received (undefined|null)\b/i,Rme=/expected .+, received (undefined|null)/i;function sI(e){return Lme.test(e)||Rme.test(e)}function cI(e,t,n,r){if(!(e.error?.type===`server`||e.error?.type===`server-unique`||e.isTouched||t||(n===ta.ON_CHANGE||n===ta.ON_TOUCHED)&&e.isDirty)||!e.error)return;if(sI(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 lI({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_CHIPS_INPUT,`ChipsInput`)(e);return(0,$.jsx)(n,{...t})}lI.displayName=`ChipsInput`;var uI=(0,Q.createContext)(!0);function dI(e){let{setValue:t}=UC(),n=zC({name:e}),r=wE(),i=(0,Q.useContext)(uI)?r:null;return{value:n,setValue:(0,Q.useCallback)(n=>{t(e,n,{shouldDirty:!0,shouldTouch:!0}),i?.triggerSave(e,n,au.DEBOUNCE)},[t,e,i])}}function fI(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var zme={activationConstraint:{distance:8}},Bme={coordinateGetter:fF};function pI({listeners:e,attributes:t,disabled:n,ariaLabel:r,renderIcon:i}){return(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:text-muted-foreground hover:bg-accent/50`,Mg(a_.OFFSET),`active:cursor-grabbing`,n&&`pointer-events-none opacity-0`),"aria-label":r,tabIndex:n?-1:0,...t,...e,children:i(H.GRIP_VERTICAL,{size:ca.SM})})}function Vme({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}=uF({id:e,disabled:!s||i}),D={transform:fI(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)(pI,{listeners:S,attributes:x,disabled:i,ariaLabel:d,renderIcon:b}),c&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5 mb-element`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>_(y),disabled:i||o||l,className:`h-5 w-5`,"aria-label":f,children:b(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(y),disabled:i||o||u,className:`h-5 w-5`,"aria-label":p,children:b(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:h?h(t,r):(0,$.jsx)(QL,{name:t,schema:r,label:n,disabled:i})}),a&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>g(y),disabled:i||o,className:`shrink-0 mb-element`,"aria-label":m,children:b(H.DELETE,{size:ca.SM})})]})}var mI=`w-12`,hI=`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 gI({fieldName:e,itemSchema:t,primaryFieldName:n,disabled:r,only:i}){let a=LT(),o=F(t),s=Jr(t);if(!o||s.length===0)return null;if(sd(t))return i===`boolean`?null:(0,$.jsx)(Zw,{formChromeMode:Uc.COMPACT,sectionChromeMode:void 0,children:(0,$.jsx)(QL,{name:e,schema:t,labelPlacement:`hidden`,disabled:r,className:`min-w-0 flex-1`})});let c=s.filter(e=>me(o[e])===_u.BOOLEAN),l=s.filter(e=>me(o[e])!==_u.BOOLEAN),u=i===`boolean`?c:i===`body`?l:[...c,...l];return(0,$.jsx)(Zw,{formChromeMode:Uc.COMPACT,sectionChromeMode:void 0,children:u.map(t=>{let i=`${e}.${t}`,s=a?.fieldLabels?.[hr.labelDictionaryPath(i)]??hr.unresolvedFieldLabel(t);return(0,$.jsx)(QL,{name:i,schema:o[t],label:s,labelPlacement:`hidden`,disabled:r,className:U(`w-auto`,t===n?`min-w-0 flex-1`:`shrink-0`)},t)})})}function Hme({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}=uF({id:e,disabled:!l||o}),k={transform:fI(E),transition:D,opacity:O?.5:void 0,zIndex:O?10:void 0,position:`relative`},A=zC({name:i?`${t}.${i}`:t}),j=typeof A==`string`&&A.trim()!==``?A.trim():typeof A==`number`?String(A):n;return r===Qo.ROW?(0,$.jsxs)(`div`,{ref:T,style:k,className:`group/array-row relative flex items-center gap-element`,children:[l&&!u&&(0,$.jsx)(`div`,{className:U(`absolute -left-5 top-1/2 -translate-y-1/2`,hI),children:(0,$.jsx)(pI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S})}),u&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:ca.XS})})]}),!_&&(0,$.jsx)(`div`,{className:U(`flex shrink-0 items-center`,mI),children:(0,$.jsx)(gI,{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)(gI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`body`})}),s&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(x),disabled:o||c,className:U(`shrink-0`,hI),"aria-label":g,children:S(H.DELETE,{size:ca.SM})})]}):(0,$.jsxs)(`div`,{ref:T,style:k,className:`relative mt-3 rounded-lg border border-border p-card`,children:[(0,$.jsxs)(`div`,{className:`absolute -top-3 start-card-sm z-10 flex max-w-[calc(100%-4.5rem)] items-center gap-1 overflow-hidden bg-background px-card-sm text-sm font-medium text-muted-foreground`,children:[l&&(0,$.jsx)(pI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S}),u&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),s&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON,onClick:()=>v(x),disabled:o||c,className:`absolute -top-3 end-3 z-10 h-6 w-6 bg-background`,"aria-label":g,children:S(H.CLOSE,{size:ca.SM})}),(0,$.jsx)(`div`,{className:`pt-item`,children:_?_(t,a):(0,$.jsx)(QL,{name:t,schema:a,label:n,hideLabel:!0,disabled:o})})]})}function Ume({primaryField:e,itemSchema:t,onAdd:n,disabled:r,addLabel:i,placeholder:a,leadingGutterClassName:o}){let{renderIcon:s}=Of(),{resolvedRegionalPreferences:c}=K(),l=c?.timezone,u=me(e.schema)===_u.NUMBER,[d,f]=(0,Q.useState)(``),p=d.trim(),m=u?Number(p):p,h=!r&&p!==``&&e.schema.safeParse(m).success,g=(0,Q.useCallback)(()=>{if(r)return;let i=d.trim();if(i===``)return;let a=u?Number(i):i;e.schema.safeParse(a).success&&(n(e.name===null?a:{...hr.getDefaultValueForSchema(t,{timeZone:l}),[e.name]:a}),f(``))},[r,d,u,e,t,n,l]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,"data-testid":`array-quick-add-row`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},children:[o&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`shrink-0`,o)}),(0,$.jsx)(eN,{type:u?`number`:`text`,value:d,onChange:e=>f(e.target.value),placeholder:a??i,disabled:r,wrapperClassName:`flex-1`,"aria-label":i}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:g,disabled:!h,"aria-label":i,children:s(H.PLUS,{size:ca.SM})})]})}function Wme({name:e,schema:t,label:n,description:r,disabled:i,className:a,renderField:o,addLabel:c,itemLabel:l,reorderable:u=!0,sectionAppearance:d,chromeMode:f,hideLabel:p=!1,objectItemLayout:m,enumLabels:h,allowedValues:g}){let{control:_,getFieldState:v,getValues:b,formState:x,trigger:S}=UC(),C=LM(e),{renderIcon:w}=Of(),{tComponent:T,tErrorValidation:E,isReady:D,resolvedRegionalPreferences:O}=K({component:B.LOW_LEVEL_FORM_MESSAGE,keys:[`errors_validation`]}),k=O?.timezone,{getRecipe:A}=Rg(),j=A(oc.TYPOGRAPHY,y.DESCRIPTION),{formChromeMode:M,sectionChromeMode:N}=Qw(),P=pc(),F=Yc(t),I=F?.chromeMode??f??N??M??GL(P.autoRender?.autoFieldChrome),ee=KL(P.autoRender?.autoLabelPlacement),L=qL(P.autoRender?.autoFieldDensity),R=P.autoRender?.autoErrorPlacement===`summary-at-surface-top`,z=wE(),te=(0,Q.useContext)(uI)?z:null,ne=te?t=>te.triggerSave(e,t,au.BLUR):void 0,re=c??T(B.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),ie=l??T(B.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`),ae=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayEmptyMessage`),oe=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(oe.current=!0,()=>{oe.current=!1}),[]);let[se,ce]=(0,Q.useState)(!1),{fields:le,append:ue,remove:de,move:fe}=Mw({control:_,name:e}),pe=ja(t),he=Pn(t),ge=pe?me(pe):`unknown`,_e=g!==void 0&&ge===_u.STRING,ve=ge===_u.ENUM||_e,ye=ga(t)?.edit,be=m??ga(t)?.objectItemLayout??Qo.CARD,xe=ye?.isSortable,Se=xe==null||!!xe&&ye?.dnd!==!1,Ce=xe?ye?.upDownIcons??!1:!1,we=u&&Se&&!i&&le.length>1,Te=eP($N(MP,zme),$N(OP,Bme)),Ee=(0,Q.useMemo)(()=>le.map(e=>e.id),[le]),De=he.maxLength===void 0||le.length<he.maxLength,Oe=he.minLength===void 0||le.length>he.minLength,ke=(0,Q.useCallback)(()=>{ce(!0),setTimeout(async()=>{if(oe.current&&(await S(e),oe.current&&(ce(!1),te))){let t=b(e);te.triggerSave(e,t,au.DEBOUNCE)}},0)},[S,e,te,b]),Ae=(0,Q.useCallback)(()=>{if(!De||i||se)return;let e=hr.getDefaultValueForSchema(pe,{timeZone:k});ue(e),ke()},[De,i,se,pe,ue,ke,k]),je=(0,Q.useCallback)(e=>{!De||i||se||(ue(e),ke())},[De,i,se,ue,ke]),Me=(0,Q.useCallback)(e=>{!Oe||i||se||(de(e),ke())},[Oe,i,se,de,ke]),Ne=(0,Q.useCallback)(e=>{e>0&&!i&&!se&&(fe(e,e-1),ke())},[fe,i,se,ke]),Pe=(0,Q.useCallback)(e=>{e<le.length-1&&!i&&!se&&(fe(e,e+1),ke())},[le.length,fe,i,se,ke]),Fe=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=le.findIndex(e=>e.id===t.id),r=le.findIndex(e=>e.id===n.id);e!==-1&&r!==-1&&(fe(e,r),ke())}},[le,fe,ke]);if(!pe||!D)return null;if(ve){let o=F?.validationMode??ta.ON_BLUR,s=!_e&&g!==void 0?Jo(pe).filter(e=>g.includes(e)):void 0,c=_e?g.map(e=>({value:e,label:h?.[e]??e})):s?s.map(e=>({value:e,label:h?.[e]??e})):h?Jo(pe).map(e=>({value:e,label:h[e]??e})):void 0;return(0,$.jsx)(VC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:l})=>(0,$.jsx)(qM,{mode:I,label:n,description:r,error:cI(l,x.isSubmitted,o,E),labelPlacement:ee,hideError:R,saveState:te?.getFieldState(e),saveErrorMessage:te?.getFieldStateInfo(e).lastError,onRetrySave:te?()=>te.retryFieldSave(e):void 0,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(aI,{multiple:!0,schema:t,options:c,name:e,disabled:i,value:Array.isArray(s.value)?s.value:[],onChange:t=>{C.noteInputReceived(),s.onChange(t),te?.triggerSave(e,t,au.DEBOUNCE)},onBlur:()=>{C.handleFieldBlur(s.onBlur)},controlSize:L})})})}if(ge===_u.STRING&&ga(t)?.display?.listStyle===s.CHIPS){let t=F?.validationMode??ta.ON_BLUR,o=e=>{let n=pe.safeParse(e);if(n.success)return;let r=n.error.issues[0];return cI({isTouched:!0,error:{type:r?.code??`custom`,message:r?.message,params:r?hT(r):void 0}},!0,t,E)};return(0,$.jsx)(VC,{name:e,control:_,shouldUnregister:!0,render:({field:s,fieldState:c})=>(0,$.jsx)(qM,{mode:I,label:n,description:r,error:cI(c,x.isSubmitted,t,E),labelPlacement:ee,hideError:R,saveState:te?.getFieldState(e),saveErrorMessage:te?.getFieldStateInfo(e).lastError,onRetrySave:te?()=>te.retryFieldSave(e):void 0,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(lI,{id:`field-${e}`,value:Array.isArray(s.value)?s.value.filter(e=>typeof e==`string`):[],onChange:t=>{C.noteInputReceived(),s.onChange(t),te?.triggerSave(e,t,au.DEBOUNCE)},onBlur:()=>{C.handleFieldBlur(s.onBlur)},validateItem:o,maxItems:he.maxLength,disabled:i,invalid:!!c.error,controlSize:L})})})}let Ie=te?.getFieldStateInfo(e),Le=te&&Ie&&Ie.state!==tT.IDLE?(0,$.jsx)(UM,{state:Ie.state,errorMessage:Ie.lastError,onRetry:()=>te.retryFieldSave(e),position:`inline`,size:`sm`,className:`ms-element align-middle`}):null,Re=v(e,x),ze=Re.error?.root?.message||Re.error?.message,Be=!(!ze||R),Ve=hr.resolveArrayAddMode(t,pe),He=hr.getArrayItemPrimaryField(pe),Ue=Ve===Wee.QUICK_ADD?He:null,We=ge!==`object`&&ge!==`array`,Ge=(0,$.jsxs)($.Fragment,{children:[Be&&(0,$.jsx)(`p`,{id:`${e}-error`,className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:ze}),(0,$.jsxs)(DT,{className:U(be===Qo.ROW?void 0:`space-y-field`),style:be===Qo.ROW?{rowGap:`var(--spacing-element)`}:void 0,children:[(0,$.jsx)($P,{sensors:Te,collisionDetection:sP,onDragEnd:Fe,children:(0,$.jsx)(cF,{items:Ee,strategy:aF,children:le.map((t,n)=>{let r=`${e}.${n}`,a=`${ie} ${n+1}`,s=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayDragHandle`,{label:a}),c=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayMoveUp`,{label:a}),l=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayMoveDown`,{label:a}),u=T(B.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:a});return We?(0,$.jsx)(Vme,{id:t.id,fieldName:r,fieldLabel:a,itemSchema:pe,disabled:i,canRemove:Oe,isValidating:se,reorderable:we,showUpDownIcons:Ce,isFirst:n===0,isLast:n===le.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:Me,onMoveUp:Ne,onMoveDown:Pe,index:n,renderIcon:w},t.id):(0,$.jsx)(Hme,{id:t.id,fieldName:r,fieldLabel:a,layout:be,primaryFieldName:He.name,itemSchema:pe,disabled:i,canRemove:Oe,isValidating:se,reorderable:we,showUpDownIcons:Ce,isFirst:n===0,isLast:n===le.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:Me,onMoveUp:Ne,onMoveDown:Pe,index:n,renderIcon:w},t.id)})})}),De&&Ue?(0,$.jsx)(Ume,{primaryField:Ue,itemSchema:pe,onAdd:je,disabled:i||se,addLabel:re,leadingGutterClassName:be===Qo.ROW&&!We?o?`w-7`:mI:void 0}):De?(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,onClick:Ae,disabled:i||se,className:`w-full`,children:[w(H.PLUS,{size:ca.SM,className:`me-element`}),re]}):null,le.length===0&&(i||!De)&&(0,$.jsx)(`p`,{className:U(j.base,`text-center py-card`),children:ae})]})]});if(I===Uc.SETTINGS_ROW&&d===void 0)return(0,$.jsx)(qM,{mode:Uc.SETTINGS_ROW,label:n,description:r,labelPlacement:ee,onSaveFieldNow:ne,fieldName:e,disabled:i,className:a,error:ze,hideError:!0,hideLabel:p,wideControl:!0,children:(0,$.jsxs)(`div`,{id:`field-${e}`,role:`group`,"aria-labelledby":n&&!p?`field-${e}-label`:void 0,"aria-label":n&&p?n:void 0,className:`flex flex-col`,style:{rowGap:`var(--spacing-element)`},"data-testid":`field-array-${e}`,"aria-describedby":Be?`${e}-error`:void 0,children:[Le,Ge]})});let Ke=!p&&(d===cr.CARD||d===cr.COLLAPSIBLE),qe=d!==cr.COLLAPSIBLE;return(0,$.jsxs)(ET,{appearance:d??cr.GHOST,legend:Ke?(0,$.jsxs)($.Fragment,{children:[n,qe&&Le]}):void 0,description:Ke?r:void 0,disabled:i,className:U(a,ze&&`border-destructive`),"data-field":e,"data-testid":`field-array-${e}`,"aria-invalid":!!ze,"aria-describedby":Be?`${e}-error`:void 0,children:[Ke?!qe&&Le:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xD,{children:(0,$.jsx)(OT,{className:`sr-only`,children:n})}),Le]}):(0,$.jsx)(xD,{children:(0,$.jsxs)(OT,{children:[n,Le]})}),!Ke&&r&&!p&&(0,$.jsx)(dx,{children:r}),(0,$.jsx)(OE,{fieldName:e,label:n,disabled:i,onSaveFieldNow:ne,children:Ge})]})}function _I(e){let t=wE(),n=t!==null&&EE(Yc(e.schema)?.autosave,t.config.defaultTrigger,!0)!==au.NONE;return(0,$.jsx)(uI.Provider,{value:n,children:(0,$.jsx)(Wme,{...e})})}_I.displayName=`AutomatedArrayField`;var vI=_I,yI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldEdit_ResourceReference`,Ii.EDIT)(e);return(0,$.jsx)(r,{...t,ref:n})});yI.displayName=`ResourceFieldEdit_ResourceReference`;function Gme(e,t){let n=e?.resourceReferenceTargets;if(n)return n[t]??[]}function Kme(e,t){if(t)return e?.resourceType===t?e:{resourceType:t}}function qme(e,t){return e?.resourceType?t?{resourceType:e.resourceType,resourceId:t}:{resourceType:e.resourceType}:e}function Jme(e,t,n){let r=e.map(e=>({value:e,label:n(e)}));return t&&!e.includes(t)&&r.unshift({value:t,label:n(t)}),r}var Yme=[oi.RESOURCES];function bI(e,t){return F(lr(e))?.[t]??e}var xI=Q.forwardRef(({types:e,value:t,onChange:n,schema:r,name:i,...a},o)=>{let{tComponent:s,tResourceHeader:c}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,keys:Yme}),l=Q.useMemo(()=>Jme(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)(gF,{ref:o,...a,schema:bI(r,`resourceType`),name:`${i}.resourceType`,options:l,value:t?.resourceType||void 0,onChange:e=>n?.(Kme(t,e)),placeholder:s(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,l.length>0?`selectTypePlaceholder`:`noTypesAvailable`)}),t?.resourceType?(0,$.jsx)(yI,{...a,schema:bI(r,`resourceId`),name:`${i}.resourceId`,targetResourceType:t.resourceType,value:t.resourceId,onChange:e=>n?.(qme(t,Array.isArray(e)?e[0]:e))}):null]})});xI.displayName=`FormFieldResourceReference`;var SI=Xs(B.LOW_LEVEL_SWITCH,`Switch`,[`Root`]),CI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=SI(e);return(0,$.jsx)(r,{...t,ref:n})});CI.displayName=`Switch`;var wI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=SI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});wI.displayName=`SwitchRoot`;var TI=Xs(B.LOW_LEVEL_CHECKBOX,`Checkbox`,[`Root`]),EI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=TI(e);return(0,$.jsx)(r,{...t,ref:n})});EI.displayName=`Checkbox`;var DI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=TI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});DI.displayName=`CheckboxRoot`;var OI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_TOGGLE_GROUP_BOOLEAN,`ToggleGroupBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});OI.displayName=`ToggleGroupBoolean`;var kI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,checked:a,onCheckedChange:o,onBlur:s,defaultChecked:c,validationMode:l,autoFocus:u,controlSize:d},f)=>{let{tComponent:p,isReady:m}=K({component:B.LOW_LEVEL_FORM_FIELD_BOOLEAN}),h=Hne(e),g=Br(e),_=h?.labellingValue??`yes/no`,[v,y]=Q.useState(c??!1),b=T_(a,o),x=a??v,S=Q.useCallback(e=>{r||(b?o?.(e):y(e))},[b,o,r]),C=Q.useCallback(()=>{s?.()},[s]),w={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:u,controlSize:d},T=typeof _==`object`&&!!_&&_.mode===`custom`,[E,D]=T?[void 0,void 0]:_.split(`/`),O=()=>T?_.trueValue:p(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,E),k=()=>T?_.falseValue:p(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,D);if(!m)return null;switch(g){case $s.TOGGLE:return(0,$.jsx)(OI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case $s.SWITCH:return(0,$.jsx)(CI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case $s.CHECKBOX:return(0,$.jsx)(EI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case $s.RADIO:let e=[{value:`true`,label:O()},{value:`false`,label:k()}];return(0,$.jsx)(CF,{ref:f,...w,options:e,value:x?`true`:`false`,onValueChange:e=>S(e===`true`),onBlur:C});default:return(0,$.jsx)(CI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C})}}),AI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,`FormFieldBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});AI.displayName=`FormFieldBoolean`;var jI=Xs(B.LOW_LEVEL_TEXTAREA,`Textarea`,[`Root`]),MI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=jI(e);return(0,$.jsx)(r,{...t,ref:n})});MI.displayName=`Textarea`;var NI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=jI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});NI.displayName=`TextareaRoot`;function PI({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_MARKDOWN_EDITOR,`MarkdownEditor`)(e);return(0,$.jsx)(n,{...t})}PI.displayName=`MarkdownEditor`;var FI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_COLOR_INPUT,`ColorInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});FI.displayName=`ColorInput`;var II=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,disabled:i,readOnly:a,className:o,autoFocus:s,controlSize:c=qd.MD,clearable:l,labelledBy:u,controlId:d,monthPlaceholder:f},p)=>{let{tComponent:m,resolvedRegionalPreferences:h}=K({component:B.LOW_LEVEL_FORM_FIELD_STRING}),g=Pt(t),[_,v]=Q.useState(g?.month),[y,b]=Q.useState(String(g?g.year:new Date().getUTCFullYear()));Q.useEffect(()=>{let e=Pt(t);e?(v(e.month),b(String(e.year))):(t===void 0||t===``)&&(v(void 0),b(String(new Date().getUTCFullYear())))},[t]);let x=Q.useRef(null),S=Q.useCallback(e=>{x.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),C=Q.useMemo(()=>Al.monthNames(h),[h]),w=(e,r)=>{if(e===void 0||!/^\d{4}$/.test(r))return;let i=qi(Number(r),e);i!==t&&n?.(i)},T=()=>{let e=Pt(t);e&&!/^\d{4}$/.test(y)&&b(String(e.year)),r?.()},E=i||a,D=l===!0&&Pt(t)!==void 0;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,o),role:`group`,"aria-labelledby":u??`field-${e}-label`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(_F,{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)(vF,{ref:S,id:d??`field-${e}`,size:c,className:`w-full`,"aria-label":m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonth`),autoFocus:s,children:(0,$.jsx)(bF,{placeholder:f??m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonthPlaceholder`)})}),(0,$.jsx)(yF,{children:C.map((e,t)=>(0,$.jsx)(xF,{value:String(t+1),textValue:e,children:e},t+1))})]})}),(0,$.jsx)(`div`,{className:`w-28 shrink-0`,children:(0,$.jsx)(eN,{type:`number`,inputMode:`numeric`,min:1,max:9999,step:1,name:`${e}.year`,controlSize:c,"aria-label":m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthYear`),value:y,disabled:i,readOnly:a,onChange:e=>{let t=e.target.value;b(t),w(_,t)},onBlur:T})}),D&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:c===qd.SM?Y.SM:Y.MD,disabled:E,onClick:()=>{n?.(``),x.current?.focus()},children:m(B.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthClear`)})]})});II.displayName=`YearMonthInput`;var LI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_PASSWORD_INPUT,`PasswordInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});LI.displayName=`PasswordInput`;var RI=Xs(B.LOW_LEVEL_INPUT_OTP,`InputOTP`,[`Group`,`Slot`,`Separator`]),zI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=RI(e);return(0,$.jsx)(r,{...t,ref:n})});zI.displayName=`InputOTP`;function BI({preset:e=q.DEFAULT,...t}){let n=RI(e);return(0,$.jsx)(n.Group,{...t})}function VI({preset:e=q.DEFAULT,...t}){let n=RI(e);return(0,$.jsx)(n.Slot,{...t})}function Xme({preset:e=q.DEFAULT,...t}){let n=RI(e);return(0,$.jsx)(n.Separator,{...t})}function Zme(e,t){let n=e?.organizationRoles;if(!n||n.length===0)return;let r=e?.organizationTypes;return!t||!r?n:n.filter(e=>wo(r,t,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=[oi.ROLES],HI=Q.forwardRef(({roles:e,value:t,onChange:n,clearable:r,...i},a)=>{let{tComponent:o,tRole:s}=K({component:B.LOW_LEVEL_FORM_FIELD_STRING,keys:$me}),c=Q.useMemo(()=>Qme(e,t,e=>s(e,`label`)),[e,t,s]),l=(0,$.jsx)(gF,{ref:a,...i,options:c,value:t||void 0,onChange:e=>n?.(e),placeholder:o(B.LOW_LEVEL_FORM_FIELD_STRING,`organizationRolePlaceholder`)});return!r||!t?l:(0,$.jsxs)(`span`,{className:`flex items-center gap-element`,children:[l,(0,$.jsx)(X,{type:`button`,variant:J.GHOST,disabled:i.disabled||i.readOnly,onClick:()=>n?.(``),children:o(B.LOW_LEVEL_FORM_FIELD_STRING,`organizationRoleClear`)})]})});HI.displayName=`FormFieldStringOrganizationRole`;function ehe(){let{appConfig:e}=Tu(),{organizations:t,currentOrganizationId:n}=sg(),r=t.find(e=>e._id===n)?.type;return Zme(e,r)}function the(e){if(e.roleTable===yr.ANOTHER_ORGANIZATION)return e.offeredRoles;if(e.table)return e.offeredRoles?e.table.filter(t=>e.offeredRoles.includes(t)):e.table}var UI=Q.forwardRef(({fallback:e,roleTable:t=yr.CURRENT_ORGANIZATION,offeredRoles:n,...r},i)=>{let a=the({table:ehe(),roleTable:t,offeredRoles:n});return a?(0,$.jsx)(HI,{ref:i,roles:a,...r}):(0,$.jsx)($.Fragment,{children:e})});UI.displayName=`FormFieldStringOrganizationRoleOrFallback`;var WI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,autoComplete:d,autoFocus:f,controlSize:p=qd.MD,type:m,clearable:h,offeredValues:g},_)=>{let v=m??`text`,y=qt(e);Fte(e);let b=xt(e),x=y?.edit?.textareaRows??4,[S,C]=Q.useState(c??``),w=T_(a,o),T=a??S,E=Q.useCallback(e=>{w?o?.(e):C(e)},[w,o]),D=Q.useCallback(()=>{s?.()},[s]),O={schema:e,name:t,disabled:n,readOnly:r,className:i,validationMode:l,autoFocus:f,controlSize:p};switch(b){case z.INPUT:return(0,$.jsx)($M,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});case z.TEXTAREA:return(0,$.jsx)(MI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,rows:x,autoComplete:d});case z.MARKDOWN:return(0,$.jsx)(PI,{value:T,onChange:E,onBlur:D,placeholder:u,disabled:n,readOnly:r,autoFocus:f,minRows:x,ariaLabel:t,className:i});case z.COLOR:return(0,$.jsx)(FI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u});case z.YEAR_MONTH:return(0,$.jsx)(II,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h});case z.PASSWORD:return(0,$.jsx)(LI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d});case z.OTP:{let r=vee(e)?.maxLength??6;return(0,$.jsx)(zI,{ref:_,name:t,className:i,maxLength:r,value:T,onChange:E,onBlur:D,disabled:n,autoComplete:d,autoFocus:f,controlSize:p,children:(0,$.jsx)(BI,{children:Array.from({length:r},(e,t)=>(0,$.jsx)(VI,{index:t},t))})})}case z.ORGANIZATION_ROLE:{let e=(0,$.jsx)($M,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});return(0,$.jsx)(UI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h,fallback:e,roleTable:y?.edit?.organizationRoleTable??yr.CURRENT_ORGANIZATION,...g?{offeredRoles:g}:{}})}default:return(0,$.jsx)($M,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v})}}),GI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_STRING,`FormFieldString`)(e);return(0,$.jsx)(r,{...t,ref:n})});GI.displayName=`FormFieldString`;var KI=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=qd.MD},_)=>{let{renderIcon:v}=Of(),y=g===qd.SM?Y.ICON_SM:Y.ICON;Ze(e);let b=$r(e),x=gt(e),S=f??x.min,C=p??x.max,w=d??x.step??1,[T,E]=Q.useState(c??0),D=T_(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 ac.INPUT:return(0,$.jsx)($M,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C});case ac.SLIDER:return(0,$.jsx)(YM,{ref:_,...P,value:[O],onValueChange:e=>A(e[0]),onBlur:j,min:S??0,max:C??100,step:w,showValue:!0});case ac.STEPPER:let e=t??`stepper-field`;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:y,onClick:N,disabled:n||S!==void 0&&O<=S,children:v(H.MINUS,{size:ca.SM})}),(0,$.jsx)(eN,{ref:_,id:e,type:`number`,value:k,onChange:e=>{let t=e.target.value;if(t===``)A(h?``:S??0);else{let e=parseFloat(t);isNaN(e)||A(e)}},onBlur:j,disabled:n,readOnly:r,min:S,max:C,step:w,className:`w-20 text-center`,autoFocus:m,controlSize:g}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:y,onClick:M,disabled:n||C!==void 0&&O>=C,children:v(H.PLUS,{size:ca.SM})})]});default:return(0,$.jsx)($M,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C})}}),qI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_NUMBER,`FormFieldNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});qI.displayName=`FormFieldNumber`;var JI=Q.forwardRef(({controlSize:e,className:t,wrapperClassName:n,children:r,disabled:i,...a},o)=>{let{getRecipe:s,fieldVariant:c}=Rg(),{renderIcon:l}=Of(),u=s(oc.FORM_CONTROL,Ig(c));return(0,$.jsxs)(`div`,{"data-slot":`native-select`,className:U(`relative flex`,n),children:[(0,$.jsx)(`select`,{ref:o,disabled:i,"data-size":e,className:U(`w-full cursor-pointer rounded-md bg-transparent text-sm disabled:cursor-default`,u.base,u.states.focus,u.states.disabled,e?u.sizes?.[e]:void 0,u.motion.transition,`appearance-none pe-8`,t),...a,children:r}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 end-0 flex items-center pe-3 text-muted-foreground`,children:l(H.CHEVRON_DOWN,{size:ca.SM,className:`opacity-[var(--opacity-muted)]`})})]})});JI.displayName=`ThemedNativeSelect`;function nhe(e,t,n){return fe(e,t).map(e=>{let t=Ra[e],r=n(e);return{value:e,label:`${t.symbol} ${r}`}}).sort((e,t)=>{let n=Ra[e.value],r=Ra[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var YI=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=qd.MD},h)=>{let{tSystemEnum:g,tComponent:_,isReady:v}=K({component:B.LOW_LEVEL_FORM_FIELD_MONEY,keys:[`system_enums`]}),{getRecipe:y,fieldVariant:b}=Rg(),x=y(oc.FORM_CONTROL,Ig(b)),S=Q.useCallback(e=>g(Uo.AVAILABLE_CURRENCY,e),[g]),C=Me(e),w=C?.currenciesAllowed,T=C?.appEnabledOnly??!0,E=C?.allowCurrencyChange??!0,D=Q.useMemo(()=>nhe(w,T,S),[w,T,S]),O=Q.useCallback(e=>Xa(e)?.decimals??2,[]),k=Q.useCallback(()=>dae(e),[e]),[A,j]=Q.useState(c??k()),M=T_(a,o),N=a??A,P=Q.useMemo(()=>N.amount===0n?``:Qt(N.amount,N.decimals).toFixed(N.decimals),[N.amount,N.decimals]),F=Q.useCallback(e=>{let t=e.target.value;if(!t||t===``){if(M&&p){o?.(void 0);return}let e={...N,amount:0n};M?o?.(e):j(e);return}let n=Ji(t,N.decimals);if(n===null)return;let r={...N,amount:n};M?o?.(r):j(r)},[N,M,o,p]),I=Q.useCallback(e=>{let t=O(e),n={amount:te(N.amount,N.decimals,t),currency:e,decimals:t};M?o?.(n):j(n)},[N,M,o,O]),ee=Q.useCallback(()=>{s?.()},[s]),L=`field-${t}`,R=Xa(N.currency)?.symbol??N.currency;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(eN,{ref:h,id:L,type:`number`,step:10**-N.decimals,min:C?.minAmount===void 0?void 0:Qt(C.minAmount,N.decimals),max:C?.maxAmount===void 0?void 0:Qt(C.maxAmount,N.decimals),value:P,onChange:F,onBlur:ee,disabled:n,readOnly:r,placeholder:u??`0.00`,prefix:R,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:f,controlSize:m}),E?(0,$.jsx)(JI,{value:N.currency,onChange:e=>I(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-32`,"aria-label":_(B.LOW_LEVEL_FORM_FIELD_MONEY,`currency`),children:D.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,x.sizes?.[m]),children:S(N.currency)})]})}),XI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_MONEY,`FormFieldMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});XI.displayName=`FormFieldMoney`;var rhe=[pl.SECONDS,pl.MINUTES,pl.HOURS,pl.DAYS,pl.WEEKS],ZI=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=qd.MD},m)=>{let{tSystemEnum:h,tComponent:g,isReady:_}=K({component:B.LOW_LEVEL_FORM_FIELD_DURATION,keys:[`system_enums`]}),v=xre(e),y=v?.allowedUnits&&v.allowedUnits.length>0?v.allowedUnits:rhe,b=v?.minValue,x=v?.maxValue,S=Q.useCallback(e=>h(Uo.DURATION_UNIT,e),[h]),C=Q.useCallback(()=>rte(e),[e]),[w,T]=Q.useState(c??C()),E=T_(a,o),D=a??w,O=D.value===0?``:String(D.value),k=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===void 0){if(E&&f){o?.(void 0);return}let e={...D,value:0};E?o?.(e):T(e);return}let n=parseInt(t,10);if(Number.isNaN(n)||n<0)return;let r={...D,value:n};E?o?.(r):T(r)},[D,E,o,f]),A=Q.useCallback(e=>{let t={...D,unit:e};E?o?.(t):T(t)},[D,E,o]),j=Q.useCallback(()=>{s?.()},[s]),M=`field-${t}`;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(eN,{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)(JI,{value:D.unit,onChange:e=>A(e.target.value),disabled:n||r,controlSize:p,wrapperClassName:`w-32`,"aria-label":g(B.LOW_LEVEL_FORM_FIELD_DURATION,`unit`),children:y.map(e=>(0,$.jsx)(`option`,{value:e,children:S(e)},e))})]})});ZI.displayName=`FormFieldDuration_Preset_Default`;var QI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_DURATION,`FormFieldDuration`)(e);return(0,$.jsx)(r,{...t,ref:n})});QI.displayName=`FormFieldDuration`;var $I=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_INPUT_GROUP,`InputGroup`)(e);return(0,$.jsx)(r,{...t,ref:n})});$I.displayName=`InputGroup`;function eL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_ADDON,`InputGroupAddon`)(e);return(0,$.jsx)(n,{...t})}function tL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_BUTTON,`InputGroupButton`)(e);return(0,$.jsx)(n,{...t})}function ihe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_TEXT,`InputGroupText`)(e);return(0,$.jsx)(n,{...t})}function nL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_INPUT,`InputGroupInput`)(e);return(0,$.jsx)(n,{...t})}function rL({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INPUT_GROUP_TEXTAREA,`InputGroupTextarea`)(e);return(0,$.jsx)(n,{...t})}var ahe=`US`;function ohe(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 she(e){let t;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{t=void 0}let n=new Intl.Collator(e);return pi().map(e=>({code:e,name:t?.of(e)??e,dialCode:R(e)})).sort((e,t)=>n.compare(e.name,t.name))}function che(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 lhe(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 iL=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=qd.MD},p)=>{let{tComponent:m,currentLanguage:h}=K({component:[B.LOW_LEVEL_FORM_FIELD_PHONE]}),g=Eee(e)?.defaultCountry??ahe,_=Q.useMemo(()=>she(h),[h]),[v,y]=Q.useState(g),[b,x]=Q.useState(``),S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(null),T=Q.useRef(``),E=Q.useCallback(e=>{w.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),D=a??c??``;Q.useEffect(()=>{if(D===S.current)return;if(S.current=D,C.current=null,!D.trim()){x(``),T.current=``;return}let e=ea(D,g),t=e?e.formatNational():D;e?.country&&y(e.country),x(t),T.current=t},[D,g]),Q.useLayoutEffect(()=>{let e=C.current;C.current=null;let t=w.current;if(e===null||!t||document.activeElement!==t)return;let n=lhe(t.value,e);t.setSelectionRange(n,n)},[b]);let O=Q.useCallback((e,t)=>{let n=t.replace(/\D/g,``);if(!n)return``;let r=ea(n,e);return r?r.format(`E.164`):`+${R(e)}${n}`},[]),k=Q.useCallback((e,t)=>{let n=O(e,t);S.current=n,o?.(n)},[o,O]),A=Q.useCallback(e=>{let t=e.target.value;y(t);let n=T.current.replace(/\D/g,``),r=n?mn(n,t):``;x(r),T.current=r,n&&k(t,r)},[k]),j=Q.useCallback(e=>{let t=e.target.value,n=e.target.selectionStart??t.length;if(t.trim().startsWith(`+`)){let e=yt(t);if(e){let n=R(e),r=t.replace(/\D/g,``),i=r.startsWith(n)?r.slice(n.length):r,a=O(e,i),s=ea(a),c=s?s.formatNational():mn(i,e);y(e),x(c),T.current=c,C.current=null,S.current=a,o?.(a);return}x(t),T.current=t;let n=`+${t.replace(/\D/g,``)}`;S.current=n,o?.(n);return}let r=T.current,i=t.length===r.length-1,a=i?t:mn(t,v);C.current=i?null:che(t,n),x(a),T.current=a,k(v,a)},[v,k,o,O]),M=Q.useCallback(()=>{s?.()},[s]),N=Q.useMemo(()=>l||oae(v)||``,[l,v]),P=R(v),F=`field-${t}`,I=m(B.LOW_LEVEL_FORM_FIELD_PHONE,`country`);return(0,$.jsxs)($I,{className:U(`w-full`,i),"data-disabled":n||void 0,"data-size":f,children:[(0,$.jsxs)(`div`,{className:`relative flex shrink-0 items-stretch self-stretch border-e border-border`,children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,className:U(`pointer-events-none flex select-none items-center gap-1.5 ps-3 pe-2 text-sm text-muted-foreground`,n&&`opacity-[var(--opacity-disabled)]`),children:[(0,$.jsx)(`span`,{className:`text-base leading-none`,children:ohe(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)(nL,{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`})]})});iL.displayName=`FormFieldPhone_Preset_Default`;var aL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_PHONE,`FormFieldPhone`)(e);return(0,$.jsx)(r,{...t,ref:n})});aL.displayName=`FormFieldPhone`;var oL=[{part:Dr.LINE1,autoComplete:`address-line1`},{part:Dr.LINE2,autoComplete:`address-line2`},{part:Dr.CITY,autoComplete:`address-level2`},{part:Dr.STATE,autoComplete:`address-level1`},{part:Dr.POSTAL_CODE,autoComplete:`postal-code`}];function sL(e,t){return{[Dr.LINE1]:e?.line1??``,[Dr.LINE2]:e?.line2??``,[Dr.CITY]:e?.city??``,[Dr.STATE]:e?.state??``,[Dr.POSTAL_CODE]:e?.postalCode??``,[Dr.COUNTRY]:e?.country??t??``,[vr.LATITUDE]:e?.coordinates?String(e.coordinates.latitude):``,[vr.LONGITUDE]:e?.coordinates?String(e.coordinates.longitude):``}}function cL(e){return e.trim()===``?NaN:Number(e)}function uhe(e){let t=oL.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:cL(e.latitude),longitude:cL(e.longitude)}}}}function dhe(e,t){let n;try{n=new Intl.DisplayNames([e],{type:`region`})}catch{n=void 0}let r=new Intl.Collator(e);return(t&&t.length>0?[...t]:pi()).map(e=>({code:e,name:n?.of(e)??e})).sort((e,t)=>r.compare(e.name,t.name))}var lL=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=qd.MD},m)=>{let{tComponent:h,currentLanguage:g}=K({component:[B.LOW_LEVEL_FORM_FIELD_ADDRESS]}),_=nie(e),v=_?.defaultCountry,y=_?.withCoordinates===!0,b=a??c,[x,S]=Q.useState(()=>sL(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=sL(b,v);C.current=e,S(e)},[T,v]);let E=Q.useMemo(()=>dhe(g,_?.countriesAllowed),[g,_?.countriesAllowed]),D=Q.useCallback(e=>{C.current=e,S(e);let t=uhe(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(sL(n,v))},[D,v,k]),j=Q.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||s?.()},[s]),M=`field-${t}`,N=e=>e===Dr.LINE1?M:`${M}-${e.replace(`.`,`-`)}`,P=(e,t,n)=>{let r=N(e),i=d?.[e],a=`${r}-error`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(cx,{htmlFor:r,className:`text-sm text-muted-foreground`,children:t}),n({id:r,...i&&{"aria-invalid":!0,"aria-describedby":a}}),i&&(0,$.jsx)(fx,{id:a,children:i})]},e)},F=({part:e,autoComplete:i})=>P(e,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e),a=>(0,$.jsx)(eN,{...a,ref:e===Dr.LINE1?m:void 0,name:`${t}.${e}`,type:`text`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,autoComplete:i,autoFocus:e===Dr.LINE1?l:void 0,controlSize:p})),I=e=>P(`coordinates.${e}`,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,e),i=>(0,$.jsx)(eN,{...i,name:`${t}.coordinates.${e}`,type:`number`,step:`any`,inputMode:`decimal`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,className:`tabular-nums`,controlSize:p})),[ee,L,R,z,te]=oL,ne=E.some(e=>e.code===x.country);return(0,$.jsxs)(`div`,{className:U(`flex w-full flex-col gap-element`,i),role:`group`,"aria-labelledby":`${M}-label`,onBlur:j,children:[f?.({..._?.countriesAllowed&&_.countriesAllowed.length>0&&{countriesAllowed:_.countriesAllowed},...v!==void 0&&{defaultCountry:v},disabled:k,applyAddress:A}),F(ee),F(L),(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[F(R),F(te)]}),F(z),P(Dr.COUNTRY,h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,Dr.COUNTRY),e=>(0,$.jsxs)(JI,{...e,name:`${t}.${Dr.COUNTRY}`,value:x.country,onChange:e=>O(Dr.COUNTRY,e.target.value),disabled:n||r,autoComplete:`country`,controlSize:p,wrapperClassName:`w-full`,children:[x.country===``&&(0,$.jsx)(`option`,{value:``,disabled:!0,children:h(B.LOW_LEVEL_FORM_FIELD_ADDRESS,`countryPlaceholder`)}),x.country!==``&&!ne&&(0,$.jsx)(`option`,{value:x.country,children:x.country}),E.map(e=>(0,$.jsx)(`option`,{value:e.code,children:e.name},e.code))]})),y&&(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[I(vr.LATITUDE),I(vr.LONGITUDE)]})]})});lL.displayName=`FormFieldAddress_Preset_Default`;var uL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_ADDRESS,`FormFieldAddress`)(e);return(0,$.jsx)(r,{...t,ref:n})});uL.displayName=`FormFieldAddress`;var dL;(function(e){e.MAIN_SCHEMA=`main-schema`,e.PATCH_REQUEST_DTO=`patch-request-dto`,e.VALUE_OBJECT=`value-object`})(dL||={});var fhe={[dL.MAIN_SCHEMA]:{isClearable:Uie,normalizeClearedValue:Si},[dL.PATCH_REQUEST_DTO]:{isClearable:Re,normalizeClearedValue:ye},[dL.VALUE_OBJECT]:{isClearable:Zee,normalizeClearedValue:ku}};function phe({schemaKind:e,rootSchema:t,fieldName:n}){if(e===eT.MAIN_SCHEMA)return dL.MAIN_SCHEMA;if(!t)return dL.PATCH_REQUEST_DTO;let r=n.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).slice(0,-1).join(`.`),i=r?hr.resolveFieldSchemaPath(t,r):t;return i?Ri(i)?dL.PATCH_REQUEST_DTO:dL.VALUE_OBJECT:dL.PATCH_REQUEST_DTO}var fL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:o,onChange:s,onBlur:c,defaultValue:l,validationMode:u,placeholder:d,step:f,min:p,max:m,required:h,autoFocus:g,controlSize:_=qd.MD},v)=>{let{formatNumber:y,isReady:b}=K({component:B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL}),{renderIcon:x}=Of(),S=_===qd.SM?Y.ICON_SM:Y.ICON,C=a(e),w=Ze(e),T=C?.edit?.editMode??w?.edit?.editMode??ac.INPUT,E=Va(e),D=p??E.min,O=m??E.max,k=E.precision,A=f??(k===void 0?`1`:new Qn(1).div(new Qn(10).pow(k)).toString()),j=a(e)?.edit?.defaultValue,[M,N]=Q.useState(l??j??`0`),P=T_(o,s),F=o??M,I=Q.useMemo(()=>{try{return parseFloat(F)}catch{return 0}},[F]),ee=Q.useCallback(e=>{P?s?.(e):N(e)},[P,s]),L=Q.useCallback(()=>{c?.()},[c]),R=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`||t===`-.`)P?s?.(t):N(t);else try{new Qn(t),ee(t)}catch{/^-?\d*\.?\d*$/.test(t)&&(P?s?.(t):N(t))}},[P,s,ee]),z=()=>{try{let e=new Qn(F||`0`),t=new Qn(A),n=e.plus(t);(O===void 0||n.lte(new Qn(O)))&&ee(n.toString())}catch{ee(A)}},te=()=>{try{let e=new Qn(F||`0`),t=new Qn(A),n=e.minus(t);(D===void 0||n.gte(new Qn(D)))&&ee(n.toString())}catch{ee(new Qn(A).neg().toString())}},ne=Q.useCallback(e=>{let t=e[0];ee(k===void 0?t.toString():t.toFixed(k))},[ee,k]);switch(T){case ac.INPUT:return(0,$.jsx)(eN,{ref:v,id:t,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:d,className:U(`tabular-nums`,i),autoFocus:g,controlSize:_});case ac.SLIDER:let e=D?parseFloat(D):0,a=O?parseFloat(O):100,o=parseFloat(A);return(0,$.jsxs)(`div`,{ref:v,className:U(`flex items-center gap-field`,i),children:[(0,$.jsx)(XM,{value:[I],onValueChange:ne,onValueCommit:()=>L(),min:e,max:a,step:o,disabled:n,className:`flex-1`,controlSize:_}),(0,$.jsx)(`span`,{className:`min-w-[4rem] text-end text-sm tabular-nums`,children:y(I)})]});case ac.STEPPER:let s=t??`stepper-field`,c=D!==void 0&&(()=>{try{return new Qn(F||`0`).lte(new Qn(D))}catch{return!1}})(),l=O!==void 0&&(()=>{try{return new Qn(F||`0`).gte(new Qn(O))}catch{return!1}})();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:S,onClick:te,disabled:n||r||c,children:x(H.MINUS,{size:ca.SM})}),(0,$.jsx)(eN,{ref:v,id:s,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,className:`w-24 text-center tabular-nums`,autoFocus:g,controlSize:_}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:S,onClick:z,disabled:n||r||l,children:x(H.PLUS,{size:ca.SM})})]});default:return(0,$.jsx)(eN,{ref:v,id:t,type:`text`,inputMode:`decimal`,value:F,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:d,className:U(`tabular-nums`,i),autoFocus:g,controlSize:_})}}),pL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,`FormFieldBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});pL.displayName=`FormFieldBigDecimal`;var mL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_CODE,`FormFieldCode`)(e);return(0,$.jsx)(r,{...t,ref:n})});mL.displayName=`FormFieldCode`;var hL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,fromPlaceholder:u=`From`,toPlaceholder:d=`To`,fromLabel:f=`From`,toLabel:p=`To`,required:m,autoFocus:h,controlSize:g=qd.MD},_)=>{let{tComponent:v,isReady:y}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL}),b=jt(e),x=Va(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=T_(a,o),j=a??O,M=Q.useMemo(()=>{if(j.from==null||j.to==null)return!1;let e=parseFloat(j.from),t=parseFloat(j.to);return isNaN(e)||isNaN(t)?!1:e>t},[j.from,j.to]),N=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,from:t};A?o?.(n):k(n)},[A,o,j]),P=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,to:t};A?o?.(n):k(n)},[A,o,j]),F=Q.useCallback(()=>{s?.()},[s]),I=t??`range-bigdecimal-field`,ee=`${I}-from`,L=`${I}-to`;return y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(eN,{ref:_,id:ee,type:`text`,inputMode:`decimal`,value:j.from??``,onChange:N,onBlur:F,disabled:n,readOnly:r,placeholder:u,"aria-invalid":M,"aria-required":!T,min:S,max:C,step:D,className:`tabular-nums`,autoFocus:h,controlSize:g})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:p}),(0,$.jsx)(eN,{id:L,type:`text`,inputMode:`decimal`,value:j.to??``,onChange:P,onBlur:F,disabled:n,readOnly:r,placeholder:d,"aria-invalid":M,"aria-required":!E,min:S,max:C,step:D,className:`tabular-nums`,controlSize:g})]})]}),M&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:v(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),gL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,`FormFieldRangeBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});gL.displayName=`FormFieldRangeBigDecimal`;function mhe(e,t){let n=Object.keys(Ra);return t&&(n=Yee()),n=n.filter(t=>Oa(t,e)),n.map(e=>({value:e,label:`${Ra[e].symbol} ${e}`})).sort((e,t)=>{let n=Ra[e.value],r=Ra[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var _L=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=qd.MD},h)=>{let{tComponent:g,isReady:_}=K({component:B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY}),{getRecipe:v,fieldVariant:y}=Rg(),b=v(oc.FORM_CONTROL,Ig(y)),x=Me(e),S=Bie(e),C=jt(e),w=x?.currenciesAllowed,T=x?.appEnabledOnly??!0,E=S?.edit?.defaultCurrency??`USD`,D=x?.allowCurrencyChange??!0,O=x?.minAmount,k=x?.maxAmount,A=C?.fromOptional??!0,j=C?.toOptional??!0,M=Q.useMemo(()=>mhe(w,T),[w,T]),N=Q.useCallback(e=>Xa(e)?.decimals??2,[]);Q.useCallback(()=>{let e=N(E);return{amount:0n,currency:E,decimals:e}},[E,N]);let[P,F]=Q.useState(c??{from:void 0,to:void 0}),[I,ee]=Q.useState(c?.from?.currency??c?.to?.currency??E),L=T_(a,o),R=a??P,z=N(I),ne=Q.useMemo(()=>!R.from||!R.to||R.from.amount===0n&&R.to.amount===0n?!1:Qt(R.from.amount,R.from.decimals)>Qt(R.to.amount,R.to.decimals),[R.from,R.to]),re=Q.useMemo(()=>!R.from||R.from.amount===0n?``:Qt(R.from.amount,R.from.decimals).toFixed(R.from.decimals),[R.from]),ie=Q.useMemo(()=>!R.to||R.to.amount===0n?``:Qt(R.to.amount,R.to.decimals).toFixed(R.to.decimals),[R.to]),ae=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Ji(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,from:n};L?o?.(r):F(r)},[R,I,z,L,o]),oe=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Ji(t,z);e!==null&&(n={amount:e,currency:I,decimals:z})}let r={...R,to:n};L?o?.(r):F(r)},[R,I,z,L,o]),se=Q.useCallback(e=>{let t=N(e);ee(e);let n,r;R.from&&R.from.amount!==0n&&(n={amount:te(R.from.amount,R.from.decimals,t),currency:e,decimals:t}),R.to&&R.to.amount!==0n&&(r={amount:te(R.to.amount,R.to.decimals,t),currency:e,decimals:t});let i={from:n,to:r};L?o?.(i):F(i)},[R,N,L,o]),ce=Q.useCallback(()=>{s?.()},[s]),le=t??`range-money-field`,ue=`${le}-from`,de=`${le}-to`,fe=Xa(I)?.symbol??I;return _?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(eN,{ref:h,id:ue,type:`number`,step:10**-z,value:re,onChange:ae,onBlur:ce,disabled:n,readOnly:r,placeholder:u,prefix:fe,wrapperClassName:`flex-1`,className:U(`tabular-nums`,ne&&`border-destructive`),"aria-invalid":ne,"aria-required":!A,min:O===void 0?void 0:Qt(O,z),max:k===void 0?void 0:Qt(k,z),autoFocus:p,controlSize:m}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsx)(eN,{id:de,type:`number`,step:10**-z,value:ie,onChange:oe,onBlur:ce,disabled:n,readOnly:r,placeholder:d,prefix:fe,wrapperClassName:`flex-1`,className:U(`tabular-nums`,ne&&`border-destructive`),"aria-invalid":ne,"aria-required":!j,min:O===void 0?void 0:Qt(O,z),max:k===void 0?void 0:Qt(k,z),controlSize:m}),D?(0,$.jsx)(JI,{value:I,onChange:e=>se(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-24`,"aria-label":g(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`currency`),children:M.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.value},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,b.sizes?.[m]),children:I})]}),ne&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:g(B.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),vL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`FormFieldRangeMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});vL.displayName=`FormFieldRangeMoney`;var yL=class extends Error{};function bL(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 yL(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 hhe(e){let t=Date.now()+(e.timeoutMs??12e4),n=e.metadata;for(;;){if(e.signal.throwIfAborted(),n&&n.fileId!==e.fileId||n&&!Object.values(Li).includes(n.readiness))throw new yL(e.unverifiedMessage);if(n?.readiness===Li.READY)return n;if(n&&n.readiness!==Li.PROCESSING)throw new yL(e.unavailableMessage);if(e.onPending(),!e.getMetadata||Date.now()>=t)throw new yL(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 bL(e.getMetadata,e.signal,t-Date.now(),e.unverifiedMessage)}catch{throw e.signal.throwIfAborted(),new yL(e.unverifiedMessage)}}}function xL(e,t){return t||(!e||typeof e!=`object`?ta.ON_BLUR:g(e)?ta.ON_CHANGE:ta.ON_BLUR)}function ghe(e){return e.issues[0]?.code??`unknown`}function SL(e){let t={};for(let[n,r]of Object.entries(e))n!==`code`&&n!==`message`&&n!==`path`&&(t[n]=r);return t}function _he(e){let t=Ms(e.schema);return t?{allowedMimeTypes:t.allowedMimeTypes,maxSize:t.maxSize,maxFiles:t.maxFiles}:{}}var vhe={[Ou.IMAGE]:`accepted_type_image`,[Ou.VIDEO]:`accepted_type_video`,[Ou.AUDIO]:`accepted_type_audio`,[Ou.PDF]:`accepted_type_pdf`,[Ou.OFFICE]:`accepted_type_office`,[Ou.ARCHIVE]:`accepted_type_archive`,[Ou.ALL]:`accepted_types_all`},yhe={[ic.TEXT]:`accepted_type_text`,[ic.MARKDOWN]:`accepted_type_markdown`,[ic.JSON]:`accepted_type_json`,[ic.TYPESCRIPT]:`accepted_type_typescript`,[ic.TYPESCRIPT_JSX]:`accepted_type_typescript_react`,[ic.YAML]:`accepted_type_yaml`};function CL(e,t){let n=e=>t(B.LOW_LEVEL_FORM_FIELD_FILE,e);return e.length===0?n(`accepted_types_all`):e.map(e=>{switch(e.category){case Eu.NATURE:return n(vhe[e.nature]);case Eu.AGENT_FORMAT:return n(yhe[e.format]);case Eu.MIME_SUBTYPE:return e.subtype.toUpperCase()}}).join(`, `)}var wL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_IMAGE_CROP,`ImageCrop`)(e);return(0,$.jsx)(r,{...t,ref:n})});wL.displayName=`ImageCrop`;function TL(e){return!(!e.type.startsWith(`image/`)||e.type===`image/svg+xml`)}async function EL(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 DL(e,t,n,r){return Math.max(n/e,r/t)}function OL(e,t,n,r){let i=Math.max(0,(t*n-r)/2);return Math.min(i,Math.max(-i,e))}function kL(e){let{naturalWidth:t,naturalHeight:n,viewportWidth:r,viewportHeight:i,transform:a}=e,o=DL(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 AL=`image/png`,jL=`image/jpeg`,ML=`image/webp`,NL=[AL,jL,ML],bhe={[AL]:`png`,[jL]:`jpg`,[ML]:`webp`},xhe=[.92,.85,.78,.7,.6,.5];function PL(e){return NL.some(t=>Lr(t,e))}function She(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function FL(e,t){return`${e.replace(/\.[^./\\]+$/,``)}.${t}`}async function IL(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=NL.filter(e=>Lr(e,s)),m=[];p.includes(r.type)&&r.type!==jL&&m.push(r.type);for(let e of[AL,ML,jL])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],FL(r.name,bhe[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===jL&&(f.save(),f.globalCompositeOperation=`destination-over`,f.fillStyle=`#ffffff`,f.fillRect(0,0,l,u),f.restore());let t=e===AL?[void 0]:xhe;for(let n of t){let t=await She(d,e,n);if(!t)continue;let r=_(t);if(r)return r;if(e===AL)break}}if(!g)throw Error(`image_encode_failed`);return h(g)}function Che(e){return e!=null&&`fileId`in e}function LL(e){return e!=null&&`fileIds`in e}var whe=0;function RL(){return`upload-${Date.now()}-${++whe}`}function zL(e){return e instanceof Error?e.code===`ERR_CANCELED`||e.name===`AbortError`:!1}function BL(e,t){return t&&e.override?e.override:e.upload}function The(e,t){return!!BL(e,t)}function VL(e){return!!e.upload}function Ehe(e,t){return e&&e.trim()!==``?e:t}function HL(e,t){return t instanceof yL?t.message:e}var UL=Q.forwardRef(({schema:e,name:t,value:n,onChange:r,onBlur:i,defaultValue:a,disabled:o=!1,readOnly:s,className:c,validationMode:l,endpoints:u,uploadButtonText:d,replaceButtonText:f,onValidationError:p,required:m,httpOperations:h},g)=>{let{t:_,tErrorValidation:v,tComponent:y,tResourceFieldEnumValue:b,isReady:x,formatByteSize:S}=K({component:B.LOW_LEVEL_FORM_FIELD_FILE,keys:[`errors_validation`,`system_enums`]}),{frontendProviderRegistry:C}=Tu(),{renderIcon:w}=Of(),{getRecipe:T}=Rg(),E=T(oc.FORM_CONTROL,Wu.DEFAULT),D=d??y(B.LOW_LEVEL_FORM_FIELD_FILE,`choose_file`),O=f??y(B.LOW_LEVEL_FORM_FIELD_FILE,`replace`),k=y(B.LOW_LEVEL_FORM_FIELD_FILE,`drag_and_drop`),A=y(B.LOW_LEVEL_FORM_FIELD_FILE,`remove`),j=y(B.LOW_LEVEL_FORM_FIELD_FILE,`upload_failed`),M=y(B.LOW_LEVEL_FORM_FIELD_FILE,`metadata_load_failed`),N=y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploads_unavailable`),P=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),F=Ms(e),I=_he({schema:e}),ee=I.allowedMimeTypes,L=I.maxSize,R=F?.minSize,z=F?.overridable??!0,te=ee?ste(ee):void 0,ne=F?.multiple??!1,re=I.maxFiles,ie=F?.imageConstraints,ae=F?.videoConstraints,oe=F?.audioConstraints,se=F?.documentConstraints,ce=xL(e,l),[le,ue]=Q.useState(a??null),[de,fe]=Q.useState(),pe=Q.useRef(n);Q.useEffect(()=>{pe.current!==void 0&&n==null&&de&&fe(void 0),pe.current=n},[n,de]);let[me,he]=Q.useState(new Map),ge=Q.useRef(me);ge.current=me;let[_e,ve]=Q.useState(0),[ye,be]=Q.useState(new Map),[xe,Se]=Q.useState(!1),Ce=Q.useRef(new Set),we=Q.useRef(0),[Te,Ee]=Q.useState(new Set),De=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_processing`),Oe=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_unavailable`),ke=y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_readiness_unverified`),Ae=Q.useCallback(()=>{we.current+=1;for(let e of Ce.current)e.abort();for(let e of ge.current.values())e.abortController.abort();Ce.current.clear()},[]),je=Q.useRef(null),Me=T_(n,r),Ne=n??le,Pe=Array.from(me.values()).some(e=>e.status===`uploading`),Ie=Che(Ne)?Ne.fileId:null,Le=LL(Ne)?Ne.fileIds:[],Re=ne?VL(u):The(u,Ie),ze=Q.useRef(Le);ze.current=Le;let Be=Q.useMemo(()=>Le.join(`,`),[Le]),Ve=Q.useRef(ye);Ve.current=ye;let He=Ie?ye.get(Ie)??null:null,Ue=Ie?[Ie]:Le,We=Ue.some(e=>ye.get(e)?.readiness===Li.UNAVAILABLE)?Oe:Ue.some(e=>![Li.READY,Li.ATTACHED].includes(ye.get(e)?.readiness))?De:void 0,Ge=Array.from(me.values()).find(e=>e.status===`error`)?.error,Ke=Pe||Te.size>0?De:Ge??We;Q.useEffect(()=>{p?.(de??Ke)},[de,Ke,p]);let qe=Q.useCallback(async e=>h.get(e),[h]),Je=Q.useCallback(async e=>h.delete(e),[h]);Q.useEffect(()=>()=>Ae(),[u.getMetadata,u.upload,u.override,h,qe,Ae]);let Ye=Q.useRef({endpoint:u.getMetadata,get:qe});Q.useEffect(()=>{let e=Ie?[Ie]:Le,t=Ye.current.endpoint!==u.getMetadata||Ye.current.get!==qe;if(Ye.current={endpoint:u.getMetadata,get:qe},t&&(Ve.current=new Map,be(new Map)),e.length===0){be(new Map),fe(e=>e===M?void 0:e);return}let n=!1,r=new AbortController,i,a=async()=>{let t=!1,o=!1,s=new Map;await Promise.all(e.map(async e=>{let n=Ve.current.get(e);if(!(n&&[Li.READY,Li.ATTACHED,Li.UNAVAILABLE].includes(n.readiness))){if(!u.getMetadata)o=!0;else try{let n=await bL(()=>qe(`${u.getMetadata}/${encodeURIComponent(e)}/metadata`),r.signal,12e4,M);if(n.fileId!==e||!Object.values(Li).includes(n.readiness))throw Error(`Invalid file metadata`);s.set(e,n),n.readiness===Li.PROCESSING&&(t=!0)}catch{o=!0,t=!0,console.warn(`Unable to load file metadata for one or more files.`)}}})),n||(be(e=>{let t=new Map(e);for(let[e,n]of s)t.set(e,n);return t}),fe(e=>o?M:e===M?void 0:e),t&&(i=setTimeout(a,2e3)))};return a(),()=>{n=!0,r.abort(),i&&clearTimeout(i)}},[Ie,Be,u.getMetadata,qe,M]);let Xe=Q.useCallback(async(e,t)=>{let n=new AbortController,r=()=>n.abort();t?.aborted&&n.abort(),t?.addEventListener(`abort`,r,{once:!0}),Ce.current.add(n);try{let t=await hhe({...e,signal:n.signal,getMetadata:u.getMetadata?()=>qe(`${u.getMetadata}/${encodeURIComponent(e.fileId)}/metadata`):void 0,onPending:()=>Ee(t=>new Set(t).add(e.fileId)),unavailableMessage:Oe,unverifiedMessage:ke});return n.signal.throwIfAborted(),{fileId:e.fileId,metadata:t}}finally{t?.removeEventListener(`abort`,r),Ce.current.delete(n),Ee(t=>{let n=new Set(t);return n.delete(e.fileId),n})}},[qe,u.getMetadata,Oe,ke]),Ze=Q.useCallback(e=>{if(ee&&ee.length>0&&!Lr(e.type,ee)){let e=CL(Fe(ee),y);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_type_not_allowed`,{accepted:e})}},[ee,y]),Qe=Q.useCallback(e=>{let t=Ze(e);if(t)return t;if(L&&e.size>L){let e=S(L);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_too_large`,{max:e})}if(R&&e.size<R){let e=S(R);return y(B.LOW_LEVEL_FORM_FIELD_FILE,`file_too_small`,{min:e})}},[Ze,L,R,y,S]),$e=Q.useCallback(async(e,t,n,r,i,a)=>{let o=new FormData;o.append(`file`,e),n&&r&&o.append(`fileId`,r);let s=()=>h.upload(t,o,{onProgress:i,signal:a}),c=a?await bL(s,a,void 0,ke):await s();return a?.throwIfAborted(),Xe(c,a)},[h,Xe,ke]),et=Q.useCallback(async t=>{Ae();let n=we.current,i=BL(u,Ie);if(!i){fe(N);return}let a=Qe(t);if(a){fe(a);return}let o=RL(),s=new AbortController;he(new Map([[o,{tempId:o,fileName:t.name,progress:0,status:`uploading`,abortController:s}]])),ve(0),p?.(De),fe(void 0);try{let a=await $e(t,i,!!Ie,Ie,e=>{ve(e),he(t=>{let n=new Map(t),r=n.get(o);return r&&n.set(o,{...r,progress:e}),n})},s.signal);if(n!==we.current)return;let c={fileId:a.fileId,updatedAt:new Date};if(Me||ue(c),r?.(c),a.metadata&&be(e=>{let t=new Map(e);return t.set(a.fileId,a.metadata),t}),ce!==`onSubmit`){let t=e.safeParse(c);if(!t.success){let e=t.error.issues[0];if(e){let t={...SL(e),message:e.message},n=v(e.code,`msg`,t);fe(n)}}}}catch(e){if(s.signal.aborted||n!==we.current||zL(e))return;fe(HL(j,e))}finally{he(e=>{let t=new Map(e);return t.delete(o),t}),ve(0)}},[Ie,u,Me,r,N,Qe,ce,e,v,$e,Ae,p,De,j]),tt=Q.useCallback(async e=>{let t=we.current;if(!VL(u)){fe(N);return}let n=ze.current.length;if(re&&n+e.length>re){fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`too_many_files`,{max:re}));return}let i=[];for(let t of e){let e=Qe(t);if(e){fe(e);return}i.push(t)}p?.(De),fe(void 0);let a=new Map,o=[];for(let e of i){let t=RL(),n=new AbortController;a.set(t,{tempId:t,fileName:e.name,progress:0,status:`uploading`,abortController:n}),o.push({tempId:t,file:e,abortController:n})}he(e=>{let t=new Map;for(let[n,r]of e)r.status===`uploading`&&t.set(n,r);for(let[e,n]of a)t.set(e,n);return t});let s=await Promise.allSettled(o.map(async({tempId:e,file:n,abortController:r})=>{try{let t=await $e(n,u.upload,!1,null,t=>{he(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,progress:t}),r})},r.signal);return he(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,status:`done`,fileId:t.fileId,progress:100}),r}),t.metadata&&be(e=>{let n=new Map(e);return n.set(t.fileId,t.metadata),n}),t.fileId}catch(n){throw r.signal.aborted||t!==we.current||zL(n)?(he(t=>{let n=new Map(t);return n.delete(e),n}),n):(he(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,status:`error`,error:HL(j,n)}),r}),n)}})),c=[];for(let e of s)e.status===`fulfilled`&&c.push(e.value);if(c.length>0&&t===we.current){let e=[...ze.current,...c];ze.current=e;let t={fileIds:e,updatedAt:new Date};Me||ue(t),r?.(t)}he(e=>{let t=new Map(e);for(let[e,n]of t)n.status===`done`&&t.delete(e);return t})},[u,Me,re,r,y,$e,Qe,j,N,p,De]),nt=ie?.aspectRatio,rt=ane(e)?.display?.preview?.shape,[it,at]=Q.useState(null),ot=Q.useCallback(e=>{at(null),et(e)},[et]),st=Q.useCallback(()=>{at(null)},[]),ct=Q.useCallback(e=>{at(null),et(e)},[et]),lt=Q.useCallback(e=>{if(e.length!==0){if(ne)tt(e);else{let t=e[0];if(nt&&TL(t)&&PL(ee)){let e=Ze(t);if(e){fe(e);return}fe(void 0),at(t);return}et(t)}}},[ne,tt,et,nt,Ze,ee]),ut=Q.useCallback(async(e,t)=>{ne||Ae();let n=we.current,i=ne?t:t.slice(0,1),a=ne?u.upload:BL(u,Ie);if(!a){fe(N);return}p?.(De),fe(void 0);let o=await Promise.allSettled(i.map(async t=>{let n=RL();Ee(e=>new Set(e).add(n));let r=new AbortController;Ce.current.add(r);try{let n=await bL(()=>h.linkRemoteReference(a,{remoteReference:{providerRef:e,externalId:t.externalId,...t.displayName===void 0?{}:{displayName:t.displayName},...t.mimeType===void 0?{}:{mimeType:t.mimeType},...t.sizeBytes===void 0?{}:{sizeBytes:t.sizeBytes}}}),r.signal,12e4,ke);r.signal.throwIfAborted();let i=await Xe(n,r.signal);return i.metadata&&be(e=>{let t=new Map(e);return t.set(i.fileId,i.metadata),t}),i.fileId}finally{Ce.current.delete(r),Ee(e=>{let t=new Set(e);return t.delete(n),t})}})),s=o.flatMap(e=>e.status===`fulfilled`?[e.value]:[]);if(s.length>0&&n===we.current){let e=ne?{fileIds:[...ze.current,...s],updatedAt:new Date}:{fileId:s[0],updatedAt:new Date};LL(e)&&(ze.current=e.fileIds),Me||ue(e),r?.(e)}if(s.length<i.length&&n===we.current){let e=o.find(e=>e.status===`rejected`);fe(HL(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_link_failed`),e?.status===`rejected`?e.reason:void 0))}},[Ie,u,h,Me,ne,r,N,y,Xe,Ae,p,De,ke]),dt=Q.useCallback(async(e,t)=>{ne||Ae();let n=we.current,r=new AbortController,i=RL();Ce.current.add(r),p?.(De),Ee(e=>new Set(e).add(i));try{let i=[],a=[],o=!1;for(let e of t)if(e.kind===ud.BROWSER_READABLE_FILE)i.push(e.file);else if(e.kind===ud.BROWSER_READABLE_URL)try{let t=await bL(()=>fetch(e.url,{signal:r.signal}),r.signal,12e4,ke);if(!t.ok){o=!0;continue}let n=await bL(()=>t.blob(),r.signal,12e4,ke);i.push(new File([n],e.displayName??`file`,{type:e.mimeType??n.type}))}catch{if(r.signal.aborted||n!==we.current)return;o=!0}else a.push(e);if(r.signal.aborted||n!==we.current)return;if(a.length>0){await ut(e,a);return}if(o&&i.length===0){fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`));return}if(i.length===0)return;fe(o?y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`):void 0),lt(i)}finally{Ce.current.delete(r),Ee(e=>{let t=new Set(e);return t.delete(i),t})}},[lt,ut,y,ne,Ae,p,De,ke]),ft=Q.useCallback(()=>{fe(y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_picker_failed`))},[y]),pt=Q.useCallback(e=>{let t=e.target.files;t&&t.length>0&&lt(Array.from(t)),je.current&&(je.current.value=``)},[lt]),mt=o||s,ht=mt||!Re,gt=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),!ht&&!Pe&&Se(!0)},[ht,Pe]),_t=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),Se(!1)},[]),vt=Q.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),Se(!1),ht||Pe)return;let t=e.dataTransfer.files;t&&t.length>0&&lt(Array.from(t))},[ht,Pe,lt]),yt=Q.useCallback(async()=>{if(Ae(),Ie){if(u.delete)try{let e=`${u.delete}/${encodeURIComponent(Ie)}`;await Je(e)}catch(e){if(zL(e))return;fe(HL(j,e));return}fe(void 0),Me||ue(null),r?.(null),be(e=>{let t=new Map(e);return t.delete(Ie),t})}},[Ie,u,Me,r,Je,j]),bt=Q.useCallback(async e=>{if(Ae(),u.delete)try{let t=`${u.delete}/${encodeURIComponent(e)}`;await Je(t)}catch(e){if(zL(e))return;fe(HL(j,e));return}fe(void 0);let t=ze.current.filter(t=>t!==e);ze.current=t;let n=t.length>0?{fileIds:t,updatedAt:new Date}:null;Me||ue(n),r?.(n),be(t=>{let n=new Map(t);return n.delete(e),n})},[u,Me,r,Je,j]),xt=Q.useCallback(e=>{let t=ge.current.get(e);t&&t.abortController.abort(),he(t=>{let n=new Map(t);return n.delete(e),n})},[]),St=Q.useCallback(()=>{!ht&&!Pe&&je.current?.click()},[ht,Pe]),Ct=e=>e?e.startsWith(`image/`)?H.FILE_IMAGE:e.startsWith(`video/`)?H.FILE_VIDEO:e.startsWith(`audio/`)?H.FILE_AUDIO:e===`application/pdf`?H.FILE_TEXT:e.includes(`spreadsheet`)||e.includes(`excel`)?H.FILE_SPREADSHEET:e.includes(`presentation`)||e.includes(`powerpoint`)?H.FILE_PRESENTATION:e.includes(`document`)||e.includes(`word`)?H.FILE_TEXT:e.includes(`zip`)||e.includes(`rar`)||e.includes(`7z`)?H.FILE_ARCHIVE:H.FILE:H.FILE,wt=(e,t=ca.MD)=>w(Ct(e),{size:t}),Tt=CL(Fe(ee),y),Et=F?.nature,Dt=(e,t=!1)=>mt?null:(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,t?`flex-shrink-0`:``),children:[!t&&z&&Re&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,onClick:St,disabled:Pe,children:O}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:e,disabled:Pe,className:U(`text-destructive hover:text-destructive`,t&&`h-6 w-6 p-0`),"aria-label":A,title:A,children:w(H.CLOSE,{size:ca.SM})})]}),Ot=(e,t,n=!1)=>(0,$.jsxs)(`div`,{className:U(`min-w-0`,n?``:`flex-1`),children:[(0,$.jsx)(`div`,{className:`flex items-center gap-element`,children:t?.url?(0,$.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:U(`font-medium text-primary hover:underline truncate`,n&&`text-sm`),children:t.filename}):(0,$.jsx)(`span`,{className:U(`font-medium truncate`,n&&`text-sm`),children:Ehe(t?.filename,P)})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group text-xs text-muted-foreground mt-0.5`,children:[t?.size!==void 0&&(0,$.jsx)(`span`,{children:S(t.size)}),t?.mimeType&&(0,$.jsx)(`span`,{className:`uppercase`,children:t.extension||t.mimeType.split(`/`).pop()}),t?.width&&t?.height&&(0,$.jsxs)(`span`,{children:[t.width,`×`,t.height]})]})]}),kt=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`relative`,children:(0,$.jsx)(`img`,{src:e.url||e.thumbnailUrl||``,alt:e.filename,className:`w-full max-h-64 object-contain bg-checkerboard`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]})]}),At=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`video`,{src:e.url,controls:!0,className:`w-full max-h-64 bg-black`,poster:e.thumbnailUrl,preload:`metadata`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]})]}),V=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(e.mimeType,ca.MD)}),Ot(``,e),Dt(yt)]}),(0,$.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]}),jt=(e,t)=>{if(t&&![Li.READY,Li.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0}),!t)return(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(void 0,ca.LG)}),Ot(e,null),Dt(yt)]});let n=yc(Et,t.mimeType);return n===yo.IMAGE&&(t.url||t.thumbnailUrl)?kt(t):n===yo.VIDEO&&t.url?At(t):n===yo.AUDIO&&t.url?V(t):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t.mimeType,ca.LG)}),Ot(e,t),Dt(yt)]})},Mt=(e,t)=>{t&&![Li.READY,Li.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0});let n=yc(Et,t?.mimeType),r=()=>bt(e);return n===yo.IMAGE&&t&&(t.url||t.thumbnailUrl)?(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`img`,{src:t.thumbnailUrl||t.url||``,alt:t.filename,className:`h-12 w-12 rounded object-cover flex-shrink-0`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t,!0)}),Dt(r,!0)]},e):n===yo.AUDIO&&t?.url?(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t.mimeType,ca.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t,!0)}),Dt(r,!0)]}),(0,$.jsx)(`audio`,{src:t.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]},e):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:wt(t?.mimeType,ca.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t??null,!0)}),Dt(r,!0)]},e)},Nt=()=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[Le.map(e=>{let t=ye.get(e);return Mt(e,t)}),Array.from(me.values()).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border border-primary/20 bg-primary/5`,children:[e.status===`uploading`&&(0,$.jsx)($y,{size:20,className:`text-primary flex-shrink-0`,"aria-hidden":`true`}),e.status===`error`&&(0,$.jsx)(`span`,{className:`text-destructive flex-shrink-0`,"aria-hidden":`true`,children:w(H.WARNING,{size:ca.MD})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-medium text-sm truncate block`,children:e.fileName}),e.status===`uploading`&&(0,$.jsx)(`div`,{className:`w-full h-1 bg-muted rounded-full mt-1 overflow-hidden`,children:e.progress<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${e.progress}%`}})}),e.status===`error`&&e.error&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:e.error})]}),(e.status===`uploading`||e.status===`error`)&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>xt(e.tempId),className:`text-muted-foreground hover:text-destructive h-6 w-6 p-0`,"aria-label":y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),title:y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),children:w(H.CLOSE,{size:ca.SM})})]},e.tempId))]}),Pt=e=>{if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)} min`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${t}h ${n}min`:`${t}h`},Ft=Q.useMemo(()=>{let e=[];if(R&&L?e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_size_range`,{min:S(R),max:S(L)})):R&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_min_size`,{min:S(R)})),ie){let{minWidth:t,maxWidth:n,minHeight:r,maxHeight:i,aspectRatio:a}=ie;if(t||r){let n=t??`–`,i=r??`–`;e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_dimensions`,{width:String(n),height:String(i)}))}if(n||i){let t=n??`–`,r=i??`–`;e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_max_dimensions`,{width:String(t),height:String(r)}))}a&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_aspect_ratio`,{width:String(a.width),height:String(a.height)}))}return ae&&ae.maxDuration&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_video_max_duration`,{duration:Pt(ae.maxDuration)})),oe&&oe.maxDuration&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_audio_max_duration`,{duration:Pt(oe.maxDuration)})),se&&se.maxPages&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_document_max_pages`,{pages:se.maxPages})),ne&&re&&e.push(y(B.LOW_LEVEL_FORM_FIELD_FILE,`constraint_max_files`,{max:re})),e},[R,L,ie,ae,oe,se,ne,re,y,S]),It=()=>Ft.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-x-group gap-y-item-xs mt-item-xs`,children:Ft.map((e,t)=>(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e},t))}),Lt=(e=!1)=>(0,$.jsx)(`div`,{onClick:St,onDragOver:gt,onDragLeave:_t,onDrop:vt,className:U(`relative flex flex-col items-center justify-center rounded-md border-2 border-dashed cursor-pointer`,e?`p-card-sm`:`p-container`,xe&&`border-primary bg-primary/5`,ht&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`,Pe&&!ne&&`pointer-events-none`,de&&`border-destructive`,!ht&&!Pe&&`hover:border-primary hover:bg-primary/5`,E.motion.transition),children:Pe&&!ne?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($y,{size:32,className:`text-primary mb-element`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_e<0?y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploading_indeterminate`):y(B.LOW_LEVEL_FORM_FIELD_FILE,`uploading`,{progress:_e})}),(0,$.jsx)(`div`,{className:`w-full max-w-xs h-1 bg-muted rounded-full mt-element overflow-hidden`,children:_e<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${_e}%`}})})]}):(0,$.jsxs)($.Fragment,{children:[!e&&(0,$.jsx)(`span`,{className:`mb-element`,"aria-hidden":`true`,children:w(H.UPLOAD,{size:ca.XL})}),(0,$.jsx)(`span`,{className:U(`font-medium`,e?`text-xs`:`text-sm`),children:e?y(B.LOW_LEVEL_FORM_FIELD_FILE,`add_more`):D}),!e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground mt-item-xs`,children:k}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground mt-element`,children:[Tt,L&&!R&&` • ${y(B.LOW_LEVEL_FORM_FIELD_FILE,`max_size`,{size:S(L)})}`]}),It()]})]})}),Rt=ne&&(!re||Le.length<re),zt=()=>(0,$.jsx)(ax,{multiple:ne,constraints:I,acceptedStorages:F?.storageAccepted,onSelect:dt,onProviderFailure:ft,renderConsentRequired:({choice:e,missingPurposes:t,grant:n})=>{let r=t.map(e=>b(ll.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Dhe)).join(`, `),i=_(e.displayNameLabelKey)??e.displayName??e.providerRef;return(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-item-xs mt-element text-sm text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_required`,{provider:i,purposes:r})}),n===void 0?null:(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.OUTLINE,onClick:()=>void n(),children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_grant`,{purposes:r})})]})},renderChooser:({choices:e,chosen:t,choose:n})=>(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs mt-element`,children:e.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.providerRef===t?J.DEFAULT:J.OUTLINE,"aria-pressed":e.providerRef===t,onClick:()=>n(e.providerRef),children:_(e.displayNameLabelKey)??e.displayName??e.providerRef},e.providerRef))})});return x?(0,$.jsxs)(`div`,{ref:g,className:c,children:[(de??Ke)&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:de??Ke}),Te.size>0&&(0,$.jsx)(X,{type:`button`,onClick:Ae,children:y(B.LOW_LEVEL_FORM_FIELD_FILE,`cancel`)}),(0,$.jsx)(`input`,{ref:je,type:`file`,accept:te,multiple:ne,onChange:pt,className:`hidden`,disabled:ht}),ne?(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(Le.length>0||me.size>0)&&Nt(),!ht&&Rt&&Lt(Le.length>0),!ht&&Le.length===0&&!Rt&&Lt(!1),!ht&&Rt&&zt()]}):Ie?jt(Ie,He):Re?(0,$.jsxs)($.Fragment,{children:[Lt(!1),!ht&&zt()]}):null,it&&nt&&(0,$.jsx)(wL,{file:it,aspectRatio:nt,maskShape:rt,maxOutputWidth:ie?.maxWidth,maxOutputHeight:ie?.maxHeight,maxOutputSizeBytes:L,allowedMimeTypes:ee,onConfirm:ot,onCancel:st,onUncroppable:ct})]}):null}),Dhe=Da(nd).consentedPurposes,WL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,httpOperations:t,...n},r)=>{let{httpClient:i}=Tu(),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=Ml(B.LOW_LEVEL_FORM_FIELD_FILE,`FormFieldFile`)(e),s={...n,httpOperations:a};return(0,$.jsx)(o,{...s,ref:r})});WL.displayName=`FormFieldFile`;var Ohe=[`shipping`,`billing`],khe=[`home`,`work`,`mobile`,`fax`,`pager`],Ahe=[`webauthn`];function jhe(e){if(!e)return{leadingModifiers:[],trailingModifiers:[]};let t=Array.isArray(e)?e:[e],n=Array.from(new Set(t)),r=n.find(e=>Ohe.includes(e)),i=n.find(e=>khe.includes(e)),a=n.find(e=>Ahe.includes(e));return{leadingModifiers:[...r?[r]:[],...i?[i]:[]],trailingModifiers:a?[a]:[]}}function Mhe({identifier:e,modifier:t}){if(!e)return;let{leadingModifiers:n,trailingModifiers:r}=jhe(t);return[...n,e,...r].join(` `)}function GL(e){switch(e){case`stacked`:return Uc.STACKED;case`inline`:return Uc.INLINE;case`compact`:return Uc.COMPACT;default:return}}function KL(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function qL(e){switch(e){case`sm`:return qd.SM;case`md`:return qd.MD;default:return}}var JL=300;function Nhe(e,t,n=JL){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 Phe(e){return!!(e?.upload||e?.override)}function YL(e){return e??void 0}function Fhe(e,t,n=ta.ON_BLUR,r=!1,i,a=ye){let{debouncedTrigger:o,cancelDebounce:s}=Nhe(e.trigger,t,JL),c=wE(),l=(i?Yc(i):void 0)?.autosave,u=EE(l,c?.config.defaultTrigger,r),d=c?.getFieldStateInfo(t),f=d?.state??tT.IDLE,p=d?.lastError,m=(0,Q.useCallback)(()=>{c?.retryFieldSave?.(t)},[c,t]),{validateUniqueness:h}=Cfe({fieldName:t,fieldSchema:i}),{handleFieldBlur:g,noteInputReceived:_}=LM(t);return{createBlurHandler:(0,Q.useCallback)(i=>()=>{let a=g(i);if(s(),a||(n===`onBlur`||n===`onTouched`||n===`onChange`&&r)&&e.trigger(t),c&&u===au.BLUR){let n=e.getValues(t);c.triggerSave(t,n,au.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===au.DEBOUNCE&&c.triggerSave(t,d,au.DEBOUNCE)},[e,t,n,r,o,c,u,i,a,_]),autosaveFieldState:f,autosaveError:p,handleRetrySave:m,saveFieldNow:(0,Q.useMemo)(()=>c?.config.enabled&&u!==au.NONE?e=>c.triggerSave(t,e,au.BLUR):void 0,[c,u,t])}}function Ihe(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 Lhe(e){if(!Ihe(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 XL({inputProps:e,value:t,isGeneratedPdfField:n,onBlur:r,inputRef:i}){let{tComponent:a}=K({component:B.LOW_LEVEL_FORM_FIELD_FILE}),o=Lhe(t),s=o===0?``:o>1?a(B.LOW_LEVEL_FORM_FIELD_FILE,`files_attached`,{count:o}):a(B.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),c=a(B.LOW_LEVEL_FORM_FIELD_FILE,n?`generated_pdf_read_only`:`uploads_unavailable_placeholder`);return(0,$.jsx)($M,{...e,value:s,onChange:()=>void 0,onBlur:r,ref:i,placeholder:c,type:`text`,readOnly:!0,disabled:!0})}function Rhe(e,t,n,r){return Yc(e)?.validationMode||t||n||hr.getDefaultValidationMode(r)}function zhe(e,t){return t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function Bhe(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 Vhe(e,t){return hr.resolveFieldSchemaPath(e,t)}function ZL({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=UC(),D=ND(),O=pc(),{registry:k}=lm(),A=Q.useContext(Fi)?.appConfig,{tErrorValidation:j,t:M,isReady:N}=K({keys:[`errors_validation`]}),P=LT(),F=ED(e),I=P?.allowedValuesByField?.[F],ee=d??I?.values;PM(F),mk(F),Bk([F]);let L=!/\.\d+(\.|$)/.test(F),R=t??Vhe(P?.schema,F),te=(0,Q.useMemo)(()=>R?ge(A,ar(R)):void 0,[R,A]),ne=xfe({declaration:P?.requestFieldOffers?.[F],record:P?.requestFieldOfferRecord,appConfig:A,fieldName:F}),re=(0,Q.useMemo)(()=>{if(!R)return;let e=me(R),t=e===_u.ARRAY?ja(R):void 0,n=te??(e===_u.ENUM?Jo(R):void 0)??(t&&me(t)===_u.ENUM?Jo(t):void 0);return Zl(ne,n)},[R,te,ne]),ie=!!R&&!ee&&me(R)===_u.STRING&&xt(R)===z.ORGANIZATION_ROLE,ae=ie?void 0:re,oe=ie?P?.roleGrantPickerOffersByField?.[F]:void 0,se=(0,Q.useMemo)(()=>oe?re?re.filter(e=>oe.includes(e)):oe:re,[re,oe]),ce=ae?ee?ee.filter(e=>ae.includes(e)):ae:ee??te,le=P?.reportRequestFieldOffer,ue=!!P?.requestFieldOffers?.[F];(0,Q.useEffect)(()=>{ue&&le?.(F,ne)},[ue,le,F,ne]);let de=hr.labelDictionaryPath(F),fe=n??P?.fieldLabels?.[de]??e,pe=r??P?.fieldDescriptions?.[de],he=i??P?.fieldTooltips?.[de],_e=u??P?.enumLabels?.[de]??(d?void 0:I?.labels),ve=m??P?.disabled,ye=S??P?.fileUploadContext,be=P?.generatedFieldOverrides?.[F],xe=[...Object.keys(P?.contextFieldValues??{}),...P?.hiddenFieldNames??[],...Object.keys(P?.generatedFieldOverrides??{})],Se=be==null&&zhe(F,xe),Ce=R?un(R):void 0,we=F.includes(`.`)?F.slice(0,F.lastIndexOf(`.`)):``,Te=Ce?Bhe(Ce,we):void 0,Ee=Te?hr.getShowWhenWatchFields(Te):[],De=zC({name:Ee.length>0?Ee:[]}),Oe=Array.isArray(De)?De:Ee.length>0?[De]:[],ke=zC({name:P?.inheritanceConfig?.discriminatorField?[P.inheritanceConfig.discriminatorField]:[]}),Ae=Array.isArray(ke)?ke[0]:ke,je=F.match(/^[^.[\]]+/)?.[0]??F,Me=(0,Q.useMemo)(()=>{if(!Te)return!0;let e=Object.fromEntries(Ee.map((e,t)=>[e,Oe[t]]));return hr.evaluateShowWhen(Te,e)},[Te,Ee,Oe]),Ne=(0,Q.useMemo)(()=>!P?.inheritanceConfig?.discriminatorField||hr.computeFieldVisibility(P.schema,je,{[P.inheritanceConfig.discriminatorField]:Ae},P.inheritanceConfig),[Ae,P?.inheritanceConfig,P?.schema,je]),Pe=R?me(R):_u.STRING,Fe=R?Yc(R):void 0,B=P?.hostResolvesRelationshipRoots===!0,Le=(0,Q.useMemo)(()=>{if(!(B||!R||!D.resourceType||Pe!==_u.OBJECT&&Pe!==_u.ARRAY))return _j({resourceType:D.resourceType,fieldName:F,operationType:D.operationType,registry:k})},[B,R,D.operationType,D.resourceType,F,k,Pe]),Re=Pe===_u.STRING||Pe===_u.CODE||Pe===_u.NUMBER||Pe===_u.BIGINT||Pe===_u.MONEY||Pe===_u.BIGDECIMAL,ze=R?Rhe(R,p,D.validationMode,Pe):p??D.validationMode??ta.ON_BLUR,Be=h??P?.readOnly??(R?Gre(R,D.operationType):!1),Ve=fhe[phe({schemaKind:D?.schemaKind,rootSchema:P?.schema,fieldName:F})],He=Ve.normalizeClearedValue,Ue=R?Ve.isClearable(R):!1,{createBlurHandler:We,createChangeHandler:Ge,autosaveFieldState:Ke,autosaveError:qe,handleRetrySave:Je,saveFieldNow:Ye}=Fhe(E,F,ze,Re,R,He),Xe=C??(P?void 0:Fe?.autoFocus),Ze=Fe,Qe=Mhe({identifier:Ze?.autoComplete,modifier:Ze?.autoCompleteModifier}),$e=(0,Q.useMemo)(()=>R?!Sre(R):!1,[R]),et=Q.useContext(wT),tt=(0,Q.useRef)(Symbol(`file-field-validation`)).current;(0,Q.useEffect)(()=>()=>{et?.delete(tt)},[et,tt,F]);let{setError:nt,clearErrors:rt,getFieldState:it}=E,at=(0,Q.useCallback)(e=>{let t=e=>{let t=it(F).error;(t?.type!==`file-validation`||t.message!==e)&&nt(F,{type:oI,message:e})};if(e)et?.set(tt,{name:F,message:e}),t(e);else{et?.delete(tt);let e=[...et?.values()??[]].find(e=>e.name===F);if(e){t(e.message);return}it(F).error?.type===`file-validation`&&rt(F)}},[nt,rt,it,F,et,tt]),ot=E.getFieldState(F,E.formState),st=cI(ot,E.formState.isSubmitted,ze,j),{formChromeMode:ct,sectionChromeMode:lt}=Qw(),ut=GL(O.autoRender?.autoFieldChrome),dt=Fe?.chromeMode??lt??ct??ut,ft=a??KL(O.autoRender?.autoLabelPlacement),pt=c??qL(O.autoRender?.autoFieldDensity),mt=l!==!1&&O.autoRender?.autoErrorPlacement===`summary-at-surface-top`,ht=ne.kind===une.NOT_OFFERED,gt=!!R&&(Se||!Me||!Ne||ht);if(vk(!!R&&!gt),(0,Q.useEffect)(()=>{gt&&!L&&F&&E.getValues(F)!==void 0&&E.setValue(F,void 0,{shouldDirty:!1,shouldValidate:!1})},[gt,L,F,E]),(0,Q.useEffect)(()=>{if(!re||!F)return;let e=E.getValues(F);if(e==null)return;let t=new Set(re);if(Array.isArray(e)){let n=e.filter(e=>t.has(String(e)));n.length!==e.length&&E.setValue(F,n,{shouldDirty:!0,shouldValidate:!1})}else t.has(String(e))||E.setValue(F,void 0,{shouldDirty:!0,shouldValidate:!1})},[re,F,E]),!R||gt)return null;if(be!=null)return(0,$.jsx)($.Fragment,{children:be});let _t=Fe?.forceHide,vt={mode:dt,label:fe,description:pe,tooltip:he,labelPlacement:ft,error:st,required:$e,hideLabel:o??_t?.label,hideDescription:s??_t?.description,hideError:_t?.error||mt,saveState:Ke,saveErrorMessage:qe,onRetrySave:Je,onSaveFieldNow:Ye,fieldName:F,disabled:ve,className:g},yt={schema:R,clearable:Ue,name:F,disabled:ve,readOnly:Be,validationMode:ze,required:$e,autoFocus:Xe||void 0,controlSize:pt},St=!(!Le||Le.semantics.nature===wi.COMPOSITION&&Le.nestedMutationConfig),Ct=Pe===_u.RANGE_NUMBER||Pe===_u.RANGE_DATE||Pe===_u.RANGE_DATETIME||Pe===_u.RANGE_TIME||Pe===_u.RANGE_BIGDECIMAL||Pe===_u.RANGE_MONEY;if(Ct){let e=An(R),t=f??Fe?.component??mte(e??bt.NUMBER);return(0,$.jsx)(VC,{name:F,control:E.control,shouldUnregister:L,render:({field:e})=>{let n=We(e.onBlur),r=Ge(e.onChange),i={...yt,value:YL(E.getValues(F)),onBlur:n},a=(()=>{let n=e.ref;switch(t){case Ie.RANGE_SLIDER:return(0,$.jsx)(ZM,{...i,onValueChange:r,ref:n});case Ie.DATE_RANGE:return(0,$.jsx)(mN,{...i,onChange:r,ref:n});case Ie.DATETIME_RANGE:return(0,$.jsx)(_N,{...i,onChange:r,ref:n});case Ie.TIME_RANGE:return(0,$.jsx)(bN,{...i,onChange:r,ref:n});case Ie.BIGDECIMAL_RANGE:return(0,$.jsx)(gL,{...i,onChange:r,ref:n});case Ie.MONEY_RANGE:return(0,$.jsx)(vL,{...i,onChange:r,ref:n});default:return{[_u.RANGE_BIGDECIMAL]:(0,$.jsx)(gL,{...i,onChange:r,ref:n}),[_u.RANGE_MONEY]:(0,$.jsx)(vL,{...i,onChange:r,ref:n}),[_u.RANGE_DATE]:(0,$.jsx)(mN,{...i,onChange:r,ref:n}),[_u.RANGE_DATETIME]:(0,$.jsx)(_N,{...i,onChange:r,ref:n}),[_u.RANGE_TIME]:(0,$.jsx)(bN,{...i,onChange:r,ref:n}),[_u.RANGE_NUMBER]:(0,$.jsx)(dN,{...i,onChange:r,ref:n})}[Pe]??(0,$.jsx)(ZM,{...i,onValueChange:r,ref:n})}})();return(0,$.jsx)(qM,{...vt,children:a})}})}let wt=e=>(0,$.jsx)(OE,{fieldName:F,label:fe,disabled:ve,onSaveFieldNow:Ye,children:e});if(Pe===_u.OBJECT){if(St)return null;let e=sd(R),t=e?Gme(A,e):void 0;return t?Tt(e=>(0,$.jsx)(xI,{...yt,types:t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):wt((0,$.jsx)(SN,{name:F,schema:R,label:fe,hideLabel:o,description:pe,disabled:ve,className:g,renderField:y,excludedChildKeys:w}))}if(Pe===_u.RECORD){let e=vi(R);return e?wt((0,$.jsx)(TN,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,valueSchema:e,keySchema:null})):null}if(Pe===_u.MAP){let e=Pi(R);return e?wt((0,$.jsx)(TN,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,valueSchema:e.valueSchema,keySchema:e.keySchema})):null}if(Pe===_u.ARRAY)return St?null:(0,$.jsx)(vI,{name:F,schema:R,label:fe,description:pe,disabled:ve,className:g,renderField:y,sectionAppearance:b,objectItemLayout:x,enumLabels:_e,allowedValues:ce});function Tt(e,t){return(0,$.jsx)(VC,{name:F,control:E.control,shouldUnregister:L,render:({field:n})=>(0,$.jsx)(qM,{...vt,...t,children:e({value:YL(E.getValues(F)),onChange:Ge(n.onChange),onBlur:We(n.onBlur),ref:n.ref})})})}if(ce){let e=ar(R),t=t=>{if(!e)return;let n=Mc(e,t),r=M(n);return r===n?void 0:r},n=ce.map(e=>({value:e,label:_e?.[e]??t(e)??e}));return Tt(e=>(0,$.jsx)(aI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,options:n}))}let Et=f;if(Et&&!Ct)switch(Et){case Ie.INPUT:case Ie.TEXTAREA:return Tt(e=>(0,$.jsx)(GI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v}));case Ie.SLIDER:return Tt(e=>(0,$.jsx)(qI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));case Ie.CHECKBOX:case Ie.SWITCH:return Tt(e=>(0,$.jsx)(AI,{...yt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.SELECT:case Ie.RADIO_GROUP:case Ie.CHECKBOX_GROUP:{let e=_e?$L(R,_e):void 0;return Tt(t=>(0,$.jsx)(aI,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}case Ie.DATE:return Tt(e=>(0,$.jsx)(rN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.DATETIME:return Tt(e=>(0,$.jsx)(oN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case Ie.TIME:return Tt(e=>(0,$.jsx)(lN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}))}if(Pe===_u.MONEY)return Tt(e=>(0,$.jsx)(XI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===_u.DURATION)return Tt(e=>(0,$.jsx)(QI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===_u.PHONE)return Tt(e=>(0,$.jsx)(aL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe}));if(Pe===_u.ADDRESS){let e=Object.fromEntries(Zr().map(e=>[e,cI({...E.getFieldState(`${F}.${e}`,E.formState),isTouched:ot.isTouched,isDirty:ot.isDirty},E.formState.isSubmitted,ze,j)])),t=ot.error;return Tt(t=>(0,$.jsx)(uL,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,partErrors:e,renderLookup:e=>(0,$.jsx)(xx,{host:e,addressSchema:R,fieldName:F})}),t!==void 0&&(t.message!==void 0||t.type!==void 0)?void 0:{error:void 0})}if(Pe===_u.BIGDECIMAL)return Tt(e=>(0,$.jsx)(pL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===_u.CODE)return Tt(e=>(0,$.jsx)(mL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===_u.FILE){let e=hr.normalizeSchemaFieldPath(F),t=ye?.[e],n=$a(R);return!n&&Phe(t)?Tt(e=>(0,$.jsx)(WL,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,endpoints:t,onValidationError:at}),{wideControl:!0}):n?(0,$.jsx)(qM,{...vt,children:(0,$.jsx)(XL,{inputProps:yt,value:E.getValues(F),isGeneratedPdfField:!0})}):Tt(e=>(0,$.jsx)(qM,{...vt,children:(0,$.jsx)(XL,{inputProps:yt,value:e.value,isGeneratedPdfField:!1,onBlur:e.onBlur,inputRef:e.ref})}))}if(Po(R))return Tt(e=>(0,$.jsx)(yI,{...yt,quickCreateSourceFieldName:T,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===_u.BOOLEAN)return Tt(e=>(0,$.jsx)(AI,{...yt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Pe===_u.STRING)return Tt(e=>(0,$.jsx)(GI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v,...ie&&se?{offeredValues:se}:{}}));if(Pe===_u.NUMBER||Pe===_u.BIGINT)return Tt(e=>(0,$.jsx)(qI,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Pe===_u.ENUM){let e=_e?$L(R,_e):void 0;return Tt(t=>(0,$.jsx)(aI,{...yt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}return Pe===_u.DATE?Tt(e=>(0,$.jsx)(rN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Pe===_u.DATETIME?Tt(e=>(0,$.jsx)(oN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Pe===_u.TIME?Tt(e=>(0,$.jsx)(lN,{...yt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):(0,$.jsx)(qM,{...vt,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Unsupported field type:`}),(0,$.jsx)(`code`,{className:`bg-destructive/20 px-item-xs rounded`,children:Pe}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e,`)`]})]})})}ZL.displayName=`FormField`;var QL=ZL;Ck(QL,bk.FIELD_SLOT);function $L(e,t){return Jo(e).map(e=>({value:e,label:t?.[e]??e}))}var eR=rs.getLogger();function tR(e,t){let n=e instanceof dj?e.mutationError:void 0,r=n?n.validationErrors?jM({httpStatus:n.status??400,validationErrors:n.validationErrors}):null:jM(e);if(!r)return;let i=Object.keys(r.validationErrors).find(e=>e===t||e.startsWith(`${t}.`));return i===void 0?void 0:r.validationErrors[i]}var nR=eR.debugByType(`DisplayFieldEditable`);eR.setDebugTypeLogging(`DisplayFieldEditable`,!1);function rR(e,t){return t.some(t=>e===t||e.startsWith(t+`[`)||wM(t,e))}function Hhe(e){return!!(e?.upload||e?.override)}var Uhe={mode:`direct`,saveOn:`blur`,showSaveButton:!1,showCancelButton:!0};function iR(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,className:p,hideLabel:m,hideDescription:h,resolvedChromeMode:g,resolvedLabelPlacement:v,resolvedEmptyValue:y,fileUploadContext:b,wideValue:x,announceName:S,doInlineUpdate:C,rmm:w}=e,{tComponent:T,tErrorValidation:E,isReady:D}=K({component:[B.LOW_LEVEL_FORM_FIELD,B.LOW_LEVEL_BUTTON]}),{getRecipe:O}=Rg(),{renderIcon:k}=Of(),A=uj(),{registry:j}=lm(),M=O(oc.INDICATOR,bl.SUCCESS),[N,P]=(0,Q.useState)(jT.DISPLAY),[F,I]=(0,Q.useState)(null),ee=(0,Q.useRef)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),[te,ne]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(!1),le=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{le.current!==r&&(oe(!1),ce(!1),ie(null),le.current=r)},[r]);let ue=N!==jT.DISPLAY,de=N===jT.SAVING,fe=w??null,pe=(0,Q.useSyncExternalStore)(fe?.subscribe??DM,fe?.getSnapshot??OM),me=Yie(t)??Uhe,he=(0,Q.useMemo)(()=>{if(i&&A.resourceType)return yj({resourceType:A.resourceType,fieldName:i,operationType:W.UPDATE,registry:j})},[i,j,A.resourceType]),ge=(0,Q.useMemo)(()=>{if(i)return b?.[hr.normalizeSchemaFieldPath(i)]},[i,b]),_e=n!==_u.FILE||!$a(t)&&Hhe(ge),ve=(0,Q.useMemo)(()=>i?.includes(`.`)?i.split(`.`).pop():i??`value`,[i]),ye=(0,Q.useMemo)(()=>jd({[ve]:t}),[ve,t]),be=Nw({resolver:vT(ye),defaultValues:{[ve]:r},mode:kT});(0,Q.useEffect)(()=>{N===jT.DISPLAY&&(be.reset({[ve]:r}),I(null))},[r,N,be,ve,t]),(0,Q.useEffect)(()=>{if(ue&&ee.current){let e=setTimeout(()=>{let e=ee.current?.querySelector(`input, textarea, select, [tabindex]:not([tabindex="-1"])`);e&&e.focus()},0);return()=>clearTimeout(e)}},[ue]),(0,Q.useEffect)(()=>{N===jT.ERROR&&L.current?.focus()},[N]),(0,Q.useEffect)(()=>()=>{R.current!=null&&clearTimeout(R.current)},[]);let xe=(0,Q.useCallback)(async()=>{if(i){if(!await be.trigger(ve))be.setValue(ve,be.getValues(ve),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),P(jT.EDITING);else{I(null),P(jT.SAVING);try{let e=be.getValues(ve);await C(i,e),nR(`inline edit save`,{fieldName:i,value:e}),P(jT.SAVED),R.current=setTimeout(()=>{P(jT.DISPLAY),R.current=null},500)}catch(e){if(e instanceof dj&&e.mutationError?.type===dE.CONFLICT)return;let t=tR(e,i);if(t!==void 0){let e=_(t)?E(t.code,`msg`,t.params):t;be.setError(ve,{type:iT,message:e}),P(jT.EDITING);return}I(T(B.LOW_LEVEL_FORM_FIELD,`save_failed`)),P(jT.ERROR)}}}},[be,ve,i,C,T,E]);(0,Q.useEffect)(()=>{let e=be.watch((e,{name:t})=>{t===ve&&be.getFieldState(ve).error?.type===`server`&&be.clearErrors(ve)});return()=>e.unsubscribe()},[be,ve]);let Se=(0,Q.useCallback)(()=>{i&&nR(`inline edit cancel`,{fieldName:i}),be.reset({[ve]:r}),I(null),P(jT.DISPLAY)},[be,ve,r,i]),Ce=(0,Q.useCallback)(async e=>{if(i){ie(e),I(null),ne(!0);try{await C(i,e),nR(`inline boolean toggle`,{fieldName:i,value:e})}catch(e){if(ie(null),!(e instanceof dj&&e.mutationError?.type===dE.CONFLICT)){let t=tR(e,i);I(t===void 0?T(B.LOW_LEVEL_FORM_FIELD,`save_failed`):_(t)?E(t.code,`msg`,t.params):t)}}finally{ne(!1)}}},[i,C,T,E]),we=(0,Q.useRef)(T);we.current=T,(0,Q.useEffect)(()=>{if(!fe||!pe?.lastEvent||!i)return;let e=pe.lastEvent;if(e.id!==z.current)switch(z.current=e.id,e.type){case cE.REMOTE_UPDATE:rR(i,e.changedFields)&&N===jT.EDITING&&(nR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se());break;case cE.CONFLICT_RESET:{let t=EM(e.currentData,i);be.reset({[ve]:t}),N!==jT.DISPLAY&&(nR(`RMM event resetting inline edit after conflict`,{fieldName:i,eventType:e.type}),I(we.current(B.LOW_LEVEL_FORM_FIELD,`field_reset_after_conflict`)),P(jT.ERROR));break}case cE.MUTATION_RESULT:e.result.success&&e.source.type!==uE.DISPLAY&&e.result.savedFields&&rR(i,e.result.savedFields)&&N===jT.EDITING&&(nR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se());break;case cE.RESOURCE_DELETED:N===jT.EDITING&&(nR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),Se())}},[pe?.lastEvent?.id,fe,i,N,ve,be,Se]);let Te=(0,Q.useCallback)(e=>{if(me.saveOn===`blur`&&ee.current){let t=e.relatedTarget;ee.current.contains(t)||xe()}},[me.saveOn,xe]),Ee=n===_u.CODE||Une(t),De=(0,Q.useCallback)(e=>{e.key===`Escape`?(e.preventDefault(),Se()):e.key===`Enter`&&(Ee?(e.ctrlKey||e.metaKey)&&(e.preventDefault(),xe()):e.shiftKey||(e.preventDefault(),xe()))},[xe,Se,Ee]);function Oe(){return(0,$.jsx)(bM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:p,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,emptyValue:y,fileUploadContext:b,showAllArrayItems:ae,onExpandArrayItems:()=>oe(!0),showAllObjectFields:se,onExpandObjectFields:()=>ce(!0)})}function ke(){let e=re??!!r;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-element`,children:[te&&(0,$.jsx)(`span`,{className:`text-muted-foreground`,"aria-hidden":`true`,children:k(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`})}),F&&!te&&(0,$.jsx)(`span`,{className:`text-destructive text-xs`,role:`alert`,children:F}),(0,$.jsx)(wI,{checked:e,onCheckedChange:Ce,disabled:te,"aria-label":a||i||void 0})]})}function Ae(){return(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,className:U(`group relative inline-flex items-center gap-element h-auto px-card-sm py-item-xs`),onClick:()=>{i&&nR(`inline edit start`,{fieldName:i}),P(jT.EDITING)},"aria-label":T(B.LOW_LEVEL_FORM_FIELD,`editField`,{label:a||i||``}),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:Oe()}),(0,$.jsx)(`span`,{className:`text-muted-foreground opacity-0 group-hover:opacity-100 motion-safe:transition-opacity`,children:k(H.EDIT,{size:ca.SM})})]})}function je(){let e=i?`inline-edit-error-${i.replace(/\./g,`-`)}`:void 0,n=N===jT.ERROR&&!!F;return(0,$.jsx)(rT,{schema:ye,schemaKind:eT.MAIN_SCHEMA,form:be,resourceType:A.resourceType,resourceId:A.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:A.contextResourceIdentifiers,navigationZone:A.navigationZone,children:(0,$.jsxs)(`div`,{ref:ee,className:`inline-flex flex-col gap-item-xs min-w-[200px]`,onBlur:Te,onKeyDown:De,"aria-describedby":n?e:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(QL,{name:ve,quickCreateSourceFieldName:he?.sourceFieldName,schema:t,label:``,description:``,disabled:de,placeholder:a,enumLabels:l,respectSurfaceErrorPlacement:!1,fileUploadContext:ge?{[ve]:ge}:void 0,className:`inline-edit-field`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-item-xs shrink-0 pt-item-xs`,children:[N===jT.SAVED&&(0,$.jsx)(`div`,{className:M.base,"aria-hidden":`true`,children:k(H.CHECK,{size:ca.SM})}),me.showSaveButton&&N!==jT.SAVED&&(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.DEFAULT,onClick:xe,disabled:de,"aria-label":T(B.LOW_LEVEL_BUTTON,`save`),children:N===jT.SAVING?k(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):k(H.CHECK,{size:ca.SM})}),me.showCancelButton&&(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:J.GHOST,onClick:Se,disabled:de,"aria-label":T(B.LOW_LEVEL_BUTTON,`cancel`),children:k(H.CLOSE,{size:ca.SM})})]})]}),n&&(0,$.jsxs)(AD,{id:e,variant:`destructive`,role:`alert`,className:`flex items-center gap-element py-card-sm`,children:[k(H.ERROR,{size:ca.SM,className:`shrink-0`}),(0,$.jsx)(MD,{className:`flex-1 m-0`,children:(0,$.jsx)(Z,{children:F})}),(()=>{let e=T(B.LOW_LEVEL_BUTTON,`retry`);return(0,$.jsx)(X,{ref:L,type:`button`,size:Y.SM,variant:J.GHOST,onClick:xe,disabled:de,"aria-label":e,title:e,children:k(H.TRY_AGAIN,{size:ca.SM})})})()]})]})})}if(!D)return null;let Me;return Me=n===_u.BOOLEAN&&i?ke():ue&&i&&_e?je():_e?Ae():Oe(),(0,$.jsx)(sj,{mode:g,label:a,description:o,tooltip:s,provenance:c,name:i,labelPlacement:v,hideLabel:m,hideDescription:h,wide:x,announceName:S,className:p,children:Me})}iR.displayName=`DisplayFieldEditable`;function aR({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)(()=>jd({[f]:t}),[f,t]),m=(0,Q.useMemo)(()=>({[f]:Array.isArray(n)?n:[]}),[f,n]),h=Nw({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=uj(),y=e.includes(`.`)?e.slice(0,e.lastIndexOf(`.`)):void 0,b=eE(p,{resourceType:v.resourceType,operationId:W.UPDATE},m,`edit`,{fieldPathPrefix:y}),x=(0,Q.useMemo)(()=>({schema:p,fieldLabels:b.fieldLabels,fieldDescriptions:b.fieldDescriptions,fieldTooltips:b.fieldTooltips,enumLabels:b.enumLabels,sectionLabels:b.sectionLabels,sectionDescriptions:b.sectionDescriptions,groupLabels:b.groupLabels,wizardStepLabels:b.wizardStepLabels,wizardStepDescriptions:b.wizardStepDescriptions,operationType:W.UPDATE,isExisting:!0}),[p,b]),S=d===!0||c===Pc.HIDDEN||c===Pc.COMPACT,C=(0,Q.useMemo)(()=>({enabled:!0}),[]),{tComponent:w}=K({component:B.RESOURCES_LAYOUTS_CREATE}),T=(0,Q.useMemo)(()=>({errorNetwork:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:w(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[w]),E=(0,Q.useCallback)(async()=>{await a(e,h.getValues(f))},[a,e,h,f]);return(0,$.jsx)(WC,{...h,children:(0,$.jsx)(rT,{schema:p,form:h,resourceType:v.resourceType,resourceId:v.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:v.contextResourceIdentifiers,navigationZone:v.navigationZone,children:(0,$.jsx)(FT,{value:x,children:(0,$.jsx)(TE,{onSave:E,labels:T,config:C,children:(0,$.jsx)(`div`,{ref:g,children:(0,$.jsx)(vI,{name:f,schema:t,label:r,description:i,renderField:o,sectionAppearance:s,objectItemLayout:l,enumLabels:u,hideLabel:S,chromeMode:c===Pc.SETTINGS_ROW?Uc.SETTINGS_ROW:void 0})})})})})})}aR.displayName=`DisplayFieldEditableArray`;var Whe=aR,Ghe=zd({slug:yd().regex(_re,`A slot slug is lowerCamelCase with no separators.`).max(40).refine(e=>e!==zo,{error:`"${zo}" is reserved: the environment builder emits ${Oie(`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:Dd(),description:yd().min(1)}),oR=e=>Nd(Ghe).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.`})});zd({addressSlots:oR(`credential address`),secretSlots:oR(`credential secret`)});var Khe={[Gs.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."}]},[Gs.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.`}]},[Gs.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.`}]},[Gs.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.`}]},[Gs.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.`}]},[Gs.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.`}]},[Gs.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.`}]},[Gs.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.`}]}},qhe=function(e){return e.KEY_ID_SUPPLIED=`key-id-supplied`,e.X509_THUMBPRINT_DERIVED=`x509-thumbprint-derived`,e}({}),Jhe=function(e){return e.REQUEST_BODY=`request-body`,e.BASIC_HEADER=`basic-header`,e}({}),sR=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}({}),cR=Td().int().min(30).max(86400),lR={dialects:Nd(Od(Ho)).min(1).optional()},uR=pae(`kind`,[zd({kind:Cd(Gs.ODOO_API_KEY_IN_ARGS).systemEnum(`SystemOfRecordCredentialKind`),...lR}),zd({kind:Cd(Gs.API_KEY_HEADER).systemEnum(`SystemOfRecordCredentialKind`),...lR,headerName:yd().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/,`A header name is an RFC 9110 token.`).max(64),valuePrefix:yd().max(32).optional()}),zd({kind:Cd(Gs.API_KEY_QUERY).systemEnum(`SystemOfRecordCredentialKind`),...lR,parameterName:yd().regex(/^[A-Za-z0-9_.-]+$/,`A query parameter name is alphanumeric with -._`).max(64)}),zd({kind:Cd(Gs.BASIC).systemEnum(`SystemOfRecordCredentialKind`),...lR}),zd({kind:Cd(Gs.OAUTH2_CLIENT_CREDENTIALS_SECRET).systemEnum(`SystemOfRecordCredentialKind`),...lR,clientAuthentication:Od(Jhe),tokenLifetimeFallbackSeconds:cR}),zd({kind:Cd(Gs.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...lR,assertionHeaderPolicy:Od(qhe),assertionSigningAlgorithm:Od(sR),assertionLifetimeSeconds:Td().int().min(30).max(600),tokenLifetimeFallbackSeconds:cR}),zd({kind:Cd(Gs.OAUTH2_JWT_BEARER).systemEnum(`SystemOfRecordCredentialKind`),...lR,assertionSigningAlgorithm:Od(sR),assertionLifetimeSeconds:Td().int().min(30).max(600),tokenLifetimeFallbackSeconds:cR}),zd({kind:Cd(Gs.MTLS_CLIENT_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...lR})]),Yhe=function(e){return e.SKIP=`skip`,e.NEXT_LINK_ONLY=`next-link-only`,e}({}),dR=function(e){return e.FIELD=`field`,e.PATH_SEGMENT=`path-segment`,e}({}),Xhe=function(e){return e.SCALAR=`scalar`,e.MANY2ONE_PAIR=`many2one-pair`,e}({}),fR=zd({kind:Od(dR),remoteField:yd().min(1).max(120),codec:Od(mne),valueShape:Od(Xhe)}),pR=function(e){return e.CSRF_TOKEN_HANDSHAKE=`csrf-token-handshake`,e}({}),Zhe=`@odata.etag`;zd({vendor:yd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),dialects:Nd(Od(Ho)).min(1),addressSlots:oR(`vendor address`),credentialOffers:Nd(uR).min(1),odataListPaging:Od(Yhe).optional(),partition:fR.optional(),incrementalExtractionModes:Nd(Od(kt)).optional(),odataExpiredChangePositionErrorCodes:Nd(yd().regex(Ns)).optional(),actionCallShapes:Nd(Od(hie)).optional(),rowVersionField:yd().min(1).max(120).optional(),writePrerequisites:Nd(Od(pR)).optional()}).superRefine((e,t)=>{e.rowVersionField!==void 0&&e.dialects.includes(Ho.ODATA)&&e.rowVersionField!==`@odata.etag`&&t.addIssue({code:`custom`,path:[`rowVersionField`],message:`An OData vendor's row version is its entity tag, "${Zhe}" — got "${e.rowVersionField}".`});for(let[n,r]of(e.actionCallShapes??[]).entries())e.dialects.includes(ul[r])||t.addIssue({code:`custom`,path:[`actionCallShapes`,n],message:`Action call shape "${r}" is spoken over ${ul[r]}, which this vendor's dialects do not list.`});e.odataExpiredChangePositionErrorCodes!==void 0&&!(e.incrementalExtractionModes??[]).includes(kt.ODATA_DELTA_LINK)&&t.addIssue({code:`custom`,path:[`odataExpiredChangePositionErrorCodes`],message:`An expired change-position code is read only by the "${kt.ODATA_DELTA_LINK}" mode, which this vendor's incrementalExtractionModes do not list.`});let n=new Set;for(let[r,i]of e.dialects.entries())n.has(i)&&t.addIssue({code:`custom`,path:[`dialects`,r],message:`Duplicate dialects member "${i}".`}),n.add(i);let r=new Set;for(let[n,i]of e.credentialOffers.entries())r.has(i.kind)&&t.addIssue({code:`custom`,path:[`credentialOffers`,n],message:`Duplicate credentialOffers member "${i.kind}".`}),r.add(i.kind);for(let[n,r]of e.credentialOffers.entries())for(let i of r.dialects??[])e.dialects.includes(i)||t.addIssue({code:`custom`,path:[`credentialOffers`,n,`dialects`],message:`Credential offer "${r.kind}" is scoped to ${i}, which this vendor's dialects do not list.`});for(let[n,r]of e.dialects.entries())e.credentialOffers.some(e=>Qhe(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 Khe[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.`})}),zd({vendor:yd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),partition:fR.optional(),credentialOffers:Nd(uR).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 Qhe(e,t){return e.dialects===void 0||e.dialects.includes(t)}Object.freeze({[Ho.ODATA]:{translatesSort:!0,sendsRowWrites:!0},[Ho.ODATA_V2]:{translatesSort:!0,sendsRowWrites:!1},[Ho.ODOO_JSONRPC]:{translatesSort:!0,sendsRowWrites:!0},[Ho.ODOO_JSON2]:{translatesSort:!0,sendsRowWrites:!0},[Ho.REST_JSON]:{translatesSort:!1,sendsRowWrites:!0}}),Object.freeze({[pR.CSRF_TOKEN_HANDSHAKE]:!1}),Object.freeze({[dR.FIELD]:!0,[dR.PATH_SEGMENT]:!1});function $he(e){if(e.direction===En.OUTBOUND)return[];let t=new Set([e.remoteKeyLocalField]);e.partitionKeyLocalField&&t.add(e.partitionKeyLocalField),e.partitionUnitLocalField&&t.add(e.partitionUnitLocalField);for(let n of e.mapping)(e.direction!==En.BIDIRECTIONAL||tte(n)===Ree.REMOTE)&&iee(n).length>0&&t.add(n.localField);return[...t]}var ege=`external-data-provenance`,tge=zd({system:Xre,currentAsOf:hae().nullable()}),nge=3e5,mR=new WeakMap;function rge(e){let t=mR.get(e);return t||(t=new Set($he(e)),mR.set(e,t)),t}function ige(e){let{resourceConfiguration:t,contextualParameters:n}=e,r=(t.operations??[]).filter(e=>dt(e,W.LIST));if(r.length!==1)return;let i=r[0].initiatorInfos??[];if(i.length===0)return;let a=V.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:n,targetResourceType:t.resourceIdentifier,targetDefaultFieldIdentifier:t.resourceFieldIdentifier});if(!a)return;let o=zm.resolveUrlPath(a.url,n);if(o&&!zm.hasUnresolvedPlaceholders(o))return`${o}/${ege}`}var hR=new WeakMap,gR=new Set;function age(e){let t=hR.get(e);return t||(t={cache:new Map,inFlight:new Map},hR.set(e,t)),t}function oge(){for(let e of gR)e()}function sge(e){return gR.add(e),()=>{gR.delete(e)}}function cge(e,t,n=Date.now()){let r=e&&t?hR.get(t)?.cache.get(e):void 0;return r?Math.max(0,r.fetchedAt+nge-n):void 0}function lge(e,t){if(e&&t)return hR.get(t)?.cache.get(e)?.value}function _R(e,t,n=Date.now()){let{cache:r,inFlight:i}=age(t),a=r.get(e);if(a&&n-a.fetchedAt<3e5||i.has(e))return;let o=(async()=>{let n;try{let r=tge.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),oge()})();i.set(e,o)}function uge(e){let{resourceType:t,contextualParameters:n}=uj(),r=gm(),i=(0,Q.useContext)(Fi)?.httpClient,a=t?r?.registry.resourceConfigurations[t]:void 0,o=a?.externalDataPipeline,s=e.enabled&&!!o&&!!e.fieldName&&rge(o).has(e.fieldName),c=(0,Q.useMemo)(()=>s&&a?ige({resourceConfiguration:a,contextualParameters:n??{}}):void 0,[s,a,n]),l=(0,Q.useSyncExternalStore)(sge,()=>lge(c,i));return(0,Q.useEffect)(()=>{if(!c||!i)return;_R(c,i);let e=cge(c,i);if(e===void 0)return;let t=setTimeout(()=>_R(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 vR=rs.getLogger();function dge(e){switch(e){case`stacked`:return Pc.STACKED;case`inline`:return Pc.INLINE;case`compact`:return Pc.COMPACT;default:return}}function fge(e){switch(e){case`em-dash`:case`placeholder`:case`hidden`:case`skeleton`:return e;default:return}}function pge(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function yR(e,t){return!e||!t||t.length===0?!1:t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function bR(e){let t=rk(),{pathPrefix:n}=TD(),r=pc(),i=IA(),a=e.name,o=a?n?`${n}.${a}`:a:void 0,s=e.schema??(o?sA(t?.schema,o):void 0),c=e.schemaType??(s?me(s):void 0),l=e.value??(o?cA(t?.data,o):void 0),u=o===void 0?void 0:hr.labelDictionaryPath(o),d=o?hr.isArrayItemPath(o):!1,f=d?void 0:u,p=f?hr.unresolvedFieldLabel(f.split(`.`).pop()??f):void 0,m=e.label??(f?t?.fieldLabels?.[f]:void 0)??p,h=s?Jee(s):!1,g=e.description??(f&&h?t?.fieldDescriptions?.[f]:void 0),_=e.tooltip??(f?t?.fieldTooltips?.[f]:void 0),v=e.enumLabels??(u?t?.enumLabels?.[u]:void 0),y=s?i===NA.SUMMARY?Js(s):vl(s):void 0,b=e.displayComponent??y?.component,x=e.parentData??lA(t?.data,n||void 0),S=e.disableInlineEdit??!1,C=e.className,w=yR(o,t?.hiddenFieldNames),T=yR(o,t?.inlineEditDisabledFieldNames),{displayChromeMode:D,sectionChromeMode:O}=ok(),k=yA(),A=WA(),j=dge(r.autoRender?.autoFieldChrome),M=i===NA.SUMMARY&&A&&y?.chromeMode===void 0&&O===void 0&&JA(c),N=y?.chromeMode??O??(M?Pc.INLINE:void 0)??D??j,P=e.labelPlacement??(y?.chromeMode===void 0?pge(r.autoRender?.autoLabelPlacement):void 0),F=e.labelStyle??y?.labelStyle,I=SA(c,y?.displayMode,s?jo(s)?.mode:void 0),ee=t?.breakpoint,L=ee?fA(y?.forceHide,ee):y?.forceHide,R=L?.label===!0,z=L?.description===!0,te=e.hideLabel===!0||R,ne=e.hideDescription===!0||z||M,{canInlineEdit:re,doInlineUpdate:ie,fileUploadContext:ae,rmm:oe,defaultInlineEdit:se,defaultEmptyValue:ce,parentReferenceConfig:le,resourceType:ue}=uj(),de=gm()?.registry,fe=ce??fge(r.autoRender?.autoEmptyValue),pe=uge({fieldName:!n&&!d?o:void 0,enabled:i!==NA.SUMMARY&&!e.resourceLinkTrail}),he=o&&s&&Wo(s),ge=!!o&&!!s&&se===E.WRITABLE_FIELDS&&Ire(s),_e=!S&&!T&&re&&(!!he||ge);if(w||s&&wie(s))return(0,$.jsx)($.Fragment,{});let ve=HA(N,ee??xl.DESKTOP),ye=k&&ve!==Pc.TILE,be=!te&&P!==`hidden`&&ve!==Pc.HIDDEN&&ve!==Pc.COMPACT,xe=!te&&(P===`hidden`||i===NA.SUMMARY),Se=!be&&!xe;if(t?.isLoading??!1)return(0,$.jsx)(VA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(sj,{mode:N,label:m,labelStyle:F,name:o,labelPlacement:P,hideLabel:te,hideDescription:!0,tooltip:_,wide:I,announceName:i===NA.SUMMARY,children:(0,$.jsx)(um,{className:`h-5 w-full`})})});let Ce=s?un(s):void 0,we=n&&x?x:t?.data;if(Ce&&we&&!hr.evaluateShowWhen(Ce,we))return(0,$.jsx)($.Fragment,{});if(le?.displayMode===na.NONE&&o){let t=Nj({schema:s,value:l,fieldName:o,parentData:x,resourceLinkTrail:e.resourceLinkTrail,currentResourceType:ue,registry:de});if(t&&cj({parentReferenceConfig:le,...t}).hidesWholeReference)return(0,$.jsx)($.Fragment,{})}let Te=(k||i===NA.SUMMARY)&&!_e;if((y?.hideWhenEmpty??Te)&&zA(l))return(0,$.jsx)($.Fragment,{});if(!s||!c)return vR.error(`[DisplayField] Cannot resolve schema for field`,{name:o}),(0,$.jsx)($.Fragment,{});let Ee={schema:s,schemaType:c,value:l,fieldName:o,label:m,description:g,tooltip:_,provenance:pe,enumLabels:v,displayComponent:b,parentData:x,resourceLinkTrail:e.resourceLinkTrail,renderItem:e.renderField,className:C,hideLabel:te,hideDescription:ne,resolvedChromeMode:N,resolvedLabelPlacement:P,resolvedLabelStyle:F,resolvedEmptyValue:fe,fileUploadContext:ae,wideValue:I,announceName:i===NA.SUMMARY};return(0,$.jsx)(SR,{name:o,children:_e&&c===_u.ARRAY?(0,$.jsx)(VA,{active:k,name:o,label:m,children:(0,$.jsx)(Whe,{name:o,schema:s,value:l,label:m,description:g,doInlineUpdate:ie,renderField:e.renderField,sectionAppearance:e.sectionAppearance,objectItemLayout:e.objectItemLayout,enumLabels:v,hideLabel:te,displayChromeMode:ee?fA(N,ee):typeof N==`string`?N:void 0})}):_e?(0,$.jsx)(VA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(iR,{...Ee,doInlineUpdate:ie,rmm:oe})}):c===_u.ARRAY&&e.sectionAppearance?(0,$.jsx)(VA,{active:k,name:o,label:m,children:(0,$.jsx)(SM,{...Ee,sectionAppearance:e.sectionAppearance})}):(0,$.jsx)(VA,{active:ye,name:o,label:m,termAnnounced:Se,children:(0,$.jsx)(xM,{...Ee})})})}bR.displayName=`DisplayField`;var xR=bR,SR=class extends Q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){let n=this.props.name;vR.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}},CR=(0,Q.createContext)(null);function mge({value:e,children:t}){return(0,$.jsx)(CR.Provider,{value:e,children:t})}function wR(){return(0,Q.useContext)(CR)}var TR;(function(e){e.DEFAULT=`default`,e.ENTRY=`entry`,e.SECTION=`section`,e.DOCUMENT=`document`})(TR||={});var hge={[TR.DEFAULT]:void 0,[TR.ENTRY]:`h5`,[TR.SECTION]:`h4`,[TR.DOCUMENT]:`h3`};function ER({name:e,scale:t=TR.DEFAULT,className:n}){let r=wR(),{getRecipe:i}=Rg(),a=hge[t],o=i(oc.TYPOGRAPHY,y.HEADING),s=a?U(o.base,o.sizes?.[a]):void 0;if(r?.titleMountTracker&&(r.titleMountTracker.titleMounted=!0),e)return(0,$.jsx)(h_,{className:s,children:(0,$.jsx)(`div`,{"data-summary-title":``,className:U(`min-w-0 flex-1 text-foreground`,s?`leading-tight`:`font-medium leading-tight`,n),children:(0,$.jsx)(xR,{name:e,hideLabel:!0})})});let c=r?.primaryLabel;return c?(0,$.jsx)(Z,{as:`p`,"data-summary-title":``,className:U(`min-w-0 flex-1 font-medium text-foreground`,n),truncate:!0,children:c}):null}var DR;(function(e){e.AUTO=`auto`,e.TEMPLATE_OWNED=`template-owned`})(DR||={});var OR;(function(e){e.STACK=`stack`,e.ROW=`row`})(OR||={});var gge={[OR.STACK]:`flex flex-col gap-element text-sm`,[OR.ROW]:`flex flex-wrap items-center gap-x-group gap-y-item text-sm`};function kR(e){let t=!1;return Q.Children.forEach(e,e=>{if(t||!(0,Q.isValidElement)(e))return;if(e.type===ER){t=!0;return}let n=e.props?.children;n!==void 0&&kR(n)&&(t=!0)}),t}function AR({flow:e=OR.STACK,className:t,titlePlacement:n=DR.AUTO,children:r}){let i=n===DR.AUTO&&!kR(r);return(0,$.jsx)(wD,{pathPrefix:``,children:(0,$.jsxs)(`div`,{className:U(gge[e],t),children:[i&&(0,$.jsx)(ER,{}),r]})})}function jR({name:e,className:t,children:n}){let{pathPrefix:r}=TD(),i=r?`${r}.${e}`:e,a=(0,$.jsx)(wD,{pathPrefix:i,children:n});return t?(0,$.jsx)(`div`,{className:t,children:a}):a}Ck(jR,bk.FIELD_SLOT_CONTAINER);function MR({field:e,variants:t,fallback:n}){let r=zC({name:ED(e)}),i=r==null?void 0:t[String(r)];return(0,$.jsx)($.Fragment,{children:i??n??null})}function NR({field:e,variants:t,fallback:n}){let r=ED(e),i=cA(rk()?.data,r),a=i==null?void 0:t[String(i)];return(0,$.jsx)($.Fragment,{children:a??n??null})}function PR(e,t,n){let r=me(t),i=un(t);return{name:e,schema:t,schemaType:r,showWhenParams:i,showWhenWatchFields:i?RR(i):void 0,isDiscriminator:n===e}}function FR(e,t){let n=hr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return[];let i=[];for(let e of r){let r=n[e];Zu(r)||ou(r)||i.push(PR(e,r,t))}return i}function IR(e){return Da(e)}function LR(e){let t=lr(e);if(!qne(t))return null;let n=La(t,`discriminator`),r=Kn(t,`options`)??[];if(!n||r.length===0)return null;let i=e=>!!e&&!Zu(e)&&!ou(e),a=r.map(e=>new Set(Jr(e))),o=[...a[0]??new Set].filter(e=>e!==n&&a.every(t=>t.has(e))),s=F(r[0]),c=s?o.filter(e=>i(s[e])).map(e=>PR(e,s[e])):[],l=[];for(let e of r){let t=F(e);if(!t)continue;let r=Ene(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=>PR(e,t[e]))})}return{discriminator:n,commonFields:c,variants:l}}function _ge(e){let t=LR(e);if(t)return{discriminatorField:t.discriminator,inheritedSchemas:t.variants.map(e=>({discriminatorFieldValue:e.value,schema:e.schema}))}}function vge(e){let t=LR(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)(QL,{name:e.name},e.name))}));return(0,$.jsxs)(jR,{name:e.name,children:[(0,$.jsx)(QL,{name:t.discriminator}),t.commonFields.map(e=>(0,$.jsx)(QL,{name:e.name},e.name)),Object.keys(n).length>0&&(0,$.jsx)(MR,{field:t.discriminator,variants:n})]},e.name)}function RR(e){let t=Array.isArray(e.conditions)?e.conditions:[e.conditions];return[...new Set(t.map(e=>e.field))]}function zR(e,t){let n=t?.inheritanceConfig??_ge(e),r=FR(e,n?.discriminatorField);AT.FORM;let i=t?.includeSubmitButton!==!1,a=t?.includeErrorSummary!==!1;if(r.length===0){let e=()=>(0,$.jsx)(tA,{autoInjectSubmitButton:i});return e.displayName=`GeneratedFormTemplate(empty)`,e}let o=Sge(r),s=o.length>0,c=new Set(r.map(e=>e.name)),l=()=>{let e=yge(s,o),t=LT(),l=new Set(Object.keys(t?.contextFieldValues??{}));for(let e of t?.hiddenFieldNames??[])l.add(e);return(0,$.jsxs)(tA,{autoInjectSubmitButton:i,children:[a&&(0,$.jsx)(eO,{}),r.map(r=>{let i=!!t?.generatedFieldOverrides?.[r.name],a=l.has(r.name)&&!i?null:bge(r,n,c,l,t?.generatedFieldOverrides,e,o);return!r.showWhenParams||!e||UR(r.showWhenParams,e,o)?a:null}),i&&(0,$.jsx)(nO,{})]})};return l.displayName=`GeneratedFormTemplate`,l}function yge(e,t){let n=zC({name:e?t:[]});return e?Array.isArray(n)?n:[n]:void 0}function bge(e,t,n,r,i,a,o){return i?.[e.name]?(0,$.jsx)(QL,{name:e.name},e.name):e.isDiscriminator&&t&&n&&r?xge(e,t,n,r,i):e.schemaType===_u.OBJECT?BR(e,a,o):(0,$.jsx)(QL,{name:e.name},e.name)}function xge(e,t,n,r,i){let a={};if(t.inheritedSchemas)for(let e of t.inheritedSchemas){let t=F(e.schema),o=Jr(e.schema);if(t&&o.length>0){let s=o.filter(e=>!Zu(t[e])&&!ou(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)(QL,{name:e},e))}))}}let o=Object.keys(a).length>0;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(QL,{name:e.name}),o&&(0,$.jsx)(MR,{field:t.discriminatorField,variants:a})]},e.name)}function BR(e,t,n,r=``){if(e.showWhenParams&&t&&n&&!UR(HR(e.showWhenParams,r),t,n))return null;let i=vge(e);if(i)return i;let a=IR(e.schema),o=Object.keys(a).filter(e=>{let t=a[e];return!Zu(t)&&!ou(t)});if(o.length===0)return(0,$.jsx)(QL,{name:e.name},e.name);let s=r?`${r}.${e.name}`:e.name;return(0,$.jsx)(jR,{name:e.name,children:o.map(e=>{let r=a[e];return me(r)===_u.OBJECT?BR(PR(e,r),t,n,s):(0,$.jsx)(QL,{name:e},e)})},e.name)}function Sge(e){let t=new Set;for(let n of e)VR(n,t);return[...t]}function VR(e,t,n=``){if(e.showWhenParams){let r=HR(e.showWhenParams,n);for(let e of RR(r))t.add(e)}if(e.schemaType!==_u.OBJECT)return;let r=IR(e.schema),i=n?`${n}.${e.name}`:e.name;for(let[e,n]of Object.entries(r))Zu(n)||ou(n)||VR(PR(e,n),t,i)}function HR(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 UR(e,t,n){let r={};for(let e=0;e<n.length;e++)r[n[e]]=t[e];return hr.evaluateShowWhen(e,r)}function WR(e,t={}){let n=LR(e);if(n)return()=>(0,$.jsx)(mA,{children:t.factsAsTiles?wge(n,t.resourceConfig):YR(n,t.resourceConfig)});let r=FR(e);if(AT.DISPLAY,r.length===0)return()=>(0,$.jsx)(mA,{});let i=GR(r,t.resourceConfig);if(t.factsAsTiles)return()=>(0,$.jsxs)(mA,{children:[i.state.length>0&&(0,$.jsx)(wA,{children:i.state.map(KR)}),i.content.map(JR),i.facts.length>0&&(0,$.jsx)(CA,{children:i.facts.map(JR)}),i.recordKeeping.length>0&&(0,$.jsx)(TA,{children:i.recordKeeping.map(JR)})]});let a=[...i.state,...i.content,...i.facts,...i.recordKeeping];return()=>(0,$.jsx)(mA,{children:a.map(JR)})}function GR(e,t){let n={state:[],content:[],facts:[],recordKeeping:[]};for(let r of e)switch(jA(r.name,r.schema,t)){case EA.STATE:(n.state.length===0?n.state:n.facts).push(r);break;case EA.CONTENT:n.content.push(r);break;case EA.FACT:n.facts.push(r);break;case EA.RECORD_KEEPING:n.recordKeeping.push(r);break;case EA.IDENTITY_PLUMBING:}return n}function KR(e){return(0,$.jsx)(xR,{name:e.name,labelPlacement:`hidden`},e.name)}function Cge({children:e}){let{displayChromeMode:t}=ok();return(0,$.jsx)(ak,{displayChromeMode:t,sectionChromeMode:Pc.INLINE,children:e})}function qR(e){return kA(e.schema)}function wge(e,t){let n=GR(e.commonFields,t),r={},i={};for(let t of e.variants){let e=t.fields.filter(qR),n=t.fields.filter(e=>!qR(e));e.length>0&&(r[t.value]=(0,$.jsx)($.Fragment,{children:e.map(JR)})),n.length>0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:n.map(JR)}))}return(0,$.jsxs)($.Fragment,{children:[n.state.length>0&&(0,$.jsx)(wA,{children:n.state.map(KR)}),n.content.map(JR),Object.keys(r).length>0&&(0,$.jsx)(NR,{field:e.discriminator,variants:r}),(0,$.jsxs)(CA,{children:[(0,$.jsx)(xR,{name:e.discriminator}),n.facts.map(JR),Object.keys(i).length>0&&(0,$.jsx)(NR,{field:e.discriminator,variants:i})]}),n.recordKeeping.length>0&&(0,$.jsx)(TA,{children:n.recordKeeping.map(JR)})]})}function JR(e){return e.schemaType===_u.OBJECT?Tge(e):(0,$.jsx)(xR,{name:e.name},e.name)}function YR(e,t){let n=GR(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(JR)}));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xR,{name:e.discriminator}),r.map(JR),Object.keys(i).length>0&&(0,$.jsx)(NR,{field:e.discriminator,variants:i})]})}function Tge(e){let t=LR(e.schema);if(t)return(0,$.jsx)(jR,{name:e.name,children:YR(t)},e.name);let n=IR(e.schema),r=Object.keys(n).filter(e=>{let t=n[e];return!Zu(t)&&!ou(t)});return r.length===0?(0,$.jsx)(xR,{name:e.name},e.name):(0,$.jsx)(jR,{name:e.name,children:r.map(e=>JR(PR(e,n[e])))},e.name)}function XR(e,t){let n=hr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return()=>(0,$.jsx)(AR,{titlePlacement:DR.AUTO});let i=e=>!V.isIdentityOnlySummaryField(e,t),a=r.filter(e=>{let t=n[e];return i(e)&&!ou(t)&&bs(t)}),o=a.length>0?a:r.filter(e=>i(e)&&!ou(n[e])),s=t?.frontendConfiguration?.layout?.defaultChromeMode?.summary!==void 0,c=o.map(e=>me(n[e]));return()=>{let e=rk(),t=e?.data,n=t!==void 0&&e?.isLoading!==!0,r=o.map(e=>!n||YA(t?.[e])),i=s?[]:XA(o.map((e,t)=>({schemaType:c[t],present:r[t]})));return(0,$.jsx)(AR,{titlePlacement:DR.AUTO,children:o.map((e,t)=>r[t]?i[t]?(0,$.jsx)(Cge,{children:(0,$.jsx)(xR,{name:e})},e):(0,$.jsx)(xR,{name:e},e):null)})}}function Ege(e,t){return t!==W.UPDATE||!e?!1:Object.values(e).some(e=>{let t=Yc(e)?.autosave;return t===void 0?!1:t===!0||typeof t==`object`&&t.enabled!==!1})}function ZR(e,t){return e?.cause instanceof Error?e.cause:Error(e?.message??t)}var QR=(0,Q.createContext)(null);function $R(e){let{tErrorValidation:t,tErrorMessage:n,t:r}=K(),i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{a.current?.unsubscribe()},[]);let o=(0,Q.useCallback)(e=>{a.current?.unsubscribe();let t=e.watch((t,{name:n})=>{n&&i.current.has(n)&&(e.clearErrors(n),i.current.delete(n))});a.current=t},[]),s=(0,Q.useCallback)(()=>{e.current&&i.current.size>0&&(Array.from(i.current).forEach(t=>{e.current.clearErrors(t)}),i.current.clear())},[e]);return{initAutoClearing:o,injectServerErrors:(0,Q.useCallback)(a=>{e.current&&(Object.entries(a).forEach(([a,o])=>{let s=FD.isFormLevelErrorPath(a)?oT:a,c=(_(o)&&o.code===ka.DECLARED_REFUSAL?Tp({tErrorMessage:n,t:r},o.params?.refusalCode):void 0)??(_(o)?t(o.code,`msg`,o.params):o);e.current.setError(s,{type:iT,message:c}),i.current.add(s)}),KD(Object.keys(a).map(e=>FD.isFormLevelErrorPath(e)?oT:e)))},[e,t,n,r]),clearServerErrors:s}}function ez(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=On.getResourceId(s);c&&c!==o&&(a??={...n},a[r]=o)}return a}function tz(e,t){if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[t?.[e]??e,n]))}function nz(e){return e?.requestFieldRowFields}function rz(e,t){let{emit:n}=Ao(),r=(0,Q.useContext)(sm),{registry:i}=lm(),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 Ia(t?.operations??[],W.LIST).filter(e=>Jv({operation:e,contextResourceIdentifiers:r,contextualParameters:a}))},[e.contextResourceIdentifiers,e.resourceType,i]);return(0,Q.useCallback)((r,i)=>{if(wn(r))return;n(wc.RESOURCE_OPERATION_EXECUTED,{resourceType:e.resourceType,operationIdentifier:String(t.operationIdentifier),operation:t,variantType:t.variantType,isOperationDefault:t.isOperationDefault??!0,isBulkOperation:t.isBulkOperation??!1,variantKey:t.variantKey,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:e.resourceType,result:r,isBulkOperation:t.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements,optionalDiscriminator:Rc(e.additionalContext),resultSummary:Yu(r),...i?.partialWrite?{isPartialWrite:!0}:{}});let s=t.admitsCrossTenantPlatformAdministration===!0;if(!t.isBulkOperation&&!s||Ai(t,a))return;let{[e.resourceType]:c,...l}=Vu(e.contextResourceIdentifiers),u=o.length>0?o:[null];for(let t of u)n(wc.RESOURCE_REFRESH,{resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),operation:t??{operationIdentifier:W.LIST},variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:l,parentResourcesRequirements:e.parentResourcesRequirements})},[n,a,o,t,e.additionalContext,e.contextResourceIdentifiers,e.parentResourcesRequirements,e.resourceType])}function Dge(e){let{apiBaseUrl:t,initiatorInfo:n,contextualParameters:r}=e,i=zm.resolveUrlPath(n.url,r);if(i&&!zm.hasUnresolvedPlaceholders(i))return`${t}${i}/validate-field`}var iz=rs.getLogger(),az=iz.debugByType(`HttpTransportAdapter`);iz.setDebugTypeLogging(`HttpTransportAdapter`,!1);function Oge(e){let t=e?.context;if(!t||typeof t!=`object`)return;let n=t,r=$te.safeParse(n.versionConflict);return r.success?r.data:void 0}function kge(e){let t=e.httpStatus;return t!=null&&typeof t==`number`&&!Number.isNaN(t)}function Age(e){return e>=500?dE.SERVER:e>=400&&!uc.has(e)?dE.REFUSED:dE.TRANSIENT}function oz(e,t,n){let r=e?.validationErrors;return typeof r==`object`&&r&&Object.keys(r).length>0?{type:dE.VALIDATION,status:t,validationErrors:r,message:n}:{type:dE.REFUSED,status:t,message:n}}var jge=class{_doOperation;constructor(e){this._doOperation=e}async execute(e){az(`execute`,{operationPathKey:e.operationPathKey,fields:e.requestData?Object.keys(e.requestData):[],expectedVersion:e.expectedVersion});try{let t={};e.expectedVersion!=null&&(t[qu.IF_MATCH]=String(e.expectedVersion));let n=e.fieldTimestamps?{...e.requestData,_field_timestamps:e.fieldTimestamps}:e.requestData,r=await this._doOperation(e.operationPathKey,{contextualParameters:e.contextualParameters,requestData:n,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:e.dataMode},{signal:e.signal,silent:!0,headers:Object.keys(t).length>0?t:void 0}),i=wn(r);if(i)return az(`execute: held for approval`,{decisionRef:i.decisionRef}),{status:fE.SUCCESS,heldForApproval:i};let a=r,o={status:fE.SUCCESS,data:a??void 0,newVersion:a?._version,fieldMeta:a?._field_meta};return az(`execute: success`,{newVersion:o.newVersion}),o}catch(t){let n=this._mapError(t,e.expectedVersion!=null);return az(`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!==dE.SERVER&&n.error.type!==dE.TRANSIENT||ha(e)||cl(e)||(n.error.resendable=Uee(e,Ba.REDISPATCH))),n}_classifyError(e,t){if(ree(e))return{status:fE.ERROR,error:{type:dE.ABORT}};if(ha(e)||cl(e))return{status:fE.ERROR,error:{type:dE.TRANSIENT,message:e.message}};let n=kge(e)?e.httpStatus:void 0;if(n!=null)switch(n){case 400:case 422:return{status:fE.ERROR,error:{type:dE.VALIDATION,status:n,validationErrors:e.validationErrors,message:e.message??String(e)}};case 404:case 410:return{status:fE.ERROR,error:{type:dE.NOT_FOUND,status:n}};case 409:if(e?.customMessageReference===ql.VERSION_CONFLICT){let r=Oge(e);return!r&&!t?{status:fE.ERROR,error:oz(e,n,e?.message??String(e))}:r?{status:fE.ERROR,error:{type:dE.CONFLICT,status:n,conflictDetails:r}}:{status:fE.ERROR,error:{type:dE.SERVER,status:n,message:`Version conflict response missing authoritative conflict details.`}}}return{status:fE.ERROR,error:oz(e,n,e?.message??String(e))};default:return{status:fE.ERROR,error:{type:Age(n),status:n,message:String(e)}}}return{status:fE.ERROR,error:{type:dE.TRANSIENT,message:po(e)}}}},Mge=15e3,Nge=3e4,Pge=[1e3,3e3],Fge=2e3,Ige=3e5;function sz(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}:{},...cz(e)}}function cz(e){let t=tp(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 lz=rs.getLogger(),uz=lz.debugByType(`ResourceMutationManager`);lz.setDebugTypeLogging(`ResourceMutationManager`,!1);var Lge=64;function Rge(e,t){let n=CM(t).split(`.`).filter(Boolean),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=Array.isArray(r)?r[Number(e)]:r[e]}return r}function dz(e,t){let n=Object.keys(e).filter(e=>CM(e).includes(`.`));if(n.length===0)return e;if(t===null)throw Error(`Cannot write ${n.join(`, `)} before the record's stored state is known: the stored siblings would be erased.`);let r={};for(let[t,i]of Object.entries(e))n.includes(t)||(r[t]=i);for(let i of n){let n=CM(i).split(`.`)[0];if(n in r)r[n]!==null&&typeof r[n]==`object`&&(r[n]=structuredClone(r[n]));else{let e=t?.[n];r[n]=typeof e==`object`&&e?structuredClone(e):void 0}pz(r,i,e[i])}return r}var fz=new Set([lE.SECTION,lE.AUTOSAVE,lE.INLINE]);function pz(e,t,n){let r=CM(t).split(`.`).filter(Boolean),i=e;for(let e=0;e<r.length-1;e++){let t=r[e],a=r[e+1],o=/^\d+$/.test(a)?[]:{};if(i[t]===void 0||i[t]===null||typeof i[t]!=`object`){if(n===void 0)return;i[t]=o}i=i[t]}let a=r[r.length-1];n===void 0?Array.isArray(i)&&/^\d+$/.test(a)?delete i[Number(a)]:delete i[a]:Array.isArray(i)&&/^\d+$/.test(a)?i[Number(a)]=n:i[a]=n}var mz;(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`})(mz||={});var hz={type:uE.FORM,subscriberId:`autosave`},gz={maxQueueDepth:5,softTimeoutMs:Mge,hardTimeoutMs:Nge},_z=class{resourceType;_resourceId;_confirmedData=null;_version=null;_pendingFields=new Map;_queue=[];_activeMutation=null;_state=sE.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=[...Pge];_serverRetryDelay=Fge;_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??gz.maxQueueDepth,softTimeoutMs:t?.softTimeoutMs??gz.softTimeoutMs,hardTimeoutMs:t?.hardTimeoutMs??gz.hardTimeoutMs},this._crdtFieldNames=N({mainSchema:e.resourceSchema,inheritenceSchemaDefinition:e.resourceInheritance}),this._discriminatorFieldNames=kE(e.resourceSchema),this.subscribe=this.subscribe.bind(this),this.getSnapshot=this.getSnapshot.bind(this),uz(`constructor`,{resourceType:e.resourceType,resourceId:e.resourceId,conflictStrategy:e.conflictPolicy.strategy,operationPathKey:e.operationPathKey,crdtFieldCount:this._crdtFieldNames.size,crdtFields:Array.from(this._crdtFieldNames)})}_getAdjustedTimestamp(){let e=Date.now()+this._clockOffset;return this._lastIssuedLocalTimestamp=gee(Math.max(1,e),this._lastIssuedLocalTimestamp),this._lastIssuedLocalTimestamp}_isCrdtManagedField(e){return this._crdtFieldNames.has(e)||this._crdtFieldNames.has(e.split(`.`)[0]??e)}set clockOffset(e){this._clockOffset=e}get resourceId(){return this._resourceId}get contextualParameters(){return this._config.contextualParameters}get contextResourceIdentifiers(){return this._config.contextResourceIdentifiers??{}}get parentResourcesRequirements(){return this._config.parentResourcesRequirements}get readOperationPathKey(){return this._config.readOperationPathKey}syncRuntimeRoutingConfig(e){if(this._state===sE.DELETED)return;let t=Object.prototype.hasOwnProperty.call(e,`readOperationPathKey`),n=Object.prototype.hasOwnProperty.call(e,`parentResourcesRequirements`),r=e.operationPathKey!==void 0&&e.operationPathKey!==this._config.operationPathKey,i=t&&e.readOperationPathKey!==this._config.readOperationPathKey,a=e.transportAdapter!==void 0&&e.transportAdapter!==this._config.transportAdapter,o=e.conflictPolicy!==void 0&&e.conflictPolicy.strategy!==this._config.conflictPolicy.strategy,s=e.resourceSchema!==void 0&&e.resourceSchema!==this._config.resourceSchema||e.resourceInheritance!==void 0&&e.resourceInheritance!==this._config.resourceInheritance;this._config={...this._config,...e.transportAdapter===void 0?{}:{transportAdapter:e.transportAdapter},currentUserId:e.currentUserId,...e.contextResourceIdentifiers===void 0?{}:{contextResourceIdentifiers:{...e.contextResourceIdentifiers}},contextualParameters:{...e.contextualParameters},...n?{parentResourcesRequirements:e.parentResourcesRequirements}:{},...e.operationPathKey===void 0?{}:{operationPathKey:e.operationPathKey},...t?{readOperationPathKey:e.readOperationPathKey}:{},...e.conflictPolicy===void 0?{}:{conflictPolicy:e.conflictPolicy},...e.resourceSchema===void 0?{}:{resourceSchema:e.resourceSchema},...e.resourceInheritance===void 0?{}:{resourceInheritance:e.resourceInheritance}},s&&(this._crdtFieldNames=N({mainSchema:this._config.resourceSchema,inheritenceSchemaDefinition:this._config.resourceInheritance}),this._discriminatorFieldNames=kE(this._config.resourceSchema)),uz(`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===sE.DELETED)return;this._confirmedData={...e},this._version=t,this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1;let r=n??e._field_meta;this._fieldMeta=r==null?null:Pr(r),this._invalidateSnapshot(),uz(`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===sE.DELETED)return uz(`queueMutation: rejected — resource deleted`,{resourceId:this._resourceId}),Promise.reject(new vE);let n=t?.priority??gE.LOW,r=t?.type??lE.AUTOSAVE,i=t?.source??hz;return this._queue.length>=this._backpressure.maxQueueDepth&&n<=gE.LOW?(uz(`queueMutation: rejected — backpressure`,{queueDepth:this._queue.length,maxDepth:this._backpressure.maxQueueDepth}),Promise.reject(new yE)):(uz(`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>=gE.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:mz.QUEUE_MUTATION}),this._processQueue()}))}autosave(e){this.queueMutation(e,{type:lE.AUTOSAVE,priority:gE.LOW,source:hz}).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:lE.AUTOSAVE,priority:e?.priority??gE.NORMAL,source:e?.source??hz,signal:e?.signal})}cancelPendingMutations(e){if(this._state!==sE.DELETED){uz(`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 _E(e)),null);for(let t of this._queue)t.reject(new _E(e));this._queue=[],this._deferredSelfEvents=[],this._pendingFieldTimestamps.clear(),this._transition({type:mz.CANCEL})}}acknowledgeConflict(){this._state===sE.CONFLICT&&(uz(`acknowledgeConflict`,{resourceId:this._resourceId}),this._transition({type:mz.CONFLICT_ACKNOWLEDGED}),this._processQueue())}_isOwnEcho(e){return this._producedVersions.has(e)}_recordProducedVersion(e){if(e!=null&&(this._producedVersions.add(e),this._producedVersions.size>Lge)){let e=this._producedVersions.values().next().value;e!==void 0&&this._producedVersions.delete(e)}}applyRemoteUpdate(e,t,n,r){if(this._state!==sE.DELETED){if(this._isOwnEcho(t)){if(this._activeMutation!==null){uz(`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,uz(`applyRemoteUpdate: accepting settled own-echo after canonical read-back miss`,{version:t}),this._applyRemoteUpdateInternal(e,t,n,r,!0);return}uz(`applyRemoteUpdate: own-echo discarded (no in-flight mutation)`,{version:t})}else this._activeMutation!==null&&n!==void 0&&n===this._config.currentUserId?(uz(`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){uz(`handleDeletion`,{reason:e,deletedBy:t,resourceId:this._resourceId}),this._transition({type:mz.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===sE.SAVING,isDeleted:this._state===sE.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(){uz(`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){uz(`destroy: flushPendingFields failed`,{resourceId:this._resourceId,attempt:e,error:po(t)});break}this._pendingFields.size>0&&uz(`destroy: completing with pending fields remaining (flush exhausted or failed)`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size}),(this._activeMutation||this._queue.length>0)&&(uz(`destroy: waiting for drain`,{queueDepth:this._queue.length}),await new Promise(e=>{this._onDrainCallbacks.push(e)})),this._clearTimers(),this._clearAuthoritativeRecoveryTimer(),this._snapshotListeners.clear(),uz(`destroy: complete`,{resourceId:this._resourceId})}_transition(e){let t=this._state;switch(e.type){case mz.QUEUE_MUTATION:if(this._state===sE.IDLE)this._state=sE.QUEUED;else if(this._state===sE.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 _E(e.entry.source))}this._state=sE.QUEUED}this._invalidateSnapshot();return;case mz.START_SAVING:this._state===sE.QUEUED&&(this._state=sE.SAVING,this._lastError=null,this._startBackpressureTimers());break;case mz.SAVE_SUCCESS:{this._state=this._queue.length>0||this._pendingFields.size>0?sE.QUEUED:sE.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:cE.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 mz.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:dE.SERVER,message:`Unknown error`};if(this._lastError=n,t===dE.CONFLICT){this._clearTimers(),this._state=sE.CONFLICT;let t=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new _E);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:cE.CONFLICT_RESET,discardedFields:t,reason:mE.VERSION_CONFLICT,currentData:a,currentVersion:o,conflictDetails:r,id:++this._eventCounter};break}if(t===dE.ABORT){this._clearTimers();let e=this._queue.length>0||this._pendingFields.size>0?sE.QUEUED:sE.IDLE;this._state=e,e===sE.IDLE&&(this._lastError=null);break}if(t===dE.VALIDATION||t===dE.NOT_FOUND||t===dE.REFUSED){if(this._clearTimers(),t===dE.VALIDATION&&this._activeMutation)for(let t of e.savedFields)this._pendingFields.has(t)||this._pendingFields.set(t,this._activeMutation.savingFields[t]);this._lastEvent={type:cE.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?sE.QUEUED:sE.IDLE;break}let r=this._activeMutation?.retryCount??0,i=n.resendable===!1?0:t===dE.TRANSIENT?this._retryDelays.length:+(t===dE.SERVER);if(r<i){let a=t===dE.TRANSIENT?this._retryDelays[r]:this._serverRetryDelay;this._state=sE.ERROR,this._lastEvent={type:cE.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===sE.ERROR&&this._activeMutation&&(this._activeMutation.retryCount++,uz(`retry: attempt`,{mutationId:this._activeMutation.entry.id,retryCount:this._activeMutation.retryCount,maxRetries:i,delayMs:a}),this._transition({type:mz.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 _E);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._lastEvent={type:cE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=sE.IDLE,this._emitTerminalMutationFailureNotification(n,a);break}case mz.RETRY:this._state===sE.ERROR&&(this._state=sE.SAVING);break;case mz.CONFLICT_DETECTED:this._clearTimers(),this._state=sE.CONFLICT,this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new _E),null);for(let e of this._queue)e.reject(new _E);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._confirmedData={...e.currentData},this._version=e.currentVersion,this._lastEvent={type:cE.CONFLICT_RESET,discardedFields:e.discardedFields,reason:e.reason,currentData:e.currentData,currentVersion:e.currentVersion,conflictDetails:e.conflictDetails,id:++this._eventCounter};break;case mz.CONFLICT_ACKNOWLEDGED:this._state===sE.CONFLICT&&(this._state=this._queue.length>0?sE.QUEUED:sE.IDLE,this._lastError=null);break;case mz.CANCEL:this._state=sE.IDLE,this._lastError=null;break;case mz.DELETE:this._clearTimers(),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._state=sE.DELETED,this._lastEvent={type:cE.RESOURCE_DELETED,reason:e.reason,deletedBy:e.deletedBy,id:++this._eventCounter};break;case mz.REMOTE_UPDATE:this._lastEvent={type:cE.REMOTE_UPDATE,changedFields:e.changedFields,mergedFields:e.mergedFields,version:e.version,initiatorUserId:e.initiatorUserId,crdtResolutions:e.crdtResolutions,id:++this._eventCounter}}this._state!==t&&uz(`_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=Ca.parseOperationPathKey(n)}catch{}try{_i.emit(wc.NOTIFY_RESOURCE_ERROR,{resourceType:this.resourceType,parentResourcesRequirements:[],operationIdentifier:String(r.operationIdentifier??W.UPDATE),isOperationDefault:r.isOperationDefault??!0,isBulkOperation:r.isBulkOperation??!1,variantKey:r.variantKey,operation:void 0,contextResourceIdentifiers:this._config.contextResourceIdentifiers??{},additionalContext:{error:e.message??`Saving failed after retries`,errorCustomMessageReference:e.type===dE.TRANSIENT?ql.NETWORK:sz(e.cause).errorCustomMessageReference,errorHttpStatus:e.status,errorRefusalCode:sz(e.cause).errorRefusalCode,...cz(e.cause),mutationErrorType:e.type,discardedFields:t}})}catch(e){uz(`_emitTerminalMutationFailureNotification: emit failed`,{resourceId:this._resourceId,error:po(e)})}}_processQueue(){if(this._activeMutation!==null||this._queue.length===0||this._state===sE.CONFLICT||this._state===sE.DELETED||this._state===sE.ERROR)return;let e=this._queue.shift(),t;if(e.type===lE.SUBMIT||e.type===lE.DRAFT||e.type===lE.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]}uz(`_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 _E(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:mz.START_SAVING}),this._executeTransport(this._activeMutation)}_executeTransport(e){let t=e;uz(`_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??(fz.has(e.entry.type)?AE(dz(e.savingFields,this._confirmedData),this._discriminatorFieldNames,this._confirmedData):dz(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){uz(`_executeTransport: stale callback — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),i=t.entry.source,a=e.status===fE.SUCCESS&&!e.heldForApproval&&r?.readBackOnSuccess?await this._readBackConfirmedState(e):e;if(a.status===fE.SUCCESS){uz(`_executeTransport: success`,{mutationId:t.entry.id,savedFields:n,newVersion:a.newVersion});let e=a.fieldMeta??a.data?._field_meta;e!=null&&(this._fieldMeta=Pr(e));for(let e of n)this._pendingFieldTimestamps.delete(e);let r=Object.entries(t.savingFields).filter(([,e])=>e===null).map(([e])=>e),o=fz.has(t.entry.type)?t.savingFields:void 0;this._transition({type:mz.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 uz(`_executeTransport: error`,{mutationId:t.entry.id,errorType:a.error?.type,errorStatus:a.error?.status,errorMessage:a.error?.message,savedFields:n}),this._transition({type:mz.SAVE_ERROR,result:a,savedFields:n,source:i}),this._state===sE.ERROR||(this._state===sE.CONFLICT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:dE.CONFLICT,conflictDetails:a.error?.conflictDetails}}),this._notifyDrained()):a.error?.type===dE.ABORT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.reject(new _E(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){uz(`_executeTransport: stale rejection — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),r=t.entry.source;uz(`_executeTransport: transport rejected`,{mutationId:t.entry.id,error:po(e),savedFields:n}),this._transition({type:mz.SAVE_ERROR,result:{status:fE.ERROR,error:{type:dE.TRANSIENT,message:po(e),cause:e}},savedFields:n,source:r}),this._state===sE.ERROR||(this._activeMutation=null,this._processDeferredSelfEvents(void 0),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:dE.TRANSIENT,message:po(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:zl.RAW,signal:void 0});return n.status===fE.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(),uz(`_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&&Rge(t,r)!==void 0||pz(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))pz(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))pz(e,t,n);for(let[t,n]of this._pendingFields)pz(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===sE.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))pz(o,e,t);for(let[e,t]of this._pendingFields)pz(o,e,t);if(this._version!==null&&(i?t<this._version:t<=this._version)){uz(`_applyRemoteUpdateInternal: stale — ignored`,{incomingVersion:t,currentVersion:this._version});return}let s=Object.keys(e),c=[...this._pendingFields.keys()],l=this._activeMutation?Object.keys(this._activeMutation.savingFields):[],u=[...new Set([...l,...c])],d=s.filter(e=>u.some(t=>TM(e,t)));uz(`_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)||(pz(g,t,e[t]),m.push(t));for(let t of f){let n=u.find(e=>TM(t,e)),i=r?.[t]?.ts??0,a=n?this._pendingFieldTimestamps.get(n)??0:0,o=mc(i,a);h[t]=o,o===Ec.INCOMING?(n&&(this._pendingFields.delete(n),this._pendingFieldTimestamps.delete(n)),pz(g,t,e[t]),m.push(t),uz(`CRDT LWW: remote wins`,{field:t,remoteTs:i,localTs:a})):uz(`CRDT LWW: local wins (keep pending)`,{field:t,remoteTs:i,localTs:a})}this._confirmedData=g,r!=null&&(this._fieldMeta={...Pr(this._fieldMeta),...Pr(r)}),this._version=t;let _=Object.keys(h).length>0?h:void 0;if(p.length===0||this._config.conflictPolicy.strategy===pE.LAST_WRITE_WINS){this._transition({type:mz.REMOTE_UPDATE,changedFields:s,mergedFields:m,version:t,initiatorUserId:n,crdtResolutions:_});return}let v=new Map,y=new Map;for(let e of f){let t=u.find(t=>TM(e,t)),n=t?this._pendingFieldTimestamps.get(t)??0:0,i=r?.[e]?.ts??0;if(t&&mc(i,n)===Ec.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))pz(b,t,n);let x=u.filter(e=>!v.has(e)),S={currentVersion:t,expectedVersion:a??t,conflictingFields:d,currentValues:Object.fromEntries(d.map(e=>[e,EM(b,e)])),submittedValues:Object.fromEntries(d.map(e=>[e,EM(o,e)]))};this._transition({type:mz.CONFLICT_DETECTED,discardedFields:x,reason:mE.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,uz(`_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}uz(`_processDeferredSelfEvents: discarded (version matches response)`,{version:n.version})}else uz(`_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===sE.DELETED||(this._authoritativeRecoveryTimer=setTimeout(()=>{this._authoritativeRecoveryTimer=null,this._retryAuthoritativeRecovery()},this._serverRetryDelay))}_clearAuthoritativeRecoveryTimer(){this._authoritativeRecoveryTimer&&=(clearTimeout(this._authoritativeRecoveryTimer),null)}async _retryAuthoritativeRecovery(){if(this._state===sE.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:zl.RAW,signal:void 0});if(t.status!==fE.SUCCESS||!t.data){uz(`_retryAuthoritativeRecovery: canonical reread still unavailable`,{errorType:t.error?.type,errorStatus:t.error?.status});return}let n=t.newVersion??this._version;n==null?uz(`_retryAuthoritativeRecovery: canonical reread missing version`,{resourceId:this._resourceId}):(uz(`_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&&(uz(`backpressure: soft timeout`,{mutationId:this._activeMutation.entry.id,timeoutMs:this._backpressure.softTimeoutMs}),this._lastEvent={type:cE.MUTATION_RESULT,result:{success:!1,error:{type:dE.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(),uz(`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 _E(this._activeMutation.entry.source)),null),this._deferredSelfEvents=[];let t=this._queue.length>0||this._pendingFields.size>0?sE.QUEUED:sE.IDLE;this._state=t,this._lastError=t===sE.IDLE?null:{type:dE.TRANSIENT,message:`Hard timeout exceeded`},this._lastEvent={type:cE.MUTATION_RESULT,result:{success:!1,error:{type:dE.TRANSIENT,message:`Hard timeout exceeded`},retriesRemaining:0},source:e??hz,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)}uz(`_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=rs.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 _z(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=rs.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}${w[rre.HEALTH_TIME]}`),i=Date.now(),a=r.headers.get(qu.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})},Ige);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=zl.RAW;function kz(e,t,n){let r=t.resourceConfigurations[e],i=r?.operations??[],a=(e,n)=>lh({resourceConfig:r,operations:e,coreOperation:W.READ,registry:t,hasResourceId:n.hasResourceId,contextResourceIdentifiers:n.contextResourceIdentifiers,contextualParameters:n.contextualParameters,preferredVariantKey:n.actingOperation?.variantKey}),o=n?.actingOperation?.admitsCrossTenantPlatformAdministration===!0?a(i.filter(e=>e.admitsCrossTenantPlatformAdministration===!0),n):void 0,s=n?o??a(i,n):$l(i,W.READ);if(s||!n||n.hasResourceId===!0)return s;let c=Ia(i,W.READ).filter(e=>e.isOperationDefault!==!0&&e.isBulkOperation!==!0&&(e.initiatorInfos??[]).some(e=>(e.parameters??[]).some(e=>n.contextResourceIdentifiers?.[String(e.resourceType)]!==void 0||n.contextualParameters?.[e.fieldIdentifier]!==void 0)));return c.length===1?c[0]:void 0}function Az(e,t,n){let r=t.resourceConfigurations[e]?.operations??[],i=Ia(r,W.READ),a=kz(e,t,n);if(a)return Ca.createOperationPathKeyFromOperation(a);if(i.length===0||n)return;let o=i.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(o.length===1)return Ca.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=rs.getLogger(),Pz=Nz.debugByType(`useListInvalidation`);Nz.setDebugTypeLogging(`useListInvalidation`,!1);function Fz(e,t){let n=(0,Q.useSyncExternalStore)(e?.subscribe??DM,e?.getSnapshot??OM),{emit:r}=Ao(),i=(0,Q.useContext)(sm)?.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===cE.MUTATION_RESULT&&n.lastEvent.result.success&&!a.current){let t=n.lastEvent.result,i=Qv({resourceType:e.resourceType,registry:o.current.registry,callContext:o.current.contextResourceIdentifiers,previousRow:t.previousConfirmedData,row:t.responseData}),s=Xv({resourceType:e.resourceType,registry:o.current.registry,scopes:i}),c=s.length>0?s:[null];for(let t of c){let n={resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:i.contextResourceIdentifiers,...i.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:i.previousContextResourceIdentifiers}:{},parentResourcesRequirements:o.current.parentResourcesRequirements,operation:t??{operationIdentifier:W.LIST}};r(wc.RESOURCE_REFRESH,n)}Pz(`list invalidation triggered`,{resourceType:e.resourceType,isConnected:a.current})}},[n.lastEvent?.id])}var Iz=rs.getLogger(),Lz=Iz.debugByType(`useResourceRMM`);Iz.setDebugTypeLogging(`useResourceRMM`,!1);var Rz={strategy:pE.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}=lm(),h=(0,Q.useContext)(th),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 jge((...e)=>r.current(...e)),[]),w=lS(Qm(t,S||void 0,o)),T=(0,Q.useMemo)(()=>uh({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?Ca.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??DM,k?.getSnapshot??OM);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}=Of();if(e.type===`conflict`){let n=e.conflictDetails?.conflictingFields?.length?e.conflictDetails.conflictingFields:e.discardedFields;return(0,$.jsxs)(AD,{variant:`warning`,children:[t(H.WARNING,{size:ca.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between gap-element`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(jD,{children:e.labels.title}),(0,$.jsx)(MD,{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:J.OUTLINE,size:Y.SM,onClick:e.onDismiss,className:`shrink-0`,children:e.labels.acknowledgeButton})]})]})}return(0,$.jsxs)(AD,{variant:`info`,className:`mb-item-xs`,children:[t(H.INFO,{size:ca.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,$.jsx)(MD,{children:Vz(e.labels.message,e.changedFields)}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:e.onDismiss,"aria-label":e.labels.dismissAriaLabel,className:`shrink-0`,children:t(H.CLOSE,{size:ca.SM})})]})]})},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}=lm(),{on:n}=Ao(),{navigate:r}=wS(),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>{if(e.sourceResourceType&&e.sourceFieldName)return Tj({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(wc.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(wc.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=On.createFrontendResourceOperationContextFromOperation({resourceType:s.relatedResourceType,operation:c,contextResourceIdentifiers:On.withoutSelfReferencingParents(e.contextResourceIdentifiers??{},s.relatedResourceType,t),additionalContext:{quickCreateRequest:i},isOperationDefault:c.isOperationDefault??!0,isBulkOperation:c.isBulkOperation??!1,variantKey:c.variantKey});r({content:{contentType:od.RESOURCE_OPERATION,resourceContext:l},initiator:zm.createOperationInitiator(e.navigationZone,e.sourceOperation),relationshipTransition:e.navigationZone===`overlay`?Rt.SPLIT:{transition:Rt.OVERLAY,ephemeral:!0}})},[s,r,t,e.contextResourceIdentifiers,e.navigationZone,e.sourceFieldName,e.sourceOperation,e.sourceResourceId,e.sourceResourceType,c]);return{canQuickCreate:!!(s?.allowQuickCreate&&c&&e.navigationZone),isLaunching:i,launchQuickCreate:l,relatedCreateOperation:c,config:s}}function Yz(e){e.emit(wc.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)(qM,{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=rs.getLogger();function Qz(e){ya.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=F(lr(r));if(!t||(r=t[e],!r))return}return r}var tB=rs.getLogger();function nB(e){let t=UC(),n=ND(),r=LT(),{registry:i,doOperation:a}=lm();mk(e.fieldName);let{formChromeMode:o,sectionChromeMode:s}=Qw(),c=pc(),{tComponent:l}=K(),u=eB(r?.schema,e.fieldName);return{formContext:t,formSchemaContext:n,templateContext:r,registry:i,doOperation:a,fieldSchema:u,resolvedChromeMode:(u?Yc(u):void 0)?.chromeMode??s??o??GL(c.autoRender?.autoFieldChrome),resolvedLabelPlacement:KL(c.autoRender?.autoLabelPlacement),resolvedControlSize:qL(c.autoRender?.autoFieldDensity),hideInlineErrorForPolicy:c.autoRender?.autoErrorPlacement===`summary-at-surface-top`,fieldLabel:r?.fieldLabels?.[e.fieldName]??hr.formatFieldPathFallback(e.fieldName),fieldDescription:r?.fieldDescriptions?.[e.fieldName],fieldTooltip:r?.fieldTooltips?.[e.fieldName],disabled:r?.disabled,readOnly:r?.readOnly,labels:{saveLabel:l(B.LOW_LEVEL_BUTTON,`save`),savingLabel:l(B.LOW_LEVEL_FORM_FIELD,`saving`),clearLabel:l(B.LOW_LEVEL_FORM_FIELD,`clearSelection`),saveFailedLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_failed`),saveConflictLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_conflict`),saveUnavailableLabel:l(B.LOW_LEVEL_FORM_FIELD,`save_unavailable`)}}}function rB(e){(0,Q.useEffect)(()=>{!e.rmm&&ya.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||me(f)===_u.ARRAY,M=r||k!==void 0,N=(0,Q.useMemo)(()=>{let e=new Map;if(!O||!A)return e;let t=Array.isArray(A)?A:[A];for(let n of t){if(!n||typeof n!=`object`||Array.isArray(n))continue;let t=n,r=t[O];typeof r==`string`&&r!==``&&e.set(r,t)}return e},[O,A]),P=(0,Q.useMemo)(()=>[...N.keys()],[N]),[F,I]=(0,Q.useState)(void 0),[ee,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{I(void 0),L(!1),z(void 0)},[o,l.resourceId]),(0,Q.useEffect)(()=>{I(void 0),L(!1),z(void 0)},[P.join(`|`)]);let te=F??(j?P:P[0]),ne=(0,Q.useMemo)(()=>[...new Set(Iw(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{L(!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=Ca.createOperationPathKeyFromOperation(t),f={...Dl([l.resourceId]),peerIds:e};if(i){let e=await i.queueMutation({[o]:j?a:a[0]??null},{type:lE.CUSTOM,priority:gE.NORMAL,source:{type:uE.FORM,subscriberId:`generated-association:${o}`},transportOverride:{operationPathKey:s,contextualParameters:n,parentResourcesRequirements:r,requestData:f,readBackOnSuccess:!0}});if(!e.success){z(e.error?.type===dE.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{L(!1)}}}},[a,P,N,d,o,c,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,M,ie,j,t,u,O,T,D,i]),ce=(0,Q.useCallback)(async()=>{await se(ne)},[ne,se]);return!f||!O?null:(0,$.jsx)(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)(yI,{schema:j?Nd(yd()).optional():yd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?o:void 0,value:te,onChange:ae,targetResourceType:s,onQuickCreateCreated:e=>{let t=[...new Set([...ne,e])];I(j?t:e),z(void 0),se(t)},onBlur:()=>{},disabled:b||x||ee||re,readOnly:x,controlSize:h,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Y.SM,className:`shrink-0`,disabled:!ie||ee||x||re,onClick:()=>{ce()},children:ee?C:S}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,className:`shrink-0`,disabled:ne.length===0||ee||x||re,onClick:oe,children:w})]})})}function 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),[ee,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),z(void 0)},[a,l.resourceId]),(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),z(void 0)},[M]);let te=F===void 0?M:F??void 0,ne=N??te;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{L(!0),z(void 0);try{let t=Ca.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={...Dl([l.resourceId]),...e===`set`?{targetId:p}:{}};if(r){let c=await r.queueMutation({[a]:e===`set`?s:null,[o]:e===`set`?p:null},{type:lE.CUSTOM,priority:gE.NORMAL,source:{type:uE.FORM,subscriberId:`generated-reference:${a}`},transportOverride:{operationPathKey:t,contextualParameters:n,parentResourcesRequirements:i,requestData:m,readBackOnSuccess:!0}});if(!c.success){z(c.error?.type===dE.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{L(!1)}}}},[n,ne,te,a,o,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,c,k,d,i,f,r,E,O,t]);return!p||!k||!o?null:(0,$.jsx)(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)(yI,{schema:yd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?a:void 0,value:ne,onChange:re,onQuickCreateCreated:e=>{P(e),z(void 0),ie(`set`,e)},onBlur:()=>{},disabled:x||S||ee||!r&&!i,readOnly:S,controlSize:g,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Y.SM,className:`shrink-0`,disabled:!N||N===te||ee||S||!r&&!i,onClick:()=>{ie(`set`)},children:ee?w:C}),n&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,className:`shrink-0`,disabled:!te||ee||S||!r&&!i,onClick:()=>{ie(`clear`)},children:T})]})})}var oB=rs.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,lC.default)(e,t)}function dB(e){return e.validationErrors?jM({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===cu.FRONT_END_SUCCESS&&n===Are.USER_SELF});return t?{identifier:t.identifier,level:t.level||Fl.SUCCESS}:null}function pB(e){switch(e){case W.CREATE:return`create`;case W.UPDATE:case W.UPDATE_MANY:return`saveChanges`;case W.DELETE:return`delete`;default:return`submit`}}function mB(e){return!e.success&&e.error?.type===dE.CONFLICT}function hB(e){return ds(e.operationIdentifier,e.resourceOperationLike)===W.READ||tl(e)}function gB(e,t,n,r){if(!e||h(t))return e;let i=n?Object.keys(n):[],a=r?hr.getObjectLikeFieldShape(r):void 0;if(i.length!==0&&a)return i.every(e=>Object.prototype.hasOwnProperty.call(a,e))?e:void 0}function _B({Template:e,requestFieldNames:t}){let n=kk(),r=LT(),[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)(QL,{name:e},e))}):null,claim:c}),[c,l,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ok.Provider,{value:n,children:(0,$.jsx)(QR.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:eD(`measure`)},"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(QL,{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:_}=lm(),{emit:v}=Ao(),{tComponent:y,tResourceOperation:b,isReady:x}=K({component:B.RESOURCES_LAYOUTS_CREATE,resource:e.resourceType}),S=ap(),w=(0,Q.useRef)(g),T=(0,Q.useRef)(v),E=(0,Q.useRef)(n),D=(0,Q.useRef)(t),k=(0,Q.useRef)(null),A=(0,Q.useRef)(d);w.current=g,T.current=v,E.current=n,D.current=t,A.current=d;let j=(0,Q.useMemo)(()=>new De,[]),{resourceType:M,operation:N,contextResourceIdentifiers:P}=e,F=rz(e,N),I=(0,Q.useContext)(oh),ee=(0,Q.useRef)(I);ee.current=I;let L=(0,Q.useCallback)(e=>wn(e)?(ee.current?.notifyInfo(y(B.RESOURCES_LAYOUTS_CREATE,`operationSentForApproval`)),!0):!1,[y]),R=m??wl(N,_.resourceConfigurations[M]?.operations),z=String(N.operationIdentifier),te=N.variantKey,ne=N.admitsCrossTenantPlatformAdministration===!0,re=(0,Q.useMemo)(()=>({variantKey:te,admitsCrossTenantPlatformAdministration:ne}),[ne,te]),ie=ds(z,N.resourceOperationLike?String(N.resourceOperationLike):void 0),ae=z,oe=N.resourceOperationLike?String(N.resourceOperationLike):void 0,se=oe??ae,ce=RT(ie,se),[le,ue]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(!1),[he,ge]=(0,Q.useState)(void 0),[_e,ve]=(0,Q.useState)(`none`),[ye,be]=(0,Q.useState)(null),xe=(0,Q.useRef)(null),{initAutoClearing:Se,injectServerErrors:Ce,clearServerErrors:we}=$R(xe),[Te,Ee]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(u?.isDraft??!1),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),Le=(0,Q.useRef)(null),Re=(0,Q.useMemo)(()=>{let e=N.requestDto;if(!e)return oB.error(`[ResourceAutomatedForm] No requestDto found for operation ${z} on resource ${M}`),e;if(N.isBulkOperation===!0&&e instanceof yae){let t=wre.filter(t=>t in e.shape),n=t.length>0?e.omit(Object.fromEntries(t.map(e=>[e,!0]))):e;return Ll(ie)?sae(n):n}return e},[ie,N,z,M]),ze=(0,Q.useMemo)(()=>_.resourceConfigurations[M],[_,M]),Be=(0,Q.useMemo)(()=>kE(ze?.mainSchema),[ze]),Ve=(0,Q.useMemo)(()=>ie===W.READ||z===W.UPDATE?new Set:new Set([ze?.mainSchema,...rl(ze?.inheritenceSchemaDefinition)].flatMap(e=>[...bo(e)])),[ie,z,ze]),He=(0,Q.useCallback)((e,t=!0)=>{let n=f??{},r=t?{...e,...n}:{...e};for(let e of Ve)Object.prototype.hasOwnProperty.call(n,e)||delete r[e];return r},[f,Ve]);(0,Q.useMemo)(()=>N.operationFrontendConfig,[N]);let Ue=ze?.frontendConfiguration?.layout?.refs,We=ze?.frontendConfiguration?.layout?.defaultChromeMode?.edit,Ge=(0,Q.useMemo)(()=>{let e=ze?.inheritenceSchemaDefinition;if(e)return{discriminatorField:e.discriminatorField,withoutInheritanceDiscriminatorFieldValues:e.withoutInheritanceDiscriminatorFieldValues,inheritedSchemas:e.inheritedSchemas}},[ze]),Ke=(0,Q.useMemo)(()=>{if(Re)return hr.getObjectLikeFieldShape(Re)},[Re]),qe=(0,Q.useMemo)(()=>gB(ze?.frontendConfiguration?.layout?.edit,N.operationIdentifier,Ke,ze?.inheritenceSchemaDefinition?jd(V.resolveFieldShapeOfAnyVariant(ze)??{}):ze?.mainSchema),[ze,N.operationIdentifier,Ke]),Je=ze?.frontendConfiguration?.draftableConfig,Ye=(0,Q.useMemo)(()=>{if(Je||u)return!Je&&u?u:Je&&!u?{enabled:!0,isDraft:!1,discriminator:Je.discriminator,draftValue:Je.draftValue,publishedValue:Je.publishedValue,requireConfirmationToPublish:Je.requireConfirmationToPublish}:{...Je,...u,enabled:u?.enabled??!!Je}},[Je,u]);(0,Q.useEffect)(()=>{Ye?.isDraft!==void 0&&Me(Ye.isDraft)},[Ye?.isDraft]);let Xe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(P),[P]),Ze=(0,Q.useMemo)(()=>V.buildContextualParameters(P,_),[Xe,_]),Qe=(0,Q.useMemo)(()=>{if(!Ke)return{};let t=V.resolveSemanticContextFieldValues({resourceType:M,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:P,contextualParameters:Ze,registry:_}),n={};for(let[e,r]of Object.entries(t))Ke[e]&&(n[e]=r);return n},[Xe,Ze,Ke,_,e.parentResourcesRequirements,M]),$e=(0,Q.useMemo)(()=>{if(!Ke)return{};let e={};for(let t of Object.keys(Ke)){let n=_j({resourceType:M,fieldName:t,operationType:se,registry:_});n&&(e[t]=n)}return e},[se,Ke,_,M]),et=ze?.operations??[],tt=(0,Q.useContext)(th)?.permissions?.accessProfile,nt=tt?.organizationUnitNarrowing,it=(0,Q.useMemo)(()=>ie===W.CREATE?Gue({resourceType:M,resourceConfiguration:ze,formFieldShape:Ke,readThroughCreateOrganizationUnits:tt?.readThroughCreateOrganizationUnits}):void 0,[tt?.readThroughCreateOrganizationUnits,ie,Ke,ze,M]),ot=que({resourceType:ll.ORGANIZATION_UNITS,ids:it,hostContextualParameters:Ze}),st=lg(),ct=Jp()?.currentOrganizationId??void 0,lt=ze?.resourcePrimaryScope===Vr.ORGANIZATIONS&&String(Ze[Qu[Vr.ORGANIZATIONS]]??ct??``)||void 0,ut=(0,Q.useMemo)(()=>Jue({roleEntries:tt?.roleEntries,organizationId:lt,roleTables:st,rolesWithinAuthority:tt?.rolesWithinAuthority}),[tt?.roleEntries,tt?.rolesWithinAuthority,lt,st]),dt=(0,Q.useMemo)(()=>Xue({fieldShape:Ke,ceiling:ut,record:he}),[Ke,ut,he]),ft=(0,Q.useMemo)(()=>Zue({fieldShape:Ke,ceiling:ut,record:he}),[Ke,ut,he]),pt=(0,Q.useMemo)(()=>{let e=it?{[Nr]:{values:it,labels:ot}}:void 0;return e||dt?{...dt,...e}:void 0},[it,ot,dt]),mt=(0,Q.useMemo)(()=>{if(!Ke)return[];let e=[];for(let t of Object.values($e)){let n=t.rootFieldName,r=e=>et.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Bl.buildRelationshipBulkOperationIdentifier(e,n));(()=>{if(t.semantics.nature===wi.COMPOSITION&&t.nestedMutationConfig)return!0;if(t.semantics.nature===wi.REFERENCE){let e=t.foreignKeyIdentity?.fieldIdentifier,n=e?Ke[e]:void 0;return!!(n&&Po(n)&&!Object.prototype.hasOwnProperty.call(Qe,e??``))||!!r(C.SET)}return t.semantics.nature===wi.ASSOCIATION&&!!r(C.REPLACE)})()?e.push(n):ya.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Keeping relationship root visible because no business-facing editor is available`,{resourceType:M,operationType:se,fieldName:n,relationshipNature:t.semantics.nature,hasNestedMutationConfig:!!t.nestedMutationConfig})}return Wue({resourceType:M,resourceConfiguration:ze,formFieldShape:Ke,organizationUnitNarrowing:nt})&&e.push(Nr),e},[Qe,se,Ke,nt,$e,ze,et,M]),ht=(0,Q.useMemo)(()=>Ca.createOperationPathKeyFromOperation(N),[N]),gt=(0,Q.useMemo)(()=>tl(N),[N]),_t=(0,Q.useMemo)(()=>{let e=On.getAddressedRecordId({resourceType:M,operation:N,contextResourceIdentifiers:P});if(e)return e;let t=he&&typeof he==`object`?he._id:void 0;return typeof t==`string`&&t.length>0?t:null},[Xe,he,M,N]),vt=(0,Q.useMemo)(()=>JSON.stringify(e.parentResourcesRequirements??[]),[e.parentResourcesRequirements]),yt=(0,Q.useMemo)(()=>!_t||P[M]?P:{...P,[M]:_t},[Xe,_t,M]),bt=(0,Q.useMemo)(()=>{let e=ze?.resourceFieldIdentifier;return!_t||!e||String(Ze[e]??``)===_t?Ze:{...Ze,[e]:_t}},[Ze,ze?.resourceFieldIdentifier,_t]),xt=(0,Q.useMemo)(()=>{if(!gt||ie!==W.UPDATE||N.operationIdentifier!==W.UPDATE||!ze)return ht;let e=lh({resourceConfig:ze,operations:et,coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt});return e?Ca.createOperationPathKeyFromOperation(e):ht},[Xe,yt,bt,ie,gt,N.operationIdentifier,ht,_,ze,_t,et]),St=(0,Q.useMemo)(()=>{let t=gt&&ie===W.UPDATE&&z!==W.UPDATE;return{operationPathKey:xt,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements,...t?{readBackOnSuccess:!0}:{}}},[bt,xt,ie,gt,z,e.parentResourcesRequirements]),Ct=(0,Q.useCallback)(t=>tc({operation:N,requestData:t,additionalContext:e.additionalContext}),[N,e.additionalContext]),{rmm:wt,rmmSnapshot:Tt,canonicalReadOperationPathKey:Et}=Bz({resourceType:M,resourceId:_t,doOperationRef:w,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:yt,resourceSchema:ze?.mainSchema,resourceInheritance:ze?.inheritenceSchemaDefinition,enabled:gt&&!!_t,conflictPolicy:{strategy:pE.ACCEPT_REMOTE},directFallbackAccepted:tr(R),actingOperation:re});ky({markerId:`rmm:${M}:${_t??``}`,isDirty:!!wt&&Tt.hasUnsavedChanges});let Dt=(0,Q.useMemo)(()=>tr(R),[R]),Ot=gt&&!Dt,kt=(0,Q.useCallback)(e=>{if(Ot&&!wt)throw new ua({surfaceName:e,resourceType:M,operationIdentifier:z})},[z,Ot,M,wt]);(0,Q.useEffect)(()=>{Ot&&!wt&&ya.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:M,operationIdentifier:z,hasResourceId:_t!==null,updateLikeMutationFallbackMode:R})},[z,Ot,_t,M,wt,R]);let At=(0,Q.useMemo)(()=>{if(!ze||!gt||!_t||!Ke)return{};let e={};for(let[t,n]of Object.entries($e)){let r=n.rootFieldName,i=e=>et.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Bl.buildRelationshipBulkOperationIdentifier(e,r));if(n.semantics.nature===wi.REFERENCE){let r=n.foreignKeyIdentity?.fieldIdentifier;if(!r)continue;let a=Ke[r];if(a&&Po(a)&&!Object.prototype.hasOwnProperty.call(Qe,r))continue;let o=i(C.SET),s=i(C.CLEAR);if(!o){ya.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping reference override because generated bulk set operation is unavailable`,{resourceType:M,fieldName:t,foreignKeyFieldName:r});continue}e[t]=(0,$.jsx)(aB,{writeSurface:n,setOperation:o,clearOperation:s,rmm:wt,allowDirectOperationFallback:Dt})}else if(n.semantics.nature===wi.ASSOCIATION){let r=i(C.REPLACE),a=he?cB(he,t):void 0,o=!!(he&&typeof he==`object`&&Object.prototype.hasOwnProperty.call(he,t));if(!r){ya.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping association override because generated bulk replace operation is unavailable`,{resourceType:M,fieldName:t});continue}e[t]=(0,$.jsx)(iB,{writeSurface:n,replaceOperation:r,initialRelationshipValue:a,hasHydratedInitialValue:o,rmm:wt,allowDirectOperationFallback:Dt})}}return e},[Qe,he,se,Ke,gt,_,ze,_t,et,M,$e,wt,Dt]),jt=(0,Q.useCallback)((e,t,n)=>{let r=xe.current;if(r)for(let i of e){if(n&&Object.prototype.hasOwnProperty.call(n,i)&&!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(!wt||!Tt?.lastEvent)return;let e=Tt.lastEvent;switch(e.type){case cE.MUTATION_RESULT:{let{result:t}=e;if(t.success&&t.savedFields&&jt(t.savedFields,Tt.confirmedData,t.savedValues),!t.success&&t.error?.type===dE.VALIDATION&&t.error.validationErrors){let e=jM({httpStatus:t.error.status??400,validationErrors:t.error.validationErrors});e&&Ce(e.validationErrors)}break}case cE.REMOTE_UPDATE:if(xe.current)for(let t of e.changedFields)xe.current.getFieldState(t).isDirty||xe.current.setValue(t,cB(Tt.confirmedData,t),{shouldDirty:!1,shouldValidate:!1});Ie({changedFields:e.changedFields,initiatorUserId:e.initiatorUserId}),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{Ie(null),Le.current=null},3e3);break;case cE.CONFLICT_RESET:xe.current&&xe.current.reset(He(e.currentData,!1)),we(),Pe({discardedFields:e.discardedFields,conflictingFields:e.conflictDetails?.conflictingFields??e.discardedFields,reason:e.reason,conflictDetails:e.conflictDetails});break;case cE.RESOURCE_DELETED:sB(`RMM resource deleted event`,{reason:e.reason})}},[Tt?.lastEvent?.id]),(0,Q.useEffect)(()=>()=>{Le.current&&=(clearTimeout(Le.current),null)},[]);let Mt=(0,Q.useCallback)(()=>{wt?.acknowledgeConflict(),Pe(null)},[wt]),Nt=(0,Q.useMemo)(()=>{let e={resourceContext:{resourceType:M,operationId:z}};return{...e,...o,navigation:{...e.navigation,...o?.navigation}}},[M,z,o]),Pt=(0,Q.useMemo)(()=>{let t=ie===W.CREATE,n=tl(N);if(!t&&!n)return null;try{let t=n?_t:null,r=ya.getApiUrl();if(!ze?.resourceFieldIdentifier)throw V.buildConfigurationError(ql.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:e.resourceType,component:`ResourceAutomatedForm`});let i=ze.resourceFieldIdentifier,a={...bt};t&&(a[i]=t);let o=N.variantType===at.API_CALL?N:ze&&n?lh({resourceConfig:ze,operations:ze.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt}):ze?$l(ze.operations??[],W.CREATE):void 0,s;if(o){let t=Vn.buildOperationFrontendRoutePaths(ze,o,_.allResourceFieldIdentifiers);if(t.length>0){let n=On.selectMatchingRoutePath(t,yt,ze.resourceIdentifier,i,e.parentResourcesRequirements);s=`${br}${n.url}`,s=zm.resolveUrlPath(s,a),s&&zm.hasUnresolvedPlaceholders(s)&&(oB.warn(`[ResourceAutomatedForm] Unresolved placeholders in routed API basePath; disabling route-derived helpers`,{basePath:s,resourceType:M,operationIdentifier:z}),s=void 0)}}return s?{apiBaseUrl:r,basePath:s,contextualParameters:a,resourceFieldIdentifier:i}:null}catch(e){return oB.error(`[ResourceAutomatedForm] Error computing resource API base:`,e),null}},[yt,bt,ie,N,_,ze,e,_t,M]),Ft=(0,Q.useMemo)(()=>{if(!Re||!Pt||!ze?.resourceFieldIdentifier)return{};let t={},n=tl(N),{apiBaseUrl:r,contextualParameters:i}=Pt;try{let a=N.variantType===at.API_CALL?N:n?lh({resourceConfig:ze,operations:ze.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt}):$l(ze.operations??[],W.CREATE);if(!a)return t;let o=Vn.buildOperationFrontendRoutePaths(ze,a,_.allResourceFieldIdentifiers);if(o.length===0)return t;let s=On.selectMatchingRoutePath(o,yt,ze.resourceIdentifier,ze.resourceFieldIdentifier,e.parentResourcesRequirements),c=`${r}/api/v1/files`,l=hr.collectUploadableFileFieldPaths(Re);for(let e of l){let a=Vn.buildFileUploadRouteForOperation({operationRouteUrl:s.url,operationParameters:s.parameters,targetResourceType:M,targetResourceFieldIdentifier:ze.resourceFieldIdentifier,fieldName:e,requiresTargetResourceId:n,isFrontend:!0}),o=zm.resolveUrlPath(a.url,i);if(zm.hasUnresolvedPlaceholders(o)){oB.warn(`[ResourceAutomatedForm] Unresolved placeholders in file upload path, skipping endpoint`,{fieldName:e,uploadPath:o});continue}let l=`${r}${br}${o}`;t[e]={upload:l,override:n?l:void 0,getMetadata:c,delete:n?void 0:c}}}catch(e){oB.error(`[ResourceAutomatedForm] Error generating file upload context:`,e)}return t},[yt,Re,N,vt,Pt,ze,M]),It=(0,Q.useMemo)(()=>{if(!Pt||!ze)return;let t=V.resolveFieldShapeOfAnyVariant(ze);if(!t||!Object.values(t).some(e=>vu(e)))return;let n=$l(ze.operations??[],W.CREATE),r=n?.initiatorInfos?.length?V.selectOperationUrlInitiatorInfo({initiatorInfos:n.initiatorInfos,contextualParameters:Pt.contextualParameters,targetResourceType:ze.resourceIdentifier,targetDefaultFieldIdentifier:Pt.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}):void 0;if(!r)return;let i=Dge({apiBaseUrl:Pt.apiBaseUrl,initiatorInfo:r,contextualParameters:Pt.contextualParameters});return i||oB.warn(`[ResourceAutomatedForm] validate-field URL has unresolved parameters; blur-time validation disabled`,{initiatorUrl:r.url,resourceType:M}),i},[Pt,ze,e.parentResourcesRequirements,M]),Lt=(0,Q.useMemo)(()=>_t??void 0,[_t]),Rt=(0,Q.useMemo)(()=>{if(!wt)return kz(M,_,{hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt,actingOperation:re})},[Xe,yt,bt,re,_,_t,M,wt]),zt=(0,Q.useMemo)(()=>wt?Et:Rt?Ca.createOperationPathKeyFromOperation(Rt):Az(M,_,{hasResourceId:!!_t,contextResourceIdentifiers:yt,contextualParameters:bt,actingOperation:re}),[Rt,Xe,yt,bt,re,_,_t,M,wt,Et]),Bt=(0,Q.useMemo)(()=>hB(N),[N]),Vt=(0,Q.useRef)(null),Ht=BS({operation:N,currentObject:Bt?he:void 0,resourceType:M,enabled:Bt&&le&&!ye}),Ut=(0,Q.useMemo)(()=>he&&He(he),[he,He]),Wt=N.isBulkOperation===!0&&Ll(ie),Gt=(0,Q.useMemo)(()=>{if(!Bt)return Wt?f:lde({formFieldShape:Ke,inheritanceConfig:Ge,defaultValuesOverride:f})},[Bt,Ke,Ge,f,Wt]),Kt=(0,Q.useCallback)((e,t,n={})=>rde({values:e,seed:void 0,schema:Re,writtenAsHeld:t,variantFields:Be,clears:n}),[Be,Re]),[qt,Jt]=(0,Q.useState)({}),Yt=(0,Q.useRef)(qt),Xt=Cne(e.additionalContext),Zt=(0,Q.useMemo)(()=>{let e=new Map;return t=>{if(Wt)return e.has(t)||e.set(t,ide(t,N.requestDto,Re,Be)),e.get(t)}},[Be,Re,N.requestDto,Wt]),Qt=(0,Q.useCallback)((e,t)=>{let n=t?Zt(e):void 0;if(t&&!n)return;let r={...Yt.current};if(n?r[e]=n.value:delete r[e],Yt.current=r,Jt(r),!n)return;let i=n.kind===XT.EMPTY?[]:n.kind!==XT.TURN_OFF&&void 0;xe.current?.setValue(e,i,{shouldDirty:!0}),xe.current?.clearErrors(e)},[Zt]),$t=(0,Q.useRef)(new Map),en=(0,Q.useCallback)(e=>{let t=$t.current;return t.set(e,(t.get(e)??0)+1),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),tn=(0,Q.useRef)(xt);(0,Q.useEffect)(()=>{tn.current!==xt&&(tn.current=xt,Object.keys(Yt.current).length!==0&&(Yt.current={},Jt({})))},[xt]);let nn=(0,Q.useCallback)(()=>Object.fromEntries(Object.entries(Yt.current).filter(([e])=>$t.current.has(e))),[]),rn=(0,Q.useCallback)(e=>{let t=Object.keys(e);if(t.length===0)return;let n={...Yt.current};for(let e of t)delete n[e];Yt.current=n,Jt(n)},[]),an=(0,Q.useMemo)(()=>Wt?{selectionCount:Xt,clearFor:Zt,isCleared:e=>Object.hasOwn(qt,e),setCleared:Qt,registerField:en}:null,[Zt,qt,Xt,en,Qt,Wt]);(0,Q.useEffect)(()=>{if(!Bt){ge(f??void 0),ve(`create`),ue(!0);return}let t=JSON.stringify({canonicalReadOperationPathKey:zt,contextResourceIdentifiersKey:Xe,parentResourcesRequirementsKey:vt});if(le&&Vt.current===t){if(wt&&he&&typeof wt.getSnapshot==`function`&&wt.getSnapshot().confirmedData===null&&typeof wt.setInitialState==`function`){let e=he;wt.setInitialState(e,e._version??0,e._field_meta)}return}let n=!1;return(async()=>{be(null);try{if(!zt)throw Error(`No addressable canonical READ operation is available for this resource form context.`);let r=await Mz({doOperation:w.current,readOperationPathKey:zt,contextualParameters:bt,parentResourcesRequirements:e.parentResourcesRequirements});if(n)return;let i=r;wt&&wt.setInitialState(i,i._version??0,i._field_meta),ge(f?{...i,...f}:r),Vt.current=t,ve(t),ue(!0)}catch(e){if(n)return;let t=e instanceof Error?e:Error(String(e)),r=O(e),i=j.buildWildoError_Frontend(za.NOT_FOUND,{customMessageReference:ql.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:zt,context:{resourceType:M,operationIdentifier:z,originalErrorMessage:t.message,originalErrorStack:t.stack,httpCode:r.code,httpContext:r.context}});be({wildoError:i,message:S(e)}),E.current?.(t)}})(),()=>{n=!0}},[Bt,zt,M,Xe,bt,vt,j,z,f,wt,le,he]);let on=(0,Q.useCallback)(async t=>{k.current?.(),fe(!0),we(),sB(`handleSubmit: starting`,{operationPathKey:ht,dataKeys:Object.keys(t||{})});try{let n;if(wt){let e=gt&&ez({resourceType:M,contextResourceIdentifiers:yt,rowValues:tz(t,nz(N)),registry:_})!==void 0,r=await wt.queueMutation(t,{type:lE.SUBMIT,priority:gE.HIGH,source:{type:uE.FORM,subscriberId:`submit`},transportOverride:e?{...St,readBackOnSuccess:!1}:St});if(!r.success){if(mB(r))return;if(r.error?.type===dE.VALIDATION){E.current?.(ZR(r.error,`Validation failed`));return}throw ZR(r.error,`Submit failed`)}n=r.heldForApproval??r.responseData}else{kt(`ResourceAutomatedForm submit`);let e=Object.keys(Qe),r=Wt?nn():{},i=Wt?Kt(t,e,r):t,a=z===W.UPDATE||z===W.UPDATE_MANY;if(Wt&&a&&Object.keys(i).every(t=>e.includes(t))){Ce({[oT]:y(B.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0}),rn(r)}if(sB(`handleSubmit: success`,{operationPathKey:ht}),L(n)){D.current?.(n);return}let r=fB(N);if(r){let t=r.level===Fl.WARNING?wc.NOTIFY_RESOURCE_WARNING:r.level===Fl.ERROR?wc.NOTIFY_RESOURCE_ERROR:r.level===Fl.INFO?wc.NOTIFY_RESOURCE_INFO:wc.NOTIFY_RESOURCE_SUCCESS;T.current(t,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Yu(n),additionalContext:{...e.additionalContext,notificationIdentifier:r.identifier,notificationLevel:r.level,result:n}})}let i=e.additionalContext?.quickCreateRequest;if(i?.requestId&&ie===W.CREATE){let e=qz({result:n,resourceType:M,registry:_});e&&Yz({emit:T.current,requestId:i.requestId,resourceType:M,resourceId:e,data:typeof n==`object`&&n&&!Array.isArray(n)?n:void 0})}D.current?.(n)}catch(t){if(t instanceof _E)return;let n=t instanceof Error?t:Error(String(t));sB(`handleSubmit: error caught`,{message:n.message,operationPathKey:ht});let r=jM(t);r?(sB(`handleSubmit: server validation errors detected`,{httpStatus:r.httpStatus,fields:Object.keys(r.validationErrors)}),Ce(r.validationErrors)):(sB(`handleSubmit: general error (not validation)`,{message:n.message}),T.current(wc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,error:n.message,...sz(t)}})),E.current?.(n)}finally{fe(!1)}},[kt,Qe,yt,St,gt,_,M,Ce,Ct,z,ht,Ze,N,e,wt,y,Kt,rn,nn,Wt]),sn=e=>{sB(`handleError: client-side validation failed`,{errorCount:Object.keys(e).length,fields:Object.keys(e)}),oB.warn(`[ResourceAutomatedForm] Form validation errors`,e),KD(GD(e))};(0,Q.useEffect)(()=>{if(!f||!xe.current)return;let e=he?He(he):f;xe.current.reset(e)},[f]);let cn=(0,Q.useCallback)(e=>{if(xe.current=e,Se(e),f){let t=he?He(he):f;e.reset(t)}},[Se,f]),ln=(0,Q.useCallback)(async e=>xe.current?xe.current.trigger(e):(sB(`validateAutosaveField: form methods unavailable, failing closed`,{fieldName:e}),!1),[]),un=(0,Q.useCallback)(async(e,t,n)=>{kt(`ResourceAutomatedForm autosave`);let r=()=>{if(n.aborted)throw new DOMException(`Autosave aborted`,`AbortError`)};r();let i=!wt&&Wt?YT(nn(),JT([e],Re)):{},a=!wt&&Wt?Kt(UT(Que(xe.current?.getValues()??{},e,t),JT([e],Re)),[],i):void 0;if(a&&Object.keys(a).length===0)return;let o=wt?wt.queueMutation({[e]:t},{type:lE.AUTOSAVE,priority:gE.LOW,transportOverride:St}).then(e=>{if(!e.success)throw e.error??Error(`Autosave failed`)}):w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(a??AE(uA(xe.current?.getValues()??null,e,t),Be,he)),parentResourcesRequirements:St.parentResourcesRequirements},{signal:n,silent:!0}),s=new Promise((e,t)=>{if(n.aborted){t(new DOMException(`Autosave aborted`,`AbortError`));return}let r=()=>{t(new DOMException(`Autosave aborted`,`AbortError`))};n.addEventListener(`abort`,r,{once:!0}),o.finally(()=>{n.removeEventListener(`abort`,r)})});await Promise.race([o,s]),r(),rn(i)},[kt,St,he,Be,Re,Ct,wt,Kt,rn,nn,Wt]),dn=(0,Q.useCallback)(async(t,n,r)=>{if(n.length===0){ya.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] Skipping section save because no fields were registered for the section.`,{resourceType:M,sectionRef:t});return}let i=WT(UT(r,n),{hiddenFieldNames:mt,contextFieldValues:Qe,omitClearedFields:ce,schema:Re});try{if(A.current){await A.current(t,n,i);return}let a;if(wt){let e=await wt.queueMutation(lB(i,n),{type:lE.SECTION,priority:gE.NORMAL,source:{type:uE.FORM,subscriberId:`section:${t}`},transportOverride:St});if(!e.success){if(mB(e)||e.error?.type===dE.VALIDATION&&dB(e.error))return;throw ZR(e.error,`Section save failed`)}a=e.heldForApproval??e.responseData}else{kt(`ResourceAutomatedForm section save`);let e,t={};if(Wt){let i=Object.keys(Qe);t=YT(nn(),JT(n,Re));let a={...xe.current?.getValues()??r};for(let e of Object.keys(N.requestFieldOffers??{}))e in r?a[e]=r[e]:delete a[e];let o=Kt(WT(UT(a,JT(n,Re)),{hiddenFieldNames:mt,contextFieldValues:Qe,omitClearedFields:ce,schema:Re}),i,t);if((z===W.UPDATE||z===W.UPDATE_MANY)&&Object.keys(o).every(e=>i.includes(e))){Ce({[oT]:y(B.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}e=Ct(o)}else{let t=he;e=Ct(AE($ue(i,n,t),Be,t))}a=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:e,parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0}),wn(a)||jt(n,a,Object.fromEntries(n.map(e=>[e,cB(i,e)]))),rn(t)}if(L(a))return;F(a,{partialWrite:!0}),T.current(wc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:a,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Yu(a),additionalContext:{...e.additionalContext,sectionRef:t,fieldNames:n,notificationIdentifier:`section_saved`,notificationLevel:Fl.SUCCESS}})}catch(n){if(n instanceof _E)return;let r=jM(n);if(r){Ce(r.validationErrors);return}let i=n instanceof Error?n:Error(String(n));T.current(wc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,sectionRef:t,error:i.message,...sz(n)}})}},[F,kt,St,Qe,he,Be,Re,mt,Ce,jt,Ct,ce,z,e,M,wt,y,Kt,rn,nn,Wt]),fn=(0,Q.useMemo)(()=>l===void 0&&Ege(Ke,se),[l,se,Ke]),pn=Ll(ie)&&N.requiresApproval===void 0,mn=l?.enabled===!0;(0,Q.useEffect)(()=>{mn&&!pn&&ya.isDevelopment()&&oB.warn(`[ResourceAutomatedForm] autosaveConfig is ignored: autosave saves fields of records that exist, and this form creates one or runs an action.`,{resourceType:M,operationIdentifier:z})},[pn,mn,z,M]);let hn=(0,Q.useMemo)(()=>({enabled:pn&&(l?.enabled??fn),defaultTrigger:l?.defaultTrigger??(fn?au.NONE:au.DEBOUNCE),debounceMs:l?.debounceMs??500,savedStateDurationMs:2e3}),[l,pn,fn]),gn=(0,Q.useMemo)(()=>{if(!Re||!Ye?.enabled)return null;try{let e=ae===W.CREATE?`CREATE`:Ll(ae)?`UPDATE`:`CREATE`,t=oe===W.CREATE?`CREATE`:oe&&Ll(oe)?`UPDATE`:oe===W.READ?`READ`:void 0;return rt(Re,{operationType:e,operationLike:t,isDraftMode:!0})}catch{return null}},[Re,Ye?.enabled,ae,oe]),_n=(0,Q.useCallback)(async t=>{if(Ye?.enabled){k.current?.(),me(!0),we();try{let n,r=!0;if(Ye?.onSaveDraft)n=await Ye.onSaveDraft(t),r=n!==void 0;else{let e=Ye?.discriminator||`_isDraft`,r=Ye?.draftValue??!0,i={...t,[e]:r};if(wt){let e=await wt.queueMutation(i,{type:lE.DRAFT,priority:gE.HIGH,source:{type:uE.FORM,subscriberId:`draft`},transportOverride:{...St,requestData:i}});if(!e.success){if(mB(e))return;throw ZR(e.error,`Draft save failed`)}n=e.heldForApproval??e.responseData}else kt(`ResourceAutomatedForm draft save`),n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0})}if(L(n)){D.current?.(n);return}Me(!0),r&&(T.current(wc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Yu(n),additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaved`}}),D.current?.(n))}catch(t){if(t instanceof _E)return;let n=jM(t);n?Ce(n.validationErrors):T.current(wc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaveFailed`,...sz(t)}}),E.current?.(t)}finally{me(!1)}}},[kt,St,Ye,Ct,e,M,Ce,wt]),vn=(0,Q.useCallback)(async t=>{if(Ye?.enabled){k.current?.(),fe(!0),we();try{let n,r=!0;if(Ye?.onPublish)n=await Ye.onPublish(t),r=n!==void 0;else{let e=Ye?.discriminator||`_isDraft`,r=Ye?.publishedValue??!1,i={...t,[e]:r};if(wt){let e=await wt.queueMutation(i,{type:lE.PUBLISH,priority:gE.HIGH,source:{type:uE.FORM,subscriberId:`publish`},transportOverride:{...St,requestData:i}});if(!e.success){if(mB(e))return;throw ZR(e.error,`Publish failed`)}n=e.heldForApproval??e.responseData}else kt(`ResourceAutomatedForm publish`),n=await w.current(St.operationPathKey,{contextualParameters:St.contextualParameters,requestData:Ct(i),parentResourcesRequirements:St.parentResourcesRequirements},{silent:!0})}if(L(n)){D.current?.(n);return}if(Me(!1),r){let t=fB(N);t&&T.current(wc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Ae({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:M,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Yu(n),additionalContext:{...e.additionalContext,notificationIdentifier:t.identifier}}),D.current?.(n)}}catch(t){if(t instanceof _E)return;let n=jM(t);n?Ce(n.validationErrors):T.current(wc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:Vu(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`publishFailed`,...sz(t)}}),E.current?.(t)}finally{fe(!1)}}},[kt,St,Ye,Ct,e,M,N,Ce,wt]),yn=(0,Q.useCallback)(async e=>{Ye?.enabled&&(Ye?.requireConfirmationToPublish?Ee(e):await vn(e))},[Ye,vn]),bn=(0,Q.useCallback)(async()=>{Te&&(await vn(Te),Ee(null))},[Te,vn]),xn=(0,Q.useCallback)(()=>{Ee(null)},[]),Sn=ns(N.riskLevel),Cn=N.riskLevel===zi.CRITICAL,Tn=ti(N)?void 0:null,En=b(M,String(N.operationIdentifier),`description`)||void 0,Dn=(0,Q.useMemo)(()=>US(b,M,String(N.operationIdentifier)),[b,M,N.operationIdentifier]),kn=!!(Ye?.enabled&&gn),An=(0,Q.useCallback)(e=>{kn?yn(e):on(e)},[kn,yn,on]),jn=(0,Q.useCallback)(e=>{Sn?ke(e):An(e)},[Sn,An]),Mn=(0,Q.useCallback)(()=>{let e=Oe;ke(null),e!==null&&An(e)},[Oe,An]),Nn=(0,Q.useCallback)(()=>{ke(null)},[]),Pn=(0,Q.useMemo)(()=>{let e=h(z)?y(B.RESOURCES_LAYOUTS_CREATE,pB(ie??z)):Dn,t=y(B.RESOURCES_LAYOUTS_CREATE,`submitting`);if(Ye?.enabled&&gn){let e=Ye?.publishLabel?y(B.RESOURCES_LAYOUTS_CREATE,Ye.publishLabel):y(B.RESOURCES_LAYOUTS_CREATE,`publish`),t=y(B.RESOURCES_LAYOUTS_CREATE,`publishing`);return(0,$.jsx)(X,{type:`submit`,disabled:de||pe||i,children:de?t:e})}return(0,$.jsx)(X,{type:`submit`,disabled:de||i,children:de?t:e})},[ie,z,Dn,de,pe,i,y,Ye,gn]),Fn=(0,Q.useMemo)(()=>{if(!r)return null;let e=y(B.RESOURCES_LAYOUTS_CREATE,`cancel`);return(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:de||pe,onClick:r,children:e})},[r,de,pe,y]),In=(0,Q.useMemo)(()=>{if(!Ye?.enabled||!gn)return null;let e=Ye?.saveDraftLabel?y(B.RESOURCES_LAYOUTS_CREATE,Ye.saveDraftLabel):y(B.RESOURCES_LAYOUTS_CREATE,`saveAsDraft`),t=y(B.RESOURCES_LAYOUTS_CREATE,`savingDraft`);return(0,$.jsx)(bB,{draftSchema:gn,omitClearedFields:ce,submissionSchema:Re,onSaveDraft:_n,disabled:pe||de||i,isSavingDraft:pe,label:e,savingLabel:t})},[Ye,gn,_n,pe,de,i,y]),Ln=Ne?{title:y(B.RESOURCES_LAYOUTS_CREATE,Ne.reason===mE.VERSION_CONFLICT?`conflictTitleVersion`:`conflictTitleRemote`),message:y(B.RESOURCES_LAYOUTS_CREATE,Ne.reason===mE.VERSION_CONFLICT?`conflictMessageVersion`:`conflictMessageRemote`),acknowledgeButton:y(B.RESOURCES_LAYOUTS_CREATE,`conflictAcknowledge`),currentValue:y(B.RESOURCES_LAYOUTS_CREATE,`conflictCurrentValue`),submittedValue:y(B.RESOURCES_LAYOUTS_CREATE,`conflictSubmittedValue`),emptyValue:y(B.LOW_LEVEL_FORM_FIELD,`noValue`)}:void 0,Rn=(0,Q.useMemo)(()=>!Ne||!Ln?null:(0,$.jsx)(Wz,{type:`conflict`,discardedFields:Ne.discardedFields,conflictDetails:Ne.conflictDetails,labels:Ln,onDismiss:Mt}),[Ne,Ln,Mt]),[zn,Bn]=(0,Q.useState)(0),Hn=(0,Q.useCallback)(()=>(Bn(e=>e+1),()=>Bn(e=>e-1)),[]),Un=(0,Q.useMemo)(()=>({submitButton:Pn,draftSaveButton:In,cancelButton:Fn,submissionNotice:Rn,claimFooter:Hn,footerClaimed:zn>0}),[Pn,In,Fn,Rn,Hn,zn]),Wn=(0,Q.useMemo)(()=>{if(Bt)return String(Rt?.operationIdentifier??V.resolveSingleResourceReadOperation(M,_)?.operationIdentifier??W.READ)},[Rt,Bt,M,_]),Gn=(0,Q.useMemo)(()=>!Bt||!Wn?[]:[{resourceType:M,operation:Wn}],[Bt,M,Wn]),Kn=(0,Q.useMemo)(()=>[`components.${B.RESOURCES_LAYOUTS_CREATE}`],[]),qn=(0,Q.useMemo)(()=>Bt?[{id:`form-data`,isReady:le}]:[],[Bt,le]),Jn=(0,Q.useMemo)(()=>({errorNetwork:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:y(B.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[y]),Yn=(0,Q.useMemo)(()=>{if(!Re)return null;if(qe){let e=qe,t=h(N.operationIdentifier)?null:FR(Re,Ge?.discriminatorField).map(e=>e.name),n=()=>(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(_B,{Template:e,requestFieldNames:t}):(0,$.jsx)(e,{}),(0,$.jsx)(oE,{})]});return n.displayName=`ResourceFormTemplate(explicit)`,n}let e=zR(Re,{inheritanceConfig:Ge,includeSubmitButton:!1,includeErrorSummary:s}),t=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e,{}),(0,$.jsx)(oE,{})]});return t.displayName=`ResourceFormTemplate`,t},[qe,Re,Ge,s,N.operationIdentifier]);if(!x)return null;if(ye){let e=y(B.RESOURCES_LAYOUTS_CREATE,`failedToLoadData`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:ye.message})]})})}if(Bt&&le&&!Ht.isLoading&&!Ht.isEnabled){let e=y(B.RESOURCES_LAYOUTS_CREATE,`operationUnavailableTitle`),t=y(B.RESOURCES_LAYOUTS_CREATE,`operationUnavailableMessage`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-muted/50 border border-border rounded-lg`,role:`status`,children:[(0,$.jsx)(`p`,{className:`font-medium text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-item-xs`,children:t})]})})}let Xn=Bt?Ut??f:Gt??f;if(!Re){let e=y(B.RESOURCES_LAYOUTS_CREATE,`configurationError`),t=y(B.RESOURCES_LAYOUTS_CREATE,`noSchemaFound`,{operation:z,resource:M});return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}let Zn=y(B.RESOURCES_LAYOUTS_CREATE,`confirmPublishTitle`),Qn=y(B.RESOURCES_LAYOUTS_CREATE,`confirmPublishMessage`),H=y(B.RESOURCES_LAYOUTS_CREATE,`cancel`),$n=y(B.RESOURCES_LAYOUTS_CREATE,`publish`),er=Fe?{message:y(B.RESOURCES_LAYOUTS_CREATE,`remoteUpdateMessage`),dismissAriaLabel:y(B.RESOURCES_LAYOUTS_CREATE,`dismiss`)}:void 0,nr=(0,$.jsx)(nb,{i18nKeys:Kn,loadingScopes:Gn,readiness:qn,children:(0,$.jsxs)(`div`,{className:a,children:[(0,$.jsx)(Vw,{open:!!Te,onOpenChange:e=>!e&&xn(),children:(0,$.jsxs)(Uw,{children:[(0,$.jsxs)(Ww,{children:[(0,$.jsx)(Kw,{children:Zn}),(0,$.jsx)(qw,{children:Qn})]}),(0,$.jsxs)(Gw,{children:[(0,$.jsx)(Yw,{onClick:xn,children:H}),(0,$.jsx)(Jw,{onClick:bn,children:$n})]})]})}),Oe!==null&&(0,$.jsx)(Pw,{open:!0,onOpenChange:e=>{e||Nn()},cancelCallback:Nn,validationCallback:Mn,label:Dn,confirmLabel:Dn,description:Tn,detail:En,requireTypedConfirmation:Cn,confirmationPhrase:Cn?Dn:``}),Fe&&er&&(0,$.jsx)(Wz,{type:`remote-update`,changedFields:Fe.changedFields,labels:er,onDismiss:()=>Ie(null)}),(0,$.jsx)(DE.Provider,{value:an,children:(0,$.jsx)(iE,{value:Un,children:(0,$.jsx)(nE,{schema:Re,defaultValues:Xn,onSubmit:jn,onError:sn,validationMode:c,disabled:i||de,labels:Nt,layoutRefs:Ue,operationRef:z,operationType:ae,operationLike:oe,coreOperation:ie,fileUploadContext:Ft,contextFieldValues:Qe,hiddenFieldNames:mt,generatedFieldOverrides:At,allowedValuesByField:pt,roleGrantPickerOffersByField:ft,requestFieldOffers:N.requestFieldOffers,requestFieldOfferRecord:Bt?he:void 0,inheritanceConfig:Ge,onSectionSave:ade({writesRecordFields:Ll(ie),hasCallerSectionHandler:d!==void 0})?dn:void 0,onFormReady:cn,warnOnUnsavedChanges:!0,validateFieldUrl:It,resourceType:M,hostResolvesRelationshipRoots:!0,resourceId:Lt,contextResourceIdentifiers:yt,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:p,chromeMode:We,layoutTemplate:Yn},_e)})})]})});return hn.enabled?(0,$.jsxs)(TE,{labels:Jn,validateField:ln,onSave:un,rmm:wt??void 0,config:hn,children:[(0,$.jsx)(yB,{cancelRef:k}),nr]}):nr}function yB({cancelRef:e}){let t=wE();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=UC(),l=LT(),u=(0,Q.useCallback)(async()=>{if(!c)return;let n=c.getValues(),r=e.safeParse(ST(n,e));if(r.success){let e=WT(r.data,{hiddenFieldNames:l?.hiddenFieldNames,contextFieldValues:l?.contextFieldValues,omitClearedFields:o,schema:s});c.clearErrors(),await t(e)}else{let e=_T(r.error.issues),t=Object.keys(e);for(let[t,n]of Object.entries(e))c.setError(t,n);KD(t)}},[c,l?.contextFieldValues,l?.hiddenFieldNames,e,t]);return(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:n,onClick:u,children:r?a:i})}var xB;(function(e){e.SHELL=`shell`,e.SURFACE=`surface`})(xB||={});function SB(e,t,n=!0){return e||(n?t:Sl.PRIMARY)}function CB({preset:e=q.DEFAULT,host:t=xB.SHELL,...n}){let r=(0,Q.useContext)(t_)?.navigationLayout?.backAffordanceOwner;if(!(t===xB.SHELL?uu(r):Pre(r)))return null;let i=G(B.APPLICATION_LEVEL_NAVIGATION_BACK,`ApplicationLevel_NavigationBack`)(e);return(0,$.jsx)(i,{...n})}var wB=Xs(B.LOW_LEVEL_BREADCRUMB,`Breadcrumb`,[`List`,`Item`,`Link`,`Page`,`Separator`,`Ellipsis`]);function TB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n,{...t})}function EB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.List,{...t})}function DB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Item,{...t})}function OB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Link,{...t})}function kB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Page,{...t})}function AB({preset:e=q.DEFAULT,...t}){let n=wB(e);return(0,$.jsx)(n.Separator,{...t})}function jB({preset:e=q.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}=lm(),l=uS(),{tResourceHeader:u,t:d,formatDate:f,formatDateTime:p,isReady:m}=K({resource:i}),{navigate:h}=wS(),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?lh({resourceConfig:t,operations:(t.operations??[]).filter(t=>Jx(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:{...V.buildContextualParameters(r,s),...n.contextualParameters??{}}}):void 0,o=V.tryBuildForeignKeyReadOperationPath(e.resourceType,s,i),c=()=>{let t=Up({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=lh({resourceConfig:t,operations:(t.operations??[]).filter(t=>!fr(t.operationFrontendConfig)&&Jx(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,s)});if(r)return{segmentResourceConfig:t,segmentContextIdentifiers:n,readOp:r}},S=(0,Q.useMemo)(()=>new Map(_.map(e=>[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=On.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:o,contextResourceIdentifiers:a,isOperationDefault:!0,parentResourcesRequirements:e.ancestorRequirements}),l;if(Sn(o.operationFrontendConfig)){let t=Vn.buildOperationFrontendRoutePaths(i,o,s.allResourceFieldIdentifiers);l=On.selectMatchingRoutePath(t,a,i.resourceIdentifier,i.resourceFieldIdentifier,e.ancestorRequirements)?.url}h({content:{contentType:od.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=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_BREADCRUMB,`ResourceLayout_Breadcrumb`)(e);return(0,$.jsx)(n,{...t})}var LB=rs.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=Bt.RMM_REQUIRED,layoutTemplate:y,isLoading:b=!1,defaultDisplayChromeMode:x,defaultInlineEdit:S,defaultEmptyValue:C,defaultSectionAppearance:w,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}){let{doOperation:O,registry:k}=lm(),A=(0,Q.useContext)(t_)?.UIConfig?.currentBreakpoint??xl.DESKTOP,{fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee}=eE(e,r?.resourceContext,t,`display`,{layoutRefs:i,fieldPathPrefix:r?.fieldPathPrefix,overrides:{fields:r?.fields,enums:r?.enums,sections:r?.sections}}),L=lS(Qm(a,o,c)),R=(0,Q.useCallback)(()=>{if(d===null)return null;if(d!==void 0){let e=d.variantType===at.API_CALL,t=d.resourceOperationLike??d.operationIdentifier,n=d.operationIdentifier===W.UPDATE;if(!e||!n||d.isBulkOperation===!0||t!==W.UPDATE)throw RB(`Rejected invalid inlineEditOperation`,{operationIdentifier:String(d.operationIdentifier),variantType:d.variantType,variantKey:d.variantKey,isBulkOperation:d.isBulkOperation,effectiveOperation:String(t)}),new dj(`inlineEditOperation must be the non-bulk URL-bearing literal UPDATE operation, not a custom verb borrowing UPDATE semantics`);return d}if(!a||!o)return null;let e=k.resourceConfigurations[a];if(!e)return null;let t=V.getResourceFieldIdentifierForType(a,k),n=On.buildRecordIdentifiersFromCollection(c,a,o),r={...s??{},[t]:o};return uh({resourceConfig:e,operations:e.operations??[],registry:k,hasResourceId:On.getResourceId(n[a]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:n,contextualParameters:r,viewer:L})??null},[c,s,d,k,o,a,L]),z=(0,Q.useMemo)(()=>R()!==null,[R]),te=(0,Q.useMemo)(()=>kE(e),[e]),ne=(0,Q.useCallback)(async(n,r)=>{let i=e?Oc(e,n):void 0,c=i?Si(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:Ca.createOperationPathKeyFromOperation(d)}:void 0,t=await _.queueMutation({[n]:c},{type:lE.INLINE,priority:gE.LOW,source:{type:uE.DISPLAY,subscriberId:`display-inline`},transportOverride:e});if(!t.success)throw new dj(t.error?.message??`Inline edit failed`,t.error);g?.(n,c)}else if(tr(v)&&a&&o){let e=R();if(!e)throw Error(`No UPDATE operation configured for resource "${a}". Inline editing requires an UPDATE.default operation.`);let r=Ca.createOperationPathKeyFromOperation(e),i=V.getResourceFieldIdentifierForType(a,k),u={...s,[i]:o};await O(r,{contextualParameters:u,parentResourcesRequirements:l,requestData:AE(uA(t,n,c),te,t)}),g?.(n,c)}else throw new ua({surfaceName:`AutomaticDisplayer inline edit`,resourceType:a??`unknown`,operationIdentifier:d?.operationIdentifier??W.UPDATE})},[p,_,a,o,s,l,O,k,g,R,v,d,te,t,e]),re=!m&&(!!p||!!_||tr(v)&&!!a&&!!o&&z),ie=(0,Q.useMemo)(()=>({resourceType:a,resourceId:o,doInlineUpdate:ne,canInlineEdit:re,defaultInlineEdit:S,defaultEmptyValue:C,fileUploadContext:h,contextualParameters:s,contextResourceIdentifiers:c,navigationZone:u,parentReferenceConfig:f,rmm:_}),[a,o,ne,re,S,C,h,s,c,u,f,_]),ae=(0,Q.useMemo)(()=>({schema:e,data:b?void 0:t,isLoading:b,fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee,defaultSectionAppearance:w,breakpoint:A,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}),[e,t,b,j,M,N,P,F,I,ee,w,A,T,E,D]);return(0,$.jsx)(lj.Provider,{value:ie,children:(0,$.jsx)(vA.Provider,{value:!1,children:(0,$.jsx)(ak,{displayChromeMode:x,children:(0,$.jsx)(tk,{value:ae,children:(0,$.jsx)(`div`,{className:U(`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=U(`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:U(`min-w-0`,KB(),e),"aria-hidden":`true`,"data-resource-header-title-pending":`true`,children:(0,$.jsx)(um,{className:`h-[1lh] w-48 max-w-full`})})}function KB(){let e=(0,Q.useContext)(t_);return(e?e.getRecipe(oc.TYPOGRAPHY,y.RESOURCE_TITLE):jg.typography?.[y.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,EN.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,EN.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:U(`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([W.READ,W.LIST,W.SEARCH,W.COUNT,W.DELETE,W.DELETE_MANY]);function iV(e,t){if(e.resourceType!==t.resourceType||e.isBulkOperation)return!1;let n=_l(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||_l(e.operation??{operationIdentifier:e.operationIdentifier})!==W.READ?!1:oV(e,t)}function oV(e,t){let n=e.contextResourceIdentifiers?.[t.resourceType];if(n==null)return!1;let r=String(On.getResourceId(n));return t.shownRowIds.some(e=>e!=null&&e!==``&&e===r)}function sV(e){let{on:t}=Ao(),[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(wc.RESOURCE_OPERATION_EXECUTED,()=>r({at:Date.now(),madeElsewhere:!1}),e=>iV(e,{resourceType:a,shownRowIds:i.current})),n=t(wc.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:U(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)(QS,{children:t})})]})]})}var lV=({resourceContext:e,navigationZone:t,navigationInitiator:n,title:r,description:i,className:a,actions:o,parentReferenceConfig:s,heldRecord:c})=>{let l=Kk(),u=sC(),d=u?.resourceContext?.resourceType===e.resourceType?u:void 0,f=d?.resourceContext??e,{resourceType:p,operation:m,contextResourceIdentifiers:h}=f,{tResourceHeader:g,tResourceOperation:_,t:v,formatDate:y,formatDateTime:b,isReady:x}=K({component:B.RESOURCES_LAYOUTS_HEADER,resource:p}),S=ap(),{registry:C,doOperation:w}=lm(),{renderIcon:T}=Of();String(m.operationIdentifier);let E=On.getPrimaryResourceIdentifier(f),D=(0,Q.useMemo)(()=>C.resourceConfigurations[p],[C,p]),k=d?.resourceConfig??D,A=V.frontendResourceLabelDefinitionOf(k),j=_l(m),M=go(m),N=j===W.READ?k?.frontendConfiguration?.layout?.header:void 0,P=!!A&&!!E&&M,F=(!!A||!!N)&&!!E&&M,I=!!k,[ee,L]=(0,Q.useState)(void 0),[R,z]=(0,Q.useState)(!1),te=c!==void 0,ne=c?c.record:ee,ie=c?c.record===void 0&&!c.failed:R,[ae,oe]=(0,Q.useState)(null),se=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),ce=(0,Q.useMemo)(()=>V.buildContextualParameters(h,C),[se,C]),le=d?.contextualParameters??ce,ue=(0,Q.useMemo)(()=>Object.entries(le).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[le]),de=(0,Q.useMemo)(()=>JSON.stringify(f.parentResourcesRequirements??null),[f.parentResourcesRequirements]),fe=(0,Q.useMemo)(()=>m.operationIdentifier===W.READ?m:d?.resolvePreferredOperation(W.READ,{requireAddressable:!0})??kz(p,C,{hasResourceId:!!E,contextResourceIdentifiers:h,contextualParameters:le}),[m,d,p,C,E,h,le]),pe=(0,Q.useMemo)(()=>V.tryBuildForeignKeyReadOperationPath(p,C,fe),[p,C,fe]),me=Qy(dg({resourceType:p,operation:fe?fe.operationIdentifier??W.READ:W.READ,discriminator:E??void 0})),he=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{he.current=w},[w]);let ge=sV({resourceType:p,rowIds:[E?String(E):null,ee&&(typeof ee._id==`string`||typeof ee._id==`number`)?String(ee._id):null],enabled:!te&&F&&!!E}),_e=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(te||!F||!k||!pe)return;let e=!1,t=`${pe}|${se}|${ue}|${de}`,n=_e.current===t;return _e.current=t,(async()=>{n||(z(!0),L(void 0)),oe(null);try{let t=await he.current(pe,{contextualParameters:le,parentResourcesRequirements:f.parentResourcesRequirements});if(e)return;t&&typeof t==`object`&&!Array.isArray(t)&&L(t)}catch(t){if(e)return;let r=O(t);rs.getLogger().error(`[ResourceLayoutPreset_Header_Default] Error fetching resource label:`,{resourceType:p,operationPathKey:pe,...r,error:t}),oe({...r,message:S(t)}),n||L(void 0)}finally{e||z(!1)}})(),()=>{e=!0}},[te,F,pe,se,ue,de,I,p,ge?.at]);let ve=(0,Q.useMemo)(()=>!ne||!P?null:V.computeFrontendResourceLabel({resourceType:p,registry:C,currentObject:ne,objectContext:f,initiatorUserContext:void 0,t:v,formatDate:y,formatDateTime:b}),[ne,P,p,C,f,v,y,b]),ye=io(m.operationIdentifier,k?.operations),be=(0,Q.useMemo)(()=>r||_(p,ye,`title`),[r,_,p,ye]),xe=j===W.LIST||j===W.SEARCH,Se=ko(m),Ce=!Se&&P?ve:null,we=(0,Q.useMemo)(()=>i||Ce||(xe?zp({tResourceHeader:g,resourceType:p})??null:null),[i,Ce,xe,g,p]),Te=(0,Q.useMemo)(()=>P&&Se?ie||me.isInitialLoad?null:ve||(E?`#${E}`:null):null,[P,Se,ie,me.isInitialLoad,ve,E]),Ee=m.operationFrontendConfig?.headerIconPlacement,De=(0,Q.useMemo)(()=>Ee===Iu.TEMPLATE_OWNED?null:T({category:re.RESOURCES,resourceType:p},{size:ca.MD}),[T,p,Ee]),Oe=!!Te,ke=l&&!Oe,Ae=P&&Se&&!Oe&&(ie||me.isInitialLoad),je=(0,Q.useMemo)(()=>V.resolveRowSchema(k,ne),[k,ne]),Me=(0,Q.useMemo)(()=>({resourceContext:{resourceType:p,operationId:W.READ}}),[p]),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{if(!Le||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&Be(t.isIntersecting)});if(typeof e?.observe==`function`)return e.observe(Le),()=>e.disconnect?.()},[Le]);let Ve=ZB(t)&&!l,He=tV(t,!l&&(x||Ae),ze),Ue=(0,Q.useMemo)(()=>{if(l||No.resolve(B.RESOURCES_LAYOUTS_BREADCRUMB,q.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:na.NONE}:s;let t=e[e.length-1];return t?{parentResourceType:t.resourceType,parentResourceId:t.resourceId,displayMode:na.NONE}:void 0},[s,l,f.parentResourcesRequirements,f.contextResourceIdentifiers]),We=(0,Q.useRef)({titleMounted:!1}).current,Ge=(0,Q.useMemo)(()=>({resourceType:p,title:Oe?Te:l&&Ae?null:be,titlePending:Ae&&(l||!be),titleMountTracker:We,hostProvidesHeading:l,titleTarget:Ne,leadingTarget:Fe}),[p,Oe,Te,be,We,l,Ae,Ne,Fe]);(0,Q.useEffect)(()=>{});let Ke=(0,$.jsxs)(`div`,{ref:Re,className:U(`flex min-w-0 items-center gap-element pb-item-sm`,Ve?`min-h-8`:`empty:hidden`),"data-slot":`resource-header-bar`,children:[(0,$.jsx)(CB,{host:xB.SURFACE,navigationZone:t}),!l&&(0,$.jsx)(IB,{resourceContext:f,navigationZone:t,navigationInitiator:n}),He&&(0,$.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-element`,children:He})]});if(!x)return Ae?(0,$.jsx)(cV,{className:a,actions:o,bar:Ke}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(QS,{children:o})}):null;if(ke)return Ae?(0,$.jsx)(cV,{className:a,actions:o}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(QS,{children:o})}):null;let qe=!!N&&!!je;return(0,$.jsxs)(`div`,{className:U(a||`flex-1`,nV,`flex min-w-0 flex-col`),"data-slot":`resource-header`,children:[Ke,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,"data-slot":`resource-header-title-line`,children:[De&&(0,$.jsx)(`div`,{className:`shrink-0`,children:De}),qe&&(0,$.jsx)(`span`,{ref:Ie,className:`flex shrink-0 items-center gap-field empty:hidden`,"data-slot":`resource-header-leading`}),qe?(0,$.jsx)(`div`,{ref:Pe,className:`flex min-w-0 flex-1 basis-60 items-center`,"data-slot":`resource-header-title`}):(0,$.jsx)(WB,{title:(Oe?Te:be)??``,hostProvidesHeading:l,className:`flex-1 basis-60`}),o&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(QS,{children:o})})]}),qe&&(0,$.jsx)(`div`,{className:`min-w-0 [&:has(:is(span,a,img,svg,button,p))]:pt-item-sm`,"data-slot":`resource-header-facts`,children:(0,$.jsx)(HB,{value:Ge,children:(0,$.jsx)(BB,{schema:je,data:ne,labels:Me,resourceType:p,resourceId:E?String(E):void 0,contextualParameters:le,contextResourceIdentifiers:h,parentResourcesRequirements:f.parentResourcesRequirements,navigationZone:t,parentReferenceConfig:Ue,disableInlineEdit:!0,layoutTemplate:N,defaultDisplayChromeMode:Pc.INLINE,isLoading:!ne})})}),!Oe&&we&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:we}),ae&&(0,$.jsxs)(`p`,{className:`mt-item-xs text-xs text-destructive/80 inline-flex items-center gap-item-xs`,role:`alert`,"aria-live":`polite`,title:ae.message,children:[T(H.WARNING,{size:ca.XS}),(0,$.jsx)(`span`,{children:ae.message})]})]})};function uV({preset:e=q.DEFAULT,...t}){let n=G(B.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}=oC(),{doOperation:u,registry:d}=lm(),{tComponent:f}=K({component:B.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)(()=>tl(a),[a]),x=b&&tr(wl(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?On.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:pE.ACCEPT_REMOTE},directFallbackAccepted:x,actingOperation:O}),j=(0,Q.useMemo)(()=>gp({tComponent:f,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),[f]),M=rz((0,Q.useMemo)(()=>w===r.contextResourceIdentifiers?r:{...r,contextResourceIdentifiers:w},[w,r]),a),N=(0,Q.useContext)(oh),P=(0,Q.useRef)(N);P.current=N;let F=(0,Q.useCallback)((t,n)=>{wn(t)&&P.current?.notifyInfo(gp({tComponent:f,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`operationSentForApproval`})),M(t),n&&!wn(t)?(e?.(t),c({contextResourceIdentifiers:n})):e?e(t):s()},[M,s,c,e,f]),I=(0,Q.useCallback)(e=>F(e,b&&!wn(e)?ez({resourceType:i,contextResourceIdentifiers:w,rowValues:e,registry:d}):void 0),[w,b,d,i,F]),ee=(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||ee(t instanceof Error?t:Error(String(t)))}).finally(()=>{e||_(!1)}),()=>{e=!0}},[S,k,T,r.parentResourcesRequirements,C,ee,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?ez({resourceType:i,contextResourceIdentifiers:w,rowValues:tz(e,nz(a)),registry:d}):void 0;if(b&&(A||!x)){if(!A)throw new ua({surfaceName:`useOperationDirectExecution`,resourceType:i,operationIdentifier:String(a.operationIdentifier)});let o=await A.queueMutation({},{type:lE.CUSTOM,priority:gE.HIGH,source:{type:uE.CUSTOM,subscriberId:`direct-execution:${String(a.operationIdentifier)}`},transportOverride:{operationPathKey:Ca.createOperationPathKeyFromOperation(a),contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{},readBackOnSuccess:n===void 0}});if(!o.success)throw ZR(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(Ca.createOperationPathKeyFromOperation(a),{contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{}})}else t=await l(e);F(t,n)}catch(e){ee(e instanceof Error?e:Error(j))}finally{h(!1)}},[T,r.parentResourcesRequirements,w,l,ee,F,x,b,C,a,i,A,j,d]),isExecuting:m,isBootstrapping:g,completeWithSuccess:I,reportFailure:ee}}var fV=rs.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}=oC(),p=e.resourceContext?.operation,m=p?Ca.createOperationPathKeyFromOperation(p):void 0,h=f?Ca.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}=K({component:B.RESOURCES_LAYOUTS_ACTION,resource:d}),y=(0,Q.useMemo)(()=>[`resources.${d}`,`components.${B.RESOURCES_LAYOUTS_ACTION}`],[d]),[b,x]=(0,Q.useState)(!1),{execute:S,isExecuting:C,isBootstrapping:w,completeWithSuccess:T,reportFailure:E}=dV({onSuccess:r,errorMessage:t,errorComponent:n}),D=(0,Q.useMemo)(()=>_(d,String(f.operationIdentifier),`title`),[f.operationIdentifier,d,_]),O=(0,Q.useMemo)(()=>gp({tComponent:g,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`runningAction`,params:{actionLabel:D}}),[D,g]),k=(0,Q.useCallback)(async()=>{await S()},[S]),A=!Vre(f)&&!di(f),j=f.riskLevel===zi.CRITICAL,M=(0,Q.useMemo)(()=>US(_,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)(nb,{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:gp({tComponent:g,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`confirmMessage`})}),(0,$.jsx)(X,{type:`button`,variant:J.DEFAULT,onClick:N,disabled:C||w,children:C||w?O:D})]}),b&&(0,$.jsx)(Pw,{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)(cC,{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}=K({component:B.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n()},[n]);return(0,$.jsx)(hV,{resourceContext:e,navigationZone:t,onSuccess:i,onCancel:n,errorMessage:gp({tComponent:r,componentType:B.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}=lm(),{t:o,formatDate:s,formatDateTime:c,tComponent:l,tResourceFieldEdit:u}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE}),d=ap(),f=PD(),p=sC(),m=(0,Q.useMemo)(()=>f?.contextResourceIdentifiers?V.buildContextualParameters(f.contextResourceIdentifiers,i):p?.contextualParameters??{},[f?.contextResourceIdentifiers,p?.contextualParameters,i]),h=(0,Q.useRef)(null),g=(0,Q.useRef)(a);g.current=a;let _=(0,Q.useRef)(m);_.current=m;let v=f?{resourceType:f.resourceType,id:f.resourceId}:p?.resourceContext?{resourceType:p.resourceContext.resourceType,id:On.getAddressedRecordId(p.resourceContext)}:void 0,y=(0,Q.useRef)(v);y.current=v;let b=me(e)===_u.ARRAY,x=b&&ja(e)||e,S=(0,Q.useMemo)(()=>kj({explicitResourceType:r,schema:wu(e)?e:x,fieldName:t,registry:i}),[x,t,i,e,r]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(new Map),[I,ee]=(0,Q.useState)(null),L=(0,Q.useMemo)(()=>Iw(n),[n]),R=(0,Q.useMemo)(()=>S?$l(i.resourceConfigurations?.[S]?.operations??[],W.READ)??null:null,[i,S]),z=(0,Q.useCallback)(async e=>{if(S){k(!0),ee(null);try{let t=V.buildForeignKeySearchOperationPath(S,i),n=V.buildForeignKeySearchParams(e,yV,{resourceType:S,registry:i}),r=On.withoutSelfReferencingParents(_.current,S,i),a=Fw({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(Kue({items:u,resourceType:S,registry:i,t:o,formatDate:s,formatDateTime:c}))}catch(t){let n=O(t);rs.getLogger().error(`[useResourceSearch] Failed to fetch options:`,{resourceType:S,query:e,...n,error:t}),ee({...n,message:d(t)}),E([])}finally{k(!1)}}},[S,i,o,s,c]),te=(0,Q.useRef)(P);te.current=P;let ne=(0,Q.useCallback)(async()=>{if(!S||L.length===0)return;let e=L.filter(e=>!te.current.has(e));if(e.length===0)return;j(!0);let t=new Map(te.current);for(let n of e)try{let{label:e}=await Rw({resourceType:S,id:n,registry:i,doOperation:g.current,contextualParameters:Im({hostIdentifiers:{},hostContextualParameters:_.current,hostRecord:y.current,targetResourceType:S,targetId:n,registry:i}).contextualParameters,readOperation:R,t:o,formatDate:s,formatDateTime:c});t.set(n,e)}catch{t.set(n,n)}F(t),j(!1)},[S,L,i,R,o,s,c]);(0,Q.useEffect)(()=>{ne()},[ne]),(0,Q.useEffect)(()=>{if(C)return h.current&&clearTimeout(h.current),M.length>=xV?h.current=setTimeout(()=>{z(M)},bV):M.length===0&&z(),()=>{h.current&&clearTimeout(h.current)}},[M,C,z]);let re=(0,Q.useCallback)(e=>{N(e)},[]),ie=(0,Q.useCallback)(e=>{w(e),e?ee(null):N(``)},[]),ae=(0,Q.useCallback)(e=>P.get(e)||e,[P]),oe=(0,Q.useMemo)(()=>M.length>0&&M.length<xV?l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`minSearchChars`,{count:String(xV)}):l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`noResults`),[M,l]),se=f?.resourceType;return{options:T,isLoading:D,isLoadingCurrentValue:A,isOpen:C,setIsOpen:ie,handleSearchChange:re,getDisplayLabel:ae,resourceType:S,isMultiple:b,normalizedValue:L,emptyMessage:oe,defaultPlaceholder:(0,Q.useMemo)(()=>{if(!b&&se){let e=u(se,hr.labelDictionaryPath(t),`label`);if(e)return gp({tComponent:l,componentType:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`selectReferencePlaceholder`,params:{target:e}})}return l(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`selectPlaceholder`)},[se,b,t,l,u]),fetchError:I}}var CV=Xs(B.LOW_LEVEL_COMMAND,`Command`,[`Dialog`,`Input`,`List`,`Empty`,`Group`,`Item`,`Shortcut`,`Separator`]);function wV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n,{...t})}function TV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Dialog,{...t})}function EV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Input,{...t})}function DV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.List,{...t})}function OV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Empty,{...t})}function kV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Group,{...t})}function AV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Item,{...t})}function jV({preset:e=q.DEFAULT,...t}){let n=CV(e);return(0,$.jsx)(n.Shortcut,{...t})}function MV({preset:e=q.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)(cC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(FV,{currentValue:n,onDismiss:r})})}function FV({currentValue:e,onDismiss:t}){let{operation:n,resourceType:r}=oC(),{tComponent:i}=K({component:B.RESOURCES_LAYOUTS_ACTION,resource:r}),a=(0,Q.useMemo)(()=>Us(n),[n]),{execute:o,isExecuting:s,isBootstrapping:c}=dV({onSuccess:t,errorMessage:gp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionDropdownBody`}),l=(0,Q.useCallback)(n=>{a&&(n===e?t():o({[a.fieldName]:n}))},[a,e,o,t]);if(!a)return null;let u=s||c;return a.domain===pa.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}=oC(),{tComponent:o,isReady:s}=K({component:B.LOW_LEVEL_FORM_FIELD}),{enumLabels:c,isReady:l}=eE(a.requestDto,{resourceType:i,operationId:String(a.operationIdentifier)},void 0,`edit`),u=(0,Q.useMemo)(()=>Jo(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(B.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`)}),(0,$.jsxs)(DV,{children:[(0,$.jsx)(OV,{children:o(B.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}=K({component:B.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(B.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)($y,{size:16})})}function zV({value:e,label:t,isCurrent:n,disabled:r,onPick:i}){let{renderIcon:a}=Of();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:ca.SM,className:U(`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(On.getResourceId(t[e]).length>0)return!0;let r=n[e];return r!==void 0&&String(r).length>0}))})}var HV={[W.UPDATE]:10,[W.CREATE]:20,[W.DELETE]:90,[W.DELETE_MANY]:90,[W.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===$u.FULL_RESULT_SET?`all rows`:`this page`;return`${e.format.toUpperCase()} — ${t}`}function JV(e){let t=e.generatedOperation?.kind===To.GENERATED_FILE_REGENERATE?e.generatedOperation:void 0,n=typeof t?.fieldName==`string`?t.fieldName:typeof e.operationIdentifier==`string`?Bl.parseGeneratedFileRegenerateOperationIdentifier(e.operationIdentifier)?.fieldName:void 0;return n&&n.length>0?n:void 0}function YV(e){switch(e){case zi.CRITICAL:case zi.HIGH:return J.DESTRUCTIVE;default:return J.GHOST}}function XV(e){return e?{unavailability:e}:{}}var ZV={[W.READ]:`viewDetails`,[W.UPDATE]:`edit`,[W.DELETE]:`delete`},QV=[];function $V(e,t){let n=e?.[ll.ORGANIZATIONS],r=n?On.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}=lm(),{permissions:E}=sg(),D=Jp(),{navigateToResource:O}=wS(),{tComponent:k,tResourceOperation:A,tResourceFieldDisplay:j,isReady:M}=K({component:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,resource:t}),N=ap(),{renderIcon:P}=Of(),F=Rx(),{emit:I,on:ee}=Ao(),L=(0,Q.useContext)(sm)?.isConnected??!1,R=(0,Q.useContext)(Fi),z=(0,Q.useRef)(R);z.current=R;let te=(0,Q.useRef)(x);te.current=x;let ne=(0,Q.useContext)(oh),ie=(0,Q.useRef)(ne);ie.current=ne;let ae=(0,Q.useRef)(w),oe=(0,Q.useRef)(I),ce=(0,Q.useRef)(L);ae.current=w,oe.current=I,ce.current=L;let[le,ue]=(0,Q.useState)({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null}),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(new Set),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(()=>new Set),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(null),Ce=(0,Q.useRef)(null),we=(0,Q.useMemo)(()=>C.resourceConfigurations[t],[C,t]),Te=n===Se.DETAIL&&Eie({resourceRelationships:we?.resourceRelationships,currentObject:r,contextResourceIdentifiers:a}),Ee=(0,Q.useMemo)(()=>se(n,we?.frontendConfiguration?.layout?.actionDisclosure),[n,we]),De=JSON.stringify(a??{}),Oe=(0,Q.useMemo)(()=>a,[De]),ke=JSON.stringify(o??[]),je=(0,Q.useMemo)(()=>o??[],[ke]),Me=r?._id??(we?.resourceFieldIdentifier?r?.[we.resourceFieldIdentifier]:void 0),Ne=typeof Me==`string`&&Me.length>0?Me:void 0,Pe=(0,Q.useMemo)(()=>{if(!Ne)return Oe;let e=Oe[t];if(On.getResourceId(e)===Ne)return Oe;let n=e?On.getFieldIdentifier(e):void 0;return{...Oe,[t]:n?{fieldIdentifier:n,resourceId:Ne}:Ne}},[Oe,Ne,t]),Fe=JSON.stringify(l??[]),Ie=(0,Q.useMemo)(()=>l??[],[Fe]),Le=$V(Oe,D?.currentOrganizationId),Re=E?.appLevel??QV,ze=Le?E?.organizations?.[Le]??QV:QV,Be=Re.join(`,`),Ve=ze.join(`,`),He=(0,Q.useMemo)(()=>Re,[Be]),Ue=lg(),We=(0,Q.useMemo)(()=>ze,[Ve]),Ge=E?.accessProfile??null,Ke=(0,Q.useMemo)(()=>({applicationRoles:[...He],organizationRoles:[...We],roleTables:Ue,organizationId:Le??null,accessProfile:Ge}),[He,We,Ue,Le,Ge]),qe=gS(),Je=(0,Q.useMemo)(()=>(we?.operations??[]).filter(e=>!_S(e.operationFrontendConfig?.runtimeAvailability,qe)).map(e=>Ca.createOperationPathKeyFromOperation(e)).sort().join(`
11
- `),[we,qe]),Ye=(0,Q.useMemo)(()=>new Set(Je?Je.split(`
12
- `):[]),[Je]),Xe=x?.isSearchActive,Ze=x?.listingVariantKeys!==void 0,Qe=x?.listingVariantKeys?.list,$e=x?.listingVariantKeys?.search,et=(0,Q.useMemo)(()=>Ze?{list:Qe,search:$e}:void 0,[Ze,Qe,$e]),tt=(0,Q.useMemo)(()=>{let e=(we?.operations??[]).filter(e=>Ja(e)),t=e.some(e=>e.generatedOperation?.kind===To.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH),n=e.some(e=>e.generatedOperation?.kind===To.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation!==W.SEARCH);return t&&n},[we]),nt=(0,Q.useMemo)(()=>{if(!we)return[];let e=we.operations||[],n=new Set(Ie);return e.filter(e=>{let r=String(e.operationIdentifier),i=e.isBulkOperation??!1;if(n.has(r)||e.operationFrontendConfig?.actionVisibility===mo.HIDDEN||Ye.has(Ca.createOperationPathKeyFromOperation(e))||fr(e.operationFrontendConfig)&&!Ja(e))return!1;let a=Ta(e,{addressesTheContextSingletonRecord:Te});if(p){if(!a||i)return!1}else if(a)return!1;if(!Wn(e,et)||Xe!==void 0&&tt&&Ja(e)&&(e.generatedOperation?.kind===To.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH)!==Xe||u&&!i||!u&&(i||rae(e)))return!1;let o=e.variantType;return!(o&&o!==at.API_CALL||!Vm({...e,resourceType:t,resourcePrimaryScope:we?.resourcePrimaryScope},Ke))})},[we,t,Ie,Ye,u,p,Ke,Xe,et,tt,Te]),rt=HS(nt,{currentObject:r,resourceType:t,selectionObjects:d,...i?{subjectDataMode:i}:{},...Le?{organizationId:Le}:{}}),it=(0,Q.useMemo)(()=>V.buildContextualParameters(Pe,C),[Pe,C]),ot=(0,Q.useMemo)(()=>!!On.getResourceId(Pe[t]),[Pe,t]),st=v??Rc(_),ct=(0,Q.useCallback)(e=>we?e.isBulkOperation===!0?VV(e,Pe,it):!Am({operation:e,resourceType:t,resourceConfig:we})||Gh({resourceConfig:we,operation:e,registry:C,hasResourceId:ot,contextResourceIdentifiers:Pe,contextualParameters:it}):!0,[Pe,it,ot,C,we,t]),lt=(0,Q.useCallback)(e=>{let n=String(e.operationIdentifier);if(Ja(e)){let t=GV(e),n=t?Mr(t):[],r=gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`collectionExport`});return n.length===1?`${r} ${n[0].format.toUpperCase()}`:r}if(di(e)){let n=JV(e);return gp(n?{tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerateNamed`,params:{field:j(t,n,`label`)}}:{tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerate`})}let r=ZV[n];return r?gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:r}):US(A,t,n)},[k,A,j,t]),ut=(0,Q.useCallback)(e=>P({category:re.OPERATION_RESOURCES,resourceType:t,operationReference:String(e.operationIdentifier)},{size:ca.SM}),[P,t]),dt=(0,Q.useCallback)(e=>{let t=e.operationFrontendConfig;return t?.displayPriority===void 0?HV[_l(e)??String(e.operationIdentifier)]??UV:t.displayPriority},[]),ft=(0,Q.useCallback)(e=>ge.has(Ca.createOperationPathKeyFromOperation(e)),[ge]),pt=(0,Q.useCallback)(()=>g?.matchedCount??d?.length??h?.length??0,[g,h,d]),mt=(0,Q.useRef)(pt);mt.current=pt,(0,Q.useEffect)(()=>{if(st)return ee(wc.RESOURCE_OPERATION_EXECUTED,e=>{let t=ri(e.resultSummary);t&&he({jobId:t.jobId,attemptedCount:mt.current()})},e=>e.resourceType===t&&e.isBulkOperation===!0&&e.optionalDiscriminator===st)},[ee,t,st]);let ht=(0,Q.useCallback)(e=>g?T(e):ire(e),[g]),gt=(0,Q.useCallback)(e=>e.isBulkOperation===!0&&pt()>ht(e),[pt,ht]),_t=(0,Q.useCallback)((e,n)=>{if(gt(e))return{reason:gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`bulkSelectionTooLarge`,params:{maxSelection:ht(e),selectedCount:pt()}})};if(n.isEnabled||n.featureAvailability&&!n.featureAvailability.isAvailable)return;let r=String(e.operationIdentifier),i=am(A,t,r),a=n.ineligibleSelectionIndices;if(e.isBulkOperation===!0&&a&&a.length>0&&d?.length){let e=gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForSelection`,params:{ineligibleCount:a.length,selectedCount:d.length}}),t=new Set(a),n=d.filter((e,n)=>!t.has(n));return{reason:i?`${e} ${i}`:e,...n.length>0&&f?{resolve:{label:gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`keepEligibleOnly`,params:{eligibleCount:n.length}}),onSelect:()=>f(n)}}:{}}}return{reason:i??gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForItem`})}},[gt,ht,pt,f,t,h,d,k,A]),vt=(0,Q.useCallback)(e=>{let t=IS(e);return rt.has(t)?rt.get(t):e.enabledCondition||e.requiredFeatures?{isEnabled:!1}:{isEnabled:!0}},[rt]),yt=(0,Q.useCallback)(e=>vt(e).isEnabled,[vt]),bt=(0,Q.useCallback)(e=>On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:e,contextResourceIdentifiers:Pe,additionalContext:{...e.isBulkOperation===!0&&g?{[Ote]:{...g.filters?{filters:g.filters}:{},...g.search?{search:g.search}:{},...g.listing?{listing:g.listing}:{},matchedCount:g.matchedCount}}:e.isBulkOperation===!0&&h?.length?{[ln]:h}:{},...st?{[bte]:st}:{}},parentResourcesRequirements:je,isOperationDefault:e.isOperationDefault??!0}),[t,Pe,je,h,g,st]),xt=(0,Q.useCallback)(e=>{if(!we)return;let t=bt(e),n=V.flattenContextIdentifiers(Pe),r=zm.resolveResourceUrl(we,e,n,C.allResourceFieldIdentifiers,je)?.resolvedUrl;O(t,zm.createOperationInitiator(s,c),r)},[we,bt,Pe,je,C,O,s,c]),St=(0,Q.useCallback)(async(e,n)=>{let r=GV(e),i=z.current?.httpClient;if(!r||!i){ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnavailable`));return}let o=te.current,s=e.resourceOperationLike===W.SEARCH;if(o?.isSearchActive&&!s){ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportClearSearch`));return}let{format:c,rowScope:l}=n,u=WS({registry:C,resourceConfig:we,exportOperation:e,resourceType:t,contextResourceIdentifiers:Vu(a),contextualParameters:it,parentResourcesRequirements:je,apiBaseUrl:ya.getApiUrl(),format:c,rowScope:l,listingQuery:l===$u.FULL_RESULT_SET?KV(o?.params):o?.params});if(!u)ie.current?.notifyError?.(k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnaddressable`));else try{await bue({url:u,resourceType:t,format:c,getBlob:e=>i.fetchFileBlob(e)})}catch(e){ie.current?.notifyError?.(N(e,k(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportFailed`)))}},[C,we,t,a,it,je,k,N]),Ct=(0,Q.useCallback)(async e=>{if(!we)return;let n=Ca.createOperationPathKeyFromOperation(e);if(!pe.current.has(n)){pe.current.add(n),_e(new Set(pe.current)),fe(!0);try{let n=Ca.createOperationPathKeyFromOperation(e),r=e.isBulkOperation??!1,i=e.operationFrontendConfig?.rowTargetRequestField,a=i?On.getResourceId(Pe[t]):``,o=r&&g?eee(g):r&&h?.length?Dl(h):i&&a?{[i]:a}:void 0;if(i&&!a)throw Error(`Row-targeted operation "${String(e.operationIdentifier)}" could not resolve the target row id from context.`);let s=S.current,c=await ae.current(n,{contextualParameters:it,parentResourcesRequirements:je,...o?{requestData:o}:{}},{silent:!0});if(wn(c)){ie.current?.notifyInfo(gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationSentForApproval`}));return}let l=ri(c);l&&ie.current?.notifyInfo(gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationRunningInBackground`}));let u=l?void 0:c&&typeof c==`object`&&!Array.isArray(c)?c.message:void 0;typeof u==`string`&&u.length>0&&ie.current?.notifySuccess(u);let d=()=>{let n=di(e),r=Ae({contextResourceIdentifiers:Pe,resourceType:t,result:c,isBulkOperation:e.isBulkOperation===!0}),i=V.buildContextualParameters(r,C),a=Yu(c);if(!Ai(e,ce.current)&&Su(e)){let a=Qv({resourceType:t,registry:C,callContext:Pe,...e.isBulkOperation===!0?{}:{previousRow:s,row:c}}),o=Xv({resourceType:t,registry:C,scopes:a}),l=o.length>0?o:[null];for(let e of l){let n=e??{operationIdentifier:W.LIST};oe.current(wc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:a.contextResourceIdentifiers,...a.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:a.previousContextResourceIdentifiers}:{},parentResourcesRequirements:je,...st?{optionalDiscriminator:st}:{}})}if(n){let e=Ia(we.operations??[],W.READ,{requireAddressable:!0}).filter(e=>Gh({resourceConfig:we,operation:e,registry:C,hasResourceId:On.getResourceId(r[t]).length>0,contextResourceIdentifiers:r,contextualParameters:i})),n=e.length>0?e:[null],a=new Set;for(let e of n){let n=e??{operationIdentifier:W.READ},i=[On.getResourceId(r[t]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);a.has(i)||(a.add(i),oe.current(wc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:je,...st?{optionalDiscriminator:st}:{}}))}}}oe.current(wc.RESOURCE_OPERATION_EXECUTED,{resourceType:t,operationIdentifier:String(e.operationIdentifier),operation:e,variantType:e.variantType,isOperationDefault:e.isOperationDefault??!0,isBulkOperation:e.isBulkOperation??!1,variantKey:e.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:je,resultSummary:a,...st?{optionalDiscriminator:st}:{}}),b?.(e)};if(c&&typeof c==`object`){let t=KS(e.responseDto,c);if(t.length>0){xe(t),Ce.current=d;return}}d()}catch(n){console.error(`[useResourceOperationActions] Operation ${String(e.operationIdentifier)} failed:`,n);let r=n&&typeof n==`object`?n:{};oe.current(wc.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(Pe),parentResourcesRequirements:je,additionalContext:{error:r.message??po(n),errorCustomMessageReference:r.customMessageReference,errorHttpStatus:r.httpStatus,errorRefusalCode:sz(n).errorRefusalCode,...cz(n)}})}finally{fe(!1),pe.current.delete(n),_e(new Set(pe.current))}}},[we,t,C,it,Pe,je,h,st,b]),wt=(0,Q.useCallback)(e=>{if(Ja(e)){let t=GV(e),n=t?Mr(t):[];n.length>0&&St(e,n[0]);return}let n=String(e.operationIdentifier),r=e.riskLevel,i=qc(e);if(i===cc.INLINE&&F.isAvailable){let n=On.getResourceId(Pe[t]);if(n){F.open({kind:Fx.ELEMENT,elementId:n,operation:e,resourceContext:bt(e)});return}}if(i===cc.POPOVER||i===cc.DROPDOWN)ye(Ca.createOperationPathKeyFromOperation(e));else if(Gt(i)||i===cc.INLINE)xt(e);else if(ns(r)){let t=n===W.DELETE?gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmDelete`}):lt(e),i=r===zi.CRITICAL,a=e.isBulkOperation===!0?pt():0,o=[a>0?gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmAppliesToSelection`,params:{count:a}}):void 0,ti(e)?gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmCannotBeUndone`}):void 0].filter(e=>!!e);ue({open:!0,label:t,requiresTypedConfirmation:i,confirmationPhrase:i?lt(e):``,description:o.length>0?o.join(` `):null,confirmLabel:lt(e),callback:()=>Ct(e)})}else Ct(e)},[xt,Ct,k,lt,d,h]),Tt=(0,Q.useCallback)(e=>{let t=qc(e);t===cc.POPOVER||t===cc.DROPDOWN?xt(e):wt(e)},[xt,wt]),Et=(0,Q.useCallback)(async()=>{le.callback&&await le.callback(),ue({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[le.callback]),Dt=(0,Q.useCallback)(()=>{ue({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[]),Ot=(0,Q.useCallback)(()=>{xe(null);let e=Ce.current;Ce.current=null,e?.()},[]),kt=(0,Q.useCallback)(e=>{let n=qc(e);if(!(n===cc.POPOVER||n===cc.DROPDOWN||n===cc.INLINE&&!F.isAvailable)||!we)return;let r=Ca.createOperationPathKeyFromOperation(e),i=()=>ye(null),a=A(t,io(e.operationIdentifier,we.operations),`title`);if(n===cc.DROPDOWN){let t=Us(e),n=e.isBulkOperation===!0||!t?void 0:S.current?.[t.rowFieldName];return{open:ve===r,onOpenChange:e=>ye(e?r:null),title:a,chrome:qS.LIST,content:Q.createElement(PV,{resourceContext:bt(e),navigationZone:s,onDismiss:i,...typeof n==`string`?{currentValue:n}:{}})}}return{open:ve===r,onOpenChange:e=>ye(e?r:null),title:a,content:Q.createElement(vV,{resourceContext:bt(e),navigationZone:s,onDismiss:i})}},[we,t,A,ve,bt,s,F.isAvailable]);return{items:(0,Q.useMemo)(()=>{if(!we)return[];let e=we.operations||[],t=new Map;for(let e of nt.filter(ct)){let n=String(e.operationIdentifier);t.has(n)||t.set(n,[]),t.get(n).push(e)}let r=[];for(let[e,n]of t){let e=n.filter(e=>vt(e).isEnabled),t=Ke.organizationRoles.length>0?e.filter(e=>e.admitsCrossTenantPlatformAdministration!==!0):[],i=ao(t.length>0?t:e.length>0?e:n),a=i.find(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0)||i.find(e=>e.isOperationDefault===!0)||i[0],o=vt(a),s=a.operationFrontendConfig?.actionVisibility,c=!(!o.featureAvailability||o.featureAvailability.isAvailable);if((s??(Ee.disabledActionHandling===Eo.HIDE&&!c?mo.WHEN_AVAILABLE:mo.ALWAYS))===mo.WHEN_AVAILABLE&&!o.isEnabled||!o.isEnabled&&a.isBulkOperation===!0&&d?.length&&(o.ineligibleSelectionIndices?.length??0)>=d.length)continue;let l=new Map(i.map(e=>[e,vt(e)])),u=a.riskLevel,f=a.operationFrontendConfig?.actionVariant??YV(u),p=ut(a),h=lt(a),g=dt(a),_=a.operationFrontendConfig?.actionPlacement??(ns(u)&&ti(a)?ec.DANGER_ZONE:ec.PRIMARY);if(m&&_!==m)continue;let v=!o.isEnabled||gt(a);if(v&&o.featureAvailability&&!o.featureAvailability.isAvailable){let e=o.featureAvailability;switch(e.behavior){case Ko.HIDE:continue;case Ko.DISABLE:break;case Ko.UPGRADE_PROMPT:case Ko.ADDON_PROMPT:case Ko.LIMIT_UPGRADE_PROMPT:case Ko.CONTACT_ADMIN:case Ko.CUSTOM:i.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>wt(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=Ja(a)?GV(a):void 0;if(y){let e=Mr(y);e.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>{St(a,e[0])},disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)}):e.length>1&&r.push({type:`subgroup`,icon:p,label:h,variant:f,items:e.map(e=>({type:`button`,icon:p,label:qV(e),variant:f,riskLevel:u,operationIdentifier:String(a.operationIdentifier),onClick:()=>{St(a,e)},disabled:v})),disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else if(i.length===1){let e=kt(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>xt(a):()=>wt(a),...e?{popover:e}:{},disabled:v,...v?XV(_t(a,o)):{},...ft(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else{let e=i.filter(e=>e!==a).flatMap(e=>{let t=l.get(e);if(t.featureAvailability&&!t.featureAvailability.isAvailable&&t.featureAvailability.behavior===Ko.HIDE)return[];let n=e.variantKey,r=n?`${h} (${n})`:h,i=e.riskLevel;return[{type:`button`,icon:ut(e),label:r,variant:YV(i),riskLevel:i,operationIdentifier:String(e.operationIdentifier),onClick:()=>Tt(e),disabled:!t.isEnabled||gt(e),...!t.isEnabled||gt(e)?XV(_t(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?()=>xt(a):()=>wt(a),...e?{popover:e}:{},disabled:v,...v?XV(_t(a,o)):{},...ft(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===Se.SUMMARY&&m!==ec.DANGER_ZONE&&!y){let t=we?lh({resourceConfig:we,operations:e,coreOperation:W.READ,registry:C,hasResourceId:ot,requireFrontendAddressable:!0,contextResourceIdentifiers:Pe,contextualParameters:it}):void 0;if(t){let e=gp({tComponent:k,componentType:B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`viewDetails`});r.push({type:`button`,icon:P(H.EYE,{size:ca.SM}),label:e,variant:J.GHOST,onClick:()=>xt(t),disabled:!1,_priority:WV,_group:ec.PRIMARY})}}let i=e=>+(e===ec.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===ec.DANGER_ZONE&&o===ec.PRIMARY&&a.push({type:`separator`}),a.push(n),o=t;return a},[we,Pe,it,ot,Ke,ct,C,t,nt,rt,n,Ee,y,ut,lt,dt,yt,vt,_t,gt,ft,wt,Tt,xt,kt,St,k,P,d]),isConfirmDialogOpen:le.open,confirmDialogLabel:le.label,confirmDialogDescription:le.description,confirmDialogConfirmLabel:le.confirmLabel,confirmRequiresTypedConfirmation:le.requiresTypedConfirmation,confirmConfirmationPhrase:le.confirmationPhrase,onConfirm:Et,onCancel:Dt,isExecuting:de,acceptedBackgroundRun:me,ephemeralFields:be,onEphemeralAcknowledge:Ot}}function 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=Vn.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let d=On.selectMatchingRoutePath(e,s,n.resourceIdentifier,n.resourceFieldIdentifier,l,t.allResourceFieldIdentifiers),f={...c,[n.resourceFieldIdentifier]:o},p=Vn.buildFileUploadRouteForOperation({operationRouteUrl:d.url,operationParameters:d.parameters,targetResourceType:i,targetResourceFieldIdentifier:n.resourceFieldIdentifier,fieldName:a,requiresTargetResourceId:!0,isFrontend:!0}),m=zm.resolveUrlPath(p.url,f);return zm.hasUnresolvedPlaceholders(m)?null:`${u}${br}${m}`}catch{return null}}function rH(e,t){return t===Bi.ORIGINAL?e:`${e}${e.includes(`?`)?`&`:`?`}variant=${encodeURIComponent(t)}`}function iH(e){return rH(e,Bi.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(Ch,{flushSync:EN.flushSync,...e})}ug();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=vc();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=[hs.PASSKEY,hs.TOTP,hs.PASSWORD],yH={[lH.POPUP_BLOCKED]:fu.REAUTH_PROVIDER_POPUP_BLOCKED,[lH.CANCELLED]:fu.REAUTH_PROVIDER_FAILED,[lH.TIMED_OUT]:fu.REAUTH_PROVIDER_TIMED_OUT,[lH.FAILED]:fu.REAUTH_PROVIDER_FAILED},bH={[hs.PASSKEY]:fu.REAUTH_WITH_PASSKEY,[hs.TOTP]:fu.REAUTH_WITH_TOTP,[hs.PASSWORD]:fu.REAUTH_WITH_PASSWORD};async function xH(e){try{let{methods:t,identityLinks:n}=await vc().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 hs.PASSWORD:return t.password.trim()?{method:e,password:t.password}:null;case hs.TOTP:return/^\d{6,8}$/.test(t.code.trim())?{method:e,code:t.code.trim()}:null;case hs.PASSKEY:return{method:e};default:return null}}function CH(e,t){let n=t.origin===Ki.GRANTING_ORGANIZATION,r=t.decisionRequirement?.minimumAssurance;return{methods:e.methods.filter(e=>!n||e!==hs.PASSWORD).filter(e=>{if(r===void 0)return!0;let t=Qte(e);return t!==void 0&&Ea(t,r)}),identityLinks:n||t.decisionRequirement?[]:[...e.identityLinks]}}var wH=({open:e,purpose:t,origin:n=Ki.ACCOUNT_OR_OPERATION,decisionRequirement:r,onConfirm:i,onCancel:a,failure:o,isLoading:s})=>{let c=ap(),{tComponent:l,isReady:u}=K({component:B.APP_LAYOUTS_SECURITY_SETTINGS}),d=(0,Q.useCallback)(e=>l(B.APP_LAYOUTS_SECURITY_SETTINGS,e),[l]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(!1),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(!e)return;S(``),w(``),T.current=!1,b.current=!1,p(null),h([]),_(null),y(null);let i=!1;return 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)(Pw,{open:e,onOpenChange:A,cancelCallback:k,validationCallback:O,label:d(fu.REAUTH_TITLE),children:(0,$.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:d(n===Ki.GRANTING_ORGANIZATION?fu.REAUTH_GRANTING_ORGANIZATION_DESCRIPTION:fu.REAUTH_DESCRIPTION)}),o!==null&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o instanceof uH?d(yH[o.reason]):c(o,d(fu.ERROR))})}),D&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:d(fu.REAUTH_NO_ACCEPTED_METHOD)})}),f&&f.length+m.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":d(fu.REAUTH_TITLE),children:[f.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e===g?J.DEFAULT:J.OUTLINE,"aria-pressed":e===g,disabled:s,onClick:()=>{_(e),y(null)},children:d(bH[e])},e)),m.map(e=>(0,$.jsx)(X,{type:`button`,size:Y.SM,variant:e.identityLinkId===v?.identityLinkId?J.DEFAULT:J.OUTLINE,"aria-pressed":e.identityLinkId===v?.identityLinkId,disabled:s,onClick:()=>{y(e),_(null)},children:l(B.APP_LAYOUTS_SECURITY_SETTINGS,fu.REAUTH_WITH_PROVIDER,{provider:e.displayName})},e.identityLinkId))]}),v&&(0,$.jsx)(Z,{className:`text-sm`,children:l(B.APP_LAYOUTS_SECURITY_SETTINGS,fu.REAUTH_PROVIDER_PROMPT,{provider:v.displayName})}),g===hs.PASSWORD&&(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:d(fu.REAUTH_PASSWORD)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value),placeholder:d(fu.REAUTH_PASSWORD_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===hs.TOTP&&(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:d(fu.REAUTH_TOTP_CODE)}),(0,$.jsx)(eN,{inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:8,value:C,onChange:e=>w(e.target.value.replace(/\D/g,``)),placeholder:d(fu.REAUTH_TOTP_CODE_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===hs.PASSKEY&&(0,$.jsx)(Z,{className:`text-sm`,children:d(fu.REAUTH_PASSKEY_PROMPT)})]})}):null},TH=(0,Q.createContext)(void 0),EH=({children:e})=>{let{setStepUpAuthHandler:t}=lm(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(Mo.STEP_UP),[u,d]=(0,Q.useState)(Ki.ACCOUNT_OR_OPERATION),[f,p]=(0,Q.useState)(void 0),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async(e,t=Ki.ACCOUNT_OR_OPERATION,n)=>n?(g.current&&await g.current.catch(()=>void 0),l(Mo.STEP_UP),d(t),p(n),y()):g.current?(e===Mo.STEP_UP&&l(Mo.STEP_UP),t===Ki.GRANTING_ORGANIZATION&&d(Ki.GRANTING_ORGANIZATION),g.current):(l(e),d(t),p(void 0),y()),[]);function y(){let e=new Promise((e,t)=>{m.current=e,h.current=t,a(null),s(!1),r(!0)});return g.current=e,e.finally(()=>{g.current=null}).catch(()=>void 0),e}let b=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{b.current=t},[t]),(0,Q.useEffect)(()=>(vc().setStepUpAuthHandler(v),b.current(v),()=>{vc().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=Mo.STEP_UP,n,r){let i=vc(),a=r?{decisionBinding:r}:{};switch(e.method){case hs.PASSWORD:return i.reAuthenticate(hs.PASSWORD,{password:e.password,...a},t);case hs.TOTP:return i.reAuthenticate(hs.TOTP,{code:e.code,...a},t);case hs.PASSKEY:{let e=await i.reAuthPasskeyOptions(void 0,r),n=await foe({optionsJSON:e});return i.reAuthenticate(hs.PASSKEY,{passkeyResponse:n,...a},t)}case hs.EXTERNAL_OAUTH2:case hs.ORG_OPENID_CONNECT:case hs.ORG_SAML:return _H(e.identityLinkId,t,e.popup,n)}}var OH=rs.getLogger();function kH(){let e=Fm(),{registry:t}=lm(),n=t.resourceConfigurations[ll.ORGANIZATIONS]?.resourceFieldIdentifier;return n?e[n]:void 0}function AH(){let e=kH(),{registry:t,doOperation:n}=lm(),{auth:r,user:i}=sg(),a=Jp(),o=(0,Q.useRef)(n);o.current=n;let s=t.resourceConfigurations[ll.ORGANIZATIONS],c=s?.resourceFieldIdentifier,l=a?.currentUserId??null,u=!!i&&(!l||i._id===l),d=!!r.accessToken&&r.sessionType!==Ic.ONE_OFF&&!r.isRestoringSession&&r.sessionRestored&&u,f=!!r.accessToken&&r.sessionType!==Ic.ONE_OFF&&u,p=!!e&&f&&jh(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=qm(s);if(!n){t(ag.INCONCLUSIVE);return}let r=!1;return o.current(Ca.buildOperationPathKeyFromOperation(n),{contextualParameters:{[c]:e}},{silent:!0}).then(()=>{r||t(ag.ADMITTED)}).catch(n=>{if(r)return;let i=lt.isAuthorizationError(n)||lt.isNotFoundError(n);i||OH.warn(`Could not verify access to the organization addressed by the route`,{organizationId:e,error:n}),t(i?ag.REFUSED:ag.INCONCLUSIVE)}),()=>{r=!0}},[m,_,e,c,s]),e?p?ag.ACTIVE_MEMBERSHIP:d?_??ag.VERIFYING:ag.UNDECIDABLE:ag.NOT_ADDRESSED}var jH=(0,Q.createContext)(null);function MH(e){let t=kH(),n=Jp(),{user:r,organizations:i,permissions:a,followRouteOrganization:o}=sg(),{emit:s}=Ao(),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=dse({routeOrganizationId:t,access:e,routeOrganizationLoaded:!!t&&i.some(e=>e._id===t),routeOrganizationConferred:lse(a?.accessProfile,t),currentOrganizationId:c,arrivalSettled:m});return(0,Q.useEffect)(()=>{h===rh.FOLLOWING&&t&&l&&(p(l),o(t)&&s(wc.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:t}))},[h,t,l,o,s]),h}function NH(){let e=(0,Q.useContext)(t_),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=q.DEFAULT,...t}){NH();let n=G(B.APP_LAYOUTS_MAIN_CONTAINER,`AppLayout_MainContainer`)(e);return(0,$.jsx)(n,{...t})}var FH=rs.getLogger();function IH(){let{appConfig:e}=Tu(),{privacy:t,recordConsentDecision:n,logout:r}=sg(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)([]),u=(0,Q.useMemo)(()=>Jb({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=Xb(u,e,t);if(i.length>0&&!r)l(i);else{l([]),a(!0);try{await n(Yb(u.grantedPurposes,e,t))}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=q.DEFAULT,children:t}){let n=IH();if(n.status===qb.NOT_APPLICABLE||n.status===qb.SATISFIED)return(0,$.jsx)($.Fragment,{children:t});let r=G(B.APP_LAYOUTS_CONSENT_GATE,`AppLayout_ConsentGate`)(e);return n.status===qb.REQUIRED?(0,$.jsx)(r,{gate:n}):(0,$.jsxs)($.Fragment,{children:[t,(0,$.jsx)(r,{gate:n})]})}var 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}=Tu(),{logout:t}=sg(),{resolvedUserType:n}=Xx(),r=e.compliance?.governedDocumentAcceptanceMode??uo.EXPLICIT_CHECKBOX,i=$o(e.compliance),a=n!==null&&(e.compliance?.governedDocumentReleases??[]).some(e=>e.allowedInteractionKinds.includes(xs.CONTRACT_ACCEPTED)&&(!i||e.approvalState===be.APPROVED)),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!a)return;let e=!1;return vc().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:su(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===uo.IMPLIED_BY_REGISTERING||u,E=(0,Q.useCallback)(async()=>{if(T&&b.length!==0){h(!0),_(!1),y(!1);try{let e=await vc().acceptGovernedDocuments(b.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})));s(e.owed),d(!1),p([]),e.owed.length>0&&_(!0)}catch(e){if(jr(e)&&e.customMessageReference===ql.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)try{let e=await vc().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=q.DEFAULT,children:t}){let n=zH();if(n.status!==RH.REQUIRED)return(0,$.jsx)($.Fragment,{children:t});let r=G(B.APP_LAYOUTS_DOCUMENT_ACCEPTANCE_GATE,`AppLayout_DocumentAcceptanceGate`)(e);return(0,$.jsx)(r,{gate:n})}var VH=()=>(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)($y,{})}),HH=()=>{let e=nh(),{notifyWarning:t}=Mm(),{tErrorMessage:n,tErrorGuidance:r}=K(),i=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{i.current||(i.current=!0,t(lp({type:za.AUTHORIZATION,customMessageReference:ql.AUTHORIZATION_ORGANIZATION_NOT_ACCESSIBLE},{translators:{tErrorMessage:n,tErrorGuidance:r}})),e(Ln.home,{replace:!0}))},[e,t,n,r]),(0,$.jsx)(VH,{})},UH=({redirectTo:e=Ln.login})=>{let{auth:t}=sg(),n=(0,Q.useContext)(Fi)?.shellCompanions??[],r=Jp(),i=cg(),a=AH(),o=MH(a),s=kH()??null,c=a===ag.VERIFYING||a===ag.REFUSED||o===rh.FOLLOWING,l=(0,Q.useMemo)(()=>({routeOrganizationId:s,routeContentHeld:c}),[s,c]),u=r?.currentOrganizationId,d=!!t.accessToken,f=ed(i),p=fi(e,f);if(!d)return(0,$.jsx)(Uh,{to:p,replace:!0});if(t.isRestoringSession||!t.sessionRestored&&!u)return(0,$.jsx)(PH,{children:(0,$.jsx)(VH,{})});let m=(0,$.jsx)(Ih,{});return a===ag.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===He.CHECKLIST_ITEM).map(e=>e.ref),s=0;for(let e of a)e.type===He.CHECKLIST&&(s++,e.items=s===1?o:[]);return s>1&&o.length>0&&!WH.has(n)&&(WH.add(n),rs.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??Ql.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:sc.ROUTE_MATCH,routePattern:r??`/${t.toLowerCase()}`}}case`MANUAL`:return{type:sc.MANUAL};case`DELAYED`:return{type:sc.DELAYED,delayMs:r.delayMs??1e3};case`EVENT`:{let n=r.eventName??`${t}:${e.bindToOperation}`;return{type:sc.EVENT,eventName:n}}default:return{type:sc.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 He.TOOLTIP:return{...r,type:He.TOOLTIP,targetSelector:n??``,placement:JH(e.placement)};case He.TOUR:return{...r,type:He.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 He.MODAL:return{...r,type:He.MODAL,dismissible:!0,...e.actionRef?{ctaAction:e.actionRef}:{}};case He.BANNER:return{...r,type:He.BANNER,...e.actionRef?{actionRef:e.actionRef}:{}};case He.ANNOUNCEMENT:return{...r,type:He.ANNOUNCEMENT,...e.actionRef?{actionRef:e.actionRef}:{}};case He.BADGE:return{...r,type:He.BADGE,...n?{targetSelector:n}:{}};case He.CARD:return{...r,type:He.CARD,...e.actionRef?{actionRef:e.actionRef}:{}};case He.SURVEY:return{...r,type:He.SURVEY,questions:(e.questions??[]).map(e=>({id:e.id,type:e.type,required:e.required??!1,options:e.options?.map(e=>({ref:e.ref}))}))};case He.CHECKLIST:return{...r,type:He.CHECKLIST,items:[]};case He.CHECKLIST_ITEM:return{...r,type:He.CHECKLIST_ITEM,...e.actionRef?{actionRef:e.actionRef}:{}};default:return{...r,type:e.type}}}function 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={[Oo.USER]:null,[Oo.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===at.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),rs.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=ho[e],i=aU(n,r,W.READ);if(!i)return cU(r,W.READ),{outcome:oU.UNAVAILABLE};let a=Ca.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:oU.LOADED,state:e??{flows:{}}}}catch(e){return lt.isNotFoundError(e)?{outcome:oU.ABSENT}:{outcome:oU.UNAVAILABLE}}}async function dU(e,t,n){let r=ho[e],i=aU(n,r,W.CREATE);if(!i)return cU(r,W.CREATE),{outcome:oU.UNAVAILABLE};let a=Ca.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=ho[e],a=aU(r,i,W.UPDATE);if(!a){cU(i,W.UPDATE);return}let o=Ca.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!==He.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,W.UPDATE);if(!s)return rs.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=Ca.buildOperationPathKeyFromOperation(s);try{return await n(c,{contextualParameters:{},requestData:o}),pU.WRITTEN}catch(t){return rs.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=nae[e],i=aU(n,r,W.READ);if(!i)return{outcome:oU.UNAVAILABLE};let a=Ca.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 lt.isNotFoundError(e)?{outcome:oU.ABSENT}:{outcome:oU.UNAVAILABLE}}}async function gU(e){if(!e)return[];try{return(await vc().getMilestoneDefinitions({silent:!0}))?.definitions??[]}catch{return[]}}var _U={[Ee.USER]:null,[Ee.ORGANIZATION]:null};async function vU(e,t,n){let r=ki[e],i=aU(n,r,W.READ);if(!i)return{outcome:oU.UNAVAILABLE};let a=Ca.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return e?{outcome:oU.LOADED,state:e}:{outcome:oU.ABSENT}}catch(e){return lt.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 Lo.OVERLAY:i||=(r.push(e),!0);break;case Lo.CHECKLIST:a||=(r.push(e),!0);break;case Lo.INLINE:r.push(e)}return r}var bU=({children:e})=>{let t=(0,Q.useContext)(Fi),{on:n,emit:r}=Ao(),i=sg(),a=Jp(),o=lm(),s=(0,Q.useContext)(fh),c=(0,Q.useRef)(o);c.current=o;let l=(0,Q.useMemo)(()=>rs.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]),m=(0,Q.useMemo)(()=>t?.frontendConfiguration?.onboardingViews??[],[t?.frontendConfiguration]),h=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,{ref:t.ref,scope:t.scope??Ql.USER,elements:t.elements,renderMode:t.renderMode});for(let t of m)e.has(t.ref)||e.set(t.ref,{ref:t.ref,scope:Ql.USER,elements:t.elements,renderMode:void 0});return e},[d,m]),g=h.size>0,_=(0,Q.useMemo)(()=>{let e={};for(let t of h.values())e[t.ref]=t.scope;return e},[h]),[v,y]=(0,Q.useState)({}),b=(0,Q.useRef)({}),x=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(x.current=!0,()=>{x.current=!1}),[]);let S=(0,Q.useRef)(new Set),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T=(0,Q.useRef)(0),[E,D]=(0,Q.useState)(new Set),[O,k]=(0,Q.useState)(!0),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(new Map),M=(0,Q.useRef)(new Set),N=(0,Q.useCallback)(e=>(b.current=e,y(e),e),[]),P=(0,Q.useCallback)(e=>{let t=e(b.current);return N(t)},[N]),[F,I]=(0,Q.useState)({...tU}),[ee,L]=(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&&g&&!A.current,he=de&&g?O||me:!1;Gm({identifier:es.PROGRESSION,isLoading:ee}),Gm({identifier:es.LIFECYCLE,isLoading:oe});let ge=(0,Q.useMemo)(()=>{let e=[Ql.USER];return a?.currentOrganizationId&&e.push(Ql.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{b.current=v},[v]);let _e=(0,Q.useRef)(ge);(0,Q.useEffect)(()=>{_e.current!==ge&&(A.current=!1,R.current=!1,ce.current=!1,M.current.clear(),S.current.clear(),C.current=!1,we.current.clear(),Te.current.clear(),T.current+=1,_e.current=ge,de&&g&&k(!0),de&&L(!0),de&&re&&se(!0),P(e=>{if(!(Ql.ORGANIZATION in e))return e;let t={...e};return delete t[Ql.ORGANIZATION],t}),I(e=>({...e,[Oo.ORGANIZATION]:null})),ae(e=>({...e,[Ee.ORGANIZATION]:null})),D(e=>{let t=new Set(e);for(let e of d)(e.scope??Ql.USER)===Ql.ORGANIZATION&&t.delete(e.ref);return t}))},[ge,d,g,de,re,P]);let ve=(0,Q.useRef)({isAuthenticated:de,userId:ue});(0,Q.useEffect)(()=>{let e=ve.current,t=e.isAuthenticated&&!de,n=e.userId!==null&&ue!==null&&e.userId!==ue;if(ve.current={isAuthenticated:de,userId:ue},t||n){for(let e of j.current.values())clearTimeout(e);j.current.clear(),A.current=!1,R.current=!1,ce.current=!1,M.current.clear(),S.current.clear(),C.current=!1,we.current.clear(),Te.current.clear(),T.current+=1,N({}),D(new Set),I({...tU}),te(eU),ae({..._U}),k(de&&g),L(de),se(de&&re)}},[N,ue,g,de,re]);let ye=(0,Q.useMemo)(()=>{let e={};for(let t of ge){let n=v[t];n?.flows&&Object.assign(e,n.flows)}return e},[v,ge]),be=(0,Q.useMemo)(()=>{let e=new Set;for(let[t,n]of Object.entries(ye))n.status===Hr.COMPLETED&&e.add(t);let t=Nh(i.permissions,a?.currentOrganizationId).filter(Boolean),n=s?.resolvedFeatures?.features??[],r=s?.resolvedFeatures?.limits??{},o=s?.resolvedFeatures?.currentUsage??{},c={};for(let e of[Ql.USER,Ql.ORGANIZATION]){let t=F[Zne[e]],n=ie[lie[e]];(t||n)&&(c[e]={achievedMilestoneRefs:new Set(Object.keys(t?.milestonesAchieved??{})),currentLifecycleStage:n?.currentStage,stagesReached:new Set(n?.stagesVisited??[])})}return{userRoles:t,userFeatures:n,featureLimits:r,currentUsage:o,completedFlowRefs:e,userCreatedAt:i.user?.createdAt?new Date(i.user.createdAt):void 0,scopedState:c,recordedSurveyAnswer:(e,t,n)=>ye[e]?.elements?.[t]?.surveyAnswers?.[n]}},[ye,F,ie,i.permissions,a?.currentOrganizationId,i.user?.createdAt,s?.resolvedFeatures?.features,s?.resolvedFeatures?.limits,s?.resolvedFeatures?.currentUsage]);(0,Q.useEffect)(()=>{if(A.current||!g||!de)return;A.current=!0;let e=Symbol(`guidance-init`);w.current=e,C.current=!0;let t=!1,n=!1;return(async()=>{let e=c.current;u(`Initializing guidance state`,{scopes:ge,flowCount:h.size});let r=await Promise.allSettled(ge.map(async t=>{let n=await 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?(S.current.add(t),i[t]=n.state):u(`Guidance state unavailable for scope ${t} — writes suppressed for this scope`)}P(e=>{let t={...e};for(let[n,r]of Object.entries(i))t[n]=lU(r,e[n]);return t}),n=!0,k(!1),u(`Guidance state loaded`,{scopeCount:Object.keys(i).length})})().catch(e=>{rs.getLogger().warn(`GuidanceContext: guidance initialization failed`,{error:e}),A.current=!1,k(!1)}).finally(()=>{w.current===e&&(C.current=!1)}),()=>{t=!0,n||(A.current=!1),w.current===e&&(C.current=!1)}},[g,ge,de,u,P]);let xe=(0,Q.useMemo)(()=>{let e=[Oo.USER];return a?.currentOrganizationId&&e.push(Oo.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(R.current||!de)return;R.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;u(`Initializing progression state`,{scopes:xe});let[r,i]=await Promise.all([Promise.allSettled(xe.map(async e=>({scope:e,read:await hU(e,n.doOperation,n.registry)}))),gU(fe&&n.hasResource(ll.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,L(!1),u(`Progression state loaded`,{scopeCount:Object.values(a).filter(Boolean).length,milestoneDefinitionCount:i.length})})().catch(e=>{rs.getLogger().warn(`GuidanceContext: progression initialization failed`,{error:e}),R.current=!1,L(!1)}),()=>{e=!0,t||(R.current=!1)}},[fe,xe,de,u]);let Se=(0,Q.useMemo)(()=>{if(!re)return[];let e=[Ee.USER];return a?.currentOrganizationId&&e.push(Ee.ORGANIZATION),e},[re,a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(ce.current||!de||!re)return;ce.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;se(!0),u(`Initializing lifecycle state`,{scopes:Se});let r=await Promise.allSettled(Se.map(async e=>({scope:e,read:await 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]=p.createInitialLifecycleState())}ae(e=>({...e,...i})),t=!0,se(!1),u(`Lifecycle state loaded`,{scopeCount:Object.values(i).filter(Boolean).length})})().catch(e=>{rs.getLogger().warn(`GuidanceContext: lifecycle initialization failed`,{error:e}),ce.current=!1,se(!1)}),()=>{e=!0,t||(ce.current=!1)}},[Se,de,re,u]);let Ce=(0,Q.useCallback)((e,t=b.current)=>{let n=[Ql.USER,Ql.ORGANIZATION].filter(n=>t[n]?.flows?.[e]!==void 0);return n.find(n=>t[n]?.flows?.[e]?.status===Hr.IN_PROGRESS)??n[0]??_[e]??Ql.USER},[_]),we=(0,Q.useRef)(new Set),Te=(0,Q.useRef)(new Set),De=(0,Q.useRef)(new Set),Oe=(0,Q.useCallback)(async e=>{if(De.current.has(e))return;De.current.add(e);let t=T.current;try{let n=c.current,r=await hU(e,n.doOperation,n.registry);if(r.outcome!==oU.LOADED||!x.current||T.current!==t)return;I(t=>({...t,[e]:r.state})),u(`Progression state for scope ${e} recovered after a failed read`)}finally{De.current.delete(e)}},[u]),ke=(0,Q.useCallback)(async e=>{if(S.current.has(e)||C.current||Te.current.has(e))return;Te.current.add(e);let t=T.current;try{let n=c.current,r=await uU(e,n.doOperation,n.registry);if(r.outcome===oU.ABSENT&&(r=await dU(e,n.doOperation,n.registry)),r.outcome!==oU.LOADED||!x.current||T.current!==t)return;S.current.add(e),rs.getLogger().info(`GuidanceContext: guidance state for scope "${e}" recovered — persistence resumes for this scope.`),we.current.delete(e),P(t=>({...t,[e]:lU(r.state,t[e])}))}finally{Te.current.delete(e)}},[P]),Ae=(0,Q.useCallback)((e,t,n)=>{let r=b.current,i=n?.scopeOverride??Ce(e,r),a=S.current.has(i),s=r[i]??{flows:{}},c=t(s.flows[e]??{status:Hr.NOT_STARTED,elements:{},triggerCount:0}),l={...s,flows:{...s.flows,[e]:c}};N({...r,[i]:l}),a?fU(i,l,o.doOperation,o.registry):(we.current.has(i)||(we.current.add(i),rs.getLogger().warn(`GuidanceContext: guidance persistence is SUPPRESSED for scope "${i}" — its stored document was never read this session, so writing would replace the server's history with this session's single entry. Changes apply locally and are retried on the next interaction.`)),ke(i))},[N,Ce,o,ke]),je=(0,Q.useCallback)(e=>{let t=f.get(e);if(!t)return;let n=_[e]??Ql.USER;if(!ge.includes(n))return;if(pe&&t.audience?.requiredFeatures){M.current.add(e);return}let r=ye[e];Tt(r?.status)||r?.status===Hr.IN_PROGRESS&&E.has(e)||XH(t.audience,be,t.scope??Ql.USER)&&(u(`Activating flow: ${e}`),D(t=>{let n=new Set(t);return n.add(e),n}))},[f,ye,E,be,_,ge,u,pe]),Me=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{for(let e of Me.current)E.has(e)||Me.current.delete(e);let e=!1;for(let t of Ne.current)E.has(t)||(Ne.current.delete(t),e=!0);e&&Fe(new Set(Ne.current))},[E]);let Ne=(0,Q.useRef)(new Set),[Pe,Fe]=(0,Q.useState)(new Set),B=(0,Q.useCallback)((e,t)=>{Ne.current.has(e)!==t&&(t?Ne.current.add(e):Ne.current.delete(e),Fe(new Set(Ne.current)))},[]),Ie=(0,Q.useCallback)(e=>{if(!E.has(e)||Me.current.has(e))return;let t=f.get(e);t&&(Me.current.add(e),Ae(e,e=>({...e,status:Hr.IN_PROGRESS,startedAt:e.startedAt??new Date,triggerCount:(e.triggerCount??0)+1})),r(wc.GUIDANCE_FLOW_ACTIVATED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:_[e]??Ql.USER}))},[E,f,_,Ae,r]);(0,Q.useEffect)(()=>{if(!(he||pe||d.length===0))for(let e of d){if(e.trigger.type!==sc.FIRST_VISIT)continue;let t=ye[e.ref];t&&t.triggerCount!==0||je(e.ref)}},[he,pe,ge]),(0,Q.useEffect)(()=>{if(pe||M.current.size===0)return;let e=Array.from(M.current);M.current.clear();for(let t of e)je(t)},[pe,je]);let Le=(0,Q.useMemo)(()=>d.filter(e=>e.trigger.type===sc.ROUTE_MATCH&&e.trigger.routePattern).map(e=>{try{return{...e,_compiledPattern:new RegExp(e.trigger.routePattern)}}catch{return null}}).filter(e=>e!==null),[d]);(0,Q.useEffect)(()=>{if(!(he||Le.length===0))return n(wc.NAVIGATION_ZONE_CHANGED,e=>{let t=e.currentContent?.urlPath;if(t)for(let e of Le)e._compiledPattern.test(t)&&je(e.ref)})},[he,Le,n,je]);let Re=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===sc.EVENT&&e.trigger.eventName);if(e.length!==0){for(let t of e){let e=t.trigger.eventName;e.includes(`:`)||Re.current.has(t.ref)||(Re.current.add(t.ref),rs.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(wc.NOTIFY_RESOURCE_SUCCESS,t=>{let n=`${t.resourceType}:${t.operationIdentifier}`;for(let t of e)t.trigger.eventName===n&&je(t.ref)})}},[he,d,n,je]);let ze=(0,Q.useRef)(je);(0,Q.useEffect)(()=>{ze.current=je},[je]),(0,Q.useEffect)(()=>{if(he||d.length===0)return;let e=d.filter(e=>e.trigger.type===sc.DELAYED&&e.trigger.delayMs);if(e.length!==0){for(let t of e){if(j.current.has(t.ref))continue;let e=setTimeout(()=>{ze.current(t.ref),j.current.delete(t.ref)},t.trigger.delayMs);j.current.set(t.ref,e)}return()=>{for(let e of j.current.values())clearTimeout(e);j.current.clear()}}},[he,d]);let Be=(0,Q.useMemo)(()=>yU(d.filter(e=>E.has(e.ref)),Pe),[d,E]),Ve=(0,Q.useCallback)(e=>{he||je(e)},[je,he]),He=(0,Q.useCallback)(e=>{D(t=>{let n=new Set(t);return n.delete(e),n});let t=h.get(e),n=Ce(e);t?.renderMode&&r(wc.GUIDANCE_FLOW_COMPLETED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:n}),u(`Flow completed: ${e}`)},[h,Ce,r,u]),Ue=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];Tt(t?.status)||(Ae(e,e=>({...e,status:Hr.COMPLETED,completedAt:new Date})),He(e))},[Ae,h,ye,He]),We=(0,Q.useCallback)(async(e,t,n)=>{if(!h.has(e))return;let i;if(n?.surveyAnswers){let e={};for(let[t,r]of Object.entries(n.surveyAnswers))(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(e[t]=r);i=e}let a=h.get(e)?.elements.find(e=>e.ref===t);if(a&&!n?.declineResourceBinding){let e=c.current,t=await 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=h.get(e),s=o!==void 0&&o.elements.every(n=>n.ref===t||ye[e]?.elements?.[n.ref]?.status===Hr.COMPLETED);if(Ae(e,e=>({...e,status:s?Hr.COMPLETED:e.status===Hr.NOT_STARTED?Hr.IN_PROGRESS:e.status,...s?{completedAt:new Date}:{},elements:{...e.elements,[t]:{status:Hr.COMPLETED,completedAt:new Date,surveyAnswers:i,lastStepIndex:n?.lastStepIndex}}})),o?.renderMode){let n=o.elements.find(e=>e.ref===t);n&&r(wc.GUIDANCE_ELEMENT_COMPLETED,{flowRef:e,elementRef:t,elementType:n.type})}u(`Element completed: ${e}/${t}`),s&&He(e)},[Ae,h,r,u,He,ye]),Ge=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];if(Tt(t?.status))return;Ae(e,e=>({...e,status:Hr.DISMISSED,dismissedAt:new Date})),D(t=>{let n=new Set(t);return n.delete(e),n});let n=h.get(e),i=Ce(e);n?.renderMode&&r(wc.GUIDANCE_FLOW_DISMISSED,{flowRef:e,renderMode:n.renderMode,triggerSource:`frontend`,scope:i}),u(`Flow dismissed: ${e}`)},[Ae,h,ye,Ce,r,u]),Ke=(0,Q.useCallback)(e=>{if(!h.has(e))return;let t=ye[e];Tt(t?.status)||(Ae(e,e=>({...e,status:Hr.SKIPPED})),D(t=>{let n=new Set(t);return n.delete(e),n}),u(`Flow skipped: ${e}`))},[Ae,h,ye,u]),qe=(0,Q.useCallback)(e=>E.has(e),[E]),Je=(0,Q.useCallback)(e=>ye[e]?.status===Hr.COMPLETED,[ye]),Ye=(0,Q.useCallback)(e=>h.has(e),[h]);(0,Q.useEffect)(()=>{let e=n(wc.GUIDANCE_FLOW_ACTIVATED,e=>{e.triggerSource===`backend`&&(u(`Backend activated flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.add(e.flowRef),n}))}),t=n(wc.GUIDANCE_FLOW_COMPLETED,e=>{e.triggerSource===`backend`&&(u(`Backend completed flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Ae(e.flowRef,e=>({...e,status:Hr.COMPLETED,completedAt:new Date}),{scopeOverride:e.scope}))}),r=n(wc.GUIDANCE_FLOW_DISMISSED,e=>{e.triggerSource===`backend`&&(u(`Backend dismissed flow: ${e.flowRef}`),D(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Ae(e.flowRef,e=>({...e,status:Hr.DISMISSED,dismissedAt:new Date}),{scopeOverride:e.scope}))});return()=>{e(),t(),r()}},[n,u,Ae]),(0,Q.useEffect)(()=>{let e=n(wc.MILESTONE_ACHIEVED,e=>{u(`Milestone achieved: ${e.milestoneRef} (scope: ${e.scope})`);let t=e.scope;if(I(n=>{let r=n[t];return r?{...n,[t]:{...r,milestonesAchieved:{...r.milestonesAchieved,[e.milestoneRef]:{achievedAt:new Date,count:1}},totalPoints:e.totalPoints,categoriesProgress:{...r.categoriesProgress,[e.category]:{completedCount:(r.categoriesProgress[e.category]?.completedCount??0)+1,totalPoints:(r.categoriesProgress[e.category]?.totalPoints??0)+(e.points??0)}}}}:(u(`Milestone event for unread progression scope ${t} — dropped rather than seeded`),Oe(t),n)}),e.reward?.type===ro.FEATURE_UNLOCK&&(s?.refetch(),r(wc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.feature_unlock.${e.milestoneRef}`,data:{milestoneRef:e.milestoneRef,featureRef:e.reward.featureRef}})),e.reward?.type===ro.CELEBRATION&&e.reward?.celebrationLevel){let t=Gie(e.reward);r(wc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.${e.milestoneRef}`,data:{frontendDisplayHints:{celebration:{mode:t}},milestoneRef:e.milestoneRef,category:e.category,points:e.points}})}}),t=n(wc.PROGRESSION_UPDATED,e=>{let t=e.scope;I(n=>{let r=n[t];return r?{...n,[t]:{...r,operationCounts:e.operationCounts,totalPoints:e.totalPoints}}:(u(`Progression update for unread progression scope ${t} — dropped rather than seeded`),Oe(t),n)})});return()=>{e(),t()}},[n,u,r,s,Oe]),(0,Q.useEffect)(()=>{if(!re)return;let e=n(wc.LIFECYCLE_STAGE_CHANGED,e=>{u(`Lifecycle stage changed: ${e.previousStage} → ${e.newStage} (scope: ${e.scope})`);let t=e.scope;ae(n=>{let r=n[t]??p.createInitialLifecycleState(new Date(e.changedAt)),i=new Date(e.changedAt),a=[...r.stageHistory];return a.length>0&&!a[0].exitedAt&&(a[0]={...a[0],exitedAt:i}),a.unshift({stage:e.newStage,enteredAt:i,trigger:e.trigger}),{...n,[t]:{...r,currentStage:e.newStage,stageEnteredAt:i,stageHistory:a,...e.activationCriteriaMet?{activationCriteriaMet:e.activationCriteriaMet}:{}}}})});return()=>{e()}},[n,u,re]);let Xe=(0,Q.useMemo)(()=>{let e=e=>{for(let t of Object.values(Oo))if(F[t]?.milestonesAchieved[e])return!0;return!1},t=e=>{for(let t of Object.values(Oo)){let n=F[t]?.milestonesAchieved[e];if(n)return n}},n=e=>{let t;for(let n of Object.values(Oo)){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(Oo)){let t=F[e];t&&(r+=t.totalPoints)}return{scopedStates:F,isMilestoneAchieved:e,getMilestoneAchievement:t,getCategoryProgress:n,totalPoints:r,milestoneDefinitions:z,isLoading:ee}},[F,ee,z]),Ze=(0,Q.useMemo)(()=>{if(!re)return rU;let e=ie[Ee.USER],t=e?.currentStage??null,n=e?.stageEnteredAt?new Date(e.stageEnteredAt):null,r=t=>e?ct(e,t):!1,i=e?.activationCriteriaMet??{},a=le?.criteria??[],o=a.length,s=Object.values(i).filter(Boolean).length;return{currentStage:t,stageEnteredAt:n,isEnabled:!0,isLoading:oe,hasReachedStage:r,activationProgress:{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:o>0?s>=o:t!==Lu.SIGNED_UP}}},[re,ie,oe,le]),Qe=(0,Q.useMemo)(()=>({activeFlows:Be,flowStates:ye,activateFlow:Ve,recordFlowPresented:Ie,reportFlowNotPresentable:B,completeElement:We,completeFlow:Ue,dismissFlow:Ge,skipFlow:Ke,isFlowActive:qe,isFlowCompleted:Je,isFlowPersistable:Ye,isLoading:he,progression:Xe,lifecycle:Ze}),[Be,ye,Ve,Ie,We,Ue,Ge,Ke,qe,Je,Ye,he,Xe,Ze]);return(0,$.jsx)(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??Oo.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??Oo.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!==xu.COUNT_THRESHOLD?0:Math.min(1,(e.currentCount??0)/t)}function NU(e){return e.status===TU.IN_PROGRESS&&e.definition.type===xu.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}=Of(),o=e.status===TU.ACHIEVED?a(H.CHECK,{size:ca.SM,className:`text-success`}):e.status===TU.LOCKED?a(H.LOCK,{size:ca.SM,className:`text-muted-foreground`}):a(H.CLOCK,{size:ca.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)(Mf,{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)(b_,{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)(b_,{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=G_,actionableLimit:t=3,className:n}={}){let r=CU(),{tComponent:i,tMilestone:a,tMilestoneCategory:o,isReady:s}=K({component:B.PROGRESSION_MILESTONE_TRACKER,keys:[oi.MILESTONES]}),c=(0,Q.useMemo)(()=>(e,t)=>i(B.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(W_).includes(e)?e:G_;g!==e&&!wU.has(e)&&(wU.add(e),rs.getLogger().warn(`ProgressionMilestoneTracker: unknown variant "${e}" — falling back to "${G_}". Valid values: ${Object.values(W_).join(`, `)}.`));let _=(()=>{switch(g){case W_.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 W_.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 W_.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 W_.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)(b_,{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===W_.SUMMARY||g===W_.DETAILED;return(0,$.jsxs)(OF,{role:`region`,"aria-label":p,className:n,"data-progression-variant":g,children:[(0,$.jsxs)(AF,{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)(Mf,{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)(FF,{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}=lm(),c=Jp(),{UIConfig:l,compositeViews:u}=Rg(),d=l?.currentBreakpoint,f=Q.useMemo(()=>Op(e),[e]),p=n??(f?.hostKind===Lp.RESOURCE&&f.viewKind===_p.COMPOSITE_VIEW?f.hostRef:void 0)??o?.hostResourceType,m=r??o?.contextResourceIdentifiers,h=(0,Q.useMemo)(()=>t??mp({viewRef:e,compositeViews:u,registry:s}),[t,e,u,s]);(0,Q.useEffect)(()=>{},[h,m,e]);let g=(0,Q.useMemo)(()=>{let e=Qp.buildInitiatorIds({userId:c?.currentUserId,organizationId:c?.currentOrganizationId,applicationId:c?.currentApplicationId,anonymousUserId:c?.currentAnonymousUserId}),t=h?.primaryScope?Qp.primaryScopeToContextIdentifiers(e,h.primaryScope):{},n=c?.buildContextResourceIdentifiers()??{},r=Qp.filterCustomScopeContextResourceIdentifiers(n);if(!h)return Qp.mergeContextResourceIdentifiers(t,r,m);let i=h.scope===Zp.RESOURCE&&p?[{resourceType:p,requirement:Be.OPTIONAL,isPrimaryScope:!1}]:[],a=[...h.additionalResourceRequirements??[],...i],o=Qp.getAllowedViewBindingKeys({primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a});return Qp.resolveViewContextResourceIdentifiers({surfaceName:`CompositeView`,surfaceRef:h.ref,primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a,primaryScopeContext:t,customScopeContext:r,explicitContextResourceIdentifiers:Qp.scopeContextToBindingContract(m,o)})},[c,c?.currentAnonymousUserId,c?.currentApplicationId,c?.currentOrganizationId,c?.currentUserId,h,p,m]),_=V.buildContextResourceIdentifiersKey(g),v=(0,Q.useMemo)(()=>g,[_]),y=i??o?.navigationZone??rr.PRIMARY,b=a??o?.navigationInitiator;if(!h)return(0,$.jsx)(u_,{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}=K({keys:[`lifecycle`]}),{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:c}=e;return(0,$.jsxs)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`},children:[(0,$.jsx)(`h2`,{children:t(`home_activation_progress.title`)}),(0,$.jsx)(`p`,{children:t(`home_activation_progress.description`)}),o>0&&(0,$.jsxs)(`div`,{style:{marginTop:`1rem`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:`0.5rem`},children:[s,` / `,o]}),(0,$.jsx)(`div`,{className:`w-full h-2 bg-muted rounded overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded transition-all duration-[var(--motion-duration-normal)] ease-in-out ${c?`bg-success`:`bg-primary`}`,style:{width:`${o>0?s/o*100:0}%`}})}),(0,$.jsx)(`ul`,{style:{listStyle:`none`,padding:0,marginTop:`1rem`},children:a.map((e,t)=>{let r=e.criterionType===yee.MILESTONE?e.milestoneRef:e.guidanceFlowRef,a=i[r]??!1;return(0,$.jsxs)(`li`,{style:{padding:`0.25rem 0`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,$.jsx)(`span`,{children:a?`✓`:`○`}),(0,$.jsx)(`span`,{style:{opacity:a?.6:1},children:n(e)})]},r??t)})})]})]})}function qU({stage:e}){let{tLifecycle:t,tLifecycleStage:n}=K({keys:[`lifecycle`]});return(0,$.jsxs)(`div`,{className:`px-8 py-4 bg-success/5 rounded-lg mb-4`,children:[(0,$.jsx)(`strong`,{children:t(`home_welcome_back.title`)}),(0,$.jsx)(`p`,{style:{margin:`0.25rem 0 0`},children:t(`home_welcome_back.message`,{stage:n(e)})})]})}function JU(){let{tLifecycle:e,isReady:t}=K({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}=K({component:B.APP_LAYOUTS_HOME});return(0,$.jsx)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`,textAlign:`center`},children:(0,$.jsx)(`h2`,{children:e(B.APP_LAYOUTS_HOME,`welcomeTitle`)})})}var XU=({})=>{let{currentStage:e,isEnabled:t,isLoading:n,activationProgress:r}=SU(),{homeDefinition:i}=Rg(),{registry:a}=lm(),o=cg(),{navigate:s}=wS(),c=Jp(),{tComponent:l,isReady:u}=K({component:B.APP_LAYOUTS_HOME}),d=i?.compositeViewReference,f=(0,Q.useMemo)(()=>{if(!i||i.compositeViewReference)return null;let e=i.resourceOperationPath;if(!e)return null;let t=a.resourceConfigurations[e.resourceType];if(!t)return null;let n=t.operations.find(t=>String(t.operationIdentifier)===String(e.operationIdentifier)&&!!(t.isOperationDefault??!0)===e.isOperationDefault&&!!(t.isBulkOperation??!1)===e.isBulkOperation&&String(t.variantKey??``)===String(e.variantKey??``));if(!n)return null;let r=zm.resolveResourceUrl(t,n,c?.buildContextResourceIdentifiers?.()??{},a.allResourceFieldIdentifiers,e.parentResourcesRequirements);return r?.resolvedUrl?{content:{contentType:od.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:n,contextResourceIdentifiers:c?.buildContextResourceIdentifiers?.()??{},parentResourcesRequirements:e.parentResourcesRequirements})},urlPath:r.resolvedUrl}:null},[c,i,a]);if((0,Q.useEffect)(()=>{f&&f.urlPath!==o.pathname&&s({content:f.content,urlPath:f.urlPath,initiator:{sourceZone:Dn},replaceBrowserHistory:!0})},[f,o.pathname,s]),d)return(0,$.jsx)(GU,{viewRef:d,navigationZone:rr.PRIMARY});if(!u)return null;if(n)return(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`},children:l(B.APP_LAYOUTS_HOME,`loading`)});if(!t||!e)return(0,$.jsx)(YU,{});switch(e){case Lu.SIGNED_UP:return(0,$.jsx)(KU,{activationProgress:r});case Lu.REACTIVATED:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qU,{stage:e}),(0,$.jsx)(JU,{})]});case Lu.DORMANT:case Lu.ACTIVATED:case Lu.ENGAGED:default:return(0,$.jsx)(JU,{})}};function ZU({preset:e=q.DEFAULT,...t}){let n=G(B.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?[`${oi.COMPOSITE_VIEWS}.${o}`]:[],[o]),{tCompositeViewSection:c}=K({keys:s}),l=(0,Q.useMemo)(()=>{let e=new Set([...Object.keys(r??{}),...a?.viewDefinition.sectionRefs??[]]);if(e.size===0)return;let t=new Set(a?.viewDefinition.sectionRefs??[]);return Object.fromEntries(Array.from(e).map(e=>[e,{title:o&&t.has(e)?c(o,e,`title`):void 0,description:o&&t.has(e)?c(o,e,`description`):void 0,icon:r?.[e]?.icon,count:r?.[e]?.count,countTone:r?.[e]?.countTone}]))},[o,a?.viewDefinition.sectionRefs,r,c]),u=(0,Q.useMemo)(()=>$U(t,n,l,r,i),[t,n,l,r,i]);return(0,$.jsx)(Uk,{value:{sectionEntries:l},children:(0,$.jsx)(`div`,{className:U(`flex flex-col gap-section`,e),"data-composite-layout":!0,children:u})})}function $U(e,t,n,r,i){let a=$k(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(eA({...o,sections:e}),tW(e,t,r)),l=e.map(e=>eW(e,n));return(0,$.jsx)(UO,{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)(Yk,{hostKind:ck.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=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_APPROVAL_REQUEST,`AI_ApprovalRequest`)(e);return(0,$.jsx)(n,{...t})}function aW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_APPROVAL_QUEUE,`AI_ApprovalQueue`)(e);return(0,$.jsx)(n,{...t})}function oW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_DECISION_REQUEST,`AI_DecisionRequest`)(e);return(0,$.jsx)(n,{...t})}function sW({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_HUMAN_INPUT_REQUEST,`AI_HumanInputRequest`)(e);return(0,$.jsx)(n,{...t})}var cW=rs.getLogger(),lW=new Set(Object.values(Hu));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}=Tu(),{on:t}=sp(),[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=`${br}${Fa(Ar.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:Hu.NOT_ACTIONABLE};let i=`${br}${Fa(Ar.FLOWS_ACTORS_DECISION_ACT,{decisionRef:t,act:n})}`,a=async t=>{try{return await e.post(i,r,{silent:!0,...t?{headers:{[qu.REAUTH_TOKEN]:t}}:{}})}catch(e){let t=dW(e);if(!t)throw e;return t}},o=i=>n===Ne.ANSWER&&r.presentationId!==void 0?e.stepUpForDecision({binding:{decisionRef:t,presentationId:r.presentationId},requirement:i}):Promise.resolve(void 0),s={kind:Hu.NOT_ACTIONABLE,reason:Ac.DECISION_STEP_UP_REQUIRED},c;l.current.add(t);try{let e=n===Ne.ANSWER?u.current.find(e=>e.decisionRef===t)?.stepUp:void 0;if(e){let t=await o(e);c=t?await a(t):s}else if(c=await a(),c.kind===Hu.NOT_ACTIONABLE&&c.reason===Ac.DECISION_STEP_UP_REQUIRED){let e=await o({});e&&(c=await a(e))}await m()}finally{l.current.delete(t)}return c},[e,m]),g=(0,Q.useCallback)(async t=>{if(!e)return[];let n=`${br}${Fa(Ar.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(fa.FLOWS_ACTORS_DECISION_ROUTED,()=>{m()}),n=t(fa.FLOWS_ACTORS_DECISION_WITHDRAWN,e=>{if(!e?.decisionRef||l.current.has(e.decisionRef))return;let t=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=rs.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={[Yt.COMPLETED]:yW.COMPLETED,[Yt.CANCELLED]:yW.CANCELLED,[Yt.AWAITING_APPROVAL]:yW.AWAITING_APPROVAL,[Yt.PROCESSING]:yW.RUNNING,[Yt.PENDING]:yW.STARTING,[Yt.READY]:yW.STARTING,[Yt.FAILED]:yW.ERROR,[Yt.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}=Tu(),i=sg(),a=Jp(),{on:o,emit:s,isConnected:c}=sp(),l=(0,Q.useRef)(!1),u=(n?.flowsActorsViews?.length??0)>0,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(new Map),[T,E]=(0,Q.useState)(!1);Gm({identifier:es.FLOWS_ACTORS,isLoading:y,hasLoadedOnce:T});let D=(0,Q.useRef)(C);D.current=C;let O=(0,Q.useCallback)((e,t)=>{w(n=>{let r=n.get(e);if(!r)return n;let i=new Map(n);return i.set(e,t(r)),i})},[]),k=(0,Q.useCallback)(async()=>{if(!t?.runtime?.endPoints?.main_backend_api)hW(`Cannot refresh systems - API endpoint not configured`);else if(!r)hW(`Cannot refresh systems - httpClient not available`);else{b(!0),S(null);try{let e=await r.get(`${br}${Fa(Ar.FLOWS_ACTORS_FRONTEND_INFO)}`);f(e.systems),m(e.autonomousAgents),g(e.chatAgents),v(e.chatConnectionRefs),E(!0),hW(`Systems refreshed`,{count:e.systems.length})}catch(e){if(lt.isNotFoundError(e)){hW(`FlowsActors backend support not available - skipping systems bootstrap`),f([]),m([]),g([]),v([]),S(null),E(!0);return}let t=e instanceof Error?e:Error(`Unknown error`);S(t),hW(`Failed to refresh systems`,{error:t.message})}finally{b(!1)}}},[t?.runtime?.endPoints?.main_backend_api,r]),A=(0,Q.useCallback)(async(e,t,n)=>{if(!r)hW(`Cannot fetch conversation history - httpClient not available`);else try{let i=`${br}${Fa(Ar.FLOWS_ACTORS_HISTORY)}`,o=t===void 0?void 0:hc({...a?.currentOrganizationId?{organizationId:a.currentOrganizationId}:{},...t}),s=`?systemRef=${encodeURIComponent(e)}${o===void 0?``:`&contextRef=${encodeURIComponent(o)}`}`+(n?.before?`&before=${encodeURIComponent(n.before)}`:``),c=Sh(sn,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&&w(e=>{let t;for(let n of l){let r=e.get(n.executionId),i=r?.status===yW.ERROR&&(r.errorCode===fn.DECISION_PENDING||r.errorCode===fn.DECISION_PRESENTATION_STALE||r.errorCode===fn.DECISION_STEP_UP_REQUIRED);r&&!i||n.pendingApproval===void 0||(t??=new Map(e),t.set(n.executionId,{executionId:n.executionId,systemRef:n.systemRef,status:yW.AWAITING_APPROVAL,messages:[],pendingApproval:SW(n.pendingApproval)}))}return t??e}),{executions:c.executions,hasOlder:c.hasOlder===!0}}catch(t){if(lt.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]),j=(0,Q.useCallback)(async e=>{if(!r){hW(`Cannot delete conversation - httpClient not available`);return}let t=`${br}${Fa(Ar.FLOWS_ACTORS_HISTORY)}`;await r.delete(`${t}?executionId=${encodeURIComponent(e)}`),hW(`Conversation deleted`,{executionId:e})},[r]),M=(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??{}),w(t=>{let n=new Map(t);return n.set(o,{executionId:o,systemRef:e,status:yW.STARTING,messages:[]}),n}),s(fa.FLOWS_ACTORS_START,{systemRef:e,executionId:o,contextResourceIdentifiers:l,initialInput:t,...i?.caseRef?{caseRef:i.caseRef}:{},...i?.messageId?{messageId:i.messageId}:{}}),o},[c,s,a?.currentOrganizationId]),N=(0,Q.useCallback)((e,t,n,r,i,a)=>{let o=D.current.get(e);o?c?(hW(`Responding to approval`,{executionId:e,approvalId:t,approved:n,modified:i!==void 0}),s(fa.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:o.systemRef,executionId:e,approvalId:t,approved:n,comment:r,...o.pendingApproval?.decisionRef?{decisionRef:o.pendingApproval.decisionRef}:{},...o.pendingApproval?.presentationId?{presentationId:o.pendingApproval.presentationId}:{},...i?{modifiedToolArgs:i}:{},...a?{reasonCode:a}:{}}),O(e,e=>({...e,status:n?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,O]),P=(0,Q.useCallback)((e,t,n,r)=>{let i=D.current.get(e),a=i?.pendingApproval;if(!i||!a?.question||!a.decisionRef||!c){hW(`Cannot answer a question — no paused question, or the WebSocket is not connected`,{executionId:e});return}let o=t===Rne.ANSWER;s(fa.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:i.systemRef,executionId:e,approvalId:a.approvalId,decisionRef:a.decisionRef,...a.presentationId?{presentationId:a.presentationId}:{},approved:o,answer:{decisionId:a.decisionRef,optionRef:t,values:[...n]},...r?{comment:r}:{}}),O(e,e=>({...e,status:yW.RUNNING,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval}:void 0}))},[c,s,O]),F=(0,Q.useCallback)(e=>D.current.get(e),[]),I=(0,Q.useCallback)(e=>d.find(t=>t.ref===e),[d]),ee=(0,Q.useCallback)(e=>{let t=D.current.get(e);t&&c&&s(fa.FLOWS_ACTORS_CANCEL,{systemRef:t.systemRef,executionId:e})},[c,s]),L=(0,Q.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]);(0,Q.useEffect)(()=>{i.isAuthenticated()||(l.current=!1,f([]),m([]),g([]),v([]),S(null),w(new Map))},[i]);let R=(0,Q.useCallback)(()=>{!l.current&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,r,i,k]);(0,Q.useEffect)(()=>{!l.current&&u&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,u,r,i,k]);let z=(0,Q.useRef)(c);(0,Q.useEffect)(()=>{let e=z.current&&!c;z.current=c,e&&w(e=>{let t=null;for(let[n,r]of e)(r.status===yW.STARTING||r.status===yW.RUNNING)&&(t??=new Map(e),t.set(n,{...r,status:yW.ERROR,recoverable:!0,errorCode:fn.CONNECTION_LOST}));return t??e})},[c]),(0,Q.useEffect)(()=>{if(!c)return;let e=o(fa.FLOWS_ACTORS_STARTED,e=>{hW(`Execution started`,{executionId:e.executionId}),O(e.executionId,e=>({...e,status:yW.RUNNING}))}),t=o(fa.FLOWS_ACTORS_MESSAGE,e=>{hW(`Execution message`,{executionId:e.executionId,type:e.messageType,messageId:e.messageId,isFinal:e.isFinal});let t=Ute.safeParse(e.data);if(t.success){let{approvalId:n,toolName:r}=t.data;hW(`Approval requested`,{executionId:e.executionId,approvalId:n,toolName:r}),O(e.executionId,e=>({...e,status:yW.AWAITING_APPROVAL,answeredApproval:void 0,pendingApproval:SW(t.data)}))}O(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(fa.FLOWS_ACTORS_COMPLETED,e=>{hW(`Execution completed`,{executionId:e.executionId,status:e.status,duration:e.duration}),O(e.executionId,t=>({...t,status:xW(e.status),pendingApproval:void 0,duration:e.duration,...e.usage?{usage:e.usage}:{}}))}),r=o(fa.FLOWS_ACTORS_ERROR,e=>{hW(`Execution error`,{executionId:e.executionId,errorCode:e.errorCode,recoverable:e.recoverable}),O(e.executionId,t=>{if(e.recoverable&&e.errorCode===fn.APPROVAL_MODIFICATION_REJECTED&&t.answeredApproval)return{...t,status: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===fn.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===fn.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===fn.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,O]);let te=(0,Q.useMemo)(()=>({systems:d,autonomousAgents:p,chatAgents:h,chatConnectionRefs:_,requestAgentDeclarations:R,isLoading:y,error:x,executions:C,startExecution:M,respondToApproval:N,answerQuestion:P,cancelExecution:ee,clearExecution:L,getExecution:F,getSystem:I,refreshSystems:k,fetchConversationHistory:A,deleteConversation:j}),[d,p,h,_,R,y,x,C,M,N,P,ee,L,F,I,k,A,j]);return(0,$.jsx)(CW.Provider,{value:te,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={[Ut.AGENT_NOT_REGISTERED]:`refusalAgentNotRegistered`,[Ut.TOOL_NOT_DECLARED]:`refusalToolNotDeclared`,[Ut.TOOL_NO_LONGER_GATED]:`refusalToolNoLongerGated`,[Ut.APPROVAL_ROUTE_CHANGED]:`refusalApprovalRouteChanged`,[Ut.AGENT_NOT_ACTIVE]:`refusalAgentNotActive`,[Ut.AGENT_SUSPENDED]:`refusalAgentSuspended`,[Ut.CONTENT_POLICY_TIGHTENED]:`refusalContentPolicyTightened`,[Ut.AGENT_STANDING_UNREADABLE]:`refusalAgentStandingUnreadable`,[Ut.ARGUMENTS_INVALID]:`refusalArgumentsInvalid`,[Ut.ARGUMENTS_NOT_RUN_AS_WRITTEN]:`refusalArgumentsNotRunAsWritten`,[Ut.ARGUMENTS_CANNOT_BE_CORRECTED]:`refusalArgumentsCannotBeCorrected`,[Ut.CREDENTIAL_NOT_ACCEPTED]:`refusalCredentialNotAccepted`,[Ut.SIGNING_KEY_NOT_CONFIGURED]:`refusalSigningKeyNotConfigured`,[Ut.CALL_NOT_REWRITABLE]:`refusalCallNotRewritable`,[Ut.RECORD_NOT_REACHABLE]:`refusalRecordNotReachable`,[Ut.DELIVERABLE_FILE_NOT_EDITABLE]:`refusalDeliverableFileNotEditable`},OW=`refusalReasonUnstated`,kW=new Set(Object.values(Ut));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){let n={arguments:(e.argumentNames??[]).join(`, `)||t(`noticeTheseArguments`)};return{[Hu.APPLIED]:void 0,[Hu.NOT_ACTIONABLE]:e.reason===Ac.PRESENTATION_STALE?t(`noticePresentationStale`):e.reason===Ac.CLOCK_ALREADY_PAUSED?t(`noticeClockAlreadyPaused`):e.reason===Ac.CLOCK_NOT_PAUSED?t(`noticeClockNotPaused`):e.reason===Ac.PAUSE_STATE_NOT_DECLARED?t(`noticePauseStateNotDeclared`):t(`noticeNotActionable`),[Hu.LAPSED]:t(`noticeLapsed`),[Hu.REQUESTER_AUTHORITY_LAPSED]:t(`noticeRequesterAuthorityLapsed`),[Hu.MODIFICATION_REJECTED]:e.reason===Ac.EDITED_CALL_NOT_REACHABLE?t(`noticeEditedCallNotReachable`,n):e.reason===Ac.CALL_NOT_RUN_AS_READ?t(`noticeCallNotRunAsRead`,n):e.reason===Ac.CREDENTIAL_NOT_ACCEPTED?t(`noticeCredentialNotAccepted`,n):e.reason===Ac.CALL_CANNOT_RUN?t(`noticeCallCannotRun`):e.reason===Ac.ARGUMENTS_CANNOT_BE_CORRECTED?t(`noticeArgumentsCannotBeCorrected`,n):t(`noticeModificationRejected`),[Hu.REASON_CODE_REJECTED]:t(`noticeReasonCodeRejected`),[Hu.CONSENT_REQUIRED]:t(`noticeConsentRequired`),[Hu.TARGET_REFUSED]:e.reason===Ac.NO_TARGET?t(`noticeNoEscalationTarget`):t(`noticeTargetRefused`),[Hu.SUPERSEDED]:t(`noticeSuperseded`)}[e.kind]}function NW(e,t){let n=e.find(e=>e.decisionRef===t)?.presentationId;return n?{presentationId:n}:{}}function PW(e,t){if(e&&e.length!==0)return e.map(e=>({value:e,label:t(Xie,e)}))}function FW(e,t){return t(ite.HUMAN_DECISION_PAUSE_STATE,e)}var IW=[oi.SYSTEM_ENUMS,oi.ROLES],LW=[];function RW({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}=KW(Q.useMemo(()=>f?[f]:[],[f]),LW),y=Q.useCallback((t,n,i,a)=>{o(t),c(l.current),r(e,t,!0,n,i,...a?[a]:[])},[e,r]),b=Q.useCallback((t,n,i)=>{o(t),c(l.current),i?r(e,t,!1,n,void 0,i):r(e,t,!1,n)},[e,r]),x=Q.useCallback((t,n,r,a)=>{o(t),c(l.current),i(e,n,r,a)},[e,i]),S=Q.useCallback(e=>_(B.LOW_LEVEL_AI_APPROVAL,e),[_]);if(Q.useEffect(()=>{o(null)},[d]),!u||!d)return s?(0,$.jsx)(rM,{decisionRef:s.decisionRef,description:s.title}):null;let{approvalId:C,riskLevel:w,expiresAt:T,toolName:E,toolArgs:D,toolInputSchema:O,modificationRefusal:k,rejectedToolArgs:A,routeKind:j,reasonCodes:M,reasonCodeRefused:N,question:P,presentation:F}=d,I=HW(F?.title??lc({plane:Yr.CONVERSATIONAL,toolName:E??``}).title,p,m,h,g);l.current=d.decisionRef?{decisionRef:d.decisionRef,title:I}:null;let ee=j===void 0||j===Tr.OWNER;return P?(0,$.jsx)(iW,{approvalId:C,actionDescription:P.title,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:ee,question:WW(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:ee,actionNotice:ee?N?_(B.LOW_LEVEL_AI_APPROVAL,`noticeReasonCodeRejected`):void 0:_(B.LOW_LEVEL_AI_APPROVAL,`awaitingReview`),reasonCodeOptions:ee?PW(M,v):void 0,allowArgumentModification:ee,toolName:E,toolLabel:E?h(E):void 0,executionContext:D,presentedArguments:d.presentation?Gr(d.presentation):void 0,argumentsSchema:O,argumentModificationError:k?AW(k,(e,t)=>_(B.LOW_LEVEL_AI_APPROVAL,e,t)):void 0,rejectedArguments:A,onApprove:y,onDeny:b,isProcessing:a===C,...t})}function zW(e,t,n,r){return{[Tr.OWNER]:()=>t(`holderOwner`),[Tr.ASSIGNEE]:()=>e.claimedAt?t(`holderClaimedByYou`,{when:r(e.claimedAt)}):t(`holderAssignedToYou`),[Tr.ROLE]:()=>e.eligibleRole?t(`holderRole`,{role:n(e.eligibleRole)}):void 0}[e.kind]()}var BW={[ee.USER]:void 0,[ee.MACHINE]:`requesterAutonomousAgent`,[ee.DELEGATED_CLIENT]:`requesterConnectedApplication`};function VW(e,t){let n=BW[e];return n?t(n):void 0}function HW(e,t,n,r,i=(e,t)=>`${oi.RESOURCES}.${e}.operations.${t}.${Nc.TITLE}`){switch(e.kind){case D.LABEL:return e.params?t(e.labelRef,Object.fromEntries(Object.entries(e.params).map(([e,a])=>[e,typeof a==`object`?HW(a,t,n,r,i):String(a)]))):t(e.labelRef);case D.ROLE:return n(e.roleKey);case D.TOOL:return r(e.toolName);case D.RESOURCE_OPERATION:return i(e.resourceType,e.operationIdentifier);case D.TEXT:return e.text;default:return e}}function UW(e,t,n=e=>e,r=e=>e,i){let a=e.presentation?{presentedArguments:Gr(e.presentation)}:{},o=HW(e.presentation?.title??lc(e).title,t,n,r,i);return e.plane===Yr.OPERATION_APPROVAL&&e.operationApproval?{actionDescription:o,executionContext:e.operationApproval.requestedValues,...a}:e.plane===Yr.REPRESENTATIVE_ADMISSION&&e.representativeAdmission||Cr(e)?{actionDescription:o}:{actionDescription:o,toolName:e.toolName,toolLabel:r(e.toolName),executionContext:e.toolArgs,...a}}function WW(e,t){return{description:e.description,options:e.options.map(e=>({ref:e.ref,label:HW(Cee(e),t,e=>e,e=>e),intent:e.intent,...e.description?{description:e.description}:{}})),fields:e.fields,...e.form?{form:e.form}:{}}}function GW(e,t){if(e.request&&Cr(e))return WW(e.request,t)}function KW(e,t){let n=Q.useMemo(()=>[...IW,...e.map(Bee),...t.map(e=>`${oi.RESOURCES}.${e}`)],[e,t]),{t:r,tComponent:i,tRole:a,tSystemEnum:o,tResourceOperation:s,formatDateTime:c}=K({component:B.LOW_LEVEL_AI_APPROVAL,keys:n});return{t:Q.useCallback((e,t)=>i(B.LOW_LEVEL_AI_APPROVAL,e,t),[i]),roleLabel:Q.useCallback(e=>a?a(e,`label`):e,[a]),toolLabel:Q.useCallback(e=>{let t=Tee(e,zie.TITLE),n=r(t);return n===t||n.length===0?e:n},[r]),operationLabel:Q.useCallback((e,t)=>s(e,t,Nc.TITLE),[s]),tComponent:i,tSystemEnum:o,formatDateTime:c}}function qW(e,t){let n=new URLSearchParams(t).get(ote);if(!n)return e;let r=e.filter(e=>e.decisionRef===n);return r.length===0?e:[...r,...e.filter(e=>e.decisionRef!==n)]}function JW(e){let{decisions:t,readState:n,refresh:r,act:i,candidates:a}=pW(),o=Q.useMemo(()=>qW(t,window.location.search),[t]),{t:s,roleLabel:c,toolLabel:l,operationLabel:u,tSystemEnum:d,formatDateTime:f}=KW(Q.useMemo(()=>[...new Set(o.map(e=>e.toolName).filter(e=>!!e))].sort(),[o]),Q.useMemo(()=>[...new Set(o.map(e=>e.operationApproval?.resourceType).filter(e=>!!e))].sort(),[o])),[p,m]=Q.useState(()=>new Set),[h,g]=Q.useState(()=>new Map),[_,v]=Q.useState(()=>new Map),[y,b]=Q.useState([]),x=Q.useRef(new Map),S=Q.useCallback(async(e,t,n)=>{m(t=>new Set(t).add(e));let r=x.current.get(e);try{let a=await i(e,t,n);t===Ne.ANSWER&&a.kind===Hu.APPLIED&&b(t=>[{decisionRef:e,...r?{title:r}:{}},...t.filter(t=>t.decisionRef!==e)].slice(0,jW));let o=MW(a,s);g(t=>{let n=new Map(t);return o===void 0?n.delete(e):n.set(e,o),n})}catch{g(t=>new Map(t).set(e,s(`noticeNotActionable`)))}finally{m(t=>{let n=new Set(t);return n.delete(e),n})}},[i,s]),C=Q.useMemo(()=>o.map(e=>({approvalId:e.decisionRef,executionId:e.executionId,systemRef:e.systemRef,systemName:e.systemDisplayName,riskLevel:e.riskLevel,question:GW(e,s),holderNotice:zW(e.route,s,c,f),requesterNotice:VW(e.requesterKind,s),...UW(e,s,c,l,u),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,createdAt:new Date(e.requestedAt),canEscalate:e.permittedActs.includes(Ne.ESCALATE)&&e.declaresEscalationTarget,canClaim:e.permittedActs.includes(Ne.CLAIM),canUnclaim:e.permittedActs.includes(Ne.UNCLAIM),canReassign:e.permittedActs.includes(Ne.REASSIGN),reassignCandidates:_.get(e.decisionRef),actionNotice:h.get(e.decisionRef),canPauseClock:e.permittedActs.includes(Ne.PAUSE_CLOCK)&&!e.clockPause&&e.pauseStates.length>0,canResumeClock:e.permittedActs.includes(Ne.RESUME_CLOCK)&&!!e.clockPause,pauseStateOptions:e.pauseStates.map(e=>({value:e,label:FW(e,d)})),deadlineNotice:e.nextDeadline?s(e.nextDeadline.kind===Hee.CLAIM?`deadlineClaimBy`:`deadlineDecisionBy`,{when:f(e.nextDeadline.dueAt)}):void 0,clockPausedNotice:e.clockPause?s(`clockPausedIn`,{pauseState:FW(e.clockPause.pauseStateRef,d)}):void 0,reasonCodeOptions:PW(e.reasonCodes,d),allowArgumentModification:e.plane===Yr.CONVERSATIONAL,argumentsSchema:e.toolInputSchema})),[o,_,h,s,c,l,u,d,f]);x.current=new Map(C.flatMap(e=>typeof e.actionDescription==`string`?[[e.approvalId,e.actionDescription]]:[]));let w=Q.useCallback((e,t,n,r,i)=>{let a=o.find(t=>t.decisionRef===e)?.plane,c=a?ure[a]:void 0;if(!c){g(t=>new Map(t).set(e,s(`noticeNotActionable`)));return}let l=t?c.approve:c.deny;S(e,Ne.ANSWER,{answer:{decisionId:e,optionRef:l,values:[]},...NW(o,e),...n?{reason:n}:{},...r?{modifiedToolArgs:r}:{},...i?{reasonCode:i}:{}})},[S,o,s]),T=Q.useCallback(e=>{v(t=>{let n=new Map(t);return n.delete(e),n}),a(e).then(t=>v(n=>new Map(n).set(e,t.map(e=>({value:e.userId,label:e.email??e.userId}))))).catch(()=>v(t=>new Map(t).set(e,[])))},[a]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(aW,{items:C,onApprove:(e,t,n,r)=>w(e,!0,t,n,r),onDeny:(e,t,n)=>w(e,!1,t,void 0,n),onEscalate:(e,t)=>void S(e,Ne.ESCALATE,t?{reason:t}:{}),onAnswer:(e,t,n,r,i)=>void S(e,Ne.ANSWER,{answer:{decisionId:e,optionRef:t,values:[...n]},...NW(o,e),...r?{reason:r}:{},...i?{reasonCode:i}:{}}),onClaim:e=>void S(e,Ne.CLAIM,{}),onUnclaim:e=>void S(e,Ne.UNCLAIM,{}),onReassignOpen:T,onReassign:(e,t,n)=>void S(e,Ne.REASSIGN,{targetUserId:t,...n?{reason:n}:{}}),onPauseClock:(e,t)=>void S(e,Ne.PAUSE_CLOCK,{pauseStateRef:t}),onResumeClock:e=>void S(e,Ne.RESUME_CLOCK,{}),processingIds:p,isLoading:n===fW.LOADING,loadFailed:n===fW.FAILED,onRetry:()=>{r()},...e}),y.map(e=>(0,$.jsx)(rM,{decisionRef:e.decisionRef,...e.title?{description:e.title}:{}},e.decisionRef))]})}function YW(){return(0,$.jsx)(QU,{children:(0,$.jsx)(Jk,{name:`decisions`,appearance:cr.CARD,children:(0,$.jsx)(JW,{})})})}function XW(e){return e.operationFrontendConfig?.customView}function ZW(e){return e.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey}var QW=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_ACTION});return i?(0,$.jsx)(mV,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceLayoutPreset_Action_Default`}):null};function $W({preset:e,...t}){let n=XW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=ZW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.RESOURCES_LAYOUTS_ACTION,`ResourceLayout_Action`)(i);return(0,$.jsx)(a,{...t})}var eG=Xs(B.LOW_LEVEL_DIALOG,`Dialog`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function tG({preset:e=q.DEFAULT,...t}){let n=eG(e);return(0,$.jsx)(n,{...t})}var nG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eG(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});nG.displayName=`DialogTrigger`;var rG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eG(e);return(0,$.jsx)(r.Content,{...t,ref:n})});rG.displayName=`DialogContent`;function iG({preset:e=q.DEFAULT,...t}){let n=eG(e);return(0,$.jsx)(n.Close,{...t})}function aG({preset:e=q.DEFAULT,...t}){let n=eG(e);return(0,$.jsx)(n.Header,{...t})}function oG({preset:e=q.DEFAULT,...t}){let n=eG(e);return(0,$.jsx)(n.Footer,{...t})}var sG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eG(e);return(0,$.jsx)(r.Title,{...t,ref:n})});sG.displayName=`DialogTitle`;var cG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eG(e);return(0,$.jsx)(r.Description,{...t,ref:n})});cG.displayName=`DialogDescription`;function lG({open:e,onAcknowledge:t,fields:n,resourceType:r}){let{tComponent:i,tResourceFieldDisplay:a,isReady:o}=K({component:B.RESOURCES_LAYOUTS_CREATE,resource:r}),s=Q.useRef(n);if(s.current=n,(0,Q.useEffect)(()=>()=>{s.current=[]},[]),!o)return null;let c=gp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.title`}),l=gp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.warning`}),u=gp({tComponent:i,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.acknowledge`});return(0,$.jsx)(tG,{open:e,onOpenChange:()=>{},children:(0,$.jsxs)(rG,{className:`sm:max-w-lg`,onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),showCloseButton:!1,children:[(0,$.jsxs)(aG,{children:[(0,$.jsx)(sG,{className:`text-warning-foreground`,children:c}),(0,$.jsx)(cG,{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)(zj,{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)(oG,{children:(0,$.jsx)(X,{onClick:t,children:u})})]})})}var uG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_CREATE}),{resourceType:a,operation:o,resourceConfig:s,isSemanticCustomOperation:c,navigateToPreferredRead:l,reportError:u,goBackWithinZone:d}=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),f=gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`formSubmissionFailed`}),p=gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_CREATE,key:`semanticOperationFailed`}),{closeOverlay:m}=wS(),h=e.additionalContext?.defaultValuesOverride,g=!!e.additionalContext?.quickCreateRequest,[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(n=>{if(g)t===rr.OVERLAY?m():d();else if(s){if(n){let r=n._id||n[s.resourceFieldIdentifier];if(r){l({contextResourceIdentifiers:On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,a,String(r)),fallbackToGoBack:!1,transitionOverride:t===rr.OVERLAY?Rt.PROMOTE:void 0})||d();return}}d()}},[m,d,g,l,t,s,e.contextResourceIdentifiers,a]),b=(0,Q.useCallback)(e=>{if(!s)return;let t=KS(o.responseDto,e);t.length>0?v({fields:t,result:e}):y(e)},[s,o.responseDto,y]),x=(0,Q.useCallback)(()=>{if(_){let{result:e}=_;v(null),y(e)}},[_,y]),S=(0,Q.useCallback)(e=>{u(e,f,`ResourceLayoutPreset_Create_Default`)},[f,u]),C=(0,Q.useMemo)(()=>t===rr.OVERLAY?()=>m():void 0,[t,m]);return i?c?(0,$.jsx)(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)(lG,{open:!0,onAcknowledge:x,fields:_.fields,resourceType:a})]}):null};function dG({preset:e,...t}){let n=XW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=ZW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.RESOURCES_LAYOUTS_CREATE,`ResourceLayout_Create`)(i);return(0,$.jsx)(a,{...t})}var fG=700;function pG(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},fG))},[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 mG=Pc.HIDDEN;function hG(e){let{resourceType:t,resourceConfig:n,data:r,hostIdentifiers:i}=e,a={...i??{}},o=n?.resourcePrimaryScope;if(o){let e=r[Qu[o]];typeof e==`string`&&e.length>0&&(a[Iie[o]]=e)}let s=n?.resourceFieldIdentifier,c=s?V.getResourceObjectId(r,s):void 0;return c&&(a[t]=c),a}function gG({resourceType:e,schema:t,data:n,className:r,primaryLabel:i=null,contextResourceIdentifiers:a}){let{registry:o}=lm(),s=(0,Q.useMemo)(()=>o.resourceConfigurations[e],[o,e]),c=(0,Q.useMemo)(()=>hG({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??XR(t,s),[d,t,s]),m=(0,Q.useRef)({titleMounted:!1}).current,h=(0,Q.useMemo)(()=>({resourceType:e,primaryLabel:i,titleMountTracker:m}),[e,i,m]);(0,Q.useEffect)(()=>{});let g=(0,Q.useMemo)(()=>({resourceContext:{resourceType:e,operationId:W.READ}}),[e]);return(0,$.jsx)(FA,{kind:NA.SUMMARY,children:(0,$.jsx)(mge,{value:h,children:(0,$.jsx)(UA.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??mG,isLoading:!1})})})})}gG.displayName=`ResourceSummaryDisplayer`;var _G=gG;function vG({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item`,`[&>*]:w-auto`,e),children:t})}var yG=`a[href], button, input, select, textarea, summary, [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"], [role="option"], [role="tab"]`;function bG(e){let t=e.target,n=e.currentTarget;if(!(t instanceof Element)||t===n)return!1;let r=t.closest(yG);return r!==null&&r!==n&&n.contains(r)}var xG=`15rem`,SG=`border border-border rounded-lg divide-y divide-border list-none m-0 p-0`,CG=`px-card py-card-sm`,wG=`ps-card`,TG=`flex items-start gap-element-sm`,EG=`border-s border-transparent ${wG}`,DG=`grid gap-element list-none m-0 p-0`;function OG(e){return e===void 0?SG:U(DG)}function kG(e){if(e===void 0)return;let t=Math.min(Math.max(Math.trunc(e),1),6);return{gridTemplateColumns:`repeat(auto-fill, minmax(max(${xG}, ${`calc((100% - ${t-1} * var(--spacing-element)) / ${t})`}), 1fr))`}}var AG={vertical:al.MIDDLE,horizontal:Zc.END,orientation:pu.HORIZONTAL},jG={[al.TOP]:`items-start`,[al.MIDDLE]:`items-center`,[al.BOTTOM]:`items-end`};function MG(e=AG){let{vertical:t,horizontal:n,orientation:r=pu.HORIZONTAL}=e,i=r===pu.VERTICAL?`flex flex-col gap-element-sm`:`flex gap-element-sm`;return n===Zc.MIDDLE?{containerClass:`flex ${t===al.TOP?`flex-col-reverse`:`flex-col`} gap-element-sm`,contentClass:`min-w-0`,actionsClass:`${i} self-center`}:{containerClass:`flex ${n===Zc.START?`flex-row-reverse`:``} ${jG[t]} gap-element-sm`.replace(/\s+/g,` `).trim(),contentClass:`min-w-0 flex-1`,actionsClass:`${i} shrink-0`}}var NG=async()=>{throw Error(`A collection cell does not edit in place.`)};function PG(e){let t=uj(),n=gm()?.registry,{resourceType:r,record:i,collectionContextResourceIdentifiers:a}=e;return(0,Q.useMemo)(()=>{if(!n||!i)return t;let e=hG({resourceType:r,resourceConfig:n.resourceConfigurations[r],data:i,hostIdentifiers:a??t.contextResourceIdentifiers});return{...t,resourceType:r,resourceId:On.getResourceId(e[r])||void 0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,n),canInlineEdit:!1,doInlineUpdate:NG,defaultInlineEdit:void 0,fileUploadContext:void 0,rmm:null}},[t,n,i,r,a])}function FG({fieldName:e,value:t,fieldSchema:n,fieldLabel:r,resourceType:i,record:a,collectionContextResourceIdentifiers:o,tResourceFieldEnumValue:s,fieldLabelVisible:c=!1}){let l=PG({resourceType:i,record:a,collectionContextResourceIdentifiers:o}),u=(0,Q.useMemo)(()=>{let t=n?Vc(n):void 0;if(!t)return;let r=Jo(t);if(r.length!==0)return Object.fromEntries(r.map(t=>[t,s(i,e,t,n)]))},[n,i,e,s]);return t==null?null:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-element-sm`,children:[r&&(c?(0,$.jsxs)(Z,{as:`span`,variant:zr.MUTED,size:Le.XS,children:[r,`:`]}):(0,$.jsxs)(`span`,{className:`sr-only`,children:[r,`: `]})),n?(0,$.jsx)(lj.Provider,{value:l,children:(0,$.jsx)(ak,{displayChromeMode:Pc.COMPACT,children:(0,$.jsx)(xR,{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 IG({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(ql.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:t,component:`ResourceListItemRenderer`});let v=n.resourceFieldIdentifier,y=V.getResourceObjectId(e,v),{t:b,formatDate:x,formatDateTime:S}=K({resource:t}),C=(0,Q.useMemo)(()=>{let n=V.computeFrontendResourceLabel({resourceType:t,registry:r,currentObject:e,t:b,formatDate:x,formatDateTime:S});return String(n||e[a[0]]||`${t} #${y}`)},[e,t,r,a,y,b,x,S]),w=(0,Q.useMemo)(()=>a.filter(t=>{let n=e[t];return YA(n)?String(n)!==C:!1}),[a,e,C]),T=(0,Q.useMemo)(()=>V.resolveRowSchema(n,e),[n,e]),E=(0,Q.useMemo)(()=>T?hr.getObjectLikeFieldShape(T,{commonOnly:!1})??null:null,[T]),D=Q.useContext(t_),O=D?.UIConfig?.currentBreakpoint??xl.DESKTOP,k=HA(n?.frontendConfiguration?.layout?.defaultChromeMode?.summary,O),A=(0,Q.useMemo)(()=>QA(k,w.map(e=>{let t=E?.[e];return{schemaType:t?me(t):void 0,present:!0,declaredChrome:t?HA(Js(t)?.chromeMode,O):void 0}})),[k,w,E,O]),j=n?.frontendConfiguration?.layout?.summary,M=_?.hover??``,N=_?.transition??``,P=MG(u),F=D?.UIConfig?.currentBreakpoint===xl.MOBILE,I=d&&m&&F,ee=pG(()=>p?.(e),{enabled:d&&!!p&&F}),L=!!c||I,R=()=>{ee.consumeLongPress()||(I?p?.(e):c?.(e))};return(0,$.jsxs)(`div`,{"data-slot":`resource-list-item`,className:U(`group/list-item`,CG,N,L&&`relative`,L&&M,L&&`cursor-pointer`,f&&`bg-primary/5`,d&&`select-none`,g),onClick:L?e=>{bG(e)||R()}:void 0,...ee.handlers,children:[L&&(0,$.jsx)(`button`,{type:`button`,"aria-label":String(C),className:U(`absolute inset-0 rounded-[inherit] outline-none`,Mg(a_.INSET)),onClick:e=>{e.stopPropagation(),R()}}),(0,$.jsxs)(`div`,{className:U(TG,L&&`relative`),children:[d&&(0,$.jsx)(`div`,{className:U(`shrink-0`,`pt-0.5`,!f&&!m&&`opacity-0 group-hover/list-item:opacity-100 group-focus-within/list-item:opacity-100 any-pointer-coarse:opacity-100 motion-safe:transition-opacity`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,$.jsx)(DI,{checked:f,onCheckedChange:()=>p?.(e),"aria-label":h??String(C)})}),(0,$.jsxs)(`div`,{className:U(P.containerClass,`min-w-0 flex-1`),children:[(0,$.jsx)(`div`,{className:U(`space-y-item-xs`,P.contentClass),children:j&&T?(0,$.jsx)(_G,{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)(vG,{children:w.map((n,r)=>{let a=e[n];return(0,$.jsx)(FG,{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 LG({navigationZone:e,className:t}){let n=Rx(),{tComponent:r}=K({component:B.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n.close()},[n]),a=n.target;return a?(0,$.jsx)(`div`,{"data-slot":`resource-in-place-operation`,className:U(`p-container`,t),children:(0,$.jsx)(hV,{resourceContext:a.resourceContext,navigationZone:e,onSuccess:i,onCancel:i,errorMessage:gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceInPlaceOperationRow`})}):null}var RG;(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`})(RG||={});var zG=new Set;function BG(e,t){return VG(e,t,$c)}function VG(e,t,n){if(!e)return zG;let r=new Set;for(let i of[e,...rl(t)]){let e=hr.getObjectLikeFieldShape(i,{commonOnly:!1});for(let[t,i]of Object.entries(e??{}))n(i)&&r.add(t)}return r.size>0?r:zG}var HG=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(!cre(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?Qu[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=VG(a?.mainSchema,a?.inheritenceSchemaDefinition,sa),s=[];for(let[e,r]of Object.entries(t)){if(typeof r==`function`||!r||typeof r!=`object`||i?.has(e)||e===`_id`)continue;let t=r,a=me(t),c=RG.UNKNOWN;if(Ue(t)){s.push({fieldName:e,schema:t,fieldType:RG.NUMBER_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}if(Ur(t)){s.push({fieldName:e,schema:t,fieldType:RG.YEAR_MONTH_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}let l,u;switch(a){case _u.STRING:c=RG.STRING;break;case _u.NUMBER:case _u.BIGDECIMAL:c=RG.NUMBER;break;case _u.BOOLEAN:c=RG.BOOLEAN;break;case _u.ENUM:c=RG.ENUM;try{l=Jo(lr(t))}catch{l=[]}break;case _u.DATE:case _u.DATETIME:c=RG.DATE;break;default:c=RG.STRING}if(c===RG.STRING&&n){let t=n.registry.fieldIdentifierToResourceType?.[e];t&&(c=RG.REFERENCE,u=t)}c===RG.STRING&&(sa(t)||o.has(e))&&(c=RG.YEAR_MONTH),s.push({fieldName:e,schema:t,fieldType:c,enumValues:l,referenceTargetResourceType:u})}return s}},UG=new Set([W.LIST,W.SEARCH,W.COUNT]);function WG(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&&Bl.resolveForeignKeyHolderResourceType(t)===e.targetResourceType).map(t=>({relationship:t,foreignKeyField:Bl.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier})).filter(t=>e.selectedForeignKey===void 0||t.foreignKeyField===e.selectedForeignKey)}var GG;(function(e){e.NAMES_HOST=`names_host`,e.OTHER=`other`,e.NO_ROUTE=`no_route`})(GG||={});function KG(e){return qG(e)===GG.NAMES_HOST}function qG(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)?GG.NAMES_HOST:GG.OTHER:GG.NO_ROUTE}function JG(e,t){return V.buildConfigurationError(ql.CONFIGURATION,{message:e,component:`confineRelatedCollectionToHost`,...t})}function YG(e,t,n){let r=n.resourceConfigurations[t]?.operations??[];return new Set(Object.keys(ES(e,r)??{}))}function XG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:i,registry:a}=e,o=t.resourceType,s=String(a.allResourceFieldIdentifiers[o]??``),c=[...t.operation.initiatorInfos??[]].sort((e,t)=>t.parameters.length-e.parameters.length||String(e.url??``).localeCompare(String(t.url??``))),l=V.buildContextualParameters(t.contextResourceIdentifiers,a),u=e=>(t.parentResourcesRequirements??[]).find(t=>t.resourceType===e);for(let e of c){let c=e.parameters.filter(e=>e.resourceType!==o||e.fieldIdentifier!==s),d=e=>i.length>0?i.includes(e.fieldIdentifier)||e.relationshipField!==void 0&&i.includes(e.relationshipField):e.resourceType===n;if(!c.some(d))continue;let f={...t.contextResourceIdentifiers},p=!0;for(let e of c){let t=l[e.fieldIdentifier],n=(typeof t==`string`||typeof t==`number`)&&String(t).length>0;if(d(e)){if(n&&String(t)!==r){p=!1;break}n||(f[e.fieldIdentifier]={fieldIdentifier:e.fieldIdentifier,resourceId:r})}else if(!n){p=!1;break}}if(!p)continue;let m=c.map((e,t)=>{let n=c[t+1]?.resourceType??o,r=u(e.resourceType);return{resourceType:e.resourceType,foreignKeyField:e.relationshipField,childResourceType:n,relationshipEdgeKey:V.buildRelationshipEdgeKey({parentResourceType:e.resourceType,childResourceType:n,foreignKeyField:e.relationshipField}),requirement:r?.requirement??Be.MANDATORY,isPrimaryScope:r?.isPrimaryScope??!1,...r?.primaryScope?{primaryScope:r.primaryScope}:{}}}),h={...t,contextResourceIdentifiers:f,parentResourcesRequirements:m};if(KG({childContext:h,hostResourceType:n,hostResourceId:r,registry:a,edgeForeignKeyFields:i}))return h}}function ZG(e){let{childContext:t,hostResourceId:n,callerPinnedFilters:r,registry:i}=e,{operation:a}=t,o=a.isBulkOperation===!0?void 0:_l(a);if(!o||!UG.has(o))return t;if(r&&Object.keys(r).length>0){let a=eK(t,r,i,$G.CALLER);if(!n)return a;try{return QG({...e,childContext:a,hostResourceId:n})}catch(e){if(e.wildoError?.context?.conflictingKey!==void 0)throw e;return a}}return n?QG({...e,hostResourceId:n}):t}function QG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,hostRelationships:i,selectedForeignKey:a,registry:o}=e,{operation:s,resourceType:c}=t,l=i?WG({hostResourceType:n,hostRelationships:i,targetResourceType:c,selectedForeignKey:a,registry:o}):[];if(a!==void 0&&l.length===0)throw JG(`"${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=qG({childContext:t,hostResourceType:n,hostResourceId:r,registry:o,edgeForeignKeyFields:u});if(d===GG.NAMES_HOST)return t;let f=l.length<=1?XG({childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:u,registry:o}):void 0;if(f)return f;if(d===GG.NO_ROUTE)return t;if(l.length===0)throw JG(`"${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 JG(`"${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 JG(`"${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 eK(t,{[p]:r},o,$G.RELATIONSHIP,n)}var $G;(function(e){e.CALLER=`caller`,e.RELATIONSHIP=`relationship`})($G||={});function eK(e,t,n,r,i){let a=r===$G.CALLER?`the embed's own filter`:`the relationship's foreign key`,{operation:o,resourceType:s}=e;if(_l(o)===W.COUNT)throw JG(`"${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=YG(o,s,n),l=Object.keys(t).find(e=>!c.has(e));if(l!==void 0&&r===$G.CALLER)throw JG(`"${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 JG(`"${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 JG(`"${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 tK(e){let{searchOperation:t}=e;if(!t)return!1;let n=Object.keys(e.pinnedFilters??{});if(n.length>0){let r=YG(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 nK(e){let t=e?.wildoError?.context?.message;return typeof t==`string`&&t.length>0?t:e instanceof Error?e.message:void 0}var rK=({pagination:e,onPaginationChange:t,className:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_PAGINATION}),a=(e.page-1)*e.limit+1,o=Math.min(e.page*e.limit,e.total),s=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page-1}))},[t]),c=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page+1}))},[t]);return e.total<=e.limit||!i?null:(0,$.jsxs)(`nav`,{"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`paginationLabel`),className:U(`flex items-center justify-between`,n),children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"aria-live":`polite`,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`showing`,{from:a,to:o,total:e.total})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:e.page<=1,"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`previousPage`),onClick:s,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`previous`)}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:e.page>=e.totalPages,"aria-label":r(B.RESOURCES_LAYOUTS_PAGINATION,`nextPage`),onClick:c,children:r(B.RESOURCES_LAYOUTS_PAGINATION,`next`)})]})]})};function iK({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_PAGINATION,`ResourceLayout_Pagination`)(e);return(0,$.jsx)(n,{...t})}function aK(e,t){let n=pc();return mm(n.interactiveState?.emptyDisplay)===`placeholder`&&oK(e,t)}function oK(e,t){return e?.primaryAction!==!1&&t}var sK=G(B.RESOURCES_LAYOUTS_EMPTY_STATE,`ResourceEmptyState`);function cK({resourceType:e,config:t,hasCreateOperation:n=!1,onCreateAction:r,variant:i=`default`,title:a,description:o,preset:s=q.DEFAULT}){let{tResourceEmptyState:c,tResourceOperation:l,tComponent:u,isReady:d}=K({component:[B.RESOURCES_LAYOUTS_EMPTY_STATE,B.RESOURCES_LAYOUTS_LIST],resource:e}),{activateFlow:f}=xU(),p=pc(),m=mm(p.interactiveState?.emptyDisplay),h=(0,Q.useMemo)(()=>a||c(e,`title`)||gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noItems`}),[a,e,c,u]),g=(0,Q.useMemo)(()=>a?o:c(e,`description`),[a,o,e,c]),_=oK(t,n),v=(0,Q.useMemo)(()=>{if(_)return l(e,W.CREATE,`title`)},[_,e,l]),y=(0,Q.useMemo)(()=>{if(t?.icon)return t.icon},[t?.icon]),b=(0,Q.useMemo)(()=>{if(!t?.secondaryAction)return;let{type:n,target:r}=t.secondaryAction,i=c(e,`secondaryActionLabel`);if(n===Wr.LINK)return{label:i,onClick:()=>{window.open(r,`_blank`,`noopener,noreferrer`)}};if(n===Wr.GUIDANCE)return{label:i,onClick:()=>f(r)}},[t?.secondaryAction,e,c,f]),x=sK(s);return!d||m===`render-children`||Poe(m)?null:(0,$.jsx)(x,{title:h,description:g,iconRef:y,primaryActionLabel:v,onPrimaryAction:_?r:void 0,showPrimaryAction:_,secondaryAction:b,variant:i,hidden:Kp(m),style:Kp(m)?{display:`none`}:void 0})}function lK(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function uK(e){return e.isSearchActive||Object.values(e.filterValues).some(lK)}function dK(e){return!(e.hasLoadedOnce&&e.itemCount===0&&!e.isNarrowed&&e.emptyStateOffersCreate)}var fK=300;function pK({enabled:e,debounceMs:t=fK,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 mK=({query:e,onChange:t,onClear:n,resourceType:r,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s})=>{let{tComponent:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:u}=Of(),d=u(H.SEARCH,{size:ca.SM}),f=u(H.X_MARK,{size:ca.SM});if(!l)return null;let p=c(B.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`);return(0,$.jsx)(eN,{type:`text`,value:e,onChange:t,placeholder:p,"aria-label":p,"data-slot":`collection-toolbar-search-input`,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s,prefix:d,suffix:e?(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:n,"aria-label":c(B.RESOURCES_LAYOUTS_LIST,`clearSearch`),className:`me-1`,children:f}):void 0})};function hK(e){let{resolvedRegionalPreferences:t}=K(),{registry:n}=lm(),r=n.resourceConfigurations[e],i=r?.mainSchema,a=r?.inheritenceSchemaDefinition,o=(0,Q.useMemo)(()=>BG(i,a),[i,a]),s=t?.timezone,c=(0,Q.useContext)(th)?.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 gK=864e5;function _K(e,t){return new Date(e.getTime()+t*gK)}function vK(e,t,n,r){let i=e=>n?e:Al.startOfZonedDay(e,r),a={};return e!==void 0&&(a.startDate=i(e)),t!==void 0&&(a.endDate=new Date(i(_K(t,1)).getTime()-1)),a}function yK(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 bK(e,t,n){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return;let r=e,i=yK(r.startDate),a=yK(r.endDate);if(!i&&!a)return;let o=e=>Al.calendarDateToday({timezone:t?`UTC`:n},e);return{firstDay:i?o(i):void 0,lastDay:a?o(a):void 0}}function xK(e){return typeof e==`string`&&Pt(e)!==void 0?e:void 0}function SK(e){let t=xK(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=xK(n),a=xK(r);return{...i===void 0?{}:{startMonth:i},...a===void 0?{}:{endMonth:a}}}function CK(e,t,n){let r={...SK(e)},i=xK(n);return i===void 0?delete r[t]:r[t]=i,r.startMonth===void 0&&r.endMonth===void 0?void 0:r}var wK={[Gc.TODAY]:e=>({firstDay:e,lastDay:e}),[Gc.YESTERDAY]:e=>({firstDay:_K(e,-1),lastDay:_K(e,-1)}),[Gc.LAST_7_DAYS]:e=>({firstDay:_K(e,-6),lastDay:e}),[Gc.LAST_30_DAYS]:e=>({firstDay:_K(e,-29),lastDay:e}),[Gc.THIS_MONTH]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),lastDay:e}),[Gc.THIS_YEAR]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),0,1)),lastDay:e}),[Gc.BEFORE_TODAY]:e=>({lastDay:_K(e,-1)}),[Gc.BEFORE_NOW]:e=>({lastDay:_K(e,-1)}),[Gc.NEXT_7_DAYS]:e=>({firstDay:e,lastDay:_K(e,6)}),[Gc.NEXT_30_DAYS]:e=>({firstDay:e,lastDay:_K(e,29)})},TK=new Set([Gc.BEFORE_NOW]),EK;(function(e){e.EXACT_BOUNDS=`exact_bounds`,e.ENDS_EARLIER_TODAY=`ends_earlier_today`})(EK||={});function DK(e,t,n,r){let i=r.calendarDateFields.has(t);return TK.has(e)&&!i?{window:{endDate:new Date(r.now.getTime())},readBack:EK.ENDS_EARLIER_TODAY}:{window:kK(wK[e](n),i,r.timeZone),readBack:EK.EXACT_BOUNDS}}function OK(e,t,n){if(!VK(e)||e.startDate!==void 0||e.endDate===void 0)return!1;let r=vK(t,void 0,!1,n.timeZone).startDate,i=e.endDate.getTime();return r!==void 0&&i>=r.getTime()&&i<=n.now.getTime()}function kK(e,t,n){return vK(e.firstDay,e.lastDay,t,n)}var AK={[hl.THIS_MONTH]:e=>({first:e,last:e}),[hl.LAST_MONTH]:e=>({first:e-1,last:e-1}),[hl.NEXT_MONTH]:e=>({first:e+1,last:e+1}),[hl.THIS_QUARTER]:e=>({first:e-e%3,last:e-e%3+2}),[hl.LAST_QUARTER]:e=>({first:e-e%3-3,last:e-e%3-1}),[hl.LAST_3_MONTHS]:e=>({first:e-2,last:e}),[hl.LAST_12_MONTHS]:e=>({first:e-11,last:e}),[hl.YEAR_TO_DATE]:e=>({first:e-e%12,last:e}),[hl.THIS_YEAR]:e=>({first:e-e%12,last:e-e%12+11})};function jK(e){return qi(Math.floor(e/12),e%12+1)}function MK(e,t){let n=AK[e](t.getUTCFullYear()*12+t.getUTCMonth());return{startMonth:jK(n.first),endMonth:jK(n.last)}}var NK={[ls.CURRENT_USER]:e=>e.userId!==void 0&&e.userId.length>0?e.userId:void 0};function PK(e){return typeof e==`object`&&!!e&&`contextValue`in e}function FK(e){return typeof e==`object`&&!!e&&`relativeMonthRange`in e}function IK(e){return typeof e==`object`&&!!e&&`relativeRange`in e}function LK(e,t){let n=Al.calendarDateToday({timezone:t.timeZone},t.now),r={};for(let[i,a]of Object.entries(e.filters))if(IK(a))r[i]=DK(a.relativeRange,i,n,t).window;else if(FK(a))r[i]=MK(a.relativeMonthRange,n);else if(PK(a)){let e=NK[a.contextValue](t.viewer);if(e===void 0)return null;r[i]=e}else r[i]=a;return r}function RK(e,t){return Object.values(e.filters).every(e=>!PK(e)||NK[e.contextValue](t)!==void 0)}function zK(e,t){if(VK(t)){if(!VK(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(HK(t))return HK(e)&&e.min===t.min&&e.max===t.max;if(BK(t)||BK(e)){let n=SK(e),r=SK(t);return(n.startMonth!==void 0||n.endMonth!==void 0)&&n.startMonth===r.startMonth&&n.endMonth===r.endMonth}return e===t}function BK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length>0&&t.every(([e,t])=>(e===`startMonth`||e===`endMonth`)&&typeof t==`string`&&Pt(t)!==void 0)}function 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===`startDate`||e===`endDate`)&&t instanceof Date)}function HK(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 UK(e,t,n){let r=LK(e,n);if(r===null)return!1;let i=Object.entries(r),a=Al.calendarDateToday({timezone:n.timeZone},n.now);return i.length>0&&i.every(([r,i])=>{let o=e.filters[r];return o!==void 0&&IK(o)&&DK(o.relativeRange,r,a,n).readBack===EK.ENDS_EARLIER_TODAY?OK(t[r],a,n):zK(t[r],i)})}function WK(e,t,n){let r=LK(e,n);if(r===null)return t;let i={...t};if(UK(e,t,n)){for(let e of Object.keys(r))delete i[e];return i}return{...i,...r}}function GK(e,t,n){let r=new Set;for(let i of e)if(UK(i,t,n))for(let e of Object.keys(i.filters))r.add(e);return r}var KK=/^(\d{4})-(\d{2})-(\d{2})$/;function qK(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=KK.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 JK(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=qK(t.startDate,n),a=qK(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=qK(e,n);return i?r(i):null}var YK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,presetFilters:i,className:a})=>{let{tResourceFieldDisplay:o,tResourceFieldEnumValue:s,tComponent:c,formatDate:l,isReady:u}=K({component:B.RESOURCES_LAYOUTS_FILTERS,resource:e}),{renderIcon:d}=Of(),f=e=>c(B.RESOURCES_LAYOUTS_FILTERS,e),p=hK(e),m=p.calendarDateFields,h=(0,Q.useMemo)(()=>{if(!i||i.length===0)return t;let e=GK(i,n,{now:new Date,...p});return t.filter(t=>!e.has(t.fieldName))},[t,i,n,p]),g=(0,Q.useMemo)(()=>h.filter(e=>{let t=n[e.fieldName];return t!=null&&t!==``}),[h,n]),_=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=o(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,o]),v=(0,Q.useCallback)(()=>{let e={...n};for(let t of h)delete e[t.fieldName];r(e)},[n,h,r]),y=(0,Q.useCallback)(e=>{let t={...n};delete t[e],r(t)},[n,r]);if(!u||g.length===0)return null;let b=d(H.X_MARK,{size:ca.XS});return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm flex-wrap`,a),children:[g.map(t=>{let r=t.fieldName,i=n[r],a=_[r]||r,o=String(i);if(t.fieldType===RG.REFERENCE)o=(0,$.jsx)(XK,{field:t,value:String(i)});else if(t.fieldType===RG.ENUM){let n=s(e,r,String(i),t.schema);typeof n==`string`&&(o=n)}else if(t.fieldType===RG.BOOLEAN)o=f(i?`booleanYes`:`booleanNo`);else if(t.fieldType===RG.YEAR_MONTH){let e=l(String(i),{yearMonth:!0});e!==``&&(o=e)}else if(t.fieldType===RG.YEAR_MONTH_RANGE){let{startMonth:e,endMonth:t}=SK(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===RG.DATE){let e=JK(i,l,m.has(t.fieldName));e!==null&&(o=e)}else if(t.fieldType===RG.NUMBER_RANGE){let e=i??{};o=e.min!==void 0&&e.max!==void 0?`${e.min} – ${e.max}`:e.min===void 0?`≤ ${e.max}`:`≥ ${e.min}`}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-xs ps-element-sm pe-element-xs py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[a,`:`]}),o,(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:()=>y(r),className:`ms-0.5 h-4 w-4 p-0`,"aria-label":f(`removeFilter`),children:b})]},r)}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:v,className:`text-xs text-muted-foreground`,children:f(`clearAll`)})]})},XK=({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 ZK(e,t){return(t?t.map(t=>e[t]):Object.values(e)).filter(e=>e!=null&&e!==``).length}var QK=`filters-panel`,$K=({activeCount:e,isExpanded:t,onToggle:n,className:r})=>{let{tComponent:i,isReady:a}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),{renderIcon:o}=Of();if(!a)return null;let s=(e=>i(B.RESOURCES_LAYOUTS_FILTERS,e))(`filters`);return(0,$.jsxs)(X,{variant:J.GHOST,size:Y.SM,onClick:n,"aria-expanded":t,"aria-controls":QK,"aria-label":s,title:s,"data-slot":`collection-toolbar-filters-trigger`,className:U(`gap-element-sm`,r),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(H.FILTER,{size:ca.SM})}),e>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-element-xs text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:e})]})},eq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFieldDisplay:a,tResourceFieldEnumValue:o,tComponent:s,resolvedRegionalPreferences:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_FILTERS,resource:e}),{timeZone:u,calendarDateFields:d}=hK(e),f=e=>s(B.RESOURCES_LAYOUTS_FILTERS,e),p=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=a(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,a]),m=(0,Q.useCallback)((e,t)=>{let i={...n};t===``||t==null?delete i[e]:i[e]=t,r(i)},[n,r]);return!l||t.length===0?null:(0,$.jsx)(`div`,{id:QK,className:U(`flex items-start gap-field flex-wrap p-card bg-muted/50 rounded-lg border border-border`,i),children:t.map(t=>(0,$.jsx)(`div`,{"data-filter-field":t.fieldName,className:`contents`,children:(0,$.jsx)(aq,{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))})},tq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let[a,o]=(0,Q.useState)(!1),s=ZK(n,t.map(e=>e.fieldName));return t.length===0?null:(0,$.jsxs)(`div`,{className:U(`space-y-element-sm`,i),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm flex-wrap`,children:[(0,$.jsx)($K,{activeCount:s,isExpanded:a,onToggle:()=>o(e=>!e)}),(0,$.jsx)(YK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]}),a&&(0,$.jsx)(eq,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]})},nq={[$s.TOGGLE]:vs.TOGGLE,[$s.RADIO]:vs.RADIO,[$s.SWITCH]:vs.SELECT,[$s.CHECKBOX]:vs.SELECT},rq;(function(e){e.ANY=``,e.YES=`true`,e.NO=`false`})(rq||={});function iq(e){return Od(rq).enumUI({edit:{editMode:nq[Br(e)]}})}var aq=({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)(()=>iq(e.schema),[e.schema]);switch(e.fieldType){case RG.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)(yI,{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:qd.SM})]});case RG.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)(eN,{type:`text`,value:u,onChange:m})]});case RG.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)(eN,{type:`number`,value:u,onChange:h})]});case RG.BOOLEAN:{let r=[{value:rq.ANY,label:o(`booleanAny`)},{value:rq.YES,label:o(`booleanYes`)},{value:rq.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)(aI,{name:e.fieldName,schema:g,options:r,value:t===void 0?rq.ANY:String(t),onChange:e=>i(e===rq.ANY?void 0:e===rq.YES),controlSize:qd.SM})]})}case RG.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)(aI,{name:e.fieldName,schema:e.schema,options:s,value:t??``,onChange:e=>i(e||void 0),controlSize:qd.SM})]})}case RG.DATE:{let r=bK(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)(fN,{name:e.fieldName,schema:e.schema,value:a,onChange:e=>{let t=e?.from??e?.to;i(t?vK(t,e?.to??t,s,c):void 0)},placeholder:o(`anyValue`),dateFormat:l,timeZone:c,controlSize:qd.SM})]})}case RG.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)(II,{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:qd.SM})]});case RG.YEAR_MONTH_RANGE:{let r=SK(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)(II,{name:`${e.fieldName}.startMonth`,schema:e.schema,value:r.startMonth,onChange:e=>i(CK(t,`startMonth`,e)),clearable:!0,labelledBy:`${p} ${a}`,controlId:`${p}-start-month`,monthPlaceholder:o(`anyValue`),controlSize:qd.SM}),(0,$.jsx)(`span`,{id:s,className:`text-xs text-muted-foreground`,children:o(`monthRangeEnd`)}),(0,$.jsx)(II,{name:`${e.fieldName}.endMonth`,schema:e.schema,value:r.endMonth,onChange:e=>i(CK(t,`endMonth`,e)),clearable:!0,labelledBy:`${p} ${s}`,controlId:`${p}-end-month`,monthPlaceholder:o(`anyValue`),controlSize:qd.SM})]})}case RG.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)(eN,{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)(eN,{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)(eN,{type:`text`,value:u,onChange:m})]})}},oq=`__wildo-quick-filter-all__`,sq=yd(),cq=`@max-[32rem]/collection-toolbar:hidden`,lq=`hidden @max-[32rem]/collection-toolbar:block`,uq=({resourceType:e,field:t,value:n,onChange:r,className:i})=>{let{tComponent:a,tResourceFieldDisplay:o,tResourceFieldEnumValue:s,isReady:c}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),l=(0,Q.useCallback)(e=>{typeof e==`string`&&e!==``&&r(e===oq?void 0:e)},[r]);if(!c)return null;let u=t.enumValues??[];if(u.length===0)return null;let d=o(e,t.fieldName,`label`),f=a(B.RESOURCES_LAYOUTS_FILTERS,`enumAll`),p=a(B.RESOURCES_LAYOUTS_FILTERS,`quickFilterLabel`,{field:d}),m=[{value:oq,label:f},...u.map(n=>({value:n,label:s(e,t.fieldName,n,t.schema)}))],h=n??oq;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yO,{type:gO.SINGLE,value:h,onValueChange:l,size:Y.SM,rovingFocus:!0,loop:!0,className:U(`justify-start`,cq,i),"data-slot":`collection-quick-filter`,"aria-label":p,children:m.map(e=>(0,$.jsx)(bO,{value:e.value,size:Y.SM,children:e.label},e.value))}),(0,$.jsx)(`div`,{className:U(lq,i),"data-slot":`collection-quick-filter-select`,children:(0,$.jsx)(gF,{name:`quick-filter-${t.fieldName}`,schema:sq,options:m,value:h,onChange:e=>l(e),"aria-label":p,size:qd.SM})})]})},dq=({resourceType:e,presets:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFilterPreset:a}=K({component:B.RESOURCES_LAYOUTS_FILTERS}),o=new Date,s=hK(e),c=(0,Q.useMemo)(()=>t.filter(e=>UK(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(WK(o,n,{now:new Date,...s}))},[c,t,n,r,s]);return t.length===0?null:(0,$.jsx)(yO,{type:gO.MULTIPLE,appearance:_O.CHIPS,value:c,onValueChange:l,size:Y.SM,orientation:pu.HORIZONTAL,className:i,"data-slot":`collection-filter-presets`,children:t.map(t=>{let n=a(e,t.ref,`label`);return(0,$.jsx)(bO,{value:t.ref,size:Y.SM,"data-preset":t.ref,disabled:!RK(t,s.viewer),children:n},t.ref)})})},fq=Xs(B.LOW_LEVEL_POPOVER,`Popover`,[`Trigger`,`Content`,`Anchor`]);function pq({preset:e=q.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n,{...t})}var mq=(0,Q.forwardRef)(({preset:e=q.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=q.DEFAULT,...t},n)=>{let r=fq(e);return(0,$.jsx)(r.Content,{...t,ref:n})});hq.displayName=`PopoverContent`;function gq({preset:e=q.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n.Anchor,{...t})}function zge(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var Bge={activationConstraint:{distance:8}},Vge={coordinateGetter:fF};function Hge({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}=uF({id:e.field,disabled:!n}),_=e.direction===`asc`,v={transform:zge(m),transition:h,opacity:g?.5:void 0,zIndex:g?10:void 0,position:`relative`};return(0,$.jsxs)(`div`,{ref:p,style:v,className:`flex items-center gap-element-sm rounded-md bg-muted/40 px-element-sm py-1`,children:[n&&(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:bg-accent/50 hover:text-muted-foreground`,Mg(a_.OFFSET),`active:cursor-grabbing`),"aria-label":i,...d,...f,children:u(H.GRIP_VERTICAL,{size:ca.SM})}),(0,$.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:r}),(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,size:Y.SM,onClick:()=>c(t),className:`h-6 gap-1 px-2 text-xs`,children:[u(_?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.XS}),_?a:o]}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,className:`h-5 w-5 p-0 text-muted-foreground`,onClick:()=>l(t),"aria-label":s,children:u(H.X_MARK,{size:ca.XS})})]})}var _q=({resourceType:e,sortFields:t,currentSorts:n,onSortChange:r,className:i})=>{let{tResourceFieldDisplay:a,tComponent:o,isReady:s}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:e}),{renderIcon:c}=Of(),[l,u]=(0,Q.useState)(!1),d=eP($N(MP,Bge),$N(OP,Vge)),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(tF([...n],e,a))}},[n,r]),v=(0,Q.useCallback)(e=>{r([...n,{field:e,direction:`asc`}])},[n,r]),y=(0,Q.useCallback)(()=>r([]),[r]);if(t.length===0||!s)return null;let b=e=>o(B.RESOURCES_LAYOUTS_LIST,e),x=n.length,S=x>1,C=c(H.ARROWS_UP_DOWN,{size:ca.SM}),w=b(`sortAsc`),T=b(`sortDesc`),E=b(`removeSort`),D=b(`reorderSort`);return(0,$.jsxs)(pq,{open:l,onOpenChange:u,children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,"aria-label":b(`sortLabel`),"data-slot":`collection-toolbar-sort-trigger`,className:U(`gap-1.5`,i),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:C}),(0,$.jsx)(`span`,{children:b(`sortLabel`)}),x>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:x})]})}),(0,$.jsxs)(hq,{align:Rr.START,className:`w-72 p-element-sm space-y-element-sm`,onInteractOutside:e=>{let t=e.detail.originalEvent?.type;t!==`pointerdown`&&t!==`mousedown`&&t!==`touchstart`&&t!==`click`&&e.preventDefault()},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-element-sm`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:b(`sortLabel`)}),x>0&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:y,className:`h-auto py-0.5 text-xs text-muted-foreground`,children:b(`clearSort`)})]}),(0,$.jsx)($P,{sensors:d,collisionDetection:sP,onDragEnd:_,children:(0,$.jsx)(cF,{items:m,strategy:aF,children:(0,$.jsx)(`div`,{className:`space-y-element-sm`,children:n.map((e,t)=>(0,$.jsx)(Hge,{rule:e,index:t,reorderable:S,label:f(e.field),reorderLabel:D,ascLabel:w,descLabel:T,removeLabel:E,onToggleDirection:h,onRemove:g,renderIcon:c},e.field))})})}),p.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-border/50 pt-element-sm`,children:[(0,$.jsx)(`span`,{className:`px-element-sm text-xs text-muted-foreground`,children:b(`addSort`)}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1 px-element-sm`,children:p.map(e=>(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>v(e),className:`h-6 gap-1 px-2 text-xs`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:c(H.PLUS,{size:ca.XS})}),f(e)]},e))})]})]})]})},vq=[{mode:gu.CARDS,icon:H.VIEW_LIST,labelKey:`viewCards`},{mode:gu.TABLE,icon:H.VIEW_TABLE,labelKey:`viewTable`},{mode:gu.BOARD,icon:H.VIEW_BOARD,labelKey:`viewBoard`},{mode:gu.CALENDAR,icon:H.VIEW_CALENDAR,labelKey:`viewCalendar`},{mode:gu.TIMELINE,icon:H.VIEW_TIMELINE,labelKey:`viewTimeline`}],Uge=[gu.CARDS,gu.TABLE],Wge=e=>vq.some(t=>t.mode===e),Gge=({viewMode:e,onViewModeChange:t,availableModes:n=Uge,className:r})=>{let{tComponent:i,isReady:a}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Of();if(!a)return null;let s=e=>i(B.RESOURCES_LAYOUTS_LIST,e);return(0,$.jsx)(yO,{type:gO.SINGLE,value:e,onValueChange:r=>{typeof r==`string`&&Wge(r)&&n.includes(r)&&r!==e&&t(r)},size:Y.SM,"aria-label":s(`viewModeLabel`),className:U(`shrink-0`,r),"data-slot":`collection-view-mode`,children:vq.filter(({mode:e})=>n.includes(e)).map(({mode:e,icon:t,labelKey:n})=>{let r=s(n);return(0,$.jsx)(bO,{value:e,size:Y.SM,"aria-label":r,title:r,children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(t,{size:ca.SM})})},e)})})};function yq({count:e,onClear:t,matchAllOffer:n,isMatchAllSelected:r,className:i}){let{tComponent:a}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Of();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm`,i),"data-slot":`collection-selection`,children:[(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:U(`text-sm font-medium text-muted-foreground whitespace-nowrap`,e===0&&`sr-only`),children:e>0?a(B.RESOURCES_LAYOUTS_LIST,r?`allMatchingSelected`:`selectedCount`,{count:e}):``}),n&&!r&&(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:n.onSelectAllMatching,children:a(B.RESOURCES_LAYOUTS_LIST,`selectAllMatching`,{count:n.matchedCount})}),e>0&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,onClick:t,"aria-label":a(B.RESOURCES_LAYOUTS_LIST,`clearSelection`),children:o(H.X_MARK,{size:ca.XS})})]})}function bq(e,t){return e===0||t===0?!1:t>=e||`indeterminate`}function xq({state:e,onToggle:t,className:n}){let{tComponent:r}=K({component:B.RESOURCES_LAYOUTS_LIST}),i=r(B.RESOURCES_LAYOUTS_LIST,`selectAll`);return(0,$.jsx)(`span`,{className:U(`inline-flex shrink-0 items-center`,EG,n),"data-slot":`collection-select-all`,title:i,children:(0,$.jsx)(DI,{checked:e,onCheckedChange:()=>t(),"aria-label":i})})}var Sq;(function(e){e.LABELLED=`labelled`,e.ICONS=`icons`,e.CAPPED=`capped`})(Sq||={});var Kge={[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 qge(){return(0,Q.useContext)(Cq)?.density??null}function Jge(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 Yge(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=>Kge[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 Xge=`motion-safe:transition-[width] motion-safe:duration-[var(--motion-duration-normal)] motion-safe:ease-[var(--motion-easing-default)] motion-reduce:transition-none`,Zge=`@container/collection-toolbar`,Qge=`@max-[32rem]/collection-toolbar:order-last @max-[32rem]/collection-toolbar:basis-full`,$ge=`@max-[32rem]/collection-toolbar:hidden`,Oq;(function(e){e.REFINE=`refine`,e.SELECTION=`selection`})(Oq||={});var e_e=({resourceType:e,quickFilter:t,presetFilters:n,search:r,filterFields:i,filterPanel:a=Go.OFFERED,filterValues:o,onFiltersChange:s,sort:c,viewMode:l,primaryAction:u,selection:d,selectAll:f,bulkActions:p,collectionActions:m,className:h})=>{let[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),{tComponent:b}=K({component:B.RESOURCES_LAYOUTS_LIST}),{renderIcon:x}=Of(),S=b(B.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`),C=(0,Q.useCallback)(e=>{e.currentTarget.value||_(!1)},[]),w=(0,Q.useCallback)(e=>{e.key===`Escape`&&(r?.onClear(),_(!1),e.currentTarget.blur())},[r]),T=i.length>0,E=T&&a!==Go.HIDDEN,D=!!c&&c.sortFields.length>0,O=ZK(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:U(Zge,`flex flex-col gap-element-sm`,h),"data-slot":`collection-toolbar`,children:[t&&(0,$.jsx)(uq,{resourceType:e,field:t.field,value:t.value,onChange:t.onChange}),(0,$.jsxs)(`div`,{ref:M,className:U(`flex items-center gap-element`,A?`flex-nowrap`:`flex-wrap`),"data-slot":`collection-toolbar-row`,"data-mode":A?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:J.GHOST,size:Y.ICON_SM,onClick:()=>_(!0),"aria-label":S,title:S,"data-slot":`collection-toolbar-search-trigger`,children:x(H.SEARCH,{size:ca.SM})}),r&&k&&(0,$.jsx)(`div`,{className:U(`overflow-hidden shrink-0 w-64 max-w-full`,Xge),"data-state":`open`,children:(0,$.jsx)(mK,{query:r.query,onChange:r.onChange,onClear:r.onClear,resourceType:e,autoFocus:!0,onFocus:()=>_(!0),onBlur:C,onKeyDown:w})}),E&&(0,$.jsx)($K,{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:U(`h-5 w-px bg-border`,$ge),"aria-hidden":`true`}),(0,$.jsx)(dq,{resourceType:e,presets:n,currentFilters:o,onFiltersChange:s,className:Qge})]})]}),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)(Gge,{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)(eq,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s}),T&&(0,$.jsx)(YK,{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 t_e(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function n_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 r_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 i_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 a_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 o_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:()=>n_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=>r_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},s_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 c_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(!t_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},l_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 u_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 d_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 u_e(i,t,n)},Nq(e.options,`debugTable`,`_getOrderColumnsFn`))}},Xq=()=>({left:[],right:[]}),f_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 p_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:[]}),m_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=p_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=h_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 h_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 g_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 __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()}}},v_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)}}},y_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}),b_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:[]}),x_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`))}},S_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,C_e=(e,t,n)=>pJ(fJ(e.getValue(n)).toLowerCase(),fJ(t.getValue(n)).toLowerCase()),w_e=(e,t,n)=>pJ(fJ(e.getValue(n)),fJ(t.getValue(n))),T_e=(e,t,n)=>dJ(fJ(e.getValue(n)).toLowerCase(),fJ(t.getValue(n)).toLowerCase()),E_e=(e,t,n)=>dJ(fJ(e.getValue(n)),fJ(t.getValue(n))),D_e=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},O_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:C_e,alphanumericCaseSensitive:w_e,text:T_e,textCaseSensitive:E_e,datetime:D_e,basic:O_e},k_e=[a_e,g_e,d_e,f_e,s_e,c_e,__e,v_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())}},l_e,y_e,b_e,x_e,S_e,m_e];function A_e(e){let t=[...k_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=i_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 j_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=o_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 M_e(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=Q.useState(()=>({current:A_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=Xs(B.LOW_LEVEL_TABLE,`Table`,[`Header`,`Body`,`Footer`,`Row`,`Head`,`Cell`,`Caption`]);function gJ({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n,{...t})}function _J({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Header,{...t})}function vJ({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Body,{...t})}function N_e({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Footer,{...t})}function yJ({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Row,{...t})}function bJ({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Head,{...t})}function xJ({preset:e=q.DEFAULT,...t}){let n=hJ(e);return(0,$.jsx)(n.Cell,{...t})}function P_e({preset:e=q.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 F_e=({items:e,resourceType:t,resourceConfig:n,navigationZone:r,summaryFields:i,contextResourceIdentifiers:a,fieldLabelsMap:o,sortFields:s,sortStates:c,onSortChange:l,selectable:u=!1,isRowSelected:d,onToggleRow:f,allSelected:p=!1,onToggleAll:m,renderRowActions:h,onRowClick:g,canOpenRow:_})=>{let{tComponent:v,tResourceFieldEnumValue:b}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:t}),{renderIcon:x}=Of(),S=Rx(),{getRecipe:C}=Rg(),w=C(oc.INTERACTIVE,In.GHOST),T=C(oc.TYPOGRAPHY,y.EYEBROW),E=(0,Q.useMemo)(()=>V.resolveFieldShapeOfAnyVariant(n)??null,[n]),D=(0,Q.useMemo)(()=>new Set(s),[s]),O=M_e({data:e,columns:(0,Q.useMemo)(()=>{let e=[];u&&e.push({id:`__select`,header:()=>(0,$.jsx)(DI,{checked:p,onCheckedChange:()=>m?.(),"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`selectAll`)}),cell:({row:e})=>(0,$.jsx)(DI,{checked:d?.(e.original)??!1,onCheckedChange:()=>f?.(e.original),"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:e.index+1})}),size:40,enableSorting:!1});for(let n of i){let r=E?.[n],i=D.has(n),s=o[n]||n;e.push({id:n,accessorFn:e=>e[n],header:()=>{if(!i)return(0,$.jsx)(`span`,{children:s});let e=c.findIndex(e=>e.field===n),t=e>=0,r=t?c[e].direction:null;return(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`inline-flex items-center gap-1 text-start -ms-2 h-auto py-0.5 px-2 font-medium`,onClick:()=>{e<0?l([...c,{field:n,direction:`asc`}]):c[e].direction===`asc`?l(c.map((t,n)=>n===e?{...t,direction:`desc`}:t)):l(c.filter((t,n)=>n!==e))},children:[s,t&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-muted-foreground`,"aria-hidden":`true`,children:[x(r===`asc`?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:ca.XS}),c.length>1&&(0,$.jsx)(`span`,{className:`text-[10px] font-semibold tabular-nums`,children:e+1})]})]})},cell:({row:e})=>(0,$.jsx)(FG,{value:e.original[n],fieldSchema:r,fieldLabel:void 0,resourceType:t,record:e.original,collectionContextResourceIdentifiers:a,fieldName:n,tResourceFieldEnumValue:b})})}return h&&e.push({id:`__actions`,header:()=>(0,$.jsx)(`span`,{className:`sr-only`,children:v(B.RESOURCES_LAYOUTS_LIST,`actionsColumn`)}),cell:({row:e})=>(0,$.jsx)(`div`,{className:`flex justify-end`,children:h(e.original)}),enableSorting:!1}),e},[u,p,m,d,f,h,i,a,E,D,o,c,l,t,b,v,x]),getCoreRowModel:j_e(),getRowId:(e,t)=>String(e.id??e._id??t),manualSorting:!0});return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{"data-slot":`table`,className:`w-full text-sm tabular-nums`,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`listLabel`),children:[(0,$.jsx)(`thead`,{className:`bg-muted/50 border-b border-border`,children:O.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsx)(`th`,{className:U(`px-card-sm py-element-sm text-start`,T.base),style:{width:e.getSize()===150?void 0:e.getSize()},children:e.isPlaceholder?null:SJ(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,$.jsx)(`tbody`,{className:`divide-y divide-border`,children:O.getRowModel().rows.map(e=>{let t=V.getResourceObjectId(e.original,n.resourceFieldIdentifier);if(S.isElementActive(t))return(0,$.jsx)(`tr`,{role:`row`,children:(0,$.jsx)(`td`,{colSpan:e.getVisibleCells().length,className:`p-0`,children:(0,$.jsx)(LG,{navigationZone:r})})},e.id);let i=!_||_(e.original);return(0,$.jsx)(`tr`,{"data-slot":`resource-list-item`,className:U(i&&(w.states.hover||`hover:bg-muted/30`),`transition-colors motion-reduce:transition-none`,i&&`cursor-pointer`,i&&Mg(a_.INSET),d?.(e.original)&&`bg-primary/5`),onClick:i?t=>{bG(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=>{bG(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)})})]})})})})},I_e=`__wildo-board-ungrouped__`;function L_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:I_e,value:null,label:null,items:[],total:o,loading:!1,failed:!1}),a}function R_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 z_e(e,t){if(e.length===0)return;let n=t(e);return n.find(e=>e.isOperationDefault===!0)??n[0]}function B_e(e,t){return{[e]:t}}async function V_e(e){let t=B_e(e.groupByField,e.targetValue);try{await e.call(t)}catch(t){return e.reportRefusal(t),!1}return e.applyMove(t),!0}function H_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`,U_e=[];function W_e(e,t){let n=e?.operations??U_e,r=HS(n,{currentObject:t,resourceType:e?.resourceType,subjectDataMode:e?.subjectDataMode,organizationId:e?.organizationId});return z_e(n.filter(e=>r.get(IS(e))?.isEnabled===!0),e=>ao(e))}function G_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=W_e(i,e),f=d!==void 0&&!a;return(0,$.jsx)(`li`,{className:U(`list-none rounded-md border bg-background`,f&&`cursor-grab`,a&&`opacity-60`),"data-board-card":n,"data-board-card-movable":f?`true`:void 0,draggable:f,tabIndex:f?0:void 0,"aria-describedby":f?o:void 0,"aria-busy":a?!0:void 0,onDragStart:e=>{!f||!d?e.preventDefault():(e.dataTransfer.setData(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 K_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=H_e(e,n,r);a!==void 0&&x(t,a,i)},[e,x]),w=0;return(0,$.jsxs)(`div`,{role:`group`,"aria-label":l,className:`flex gap-group overflow-x-auto pb-item-sm`,"data-slot":`collection-board`,children:[(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:f}),e.map(e=>{let c=e.value!==null&&m!==null&&m.fromValue!==e.value,l=c&&g===e.value,f=e.label??u;return(0,$.jsxs)(`section`,{"aria-label":f,"data-board-column":e.key,"data-drop-target":l?`true`:void 0,className:U(`flex w-72 shrink-0 flex-col gap-item-sm rounded-lg border bg-muted/20 p-item-sm`,l&&`border-primary bg-muted/40`),onDragOver:t=>{c&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,g!==e.value&&_(e.value))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||g===e.value&&_(null)},onDrop:t=>{if(!c||e.value===null)return;t.preventDefault();let n=t.dataTransfer.getData(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)(G_e,{item:t,index:n,itemId:r,columnValue:e.value,transition:s,isMoving:v===r,hintId:p,renderCard:a,onDragStart:(e,t,n)=>h({itemId:e,fromValue:t,operation:n}),onDragEnd:S,onKeyboardMove:C},r||n)})}),e.value!==null&&!e.failed&&e.items.length<e.total&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,disabled:e.loading,"data-board-load-more":e.key,onClick:()=>t(e.value),children:n(e.total-e.items.length)})]},e.key)})]})}function 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 q_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 J_e(e,t){let n=TJ(e),r=(n.getUTCDay()-t+7)%7,i=_K(EJ(n,1),-1),a=[],o=_K(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=_K(o,1);a.push(e)}return a}function Y_e(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 Al.calendarDateToday({timezone:t?`UTC`:n},r)}function X_e(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 Z_e(e,t,n){return vK(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 Q_e(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 $_e(e,t){if(!t||Object.keys(t).length===0)return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=Q_e(e[r],i);return n}function eve(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 tve(e,t,n){if(`days`in t)return _K(e,t.days);if(`months`in t){let n=EJ(TJ(e),t.months),r=_K(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`?_K(e,-r):_K(e,6-r)}var nve=[];function rve({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}=Of(),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=eve(e.key);n&&(e.preventDefault(),D(tve(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:J.OUTLINE,size:Y.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:ca.SM})})}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.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:ca.SM})})}),(0,$.jsx)(`h3`,{id:b,className:`text-sm font-medium`,"aria-live":`polite`,children:o}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,className:`ms-auto`,onClick:()=>D(r),children:_})]}),(0,$.jsx)(`span`,{id:y,className:`sr-only`,children:v}),(0,$.jsxs)(`table`,{ref:S,role:`grid`,"aria-label":m,"aria-describedby":y,className:`w-full table-fixed border-collapse`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:o}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:s.map((e,t)=>(0,$.jsx)(`th`,{scope:`col`,className:`pb-item-xs text-xs font-medium text-muted-foreground`,children:e},t))})}),(0,$.jsx)(`tbody`,{children:e.map(e=>(0,$.jsx)(`tr`,{children:e.map(({day:e,key:n,inMonth:r})=>{let i=t.get(n)??nve,a=n===E;return(0,$.jsxs)(`td`,{role:`gridcell`,"data-calendar-day":n,"data-in-month":r?`true`:void 0,"data-today":n===k?`true`:void 0,"aria-label":l(e,i.length),"aria-current":n===k?`date`:void 0,tabIndex:a?0:-1,onKeyDown:t=>O(t,e),onFocus:t=>{t.target===t.currentTarget&&!a&&w(e)},className:U(`h-24 border align-top p-item-xs`,Mg(a_.INSET),!r&&`bg-muted/30 text-muted-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs`,n===k&&`bg-primary text-primary-foreground`),children:c(e)}),i.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`flex max-h-28 flex-col gap-px overflow-y-auto`,children:i.map(e=>{let t=u(e),n=d(e);return(0,$.jsx)(`li`,{className:`list-none`,"data-calendar-item":t,children:f(e)?(0,$.jsx)(X,{variant:J.GHOST,size:Y.XS,tabIndex:a?0:-1,className:`h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal`,title:n,onClick:()=>p(e),children:n}):(0,$.jsx)(`span`,{className:`block truncate px-item-xs text-xs`,title:n,children:n})},t)})})]},n)})},e[0].key))})]})]})}function ive(e){let t=TJ(e),n=EJ(t,1),r=[];for(let e=t;e.getTime()<n.getTime();e=_K(e,1))r.push(e);return r}var AJ=864e5;function ave(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 ove(e){let{startField:t,endField:n,startIsCalendarDate:r,endIsCalendarDate:i,timeZone:a,firstDay:o,lastDay:s}=e;return{[t]:vK(void 0,s,r,a),[n]:vK(o,void 0,i,a)}}var jJ=wJ;function sve(e){return{gridTemplateColumns:`minmax(8rem, 12rem) repeat(${e}, minmax(1.5rem, 1fr))`}}function cve({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:_}=Of(),v=(0,Q.useRef)(null),y=jJ(r),b=sve(e.length),x=e=>{let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(t===0)return;let n=Array.from(v.current?.querySelectorAll(`[data-timeline-bar]`)??[]),r=n[n.indexOf(e.currentTarget)+t];r&&(e.preventDefault(),r.focus())};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,"data-slot":`collection-timeline`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":p,title:p,onClick:()=>i(EJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_LEFT,{size:ca.SM})})}),(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.ICON_SM,"aria-label":m,title:m,onClick:()=>i(EJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_RIGHT,{size:ca.SM})})}),(0,$.jsx)(`h3`,{className:`text-sm font-medium`,"aria-live":`polite`,children:a}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,className:`ms-auto`,onClick:()=>i(r),children:h})]}),(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`div`,{className:`min-w-max`,children:[(0,$.jsxs)(`div`,{className:`grid border-b pb-item-xs`,style:b,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{}),e.map(e=>{let t=jJ(e);return(0,$.jsx)(`span`,{"data-timeline-day":t,"data-today":t===y?`true`:void 0,className:U(`text-center text-xs text-muted-foreground`,t===y&&`font-semibold text-foreground`),children:o(e)},t)})]}),t.length===0?(0,$.jsx)(`p`,{role:`status`,className:`py-section text-center text-sm text-muted-foreground`,children:g}):(0,$.jsx)(`ul`,{ref:v,role:`list`,"aria-label":f,className:`flex flex-col`,children:t.map(e=>{let{item:t,startDay:n,endDay:r,startColumn:i,endColumn:a,continuesBefore:o,continuesAfter:f}=e,p=s(t),m=c(t),h=l(t,n,r),g=U(`h-6 min-w-0 truncate rounded-md bg-primary/15 px-item-xs text-start text-xs text-foreground`,o&&`rounded-s-none`,f&&`rounded-e-none`),_={gridColumn:`${i+1} / ${a+2}`,gridRow:1};return(0,$.jsxs)(`li`,{className:`grid list-none items-center border-b py-px`,style:b,"data-timeline-item":p,"data-continues-before":o?`true`:void 0,"data-continues-after":f?`true`:void 0,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`truncate pe-item-sm text-sm`,style:{gridColumn:1,gridRow:1},title:m,children:m}),u(t)?(0,$.jsx)(X,{variant:J.GHOST,size:Y.XS,"data-timeline-bar":p,"aria-label":h,title:h,className:U(g,`justify-start font-normal hover:bg-primary/25`),style:_,onClick:()=>d(t),onKeyDown:x,children:m}):(0,$.jsx)(`span`,{role:`img`,"data-timeline-bar":p,tabIndex:0,"aria-label":h,title:h,className:U(g,`flex items-center`),style:_,onKeyDown:x,children:m})]},p)})})]})})]})}function 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 lve(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 uve(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 dve(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 fve(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:pve(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?dve(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=>uve(i,{itemId:e,fromValue:t,toValue:n,movedFields:r,getItemId:d.current.getItemId}))},[])}}function pve(e,t,n){return NJ(e,t,n)!==null}function mve(e){let{on:t}=Ao(),[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(wc.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 hve(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=Y.ICON_SM,labelDisplayMode:f=Ua.INLINE,className:p})=>{let m=qge(),{resourceType:h,operation:g}=e,{on:_}=Ao(),v=(0,Q.useId)(),{isReady:y,tComponent:b,tErrorMessage:x,tResourceOperation:S}=K({component:B.RESOURCES_LAYOUTS_OPERATIONS_BULK,resource:h}),C=(0,Q.useMemo)(()=>Vu(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),w=(0,Q.useMemo)(()=>[`resources.${h}`,`components.${B.RESOURCES_LAYOUTS_OPERATIONS_BULK}`],[h]),T=(0,Q.useMemo)(()=>o&&o.length>0?[...o]:r.map(e=>String(e[c]??e._id??``)),[o,r,c]),E=(0,Q.useMemo)(()=>u?e=>u([...e]):void 0,[u]),{items:D,isConfirmDialogOpen:O,confirmDialogLabel:k,confirmDialogDescription:A,confirmDialogConfirmLabel:j,confirmRequiresTypedConfirmation:M,confirmConfirmationPhrase:N,onConfirm:P,onCancel:F,isExecuting:I,acceptedBackgroundRun:ee}=eH({resourceType:h,displayMode:Se.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:t,sourceOperation:g,bulkOnly:!0,selectedItemIds:T,successDiscriminator:v,selectionObjects:r,...i?{currentObjectDataMode:i}:{},...a?{matchAllSelection:a}:{},onSelectionNarrow:E}),L=mve(ee),R=r.length>0||!!a||!!o?.length,z=a?`match:${JSON.stringify(a)}`:R?`ids:${T.join(`,`)}`:``,[te,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null);L?.finished&&te?.jobId!==L.jobId&&ne({jobId:L.jobId,selectionKey:z});let ae=!!L?.finished&&te?.jobId===L.jobId&&z!==``&&z!==te.selectionKey;ae&&re!==L.jobId&&ie(L.jobId);let oe=L&&!ae&&L.jobId!==re?L:null;return Yge(oe?oe.finished?Tq.FINISHED:Tq.WORKING:Tq.NONE),Jge((0,Q.useMemo)(()=>D.map(e=>e.type===`separator`?`|`:e.operationIdentifier??e.label).join(`,`),[D])),(0,Q.useEffect)(()=>{if(l)return _(wc.RESOURCE_OPERATION_EXECUTED,()=>l(),e=>{let t=e;return t.resourceType===h&&t.isBulkOperation===!0&&t.isPartialWrite!==!0&&t.optionalDiscriminator===v&&(0,lC.default)(Vu(t.contextResourceIdentifiers),C)})},[_,l,C,h,v]),y?oe?(0,$.jsx)(nb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,"data-slot":`bulk-background-run`,children:[!oe.finished&&(0,$.jsx)(b_,{value:oe.processedCount,max:Math.max(oe.attemptedCount,1),className:`w-40`,getValueLabel:(e,t)=>`${e}/${t}`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground whitespace-nowrap`,role:`status`,"aria-live":`polite`,children:oe.finished?b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunFinished`,{succeededCount:oe.processedCount-oe.failedCount,failedCount:oe.failedCount}):b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunProgress`,{processedCount:oe.processedCount,attemptedCount:oe.attemptedCount})}),oe.finished&&oe.failures.length>0&&(0,$.jsxs)(pq,{children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,children:b(B.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:hve(oe.failures,e=>Sp({tErrorMessage:x,tResourceOperation:S,resourceType:h,operationIdentifier:oe.operationIdentifier,customMessageReference:e})).map(e=>(0,$.jsxs)(`li`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.reason}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failureReasonRowCount`,{count:e.resourceIds.length})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground break-all`,children:e.resourceIds.join(`, `)})]},e.key))}),s&&(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:()=>s(oe.failures.map(e=>e.resourceId)),children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`selectRefusedRows`,{count:oe.failures.length})}),oe.failures.length<oe.failedCount&&(0,$.jsx)(`p`,{className:`mt-element-sm text-xs text-muted-foreground`,children:b(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failuresPartialList`,{shownCount:oe.failures.length,failedCount:oe.failedCount})})]})]})]})}):!R||D.length===0?null:(0,$.jsx)(nb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{"data-slot":`operations-bulk`,className:U(`flex items-center`,p),children:[(0,$.jsx)(XS,{items:D,size:d,labelDisplayMode:m===null||m===Sq.LABELLED?f:Ua.TOOLTIP,...m===Sq.CAPPED?{maxDisplayed:2}:{}}),O&&(0,$.jsx)(Pw,{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=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,`ResourceLayout_OperationBulk`)(e);return(0,$.jsx)(n,{...t})}var gve=({resourceContext:e,navigationZone:t,size:n=Y.ICON_SM,className:r,collectionExportQuery:i})=>{let{resourceType:a,operation:o}=e,{items:s,isConfirmDialogOpen:c,confirmDialogLabel:l,confirmDialogDescription:u,confirmDialogConfirmLabel:d,confirmRequiresTypedConfirmation:f,confirmConfirmationPhrase:p,onConfirm:m,onCancel:h,ephemeralFields:g,onEphemeralAcknowledge:_}=eH({resourceType:a,displayMode:Se.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:o,collectionOnly:!0,collectionExportQuery:i});return s.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(XS,{items:s,size:n,labelDisplayMode:Ua.INLINE,className:r}),c&&(0,$.jsx)(Pw,{open:c,onOpenChange:e=>{e||h()},cancelCallback:h,validationCallback:m,label:l,description:u,confirmLabel:d,requireTypedConfirmation:f,confirmationPhrase:p}),g&&(0,$.jsx)(lG,{open:!0,onAcknowledge:_,fields:g,resourceType:a})]})},_ve=`__wildo-ungrouped__`;function vve(e,t,n,r,i){let a=BG(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??_ve,l=o[o.length-1];l&&l.key===c?l.items.push(n):o.push({key:c,label:s,items:[n]})}return o}var yve=`wildo-collection-view-mode:`;function LJ(e){return`${yve}${e}`}function bve(e){let t=qs(LJ(e));return t!==null&&Object.values(gu).includes(t)?t:null}function xve(e,t){so(LJ(e),t)}function Sve(e,t){let[n,r]=(0,Q.useState)(()=>bve(e)??t);return{viewMode:n,setViewMode:(0,Q.useCallback)(t=>{r(t),xve(e,t)},[e])}}function Cve(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=Cve(e);rs.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:U(`rounded-md border border-dashed border-muted-foreground/40 bg-muted/30`,e),style:t})}var wve=Q.lazy(()=>l_(()=>import(`./ChartView-nQvehKAl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function Tve({height:e}){let{tComponent:t,isReady:n}=K({component:B.HIGH_LEVEL_VIEWS_CHART_WIDGET});return n?(0,$.jsx)(`div`,{style:{minHeight:e},"data-lazy-door":`unavailable`,children:(0,$.jsx)(cm,{variant:`compact`,iconRef:H.ERROR_APPLICATION,title:t(B.HIGH_LEVEL_VIEWS_CHART_WIDGET,`chartFailed`),respectSurfaceEmptyDisplay:!1,className:`h-full min-h-[120px] border-0`})}):null}var BJ=e=>(0,$.jsx)(RJ,{doorName:`ChartView`,fallback:(0,$.jsx)(Tve,{height:e.height??400}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(ym,{height:e.height??400}),children:(0,$.jsx)(wve,{...e})})});function Eve(e){return typeof e.resourceType==`string`&&e.resourceType.length>0}function Dve(e){return e.foreignKeyField??e.resourceType}function Ove(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===Em.PARENT_RESOURCE_REQUIREMENT?e.parentResourcesRequirements:e.additionalResourceRequirements)??[]).filter(e=>Eve(e)?Dve(e)===n:!1);return a.length===1?{mainResourceType:a[0].resourceType,mainResourceId:i,bindingKey:n,source:r===Em.PARENT_RESOURCE_REQUIREMENT?$v.PARENT_RESOURCE_REQUIREMENT:$v.ADDITIONAL_RESOURCE_REQUIREMENT}:null}function kve(e){return e.explicitTemplate?e.explicitTemplate:e.displaySchema?WR(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 De}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(za.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=>Ca.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`&&Hte.getCoreResourceOperationFromOperation(t)!==W.READ?null:t:e.validationTarget===`canonical-read`?null:this.findOperation(e)}selectResponseDto(e,t){return cs.selectResponseDto(e,t)}validateResourceData(e,t,n){if(!t)return e;try{return t.parse(e)}catch(t){throw t instanceof Fd?this.buildError(ql.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(ql.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(ql.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(ql.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{arrayIndex:n,originalError:e})}throw e}})}},UJ=rs.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 Ave(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 jve=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=sp(),a=(0,Q.useContext)(Ez),{doOperation:o,getResourcesRegistry:s}=lm(),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:po(n)})}).finally(()=>{d.current.delete(r)}))},[]),h=(0,Q.useCallback)(async e=>{let t=new Set(e.map(({key:e})=>`rmm:${e}`));for(let e of f.current){if(t.has(e))continue;let n=p.current.get(e);n&&(await i({ownerKey:e,resourceType:n.resourceType,resourceId:n.resourceId,contextResourceIdentifiers:n.contextResourceIdentifiers}),p.current.delete(e))}for(let{key:t,resourceType:n,resourceId:i,rmm:a}of e){let e=`rmm:${t}`;p.current.set(e,{resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers}),await r({ownerKey:e,resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers})}f.current=t},[r,i]);(0,Q.useEffect)(()=>{if(!a)return;let e=a.subscribeActiveInstances(e=>{h(e)});return()=>{e();let t=Array.from(f.current);f.current.clear();for(let e of t){let t=p.current.get(e);t&&(i({ownerKey:e,resourceType:t.resourceType,resourceId:t.resourceId,contextResourceIdentifiers:t.contextResourceIdentifiers}),p.current.delete(e))}}},[a,i,h]),(0,Q.useEffect)(()=>{if(!t||!a)return;let n=e(fa.RESOURCE_UPDATED,e=>{if(e.deliveryTarget===qa.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!==qa.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:po(n)}),m(e.resourceType,e.resourceId,t);return}let o=t.getSnapshot(),s=o.confirmedData??{},c=Ave(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(fa.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(hE.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=rs.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=Bt.RMM_REQUIRED,recordNameShownAbove:l=!1}){let{doOperation:u,registry:d}=lm(),{emit:f,resourceRefreshEvent:p}=Ao(),{lastRefreshAt:m}=p({ctx:e}),{tComponent:h,isReady:g,t:_,formatDate:v,formatDateTime:y}=K({component:B.RESOURCES_LAYOUTS_READ,resource:e.resourceType}),[b]=ih(),x=(0,Q.useMemo)(()=>[`resources.${e.resourceType}`,`components.${B.RESOURCES_LAYOUTS_READ}`],[e.resourceType]),S=(0,Q.useRef)(u),C=(0,Q.useRef)(f),w=(0,Q.useRef)(t),T=(0,Q.useRef)(a),D=(0,Q.useRef)(e);S.current=u,C.current=f,w.current=t,T.current=a,D.current=e;let O=(0,Q.useMemo)(()=>new De,[]),{resourceType:k,operation:A,contextResourceIdentifiers:j}=e,M=String(A.operationIdentifier),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[ee,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),te=(0,Q.useMemo)(()=>[{resourceType:k,operation:M}],[k,M]),ne=(0,Q.useMemo)(()=>On.extractDataMode(b,i),[b,i]),re=(0,Q.useMemo)(()=>ne??zl.RAW,[ne]),ie=(0,Q.useMemo)(()=>{let e;switch(re){case zl.SUMMARY:e=A.summaryDto||A.responseDto;break;case zl.CONTEXT:e=A.contextDto||A.responseDto;break;case zl.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)(()=>Ca.createOperationPathKeyFromOperation(A),[A]),ue=(0,Q.useMemo)(()=>({resourceContext:{resourceType:k,operationId:M},...r}),[k,M,r]),de=(0,Q.useMemo)(()=>{if(ie)try{let e=hr.collectFileFieldPaths(ie);if(e.length===0)return;let t=ya.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||L(null);try{let t=await S.current(le,{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements,dataMode:re},{silent:!0});if(e)return;L(null),P(t)}catch(a){if(e)return;let o=a instanceof Error?a:Error(String(a)),s=a&&typeof a==`object`?a:{},c=O.buildWildoError_Frontend(za.NOT_FOUND,{customMessageReference:ql.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:le,context:{resourceType:k,operationIdentifier:M,originalErrorMessage:o.message,originalErrorStack:o.stack,httpCode:s.code,httpContext:s.context}});if(L(c),(Sie(a)||cl(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}=sz(a);C.current(wc.NOTIFY_RESOURCE_ERROR,{...l,contextResourceIdentifiers:Vu(l.contextResourceIdentifiers),parentResourcesRequirements:l.parentResourcesRequirements||[],additionalContext:{...l.additionalContext,error:o.message,errorCustomMessageReference:ql.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,...u?{errorRefusalCode:u}:{},...cz(a)}}),w.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 On.getResourceId(e);if(N){let e=V.getResourceFieldIdentifierForType(k,d),t=N[e];if(t!=null)return t;let n=ae?.mainSchema?Vee(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=lS(Qm(ae?.resourceIdentifier,fe==null?void 0:String(fe),pe)),ge=(0,Q.useMemo)(()=>{if(ae)return uh({resourceConfig:ae,operations:ae.operations??[],registry:d,hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me,viewer:he})},[pe,me,fe,A,d,ae,he]),_e=(0,Q.useMemo)(()=>ge!==void 0,[ge]),{rmm:ve,rmmSnapshot:ye}=Bz({resourceType:k,resourceId:fe==null?null:String(fe),doOperationRef:S,contextualParameters:me,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:pe,resourceSchema:ae?.mainSchema,resourceInheritance:ae?.inheritenceSchemaDefinition,enabled:_e&&fe!=null,conflictPolicy:{strategy:pE.ACCEPT_REMOTE}}),be=(0,Q.useRef)(null);be.current=typeof N?._id==`string`||typeof N?._id==`number`?String(N._id):null;let xe=ve!==null&&!R,Ce=(0,Q.useRef)(!1),we=sV({resourceType:k,rowIds:[fe==null?null:String(fe),be.current],enabled:fe!=null});(0,Q.useEffect)(()=>{if(we!=null&&fe!=null){if(xe&&ve!==null&&!we.madeElsewhere){let e=String(fe);JJ({resourceType:k,resourceId:e,rmm:ve,doOperation:S.current}).catch(t=>{YJ.warn(`[ResourceAutomaticDisplayer] Re-reading the row after it changed failed`,{resourceType:k,resourceId:e,error:po(t)})})}xe&&Ce.current||I(we.at)}},[we]);let Te=(0,Q.useMemo)(()=>ve?ve.readOperationPathKey:Az(k,d,{hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me}),[d,k,ve,fe,pe,me]),Ee=R?null:ve;(0,Q.useEffect)(()=>{XJ(`RMM obtained`,{resourceType:k,resourceId:fe==null?void 0:String(fe),rmmExists:!!ve})},[ve,k,fe]),(0,Q.useEffect)(()=>{z(!1)},[Te,fe,le,k]),(0,Q.useEffect)(()=>{if(!ve||!N)return;let e=ve.getSnapshot();if(e.confirmedData!==null&&m==null)return;if(!Te){z(!0),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:S.current,readOperationPathKey:Te,contextualParameters:me,parentResourcesRequirements:D.current.parentResourcesRequirements});if(t)return;if(typeof r!=`object`||!r){z(!0);return}let i=r,a=i._version??0;ve.setInitialState(i,a,i._field_meta),z(!1),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:po(e)})}),()=>{t=!0}},[ve,N,re,le,Te,me,k,fe,m]),(0,Q.useEffect)(()=>{if(!ve||!ye?.lastEvent)return;let e=ye.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&&S.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:po(e)})})};switch(e.type){case cE.MUTATION_RESULT:e.result.success&&(e.source.type===uE.DISPLAY&&C.current(wc.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ae({contextResourceIdentifiers:D.current.contextResourceIdentifiers,resourceType:k,result:e.result.responseData}),parentResourcesRequirements:D.current.parentResourcesRequirements||[],additionalContext:{...D.current.additionalContext,inlineEdit:!0,fieldName:e.result.savedFields?.[0]},resultSummary:e.result.responseData}),n());break;case cE.REMOTE_UPDATE:case cE.CONFLICT_RESET:n();break;case cE.RESOURCE_DELETED:}},[ye?.lastEvent?.id]);let Oe=(0,Q.useMemo)(()=>jz({loadedOperationPathKey:le,canonicalReadOperationPathKey:Te,dataMode:re}),[Te,re,le]),ke=re===zl.SUMMARY||re===zl.CONTEXT,je=!ke&&Oe&&ve&&ye.optimisticData?ye.optimisticData:N;Ce.current=!ke&&Oe&&xe;let Me=xe?ye.optimisticData:null;(0,Q.useEffect)(()=>{if(je==null)return;let e=Oe?je:Me??void 0;T.current?.(je,{holdsCanonicalRecord:Oe||xe,canonicalRecord:e})},[je,Oe,xe,Me]),(0,Q.useEffect)(()=>{XJ(`effectiveData source`,{dataMode:re,usingRmmData:Oe&&!!ye?.optimisticData})},[Oe,re,ye?.optimisticData]);let Ne=(0,Q.useCallback)((e,t)=>{P(n=>n&&dA(n,e,t)),C.current(wc.NOTIFY_RESOURCE_SUCCESS,{...D.current,contextResourceIdentifiers:Ae({contextResourceIdentifiers:D.current.contextResourceIdentifiers,resourceType:k,result:t}),parentResourcesRequirements:D.current.parentResourcesRequirements||[],additionalContext:{...D.current.additionalContext,inlineEdit:!0,fieldName:e},resultSummary:typeof t==`object`&&t?t:dA({},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)(()=>kve({explicitTemplate:Pe,displaySchema:ie,defaultDisplayChromeMode:Fe,resourceConfig:ae}),[Pe,ie,Fe,ae]),Be=eH({resourceType:e.resourceType,displayMode:Se.DETAIL,currentObject:je,currentObjectDataMode:re,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s??Sl.PRIMARY,sourceOperation:e.operation}),Ve=(0,Q.useCallback)(t=>{let n=Be.items.find(e=>e.type!==`separator`&&e.type!==`subgroup`&&e.operationIdentifier===t.operationIdentifier);n?.onClick?n.onClick():ya.isDevelopment()&&rs.getLogger().warn(`[ResourceAutomaticDisplayer] File "${t.fieldName}" requests operation "${t.operationIdentifier}", which is not available on ${e.resourceType} for the current user/row (unauthorized, condition-disabled, or unknown). The activation is inert.`)},[Be.items,e.resourceType]),He=(0,Q.useMemo)(()=>{if(Pe)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let e=wj({resourceType:k,schema:ie,parentData:je,registry:d}),t=ae?.frontendConfiguration?.layout?.defaultInlineEdit===E.WRITABLE_FIELDS,n=ie?hr.getObjectLikeFieldShape(ie,{commonOnly:!1}):void 0,r=l&&!t?MA({resourceType:k,registry:d,data:je,t:_,formatDate:v,formatDateTime:y}).filter(e=>{let t=n?.[e];return!t||!Wo(t)}):[];return r.length===0?e:{...e,hiddenFieldNames:[...e.hiddenFieldNames,...r]}},[ie,je,Pe,d,k,ae,l,_,v,y]),Ue=!je,We=(0,Q.useCallback)(async e=>{let t=ae?.operations?.find(t=>String(t.operationIdentifier)===e&&t.isOperationDefault===!0);if(!t)throw Error(`${k} declares no operation ${e}`);return S.current(Ca.createOperationPathKeyFromOperation(t),{contextualParameters:ce,parentResourcesRequirements:D.current.parentResourcesRequirements},{silent:!0})},[ae,k,ce]);if(g===!1)return null;if(ee){let t=ae?.frontendConfiguration?.layout?.readFailure;if(t)return(0,$.jsx)(`div`,{className:n,children:(0,$.jsx)(t,{error:ee,resourceContext:e,askOperation:We})});let r=h(B.RESOURCES_LAYOUTS_READ,`failedToLoadData`),i=r;return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:r}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:i})]})})}if(!ie){let e=h(B.RESOURCES_LAYOUTS_READ,`configurationError`),t=h(B.RESOURCES_LAYOUTS_READ,`noSchemaFound`,{operation:M,resource:k});return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}return(0,$.jsx)(nb,{i18nKeys:x,loadingScopes:te,children:(0,$.jsx)(BB,{schema:ie,data:je,className:n,labels:ue,layoutRefs:oe,resourceType:k,resourceId:fe?String(fe):void 0,contextualParameters:me,contextResourceIdentifiers:pe,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s,inlineEditOperation:ge??null,parentReferenceConfig:o,fileUploadContext:de,rmm:Ee,onInlineEditSuccess:!Ee&&tr(c)?Ne:void 0,updateLikeMutationFallbackMode:c,layoutTemplate:ze,isLoading:Ue,defaultDisplayChromeMode:Fe,defaultInlineEdit:Ie,defaultEmptyValue:Le,defaultSectionAppearance:Re,hiddenFieldNames:He.hiddenFieldNames,inlineEditDisabledFieldNames:He.inlineEditDisabledFieldNames,onFileActivationOperation:Ve})})}$J.displayName=`ResourceAutomaticDisplayer`;var eY=$J,Mve=Object.freeze(new Set),Nve=Object.freeze({depth:0,visited:Mve}),tY=(0,Q.createContext)(Nve);function nY(){return(0,Q.useContext)(tY)}var rY=new Set;function Pve(e,t,n,r){rY.has(`${e}:${t}`)||(rY.add(`${e}:${t}`),rs.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?(Pve(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)&&Fve([...e.placed])}),(0,$.jsx)(aY.Provider,{value:n,children:e})}var sY=new Set;function Fve(e){let t=e.slice().sort().join(`,`);sY.has(t)||(sY.add(t),rs.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 Ive=Object.freeze(new Set);function dY(e){let t=(0,Q.useContext)(aY);t&&e&&(t.composedAutomatically.current=!0)}function Lve(){return(0,Q.useContext)(aY)?.placed??Ive}function Rve(e,t){if(!t)return;let n=On.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=>Rve(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 $l(t,W.LIST)}function zve(e){return e.isOneToOne}function Bve(e){return e===cr.COLLAPSIBLE}function Vve(e){let t=[];for(let n of e){let e=n.contentSectionConfig.mode;if(Bve(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),rs.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: ${po(n)}`))}var gY=new Set;function Hve(e,t){let n=`${e}->${t.childResourceType}`;gY.has(n)||(gY.add(n),rs.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}=lm(),{tResourceHeader:o,isReady:s}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:i}),{navigate:c}=wS(),{currentBreakpoint:l}=Rg(),u=lY(),d=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_CONTAINER_NESTED}`],[i]),f=(0,Q.useMemo)(()=>a.resourceConfigurations[i],[a,i]),p=(0,Q.useMemo)(()=>f?.resourceRelationships?Hi(f.resourceRelationships):[],[f]),m=(0,Q.useMemo)(()=>{if(p.length===0)return[];let t=[];for(let n of p){let s=xj({parentResourceType:i,relationship:n,parentData:r,registry:a,viewport:l});if(!s)continue;let c=s.childResourceType,u=a.resourceConfigurations[c];if(!u)continue;let d=s.isOneToOne,p;try{p=On.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:d?W.READ:W.LIST,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){hY(i,c,e);continue}let m=V.buildContextualParameters(p.contextResourceIdentifiers,a),h=d?lh({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!On.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=On.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:String(h.operationIdentifier),operation:h,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){hY(i,c,e);continue}let n=On.getResourceId(e.contextResourceIdentifiers?.[i])||void 0,r=s.relationship.isPrimaryScope===!0;if(n!==void 0)try{r=ZG({childContext:t,hostResourceType:i,hostResourceId:n,hostRelationships:f?.resourceRelationships,selectedForeignKey:s.foreignKeyField,registry:a})===t}catch{r=!1}if(!r)continue}if(!h){Hve(i,s);continue}let g=Up({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)(()=>Vve(m),[m]),g=(0,Q.useMemo)(()=>{let t=e.contextResourceIdentifiers?.[i];if(t)return typeof t==`string`?t:t.resourceId},[e.contextResourceIdentifiers,i]),_=(0,Q.useCallback)((t,n)=>On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:String(n.operationIdentifier),operation:n,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),[a,e,i]),v=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.READ,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return lh({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!On.getResourceId(r.contextResourceIdentifiers?.[t.childResourceType]),contextResourceIdentifiers:r.contextResourceIdentifiers,contextualParameters:o})},[a,e,i]),y=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=On.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.LIST,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return 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:od.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:t,sourceOperation:_l(n),sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},relationshipTransition:e.transition,relationshipMaxDepth:e.navigationConfig?.maxDepth})},[_,a,c,t,i,g,v,y]),x=e=>{if(e.transition)return(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>b(e),children:e.label},e.relationshipEdgeKey);let r=a.resourceConfigurations[e.childResourceType];if(zve(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)(dX,{resourceContext:s,navigationZone:t,navigationInitiator:n,inlineParentContext:c,sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},e.relationshipEdgeKey)},S=(0,Q.useCallback)(e=>({id:e.relationshipEdgeKey,title:e.label,content:(0,$.jsx)(iY,{descentKey:`nested:${e.relationshipEdgeKey}::${g||`no-row`}`,children:(0,$.jsx)(Gk.Provider,{value:!0,children:x(e)})})}),[x,g]);return dY(m.length>0&&s&&!u),m.length===0||!s||u?null:(0,$.jsx)(nb,{i18nKeys:d,children:(0,$.jsx)(`div`,{className:`space-y-section`,children:h.items.map((e,t)=>e.type===`single`?(0,$.jsx)(UO,{config:{...e.config.contentSectionConfig,...e.config.contentSectionConfig.mode===cr.COLLAPSIBLE?{showSingleSectionNav:!0}:{}},sections:[S(e.config)]},e.config.relationshipEdgeKey):(0,$.jsx)(UO,{config:e.configs[0].contentSectionConfig,sections:e.configs.map(S)},`relationship-group-${e.mode}-${t}`))})})};function vY({preset:e=q.DEFAULT,...t}){let n=G(B.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=Se.DETAIL,onOperationExecuted:o,size:s=Y.ICON_SM,maxDisplayed:c,excludeOperations:l,placementFilter:u,hostRowOpensRead:d=!1,orientation:f,className:p})=>{let{resourceType:m,operation:h}=e,g=gm()?.getResourceConfiguration(m)?.frontendConfiguration?.layout,_=g?.actionLabelDisplayMode?.[a],v=Q.useContext(t_)?.UIConfig?.currentBreakpoint===xl.MOBILE,y=g?.actionDisclosure?.[a]?.maxPrimaryActions??c??(v?a===Se.SUMMARY?0:1:void 0)??se(a,g?.actionDisclosure).maxPrimaryActions,{items:b,isConfirmDialogOpen:x,confirmDialogLabel:S,confirmDialogDescription:C,confirmDialogConfirmLabel:w,confirmRequiresTypedConfirmation:T,confirmConfirmationPhrase:E,onConfirm:D,onCancel:O,ephemeralFields:k,onEphemeralAcknowledge:A}=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)(XS,{items:b,maxDisplayed:y,labelDisplayMode:_,orientation:f,size:s,className:p}),x&&(0,$.jsx)(Pw,{open:x,onOpenChange:e=>{e||O()},cancelCallback:O,validationCallback:D,label:S,description:C,confirmLabel:w,requireTypedConfirmation:T,confirmationPhrase:E}),k&&(0,$.jsx)(lG,{open:!0,onAcknowledge:A,fields:k,resourceType:m})]})});function bY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`ResourceLayout_OperationsItems`)(e);return(0,$.jsx)(n,{...t})}function xY({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DANGER_ZONE,`DangerZone`)(e);return(0,$.jsx)(n,{...t})}function SY({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_HEADING,`Heading`)(e);return(0,$.jsx)(n,{...t})}function CY({preset:e=q.DEFAULT,...t}){let n=G(B.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}=K({component:B.RESOURCES_LAYOUTS_DANGER_ZONE,resource:o}),{items:u,isConfirmDialogOpen:d,confirmDialogLabel:f,confirmDialogDescription:p,confirmDialogConfirmLabel:m,confirmRequiresTypedConfirmation:h,confirmConfirmationPhrase:g,onConfirm:_,onCancel:v}=eH({resourceType:o,displayMode:Se.DETAIL,currentObject:n,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:s,placementFilter:ec.DANGER_ZONE,onOperationExecuted:r}),y=(0,Q.useMemo)(()=>u.flatMap(e=>e.type===`subgroup`?e.items.filter(e=>e.type!==`separator`&&e.type!==`subgroup`):e.type===`separator`?[]:[e]),[u]);if(y.length===0)return null;let b=e=>c(B.RESOURCES_LAYOUTS_DANGER_ZONE,e),x=b(`title`),S=e=>{switch(e){case zi.CRITICAL:return b(`descriptionCritical`);case zi.HIGH:return b(`descriptionHigh`);default:return b(`descriptionDefault`)}},C=e=>(e.operationIdentifier?l(o,e.operationIdentifier,`description`):``)||S(e.riskLevel);return(0,$.jsxs)(`section`,{"data-slot":`danger-zone-section`,"data-inline-size-tier":a,className:U(`mr-auto w-full flex flex-col gap-field-sm`,i),style:tD(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)(p_,{children:e.label}),(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:C(e)})]}),(0,$.jsx)(X,{variant:Vd(e.variant,JS(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)(Pw,{open:d,onOpenChange:e=>{e||v()},cancelCallback:v,validationCallback:_,label:f,description:p,confirmLabel:m,requireTypedConfirmation:h,confirmationPhrase:g})]})};function TY({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_DANGER_ZONE,`ResourceLayout_DangerZone`)(e);return(0,$.jsx)(n,{...t})}var Uve=rs.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[ll.ORGANIZATION_RELATIONSHIPS]?.operations)?.find(e=>String(e.operationIdentifier)===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function OY(e,t,n,r){let i=ll.ORGANIZATION_RELATIONSHIPS,a={...Qp.buildResourceOperationContextIdentifiers({currentOrganizationId:n,primaryScope:e.resourceConfigurations[i]?.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),...r?{[i]:r}:{}};return{operationPathKey:Ca.buildOperationPathKeyFromOperation(t),contextualParameters:V.buildContextualParameters(a,e),parentResourcesRequirements:On.buildParentResourcesRequirements(i,a,e)}}function Wve(e){let t=e;return(t?.response?.data?.error?.details?.code??t?.context?.code)===nee.RELATIONSHIP_RECORD_NOT_SHAREABLE}var kY={relationships:[],viaRelationshipId:null,sharedWithRelationshipIds:[],commonToEveryRelationship:!1};function Gve(e){let t=(0,Q.useContext)(im),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,ce.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=vte.parse(await e(r.operationPathKey,{contextualParameters:r.contextualParameters,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{resourceType:m,recordId:h}},{silent:!0}));if(i)return;d({relationships:o.relationships.map(({representingOrganizationName:e,...t})=>({...t,...e?{name:e}:{}})),viaRelationshipId:o.viaRelationshipId,sharedWithRelationshipIds:o.sharedWithRelationshipIds,commonToEveryRelationship:o.commonToEveryRelationship}),y.current=a,_(a),s(EY.READY),l(!1)}catch(e){if(i)return;if(y.current=void 0,_(a),l(!1),d(kY),Wve(e)){s(EY.NOT_SHAREABLE);return}Uve.warn(`[RecordSharing] The record's sharing could not be read`,{resourceType:m,backendRefusal:jr(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(ce.SHARE_RECORD,e),[b]),S=(0,Q.useCallback)(e=>b(ce.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 Kve(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||!A(e.resourceType,t.resourcePrimaryScope)||fre.includes(e.resourceType)||!e.recordId||!e.currentOrganizationId||e.recordOrganizationId!==e.currentOrganizationId||!e.grants)return!1;let n=e.registry?.resourceConfigurations[ll.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope,r=t=>!!t&&Vm({...t,resourceType:ll.ORGANIZATION_RELATIONSHIPS,resourcePrimaryScope:n},e.viewer);return r(DY(e.registry,ce.READ_RECORD_SHARING))&&r(DY(e.registry,ce.SHARE_RECORD))&&!!DY(e.registry,ce.UNSHARE_RECORD)}var jY=({resourceContext:e,currentObject:t,className:n,responsiveMaxWidth:r})=>{let{resourceType:i}=e,{tComponent:a,formatList:o}=K({component:B.RESOURCES_LAYOUTS_RECORD_SHARING,resource:i}),s=(e,t)=>a(B.RESOURCES_LAYOUTS_RECORD_SHARING,e,t),c=(0,Q.useContext)(im)?.registry,l=Jp()?.currentOrganizationId??void 0,u=Kve(t,c?.resourceConfigurations[i]?.resourceFieldIdentifier),d=(typeof t?.organizationId==`string`&&t.organizationId.length>0?t.organizationId:void 0)??Qm(i,u,e.contextResourceIdentifiers),f=lS(d),p=fS()[pv.GRANTS],m=AY({registry:c,resourceType:i,recordId:u,recordOrganizationId:d,currentOrganizationId:l,grants:p,viewer:f}),h=Gve({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 ee=b||h.refreshing,L=e=>{x(!0),e().then(()=>_(void 0)).catch(()=>void 0).finally(()=>x(!1))},R=DY(c,ce.SHARE_RECORD),z=e=>{ns(R?.riskLevel)?y(e):L(()=>h.share(e))};return(0,$.jsxs)(`section`,{"data-slot":`record-sharing-section`,"data-inline-size-tier":r,className:U(`mr-auto w-full flex flex-col gap-field-sm`,n),style:tD(r),children:[(0,$.jsx)(SY,{level:3,children:s(`title`)}),(0,$.jsx)(OF,{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:zr.MUTED,size:Le.SM,children:s(`readFailed`)})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs px-card py-card`,children:[(0,$.jsx)(Z,{size:Le.SM,children:h.viaRelationshipId===null?s(`ownRecord`):s(`createdThrough`,{relationship:E(h.viaRelationshipId)})}),h.viaRelationshipId!==null&&!F?.confersNow&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`relationshipInactive`)}),h.viaRelationshipId!==null&&F?.confersNow&&!F.rolesReachRecord&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`creatorCannotRead`)}),(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:h.commonToEveryRelationship?s(`commonToEveryRelationship`):s(P?`notReadableByRelationships`:`description`)}),M.length>0&&!h.commonToEveryRelationship&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`alreadyReadBy`,{relationships:o(M.map(e=>E(e.relationshipId)))})})]}),h.sharedWithRelationshipIds.length===0?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:s(`notShared`)})}):h.sharedWithRelationshipIds.map(e=>{let t=I(e);return(0,$.jsxs)(`div`,{"data-slot":`record-sharing-share`,className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(p_,{children:E(e)}),t!==void 0&&(0,$.jsx)(Z,{variant:zr.MUTED,size:Le.SM,children:t})]}),(0,$.jsx)(X,{variant:J.OUTLINE,disabled:ee,onClick:()=>L(()=>h.unshare(e)),className:`shrink-0 self-start sm:self-auto`,children:s(`withdraw`)})]},e)}),D.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center`,children:[(0,$.jsx)(gF,{name:`recordSharingRelationship`,schema:yd(),options:D.map(e=>({value:e.relationshipId,label:E(e.relationshipId)})),value:A,onChange:_,placeholder:s(`chooseRelationship`),size:qd.SM,disabled:ee}),(0,$.jsx)(X,{variant:J.SECONDARY,disabled:ee||!A,onClick:()=>{A&&z(A)},className:`shrink-0 self-start sm:self-auto`,children:s(`share`)})]})]})}),j!==void 0&&(0,$.jsx)(Pw,{open:!0,onOpenChange:e=>{e||y(void 0)},cancelCallback:()=>y(void 0),validationCallback:()=>{let e=j;y(void 0),L(()=>h.share(e))},label:s(`confirmShareTitle`,{relationship:E(j)}),description:s(`confirmShareDescription`),confirmLabel:s(`share`)})]})};function MY({preset:e=q.DEFAULT,...t}){let n=G(B.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 qve(e){let{registry:t,doOperation:n}=lm(),[r,i]=(0,Q.useState)(void 0),a=(0,Q.useMemo)(()=>{if(!e.enabled)return!1;let n=t.resourceConfigurations[e.resourceContext.resourceType];return(n?.resourceRelationships?Hi(n.resourceRelationships):[]).some(e=>e.discriminator!=null||e.condition!=null)},[e.enabled,e.resourceContext.resourceType,t]),o=sV({resourceType:e.resourceContext.resourceType,rowIds:[On.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),typeof r?._id==`string`?r._id:null],enabled:a}),s=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(!a){i(void 0);return}let r=t.resourceConfigurations[e.resourceContext.resourceType];if(!r){i(void 0);return}let o=V.buildContextualParameters(e.resourceContext.contextResourceIdentifiers,t),c=On.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),l=lh({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!!c,contextResourceIdentifiers:e.resourceContext.contextResourceIdentifiers,contextualParameters:o});if(!l){i(void 0);return}let u=Ca.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}=wS(),{getZoneState:l}=Px(),{registry:u}=lm(),{tComponent:d,isReady:f}=K({component:B.RESOURCES_LAYOUTS_READ}),{resourceContext:p,resourceType:m,operation:h,isSemanticCustomOperation:g,reportError:_,resolvePreferredOperation:v,navigateToResourceOperation:b}=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),[x,S]=(0,Q.useState)(void 0),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),k=(0,Q.useCallback)((e,t)=>{S(e),w(!1),E(t.canonicalRecord),O(t.holdsCanonicalRecord)},[]),A=D??String(p.operation.operationIdentifier)===W.READ,j=(0,Q.useMemo)(()=>A?{record:T,failed:C}:void 0,[A,T,C]),M=gp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_READ,key:`displayFailed`}),N=gp({tComponent:d,componentType:B.RESOURCES_LAYOUTS_READ,key:`semanticOperationFailed`}),P=qve({resourceContext:p,enabled:g}),F=(0,Q.useMemo)(()=>Cj({inlineParentContext:r,navigationZone:t,navigationInitiator:n,getZoneState:l}),[r,t,n,l]),I=(0,Q.useCallback)(e=>{let n=F?.parentReference,r=n?.parentResourceType,i=t?l(t):void 0,a=i&&i.activeTabId===void 0?i.stack[i.stack.length-2]:void 0;if(a?.content.contentType===od.RESOURCE_OPERATION&&a.content.resourceContext.resourceType===r&&On.getAddressedRecordId(a.content.resourceContext)===e&&s(t))return o(t),!0;if(!n||!r)return!1;let d=u.resourceConfigurations[r];if(!d)return!1;let f=p.contextResourceIdentifiers??{},m=p.parentResourcesRequirements??[],h=m[m.length-1]?.resourceType===r?m.slice(0,-1):On.buildParentResourcesRequirements(r,f,u),g={};for(let e of h){let t=e.foreignKeyField??e.resourceType,n=f[t]??f[e.resourceType],r=On.getResourceId(n);r&&(e.foreignKeyField?g[t]={fieldIdentifier:e.foreignKeyField,resourceId:r}:g[e.resourceType]=r)}g[r]=e;let _=V.buildContextualParameters(g,u),v=lh({resourceConfig:d,operations:d.operations??[],coreOperation:W.READ,registry:u,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:g,contextualParameters:_});if(!v)return!1;let y=On.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:v,contextResourceIdentifiers:g,parentResourcesRequirements:h}),b=zm.resolveResourceUrl(d,v,Vu(g),u.allResourceFieldIdentifiers,h);return c({content:{contentType:od.RESOURCE_OPERATION,resourceContext:y},initiator:{sourceZone:t},urlPath:b?.resolvedUrl}),!0},[s,p.contextResourceIdentifiers,p.parentResourcesRequirements,l,o,c,F,t,u]),ee=(0,Q.useMemo)(()=>{let e=F?.parentReference;if(e)return{parentResourceType:e.parentResourceType,parentResourceId:e.parentResourceId,displayMode:e.parentDisplay??na.CONTEXT,showParentLink:e.showParentLink,onNavigateToParent:I}},[F,I]),L=(0,Q.useCallback)(e=>{w(!0),_(e,M,`ResourceLayoutPreset_Read_Default`)},[M,_]),R=(0,Q.useCallback)(e=>{let n=_l(e);if(n!==W.DELETE&&n!==W.DELETE_MANY)return;if(s(t)||t!==Sl.PRIMARY){o(t);return}let r=v(W.LIST);if(!r)return;let{[m]:i,...a}=p.contextResourceIdentifiers??{};b({operation:r,contextResourceIdentifiers:a,parentResourcesRequirements:p.parentResourcesRequirements})},[o,s,t,v,b,m,p.contextResourceIdentifiers,p.parentResourcesRequirements]),z=(0,Q.useMemo)(()=>V.flattenContextIdentifiers(p.contextResourceIdentifiers),[p.contextResourceIdentifiers]);return f===!1?null:g?(0,$.jsx)(RU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,navigationZone:t,navigationInitiator:n,children:(0,$.jsxs)(oY,{children:[(0,$.jsx)(mV,{resourceContext:p,navigationZone:t,navigationInitiator:n,errorMessage:N,errorComponent:`ResourceLayoutPreset_Read_Default`,headerActions:(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.ACTION_BAR}),recordNavigation:(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.RECORD_NAVIGATION})}),(0,$.jsxs)(bD,{voice:y.EYEBROW,children:[(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.CONTENT}),(0,$.jsx)(vY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:P})]})]})}):(0,$.jsx)(RU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,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:ee,heldRecord:j,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.ACTION_BAR}),(0,$.jsx)(bY,{resourceContext:p,currentObject:x,navigationZone:t,navigationInitiator:n,displayMode:Se.DETAIL,placementFilter:ec.PRIMARY,size:Y.ICON_SM,onOperationExecuted:R})]})}),(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:rX.RECORD_NAVIGATION}),(0,$.jsx)(`div`,{"data-record-body":!0,children:(0,$.jsx)(eY,{resourceContext:p,navigationZone:t,onError:L,onDataLoaded:k,parentReferenceConfig:ee,recordNameShownAbove:!0})}),(0,$.jsx)(aX,{resourceContext:p,navigationZone:t,showCharts:a,renderSlot:rX.CONTENT}),(0,$.jsxs)(bD,{voice:y.EYEBROW,children:[(0,$.jsx)(NY.Provider,{value:x,children:i}),(0,$.jsx)(vY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:x})]}),(0,$.jsx)(MY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:x,className:`[max-inline-size:var(--record-body-max-inline-size)]`}),(0,$.jsx)(TY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:x,onOperationExecuted:R,className:`[max-inline-size:var(--record-body-max-inline-size)]`})]})})})},IY=(0,Q.createContext)(new Set);function LY({preset:e,...t}){let n=XW(t.resourceContext.operation),r=ZW(t.resourceContext.operation),i=e??r??xi.DEFAULT,a=(0,Q.useContext)(IY),o=(0,Q.useMemo)(()=>Ca.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=G(B.RESOURCES_LAYOUTS_READ,`ResourceLayout_Read`)(i);return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(l,{...t})})}var RY=rs.getLogger(),zY=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r})=>{let{resourceType:i,operation:a,resourceConfig:o,operationInitiator:s,contextualParameters:c,navigateToResourceOperation:l}=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tComponent:u,tResourceFieldDisplay:d,tResourceFieldEnumValue:f}=K({component:[B.RESOURCES_LAYOUTS_SEARCH,B.RESOURCES_LAYOUTS_LIST],resource:i}),p=ap(),m=e=>u(B.RESOURCES_LAYOUTS_SEARCH,e),{renderIcon:h}=Of(),{getRecipe:g}=Rg(),_=g(oc.INTERACTIVE,In.GHOST),{registry:v,doOperation:y}=lm(),[b]=ih(),x=a.operationFrontendConfig?.collectionDisplayConfig,S=x?.cardLayout,C=x?.cardActionPlacement,w=x?.selectable??!1,T=S?.style===Xl.GRID,E=S?.style===Xl.GRID?S.columns:void 0,D=o?.resourceFieldIdentifier,k=tH({idField:D}),A=Rx(),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)([]),ee=(0,Q.useRef)(null),L=Dq(ee,k.selectionCount>0),R=Eq(k.selectionCount>0),z=F.length>0&&F.every(e=>k.isSelected(e)),te=(0,Q.useCallback)(()=>{F.length>0&&F.every(e=>k.isSelected(e))?F.forEach(e=>k.deselectItem(e)):F.forEach(e=>k.selectItem(e))},[F,k]),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(()=>{let e=a,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[ce,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)([]),[fe,pe]=(0,Q.useState)({});(0,Q.useEffect)(()=>{k.clearSelection()},[N,fe]);let me=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_SEARCH}`],[i]),he=a?.operationIdentifier??W.SEARCH,{isInitialLoad:ge,isRefreshing:_e}=Qy(dg({resourceType:i,operation:he})),ve=(0,Q.useRef)(y),ye=(0,Q.useRef)(e),be=(0,Q.useRef)(ue),xe=(0,Q.useRef)(fe);ve.current=y,ye.current=e,be.current=ue,xe.current=fe;let Se=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),Ce=(0,Q.useMemo)(()=>HG.searchOperationAcceptsATerm(a),[a]),we=(0,Q.useMemo)(()=>HG.detectSummaryFields(o),[o]),Te=(0,Q.useMemo)(()=>gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_SEARCH,key:`resultsLabel`}),[u]),Ee=(0,Q.useMemo)(()=>{let e={};for(let t of we)e[t]=d(i,t,`label`);return e},[we,i,d]),De=(0,Q.useCallback)(e=>o?lh({resourceConfig:o,operations:o.operations??[],coreOperation:W.READ,registry:v,hasResourceId:On.getResourceId(e[i]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,v)})??null:null,[v,o,i]),{sortFields:Oe,filterFields:ke,filtersEnabled:Ae}=(0,Q.useMemo)(()=>{let t=a,n=t?.sortFields??[],r=HG.parseFilterFieldDefinitions(t?.filterFields,o?{registry:v,resourceConfig:o,operation:a,contextualParameters:c,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),i=HG.withoutPinnedFilterFields(r,e.pinnedFilters);return{sortFields:n,filterFields:i,filtersEnabled:i.length>0}},[a,v,o,c,e.parentResourcesRequirements,e.pinnedFilters]),je=(0,Q.useMemo)(()=>On.extractDataMode(b,r),[b,r]),Me=(0,Q.useMemo)(()=>Ca.createOperationPathKeyFromOperation(a),[a]),Ne=HG.matchListingOf(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{P(j)},300);return()=>clearTimeout(e)},[j]);let Pe=ue.map(e=>`${e.field}:${e.direction}`).join(`,`),Fe=(0,Q.useMemo)(()=>JSON.stringify(fe),[fe]),Ie=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]),{emit:Le}=Ao();(0,Q.useEffect)(()=>{Le(wc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:i,filterValues:xe.current})},[Fe,i,Le]);let Re=`${i}|${Me}|${Se}|${N}|${oe.page}|${oe.limit}|${Pe}|${Fe}|${Ie}|${Ce}`;(0,Q.useEffect)(()=>{if(!N&&!ie&&Ce)return;let e=!1,t=!1,n=()=>{t||(t=!0,le(!1))};return(async()=>{le(!0),re(null),ae(!0);try{let t=HG.withPinnedFilters(xe.current,ye.current.pinnedFilters),n=Object.keys(t).length>0?t:void 0,r={contextualParameters:c,searchQuery:N||void 0,filters:n,pagination:{page:oe.page,limit:oe.limit},sort:be.current.length?[...be.current]:void 0,parentResourcesRequirements:ye.current.parentResourcesRequirements,dataMode:je},i=await ve.current(Me,r);if(e)return;if(i&&typeof i==`object`&&`data`in i&&`pagination`in i){let e=i;I(e.data),se(e.pagination)}else Array.isArray(i)&&(I(i),se(e=>({...e,total:i.length,totalPages:1})))}catch(t){if(e)return;let n=O(t);re({message:p(t)}),RY.error(`[ResourceLayoutPreset_Search_Default] Search error:`,{...n,error:t})}finally{e||n()}})(),()=>{e=!0,n()}},[Re]);let ze=(0,Q.useCallback)(e=>{if(!o)return;let t=V.getResourceObjectId(e,o.resourceFieldIdentifier);if(!t){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=On.buildRecordIdentifiersFromCollection(ye.current.contextResourceIdentifiers,i,t),r=De(n);r&&l({operation:r,contextResourceIdentifiers:n,parentResourcesRequirements:ye.current.parentResourcesRequirements,initiatorOverride:s})},[o,o?.resourceFieldIdentifier,i,l,s,De]),Be=(0,Q.useCallback)(e=>{de(e),se(e=>({...e,page:1}))},[]),Ve=(0,Q.useCallback)(e=>{pe(e),se(e=>({...e,page:1}))},[]),He=(0,Q.useCallback)(e=>{e.preventDefault(),P(j)},[j]),Ue=h(H.SEARCH,{size:ca.SM});return(0,$.jsx)(nb,{i18nKeys:me,readiness:[{id:`search-initial-load`,isReady:!ge}],renderLoading:()=>(0,$.jsx)(um,{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}),Ce&&(0,$.jsxs)(`form`,{onSubmit:He,role:`search`,className:`flex gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(eN,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:m(`placeholder`),"aria-label":m(`placeholder`),prefix:Ue})}),(0,$.jsx)(X,{type:`submit`,disabled:ce,children:m(`search`)})]}),(Ae||Oe.length>0&&ie)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[Ae&&ke.length>0&&(0,$.jsx)(tq,{resourceType:i,filterFields:ke,currentFilters:fe,onFiltersChange:Ve}),Oe.length>0&&ie&&(0,$.jsx)(_q,{resourceType:i,sortFields:Oe,currentSorts:ue,onSortChange:Be})]}),w&&ie&&(F.length>0||k.selectionCount>0||R.backgroundRunState!==Tq.NONE)&&(0,$.jsxs)(`div`,{ref:ee,className:`flex flex-nowrap items-center gap-element`,"data-slot":`collection-selection-row`,children:[F.length>0&&(0,$.jsx)(xq,{state:bq(F.length,F.filter(e=>k.isSelected(e)).length),onToggle:te}),(0,$.jsx)(yq,{count:k.selectionCount,onClear:k.clearSelection,...z&&!k.matchAllSelection&&oe.total>F.length&&Ne?{matchAllOffer:{matchedCount:oe.total,onSelectAllMatching:()=>k.selectAllMatching({filters:HG.withPinnedFilters(fe,e.pinnedFilters),...N?{search:N}:{},listing:Ne,matchedCount:oe.total})}}:{},...k.matchAllSelection?{isMatchAllSelected:!0}:{}}),R.isBulkBarMounted&&(0,$.jsx)(`div`,{className:`ms-auto min-w-0`,children:(0,$.jsx)(wq,{density:L.density,onActionSetChange:L.reportActionSet,onBackgroundRunChange:R.onBackgroundRunChange,children:(0,$.jsx)(IJ,{resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:k.selectedItems,selectedItemsDataMode:je,matchAllSelection:k.matchAllSelection,explicitIdSelection:k.explicitIdSelection,onSelectIds:k.selectIds,idField:D,onSelectionClear:k.clearSelection,onSelectionReplace:k.selectAll})})})]}),ne&&(0,$.jsx)(zy,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_SEARCH,key:`errorLoading`}),message:ne.message}),A.isCreateActive&&(0,$.jsx)(LG,{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:gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`})}):(0,$.jsx)(`div`,{className:`space-y-item-sm`,children:(0,$.jsx)(`ul`,{role:`list`,"aria-label":Te,style:kG(E),className:U(OG(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(ql.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:i,component:`ResourceLayoutPreset_Search`});let s=V.getResourceObjectId(n,a);return A.isElementActive(s)?(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(LG,{navigationZone:t})},s||r):(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(IG,{item:n,resourceType:i,resourceConfig:o,registry:v,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:we,fieldLabelsMap:Ee,tResourceFieldEnumValue:f,onItemClick:ze,cardActionPlacement:C,selectable:w,isSelected:k.isSelected(n),selectionActive:k.selectionCount>0,onToggleSelect:k.toggleSelection,selectAriaLabel:u(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:r+1}),interactiveClasses:{hover:_.states.hover,transition:_.motion.transition}})},s||r)})})}),(0,$.jsx)(iK,{pagination:oe,onPaginationChange:se})]})]})})};function BY({preset:e,...t}){let n=XW(t.resourceContext.operation),r=ZW(t.resourceContext.operation),i=e??r??Du.DEFAULT,a=n?(0,$.jsx)(n,{...t}):Q.createElement(G(B.RESOURCES_LAYOUTS_SEARCH,`ResourceLayout_Search`)(i),t);return(0,$.jsx)(Lx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[pA]:!0,children:a})})}var VY=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:B.RESOURCES_LAYOUTS_UPDATE}),{resourceContext:a,operation:o,isSemanticCustomOperation:s,navigateToPreferredRead:c,goBackWithinZone:l,reportError:u}=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),d=gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_UPDATE,key:`formUpdateFailed`}),f=gp({tComponent:r,componentType:B.RESOURCES_LAYOUTS_UPDATE,key:`semanticOperationFailed`}),{closeOverlay:p}=wS(),m=(0,Q.useCallback)(()=>{o.isBulkOperation?l():c({transitionOverride:t===rr.OVERLAY?Rt.PROMOTE:void 0})},[l,c,t,o.isBulkOperation]),h=rz(a,o),g=(0,Q.useCallback)(e=>{h(e),m()},[h,m]),_=(0,Q.useCallback)(e=>{u(e,d,`ResourceLayoutPreset_Update_Default`)},[d,u]),v=(0,Q.useMemo)(()=>t===rr.OVERLAY?()=>p():void 0,[t,p]);return i?s?(0,$.jsx)(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=XW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=ZW(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(B.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=Os(e.operation),a;switch(i){case`create`:a=(0,$.jsx)(dG,{...r});break;case`list`:a=(0,$.jsx)(dX,{...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)($W,{...r})}return(0,$.jsx)(cC,{...r,children:a})}function WY(e){return`${oi.COMPOSITE_VIEWS}.${e}`}function GY(e){return`${oi.VIEWS}.${e.family}.${e.translationRef}`}function KY(e){return`app.${e}`}function qY(e,t){return`resources.${e}.${t}`}function JY(e){let t=Op(e);if(!t)return Cp(e);if(t.viewKind===_p.COMPOSITE_VIEW)return t.hostKind===Lp.RESOURCE?up(t.hostRef,t.localRef):Cp(t.localRef)}function YY(e){let t=Op(e.viewRef);if(e.contentType===od.CHART_VIEW)return t?.viewKind===_p.CHART_VIEW?{family:iu.CHART,translationRef:qY(t.hostRef,t.localRef)}:{family:iu.CHART,translationRef:KY(e.viewRef)};if(e.contentType===od.EXECUTION_VIEW)return t?.viewKind===_p.EXECUTION_VIEW?{family:iu.EXECUTION,translationRef:qY(t.hostRef,t.localRef)}:{family:iu.EXECUTION,translationRef:KY(e.viewRef)};if(e.contentType===od.FULL_CUSTOM_VIEW)return{family:iu.FULL_CUSTOM,translationRef:KY(e.viewRef)};if(e.contentType===od.FLOWS_ACTORS_VIEW)return{family:iu.FLOWS_ACTORS,translationRef:KY(e.viewRef)}}function XY(e){if(e.contentType===od.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 ZY={[od.FULL_CUSTOM_VIEW]:`view-custom-`,[od.EXECUTION_VIEW]:`view-execution-`,[od.FLOWS_ACTORS_VIEW]:`view-flows-`,[od.CHART_VIEW]:`view-chart-`},QY=({viewRef:e,contentType:t,hasAuthoredIcon:n=!1,iconViewRef:r,navigationZone:i=rr.PRIMARY,className:a})=>{let o=Kk(),s=(0,Q.useMemo)(()=>{if(t===od.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}=K({keys:s}),{renderIcon:d}=Of(),{title:f,description:p}=(0,Q.useMemo)(()=>{if(t===od.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=ZY[t];return i?d({category:re.CUSTOM,customReference:`${i}${r??e}`},{size:ca.LG}):null},[n,t,e,r,d]);return!u||o||!f?null:(0,$.jsxs)(`div`,{className:U(a),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-field`,children:[(0,$.jsx)(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 Jve(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-${crypto.randomUUID()}`:`execution-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var $Y=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=rr.PRIMARY})=>{let i=Jp(),{doOperation:a,registry:o}=lm(),{navigate:s}=wS(),{tComponent:c,isReady:l}=K({component:B.HIGH_LEVEL_VIEWS_EXECUTION}),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)({}),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)({}),S=t??wp({viewRef:e,registry:o}),C=(0,Q.useMemo)(()=>Jve(),[S?.ref]);(0,Q.useEffect)(()=>{},[n,S,e]);let w=(0,Q.useMemo)(()=>{let e=Qp.buildInitiatorIds({userId:i?.currentUserId,organizationId:i?.currentOrganizationId,applicationId:i?.currentApplicationId,anonymousUserId:i?.currentAnonymousUserId}),t=S?.primaryScope?Qp.primaryScopeToContextIdentifiers(e,S.primaryScope):{},r=i?.buildContextResourceIdentifiers()??{},a=Qp.filterCustomScopeContextResourceIdentifiers(r);if(!S)return Qp.mergeContextResourceIdentifiers(t,a,n);let o=Qp.getAllowedViewBindingKeys({primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements});return Qp.resolveViewContextResourceIdentifiers({surfaceName:`ExecutionView`,surfaceRef:S.ref,primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:a,explicitContextResourceIdentifiers:Qp.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?Ove(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?Yse({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=>{ay(e.content),d(e),y(e=>jy(e,ny.EMBEDDED_CONTENT)),x(e=>dy(e,oy.EMBEDDED_CONTENT))},closeEmbeddedContent:()=>{d(null),y(e=>jy(e,ny.EMBEDDED_CONTENT)),x(e=>dy(e,oy.EMBEDDED_CONTENT))},openLocalPane:(e,t)=>{iy(t),p({paneId:e,payload:t}),y(t=>My(t,e)),x(t=>fy(t,e))},closeLocalPane:()=>{p(null),y(e=>My(e,null)),x(e=>fy(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=>{ty(e),_(t=>({...t,[e.prefetchRuntimeId]:e}))},endParticipationPrefetch:e=>{_(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},markDirty:e=>{ry(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=>{sy(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=>hy(t,e))}}),[s,r]);if(!S)return(0,$.jsx)(u_,{viewKind:`execution`,viewRef:e});if(!l)return null;let k=e=>gp({tComponent:c,componentType:B.HIGH_LEVEL_VIEWS_EXECUTION,key:e}),A=S.viewComponent,j=E.embeddedContent,M=j?.content??null,N=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(A,{viewRef:S.ref,viewDefinition:S,contextResourceIdentifiers:w})});return(0,$.jsxs)(uy,{viewDefinition:S,contextResourceIdentifiers:w,runtimeInstanceId:C,navigationZone:r,doOperation:a,navigation:O,anchor:T,participations:D,runtimeState:E,children:[(0,$.jsx)(QY,{viewRef:e??S.ref,iconViewRef:S.ref,contentType:od.EXECUTION_VIEW,hasAuthoredIcon:!!S.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Uy,{children:M?(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-group xl:grid-cols-[minmax(0,1fr)_minmax(360px,480px)]`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-col`,children:N}),(0,$.jsxs)(`aside`,{className:`flex min-w-0 min-h-0 flex-col overflow-hidden rounded-lg border bg-background`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b px-card py-item-sm`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:k(`embeddedTitle`)}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:k(`embeddedDescription`)})]}),(0,$.jsx)(X,{type:`button`,variant:J.LINK,size:Y.SM,onClick:()=>{O.closeEmbeddedContent()},children:k(`embeddedClose`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,$.jsx)(Oy,{scope:{scope:ny.EMBEDDED_CONTENT},children:(0,$.jsx)(UY,{resourceContext:M.resourceContext,navigationZone:r,navigationInitiator:j?.navigationInitiator})})})]})]}):N})]})};function eX(e){let t={};for(let[n,r]of Object.entries(e.contextResourceIdentifiers)){let e=On.getResourceId(r);if(e&&(t[n]=e,typeof r==`object`&&r&&`fieldIdentifier`in r)){let n=r.fieldIdentifier;typeof n==`string`&&n.length>0&&(t[n]=e)}}return t}function tX(e,t){return!e||e.length===0||e.every(e=>{if(e.requirement!==Be.MANDATORY||e.isPrimaryScope)return!0;let n=e.foreignKeyField?t[e.foreignKeyField]:void 0,r=t[e.resourceType];return!!(n??r)})}function nX({resourceContext:e,viewRef:t,navigationZone:n,navigationInitiator:r}){let i=(0,Q.useMemo)(()=>hp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>eX(e),[e]);return(0,$.jsx)(GU,{viewRef:i.insertedViewRef,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r})}function Yve({resourceContext:e,viewRef:t,inputs:n,urlParamValues:r,className:i}){let{registry:a}=lm(),o=(0,Q.useMemo)(()=>vp(e.resourceType,{ref:t}),[e.resourceType,t]),s=(0,Q.useMemo)(()=>eX(e),[e]),c=a.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(e=>e.ref===t);if(!c)throw Zve(`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)(Kh,{requiredFeatures:c.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewRef:o.insertedViewRef,viewDefinition:c,runtimeDescriptor:pp({identity:o,chartView:c,contextResourceIdentifiers:s}),contextResourceIdentifiers:s,inputs:n,urlParamValues:r,localErrorOnly:!0})})})}function Xve({resourceContext:e,viewRef:t,navigationZone:n,className:r}){let i=(0,Q.useMemo)(()=>cp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>eX(e),[e]);return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)($Y,{viewRef:i.insertedViewRef,navigationZone:n,contextResourceIdentifiers:a})})}function Zve(e,t){return V.buildConfigurationError(ql.CONFIGURATION,{component:`ResourceOwnedViewEmbeds`,message:e,...t})}var rX;(function(e){e.ACTION_BAR=`action_bar`,e.RECORD_NAVIGATION=`record_navigation`,e.CONTENT=`content`,e.ALL=`all`})(rX||={});var iX=(0,Q.createContext)(new Set);function aX({resourceContext:e,navigationZone:t,navigationInitiator:n,className:r=``,chartHeight:i=320,showCharts:a=!0,renderSlot:o=rX.ALL}){let{registry:s}=lm(),c=(0,Q.useContext)(iX),{navigate:l}=wS(),{renderIcon:u}=Of(),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:iu.CHART,translationRef:qY(e.resourceType,t.ref)})),...(d?.executionViews??[]).map(t=>GY({family:iu.EXECUTION,translationRef:qY(e.resourceType,t.ref)}))],[d?.chartViews,d?.executionViews,e.resourceType]),{tCompositeView:m,tResourceHeader:h,tResourceOperation:g,tView:_}=K({keys:[...f,...p]}),v=(0,Q.useMemo)(()=>eX(e),[e]),b=e.operation,x=b.isOperationDefault===!0||!b.variantKey,S=String(b.operationIdentifier),C=yD(),w=S===W.READ?y.EYEBROW:C,{getRecipe:T}=Rg(),E=(0,Q.useMemo)(()=>x?S:dp([S,String(b.variantKey)]),[S,x,b.variantKey]),D=(0,Q.useMemo)(()=>x?(d?.compositeViews??[]).filter(e=>String(e.operationLike)===S&&tX(e.parentResourcesRequirements,v)):[],[v,S,d?.compositeViews,x]),O=(0,Q.useMemo)(()=>x?(d?.chartViews??[]).filter(e=>String(e.operationLike)===S&&tX(e.parentResourcesRequirements,v)):[],[v,S,d?.chartViews,x]),k=(0,Q.useMemo)(()=>(d?.executionViews??[]).filter(e=>(e.surfaceInOperations??[]).some(e=>dp(e)===E)&&tX(e.parentResourcesRequirements,v)),[v,E,d?.executionViews]),A=(0,Q.useMemo)(()=>{if(D.length===0&&O.length===0&&k.length===0)return[];let t={registry:s,contextResourceIdentifiers:v,views:{},tResourceHeader:h,tResourceOperation:g,tViewTitle:(e,t)=>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 D)r.isAddressable?oX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:b.operationIdentifier,familyLabel:`composite`,launcher:r.launcher}):c.has(r.ref)||n.push({type:`embedded-composite`,ref:r.ref});if(a)for(let t of O)n.push({type:`chart`,ref:t.ref,chartView:t,title:_(iu.CHART,qY(e.resourceType,t.ref),`title`)});for(let r of k)oX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:b.operationIdentifier,familyLabel:`execution`,launcher:r.launcher});return n},[c,D,O,k,v,b.operationIdentifier,s,e.resourceType,a,m,_,h,g]),j=(0,Q.useCallback)(e=>{l({content:{contentType:e.kind,viewRef:e.ref,contextResourceIdentifiers:e.contextResourceIdentifiers},initiator:{sourceZone:t},urlPath:e.urlPath})},[l,t]),M=(0,Q.useMemo)(()=>{if(o===rX.ALL)return A;let e={[Mp.ACTION_BAR]:rX.ACTION_BAR,[Mp.RECORD_NAVIGATION]:rX.RECORD_NAVIGATION,[Mp.CONTENT_CARD]:rX.CONTENT};return A.flatMap(t=>{if(t.type!==`launcher-group`)return o===rX.CONTENT?[t]:[];let n=t.views.filter(t=>e[t.presentation.placement]===o);return n.length>0?[{...t,views:n}]:[]})},[A,o]);return M.length===0?null:(0,$.jsx)(bD,{voice:w,children:(0,$.jsx)(`div`,{className:U(`space-y-section`,r),"data-testid":`resource-layout-inserted-views`,children:M.map((r,a)=>r.type===`embedded-composite`?(0,$.jsx)(iX.Provider,{value:new Set([...c,r.ref]),children:(0,$.jsx)(nX,{resourceContext:e,viewRef:r.ref,navigationZone:t,navigationInitiator:n})},`embedded-composite:${r.ref}:${a}`):r.type===`chart`?(0,$.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:[r.title&&(0,$.jsx)(`h3`,{className:U(`mb-element-sm`,w?T(oc.TYPOGRAPHY,w).base:`text-sm font-medium text-foreground`),children:r.title}),(0,$.jsx)(Kh,{requiredFeatures:r.chartView.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewDefinition:r.chartView,runtimeDescriptor:pp({identity:vp(e.resourceType,r.chartView),chartView:r.chartView,contextResourceIdentifiers:v}),height:i,localErrorOnly:!0})})]},`chart:${r.ref}:${a}`):(0,$.jsx)(Qve,{renderSlot:o,children:r.views.map(e=>(0,$.jsx)(Kh,{requiredFeatures:e.requiredFeatures,children:(0,$.jsxs)(X,{"data-testid":`inserted-view-launcher-${e.ref}`,type:`button`,variant:e.presentation.emphasized?J.DEFAULT:o===rX.RECORD_NAVIGATION?J.GHOST:J.OUTLINE,size:Y.SM,onClick:()=>j(e),"aria-label":e.presentation.showLabel?void 0:e.label,title:e.presentation.showLabel&&o!==rX.ACTION_BAR?void 0:e.label,children:[e.iconReference?u(e.iconReference,{size:ca.SM}):e.kind===od.COMPOSITE_VIEW?u({category:re.COMPOSITE_VIEW,viewReference:e.ref},{size:ca.SM}):u({category:re.CUSTOM,customReference:`view-execution-${e.ref}`},{size:ca.SM}),e.presentation.showLabel&&(0,$.jsx)(`span`,{className:o===rX.ACTION_BAR?`@max-[48rem]/resource-header:sr-only`:void 0,children:e.label})]})},`${e.kind}:${e.ref}`))},`launcher-group:${a}`))})})}function Qve({renderSlot:e,children:t}){return e===rX.ACTION_BAR?(0,$.jsx)($.Fragment,{children:t}):e===rX.RECORD_NAVIGATION?(0,$.jsx)(`nav`,{className:`-mt-element flex flex-wrap items-center gap-item-xs border-b border-border pb-element-sm`,children:t}):(0,$.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-item-sm`,children:t})})}function $ve(e){return e?.contentType===od.COMPOSITE_VIEW||e?.contentType===od.EXECUTION_VIEW}function oX(e){let{resolvedSegments:t,resolutionContext:n,resourceType:r,viewRef:i,operationIdentifier:a,familyLabel:o,launcher:s}=e,c=Wm({kind:mu.RESOURCE_VIEW,resourceType:r,viewRef:i},n);if(!c)throw sX(`Operation "${String(a)}" on resource "${r}" could not resolve resource-owned ${o} view "${i}".`);if(!$ve(c))throw sX(`Operation "${String(a)}" on resource "${r}" resolved ${o} view "${i}" into unsupported content type "${c.contentType}".`);let l={kind:c.contentType,ref:c.viewRef,label:c.label,iconReference:c.iconReference,urlPath:c.urlPath,contextResourceIdentifiers:c.contextResourceIdentifiers,requiredFeatures:c.requiredFeatures,presentation:km(s)},u=t[t.length-1];u?.type===`launcher-group`?u.views.push(l):t.push({type:`launcher-group`,views:[l]})}function sX(e){return V.buildConfigurationError(ql.CONFIGURATION,{component:`ResourceLayout_InsertedViews`,message:e})}var cX=rs.getLogger(),lX=cX.debugByType(`ResourceLayoutPreset_List_Default`);cX.setDebugTypeLogging(`ResourceLayoutPreset_List_Default`,!1);var uX=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r,sourceRelationship:i,showCharts:a=!0,defaultViewMode:o=gu.CARDS})=>{let{resourceType:s,operation:c,operationId:l,resourceConfig:u,operationInitiator:d,contextualParameters:f,resolvePreferredOperation:p,navigateToResourceOperation:m}=rC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tResourceHeader:h,tResourceFieldDisplay:g,tResourceFieldEnumValue:_,tResourceOperation:v,tComponent:y,formatDate:b,formatDateTime:x,isReady:S,resolvedRegionalPreferences:C}=K({component:B.RESOURCES_LAYOUTS_LIST,resource:s}),{t:w}=K({resource:s}),T=ap(),{renderIcon:E}=Of(),{registry:D,doOperation:k}=lm(),[A]=ih(),{getRecipe:j}=Rg(),M=j(oc.INTERACTIVE,In.GHOST),N=(0,Q.useMemo)(()=>({...d,sourceRelationship:i??n?.sourceRelationship}),[d,i,n?.sourceRelationship]),P=c.operationFrontendConfig?.collectionDisplayConfig,F=P?.displayMode??o??gu.CARDS,I=P?.userSwitchableDisplayMode??!1,ee=P?.quickFilterField,L=HG.withoutPresetsAssigningPinnedFields(P?.presetFilters,e.pinnedFilters),R=e.collectionToolbar!==bu.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===Xl.GRID,ue=oe?.style===Xl.GRID?oe.columns:void 0,{viewMode:de,setViewMode:fe}=Sve(s,F),pe=I?de:F,me=(0,Q.useMemo)(()=>[gu.CARDS,gu.TABLE,...re?[gu.BOARD]:[],...ie?[gu.CALENDAR]:[],...ae?[gu.TIMELINE]:[]],[re,ie,ae]),he=me.includes(pe)?pe:gu.CARDS,ge=u?.resourceFieldIdentifier,_e=Rx(),ve=tH({idField:ge}),[ye,be]=(0,Q.useState)([]),xe=ye.length>0&&ye.every(e=>ve.isSelected(e)),Ce=bq(ye.length,ye.filter(e=>ve.isSelected(e)).length),{isSelected:we,selectItem:Te,deselectItem:Ee,toggleSelection:De}=ve,Oe=(0,Q.useCallback)(()=>{ye.length>0&&ye.every(e=>we(e))?ye.forEach(e=>Ee(e)):ye.forEach(e=>Te(e))},[ye,we,Te,Ee]),[ke,Ae]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(()=>{let e=c,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[Ne,Pe]=(0,Q.useState)(!1),[Fe,Ie]=(0,Q.useState)([]),[Le,Re]=(0,Q.useState)({}),ze=(0,Q.useMemo)(()=>[`resources.${s}`,`components.${B.RESOURCES_LAYOUTS_LIST}`],[s]),Be=(0,Q.useMemo)(()=>[{id:`initial-data`,isReady:Ne}],[Ne]),Ve=(0,Q.useCallback)(()=>{Me(e=>({...e,page:1}))},[]),He=(0,Q.useRef)(k),Ue=(0,Q.useRef)(Fe),We=(0,Q.useRef)(Le);He.current=k,Ue.current=Fe,We.current=Le,(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]);let Ge=(0,Q.useMemo)(()=>Object.entries(f).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[f]),Ke=lS($V(e.contextResourceIdentifiers,void 0)??void 0),qe=(0,Q.useMemo)(()=>{if(!u)return{create:null,read:null,search:null};let t=p(W.CREATE,{requireLiteralIdentifier:!0}),n=t?.operationFrontendConfig;return{create:t&&n&&!fr(n)&&n.actionVisibility!==mo.HIDDEN&&Vm({...t,resourceType:e.resourceType,resourcePrimaryScope:u.resourcePrimaryScope},Ke)?t:null,read:p(W.READ,{requireAddressable:!0})||null,search:p(W.SEARCH)||null}},[u,p,Ke,e.resourceType]),Je=(0,Q.useCallback)(e=>{if(!u)return null;let t=t=>lh({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:D,hasResourceId:On.getResourceId(e[s]).length>0,requireFrontendAddressable:t,preferredVariantKey:c?.variantKey,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,D)})??null,n=t(!0);if(n)return n;let r=t(!1);return r&&r.operationFrontendConfig&&!fr(r.operationFrontendConfig)?r:null},[c,D,u,s]),Ye=(0,Q.useMemo)(()=>{let e=[{resourceType:s,operation:l}];return qe.search&&e.push({resourceType:s,operation:String(qe.search.operationIdentifier)}),e},[s,l,qe.search]),Xe=(0,Q.useMemo)(()=>u?.frontendConfiguration?.emptyState,[u]),{sortFields:Ze,filterFields:Qe,searchEnabled:$e,filtersEnabled:et}=(0,Q.useMemo)(()=>{let t=c,n=qe.search,r=(t?.sortFields?.length?t.sortFields:n?.sortFields)??[],i=t?.filterFields&&Object.keys(t.filterFields).length>0?t.filterFields:n?.filterFields,a=HG.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:HG.withoutPinnedFilterFields(a,e.pinnedFilters),searchEnabled:o,filtersEnabled:s}},[qe.search,c,D,u,f,e.parentResourcesRequirements,e.pinnedFilters]),tt=C?.timezone,nt=(0,Q.useMemo)(()=>q_e(C?.locale),[C?.locale]),rt=Al.calendarDateToday({timezone:tt}),[it,at]=(0,Q.useState)(()=>TJ(rt)),ot=(0,Q.useCallback)(e=>at(TJ(e)),[]),st=ie&&he===gu.CALENDAR?Qe.find(e=>e.fieldName===ie.dateField&&e.fieldType===RG.DATE):void 0,ct=(0,Q.useMemo)(()=>ie?BG(u?.mainSchema,u?.inheritenceSchemaDefinition).has(ie.dateField):!1,[ie,u]),lt=(0,Q.useMemo)(()=>J_e(it,nt),[it,nt]),ut=!!ae&&he===gu.TIMELINE&&[ae.startField,ae.endField].every(e=>Qe.some(t=>t.fieldName===e&&t.fieldType===RG.DATE)),dt=(0,Q.useMemo)(()=>BG(u?.mainSchema,u?.inheritenceSchemaDefinition),[u]),ft=(0,Q.useMemo)(()=>ive(it),[it]),pt=(0,Q.useMemo)(()=>{if(ie&&st)return{[ie.dateField]:Z_e(Y_e(lt),ct,tt)};if(ae&&ut)return ove({startField:ae.startField,endField:ae.endField,startIsCalendarDate:dt.has(ae.startField),endIsCalendarDate:dt.has(ae.endField),timeZone:tt,firstDay:ft[0],lastDay:ft[ft.length-1]})},[ie,st,lt,ct,tt,ae,ut,dt,ft]),mt=(0,Q.useRef)(pt);mt.current=pt;let ht=(0,Q.useMemo)(()=>JSON.stringify(pt??{}),[pt]);(0,Q.useEffect)(()=>{Me(e=>e.page===1?e:{...e,page:1})},[ht]);let{quickFilterDef:gt,panelFilterFields:_t}=(0,Q.useMemo)(()=>{if(!ee)return{quickFilterDef:void 0,panelFilterFields:Qe};let e=Qe.find(e=>e.fieldName===ee&&e.fieldType===RG.ENUM&&(e.enumValues?.length??0)>0);return e?{quickFilterDef:e,panelFilterFields:Qe.filter(t=>t!==e)}:{quickFilterDef:void 0,panelFilterFields:Qe}},[Qe,ee]),vt=(0,Q.useMemo)(()=>HG.detectSummaryFields(u),[u]),yt=(0,Q.useMemo)(()=>gp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`errorLoading`}),[y]),bt=(0,Q.useMemo)(()=>v(s,W.CREATE,`title`),[v,s]),xt=(0,Q.useMemo)(()=>gp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`}),[y]),St=(0,Q.useMemo)(()=>gp({tComponent:y,componentType:B.RESOURCES_LAYOUTS_LIST,key:`listLabel`}),[y]),Ct=(0,Q.useMemo)(()=>{let e={};for(let t of vt)e[t]=g(s,t,`label`);return e},[vt,s,g]),wt=(0,Q.useMemo)(()=>On.extractDataMode(A,r,zl.SUMMARY),[A,r]),Tt=(0,Q.useMemo)(()=>Ca.createOperationPathKeyFromOperation(c),[c]),Et=(0,Q.useMemo)(()=>HG.searchOperationAcceptsATerm(qe.search)&&tK({listOperation:c,searchOperation:qe.search??void 0,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements,pinnedFilters:e.pinnedFilters,resourceType:s,resourceFieldIdentifier:String(u?.resourceFieldIdentifier??``),registry:D}),[qe.search,f,c,D,u,e.parentResourcesRequirements,e.pinnedFilters,s]),Dt=(0,Q.useMemo)(()=>!qe.search||!Et?null:Ca.createOperationPathKeyFromOperation(qe.search),[qe.search,Et]),Ot=pK({enabled:$e&&!!qe.search&&Et,onDebouncedChange:Ve}),kt=Ot.debouncedQuery;(0,Q.useEffect)(()=>{ve.clearSelection()},[Le,kt]);let At=(0,Q.useRef)(e);At.current=e;let jt=Fe.map(e=>`${e.field}:${e.direction}`).join(`,`),Mt=(0,Q.useMemo)(()=>JSON.stringify(Le),[Le]),Nt=e.pinnedFilters,Pt=(0,Q.useMemo)(()=>JSON.stringify(Nt??{}),[Nt]),{emit:Ft,resourceCollectionRefreshEvent:It}=Ao(),{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(wc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:s,filterValues:We.current})},[Mt,s,Ft]);let Rt=kt.length>0&&!!Dt,zt=`${s}|${Rt?Dt:Tt}|${Ge}|${je.limit}|${jt}|${Mt}|${Pt}|${ht}|${kt}|${Lt??0}`,Bt=`${zt}|page:${je.page}`,Vt=(0,Q.useCallback)(async(e,t,n)=>{let r=HG.withPinnedFilters(e,At.current.pinnedFilters);if(Rt&&Dt){lX(`Calling doOperation (SEARCH via inline search)`,{searchOperationPathKey:Dt,query:kt});let e={contextualParameters:f,searchQuery:kt,filters:Object.keys(r).length>0?r:void 0,pagination:{page:t,limit:n},sort:Ue.current.length?[...Ue.current]:void 0,parentResourcesRequirements:At.current.parentResourcesRequirements,dataMode:wt};return He.current(Dt,e)}lX(`Calling doOperation (LIST)`,{operationPathKey:Tt});let i={page:t,limit:n};return Ue.current.length&&(i.sort=Ue.current.map(e=>`${e.field}:${e.direction}`).join(`,`)),Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&(i[e]=t)}),He.current(Tt,{contextualParameters:f,queryParameters:i,parentResourcesRequirements:At.current.parentResourcesRequirements,dataMode:wt})},[Rt,Dt,kt,f,wt,Tt]),Ht=(0,Q.useRef)(Vt);Ht.current=Vt;let Ut=Rt?qe.search?.maxPaginatedResultPerPageLimit??50:c?.maxPaginatedResultPerPageLimit??100,[Wt,Gt]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{lX(`useEffect triggered`,{fetchKey:Bt,resourceType:s});let e=!1;return(async()=>{lX(`fetchData started`,{fetchKey:Bt,operationPathKey:Tt,contextualParameters:f}),Ae(null);try{let t=$_e(We.current,mt.current);if(mt.current){let n=await lve({requestPage:(e,n)=>Ht.current(t,e,n),pageLimit:Ut});if(e)return;be(n.items),Gt(n.notShown),Pe(!0);return}let n=await Ht.current(t,je.page,je.limit);if(lX(`doOperation completed`,{resultType:Array.isArray(n)?`array`:typeof n,resultLength:Array.isArray(n)?n.length:void 0}),e)return;if(Gt(0),n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;be(e.data),Me(t=>{let n=e.pagination;return t.page===n.page&&t.limit===n.limit&&t.total===n.total&&t.totalPages===n.totalPages?t:n})}else Array.isArray(n)&&(be(n),Me(e=>e.total===n.length&&e.totalPages===1?e:{...e,total:n.length,totalPages:1}));Pe(!0)}catch(t){if(e){lX(`Fetch cancelled after error`,{fetchKey:Bt});return}let n=O(t);Ae({message:T(t)}),cX.error(`Fetch error`,{...n,error:t,fetchKey:Bt})}finally{lX(`fetchData finally block`,{cancelled:e,fetchKey:Bt})}})(),()=>{lX(`useEffect cleanup`,{cancelled:e,fetchKey:Bt}),e=!0}},[Bt]);let Kt=(0,Q.useCallback)(e=>{Ie(e),Me(e=>({...e,page:1}))},[]),qt=(0,Q.useCallback)(e=>{Re(e),Me(e=>({...e,page:1}))},[]),Jt=(0,Q.useCallback)(e=>{ee&&(Re(t=>{let n={...t};return e===void 0?delete n[ee]:n[ee]=e,n}),Me(e=>({...e,page:1})))},[ee]),Yt=(0,Q.useMemo)(()=>{if(!ne||he!==gu.CARDS)return null;let e=Qe.find(e=>e.fieldName===ne),t=e?.enumValues??[];if(t.length===0)return null;let n=new Map(t.map(e=>[e,[]])),r=[];for(let e of ye){let t=e[ne],i=typeof t==`string`?n.get(t):void 0;i?i.push(e):r.push(e)}let i=[];for(let r of t){let t=n.get(r)??[];t.length!==0&&i.push({key:r,label:_(s,ne,r,e?.schema),items:t})}return r.length>0&&i.push({key:`__wildo-ungrouped__`,label:null,items:r}),i},[ye,ne,he,Qe,_,s]),Xt=(0,Q.useMemo)(()=>Yt||!te||he!==gu.CARDS?null:vve(ye,te,u?.mainSchema,b,u?.inheritenceSchemaDefinition),[ye,te,he,b,Yt,u]),Zt=Yt??Xt,Qt=re&&he===gu.BOARD?Qe.find(e=>e.fieldName===re.groupByField):void 0,$t=(0,Q.useMemo)(()=>Qt?.fieldType===RG.ENUM?Qt.enumValues??[]:[],[Qt]),en=(0,Q.useCallback)(e=>V.getResourceObjectId(e,String(u?.resourceFieldIdentifier??``))??``,[u?.resourceFieldIdentifier]),tn=fve({enabled:$t.length>0,vocabulary:$t,groupByField:re?.groupByField??``,readerFilters:Le,reloadKey:zt,pageSize:je.limit,requestPage:Vt,getItemId:en}),nn=(0,Q.useMemo)(()=>!re||!Qt?null:L_e({vocabulary:$t,labelOf:e=>_(s,re.groupByField,e,Qt.schema),pages:tn.pages,collectionTotal:Ne?je.total:void 0}),[re,Qt,$t,tn.pages,Ne,je.total,_,s]),rn=(0,Q.useMemo)(()=>{if(!re||!u)return;let t=R_e(u.operations??[],re.transitionOperation).filter(e=>Vm({...e,resourceType:s,resourcePrimaryScope:u.resourcePrimaryScope},Ke));if(t.length!==0)return{operations:t,resourceType:s,subjectDataMode:wt,organizationId:$V(e.contextResourceIdentifiers,void 0)??void 0}},[re,u,s,Ke,wt,e.contextResourceIdentifiers]),an=(0,Q.useCallback)(async(t,n,r)=>{if(!re)return;let i=en(t);if(!i)return;let a=On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,i);await V_e({groupByField:re.groupByField,targetValue:n,call:t=>k(Ca.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=>ch.error(T(e))})},[re,tn.applyMove,en,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,k,D,T]),on=(0,Q.useMemo)(()=>!ie||!st?new Map:X_e({items:ye,dateField:ie.dateField,calendarField:ct,timeZone:tt}),[ie,st,ye,ct,tt]),sn=(0,Q.useMemo)(()=>!ae||!ut?[]:ave({items:ye,startField:ae.startField,endField:ae.endField,startIsCalendarDate:dt.has(ae.startField),endIsCalendarDate:dt.has(ae.endField),timeZone:tt,days:ft}),[ae,ut,ye,dt,tt,ft]),cn=C?.locale,ln=(0,Q.useMemo)(()=>{let e=new Intl.DateTimeFormat(cn||void 0,{weekday:`short`,timeZone:`UTC`});return(lt[0]??[]).map(({day:t})=>e.format(t))},[cn,lt]),un=(0,Q.useMemo)(()=>new Intl.DateTimeFormat(cn||void 0,{day:`numeric`,timeZone:`UTC`}),[cn]),dn=(0,Q.useCallback)(e=>{let t=V.computeFrontendResourceLabel({resourceType:s,registry:D,currentObject:e,t:w,formatDate:b,formatDateTime:x});return String(t||en(e))},[s,D,w,b,x,en]),fn=(0,Q.useCallback)(()=>{u?qe.create?m({operation:qe.create,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N}):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - CREATE operation not available for resource:`,s):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - missing resourceConfig`)},[u,qe.create,m,e.contextResourceIdentifiers,e.parentResourcesRequirements,N]),pn=(0,Q.useCallback)(t=>{if(!u)return!1;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);return n?Je(On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n))!==null:!1},[u,e.contextResourceIdentifiers,s,Je]),mn=(0,Q.useCallback)(t=>{if(!u)return;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);if(!n){cX.error(`[ResourceLayoutPreset_List] Item click ignored: could not resolve resource id from list item.`,{resourceType:s,fieldIdentifier:u.resourceFieldIdentifier,itemKeys:Object.keys(t??{})});return}let r=On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n),i=Je(r);i&&m({operation:i,contextResourceIdentifiers:r,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N})},[u,m,u?.resourceFieldIdentifier,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,N,Je]),hn=(0,Q.useCallback)((n,r)=>{let i=u?.resourceFieldIdentifier;if(!i)return null;let a=V.getResourceObjectId(n,i),o=a?On.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,a):e.contextResourceIdentifiers,c=Je(o),l=On.createFrontendResourceOperationContextFromOperation({resourceType:s,operation:c??e.operation,contextResourceIdentifiers:o});return(0,$.jsx)(bY,{resourceContext:l,navigationZone:t,navigationInitiator:N,currentObject:n,currentObjectDataMode:wt,displayMode:Se.SUMMARY,size:Y.ICON_SM,orientation:r,hostRowOpensRead:!0})},[u,s,e.contextResourceIdentifiers,e.operation,Je,t,N,wt]),gn=(e,n)=>{let r=u?.resourceFieldIdentifier;if(!r)throw V.buildConfigurationError(ql.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:s,component:`ResourceLayoutPreset_List`});let i=V.getResourceObjectId(e,r);return _e.isElementActive(i)?(0,$.jsx)(`li`,{className:U(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(LG,{navigationZone:t})},i||n):(0,$.jsx)(`li`,{className:U(`list-none`,le&&`border border-border rounded-lg overflow-hidden`),children:_n(e,n)},i||n)},_n=(t,n)=>(0,$.jsx)(IG,{item:t,resourceType:s,resourceConfig:u,registry:D,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:vt,fieldLabelsMap:Ct,tResourceFieldEnumValue:_,onItemClick:pn(t)?mn:void 0,cardActionPlacement:se,selectable:ce,isSelected:ve.isSelected(t),selectionActive:ve.selectionCount>0,onToggleSelect:ve.toggleSelection,selectAriaLabel:y(B.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:n+1}),operationsSlot:hn(t,se?.orientation),interactiveClasses:{hover:`hover:bg-muted/50`,transition:M.motion.transition}}),vn=E(H.PLUS,{size:ca.SM}),yn=qe.create?(0,$.jsxs)(X,{onClick:fn,size:Y.SM,"data-slot":`collection-create`,className:`inline-flex items-center gap-element`,children:[vn,(0,$.jsx)(`span`,{children:bt})]}):void 0,bn=uK({isSearchActive:Rt,filterValues:Le}),xn=R&&!!qe.create,Sn=aK(Xe,xn),Cn=dK({hasLoadedOnce:Ne,itemCount:ye.length,isNarrowed:bn,emptyStateOffersCreate:Sn})?yn:void 0,wn=(0,Q.useMemo)(()=>(u?.operations??[]).some(e=>Ta(e)),[u]),Tn=(0,Q.useMemo)(()=>{let e={page:je.page,limit:je.limit};Fe.length&&(e.sort=Fe.map(e=>`${e.field}:${e.direction}`).join(`,`));for(let[t,n]of Object.entries(HG.withPinnedFilters(Le,Nt)))n!=null&&n!==``&&(e[t]=n);Rt&&(e.q=kt);let t={list:HG.variantKeyOf(c),...qe.search?{search:HG.variantKeyOf(qe.search)}:{}};return{params:e,isSearchActive:!!kt,listingVariantKeys:t}},[je.page,je.limit,Fe,Le,Nt,kt,Rt,c,qe.search]),En=HG.matchListingOf(HG.listingOperationShown({inlineSearchTerm:kt,listOperation:c,searchOperation:qe.search})),Dn=wn?(0,$.jsx)(gve,{resourceContext:e,navigationZone:t,navigationInitiator:N,collectionExportQuery:Tn}):void 0;return S?ke?(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:ke.message})]})]}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(uV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),R&&(0,$.jsx)(e_e,{resourceType:s,quickFilter:gt?{field:gt,value:Le[gt.fieldName],onChange:Jt}:void 0,presetFilters:L,search:Ot.isVisible?{query:Ot.query,onChange:Ot.handleChange,onClear:Ot.handleClear}:void 0,filterFields:et?_t:[],filterPanel:z,filterValues:Le,onFiltersChange:qt,sort:he===gu.CARDS&&Ze.length>0?{sortFields:Ze,sortStates:Fe,onSortChange:Kt}:void 0,viewMode:I?{viewMode:he,onViewModeChange:fe,availableModes:me}:void 0,primaryAction:Cn,collectionActions:Dn,...ce&&he!==gu.TABLE&&ye.length>0?{selectAll:{state:Ce,onToggle:Oe}}:{},selection:ce?{count:ve.selectionCount,onClear:ve.clearSelection,...xe&&!ve.matchAllSelection&&je.total>ye.length&&En?{matchAllOffer:{matchedCount:je.total,onSelectAllMatching:()=>ve.selectAllMatching({filters:HG.withPinnedFilters(Le,Nt),...kt?{search:kt}:{},listing:En,matchedCount:je.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)(nb,{i18nKeys:ze,loadingScopes:Ye,readiness:Be,renderLoading:()=>(0,$.jsx)(um,{template:he===gu.TABLE?`table`:le?`card`:`list`,density:`auto`,count:je.limit,"aria-hidden":`true`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(aX,{resourceContext:e,navigationZone:t,showCharts:a}),_e.isCreateActive&&(0,$.jsx)(LG,{navigationZone:t,className:`border border-border rounded-lg`}),pt&&Wt>0&&(0,$.jsx)(AD,{variant:`warning`,"data-slot":`collection-window-not-shown`,children:(0,$.jsx)(MD,{children:y(B.RESOURCES_LAYOUTS_LIST,`displayWindowRowsNotShown`,{count:Wt})})}),ie&&st?(0,$.jsx)(rve,{weeks:lt,itemsByDay:on,month:it,today:rt,firstDayOfWeek:nt,onMonthChange:ot,monthHeading:b(DJ(it),{yearMonth:!0}),weekdayLabels:ln,dayNumberLabel:e=>un.format(e),dayLabel:(e,t)=>y(B.RESOURCES_LAYOUTS_LIST,`calendarDayItemCount`,{date:b(e,{calendarDate:!0}),count:t}),getItemId:en,getItemLabel:dn,canOpenItem:pn,onOpenItem:mn,calendarLabel:St,previousMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayToday`),keyboardHint:y(B.RESOURCES_LAYOUTS_LIST,`calendarKeyboardHint`)}):ae&&ut?(0,$.jsx)(cve,{days:ft,placements:sn,month:it,today:rt,onMonthChange:ot,monthHeading:b(DJ(it),{yearMonth:!0}),dayNumberLabel:e=>un.format(e),getItemId:en,getItemLabel:dn,barLabel:(e,t,n)=>y(B.RESOURCES_LAYOUTS_LIST,`timelineItemSpan`,{label:dn(e),from:b(t,{calendarDate:!0}),to:b(n,{calendarDate:!0})}),canOpenItem:pn,onOpenItem:mn,timelineLabel:St,previousMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(B.RESOURCES_LAYOUTS_LIST,`displayToday`),emptyMonthLabel:y(B.RESOURCES_LAYOUTS_LIST,`timelineEmptyMonth`)}):ye.length===0?bn?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:xt}):(0,$.jsx)(cK,{resourceType:s,config:Xe,hasCreateOperation:xn,onCreateAction:fn,variant:R?`default`:`compact`,title:e.emptyStateWords?.title,description:e.emptyStateWords?.description}):he===gu.TABLE?(0,$.jsx)(F_e,{items:ye,resourceType:s,resourceConfig:u,navigationZone:t,summaryFields:vt,contextResourceIdentifiers:e.contextResourceIdentifiers,fieldLabelsMap:Ct,sortFields:Ze,sortStates:Fe,onSortChange:Kt,selectable:ce,isRowSelected:we,onToggleRow:De,allSelected:xe,onToggleAll:Oe,renderRowActions:hn,onRowClick:mn,canOpenRow:pn}):nn?(0,$.jsx)(K_e,{columns:nn,onLoadMore:e=>{tn.loadMore(e)},loadMoreLabel:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardLoadMore`,{count:e}),columnLoadFailedLabel:y(B.RESOURCES_LAYOUTS_LIST,`boardColumnLoadFailed`),ungroupedNote:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardUngroupedNote`,{count:e}),renderCard:_n,getItemId:en,transition:rn,onMoveItem:an,boardLabel:St,ungroupedLabel:y(B.RESOURCES_LAYOUTS_LIST,`boardUngrouped`),columnCountLabel:e=>y(B.RESOURCES_LAYOUTS_LIST,`boardColumnCount`,{count:e}),moveHint:y(B.RESOURCES_LAYOUTS_LIST,`boardMoveHint`)}):Zt?(0,$.jsx)(`div`,{className:`space-y-card`,"data-slot":`collection-groups`,children:Zt.map((e,t)=>{let n=Zt.slice(0,t).reduce((e,t)=>e+t.items.length,0);return(0,$.jsxs)(`section`,{className:`space-y-item-xs`,children:[e.label&&(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,$.jsx)(`ul`,{role:`list`,"aria-label":e.label??St,className:OG(ue),style:kG(ue),children:e.items.map((e,t)=>gn(e,n+t))})]},`${e.key}:${t}`)})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":St,className:OG(ue),style:kG(ue),children:ye.map(gn)}),!nn&&!pt&&(0,$.jsx)(iK,{pagination:je,onPaginationChange:Me})]})})]}):null};function dX({preset:e,...t}){let n=XW(t.resourceContext.operation),r=e??ZW(t.resourceContext.operation)??Uu.DEFAULT,i=n?(0,$.jsx)(n,{...t}):Q.createElement(G(B.RESOURCES_LAYOUTS_LIST,`ResourceLayout_List`)(r),t);return(0,$.jsx)(Lx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[pA]:!0,children:i})})}var fX=rs.getLogger(),eye=fX.debugByType(`PublicLayout_MainContainer`);fX.setDebugTypeLogging(`PublicLayout_MainContainer`,!1);function pX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MAIN_CONTAINER,`PublicLayout_MainContainer`)(e);return eye(`Render preset=${e} card=${t.useCardLayout?`yes`:`no`} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var mX;(function(e){e.DEFAULT=`default`,e.MUTED=`muted`,e.CONTRAST=`contrast`,e.DESTRUCTIVE=`destructive`,e.SUCCESS=`success`,e.INHERIT=`inherit`})(mX||={});var hX;(function(e){e.HOVER=`hover`,e.ALWAYS=`always`,e.NONE=`none`})(hX||={});var gX;(function(e){e.NORMAL=`normal`,e.MEDIUM=`medium`,e.SEMIBOLD=`semibold`})(gX||={});function _X({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LINK,`Link`)(e);return(0,$.jsx)(n,{...t})}var vX=({href:e,onClick:t,children:n})=>(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:e,onClick:t,children:n})}),yX=({code:e,errorParam:t,errorDescription:n})=>{let{handleAuthCodeExchange:r,auth:i}=fm(),{tComponent:a,isReady:o}=K({component:B.PUBLIC_LAYOUTS_AUTH_CALLBACK}),s=ap(),c=cg(),l=e=>a(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,e),u=(0,Q.useMemo)(()=>L(c.search),[c.search]),d=(0,Q.useMemo)(()=>fi(Ln.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(c.search),[c.search]),[p,m]=(0,Q.useState)(null),h=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{h.current||(t?(h.current=!0,m(l(Zn.ERROR_GENERIC))):e?i.accessToken||i.onboardingSessionId?h.current=!0:(h.current=!0,r(e).catch(e=>{m(s(e,l(Zn.ERROR_EXCHANGE_FAILED)))})):(h.current=!0,m(l(Zn.ERROR_NO_CODE))))},[e,t,n,i.accessToken,i.onboardingSessionId,r]);let g=Fp(i,u);return g?(0,$.jsx)(Uh,{to:g,replace:!0}):i.accessToken&&!i.isLoading?(0,$.jsx)(Uh,{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(Zn.ERROR_TITLE)})]}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:p})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:l(Zn.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(Zn.VERIFYING)})]}):null};function bX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,`Auth_AuthCallback`)(e);return(0,$.jsx)(n,{...t})}var tye=()=>{let[e]=ih(),t=e.get(`code`),n=e.get(`error`),r=e.get(`error_description`);return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(bX,{code:t,errorParam:n,errorDescription:r})})},xX;(function(e){e.REPORTED=`reported`,e.NOTHING_TO_REPORT=`nothing_to_report`})(xX||={});var nye=()=>{let[e]=ih(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_AUTH_CALLBACK}),[r,i]=(0,Q.useState)(null),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let t=e.get(`code`),n=e.get(`error`);!t&&!n?i(xX.NOTHING_TO_REPORT):(hH(t?{code:t}:{error:n??void 0}),i(xX.REPORTED),window.close())},[e]),!n||r===null?null:(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(Z,{className:`text-sm`,children:t(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,r===xX.REPORTED?Zn.REAUTH_RETURNING:Zn.REAUTH_NO_RESULT)})})};function SX({mfaRequired:e,mfaSessionId:t,usableSecondFactorMethods:n,email:r,authRedirectTarget:i}){let a=nh();(0,Q.useEffect)(()=>{e&&t&&(n.length===0?a(fi(Ln.enrollmentRequired,i),{replace:!0}):a(fi(`${Ln.mfaChallenge}?sessionId=${t}&email=${encodeURIComponent(r||``)}`,i),{replace:!0}))},[e,t,n,a,r,i])}var CX=({token:e,email:t,redirect:n})=>{let r=Ste(n)?n:void 0,{handleMagicLinkVerify:i,auth:a}=fm(),{tComponent:s,isReady:c}=K({component:B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY}),l=ap(),u=e=>s(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,e),d=Ln.login,[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(!e||!t?(m.current=!0,p(u(o.ERROR_INVALID_LINK))):a.accessToken?m.current=!0:(m.current=!0,i(e,t).then(e=>{!e.success&&!e.requiresMFA&&p(l(null,u(o.ERROR_VERIFICATION_FAILED)))}).catch(e=>{p(l(e,u(o.ERROR_EXPIRED)))})))},[e,t,a.accessToken,i]),SX({mfaRequired:a.mfaRequired,mfaSessionId:a.mfaSessionId,usableSecondFactorMethods:a.usableSecondFactorMethods,email:t??void 0,authRedirectTarget:r});let h=Fp(a,r);return h?(0,$.jsx)(Uh,{to:h,replace:!0}):a.accessToken&&!a.isLoading?(0,$.jsx)(Uh,{to:r??Ln.home,replace:!0}):c?f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(SY,{children:u(o.ERROR_TITLE)})]}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:f})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:u(o.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:u(o.VERIFYING)})]}):null};function wX({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,`Auth_MagicLinkVerify`)(e);return(0,$.jsx)(n,{...t})}var rye=()=>{let[e]=ih(),t=e.get(`token`),n=e.get(`email`),r=e.get(`redirect`);return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(wX,{token:t,email:n,redirect:r})})},iye=()=>{let{auth:e}=sg(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`email`}),(0,$.jsx)(QL,{name:`password`}),e.error&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:e.error})}),(0,$.jsx)(nO,{label:(e=>t(B.PUBLIC_LAYOUTS_USER_AUTH,e))(as.SUBMIT),submittingLabel:`…`,fullWidth:!0})]}):null},aye=({email:e,onSuccess:t,onError:n,isLoading:r,t:i})=>{let{authenticateWithPassword:a}=sg(),o=ap(),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)(nE,{schema:mie,defaultValues:c,onSubmit:s,validationMode:ta.ON_BLUR,disabled:r,labels:{fields:{email:i(as.EMAIL_ADDRESS),password:i(as.PASSWORD)}},layoutTemplate:iye},`password-auth`)},TX={[hs.PASSWORD]:H.KEY,[hs.PASSKEY]:H.FINGERPRINT,[hs.MAGIC_LINK]:H.MAIL,[hs.EMAIL_OTP]:H.MAIL,[hs.SMS_OTP]:H.MESSAGE_CIRCLE,[hs.TOTP]:H.SMARTPHONE,[hs.ORG_SAML]:H.ORGANIZATION,[hs.ORG_OPENID_CONNECT]:H.ORGANIZATION,[hs.EXTERNAL_OAUTH2]:H.LINK},oye={[hs.PASSWORD]:as.METHOD_PASSWORD,[hs.MAGIC_LINK]:as.METHOD_MAGIC_LINK,[hs.PASSKEY]:as.METHOD_PASSKEY,[hs.SMS_OTP]:as.METHOD_SMS_OTP,[hs.ORG_SAML]:as.METHOD_ORG_SSO,[hs.ORG_OPENID_CONNECT]:as.METHOD_ORG_SSO,[hs.EXTERNAL_OAUTH2]:as.METHOD_EXTERNAL_OAUTH2};function sye(e,t,n){if(e===hs.ORG_SAML||e===hs.ORG_OPENID_CONNECT)return t.offeredMethod?.config?.displayName?.trim()||void 0;if(e!==hs.EXTERNAL_OAUTH2)return;let r=t.offeredMethod?.oauth2ProviderRefs,i=t.socialProviders??[],a=r&&r.length>0?i.filter(e=>r.includes(e.providerRef)):i;return a.length===1&&n(a[0]).trim()||void 0}function EX(e,t){let n=sye(e,t,t.resolveSocialProviderLabel);if(n&&t.continueWithTemplate.includes(`{provider}`))return t.continueWithTemplate.replace(`{provider}`,n);let r=oye[e];return r?t.translateLabel(r):e}var DX=({method:e})=>{let{renderIcon:t}=Of();return t(TX[e],{size:ca.SM})},cye=({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 vc().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(as.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:n(as.MAGIC_LINK_SENT_DESCRIPTION)}),(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:`#`,onClick:e=>{e.preventDefault(),a(!1)},children:n(as.MAGIC_LINK_TRY_ANOTHER_METHOD)})})]}):(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:Zd.WRAP,onClick:c,disabled:o||t,children:[(0,$.jsx)(DX,{method:hs.MAGIC_LINK}),o?`…`:n(as.MAGIC_LINK_SEND)]})})};function OX({fieldName:e,submitLabel:t,submittingLabel:n,fieldProps:r}){let{formState:i}=UC();return(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:e,...r}),i.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:i.errors.root.message})}),(0,$.jsx)(nO,{label:t,submittingLabel:n,fullWidth:!0})]})}var kX=5e3,lye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=fm(),a=ap(),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 vc().smsOTPDelivery(e);if(t)return;if(n){g(!0);return}}catch{}!t&&Date.now()-n<12e4&&(r=setTimeout(()=>{i()},kX))}};return r=setTimeout(()=>{i()},kX),()=>{t=!0,r!==void 0&&clearTimeout(r)}},[p,e]);let _=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r(Zo.VERIFY_BUTTON),submittingLabel:r(Zo.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 vc().smsOTPSend(e),g(!1),c(!0),m(e=>e+1)}catch(e){let t=a(e,r(Zo.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,hs.SMS_OTP,n.code.trim());o.success?t(o):b(a(null,r(Zo.ERROR_INVALID_CODE)))}catch(e){b(a(e,r(Zo.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(Zo.SMS_OTP_SENT)}),h&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:r(Zo.SMS_OTP_UNDELIVERED)})}),(0,$.jsx)(nE,{schema:jie,defaultValues:{code:``},onSubmit:S,validationMode:ta.ON_BLUR,disabled:n||l,onFormReady:v,labels:{fields:{code:r(Zo.SMS_OTP_CODE_LABEL)}},layoutTemplate:_},`sms-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:x,disabled:l,children:r(Zo.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(Zo.SMS_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:Zd.WRAP,onClick:x,disabled:l||n,children:[(0,$.jsx)(DX,{method:hs.SMS_OTP}),r(l?Zo.SMS_OTP_SENDING:Zo.SMS_OTP_SEND)]}),d&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:d})})]})},uye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=fm(),a=ap(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r(Zo.VERIFY_BUTTON),submittingLabel:r(Zo.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 vc().mfaEmailOTPSend(e),c(!0)}catch(e){let t=a(e,r(Zo.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,hs.EMAIL_OTP,n.code.trim());o.success?t(o):g(a(null,r(Zo.ERROR_INVALID_CODE)))}catch(e){g(a(e,r(Zo.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(Zo.EMAIL_OTP_SENT)}),(0,$.jsx)(nE,{schema:pne,defaultValues:{code:``},onSubmit:v,validationMode:ta.ON_BLUR,disabled:n||l,onFormReady:m,labels:{fields:{code:r(Zo.EMAIL_OTP_CODE_LABEL)}},layoutTemplate:p},`email-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:_,disabled:l,children:r(Zo.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(Zo.EMAIL_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:Zd.WRAP,onClick:_,disabled:l||n,children:[(0,$.jsx)(DX,{method:hs.EMAIL_OTP}),r(l?Zo.EMAIL_OTP_SENDING:Zo.EMAIL_OTP_SEND)]}),d&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:d})})]})},dye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=fm(),a=ap(),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:r(Zo.VERIFY_BUTTON),submittingLabel:r(Zo.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,hs.TOTP,n.code.trim());o.success?t(o):u(a(null,r(Zo.ERROR_INVALID_CODE)))}catch(e){u(a(e,r(Zo.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(Zo.TOTP_DESCRIPTION)}),(0,$.jsx)(nE,{schema:Pne,defaultValues:{code:``},onSubmit:d,validationMode:ta.ON_BLUR,disabled:n,onFormReady:c,labels:{fields:{code:r(Zo.TOTP_CODE_LABEL)}},layoutTemplate:s},`totp-challenge`)]})},fye=({sessionId:e,onSuccess:t,onError:n,isLoading:r,t:i,factorLevel:a})=>{let{handlePasskeyAuth:o}=fm(),s=ap(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>a===`first`?as:Zo,[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)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:u})}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:Zd.WRAP,onClick:m,disabled:c||r,children:[(0,$.jsx)(DX,{method:hs.PASSKEY}),i(c?f.PASSKEY_AUTHENTICATING:f.PASSKEY_BUTTON)]})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:i(f.PASSKEY_UNSUPPORTED)})})})},pye=br,mye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=cg(),l=e.config?.displayName||`SSO`,u=e.config?.connectionId,d=ed(c),f=(0,Q.useCallback)(()=>{if(!u){s(n(as.SSO_CONFIGURATION_ERROR));return}a(!0);let e=Fa(Ar.AUTH_SAML_LOGIN,{connectionId:u}),t=vc().getBaseURL(),r=t===window.location.origin?window.location.origin:``;window.location.href=`${t}${pye}${e}?returnUrl=${encodeURIComponent(`${r}${d}`)}`},[u,d,n]),p=r===`first`?n(as.CONTINUE_WITH).replace(`{provider}`,l):l;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:Zd.WRAP,onClick:f,disabled:t||i,children:[(0,$.jsx)(DX,{method:hs.ORG_SAML}),i?`…`:p]}),o&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o})})]})},hye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=cg(),l=ap(),u=e.config?.displayName||`SSO`,d=e.config?.connectionId,f=e.config?.scopeType,p=e.config?.scopeId,m=f===Ys.ORGANIZATION?p:void 0,h=ed(c),g=f===Ys.APPLICATION?p:void 0,_=(0,Q.useCallback)(async()=>{if(!d)s(n(as.SSO_CONFIGURATION_ERROR));else{a(!0),s(null);try{let e=vc();if(!m&&!g){s(n(as.SSO_CONFIGURATION_ERROR)),a(!1);return}let t=m?await e.getEnterpriseSSOAuthorizationUrl(m,d,h):await e.getAppEnterpriseSSOAuthorizationUrl(d,h,{headers:{[qu.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(as.CONTINUE_WITH).replace(`{provider}`,u):u;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:Zd.WRAP,onClick:_,disabled:t||i,children:[(0,$.jsx)(DX,{method:hs.ORG_OPENID_CONNECT}),i?`…`:v]}),o&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o})})]})},AX=({label:e,className:t})=>(0,$.jsxs)(`div`,{className:`my-group flex items-center gap-element text-xs uppercase text-muted-foreground${t?` ${t}`:``}`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`})]});function jX(e){return lb({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,fallbackLabel:e.brandLabel,translate:e.translate})}function MX(e){let t=e.publicProviders;return t?Object.entries(t).map(([e,t])=>({key:e,providerRef:e,displayName:t.displayName,displayNameLabelKey:_d(e)})):[]}var NX={google:{label:`Google`,brandClass:``,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,$.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z`,fill:`#4285F4`}),(0,$.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,$.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,$.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})},microsoft:{label:`Microsoft`,brandClass:`bg-[#2F2F2F] hover:bg-[#404040] text-white`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 21 21`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`9`,height:`9`,fill:`#F25022`}),(0,$.jsx)(`rect`,{x:`11`,y:`1`,width:`9`,height:`9`,fill:`#7FBA00`}),(0,$.jsx)(`rect`,{x:`1`,y:`11`,width:`9`,height:`9`,fill:`#00A4EF`}),(0,$.jsx)(`rect`,{x:`11`,y:`11`,width:`9`,height:`9`,fill:`#FFB900`})]})},github:{label:`GitHub`,brandClass:`bg-[#24292e] hover:bg-[#2f363d] text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})})},apple:{label:`Apple`,brandClass:`bg-black hover:bg-gray-900 text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z`})})}},PX={brandClass:`bg-muted hover:bg-muted/80 border border-border text-foreground`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,$.jsx)(`path`,{d:`M2 12h20`}),(0,$.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]})},FX=({providers:e,onProviderClick:t,isLoading:n,disabled:r=!1,continueWithLabel:i,translate:a,dividerLabel:o,showDivider:s})=>e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`space-y-item`,children:e.map(({key:e,providerRef:o,displayName:s,displayNameLabelKey:c})=>{let l=NX[o]??null,u=jX({providerRef:o,displayName:s,displayNameLabelKey:c,brandLabel:l?.label,translate:a}),d=l?.brandClass??PX.brandClass,f=l?.icon??PX.icon;return(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,disabled:n||r,onClick:()=>t(o),className:`w-full ${d}`,children:[f,(0,$.jsx)(`span`,{children:i.replace(`{provider}`,u)})]},e)})}),s&&o&&(0,$.jsx)(AX,{label:o})]}),gye=({methodConfig:e,isLoading:t,t:n})=>{let{initiateOAuth2Login:r}=sg(),{appConfig:i}=Tu(),a=cg(),[o,s]=(0,Q.useState)(null),c=ap(),l=e.oauth2ProviderRefs||[],u=(0,Q.useMemo)(()=>MX({publicProviders:Object.fromEntries(l.map(e=>[e,i.auth?.socialOAuth2Providers?.[e]??{}]))}),[i.auth?.socialOAuth2Providers,l]),d=(0,Q.useMemo)(()=>cb(u.map(e=>e.displayNameLabelKey)),[u]),{t:f}=K({keys:d}),p=(0,Q.useMemo)(()=>ed(a),[a]),m=(0,Q.useCallback)(async e=>{s(null);try{await r(e,p)}catch(e){s(c(e))}},[r,p,c]);return l.length===0?null:(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(FX,{providers:u,onProviderClick:m,isLoading:t,continueWithLabel:n(as.CONTINUE_WITH),translate:f}),o&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o})})]})},IX={};IX[hs.PASSWORD]=aye,IX[hs.MAGIC_LINK]=cye,IX[hs.SMS_OTP]=lye,IX[hs.EMAIL_OTP]=uye,IX[hs.TOTP]=dye,IX[hs.PASSKEY]=fye,IX[hs.ORG_SAML]=mye,IX[hs.ORG_OPENID_CONNECT]=hye,IX[hs.EXTERNAL_OAUTH2]=gye;var LX={};function RX(e,t){LX[e]=t}var zX;(function(e){e.REFLOW=`reflow`,e.LIST=`list`})(zX||={});var BX=({methods:e,labelFor:t,onSelect:n,disabled:r,layout:i=zX.REFLOW,className:a})=>{if(e.length===0)return null;let o=i===zX.REFLOW;return(0,$.jsx)(`div`,{className:U(o?`flex flex-wrap gap-element`:`flex flex-col gap-item`,a),children:e.map(e=>(0,$.jsxs)(X,{type:`button`,variant:J.OUTLINE,labelOverflow:Zd.WRAP,className:o?`grow basis-[10rem] max-w-full text-center`:`w-full justify-start text-start`,onClick:()=>n(e),disabled:r,"data-auth-method":e,children:[(0,$.jsx)(DX,{method:e}),(0,$.jsx)(`span`,{children:t(e)})]},e))})};function VX({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_LABEL,`Label`)(e);return(0,$.jsx)(n,{...t})}var _ye=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),HX=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),UX=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),vye=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})),yye=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})),bye=n((e=>{var t=HX().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),xye=n((e=>{var t=HX().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Sye=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),WX=n((e=>{var t=UX(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Cye=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]]}})),wye=n((e=>{var t=Cye();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}})),Tye=n(((e,t)=>{var n=wye();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),GX=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),KX=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
16
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),qX=n((e=>{var t=GX(),n=KX();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Eye=n((e=>{var t=HX(),n=WX(),r=UX(),i=qX(),a=GX(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Dye=n((e=>{var t=HX(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Oye=n(((e,t)=>{var n=qX();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),kye=n(((e,t)=>{var n=qX(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Aye=n(((e,t)=>{var n=qX();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),jye=n(((e,t)=>{var n=qX(),r=HX();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
17
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Mye=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)})),Nye=n((e=>{var t=qX(),n=Oye(),r=kye(),i=Aye(),a=jye(),o=KX(),s=HX(),c=Mye();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()))}})),Pye=n((e=>{var t=HX(),n=UX(),r=vye(),i=yye(),a=bye(),o=xye(),s=Sye(),c=WX(),l=Tye(),u=Eye(),d=Dye(),f=qX(),p=Nye();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
19
- The chosen QR Code version cannot contain this amount of data.
20
- Minimum version required to store current data is: `+c+`.
21
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),JX=n((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Fye=n((e=>{var t=JX();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o!==void 0||i&&i.getContext||(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Iye=n((e=>{var t=JX();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
22
- `;return typeof a==`function`&&a(null,p),p}})),Lye=e(n((e=>{var t=_ye(),n=Pye(),r=Fye(),i=Iye();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function YX(e){return e?{[qu.AUTH_SESSION_ID]:e}:void 0}var XX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(`loading`),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=(0,Q.useRef)(n);v.current=n;let y=(0,Q.useRef)(i);y.current=i;let b=ap(),x=(0,Q.useRef)(null),S=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:i(Ma.TOTP_VERIFY_BUTTON),submittingLabel:i(Ma.TOTP_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),C=(0,Q.useCallback)(e=>{a.current=e},[]),w=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),T=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]);(0,Q.useEffect)(()=>{let t=!1;if(!x.current||x.current.sessionId!==e){let t=YX(e);x.current={sessionId:e,promise:vc().mfaTOTPSetup(t?{headers:t}:void 0)}}let n=x.current.promise;return(async()=>{try{let e=await n;if(t)return;let r=await Lye.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(Ma.ENROLL_ERROR));_(n),v.current(n)}})(),()=>{t=!0}},[e]);let E=(0,Q.useCallback)(async r=>{w();try{let n=YX(e),a=await vc().mfaTOTPVerifySetup(r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):T(i(Ma.ENROLL_ERROR))}catch(e){let t=b(e,i(Ma.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(Ma.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(Ma.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(Ma.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)(OF,{children:(0,$.jsxs)(FF,{className:`space-y-2 pt-4`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:i(Ma.TOTP_BACKUP_CODES)}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:f.map((e,t)=>(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted px-2 py-1 rounded text-center`,children:e},t))}),(0,$.jsxs)(VX,{className:`flex items-center gap-2 cursor-pointer mt-2`,children:[(0,$.jsx)(DI,{checked:m,onCheckedChange:e=>h(e===!0)}),(0,$.jsx)(Z,{className:`text-xs`,children:i(Ma.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(Ma.TOTP_VERIFY_LABEL)}),(0,$.jsx)(nE,{schema:ps,defaultValues:{code:``},onSubmit:E,validationMode:ta.ON_BLUR,disabled:r||D,onFormReady:C,labels:{fields:{code:i(Ma.TOTP_VERIFY_LABEL)}},layoutTemplate:S},`totp-enrollment-verify`)]}),g&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:g})})]})};RX(hs.TOTP,XX);function Rye(e){return e?{[qu.AUTH_SESSION_ID]:e}:void 0}RX(hs.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=ap(),u=typeof window<`u`&&!!window.PublicKeyCredential,d=(0,Q.useCallback)(async()=>{o(!0),c(null);try{let n=Rye(e),r=await vc().passkeyRegisterOptions(n?{headers:n}:void 0),i=await fp({optionsJSON:r});t((await vc().passkeyRegisterVerify({response:i},n?{headers:n}:void 0)).enrollmentSession)}catch(e){let t=e?.name===`NotAllowedError`?i(Ma.PASSKEY_CANCELLED):l(e,i(Ma.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(Ma.PASSKEY_DESCRIPTION)}),s&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:s})}),(0,$.jsx)(X,{className:`w-full`,onClick:d,disabled:a||r,children:i(a?Ma.PASSKEY_REGISTERING:Ma.PASSKEY_REGISTER_BUTTON)})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:i(Ma.PASSKEY_UNSUPPORTED)})})})});function ZX(e){return e?{[qu.AUTH_SESSION_ID]:e}:void 0}var QX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=ap(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`phoneNumber`,submitLabel:i(Ma.PHONE_SEND_CODE),submittingLabel:i(Ma.PHONE_SENDING),fieldProps:{type:`tel`,placeholder:`+1 555 123 4567`,autoFocus:!0}}),[i]),h=(0,Q.useMemo)(()=>()=>(0,$.jsx)(OX,{fieldName:`code`,submitLabel:i(Ma.PHONE_VERIFY_BUTTON),submittingLabel:i(Ma.PHONE_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),g=(0,Q.useCallback)(e=>{a.current=e},[]),_=(0,Q.useCallback)(e=>{o.current=e},[]),v=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),y=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),b=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]),x=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),S=(0,Q.useCallback)(async(t,r)=>{let a=t.trim();if(a){p(!0),r===`phone`?v():y();try{let t=ZX(e);await vc().phoneVerifySend(a,t?{headers:t}:void 0),l(a),d(!0)}catch(e){let t=s(e,i(Ma.ENROLL_ERROR));r===`phone`?b(t):x(t),n(t)}finally{p(!1)}}},[e,n,i,s,v,y,b,x]),C=(0,Q.useCallback)(async e=>{await S(e.phoneNumber,`phone`)},[S]),w=(0,Q.useCallback)(async()=>{await S(c,`code`)},[c,S]),T=(0,Q.useCallback)(async r=>{y();try{let n=ZX(e),a=await vc().phoneVerifyConfirm(c.trim(),r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):x(i(Ma.ENROLL_ERROR))}catch(e){let t=s(e,i(Ma.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(Ma.PHONE_CODE_SENT)}),(0,$.jsx)(nE,{schema:bre,defaultValues:{code:``},onSubmit:T,validationMode:ta.ON_BLUR,disabled:f||r,onFormReady:_,labels:{fields:{code:i(Ma.PHONE_CODE_LABEL)}},layoutTemplate:h},`phone-enrollment-verify`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:w,disabled:f,children:i(Ma.PHONE_RESEND)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(Ma.PHONE_DESCRIPTION)}),(0,$.jsx)(nE,{schema:Tne,defaultValues:{phoneNumber:c},onSubmit:C,validationMode:ta.ON_BLUR,disabled:f||r,onFormReady:g,labels:{fields:{phoneNumber:i(Ma.PHONE_NUMBER_LABEL)}},layoutTemplate:m},`phone-enrollment-start`)]})};RX(hs.SMS_OTP,QX);var zye={[hs.SMS_OTP]:Zo.SMS_OTP_TITLE,[hs.EMAIL_OTP]:Zo.EMAIL_OTP_TITLE,[hs.TOTP]:Zo.TOTP_TITLE,[hs.PASSKEY]:Zo.PASSKEY_TITLE},$X=({sessionId:e,sessionEmail:t=``})=>{let{getSessionState:n,auth:r}=fm(),i=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_MFA_CHALLENGE,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:a,isReady:o}=K({component:i}),s=cg(),c=e=>a(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,e),l=(0,Q.useMemo)(()=>pm(a,B.PUBLIC_LAYOUTS_USER_AUTH),[a]),u=(0,Q.useMemo)(()=>L(s.search),[s.search]),d=(0,Q.useMemo)(()=>fi(Ln.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(s.search),[s.search]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!C.current&&e&&(C.current=!0,n(e).then(e=>{let t=new Set(e.usableSecondFactorMethods||[]),n=(e.availableSecondFactorMethods||[]).filter(e=>t.has(e.method)).filter(e=>IX[e.method]);n.length===0?(e.availableEnrollmentMethods||[]).filter(e=>LX[e]).length>0?S(!0):b(`no_methods`):(m(n),n.length===1&&g(n[0].method))}).catch(e=>{let t=e?.response?.status;b(t===404||t===410?`expired`:`generic`)}))},[e,n]);let w=(0,Q.useCallback)(e=>{},[]),T=(0,Q.useCallback)(e=>{v(e)},[]),E=(0,Q.useCallback)(()=>{g(null),v(null)},[]),D=Fp(r,u);if(D)return(0,$.jsx)(Uh,{to:D,replace:!0});if(r.accessToken&&!r.isLoading)return(0,$.jsx)(Uh,{to:f,replace:!0});if(x&&e)return(0,$.jsx)(Uh,{to:fi(`${Ln.enrollmentRequired}?sessionId=${encodeURIComponent(e)}&email=${encodeURIComponent(t)}`,u),replace:!0});if(!o)return null;if(!e||y){let e={expired:Zo.ERROR_EXPIRED,no_methods:Zo.ERROR_NO_METHODS,generic:Zo.ERROR_GENERIC},t=y?e[y]:Zo.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(Zo.TITLE)})}),(0,$.jsx)(AD,{variant:y===`no_methods`?`default`:`destructive`,children:(0,$.jsx)(MD,{children:c(t)})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:d,children:c(Zo.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)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`text-muted-foreground`,children:c(Zo.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(Zo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto text-muted-foreground`,children:c(Zo.SUB_TITLE)})]}),!h&&p.length>1&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c(Zo.SELECT_METHOD)}),(0,$.jsx)(BX,{layout:zX.LIST,methods:p.map(e=>e.method),labelFor:e=>{let t=zye[e];return t?c(t):e},onSelect:g})]}),h&&(()=>{let n=IX[h];if(!n)return null;let i=p.find(e=>e.method===h);if(!i)return null;let a={sessionId:e,email:t,methodConfig:i,onSuccess:w,onError:T,factorLevel:`second`,isLoading:r.isLoading,t:l,authRedirectTarget:u};return(0,$.jsx)(n,{...a})})(),_&&!h&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:_})}),h&&p.length>1&&(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:E,children:c(Zo.CHANGE_METHOD)})}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:d,children:c(Zo.BACK_TO_LOGIN)})})]})};function eZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,`Auth_MfaChallenge`)(e);return(0,$.jsx)(n,{...t})}var Bye=()=>{let[e]=ih(),t=e.get(`sessionId`),n=e.get(`email`)||``;return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(eZ,{sessionId:t,sessionEmail:n})})},tZ={[hs.TOTP]:Ma.TOTP_TITLE,[hs.PASSKEY]:Ma.PASSKEY_TITLE,[hs.SMS_OTP]:Ma.PHONE_TITLE},nZ=e=>{let{auth:t,completeEnrollmentSession:n,getSessionState:r,adoptPendingMfaSession:i}=fm(),{logout:a}=sg(),{tComponent:o,isReady:s}=K({component:B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED}),c=nh(),l=cg(),u=e=>o(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e),d=(0,Q.useMemo)(()=>L(l.search),[l.search]),{urlSessionId:f,urlEmail:p}=(0,Q.useMemo)(()=>{let e=new URLSearchParams(l.search);return{urlSessionId:e.get(`sessionId`),urlEmail:e.get(`email`)||``}},[l.search]),[m]=(0,Q.useState)(()=>toe()),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&&Xae()};r(h).then(t=>{i(h,t)||e()}).catch(t=>{let n=t?.response?.status;(n===404||n===410)&&e()}).finally(()=>y(!0))},[_,h,m,r,i]);let x=(0,Q.useMemo)(()=>fi(Ln.login,d),[d]),S=(0,Q.useMemo)(()=>Xt(l.search),[l.search]),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),k=(0,Q.useMemo)(()=>t.availableEnrollmentMethods.filter(e=>LX[e]),[t.availableEnrollmentMethods]),A=(0,Q.useMemo)(()=>{let e=t.mfaSessionId;if(!e)return fi(Ln.mfaChallenge,d);let n=t.identification?.email||g;return fi(`${Ln.mfaChallenge}?sessionId=${e}&email=${encodeURIComponent(n)}`,d)},[t.mfaSessionId,t.identification?.email,g,d]),j=(0,Q.useCallback)(e=>{O(null),n(e)||(E(!0),setTimeout(()=>{c(A,{replace:!0})},1200))},[c,A,n]),M=(0,Q.useCallback)(e=>{O(e)},[]),N=Fp(t,d);if(N)return(0,$.jsx)(Uh,{to:N,replace:!0});if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Uh,{to:S,replace:!0});if(!t.mfaRequired)return _&&!v?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(Uh,{to:x,replace:!0});let P=t.usableSecondFactorMethods.length>0;if(t.mfaSessionId&&k.length===0&&P)return(0,$.jsx)(Uh,{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(Ma.TITLE)})}),(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:u(Ma.NO_METHODS_AVAILABLE)})}),(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Ma.LOGOUT_BUTTON)})]});if(T)return(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:u(Ma.ENROLL_SUCCESS)})}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:u(Ma.LOADING)})]});let F=C?LX[C]:null;return(0,$.jsxs)(`div`,{className:`space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:u(Ma.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:u(Ma.DESCRIPTION)})]}),D&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:D})}),!C&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:u(Ma.SELECT_METHOD)}),(0,$.jsx)(BX,{layout:zX.LIST,methods:k,labelFor:e=>u(tZ[e]||e),onSelect:e=>{w(e),O(null)}})]}),C&&F&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:()=>{w(null),O(null)},children:`←`}),(0,$.jsx)(Z,{className:`text-sm font-medium`,children:u(tZ[C]||C)})]}),(0,$.jsx)(F,{sessionId:t.mfaSessionId||void 0,onComplete:j,onError:M,isLoading:!1,t:u})]}),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(Ma.LOGOUT_BUTTON)})})]})};function rZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,`Auth_EnrollmentRequired`)(e);return(0,$.jsx)(n,{...t})}var Vye=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(rZ,{})}),iZ=B.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,aZ=Q.createContext(null),Hye=()=>{let{tComponent:e,isReady:t}=K({component:iZ}),n=Q.useContext(aZ);return t?(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`organizationName`}),n&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:n})}),(0,$.jsx)(nO,{label:e(iZ,lo.SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null},Uye=()=>{let{tComponent:e,isReady:t}=K({component:iZ}),n=Q.useContext(aZ);return t?(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`firstName`}),(0,$.jsx)(QL,{name:`lastName`}),n&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:n})}),(0,$.jsx)(nO,{label:e(iZ,lo.PROFILE_SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null};function oZ(e){let t=e?.pendingObligations;if(!Array.isArray(t))return[tu.ORGANIZATION];let n=new Set(Object.values(tu));return t.filter(e=>typeof e==`string`&&n.has(e))}var sZ=e=>{let{auth:t,completeOrganizationOnboarding:n,completeProfileOnboarding:r,abandonOrganizationOnboarding:i,getSessionState:a}=fm(),{tComponent:o,isReady:s}=K({component:iZ}),c=e=>o(iZ,e),l=ap(),u=cg(),d=nh(),f=(0,Q.useMemo)(()=>L(u.search),[u.search]),p=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),m=(0,Q.useMemo)(()=>fi(Ln.login,f),[f]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=t.onboardingSessionId;if(!e){v(null);return}let n=!1;return a(e).then(e=>{n||v(oZ(e))}).catch(()=>{n||v([tu.ORGANIZATION])}),()=>{n=!0}},[t.onboardingSessionId]);let y=_?.[0],b=(0,Q.useCallback)(async e=>{g(null);try{let t=await r(e.firstName.trim(),e.lastName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(lo.COMPLETION_ERROR)))}},[r,c]),x=(0,Q.useCallback)(async e=>{g(null);try{let t=await n(e.organizationName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(lo.COMPLETION_ERROR)))}},[n,c]),S=(0,Q.useCallback)(()=>{i(),d(m,{replace:!0})},[i,d,m]);if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Uh,{to:p,replace:!0});if(!s)return null;if(!t.onboardingSessionId)return(0,$.jsxs)(`div`,{className:`space-y-group py-section text-center`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(SY,{children:c(lo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(lo.SESSION_EXPIRED)})]}),(0,$.jsx)(Z,{className:`text-sm`,children:(0,$.jsx)(_X,{href:m,children:c(lo.SIGN_IN_AGAIN_LINK)})})]});if(_===null)return null;let C=(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:J.GHOST,onClick:S,children:c(lo.USE_DIFFERENT_ACCOUNT)})});return y===tu.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(lo.PROFILE_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(lo.PROFILE_DESCRIPTION)})]}),(0,$.jsx)(aZ.Provider,{value:h,children:(0,$.jsx)(nE,{schema:qte,defaultValues:{firstName:``,lastName:``},onSubmit:b,validationMode:ta.ON_BLUR,disabled:t.isLoading,layoutTemplate:Uye,labels:{fields:{firstName:c(lo.FIRST_NAME),lastName:c(lo.LAST_NAME)}}},tu.PROFILE_NAMES)}),C]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(SY,{children:c(lo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(lo.DESCRIPTION)})]}),(0,$.jsx)(aZ.Provider,{value:h,children:(0,$.jsx)(nE,{schema:Rte,defaultValues:{organizationName:``},onSubmit:x,validationMode:ta.ON_BLUR,disabled:t.isLoading,layoutTemplate:Hye,labels:{fields:{organizationName:c(lo.ORGANIZATION_NAME)}}},tu.ORGANIZATION)}),C]})};function cZ({preset:e=q.DEFAULT,...t}){let n=G(iZ,`Auth_OrganizationOnboarding`)(e);return(0,$.jsx)(n,{...t})}var Wye=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(cZ,{})}),lZ=({label:e})=>{let{appConfig:t}=Tu(),n=cie(t.compliance,_ae.PRIVACY_NOTICE,new Date().toISOString());return n===void 0?null:(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:n,external:!0,"data-privacy-notice-link":``,children:e})})},uZ=rs.getLogger(),dZ=uZ.debugByType(`Auth_Main`);uZ.setDebugTypeLogging(`Auth_Main`,!1);var Gye=()=>{let{auth:e}=sg(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`email`}),e.error&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:e.error})}),(0,$.jsx)(nO,{label:(e=>t(B.PUBLIC_LAYOUTS_USER_AUTH,e))(as.CONTINUE),submittingLabel:`…`,fullWidth:!0})]}):null};function Kye(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 qye=3e3,Jye={[Xc.SAML_LOGIN_FAILED]:{label:as.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Xc.SAML_AUTH_FAILED]:{label:as.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Xc.MISSING_PARAMS]:{label:as.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Xc.OAUTH_FAILED]:{label:as.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Xc.SAML_SLO_FAILED]:{label:as.PROVIDER_SIGN_OUT_FAILED,variant:`warning`}},fZ=({})=>{let{auth:e,identifyByEmail:t,initiateOAuth2Login:n}=sg(),{signInWithPasskey:r,endedSessionReason:i}=fm(),a=Xx(),o=cg(),s=(0,Q.useMemo)(()=>MX({publicProviders:a.globalAuth?.socialOAuth2Providers}),[a.globalAuth?.socialOAuth2Providers]),c=(0,Q.useMemo)(()=>cb(s.map(e=>e.displayNameLabelKey)),[s]),{t:l,tComponent:u,isReady:d}=K({component:B.PUBLIC_LAYOUTS_USER_AUTH,keys:c}),f=e=>u(B.PUBLIC_LAYOUTS_USER_AUTH,e),p=Ln,m=(0,Q.useMemo)(()=>Xt(o.search),[o.search]),h=(0,Q.useMemo)(()=>L(o.search),[o.search]),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams(o.search).get(`error`);if(!e)return null;let{label:t,variant:n}=Jye[e]??{label:as.PROVIDER_SIGN_IN_FAILED,variant:`destructive`};return{text:u(B.PUBLIC_LAYOUTS_USER_AUTH,t),variant:n}},[o.search,u]),_=i===j.ACCOUNT_NOT_ACTIVE?{text:f(as.ACCOUNT_NOT_ACTIVE_NOTICE),variant:`destructive`}:i===j.SESSION_ENDED?{text:f(as.SESSION_ENDED_NOTICE),variant:`info`}:null,v=(0,Q.useMemo)(()=>fi(p.passwordLost,h),[h,p.passwordLost]),y=(0,Q.useMemo)(()=>fi(p.register,h),[h,p.register]),[b,x]=(0,Q.useState)(null);SX({mfaRequired:e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:e.identification?.email,authRedirectTarget:h});let S=!!e.identification,C=e.identification?.sessionId||``,w=e.identification?.email||``,T=(0,Q.useMemo)(()=>!S||!e.identification?.userExists?[]:(e.identification?.firstFactorMethods||[]).filter(e=>IX[e.method]),[S,e.identification]),E=(0,Q.useMemo)(()=>{if(T.length===0)return null;let t=e.identification?.defaultFirstFactorMethod;return t&&IX[t]?t:T[0].method},[T,e.identification?.defaultFirstFactorMethod]),D=b||E,O=T.filter(e=>e.method!==D),k=T.some(e=>e.method===D&&e.enforcedFirstFactor),A=async e=>{try{await n(e,h)}catch{}},M=async e=>{await t(e.email)},N=(0,Q.useCallback)(e=>{},[]),P=(0,Q.useCallback)(e=>{},[]),F=s.length>0,I=!S||!e.identification?.userExists,ee=F&&I,R=(0,Q.useMemo)(()=>{let e=Nu(a.userTypeAuth?.authMethodsEnabled);return F||e.delete(hs.EXTERNAL_OAUTH2),e},[F,a.userTypeAuth?.authMethodsEnabled]),z=!a.userTypeAuth?.authMethodsEnabled||R.size>0,te=ee&&z,ne=lte(a.userTypeAuth?.authMethodsEnabled).has(hs.PASSKEY)&&e.purpose!==Ps.REAUTH&&typeof window<`u`&&!!window.PublicKeyCredential,re=I&&!z&&!ne&&!ee,ie=!I&&T.length===0,ae=(0,Q.useRef)(!1),[oe,se]=(0,Q.useState)(0),ce=(0,Q.useCallback)(async()=>{ae.current=!0;try{await r(Tm.MODAL)}catch{}finally{ae.current=!1,se(e=>e+1)}},[r]),le=(0,Q.useRef)(r);le.current=r,(0,Q.useEffect)(()=>{if(!d||!I||!ne)return;let e=!1;return(async()=>{if(await goe())for(await Kye(qye);!e;)try{await le.current(Tm.CONDITIONAL);return}catch(e){if(!(e instanceof Dm)||ae.current)return}})(),()=>{e=!0,eoe.cancelCeremony()}},[d,I,ne,oe]),(0,Q.useEffect)(()=>{dZ(`Render isReady=${d} accessToken=${e.accessToken?`yes`:`no`} authLoading=${e.isLoading?`yes`:`no`} identification=${S?`yes`:`no`} showIdentify=${I?`yes`:`no`} activeMethod=${D??`none`}`)},[d,e.accessToken,e.isLoading,S,I,D]);let ue=Fp(e,h);return ue?(0,$.jsx)(Uh,{to:ue,replace:!0}):e.accessToken?(0,$.jsx)(Uh,{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===Ps.REAUTH?f(as.REAUTH_TITLE):f(as.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:e.purpose===Ps.REAUTH?f(as.REAUTH_SUB_TITLE):f(as.SUB_TITLE)})]}),ee&&(0,$.jsx)(FX,{providers:s,onProviderClick:A,isLoading:e.isLoading,continueWithLabel:f(as.CONTINUE_WITH),translate:l,dividerLabel:f(as.DIVIDER_OR),showDivider:te}),!e.error&&_&&(0,$.jsx)(AD,{variant:_.variant,"data-session-ended-notice":i??void 0,children:(0,$.jsx)(MD,{children:_.text})}),!e.error&&g&&(0,$.jsx)(AD,{variant:g.variant,children:(0,$.jsx)(MD,{children:g.text})}),I&&z&&(0,$.jsx)(nE,{schema:Nre,defaultValues:{email:``},onSubmit:M,validationMode:ta.ON_BLUR,disabled:e.isLoading,labels:{fields:{email:f(as.EMAIL_ADDRESS)}},layoutTemplate:Gye},`identify`),I&&ne&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:f(as.DIVIDER_OR)}),(0,$.jsxs)(X,{variant:J.OUTLINE,className:`w-full`,labelOverflow:Zd.WRAP,onClick:ce,disabled:e.isLoading,"data-passkey-sign-in":``,children:[(0,$.jsx)(DX,{method:hs.PASSKEY}),f(as.PASSKEY_SIGN_IN)]})]}),D&&!I&&(()=>{let t=IX[D];if(!t)return null;let n=T.find(e=>e.method===D);if(!n)return null;let r={sessionId:C,email:w,methodConfig:n,onSuccess:N,onError:P,factorLevel:`first`,isLoading:e.isLoading,t:f,authRedirectTarget:h};return(0,$.jsx)(t,{...r})})(),k&&O.length>0&&!I&&(0,$.jsx)(Z,{children:f(as.ORGANIZATION_ENFORCED_METHOD)}),O.length>0&&!I&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:f(as.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(BX,{methods:O.map(e=>e.method),labelFor:e=>EX(e,{offeredMethod:O.find(t=>t.method===e),socialProviders:s,continueWithTemplate:f(as.CONTINUE_WITH),translateLabel:e=>f(e),resolveSocialProviderLabel:e=>jX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:NX[e.providerRef]?.label,translate:l})}),onSelect:x,disabled:e.isLoading})]}),re&&(0,$.jsx)(AD,{"data-auth-no-entry-point":``,children:(0,$.jsx)(MD,{children:f(as.NO_SIGN_IN_METHOD_AVAILABLE)})}),ie&&(0,$.jsx)(AD,{"data-auth-no-method-for-address":``,children:(0,$.jsx)(MD,{children:f(as.NO_SIGN_IN_METHOD_FOR_ADDRESS)})}),!z&&!S&&e.error&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:e.error})}),(0,$.jsxs)(`div`,{className:`text-center space-y-item pt-group`,children:[D===hs.PASSWORD&&!I&&(0,$.jsx)(Z,{children:(0,$.jsx)(_X,{href:v,children:f(as.FORGOT_PASSWORD)})}),e.purpose!==Ps.REAUTH&&a.registrationConfig.publicRegistrationAvailable&&(0,$.jsxs)(Z,{children:[f(as.NO_ACCOUNT),` `,(0,$.jsx)(_X,{href:y,children:f(as.SIGNUP_LINK)})]}),(0,$.jsx)(lZ,{label:f(as.PRIVACY_NOTICE_LINK)})]})]}):null};function pZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_AUTH,`Auth_Main`)(e);return dZ(`Resolve wrapper preset=${e} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var mZ=rs.getLogger(),Yye=mZ.debugByType(`AuthPage_Main`);mZ.setDebugTypeLogging(`AuthPage_Main`,!1);var Xye=()=>{let{auth:e}=fm(),{isReady:t}=K({component:[B.PUBLIC_LAYOUTS_USER_AUTH,B.LOW_LEVEL_FORM_MESSAGE],keys:[`errors_validation`]});return Yye(`Render ready=${t}`),t?(0,$.jsx)(pX,{useCardLayout:!0,organizationBranding:e.identification?.organizationBranding,children:(0,$.jsx)(pZ,{})}):(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)($y,{size:48})})},Zye=60,hZ=({token:e,email:t})=>{let{auth:n,handleEmailVerification:r}=fm(),{tComponent:i,isReady:a}=K({component:B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL}),o=ap(),s=e=>i(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,e),c=Ln.login,[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(t||``),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(null),S=(0,Q.useCallback)(()=>{e&&t&&r(e,t).catch(e=>{u(o(e,s(fl.ERROR_MESSAGE)))})},[e,t]);(0,Q.useEffect)(()=>{e&&t&&!d.current&&(d.current=!0,n.accessToken&&!n.isLoading?p(!0):S())},[e,t]),(0,Q.useEffect)(()=>{if(v<=0)return;let e=setInterval(()=>{y(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[v]),SX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:t,authRedirectTarget:void 0});let C=(0,Q.useCallback)(async()=>{if(!(!m||v>0)){_(`sending`),x(null);try{await vc().resendVerificationEmail(m),_(`sent`),y(Zye)}catch(e){_(`error`),x(o(e,s(fl.ERROR_MESSAGE)))}}},[m,v]),w=Fp(n,void 0);return w?(0,$.jsx)(Uh,{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(fl.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(fl.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(fl.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(fl.SESSION_CONFLICT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(fl.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(fl.SESSION_CONFLICT_VERIFY_BUTTON).replace(`{email}`,t)}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>{window.location.href=Ln.home},children:s(fl.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(fl.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(fl.SUCCESS_MESSAGE)})]}),(0,$.jsx)(Uh,{to:Ln.home,replace:!0})]}):l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(SY,{children:s(fl.ERROR_TITLE)})]}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:l})}),(0,$.jsxs)(`div`,{className:`mt-group space-y-item-sm`,children:[(0,$.jsx)(Z,{className:`text-sm text-center`,children:s(fl.RESEND_DESCRIPTION)}),(0,$.jsxs)(`div`,{className:`flex gap-item-xs`,children:[(0,$.jsx)($M,{name:`__display`,schema:yd(),type:`email`,placeholder:s(fl.RESEND_EMAIL_PLACEHOLDER),value:m,onChange:e=>h(String(e)),disabled:g===`sending`||v>0}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:C,disabled:!m||g===`sending`||v>0,children:g===`sending`?s(fl.RESEND_SENDING):v>0?`${s(fl.RESEND_COOLDOWN)} (${v}s)`:s(fl.RESEND_BUTTON)})]}),g===`sent`&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:s(fl.RESEND_SUCCESS)})}),g===`error`&&b&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:b})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(fl.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)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(SY,{children:s(fl.TITLE)}),(0,$.jsxs)(Z,{className:`max-w-sm mx-auto`,children:[s(fl.VERIFYING),` `,t]})]})}):null};function gZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,`Auth_ConfirmEmail`)(e);return(0,$.jsx)(n,{...t})}var Qye=()=>{let[e]=ih(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(gZ,{token:t,email:n})})},_Z={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0},vZ=({fieldName:e,policy:t,t:n,blocklistContext:r})=>{let{watch:i}=UC(),a=i(e)||``,o=(0,Q.useMemo)(()=>{if(!a)return[];let e=[];return e.push({label:n(ol.MIN_LENGTH).replace(`{minLength}`,String(t.minLength)),passed:a.length>=t.minLength}),e.push({label:n(ol.MAX_LENGTH).replace(`{maxLength}`,String(t.maxLength)),passed:a.length<=t.maxLength}),t.requireUppercase&&e.push({label:n(ol.UPPERCASE),passed:/[A-Z]/.test(a)}),t.requireLowercase&&e.push({label:n(ol.LOWERCASE),passed:/[a-z]/.test(a)}),t.requireNumbers&&e.push({label:n(ol.NUMBER),passed:/\d/.test(a)}),t.requireSpecialChars&&e.push({label:n(ol.SPECIAL_CHAR),passed:/[^A-Za-z0-9]/.test(a)}),e.push({label:n(ol.BLOCKLISTED),passed:!Ve(a,r)}),e},[a,t,n,r]);return!a||o.length===0?null:(0,$.jsx)(`ul`,{className:`space-y-1 text-xs mt-item-xs`,children:o.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5 ${e.passed?`text-success-subtle-foreground`:`text-muted-foreground`}`,children:[e.passed?(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})}):(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`circle`,{cx:`10`,cy:`10`,r:`3`})}),(0,$.jsx)(`span`,{children:e.label})]},t))})};function yZ({email:e}){return e?(0,$.jsx)(`input`,{"data-testid":`credential-username-autofill`,type:`email`,name:`email`,autoComplete:`username`,value:e,readOnly:!0,tabIndex:-1,className:`sr-only`}):null}function bZ(e,t,n){return e.map(e=>{let r=t(e);return e===hu.MIN_LENGTH?r.replace(`{minLength}`,String(n.minLength??8)):e===hu.MAX_LENGTH?r.replace(`{maxLength}`,String(n.maxLength??128)):r})}function xZ(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;if(r.message!==ql.VALIDATION_PASSWORD_POLICY_VIOLATION)return null;let i=r.context,a=i?.violations;return!Array.isArray(a)||a.length===0?null:bZ(a,t,{minLength:i.minLength??n.minLength??8,maxLength:i.maxLength??n.maxLength??128}).join(`. `)}var $ye=new Set([hs.PASSWORD,hs.ORG_SAML,hs.ORG_OPENID_CONNECT,hs.EXTERNAL_OAUTH2,hs.MAGIC_LINK,hs.PASSKEY]),ebe=({invitationEmail:e,passwordPolicy:t})=>{let{formState:n}=UC(),{tComponent:r,isReady:i}=K({component:B.PUBLIC_LAYOUTS_USER_INVITATION}),a=e=>r(B.PUBLIC_LAYOUTS_USER_INVITATION,e);return i?(0,$.jsxs)(tA,{children:[(0,$.jsx)(yZ,{email:e}),(0,$.jsx)(QL,{name:`firstName`}),(0,$.jsx)(QL,{name:`lastName`}),(0,$.jsx)(QL,{name:`password`}),(0,$.jsx)(QL,{name:`confirmPassword`}),(0,$.jsx)(vZ,{fieldName:`password`,policy:t,t:a}),n.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:n.errors.root.message})}),(0,$.jsx)(nO,{label:a(Hc.ACCEPT_INVITATION),submittingLabel:a(Hc.ACCEPTING_INVITATION),fullWidth:!0})]}):null},tbe=({invitationEmail:e,t,tAuth:n})=>{let{formState:r}=UC();return(0,$.jsxs)(tA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(QL,{name:`firstName`}),(0,$.jsx)(QL,{name:`lastName`}),r.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:r.errors.root.message})}),(0,$.jsx)(nO,{label:n(as.MAGIC_LINK_SEND),submittingLabel:n(as.MAGIC_LINK_SEND),fullWidth:!0})]})},nbe=({invitationEmail:e,disabled:t,onSubmit:n,t:r,tAuth:i})=>{let a=(0,Q.useRef)(null),o=ap(),s=(0,Q.useMemo)(()=>ci.pick({firstName:!0,lastName:!0}),[]),c=(0,Q.useCallback)(async e=>{a.current?.clearErrors(`root`);try{await n(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0)}catch(e){a.current?.setError(`root`,{type:`server`,message:o(e,r(Hc.UNEXPECTED_ERROR))})}},[n,r,o]);return(0,$.jsx)(nE,{schema:s,defaultValues:{firstName:``,lastName:``},onSubmit:c,validationMode:ta.ON_BLUR,disabled:t,onFormReady:e=>{a.current=e},labels:{fields:{firstName:r(Hc.FIRST_NAME),lastName:r(Hc.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(tbe,{invitationEmail:e,t:r,tAuth:i})})},rbe=({invitationEmail:e,error:t,t:n})=>(0,$.jsxs)(tA,{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(Hc.PASSKEY_DESCRIPTION)}),(0,$.jsx)(QL,{name:`firstName`}),(0,$.jsx)(QL,{name:`lastName`}),t&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:t})}),(0,$.jsx)(nO,{label:n(Hc.PASSKEY_CREATE),submittingLabel:n(Hc.PASSKEY_CREATING),fullWidth:!0})]}),ibe=({invitationEmail:e,disabled:t,error:n,onSubmit:r,t:i})=>{let a=typeof window<`u`&&!!window.PublicKeyCredential,o=(0,Q.useMemo)(()=>ci.pick({firstName:!0,lastName:!0}),[]);return a?(0,$.jsx)(nE,{schema:o,defaultValues:{firstName:``,lastName:``},onSubmit:e=>r(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0),validationMode:ta.ON_BLUR,disabled:t,labels:{fields:{firstName:i(Hc.FIRST_NAME),lastName:i(Hc.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(rbe,{invitationEmail:e,error:n,t:i})}):(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:i(Hc.PASSKEY_UNAVAILABLE_HINT)})})},SZ=({token:e,email:t})=>{let{auth:n,acceptInvitation:r}=fm(),{handleError:i}=ep(),a=ap(),o=Xx(),s=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_USER_INVITATION,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:c,isReady:l}=K({component:s}),u=cg(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),I=(0,Q.useCallback)(e=>c(B.PUBLIC_LAYOUTS_USER_INVITATION,e),[c]),ee=(0,Q.useCallback)(e=>c(B.PUBLIC_LAYOUTS_USER_AUTH,e),[c]),R=(0,Q.useMemo)(()=>pm(c,B.PUBLIC_LAYOUTS_USER_AUTH),[c]),z=Ln.login,te=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),ne=(0,Q.useMemo)(()=>L(u.search),[u.search]),re=O?.inviteeEmail??t,ie=(0,Q.useMemo)(()=>O?.passwordPolicy??o.passwordPolicy??_Z,[O?.passwordPolicy,o.passwordPolicy]),ae=(0,Q.useMemo)(()=>ci.refine(e=>!e.password||e.password===e.confirmPassword,{message:I(Hc.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[I]),oe=(0,Q.useCallback)(e=>{d.current=e},[]);(0,Q.useEffect)(()=>{if(!e||n.accessToken){j(!1);return}let t=!1;return j(!0),N(null),vc().getInvitationInfo(e).then(e=>{t||k(e)}).catch(e=>{t||N(a(e,I(Hc.UNEXPECTED_ERROR)))}).finally(()=>{t||j(!1)}),()=>{t=!0}},[e,n.accessToken]);let se=(0,Q.useMemo)(()=>(O?.availableFirstFactorMethods??[]).filter(e=>$ye.has(e.method)),[O]),ce=se.length>0,le=n.isLoading||E||v,ue=(0,Q.useMemo)(()=>se[0]?.method??null,[se]),de=P??ue,fe=se.filter(e=>e.method!==de);SX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:re||void 0,authRedirectTarget:ne});let pe=(0,Q.useCallback)(async t=>{if(d.current?.clearErrors(`root`),t.password){let e=st.validatePasswordAgainstPolicy(t.password,ie);if(!e.valid){d.current?.setError(`root`,{type:`policy`,message:bZ(e.violations,I,ie).join(`. `)});return}}let n=e=>e?.trim()||void 0;try{(await r({invitationToken:e,firstName:n(t.firstName),lastName:n(t.lastName),password:t.password||void 0}))?.signInRequired&&T(!0)}catch(e){d.current?.setError(`root`,{type:`server`,message:a(e,I(Hc.UNEXPECTED_ERROR))})}},[r,ie,I,e,a]),me=(0,Q.useCallback)(async(t,n)=>{x(null),y(!0);try{let i=await r({invitationToken:e,firstName:t,lastName:n,credentialMethod:hs.PASSKEY});if(i?.signInRequired){T(!0);return}let a=i?.passkeyRegistrationOptions;if(a)try{let e=await fp({optionsJSON:a});await vc().passkeyRegisterVerify({response:e})}catch{}}catch(e){x(a(e,I(Hc.UNEXPECTED_ERROR)))}finally{y(!1)}},[r,e,I,a]),he=(0,Q.useCallback)(async(t,n)=>{D(!0);try{(await vc().acceptInvitation({invitationToken:e,firstName:t,lastName:n,credentialMethod:hs.MAGIC_LINK,redirect:ne})).nextStep===eie.SIGN_IN_REQUIRED?T(!0):C(!0)}catch(e){throw i(e,`Invitation acceptance failed (magic link)`,{credentialMethod:hs.MAGIC_LINK}),e}finally{D(!1)}},[e,i,ne]),ge=(0,Q.useCallback)(async()=>{if(_(null),!e)_(I(Hc.INVALID_LINK));else{p(!0);try{await vc().rejectInvitation({invitationToken:e}),h(!0)}catch(e){_(a(e,I(Hc.UNEXPECTED_ERROR)))}finally{p(!1)}}},[I,e,a]),_e=(0,Q.useCallback)(e=>{},[]),ve=(0,Q.useCallback)(e=>{},[]);return n.accessToken&&!v?(0,$.jsx)(Uh,{to:te,replace:!0}):l?e?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.DECLINE_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Hc.DECLINE_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Hc.CONTINUE_LINK)})})]}):w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.SIGN_IN_REQUIRED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Hc.SIGN_IN_REQUIRED_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Hc.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(as.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:ee(as.MAGIC_LINK_SENT_DESCRIPTION)}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Hc.LOGIN_LINK)})})]}):A?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-group`,children:(0,$.jsx)($y,{size:40})}):M||!O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:M||I(Hc.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Hc.LOGIN_LINK)})})]}):O.managementMode===Ure.SCIM?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.SCIM_MANAGED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Hc.SCIM_MANAGED_MESSAGE)}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),g&&(0,$.jsx)(AD,{variant:`destructive`,className:`mb-group`,children:(0,$.jsx)(MD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ge,disabled:f,className:`w-full`,children:I(f?Hc.DECLINING_INVITATION:Hc.DECLINE_INVITATION)}),(0,$.jsx)(vX,{href:z,children:I(Hc.LOGIN_LINK)}),(0,$.jsx)(lZ,{label:ee(as.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Hc.SUB_TITLE)}),O.organizationName&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:O.organizationName}),re&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:re})]}),ce?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:I(Hc.METHOD_CHOICE_HINT)}),(()=>{if(!de)return null;let e=se.find(e=>e.method===de);if(!e)return null;if(de===hs.PASSWORD)return(0,$.jsx)(nE,{schema:ae,defaultValues:{firstName:``,lastName:``,password:``,confirmPassword:``},onSubmit:pe,validationMode:ta.ON_BLUR,disabled:n.isLoading||f,onFormReady:oe,labels:{fields:{firstName:I(Hc.FIRST_NAME),lastName:I(Hc.LAST_NAME),password:I(Hc.PASSWORD),confirmPassword:I(Hc.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(ebe,{invitationEmail:re,passwordPolicy:ie})});if(de===hs.MAGIC_LINK)return(0,$.jsx)(nbe,{invitationEmail:re,disabled:n.isLoading||f,onSubmit:he,t:I,tAuth:ee});if(de===hs.PASSKEY)return(0,$.jsx)(ibe,{invitationEmail:re,disabled:n.isLoading||f,error:b,onSubmit:me,t:I});let t=IX[de];if(!t)return null;let r={sessionId:``,email:re??``,methodConfig:e,onSuccess:_e,onError:ve,factorLevel:`first`,isLoading:n.isLoading||f,t:R};return(0,$.jsx)(t,{...r})})(),fe.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:ee(as.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(BX,{methods:fe.map(e=>e.method),labelFor:e=>EX(e,{offeredMethod:fe.find(t=>t.method===e),continueWithTemplate:ee(as.CONTINUE_WITH),translateLabel:e=>ee(e),resolveSocialProviderLabel:e=>e.displayName??e.providerRef}),onSelect:e=>{F(e),x(null)},disabled:le||f})]})]}):(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:I(Hc.NO_METHOD_AVAILABLE_HINT)})}),g&&(0,$.jsx)(AD,{variant:`destructive`,className:`mt-group`,children:(0,$.jsx)(MD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ge,disabled:le||f,className:`w-full`,children:I(f?Hc.DECLINING_INVITATION:Hc.DECLINE_INVITATION)}),(0,$.jsx)(vX,{href:z,children:I(Hc.LOGIN_LINK)}),(0,$.jsx)(lZ,{label:ee(as.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:I(Hc.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(Hc.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:z,children:I(Hc.LOGIN_LINK)})})]}):null};function CZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_INVITATION,`Auth_Invitation`)(e);return(0,$.jsx)(n,{...t})}var abe=()=>{let[e]=ih(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(CZ,{token:t,email:n})})};function obe(e,t,n){if(!t||Object.keys(t).length===0)return;let r,i;for(let t of Object.values(n.resourceConfigurations)){let n=Array.isArray(t.operations)?t.operations:[];for(let a of n)if(a.tokenAuthentication?.types?.includes(e)&&Sn(a.operationFrontendConfig)){r=t,i=a;break}if(i)break}if(!r||!i)return;let a={};for(let[e,r]of Object.entries(t)){let t=n.fieldIdentifierToResourceType[e];t&&(a[t]=r)}return zm.resolveResourceUrl(r,i,a,n.allResourceFieldIdentifiers)?.resolvedUrl??void 0}function sbe(e){return!e||!Dae(e)||e.includes(`..`)||e.includes(`\\`)||e.includes(`://`)||/[<>"]/.test(e)||e.length>256?Ln.home:e}var wZ=({token:e,mode:t=`one-off-session`,returnPathFromUrl:n})=>{let{handleOneOffTokenExchange:r,handleAuthCodeExchange:i,clearCrossFrontendHandoffContext:a,auth:o,tokenStorage:s}=fm(),{registry:c}=lm(),{tComponent:l,isReady:u}=K({component:B.PUBLIC_LAYOUTS_ONE_OFF_SESSION}),d=ap(),f=e=>l(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,e),p=Ln.login,[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(t===`one-off-session`&&!!o.accessToken),y=(0,Q.useMemo)(()=>o.accessToken?t===`cross-frontend-handoff`?sbe(o.crossFrontendHandoffContext?.returnPath??n):o.oneOffContext?obe(o.oneOffContext.tokenType,o.oneOffContext.scopedInitiatorIds,c)??Ln.home:Ln.home:Ln.home,[t,o.oneOffContext,o.accessToken,o.crossFrontendHandoffContext,n,c]);return(0,Q.useEffect)(()=>{g.current||(t===`one-off-session`&&!(s instanceof $p)?(g.current=!0,h(f(Qs.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(Qs.ERROR_GENERIC)))}).finally(()=>{v(!0)})):(g.current=!0,h(f(Qs.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)(Uh,{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(Qs.ERROR_TITLE)})]}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:m})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:p,children:f(Qs.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)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:f(Qs.VERIFYING)})]}):null};function TZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,`Auth_OneOffSession`)(e);return(0,$.jsx)(n,{...t})}var EZ=()=>{let{token:e}=Fm();return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(TZ,{token:e})})},DZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.UPLOADING=`uploading`,e.DONE=`done`,e.FAILED=`failed`})(DZ||={});function OZ(e,t){if(e.length===0||t===``)return!0;let n=t.split(`/`)[0];return e.some(e=>e===t||e===`${n}/*`)}function cbe(e){let t=e,n=t?.status??t?.statusCode??t?.response?.status;return typeof n==`number`?n:void 0}var kZ=({token:e})=>{let{tComponent:t,isReady:n,formatDateTime:r,formatByteSize:i}=K({component:B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT}),a=ap(),o=(0,Q.useCallback)((e,n)=>t(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,e,n),[t]),[s,c]=(0,Q.useState)(DZ.LOADING),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async()=>{if(!e)return f({kind:_a.ERROR_NOT_FOUND,cause:void 0}),c(DZ.FAILED),null;try{let t=await vc().readFileUploadGrantStatus(e);return u(t),t}catch(e){let t=cbe(e)===404?_a.ERROR_NOT_FOUND:_a.ERROR_GENERIC;return f({kind:t,cause:t===_a.ERROR_GENERIC?e:void 0}),c(DZ.FAILED),null}},[e]);(0,Q.useEffect)(()=>{let e=!1;return v().then(t=>{!e&&t&&c(DZ.READY)}),()=>{e=!0}},[v]);let y=(0,Q.useMemo)(()=>l?i(l.constraints.maxBytes):``,[l,i]),b=(0,Q.useCallback)(e=>{e&&l&&(e.size>l.constraints.maxBytes?(m(null),f({kind:_a.ERROR_TOO_LARGE,cause:void 0}),c(DZ.FAILED)):OZ(l.constraints.allowedMimeTypes,e.type)?(f(null),m(e),c(DZ.READY)):(m(null),f({kind:_a.ERROR_TYPE_NOT_ACCEPTED,cause:void 0}),c(DZ.FAILED)))},[l]),x=(0,Q.useCallback)(async()=>{if(e&&l&&p){c(DZ.UPLOADING),g(0);try{await vc().uploadWithFileUploadGrant(l,e,p,{onUploadProgress:e=>g(e<0?0:e)}),await v()&&c(DZ.DONE)}catch(e){f({kind:_a.ERROR_GENERIC,cause:e}),c(DZ.FAILED)}}},[e,l,p,v]),S=(0,Q.useCallback)(()=>{f(null),m(null),g(0),l?c(DZ.READY):(c(DZ.LOADING),v().then(e=>{e&&c(DZ.READY)}))},[l,v]);if(!n)return null;if(s===DZ.LOADING)return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)($y,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(_a.LOADING)})]});if(s===DZ.FAILED&&d){let e=o(_a.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(_a.ERROR_TITLE)})}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsxs)(MD,{children:[o(d.kind,d.kind===_a.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===_a.ERROR_NOT_FOUND?null:(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:S,children:o(_a.RETRY)})})]})}if(!l)return null;if(l.state!==Mu.PENDING){let e=s===DZ.DONE,t=e?_a.SUCCESS_TITLE:l.state===Mu.REDEEMED?_a.STATE_REDEEMED_TITLE:l.state===Mu.EXPIRED?_a.STATE_EXPIRED_TITLE:_a.STATE_REVOKED_TITLE,n=e?_a.SUCCESS_MESSAGE:l.state===Mu.REDEEMED?_a.STATE_REDEEMED:l.state===Mu.EXPIRED?_a.STATE_EXPIRED:_a.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)(AD,{variant:e?`success`:`info`,children:(0,$.jsx)(MD,{children:o(n)})}),l.file?(0,$.jsxs)(`dl`,{className:`mt-group text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(_a.FILE_ID)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{"data-testid":`upload-grant-file-id`,children:l.file.fileId})})]}):null]})}let C=s===DZ.UPLOADING,w=l.constraints.allowedMimeTypes;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:o(_a.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(_a.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(_a.MAX_SIZE)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-max-size`,children:y}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(_a.ACCEPTED_TYPES)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-accepted-types`,children:w.length>0?w.join(`, `):o(_a.ANY_TYPE)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(_a.EXPIRES_AT)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:l.expiresAt,children:r(l.expiresAt)})})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":o(_a.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(_a.DROPZONE_PROMPT)}),(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-choose`,variant:J.OUTLINE,disabled:C,onClick:()=>_.current?.click(),children:o(_a.CHOOSE_FILE)}),(0,$.jsx)(Z,{className:`mt-element text-sm`,"data-testid":`upload-grant-selected-file`,children:p?`${p.name} · ${i(p.size)}`:o(_a.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(_a.UPLOADING,{percent:h}):o(_a.UPLOAD)})})]})};function AZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,`Files_UploadGrantDrop`)(e);return(0,$.jsx)(n,{...t})}var jZ=()=>{let{token:e}=Fm();return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(AZ,{token:e})})},lbe=()=>{let[e]=ih(),t=e.get(`code`)??void 0,n=e.get(`return`)??void 0;return(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(TZ,{token:t,mode:`cross-frontend-handoff`,returnPathFromUrl:n})})},ube=()=>{let{formState:e}=UC(),{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),r=e=>t(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e);return n?(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`email`}),e.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:e.errors.root.message})}),(0,$.jsx)(nO,{label:r(_s.SEND_RESET_PASSWORD_LINK),submittingLabel:r(_s.SENDING),fullWidth:!0})]}):null},dbe=({resetEmail:e})=>{let t=Xx(),{formState:n}=UC(),{tComponent:r,isReady:i}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),a=e=>r(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),o=t.passwordPolicy??_Z;return i?(0,$.jsxs)(tA,{children:[(0,$.jsx)(yZ,{email:e}),(0,$.jsx)(QL,{name:`newPassword`}),(0,$.jsx)(QL,{name:`confirmPassword`}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:o,t:a}),n.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:n.errors.root.message})}),(0,$.jsx)(nO,{label:a(_s.RESET_BUTTON),submittingLabel:a(_s.RESETTING),fullWidth:!0})]}):null},MZ=({resetToken:e,email:t})=>{let{auth:n}=sg(),r=Xx(),i=ap(),{tComponent:a,isReady:o}=K({component:B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),s=e=>a(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),c=Ln.login,l=(0,Q.useRef)(null),{initAutoClearing:u,injectServerErrors:d,clearServerErrors:f}=$R(l),p=(0,Q.useCallback)(e=>{l.current=e,u(e)},[u]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=(0,Q.useMemo)(()=>r.passwordPolicy??_Z,[r.passwordPolicy]),x=(0,Q.useMemo)(()=>Vne.refine(e=>e.newPassword===e.confirmPassword,{message:s(_s.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[s]);return n.accessToken?(0,$.jsx)(Uh,{to:Ln.home,replace:!0}):o?v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-success`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,$.jsx)(SY,{children:s(_s.RESET_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(_s.RESET_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(_s.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(_s.RESET_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(_s.RESET_SUB_TITLE)})]}),(0,$.jsx)(nE,{schema:x,defaultValues:{newPassword:``,confirmPassword:``},onSubmit:async t=>{h(!0),l.current?.clearErrors(`root`),f();let n=st.validatePasswordAgainstPolicy(t.newPassword,b);if(!n.valid)l.current?.setError(`root`,{type:`policy`,message:bZ(n.violations,s,b).join(`. `)}),h(!1);else try{await vc().completePasswordReset(e,t.newPassword),y(!0)}catch(e){let t=jM(e);if(t)d(t.validationErrors);else{let t=xZ(e,s,b);l.current?.setError(`root`,{type:`server`,message:t??i(e,s(_s.INVALID_TOKEN))})}}finally{h(!1)}},onFormReady:p,validationMode:ta.ON_BLUR,disabled:m,labels:{fields:{newPassword:s(_s.NEW_PASSWORD),confirmPassword:s(_s.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(dbe,{resetEmail:t})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(_s.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(_s.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(_s.SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:c,children:s(_s.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(_s.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(_s.SUB_TITLE)})]}),(0,$.jsx)(nE,{schema:Cie,defaultValues:{email:``},onSubmit:async e=>{h(!0),l.current?.clearErrors(`root`),f();try{await vc().requestPasswordReset(e.email),_(!0)}catch(e){let t=jM(e);t?d(t.validationErrors):l.current?.setError(`root`,{type:`server`,message:i(e,s(_s.UNEXPECTED_ERROR))})}finally{h(!1)}},onFormReady:p,validationMode:ta.ON_BLUR,disabled:m,labels:{fields:{email:s(_s.EMAIL_ADDRESS)}},layoutTemplate:ube}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:c,children:s(_s.BACK_TO_LOGIN)})})]}):null};function NZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,`Auth_PasswordLost`)(e);return(0,$.jsx)(n,{...t})}var fbe=()=>{let[e]=ih(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(NZ,{resetToken:t,email:n})})},pbe=[`response_type`,`client_id`,`redirect_uri`,`code_challenge`,`code_challenge_method`,`scope`,`resource`,`state`,`nonce`],PZ=e=>{let{auth:t}=sg(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_OAUTH_CONSENT}),[i]=ih(),[a,o]=(0,Q.useState)(`loading`),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=t?.accessToken,m=(e,t)=>n(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,e,t),h=(0,Q.useRef)(!1),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams;for(let t of pbe){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),vc().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(Is.ERROR_INVALID)))}).catch(()=>{e||(o(`error`),u(Is.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 vc().oauthConsentDecision(s.consent_token,e,e===qr.APPROVE&&d);window.location.assign(t)}catch{h.current=!1,o(`error`),u(Is.ERROR_DECISION)}}},[s,d]);if(!p){let e=ed({pathname:Ln.oauthConsent,search:`?${i.toString()}`});return(0,$.jsx)(Uh,{to:fi(Ln.login,e),replace:!0})}return a===`loading`||a===`submitting`||!r?(0,$.jsx)(`div`,{className:`py-region flex justify-center`,children:(0,$.jsx)($y,{})}):a===`error`||!s?(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:m(l??Is.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(Is.TITLE,{clientName:s.client.name})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:m(Is.SUB_TITLE)})]}),s.scopes.length>0&&(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:m(Is.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(Is.AGENT_ENDPOINT,{resource:s.resource})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-item-xs cursor-pointer`,children:[(0,$.jsx)(DI,{checked:d,onCheckedChange:e=>f(e===!0)}),(0,$.jsx)(Z,{children:m(Is.REMEMBER)})]}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,className:`flex-1`,onClick:()=>_(qr.DENY),children:m(Is.DENY)}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,onClick:()=>_(qr.APPROVE),children:m(Is.APPROVE)})]})]})};function FZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,`Auth_OAuthConsent`)(e);return(0,$.jsx)(n,{...t})}var mbe=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(FZ,{})})),IZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.LINKING=`linking`,e.LINKED=`linked`,e.ERROR=`error`})(IZ||={});var LZ=B.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK;function RZ(e){return Ca.createOperationPathKey({resourceIdentifier:ll.CHAT_IDENTITY_LINKS,operationIdentifier:e,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1})}var zZ=e=>{let{auth:t}=sg(),n=t?.accessToken,{tComponent:r,isReady:i,formatDateTime:a}=K({component:LZ}),o=(e,t)=>r(LZ,e,t),{doOperation:s}=lm(),c=ap(),l=nh(),[u,d]=ih(),[f]=(0,Q.useState)(()=>({organizationId:u.get(ma.ORGANIZATION_ID),token:u.get(ma.TOKEN),host:Eae(u.get(ma.HOST))})),p=Ub(f.host),[m,h]=(0,Q.useState)(IZ.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(ma.TOKEN)&&d({},{replace:!0}),!f.organizationId||!f.token){h(IZ.ERROR),y(null);return}let e=!1;return h(IZ.LOADING),x.current(RZ(Ol.PREVIEW_LINK),C()).then(t=>{e||(_(t),h(IZ.READY))}).catch(t=>{e||(y(S.current(t)),h(IZ.ERROR))}),()=>{e=!0}},[w,f,C]);let T=(0,Q.useCallback)(async()=>{if(!b.current){b.current=!0,h(IZ.LINKING);try{await x.current(RZ(Ol.COMPLETE_LINK),C()),h(IZ.LINKED)}catch(e){b.current=!1,y(S.current(e)),h(IZ.ERROR)}}},[C]),E=m===IZ.LINKED||m===IZ.READY&&g?.standing===Kt.LINKED_TO_YOU,D=p.tell;(0,Q.useEffect)(()=>{E&&D(Vb.SUCCEEDED)},[E,D]);let O=(e,t)=>p.hostServed?(0,$.jsx)(X,{variant:J.OUTLINE,className:t,onClick:()=>{D(E?Vb.SUCCEEDED:Vb.FAILED,{repeat:!0}).then(e=>{e===0&&l(Ln.home)})},children:o(yl.CLOSE_HOST_WINDOW)}):(0,$.jsx)(X,{variant:J.OUTLINE,className:t,onClick:()=>l(Ln.home),children:o(e)}),k=O(yl.BACK_TO_APP);if(!n){let e=ed({pathname:xte,search:`?${u.toString()}`});return(0,$.jsx)(Uh,{to:fi(Ln.login,e),replace:!0})}if(!i||m===IZ.LOADING||m===IZ.LINKING)return(0,$.jsxs)(`div`,{className:`py-region flex flex-col items-center gap-element`,children:[(0,$.jsx)($y,{}),i&&(0,$.jsx)(Z,{children:o(m===IZ.LINKING?yl.LINKING:yl.LOADING)})]});if(m===IZ.ERROR||!g)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(SY,{children:o(yl.ERROR_TITLE)}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:v??o(yl.ERROR_INCOMPLETE_LINK)})}),k]});if(m===IZ.LINKED)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(SY,{children:o(yl.SUCCESS_TITLE)}),(0,$.jsx)(Z,{children:o(yl.SUCCESS_MESSAGE)}),k]});if(g.standing===Kt.LINKED_TO_YOU)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(SY,{children:o(yl.ALREADY_LINKED_TITLE)}),(0,$.jsx)(Z,{children:o(yl.ALREADY_LINKED)}),k]});if(g.standing===Kt.LINKED_TO_ANOTHER_MEMBER)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(SY,{children:o(yl.LINKED_TO_ANOTHER_TITLE)}),(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o(yl.LINKED_TO_ANOTHER)})}),k]});let A=g.chatUserDisplayName&&g.workspaceDisplayName?o(yl.ACCOUNT_NAMED,{chatUser:g.chatUserDisplayName,workspace:g.workspaceDisplayName}):void 0,j=o(yl.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(yl.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(yl.INTRO)})]}),(0,$.jsxs)(`dl`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`dt`,{children:(0,$.jsx)(Z,{className:`font-medium`,children:o(yl.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)(AD,{variant:`warning`,children:(0,$.jsx)(MD,{children:o(yl.WARNING_NOT_YOURS)})}),(0,$.jsx)(Z,{className:`text-sm`,children:o(yl.EXPIRES_AT,{expiresAt:a(g.expiresAt)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[O(yl.CANCEL,`flex-1`),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,onClick:T,children:o(yl.CONFIRM)})]})]})};function BZ({preset:e=q.DEFAULT,...t}){let n=G(LZ,`Auth_ChatIdentityLink`)(e);return(0,$.jsx)(n,{...t})}var hbe=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(BZ,{})})),VZ=e=>{let{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT}),r=nh(),i=e=>t(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,e);return n?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(SY,{children:i(Qc.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:i(Qc.SUB_TITLE)})]}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`w-full`,onClick:()=>r(Ln.login),children:i(Qc.RETURN_TO_SIGN_IN)})]}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)($y,{})})};function HZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,`Auth_OAuthLoggedOut`)(e);return(0,$.jsx)(n,{...t})}var gbe=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(HZ,{})}),UZ;(function(e){e.READY=`ready`,e.SUBMITTING=`submitting`,e.ERROR=`error`})(UZ||={});var WZ=e=>{let{tComponent:t,isReady:n}=K({component:B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM}),[r]=ih(),[i,a]=(0,Q.useState)(UZ.READY),o=e=>t(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,e),s=(0,Q.useMemo)(()=>r.get(`token`)??``,[r]),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)(async()=>{if(s&&!c.current){c.current=!0,a(UZ.SUBMITTING);try{let{redirect_to:e}=await vc().oauthEndSessionConfirm(s);window.location.assign(e)}catch{c.current=!1,a(UZ.ERROR)}}},[s]),u=(0,Q.useCallback)(()=>{window.location.assign(Ln.home)},[]);return n?s?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(SY,{children:o(Nl.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:o(Nl.SUB_TITLE)})]}),i===UZ.ERROR&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o(Nl.ERROR)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,className:`flex-1`,disabled:i===UZ.SUBMITTING,onClick:u,children:o(Nl.CANCEL)}),(0,$.jsx)(X,{variant:J.DEFAULT,className:`flex-1`,disabled:i===UZ.SUBMITTING,onClick:l,children:o(Nl.CONFIRM)})]})]}):(0,$.jsx)(Uh,{to:Ln.oauthLoggedOut,replace:!0}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)($y,{})})};function GZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,`Auth_OAuthLogoutConfirm`)(e);return(0,$.jsx)(n,{...t})}var _be=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(GZ,{})})),KZ=(e,t)=>e.kind===xo.RELEASED?`${String(t)}:${e.release.identity.releaseId}@${String(e.release.identity.releaseVersion)}:${e.content.title}`:`${String(t)}:${e.content.title}`,vbe=({document:e,t,paneKey:n,onReachedEnd:r})=>{let i=(0,Q.useRef)(null),a=(0,Q.useCallback)(()=>{let e=i.current;e&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&r(n)},[r,n]);return(0,Q.useEffect)(a,[a,e]),(0,$.jsxs)(`div`,{ref:i,onScroll:a,tabIndex:0,lang:e.content.locale,role:`region`,"aria-label":e.content.title,className:U(`max-h-64 overflow-y-auto rounded-md border border-border bg-muted/30 p-element text-sm`,Mg(a_.FIELD)),children:[(0,$.jsx)(`h2`,{className:`font-medium`,children:e.content.title}),e.kind===xo.UNRELEASED_DRAFT&&(0,$.jsx)(Z,{role:`note`,className:`mt-element-sm text-xs font-medium`,children:t(Za.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===Qie.NOT_YET_ESTABLISHED&&(0,$.jsx)(Z,{role:`note`,className:`text-xs`,children:`${t(Za.TERMS_CLAUSE_NOT_ESTABLISHED)} ${e.missingInformation??``}`.trim()})]},e.clauseRef))]},e.sectionRef))]})},qZ=({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:Sd(e.release.identity.document.documentRef),path:Ye(e.release),title:e.document?.content.title??Sd(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:Sd(e.kind===xo.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(KZ(e,t)));if(r.length===0)return null;let g=f.length>0&&(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-element-sm`,children:[m.map(({document:e,path:t})=>(0,$.jsx)(_X,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:e.content.locale,children:n(B.PUBLIC_LAYOUTS_USER_REGISTER,Za.TERMS_OPEN_DOCUMENT,{documentTitle:e.content.title})},t)),f.map(({release:e,path:t,title:r,locale:i})=>(0,$.jsx)(_X,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:i,children:n(B.PUBLIC_LAYOUTS_USER_REGISTER,Za.TERMS_OPEN_DOCUMENT,{documentTitle:r})},e.identity.releaseId))]});if(!xc(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(Za.TERMS_ACCEPTANCE_IMPLIED)}),g]});let _=a.every(e=>e.document!==void 0)&&a.length>0,v=x(i)&&_,y=v&&!h,b=(0,Q.useId)();return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{id:b,className:`text-sm text-muted-foreground`,children:t(Za.TERMS_READ_PROMPT)}),d.map((e,n)=>(0,$.jsx)(vbe,{document:e,t,paneKey:KZ(e,n),onReachedEnd:u},KZ(e,n)))]}),(0,$.jsxs)(`label`,{className:U(`flex items-start gap-element`,y?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(DI,{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(Za.TERMS_ACCEPTANCE)})]}),(0,$.jsx)(Z,{"aria-live":`polite`,className:`sr-only`,children:v&&h?t(Za.TERMS_READ_COMPLETE):``}),g]})},ybe=60,bbe=[hs.PASSWORD,hs.MAGIC_LINK,hs.PASSKEY],JZ=Q.createContext({requiredReleases:[],acceptanceMode:uo.EXPLICIT_CHECKBOX,requiredDocuments:[],servedDocuments:[],accepted:!1,setAccepted:()=>{},documentsRead:[],markDocumentRead:()=>{},method:hs.PASSWORD}),YZ=({t:e,tComponent:t})=>{let{method:n,...r}=Q.useContext(JZ);return(0,$.jsx)(qZ,{state:r,t:e,tComponent:t})},xbe=()=>{let e=Xx(),{formState:t}=UC(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_USER_REGISTER}),i=e=>n(B.PUBLIC_LAYOUTS_USER_REGISTER,e),a=e.passwordPolicy??_Z,{requiredReleases:o,acceptanceMode:s,accepted:c,method:l}=Q.useContext(JZ),u=l===hs.PASSWORD;if(!r)return null;let d=u?Za.REGISTER_BUTTON:l===hs.PASSKEY?Za.PASSKEY_SIGNUP_BUTTON:Za.MAGIC_LINK_SIGNUP_BUTTON,f=u?Za.REGISTERING:Za.MAGIC_LINK_SIGNUP_SENDING;return(0,$.jsxs)(tA,{children:[(0,$.jsx)(QL,{name:`email`}),(0,$.jsx)(QL,{name:`firstName`}),(0,$.jsx)(QL,{name:`lastName`}),(0,$.jsx)(QL,{name:`organizationName`}),(e.registrationConfig.additionalProfileQuestions??[]).map(e=>(0,$.jsx)(QL,{name:e.id},e.id)),(0,$.jsx)(QL,{name:`password`}),(0,$.jsx)(QL,{name:`confirmPassword`}),u&&(0,$.jsx)(vZ,{fieldName:`password`,policy:a,t:i}),t.errors.root&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:t.errors.root.message})}),(0,$.jsx)(YZ,{t:i,tComponent:n}),(0,$.jsx)(nO,{label:i(d),submittingLabel:i(f),fullWidth:!0,disabled:o.length>0&&xc(s)&&!c})]})},XZ=({})=>{let{auth:e,initiateOAuth2Login:t}=sg(),{registerAccount:n}=fm(),r=ap(),{appConfig:i}=Tu(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)([]),l=(0,Q.useCallback)(e=>{c(t=>t.includes(e)?t:[...t,e])},[]),[u,f]=(0,Q.useState)(null),p=i.compliance?.governedDocumentAcceptanceMode??uo.EXPLICIT_CHECKBOX,m=$o(i.compliance),h=(0,Q.useMemo)(()=>(u===null?Jne(i.compliance?.governedDocumentReleases??[],new Date().toISOString(),{requireApproved:m}):(i.compliance?.governedDocumentReleases??[]).filter(e=>u.some(t=>t.releaseId===e.identity.releaseId&&t.releaseVersion===e.identity.releaseVersion))).filter(e=>e.allowedInteractionKinds.includes(xs.CONTRACT_ACCEPTED)),[i.compliance?.governedDocumentReleases,m,u]),g=(0,Q.useMemo)(()=>h.map(e=>({release:e,document:su(i.compliance?.publicDocuments??[],e,{requireApproved:m})})),[h,i.compliance?.publicDocuments,m]),_=(0,Q.useMemo)(()=>i.compliance?.publicDocuments??[],[i.compliance?.publicDocuments]),v=(0,Q.useMemo)(()=>({requiredReleases:h,acceptanceMode:p,requiredDocuments:g,servedDocuments:_,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:hs.EXTERNAL_OAUTH2}),[h,p,g,_,a,s,l]),y=h.length>0&&xc(p)&&!a,b=(0,Q.useMemo)(()=>h.length===0||xc(p)&&!a?[]:h.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})),[h,p,a]),x=(0,Q.useCallback)(e=>{if(!jr(e)||e.customMessageReference!==ql.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)return!1;let t=e.context?.inForceReleases,n=Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.releaseId==`string`&&typeof e.releaseVersion==`number`):[],r=i.compliance?.governedDocumentReleases??[];return n.every(e=>r.some(t=>t.identity.releaseId===e.releaseId&&t.identity.releaseVersion===e.releaseVersion))?(f(n),o(!1),c([]),!0):(window.location.reload(),!0)},[i.compliance?.governedDocumentReleases]),S=Xx(),C=cg(),w=(0,Q.useMemo)(()=>S.registrationConfig.allowedMethods.includes(hs.EXTERNAL_OAUTH2)?MX({publicProviders:S.globalAuth?.socialOAuth2Providers}):[],[S.globalAuth?.socialOAuth2Providers,S.registrationConfig.allowedMethods]),T=(0,Q.useMemo)(()=>cb(w.map(e=>e.displayNameLabelKey)),[w]),E=(0,Q.useMemo)(()=>[B.PUBLIC_LAYOUTS_USER_REGISTER,B.PUBLIC_LAYOUTS_USER_AUTH],[]),{t:D,tComponent:O,isReady:k}=K({component:E,keys:T}),A=e=>O(B.PUBLIC_LAYOUTS_USER_REGISTER,e),j=e=>O(B.PUBLIC_LAYOUTS_USER_AUTH,e),M=(0,Q.useMemo)(()=>L(C.search),[C.search]),N=(0,Q.useMemo)(()=>new URLSearchParams(C.search).get(`email`)?.trim()??``,[C.search]),P=(0,Q.useMemo)(()=>fi(Ln.login,M),[M]),F=(0,Q.useMemo)(()=>Xt(C.search),[C.search]),I=w.length>0,ee=(0,Q.useCallback)(async e=>{try{await t(e,M,b)}catch(e){x(e)}},[b,M,t,x]),R=(0,Q.useRef)(null),{initAutoClearing:z,injectServerErrors:te,clearServerErrors:ne}=$R(R),re=(0,Q.useCallback)(e=>{R.current=e,z(e)},[z]),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(``);SX({mfaRequired:oe===Ap.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 vc().resendVerificationEmail(ce),de(`sent`),pe(ybe)}catch(e){de(`error`),he(r(e,A(Za.UNEXPECTED_ERROR)))}}},[ce,fe]),_e=(0,Q.useMemo)(()=>S.passwordPolicy??_Z,[S.passwordPolicy]),ve=(0,Q.useMemo)(()=>{if(!S.resolvedUserType)return!1;let e=eae(i.organizationTypes,S.resolvedUserType);return e.length===1&&e[0]?.definition.creationPolicy?.orgNameSource===qre.ASK},[i.organizationTypes,S.resolvedUserType]),ye=(0,Q.useMemo)(()=>S.registrationConfig,[S.registrationConfig]).allowedMethods,be=(0,Q.useMemo)(()=>bbe.filter(e=>ye.includes(e)),[ye]),[xe,Se]=(0,Q.useState)(null),Ce=xe!==null&&be.includes(xe)?xe:be[0]??null,we=be.filter(e=>e!==Ce),Te=Ce!==null,Ee=Te&&Ce!==null,De=Ce===hs.PASSWORD,Oe=I&&Te,ke=S.registrationConfig.additionalProfileQuestions??[],Ae=S.registrationConfig.profileNamesCollectedAt!==Wc.ONBOARDING,je=(0,Q.useMemo)(()=>{let e={};for(let t of ke){let n=t.type===Cc.RATING?Td():yd().min(1);e[t.id]=t.required?n:n.optional()}let t=d.extend(e),n=Ae?t:t.omit({firstName:!0,lastName:!0}),r=ve?n:n.omit({organizationName:!0});return De?r.refine(e=>!e.password||e.password===e.confirmPassword,{message:A(Za.PASSWORD_MISMATCH),path:[`confirmPassword`]}):r.omit({password:!0,confirmPassword:!0})},[A,ve,De,ke,Ae]),Me=Fp(e,M);if(Me)return(0,$.jsx)(Uh,{to:Me,replace:!0});if(!k)return null;if(oe===Ap.SIGNED_IN)return e.accessToken?(0,$.jsx)(Uh,{to:F,replace:!0}):null;if(oe===Ap.MFA_ENROLLMENT_REQUIRED)return null;if(oe!==null){let e=oe===Ap.SSO_REDIRECT_REQUIRED,t=e?Za.SSO_REGISTRATION_TITLE:Za.SUCCESS_TITLE,n=e?Za.SSO_REGISTRATION_MESSAGE:oe===Ap.UNFINISHED?Za.REGISTRATION_UNFINISHED:oe===Ap.MAGIC_LINK_SENT?Za.MAGIC_LINK_SENT_MESSAGE:oe===Ap.PASSKEY_ENROLLMENT_PENDING?Za.PASSKEY_ENROLLMENT_PENDING_MESSAGE:Za.SUCCESS_MESSAGE,r=oe===Ap.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(Za.RESEND_PROMPT),` `,(0,$.jsx)(X,{variant:J.LINK,className:`p-0 h-auto text-sm`,onClick:ge,disabled:ue===`sending`||fe>0,children:ue===`sending`?A(Za.RESEND_SENDING):fe>0?`${A(Za.RESEND_COOLDOWN)} (${fe}s)`:A(Za.RESEND_LINK)})]}),ue===`sent`&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:A(Za.RESEND_SUCCESS)})}),ue===`error`&&me&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:me})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(vX,{href:P,children:A(Za.SIGNIN_LINK)})})]})}let Ne=async e=>{ae(!0),R.current?.clearErrors(`root`),ne();let t=Ce??hs.PASSWORD;if(t===hs.PASSWORD&&e.password){let t=st.validatePasswordAgainstPolicy(e.password,_e);if(!t.valid){R.current?.setError(`root`,{type:`policy`,message:bZ(t.violations,A,_e).join(`. `)}),ae(!1);return}}try{let r=await n({email:e.email,...Ae?{firstName:e.firstName,lastName:e.lastName}:{},password:t===hs.PASSWORD&&e.password?.trim()||void 0,organizationName:e.organizationName?.trim()||void 0,profileAnswers:ke.length>0?Object.fromEntries(ke.map(t=>[t.id,e[t.id]]).filter(([,e])=>e!==void 0&&e!==``)):void 0,method:t,...M?{redirect:M}:{},...b.length>0?{acceptedGovernedDocumentReleases:b}:{}});le(e.email),se(r)}catch(e){x(e);let t=jM(e);if(t)te(t.validationErrors);else{let t=xZ(e,A,_e);R.current?.setError(`root`,{type:`server`,message:t??r(e,A(Za.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(Za.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(Za.REGISTRATION_DISABLED)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:P,children:A(Za.SIGNIN_LINK)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:A(Za.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:A(Za.SUB_TITLE)})]}),w.length>0&&h.length>0&&!Ee&&(0,$.jsx)(JZ.Provider,{value:v,children:(0,$.jsx)(YZ,{t:A,tComponent:O})}),(0,$.jsx)(FX,{providers:w,onProviderClick:ee,isLoading:ie||e.isLoading,disabled:y,continueWithLabel:A(Za.CONTINUE_WITH),translate:D,dividerLabel:A(Za.DIVIDER_OR),showDivider:Oe}),Te&&Ce!==null&&(0,$.jsx)(JZ.Provider,{value:{requiredReleases:h,acceptanceMode:p,requiredDocuments:g,servedDocuments:_,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:Ce},children:(0,$.jsx)(nE,{schema:je,defaultValues:{email:N,...Ae&&{firstName:``,lastName:``},...ve&&{organizationName:``},...De&&{password:``,confirmPassword:``}},onSubmit:Ne,onFormReady:re,validationMode:ta.ON_BLUR,disabled:ie,layoutTemplate:xbe,labels:{fields:{email:A(Za.EMAIL_ADDRESS),...Ae&&{firstName:A(Za.FIRST_NAME),lastName:A(Za.LAST_NAME)},...ve&&{organizationName:A(Za.ORGANIZATION_NAME)},...De&&{password:A(Za.PASSWORD),confirmPassword:A(Za.CONFIRM_PASSWORD)}}}},Ce)}),we.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AX,{label:j(as.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:A(Za.METHOD_CHOICE_HINT)}),(0,$.jsx)(BX,{methods:we,labelFor:e=>EX(e,{socialProviders:w,continueWithTemplate:j(as.CONTINUE_WITH),translateLabel:e=>j(e),resolveSocialProviderLabel:e=>jX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:NX[e.providerRef]?.label,translate:D})}),onSelect:Se,disabled:ie})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsxs)(Z,{className:`text-sm`,children:[A(Za.ALREADY_HAVE_ACCOUNT),` `,(0,$.jsx)(_X,{href:P,children:A(Za.SIGNIN_LINK)})]})})]})};function Sbe({mode:e}){let t=cg(),{tComponent:n,isReady:r}=K({component:B.PUBLIC_LAYOUTS_USER_REGISTER}),i=(0,Q.useMemo)(()=>L(t.search),[t.search]),a=(0,Q.useMemo)(()=>fi(Ln.login,i),[i]);if(!r)return null;let o=e===to.INVITATION_ONLY?Za.INVITATION_ONLY:e===to.ADMIN_ONLY?Za.ADMIN_ONLY:Za.REGISTRATION_DISABLED,s=e=>n(B.PUBLIC_LAYOUTS_USER_REGISTER,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(SY,{children:s(Za.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(o)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(vX,{href:a,children:s(Za.SIGNIN_LINK)})})]})}function ZZ({preset:e=q.DEFAULT,...t}){let{auth:n}=sg(),r=Xx(),i=cg(),a=(0,Q.useMemo)(()=>Xt(i.search),[i.search]);if(n.accessToken)return(0,$.jsx)(Uh,{to:a,replace:!0});if(!r.registrationConfig.publicRegistrationAvailable)return(0,$.jsx)(Sbe,{mode:r.registrationConfig.mode});let o=G(B.PUBLIC_LAYOUTS_USER_REGISTER,`Auth_Register`)(e);return(0,$.jsx)(o,{...t})}var Cbe=()=>(0,$.jsx)(pX,{useCardLayout:!0,children:(0,$.jsx)(ZZ,{})});function QZ({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_TERMS,`PublicLayout_Terms`)(e);return(0,$.jsx)(n,{...t})}function $Z({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_LEGAL_NOTICE,`PublicLayout_LegalNotice`)(e);return(0,$.jsx)(n,{...t})}function wbe(){let{on:e}=Ao(),{navigate:t}=wS(),{registry:n}=lm(),r=nh();return(0,Q.useEffect)(()=>e(wc.NAVIGATION_REQUEST,e=>{let i;e.operationRef?i=zm.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 eQ(e){let t=(0,Q.useSyncExternalStore)(zm.subscribeToTransactionState,zm.getTransactionEpoch,zm.getTransactionEpoch),n=(0,Q.useCallback)(()=>void 0,[]);return{retryTick:t,scheduleRetry:n,clearRetry:n}}function tQ(){let e=cg(),t=(0,Q.useContext)(_h)?.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 nQ(e){let t=tQ();return t.pathname!==e.pathname||t.search!==e.search}function Tbe(e,t,n){let r=cg(),i=nQ(r),a=Fm(),{registry:o}=lm(),{emit:s}=Ao(),{getZoneState:c,contentAreaWidth:l}=Px(),u=Jp(),d=uS(),{navigationLayout:f,currentBreakpoint:p}=Rg(),m=(0,Q.useMemo)(()=>zm.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}=eQ(m),x=(0,Q.useMemo)(()=>{if(!e||!t)return[];let n=o.resourceConfigurations?.[e];return n?Vn.buildOperationFrontendRoutePaths(n,t,o.allResourceFieldIdentifiers).map(e=>e.url):[]},[e,t,o]);(0,Q.useEffect)(()=>{if(!e||!t)return;if(Bx(`useRouterSync: effect fired`,{resourceType:e,operationId:t.operationIdentifier,locationPathname:r.pathname,lastSyncedPath:_.current,routePatternsCount:x.length}),zm.isInTransaction()){Bx(`useRouterSync: SKIP — navigation transaction active`,{source:zm.getTransactionSource()}),y();return}if(b(),i){Bx(`useRouterSync: SKIP — the router is ahead of the committed location`,{committedUrl:m});return}if(_.current===m){Bx(`useRouterSync: SKIP — already synced this path`,{currentBrowserUrl:m});return}if(x.length>0&&!x.some(e=>zm.matchUrlPattern(e,r.pathname))){Bx(`useRouterSync: SKIP — URL does not match any resource route pattern`,{pathname:r.pathname,patterns:x}),_.current=m;return}let g=o.resourceConfigurations?.[e]?.resourcePrimaryScope,v=n?On.buildParentResourcesRequirementsFromRouteParams(n,e,o):[],S=f?.zones,C=!!S?.secondary,w=!!S?.companion,T=zm.calculateResourceRelationshipDepth(v),E=T===0&&C&&t!==void 0&&zm.layoutSplitsOperationFromPrimary(f,t,p),D=zm.resolveResourceTargetZone(T,{hasSecondary:C,hasCompanion:w,prefersAdjacentZoneForDetail:E}),O=T>=1&&D!==Sl.PRIMARY&&Wx({content:{contentType:od.RESOURCE_OPERATION,resourceContext:On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:{},parentResourcesRequirements:v})},paneZone:D,layout:f,registry:o,viewport:p,contentAreaWidth:l})?Sl.PRIMARY:D,k=qh({zone:O,layout:f,viewport:p,contentAreaWidth:l})?O:Sl.PRIMARY;k!==O&&Bx(`useRouterSync: adjacent zone is collapsed at this viewport — restoring into PRIMARY`,{preferredZone:O,viewport:p,contentAreaWidth:l});let A=zm.zoneOwnsBrowserUrl(k,m,c);if(Bx(`useRouterSync: checking guards`,{currentBrowserUrl:m,targetZone:k,targetZoneOwnsUrl:A,targetZoneTopUrlPath:zm.getTopEntry(c(k))?.urlPath}),A){Bx(`useRouterSync: SKIP — target zone already owns current URL`,{targetZone:k}),_.current=m;return}let j=zm.findStructuralRouteOwner(m,c);if(j&&j.zone!==k){Bx(`useRouterSync: SKIP — another structural zone already shows this destination`,{owningZone:j.zone,targetZone:k,currentBrowserUrl:m}),_.current=m;return}let M=On.extractResourceIdentifiersFromUrlParams(a,o,n),N=Qp.buildResourceOperationContextIdentifiers({currentUserId:u?.currentUserId,currentOrganizationId:u?.currentOrganizationId,currentApplicationId:u?.currentApplicationId,currentAnonymousUserId:u?.currentAnonymousUserId,primaryScope:g,liveAppScopeContextResourceIdentifiers:h,explicitContextResourceIdentifiers:M}),P=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:N,parentResourcesRequirements:v}),F={contentType:od.RESOURCE_OPERATION,resourceContext:P},I=zm.generateStackEntryId();Bx(`useRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{resourceType:e,operationId:t.operationIdentifier,currentBrowserUrl:m,mergedContextIdentifiers:N,depth:T,targetZone:k}),T>=1&&zm.beginTransaction(`url_reverse_cascade`);let ee=k!==O,L=Ele({content:F,paneZone:O,placedZone:k,layout:f,registry:o,viewport:p,contentAreaWidth:l});if(ee&&E&&O===Sl.SECONDARY&&qx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),s(ee?wc.NAVIGATION_PUSH:wc.NAVIGATION_REPLACE,{zone:k,content:F,urlPath:m,stackEntryId:I,initiator:{sourceZone:k},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE,...ee?{collapsedFromZone:O}:{},...L?{persistent:!0}:{}}),E&&k===Sl.SECONDARY&&qx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),T>=1){let e=Vu(N);Yx(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 rQ(e,t){let n=cg(),r=nQ(n),{emit:i}=Ao(),{getZoneState:a}=Px(),{registry:o}=lm(),{fullCustomViews:s,flowsActorsViews:c}=Rg(),l=(0,Q.useRef)(null),u=zm.buildBrowserUrl(n.pathname,n.search),{retryTick:d,scheduleRetry:f,clearRetry:p}=eQ(u);(0,Q.useEffect)(()=>{if(!e)return;if(zm.isInTransaction()){f();return}if(p(),r||l.current===u)return;if(zm.zoneOwnsBrowserUrl(Sl.PRIMARY,u,a)){l.current=u;return}let d,m=t===od.COMPOSITE_VIEW?jp(new URLSearchParams(n.search)):void 0,h=t===od.CHART_VIEW?Hp(new URLSearchParams(n.search)):void 0,g=t===od.CHART_VIEW?Bp(new URLSearchParams(n.search)):void 0,_=t===od.EXECUTION_VIEW?om(new URLSearchParams(n.search)):void 0,v=t===od.FULL_CUSTOM_VIEW?s?.find(t=>t.ref===e):void 0,y=t===od.FLOWS_ACTORS_VIEW?c?.find(t=>t.ref===e):void 0,b=t===od.EXECUTION_VIEW?wp({viewRef:e,registry:o}):void 0;switch(t){case od.COMPOSITE_VIEW:d={contentType:od.COMPOSITE_VIEW,viewRef:e,contextResourceIdentifiers:m};break;case od.CHART_VIEW:d={contentType:od.CHART_VIEW,viewRef:e,contextResourceIdentifiers:h,urlParamValues:g};break;case od.FULL_CUSTOM_VIEW:if(!v)return;d={contentType:od.FULL_CUSTOM_VIEW,viewRef:e,fullCustomComponentRef:v.componentRef};break;case od.FLOWS_ACTORS_VIEW:if(!y)return;d={contentType:od.FLOWS_ACTORS_VIEW,viewRef:e,flowsActorsSystemRef:y.systemRef};break;case od.EXECUTION_VIEW:if(!b||b.isAddressable!==!0)return;d={contentType:od.EXECUTION_VIEW,viewRef:e,contextResourceIdentifiers:_};break;default:return}let x=zm.generateStackEntryId();Bx(`useViewRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{viewRef:e,contentType:t,locationPathname:n.pathname,locationSearch:n.search}),i(wc.NAVIGATION_REPLACE,{zone:Sl.PRIMARY,content:d,urlPath:zm.decomposeHostedPaneBrowserUrl(u).hostUrl,stackEntryId:x,initiator:{sourceZone:Sl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),l.current=u},[e,t,i,a,s,c,o,u,r,d,f,p])}function Ebe(e){let t=cg(),n=nQ(t),{emit:r}=Ao(),{getZoneState:i}=Px(),a=(0,Q.useRef)(null),o=zm.buildBrowserUrl(t.pathname,t.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=eQ(o);(0,Q.useEffect)(()=>{if(!e)return;if(zm.isInTransaction()){c();return}if(l(),n||a.current===o)return;if(zm.zoneOwnsBrowserUrl(Sl.PRIMARY,o,i)){a.current=o;return}let t=zm.generateStackEntryId();r(wc.NAVIGATION_REPLACE,{zone:Sl.PRIMARY,content:{contentType:od.ENGINE_PAGE,pageRef:e},urlPath:zm.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:t,initiator:{sourceZone:Sl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),a.current=o},[e,r,i,o,n,s,c,l])}function Dbe(){let e=tQ(),{emit:t}=Ao(),{getZoneState:n}=Px(),r=(0,Q.useRef)(null),i=zm.buildBrowserUrl(e.pathname,e.search),{retryTick:a,scheduleRetry:o,clearRetry:s}=eQ(i);(0,Q.useEffect)(()=>{if(zm.isInTransaction()){o();return}if(s(),r.current===i)return;if(iQ(e.pathname).isSettings){r.current=i;return}let a=zm.findStructuralStackEntryOwningUrl(i,n);if(a?.isTop){if(a.searchDiffers){let{hostUrl:e,paneUrl:r}=zm.decomposeHostedPaneBrowserUrl(i),o=r===void 0?[{zone:a.zone,entry:a.entry,urlPath:i}]:[{zone:Sl.PRIMARY,entry:zm.getTopEntry(n(Sl.PRIMARY)),urlPath:e},{zone:Sl.SECONDARY,entry:a.entry,urlPath:r}];for(let e of o)e.entry&&e.entry.urlPath!==e.urlPath&&(Bx(`useStructuralZoneBackForwardSync: refreshing entry urlPath for a view-state change`,{zone:e.zone,stackEntryId:e.entry.id,from:e.entry.urlPath,to:e.urlPath}),t(wc.NAVIGATION_URL_PATH_UPDATED,{zone:e.zone,stackEntryId:e.entry.id,urlPath:e.urlPath}))}r.current=i}else if(a)Bx(`useStructuralZoneBackForwardSync: POP to backstack entry`,{zone:a.zone,toStackEntryId:a.entry.id,currentUrl:i}),t(wc.NAVIGATION_POP,{zone:a.zone,toStackEntryId:a.entry.id}),r.current=i;else{if(pr.some(e=>n(e).stack.length>0)){Bx(`useStructuralZoneBackForwardSync: clearing structural zones for URL rebuild`,{currentUrl:i}),zm.beginTransaction(`backforward_url_rebuild`);for(let e of pr)t(wc.NAVIGATION_CLEAR_ZONE,{zone:e})}r.current=i}},[i,e.pathname,t,n,a,o,s])}function Obe(){let e=tQ(),{emit:t}=Ao(),{getZoneState:n}=Px(),{registry:r}=lm(),i=Jp(),a=(0,Q.useRef)(null),o=zm.buildBrowserUrl(e.pathname,e.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=eQ(o),u=(0,Q.useMemo)(()=>i?.buildContextResourceIdentifiers?.()??{},[i]);(0,Q.useEffect)(()=>{if(zm.isInTransaction()){c();return}if(l(),a.current===o)return;if(iQ(e.pathname).isSettings){a.current=o;return}let{paneUrl:s}=zm.decomposeHostedPaneBrowserUrl(o),d=n(Sl.SECONDARY),f=zm.getTopEntry(d);if(s===void 0){f?.hostedPane&&(Bx(`useHostedPaneRouteSync: pane left the URL — clearing SECONDARY`,{currentUrl:o}),t(wc.NAVIGATION_CLEAR_ZONE,{zone:Sl.SECONDARY})),a.current=o;return}if(f?.hostedPane&&zm.urlsAddressSameDestination(f.urlPath,s)){a.current=o;return}let p=zm.getTopEntry(n(Sl.PRIMARY));if(zm.isHeldHostedPane(p)&&zm.urlsAddressSameDestination(p?.urlPath,s)){a.current=o;return}let m=[...d.stack].reverse().find(e=>e.hostedPane&&zm.urlsAddressSameDestination(e.urlPath,s));if(m){Bx(`useHostedPaneRouteSync: POP to a buried pane`,{toStackEntryId:m.id,paneUrl:s}),t(wc.NAVIGATION_POP,{zone:Sl.SECONDARY,toStackEntryId:m.id}),a.current=o;return}let h=zm.resolveResourceRouteForUrl(s,r);if(!h){Bx(`useHostedPaneRouteSync: pane URL matches no addressable resource route — ignored`,{paneUrl:s}),a.current=o;return}let g=On.buildParentResourcesRequirementsFromRouteParams(h.routePathParameters,h.resourceType,r),_=On.extractResourceIdentifiersFromUrlParams(h.urlParameters,r,h.routePathParameters),v=r.resourceConfigurations?.[h.resourceType]?.resourcePrimaryScope,y=Qp.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:i?.currentApplicationId,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:v,liveAppScopeContextResourceIdentifiers:u,explicitContextResourceIdentifiers:_}),b=On.createFrontendResourceOperationContextFromOperation({resourceType:h.resourceType,operation:h.operation,contextResourceIdentifiers:y,parentResourcesRequirements:g});Bx(`useHostedPaneRouteSync: EMITTING NAVIGATION_REPLACE (URL_SYNC) for the hosted pane`,{paneUrl:s,resourceType:h.resourceType,operationId:h.operation.operationIdentifier}),t(wc.NAVIGATION_REPLACE,{zone:Sl.SECONDARY,content:{contentType:od.RESOURCE_OPERATION,resourceContext:b},urlPath:s,stackEntryId:zm.generateStackEntryId(),initiator:{sourceZone:Sl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.SPLIT,hostedPane:!0}),a.current=o},[o,e.pathname,t,n,r,i?.currentUserId,i?.currentOrganizationId,i?.currentApplicationId,i?.currentAnonymousUserId,u,s,c,l])}function iQ(e){if(e===Ln.settings)return{isSettings:!0};let t=`${Ln.settings}/`;if(e.startsWith(t)){let[n,r]=e.slice(t.length).split(`/`);return{isSettings:!0,sectionRef:n&&n.length>0?n:void 0,subTabRef:r&&r.length>0?r:void 0}}return{isSettings:!1}}function kbe(){let e=tQ(),{emit:t}=Ao(),{state:n}=Px(),{retryTick:r,scheduleRetry:i,clearRetry:a}=eQ(e.pathname),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(zm.isInTransaction()){i();return}a();let{isSettings:r,sectionRef:s,subTabRef:c}=iQ(e.pathname),l=n.overlay,u=l.length>0?l[l.length-1]:void 0,d=!1,f,p;if(u&&u.content.contentType===od.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?wc.NAVIGATION_REPLACE:wc.NAVIGATION_PUSH,r=`${n}|${e.pathname}|${s??``}|${c??``}|${l.length}`;if(o.current===r)return;o.current=r,t(n,{zone:rr.OVERLAY,content:{contentType:od.SETTINGS_HUB,sectionRef:s,subTabRef:c},urlPath:zm.buildBrowserUrl(e.pathname,e.search),stackEntryId:zm.generateStackEntryId(),initiator:{sourceZone:rr.OVERLAY},navigationSource:Qi.URL_SYNC,transition:Rt.OVERLAY,appearance:Rn.DIALOG,ephemeral:!1})}else if(d){let e=`${wc.NAVIGATION_CLOSE}|${l.length}`;if(o.current===e)return;o.current=e,t(wc.NAVIGATION_CLOSE,{zone:rr.OVERLAY})}else o.current=null},[e.pathname,e.search,t,n.overlay,r,i,a])}var aQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=rr.PRIMARY})=>{let{fullCustomViews:i}=Rg(),a=Jp(),o=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,o,e]);let s=(0,Q.useMemo)(()=>{let e=Qp.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=o?.primaryScope?Qp.primaryScopeToContextIdentifiers(e,o.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=Qp.filterCustomScopeContextResourceIdentifiers(r);return o?Qp.resolveViewContextResourceIdentifiers({surfaceName:`FullCustomView`,surfaceRef:o.ref,primaryScope:o.primaryScope,parentResourcesRequirements:o.parentResourcesRequirements,additionalResourceRequirements:o.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n}):Qp.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)(u_,{viewKind:`full-custom`,viewRef:e});let c=No.resolve(o.componentRef,q.DEFAULT);return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(QY,{viewRef:o.ref,contentType:od.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)(il,{componentType:o.componentRef,componentName:o.componentRef})},oQ;(function(e){e.TURN=`turn`,e.TOOL=`tool`,e.REASONING=`reasoning`,e.HOST=`host`})(oQ||={});var sQ;(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`})(sQ||={});function cQ(e,t){return[...e??[],t]}function Abe(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 lQ=new Set([ht.TEXT,ht.MARKDOWN]);function uQ(e){if(e==null)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t}function jbe(e){if(e.role===Gi.TOOL){let t=Dc.safeParse(e.data);return t.success?{kind:oQ.TOOL,key:`tool:${t.data.toolCallId}`,trace:t.data,fromRecordOnly:!0}:null}if(e.role!==Gi.USER&&e.role!==Gi.ASSISTANT)return null;if(e.contentType===ht.REASONING)return{kind:oQ.REASONING,key:`reasoning:${e.id}`,content:e.content};if(e.contentType!==void 0&&!lQ.has(e.contentType))return null;let t=Xe.safeParse(e.data).data?.sources;return{kind:oQ.TURN,key:`message:${e.id}`,storedMessageId:e.id,role:e.role,content:e.content,markdown:e.role===Gi.ASSISTANT||e.contentType===ht.MARKDOWN,...t&&t.length>0?{sources:t}:{}}}var dQ;(function(e){e.NONE=`none`,e.REASONING=`reasoning`,e.TOOL=`tool`,e.REPLY=`reply`})(dQ||={});function Mbe(e,t){let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>{let t=e.role===Gi.TOOL?Dc.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=dQ.NONE;e.messages.forEach((t,r)=>{let i=t.messageId??`${e.executionId}:${r}`;if(t.type===ht.REASONING){let e=a.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,a.set(i,e),n.has(i)||(c=dQ.REASONING)}else if(t.type===ht.PROGRESS){let e=Dc.safeParse(t.data);if(!e.success)return;s.set(e.data.toolCallId,{...s.get(e.data.toolCallId),...e.data}),c=dQ.TOOL}else if(lQ.has(t.type)){let e=o.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,e.sources.push(...Xe.safeParse(t.data).data?.sources??[]),o.set(i,e),n.has(i)||(c=dQ.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:oQ.REASONING,key:`live-reasoning:${e.id}`,content:e.content,streaming:i&&t===u.length-1&&c===dQ.REASONING}));let p=new Map;for(let e of s.values())r.has(e.toolCallId)?p.set(e.toolCallId,e):f.push({kind:oQ.TOOL,key:`tool:${e.toolCallId}`,trace:e});return d.forEach((e,t)=>f.push({kind:oQ.TURN,key:`live-reply:${e.id}`,role:Gi.ASSISTANT,content:e.content,markdown:!0,...i&&t===d.length-1&&c===dQ.REPLY?{streaming:!0}:{},...e.sources.length>0?{sources:e.sources}:{}})),{entries:f,calls:[...s.values()],recordedCallUpdates:p,activity:c}}function Nbe(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if((n.role===Gi.USER||n.role===Gi.ASSISTANT)&&(n.contentType===void 0||lQ.has(n.contentType)))return n.role}}function fQ(e){let t=e.thread?.messages??[],n=[],r=new Map;for(let e of t){let t=jbe(e);if(t){if(t.kind===oQ.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:uQ(e.createdAt),entry:t})}}let i=e.live,a=i?Mbe(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 Abe(e.sent,new Set(t.map(e=>e.id))))n.push({at:r.sentAt.getTime(),entry:{kind:oQ.TURN,key:`sent-pending:${r.id}`,role:Gi.USER,content:r.text,markdown:!1,pending:!0}});let o=(e.hostEntries??[]).map((e,t)=>({at:uQ(e.at),index:t,entry:{kind:oQ.HOST,key:`host:${e.key}`,node:e.node}})).sort((e,t)=>e.at-t.at||e.index-t.index),s=[],c=0;for(let e of n){for(;c<o.length&&o[c].at<e.at;)s.push(o[c++].entry);s.push(e.entry)}for(;c<o.length;)s.push(o[c++].entry);if(!i||!a){let n=e.thread?.status,r=e.thread?.executionId;if(n===Yt.AWAITING_APPROVAL&&r&&e.thread?.pendingApproval!==void 0)return{entries:s,turnState:sQ.AWAITING_DECISION,activeExecutionId:r,stoppable:!1};let i=e.thread?.failureCode;return n===Yt.FAILED&&i!==void 0?{entries:s,turnState:sQ.FAILED,stoppable:!1,recoverable:!1,errorCode:i}:n===Yt.FAILED&&Nbe(t)===Gi.USER?{entries:s,turnState:sQ.INTERRUPTED,stoppable:!1}:n===Yt.CANCELLED?{entries:s,turnState:sQ.STOPPED,stoppable:!1}:{entries:s,turnState:sQ.IDLE,stoppable:!1}}switch(s.push(...a.entries),i.status){case yW.STARTING:case yW.RUNNING:{if(a.activity===dQ.REPLY)return{entries:s,turnState:sQ.ANSWERING,activeExecutionId:i.executionId,stoppable:!0};let e=a.activity===dQ.TOOL?a.calls.at(-1):void 0;return{entries:s,turnState:sQ.WORKING,activeExecutionId:i.executionId,stoppable:!0,...e?.phase===Mee.CALL?{currentCall:e}:{}}}case yW.AWAITING_APPROVAL:return{entries:s,turnState:sQ.AWAITING_DECISION,activeExecutionId:i.executionId,stoppable:!1,...i.errorCode?{errorCode:i.errorCode}:{}};case yW.CANCELLED:return{entries:s,turnState:sQ.STOPPED,stoppable:!1};case yW.ERROR:return{entries:s,turnState:sQ.FAILED,stoppable:!1,recoverable:i.recoverable===!0,...i.errorCode?{errorCode:i.errorCode}:{}};case yW.IDLE:case yW.COMPLETED:return{entries:s,turnState:sQ.IDLE,stoppable:!1}}}function pQ(e){return new Date(e.createdAt).getTime()}function mQ(e){return[...e].sort((e,t)=>pQ(t)-pQ(e))}function hQ(e,t){if(!t.hasOlder)return{threads:mQ(t.executions),hasOlder:!1};let n=Math.min(...t.executions.map(pQ)),r=new Set(t.executions.map(e=>e.executionId)),i=e.threads.filter(e=>pQ(e)<n&&!r.has(e.executionId));return{threads:mQ([...t.executions,...i]),hasOlder:i.length>0?e.hasOlder:!0}}function gQ(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:mQ(n.values()),hasOlder:t.hasOlder}}function _Q(e){let t=e.threads.at(-1);return t?new Date(t.createdAt).toISOString():void 0}async function vQ(e){let t=await e();if(!t)return;let n=hQ({threads:[],hasOlder:!1},t);for(;n.hasOlder;){let t=_Q(n),r=await e(t?{before:t}:void 0);if(!r)return;let i=gQ(n,r);if(i.threads.length===n.threads.length)break;n=i}return n.threads}var yQ=Xs(B.LOW_LEVEL_AI_CONVERSATION_THREAD,`AI_ConversationThread`,[`Composer`,`Discussions`]);function bQ({preset:e=q.DEFAULT,...t}){let n=yQ(e);return(0,$.jsx)(n,{...t})}function xQ({preset:e=q.DEFAULT,...t}){let n=yQ(e);return(0,$.jsx)(n.Composer,{...t})}function SQ({preset:e=q.DEFAULT,...t}){let n=yQ(e);return(0,$.jsx)(n.Discussions,{...t})}var CQ=new Map;function wQ(e,t,n,r){return`${e??``}\u0000${t}\u0000${n}\u0000${r}`}function Pbe(e){return CQ.get(e)??null}function Fbe(e,t){t?CQ.set(e,t):CQ.delete(e)}var TQ=Xs(B.LOW_LEVEL_AI_MESSAGE,`AI_Message`,[`Content`,`Response`,`Actions`,`Action`,`Branch`,`BranchContent`,`BranchSelector`,`BranchPrevious`,`BranchNext`,`BranchPage`,`Attachment`,`Attachments`,`Toolbar`]);function EQ({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n,{...t})}function DQ({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Content,{...t})}function OQ({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Response,{...t})}function kQ({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Actions,{...t})}function AQ({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Action,{...t})}function Ibe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Branch,{...t})}function Lbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.BranchContent,{...t})}function Rbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.BranchSelector,{...t})}function zbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.BranchPrevious,{...t})}function Bbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.BranchNext,{...t})}function Vbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.BranchPage,{...t})}function Hbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Attachment,{...t})}function Ube({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Attachments,{...t})}function Wbe({preset:e=q.DEFAULT,...t}){let n=TQ(e);return(0,$.jsx)(n.Toolbar,{...t})}var Gbe=Ca.createOperationPathKey({resourceIdentifier:ll.AGENT_BEHAVIOR_REPORTS,operationIdentifier:W.CREATE,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),jQ;(function(e){e.IDLE=`idle`,e.SENDING=`sending`,e.SENT=`sent`})(jQ||={});function Kbe({executionId:e,messageId:t,organizationId:n}){let{tComponent:r,tResourceFieldEnumValue:i}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,resource:ll.AGENT_BEHAVIOR_REPORTS}),a=(0,Q.useMemo)(()=>pm(r,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[r]),{doOperation:o}=lm(),s=ap(),{renderIcon:c}=Of(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(void 0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(jQ.IDLE),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b=(0,Q.useMemo)(()=>Object.values(tee).map(e=>({value:e,label:i(ll.AGENT_BEHAVIOR_REPORTS,`category`,e,ie.shape.category)})),[i]),x=(0,Q.useCallback)(async()=>{if(d&&!y.current){y.current=!0,g(jQ.SENDING),v(null);try{let r=p.trim();await o(Gbe,{contextualParameters:{organizationId:n},requestData:{executionRef:{kind:pe.CONVERSATIONAL_EXECUTION,id:e},turnMessageId:t,category:d,...r?{comment:r}:{}}},{silent:!0}),g(jQ.SENT),u(!1)}catch(e){v(s(e)),g(jQ.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===jQ.SENT,T=a(w?`replyReported`:`reportReply`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(AQ,{tooltip:T,label:T,disabled:w,onClick:()=>{v(null),u(!0)},"data-agent-reply-report":h,children:c(H.WARNING,{size:ca.SM})}),(0,$.jsx)(tG,{open:l,onOpenChange:e=>{h!==jQ.SENDING&&u(e)},children:(0,$.jsxs)(rG,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(aG,{children:[(0,$.jsx)(sG,{children:a(`reportDialogTitle`)}),(0,$.jsx)(cG,{children:a(`reportDialogDescription`)})]}),(0,$.jsxs)(ux,{className:`gap-field py-field`,children:[(0,$.jsxs)(sx,{children:[(0,$.jsx)(lx,{id:S,children:a(`reportCategoryLabel`)}),(0,$.jsx)(CF,{"aria-labelledby":S,name:`agent-reply-report-category-${t}`,schema:ie.shape.category,options:b,value:d,onValueChange:e=>f(e),orientation:pu.VERTICAL,disabled:h===jQ.SENDING,required:!0})]}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{htmlFor:`field-${C}`,children:a(`reportCommentLabel`)}),(0,$.jsx)(MI,{name:C,schema:ie.shape.comment,value:p,onChange:e=>m((e??``).slice(0,yn)),placeholder:a(`reportCommentPlaceholder`),rows:3,disabled:h===jQ.SENDING})]}),_?(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:_})}):null]}),(0,$.jsxs)(oG,{children:[(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>u(!1),disabled:h===jQ.SENDING,children:a(`reportCancel`)}),(0,$.jsx)(X,{onClick:()=>{x()},disabled:!d||h===jQ.SENDING,children:a(`reportSend`)})]})]})})]})}function MQ(e,t=40){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t)}…`:n}function qbe(e){return MQ(e.messages.find(e=>e.role===Gi.USER)?.content??``)}function NQ(){let{tComponent:e}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS});return(0,Q.useMemo)(()=>pm(e,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[e])}var Jbe=new Set([yW.COMPLETED,yW.CANCELLED,yW.ERROR,yW.AWAITING_APPROVAL]),PQ={threads:[],hasOlder:!1},Ybe=({system:e,contextResourceIdentifiers:t,preset:n,caseRef:r})=>{let i=NQ(),{startExecution:a,cancelExecution:o,executions:s,fetchConversationHistory:c,deleteConversation:l}=TW(),u=Jp(),d=u?.currentUserId??null,f=hc(t),p=(0,Q.useRef)(t);p.current=t;let[m,h]=(0,Q.useState)(PQ),g=m.threads,[_,v]=(0,Q.useState)(!1),y=r?`${r.resourceType}:${r.resourceId}`:``,b=wQ(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 Fbe(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=>hQ(e,n))},[e.ref,c]),A=(0,Q.useRef)(0),j=(0,Q.useCallback)(async()=>{let t=_Q(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=>gQ(e,r))}finally{n===A.current&&v(!1)}},[m,_,e.ref,c]);(0,Q.useEffect)(()=>{let e=T.current;e&&m!==PQ&&(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(PQ),v(!1);let t=Pbe(wQ(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&&Jbe.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)(()=>fQ({...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:qbe(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:MQ(t[0].text)})),...e]},[g,E]),ee=(0,Q.useCallback)(()=>w(null),[w]),L=(0,Q.useCallback)(e=>{w(e),k()},[k,w]),R=(0,Q.useCallback)(e=>{h(t=>({...t,threads:t.threads.filter(t=>t.executionId!==e)})),D(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),w(t=>t===e?null:t),l(e).catch(()=>{k()})},[l,k,w]),z=(0,Q.useCallback)(t=>{let n=crypto.randomUUID(),i=a(e.ref,{message:t},x??void 0,p.current,{messageId:n,...r?{caseRef:r}:{}});i&&(D(e=>({...e,[i]:cQ(e[i],{id:n,text:t,sentAt:new Date})})),w(i))},[a,e.ref,x,r,w]),te=F.turnState===sQ.WORKING||F.turnState===sQ.ANSWERING||F.turnState===sQ.AWAITING_DECISION,ne=F.stoppable?F.activeExecutionId:void 0,re=jte(t,u?.currentOrganizationId??void 0),ie=N?x:null,ae=(0,Q.useMemo)(()=>ie&&re?({messageId:e})=>(0,$.jsx)(Kbe,{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)(SQ,{preset:n,discussions:I,currentId:x,onNew:ee,onSelect:L,onDelete:R,...m.hasOlder?{onLoadOlder:()=>{j()},loadingOlder:_}:{}}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-card-sm`,children:[(0,$.jsx)(bQ,{preset:n,model:F,...ae?{renderReplyActions:ae}:{},emptyState:{title:e.displayName,description:e.description||i(`emptyStateDescription`)}}),(0,$.jsx)(xQ,{preset:n,placeholder:i(`promptPlaceholder`,{assistant:e.displayName}),onSubmit:z,sendDisabled:te,...ne?{onStop:()=>o(ne)}:{}})]})]})})},Xbe=({system:e})=>{let t=NQ(),{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:U(`size-2 shrink-0 rounded-full`,r?`bg-warning`:`bg-success`)}),(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.displayName}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(r?`statusWorking`:`statusReady`)})]})},FQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,caseRef:r})=>{let{flowsActorsViews:i}=Rg(),a=Jp(),{systems:o,isLoading:s}=TW(),{isReady:c}=K({component:B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),l=NQ(),u=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,u,e]);let d=(0,Q.useMemo)(()=>{let e=Qp.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=u?.primaryScope?Qp.primaryScopeToContextIdentifiers(e,u.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=Qp.filterCustomScopeContextResourceIdentifiers(r);return u?Qp.resolveViewContextResourceIdentifiers({surfaceName:`FlowsActorsView`,surfaceRef:u.ref,primaryScope:u.primaryScope,parentResourcesRequirements:u.parentResourcesRequirements,additionalResourceRequirements:u.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n})??{}:Qp.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)(Xbe,{system:f}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col pt-card-sm`,children:(0,$.jsx)(Ybe,{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)(u_,{viewKind:`flows-actors`})},Zbe=Q.lazy(()=>l_(()=>import(`./ChartView-nQvehKAl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function Qbe(e){let{insertedIdentity:t,contextResourceIdentifiers:n,urlParamValues:r,registry:i}=e;if(t.hostKind!==Lp.RESOURCE||t.viewKind!==_p.CHART_VIEW)return;let a=kp({viewRef:t.insertedViewRef,registry:i})?.chartView;if(!a||!Wp(a))return;let o=n??{};return{routeViewRef:t.insertedViewRef,viewDefinition:a,contextResourceIdentifiers:o,urlParamValues:r,runtimeDescriptor:pp({identity:t,chartView:a,contextResourceIdentifiers:o}),requiredFeatures:a.chartDefinition.requiredFeatures}}function $be(e){let{viewRef:t,registry:n,contextResourceIdentifiers:r,urlParamValues:i}=e;if(!t)return;let a=Op(t);if(a)return Qbe({insertedIdentity:a,contextResourceIdentifiers:r,urlParamValues:i,registry:n})}function exe(e){let t=cg(),n=nQ(t),{emit:r}=Ao(),{getZoneState:i}=Px(),a=Q.useRef(null),o=`${t.pathname}${t.search}`,{retryTick:s,scheduleRetry:c,clearRetry:l}=eQ(o);Q.useEffect(()=>{e&&(zm.isInTransaction()?c():(l(),n||a.current!==o&&(zm.zoneOwnsBrowserUrl(Sl.PRIMARY,o,i)||r(wc.NAVIGATION_REPLACE,{zone:Sl.PRIMARY,content:{contentType:od.CHART_VIEW,viewRef:e.routeViewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor,requiredFeatures:e.requiredFeatures},urlPath:zm.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:zm.generateStackEntryId(),initiator:{sourceZone:Sl.PRIMARY},navigationSource:Qi.URL_SYNC,transition:Rt.REPLACE}),a.current=o)))},[r,i,e,o,n,s,c,l])}var txe=new Set(Object.values(W).map(e=>String(e).toLowerCase()));function nxe(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}`):txe.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 rxe=rs.getLogger(),ixe=({resourceType:e,operation:t,PageComponent:n,routePathParameters:r})=>{let{registry:i}=lm(),a=Jp(),{navigationLayout:o,currentBreakpoint:s}=Rg(),{contentAreaWidth:c}=Px(),l=Fm(),u=Q.useMemo(()=>nxe(l,e),[l,e]);Tbe(u.isValid?e:void 0,u.isValid?t:void 0,r),Q.useEffect(()=>{!u.isValid&&u.message&&rxe.warn(`[AppRouter] ${u.message}`,{resourceType:e,operation:String(t.operationIdentifier),invalidParams:u.invalidParams,errorType:u.errorType,url:window.location.href})},[u.isValid,u.message,u.errorType,u.invalidParams,e,t.operationIdentifier]);let d=Q.useMemo(()=>On.buildParentResourcesRequirementsFromRouteParams(r,e,i),[r,e,i]);if(!u.isValid)return(0,$.jsx)(qy,{});let f=On.extractResourceIdentifiersFromUrlParams(l,i,r),p=i.resourceConfigurations?.[e]?.resourcePrimaryScope,m=Qp.buildResourceOperationContextIdentifiers({currentUserId:a?.currentUserId,currentOrganizationId:a?.currentOrganizationId,currentApplicationId:a?.currentApplicationId,currentAnonymousUserId:a?.currentAnonymousUserId,primaryScope:p,liveAppScopeContextResourceIdentifiers:a?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:f}),h=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:m,parentResourcesRequirements:d}),g=zm.calculateResourceRelationshipDepth(d),_=g===0&&!!o?.zones?.secondary&&zm.layoutSplitsOperationFromPrimary(o,t,s),v=zm.resolveResourceTargetZone(g,{hasSecondary:!!o?.zones?.secondary,hasCompanion:!!o?.zones?.companion,prefersAdjacentZoneForDetail:_}),y=g>=1&&v!==Sl.PRIMARY&&Wx({content:{contentType:od.RESOURCE_OPERATION,resourceContext:h},paneZone:v,layout:o,registry:i,viewport:s,contentAreaWidth:c})?Sl.PRIMARY:v,b=qh({zone:y,layout:o,viewport:s,contentAreaWidth:c})?y:Sl.PRIMARY;return(0,$.jsx)(n,{resourceContext:h,navigationZone:b,navigationInitiator:{sourceZone:b}})};function IQ(e,t){let{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Rg(),{registry:a}=lm();return Q.useMemo(()=>{if(e)switch(t){case od.COMPOSITE_VIEW:return mp({viewRef:e,compositeViews:n,registry:a})?.requiredFeatures;case od.CHART_VIEW:return kp({viewRef:e,registry:a})?.chartView.chartDefinition.requiredFeatures;case od.FULL_CUSTOM_VIEW:return r?.find(t=>t.ref===e)?.requiredFeatures;case od.FLOWS_ACTORS_VIEW:return i?.find(t=>t.ref===e)?.requiredFeatures;case od.EXECUTION_VIEW:return wp({viewRef:e,registry:a})?.requiredFeatures;default:return}},[e,t,n,r,i,a])}var LQ=({ViewComponent:e,contentType:t,viewProps:n})=>{let{viewRef:r}=Fm();rQ(r,t);let i=IQ(r,t);return(0,$.jsx)(Kh,{requiredFeatures:i,children:(0,$.jsx)(e,{viewRef:r,...n})})},axe=({viewProps:e})=>{let{viewRef:t}=Fm(),n=cg(),{compositeViews:r}=Rg(),{registry:i}=lm(),a=Q.useMemo(()=>jp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>mp({viewRef:t,compositeViews:r,registry:i}),[t,r,i]),s=!!t&&Ip(o);rQ(s?t:void 0,od.COMPOSITE_VIEW);let c=IQ(s?t:void 0,od.COMPOSITE_VIEW);return s?(0,$.jsx)(Kh,{requiredFeatures:c,children:(0,$.jsx)(GU,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(u_,{viewKind:`composite`,viewRef:t})},oxe=({viewProps:e})=>{let{viewRef:t}=Fm(),n=cg(),{registry:r}=lm(),i=Q.useMemo(()=>wp({viewRef:t,registry:r}),[t,r]),a=Q.useMemo(()=>om(new URLSearchParams(n.search)),[n.search]),o=!!t&&!!i&&np(i);rQ(o?t:void 0,od.EXECUTION_VIEW);let s=IQ(o?t:void 0,od.EXECUTION_VIEW);return o?(0,$.jsx)(Kh,{requiredFeatures:s,children:(0,$.jsx)($Y,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(u_,{viewKind:`execution`,viewRef:t})},sxe=({viewProps:e})=>{let{viewRef:t}=Fm(),n=cg(),{registry:r}=lm(),i=Q.useMemo(()=>Hp(new URLSearchParams(n.search)),[n.search]),a=Q.useMemo(()=>Bp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>$be({viewRef:t,registry:r,contextResourceIdentifiers:i,urlParamValues:a}),[t,r,i,a]);return exe(o),o?(0,$.jsx)(Kh,{requiredFeatures:o.requiredFeatures,children:(0,$.jsx)(Zbe,{viewRef:o.routeViewRef,viewDefinition:o.viewDefinition,contextResourceIdentifiers:o.contextResourceIdentifiers,urlParamValues:o.urlParamValues,runtimeDescriptor:o.runtimeDescriptor,...e})}):(0,$.jsx)(u_,{viewKind:`chart`,viewRef:t})},RQ=({pageRef:e,PageComponent:t})=>(Ebe(e),(0,$.jsx)(t,{})),zQ=()=>(0,$.jsx)(ZU,{});function cxe({documentRef:e}){let[t]=ih(),n=mt(t);return(0,$.jsx)(QZ,{documentRef:e,...n?{namedRelease:n}:{}})}var lxe=()=>{let{registry:e}=lm();ya.isDevelopment();let t=[];return Object.values(e.resourceConfigurations).forEach(n=>{(Array.isArray(n.operations)?n.operations:[]).forEach(r=>{if(!Sn(r.operationFrontendConfig))return;let i=Vn.buildOperationFrontendRoutePaths(n,r,e.allResourceFieldIdentifiers),a=Os(r),o;switch(a){case`create`:o=dG;break;case`list`:o=dX;break;case`read`:o=LY;break;case`update`:o=HY;break;case`search`:o=BY;break;default:o=$W}i.forEach((e,i)=>{let a=(0,$.jsx)(Kh,{operation:r,children:(0,$.jsx)(ixe,{resourceType:n.resourceIdentifier,operation:r,PageComponent:o,routePathParameters:e.parameters})}),s=`${n.resourceIdentifier}-${String(r.operationIdentifier)}-${i}`;t.push((0,$.jsx)(Th,{path:e.url,element:a,errorElement:(0,$.jsx)(qy,{})},s))})})}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wbe,{}),(0,$.jsxs)(Tse,{children:[(0,$.jsx)(Th,{path:Ln.authCallback,element:(0,$.jsx)(tye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.reAuthenticationCallback,element:(0,$.jsx)(nye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.magicLinkVerify,element:(0,$.jsx)(rye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.mfaChallenge,element:(0,$.jsx)(Bye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.enrollmentRequired,element:(0,$.jsx)(Vye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.organizationOnboarding,element:(0,$.jsx)(Wye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.oneOffSession,element:(0,$.jsx)(EZ,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.fileUploadGrant,element:(0,$.jsx)(jZ,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.authExchange,element:(0,$.jsx)(lbe,{}),errorElement:(0,$.jsx)(qy,{})}),Object.entries(xae).map(([e,t])=>(0,$.jsx)(Th,{path:t,element:(0,$.jsx)(cxe,{documentRef:e}),errorElement:(0,$.jsx)(qy,{})},e)),(0,$.jsx)(Th,{path:Oae,element:(0,$.jsx)($Z,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.login,element:(0,$.jsx)(Xye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.register,element:(0,$.jsx)(Cbe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.passwordLost,element:(0,$.jsx)(fbe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.oauthConsent,element:(0,$.jsx)(mbe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.chatIdentityLink,element:(0,$.jsx)(hbe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.oauthLoggedOut,element:(0,$.jsx)(gbe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.oauthLogoutConfirm,element:(0,$.jsx)(_be,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.invitation,element:(0,$.jsx)(abe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.confirmEmail,element:(0,$.jsx)(Qye,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsxs)(Th,{element:(0,$.jsx)(UH,{}),errorElement:(0,$.jsx)(qy,{}),children:[(0,$.jsx)(Th,{path:Ln.home,element:(0,$.jsx)(RQ,{pageRef:fo.HOME,PageComponent:ZU}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.decisions,element:(0,$.jsx)(RQ,{pageRef:fo.DECISIONS,PageComponent:YW}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.settings,element:(0,$.jsx)(zQ,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.settingsSection,element:(0,$.jsx)(zQ,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:Ln.settingsSectionSubTab,element:(0,$.jsx)(zQ,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:`/composite/:viewRef`,element:(0,$.jsx)(axe,{}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:`/custom/:viewRef`,element:(0,$.jsx)(LQ,{ViewComponent:aQ,contentType:od.FULL_CUSTOM_VIEW}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:`/flows-actors/:viewRef`,element:(0,$.jsx)(LQ,{ViewComponent:FQ,contentType:od.FLOWS_ACTORS_VIEW}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{path:`/execution/:viewRef`,element:(0,$.jsx)(oxe,{viewProps:{navigationZone:rr.PRIMARY}}),errorElement:(0,$.jsx)(qy,{})}),(0,$.jsx)(Th,{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)(sxe,{})}),errorElement:(0,$.jsx)(qy,{})}),t]}),(0,$.jsx)(Th,{path:`*`,element:(0,$.jsx)(qy,{})})]})]})},BQ=mae.EN,VQ={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 uxe(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function HQ(e){let t=e.trim().toLowerCase();if(t)return Object.keys(VQ).find(e=>e.toLowerCase()===t)}function UQ(e){let t=VQ[e]??VQ[BQ],n=qn[e]?.direction??Rd.LTR;return{...t,languageTag:e,direction:n}}function dxe(e){for(let t of e){if(typeof t!=`string`)continue;let e=HQ(t);if(e)return UQ(e);let n=HQ(uxe(t));if(n)return UQ(n)}return UQ(BQ)}function fxe({onRetry:e}){let t=(0,Q.useMemo)(()=>dxe(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 pxe(e){let t=[...hxe(e.appConfig),..._xe(e.resourcesRegistry)],n=bie({definitions:e.featureConfiguration.definitions,usages:t}),r=[...mxe(e.featureConfiguration,e.isComponentRegistered),...n.unknownIssues.map(e=>`${e.surface}: unknown feature reference(s): ${yxe(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 mxe(e,t){let n=[];for(let r of e.definitions??[]){let e=r.unavailability;if(!e||!(e.behavior===Ko.CUSTOM||Object.values(e.byRole??{}).includes(Ko.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 hxe(e){return[...WQ(e.compositeViews,e=>`frontend composite view '${e.ref}'`),...WQ(e.fullCustomViews,e=>`frontend full custom view '${e.ref}'`),...WQ(e.flowsActorsViews,e=>`frontend flows/actors view '${e.ref}'`),...WQ(e.onboardingViews,e=>`frontend onboarding view '${e.ref}'`),...gxe(e)]}function gxe(e){return(e.guidanceFlows??[]).flatMap(e=>{let t=nl(e.audience?.requiredFeatures);return t.length===0?[]:[{surface:`frontend guidance flow '${e.ref}' audience`,references:t}]})}function WQ(e,t){return e?e.flatMap((e,n)=>{let r=nl(e.requiredFeatures);return r.length===0?[]:[{surface:t(e,n),references:r}]}):[]}function _xe(e){return Object.entries(e.resourceConfigurations).flatMap(([e,t])=>vxe(e,t))}function vxe(e,t){let n=t.frontendConfiguration;return[...(n?.compositeViews??[]).flatMap(t=>{let n=nl(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' composite view '${t.ref}'`,references:n}]}),...(n?.chartViews??[]).flatMap(t=>{let n=nl(t.chartDefinition.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' chart '${t.ref}'`,references:n}]}),...(n?.executionViews??[]).flatMap(t=>{let n=nl(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' execution view '${t.ref}'`,references:n}]}),...(n?.guidance??[]).flatMap(t=>{let n=nl(t.audience?.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' guidance flow '${t.ref}' audience`,references:n}]})]}function yxe(e){return e.map(e=>`'${e.featureId}' via ${e.slotLabel}`).join(`, `)}var GQ;(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`})(GQ||={});function bxe(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 xxe(e){let t=t=>{e.onDiagnostic?.(t)},n=[];for(let r of e.modules){if(!r.providerCapabilities.includes(Ed.FRONTEND_ERROR_MONITORING))continue;let i=r.metadata.ref,a=e.activations.get(i);a===void 0?t({kind:GQ.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.`}):Bse(a.handle)?n.push({providerRef:i,sink:a.handle}):t({kind:GQ.HANDLE_IS_NOT_A_SINK,providerRef:i,message:`Provider "${i}" declares FRONTEND_ERROR_MONITORING but its activated handle has no reportCrash(report). Return a FrontendErrorMonitoringSink from activate() rather than the vendor namespace; crashes are not being reported until it does.`})}return(e.subscribe??_i.on.bind(_i))(wc.ERROR_OCCURED,e=>{if(n.length===0)return;let r=bxe(e.error);for(let{providerRef:e,sink:i}of n)try{i.reportCrash(r)}catch(n){t({kind:GQ.REPORT_FAILED,providerRef:e,message:`Provider "${e}" threw while reporting a crash; the crash itself is unaffected.`,cause:n})}})}function KQ(e){return typeof e==`object`&&!!e}function Sxe(e){if(!KQ(e)||!(`cause`in e))return;let t=e.cause;if(t instanceof Error)return t.message;if(typeof t==`string`)return t}function Cxe(e,t){let n=e instanceof Error?e:Error(String(e)),r=KQ(n)&&KQ(n.wildoError)?n.wildoError:void 0;return n.initializationDiagnostics={...t,errorName:n.name,errorMessage:n.message,stack:n.stack,causeMessage:Sxe(n),wildoError:r?{type:r.type,customMessageReference:r.customMessageReference,context:KQ(r.context)?r.context:void 0}:void 0},n}var qQ=class{services=null;isInitialized=!1;initializationPromise=null;logger=null;logDebug=null;reportNavigationLayoutDiagnostics(e){if(!e)return;let t;try{t=Gte(e)}catch(e){this.logger.warn(`Navigation layout diagnostics could not run`,{error:po(e)});return}if(t.length!==0)for(let e of t){let t={path:e.path,code:e.code,remedy:e.remedy};e.severity===gte.ERROR?this.logger.error(`Navigation layout: ${e.message}`,t):this.logger.warn(`Navigation layout: ${e.message}`,t)}}async initializeApplication(e){if(this.isInitialized&&this.services)return this.services;if(this.initializationPromise)return this.initializationPromise;let t={...e};this.initializationPromise=this.performInitialization(t);try{this.services=await this.initializationPromise,this.isInitialized=!0;try{e.onInitialized&&e.onInitialized()}catch(e){this.logger.error(`Failed to fire onInitialized callback`,{error:po(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=rs.getLogger(),this.logDebug=this.logger.debugByType(`StartApplicationFrontendService`),this.logger.setDebugTypeLogging(`StartApplicationFrontendService`,!1)),this.logger.info(`Starting application initialization...`,{autoAuth:n}),this.logDebug(`Frontend initialization started with config`,{apiBaseUrl:t.apiBaseUrl,autoAuth:n});try{l=`http client initialization`,this.logDebug(`Initializing HTTP client...`);let n=new oa({baseURL:t.apiBaseUrl});l=`manual backend client setup`,this.logDebug(`Fetching application configuration from backend...`);let i=new Ir({baseURL:t.apiBaseUrl});try{l=`environment configuration loading`,u=ya.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=Jl.parse(await i.getApplicationConfig(u.frontendServiceName));f=zb({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=mre.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}Bo(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=Py(p,e.frontendConfigOverrides),this.logDebug(`Applied frontend config overrides`,{sections:Object.keys(e.frontendConfigOverrides)})),p=bm.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 FS(n);await m.initializeResources(a,o,s,e.excludedResourceTypes,e.resourceUIBehavior,e.notificationBadgeDefinitions);let h=m.getResourcesRegistry();if(l=`component preset registration`,await c(),ya.isDevelopment()&&(l=`development launcher verification`,zv(Rv(h,p,e=>No.hasComponentType(e),{organizationRoles:d.organizationRoles})),qv(Kv(kv(p?.settingsHub),Av(p?.settingsHub),Ov(p?.settingsHub))),e.featureConfiguration)){let t=pxe({resourcesRegistry:h,appConfig:p,featureConfiguration:e.featureConfiguration,isComponentRegistered:e=>No.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??zb(),_=await Ab({surface:Yo.SAAS_APP,modules:g.listAll().filter(e=>bb(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`,xxe({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=sle(g.listAll(),{contributedLoaders:Kb(),onDiagnostic:v}),b=ale({registrations:y,onDiagnostic:v});l=`frontend provider script loading`;let x=cle(g.listAll(),y);x.length>0&&Nb(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=Cxe(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})}}}},JQ=typeof globalThis<`u`?globalThis:window;JQ.__START_APPLICATION_FRONTEND_SERVICE__||=new qQ;var YQ=JQ.__START_APPLICATION_FRONTEND_SERVICE__,wxe=G(B.LOW_LEVEL_CELEBRATION_OVERLAY,`CelebrationOverlay`),XQ=({preset:e=q.DEFAULT})=>{let{celebration:t,dismissCelebration:n}=Mm(),{tComponent:r,isReady:i}=K({component:B.LOW_LEVEL_CELEBRATION_OVERLAY}),a=r(B.LOW_LEVEL_CELEBRATION_OVERLAY,`dismiss`),o=r(B.LOW_LEVEL_CELEBRATION_OVERLAY,`ariaLabel`),s=wxe(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})};XQ.displayName=`AppCelebrationOverlay`;function ZQ({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_TOAST,`Toaster`)(e);return(0,$.jsx)(n,{...t})}var QQ=({children:e})=>{let{registry:t}=lm(),{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Rg(),a=(0,Q.useMemo)(()=>$Q({registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}),[t,n,r,i]);return(0,$.jsx)(gf,{customRegistry:a,children:e})};function $Q(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=e$(t);r&&a.set(e,r);let i=n.frontendConfiguration?.compositeViews??[];for(let e of i){let t=e$(e.icon);t&&s.set(e.ref,t)}let l=n.frontendConfiguration?.executionViews??[];for(let e of l){let t=e$(e.icon);t&&c.set(`view-execution-${e.ref}`,t)}let u=n.frontendConfiguration?.chartViews??[];for(let e of u){let t=e$(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=e$(n);if(!r)continue;let i=`${e}:${String(t.operationIdentifier)}`;o.set(i,r)}}for(let e of n??[]){let t=e$(e.icon);t&&s.set(e.ref,t)}for(let e of r??[]){let t=e$(e.icon);t&&c.set(`view-custom-${e.ref}`,t)}for(let e of i??[]){let t=e$(e.icon);t&&c.set(`view-flows-${e.ref}`,t)}return{resources:a,operationResources:o,compositeView:s,custom:c}}function e$(e){if(e)return typeof e==`string`?yf.standard.get(e):{icon:e}}var Txe=2e3,t$=new Map;function n$(e,t){let n=Ti(t.badgeReference);n&&t$.set(n,t.badgeCount),e(wc.BADGE_COUNT_CHANGED,t)}function r$(){t$.clear()}function i$(){let e=Jp(),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)&&r$()},[t,n]),null}var a$=()=>{let{on:e}=Ao(),[t,n]=(0,Q.useState)(()=>Object.fromEntries(t$)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(Object.fromEntries(t$));return(0,Q.useEffect)(()=>e(wc.BADGE_COUNT_CHANGED,e=>{let t=Ti(e.badgeReference);if(!t)return;let r=a.current[t]??0;a.current[t]=e.badgeCount,n(n=>({...n,[t]:e.badgeCount})),e.badgeCount>r&&(i(e=>({...e,[t]:!0})),setTimeout(()=>{i(e=>({...e,[t]:!1}))},Txe))}),[e]),{getBadgeState:(0,Q.useCallback)(e=>{let n=Ku(e),i=t[n]??0,a=!1;switch(e.display.pulse){case eo.WHILE_ACTIVE:a=i>0;break;case eo.ON_INCREASE:a=!!r[n];break;case eo.NONE:default:a=!1}return{count:i,pulse:a}},[t,r])}},o$=()=>{let{on:e,isConnected:t}=sp(),n=Ao(),{getResourcesRegistry:r}=lm(),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 Hn.CREATED:return El.SUCCESS;case Hn.UPDATED:return El.INFO;case Hn.DELETED:return El.WARNING;default:return El.INFO}},o=e=>{let t=i.resourceConfigurations[e.resourceType]?.operations??[];if(e.operationPathKey){let n=t.find(t=>{try{return Ca.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)=>Yv(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=Xv({resourceType:e,registry:i,scopes:d?{contextResourceIdentifiers:u,previousContextResourceIdentifiers:d}:{contextResourceIdentifiers:u}}),p=f.length>0?f:[null],m=On.buildParentResourcesRequirements(e,u,i);for(let t of p)n.emit(wc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:u,parentResourcesRequirements:m,operation:t??{operationIdentifier:W.LIST},...d?{previousContextResourceIdentifiers:d}:{},...c?{relaysRowDeletion:!0}:{}});let h=Array.from(new Set((t??[]).filter(e=>typeof e==`string`&&e.length>0)));if(!o||h.length===0)return;let g=Ia(l?.operations??[],W.READ,{requireAddressable:!0}),_=new Set;for(let t of h){let r={...u,[e]:t},a=V.buildContextualParameters(r,i),o=On.buildParentResourcesRequirements(e,r,i),s=g.filter(e=>!l||Gh({resourceConfig:l,operation:e,registry:i,hasResourceId:!0,contextResourceIdentifiers:r,contextualParameters:a})),d=s.length>0?s:[null];for(let i of d){let a=i??{operationIdentifier:W.READ},s=[t,String(a.operationIdentifier),a.variantType??``,a.variantKey??``,a.isBulkOperation??!1].join(`:`);_.has(s)||(_.add(s),n.emit(wc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(a.operationIdentifier??W.READ),variantType:i?.variantType,isOperationDefault:i?.isOperationDefault??!0,isBulkOperation:i?.isBulkOperation??!1,variantKey:i?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:o,operation:a,...c?{relaysRowDeletion:!0}:{}}))}}},l=e(fa.RESOURCE_NOTIFICATION,e=>{let t=o({resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,operationPathKey:e.operationPathKey,variantType:e.variantType,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,variantKey:e.variantKey}),i={serverNotification:e.deliveryPolicy,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,variantType:t.variantType??e.variantType,isOperationDefault:t.isOperationDefault??e.isOperationDefault,isBulkOperation:t.isBulkOperation??e.isBulkOperation,variantKey:typeof t.variantKey==`string`?t.variantKey:e.variantKey,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:[],operation:t,additionalContext:{notificationIdentifier:e.notificationIdentifier,action:e.action,frontendDisplayHints:e.frontendDisplayHints,...e.isBulkOperation?{affectedCount:e.affectedIds.length}:{}},resultSummary:e.contextResourceIdentifiers?{...e.contextResourceIdentifiers}:void 0},a=e.notificationLevel??r(e.action);switch(a!==El.ERROR&&c({resourceType:e.resourceType,resourceIds:e.affectedIds,contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.affectedIds.length>0&&!(e.isBulkOperation??!1)}),a){case El.SUCCESS:n.emit(wc.NOTIFY_RESOURCE_SUCCESS,i);break;case El.WARNING:n.emit(wc.NOTIFY_RESOURCE_WARNING,i);break;case El.ERROR:n.emit(wc.NOTIFY_RESOURCE_ERROR,i);break;case El.INFO:default:n.emit(wc.NOTIFY_RESOURCE_INFO,i)}}),u=e(fa.RESOURCE_UPDATED,e=>{c({resourceType:e.resourceType,resourceIds:e.deliveryTarget===qa.SCOPE_ROOM_NOTIFICATION?e.affectedIds??[]:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.deliveryTarget===qa.SCOPE_ROOM_NOTIFICATION?(e.affectedIds?.length??0)>0:!!e.resourceId})}),d=e(fa.RESOURCE_DELETED,e=>{c({resourceType:e.resourceType,resourceIds:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:!!e.resourceId,relaysRowDeletion:!0})}),f=e(fa.BADGE_UPDATE,e=>{let t={badgeReference:e.badgeReference,badgeCount:e.badgeCount};n$(n.emit,t)}),p=e(fa.BULK_JOB_PROGRESS,e=>{n.emit(wc.BULK_JOB_PROGRESS,{jobId:e.jobId,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,attemptedCount:e.attemptedCount,processedCount:e.processedCount,failedCount:e.failedCount,finished:e.finished,...e.failures?{failures:e.failures}:{}})}),m=e(fa.RESOURCE_EDITING_START,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(wc.RESOURCE_EDITING_START,t)}}),h=e(fa.RESOURCE_EDITING_END,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(wc.RESOURCE_EDITING_END,t)}}),g=e(fa.RESOURCE_CUSTOM,e=>{let t=e.resourceData;if(e.resourceData&&typeof e.resourceData==`object`&&!Array.isArray(e.resourceData))try{t=a.validateWebSocketResourceData(e.resourceData,{resourceType:e.resourceType,operationIdentifier:void 0,dataMode:e.dataMode})}catch(n){console.warn(`[WebSocketEventBridge] Resource data validation failed:`,n),t=e.resourceData}let r={resourceType:e.resourceType,resourceId:e.resourceId,eventName:e.eventName,data:e.data,resourceData:t,dataMode:e.dataMode,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(wc.RESOURCE_CUSTOM_EVENT,r)}),_=e(fa.USER_NOTIFICATION,e=>{let t={identifier:e.identifier??``,data:{...e.data,_backendNotification:!0,displayTarget:e.displayTarget,message:e.message,title:e.title,organizationId:e.organizationId,destination:e.destination}};switch(e.notificationLevel){case El.INFO:n.emit(wc.NOTIFY_CUSTOM_INFO,t);break;case El.SUCCESS:n.emit(wc.NOTIFY_CUSTOM_SUCCESS,t);break;case El.WARNING:n.emit(wc.NOTIFY_CUSTOM_WARNING,t);break;case El.ERROR:n.emit(wc.NOTIFY_CUSTOM_ERROR,t);break;default:n.emit(wc.NOTIFY_CUSTOM_INFO,t)}}),v=e(fa.ANALYTICS_MOMENT_ACHIEVED,e=>{let t={momentIdentifier:e.momentIdentifier,role:e.role,scope:e.scope,triggerSource:id.BACKEND};n.emit(wc.ANALYTICS_MOMENT_ACHIEVED,t)}),y=e(fa.GUIDANCE_STATE_CHANGED,e=>{let t={flowRef:e.flowRef,triggerSource:e.triggerSource,scope:e.scope,renderMode:e.renderMode};switch(e.status){case Hr.IN_PROGRESS:n.emit(wc.GUIDANCE_FLOW_ACTIVATED,t);break;case Hr.COMPLETED:n.emit(wc.GUIDANCE_FLOW_COMPLETED,t);break;case Hr.DISMISSED:n.emit(wc.GUIDANCE_FLOW_DISMISSED,t)}}),b=e(fa.MILESTONE_ACHIEVED,e=>{let t={milestoneRef:e.milestoneRef,category:e.category,points:e.points,achievedAt:e.achievedAt,scope:e.scope,reward:e.reward,lifecycleTransition:e.lifecycleTransition,totalPoints:e.totalPoints};n.emit(wc.MILESTONE_ACHIEVED,t)}),x=e(fa.PROGRESSION_UPDATED,e=>{let t={scope:e.scope,operationCounts:e.operationCounts,totalPoints:e.totalPoints,updatedAt:e.updatedAt};n.emit(wc.PROGRESSION_UPDATED,t)}),S=e(fa.LIFECYCLE_STAGE_CHANGED,e=>{let t={previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger,changedAt:e.changedAt,activationCriteriaMet:e.activationCriteriaMet};n.emit(wc.LIFECYCLE_STAGE_CHANGED,t)});return()=>{l(),u(),d(),f(),p(),m(),h(),g(),_(),v(),y(),b(),x(),S()}},[t,e,n,i,a]),null},s$=`wildo:connectivity-status`,Exe=3e3,Dxe={connectionReconnectingNotice:`Connection lost — reconnecting…`,connectionLostNotice:`Connection lost. Please check your network and reload the page.`},c$=e=>e===Xp.RECONNECTING||e===Xp.ERROR,l$=()=>{let{status:e}=sp(),{showPersistentToast:t,dismissPersistentToast:n}=Mm(),{tComponent:r,isReady:i}=K({component:B.APPLICATION_LEVEL_STATUS_BAR}),a=(0,Q.useRef)(r);a.current=r;let o=(0,Q.useRef)(t);o.current=t;let s=(0,Q.useRef)(n);s.current=n;let c=(0,Q.useRef)(e);c.current=e;let l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{c$(c.current)||s.current(s$)},[]),(0,Q.useEffect)(()=>{let t=()=>{l.current&&=(clearTimeout(l.current),null)},n=()=>{let e=c.current===Xp.ERROR,t=e?`connectionLostNotice`:`connectionReconnectingNotice`,n=a.current(B.APPLICATION_LEVEL_STATUS_BAR,t),r=n.startsWith(`components.`)?Dxe[t]:n;o.current(s$,e?`error`:`loading`,r),u.current=!0};c$(e)?i&&(u.current?n():l.current||=setTimeout(()=>{l.current=null,n()},Exe)):(t(),u.current&&=(s.current(s$),!1))},[e,i]),(0,Q.useEffect)(()=>()=>{l.current&&=(clearTimeout(l.current),null),u.current&&=(s.current(s$),!1)},[]),null},u$=class{name=Fo.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`)}},Oxe=50,kxe=1e4,Axe=20,d$=class{name=Fo.BACKEND_PROXY;buffer=[];flushInterval=null;httpClient;identity=null;generation=0;constructor(e){this.httpClient=e}async initialize(e){let t=e?.flushIntervalMs??kxe;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>=Axe&&this.flush()}page(e,t){this.track({name:dr.PAGE_VIEW,properties:{path:e,...t}})}reset(){let e=this.buffer,t=this.identity,n=this.credentialOf(t);this.generation+=1,this.buffer=[],this.identity=null,e.length!==0&&n!==null&&this.httpClient.postAnalyticsEvents({events:e},{sessionBoundCredential:n,silent:!0}).catch(()=>{})}credentialOf(e){let t=this.httpClient.getAuthToken();if(!t||!e)return null;try{return joe(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,Oxe)}}},jxe={[Fo.CONSOLE]:()=>new u$,[Fo.BACKEND_PROXY]:e=>new d$(e)},f$=class{resolveFromConfig(e,t){return e.map(e=>jxe[e.providerType](t,e.config))}},Mxe={current:null};function p$(){return(0,Q.useContext)(m$)||{track:()=>{},page:()=>{},isActive:!1,sessionStartTimestamp:Date.now(),achievedMoments:new Set,markMomentAchieved:()=>!1,_onTrackRef:Mxe}}var Nxe=({config:e,valueMoments:t,identity:n,progress:r})=>{let{track:i,page:a,isActive:o,sessionStartTimestamp:s,achievedMoments:c,markMomentAchieved:l,_onTrackRef:u}=p$(),{on:d,emit:f}=Ao(),p=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let m=(0,Q.useRef)(r.signals),h=(0,Q.useRef)(r.completed),g=(0,Q.useRef)(r.counts),_=(0,Q.useRef)(r.lastFired),v=(0,Q.useRef)(new Map),y=(0,Q.useRef)(i);(0,Q.useEffect)(()=>{y.current=i},[i]);let b=(0,Q.useRef)(l);(0,Q.useEffect)(()=>{b.current=l},[l]);let x=(0,Q.useMemo)(()=>t??[],[t]),S=(0,Q.useCallback)(e=>JSON.stringify([n.applicationId,e.scope,e.scope===la.ORGANIZATION?n.organizationId:n.userId,e]),[n.applicationId,n.userId,n.organizationId]),C=(0,Q.useCallback)(e=>{if((e.scope===la.ORGANIZATION?!n.organizationId:!n.userId)||e.role!==Xi.ANTI_PATTERN&&(c.has(e.identifier)||h.current.has(S(e)))||e.requires?.length&&!e.requires.every(e=>c.has(e))||e.beforeStage?.length&&e.beforeStage.some(e=>c.has(e)))return!1;if(e.role===Xi.ANTI_PATTERN){let t=e.cooldownMs??3e5,n=_.current.get(S(e));if(n&&Date.now()-n<t)return!1}return!0},[c,n,S]),w=(0,Q.useCallback)((e,t)=>{if(!p.current||!C(e))return;let n=e.identifier,r=S(e);m.current.has(r)||m.current.set(r,new Set);let i=m.current.get(r);if(i.add(t),e.mode!==nn.ANY&&i.size!==e.signals.length)return;e.role!==Xi.ANTI_PATTERN&&h.current.add(r);let a=()=>{if(!p.current)return;let r=e.role===Xi.ANTI_PATTERN?Xi.ANTI_PATTERN:ae;y.current(`${r}.${n}`,{signalIndex:e.mode===nn.ANY?t:void 0,signalType:e.mode===nn.ANY?e.signals[t].signalType:wte,elapsedMs:Date.now()-s,role:e.role,scope:e.scope}),e.onAchieved?.frontendEvent&&f(wc.ANALYTICS_MOMENT_ACHIEVED,{momentIdentifier:n,role:e.role,scope:e.scope??la.USER,triggerSource:id.FRONTEND})};e.role===Xi.ANTI_PATTERN?(_.current.set(r,Date.now()),a()):Promise.resolve(b.current(n)).then(e=>{e?a():h.current.delete(r)})},[C,s,f,S]),T=(0,Q.useCallback)((e,t)=>t?e?Object.entries(t).every(([t,n])=>e[t]===n):!1:!0,[]);(0,Q.useEffect)(()=>{if(!o)return;let e=vc();for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==zt.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})},[o,x]),(0,Q.useEffect)(()=>{if(!o)return;let e=vc(),t=()=>{if(document.visibilityState===`visible`)for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==zt.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[o,x]);let E=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(o)return d(wc.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===zt.VIEW_VISIT&&e.contentType===n.contentType&&(!n.viewRef||`viewRef`in e&&e.viewRef===n.viewRef)&&w(t,r)})}})},[o,e?.pageViews,x,d,a,w]),(0,Q.useEffect)(()=>{if(o)return d(wc.NOTIFY_RESOURCE_SUCCESS,t=>{e?.resourceOperations&&i(dr.RESOURCE_OPERATION,{resourceType:t.resourceType,operation:t.operationIdentifier});let n=t.resultSummary;for(let e of x)e.signals.forEach((r,i)=>{if(r.signalType===zt.RESOURCE_OPERATION&&t.resourceType===r.resourceType&&t.operationIdentifier===r.operation&&T(n,r.filter)&&p.current&&C(e)){if(r.threshold&&r.threshold>1){let t=JSON.stringify([S(e),i]),n=(g.current.get(t)??0)+1;if(g.current.set(t,n),n<r.threshold)return}w(e,i)}});let r=vc();for(let e of x)for(let n of e.signals){if(n.signalType!==zt.RESOURCE_STATE||t.resourceType!==n.resourceType)continue;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;r.get(`${br}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(t=>{if(!p.current)return;let r=t.totalCount??0;v.current.set(a,r),r>=n.threshold&&w(e,e.signals.indexOf(n))}).catch(()=>{})}})},[o,e?.resourceOperations,x,d,i,w,T,C,S]),(0,Q.useEffect)(()=>{if(o&&e?.trackErrors)return d(wc.ERROR_OCCURED,e=>{i(dr.ERROR,{errorType:e.error?.type,errorSeverity:e.error?.severity})})},[o,e?.trackErrors,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.userLifecycle)return;let t=[d(wc.USER_STATUS_CHANGED,e=>i(dr.USER_STATUS_CHANGED,{newStatus:e.newStatus,oldStatus:e.oldStatus}))];return()=>t.forEach(e=>e())},[o,e?.userLifecycle,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.notifications)return;let t=[d(wc.NOTIFY_CUSTOM_INFO,e=>i(dr.NOTIFICATION,{level:Fl.INFO,identifier:e.identifier})),d(wc.NOTIFY_CUSTOM_SUCCESS,e=>i(dr.NOTIFICATION,{level:Fl.SUCCESS,identifier:e.identifier})),d(wc.NOTIFY_CUSTOM_WARNING,e=>i(dr.NOTIFICATION,{level:Fl.WARNING,identifier:e.identifier})),d(wc.NOTIFY_CUSTOM_ERROR,e=>i(dr.NOTIFICATION,{level:Fl.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(wc.HOTKEY_COMMAND_MENU_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.COMMAND_MENU})),d(wc.HOTKEY_SIDEBAR_TOGGLE,()=>i(dr.HOTKEY_USED,{key:hi.SIDEBAR_TOGGLE})),d(wc.HOTKEY_NOTIFICATIONS_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.NOTIFICATIONS})),d(wc.HOTKEY_QUICK_SWITCHER_OPEN,()=>i(dr.HOTKEY_USED,{key:hi.QUICK_SWITCHER})),d(wc.HOTKEY_SHORTCUTS_HELP,()=>i(dr.HOTKEY_USED,{key:hi.SHORTCUTS_HELP}))];return()=>t.forEach(e=>e())},[o,e?.hotkeys,d,i]),(0,Q.useEffect)(()=>{if(!o)return;let e=[d(wc.MILESTONE_ACHIEVED,e=>{i(`milestone_achieved`,{milestoneRef:e.milestoneRef,category:e.category,points:e.points,scope:e.scope})}),d(wc.LIFECYCLE_STAGE_CHANGED,e=>{i(`lifecycle_stage_changed`,{previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger})})];return()=>e.forEach(e=>e())},[o,d,i]),(0,Q.useEffect)(()=>{if(o)return u.current=(e,t)=>{for(let n of x)n.signals.forEach((r,i)=>{if(r.signalType===zt.CUSTOM_EVENT&&r.eventName===e){if(!p.current||!C(n))return;if(r.threshold&&r.threshold>1){let e=JSON.stringify([S(n),i]),t=(g.current.get(e)??0)+1;if(g.current.set(e,t),t<r.threshold)return}w(n,i)}r.signalType===zt.FEATURE_ACCESS&&e===dr.FEATURE_ACCESSED&&r.featureId===t?.featureId&&w(n,i)})},()=>{u.current=null}},[o,x,w,C,S,u]),null},m$=(0,Q.createContext)(null),h$=(0,Q.createContext)(null),Pxe=new f$,Fxe=`signed_in_at`,Ixe=1e4,g$=({children:e})=>{let t=(0,Q.useContext)(Fi),{on:n}=Ao(),r=xm(ll.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.useCallback)(()=>{let e=f.current?.held??[];f.current&&clearTimeout(f.current.timer),f.current={held:e,timer:setTimeout(()=>p(!1),Ixe)}},[p]);(0,Q.useEffect)(()=>n(wc.RESOURCE_OPERATION_EXECUTED,()=>m(),e=>e.resourceType===ll.USER_SELF_PREFERENCES&&!da(e.operation??{operationIdentifier:e.operationIdentifier})),[n,m]),(0,Q.useEffect)(()=>()=>p(!1),[p]),(0,Q.useEffect)(()=>n(wc.USER_PREFERENCES_CHANGED,e=>{let t=()=>{T.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=Md(n),r=kd(e,[Id.ANALYTICS]);p(r),r||t(),u(e)}}),[n,p]);let h=(0,Q.useRef)(null),[g,_]=(0,Q.useState)(0),v=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!c?.enabled){o(!1);return}if(!(c.requiresConsent===!1||kd(d,[Id.ANALYTICS]))){i.current.forEach(e=>e.reset()),o(!1);return}let e=!1,t=vc(),n=[...Pxe.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=h.current;t!==null&&n.forEach(e=>e.identify({userId:t})),o(!0),_(e=>e+1)}),()=>{e=!0,n.forEach(e=>e.shutdown().catch(()=>{})),i.current=[]}},[c,d]);let y=Sx(),b=(0,Q.useMemo)(()=>c?.enabled?y.filter(e=>e.providerCapabilities.includes(Ed.FRONTEND_PRODUCT_ANALYTICS)).map(e=>e.activation.handle).filter(Vse):[],[c?.enabled,y]),x=a||b.length>0,S=c?.autoInstrumentation?.userLifecycle===!0,C=(0,Q.useRef)(S);C.current=S;let w=c?.requiresConsent!==!1,T=(0,Q.useRef)(w);T.current=w;let E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(0),k=(0,Q.useCallback)(e=>{E.current=e,O(e=>e+1)},[]);(0,Q.useEffect)(()=>n(wc.USER_LOGIN,e=>{h.current=e.userId,i.current.forEach(t=>t.identify({userId:e.userId})),e.establishment===fc.SIGNED_IN&&k({occurredAt:Date.now(),decided:!T.current,owedToBuiltIns:!0,owedToVendorSinks:!0})}),[n,k]),(0,Q.useEffect)(()=>n(wc.USER_PREFERENCES_CHANGED,e=>{let t=E.current;if(t===null||!T.current||!e.privacy)return;let n=e.privacy.consentedPurposes;n!==void 0&&k(kd(Md(n),[Id.ANALYTICS])?{...t,decided:!0}:null)}),[n,k]),(0,Q.useEffect)(()=>n(wc.USER_LOGOUT,e=>{e.reason===j.SIGNED_OUT&&C.current&&v.current(dr.USER_LOGOUT),k(null),h.current=null,i.current.forEach(e=>e.reset())}),[n,k]);let[A,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(A),I=A?.userId??null;(0,Q.useEffect)(()=>{b.length!==0&&(I===null?b.forEach(e=>e.reset()):b.forEach(e=>e.identify({userId:I})))},[b,I]);let ee=(0,Q.useRef)(F);ee.current=F;let L=(0,Q.useRef)({signals:new Map,counts:new Map,lastFired:new Map,completed:new Set}),R=A?.userId?`${bn}${JSON.stringify([A.applicationId,la.USER,A.userId])}`:null,z=A?.organizationId?`${bn}${JSON.stringify([A.applicationId,la.ORGANIZATION,A.organizationId])}`:null,te=JSON.stringify([R,z]),ne=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.scope===la.ORGANIZATION,[c?.valueMoments]),re=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.role!==Xi.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]),se=(0,Q.useCallback)(e=>{ae(t=>({key:F,moments:typeof e==`function`?e(t.key===F?t.moments:new Set):e}))},[F]),ce=(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(se(new Set),c?.enabled&&A&&(A.userId||A.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)}se(e)}catch{}if(c?.persistence?.backendSync&&r){let e=!1;return vc().getAnalyticsMomentsAchieved().then(t=>{if(e||ee.current!==F)return;let n=t;n.moments&&se(e=>{let t=new Set([...e,...n.moments].filter(re));return ce(t),t})}).catch(()=>{}),()=>{e=!0}}}},[c?.enabled,c?.persistence?.backendSync,r,te,F,ce,re,ne]),(0,Q.useEffect)(()=>n(wc.ANALYTICS_MOMENT_ACHIEVED,e=>{A&&e.triggerSource!==id.FRONTEND&&e.role!==Xi.ANTI_PATTERN&&re(e.momentIdentifier)&&se(t=>{let n=new Set(t);return n.add(e.momentIdentifier),ce(n),n})}),[n,ce,F,re]);let le=(0,Q.useCallback)(e=>{if(!A||!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=()=>ee.current===F&&(se(t=>{let n=new Set(t);return n.add(e),ce(n),n}),!0);return c?.persistence?.backendSync?vc().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,ce,F,re,oe]),ue=(0,Q.useRef)(null),de=(0,Q.useCallback)((e,t)=>{if(!x)return;let n={name:e,properties:t,timestamp:Date.now()};a&&i.current.forEach(e=>e.track(n)),e===dr.RESOURCE_OPERATION&&t?.resourceType===ll.USER_SELF_PREFERENCES&&m();let r=()=>b.forEach(n=>n.track({name:e,properties:t}));f.current?f.current.held.push(r):r(),ue.current?.(e,t)},[a,x,b,m]);v.current=de,(0,Q.useEffect)(()=>{let e=E.current;if(e===null||!e.decided||!S)return;let t={name:dr.USER_LOGIN,timestamp:e.occurredAt},n=e.owedToBuiltIns,r=e.owedToVendorSinks;n&&a&&i.current.length>0&&(i.current.forEach(e=>e.track(t)),n=!1),r&&b.length>0&&(b.forEach(n=>n.track({name:t.name,properties:{[Fxe]:new Date(e.occurredAt).toISOString()}})),r=!1),(n!==e.owedToBuiltIns||r!==e.owedToVendorSinks)&&(E.current=n||r?{...e,owedToBuiltIns:n,owedToVendorSinks:r}:null)},[D,g,a,b,S]);let fe=(0,Q.useCallback)((e,t)=>{if(!x)return;a&&i.current.forEach(n=>n.page(e,t));let n=()=>b.forEach(n=>n.page(e,t));f.current?f.current.held.push(n):n()},[a,x,b]),pe=(0,Q.useMemo)(()=>({track:de,page:fe,isActive:x,sessionStartTimestamp:s,achievedMoments:oe,markMomentAchieved:le,_onTrackRef:ue}),[de,fe,x,s,oe,le]);return(0,$.jsx)(h$.Provider,{value:P,children:(0,$.jsxs)(m$.Provider,{value:pe,children:[x&&A&&c&&(0,$.jsx)(Nxe,{identity:A,progress:L.current,config:c.autoInstrumentation,valueMoments:c.valueMoments},`${F}:${JSON.stringify(c.valueMoments)}`),e]})})};function Lxe(){let e=_m(),t=(0,Q.useContext)(h$);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 _$=rs.getLogger(),v$=_$.debugByType(`ResourceReadCacheBridge`);_$.setDebugTypeLogging(`ResourceReadCacheBridge`,!1);var y$=`read-cache`,b$=`VITE_RESOURCE_READ_CACHE`,Rxe=`off`,zxe=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=sp(),{getReadCache:a}=lm(),o=a();(0,Q.useEffect)(()=>{let e=ya.readOptionalEnvironmentValue(b$)?.toLowerCase()===Rxe;o.setEnabled(!e),e&&_$.info(`Resource read cache disabled by environment`,{flag:b$})},[o]);let s=Jp(),c=s?.currentOrganizationId??null,l=(0,Q.useContext)(Fi)?.appIdentity?.applicationId??s?.currentApplicationId??null,u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(new Map),f=(0,Q.useRef)(new Map),p=(0,Q.useRef)(t);p.current=t;let m=(0,Q.useCallback)((e,t)=>{d.current.has(e)||(d.current.set(e,t),r({ownerKey:`${y$}:${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),v$(`scope room confirmed`,{roomName:e})):(d.current.delete(e),v$(`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:`${y$}:${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(ts(e,t.scopeKey,t.scopeId))),requestCoverage:(e,t)=>{for(let n of t){let t=ts(e,n.scopeKey,n.scopeId);d.current.has(t)||(p.current?h.current(t,{...n,resourceType:e}):(f.current.set(t,{...n,resourceType:e}),v$(`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(),v$(`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(),v$(`reconnected; coverage and cache reset`,{connectionCount:n}))},[n,o]),(0,Q.useEffect)(()=>{o.clear(),g(),v$(`organization scope changed; cache cleared`,{currentOrganizationId:c})},[c,o,g]),(0,Q.useEffect)(()=>{if(!t)return;let n=e(fa.RESOURCE_UPDATED,e=>{o.invalidateResourceType(e.resourceType),v$(`invalidated by resource update`,{resourceType:e.resourceType,deliveryTarget:e.deliveryTarget,isScopeRoom:e.deliveryTarget===qa.SCOPE_ROOM_NOTIFICATION})}),r=e(fa.RESOURCE_DELETED,e=>{o.invalidateResourceType(e.resourceType)});return()=>{n(),r()}},[e,t,o]),null},x$;(function(e){e.CTRL=`ctrl`,e.ALT=`alt`,e.SHIFT=`shift`,e.META=`meta`,e.MOD=`mod`})(x$||={});function S$(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var C$=-100,w$={[cd.COMPONENT]:2,[cd.PAGE]:1,[cd.GLOBAL]:0};function T$(e){return e.length===1&&!/[a-z0-9]/i.test(e)}function E$(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(x$.CTRL);break;case`alt`:case`option`:n.push(x$.ALT);break;case`shift`:n.push(x$.SHIFT);break;case`meta`:case`cmd`:case`command`:case`win`:case`windows`:n.push(x$.META);break;case`mod`:n.push(x$.MOD);break;default:r=e}T$(r)&&(n=n.filter(e=>e!==x$.SHIFT));let i=S$(),a=[];return n.includes(x$.MOD)&&a.push(i?`⌘`:`Ctrl`),n.includes(x$.CTRL)&&a.push(i?`⌃`:`Ctrl`),n.includes(x$.ALT)&&a.push(i?`⌥`:`Alt`),n.includes(x$.SHIFT)&&a.push(i?`⇧`:`Shift`),n.includes(x$.META)&&a.push(i?`⌘`:`Win`),a.push(r.toUpperCase()),{modifiers:n,key:r,chord:[...[...n].sort(),r].join(`+`),display:a.join(i?``:`+`)}}function D$(e,t){let n=e.ctrlKey,r=e.altKey,i=e.shiftKey,a=e.metaKey,o=t.modifiers.includes(x$.MOD),s=S$(),c=t.modifiers.includes(x$.CTRL)||o&&!s,l=t.modifiers.includes(x$.ALT),u=t.modifiers.includes(x$.SHIFT),d=t.modifiers.includes(x$.META)||o&&s;return n!==c||r!==l||!T$(t.key)&&i!==u||a!==d?!1:e.key.toLowerCase()===t.key}var O$=(0,Q.createContext)(null);function k$(e,t){return e===t||e===cd.GLOBAL||t===cd.GLOBAL}var A$=({children:e,initialScope:t=cd.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=E$(e.shortcut),n=Array.from(o.current.values()).filter(n=>n.id!==e.id&&n.parsed.chord===t.chord&&k$(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&&k$(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===cd.PAGE&&n!==cd.PAGE||t.scope===cd.COMPONENT&&n!==cd.COMPONENT||r&&t.scope!==cd.GLOBAL||!D$(e,t.parsed))continue;let i=[t.priority??0,w$[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)(O$.Provider,{value:_,children:e})};function j$(){let e=(0,Q.useContext)(O$);if(!e)throw Error(`useHotkeyRegistry must be used within a HotkeyRegistryProvider`);return e}var M$=0;function Bxe(e,t,n={}){let{register:r}=j$(),i=(0,Q.useMemo)(()=>n.id??`hotkey-${++M$}`,[n.id]);return(0,Q.useEffect)(()=>{let a={id:i,shortcut:e,handler:t,description:n.description??e,scope:n.scope??cd.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)(()=>E$(e),[e])}function Vxe(e){let{register:t}=j$();(0,Q.useEffect)(()=>{let n=[];for(let r of e){let e={id:r.id??`hotkey-batch-${++M$}`,shortcut:r.shortcut,handler:r.handler,description:r.description??r.shortcut,scope:r.scope??cd.GLOBAL,enabled:r.enabled!==!1,group:r.group};n.push(t(e))}return()=>{for(let e of n)e()}},[e,t])}function Hxe(){let{pause:e,resume:t,isPaused:n}=j$();return{pause:e,resume:t,isPaused:n}}function Uxe(){let{activeScope:e,setActiveScope:t}=j$();return{activeScope:e,setActiveScope:t}}function N$(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 Wxe(e,t){switch(e){case void 0:return!0;case Vr.USER_SELF:return!!t.currentUserId;case Vr.ORGANIZATIONS:return!!t.currentOrganizationId;case Vr.APPLICATION:return!!t.currentApplicationId;case Vr.ANONYMOUS:return!!t.currentAnonymousUserId}}function Gxe(e,t){return Nm(e,t)}function Kxe(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 qxe(e,t){return(e??[]).every(e=>t.includes(e))}function Jxe(e,t){return qxe(e.requiredEngineCapabilities,t.enabledEngineCapabilities)&&_S(e.runtimeAvailability,t.runtimeContext)&&Gxe(e.requiredRoles,t.runtimeContext.effectiveRoles)&&Kxe(e.requiredFeatures,t.enabledFeatures)}function Yxe(e,t){if(e.target.kind!==dv.SUB_TABS)return e;let n=e.target.subTabs.filter(e=>_S(e.runtimeAvailability,t.runtimeContext));return n.length===0?null:n.length===e.target.subTabs.length?e:{...e,target:{...e.target,subTabs:n}}}function Xxe(e,t){let n=e.categories.filter(e=>Wxe(e.scope,t.scopeIds)),r=new Set(n.map(e=>e.ref)),i=e.sections.flatMap(e=>{if(!r.has(e.categoryRef)||!Jxe(e,t))return[];let n=Yxe(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 Zxe=[];function P$(){let e=jv(),t=Jp(),n=(0,Q.useContext)(fh)?.resolvedFeatures,r=gS(),i=(0,Q.useContext)(Fi),a=i?.appIdentity?.applicationId??t?.currentApplicationId??null,o=i?.appConfig?.enabledEngineCapabilities??Zxe;return(0,Q.useMemo)(()=>Xxe(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 Qxe=Object.values(Pl).map(e=>`${e.i18nKey}.title`);function F$(){let{registry:e}=lm(),{compositeViews:t,fullCustomViews:n,flowsActorsViews:r}=Rg(),i=Jp(),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:iu.FULL_CUSTOM,translationRef:KY(e.ref)})),...(r??[]).map(e=>GY({family:iu.FLOWS_ACTORS,translationRef:KY(e.ref)}))],i=e?.resourceConfigurations?Object.entries(e.resourceConfigurations).flatMap(([e,t])=>[...t.frontendConfiguration?.chartViews?.map(t=>GY({family:iu.CHART,translationRef:qY(e,t.ref)}))??[],...t.frontendConfiguration?.executionViews?.map(t=>GY({family:iu.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}=K({resource:a,keys:[...o,...s,...Qxe,Jm]}),h=cS(),{sections:g}=jv(),_=(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}=P$(),b=(0,Q.useMemo)(()=>eh(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 $xe={[jn.HOTKEY_SIDEBAR_TOGGLE]:`engine.hotkeys.sidebarToggle`,[jn.HOTKEY_NOTIFICATIONS_OPEN]:`engine.hotkeys.notificationsOpen`,[jn.HOTKEY_QUICK_SWITCHER_OPEN]:`engine.hotkeys.quickSwitcherOpen`,[jn.HOTKEY_SHORTCUTS_HELP]:`engine.hotkeys.shortcutsHelp`},I$=[{event:jn.HOTKEY_SIDEBAR_TOGGLE,shortcut:`Mod+B`,scope:cd.GLOBAL,group:yi.NAVIGATION},{event:jn.HOTKEY_QUICK_SWITCHER_OPEN,shortcut:`Mod+P`,scope:cd.GLOBAL,group:yi.NAVIGATION},{event:jn.HOTKEY_NOTIFICATIONS_OPEN,shortcut:`Mod+I`,scope:cd.GLOBAL,group:yi.NAVIGATION}];function eSe(e){return I$.includes(e)}function tSe(e){switch(e){case jn.HOTKEY_QUICK_SWITCHER_OPEN:return Fr.QUICK_SWITCHER;case jn.HOTKEY_NOTIFICATIONS_OPEN:return Fr.NOTIFICATION_CENTER;default:return}}function L$(){let{register:e}=j$(),{emit:t}=Ao(),n=F$(),{navigate:r}=wS(),{appComponentsConfiguration:i}=Rg(),a=gS(),o=i?.[Fr.HOTKEY],s=typeof o==`object`&&o?o.bindings:void 0,c=(0,Q.useMemo)(()=>iue(s,a),[s,a]),l=typeof o==`object`&&o?o.emitShortcuts:void 0,u=(0,Q.useMemo)(()=>N$(I$,l),[l]),d=(0,Q.useMemo)(()=>!c||!n?[]:Ah(c,n),[c,n]);return(0,Q.useEffect)(()=>{let i=[],a=e=>{let t=e.descriptionLabellingRef??$xe[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??cd.GLOBAL,group:n.group,handler:()=>{switch(n.event){case jn.HOTKEY_SIDEBAR_TOGGLE:t(wc.HOTKEY_SIDEBAR_TOGGLE,{});break;case jn.HOTKEY_NOTIFICATIONS_OPEN:t(wc.HOTKEY_NOTIFICATIONS_OPEN,{});break;case jn.HOTKEY_QUICK_SWITCHER_OPEN:t(wc.HOTKEY_QUICK_SWITCHER_OPEN,{});break;case jn.HOTKEY_SHORTCUTS_HELP:t(wc.HOTKEY_SHORTCUTS_HELP,{})}},launcher:tSe(n.event),preventDefault:n.preventDefault!==!1,priority:eSe(n)?C$: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??cd.GLOBAL,group:yi.ACTIONS,handler:()=>{zm.dispatchNavigationForResolvedTarget(r,t,Fr.HOTKEY)},launcher:Fr.HOTKEY,preventDefault:!0}));return()=>{for(let e of i)e()}},[e,t,d,r,u,n]),null}function R$({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_KBD,`Kbd`)(e);return(0,$.jsx)(n,{...t})}R$.displayName=`Kbd`;var z$=[yi.NAVIGATION,yi.ACTIONS,yi.HELP,`other`];function nSe(e,t){switch(e){case yi.NAVIGATION:return t(`navigation`);case yi.ACTIONS:return t(`actions`);case yi.HELP:return t(`help`);default:return t(`other`)}}function B$(e,t){switch(e){case cd.GLOBAL:return t(`shortcutsHelpScopeGlobal`);case cd.PAGE:return t(`shortcutsHelpScopePage`);case cd.COMPONENT:return t(`shortcutsHelpScopeComponent`);default:return t(`shortcutsHelpScopeUnknown`)}}function V$(){let[e,t]=(0,Q.useState)(!1),{on:n}=Ao(),{getHotkeys:r,getConflicts:i,activeScope:a,isPaused:o}=j$(),{t:s,tComponent:c,isReady:l}=K({component:B.APPLICATION_LEVEL_COMMAND_MENU});(0,Q.useEffect)(()=>n(wc.HOTKEY_SHORTCUTS_HELP,()=>{t(e=>!e)}),[n]);let u=(e,t)=>gp({tComponent:c,componentType:B.APPLICATION_LEVEL_COMMAND_MENU,key:e,params:t}),d=(0,Q.useMemo)(()=>e?r().slice().sort((e,t)=>{let n=z$.indexOf(e.group??`other`),r=z$.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 z$.map(t=>({group:t,label:nSe(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=Dp({t:s,key:`engine.hotkeys.shortcutsHelp`});return(0,$.jsx)(tG,{open:e,onOpenChange:t,children:(0,$.jsxs)(rG,{className:`max-w-3xl pt-10`,children:[(0,$.jsx)(aG,{children:(0,$.jsx)(sG,{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`),`: `,B$(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)(af,{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:B$(e.scope,u)}),e.launcher&&(0,$.jsx)(`span`,{children:e.launcher}),(0,$.jsx)(`span`,{children:e.id})]})]}),(0,$.jsx)(R$,{children:e.parsed.display})]},e.id))})]},e))})})]})]})})}function rSe(e){return typeof e==`string`?e:Ca.createOperationPathKey(e)}function iSe(e,t){let n=e.resourceConfigurations[t.resourceIdentifier];return n&&n.operations.find(e=>{let n=Ca.extractOperationPath(e);if(n.operationIdentifier!==t.operationIdentifier||n.variantType!==t.variantType)return!1;if(t.isOperationDefault){if(!n.isOperationDefault)return!1}else{let e=t.variantKey;if((n.variantKey??void 0)!==(e??void 0))return!1}return n.variantType!==at.API_CALL||n.isBulkOperation===!0==(t.isBulkOperation===!0)})||null}function aSe({children:e}){let t=lm(),n=Jp(),r=(0,Q.useCallback)(async(e,r,i)=>{if(!n)return t.doOperation(e,r,i);let a=rSe(e),o=null;try{o=Ca.parseOperationPathKey(a)}catch{o=null}let s=o?iSe(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:cse({initiatorInfos:s.initiatorInfos,targetResourceType:s.resourceIdentifier,registry:t.registry,ownContextualParameters:{...Object.fromEntries(Object.entries(c).filter(([e])=>fse.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=>Goe.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)(im.Provider,{value:a,children:e})}function oSe(){let e=Hh(),{notifyError:t}=Mm(),n=ap(),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 sSe(){let{currentOrganizationId:e}=sg(),{isLoading:t,isFeatureEnabled:n,resolvedForOrganizationId:r}=gh(),{doOperation:i,registry:a}=lm(),{emit:o,on:s}=Ao(),{httpClient:c}=Tu(),[l,u]=(0,Q.useState)(0),d=e??null,f=d!==null&&!t&&r===d&&n(Ds.CUSTOM_BRANDING);return(0,Q.useEffect)(()=>s(wc.RESOURCE_OPERATION_EXECUTED,()=>u(e=>e+1),e=>e.resourceType===ll.ORGANIZATION_PROFILES&&!da(e.operation??{operationIdentifier:e.operationIdentifier})),[s]),(0,Q.useEffect)(()=>{let e=!1,t=t=>{if(e)return;let n=d===null?void 0:Oi(t?.logo),r=n&&d!==null?`${c.getBaseURL().replace(/\/+$/,``)}${br}${Fee(d,Do.LOGO,n.updatedAt)}`:null;o(wc.ORGANIZATION_BRANDING_CHANGED,{organizationId:d,primaryColor:t?.primaryColor??null,secondaryColor:t?.secondaryColor??null,logoUrl:r,productName:t?.productName??null})},n=qm(a.resourceConfigurations[ll.ORGANIZATION_PROFILES]);return!f||d===null||!n?(t(null),()=>{e=!0}):(i(Ca.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(wc.ORGANIZATION_BRANDING_CHANGED,{organizationId:null,primaryColor:null,secondaryColor:null,logoUrl:null,productName:null}),[o]),null}var H$=[{componentType:B.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT},{componentType:B.PUBLIC_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT}];function cSe({children:e}){let{frontendConfiguration:t,markComponentInitialized:n}=Tu(),{on:r}=Ao(),i=(0,Q.useCallback)(e=>r(wc.USER_PREFERENCES_CHANGED,t=>{Object.prototype.hasOwnProperty.call(t,`uiPreferences`)&&e(t.uiPreferences??null)}),[r]),a=(0,Q.useCallback)(e=>r(wc.ORGANIZATION_BRANDING_CHANGED,t=>{e({primaryColor:t.primaryColor??null,secondaryColor:t.secondaryColor??null,logoUrl:t.logoUrl??null,productName:t.productName??null})}),[r]),o=(0,Q.useCallback)(()=>n(Pe.UI),[n]);return(0,$.jsx)(Bg,{frontendConfiguration:t,subscribeToUserPreferences:i,subscribeToOrganizationBranding:a,markInitialized:o,children:e})}function U$(e){return typeof e==`object`&&!!e}function W$(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 lSe(e){return e.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function G$(e){if(typeof e==`string`&&e.trim().length!==0)return lSe(e.trim())}function uSe(e){if(U$(e)&&U$(e.initializationDiagnostics))return e.initializationDiagnostics}function dSe(e,t){if(t&&U$(t.wildoError))return t.wildoError;if(U$(e)&&U$(e.wildoError))return e.wildoError}function fSe(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 pSe(e,t,n){return t&&typeof t.errorMessage==`string`&&t.errorMessage.trim().length>0?t.errorMessage:n&&U$(n.context)&&typeof n.context.message==`string`?n.context.message:e instanceof Error?e.message:typeof e==`string`?e:W$(e)}function mSe(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 K$(e){let t=[{label:`Application`,value:e.startupAppName}],n=G$(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 hSe(e){return!e||e.length===0?`root`:e.map(e=>typeof e==`string`?e:String(e)).join(` > `)}function gSe(e,t){let n=uSe(e),r=dSe(e,n),i=pSe(e,n,r),a=fSe(i),o=W$(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=>`${hSe(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:K$({diagnostics:n,wildoError:r,startupAppName:t})}}let s=mSe(r&&U$(r.context)?r.context:void 0),c=G$(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:K$({diagnostics:n,wildoError:r,startupAppName:t})}}function q$({options:e}){let t=(0,Q.useMemo)(()=>uie(e.featureConfiguration),[e.featureConfiguration]),n=(0,Q.useMemo)(()=>rs.getLogger(),[]),r=(0,Q.useMemo)(()=>{let e=n.debugByType(`ApplicationMainContext`);return n.setDebugTypeLogging(`ApplicationMainContext`,!1),e},[n]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)({[Pe.MAIN_CONTEXT]:!1,[Pe.UI]:!1,[Pe.LOADER]:!1,[Pe.ERRORS]:!1,[Pe.ROUTER]:!1,[Pe.I18N]:!1,[Pe.APP_MAIN_CONTAINER]:!1,[Pe.PUBLIC_APP_CONTAINER]:!1}),m=(0,Q.useCallback)(e=>e[Pe.MAIN_CONTEXT]&&e[Pe.UI]&&e[Pe.APP_MAIN_CONTAINER]&&e[Pe.PUBLIC_APP_CONTAINER],[]),h=(0,Q.useCallback)(e=>{p(t=>{let n={...t,[e]:!0},i=Object.entries(n).filter(([e,t])=>!t).map(([e])=>e);return r(`Component initialized: ${e}`,{newStatus:n,allComponentsReady:m(n),missingComponents:i}),m(n)&&(r(`All components initialized, setting isInitialized=true`),a(!0)),n})},[m,r]),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useMemo)(()=>{let t=e.env.VITE_APP_NAME?.trim();return t&&t.length>0?t:`Application`},[e.env]),b=(0,Q.useMemo)(()=>o?gSe(o,y):null,[o,y]);(0,Q.useEffect)(()=>{r(`useEffect triggered`,{initializationStartedRef:g.current,initializationFailedRef:_.current,hasApplicationServices:!!c,isInitialized:i,currentInitializationStatus:f}),c&&!i?(r(`Services exist but not initialized, restoring core components`),h(Pe.MAIN_CONTEXT),h(Pe.LOADER),h(Pe.ERRORS),h(Pe.ROUTER),h(Pe.APP_MAIN_CONTAINER),h(Pe.PUBLIC_APP_CONTAINER),r(`Marked container components for hot reload (they will re-mark themselves when rendered)`)):g.current||_.current?(r(`Skipping initialization (already started/failed)`),_.current&&!o&&s(`Initialization previously failed. Click Retry to try again.`)):(async()=>{g.current=!0;try{Ui.initializeGlobalErrorHandlers(),ya.injectEnvironmentVariables(aH(e.env,window.location));let i=ya.loadEnvironmentConfig(),a={apiBaseUrl:e.apiBaseUrl??i.apiBaseUrl};d(a);let o=await YQ.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(),No.assertRequiredRegistrations(`SaaS application`,H$)},onInitialized:()=>{r(`Application initialized successfully`)},onError:e=>{n.error(`Application initialization failed`,{error:e.message,details:e}),s(e)}});No.assertRequiredRegistrations(`SaaS application`,H$),l(o),h(Pe.MAIN_CONTEXT),h(Pe.LOADER),h(Pe.ERRORS),h(Pe.ROUTER)}catch(e){_.current=!0;let t=e instanceof Error?e.message:`Unknown initialization error`;s(e),n.error(`Application initialization failed`,{error:t,details:e})}})()},[e,c,i]);let x=(0,Q.useCallback)(()=>{_.current=!1,g.current=!1,window.location.reload()},[]),S=(0,Q.useRef)(window.location.pathname.startsWith(`/one-off-session/`)),C=(0,Q.useMemo)(()=>S.current?new $p:void 0,[]);if(o&&b)return ya.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)(fxe,{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)($y,{size:48})})}let w=(0,$.jsx)(Uy,{children:(0,$.jsx)(Lm,{children:(0,$.jsx)(sb,{children:(0,$.jsx)(rp,{children:(0,$.jsxs)(em,{tokenStorage:C,children:[(0,$.jsx)(Xy,{}),(0,$.jsx)(EH,{children:(0,$.jsxs)(Sm,{children:[(0,$.jsx)(zxe,{}),(0,$.jsx)(i$,{}),(0,$.jsx)(Lxe,{}),(0,$.jsx)(Ose,{customRoles:e.customRoles,children:(0,$.jsx)(Pm,{children:(0,$.jsx)($x,{children:(0,$.jsxs)(wh,{productDefinitions:e.productDefinitions,children:[(0,$.jsx)(oSe,{}),(0,$.jsxs)(rg,{featureConfiguration:t,children:[(0,$.jsx)(sSe,{}),(0,$.jsx)(aSe,{children:(0,$.jsx)(bU,{children:(0,$.jsx)(wW,{children:(0,$.jsxs)(Zm,{children:[(0,$.jsx)(L$,{}),(0,$.jsx)(V$,{}),(0,$.jsx)(lxe,{})]})})})})]})]})})})})]})})]})})})})});v.current===null&&(v.current=ig([{path:`/*`,element:w,errorElement:(0,$.jsx)(qy,{})}]));let T=v.current;return(0,$.jsx)(pt,{children:(0,$.jsx)(Cm,{children:(0,$.jsx)(Fi.Provider,{value:{appConfig:c.appConfigFromBackend,appIdentity:c.appConfigFromBackend.appIdentity,appPreferences:c.appConfigFromBackend.appPreferences,runtime:c.appConfigFromBackend.runtime,auth:c.appConfigFromBackend.auth,compliance:c.appConfigFromBackend.compliance,frontendConfiguration:c.frontendConfiguration,logger:c.logger,httpClient:c.httpClient,frontendProviderRegistry:c.frontendProviderRegistry,providerComponentRegistry:c.providerComponentRegistry,...e.shellCompanions?{shellCompanions:e.shellCompanions}:{},isInitialized:i,version:c.appConfigFromBackend.appIdentity?.version??`1.0.0`,initializationStatus:f,markComponentInitialized:h},children:(0,$.jsx)(cSe,{children:(0,$.jsx)(bi,{children:(0,$.jsx)(du,{children:(0,$.jsx)(Bm,{children:(0,$.jsx)(A$,{children:(0,$.jsx)(qp,{resourcesRepository:c.resourceRepository,children:(0,$.jsx)(wx,{children:(0,$.jsx)(g$,{children:(0,$.jsx)(QQ,{children:(0,$.jsxs)(Dz,{apiBaseUrl:u.apiBaseUrl,children:[(0,$.jsx)(o$,{}),(0,$.jsx)(jve,{}),(0,$.jsx)(l$,{}),(0,$.jsx)(XQ,{}),(0,$.jsx)(ZQ,{}),(0,$.jsx)(oH,{router:T})]})})})})})})})})})})})})})}function _Se(e){let t=gm()?.registry,n=cS(),{resourceType:r,operationIdentifier:i,variantKey:a}=e;return(0,Q.useMemo)(()=>{let e=t?.resourceConfigurations?.[r]?.operations;return e?e.filter(e=>String(e.operationIdentifier)===String(i)).filter(e=>a===void 0||e.variantKey===a).filter(e=>e.variantType===void 0||dte.includes(e.variantType)).some(e=>Vm({...e,resourceType:r},n)):!1},[t,r,i,a,n])}var vSe=[Sl.SECONDARY,Sl.COMPANION];function ySe(e){let{zones:t,viewport:n,contentAreaWidth:r,reconcileCollapsedZones:i,navigationState:a}=e;(0,Q.useEffect)(()=>{i(vSe.map(e=>({zone:e,mode:Lh({zoneConfig:t?.[e],viewport:n,contentAreaWidth:r}),contentModel:t?.[e]?.contentModel})))},[t,n,r,i,a])}function J$(e){return e.contentType===od.COMPOSITE_VIEW||e.contentType===od.CHART_VIEW||e.contentType===od.FULL_CUSTOM_VIEW||e.contentType===od.FLOWS_ACTORS_VIEW||e.contentType===od.EXECUTION_VIEW}function Y$(e,t={}){let{keepOperationTitle:n=!1}=t,r=e?.content?.contentType===od.RESOURCE_OPERATION?e.content.resourceContext.resourceType:void 0,i=(0,Q.useMemo)(()=>{if(e?.content.contentType!==od.COMPOSITE_VIEW)return[];let t=JY(e.content.viewRef);return t?[WY(t)]:[]},[e]),a=(0,Q.useMemo)(()=>{let t=e?.content;if(!t||!J$(t)||t.contentType===od.COMPOSITE_VIEW)return[];let n=YY({viewRef:t.viewRef,contentType:t.contentType});return n?[GY(n)]:[]},[e]),o=gm()?.registry.resourceConfigurations[r??``]?.operations,{tResourceOperation:s,tCompositeView:c,tView:l}=K({resource:r,keys:[...i,...a]});return(0,Q.useMemo)(()=>{if(!e)return{title:``};let{content:t}=e;if(t.contentType===od.RESOURCE_OPERATION){let{resourceType:e,operationIdentifier:r}=t.resourceContext,i=n?String(r):io(r,o);return{title:s(e,i,`title`)}}return J$(t)?{title:XY({viewRef:t.viewRef,contentType:t.contentType,tCompositeView:c,tView:l})}:t.contentType===od.SETTINGS_HUB?{title:`Settings`}:{title:``}},[e,o,n,c,s,l])}function bSe(){let e=(0,Q.useContext)(jH),t=Jp()?.currentOrganizationId,{getZoneState:n}=Px();return(0,Q.useCallback)(r=>use({entryOrganizationId:eg(r.content),entryOwnsBrowserUrl:Rh(r,n),currentOrganizationId:t,routeDecision:e}),[e,t,n])}var xSe=({wildoError:e})=>{let t=ap();return(0,$.jsx)(`div`,{className:`space-y-element`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground whitespace-pre-wrap`,children:t(e)})})},X$=Xs(B.LOW_LEVEL_RESIZABLE_PANEL_GROUP,`ResizablePanelGroup`,[`Panel`,`Handle`]);function Z$({preset:e=q.DEFAULT,...t}){let n=X$(e);return(0,$.jsx)(n,{...t})}function Q$({preset:e=q.DEFAULT,...t}){let n=X$(e);return(0,$.jsx)(n.Panel,{...t})}function $$({preset:e=q.DEFAULT,...t}){let n=X$(e);return(0,$.jsx)(n.Handle,{...t})}var e1=Xs(B.LOW_LEVEL_SHEET,`Sheet`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function t1({preset:e=q.DEFAULT,...t}){let n=e1(e);return(0,$.jsx)(n,{...t})}var n1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=e1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});n1.displayName=`SheetTrigger`;var r1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=e1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});r1.displayName=`SheetContent`;function SSe({preset:e=q.DEFAULT,...t}){let n=e1(e);return(0,$.jsx)(n.Close,{...t})}function i1({preset:e=q.DEFAULT,...t}){let n=e1(e);return(0,$.jsx)(n.Header,{...t})}function a1({preset:e=q.DEFAULT,...t}){let n=e1(e);return(0,$.jsx)(n.Footer,{...t})}var o1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=e1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});o1.displayName=`SheetTitle`;var s1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=e1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});s1.displayName=`SheetDescription`;var c1=Xs(B.LOW_LEVEL_DRAWER,`Drawer`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function l1({preset:e=q.DEFAULT,...t}){let n=c1(e);return(0,$.jsx)(n,{...t})}var u1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});u1.displayName=`DrawerTrigger`;var d1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});d1.displayName=`DrawerContent`;function f1({preset:e=q.DEFAULT,...t}){let n=c1(e);return(0,$.jsx)(n.Close,{...t})}function p1({preset:e=q.DEFAULT,...t}){let n=c1(e);return(0,$.jsx)(n.Header,{...t})}function m1({preset:e=q.DEFAULT,...t}){let n=c1(e);return(0,$.jsx)(n.Footer,{...t})}var h1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});h1.displayName=`DrawerTitle`;var g1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});g1.displayName=`DrawerDescription`;function _1({requestedMode:e,isMobileViewport:t,mobileShape:n}){if(e===Or.DIALOG&&t){if(n===`drawer`)return Or.DRAWER;if(n===`sheet`)return Or.SHEET}return e}function v1(){let e=null;return{resolve(t){let n=_1(t);return t.open===!0?(e??=n,e):(e=null,n)},reset(){e=null}}}var y1=({open:e,onOpenChange:t,trigger:n,anchor:r,title:i,titleVisuallyHidden:a,description:o,children:s,footer:c,config:l,surfacePolicyOverride:u,className:d,cancelText:f,confirmText:p,onConfirm:m,onCancel:h,commandPlaceholder:g,commandItems:_=[]})=>{let{mode:v,...y}=l,[b,x]=(0,Q.useState)(!1),S=e??b,C=(0,Q.useCallback)(n=>{e===void 0&&x(n),t?.(n)},[t,e]),{isMobile:w,getSurfacePolicy:T}=Rg(),E=(0,Q.useRef)(null);E.current===null&&(E.current=v1());let D=T?.(nt.OVERLAY,u),O=E.current.resolve({open:S,requestedMode:v,isMobileViewport:w,mobileShape:D?.geometry?.mobileShape}),{tComponent:k,isReady:A}=K({component:[B.LOW_LEVEL_OVERLAY_CONTAINER,B.LOW_LEVEL_DIALOG,B.LOW_LEVEL_SHEET,B.LOW_LEVEL_DRAWER]}),j=(e,t)=>gp({tComponent:k,componentType:B.LOW_LEVEL_OVERLAY_CONTAINER,key:e,params:t}),M=f??j(`cancel`),N=p??j(`confirm`),P=g??j(`commandPlaceholder`),F=j(`commandEmpty`),I=j(`commandGroup`),ee=j(`close`),L=jSe(O,k),R=i||L,z=a||!i,te=(0,Q.useMemo)(()=>l.closeOnEscape===!1?e=>e.preventDefault():void 0,[l.closeOnEscape]);if(!A)return null;switch(O){case Or.DIALOG:return(0,$.jsx)(x1,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.ALERT:return(0,$.jsx)(CSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,cancelText:M,confirmText:N,onConfirm:m,onCancel:h,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.SHEET:return(0,$.jsx)(wSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.DRAWER:return(0,$.jsx)(TSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.COMMAND:return(0,$.jsx)(ESe,{open:e,onOpenChange:C,placeholder:P,emptyLabel:F,groupLabel:I,items:_,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.POPOVER:return(0,$.jsx)(DSe,{open:e,onOpenChange:C,trigger:n,anchor:r,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.LIGHTBOX:return(0,$.jsx)(OSe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:z,closeLabel:ee,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s});case Or.ACTION_SHEET:return(0,$.jsx)(kSe,{open:e,onOpenChange:C,trigger:n,title:R,cancelText:M,config:y,surfacePolicyOverride:u,className:d,children:s});case Or.TOAST:return null;default:return(0,$.jsx)(x1,{open:e,onOpenChange:C,trigger:n,title:R,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:te,children:s})}};function b1(e){return e?{}:{"aria-describedby":void 0}}var x1=({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=ASe(s.size);return(0,$.jsxs)(tG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(nG,{asChild:!0,children:n}),(0,$.jsxs)(rG,{surfacePolicyOverride:c,className:U(f,l),...b1(a),onEscapeKeyDown:d,children:[i&&!a?r&&(0,$.jsx)(sG,{className:`sr-only`,children:r}):(r||a)&&(0,$.jsxs)(aG,{children:[r&&(0,$.jsx)(sG,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(cG,{children:a})]}),u,o&&(0,$.jsx)(oG,{children:o})]})]})},CSe=({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)(Vw,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(Hw,{asChild:!0,children:n}),(0,$.jsxs)(Uw,{surfacePolicyOverride:u,className:d,onEscapeKeyDown:p,children:[(0,$.jsxs)(Ww,{children:[r&&(0,$.jsx)(Kw,{children:r}),i&&(0,$.jsx)(qw,{children:i})]}),f,(0,$.jsxs)(Gw,{children:[(0,$.jsx)(Yw,{onClick:c,children:a}),(0,$.jsx)(Jw,{onClick:s,children:o})]})]})]}),wSe=({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??Zs.END,p=typeof f==`string`&&!Object.values(Zs).includes(f)?f:Hl(f,document.documentElement.dir===`rtl`?`rtl`:`ltr`);return(0,$.jsxs)(t1,{open:e,onOpenChange:t,modal:s.modal??!0,children:[n&&(0,$.jsx)(n1,{asChild:!0,children:n}),(0,$.jsxs)(r1,{surfacePolicyOverride:c,side:p,className:l,...b1(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)(i1,{children:[r&&(0,$.jsx)(o1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(s1,{children:a})]}),u,o&&(0,$.jsx)(a1,{children:o})]})]})},TSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u})=>(0,$.jsxs)(l1,{open:e,onOpenChange:t,direction:`bottom`,snapPoints:s.snapPoints,dismissible:s.closeOnEscape!==!1&&s.dismissible,children:[n&&(0,$.jsx)(u1,{asChild:!0,children:n}),(0,$.jsxs)(d1,{surfacePolicyOverride:c,className:l,...b1(a),children:[(r||a)&&(0,$.jsxs)(p1,{children:[r&&(0,$.jsx)(h1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(g1,{children:a})]}),(0,$.jsx)(`div`,{className:`px-container pb-card`,children:u}),o&&(0,$.jsx)(m1,{children:o})]})]}),ESe=({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)(R$,{className:`ms-auto`,children:e.shortcut})]},e.id))}),c]})]}),DSe=({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})]}),OSe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,closeLabel:a,surfacePolicyOverride:o,className:s,children:c,onEscapeKeyDown:l})=>{let{getRecipe:u}=Rg(),d=u(oc.OVERLAY_BACKDROP);return(0,$.jsxs)(tG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(nG,{asChild:!0,children:n}),(0,$.jsxs)(rG,{surfacePolicyOverride:o,showCloseButton:!1,onEscapeKeyDown:l,...b1(void 0),className:U(`max-w-[90vw] max-h-[90vh] p-0 overflow-hidden`,d.base,s),children:[(0,$.jsxs)(iG,{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)(sG,{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)(sG,{className:`text-white text-center text-base font-normal tracking-normal leading-normal`,children:r})})]})]})},kSe=({open:e,onOpenChange:t,trigger:n,title:r,cancelText:i,surfacePolicyOverride:a,className:o,children:s})=>(0,$.jsxs)(l1,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(u1,{asChild:!0,children:n}),(0,$.jsxs)(d1,{surfacePolicyOverride:a,className:o,children:[r&&(0,$.jsx)(p1,{className:`text-center`,children:(0,$.jsx)(h1,{className:`text-sm font-normal text-muted-foreground`,children:r})}),(0,$.jsx)(`div`,{className:`px-card-sm pb-card`,children:s}),(0,$.jsx)(m1,{className:`pt-element border-t`,children:(0,$.jsx)(f1,{asChild:!0,children:(0,$.jsx)(X,{variant:J.OUTLINE,className:`w-full`,children:i})})})]})]});function ASe(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 jSe(e,t){switch(e){case Or.DIALOG:return gp({tComponent:t,componentType:B.LOW_LEVEL_DIALOG,key:`defaultTitle`});case Or.SHEET:return gp({tComponent:t,componentType:B.LOW_LEVEL_SHEET,key:`defaultTitle`});case Or.DRAWER:return gp({tComponent:t,componentType:B.LOW_LEVEL_DRAWER,key:`defaultTitle`});default:return``}}y1.displayName=`OverlayContainer`;var MSe=`w-full max-w-md overflow-y-auto`,NSe=`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`,S1=`w-full h-[min(92vh,56rem)] p-0 gap-0 overflow-hidden`,PSe=`${S1} max-w-6xl`,FSe=`${S1} max-w-[min(94vw,88rem)]`;function ISe(e){return e?FSe:PSe}function C1(e){switch(e){case Rn.SHEET:return Or.SHEET;case Rn.DRAWER:return Or.DRAWER;case Rn.DIALOG:default:return Or.DIALOG}}function LSe(e){return e===Or.SHEET?MSe:NSe}var RSe=[W.LIST,W.SEARCH];function w1(e){return e.kind===dv.SUB_TABS?e.subTabs.map(e=>e.target):[e]}function zSe(e){return e===cr.VERTICAL_TABS}var BSe={[fv.SECURITY]:!1,[fv.APPEARANCE]:!1,[fv.INVITATIONS]:!1,[fv.BILLING]:!0,[fv.CONNECTED_ACCOUNTS]:!1,[fv.ORGANIZATION_CONNECTED_ACCOUNTS]:!1,[fv.APPLICATION_CONNECTED_ACCOUNTS]:!1,[fv.AGENT_WORK_OVERRIDE_RATE]:!1,[fv.AUTONOMOUS_AGENTS]:!1,[fv.MODEL_COST_BREAKDOWN]:!1,[fv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN]:!1,[fv.REPRESENTATIVE_ACTIVITY]:!1,[fv.AGENT_WORK_EVALUATION_EXPORT]:!1};function VSe(e){return e.kind===dv.ENGINE_PANEL?BSe[e.panelRef]:e.kind===dv.RESOURCE_OPERATION&&RSe.includes(String(e.operation))}function HSe(e){return w1(e).some(VSe)}function USe(e,t,n){if(!t)return!1;let r=e.find(e=>e.ref===t);return r?HSe(r.target)?!0:w1(r.target).some(e=>e.kind===dv.RESOURCE_OPERATION&&zSe(n(e.resourceType))):!1}function T1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_SEPARATOR,`Separator`)(e);return(0,$.jsx)(n,{...t})}var E1;(function(e){e.ACTIVE=`active`,e.INACTIVE=`inactive`,e.UNAVAILABLE=`unavailable`})(E1||={});var WSe={[E1.ACTIVE]:`success`,[E1.INACTIVE]:`outline`,[E1.UNAVAILABLE]:`secondary`},D1=({icon:e,title:t,description:n,state:r,statusLabel:i,meta:a,action:o,children:s})=>{let{renderIcon:c}=Of(),l=r===E1.ACTIVE;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item py-group first:pt-0 last:pb-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:U(`flex size-9 shrink-0 items-center justify-center rounded-md`,l?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:c(e,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:t}),(0,$.jsx)(Mf,{variant:WSe[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})]})},GSe=()=>{let{auth:e}=Tu(),{auth:t,signOutEverywhere:n}=fm(),{user:r}=sg(),i=Xx(),a=ap(),[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)(()=>cb(u.map(e=>_d(e.providerRef))),[u]),{tComponent:T,t:E,isReady:D,formatDate:O}=K({component:[B.APP_LAYOUTS_SECURITY_SETTINGS,B.PUBLIC_LAYOUTS_USER_REGISTER,B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED],keys:w}),k=(0,Q.useCallback)((e,t)=>T(B.APP_LAYOUTS_SECURITY_SETTINGS,e,t),[T]),A=(0,Q.useCallback)(e=>T(B.PUBLIC_LAYOUTS_USER_REGISTER,e),[T]),j=e?.passkeyConfig,M=i.userTypeAuth?.methodManagement,N=i.passwordPolicy,P=j?.maxPasskeysPerUser??10,F=M?.allowUserMethodRemoval??!0,I=(0,Q.useCallback)(async()=>{p(!0),h(null);try{let e=vc(),[t,n,r]=await Promise.all([e.getMyMethods(),e.passkeyList().catch(()=>({credentials:[]})),e.getIdentityLinks().catch(()=>({links:[]}))]);s(t.methods??[]),l(n.credentials??[]),d(r.links??[])}catch(e){h(a(e,k(fu.ERROR)))}finally{p(!1)}},[k,a]);(0,Q.useEffect)(()=>{I()},[I]),(0,Q.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>_(null),5e3);return()=>clearTimeout(e)},[g]);let ee=st.getEnrollableSecondFactorMethods(),L=o.filter(e=>e.enrolled&&ee.includes(e.method)).map(e=>e.method),R=Um.evaluateAccountCompleteness(t.identification?.requiresMFA??!1,t.identification?.secondFactorMethods?.map(e=>e.method)??[],L.length>0?L:t.enrolledSecondFactorMethods,i.userTypeAuth?.mfaPolicy?.acceptableMFAMethods??[]),z=o.some(e=>e.method===hs.PASSWORD&&e.enrolled),te=o.some(e=>e.method===hs.TOTP&&e.enrolled),ne=o.find(e=>e.method===hs.SMS_OTP),re=ne?.enrolled??!1,ie=ne?.details?.phoneNumber,ae=(0,Q.useMemo)(()=>u.map(t=>({...t,providerLabel:lb({providerRef:t.providerRef,displayName:e?.socialOAuth2Providers?.[t.providerRef]?.displayName,translate:E})})),[e?.socialOAuth2Providers,u,E]),oe=(0,Q.useCallback)(async()=>{if(!(c.length>=P)&&typeof window<`u`&&window.PublicKeyCredential){C(!0),h(null);try{let e=vc(),t=await e.passkeyRegisterOptions(),n=await fp({optionsJSON:t});await e.passkeyRegisterVerify({response:n}),_(k(fu.SUCCESS)),I()}catch(e){if(ii(e))return;let t=e?.name===`NotAllowedError`?k(fu.PASSKEY_CANCELLED):a(e,k(fu.ERROR));h(t)}finally{C(!1)}}},[P,c.length,I,k,a]),se=(0,Q.useCallback)(async e=>{if(F)try{await vc().passkeyRemove(e),_(k(fu.SUCCESS)),I()}catch(e){ii(e)||h(a(e,k(fu.ERROR)))}},[F,I,k,a]),ce=(0,Q.useCallback)(async()=>{try{await vc().mfaTOTPDisable(),_(k(fu.SUCCESS)),y(!1),I()}catch(e){ii(e)||h(a(e,k(fu.ERROR)))}},[I,k,a]),le=(0,Q.useCallback)(async e=>{if(F)try{await vc().unlinkIdentityLink(e),_(k(fu.SUCCESS)),I()}catch(e){ii(e)||h(a(e,k(fu.ERROR)))}},[F,I,k,a]);if(!D)return null;let ue=typeof window<`u`&&!!window.PublicKeyCredential,de=ue?c.length>0?E1.ACTIVE:E1.INACTIVE:E1.UNAVAILABLE,fe=e=>{switch(e){case E1.ACTIVE:return k(fu.STATUS_ACTIVE);case E1.UNAVAILABLE:return k(fu.STATUS_UNAVAILABLE);case E1.INACTIVE:return k(fu.STATUS_NOT_CONFIGURED)}},pe=(0,$.jsxs)(D1,{icon:TX[hs.PASSKEY],title:k(fu.SECTION_PASSKEYS),description:k(fu.PASSKEYS_DESCRIPTION),state:de,statusLabel:fe(de),action:ue&&c.length<P?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:oe,disabled:S,children:k(S?fu.PASSKEY_ADDING:fu.PASSKEY_ADD)}):void 0,children:[!ue&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:k(fu.PASSKEY_UNSUPPORTED)})}),ue&&c.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:c.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.name}),e.createdAt&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:k(fu.PASSKEY_ADDED,{date:O(e.createdAt)})})]}),F&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>se(e.credentialId),children:k(fu.PASSKEY_REMOVE)})]},e.credentialId))})]}),me=te?E1.ACTIVE:E1.INACTIVE,he=(0,$.jsx)(D1,{icon:TX[hs.TOTP],title:k(fu.SECTION_TOTP),description:k(fu.TOTP_DESCRIPTION),state:me,statusLabel:fe(me),action:te?F?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:ce,children:k(fu.TOTP_DISABLE)}):void 0:v?void 0:(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>y(!0),children:k(fu.TOTP_SETUP)}),children:te?(0,$.jsx)($.Fragment,{children:R.enrolledMethods.length===1&&R.enrolledMethods.includes(hs.TOTP)&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:k(fu.TOTP_ONLY_MFA_WARNING)})})}):v?(0,$.jsx)(XX,{onComplete:()=>{y(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null}),ge=re?E1.ACTIVE:E1.INACTIVE,_e=(0,$.jsx)(D1,{icon:TX[hs.SMS_OTP],title:k(fu.SECTION_PHONE),description:k(fu.PHONE_DESCRIPTION),state:ge,statusLabel:fe(ge),meta:re&&ie?(0,$.jsx)(Z,{className:`text-sm`,children:ie}):void 0,action:re?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>x(!0),children:k(fu.PHONE_CHANGE)}):b?void 0:(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>x(!0),children:k(fu.PHONE_VERIFY)}),children:re&&!b?null:b?(0,$.jsx)(QX,{onComplete:()=>{x(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:k(fu.PAGE_TITLE)}),m&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:m})}),g&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:g})}),f?(0,$.jsx)(Z,{className:`text-muted-foreground`,children:k(fu.LOADING)}):(0,$.jsx)(OF,{children:(0,$.jsxs)(FF,{className:`flex flex-col divide-y divide-border p-card`,children:[pe,he,_e,(0,$.jsx)(KSe,{hasPassword:z,passwordPolicy:N,userEmail:r?.email,t:k,tPolicy:A,onSuccess:()=>{_(k(fu.SUCCESS)),I()},onError:e=>h(e)}),(0,$.jsx)(JSe,{links:ae,allowRemoval:F,t:k,onUnlink:le})]})}),!f&&(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{className:`flex flex-col divide-y divide-border p-card`,children:(0,$.jsx)(qSe,{t:k,formatDate:O,onSignOutEverywhere:n,onError:e=>h(a(e))})})})]})},KSe=({hasPassword:e,passwordPolicy:t,userEmail:n,t:r,tPolicy:i,onSuccess:a,onError:o})=>{let s=ap(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=Nw({defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),p=Nw({defaultValues:{newPassword:``,confirmPassword:``}}),m=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(fu.PASSWORD_MISMATCH));else{l(!0);try{await vc().passwordChange(e.currentPassword,e.newPassword),a(),f.reset(),d(!1)}catch(e){ii(e)||o(s(e,r(fu.ERROR)))}finally{l(!1)}}},[f,o,a,r,s]),h=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(fu.PASSWORD_MISMATCH));else{l(!0);try{await vc().passwordSet(e.newPassword),a(),p.reset(),d(!1)}catch(e){ii(e)||o(s(e,r(fu.ERROR)))}finally{l(!1)}}},[o,a,p,r,s]),g=e?E1.ACTIVE:E1.INACTIVE;return(0,$.jsx)(D1,{icon:TX[hs.PASSWORD],title:r(fu.SECTION_PASSWORD),description:r(fu.PASSWORD_DESCRIPTION),state:g,statusLabel:r(e?fu.STATUS_ACTIVE:fu.STATUS_NOT_CONFIGURED),action:u?(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>{d(!1),f.reset(),p.reset()},children:r(fu.CANCEL)}):(0,$.jsx)(X,{variant:J.OUTLINE,onClick:()=>d(!0),children:r(e?fu.PASSWORD_CHANGE:fu.PASSWORD_SET)}),children:u?e?(0,$.jsx)(WC,{...f,children:(0,$.jsxs)(`form`,{onSubmit:f.handleSubmit(m),className:`space-y-4`,children:[(0,$.jsx)(yZ,{email:n}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:r(fu.PASSWORD_CURRENT)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`current-password`,...f.register(`currentPassword`,{required:!0})})]}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:r(fu.PASSWORD_NEW)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`new-password`,...f.register(`newPassword`,{required:!0})}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:r(fu.PASSWORD_CONFIRM)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`new-password`,...f.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(fu.PASSWORD_CHANGE)})]})}):(0,$.jsx)(WC,{...p,children:(0,$.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,$.jsx)(yZ,{email:n}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:r(fu.PASSWORD_NEW)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`new-password`,...p.register(`newPassword`,{required:!0})}),(0,$.jsx)(vZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(sx,{children:[(0,$.jsx)(cx,{children:r(fu.PASSWORD_CONFIRM)}),(0,$.jsx)(eN,{type:`password`,autoComplete:`new-password`,...p.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(fu.PASSWORD_SET)})]})}):null})},qSe=({t:e,formatDate:t,onSignOutEverywhere:n,onError:r})=>{let{renderIcon:i}=Of(),{t:a}=K(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(r);m.current=r,(0,Q.useEffect)(()=>{let e=!1;return vc().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 vc().revokeMySession(e),t()}catch(e){e?.httpStatus===404?t():m.current(e)}finally{p(null)}},[]),g=(e,t)=>{let n=Mc(e,t),r=a(n);return r===n?is(t):r},_=t=>e(fu.SESSION_DEVICE,{browser:g(ji.BROWSER,t.browser??hne.OTHER),operatingSystem:g(ji.OPERATING_SYSTEM,t.operatingSystem??Kie.OTHER)}),v=n=>n.ipAddress?e(fu.SESSION_DETAILS,{address:n.ipAddress,lastActive:t(n.lastActiveAt)}):e(fu.SESSION_LAST_ACTIVE,{lastActive:t(n.lastActiveAt)}),y=(0,Q.useCallback)(async()=>{l(!0);try{await n()}catch(e){l(!1),s(!1),r(e)}},[n,r]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:i(H.LOGOUT,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:e(fu.SECTION_SESSIONS)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e(fu.SIGN_OUT_EVERYWHERE_DESCRIPTION)})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>s(!0),disabled:c,children:e(fu.SIGN_OUT_EVERYWHERE)})}),(0,$.jsx)(Vw,{open:o,onOpenChange:e=>{!e&&!c&&s(!1)},children:(0,$.jsxs)(Uw,{children:[(0,$.jsxs)(Ww,{children:[(0,$.jsx)(Kw,{children:e(fu.SIGN_OUT_EVERYWHERE_CONFIRM_TITLE)}),(0,$.jsx)(qw,{children:e(fu.SIGN_OUT_EVERYWHERE_CONFIRM_DESCRIPTION)})]}),(0,$.jsxs)(Gw,{children:[(0,$.jsx)(Yw,{disabled:c,children:e(fu.CANCEL)}),(0,$.jsx)(Jw,{disabled:c,onClick:e=>{e.preventDefault(),y()},children:e(fu.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(fu.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)(Mf,{variant:`secondary`,children:e(fu.SESSION_THIS_DEVICE)})]}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:v(t)})]}),!t.isCurrent&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:f===t.sessionId,onClick:()=>{h(t.sessionId)},children:e(fu.SESSION_SIGN_OUT)})]},t.sessionId))})]})},JSe=({links:e,allowRemoval:t,t:n,onUnlink:r})=>(0,$.jsx)(D1,{icon:TX[hs.EXTERNAL_OAUTH2],title:n(fu.SECTION_IDENTITY_LINKS),description:n(fu.IDENTITY_LINKS_DESCRIPTION),state:e.length>0?E1.ACTIVE:E1.INACTIVE,statusLabel:n(e.length>0?fu.STATUS_ACTIVE:fu.STATUS_NOT_CONFIGURED),children:e.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.providerLabel}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:e.providerEmail})]}),t&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:()=>r(e._id),children:n(fu.IDENTITY_LINKS_UNLINK)})]},e._id))})});function YSe(e,t,n){let r=e.resourceConfigurations[t];return r?r.operations.find(e=>e.operationIdentifier===n&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)??null:null}function O1(){let{themePreference:e,setTheme:t}=Rg(),{doOperation:n,registry:r}=lm();return{themePreference:e,selectTheme:(0,Q.useCallback)(e=>{t(e);let i=YSe(r,ll.USER_SELF_PREFERENCES,W.UPDATE);if(!i)return;let a=Ca.buildOperationPathKeyFromOperation(i);n(a,{contextualParameters:{},requestData:{ui:{theme:e}}}).catch(()=>{})},[n,r,t])}}var XSe=[ss.LIGHT,ss.DARK,ss.AUTO],ZSe={[ss.LIGHT]:`themeLight`,[ss.DARK]:`themeDark`,[ss.AUTO]:`themeSystem`},QSe=[ml.BACKGROUND,ml.FOREGROUND,ml.MUTED,ml.MUTED_FOREGROUND,ml.PRIMARY,ml.BORDER];function k1(e,t,n){let r=r=>{let i=e?.[r]??t?.[r];return i?see(i,n):`var(--${r})`};return QSe.reduce((e,t)=>({...e,[t]:r(t)}),{})}var A1=({palette:e,className:t})=>(0,$.jsxs)(`div`,{className:U(`flex h-full w-full gap-[3px] p-[5px]`,t),style:{backgroundColor:e[ml.BACKGROUND]},children:[(0,$.jsxs)(`div`,{className:`flex w-1/4 shrink-0 flex-col gap-[3px] rounded-[3px] p-[3px]`,style:{backgroundColor:e[ml.MUTED]},children:[(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[ml.PRIMARY]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-3/4 rounded-full`,style:{backgroundColor:e[ml.MUTED_FOREGROUND],opacity:.5}}),(0,$.jsx)(`div`,{className:`h-[3px] w-2/3 rounded-full`,style:{backgroundColor:e[ml.MUTED_FOREGROUND],opacity:.5}})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-[4px] rounded-[3px] border p-[4px]`,style:{backgroundColor:e[ml.MUTED],borderColor:e[ml.BORDER]},children:[(0,$.jsx)(`div`,{className:`h-[4px] w-2/3 rounded-full`,style:{backgroundColor:e[ml.FOREGROUND]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[ml.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`h-[3px] w-4/5 rounded-full`,style:{backgroundColor:e[ml.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`mt-auto h-[6px] w-2/5 rounded-[2px]`,style:{backgroundColor:e[ml.PRIMARY]}})]})]}),$Se=({option:e,light:t,dark:n})=>e===ss.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)(A1,{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)(A1,{palette:n})})})]}):(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-16 w-full overflow-hidden rounded-md border`,children:(0,$.jsx)(A1,{palette:e===ss.DARK?n:t})}),eCe=()=>{let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_APPEARANCE_SETTINGS}),{designSystemConfiguration:n}=Rg(),{themePreference:r,selectTheme:i}=O1(),a=(0,Q.useCallback)(t=>e(B.APP_LAYOUTS_APPEARANCE_SETTINGS,t),[e]),o=(0,Q.useMemo)(()=>k1(n?.tokens,n?.customTokens,ys.LIGHT),[n]),s=(0,Q.useMemo)(()=>k1(n?.tokens,n?.customTokens,ys.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)(wF,{value:r,onValueChange:e=>i(e),"aria-label":a(`themeHeading`),className:`grid-cols-1 gap-item sm:grid-cols-3`,children:XSe.map(e=>{let t=`appearance-theme-${e}`;return(0,$.jsxs)(VX,{htmlFor:t,className:U(`flex cursor-pointer flex-col gap-element rounded-lg border p-card-sm font-normal transition-colors`,r===e?`border-primary ring-1 ring-primary`:`hover:border-primary/40`),children:[(0,$.jsx)($Se,{option:e,light:o,dark:s}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-xs`,children:[(0,$.jsx)(TF,{id:t,value:e}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:a(ZSe[e])})]})]},e)})})]}):null},tCe=[oi.ROLES],nCe=yd().min(1),rCe=()=>{let{tComponent:e,tRole:t,isReady:n,formatDateTime:r}=K({component:B.APP_LAYOUTS_INVITATIONS_SETTINGS,keys:tCe}),{refreshOrganizations:i}=sg(),a=(0,Q.useCallback)((t,n)=>e(B.APP_LAYOUTS_INVITATIONS_SETTINGS,t,n),[e]),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(a);b.current=a;let x=(0,Q.useCallback)(async()=>{p(!0),_(null);try{let e=vc(),[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 vc().acceptMyInvitation(e),await i(),y(a(`acceptSuccess`)),await x()}catch(e){ii(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,i,a]),C=(0,Q.useCallback)(async e=>{h(e),_(null);try{await vc().rejectMyInvitation(e),y(a(`rejectSuccess`)),await x()}catch(e){ii(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,a]),w=(0,Q.useCallback)(async(e,t)=>{h(e),_(null);try{y(await t()),await x()}catch(e){jr(e)&&await x(),ii(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 vc().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 vc().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)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:g})}),v&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:v})}),(f||D)&&(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{className:`p-card`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(f?`loading`:`empty`)})})}),!f&&o.length>0&&(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:o.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-section py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.organizationName??a(`unknownOrganization`)}),e.roles.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`rolesPrefix`),` `,e.roles.map(e=>t(e,`label`)).join(`, `)]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:m===e.membershipId,onClick:()=>C(e.membershipId),children:a(`rejectButton`)}),(0,$.jsx)(X,{size:Y.SM,disabled:m===e.membershipId,onClick:()=>S(e.membershipId),children:a(`acceptButton`)})]})]},e.membershipId))})})}),!f&&c.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`invitations-settings-relationships`,className:`flex flex-col gap-group`,children:[(0,$.jsx)(`h4`,{id:`invitations-settings-relationships`,className:`text-sm font-semibold`,children:a(`relationshipInvitationsHeading`)}),(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>{let n=e.receivingOrganizations,i=u[e.invitationId]??n[0]?.organizationId,o=m===e.invitationId;return(0,$.jsxs)(`li`,{className:`flex flex-col gap-group py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.representingOrganizationName??a(`unknownRepresentingOrganization`)}),e.purpose&&(0,$.jsx)(Z,{className:`text-sm`,children:e.purpose}),e.role&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`relationshipRolePrefix`),` `,t(e.role,`label`)]}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:a(`relationshipExpires`,{date:r(e.expiresAt)})})]}),n.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`relationshipNoReceivingOrganization`)}):n.length===1?(0,$.jsx)(Z,{className:`text-sm`,children:a(`relationshipReceivesInto`,{organization:n[0].organizationName??a(`unknownOrganization`)})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(VX,{htmlFor:`field-receiving-organization-${e.invitationId}`,children:a(`relationshipReceivingOrganizationLabel`)}),(0,$.jsx)(gF,{name:`receiving-organization-${e.invitationId}`,schema:nCe,options:n.map(e=>({value:e.organizationId,label:e.organizationName??a(`unknownOrganization`)})),value:i,disabled:o,onChange:t=>d(n=>({...n,[e.invitationId]:t}))})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-element`,children:[(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,disabled:o,onClick:()=>E(e),children:a(`relationshipDeclineButton`)}),n.length>0&&(0,$.jsx)(X,{size:Y.SM,disabled:o||!i,onClick:()=>T(e),children:a(`relationshipReceiveButton`)})]})]},e.invitationId)})})})})]})]})};function j1(e){return cb([e?_d(e):void 0])}function M1(e){if(e.providerRef)return lb({providerRef:e.providerRef,translate:e.translate})}function N1({preset:e=q.DEFAULT,...t}){let n=Hh(),r=ap(),i=ph(),a=(0,Q.useMemo)(()=>j1(n?.billingProviderRef),[n?.billingProviderRef]),{tBillingProduct:o,t:s,isReady:c}=K({keys:[`billing_products`,...a]}),l=G(B.LOW_LEVEL_BILLING_SUBSCRIPTION_STATUS,`SubscriptionStatus`)(e),u=t.status??n?.subscription?.status??null,d=t.planName??(n?.currentPlanKey?o(n.currentPlanKey,`name`):null),f=t.providerName??M1({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(yu.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(yu.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),v=t.unavailable??(!!n?.isEnabled&&(t.status===void 0||t.planName===void 0||t.currentPeriodEnd===void 0)&&[yu.SUBSCRIPTION,yu.PRODUCTS,yu.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 P1({preset:e=q.DEFAULT,...t}){let n=Hh(),r=ap(),i=ph(),a=Q.useMemo(()=>j1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(B.LOW_LEVEL_BILLING_PORTAL_LINK,`BillingPortalLink`)(e),c=t.onOpenPortal??(()=>{n&&i(()=>n.openCustomerPortal())}),l=t.providerName??M1({providerRef:n?.billingProviderRef,translate:o}),u=t.unavailable??(!!n?.isEnabled&&t.onOpenPortal===void 0&&[yu.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 F1;(function(e){e.IDLE=`idle`,e.PREVIEWING=`previewing`,e.READY=`ready`,e.CONFIRMING=`confirming`,e.FAILED=`failed`})(F1||={});function iCe(e){let t=e.currency.toUpperCase(),n=Ft(t);if(n===void 0||!Number.isSafeInteger(e.amount)||e.lineItems.some(e=>!Number.isSafeInteger(e.amount)))throw Error(`The invoice estimate contains unsupported monetary values.`);return{amount:{amount:BigInt(e.amount),currency:t,decimals:n},lineItems:e.lineItems.map(e=>({...e,amount:{amount:BigInt(e.amount),currency:t,decimals:n}})),periodStart:e.periodStart,periodEnd:e.periodEnd,timing:e.timing,effectiveAt:new Date(e.effectiveAt)}}function aCe(e){let[t,n]=(0,Q.useState)({phase:F1.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&&[yu.BILLING_ACCOUNT,yu.SUBSCRIPTION,yu.PRODUCTS,yu.PRICES].every(e.isSliceAvailable);return(0,Q.useEffect)(()=>(r.current+=1,i.current?.abort(),n({phase:F1.IDLE}),()=>{r.current+=1,i.current?.abort()}),[s]),(0,Q.useEffect)(()=>{let e=o.current;a.current||e.phase===F1.READY&&e.hasError||l||(r.current+=1,i.current?.abort(),n({phase:F1.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:F1.PREVIEWING});try{let i=await e.previewPlanChange(t,{signal:u.signal}),a=iCe(i);if(!i.previewToken)throw Error(`The invoice estimate has no confirmation binding.`);if(r.current!==o||c.current!==s)return;n({...d,phase:F1.READY,response:i,preview:a})}catch{if(r.current!==o||u.signal.aborted)return;n({...d,phase:F1.FAILED})}},[e,l,s]),cancel:(0,Q.useCallback)(()=>{a.current||(r.current+=1,i.current?.abort(),n({phase:F1.IDLE}))},[]),confirm:(0,Q.useCallback)(async()=>{let t=o.current;if(!e||!l||a.current||t.phase!==F1.READY||t.scopeIdentity!==c.current)return;a.current=!0;let i=r.current;n({...t,phase:F1.CONFIRMING,hasError:!1});try{await e.confirmPlanChange({...t.target,previewToken:t.response.previewToken}),r.current===i&&n({phase:F1.IDLE})}catch{r.current===i&&n({...t,phase:F1.READY,hasError:!0})}finally{a.current=!1}},[e,l])}}function I1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW,`PlanChangePreview`)(e);return(0,$.jsx)(n,{...t})}function L1({preset:e=q.DEFAULT,...t}){let n=Hh(),r=ap(),i=aCe(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=i.state.phase!==F1.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=ph(),{tBillingProduct:c,tBillingFeature:l,tBillingLimit:u,isReady:d}=K({keys:[`billing_products`,`billing_features`,`billing_limits`]}),f=G(B.LOW_LEVEL_BILLING_PRICING_TABLE,`PricingTable`)(e),p=(0,Q.useMemo)(()=>t.plans?t.plans:n?.products?n.products.filter(e=>e.type===Ga.PLAN&&e.isPublic&&e.isActive).filter(e=>!n.currentScope||!e.targetScopes||e.targetScopes.includes(n.currentScope)).map(e=>{let t=n.getPricesForProduct(e._id);return{key:e.key,name:c(e.key,`name`),description:c(e.key,`tagline`),planTier:e.planTier,sortOrder:e.sortOrder??0,grantedFeatures:(e.grantedFeatures??[]).map(e=>({id:e,label:l(e,`label`)})),grantedLimits:Object.entries(e.grantedLimits??{}).map(([e,t])=>({id:e,label:u(e,`label`),value:typeof t==`object`&&t?t.value??0:0})),isCurrent:e.key===n.currentPlanKey,prices:t.filter(e=>e.unitPrice&&e.unitPrice.currency).map(e=>({priceId:e._id,price:e.unitPrice,interval:e.interval,isDefault:e.isDefault??!0})),isRecommended:e.isRecommended===!0,priceDisclosure:e.priceDisclosure,isAcquirable:n.isProductAcquirable(e.key),isFree:t.length>0&&t.every(e=>e.unitPrice?.amount===0n),trialDays:e.behaviorPolicy?.trial?.days}}):[],[t.plans,n?.products,n?.currentScope,n?.currentPlanKey,n?.getPricesForProduct,n?.isProductAcquirable,c,l,u]),m=t.currentPlanKey===void 0?n?.currentPlanKey??null:t.currentPlanKey,h=n?.subscription?.pendingPlanChange,g=t.pendingPlanChange===void 0?h?{targetPlanName:(()=>{let e=n?.products?.find(e=>e._id===h.productId)?.key;return e?c(e,`name`):h.productId})(),effectiveAt:new Date(h.effectiveAt)}:null:t.pendingPlanChange,[_,v]=(0,Q.useState)(!1),y=t.onKeepCurrentPlan??(h&&n&&ot(h)?()=>{v(!0),s(async()=>{try{await n.cancelPendingPlanChange()}finally{v(!1)}})}:void 0),b=(0,Q.useCallback)((e,r)=>{t.onSelectPlan?t.onSelectPlan(e,r):n&&[yu.BILLING_ACCOUNT,yu.SUBSCRIPTION,yu.PRODUCTS,yu.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&&[yu.PRODUCTS,yu.PRICES,yu.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===F1.CONFIRMING||!!g,pendingPlanChange:g,onKeepCurrentPlan:y,isKeepingCurrentPlan:t.isKeepingCurrentPlan??_}),i.state.phase!==F1.IDLE&&(0,$.jsx)(I1,{targetPlanName:c(i.state.target.newProductKey,`name`),preview:`preview`in i.state?i.state.preview:null,isLoading:i.state.phase===F1.PREVIEWING,isConfirming:i.state.phase===F1.CONFIRMING,hasError:i.state.phase===F1.FAILED||`hasError`in i.state&&i.state.hasError,onCancel:i.cancel,onConfirm:i.state.phase===F1.READY||i.state.phase===F1.CONFIRMING?()=>{i.confirm()}:void 0,onRetry:i.state.phase===F1.FAILED?()=>{i.state.phase===F1.FAILED&&i.select(i.state.target)}:void 0})]}):null}function R1({preset:e=q.DEFAULT,...t}){let n=Hh(),r=ap(),i=ph(),{tBillingProduct:a,tBillingCreditPool:o,isReady:s}=K({keys:[`billing_products`,`billing_credit_pools`]}),c=G(B.LOW_LEVEL_BILLING_USAGE_DASHBOARD,`UsageDashboard`)(e),l=(0,Q.useMemo)(()=>t.products?t.products:n?.usage?.byProduct?Object.entries(n.usage.byProduct).map(([e,t])=>({productKey:e,productName:a(e,`name`),currentPeriodUsage:t.currentPeriodUsage,previousPeriodUsage:t.previousPeriodUsage,limit:t.limit,lastRecordedAt:t.lastRecordedAt})):[],[t.products,n?.usage?.byProduct,a]),u=(0,Q.useMemo)(()=>t.creditPools?t.creditPools:n?.creditPools?Object.entries(n.creditPools).map(([e,t])=>({poolKey:e,poolName:o(e,`name`),available:t.available,totalPurchased:t.totalPurchased,totalGranted:t.totalGranted??0,totalConsumed:t.totalConsumed})):[],[t.creditPools,n?.creditPools,o]),d=(0,Q.useCallback)(e=>{if(t.onTopUp){t.onTopUp(e);return}if(!n||![yu.BILLING_ACCOUNT,yu.PRODUCTS,yu.PRICES,yu.CREDIT_POOLS].every(n.isSliceAvailable))return;let r=n.products.find(t=>t.type===Ga.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(yu.USAGE)),p=t.creditPoolsUnavailable??(!!n?.isEnabled&&t.creditPools===void 0&&!n.isSliceAvailable(yu.CREDIT_POOLS)),m=!!t.onTopUp||!!n&&[yu.BILLING_ACCOUNT,yu.PRODUCTS,yu.PRICES,yu.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 z1({preset:e=q.DEFAULT,...t}){let n=Hh(),r=ap(),i=ph(),a=Q.useMemo(()=>j1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(B.LOW_LEVEL_BILLING_INVOICE_HISTORY,`InvoiceHistory`)(e),c=t.invoices??n?.invoices??[],l=t.onViewAll??(n?.isSliceAvailable(yu.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),u=t.providerName??M1({providerRef:n?.billingProviderRef,translate:o}),d=t.unavailable??(!!n?.isEnabled&&t.invoices===void 0&&[yu.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 oCe=()=>{let e=Hh(),{tComponent:t,isReady:n}=K({component:B.APP_LAYOUTS_BILLING_SETTINGS}),r=(0,Q.useCallback)(e=>t(B.APP_LAYOUTS_BILLING_SETTINGS,e),[t]);if(!n)return null;if(!e?.isEnabled)return(0,$.jsxs)(OF,{children:[(0,$.jsx)(AF,{children:(0,$.jsx)(MF,{children:r(`disabledTitle`)})}),(0,$.jsx)(FF,{children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:r(`disabledDescription`)})})]});let i=e.isSliceAvailable(yu.BILLING_ACCOUNT),a=[yu.SUBSCRIPTION,yu.PRODUCTS,yu.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)(N1,{}),i&&!a&&(0,$.jsx)(P1,{}),(0,$.jsx)(L1,{}),(0,$.jsx)(R1,{}),(0,$.jsx)(z1,{})]})};function B1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_LIST,`DescriptionList`)(e);return(0,$.jsx)(n,{...t})}function V1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_TERM,`DescriptionTerm`)(e);return(0,$.jsx)(n,{...t})}function H1({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DESCRIPTION_DETAILS,`DescriptionDetails`)(e);return(0,$.jsx)(n,{...t})}function U1(e){switch(e){case I.USER:return ll.USER_PROVIDER_CREDENTIALS;case I.ORGANIZATION:return ll.ORG_PROVIDER_CREDENTIALS;case I.APPLICATION:return}}function sCe(e){return U1(e)!==void 0}function cCe(e,t){return e===I.APPLICATION?e:t===null?null:`${e}:${t}`}function W1(e){let t=U1(e.ownerScope);if(t===void 0)return;let n=e.registry.resourceConfigurations[t];if(!n)return;let r=n.operations.find(t=>t.operationIdentifier===e.operation&&t.isOperationDefault===!0&&t.isBulkOperation!==!0&&t.variantType===at.API_CALL);if(!r)return;let i={...Qp.buildResourceOperationContextIdentifiers({...e.ownerScope===I.USER?{currentUserId:e.ownerId}:{currentOrganizationId:e.ownerId},primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),[t]:e.credentialId};return{operationPathKey:Ca.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e.registry),parentResourcesRequirements:On.buildParentResourcesRequirements(t,i,e.registry)}}function lCe(e,t){let{registry:n,doOperation:r}=lm(),[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=cCe(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 vc().listLinkedProviderConnections(e===I.APPLICATION||t===null?{ownerScope:e}:{ownerScope:e,ownerId:t});n||(a(r.connections??[]),l(!1))}catch{n||l(!0)}finally{n||s(!1)}})(),()=>{n=!0}},[p,e,t,u]);let m=(0,Q.useCallback)(()=>d(e=>e+1),[]),h=(0,Q.useCallback)(async i=>{if(p!==null){if(e===I.APPLICATION)try{await vc().disconnectApplicationProviderConnection(i.connectionRef)}finally{m()}else if(t!==null)try{for(let a of i.credentials){let i=W1({registry:n,ownerScope:e,ownerId:t,credentialId:a.credentialId,operation:W.DELETE});if(i===void 0)throw Error(`No DELETE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements})}rc({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=W1({registry:n,ownerScope:e,ownerId:t,credentialId:o.credentialId,operation:W.UPDATE});if(i===void 0)throw Error(`No UPDATE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements,requestData:{enabled:a}})}}finally{m()}},[r,t,e,n,m]),_=(0,Q.useCallback)(async(i,a,o)=>{if(t!==null)try{let s=W1({registry:n,ownerScope:e,ownerId:t,credentialId:i,operation:a});if(s===void 0)throw Error(`No ${a} operation is registered for the ${e} credential resource in this frontend.`);await r(s.operationPathKey,{contextualParameters:s.contextualParameters,parentResourcesRequirements:s.parentResourcesRequirements,...o===void 0?{}:{requestData:o}})}finally{m()}},[r,t,e,n,m]),v=(0,Q.useCallback)((e,t)=>_(e,W.UPDATE,{description:t.trim()===``?null:t.trim()}),[_]),y=(0,Q.useCallback)(e=>_(e,W.DELETE),[_]);return{connections:i,loading:o,failed:c,reload:m,disconnect:h,holdsCredentialResource:sCe(e),setEnabled:g,setCredentialDescription:v,removeCredential:y}}var G1=B.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,uCe={[I.USER]:cae.shape.description.unwrap().maxLength??void 0,[I.ORGANIZATION]:Pee.shape.description.unwrap().maxLength??void 0},K1=yd().min(1),q1=Dd(),dCe=yd().min(1),fCe=(e,t)=>e.filter(e=>e.admissibleConnections.some(e=>e.ownerScope===t)),J1=(e,t)=>{let n=new Set(Object.values(kc)),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},pCe=(e,t)=>{let n=J1(e,t);return t===I.APPLICATION?n.filter(e=>e===kc.SERVICE):n},Y1=e=>({ownerScope:e.ownerScope,delegation:e.delegation,...e.ownerScope===I.APPLICATION||e.ownerId===null?{}:{ownerId:e.ownerId},...wr(e)&&e.signedInUserId!==null?{actingForUserId:e.signedInUserId}:{}}),mCe=(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)}`}),X1;(function(e){e.SUPERSEDED=`SUPERSEDED`,e.DISABLED=`DISABLED`,e.NEEDS_REAUTHORIZATION=`NEEDS_REAUTHORIZATION`,e.WORKING=`WORKING`,e.NOT_YET_USED=`NOT_YET_USED`})(X1||={});var Z1;(function(e){e.DISCONNECTED=`DISCONNECTED`,e.FAILED=`FAILED`})(Z1||={});var hCe=e=>{if(e.supersededByConnectionRef!==void 0)return X1.SUPERSEDED;if(!e.enabled)return X1.DISABLED;switch(e.validationState){case mi.INVALID:return X1.NEEDS_REAUTHORIZATION;case mi.VALID:return X1.WORKING;case mi.UNVALIDATED:return X1.NOT_YET_USED}},gCe={[X1.SUPERSEDED]:`warning`,[X1.DISABLED]:`secondary`,[X1.NEEDS_REAUTHORIZATION]:`destructive`,[X1.WORKING]:`success`,[X1.NOT_YET_USED]:`secondary`},_Ce={[X1.SUPERSEDED]:`statusSuperseded`,[X1.DISABLED]:`statusDisabled`,[X1.NEEDS_REAUTHORIZATION]:`statusNeedsReauthorization`,[X1.WORKING]:`statusWorking`,[X1.NOT_YET_USED]:`statusNotYetUsed`},vCe=(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}},yCe=(e,t)=>cb([...[...e.flatMap(e=>[e.providerRef,...e.servesRefs??[]]),...t.flatMap(e=>[e.connectionRef,...e.servesRefs,...e.supersededByConnectionRef===void 0?[]:[e.supersededByConnectionRef]])].map(_d),...e.flatMap(e=>(e.credentialFields??[]).flatMap(t=>[hd(e.providerRef,t.slug,gd.LABEL),hd(e.providerRef,t.slug,gd.DESCRIPTION)])),...e.flatMap(e=>(e.connectionParameters??[]).flatMap(t=>[md(e.providerRef,t,gd.LABEL),md(e.providerRef,t,gd.DESCRIPTION)])),...t.flatMap(e=>e.credentials.map(e=>hd(e.providerRef,e.secretSlug,gd.LABEL)))]),Q1=(e,t,n,r)=>{let i=hd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===gd.LABEL?t:i},$1=(e,t,n,r)=>{let i=md(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===gd.LABEL?t:i},bCe=(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}))]},xCe=()=>{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}},SCe=()=>{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())},CCe=({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?[]:J1(n,r),y=v.length===1?v[0]:v.find(e=>e===u),b=y!==void 0&&_c({ownerScope:r,delegation:y}),x=r===I.USER||e.linkedByUserId!==void 0&&e.linkedByUserId===a,S=(0,Q.useCallback)(async()=>{if(i!==null&&y!==void 0){h(!0),_(!1);try{let{authorizeUrl:e}=await vc().startProviderConnection(t.offer.providerRef,{target:Y1({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),ii(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)(gF,{name:`delegation-${e.connectionRef}`,schema:K1,options:v.map(e=>({value:e,label:s(e===kc.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)(EI,{name:`organizationWideUseAcknowledged-${e.connectionRef}`,schema:q1,checked:f,onCheckedChange:p,"aria-describedby":l}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:s(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:l,className:`text-xs text-muted-foreground`,children:s(`organizationWideUseDescription`)})]})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,"aria-label":c(`grantMoreAccessAccessibleName`,{provider:o}),disabled:m||i===null||y===void 0||b&&!f,onClick:S,children:s(`grantMoreAccessButton`)})})]}),g&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:s(`errorGeneric`)})})]})},wCe={[Nee.MESSAGING_ENDPOINT]:`vendorRegistrationMessagingEndpointLabel`},TCe=new Set([ql.PROVIDER_VENDOR_REGISTRATION_DEPLOYMENT_INCOMPLETE]),e0=e=>Ot(e)||jr(e)&&e.customMessageReference!==void 0&&TCe.has(e.customMessageReference);function ECe(e){if(e.encoding===U_.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 DCe=({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=ap(),g=(0,Q.useMemo)(()=>[...new Set((s?.steps??[]).map(t=>fd(e,t.ref)))],[e,s]),{t:_,isReady:v}=K({keys:g}),y=(0,Q.useCallback)(async()=>{o(!0),u(!0),f(null),c(null);try{c(await vc().getProviderVendorRegistration(e,{ownerScope:I.ORGANIZATION,ownerId:t},{silent:!0}))}catch(e){f(e)}finally{u(!1)}},[t,e]),b=(0,Q.useCallback)(e=>{navigator.clipboard?.writeText(e).then(()=>m(e),()=>m(null))},[]);return a?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs font-medium text-muted-foreground`,children:r(`vendorRegistrationHeading`)}),l&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationLoading`)}),d!==null&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:jr(d)?h(d,r(e0(d)?`vendorRegistrationRefused`:`vendorRegistrationFailed`)):r(`vendorRegistrationFailed`)}),e0(d)?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationRefusalFinal`)}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:l,onClick:()=>{y()},children:r(`vendorRegistrationRetryButton`)})})]}),s!==null&&(0,$.jsxs)($.Fragment,{children:[(s.addresses??[]).length>0&&(0,$.jsx)(B1,{children:(s.addresses??[]).map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(V1,{children:r(wCe[e.kind]??e.kind)}),(0,$.jsx)(H1,{children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-item-xs`,children:[(0,$.jsx)(`code`,{className:`select-all break-all text-xs`,children:e.url}),(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`vendorRegistrationCopyAccessibleName`,{address:e.url}),onClick:()=>b(e.url),children:r(p===e.url?`vendorRegistrationCopiedButton`:`vendorRegistrationCopyButton`)})]})})]},e.kind))}),v&&(0,$.jsx)(`ol`,{className:`flex list-decimal flex-col gap-item-xs pl-5`,children:s.steps.map((t,n)=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Z,{className:`text-xs`,children:_(fd(e,t.ref),t.params)})},`${n}:${t.ref}`))})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,onClick:()=>{o(!1),m(null)},children:r(`vendorRegistrationHideButton`)}),s?.file!==void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,onClick:()=>Ly(ECe(s.file),s.file.name),children:i(`vendorRegistrationDownloadButton`,{file:s.file.name})})]})]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":i(`vendorRegistrationAccessibleName`,{provider:n}),onClick:()=>{y()},children:r(`vendorRegistrationButton`)})})},OCe=({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=Q1(e.providerRef,e.secretSlug,gd.LABEL,a);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[g&&(0,$.jsx)(Z,{className:`text-sm font-medium`,children:y}),!o&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e.description??r(`noDescription`)}),!o&&!s&&(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`editDescriptionAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{l(e.credentialId),d(e.description??``),p(null)},children:r(`editDescriptionButton`)}),g&&!o&&!s&&(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,"aria-label":i(`removeSlotAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{p(e.credentialId),l(null)},children:r(`removeSlotButton`)})]}),o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(eN,{"aria-label":i(`descriptionInputAccessibleName`,{provider:n,slot:y}),type:`text`,maxLength:t,autoFocus:!0,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:h,onClick:()=>{_(e.credentialId)},children:r(`saveDescriptionButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:h,onClick:()=>l(null),children:r(`cancelDescriptionButton`)})]}),s&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:i(`removeSlotConfirmation`,{slot:y})}),(0,$.jsx)(X,{size:Y.SM,variant:J.DESTRUCTIVE,disabled:h,"aria-label":i(`removeSlotConfirmAccessibleName`,{provider:n,slot:y}),autoFocus:!0,onClick:()=>{v(e.credentialId)},children:r(`removeSlotConfirmButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,disabled:h,onClick:()=>p(null),children:r(`removeSlotCancelButton`)})]})]},e.credentialId)})})]})},t0=({ownerScope:e=I.USER})=>{let{tComponent:t,isReady:n,formatDateTime:r}=K({component:G1}),{user:i,currentOrganizationId:a}=sg(),o=(0,Q.useCallback)(e=>t(G1,e),[t]),s=(0,Q.useCallback)((e,n)=>t(G1,e,n),[t]),c=(0,Q.useId)(),l=e===I.USER?i?._id??null:e===I.ORGANIZATION?a??null:null,u=e===I.APPLICATION||l!==null,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)(xCe),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&&(SCe(),j.current=vc().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 vc().listConnectableProviders(e===I.APPLICATION?{ownerScope:e}:void 0);t||(f(n.providers??[]),v(!1))}catch{t||v(!0)}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let M=(0,Q.useMemo)(()=>fCe(d,e),[d,e]),{connections:N,loading:P,failed:F,reload:ee,disconnect:L,holdsCredentialResource:R,setEnabled:z,setCredentialDescription:te,removeCredential:ne}=lCe(e,l),re=sr(),ie=(0,Q.useMemo)(()=>yCe(d,N),[d,N]),{t:ae}=K({keys:ie}),oe=(0,Q.useCallback)(e=>lb({providerRef:e,translate:ae}),[ae]),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(null),[de,fe]=(0,Q.useState)(null),pe=(0,Q.useCallback)(async e=>{ue(e.connectionRef),fe(null);try{await L(e),fe(Z1.DISCONNECTED),g(null)}catch(e){ii(e)||fe(Z1.FAILED)}finally{ue(null),ce(null)}},[L]),[me,he]=(0,Q.useState)(null),ge=(0,Q.useCallback)(async(e,t)=>{he(e.connectionRef),fe(null);try{await z(e,t),g(null)}catch(e){ii(e)||g(o(`errorGeneric`))}finally{he(null)}},[z,o]),_e=(0,Q.useCallback)(async e=>{fe(null);try{return await e(),g(null),!0}catch(e){return ii(e)||g(o(`errorGeneric`)),!1}},[o]),ve=(0,Q.useCallback)((e,t)=>_e(()=>te(e,t)),[_e,te]),ye=(0,Q.useCallback)(e=>_e(()=>ne(e)),[_e,ne]),be=(0,Q.useMemo)(()=>{if(M.length===0)return`disconnectNotice`;let e=M.filter(e=>e.revocationTellsVendor===!0).length;return e===0?`disconnectNotice`:e===M.length?`disconnectRevokesNotice`:`disconnectMixedNotice`},[M]),xe=(0,Q.useMemo)(()=>d.filter(e=>(e.missingRegistration??[]).length>0).map(e=>({providerRef:e.providerRef,envVarNames:(e.missingRegistration??[]).map(e=>e.envVarName)})),[d]),Se=(0,Q.useMemo)(()=>M.find(e=>e.providerRef===y),[M,y]),Ce=(0,Q.useCallback)(e=>{b(e),O({}),w(``),E(!1),g(null)},[]),we=(0,Q.useMemo)(()=>Se===void 0?[]:pCe(Se,e),[e,Se]),Te=we.length===1?we[0]:we.find(e=>e===C),[Ee,De]=(0,Q.useState)(null),Oe=Te!==void 0&&_c({ownerScope:e,delegation:Te}),ke=(0,Q.useCallback)(async()=>{if(Se===void 0||!u||Te===void 0)return;S(!0),g(null),De(null);let t=Y1({ownerScope:e,ownerId:l,delegation:Te,signedInUserId:i?._id??null});try{if(Se.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1){let{authorizeUrl:e}=await vc().startProviderConnection(Se.providerRef,{target:t,connectionParameters:D,...Oe?{acknowledgesOrganizationWideUse:T}:{}});window.location.href=e;return}let e=new Set((Se.credentialFields??[]).map(e=>e.slug)),n=Object.fromEntries(Object.entries(D).filter(([t,n])=>e.has(t)&&n.trim()!==``)),r=new Set(Se.connectionParameters??[]),i=Object.fromEntries(Object.entries(D).filter(([e,t])=>r.has(e)&&t.trim()!==``));await vc().storeProviderCredential(Se.providerRef,{target:t,values:n,...Object.keys(i).length===0?{}:{connectionParameters:i},...Oe?{acknowledgesOrganizationWideUse:T}:{}}),O({}),De(o(`credentialStoredNotice`)),S(!1),b(``),ee()}catch(e){S(!1),ii(e)||g(o(`errorGeneric`))}},[D,Te,Oe,T,l,u,e,ee,Se,o,i?._id]);if(!n)return null;let Ae=bCe(M,N),je=Se?.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1,Me=Se?.missingRegistration??[],Ne=Se?.connectionParameters??[],Pe=Se?.connectionParameterChoices??{},Fe=Se?.credentialFields??[],B=Se?.scopes??[],Ie=[...Ne,...je?[]:Fe.filter(e=>e.required).map(e=>e.slug)].some(e=>(D[e]??``).trim()===``);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[k.connected!==void 0&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:o(`connectedNotice`)})}),k.connectionError===`declined`&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:o(`declinedNotice`)})}),k.connectionError!==void 0&&k.connectionError!==`declined`&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o(`failedNotice`)})}),Ee&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:Ee})}),_&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o(`catalogueFailed`)})}),h&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:h})}),de===Z1.DISCONNECTED&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:o(`disconnectedNotice`)})}),de===Z1.FAILED&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{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)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:o(`connectionsFailed`)})}),Ae.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`empty`)}):(0,$.jsx)(`ul`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:Ae.map(({connectionRef:t,connection:n,catalogueEntry:a})=>{let c=oe(n===void 0?a?.providerRef??t:n.connectionRef),d=n===void 0?void 0:hCe(n),f=n===void 0||d===X1.SUPERSEDED?void 0:vCe(n,l===null?void 0:_r(re,{ownerScope:e,ownerId:l},n.connectionRef)),p=se===t,m=le===t,h=me===t,g=a!==void 0&&Se?.providerRef===a.providerRef,_=a!==void 0&&!(a.authMethods?.includes(wt.OAUTH2_AUTHORIZATION_CODE)??!1),v=n!==void 0&&_&&d!==X1.SUPERSEDED;return(0,$.jsx)(`li`,{children:(0,$.jsx)(OF,{children:(0,$.jsxs)(FF,{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)(Mf,{variant:`outline`,children:o(`notConnectedBadge`)}):(0,$.jsx)(Mf,{variant:gCe[d],children:o(_Ce[d])})]}),n!==void 0&&(0,$.jsxs)(B1,{children:[n.servesRefs.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`servesLabel`)}),(0,$.jsx)(H1,{children:n.servesRefs.map(oe).join(`, `)})]}),(n.grantedScopes??[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`grantedScopesLabel`)}),(0,$.jsx)(H1,{children:(n.grantedScopes??[]).join(`, `)})]}),n.connectedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`connectedAtLabel`)}),(0,$.jsx)(H1,{children:r(n.connectedAt)})]}),n.validationError!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`lastRefusalLabel`)}),(0,$.jsx)(H1,{children:n.validationError})]}),n.lastValidatedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`lastValidatedAtLabel`)}),(0,$.jsx)(H1,{children:r(n.lastValidatedAt)})]}),n.lastUsedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`lastUsedAtLabel`)}),(0,$.jsx)(H1,{children:r(n.lastUsedAt)})]}),n.linkedByUserId!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V1,{children:o(`linkedByLabel`)}),(0,$.jsx)(H1,{children:n.linkedByUserName??n.linkedByUserId})]})]}),n!==void 0&&d!==X1.SUPERSEDED&&R&&(0,$.jsx)(OCe,{connection:n,descriptionMaxLength:uCe[e],label:c,t:o,tWith:s,translateProvider:ae,onSaveDescription:ve,onRemove:ye}),e===I.ORGANIZATION&&l!==null&&(a?.vendorRegistrationOwnerScopes??[]).includes(I.ORGANIZATION)&&(0,$.jsx)(DCe,{providerRef:a.providerRef,organizationId:l,label:c,t:o,tWith:s}),n!==void 0&&d===X1.SUPERSEDED&&n.supersededByConnectionRef!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`supersededNotice`,{connection:oe(n.supersededByConnectionRef)})}),n!==void 0&&!n.enabled&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`disabledNotice`)}),d===X1.NEEDS_REAUTHORIZATION&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`needsReauthorizationNotice`)}),n!==void 0&&f!==void 0&&(0,$.jsx)(CCe,{connection:n,pending:f,catalogueEntry:a,ownerScope:e,ownerId:l,signedInUserId:i?._id??null,label:c,t:o,tWith:s}),n!==void 0&&p?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs`,children:s(`disconnectConfirmDescription`,{provider:c})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(n.revocationTellsVendor?`disconnectRevokesNotice`:`disconnectNotice`)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,disabled:m,onClick:()=>ce(null),children:o(`disconnectCancelButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DESTRUCTIVE,"aria-label":s(`disconnectConfirmAccessibleName`,{provider:c}),disabled:m,onClick:()=>{pe(n)},children:o(`disconnectConfirmButton`)})]})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[a!==void 0&&!g&&n===void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,"aria-label":s(`connectAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`connectButton`)}),a!==void 0&&!g&&v&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`replaceCredentialAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`replaceCredentialButton`)}),a!==void 0&&!g&&d===X1.NEEDS_REAUTHORIZATION&&!v&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`reconnectAccessibleName`,{provider:c}),onClick:()=>Ce(a.providerRef),children:o(`reconnectButton`)}),n!==void 0&&d!==X1.SUPERSEDED&&R&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(n.enabled?`disableAccessibleName`:`enableAccessibleName`,{provider:c}),disabled:h||le!==null,onClick:()=>{ge(n,!n.enabled)},children:o(n.enabled?`disableButton`:`enableButton`)}),n!==void 0&&(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-label":s(`disconnectAccessibleName`,{provider:c}),disabled:le!==null,onClick:()=>{ce(t),fe(null)},children:o(`disconnectButton`)})]}),g&&Se!==void 0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,children:[(Se.servesRefs??[]).length>1&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`servesLabel`),` `,(Se.servesRefs??[]).map(oe).join(`, `)]}),!je&&Me.length===0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`pastedCredentialNotice`)}),we.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`delegationHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`delegationDescription`)}),(0,$.jsx)(gF,{name:`delegation`,schema:K1,options:we.map(e=>({value:e,label:o(e===kc.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:C,placeholder:o(`delegationPlaceholder`),onChange:e=>{w(e),E(!1)}})]}),je&&B.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`scopesPrefix`),` `,mCe(B,D,o(`scopeChosenBelow`)).join(`, `)]}),(Ne.length>0||!je&&Fe.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`parametersHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`parametersDescription`)})]}),[...je||Se===void 0?[]:Fe.map(e=>({key:e.slug,label:Q1(Se.providerRef,e.slug,gd.LABEL,ae),description:Q1(Se.providerRef,e.slug,gd.DESCRIPTION,ae),choices:void 0,secret:!0})),...Se===void 0?[]:Ne.map(e=>({key:e,label:$1(Se.providerRef,e,gd.LABEL,ae),description:$1(Se.providerRef,e,gd.DESCRIPTION,ae),choices:Pe[e],secret:!1}))].map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:e.label}),e.description!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:e.description}),e.choices!==void 0&&(e.choices.hostSuffixes??[]).length===0?(0,$.jsx)(gF,{name:e.key,schema:dCe,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===one.ORIGIN?`https://*${t}`:`*${t}`)].join(`, `)]}),(0,$.jsx)(eN,{"aria-label":e.label,type:e.secret?`password`:`text`,value:D[e.key]??``,onChange:t=>O(n=>({...n,[e.key]:t.target.value}))})]})]},e.key)),Oe&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(EI,{name:`organizationWideUseAcknowledged`,schema:q1,checked:T,onCheckedChange:E,"aria-describedby":`organization-wide-use-description`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:`organization-wide-use-description`,className:`text-xs text-muted-foreground`,children:o(`organizationWideUseDescription`)})]})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Y.SM,variant:J.GHOST,disabled:x,onClick:()=>Ce(``),children:o(`connectCancelButton`)}),(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:x||!u||Se.notConnectableBecause!==void 0&&Se.notConnectableBecause!==vn.NO_AUTHORIZATION_FLOW||Ie||Te===void 0||Oe&&!T,onClick:ke,children:o(x?`connectingButton`:`connectButton`)})]})]})]})})},t)})})]})]}),xe.length>0&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`configurationGapsHeading`)}),(0,$.jsx)(Z,{className:`text-xs`,children:o(`configurationGapsDescription`)}),(0,$.jsx)(`ul`,{className:`list-disc pl-4`,children:xe.map(e=>(0,$.jsxs)(`li`,{className:`text-xs`,children:[oe(e.providerRef),`: `,e.envVarNames.join(`, `)]},e.providerRef))})]})})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(be)})]})},n0=B.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,r0;(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`})(r0||={});var kCe=[r0.LAST_30_DAYS,r0.LAST_90_DAYS,r0.LAST_365_DAYS],ACe=Object.values(Cl);function i0(e){return`groupBy_${e}`}function a0(e){return`window_${e}`}function jCe(e,t){switch(t){case Cl.AGENT:return e.key.agentRef;case Cl.TOOL:return e.key.toolName;case Cl.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType}:${e.key.caseRef.resourceId}`:void 0;case Cl.DECIDER:return e.key.deciderUserId}}function MCe(e,t){return e===null?null:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}var NCe=()=>{let{tComponent:e,isReady:t,currentLanguage:n}=K({component:n0}),{currentOrganizationId:r}=sg(),i=(0,Q.useCallback)(t=>e(n0,t),[e]),[a,o]=(0,Q.useState)(Cl.AGENT),[s,c]=(0,Q.useState)(r0.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),vc().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)(sO,{value:a,onValueChange:e=>o(e),children:(0,$.jsx)(cO,{children:ACe.map(e=>(0,$.jsx)(lO,{value:e,"data-ref":e,children:i(i0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:kCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===s?J.DEFAULT:J.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(a0(e))},e))})]}),p&&(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:p})}),!(p&&h.length===0)&&(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{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(i0(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=jCe(e,a),o=MCe(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},o0=B.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,s0=ar(Ni.shape.status),c0=ar(Ni.shape.autonomousTrigger);function PCe(e){return`reason_${e}`}function FCe(e){return`concurrency_${e}`}function ICe(e){if(e.caseLimit!==void 0&&e.matchedCaseCount!==void 0)return{matched:e.matchedCaseCount,limit:e.caseLimit}}var l0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(l0||={});var LCe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:o0,keys:[`system_enums`]}),{currentOrganizationId:i}=sg(),a=(0,Q.useCallback)((t,n)=>e(o0,t,n),[e]),o=(0,Q.useCallback)((e,n)=>{if(!e)return n;let r=Mc(e,n),i=t(r);return i===r?n:i},[t]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(l0.LOADING);if((0,Q.useEffect)(()=>{if(!i)return;let e=!1;return u(l0.LOADING),vc().readAutonomousAgentsOverview(i).then(t=>{e||(c(t),u(l0.READY))}).catch(()=>{e||u(l0.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===l0.FAILED?(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:a(`errorGeneric`)})}):l===l0.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)(RCe,{agent:e,scannedSince:m,tc:a,word:o,formatDateTime:r},e.ref)),p.map(e=>(0,$.jsx)(OF,{"data-autonomous-agent-undeclared":e.autonomousAgentRef,children:(0,$.jsxs)(FF,{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)(d0,{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 u0(e,t){return e?e.organizationRelationshipId===null?t(`partyOwn`):e.representingOrganizationName??t(`partyUnnamedRelationship`):null}function RCe({agent:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){let a=d_(s0??``)?.values;return(0,$.jsx)(OF,{"data-autonomous-agent":e.ref,children:(0,$.jsxs)(FF,{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(FCe(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)(Mf,{variant:a?.[e.status]?.color??`outline`,dot:!0,children:r(s0,e.status)})}),(0,$.jsx)(xJ,{"data-autonomous-party":!0,children:u0(e.party,n)}),(0,$.jsx)(xJ,{children:e.trigger?r(c0,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)(d0,{refusals:e.recentRefusals,scannedSince:t,tc:n,word:r,formatDateTime:i})]})})}function d0({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:u0(e.party,n)}),(0,$.jsx)(xJ,{children:r(c0,e.trigger)}),(0,$.jsx)(xJ,{children:n(PCe(e.reason),ICe(e))})]},`${e.occurrenceKey}:${e.refusedAt}:${e.party?e.party.organizationRelationshipId??`own`:`unknown`}`))})]})]})}function f0(e,t,n){let r=Ft(t);if(r!==void 0)return n(Qt(BigInt(e),r),{style:`currency`,currency:t,minimumFractionDigits:r,maximumFractionDigits:r})}var p0=B.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,m0;(function(e){e.APPLICATION=`application`,e.REPRESENTING_ORGANIZATION=`representing-organization`})(m0||={});var h0;(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`})(h0||={});var zCe=[h0.LAST_30_DAYS,h0.LAST_90_DAYS,h0.LAST_365_DAYS],BCe=Object.values(ia),g0;(function(e){e.GENERIC=`generic`,e.ACCESS_GRANT_REQUIRED=`accessGrantRequired`})(g0||={});function VCe(e){return e===g0.ACCESS_GRANT_REQUIRED?`errorAccessGrantRequired`:`errorGeneric`}function _0(e){return`groupBy_${e}`}function HCe(e){return`window_${e}`}function UCe(e){return`decisionTime_${e}`}function WCe(e,t){switch(t){case ia.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType} · ${e.key.caseRef.resourceId}`:void 0;case ia.ORGANIZATION:return e.key.organizationId;case ia.AGENT:return e.key.agentRef;case ia.MODEL:return e.key.model?[e.key.provider,e.key.model].filter(Boolean).join(` · `):void 0}}function GCe(e){if(e.availability===fae.JOINED)return{decisions:e.decisionCount??0,minutes:Math.round((e.reviewDurationMs??0)/6e4)}}var v0=({scope:e})=>{let{tComponent:t,isReady:n,formatNumber:r}=K({component:p0}),i=(0,Q.useCallback)((e,n)=>t(p0,e,n),[t]),{currentOrganizationId:a}=sg(),o=e===m0.REPRESENTING_ORGANIZATION?a??void 0:void 0,s=e===m0.REPRESENTING_ORGANIZATION&&!o,[c,l]=(0,Q.useState)(ia.CASE),[u,d]=(0,Q.useState)(h0.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),vc().summarizeModelCost({from:n.toISOString(),to:t.toISOString(),groupBy:c,...o?{organizationId:o}:{}}).then(t=>{e||p({summary:t,windowDays:u,organizationId:o})}).catch(t=>{e||(jr(t)&&t.customMessageReference===ql.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?_(g0.ACCESS_GRANT_REQUIRED):_(g0.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=f0(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===m0.REPRESENTING_ORGANIZATION?`representingPageTitle`:`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(e===m0.REPRESENTING_ORGANIZATION?`representingPageDescription`:`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(sO,{value:c,onValueChange:e=>l(e),children:(0,$.jsx)(cO,{children:BCe.map(e=>(0,$.jsx)(lO,{value:e,"data-ref":e,children:i(_0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:zCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===u?J.DEFAULT:J.OUTLINE,"aria-pressed":e===u,onClick:()=>d(e),children:i(HCe(e))},e))})]}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)}):g?(0,$.jsx)(AD,{variant:g===g0.ACCESS_GRANT_REQUIRED?`default`:`destructive`,children:(0,$.jsx)(MD,{children:i(VCe(g))})}):(0,$.jsx)(OF,{children:(0,$.jsxs)(FF,{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(_0(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===ia.CASE?(0,$.jsx)(bJ,{children:i(`columnDecisionTime`)}):null]})}),(0,$.jsx)(vJ,{children:y.map((e,t)=>{let n=WCe(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===ia.CASE?(0,$.jsx)(xJ,{children:e.decisionTime?i(UCe(e.decisionTime.availability),GCe(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]})})]})},y0=B.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,b0;(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`})(b0||={});var KCe=[b0.LAST_7_DAYS,b0.LAST_30_DAYS,b0.LAST_365_DAYS];function qCe(e){return`window_${e}`}function x0(e){return`disclosure_${e}`}function JCe(e){return`outcome_${e}`}function YCe(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 XCe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:y0}),i=(0,Q.useCallback)((t,n)=>e(y0,t,n),[e]),{currentOrganizationId:a}=sg(),o=a??void 0,[s,c]=(0,Q.useState)(b0.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=>vc().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=Mc(die.CORE_AUDITABLE_EVENT_TYPE,e),r=t(n);return r===n?is(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:KCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===s?J.DEFAULT:J.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(qCe(e))},e))}),o?p?(0,$.jsx)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:i(`errorGeneric`)})}):(0,$.jsx)(OF,{children:(0,$.jsxs)(FF,{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=YCe(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===js.FAILURE?`text-destructive`:void 0,children:i(JCe(e.outcome))}),(0,$.jsx)(xJ,{children:e.disclosure===Yl.FULL?(0,$.jsx)(X,{size:Y.SM,variant:J.OUTLINE,"aria-expanded":n,onClick:()=>v(n?null:e.eventId),children:i(n?`hideDetail`:x0(Yl.FULL))}):(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(x0(Yl.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:Y.SM,variant:J.OUTLINE,disabled:d,onClick:b,children:i(`loadMore`)})}):null]})}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})]})},S0=B.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,C0=864e5,ZCe=r0.LAST_365_DAYS,QCe=[r0.LAST_30_DAYS,r0.LAST_90_DAYS,r0.LAST_365_DAYS],$Ce=Lte.shape.destination.maxLength??void 0,ewe=yd().min(1);function twe(e,t){return`evaluation-dataset-${e}-${t}.jsonl`}function nwe(e,t){let n=e.resourceConfigurations[ll.EVALUATION_EXPORT_AUTHORIZATIONS],r=n?.operations.find(e=>e.operationIdentifier===W.READ&&e.isOperationDefault===!0&&e.variantType===at.API_CALL);if(!n||!r)return;let i=Qp.buildResourceOperationContextIdentifiers({currentOrganizationId:t,primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}});return{operationPathKey:Ca.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e)}}var rwe=()=>{let{tComponent:e,isReady:t}=K({component:S0}),{currentOrganizationId:n}=sg(),{registry:r,doOperation:i}=lm(),a=(0,Q.useCallback)(t=>e(S0,t),[e]),o=(0,Q.useCallback)((t,n)=>e(S0,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)(r0.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=nwe(r,n);if(e===void 0)return;let t=!1;return i(e.operationPathKey,{contextualParameters:e.contextualParameters},{silent:!0,riskLevel:zi.LOW}).then(e=>{t||T(e?.status===zne.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),vc().summarizeAgentWorkOverrideRate({from:new Date(t.getTime()-ZCe*C0).toISOString(),to:t.toISOString(),groupBy:Cl.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 vc().exportEvaluationDataset({organizationId:n,agentRef:f,from:new Date(e.getTime()-m*C0).toISOString(),to:e.toISOString(),destination:g.trim()});Ly(new Blob([t.jsonl],{type:`application/x-ndjson`}),twe(f,t.exportId)),x({exportId:t.exportId,recordCount:t.recordCount})}catch(e){ii(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)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:S})}),E&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:a(`authorizationMissingNotice`)})}),b&&(0,$.jsx)(AD,{children:(0,$.jsx)(MD,{children:o(`exportedNotice`,{count:b.recordCount})})}),(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{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)(gF,{name:`agentRef`,schema:ewe,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:QCe.map(e=>(0,$.jsx)(X,{size:Y.SM,variant:e===m?J.DEFAULT:J.OUTLINE,"aria-pressed":e===m,onClick:()=>h(e),children:a(a0(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)(eN,{"aria-label":a(`destinationLabel`),type:`text`,maxLength:$Ce,value:g,onChange:e=>_(e.target.value)})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Y.SM,variant:J.DEFAULT,disabled:v||E||f===``||g.trim()===``,onClick:()=>{D()},children:a(v?`runningButton`:`runButton`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)})})})]}):null},w0=new Set;function T0(e){let{resolvedFeatures:t,resolvedFeaturesResponse:n,featureDefinitions:r,unavailabilityPolicy:i,isLoading:a}=gh(),{permissions:o}=sg(),{track:s,isActive:c}=p$(),l=Hh(),u=Jp(),d=(0,Q.useMemo)(()=>{if(a)return{isAvailable:!0,behavior:Ko.DISABLE};let s=r.get(e);if(!s){let{behavior:t,debugTrace:n}=tg({reason:us.NOT_CONFIGURED,featureDef:void 0,policy:i,userRoles:[],billingEnabled:l?.isEnabled??!1});return{isAvailable:!1,reason:us.NOT_CONFIGURED,behavior:t,missingFeatures:[e],debugTrace:ya.isDevelopment()?n:void 0}}let c=Nh(o,u?.currentOrganizationId??null);if(s.valueType===gl.BOOLEAN){if(new Set(t.features).has(e))return{isAvailable:!0,behavior:Ko.DISABLE};let r=us.FEATURE_NOT_ENABLED,{behavior:a,suggestedProductRef:o,customComponentRef:u,debugTrace:d}=tg({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:ya.isDevelopment()?d:void 0}}if(s.valueType===gl.LIMIT){let r=t.limits[e];if(r===void 0||r===-1)return{isAvailable:!0,behavior:Ko.DISABLE};let a=t.currentUsage[e]??0;if(a<r)return{isAvailable:!0,behavior:Ko.DISABLE};let o=us.LIMIT_EXCEEDED,{behavior:u,suggestedProductRef:d,customComponentRef:f,debugTrace:p}=tg({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:ya.isDevelopment()?p:void 0}}return{isAvailable:!0,behavior:Ko.DISABLE}},[e,a,t,n,r,i,o,u?.currentOrganizationId,l?.isEnabled]);return(0,Q.useEffect)(()=>{if(!c)return;let t=`${e}:${d.isAvailable}`;w0.has(t)||(w0.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 E0({featureId:e,children:t,renderUnavailable:n}){let r=T0(e),i=Eh();return r.isAvailable?(0,$.jsx)($.Fragment,{children:t}):r.behavior===Ko.HIDE?null:n?(0,$.jsx)($.Fragment,{children:n(r)}):(0,$.jsx)(zh,{behavior:r.behavior,missingFeatures:r.missingFeatures,limitInfo:r.limitInfo,upgradeOptionsCount:r.upgradeOptions?.length,customComponentRef:r.customComponentRef,onDismiss:void 0,onAction:()=>i(r)})}function iwe(e,t){switch(t.type){case`push`:return[...e,{id:zm.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 awe(e){return{navigate:t=>{zm.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 owe({rootContext:e}){let t=CS(),[n,r]=(0,Q.useReducer)(iwe,e,e=>[{id:zm.generateStackEntryId(),context:e}]),i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useMemo)(()=>awe({dispatch:r,getDepth:()=>i.current.length,globalController:t}),[t]),o=n[n.length-1];return(0,$.jsx)(SS.Provider,{value:a,children:(0,$.jsx)(UY,{resourceContext:o.context,navigationZone:rr.OVERLAY,navigationInitiator:{sourceZone:rr.OVERLAY}},o.id)})}function swe(e,t,n,r){return t!==Vr.APPLICATION||!r||e[ll.ORGANIZATIONS]!==void 0?e:(n.initiatorInfos??[]).some(e=>e.parameters?.some(e=>e.resourceType===ll.ORGANIZATIONS))?{...e,[ll.ORGANIZATIONS]:r}:e}function cwe(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 lwe({message:e}){return(0,$.jsx)(`div`,{className:`p-card text-sm text-muted-foreground`,children:e})}function uwe({resourceType:e,operation:t,operationVariant:n}){let{registry:r}=lm(),i=Jp(),a=(0,Q.useContext)(Fi)?.appIdentity?.applicationId??i?.currentApplicationId??null,o=(0,Q.useMemo)(()=>{let o=r.resourceConfigurations[e];if(!o)return;let s=cwe(o,t,n);if(!s)return;let c=swe(Qp.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=Dx(o,r.allResourceFieldIdentifiers)&&go(s)&&c[e]===void 0?c[ll.USERS]:void 0,u=typeof l==`string`?{...c,[e]:l}:c,d=On.buildParentResourcesRequirements(e,u,r);return On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:s,contextResourceIdentifiers:u,parentResourcesRequirements:d})},[r,e,t,n,i,a]);if(!o)return(0,$.jsx)(lwe,{message:`Settings surface unavailable for ${e} (${t}).`});let s=[e,t,n??``,i?.currentOrganizationId??``,i?.currentUserId??``,a??``].join(`|`);return(0,$.jsx)(owe,{rootContext:o},s)}function dwe(e){return[...e.categories].sort((e,t)=>(e.order??0)-(t.order??0))}function fwe(e,t){return e.sections.filter(e=>e.categoryRef===t).sort((e,t)=>(e.order??0)-(t.order??0))}function pwe(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 mwe(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 hwe({panelRef:e}){switch(e){case fv.SECURITY:return(0,$.jsx)(GSe,{});case fv.APPEARANCE:return(0,$.jsx)(eCe,{});case fv.INVITATIONS:return(0,$.jsx)(rCe,{});case fv.BILLING:return(0,$.jsx)(oCe,{});case fv.CONNECTED_ACCOUNTS:return(0,$.jsx)(t0,{ownerScope:I.USER});case fv.ORGANIZATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(t0,{ownerScope:I.ORGANIZATION});case fv.APPLICATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(t0,{ownerScope:I.APPLICATION});case fv.AGENT_WORK_OVERRIDE_RATE:return(0,$.jsx)(NCe,{});case fv.AUTONOMOUS_AGENTS:return(0,$.jsx)(LCe,{});case fv.MODEL_COST_BREAKDOWN:return(0,$.jsx)(v0,{scope:m0.APPLICATION});case fv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN:return(0,$.jsx)(v0,{scope:m0.REPRESENTING_ORGANIZATION});case fv.REPRESENTATIVE_ACTIVITY:return(0,$.jsx)(XCe,{});case fv.AGENT_WORK_EVALUATION_EXPORT:return(0,$.jsx)(rwe,{})}}function D0({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){switch(e.kind){case dv.ENGINE_PANEL:return(0,$.jsx)(hwe,{panelRef:e.panelRef});case dv.CUSTOM_COMPONENT:{let t=No.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{})}):(0,$.jsx)(il,{componentType:e.componentRef,componentName:e.componentRef})}case dv.RESOURCE_OPERATION:return(0,$.jsx)(uwe,{resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant});case dv.SUB_TABS:return(0,$.jsx)(gwe,{target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r})}}function gwe({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)(sO,{value:i,onValueChange:e=>r?.(e),children:[(0,$.jsx)(cO,{children:e.subTabs.map(e=>(0,$.jsx)(lO,{value:e.ref,"data-ref":e.ref,children:t(e.ref,e.label)},e.ref))}),e.subTabs.map(e=>(0,$.jsx)(uO,{value:e.ref,children:(0,$.jsx)(D0,{target:e.target,resolveSubTabLabel:t})},e.ref))]})}var _we=`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 vwe({sectionRef:e,subTabRef:t}){let n=P$(),r=(0,Q.useMemo)(()=>dwe(n),[n]),i=(0,Q.useMemo)(()=>mwe(n,e),[n,e]),a=nh(),o=(0,Q.useCallback)(e=>{i&&a(`${Ln.settings}/${i}/${e}`,{replace:!0})},[i,a]),{UIConfig:s,getRecipe:c}=Rg(),l=c(oc.SELECTABLE,Na.FILLED),u=c(oc.TYPOGRAPHY,y.EYEBROW),d=c(oc.TYPOGRAPHY,y.LABEL),{renderIcon:f}=Of(),p=s?.currentBreakpoint===xl.MOBILE,m=p&&!!e,h=(0,Q.useCallback)(()=>{a(Ln.settings,{replace:!0})},[a]),{tComponent:g,tSettingsHubCategory:_,tSettingsHubGroup:v,tSettingsHubSection:b,isReady:x}=K({component:B.APP_LAYOUTS_SETTINGS_HUB}),S=(0,Q.useCallback)(e=>g(B.APP_LAYOUTS_SETTINGS_HUB,e),[g]),C=(0,Q.useMemo)(()=>{let e=n.sections.find(e=>e.ref===i);return e?b(e.ref,e.label):void 0},[n.sections,i,b]),w=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{i&&w.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[i]),(0,$.jsx)(nb,{readiness:[{id:`settings-hub-labels`,isReady:x}],children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col min-w-0`,children:[(0,$.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-item border-b px-card-lg`,children:[m&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,"aria-label":S(`backToSections`),onClick:h,children:f(H.BACK,{size:ca.SM})}),(0,$.jsx)(`h2`,{className:`truncate text-base font-semibold tracking-tight`,children:m?C??S(`title`):S(`title`)})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsx)(`nav`,{"aria-label":S(`sectionsNavLabel`),className:U(`overflow-y-auto px-card-sm py-card`,p?`w-full flex-1`:`w-60 shrink-0 border-e`,m&&`hidden`),children:r.map((e,t)=>{let r=fwe(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)(T1,{className:`my-item`}),(0,$.jsx)(`div`,{id:a,className:U(`px-card-sm py-card-sm`,u.base),children:_(e.ref,e.label)}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,children:pwe(e,r).map(t=>(0,$.jsxs)(Q.Fragment,{children:[t.group&&(0,$.jsx)(`div`,{id:`${a}-group-${t.group.ref}`,className:U(`px-card-sm pt-card-sm pb-item-xs text-muted-foreground`,d.base),children:v(e.ref,t.group.ref,t.group.label)}),(0,$.jsx)(`div`,{role:t.group?`group`:void 0,"aria-labelledby":t.group?`${a}-group-${t.group.ref}`:void 0,children:t.sections.map(e=>{let t=e.ref===i;return(0,$.jsxs)(xh,{ref:t?w:void 0,to:`${Ln.settings}/${e.ref}`,replace:!0,"data-ref":e.ref,"aria-current":t?`page`:void 0,"data-state":t?`active`:`inactive`,className:U(_we,l.base,l.states.focus,l.states.selected,l.motion.transition),children:[e.icon&&f(e.icon,{size:ca.SM}),b(e.ref,e.label)]},e.ref)})})]},t.group?.ref??`__ungrouped`))})]},e.ref)})}),(0,$.jsx)(`div`,{className:U(`min-w-0 flex-1 overflow-y-auto p-card-lg`,p&&!m&&`hidden`),children:n.sections.filter(e=>e.ref===i).map(e=>(0,$.jsx)(Q.Fragment,{children:e.entitlementFeatureId?(0,$.jsx)(ywe,{featureId:e.entitlementFeatureId,keptConfigurationNotice:S(`entitlementLapsedConfigurationKept`),children:(0,$.jsx)(D0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})}):(0,$.jsx)(D0,{target:e.target,resolveSubTabLabel:b,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})},e.ref))})]})]})})}function ywe({featureId:e,keptConfigurationNotice:t,children:n}){let r=T0(e),i=!r.isAvailable&&r.behavior!==Ko.HIDE,a=(r.upgradeOptions?.length??0)>0;return i?(0,$.jsxs)(`div`,{className:`space-y-card`,children:[(0,$.jsx)(AD,{variant:`info`,children:(0,$.jsx)(MD,{children:t})}),a&&(0,$.jsx)(E0,{featureId:e,children:null}),n]}):(0,$.jsx)(`div`,{className:`space-y-card`,children:(0,$.jsx)(E0,{featureId:e,children:n})})}function bwe(e){return e.requested===null||e.isMobile?null:e.requested===Sl.SECONDARY?e.secondaryShown&&e.secondaryHasContent?Sl.SECONDARY:null:e.requested===Sl.COMPANION&&e.companionShown&&e.companionHasContent?Sl.COMPANION:null}function xwe(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 Swe(e){let{homeCompositeViewRef:t,isAppRootPath:n,primaryStackTop:r}=e;if(n&&t&&!(r&&r.contentType!==od.ENGINE_PAGE))return{contentType:od.COMPOSITE_VIEW,viewRef:t}}function Cwe(e){let{primaryContent:t,compositeViews:n}=e;return t?t.contentType===od.COMPOSITE_VIEW?n?.some(e=>e.ref===t.viewRef)??!1:!0:!1}function O0(e){let{primaryContent:t,compositeViews:n,resolveExecutionView:r}=e;if(t){if(t.contentType===od.RESOURCE_OPERATION)return t.resourceContext?.operation?.operationFrontendConfig;if(t.contentType===od.COMPOSITE_VIEW)return n?.find(e=>e.ref===t.viewRef);if(t.contentType===od.EXECUTION_VIEW)return r?.(t.viewRef)}}function k0({zone:e,zones:t,destinationOverride:n}){return e===Sl.PRIMARY?ba.COLLAPSE:n??t?.[e]?.onEmpty??ba.COLLAPSE}function A0(e){return e===ba.EMPTY_STATE}function j0(e){return e.hasContent&&!A0(e.behavior)}function wwe(e){return O0(e)?.adjacentZoneOnEmpty}var M0={maxWidth:`content`,fillsHeight:!1};function Twe(e){let t=O0(e);return{maxWidth:t?.zoneContentMaxWidth??M0.maxWidth,fillsHeight:t?.zoneContentFillsHeight??M0.fillsHeight}}function N0(e){return{maxWidth:O0({primaryContent:e.zoneContent,compositeViews:e.compositeViews,resolveExecutionView:e.resolveExecutionView})?.zoneContentMaxWidth??M0.maxWidth,fillsHeight:!1}}function Ewe(e,t){return e.maxWidth===M0.maxWidth?t:{...t,geometry:{responsiveMaxWidth:e.maxWidth}}}function Dwe(e){return e.fillsHeight?`flex h-full min-h-0 flex-col`:void 0}var Owe=Q.lazy(()=>l_(()=>import(`./ChartView-nQvehKAl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),P0=rs.getLogger(),F0=P0.debugByType(`NavigationContentAreas`);P0.setDebugTypeLogging(`NavigationContentAreas`,!1);var kwe={[fo.HOME]:ZU,[fo.DECISIONS]:YW},Awe=`no-entry`;function I0(e,t){let n=t||Awe,r=e=>Object.entries(e??{}).map(([e,t])=>`${e}:${t}`).join(`|`);switch(e.contentType){case od.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 od.COMPOSITE_VIEW:case od.CHART_VIEW:case od.FULL_CUSTOM_VIEW:case od.FLOWS_ACTORS_VIEW:case od.EXECUTION_VIEW:return`${e.contentType}-${e.viewRef}-${e.contentType===od.CHART_VIEW?e.runtimeDescriptor?.identity.insertedViewRef??``:``}-${r(e.contextResourceIdentifiers)}-${e.contentType===od.CHART_VIEW?r(e.urlParamValues):``}-${n}`;case od.CUSTOM_COMPONENT:return`${e.contentType}-${e.componentRef}-${r(e.contextResourceIdentifiers)}-${n}`;case od.ENGINE_PAGE:return`${e.contentType}-${e.pageRef}-${n}`;case od.INLINE_CREATE:return`${e.contentType}-${e.resourceContext.resourceType}-${e.resourceContext.operationIdentifier}-${n}`;case od.ERROR_MODAL:return`${e.contentType}-${e.errorType}-${n}`;case od.SETTINGS_HUB:return e.contentType;default:return`unknown-${e.contentType}-${n}`}}var L0=({content:e,zone:t,initiator:n,entryId:r})=>{let{tComponent:i,isReady:a}=K({component:B.HIGH_LEVEL_VIEWS_CHART}),{registry:o}=lm(),s=I0(e,r);if(F0(`Rendering content`,{contentType:e.contentType,zone:t,contentKey:s}),e.contentType===od.RESOURCE_OPERATION)return(0,$.jsx)(UY,{resourceContext:e.resourceContext,navigationZone:t,navigationInitiator:n},s);if(e.contentType===od.COMPOSITE_VIEW)return(0,$.jsx)(GU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n},s);if(e.contentType===od.CHART_VIEW){if(!a)return null;let t=e.runtimeDescriptor?.chartDefinition.requiredFeatures??e.viewDefinition?.chartDefinition.requiredFeatures??e.requiredFeatures??kp({viewRef:e.viewRef,registry:o})?.chartView.chartDefinition.requiredFeatures;return(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`p-container text-center text-muted-foreground`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i(B.HIGH_LEVEL_VIEWS_CHART,`loading`)})}),children:(0,$.jsx)(Kh,{requiredFeatures:t,children:(0,$.jsx)(Owe,{viewRef:e.viewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor})})},s)}if(e.contentType===od.FULL_CUSTOM_VIEW)return(0,$.jsx)(aQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===od.FLOWS_ACTORS_VIEW)return(0,$.jsx)(FQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers},s);if(e.contentType===od.EXECUTION_VIEW)return(0,$.jsx)($Y,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===od.CUSTOM_COMPONENT){let t=No.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{contextResourceIdentifiers:e.contextResourceIdentifiers})},s):(0,$.jsx)(il,{componentType:e.componentRef,componentName:e.componentRef})}if(e.contentType===od.ENGINE_PAGE){let t=kwe[e.pageRef];return t?(0,$.jsx)(t,{},s):(0,$.jsx)(il,{componentType:String(e.pageRef),componentName:String(e.pageRef)},s)}if(e.contentType===od.SETTINGS_HUB)return(0,$.jsx)(vwe,{sectionRef:e.sectionRef,subTabRef:e.subTabRef},s);if(e.contentType===od.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===od.ERROR_MODAL?(0,$.jsx)(xSe,{wildoError:e.wildoError},s):null};function R0(e,t){let n=`${e}-${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`;return{tabId:`nav-zone-tab-${n}`,panelId:`nav-zone-tabpanel-${n}`}}var jwe=({zone:e,entry:t})=>{let{title:n}=Y$(t,{keepOperationTitle:!0}),{tabId:r,panelId:i}=R0(e,t.id);return(0,$.jsx)(lO,{value:t.id,id:r,"aria-controls":i,children:n})},Mwe=({zone:e,entries:t,activeEntryId:n,onSelect:r})=>(0,$.jsx)(sO,{value:n,onValueChange:t=>r(e,t),"data-zone-tab-bar":e,children:(0,$.jsx)(cO,{children:t.map(t=>(0,$.jsx)(jwe,{zone:e,entry:t},t.id))})}),z0=({zone:e,fallback:t,emptyState:n})=>{let{getTopEntry:r,getZoneState:i,setActiveTab:a}=Px(),{navigationLayout:o}=Rg(),s=bSe(),c=r(e),l=i(e),u=o?.zones?.[e]?.contentModel===$n.TABBED,d=Jh(l.stack,o?.zones?.[e]?.contentModel,l.activeTabId);F0(`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?(F0(`ZoneContentRenderer → rendering persistent stack`,{zone:e,stackDepth:f.length}),(0,$.jsxs)($.Fragment,{children:[u&&f.length>0&&(0,$.jsx)(Mwe,{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}=R0(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)($y,{})}):(0,$.jsx)(L0,{content:t.content,zone:t.zone,initiator:t.initiator,entryId:t.id})},I0(t.content,t.id))})]})):t?(F0(`ZoneContentRenderer → rendering fallback (routerChildren / Outlet)`,{zone:e}),(0,$.jsx)($.Fragment,{children:t})):n?(F0(`ZoneContentRenderer → rendering empty state (onEmpty: EMPTY_STATE)`,{zone:e}),(0,$.jsx)($.Fragment,{children:n})):(F0(`ZoneContentRenderer → rendering null (no entry, no fallback)`,{zone:e}),null)};function B0(e){return e===pu.HORIZONTAL?pu.VERTICAL:pu.HORIZONTAL}var Nwe=1280,V0=25,H0=V0;function U0(e,t){return Math.round(Math.max(5,Math.min(70,e/t*100)))}function Pwe(e){let[t,n]=(0,Q.useState)(Nwe);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 W0(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),n)}function G0(e){if(!e.isResizable)return{minSize:e.defaultSize,maxSize:e.defaultSize};let t=e.maxWidthPx?U0(e.maxWidthPx,e.containerWidth):75,n=e.minWidthPx?U0(e.minWidthPx,e.containerWidth):Math.min(H0,e.defaultSize);return{minSize:Math.min(n,t),maxSize:t}}var K0=1e-9;function Fwe(e,t){let n=e.map(e=>e.defaultSize),r=e.map(e=>e.frozen?1/0:Math.floor(e.maxSize+K0)),i=e.map((e,t)=>Math.min(Math.ceil((e.frozen?Math.min(H0,e.defaultSize):e.minSize)-K0),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]-K0?[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+K0)),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 q0;(function(e){e.SINGLE_ZONE=`single-zone`,e.MULTI_ZONE_STATIC=`multi-zone-static`,e.MULTI_ZONE_RESIZABLE=`multi-zone-resizable`})(q0||={});function J0(e){return!e.hasSecondaryZone&&!e.hasCompanionZone?q0.SINGLE_ZONE:e.hasSecondaryZone&&e.split?.resizable||e.hasCompanionZone&&e.split?.companion?.resizable?q0.MULTI_ZONE_RESIZABLE:q0.MULTI_ZONE_STATIC}function Y0(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 X0(e){return{primary:e.showSecondary||e.showCompanion,secondary:e.showSecondary&&e.showCompanion}}function Z0(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}=G0({isResizable:r,defaultSize:s,minWidthPx:c,maxWidthPx:n?.maxWidth,containerWidth:i}),d=W0(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}=G0({isResizable:o,defaultSize:c,minWidthPx:l,maxWidthPx:n?.maxWidth,containerWidth:i}),f=W0(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&&Fwe(c,75),{primaryDefault:100-c.reduce((e,t)=>e+t.defaultSize,0),secondary:o,companion:s}}var Iwe={...WE,geometry:{responsiveMaxWidth:`content`},containment:{gap:`none`}};function Q0({children:e,geometry:t}){return(0,$.jsx)(_D,{variant:nt.SHELL,emitPolicyVars:!0,policyOverride:Ewe(t,Iwe),className:U(`bg-transparent text-inherit`,Dwe(t)),children:e})}var Lwe=()=>{let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),n=t?gp({tComponent:e,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneEmptyState`}):``;return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-container`,"data-zone-empty-state":`true`,children:(0,$.jsx)(`p`,{className:`max-w-xs text-center text-sm text-muted-foreground`,children:n})})},$0=`pointer-events-auto bg-surface-raised/80 backdrop-blur-sm`,e2=({emphasized:e,onToggle:t,floating:n=!0})=>{let{tComponent:r,isReady:i}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:a}=Of(),o=i?gp({tComponent:r,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:e?`zoneRestore`:`zoneExpand`}):``;return(0,$.jsx)(X,{type:`button`,size:Y.ICON_SM,variant:J.GHOST,className:n?$0:void 0,"aria-pressed":e,"aria-label":o||void 0,title:o||void 0,"data-zone-emphasis-toggle":e?`restore`:`expand`,onClick:t,children:a(e?H.MINIMIZE:H.MAXIMIZE,{size:ca.SM})})},t2=({onDismiss:e,floating:t=!0})=>{let{tComponent:n,isReady:r}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:i}=Of(),a=r?gp({tComponent:n,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneDismiss`}):``;return(0,$.jsx)(X,{type:`button`,size:Y.ICON_SM,variant:J.GHOST,className:t?$0:void 0,"aria-label":a||void 0,title:a||void 0,"data-zone-dismiss":`true`,onClick:e,children:i(H.CLOSE,{size:ca.SM})})};function Rwe(){let{tComponent:e,isReady:t}=K({component:B.APP_LAYOUTS_MAIN_CONTAINER}),n=(0,Q.useCallback)(n=>t&&gp({tComponent:e,componentType:B.APP_LAYOUTS_MAIN_CONTAINER,key:n})||void 0,[e,t]);return{regionProps:(0,Q.useCallback)(e=>({role:`region`,"aria-label":n(zwe[e])}),[n]),resizeHandleLabel:n(`zoneResizeHandle`)}}var zwe={[Sl.PRIMARY]:`zoneRegionPrimary`,[Sl.SECONDARY]:`zoneRegionSecondary`,[Sl.COMPANION]:`zoneRegionCompanion`},Bwe=({emphasized:e,onToggleEmphasis:t,onDismiss:n})=>(0,$.jsxs)(eV,{children:[(0,$.jsx)(e2,{emphasized:e,onToggle:t}),n&&(0,$.jsx)(t2,{onDismiss:n})]}),n2=({zone:e,emphasized:t,onToggleEmphasis:n,onDismiss:r,children:i})=>(0,$.jsxs)(XB,{zone:e,controls:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e2,{emphasized:t,onToggle:n,floating:!1}),r&&(0,$.jsx)(t2,{onDismiss:r,floating:!1})]}),children:[(0,$.jsx)(Bwe,{emphasized:t,onToggleEmphasis:n,onDismiss:r}),i]}),r2=({routerChildren:e})=>{kbe(),Dbe(),Obe();let{isZoneVisible:t,getZoneDepth:n,getTopContent:r,setFocusedZone:i,emphasizedZone:a,setEmphasizedZone:o,reconcileCollapsedZones:s,state:c}=Px(),{dismissZone:l}=wS(),{setContentAreaWidth:u}=Px(),{regionProps:d,resizeHandleLabel:f}=Rwe(),{navigationLayout:p,UIConfig:m,shellAppearance:h,compositeViews:g,homeDefinition:_}=Rg(),v=cg(),{registry:y}=lm(),b=(0,Q.useCallback)(e=>wp({viewRef:e,registry:y}),[y]),x=(0,Q.useRef)(null),S=Pwe(x);(0,Q.useEffect)(()=>{u(S>0?S:void 0)},[S,u]);let C=m?.currentBreakpoint===xl.MOBILE,w=p?.zones,T=p?.split,E=h===Xo.CONTINUOUS?`bg-transparent text-foreground`:`bg-surface-raised text-surface-raised-foreground`,D=!!w?.secondary,O=!!w?.companion,k=t(Sl.SECONDARY)||n(Sl.SECONDARY)>0,A=t(Sl.COMPANION)||n(Sl.COMPANION)>0,j=r(Sl.PRIMARY),M=Swe({homeCompositeViewRef:_?.compositeViewReference,isAppRootPath:v.pathname===`/`,primaryStackTop:j})??j,N=(0,Q.useMemo)(()=>wwe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),P=(0,Q.useMemo)(()=>Twe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),F=(0,Q.useMemo)(()=>N0({zoneContent:r(Sl.SECONDARY),compositeViews:g,resolveExecutionView:b}),[r,g,b]),I=(0,Q.useMemo)(()=>N0({zoneContent:r(Sl.COMPANION),compositeViews:g,resolveExecutionView:b}),[r,g,b]),ee=k0({zone:Sl.SECONDARY,zones:w,destinationOverride:N}),L=k0({zone:Sl.COMPANION,zones:w,destinationOverride:N}),R=(0,$.jsx)(Lwe,{}),z=(0,Q.useMemo)(()=>Cwe({primaryContent:M,compositeViews:g}),[M,g]),te=Dh({zoneConfig:w?.secondary,viewport:m?.currentBreakpoint,contentAreaWidth:S}),ne=Dh({zoneConfig:w?.companion,viewport:m?.currentBreakpoint,contentAreaWidth:S});ySe({zones:w,viewport:m?.currentBreakpoint,contentAreaWidth:S,reconcileCollapsedZones:s,navigationState:c});let re=!te&&D&&(k||z&&A0(ee)),ie=!ne&&O&&(A||z&&A0(L)),ae=J0({hasSecondaryZone:D,hasCompanionZone:O,split:T}),oe=(0,Q.useCallback)(()=>i(Sl.PRIMARY),[i]),se=(0,Q.useCallback)(()=>i(Sl.SECONDARY),[i]),ce=(0,Q.useCallback)(()=>i(Sl.COMPANION),[i]),le=bwe({requested:a,isMobile:C,secondaryShown:re,companionShown:ie,secondaryHasContent:k,companionHasContent:A}),ue=n(rr.OVERLAY)>0;(0,Q.useEffect)(()=>{if(le===null)return;let e=e=>{xwe({key:e.key,emphasized:!0,overlayOpen:ue,target:e.target})&&o(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[le,ue,o]);let de=(0,Q.useCallback)(()=>o(le===Sl.SECONDARY?null:Sl.SECONDARY),[le,o]),fe=(0,Q.useCallback)(()=>o(le===Sl.COMPANION?null:Sl.COMPANION),[le,o]),pe=(0,Q.useCallback)(()=>{o(null),l(Sl.SECONDARY)},[l,o]),me=(0,Q.useCallback)(()=>{o(null),l(Sl.COMPANION)},[l,o]),he=j0({hasContent:k,behavior:ee}),ge=j0({hasContent:A,behavior:L}),_e=le!==null,ve=le!==null&&le!==Sl.SECONDARY,ye=le!==null&&le!==Sl.COMPANION,be=(0,Q.useMemo)(()=>w?Z0(w,T,re,ie,S):null,[w,T,re,ie,S]);if(ae===q0.SINGLE_ZONE)return(0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:WE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full overflow-auto p-container ${E}`,"data-content-area":`primary`,onPointerDown:oe,onFocus:oe,...d(Sl.PRIMARY),children:(0,$.jsx)(Q0,{geometry:P,children:(0,$.jsx)(z0,{zone:Sl.PRIMARY,fallback:e})})})});if(ae===q0.MULTI_ZONE_RESIZABLE&&be){let t=B0(T?.orientation);return(0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:WE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full ${E}`,children:(0,$.jsxs)(Z$,{direction:t,autoSaveId:`nav-zones`,className:`h-full`,children:[(0,$.jsx)(Q$,{defaultSize:be.primaryDefault,minSize:V0,id:`nav-primary`,order:1,className:U(`h-full`,_e&&`hidden`),"data-zone-hidden":_e||void 0,children:(0,$.jsx)(`div`,{className:`h-full p-container ${P.fillsHeight?`overflow-hidden`:`overflow-auto`}`,"data-content-area":`primary`,onPointerDown:oe,onFocus:oe,...d(Sl.PRIMARY),children:(0,$.jsx)(Q0,{geometry:P,children:(0,$.jsx)(z0,{zone:Sl.PRIMARY,fallback:e})})})}),re&&be.secondary&&(0,$.jsxs)($.Fragment,{children:[le===null&&(0,$.jsx)($$,{withHandle:!0,disabled:be.secondary.frozen,"aria-label":f}),(0,$.jsx)(Q$,{defaultSize:be.secondary.defaultSize,minSize:be.secondary.minSize,maxSize:be.secondary.maxSize,id:`nav-secondary`,order:2,className:U(`h-full`,ve&&`hidden`),"data-zone-hidden":ve||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`secondary`,"data-zone-emphasized":le===Sl.SECONDARY||void 0,onPointerDown:se,onFocus:se,...d(Sl.SECONDARY),children:(0,$.jsx)(n2,{zone:Sl.SECONDARY,emphasized:le===Sl.SECONDARY,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(Q0,{geometry:F,children:(0,$.jsx)(z0,{zone:Sl.SECONDARY,emptyState:R})})})})})]}),ie&&be.companion&&(0,$.jsxs)($.Fragment,{children:[le===null&&(0,$.jsx)($$,{withHandle:!0,disabled:be.companion.frozen,"aria-label":f}),(0,$.jsx)(Q$,{defaultSize:be.companion.defaultSize,minSize:be.companion.minSize,maxSize:be.companion.maxSize,id:`nav-companion`,order:3,className:U(`h-full`,ye&&`hidden`),"data-zone-hidden":ye||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`companion`,"data-zone-emphasized":le===Sl.COMPANION||void 0,onPointerDown:ce,onFocus:ce,...d(Sl.COMPANION),children:(0,$.jsx)(n2,{zone:Sl.COMPANION,emphasized:le===Sl.COMPANION,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)(Q0,{geometry:I,children:(0,$.jsx)(z0,{zone:Sl.COMPANION,emptyState:R})})})})})]})]})})})}let xe=B0(T?.orientation)===pu.VERTICAL,Se=Y0({secondaryPercent:T?.ratio?.[1]??50,companionPercent:T?.companion?.ratio?.[1]??30,showSecondary:re,showCompanion:ie}),Ce=(e,t)=>xe?{height:t?`100%`:`${e}%`}:{width:t?`100%`:`${e}%`},we=X0({showSecondary:re,showCompanion:ie});return(0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:WE,children:(0,$.jsxs)(`div`,{ref:x,className:U(`h-full flex`,xe?`flex-col`:`flex-row`,E),children:[(0,$.jsx)(`div`,{className:U(`flex-1 h-full overflow-auto p-container`,we.primary&&le===null&&(xe?`border-b border-border`:`border-e border-border`),_e&&`hidden`),"data-content-area":`primary`,"data-zone-hidden":_e||void 0,onPointerDown:oe,onFocus:oe,...d(Sl.PRIMARY),children:(0,$.jsx)(Q0,{geometry:P,children:(0,$.jsx)(z0,{zone:Sl.PRIMARY,fallback:e})})}),re&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,we.secondary&&le===null&&(xe?`border-b border-border`:`border-e border-border`),ve&&`hidden`),style:Ce(Se.secondary,le===Sl.SECONDARY),"data-content-area":`secondary`,"data-zone-hidden":ve||void 0,"data-zone-emphasized":le===Sl.SECONDARY||void 0,onPointerDown:se,onFocus:se,...d(Sl.SECONDARY),children:(0,$.jsx)(n2,{zone:Sl.SECONDARY,emphasized:le===Sl.SECONDARY,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(Q0,{geometry:F,children:(0,$.jsx)(z0,{zone:Sl.SECONDARY,emptyState:R})})})}),ie&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,ye&&`hidden`),style:Ce(Se.companion,le===Sl.COMPANION),"data-content-area":`companion`,"data-zone-hidden":ye||void 0,"data-zone-emphasized":le===Sl.COMPANION||void 0,onPointerDown:ce,onFocus:ce,...d(Sl.COMPANION),children:(0,$.jsx)(n2,{zone:Sl.COMPANION,emphasized:le===Sl.COMPANION,onToggleEmphasis:fe,onDismiss:ge?me:void 0,children:(0,$.jsx)(Q0,{geometry:I,children:(0,$.jsx)(z0,{zone:Sl.COMPANION,emptyState:R})})})})]})})},Vwe=()=>{let{state:e,getZoneState:t}=Px(),{closeOverlay:n}=wS(),r=nh(),i=e.overlay,a=i.length>0?i[i.length-1]:void 0,o=i.length>0,s=C1(a?.appearance??Rn.DIALOG),{title:c}=Y$(a),l=(0,Q.useCallback)(i=>{if(!i){if(a?.content.contentType===od.SETTINGS_HUB){let n=e.zones[Sl.PRIMARY]?.stack??[],i=e.zones[Sl.SECONDARY]?.stack??[],a=i[i.length-1],o=n[n.length-1]?.urlPath,s=(a?.hostedPane&&o?zm.resolveBrowserUrlForZoneEntry({zone:Sl.SECONDARY,entryUrlPath:a.urlPath,paneContent:a.content,currentBrowserUrl:o,getZoneState:t}):o)??Ln.home;r(s,{replace:!0})}else n()}},[n,r,a,e.zones,t]),u=P$(),{registry:d}=lm(),f=(0,Q.useCallback)(e=>d.resourceConfigurations[e]?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,[d]),p=a?.content.contentType===od.SETTINGS_HUB?ISe(USe(u.sections,a.content.sectionRef??u.defaultSectionRef,f)):LSe(s);return(0,$.jsx)(y1,{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:Zs.END},className:p,children:a&&(0,$.jsx)(L0,{content:a.content,zone:rr.OVERLAY,initiator:a.initiator,entryId:a.id})})},i2=()=>(0,$.jsx)(Vwe,{});function a2(e){return typeof e==`object`&&!!e&&`placement`in e&&`collapsible`in e}function o2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s2(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.position===void 0||t.position===Zc.START||t.position===Zc.END,r=t.items===void 0||Array.isArray(t.items);return n&&r}var c2;(function(e){e.ENUM=`enum`,e.RESOURCE_REFERENCE=`resource_reference`,e.RAW=`raw`})(c2||={});var l2;(function(e){e.STATIC=`static`,e.LINK=`link`,e.BUTTON=`button`})(l2||={});var u2;(function(e){e.BUTTON=`button`,e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.SELECT=`select`})(u2||={});var d2;(function(e){e.COMMANDS=`commands`,e.RECORDS=`records`})(d2||={});function f2(e){switch(e){case Fr.COMMAND_MENU:return B.APPLICATION_LEVEL_COMMAND_MENU;case Fr.QUICK_ACTION_BUTTON:return B.APPLICATION_LEVEL_QUICK_ACTION_BUTTON;case Fr.NOTIFICATION_CENTER:return B.APPLICATION_LEVEL_NOTIFICATION_CENTER;case Fr.USER_DROPDOWN:return B.APPLICATION_LEVEL_USER_DROPDOWN;case Fr.CONTROL_PANEL:return B.APPLICATION_LEVEL_CONTROL_PANEL;case Fr.QUICK_SWITCHER:return B.APPLICATION_LEVEL_QUICK_SWITCHER;case Fr.NAVIGATION_CONTROL:return B.APPLICATION_LEVEL_NAVIGATION_BACK;case Fr.UTILITY_PANEL:return B.APPLICATION_LEVEL_UTILITY_PANEL;default:return null}}function p2(e,t){if(e.startsWith(`data:`)||e.startsWith(`blob:`))return!0;try{return new URL(e,t).origin===t}catch{return!1}}function m2(e){let{httpClient:t}=Tu(),n=e!==void 0&&p2(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 h2(e={}){let{composition:t=ne.SYMBOL,purpose:n=$t.PRIMARY,theme:r,includeOrganizationBrand:i=!0}=e,{appConfig:a}=Tu(),{isDark:o,shellIdentity:s,organizationLogoUrl:c,organizationProductName:l}=Rg(),u=s?s.brandAssets:a.brandAssets,d=s?s.name:a.appIdentity?kne(a.appIdentity):``,f=(0,Q.useMemo)(()=>{if(u?.length)return It(u,{composition:t,theme:r??(o?Yi.DARK:Yi.LIGHT),purpose:n})},[u,t,n,r,o]),p=i&&!s,m=m2(p?c:void 0),h=p&&l||d;return p&&c?{name:h,logoUrl:m,logoComposition:void 0,markIsSingleColourOnDarkUi:!1}:{name:h,logoUrl:f?.url,logoComposition:f?.composition,markIsSingleColourOnDarkUi:f?.theme===Yi.MONOCHROME&&o}}function g2(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!==ne.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 _2(e,t,n,r,i,a){if(!n||!t||t.length===0)return[];let o=[],s=new Map;for(let c of t){let t=c.componentType;if(c.breakpoint&&c.breakpoint!==r||n[t]===!1||t===Fr.NAVIGATION_CONTROL&&!uu(a?.backAffordanceOwner))continue;let l=f2(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 v2(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)=>_2(i,r(i),t,n,a).some(t=>t.component===e);return!!t?.[Fr.MENUBAR]&&i(Fr.MENUBAR,Zc.START)||!!t?.[Fr.SIDEBAR]&&i(Fr.SIDEBAR,al.TOP)}var y2=new Set;function b2(e){let t=typeof e==`string`?e:o2(e)?e.placement:void 0;if(t===void 0)return al.BOTTOM;if(or(t))return t;let n=String(t);return y2.has(n)||(y2.add(n),rs.getLogger().warn(`[app-shell] the status bar is configured at '${n}', which no shell layout places (only '${al.TOP}' and '${al.BOTTOM}'); it is shown at '${al.BOTTOM}'.`)),al.BOTTOM}function x2(){let{UIConfig:e,navigationLayout:t,appComponentsConfiguration:n}=Rg(),{markComponentInitialized:r}=Tu(),i=!!(t&&n);return(0,Q.useEffect)(()=>{i&&r(Pe.APP_MAIN_CONTAINER)},[i,r]),(0,Q.useMemo)(()=>{if(!i||!t||!n)return{hasMenubar:!1,hasSidebar:!1,hasStatusBar:!1,hasToolbar:!1,hasActivityBar:!1,hasQuickActionButton:!1,hasUtilityPanel:!1,quickActionButtonHostedInChrome:!1,utilityPanelHostedInChrome:!1,sidebarPlacement:Zc.START,statusBarPlacement:al.BOTTOM,utilityPanelPlacement:Zc.END,isLayoutReady:!1};let r=n[Fr.SIDEBAR],a=n[Fr.STATUS_BAR],o=n[Fr.UTILITY_PANEL],s=a2(r)?r.placement:Zc.START;return{hasMenubar:!!n[Fr.MENUBAR],hasSidebar:!!r,hasStatusBar:!!a,hasToolbar:!!n[Fr.TOOLBAR],hasActivityBar:!!n[Fr.ACTIVITY_BAR],hasQuickActionButton:!!n[Fr.QUICK_ACTION_BUTTON],hasUtilityPanel:!!o,quickActionButtonHostedInChrome:v2(Fr.QUICK_ACTION_BUTTON,n,e?.currentBreakpoint),utilityPanelHostedInChrome:v2(Fr.UTILITY_PANEL,n,e?.currentBreakpoint),sidebarPlacement:s,statusBarPlacement:b2(a),utilityPanelPlacement:s2(o)?o.position??Zc.END:Zc.END,isLayoutReady:!0}},[i,t,n,e?.currentBreakpoint])}function Hwe(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 S2(e=!1,t){let{markComponentInitialized:n,frontendConfiguration:r}=Tu();(0,Q.useEffect)(()=>{n(Pe.PUBLIC_APP_CONTAINER)},[n]);let i=h2({includeOrganizationBrand:!1}),{shellIdentity:a}=Rg(),o=e&&!a?t:void 0,s=m2(o?.logoUrl||void 0),c=m2(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===tm.BRAND_HEADER?l:void 0;return Hwe(c),{useCardLayout:e,isReady:!0,brandHeader:u,brandAccentColor:u?o?.primaryColor:void 0}}var Uwe=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function C2(e){return!e||typeof document>`u`?null:document.getElementById(e)}var w2=(0,Q.createContext)(null);function T2(){return(0,Q.useContext)(w2)??void 0}function E2(e,t){let n=T2(),{getSurfacePolicy:r}=Rg(),i=r?.(e,t)?.stacking?.portalTarget,a=typeof i==`string`&&i!==`inline`&&i!==`app-portal`&&i!==`reset`?i:null,[o,s]=(0,Q.useState)(()=>C2(a));return Uwe(()=>{if(!a||typeof document>`u`){s(null);return}let e=C2(a);if(s(e),e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{let e=C2(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 D2(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 O2(e,t){let{getSurfacePolicy:n}=Rg(),r=n?.(e,t)?.stacking?.stackingTier;return D2(r)}function k2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_ACTIVITY_BAR,`ApplicationLevel_ActivityBar`)(e);return(0,$.jsx)(n,{...t})}function A2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_MENUBAR,`ApplicationLevel_MenuBar`)(e);return(0,$.jsx)(n,{...t})}function j2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_QUICK_ACTION_BUTTON,`ApplicationLevel_QuickActionButton`)(e);return(0,$.jsx)(n,{...t})}function M2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_SIDEBAR,`ApplicationLevel_Sidebar`)(e);return(0,$.jsx)(n,{...t})}function N2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_STATUS_BAR,`ApplicationLevel_StatusBar`)(e);return(0,$.jsx)(n,{...t})}function P2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_TOOLBAR,`ApplicationLevel_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function F2({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_UTILITY_PANEL,`ApplicationLevel_UtilityPanel`)(e);return(0,$.jsx)(n,{...t})}var I2=(0,Q.createContext)({getHostedComponentProps:()=>({})});function L2(){return(0,Q.useContext)(I2)}function R2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wwe(e){return R2(e)}var Gwe=new Set([Fr.COMMAND_MENU,Fr.NOTIFICATION_CENTER,Fr.QUICK_SWITCHER]);function z2({children:e}){let{appComponentsConfiguration:t,UIConfig:n,navigationLayout:r}=Rg(),i=n?.currentBreakpoint,{on:a,emit:o}=Ao(),{register:s}=j$(),{t:c}=K(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(0),h=t?.[Fr.MENUBAR],g=t?.[Fr.SIDEBAR],_=(0,Q.useMemo)(()=>{let e=t,n=R2(h)?_2(Fr.MENUBAR,h.hostedComponents,e,i,Zc.START,r):[],a=R2(g)?_2(Fr.SIDEBAR,g.hostedComponents,e,i,al.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 _)Gwe.has(t.component)&&(e.has(t.component)||e.set(t.component,t.instanceId));return e},[_]),b=e=>v.has(e),x=t?.[Fr.COMMAND_MENU],S=Wwe(x)?x.openShortcut:void 0;(0,Q.useEffect)(()=>{if(b(Fr.COMMAND_MENU))return a(wc.HOTKEY_COMMAND_MENU_OPEN,()=>{u(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.NOTIFICATION_CENTER))return a(wc.HOTKEY_NOTIFICATIONS_OPEN,()=>{f(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.QUICK_SWITCHER))return a(wc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{m(e=>e+1)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fr.COMMAND_MENU)&&S&&x!==!1)return s({id:`shell-hosted-command-menu-open-shortcut`,shortcut:S,description:c(`engine.hotkeys.commandMenuOpen`),scope:cd.GLOBAL,group:yi.NAVIGATION,launcher:Fr.COMMAND_MENU,preventDefault:!0,handler:()=>{o(wc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[x,S,o,s,c,v]);let C=(0,Q.useMemo)(()=>({getHostedComponentProps:(e,t)=>{let n=y.get(e)===t;switch(e){case Fr.COMMAND_MENU:return{listenForHotkeys:!1,isOpen:l,onOpenChange:u,renderDialog:n};case Fr.NOTIFICATION_CENTER:return{listenForHotkeys:!1,...n?{isOpen:d,onOpenChange:f}:{}};case Fr.QUICK_SWITCHER:return{focusTrigger:n?p:0};default:return{}}}}),[y,l,d,p]);return(0,$.jsx)(I2.Provider,{value:C,children:e})}var B2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a,children:o})=>{let{tComponent:s,isReady:c}=K({component:B.GUIDANCE_CHECKLIST}),{renderIcon:l}=Of(),{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===Hr.COMPLETED&&t++;return{completed:t,total:e.length}},[p.items,m?.elements]),_=g>0?Math.round(h/g*100):0,v=(0,Q.useCallback)(()=>{f(e=>!e)},[]),y=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if(!c)return null;let b=a(`title`),x=a(`description`),S=s(B.GUIDANCE_CHECKLIST,`headerTitle`),C=s(B.GUIDANCE_CHECKLIST,`progress`,{completed:h,total:g}),w=d?s(B.GUIDANCE_CHECKLIST,`expand`):s(B.GUIDANCE_CHECKLIST,`collapse`),T=s(B.GUIDANCE_CHECKLIST,`dismiss`);return(0,$.jsxs)(OF,{className:`w-80 max-w-[calc(100vw-3rem)] overflow-hidden`,role:`region`,"aria-label":S||b,children:[(0,$.jsxs)(AF,{className:`flex-row items-center justify-between gap-2 py-3 px-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-sm truncate`,children:S||b}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:v,"aria-expanded":!d,"aria-controls":`guidance-checklist-${p.ref}`,className:`text-xs text-muted-foreground px-1.5 py-0.5 h-auto`,children:w})]}),(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:y,"aria-label":T,children:l(H.CLOSE,{size:ca.SM})})]}),p.showProgress&&(0,$.jsxs)(`div`,{className:`px-4 pb-2 flex items-center gap-2.5`,children:[(0,$.jsx)(b_,{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)(FF,{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})]})]})},V2=({element:e,flowRef:t,state:n,onComplete:r,onAction:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:B.GUIDANCE_CHECKLIST_ITEM}),c=e,l=n?.status===Hr.COMPLETED,u=(0,Q.useCallback)(()=>{l||r(c.ref)},[l,r,c.ref]),d=(0,Q.useCallback)(()=>{c.actionRef&&i(c.actionRef)},[i,c.actionRef]);if(!s)return null;let f=a(`title`),p=a(`actionLabel`);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2 border-b border-border/50 last:border-b-0`,role:`listitem`,children:[(0,$.jsx)(EI,{name:`__display`,schema:Dd(),checked:l,onCheckedChange:u,disabled:l,"aria-label":l?o(B.GUIDANCE_CHECKLIST_ITEM,`completed`):o(B.GUIDANCE_CHECKLIST_ITEM,`markComplete`)}),(0,$.jsx)(`span`,{className:`flex-1 min-w-0 text-sm leading-snug ${l?`line-through text-muted-foreground`:``}`,children:f}),p&&c.actionRef&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:d,className:`shrink-0`,children:p})]})},H2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let o=(0,Q.useMemo)(()=>[`guidance.${t}`],[t]),{tComponent:s,tGuidanceTourStep:c,isReady:l}=K({component:B.GUIDANCE_TOUR,keys:o}),{getRecipe:u}=Rg(),{renderIcon:d}=Of(),f=T2(),p=e,m=u(oc.SURFACE,nt.OVERLAY),h=(0,Q.useMemo)(()=>[...p.steps??[]].sort((e,t)=>e.order-t.order),[p.steps]),[g,_]=(0,Q.useState)(n?.lastStepIndex??0),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=h[g],C=h.length,w=g===C-1,T=g===0;(0,Q.useEffect)(()=>{if(!S?.targetSelector){y(null);return}let e=()=>{let e=document.querySelector(S.targetSelector);y(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(S.targetSelector);t&&(x.current=new ResizeObserver(e),x.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{x.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[S?.targetSelector]);let E=(0,Q.useCallback)(()=>{w?r(p.ref,{lastStepIndex:g}):_(e=>e+1)},[w,r,p.ref,g]),D=(0,Q.useCallback)(()=>{T||_(e=>e-1)},[T]),O=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if((0,Q.useEffect)(()=>{let e=b.current;if(!e)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),O())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[O]),YE(b,!0),!l)return null;let k=s(B.GUIDANCE_TOUR,`next`),A=s(B.GUIDANCE_TOUR,`previous`),j=s(B.GUIDANCE_TOUR,`skip`),M=s(B.GUIDANCE_TOUR,`finish`),N=s(B.GUIDANCE_TOUR,`close`),P=s(B.GUIDANCE_TOUR,`stepProgress`,{current:g+1,total:C}),F=S?c(t,p.ref,S.ref,`title`):``,I=S?c(t,p.ref,S.ref,`description`):``;if(!S||typeof document>`u`)return null;let ee=Kwe(S.placement??ni.BOTTOM,v),L=f??document.body;return EN.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)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.OVERLAY,children:(0,$.jsxs)(`div`,{ref:b,style:ee,role:`dialog`,"aria-modal":`true`,tabIndex:-1,"aria-label":F,className:U(`w-[340px] max-w-[calc(100vw-2rem)] rounded-xl overflow-hidden font-inherit text-sm pointer-events-auto`,m.base,`shadow-[var(--shadow-xl)]`),children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:O,"aria-label":N,className:`absolute top-2 end-2 z-[calc(var(--z-guidance)+2)]`,children:d(H.CLOSE,{size:ca.SM})}),(0,$.jsxs)(`div`,{className:`px-5 pt-5 pb-3`,children:[F&&(0,$.jsx)(`h3`,{className:`m-0 text-base font-semibold leading-tight pe-6`,children:F}),I&&(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground leading-normal`,children:I})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-4`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:P}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p.allowSkip&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:O,children:j}),!T&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:D,children:A}),(0,$.jsx)(X,{size:Y.SM,onClick:E,children:w?M:k})]})]})]})})]}),L)};function Kwe(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 U2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:B.GUIDANCE_TOOLTIP}),{getRecipe:c}=Rg(),l=T2(),u=e,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(null),h=c(oc.SURFACE,nt.RAISED);(0,Q.useEffect)(()=>{if(!u.targetSelector)return;let e=()=>{let e=document.querySelector(u.targetSelector);f(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(u.targetSelector);t&&(m.current=new ResizeObserver(e),m.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{m.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[u.targetSelector]),(0,Q.useEffect)(()=>{u.showOnce&&!p.current&&d&&n?.status!==Hr.COMPLETED&&(p.current=!0,r(u.ref))},[u.showOnce,u.ref,d,n?.status,r]);let g=(0,Q.useCallback)(()=>{i(u.ref)},[i,u.ref]),_=(0,Q.useCallback)(()=>{r(u.ref)},[r,u.ref]);if(!s||typeof document>`u`||!d)return null;let v=l??document.body,y=a(`title`),b=a(`content`),x=o(B.GUIDANCE_TOOLTIP,`dismiss`),S=o(B.GUIDANCE_TOOLTIP,`gotIt`),C=qwe(u.placement??ni.BOTTOM,d);return EN.createPortal((0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.RAISED,children:(0,$.jsxs)(`div`,{style:C,role:`dialog`,"aria-label":y||b||void 0,"data-guidance-tooltip":u.ref,className:U(`w-70 max-w-[calc(100vw-2rem)] rounded-xl z-[calc(var(--z-guidance)+2)] font-inherit text-sm`,h.base,`shadow-[var(--shadow-lg)]`),children:[(0,$.jsxs)(`div`,{className:`px-4 pt-3.5 pb-2`,children:[y&&(0,$.jsx)(`div`,{className:`font-semibold text-sm mb-1`,children:y}),b&&(0,$.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground leading-normal`,children:b})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 px-4 pb-3.5`,children:[(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:g,children:x}),(0,$.jsx)(X,{size:Y.SM,onClick:_,children:S})]})]})}),v)};function qwe(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 W2=({element:e,t,onAction:n,onDismiss:r,onComplete:i})=>{let{tComponent:a,isReady:o}=K({component:B.GUIDANCE_MODAL}),s=e,c=s.ctaAction,l=s.dismissible??!0,u=s.imageUrl,d=s.videoUrl,f=(0,Q.useCallback)(()=>{c&&n(c),i(e.ref)},[c,n,i,e.ref]),p=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]),m=(0,Q.useCallback)(t=>{!t&&l&&r(e.ref)},[l,r,e.ref]);if(!o)return null;let h=t(`title`),g=t(`description`),_=t(`content`),v=t(`actionLabel`),y=h||a(B.GUIDANCE_MODAL,`defaultTitle`);return(0,$.jsx)(tG,{open:!0,onOpenChange:m,children:(0,$.jsxs)(rG,{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)(aG,{children:[(0,$.jsx)(sG,{className:h?void 0:`sr-only`,children:y}),g&&(0,$.jsx)(cG,{children:g})]}):(0,$.jsx)(sG,{className:`sr-only`,children:y}),_&&(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:_}),(0,$.jsxs)(oG,{children:[l&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:p,children:a(B.GUIDANCE_MODAL,`dismiss`)}),v&&(0,$.jsx)(X,{size:Y.SM,onClick:f,children:v})]})]})})},Jwe={[xr.INFO]:`info`,[xr.SUCCESS]:`success`,[xr.WARNING]:`warning`,[xr.ERROR]:`destructive`},G2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_BANNER}),{renderIcon:o}=Of(),s=e,c=s.variant??xr.INFO,l=s.position??Vi.TOP,u=s.dismissible??!0,d=s.actionRef,f=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let p=t(`title`),m=t(`content`),h=t(`actionLabel`),g=l===Vi.BOTTOM?`absolute bottom-0 inset-x-0 rounded-none border-x-0 border-b-0`:`absolute top-0 inset-x-0 rounded-none border-x-0 border-t-0`;return(0,$.jsx)(AD,{variant:Jwe[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)(jD,{children:p}),m&&(0,$.jsx)(MD,{children:m})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[h&&d&&(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(d),children:h}),u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:f,"aria-label":i(B.GUIDANCE_BANNER,`ariaClose`),title:i(B.GUIDANCE_BANNER,`dismiss`),children:o(H.CLOSE,{size:ca.SM})})]})]})})},Ywe={[xr.INFO]:`info`,[xr.SUCCESS]:`success`,[xr.WARNING]:`warning`,[xr.ERROR]:`destructive`},K2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_ANNOUNCEMENT}),{renderIcon:o}=Of(),s=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let c=e,l=c.variant??xr.INFO,u=c.dismissible??!0,d=t(`title`),f=t(`content`),p=t(`actionLabel`),m=c.actionRef,h=c.icon;return(0,$.jsxs)(AD,{variant:Ywe[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)(jD,{children:d}),f&&(0,$.jsx)(MD,{children:f}),p&&m&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(m),children:p})})]}),u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:s,"aria-label":i(B.GUIDANCE_ANNOUNCEMENT,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:ca.SM})})]})},Xwe={[Pu.DEFAULT]:bl.NEUTRAL,[Pu.PRIMARY]:bl.INFO,[Pu.SECONDARY]:bl.NEUTRAL,[Pu.SUCCESS]:bl.SUCCESS,[Pu.WARNING]:bl.WARNING,[Pu.ERROR]:bl.ERROR},q2=({element:e,t})=>{let n=e,r=n.variant??Pu.DEFAULT,i=n.unlocked??!1,a=t(`title`),o=t(`content`),s=n.icon;return(0,$.jsxs)(Mf,{variant:Gg(Xwe[r]),className:i?``:`opacity-[var(--opacity-disabled)]`,children:[s&&(0,$.jsx)(`span`,{className:`text-xs leading-none`,"aria-hidden":`true`,children:s}),a||o]})},J2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:B.GUIDANCE_CARD}),{renderIcon:o}=Of(),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)(OF,{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)(AF,{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)(FF,{children:(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:h})}),g&&l&&(0,$.jsx)(jF,{children:(0,$.jsx)(X,{size:Y.SM,onClick:()=>n(l),children:g})}),c&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON_SM,onClick:f,"aria-label":i(B.GUIDANCE_CARD,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:ca.SM})})]})},Zwe=yd(),Y2=({element:e,flowRef:t,t:n,onComplete:r})=>{let i=Q.useMemo(()=>t?[`guidance.${t}`]:[],[t]),{tComponent:a,tGuidanceSurveyQuestion:o,isReady:s}=K({component:B.GUIDANCE_SURVEY,keys:i}),c=e,l=c.questions??[],u=c.allowSkip??!0,[d,f]=(0,Q.useState)(0),[p,m]=(0,Q.useState)({}),[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)(!1),y=l[d],b=d===l.length-1,x=d===0,S=l.length,C=(0,Q.useCallback)(n=>o(t,e.ref,n.id,`question`),[t,e.ref,o]),w=(0,Q.useCallback)((n,r)=>o(t,e.ref,n.id,`options.${r}.label`),[t,e.ref,o]),T=(0,Q.useCallback)((e,t)=>{m(n=>({...n,[e]:t})),g(t=>({...t,[e]:!1}))},[]),E=(0,Q.useCallback)(()=>{if(!y||!y.required)return!0;let e=p[y.id];return!(e==null||e===``||Array.isArray(e)&&e.length===0)},[y,p]),D=(0,Q.useCallback)(async()=>{if(!E())y&&g(e=>({...e,[y.id]:!0}));else if(b){v(!1);try{await r(e.ref,{surveyAnswers:p})}catch{v(!0)}}else f(e=>e+1)},[E,b,r,e.ref,p,y]),O=(0,Q.useCallback)(()=>{x||f(e=>e-1)},[x]),k=(0,Q.useCallback)(async()=>{v(!1),await r(e.ref,{surveyAnswers:p,declineResourceBinding:!0})},[r,e.ref,p]);if(!s)return null;let A=(e,t)=>{switch(e.type){case Cc.TEXT:return(0,$.jsx)(eN,{value:t??``,onChange:t=>T(e.id,t.target.value)});case Cc.TEXTAREA:return(0,$.jsx)(NI,{value:t??``,onChange:t=>T(e.id,t.target.value),rows:3});case Cc.RADIO:case Cc.SINGLE_CHOICE:{let n=(e.options??[]).map(t=>({value:t.ref,label:w(e,t.ref)}));return(0,$.jsx)(CF,{schema:Zwe,name:`survey-${e.id}`,value:t??``,onValueChange:t=>T(e.id,t),options:n,orientation:pu.VERTICAL})}case Cc.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)(EI,{name:`__display`,schema:Dd(),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 Cc.RATING:{let n=typeof t==`number`?t:0;return(0,$.jsx)(`div`,{className:`flex gap-1`,role:`radiogroup`,"aria-label":C(e),children:[1,2,3,4,5].map(t=>(0,$.jsx)(X,{variant:J.GHOST,size:Y.ICON,onClick:()=>T(e.id,t),"aria-label":a(B.GUIDANCE_SURVEY,`ratingStar`,{star:t,total:5}),className:t<=n?`text-warning`:`text-muted-foreground/40`,children:(0,$.jsx)(`span`,{className:`text-xl`,children:`★`})},t))})}default:return null}};if(l.length===0)return null;let j=n(`title`),M=n(`description`),N=S>0?Math.round((d+1)/S*100):0;return(0,$.jsxs)(OF,{className:`pointer-events-auto`,children:[(j||M)&&(0,$.jsxs)(AF,{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)(FF,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(b_,{value:N,className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:a(B.GUIDANCE_SURVEY,`questionProgress`,{current:d+1,total:S})})]}),y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsxs)(`label`,{className:`text-sm font-medium`,children:[C(y),y.required&&(0,$.jsx)(`span`,{className:`text-destructive ml-1`,children:a(B.GUIDANCE_SURVEY,`required`)})]}),A(y,p[y.id]),h[y.id]&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:a(B.GUIDANCE_SURVEY,`required`)})]}),_&&(0,$.jsx)(AD,{variant:`destructive`,role:`alert`,children:(0,$.jsx)(MD,{children:a(B.GUIDANCE_SURVEY,`submissionFailed`)})})]}),(0,$.jsxs)(jF,{className:`flex justify-between items-center`,children:[(0,$.jsx)(`div`,{children:!x&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:O,children:a(B.GUIDANCE_SURVEY,`previous`)})}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:k,children:a(B.GUIDANCE_SURVEY,`skip`)}),(0,$.jsx)(X,{size:Y.SM,onClick:D,children:b?a(B.GUIDANCE_SURVEY,`submit`):a(B.GUIDANCE_SURVEY,`next`)})]})]})]})},X2=()=>null,Qwe={[He.CHECKLIST]:B2,[He.CHECKLIST_ITEM]:V2,[He.TOUR]:H2,[He.TOOLTIP]:U2,[He.MODAL]:W2,[He.BANNER]:G2,[He.ANNOUNCEMENT]:K2,[He.BADGE]:q2,[He.CARD]:J2,[He.SURVEY]:Y2},Z2={[He.CHECKLIST]:B.GUIDANCE_CHECKLIST,[He.CHECKLIST_ITEM]:B.GUIDANCE_CHECKLIST_ITEM,[He.TOUR]:B.GUIDANCE_TOUR,[He.TOOLTIP]:B.GUIDANCE_TOOLTIP,[He.MODAL]:B.GUIDANCE_MODAL,[He.BANNER]:B.GUIDANCE_BANNER,[He.ANNOUNCEMENT]:B.GUIDANCE_ANNOUNCEMENT,[He.BADGE]:B.GUIDANCE_BADGE,[He.CARD]:B.GUIDANCE_CARD,[He.SURVEY]:B.GUIDANCE_SURVEY};function Q2(e,t){return t?.[e]||No.resolve(Z2[e],q.DEFAULT)||Qwe[e]}var $2=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){rs.getLogger().error(`GuidanceRenderer: element "${this.props.elementRef}" threw an error`,e)}render(){return this.state.hasError?null:this.props.children}};function e4(e){return`targetSelector`in e&&typeof e.targetSelector==`string`?e.targetSelector:e.targetField?`[data-guidance-field="${e.targetField}"]`:null}function t4(e){try{return!!document.querySelector(e)}catch{return n4.has(e)||(n4.add(e),rs.getLogger().warn(`GuidanceRenderer: "${e}" is not a valid CSS selector, so the element targeting it can never be shown.`)),!1}}var n4=new Set;function $we(e,t){if(typeof document>`u`)return!1;if(t.type===He.TOOLTIP){let e=t.targetSelector;return typeof e==`string`&&t4(e)}if(t.type===He.TOUR){let e=t.steps;return Array.isArray(e)&&e.length>0}if(e.renderMode===Lo.INLINE){let e=e4(t);return e===null||t4(e)}return!0}function eTe(e,t){let n=e=>{let n=t[e.type];return!!n&&n!==X2};return e.renderMode===Lo.CHECKLIST?e.elements.filter(e=>e.type===He.CHECKLIST&&n(e)).length===0?[]:e.elements.filter(e=>(e.type===He.CHECKLIST||e.type===He.CHECKLIST_ITEM)&&n(e)):e.elements.filter(t=>n(t)&&$we(e,t))}var tTe=({targetSelector:e,children:t})=>{let n=typeof document<`u`&&t4(e)?document.querySelector(e):null;return n?EN.createPortal((0,$.jsx)(`div`,{className:`absolute z-[calc(var(--z-guidance)-2)]`,children:t}),n):null},r4=({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}=K({keys:s}),{emit:d}=Ao(),f=T2(),p=No.getRegistrationCount(),m=(0,Q.useRef)(null),h=(0,Q.useMemo)(()=>{let t={};for(let n of Object.values(He)){let r=Q2(n,e);r&&(t[n]=r)}let n=t,r=m.current;return r&&Object.values(He).every(e=>r[e]===n[e])?r:(m.current=n,n)},[e,p]),g=(0,Q.useCallback)(e=>{d(wc.NAVIGATION_REQUEST,{operationRef:e,initiator:{sourceZone:Dn}})},[d]),_=(0,Q.useCallback)((e,t,n)=>r(e,t,n),[r]),v=(0,Q.useCallback)((e,t)=>{i(e)},[i]),y=(0,Q.useMemo)(()=>{if(t.length===0)return null;let e=[],r=[],i=[];for(let a of t){let t=n[a.ref];if(a.renderMode===Lo.CHECKLIST){let e=a.elements.filter(e=>e.type===He.CHECKLIST),n=a.elements.filter(e=>e.type===He.CHECKLIST_ITEM);for(let r of e){let e=h[He.CHECKLIST];if(!e||e===X2)continue;let o=t?.elements?.[r.ref],s=c(a.ref,r.ref,Lc(r)),l=h[He.CHECKLIST_ITEM],u=l&&l!==X2?n.map(e=>{let n=t?.elements?.[e.ref],r=c(a.ref,e.ref,Lc(e));return(0,$.jsx)($2,{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)($2,{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===X2)continue;let o=t?.elements?.[n.ref],s=c(a.ref,n.ref,Lc(n)),l=(0,$.jsx)($2,{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 Lo.OVERLAY:e.push(l);break;case Lo.INLINE:{let e=e4(n);e?r.push((0,$.jsx)(tTe,{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=eTe(e,h);if(o(e.ref,t.length===0),t.length===0)continue;let n=t.flatMap(t=>Lc(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),rs.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&&EN.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&&EN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`checklist`,className:`${T} bottom-6 end-6 z-[calc(var(--z-guidance)-1)]`,children:C}),w)]})},i4=(0,Q.createContext)(null),a4=(0,Q.createContext)(null),o4=(0,Q.createContext)(null);function s4(e){let t=(0,Q.useContext)(i4);if(!t)throw Error(`${e} must be rendered inside <AppShellProviders>, which supplies the layout it places regions from.`);return t}function c4(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{e&&n(!0)},[e]),t}function l4(){return(0,$.jsx)(_D,{asChild:!0,emitPolicyVars:!1,variant:nt.SHELL,policyOverride:WE,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)($y,{size:32,className:`text-primary mx-auto mb-field`,"aria-hidden":`true`})})})})}function u4({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)(i4.Provider,{value:e,children:(0,$.jsx)(a4.Provider,{value:o,children:(0,$.jsx)(o4.Provider,{value:s,children:(0,$.jsx)(w2.Provider,{value:i??n,children:(0,$.jsx)(z2,{children:t})})})})})}function d4(){let e=(0,Q.useContext)(o4);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 f4(e){let t=s4(`AppShellRegionOutlet`),{region:n,placement:r}=e,i=e=>r===void 0||r===e?e:null;switch(n){case co.ACTIVITY_BAR:return t.hasActivityBar?(0,$.jsx)(k2,{}):null;case co.MENUBAR:return t.hasMenubar?(0,$.jsx)(A2,{}):null;case co.TOOLBAR:return t.hasToolbar?(0,$.jsx)(P2,{}):null;case co.SIDEBAR:{let e=i(t.sidebarPlacement);return t.hasSidebar&&e?(0,$.jsx)(M2,{placement:e}):null}case co.UTILITY_PANEL:{let e=i(t.utilityPanelPlacement);return t.hasUtilityPanel&&e&&!t.utilityPanelHostedInChrome?(0,$.jsx)(F2,{position:e}):null}case co.STATUS_BAR:{let e=i(t.statusBarPlacement);return t.hasStatusBar&&e?(0,$.jsx)(N2,{placement:e}):null}default:throw Error(`AppShellRegionOutlet has no rendering for region "${String(n)}".`)}}function p4({className:e,children:t}){let n=s4(`AppShellContentOutlet`),r=(0,Q.useContext)(a4);return(0,$.jsxs)(`main`,{ref:r??void 0,"data-component-area":co.CONTENT,className:e,children:[(0,$.jsx)(r2,{routerChildren:t}),n.hasQuickActionButton&&!n.quickActionButtonHostedInChrome&&(0,$.jsx)(j2,{placement:`floating`})]})}function m4(){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i2,{}),(0,$.jsx)(r4,{})]})}var h4;(function(e){e.INHERIT=`inherit`,e.COMPOSED=`composed`})(h4||={});var g4;(function(e){e.SHELL=`shell`,e.LAYOUT_2D=`layout-2d`,e.LAYOUT_3D=`layout-3d`})(g4||={});var _4=Symbol.for(`@wildo-ai/saas-frontend-lib/shell-layout-main-container`);function v4(e){return typeof e==`function`&&e[_4]===!0}function y4(e,t){switch(t.placement.kind){case h4.INHERIT:return e;case h4.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 b4(e,t,n,r,i){return Object.assign(e,{...i??{},[_4]:!0,captured:t,layout:n,layoutFamily:r})}function x4(e,t,n=g4.SHELL){let r=y4(e,t);function i(e){return(0,$.jsx)(r,{...e})}return b4(i,e,t,n)}function S4(e,t={}){let n=t.callerName??`registerShellLayout()`,r=!1;return{componentRef:B.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT,get isConfigurable(){return r},loadComponent:async()=>{let i=No.resolve(B.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT);if(!i)throw Error(`${n}: no Default APP_LAYOUTS_MAIN_CONTAINER is registered to capture. Call it from the engine module's \`componentRegistrations\`, which run after the framework presets — not from a module evaluated before them.`);let a=t.family??g4.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(v4(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=No.getMetadata(B.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT)?.isConfigurable??!1;let s=v4(i)?i.captured:i,c=t.createContainer?t.createContainer(s,e):x4(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 C4;(function(e){e.APPEARED=`appeared`,e.CHANGED=`changed`})(C4||={});var w4;(function(e){e.REST=`rest`,e.BEHIND=`behind`,e.DISCARDED=`discarded`})(w4||={});var T4;(function(e){e.PANE_SWAP=`pane-swap`,e.COLUMN_RESIZE=`column-resize`})(T4||={});var E4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(E4||={});var D4;(function(e){e.INSTANT=`instant`,e.GROW=`grow`})(D4||={});var O4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(O4||={});var k4=.55,A4=`data-shell-proxy`,j4=`data-shell-object`,M4=`data-shell-ghost-layer`,N4=`data-shell-ghost`,P4=[`id`,`data-content-area`,`data-panel-id`,`data-zone-hidden`,`data-zone-emphasized`,`data-component-area`,j4,`data-navigation-back`,`data-operation-id`,`data-nav-item-id`,`data-ref`],F4;(function(e){e.DISCARDED=`discarded`,e.BEHIND=`behind`})(F4||={});var I4;(function(e){e.BACK=`back`,e.FRONT=`front`})(I4||={});function L4(e){return`[data-component-area="${e}"]`}var R4=L4(co.CONTENT),z4=`${R4} [data-content-area]:not([data-panel-id] *), ${R4} [data-panel-id^="nav-"]`;function B4(e){return`${R4} [data-content-area="${e}"]:not([data-panel-id] *), ${R4} [data-panel-id="nav-${e}"]`}function V4(e){if(e instanceof HTMLElement)return e.dataset.contentArea??e.dataset.panelId?.replace(/^nav-/,``)}var H4=new Set([Sl.SECONDARY,Sl.COMPANION]);function U4(e){let t=V4(e);return t!==void 0&&H4.has(t)}function W4(e){return H4.has(e)}var G4;(function(e){e.DROPDOWN_MENU=`dropdown-menu-content`,e.DROPDOWN_MENU_SUB=`dropdown-menu-sub-content`,e.CONTEXT_MENU=`context-menu-content`,e.CONTEXT_MENU_SUB=`context-menu-sub-content`,e.POPOVER=`popover-content`,e.HOVER_CARD=`hover-card-content`,e.TOOLTIP=`tooltip-content`,e.SELECT=`select-content`,e.MENUBAR=`menubar-content`,e.MENUBAR_SUB=`menubar-sub-content`,e.DIALOG=`dialog-content`,e.ALERT_DIALOG=`alert-dialog-content`,e.SHEET=`sheet-content`,e.DRAWER=`drawer-content`})(G4||={});var K4={[G4.DROPDOWN_MENU]:`--radix-dropdown-menu-content-transform-origin`,[G4.DROPDOWN_MENU_SUB]:`--radix-dropdown-menu-content-transform-origin`,[G4.CONTEXT_MENU]:`--radix-context-menu-content-transform-origin`,[G4.CONTEXT_MENU_SUB]:`--radix-context-menu-content-transform-origin`,[G4.POPOVER]:`--radix-popover-content-transform-origin`,[G4.HOVER_CARD]:`--radix-hover-card-content-transform-origin`,[G4.TOOLTIP]:`--radix-tooltip-content-transform-origin`,[G4.SELECT]:`--radix-select-content-transform-origin`,[G4.MENUBAR]:`--radix-menubar-content-transform-origin`,[G4.MENUBAR_SUB]:`--radix-menubar-content-transform-origin`},nTe=[G4.DIALOG,G4.ALERT_DIALOG],q4=[G4.DIALOG,G4.ALERT_DIALOG,G4.SHEET,G4.DRAWER],J4=[`open`,`delayed-open`,`instant-open`];function rTe(){return`:has([data-shell-overlay-layer] :is(${q4.map(e=>`[data-slot="${e}"]`).join(`, `)})[data-state="open"])`}var Y4=new Map;function X4(e,t,n=document){let r=Y4.get(e)??{sheet:null,users:0};if(Y4.set(e,r),r.users+=1,r.users===1){if(`adoptedStyleSheets`in n&&typeof CSSStyleSheet<`u`&&`replaceSync`in CSSStyleSheet.prototype)r.sheet=new CSSStyleSheet,r.sheet.replaceSync(t),n.adoptedStyleSheets=[...n.adoptedStyleSheets,r.sheet];else{let r=n.createElement(`style`);r.dataset.shellLayoutStylesheet=e,r.textContent=t,n.head.appendChild(r),r.sheet===null&&console.warn(`[ShellLayout] The "${e}" layout's stylesheet was not applied: this browser has no constructable stylesheets (Chrome 73+, Firefox 101+, Safari 16.4+ have them) and the content security policy refused the <style> fallback. Allow 'unsafe-inline' in style-src, or support only browsers with constructable stylesheets.`)}}let i=!1;return()=>{if(i||(i=!0,--r.users,r.users>0))return;let{sheet:t}=r;t&&(n.adoptedStyleSheets=n.adoptedStyleSheets.filter(e=>e!==t));for(let t of n.head.querySelectorAll(`style[data-shell-layout-stylesheet]`))t.dataset.shellLayoutStylesheet===e&&t.remove();Y4.delete(e)}}var iTe=24,aTe=220,oTe=.5,Z4=24,sTe=28,cTe=1500,Q4=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function lTe(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[...P4,`data-slot`,`data-state`])e.removeAttribute(t);for(let e of t.querySelectorAll(`iframe, video, audio`))e.remove();return t}function $4(e,t){if(!(e instanceof HTMLElement))return!1;let n=e.offsetHeight;return n>=iTe&&n<=aTe&&e.offsetWidth>=t*oTe}function e3(e,t){if(e.tagName!==t.tagName)return!1;let n=new Set(e.classList),r=new Set(t.classList);return n.size===0&&r.size===0||[...n].filter(e=>r.has(e)).length/Math.max(n.size,r.size)>=.5}function uTe(e,t){return(e.parentElement?[...e.parentElement.children]:[]).some(n=>n!==e&&$4(n,t)&&e3(n,e))}function t3(e){let t=e.closest(z4);if(!t)return null;let n=t.clientWidth;for(let r=e;r&&r!==t;r=r.parentElement)if($4(r,n)&&uTe(r,n))return r;return null}var dTe=`button, a, [role="button"], [role="menuitem"], [role="option"]`;function n3(e){let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(t.current=null,!e)return;let n=e=>{if(!e)return;let n=t3(e),r=e.closest(dTe)??e;t.current={row:n?{...Q4(n.getBoundingClientRect()),picture:lTe(n),element:n}:null,control:Q4(r.getBoundingClientRect()),at:performance.now()}},r=e=>n(e.target instanceof Element?e.target:null),i=e=>{e.key===`Enter`||e.key===` `?n(document.activeElement):t.current=null};return document.addEventListener(`pointerdown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`pointerdown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),(0,Q.useMemo)(()=>{let e=(e,n)=>{let r=t.current;return!r||performance.now()-r.at>n?null:(t.current=null,e(r))};return{takeRow:t=>e(e=>e.row,t),peekRow:e=>{let n=t.current;return n&&performance.now()-n.at<=e?n.row:null},takeControl:t=>e(e=>e.control,t)}},[])}function r3(e,t,n,r,i){let a=Math.round(r.durationMs*k4);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(A4,``),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:k4},{opacity:1}],{duration:r.durationMs,easing:`linear`}),c.animate([s(t,10),s(n,14)],{duration:a,easing:r.easing,fill:`forwards`}).finished.catch(()=>void 0).then(()=>c.remove())}function i3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,i.top+t.top-a.top),s=Math.max(0,i.left+t.left-a.left),c=Math.max(0,a.right-(i.left+t.left+t.width)),l=Math.max(0,a.bottom-(i.top+t.top+t.height));e.animate([{clipPath:`inset(${o}px ${c}px ${l}px ${s}px round 12px)`},{clipPath:`inset(0px 0px 0px 0px round 0px)`}],{duration:r.durationMs,easing:r.easing})}function a3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect().left+t.left-e.getBoundingClientRect().left;Math.abs(i)<2||e.animate([{transform:`translateX(${i}px)`},{transform:`none`}],{duration:r.durationMs,easing:r.easing})}function o3(e){let t=e.clientWidth,n=[];for(let r of[e,...e.querySelectorAll(`*`)]){if(r.children.length<2||r.children.length<=n.length)continue;let e=[...r.children].filter(e=>$4(e,t)),i=[];for(let t of e){let e=i.find(e=>e3(e[0],t));e?e.push(t):i.push([t])}let a=i.reduce((e,t)=>t.length>e.length?t:e,[]);a.length>=2&&a.length>n.length&&a.length>=r.children.length*.6&&(n=a)}return n}function s3(e,t){if(t.durationMs===0||typeof e.animate!=`function`)return()=>void 0;let n=new WeakSet,r=0,i=()=>{a=0;for(let i of o3(e).slice(0,Z4))n.has(i)||(n.add(i),i.animate([{opacity:0,transform:`translateY(12px) scale(0.98)`},{opacity:1,transform:`none`}],{duration:Math.round(t.durationMs*.8),easing:t.easing,delay:Math.min(r,Z4)*sTe,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()},cTe);return()=>{clearTimeout(s),cancelAnimationFrame(a),o.disconnect()}}function c3(e,t,n){(0,Q.useEffect)(()=>{let r=e.current?.querySelector(`[data-shell-overlay-layer]`),i=e.current;if(!i||!r||t.dialogArrival!==O4.FROM_PRESSED_ELEMENT||t.durationMs===0)return;let a=new WeakSet,o=q4.filter(e=>e!==G4.DRAWER).map(e=>`[data-slot="${e}"][data-state="open"]`).join(`, `),s=new MutationObserver(()=>{for(let e of r.querySelectorAll(o)){if(a.has(e))continue;a.add(e);let r=n.takeControl(800);r&&r3(i,r,Q4(e.getBoundingClientRect()),t,e)}});return s.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>s.disconnect()},[e,t,n])}var l3=`shell-pane-arrival`,u3=`data-shell-view-transition`,fTe=`
25
- html[${u3}]::view-transition-old(root),
26
- html[${u3}]::view-transition-new(root) { animation: none; }
27
- ::view-transition-group(${l3}) {
28
- animation-duration: var(--shell-vt-duration, 320ms); animation-timing-function: var(--shell-vt-ease, ease);
29
- overflow: clip; border-radius: var(--radius, 8px);
30
- }
31
- ::view-transition-old(${l3}),
32
- ::view-transition-new(${l3}) { height: 100%; object-fit: none; object-position: left top; }
33
- html:dir(rtl)::view-transition-old(${l3}),
34
- html:dir(rtl)::view-transition-new(${l3}) { object-position: right top; }
35
- ::view-transition-old(${l3}) { animation: shell-vt-out calc(var(--shell-vt-duration, 320ms) * 0.6) ease-out both; }
36
- ::view-transition-new(${l3}) { animation: shell-vt-in var(--shell-vt-duration, 320ms) ease-in both; }
37
- @keyframes shell-vt-out { to { opacity: 0; } }
38
- @keyframes shell-vt-in { 0%, 40% { opacity: 0; } 100% { opacity: 1; } }
39
- @media (prefers-reduced-motion: reduce) {
40
- ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
41
- }
42
- `,pTe=rs.getLogger(),d3=null;function mTe(e=document){return typeof e.startViewTransition==`function`}function f3(e,t){for(let n of e.querySelectorAll(B4(t)))if(!n.hasAttribute(`data-zone-hidden`)&&n.offsetWidth>0)return n;return null}function hTe(e){let t=e.doc??document;return(n,{zone:r})=>{let i=e.stage(),a=t.startViewTransition;if(!i||typeof a!=`function`||e.axis.durationMs===0||!W4(r)||f3(i,r)){n();return}let o=e.origin.peekRow(800)?.element;if(!o?.isConnected){n();return}e.origin.takeRow(800);let s=t.documentElement,c={};d3=c;let l=null,u=()=>{o.style.removeProperty(`view-transition-name`),l?.style.removeProperty(`view-transition-name`),d3===c&&(d3=null,s.removeAttribute(u3),s.style.removeProperty(`--shell-vt-duration`),s.style.removeProperty(`--shell-vt-ease`))};s.setAttribute(u3,``),s.style.setProperty(`--shell-vt-duration`,`${e.axis.durationMs}ms`),s.style.setProperty(`--shell-vt-ease`,e.axis.easing),o.style.setProperty(`view-transition-name`,l3);try{a.call(t,()=>{o.style.removeProperty(`view-transition-name`);try{(0,EN.flushSync)(n)}catch(e){pTe.error(`A navigation commit failed inside the view-transition arrival`,{error:e,zone:r});return}let e=f3(i,r);if(e){for(let e of i.querySelectorAll(B4(r)))for(let t of e.getAnimations?.()??[])`animationName`in t&&t.finish();e.style.setProperty(`view-transition-name`,l3),l=e}}).finished.then(u,u)}catch{u(),n()}}}var gTe=`[${j4}], ${z4}`,p3=new WeakMap;function m3(e,t){let n=0,r=0,i=e;for(;i&&i!==t;){n+=i.offsetLeft,r+=i.offsetTop;let e=i.offsetParent;if(!e||!t.contains(e)&&e!==t)break;i=e}return{left:n,top:r}}function h3(e,t){let n=(0,Q.useRef)(t);n.current=t,(0,Q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>s()),a=new Set,o=()=>{r=0;let e=new Set(t.querySelectorAll(gTe));for(let t of e)a.has(t)||(i?.observe(t),a.add(t));for(let t of a)e.has(t)||(i?.unobserve(t),a.delete(t));for(let r of e){let e=m3(r,t);n.current?.(r,e,t),r.offsetWidth>0&&r.offsetHeight>0&&p3.set(r,{...e,width:r.offsetWidth,height:r.offsetHeight})}},s=()=>{r||=requestAnimationFrame(o)};o(),i?.observe(t);let c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0}),window.addEventListener(`resize`,s),()=>{cancelAnimationFrame(r),i?.disconnect(),c.disconnect(),window.removeEventListener(`resize`,s)}},[e])}function g3(e,t){let[n,r]=(0,Q.useState)(t);return(0,Q.useEffect)(()=>r(t),[t]),(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let t=(e.target instanceof Element?e.target:null)?.closest(`${L4(co.CONTENT)} :is([data-content-area], [data-panel-id^="nav-"])`),n=t?V4(t):void 0;n&&r(n)};return t.addEventListener(`pointerdown`,n,!0),t.addEventListener(`focusin`,n,!0),()=>{t.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`focusin`,n,!0)}},[e]),{zone:n,bringForward:r}}var _Te=new Set(pr);function _3(e,t){let n=Object.keys(e.state.zones).filter(e=>_Te.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===``?C4.APPEARED:C4.CHANGED)}},[i])}function v3(e){e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of P4)t.removeAttribute(e);for(let t of e.querySelectorAll(`iframe, video, audio`))t.remove()}function y3(e,t){for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}function b3(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function x3(e,t){(0,Q.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let r=n.querySelector(`[${M4}="${I4.BACK}"]`),i=n.querySelector(`[${M4}="${I4.FRONT}"]`);if(!r||!i)return;let a=new Map,o=t.durationMs,s=(e,r)=>{let i=document.createElement(`div`);return i.setAttribute(N4,e),i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,left:`${r.left}px`,top:`${r.top}px`,width:`${r.width}px`,height:`${r.height}px`}),y3(i,t.ghostPose(w4.REST,{rect:r,stage:n})),i},c=e=>{let r=p3.get(e);if(!r||o===0||e.isConnected)return;let a=s(F4.DISCARDED,r);v3(e),a.appendChild(e),i.appendChild(a),b3(()=>{y3(a,t.ghostPose(w4.DISCARDED,{rect:r,stage:n})),a.style.opacity=`0`}),setTimeout(()=>a.remove(),o+60)},l=()=>{let e=n.querySelector(`[data-zone-emphasized]`)&&t.drawsHiddenPanePicture?[...n.querySelectorAll(z4)].filter(e=>e.hasAttribute(`data-zone-hidden`)):[];for(let[r,i]of a){if(e.includes(r))continue;if(a.delete(r),o===0){i.remove();continue}let s=p3.get(r);s&&y3(i,t.ghostPose(w4.REST,{rect:s,stage:n})),i.style.opacity=`0`,setTimeout(()=>i.remove(),o)}for(let i of e){if(a.has(i))continue;let e=p3.get(i);if(!e)continue;let c=s(F4.BEHIND,e),l=i.cloneNode(!0);v3(l),l.classList.remove(`hidden`),l.style.width=`100%`,l.style.height=`100%`,c.appendChild(l),a.set(i,c),o===0?(y3(c,t.ghostPose(w4.BEHIND,{rect:e,stage:n})),r.appendChild(c)):(c.style.opacity=`0`,r.appendChild(c),b3(()=>{y3(c,t.ghostPose(w4.BEHIND,{rect:e,stage:n})),c.style.opacity=`1`}))}},u=e=>e.matches(z4)?e:e.closest(`[data-panel-id^="nav-"]`),d=new MutationObserver(e=>{for(let r of e)if(r.type===`attributes`&&r.attributeName===`data-zone-emphasized`&&t.paneResize===D4.GROW){let e=r.target instanceof Element?u(r.target):null,i=e?p3.get(e):void 0;e&&i&&(r.target.hasAttribute(`data-zone-emphasized`)?i3(e,i,n,t):a3(e,i,n,t))}else if(r.type===`childList`)for(let e of r.removedNodes)e instanceof HTMLElement&&p3.has(e)&&U4(e)&&c(e);l()}),f=n.querySelector(L4(co.CONTENT))??n;return d.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-zone-hidden`,`data-zone-emphasized`]}),l(),()=>{d.disconnect();for(let e of a.values())e.remove()}},[e,t]);let n=(0,Q.useRef)(()=>void 0);return(0,Q.useEffect)(()=>{n.current=n=>{let r=e.current;if(!r||t.durationMs===0)return;let i=r.querySelector(B4(n));i&&typeof i.animate==`function`&&i.animate([t.dipPeak(T4.PANE_SWAP,{stage:r})],{duration:t.durationMs,easing:t.easing})}},[e,t]),{dip:e=>n.current(e)}}var vTe=24;function S3(e,t){(0,Q.useEffect)(()=>{let n=e.current;if(!n||t.durationMs===0||typeof ResizeObserver>`u`)return;let r=[...n.querySelectorAll(`[${j4}]`)].filter(e=>e.querySelector(`:scope > ${L4(co.SIDEBAR)}, :scope > ${L4(co.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)<=vTe)continue;i.set(e,o);let c=performance.now();c-(a.get(e)??0)<t.durationMs||(a.set(e,c),e.animate([t.dipPeak(T4.COLUMN_RESIZE,{stage:n})],{duration:t.durationMs,easing:t.easing}))}});for(let e of r)o.observe(e);return()=>o.disconnect()},[e,t])}function C3(e,{axis:t,navigation:n,onObjectMeasured:r}){h3(e,r);let{dip:i}=x3(e,t),a=g3(e,n.focusedZone);S3(e,t);let o=n3(t.paneArrival===E4.FROM_PRESSED_ELEMENT||t.dialogArrival===O4.FROM_PRESSED_ELEMENT);c3(e,t,o),(0,Q.useEffect)(()=>{if(t.paneArrival!==E4.FROM_PRESSED_ELEMENT||!t.paneArrivalByViewTransition||t.durationMs===0||!mTe())return;let n=X4(`shell-view-transition`,fTe),r=Dse(hTe({stage:()=>e.current,origin:o,axis:t}));return()=>{r(),n()}},[e,o,t]);let s=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>()=>{for(let e of s.current.values())e();s.current.clear()},[]),_3(n,(n,r)=>{r===C4.CHANGED&&i(n),a.bringForward(n);let c=e.current,l=c?.querySelector(B4(n));if(c&&l&&t.durationMs!==0){if(r===C4.APPEARED&&t.paneArrival===E4.FROM_PRESSED_ELEMENT&&U4(l)){let e=o.takeRow(800);e&&r3(c,e,l.getBoundingClientRect(),t,l)}t.cascadesRows&&(s.current.get(n)?.(),s.current.set(n,s3(l,t)))}}),{frontZone:a.zone}}var w3=rs.getLogger(),yTe=w3.debugByType(`ComponentRegistryLoaderService`);w3.setDebugTypeLogging(`ComponentRegistryLoaderService`,!1);function bTe(e){if(!e||e.length===0)return;let t=0;e.forEach(e=>{e&&Object.entries(e).forEach(([e,n])=>{let r=e;n&&Array.isArray(n)&&n.forEach(e=>{if(!e||!e.component)return;let n=e.variant||e.preset||q.DEFAULT;No.isRegistered(r,n,e.category)||(No.register(r,n,e.component,{isConfigurable:e.isConfigurable!==!1,category:e.category}),t++)})})}),t>0&&yTe(`✅ Custom components loaded: ${t} components registered`)}function xTe(){let e=No.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:No.getRegistrationCount(),byCategory:t}}async function STe(e){for(let t of e){let e=await t.loadComponent();No.register(t.componentRef,t.preset??q.DEFAULT,e,{isConfigurable:t.isConfigurable??!1})}}var T3=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,schema:i,disabled:a,readOnly:o,className:s,placeholder:c,controlSize:l=qd.MD,targetResourceType:u,optionDisplayMode:d,onClear:f,leadingAdornment:p,quickCreateSourceFieldName:m,onQuickCreateCreated:h},g)=>{let _=PD(),{tComponent:v,isReady:y}=K({component:[B.RESOURCES_FIELDS_RESOURCE_REFERENCE,B.RESOURCES_LAYOUTS_LIST]}),{renderIcon:b}=Of(),x=l===qd.SM?`sm`:`md`,S=l===qd.SM?Y.XS:Y.SM,{options:C,isLoading:w,isLoadingCurrentValue:T,setIsOpen:E,handleSearchChange:D,getDisplayLabel:O,resourceType:k,isMultiple:A,normalizedValue:j,emptyMessage:M,defaultPlaceholder:N,fetchError:P}=SV({schema:i,name:e,value:t,targetResourceType:u}),{registry:F}=lm(),I=d??aae(i)?.edit?.optionDisplayMode??Ul,ee=k?F.resourceConfigurations[k]:void 0,L=ee?.mainSchema,R=P?gp({tComponent:v,componentType:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`fetchErrorEmptyMessage`,params:{message:P.message}}):M,z=Jz({sourceResourceType:LT()?.hostResolvesRelationshipRoots===!0?void 0:_?.resourceType,sourceResourceId:_?.resourceId,sourceFieldName:m??e,sourceOperation:_?.operationType,relatedResourceType:k,contextResourceIdentifiers:_?.contextResourceIdentifiers,navigationZone:_?.navigationZone,operationType:_?.operationType,onCreated:async({resourceId:e})=>{if(h)await h(e);else if(A){let t=[...new Set([...j,e])];n(t.length>0?t:void 0)}else n(e)}}),te=(0,Q.useCallback)(e=>{n(e||void 0)},[n]),ne=(0,Q.useCallback)(e=>{n(e.length>0?e:void 0)},[n]),re=(0,Q.useCallback)(e=>T?`...`:O(e.value),[T,O]),ie=(0,Q.useCallback)(e=>k&&L&&e.data&&typeof e.data==`object`?(0,$.jsx)(_G,{resourceType:k,schema:V.resolveRowSchema(ee,e.data)??L,data:e.data,primaryLabel:e.label,contextResourceIdentifiers:_?.contextResourceIdentifiers}):e.label,[k,ee,L,_?.contextResourceIdentifiers]),ae=I===tt.SUMMARY?ie:void 0;return k?y?A?(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(mx,{ref:g,name:e,schema:i,options:C,value:j,onChange:ne,renderOption:ae,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:re}),z.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:J.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:ca.SM})})]}):(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(px,{ref:g,name:e,schema:i,options:C,value:j[0]??``,onChange:te,renderOption:ae,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:re,onClear:f,leadingAdornment:p}),z.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:J.OUTLINE,className:`shrink-0`,onClick:z.launchQuickCreate,disabled:a||o||z.isLaunching,"aria-label":v(B.RESOURCES_LAYOUTS_LIST,`create`),children:z.isLaunching?b(H.LOADER_2,{size:ca.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:ca.SM})})]}):null:(0,$.jsx)(`div`,{className:U(`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,s),children:(0,$.jsxs)(`span`,{children:[`Unknown resource type for field: `,e]})})});T3.displayName=`ResourceFieldEditPreset_ResourceReference_Default`;var CTe=T3;function wTe(e){let t=e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType],n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}var E3=U(`block rounded-md text-inherit no-underline transition-colors hover:bg-muted/40`,Mg(a_.OFFSET));function D3({label:e}){return(0,$.jsx)(Z,{as:`span`,variant:zr.INHERIT,children:e})}var TTe=({fieldName:e,value:t,resourceType:n,data:r,displayParams:i,labelFallback:a,schema:o,className:s})=>{let{registry:c,doOperation:l}=lm(),{emit:u}=Ao(),d=uj(),f=PD(),p=kj({explicitResourceType:n,schema:o,fieldName:e,registry:c})||V.resolveResourceTypeForForeignKey(e,o,c),{t:m,tComponent:h,formatDate:g,formatDateTime:_,isReady:v}=K({component:B.RESOURCES_FIELDS_RESOURCE_REFERENCE,resource:p}),y=ap(),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??Fre,E=d?.parentReferenceConfig,{hidesWholeReference:D,visibleIds:O}=Q.useMemo(()=>cj({parentReferenceConfig:E,referencedResourceType:p,referencedIds:Iw(t)}),[E,p,t]),k=!!(E&&p&&E.parentResourceType===p&&E.displayMode!==na.NONE),A=(0,Q.useMemo)(()=>{if(!k||!E)return T;switch(E.displayMode){case na.CONTEXT:case na.BREADCRUMB:return T;case na.BADGE:case na.SUMMARY:return E.displayMode;default:return T}},[k,E,T]),j=(0,Q.useMemo)(()=>{if(k){if(E?.showParentLink===!1)return!1;if(E?.displayMode===na.CONTEXT||E?.displayMode===na.BREADCRUMB)return!0}return i?.linkable??!0},[k,E,i?.linkable]),M=d?.navigationZone??f?.navigationZone,N=(0,Q.useContext)(SS),P=(0,Q.useCallback)(e=>{N?N.navigate(e):u(wc.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=wTe({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]),ee=(0,Q.useMemo)(()=>{if(!p)return null;let e=c.resourceConfigurations[p];if(!e)return null;let t=d?.contextResourceIdentifiers||f?.contextResourceIdentifiers,n=d?.resourceType||f?.resourceType,r=n&&t?On.buildParentResourcesRequirements(n,t,c):[];return{refResourceConfig:e,ownFieldIdentifier:c.allResourceFieldIdentifiers?.[p],currentParentRequirements:r}},[p,c,d?.contextResourceIdentifiers,d?.resourceType,f?.contextResourceIdentifiers,f?.resourceType]),L=d?.resourceType?{resourceType:d.resourceType,id:d.resourceId}:f?{resourceType:f.resourceType,id:f.resourceId}:void 0,R=L?.resourceType,z=L?.id,te=(0,Q.useCallback)(e=>Im({hostIdentifiers:I,hostContextualParameters:b,hostParentRequirements:ee?.currentParentRequirements,hostRecord:{resourceType:R,id:z},targetResourceType:p??``,targetId:e,registry:c}),[I,b,ee?.currentParentRequirements,R,z,p,c]),ne=lS(Qm(R,z==null?void 0:String(z),I)),re=Jp()?.currentUserId??null,ie=(0,Q.useCallback)((e,t,n)=>{let r=p===ll.USERS||p===ll.USER_SELF,i=n[Bc[ll.USERS]],a=r?t:typeof i==`string`?i:null;return(e.operations??[]).filter(t=>ah({...t,resourcePrimaryScope:t.resourcePrimaryScope??e.resourcePrimaryScope},{subjectUserId:a,viewerUserId:re},ne))},[p,ne,re]),ae=(0,Q.useCallback)(e=>{if(!ee||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=ee,r=te(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=lh({resourceConfig:t,operations:ie(t,e,a),coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a});if(!o)return null;let s=Vn.buildOperationFrontendRoutePaths(t,o,c.allResourceFieldIdentifiers);if(s.length===0)return null;try{let t=On.selectMatchingRoutePath(s,i,p,n,r.parentRequirements,c.allResourceFieldIdentifiers);if(!t?.url)return null;let a=On.buildParentResourcesRequirementsFromRouteParams(t.parameters??[],p,c),l={};for(let[e,t]of Object.entries(r.contextualParameters))t!=null&&(l[e]=String(t));n&&(l[n]=e);let u=zm.resolveUrlPath(t.url,l);if(u&&!zm.hasUnresolvedPlaceholders(u))return{url:u,parentResourcesRequirements:a,readOp:o}}catch{}return null},[ee,c,p,te,ie]),oe=(0,Q.useCallback)(e=>{if(!ee||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=ee,r=te(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=lh({resourceConfig:t,operations:ie(t,e,a),coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:i,contextualParameters:a});return!o||o.operationFrontendConfig?.surface!==ju.EMBEDDED?null:{readOp:o}},[ee,c,p,te,ie]),se=(0,Q.useCallback)(e=>{let t=ae(e);if(t)return{readOp:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements};if(!ee||!p)return null;let{refResourceConfig:n,ownFieldIdentifier:r}=ee,i=te(e),a={...i.contextualParameters,...r?{[r]:e}:{}},o=lh({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:{...i.identifiers,[p]:e},contextualParameters:a});if(!o)return null;let s=V.selectOperationUrlInitiatorInfo({initiatorInfos:o.initiatorInfos??[],contextualParameters:a,targetResourceType:p,targetDefaultFieldIdentifier:r??``});return s?{readOp:o,parentResourcesRequirements:On.buildParentResourcesRequirementsFromRouteParams(s.parameters,p,c)}:null},[ae,ee,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 Rw({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!==tt.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===tt.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=On.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:r.readOp,contextResourceIdentifiers:n,parentResourcesRequirements:r.parentResourcesRequirements});t.preventDefault(),P({content:{contentType:od.RESOURCE_OPERATION,resourceContext:a},initiator:{sourceZone:M??rr.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?E3:`text-primary hover:underline`,onClick:a,children:t});let o=oe(e);return o?(0,$.jsx)(`button`,{type:`button`,className:n?U(E3,`w-full bg-transparent border-none p-0 cursor-pointer text-left`):`block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left`,onClick:t=>{if(t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;t.preventDefault();let n=te(e),r=On.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:o.readOp,contextResourceIdentifiers:{...n.identifiers,[p]:e},parentResourcesRequirements:n.parentRequirements});P({content:{contentType:od.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:M??rr.PRIMARY}})},children:t}):t},[P,N,A,ee,j,k,M,E,ae,oe,p,te]),ue=(0,Q.useCallback)(e=>{if(A===tt.ID)return(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:e});let t=x.get(e);if((t?.isLoading??!1)||!t)return(0,$.jsx)(um,{className:`h-4 w-24 inline-block`});if(t.error)return a?(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm`,title:t.error,children:a}):(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm italic`,title:`${e} · ${t.error}`,children:h(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,`recordUnavailable`)});let n=!!p&&!!V.frontendResourceLabelDefinitionOf(c.resourceConfigurations?.[p]),r=(t.data&&p&&n?V.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:t.data,t:m,formatDate:g,formatDateTime:_}):null)||t.label||a||e;if(A===na.BADGE){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(Mf,{variant:`secondary`,className:t?`cursor-pointer hover:opacity-[var(--opacity-hover)]`:void 0,onClick:t,children:r})}if(A===na.SUMMARY){if(k){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm ${t?`cursor-pointer hover:text-foreground transition-colors`:``}`,onClick:t,role:t?`button`:void 0,tabIndex:t?0:void 0,onKeyDown:t?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}:void 0,children:r})}if(t.data&&p){let n=c.resourceConfigurations[p],i=V.resolveRowSchema(n,t.data);if(i){let n=(0,$.jsx)(_G,{resourceType:p,schema:i,data:t.data,primaryLabel:r,contextResourceIdentifiers:te(e).identifiers});return j?le(e,n):n}}return le(e,(0,$.jsx)(D3,{label:r}))}return tt.LABEL,le(e,(0,$.jsx)(D3,{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!==tt.ID?(0,$.jsx)(`div`,{className:s,title:`Unknown resource type - showing IDs`,children:O.length===1?(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:O[0]}):(0,$.jsx)(`ul`,{className:`list-disc ps-4 space-y-item-xs`,children:O.map(e=>(0,$.jsx)(`li`,{className:`font-mono text-sm`,children:e},e))})}):O.length===1?(0,$.jsx)(`div`,{className:s,children:ue(O[0])}):(0,$.jsx)(`ul`,{className:U(`list-disc ps-4 space-y-item-xs`,s),children:O.map(e=>(0,$.jsx)(`li`,{children:ue(e)},e))})};function ETe(e,t){let n=C1(e),r={size:Ef.LG,closeOnEscape:!0,closeOnOutsideClick:t?.closeOnOutsideClick??!0,modal:t?.modal??!0,showBackdrop:t?.showBackdrop??!0};return n===Or.SHEET?{mode:n,side:Zs.END,...r}:{mode:n,...r}}var DTe=()=>{let{state:e}=Px(),{closeOverlay:t}=wS(),n=e.overlay,r=n.length>0?n[n.length-1]:void 0,i=n.length>0,{title:a,description:o}=Y$(r),s=(0,Q.useMemo)(()=>ETe(r?.appearance,r?.overlayBehavior),[r?.appearance,r?.overlayBehavior]),c=(0,Q.useCallback)(e=>{e||t()},[t]);return(0,$.jsx)(y1,{open:i,onOpenChange:c,title:a||void 0,description:o,config:s,children:r&&(0,$.jsx)(L0,{content:r.content,zone:rr.OVERLAY,initiator:r.initiator,entryId:r.id})})},O3=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(DTe,{});function OTe({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,`ResourceLayout_ContainerDialogs`)(e);return(0,$.jsx)(n,{...t})}var k3=({resourceContext:e,onFiltersChange:t})=>{let{registry:n}=lm(),{resourceType:r}=e,[i,a]=(0,Q.useState)({}),o=(0,Q.useMemo)(()=>n.resourceConfigurations[r],[n,r]),s=(0,Q.useMemo)(()=>HG.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)(tq,{resourceType:r,filterFields:s,currentFilters:i,onFiltersChange:c})};function kTe({preset:e=q.DEFAULT,...t}){let n=G(B.RESOURCES_LAYOUTS_FILTERS,`ResourceLayout_Filters`)(e);return(0,$.jsx)(n,{...t})}var ATe=e=>(0,$.jsx)(uX,{...e,defaultViewMode:gu.TABLE}),A3=e=>(0,$.jsx)(FY,{...e,showCharts:!1}),j3=(0,Q.memo)(({resourceContext:e,item:t,onNavigate:n,className:r})=>{let{resourceType:i}=e,{registry:a}=lm(),{t:o,formatDate:s,formatDateTime:c,isReady:l}=K({component:B.RESOURCES_LAYOUTS_READ_SUMMARY,resource:i}),u=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${B.RESOURCES_LAYOUTS_READ_SUMMARY}`],[i]),d=a.resourceConfigurations[i],f=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:i,registry:a,currentObject:t,t:o,formatDate:s,formatDateTime:c})||String(i),[t,i,a,o,s,c]),p=(0,Q.useMemo)(()=>V.resolveRowSchema(d,t),[d,t]),m=d?.frontendConfiguration?.layout?.summary;return l?(0,$.jsx)(nb,{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)(_G,{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)(_G,{resourceType:i,schema:p,data:t,contextResourceIdentifiers:e.contextResourceIdentifiers})]})})}):null});function jTe({preset:e,...t}){let n=t.resourceContext.operation.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey,r=e??n??ve.DEFAULT,i=G(B.RESOURCES_LAYOUTS_READ_SUMMARY,`ResourceLayout_ReadSummary`)(r);return(0,$.jsx)(i,{...t})}var MTe=({resourceContext:e,item:t,summaryFields:n,fieldLabelsMap:r,onItemClick:i,operationsSlot:a,isSelected:o,className:s})=>{let{resourceType:c}=e,{registry:l}=lm(),{t:u,formatDate:d,formatDateTime:f,tResourceFieldEnumValue:p}=K({resource:c}),{tComponent:m}=K({component:B.LOW_LEVEL_FORM_FIELD}),h=l.resourceConfigurations[c],g=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:c,registry:l,currentObject:t,t:u,formatDate:d,formatDateTime:f})||String(t[n[0]]??`${c}`),[t,c,l,n,u,d,f]),_=(0,Q.useMemo)(()=>{let e=V.resolveRowSchema(h,t);return e?hr.getObjectLikeFieldShape(e,{commonOnly:!1})??null:null},[h,t]),v=(0,Q.useCallback)(()=>{i?.(t)},[i,t]),y=(0,Q.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i?.(t))},[i,t]);return(0,$.jsxs)(`tr`,{"data-slot":`resource-list-item`,className:[`border-b border-border/50 motion-safe:transition-colors`,i?`cursor-pointer hover:bg-muted/50`:``,i?Mg(a_.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)(Pj,{noValueLabel:m(B.LOW_LEVEL_FORM_FIELD,`noValue`),typography:Ij(_?.[n]?me(_[n]):void 0)}):(0,$.jsx)(FG,{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})]})},NTe=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(zY,{resourceContext:e,navigationZone:t,navigationInitiator:n}),M3=({children:e=null})=>(0,$.jsx)(pX,{children:`PublicLayoutPreset_StaticContentContainer_Default`});function PTe({preset:e=q.DEFAULT,...t}){let n=G(B.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,`PublicLayout_StaticContentContainer`)(e);return(0,$.jsx)(n,{...t})}var FTe=Q.lazy(()=>l_(()=>import(`./ChartView-nQvehKAl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),ITe=Q.lazy(()=>l_(()=>import(`./ChartWidget-CZ5NXj5y.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,9,4,5,6,11,12])));function LTe(){No.register(B.HIGH_LEVEL_VIEWS_CHART_ECHARTS,q.DEFAULT,FTe,{isConfigurable:!1}),No.register(B.HIGH_LEVEL_VIEWS_CHART_WIDGET,q.DEFAULT,ITe,{isConfigurable:!1}),No.register(B.APP_LAYOUTS_ERROR_BOUNDARY,q.DEFAULT,By,{isConfigurable:!0}),No.register(B.APP_LAYOUTS_HOME,q.DEFAULT,XU,{isConfigurable:!0}),No.register(B.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,q.DEFAULT,Wy,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,q.DEFAULT,M3,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_USER_AUTH,q.DEFAULT,fZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,q.DEFAULT,hZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_USER_INVITATION,q.DEFAULT,SZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,q.DEFAULT,MZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_USER_REGISTER,q.DEFAULT,XZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_ONE_OFF_SESSION,q.DEFAULT,wZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,q.DEFAULT,kZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_AUTH_CALLBACK,q.DEFAULT,yX,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,q.DEFAULT,CX,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,q.DEFAULT,nZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,q.DEFAULT,sZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_MFA_CHALLENGE,q.DEFAULT,$X,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_OAUTH_CONSENT,q.DEFAULT,PZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,q.DEFAULT,VZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,q.DEFAULT,WZ,{isConfigurable:!0}),No.register(B.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK,q.DEFAULT,zZ,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_BREADCRUMB,q.DEFAULT,PB,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,q.DEFAULT,O3,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_CONTAINER_NESTED,q.DEFAULT,_Y,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_CREATE,q.DEFAULT,uG,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_ACTION,q.DEFAULT,QW,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_FILTERS,q.DEFAULT,k3,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_HEADER,q.DEFAULT,lV,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_LIST,Uu.DEFAULT,uX,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_LIST,Uu.TABLE,ATe,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_OPERATIONS_BULK,q.DEFAULT,FJ,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,q.DEFAULT,yY,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_RECORD_SHARING,q.DEFAULT,jY,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_DANGER_ZONE,q.DEFAULT,wY,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_PAGINATION,q.DEFAULT,rK,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_READ,xi.DEFAULT,FY,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_READ,xi.EXPANDABLE,A3,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_READ_SUMMARY,ve.DEFAULT,j3,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_READ_SUMMARY,ve.TABLE_ROW,MTe,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_SEARCH,Du.DEFAULT,zY,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_SEARCH,Du.TABLE,NTe,{isConfigurable:!0}),No.register(B.RESOURCES_LAYOUTS_UPDATE,q.DEFAULT,VY,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,q.DEFAULT,fL,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_BOOLEAN,q.DEFAULT,kI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_DATE,q.DEFAULT,nN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_DATETIME,q.DEFAULT,aN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_ENUM,q.DEFAULT,iI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_FILE,q.DEFAULT,UL,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_MONEY,q.DEFAULT,YI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_DURATION,q.DEFAULT,ZI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_PHONE,q.DEFAULT,iL,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_ADDRESS,q.DEFAULT,lL,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_NUMBER,q.DEFAULT,KI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,q.DEFAULT,hL,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_DATE,q.DEFAULT,pN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,q.DEFAULT,gN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,q.DEFAULT,_L,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,q.DEFAULT,uN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_RANGE_TIME,q.DEFAULT,yN,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_STRING,q.DEFAULT,WI,{isConfigurable:!0}),No.register(B.LOW_LEVEL_FORM_FIELD_TIME,q.DEFAULT,cN,{isConfigurable:!0}),No.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,T3,{isConfigurable:!0,category:Ii.EDIT}),No.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,vo.SEARCH,CTe,{isConfigurable:!0,category:Ii.EDIT}),No.register(B.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,TTe,{isConfigurable:!0,category:Ii.DISPLAY})}var RTe=rs.getLogger(),N3=new Set([B.LOW_LEVEL_CONTENT_SECTION_CONTAINER,B.LOW_LEVEL_OVERLAY_CONTAINER,B.LOW_LEVEL_AI_FLOW_NODE,B.LOW_LEVEL_AI_FLOW_EXECUTION,B.LOW_LEVEL_AI_SYSTEM_CATALOG,B.LOW_LEVEL_AI_ACTOR,B.LOW_LEVEL_AI_EXECUTION_PLAN,B.LOW_LEVEL_AI_TASK_DETAIL,B.LOW_LEVEL_AI_TASK_MEMORY,B.LOW_LEVEL_AI_EXECUTION_USAGE,B.LOW_LEVEL_AI_GRAPH_VIEWER,B.LOW_LEVEL_AI_APPROVAL,B.LOW_LEVEL_AI_DECISION,B.LOW_LEVEL_AI_EXECUTION_STREAM,B.LOW_LEVEL_AI_ARTIFACT_BROWSER,B.LOW_LEVEL_AI_AGENT_CONFIG,B.GUIDANCE_CHECKLIST,B.GUIDANCE_CHECKLIST_ITEM,B.GUIDANCE_TOUR,B.GUIDANCE_TOOLTIP,B.GUIDANCE_MODAL,B.GUIDANCE_BANNER,B.GUIDANCE_ANNOUNCEMENT,B.GUIDANCE_BADGE,B.GUIDANCE_CARD,B.GUIDANCE_SURVEY,B.GUIDANCE_ONBOARDING_VIEW,B.PROGRESSION_MILESTONE_TRACKER,B.PROGRESSION_ACHIEVEMENT_BADGE,B.LIFECYCLE_HOME_ACTIVATION_PROGRESS,B.LIFECYCLE_HOME_WELCOME_BACK,B.LIFECYCLE_HOME_DASHBOARD,B.HIGH_LEVEL_VIEWS_COMPOSITE,B.HIGH_LEVEL_VIEWS_CHART,B.HIGH_LEVEL_VIEWS_FULL_CUSTOM,B.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,B.HIGH_LEVEL_VIEWS_EXECUTION,B.HIGH_LEVEL_VIEWS_NOT_FOUND,B.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,B.APP_LAYOUTS_TEST_COMPONENT,B.APP_LAYOUTS_SECURITY_SETTINGS,B.APP_LAYOUTS_SETTINGS_HUB,B.APP_LAYOUTS_APPEARANCE_SETTINGS,B.APP_LAYOUTS_INVITATIONS_SETTINGS,B.APP_LAYOUTS_BILLING_SETTINGS,B.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,B.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,B.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,B.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,B.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,B.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,B.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,B.LOW_LEVEL_FORM_FIELD_FOREIGN_KEY,B.LOW_LEVEL_DISPLAY_FIELD_FOREIGN_KEY]);function P3(){let e=Object.values(B),t=[],n=0;for(let r of e)N3.has(r)||(No.hasComponentType(r)?n+=1:t.push(r));return{totalEnumValues:e.length,registeredCount:n,denyListedCount:N3.size,missing:t}}function zTe(e){let t=P3();if(t.missing.length===0)return t;let n=`[ComponentRegistry] Tier-1 completeness check failed: ${t.missing.length} FrontendComponentType value(s) have no registered preset.\n\nMissing entries:\n${t.missing.map(e=>` - ${e}`).join(`
43
- `)}\n\nFor each missing entry you must EITHER:\n (1) register a default preset in registerDefaultPresets() / registerFrameworkLayouts(); OR\n (2) add the enum value to KNOWN_NON_REGISTERED_COMPONENT_TYPES in assert-registry-completeness.frontend.helper.ts with a one-line justification (Tier-1 slots resolve through the registry; Tier-2, framework-internal and i18n-bundle-only slots are rendered directly and are the only ones that belong in that list).`,r=typeof process<`u`&&!1;if(e?.strict||r)throw Error(n);return RTe.warn(`component-registry.completeness-check.failed`,{message:n,missing:t.missing}),t}function BTe(e){return Wl(e)}var F3;(function(e){e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`})(F3||={});var VTe=/^#([0-9a-f]{6})$/i,HTe=/^#([0-9a-f]{3})$/i,UTe=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/i,WTe=/^hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*(?:,\s*[\d.]+\s*)?\)$/i;function I3(e,t,n){return Math.min(n,Math.max(t,e))}function L3(e){let t=e.trim();if(t.length===0)return null;let n=VTe.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=HTe.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=UTe.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=WTe.exec(t);if(a){let e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);return e>360||t>100||n>100?null:H3(e,t,n)}return null}function R3(e){let t=z3(e);return t===null?null:L3(t)}function z3(e){let t=e.trim();if(t.length===0)return null;let n=document.createElement(`span`);if(n.style.color=``,n.style.color=t,n.style.color===``)return null;let r=document.createElement(`span`);r.style.display=`none`,r.appendChild(n),document.body.appendChild(r);try{r.style.color=`rgb(1, 2, 3)`;let e=window.getComputedStyle(n).color;return r.style.color=`rgb(4, 5, 6)`,e===window.getComputedStyle(n).color&&e||null}finally{document.body.removeChild(r)}}function B3({r:e,g:t,b:n}){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=o-Math.min(r,i,a),c=0;return s!==0&&(c=o===r?((i-a)/s+(i<a?6:0))*60:o===i?((a-r)/s+2)*60:((r-i)/s+4)*60),{h:c,s:o===0?0:s/o*100,v:o*100}}function V3({h:e,s:t,v:n}){let r=(e%360+360)%360,i=I3(t,0,100)/100,a=I3(n,0,100)/100,o=a*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function H3(e,t,n){let r=(e%360+360)%360,i=I3(t,0,100)/100,a=I3(n,0,100)/100,o=(1-Math.abs(2*a-1))*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o/2,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function U3({r:e,g:t,b:n}){let r=e=>I3(Math.round(e),0,255).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function W3(e,t){if(t===F3.RGB)return`rgb(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)})`;if(t===F3.HSL){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a,s=(i+a)/2,c=0,l=0;return o!==0&&(l=s>.5?o/(2-i-a):o/(i+a),c=i===t?((n-r)/o+(n<r?6:0))*60:i===n?((r-t)/o+2)*60:((t-n)/o+4)*60),`hsl(${Math.round(c)}, ${Math.round(l*100)}%, ${Math.round(s*100)}%)`}return U3(e)}function GTe(e,t){return W3(V3(e),t)}function G3({r:e,g:t,b:n}){let r=e=>{let t=I3(e,0,255)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}var KTe=()=>{let e=(0,Q.useContext)(TH);if(!e)throw Error(`useStepUpAuth must be used within a StepUpAuthProvider`);return e},K3=class extends Error{code;httpStatus;constructor(e,t,n){super(t),this.name=`CrossFrontendHandoffClientError`,this.code=e,this.httpStatus=n}};async function q3(e,t){let n;try{n=await vc().crossFrontendHandoff(e,t)}catch(e){throw JTe(e)}if(!n||typeof n.handoffUrl!=`string`||typeof n.expiresAt!=`string`)throw new K3(`malformed_response`,`Cross-frontend handoff response missing required fields`,null);return{handoffUrl:n.handoffUrl,expiresAt:n.expiresAt}}var qTe=new Set(Object.values(Aae));function JTe(e){if(e instanceof K3)return e;let t=e,n=typeof t?.response?.status==`number`?t.response.status:typeof t?.httpStatus==`number`?t.httpStatus:null;if(n===null)return new K3(`network`,t?.message??`Cross-frontend handoff request failed (no response)`,null);if(n===401)return new K3(`unauthenticated`,`Cross-frontend handoff requires an authenticated session`,401);let r=t?.response?.data?.error?.details?.code??t?.context?.code;return typeof r==`string`&&qTe.has(r)?new K3(r,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n):new K3(`malformed_response`,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n)}function YTe(){let[e,t]=(0,Q.useState)(`idle`),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>(o.current=!1,()=>{o.current=!0}),[]),{status:e,data:n,error:i,requestHandoff:(0,Q.useCallback)(async(e,n)=>{let i=++s.current;t(`pending`),a(null);try{let a=await q3(e,n);return!o.current&&i===s.current&&(r(a),t(`success`)),a}catch(e){let n=e instanceof K3?e:new K3(`malformed_response`,e instanceof Error?e.message:`Cross-frontend handoff failed`,null);throw!o.current&&i===s.current&&(a(n),t(`error`)),n}},[]),reset:(0,Q.useCallback)(()=>{s.current++,t(`idle`),r(null),a(null)},[])}}function J3(e,t,n){if(e.visibleInModes&&e.visibleInModes.length>0&&(!t||!e.visibleInModes.includes(t)))return!1;if(e.scopeCondition)try{return e.scopeCondition(n)}catch{return!1}return!0}function Y3(e,t,n,r=!1){let i=e.filter(e=>J3(e,t,n));return r&&i.length===0&&e.length>0&&(e.some(e=>e.contentKind===ze.GUIDANCE_WIDGET&&(!e.visibleInModes||e.visibleInModes.length===0))||console.warn(`[AppMode] All sidebar sections are hidden and no unconditionally-visible GUIDANCE_WIDGET section covers the empty state. Consider adding a GUIDANCE_WIDGET section without visibleInModes restrictions and a scopeCondition that activates when other sections are hidden.`)),i}function X3(e,t,n){return{appScopeValues:e,activeMode:t,availableModes:n}}function Z3(e,t,n){let r=e.map(e=>{let r=!!(e.visibleInModes&&e.visibleInModes.length>0),i=`N/A`;r&&(i=!!t&&e.visibleInModes.includes(t));let a=!!e.scopeCondition,o=`N/A`;if(a)try{o=e.scopeCondition(n)}catch{o=!1}let s=J3(e,t,n);return{ref:e.ref,contentKind:e.contentKind,modeFilter:r?e.visibleInModes.join(`, `):`(all)`,modeMatch:i,hasScopeCondition:a,scopeMatch:o,visible:s}});console.group(`[SidebarVisibility] activeMode="${t??`none`}" | ${r.filter(e=>e.visible).length}/${r.length} sections visible`),console.table(r),console.log(`Scope params:`,n),console.groupEnd()}function XTe(e){return T0(e)}function ZTe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FEATURE_UNAVAILABLE_DIALOG,`FeatureUnavailableDialog`)(e);return(0,$.jsx)(n,{...t})}function QTe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FEATURE_LOCK_BADGE,`FeatureLockBadge`)(e);return(0,$.jsx)(n,{...t})}function Q3({featureId:e,showLabel:t=!0,size:n=`sm`,preset:r=q.DEFAULT}){let{getLimit:i,getCurrentUsage:a}=gh(),{t:o}=K(),s=i(e),c=a(e)??0;if(s===void 0||s===-1)return null;let l=Mc(yne.LIMIT,e),u=o(l),d=u===l?e:u,f=G(B.LOW_LEVEL_FEATURE_LIMIT_INDICATOR,`FeatureLimitIndicator`)(r);return(0,$.jsx)(f,{usage:c,limit:s,label:d,showLabel:t,size:n})}var $3=nc.BILLING,e6={kind:mu.SETTINGS_SECTION,sectionRef:$3,category:Fn.BILLING,searchKeywords:[`billing`,`subscription`,`plan`,`payment`,`invoice`,`upgrade`],runtimeAvailability:{requiredCapabilities:[`billingEnabled`]}};function t6(e){let t=gm(),n=cS(),r=(0,Q.useContext)(th)?.user?._id,i=e!==void 0&&e===r;return(0,Q.useMemo)(()=>t?lne(t.getAvailableResourceTypes().flatMap(e=>{let n=t.getResourceConfiguration(e);return n?[{resourceIdentifier:e,operations:n.operations??[]}]:[]}),i?{initiatorMayPerform:e=>Vm({resourceType:e.resourceIdentifier,roles:e.roles,operationIdentifier:e.operationIdentifier,resourceOperationLike:e.resourceOperationLike},n)}:{}):[],[t,n,i])}function n6(e){for(let t of e)for(let e of t)if(e.userNotifications?.some(e=>e.channel===cu.SMS))return!0;return!1}function r6(e){let t=gm(),n=(0,Q.useContext)(th)?.user?._id,r=e!==void 0&&e===n,i=(0,Q.useMemo)(()=>t?n6(t.getAvailableResourceTypes().map(e=>t.getResourceConfiguration(e)?.operations??[])):!1,[t]),[a,o]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!i||!r){o(!1);return}let e=!1;return vc().getMyMethods().then(t=>{e||o((t.methods??[]).some(e=>e.method===hs.SMS_OTP&&e.enrolled))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[i,r]),i&&r&&a}var $Te=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=sp(),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)([]),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(`useResourceRoom:${Math.random().toString(36).slice(2)}`),S=(0,Q.useRef)(async()=>void 0);b.current=p;let C=n?`${t}:${n}`:`${t}:${r}:${i}`,w=(0,Q.useCallback)(async()=>{if(p)return!0;let e=await f.claimResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a});return m(e.success),e.success&&e.editingUsers&&v(e.editingUsers),e.success},[f,t,n,r,i,a,p]),T=(0,Q.useCallback)(async()=>{p&&(await f.releaseResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a}),m(!1),v([]))},[f,t,n,r,i,a,p]);S.current=T;let E=(0,Q.useCallback)(async()=>{if(!n)return console.warn(`Cannot start editing without resourceId`),!1;let e=await f.startEditing({resourceType:t,resourceId:n,contextResourceIdentifiers:a});return e&&(g(!0),y.current=!0),e},[f,t,n,a]),D=(0,Q.useCallback)(()=>{n&&h&&(f.stopEditing({resourceType:t,resourceId:n}),g(!1),y.current=!1)},[f,t,n,h]),O=(0,Q.useCallback)((e,r,i)=>{n?f.sendCustomEvent({resourceType:t,resourceId:n,eventName:e,data:r,contextResourceIdentifiers:a,includeSelf:i}):console.warn(`Cannot send custom event without resourceId`)},[f,t,n,a]);return(0,Q.useEffect)(()=>{if(!f.isConnected||!p)return;let e=f.on(fa.RESOURCE_UPDATED,e=>{if(e.resourceType===t){if(n){if(e.resourceId!==n||e.deliveryTarget!==qa.RESOURCE_ROOM_SYNC&&e.deliveryTarget!==qa.RESOURCE_ROOM_NOTIFICATION)return}else if(e.deliveryTarget!==qa.SCOPE_ROOM_NOTIFICATION)return;s?.(e)}}),r=f.on(fa.RESOURCE_DELETED,e=>{e.resourceType===t&&n&&e.resourceId===n&&c?.(e)}),i=f.on(fa.RESOURCE_EDITING_START,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.includes(e.initiatorUserId)?t:[...t,e.initiatorUserId]),l?.(e))}),a=f.on(fa.RESOURCE_EDITING_END,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.filter(t=>t!==e.initiatorUserId)),u?.(e))}),o=f.on(fa.RESOURCE_CUSTOM,e=>{e.resourceType===t&&n&&e.resourceId===n&&d?.(e)});return()=>{e(),r(),i(),a(),o()}},[f,p,t,n,s,c,l,u,d]),(0,Q.useEffect)(()=>{o&&f.isConnected&&!p&&w()},[o,f.isConnected,p,w]),(0,Q.useEffect)(()=>()=>{y.current&&n&&f.stopEditing({resourceType:t,resourceId:n})},[f,t,n]),(0,Q.useEffect)(()=>()=>{b.current&&S.current()},[C]),{isSubscribed:p,isEditing:h,editingUsers:_,subscribe:w,unsubscribe:T,startEditing:E,stopEditing:D,sendCustomEvent:O}},i6=`this-session`;function a6(e,t){let{emit:n}=Ao(),{registry:r}=lm(),i=(0,Q.useRef)(!1),a=r.notificationBadgeDefinitions.find(t=>Ku(t)===e),o=a?.source.kind===Lie.FRONTEND_PRODUCED;(0,Q.useEffect)(()=>{if(!o){!i.current&&ya.isDevelopment()&&(i.current=!0,console.warn(a?`[usePublishNotificationBadgeCount] "${e}" is a ${a.source.kind} badge; its count is the backend's, so this page does not publish one.`:`[usePublishNotificationBadgeCount] "${e}" names no registered notification badge definition; nothing would draw it.`));return}if(t===null)return;let r=Ce(e);r&&n$(n,{badgeReference:Co(r.scope,i6,r.identifier),badgeCount:Math.max(0,Math.trunc(t))})},[e,t,o,a,n])}function eEe({milestoneRef:e,className:t}){let n=CU(),{tComponent:r,isReady:i}=K({component:B.PROGRESSION_ACHIEVEMENT_BADGE}),{renderIcon:a}=Of(),o=(0,Q.useMemo)(()=>(e,t)=>r(B.PROGRESSION_ACHIEVEMENT_BADGE,e,t),[r]),s=n.isMilestoneAchieved(e);if(!i)return null;let c=n.milestoneDefinitions.find(t=>t.identifier===e);if(!c)return null;let l=o(s?`achieved`:`locked`),u=s?a(H.CHECK,{size:ca.XS,className:`text-success`}):a(H.LOCK,{size:ca.XS});return(0,$.jsxs)(Mf,{variant:s?`default`:`outline`,className:U(`gap-1`,!s&&`opacity-60`,t),title:o(`description`),children:[u,(0,$.jsx)(`span`,{children:l}),s&&(c.points??0)>0&&(0,$.jsxs)(`span`,{className:`text-xs opacity-70`,children:[`+`,c.points]})]})}var o6=B.LOW_LEVEL_AI_ACTOR;function s6(e){return`role_${e}`}function c6(e){return`mode_${e}`}function l6(e){return`modeDesc_${e}`}var tEe={[Zi.COORDINATOR]:H.USERS,[Zi.TASK_PLANNER]:H.BOOK,[Zi.OPERATOR]:H.WRENCH,[Zi.ANALYZER]:H.SEARCH,[Zi.REVIEWER]:H.CHECK_CIRCLE,[Zi.HUMAN_IN_THE_LOOP]:H.LOCK,[Zi.FLOW_EXECUTION]:H.ARROW_RIGHT},nEe={[rn.AGENTIC]:H.BRAIN,[rn.FLOW_EXECUTION]:H.ARROW_RIGHT,[rn.HUMAN_INTERACTION]:H.USERS,[rn.PROGRAMMATIC]:H.SETTINGS},rEe={[Zi.COORDINATOR]:`default`,[Zi.TASK_PLANNER]:`default`,[Zi.OPERATOR]:`secondary`,[Zi.ANALYZER]:`secondary`,[Zi.REVIEWER]:`outline`,[Zi.HUMAN_IN_THE_LOOP]:`destructive`,[Zi.FLOW_EXECUTION]:`outline`},u6=e=>Object.values(Zi).includes(e),iEe=e=>Object.values(rn).includes(e),d6;(function(e){e.IDLE=`idle`,e.EXECUTING=`executing`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`})(d6||={});var aEe={[d6.IDLE]:bl.NEUTRAL,[d6.EXECUTING]:bl.INFO,[d6.AWAITING_APPROVAL]:bl.WARNING,[d6.COMPLETED]:bl.SUCCESS};function oEe(e){return U(Uf[aEe[e]],e===d6.EXECUTING&&`motion-safe:animate-pulse`)}function f6(e){return`status_${e}`}var sEe=({systemName:e,actors:t,systemRef:n,executions:r,className:i,children:a,...o})=>{let{tComponent:s,isReady:c}=K({component:o6}),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:U(`flex flex-col gap-card`,i),"aria-label":s(o6,`loading`),...o,children:[(0,$.jsx)(um,{className:`h-6 w-48`}),(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:[(0,$.jsx)(um,{className:`h-40`}),(0,$.jsx)(um,{className:`h-40`}),(0,$.jsx)(um,{className:`h-40`})]})]}):u&&u.length===0?(0,$.jsx)(`div`,{className:U(`flex flex-col items-center gap-element py-section text-center text-muted-foreground`,i),...o,children:(0,$.jsx)(`p`,{className:`text-sm`,children:s(o6,`noActors`)})}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,i),...o,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-element`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[e&&(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:s(o6,`teamTitle`,{name:e})}),u&&(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,children:s(o6,`teamSummary`,{count:String(u.length)})})]})}),u&&u.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Array.from(p.entries()).map(([e,t])=>(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:s(o6,`roleCount`,{role:u6(e)?s(o6,s6(e)):e,count:String(t)})},e))}),(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:u?u.map(e=>(0,$.jsx)(p6,{actor:e,status:cEe(e,Mte(u)?.ref,n,d)},e.ref)):a})]}):null};function cEe(e,t,n,r){if(!r||!n||e.ref!==t)return d6.IDLE;let i=!1;for(let e of r.values())if(e.systemRef===n){if(e.status===yW.RUNNING||e.status===yW.STARTING)return d6.EXECUTING;if(e.status===yW.AWAITING_APPROVAL)return d6.AWAITING_APPROVAL;e.status===yW.COMPLETED&&(i=!0)}return i?d6.COMPLETED:d6.IDLE}var p6=({actor:e,actorRef:t,displayName:n,roleCategory:r,executionMode:i,description:a,agentRef:o,flowRef:s,status:c=d6.IDLE,currentTask:l,onAgentClick:u,onFlowClick:d,className:f,...p})=>{let{tComponent:m,isReady:h}=K({component:o6}),{renderIcon:g}=Of();if(!h)return null;let _=e?.ref??t??``,v=e?.displayName??n??_,y=e?.roleCategory??r??``,b=e?.executionMode??i??``,x=a,S=e?.agentRef??o,C=e?.flowRef??s,w=m(o6,f6(c));return(0,$.jsxs)(OF,{className:U(`flex flex-col`,f),...p,children:[(0,$.jsxs)(AF,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(m6,{role:y}),(0,$.jsx)(h6,{mode:b})]}),(0,$.jsxs)(ej,{children:[(0,$.jsx)(tj,{asChild:!0,children:(0,$.jsx)(`span`,{role:`img`,"aria-label":w,className:U(`inline-block size-2.5 shrink-0 rounded-full`,oEe(c))})}),(0,$.jsx)(nj,{side:Zs.TOP,className:`text-xs`,children:w})]})]}),(0,$.jsx)(MF,{className:`text-sm`,children:v}),(0,$.jsx)(PF,{className:`text-xs`,children:_})]}),(0,$.jsxs)(FF,{className:`flex flex-col gap-element`,children:[x&&(0,$.jsx)(Z,{size:Le.XS,variant:zr.MUTED,"aria-label":m(o6,`description`),children:x}),l&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 rounded-sm bg-primary/10 px-2 py-1`,"aria-label":m(o6,`currentTask`),children:[g(H.LOADER_2,{size:ca.SM,className:`animate-spin text-primary`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-medium text-primary`,children:l})]}),(S||C)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[S&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>u?.(S),"aria-label":`${m(o6,`linkedAgent`)}: ${S}`,children:[g(H.BRAIN,{size:ca.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(o6,`linkedAgent`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:S})]}),C&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d?.(C),"aria-label":`${m(o6,`linkedFlow`)}: ${C}`,children:[g(H.ARROW_RIGHT,{size:ca.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(o6,`linkedFlow`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:C})]})]})]})]})},m6=({role:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:o6}),{renderIcon:i}=Of();if(!r)return null;let a=u6(e),o=a?tEe[e]:void 0,s=a?n(o6,s6(e)):e;return(0,$.jsxs)(Mf,{variant:a?rEe[e]:`secondary`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:ca.XS}),s]})},h6=({mode:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:o6}),{renderIcon:i}=Of();if(!r)return null;let a=iEe(e),o=a?nEe[e]:void 0,s=a?n(o6,c6(e)):e,c=a?n(o6,l6(e)):void 0,l=(0,$.jsxs)(Mf,{variant:`outline`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:ca.XS}),s]});return c?(0,$.jsxs)(ej,{children:[(0,$.jsx)(tj,{asChild:!0,children:l}),(0,$.jsx)(nj,{side:Zs.TOP,className:`text-xs`,children:c})]}):l},lEe=Q.lazy(()=>l_(()=>import(`./flows-actors-graph-runtime-DeTt1QCB.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]))),uEe=Q.lazy(()=>l_(()=>import(`./flows-actors-graph-runtime-DeTt1QCB.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]))),dEe=Q.lazy(()=>l_(()=>import(`./flows-actors-graph-runtime-DeTt1QCB.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]))),fEe=Q.lazy(()=>l_(()=>import(`./flows-actors-graph-runtime-DeTt1QCB.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]))),pEe=Q.lazy(()=>l_(()=>import(`./flows-actors-graph-runtime-DeTt1QCB.js`).then(e=>({default:e.AI_GraphViewer})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),g6=e=>(0,$.jsx)(RJ,{doorName:`AI_GraphViewer`,fallback:(0,$.jsx)(zJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(um,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(pEe,{...e})})}),mEe=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)(um,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(lEe,{...e})})}),hEe=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)(um,{"aria-hidden":`true`,className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(uEe,{...e})})}),_6=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)(um,{"aria-hidden":`true`,className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(dEe,{...e})})}),gEe=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)(um,{className:`h-8 w-full`})}),children:(0,$.jsx)(fEe,{...e})})}),v6=B.LOW_LEVEL_AI_SYSTEM_CATALOG,_Ee=[`all`,`draft`,`active`,`inactive`,`deprecated`,`archived`];function vEe(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 yEe=({className:e,defaultKindFilter:t=`all`,defaultStatusFilter:n=`all`,defaultViewMode:r=`grid`,onSelectSystem:i,onLaunch:a,...o})=>{let{tComponent:s,isReady:c}=K({component:v6}),{systems:l,isLoading:u,error:d,refreshSystems:f}=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&&!vEe(e,p))),[l,h,_,p]),w=Q.useMemo(()=>x?l.find(e=>e.ref===x):void 0,[l,x]),T=Q.useCallback(e=>{S(e),i?.(e)},[i]),E=Q.useCallback(()=>{S(null)},[]);return w?(0,$.jsx)(x6,{system:w,onBack:E,onLaunch:a,className:e,...o}):c?d?(0,$.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center gap-card rounded-lg border bg-card p-section text-center`,e),...o,children:[(0,$.jsx)(Z,{variant:zr.DESTRUCTIVE,children:s(v6,`errorState`)}),(0,$.jsx)(X,{type:`button`,variant:J.SECONDARY,size:Y.SM,onClick:()=>void f(),children:s(v6,`retry`)})]}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,e),...o,children:[(0,$.jsx)(bEe,{searchQuery:p,onSearchChange:m,kindFilter:h,onKindFilterChange:g,statusFilter:_,onStatusFilterChange:v,viewMode:y,onViewModeChange:b,systemCount:C.length,totalCount:l.length}),u?(0,$.jsx)(xEe,{viewMode:y}):C.length===0?(0,$.jsx)(`div`,{className:`flex flex-col items-center justify-center gap-element rounded-lg border bg-card p-section text-center`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:l.length===0?s(v6,`emptyState`):s(v6,`emptyFilteredState`)})}):y===`grid`?(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,$.jsx)(y6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))}):(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:C.map(e=>(0,$.jsx)(b6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))})]}):null},bEe=({searchQuery:e,onSearchChange:t,kindFilter:n,onKindFilterChange:r,statusFilter:i,onStatusFilterChange:a,viewMode:o,onViewModeChange:s,systemCount:c,totalCount:l})=>{let{tComponent:u,isReady:d}=K({component:v6});return d?(0,$.jsxs)(`div`,{className:`flex flex-col gap-element sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-element`,children:[(0,$.jsx)(eN,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:u(v6,`searchPlaceholder`),className:`min-w-[180px] max-w-xs flex-1`}),(0,$.jsx)(sO,{value:n,onValueChange:e=>r(e),children:(0,$.jsxs)(cO,{children:[(0,$.jsx)(lO,{value:`all`,children:u(v6,`allKinds`)}),(0,$.jsx)(lO,{value:`flow`,children:u(v6,`kindFlow`)}),(0,$.jsx)(lO,{value:`actor`,children:u(v6,`kindActor`)})]})}),(0,$.jsx)(gF,{name:`statusFilter`,schema:yd(),options:_Ee.map(e=>({value:e,label:u(v6,`status_${e}`)})),value:i,onChange:e=>a(e),placeholder:u(v6,`filterByStatus`),size:qd.SM})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,children:u(v6,`systemCount`,{count:c,total:l})}),(0,$.jsx)(sO,{value:o,onValueChange:e=>s(e),children:(0,$.jsxs)(cO,{children:[(0,$.jsx)(lO,{value:`grid`,children:u(v6,`gridView`)}),(0,$.jsx)(lO,{value:`list`,children:u(v6,`listView`)})]})})]})]}):null},xEe=({viewMode:e})=>e===`list`?(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:Array.from({length:4},(e,t)=>(0,$.jsx)(um,{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)(um,{className:`h-52 w-full rounded-lg`},t))}),y6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:v6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(OF,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer flex-col transition-shadow hover:shadow-[var(--shadow-md)]`,Mg(a_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(AF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status}),s.riskLevel!==`low`&&(0,$.jsx)(T6,{level:s.riskLevel})]}),(0,$.jsx)(MF,{className:`text-sm`,children:e.displayName}),(0,$.jsx)(PF,{className:`line-clamp-2 text-xs`,children:e.description})]}),(0,$.jsxs)(FF,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-element`,children:(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:i(v6,`scope_${s.primaryScope}`)})}),(e.category||e.tags&&e.tags.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-element`,children:[e.category&&(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:e.category}),e.tags?.map(e=>(0,$.jsx)(Mf,{variant:`secondary`,className:`text-2xs`,children:e},e))]})]}),t&&(0,$.jsx)(jF,{className:`mt-auto`,children:(0,$.jsx)(X,{type:`button`,variant:o?J.DEFAULT:J.SECONDARY,disabled:!o,onClick:n=>{n.stopPropagation(),t(e.ref)},className:`w-full`,children:i(v6,`launch`)})})]}):null},b6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:v6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer items-center gap-card rounded-lg border bg-card p-card-sm transition-shadow hover:shadow-[var(--shadow-md)]`,Mg(a_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-card overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status})]}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.displayName}),(0,$.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]}),(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-element md:flex`,children:s.riskLevel!==`low`&&(0,$.jsx)(T6,{level:s.riskLevel})})]}),t&&(0,$.jsx)(X,{type:`button`,variant:o?J.DEFAULT:J.SECONDARY,disabled:!o,size:Y.SM,onClick:n=>{n.stopPropagation(),t(e.ref)},children:i(v6,`launch`)})]}):null},x6=({system:e,onBack:t,onLaunch:n,className:r,...i})=>{let{tComponent:a,isReady:o}=K({component:v6}),s=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:U(`flex flex-col gap-card`,r),...i,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[t&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:t,className:`self-start`,children:a(v6,`backToCatalog`)}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.displayName}),(0,$.jsx)(Z,{variant:zr.MUTED,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(C6,{kind:e.kind}),(0,$.jsx)(w6,{status:e.status}),c.riskLevel!==`low`&&(0,$.jsx)(T6,{level:c.riskLevel})]})]}),n&&(0,$.jsx)(X,{type:`button`,variant:l?J.DEFAULT:J.SECONDARY,disabled:!l,onClick:()=>n(e.ref),children:a(v6,`launch`)})]}),(0,$.jsxs)(sO,{defaultValue:`config`,children:[(0,$.jsxs)(cO,{children:[(0,$.jsx)(lO,{value:`config`,children:a(v6,`detailConfig`)}),e.kind===`flow`&&(0,$.jsx)(lO,{value:`preview`,children:a(v6,`flowPreview`)}),e.kind===`actor`&&(0,$.jsx)(lO,{value:`preview`,children:a(v6,`actorTeamPreview`)}),(0,$.jsx)(lO,{value:`executions`,children:a(v6,`executionHistory`)})]}),(0,$.jsx)(uO,{value:`config`,children:(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2`,children:[(0,$.jsxs)(OF,{children:[(0,$.jsx)(AF,{children:(0,$.jsx)(MF,{className:`text-sm`,children:a(v6,`detailConfig`)})}),(0,$.jsxs)(FF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(S6,{label:a(v6,`scope`),value:a(v6,`scope_${c.primaryScope}`)}),(0,$.jsx)(S6,{label:a(v6,`riskLevel`),value:(0,$.jsx)(T6,{level:c.riskLevel})})]})]}),(0,$.jsxs)(OF,{children:[(0,$.jsx)(AF,{children:(0,$.jsx)(MF,{className:`text-sm`,children:a(v6,`detailMetadata`)})}),(0,$.jsxs)(FF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(S6,{label:a(v6,`detailRef`),value:e.ref}),(0,$.jsx)(S6,{label:a(v6,`detailKind`),value:e.kind}),(0,$.jsx)(S6,{label:a(v6,`detailStatus`),value:e.status}),e.category&&(0,$.jsx)(S6,{label:a(v6,`detailCategory`),value:e.category}),e.tags&&e.tags.length>0&&(0,$.jsx)(S6,{label:a(v6,`detailTags`),value:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-element`,children:e.tags.map(e=>(0,$.jsx)(Mf,{variant:`secondary`,className:`text-2xs`,children:e},e))})}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsx)($.Fragment,{children:Object.entries(e.metadata).map(([e,t])=>(0,$.jsx)(S6,{label:e,value:t},e))})]})]})]})}),(0,$.jsx)(uO,{value:`preview`,children:(0,$.jsx)(OF,{children:(0,$.jsx)(FF,{className:`p-card`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:e.kind===`flow`?a(v6,`flowPreviewPlaceholder`):a(v6,`actorTeamPreviewPlaceholder`)})})})}),(0,$.jsx)(uO,{value:`executions`,children:u.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border bg-card p-section`,children:(0,$.jsx)(Z,{variant:zr.MUTED,children:a(v6,`noExecutions`)})}):(0,$.jsx)(af,{className:`max-h-96`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:u.map(e=>(0,$.jsx)(CEe,{execution:e},e.executionId))})})})]})]}):null},S6=({label:e,value:t})=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,className:`font-medium`,children:e}),(0,$.jsx)(Z,{as:`span`,size:Le.XS,className:`text-end`,children:t})]}),SEe={[yW.IDLE]:`outline`,[yW.STARTING]:`secondary`,[yW.RUNNING]:`default`,[yW.AWAITING_APPROVAL]:`secondary`,[yW.COMPLETED]:`default`,[yW.CANCELLED]:`outline`,[yW.ERROR]:`destructive`},CEe=({execution:e})=>{let{tComponent:t,isReady:n}=K({component:v6});return n?(0,$.jsxs)(`div`,{className:`flex items-center gap-card rounded-lg border bg-card p-card-sm`,children:[(0,$.jsx)(Mf,{variant:SEe[e.status]??`secondary`,className:`text-2xs`,children:t(v6,`execStatus_${e.status}`)}),(0,$.jsx)(Z,{as:`span`,size:Le.XS,variant:zr.MUTED,className:`flex-1 truncate`,children:e.executionId})]}):null},C6=({kind:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6});return r?(0,$.jsx)(Mf,{variant:e===`flow`?`default`:`secondary`,className:U(`text-2xs`,t),children:e===`flow`?n(v6,`kindFlow`):n(v6,`kindActor`)}):null},wEe={draft:{variant:`outline`,extraClass:`text-muted-foreground`},active:{variant:`default`},inactive:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},deprecated:{variant:`destructive`,extraClass:`opacity-[0.75]`},archived:{variant:`outline`,extraClass:`text-muted-foreground opacity-[var(--opacity-muted)]`}},w6=({status:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6}),i=wEe[e]??{variant:`secondary`};return r?(0,$.jsx)(Mf,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(v6,`status_${e}`)}):null},TEe={low:{variant:`outline`},medium:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},high:{variant:`destructive`},critical:{variant:`destructive`,extraClass:`animate-pulse`}},T6=({level:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:v6}),i=TEe[e]??{variant:`outline`};return r?(0,$.jsx)(Mf,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(v6,`riskLevel_${e}`)}):null},E6=B.LOW_LEVEL_AI_EXECUTION_PLAN,EEe=[Yt.COMPLETED,Yt.PROCESSING,Yt.AWAITING_APPROVAL,Yt.FAILED],D6=({plan:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:E6}),a=Q.useMemo(()=>new Map(e.stepStates.map(e=>[e.planStepId,e])),[e.stepStates]),o=Q.useMemo(()=>{let t={};for(let n of e.planSteps){let e=a.get(n._id)?.status??n.status;t[e]=(t[e]??0)+1}return t},[e.planSteps,a]),s=Q.useCallback(t=>e.planSteps.find(e=>e._id===t)?.name??t,[e.planSteps]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card rounded-lg border bg-card p-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(E6,`title`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.goalDescription})]}),(0,$.jsx)(hf,{status:e.status})]}),(0,$.jsx)(k6,{total:e.planSteps.length,statusCounts:o}),(0,$.jsx)(af,{className:`max-h-80`,children:(0,$.jsx)(`ol`,{className:`flex flex-col gap-2`,children:e.planSteps.map((e,t)=>{let n=a.get(e._id);return(0,$.jsx)(O6,{step:e,index:t,resolvedStatus:n?.status??e.status,statusChanges:n?.statusChanges,nameOfStep:s},e._id)})})})]}):null},O6=({step:e,index:t,resolvedStatus:n,statusChanges:r,nameOfStep:i,className:a,...o})=>{let{tComponent:s,isReady:c,formatTime:l,formatList:u}=K({component:E6}),{statusWord:d,isReady:f}=Zf(),{word:p,isReady:m}=df(Wf),{renderIcon:h}=Of(),g=Q.useMemo(()=>xn(e),[e]),[_,v]=Q.useState(!1),y=g.length>0||r&&r.length>0;return!c||!f||!m?null:(0,$.jsxs)(`li`,{className:U(`flex items-start gap-element`,a),...o,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-mono text-muted-foreground`,children:t+1}),(0,$.jsx)(`div`,{className:U(`size-2.5 shrink-0 rounded-full`,sf(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)(Mf,{variant:`outline`,className:`text-2xs`,children:p(e.topic)}),(0,$.jsx)(hf,{status:n})]}),e.description&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),y&&(0,$.jsxs)(SO,{open:_,onOpenChange:v,children:[(0,$.jsx)(CO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.LINK,size:Y.SM,className:`h-auto p-0 text-2xs`,children:[h(_?H.CHEVRON_DOWN:H.CHEVRON_RIGHT,{size:ca.XS}),s(E6,`stepDetails`)]})}),(0,$.jsxs)(wO,{className:`mt-1 flex flex-col gap-1`,children:[g.length>0&&(0,$.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:s(E6,`stepWaitsOn`,{steps:u(g.map(e=>i?.(e)??e))})}),r&&r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:r.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(`div`,{className:U(`size-1.5 rounded-full`,sf(e.status))}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:d(e.status)}),(0,$.jsx)(`time`,{className:`text-muted-foreground`,dateTime:e.timestamp,children:Bd.formatTimestamp(e.timestamp,l)})]},`${e.status}-${e.timestamp}-${t}`))}),(0,$.jsx)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:(0,$.jsx)(`span`,{children:s(E6,`stepCreatedAt`,{time:Bd.formatTimestamp(e.createdAt,l)})})})]})]})]})]})},k6=({total:e,statusCounts:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:E6}),{statusWord:o,isReady:s}=Zf(),c=t[Yt.COMPLETED]??0,l=e>0?Math.round(c/e*100):0,u=EEe.flatMap(n=>{let r=t[n]??0;return r>0&&e>0?[{status:n,width:r/e*100}]:[]}),d=Object.values(Yt).flatMap(e=>{let n=t[e]??0;return e!==Yt.COMPLETED&&n>0?[{status:e,count:n}]:[]});return!a||!s?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:i(E6,`progress`,{completed:c,total:e})}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[l,`%`]})]}),(0,$.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded-full bg-secondary`,children:u.map(({status:e,width:t})=>(0,$.jsx)(`div`,{"data-plan-progress-segment":e,className:U(`h-full motion-safe:transition-all`,sf(e)),style:{width:`${t}%`}},e))}),d.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-card text-2xs text-muted-foreground`,children:d.map(({status:e,count:t})=>(0,$.jsxs)(`span`,{"data-plan-progress-legend":e,className:`flex items-center gap-0.5`,children:[(0,$.jsx)(`span`,{className:U(`inline-block size-1.5 rounded-full`,sf(e))}),i(E6,`progressLegendEntry`,{status:o(e),count:t})]},e))})]})},A6=B.LOW_LEVEL_AI_TASK_DETAIL;function j6(e){switch(e.kind){case aa.TASK:return e.taskId;case aa.PLAN_STEP:return e.planStepId;case aa.PLAN:return e.planId;case aa.ACTOR:return e.actorId;case aa.ACTOR_SYSTEM:return e.actorSystemId;case aa.FLOW:return e.flowId;case aa.FLOW_STEP:return e.stepId}}var M6=({task:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a,formatDateTime:o}=K({component:A6}),{word:s,isReady:c}=df(Wf),{word:l,isReady:u}=df(Ff),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)(OF,{statusEdge:Sf(e.status),className:U(`flex flex-col`,n),...r,children:[(0,$.jsxs)(AF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:s(e.topic)}),(0,$.jsx)(hf,{status:e.status}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:i(A6,`actor`)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.actors.actorRef})]})]}),(0,$.jsx)(MF,{className:`text-sm`,children:e.title}),(0,$.jsx)(PF,{className:`text-xs`,children:e.description})]}),(0,$.jsxs)(FF,{className:`flex flex-col gap-card-sm`,children:[e.input!==void 0&&(0,$.jsx)(N6,{label:i(A6,`input`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.input==`string`?e.input:JSON.stringify(e.input,null,2)})}),e.output!==void 0&&(0,$.jsx)(N6,{label:i(A6,`output`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.output==`string`?e.output:JSON.stringify(e.output,null,2)})}),(0,$.jsx)(N6,{label:i(A6,`context`),children:d?(0,$.jsx)(`pre`,{className:`max-h-24 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:JSON.stringify(e.context,null,2)}):(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:i(A6,`contextEmpty`)})}),f&&(0,$.jsx)(N6,{label:i(A6,`relationships`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.relationships.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,"data-task-relationship":e.relation,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:l(e.relation)}),(0,$.jsx)(`span`,{className:`text-muted-foreground truncate`,children:t?.(e)??j6(e)})]},n))})}),p&&(0,$.jsx)(N6,{label:i(A6,`artifacts`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.artifacts.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:e.type}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.name})]},t))})}),e.actorStates.length>0&&(0,$.jsx)(F6,{events:e.actorStates.flatMap(e=>e.statusChanges.map(t=>({status:t.status,timestamp:t.timestamp,actorRef:e.actorRef})))}),(e.startedAt||e.completedAt)&&(0,$.jsxs)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:[e.startedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(A6,`started`)}),(0,$.jsx)(`span`,{children:Bd.formatTimestamp(e.startedAt,o)})]}),e.completedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(A6,`completed`)}),(0,$.jsx)(`span`,{children:Bd.formatTimestamp(e.completedAt,o)})]}),e.startedAt&&(0,$.jsx)(`span`,{className:`font-mono`,children:Bd.formatDuration(e.startedAt,e.completedAt)})]})]})]})};function N6({label:e,children:t,defaultOpen:n=!1}){return(0,$.jsxs)(SO,{defaultOpen:n,children:[(0,$.jsx)(CO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,className:`h-auto justify-start p-0 text-xs font-medium`,children:e})}),(0,$.jsx)(wO,{className:`mt-1`,children:t})]})}var P6=({tasks:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:A6}),{statusWord:o,isReady:s}=Zf(),{word:c,isReady:l}=df(Wf),[u,d]=Q.useState(null),[f,p]=Q.useState(null),[m,h]=Q.useState(`createdAt`),g=Q.useMemo(()=>[...new Set(e.map(e=>e.status))],[e]),_=Q.useMemo(()=>[...new Set(e.map(e=>e.topic))],[e]),v=Q.useMemo(()=>{let t=e;return u&&(t=t.filter(e=>e.status===u)),f&&(t=t.filter(e=>e.topic===f)),[...t].sort((e,t)=>m===`createdAt`?new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime():e.status.localeCompare(t.status))},[e,u,f,m]);return!a||!s||!l?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`filterByStatus`)}),(0,$.jsx)(X,{type:`button`,variant:u===null?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>d(null),children:i(A6,`filterAll`)}),g.map(e=>(0,$.jsx)(X,{type:`button`,variant:u===e?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>d(e===u?null:e),children:o(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`filterByTopic`)}),(0,$.jsx)(X,{type:`button`,variant:f===null?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>p(null),children:i(A6,`filterAll`)}),_.map(e=>(0,$.jsx)(X,{type:`button`,variant:f===e?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>p(e===f?null:e),children:c(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(A6,`sortBy`)}),(0,$.jsx)(X,{type:`button`,variant:m===`createdAt`?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>h(`createdAt`),children:i(A6,`sortDate`)}),(0,$.jsx)(X,{type:`button`,variant:m===`status`?J.SECONDARY:J.GHOST,size:Y.SM,className:`h-6 text-2xs`,onClick:()=>h(`status`),children:i(A6,`sortStatus`)})]})]}),(0,$.jsx)(af,{className:`max-h-[32rem]`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-card`,children:[v.length===0&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:i(A6,`noTasks`)}),v.map(e=>(0,$.jsx)(M6,{task:e,...t?{nameOf:t}:{}},e._id))]})})]})},F6=({events:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatTime:a}=K({component:A6}),o=Q.useMemo(()=>[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[e]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,t),...n,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:r(A6,`timeline`)}),(0,$.jsx)(af,{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?Bd.formatDuration(o[t-1].timestamp,e.timestamp):void 0;return(0,$.jsxs)(`li`,{className:`ms-4`,children:[(0,$.jsx)(`div`,{className:U(`absolute -start-1.5 mt-1.5 size-3 rounded-full`,sf(e.status))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(hf,{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:Bd.formatTimestamp(e.timestamp,a)})]},`${e.status}-${e.timestamp}-${t}`)})})})]}):null},I6=B.LOW_LEVEL_AI_TASK_MEMORY,DEe={short_term:`⚡`,long_term:`📦`,working:`🔧`},OEe=({memory:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:I6}),a=e.shortTerm.entries.length+e.longTerm.entries.length+e.working.entries.length;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:r(I6,`title`)}),(0,$.jsx)(Mf,{variant:`secondary`,className:`text-2xs`,children:a})]}),(0,$.jsx)(L6,{scope:`short_term`,label:r(I6,`shortTerm`),store:e.shortTerm,defaultOpen:!0}),(0,$.jsx)(L6,{scope:`long_term`,label:r(I6,`longTerm`),store:e.longTerm}),(0,$.jsx)(L6,{scope:`working`,label:r(I6,`working`),store:e.working})]}):null},L6=({scope:e,label:t,store:n,defaultOpen:r=!1,className:i,...a})=>{let{tComponent:o,isReady:s}=K({component:I6}),c=DEe[e]??`📋`;return s?(0,$.jsxs)(SO,{defaultOpen:r,className:U(`rounded-md border`,i),...a,children:[(0,$.jsx)(CO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:J.GHOST,className:`w-full justify-between p-card-sm`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-element text-xs font-medium`,children:[(0,$.jsx)(`span`,{children:c}),t,n.maxSize!=null&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`(`,n.entries.length,`/`,n.maxSize,`)`]})]}),(0,$.jsx)(Mf,{variant:`secondary`,className:`text-2xs`,children:n.entries.length})]})}),(0,$.jsx)(wO,{children:(0,$.jsx)(af,{className:`max-h-48`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 p-card-sm pt-0`,children:[n.entries.map(e=>(0,$.jsx)(R6,{entry:e},e.key)),n.entries.length===0&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:o(I6,`scopeEmpty`)})]})})})]}):null},R6=({entry:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatDateTime:a}=K({component:I6}),o=e.expiresAt?new Date(e.expiresAt).getTime()<Date.now():!1;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-0.5 rounded-sm bg-muted p-1.5`,o&&`opacity-[var(--opacity-muted)]`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-medium`,children:e.key}),(0,$.jsx)(Mf,{variant:`outline`,className:`text-2xs`,children:e.type}),o&&(0,$.jsx)(Mf,{variant:`destructive`,className:`text-2xs`,children:r(I6,`expired`)}),e.expiresAt&&!o&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(I6,`expires`),`: `,(0,$.jsx)(`time`,{dateTime:e.expiresAt,children:Bd.formatTimestamp(e.expiresAt,a)})]})]}),(0,$.jsx)(`pre`,{className:`max-h-16 overflow-auto text-2xs text-muted-foreground`,children:typeof e.value==`string`?e.value:JSON.stringify(e.value,null,2)}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap gap-1`,children:[(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(I6,`metadata`),`:`]}),Object.entries(e.metadata).map(([e,t])=>(0,$.jsxs)(Mf,{variant:`outline`,className:`text-2xs`,children:[e,`: `,String(t)]},e))]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground/60`,dateTime:e.timestamp,children:Bd.formatTimestamp(e.timestamp,a)})]}):null},z6=new WeakMap;function kEe(e){let{doOperation:t,operationPathKey:n,contextualParameters:r,executionId:i}=e,a=z6.get(t);a||(a=new Map,z6.set(t,a));let o=JSON.stringify([n,Object.entries(r).sort(([e],[t])=>e.localeCompare(t))]),s=a.get(o);if(!s){s={operationPathKey:n,contextualParameters:r,waiters:new Map},a.set(o,s);let e=a,i=s;setTimeout(()=>{e.delete(o),AEe(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 AEe(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 jEe=Object.freeze({});function B6(e,t){return V.buildConfigurationError(ql.CONFIGURATION,{message:e,component:`useEmbeddedResourceContext`,...t})}function V6(e){return typeof e.operationIdentifier==`string`}function MEe(e,t,n,r,i){let a=(e?.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation)),o=a.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0),s=a.length===1?a[0]:n.variantType===void 0&&n.variantKey===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&o.length===1?o[0]:void 0;if(!s)throw B6(a.length===0?`Composite resource runtime cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Composite resource runtime found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:a.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))});let c=e?Am({operation:s,resourceType:t,resourceConfig:e}):!1;if(e&&c&&s.isBulkOperation!==!0&&!Gh({resourceConfig:e,operation:s,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw B6(`Composite resource runtime resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return s}function H6(e){return e.hostResourceType!==void 0&&e.target.resourceType===e.hostResourceType&&!e.target.resourceId&&!go(e.operation)&&On.selfReferenceForeignKeysOf(e.hostResourceType,e.registry).length>0}function U6(){let e=BU(),{registry:t}=lm(),n=e?.hostResourceType,r=e?.contextResourceIdentifiers??jEe,i=(0,Q.useMemo)(()=>{if(!n)return;let e=t.resourceConfigurations[n];if(!e)throw B6(`Composite resource runtime cannot resolve host resource "${n}" from the registry.`,{hostResourceType:n});return e},[n,t.resourceConfigurations]),a=(0,Q.useMemo)(()=>n?On.buildParentResourcesRequirements(n,r,t):[],[r,n,t]),o=(0,Q.useMemo)(()=>{if(i)return lh({resourceConfig:i,operations:i.operations??[],coreOperation:W.READ,registry:t,hasResourceId:n?On.getResourceId(r[n]).length>0:!1,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)})??i.operations?.[0]},[r,i,n,t]),s=(0,Q.useCallback)(e=>{let a=e.resourceType??n;if(!a)throw B6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let o=a===n?i:t.resourceConfigurations[a];if(V6(e))return MEe(o,a,e,t,r);let s=e.operationLike===W.READ||e.operationLike===W.UPDATE||e.operationLike===W.DELETE,c=e.requireAddressable||s?o?lh({resourceConfig:o,operations:o.operations??[],coreOperation:e.operationLike,registry:t,hasResourceId:On.getResourceId(r[a]).length>0,allowBulk:e.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)}):void 0:$l(o?.operations??[],e.operationLike,{requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});if(!c)throw B6(`Composite resource runtime cannot resolve a preferred ${e.operationLike}-like operation on resource "${a}".`,{resourceType:a,operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});return c},[r,i,n,t]),c=(0,Q.useCallback)((e,c)=>{if(!n)throw B6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let l=e.resourceType??n,u=s({resourceType:l,...V6(e)?{operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}:{operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk}}),d=H6({target:e,hostResourceType:n,operation:u,registry:t});if(l===n&&!d){let i=On.getResourceId(r[n]),a=e.resourceId?{...Im({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:n,id:i},targetResourceType:n,targetId:e.resourceId,registry:t}).identifiers,[n]:e.resourceId}:r,o=On.buildParentResourcesRequirements(n,a,t,e.relationshipFieldOverrides),s=On.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:u,contextResourceIdentifiers:a,additionalContext:e.additionalContext,parentResourcesRequirements:o});return c&&e.pinnedFilters&&Object.keys(e.pinnedFilters).length>0?ZG({childContext:s,hostResourceType:n,hostResourceId:void 0,hostRelationships:void 0,selectedForeignKey:void 0,callerPinnedFilters:e.pinnedFilters,registry:t}):s}if(!o)throw B6(`Composite resource runtime cannot derive related resource operations from host "${n}" because no host operation is configured.`,{hostResourceType:n,targetResourceType:l});let f=On.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:o,contextResourceIdentifiers:r,parentResourcesRequirements:a}),p=On.deriveChildResourceContext(f,{resourceType:l,operationIdentifier:String(u.operationIdentifier),operation:u,resourceId:e.resourceId,relationshipFieldOverrides:e.relationshipFieldOverrides,additionalContext:e.additionalContext},t);return c?ZG({childContext:p,hostResourceType:n,hostResourceId:On.getResourceId(r[n])||void 0,hostRelationships:i?.resourceRelationships,selectedForeignKey:e.relationshipFieldOverrides?.[n],callerPinnedFilters:e.pinnedFilters,registry:t}):p},[r,o,i,n,a,t,s]),l=(0,Q.useCallback)(e=>c(e,!0),[c]),u=(0,Q.useCallback)(e=>V.flattenContextIdentifiers(c(e,!1).contextResourceIdentifiers),[c]),d=(0,Q.useCallback)(e=>{try{return l(e),!0}catch{return!1}},[l]);return(0,Q.useMemo)(()=>!n||!i?null:{hostResourceType:n,hostResourceId:On.getResourceId(r[n]),hostResourceConfig:i,contextResourceIdentifiers:r,parentResourcesRequirements:a,resolveOperation:s,buildOperationContext:l,deriveRelatedScopeIdentifiers:u,canBuildOperationContext:d},[l,u,d,r,i,n,a,s])}function W6(){let e=U6();if(!e)throw B6(`useEmbeddedResourceContext() must be used within a resource-scoped CompositeView.`);return e}var G6=B.LOW_LEVEL_AI_EXECUTION_USAGE,K6;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(K6||={});function q6(e,t){return e.disclosure===P.TOKENS_AND_COST?e.costs.flatMap(e=>{let n=f0(e.costMinor,e.currency,t);return n===void 0?[]:[{currency:e.currency,amount:n}]}):[]}function J6(e){return(t,n)=>e(G6,t,n)}function Y6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:G6}),a=J6(i.tComponent);if(e===K6.LOADING)return null;if(e===K6.FAILED||!t)return(0,$.jsx)(`p`,{role:`status`,className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":e,children:a(`readFailed`)});if(t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0)return(0,$.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":`empty`,children:a(`noCalls`)});let o=q6(t,r),s=t.disclosure===P.TOKENS_AND_COST?t.unpricedCallCount:0,c=[{key:`calls`,label:a(`calls`),value:r(t.callCount)},...s>0?[{key:`unpricedCalls`,label:a(`unpricedCalls`),value:r(s)}]:[],{key:`inputTokens`,label:a(`inputTokens`),value:r(t.promptTokens)},{key:`outputTokens`,label:a(`outputTokens`),value:r(t.completionTokens)},...t.reasoningTokens>0?[{key:`reasoningTokens`,label:a(`reasoningTokens`),value:r(t.reasoningTokens)}]:[],{key:`totalTokens`,label:a(`totalTokens`),value:r(t.totalTokens)},...t.classifierCallCount>0?[{key:`classifierCalls`,label:a(`classifierCalls`),value:r(t.classifierCallCount)}]:[],...t.documentExtractionCallCount>0?[{key:`documentExtractionCalls`,label:a(`documentExtractionCalls`),value:r(t.documentExtractionCallCount)}]:[],...t.personalDataFieldsWithheld>0?[{key:`personalDataWithheld`,label:a(`personalDataWithheld`),value:r(t.personalDataFieldsWithheld)}]:[],...o.map(e=>({key:`cost-${e.currency}`,label:a(`cost`),value:e.amount}))];return(0,$.jsxs)(`section`,{className:U(`flex flex-col gap-field`,n),"data-execution-usage":e,"aria-label":a(`title`),children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:a(`title`)}),(0,$.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-field gap-y-1 text-sm`,children:c.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`dd`,{className:`tabular-nums`,"data-execution-usage-row":e.key,children:e.value})]},e.key))})]})}function X6({className:e}){let t=U6(),{registry:n,doOperation:r}=lm(),i=(0,Q.useMemo)(()=>{if(!t?.hostResourceId)return;let e={resourceType:t.hostResourceType,resourceId:t.hostResourceId,operationIdentifier:je.USAGE,isOperationDefault:!0};if(!t.canBuildOperationContext(e))return;let r=t.buildOperationContext(e);return{operationPathKey:Ca.createOperationPathKeyFromOperation(r.operation),contextualParameters:V.buildContextualParameters(r.contextResourceIdentifiers,n),parentResourcesRequirements:r.parentResourcesRequirements}},[t,n]),[a,o]=(0,Q.useState)({state:K6.LOADING});return(0,Q.useEffect)(()=>{if(!i)return;let e=!0;return o({state:K6.LOADING}),r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements}).then(t=>{e&&o({state:K6.READY,usage:t})}).catch(()=>{e&&o({state:K6.FAILED})}),()=>{e=!1}},[i,r]),i?(0,$.jsx)(Y6,{readState:a.state,...a.usage?{usage:a.usage}:{},...e?{className:e}:{}}):null}function Z6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:G6}),a=J6(i.tComponent);if(e===K6.LOADING)return null;let o=(e,t)=>(0,$.jsx)(`span`,{className:U(`text-xs text-muted-foreground tabular-nums`,n),"data-execution-usage-summary":t,children:e});return e===K6.FAILED||!t?o(a(`readFailed`),K6.FAILED):t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0?o(a(`noCalls`),`empty`):o([a(`summaryTokens`,{tokens:r(t.totalTokens)}),...q6(t,r).map(e=>e.amount)].join(` · `),e)}function Q6({className:e}){let t=wR()?.resourceType,n=rk()?.data,r=uj().contextualParameters,{registry:i,doOperation:a}=lm(),o=typeof n?.executionId==`string`&&n.executionId!==``?n.executionId:void 0,s=(0,Q.useMemo)(()=>[..._ee.variants.values()].find(e=>e.resourceType===t)?.parentFieldIdentifier,[t]),c=s?r?.[s]:void 0,l=(0,Q.useMemo)(()=>{let e=t?i.resourceConfigurations[t]?.operations?.find(e=>e.operationIdentifier===je.USAGES&&e.isOperationDefault):void 0;return e?Ca.createOperationPathKeyFromOperation(e):void 0},[i,t]),[u,d]=(0,Q.useState)({state:K6.LOADING});return(0,Q.useEffect)(()=>{if(!o||!l||!s||typeof c!=`string`||c===``)return;let e=!0;return d({state:K6.LOADING}),kEe({doOperation:a,operationPathKey:l,contextualParameters:{[s]:c},executionId:o}).then(t=>{e&&d(t?{state:K6.READY,usage:t}:{state:K6.FAILED})}).catch(()=>{e&&d({state:K6.FAILED})}),()=>{e=!1}},[a,o,l,s,c]),!o||!l||typeof c!=`string`||c===``?null:(0,$.jsx)(Z6,{readState:u.state,...u.usage?{usage:u.usage}:{},...e?{className:e}:{}})}function $6(e,t){let n={},r={},i={};for(let a of e.fields)n[a.key]=a.request.question,a.request.why&&(r[a.key]=a.request.why),a.request.kind===_t.CHOICE?i[a.key]=Object.fromEntries((a.request.options??[]).map(e=>[e,Mn(a.request,e)])):a.request.kind===_t.CONFIRM&&(i[a.key]={...t});let a=e.layout.kind===gr.SECTIONS?e.layout.sections:e.layout.kind===gr.WIZARD?e.layout.steps:[],o={};for(let e of a)o[e.name]={title:e.title,...e.description?{description:e.description}:{}};return{fields:n,descriptions:r,enums:i,sections:o}}var e8=Q.createContext(null);function t8(){let e=Q.useContext(e8),{control:t}=UC(),n=zC({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 NEe(){let e=Q.useContext(e8);if(!e)return null;let{layout:t,fields:n}=e.compiled;if(t.kind===gr.FLAT)return(0,$.jsxs)(tA,{autoInjectSubmitButton:!1,children:[n.map(e=>(0,$.jsx)(QL,{name:e.key},e.key)),(0,$.jsx)(t8,{})]});let r=t.kind===gr.SECTIONS?t.appearance:cr.STEPPER,i=t.kind===gr.SECTIONS?t.sections:t.steps;return(0,$.jsxs)(tA,{autoInjectSubmitButton:!1,children:[i.map(e=>(0,$.jsx)(Jk,{name:e.name,appearance:r,children:e.keys.map(e=>(0,$.jsx)(QL,{name:e},e))},e.name)),(0,$.jsx)(t8,{})]})}var PEe=()=>void 0;function n8(e){let t=JSON.stringify(e);return Q.useMemo(()=>e,[t])}function r8({fields:e,form:t,confirmWords:n,disabled:r,onReady:i,onCompleteChange:a,className:o}){let s=n8(e),c=n8(t),l=n8(n),u=Q.useMemo(()=>Tie({fields:[...s],form:c}),[s,c]),d=Q.useMemo(()=>$6(u,l),[u,l]),f=Q.useRef(a);Q.useLayoutEffect(()=>{f.current=a},[a]);let p=Q.useMemo(()=>({compiled:u,onCompleteChangeRef:f}),[u]),m=Q.useCallback(e=>{i?.({async readValues(){if(!await e.trigger())return null;let t=u.schema.safeParse(e.getValues());if(!t.success)return null;let n=t.data;return u.fields.map(e=>({ref:e.request.ref,value:Ane(n[e.key])}))}})},[u,i]);return(0,$.jsx)(`div`,{className:o,"data-human-decision-form":``,children:(0,$.jsx)(e8.Provider,{value:p,children:(0,$.jsx)(nE,{schema:u.schema,onSubmit:PEe,labels:d,disabled:r,layoutTemplate:NEe,onFormReady:m})})})}var i8=Xs(B.LOW_LEVEL_AI_ARTIFACT_LIST,`AI_ArtifactList`,[`Item`,`Origin`,`TextContent`,`FileContent`,`StructuredContent`]);function a8({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n,{...t})}function o8({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.Item,{...t})}function FEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.Origin,{...t})}function IEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.TextContent,{...t})}function LEe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.FileContent,{...t})}function REe({preset:e=q.DEFAULT,...t}){let n=i8(e);return(0,$.jsx)(n.StructuredContent,{...t})}var zEe={[er.TEXT]:`TEXT`,[er.FILE]:`FILE`,[er.RAW_DATA]:`RAW_DATA`,[er.STRUCTURED]:`STRUCTURED`};function s8(e){let t=e.content;return{ref:e.ref,name:e.name,type:zEe[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 BEe({artifacts:e,...t}){let n=Q.useMemo(()=>e.map(s8),[e]);return(0,$.jsx)(a8,{items:n,...t})}function VEe({artifact:e,...t}){let n=Q.useMemo(()=>s8(e),[e]);return(0,$.jsx)(o8,{item:n,...t})}function c8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_LIST,`AI_AgentList`)(e);return(0,$.jsx)(n,{...t})}function l8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_CARD,`AI_AgentCard`)(e);return(0,$.jsx)(n,{...t})}function HEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_PROMPT_SPEC,`AI_AgentPromptSpec`)(e);return(0,$.jsx)(n,{...t})}function UEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_AGENT_CAPABILITIES,`AI_AgentCapabilities`)(e);return(0,$.jsx)(n,{...t})}var WEe={[oe.ACTIVE]:`ACTIVE`,[oe.INACTIVE]:`INACTIVE`,[oe.DEPRECATED]:`DEPRECATED`},GEe={[ad.GENERATION]:`GENERATION`,[ad.ANALYSIS]:`ANALYSIS`,[ad.TRANSFORMATION]:`TRANSFORMATION`,[ad.DECISION]:`DECISION`,[ad.CHAT]:`CHAT`,[ad.CUSTOM]:`CUSTOM`},KEe={[gi.SECURITY]:`SECURITY`,[gi.SAFETY]:`SAFETY`,[gi.PRIVACY]:`PRIVACY`,[gi.SCOPE]:`SCOPE`,[gi.COMPLIANCE]:`COMPLIANCE`};function u8(e){let t=e.promptSpec;return{ref:e.ref,displayName:e.displayName,status:WEe[e.status]??`INACTIVE`,promptSpec:{role:t.role,persona:t.persona,skillType:GEe[t.skillType]??`CUSTOM`,constraints:t.constraints?.map(e=>({id:e.id,text:e.text,type:KEe[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 qEe({agents:e,...t}){let n=Q.useMemo(()=>e.map(u8),[e]);return(0,$.jsx)(c8,{agents:n,...t})}function JEe({agent:e,...t}){let n=Q.useMemo(()=>u8(e),[e]);return(0,$.jsx)(l8,{agent:n,...t})}var d8=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_ACTION_BUTTON,`ActionButton`)(e);return(0,$.jsx)(r,{...t,ref:n})});d8.displayName=`ActionButton`;function f8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP,`ButtonGroup`)(e);return(0,$.jsx)(n,{...t})}function p8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP_TEXT,`ButtonGroupText`)(e);return(0,$.jsx)(n,{...t})}function YEe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_BUTTON_GROUP_SEPARATOR,`ButtonGroupSeparator`)(e);return(0,$.jsx)(n,{...t})}function m8({as:e=`span`,children:t,className:n,textClassName:r,maxWidth:i=`100%`,tooltipSide:a=Zs.TOP,tooltipDelayDuration:o=300,alwaysShowTooltip:s=!1,...c}){let l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!1),f=e===`span`?`span`:`div`,p=Q.useCallback(e=>{l.current=e},[]);(0,Q.useLayoutEffect)(()=>{let e=()=>{if(l.current){let e=l.current.scrollWidth>l.current.clientWidth;d(e)}};e();let t=new ResizeObserver(e);return l.current&&t.observe(l.current),()=>t.disconnect()},[t]);let m=(0,$.jsx)(e,{ref:p,"data-slot":`truncated-text`,className:U(`block truncate text-start`,r),style:{maxWidth:i},...c,children:t});return u||s?(0,$.jsxs)(ej,{delayDuration:o,children:[(0,$.jsx)(tj,{asChild:!0,children:(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}),(0,$.jsx)(nj,{side:a,children:t})]}):(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}var h8=Xs(B.LOW_LEVEL_AVATAR,`Avatar`,[`Image`,`Fallback`]);function g8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n,{...t})}function _8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n.Image,{...t})}function v8({preset:e=q.DEFAULT,...t}){let n=h8(e);return(0,$.jsx)(n.Fallback,{...t})}function y8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_NOTIFICATION_INDICATOR,`NotificationIndicator`)(e);return(0,$.jsx)(n,{...t})}y8.displayName=`NotificationIndicator`;function b8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_IDENTIFIER,`Identifier`)(e);return(0,$.jsx)(n,{...t})}b8.displayName=`Identifier`;function x8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DURATION,`Duration`)(e);return(0,$.jsx)(n,{...t})}x8.displayName=`Duration`;function S8({activation:e,metadata:t,fileId:n,fieldName:r,onOverlayRequested:i,getBlob:a,onOperationRequested:o,ariaLabel:s}){let c=(0,Q.useCallback)(async()=>{let e=t.url;if(!e)return;if(a)try{Ly(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 Xu.NONE:return;case Xu.OVERLAY:i?.();return;case Xu.DOWNLOAD:c();return;case Xu.NEW_TAB:t.url&&window.open(t.url,`_blank`,`noopener,noreferrer`);return;case Xu.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!==Xu.NONE&&(e.policy===Xu.OVERLAY?i:e.policy===Xu.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:Xu.NONE},[l,e.policy,s,t.url,o,i])}function C8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE,`DisplayFieldFileImage`)(e);return(0,$.jsx)(n,{...t})}function w8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO,`DisplayFieldFileVideo`)(e);return(0,$.jsx)(n,{...t})}function T8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO,`DisplayFieldFileAudio`)(e);return(0,$.jsx)(n,{...t})}function E8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT,`DisplayFieldFileDocument`)(e);return(0,$.jsx)(n,{...t})}function D8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY,`DisplayFieldFileGallery`)(e);return(0,$.jsx)(n,{...t})}var XEe=G(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`NotificationCenter`),O8=({preset:e=q.DEFAULT})=>{let{notifications:t,removeNotification:n,clearAll:r}=Mm(),{tComponent:i,isReady:a}=K({component:B.APPLICATION_LEVEL_NOTIFICATION_CENTER}),o=(0,Q.useMemo)(()=>pm(i,B.APPLICATION_LEVEL_NOTIFICATION_CENTER),[i]),s=(0,Q.useMemo)(()=>t.map(e=>({id:e.id,type:e.type,message:e.message,timestamp:e.timestamp,wasCelebration:e.wasCelebration,nextStep:e.nextStep})),[t]),c=XEe(e);return a?(0,$.jsx)(c,{notifications:s,sessionCount:s.length,onRemove:n,onClearAll:r,labelTitle:o(`title`),labelNoNotifications:o(`noNotificationsThisSession`),labelClearAll:o(`clearAll`),labelDismiss:o(`dismiss`),labelTimeJustNow:o(`timeJustNow`),formatTimeMinutesAgo:e=>o(`timeMinutesAgo`,{count:e}),formatTimeHoursAgo:e=>o(`timeHoursAgo`,{count:e}),formatTimeDaysAgo:e=>o(`timeDaysAgo`,{count:e})}):null};O8.displayName=`AppNotificationCenter`;var k8=({preset:e})=>{let{notifications:t}=Mm(),n=t.length,[r,i]=(0,Q.useState)(!1),a=(0,Q.useRef)(null),o=(0,Q.useCallback)(e=>{a.current&&!a.current.contains(e.target)&&i(!1)},[]);(0,Q.useEffect)(()=>(r&&document.addEventListener(`mousedown`,o),()=>{document.removeEventListener(`mousedown`,o)}),[r,o]);let s=(0,Q.useCallback)(e=>{e.key===`Escape`&&i(!1)},[]);return(0,$.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:s,children:[(0,$.jsxs)(`button`,{type:`button`,className:`relative inline-flex items-center justify-center w-8 h-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,onClick:()=>i(e=>!e),"aria-label":`Notifications${n>0?` (${n} this session)`:``}`,"aria-expanded":r,"aria-haspopup":`true`,children:[(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,$.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),n>0&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -end-0.5 flex items-center justify-center h-4 min-w-[16px] px-1 text-[10px] font-bold bg-destructive text-destructive-foreground rounded-full`,children:Jt(n)})]}),r&&(0,$.jsx)(`div`,{className:`absolute end-0 top-full mt-2 z-(--z-overlay) animate-in fade-in slide-in-from-top-2 duration-[var(--motion-duration-fast)]`,children:(0,$.jsx)(O8,{preset:e})})]})};k8.displayName=`AppLayout_NotificationCenter`;function A8({name:e,renderItem:t,sectionAppearance:n,objectItemLayout:r,className:i}){return(0,$.jsx)(QL,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,className:i})}A8.displayName=`FormFieldArray`,Ck(A8,bk.FIELD_SLOT);function j8({name:e,renderItem:t,sectionAppearance:n=cr.GHOST,objectItemLayout:r,className:i,hideLabel:a,labelPlacement:o,hideDescription:s,labelStyle:c}){return(0,$.jsx)(xR,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,labelStyle:c,className:i,hideLabel:a,labelPlacement:o,hideDescription:s})}j8.displayName=`DisplayFieldArray`;var ZEe=Ml(B.LOW_LEVEL_CALENDAR,`Calendar`),QEe=Ml(B.LOW_LEVEL_CALENDAR_DAY_BUTTON,`CalendarDayButton`),M8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=ZEe(e);return(0,$.jsx)(r,{...t,ref:n})});M8.displayName=`Calendar`;var N8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=QEe(e);return(0,$.jsx)(r,{...t,ref:n})});N8.displayName=`CalendarDayButton`;function P8({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_INLINE_EDIT_TEXT,`InlineEditText`)(e);return(0,$.jsx)(n,{...t})}P8.displayName=`InlineEditText`;var F8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_FILE_UPLOAD,`FileUpload`)(e);return(0,$.jsx)(r,{...t,ref:n})});F8.displayName=`FileUpload`;var I8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(I8||={});var L8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Ml(B.LOW_LEVEL_TOGGLE,`Toggle`)(e);return(0,$.jsx)(r,{...t,ref:n})});L8.displayName=`Toggle`;function $Ee({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM,`FormRoot`)(e);return(0,$.jsx)(n,{...t})}function eDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_ITEM,`FormItem`)(e);return(0,$.jsx)(n,{...t})}function tDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_LABEL,`FormLabel`)(e);return(0,$.jsx)(n,{...t})}function nDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_CONTROL,`FormControl`)(e);return(0,$.jsx)(n,{...t})}function rDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_DESCRIPTION,`FormDescription`)(e);return(0,$.jsx)(n,{...t})}function iDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_MESSAGE,`FormMessage`)(e);return(0,$.jsx)(n,{...t})}function aDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_FORM_FIELD,`FormFieldPrimitive`)(e);return(0,$.jsx)(n,{...t})}var R8=Q.createContext({}),z8=Q.createContext({}),B8=()=>{let e=Q.useContext(R8),t=Q.useContext(z8),{getFieldState:n}=UC(),r=PC({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 oDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_ASPECT_RATIO,`AspectRatio`)(e);return(0,$.jsx)(n,{...t})}var V8=Xs(B.LOW_LEVEL_CAROUSEL,`Carousel`,[`Content`,`Item`,`Previous`,`Next`]);function H8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n,{...t})}function U8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Content,{...t})}function W8({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Item,{...t})}function sDe({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Previous,{...t})}function cDe({preset:e=q.DEFAULT,...t}){let n=V8(e);return(0,$.jsx)(n.Next,{...t})}function lDe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_DIVIDER,`Divider`)(e);return(0,$.jsx)(n,{...t})}function G8({notificationBadgeRef:e,label:t,className:n}){let{registry:r}=lm(),{getBadgeState:i}=a$(),a=e?r.notificationBadgeDefinitions.find(t=>Ku(t)===e):void 0;if(!a)return null;let{count:o,pulse:s}=i(a),c=t?.trim()?t:is(Ku(a));return(0,$.jsx)(y8,{mode:a.display.mode,tone:a.display.tone,count:o,pulse:s,label:c,className:n})}G8.displayName=`NavigationItemBadge`;var K8=Xs(B.LOW_LEVEL_MENU_BAR,`Menubar`,[`Menu`,`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function uDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n,{...t})}function dDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Menu,{...t})}var q8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});q8.displayName=`MenubarTrigger`;var J8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.Content,{...t,ref:n})});J8.displayName=`MenubarContent`;function fDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Group,{...t})}function pDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Item,{...t})}function mDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function hDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.RadioGroup,{...t})}function gDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.RadioItem,{...t})}function _De({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Label,{...t})}function vDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Separator,{...t})}function yDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Shortcut,{...t})}function bDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.Sub,{...t})}function xDe({preset:e=q.DEFAULT,...t}){let n=K8(e);return(0,$.jsx)(n.SubTrigger,{...t})}var Y8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=K8(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});Y8.displayName=`MenubarSubContent`;var X8=Xs(B.LOW_LEVEL_NAVBAR,`NavigationMenu`,[`List`,`Item`,`Content`,`Trigger`,`Link`,`Indicator`,`Viewport`]);function SDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n,{...t})}function CDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.List,{...t})}function wDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Item,{...t})}function TDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Content,{...t})}function EDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Trigger,{...t})}function DDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Link,{...t})}function ODe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Indicator,{...t})}function kDe({preset:e=q.DEFAULT,...t}){let n=X8(e);return(0,$.jsx)(n.Viewport,{...t})}var Z8;(function(e){e.SIDEBAR=`sidebar`,e.FLOATING=`floating`,e.INSET=`inset`})(Z8||={});var Q8;(function(e){e.OFFCANVAS=`offcanvas`,e.ICON=`icon`,e.NONE=`none`})(Q8||={});var $8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})($8||={});var e5=Xs(B.LOW_LEVEL_SIDEBAR,`Sidebar`,[`Content`,`Footer`,`Group`,`GroupAction`,`GroupContent`,`GroupLabel`,`Header`,`Input`,`Inset`,`Menu`,`MenuAction`,`MenuBadge`,`MenuButton`,`MenuItem`,`MenuSkeleton`,`MenuSub`,`MenuSubButton`,`MenuSubItem`,`Provider`,`Rail`,`Separator`,`Trigger`]);function ADe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n,{...t})}function jDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Content,{...t})}function MDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Footer,{...t})}function NDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Group,{...t})}function PDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupAction,{...t})}function FDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupContent,{...t})}function IDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.GroupLabel,{...t})}function LDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Header,{...t})}function RDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Input,{...t})}function zDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Inset,{...t})}function BDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Menu,{...t})}function VDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuAction,{...t})}function HDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuBadge,{...t})}function UDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuButton,{...t})}function WDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuItem,{...t})}function GDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSkeleton,{...t})}function KDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSub,{...t})}function qDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSubButton,{...t})}function JDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.MenuSubItem,{...t})}function YDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Provider,{...t})}function XDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Rail,{...t})}function ZDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Separator,{...t})}function QDe({preset:e=q.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Trigger,{...t})}var t5=Xs(B.LOW_LEVEL_CONTEXT_MENU,`ContextMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function $De({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n,{...t})}function eOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Trigger,{...t})}var n5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});n5.displayName=`ContextMenuContent`;function tOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Group,{...t})}function nOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Item,{...t})}function rOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function iOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function aOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.RadioItem,{...t})}function oOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Label,{...t})}function sOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Separator,{...t})}function cOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Shortcut,{...t})}function lOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.Sub,{...t})}function uOe({preset:e=q.DEFAULT,...t}){let n=t5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var r5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=t5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});r5.displayName=`ContextMenuSubContent`;var i5=Xs(B.LOW_LEVEL_DROPDOWN_MENU,`DropdownMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function a5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n,{...t})}var o5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});o5.displayName=`DropdownMenuTrigger`;var s5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});s5.displayName=`DropdownMenuContent`;function dOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Group,{...t})}function c5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Item,{...t})}function fOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function pOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function mOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.RadioItem,{...t})}function l5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Label,{...t})}function u5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Separator,{...t})}function hOe({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Shortcut,{...t})}function d5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.Sub,{...t})}function f5({preset:e=q.DEFAULT,...t}){let n=i5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var p5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=i5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});p5.displayName=`DropdownMenuSubContent`;var m5=Xs(B.LOW_LEVEL_HOVER_CARD,`HoverCard`,[`Trigger`,`Content`]);function h5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n,{...t})}function g5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n.Trigger,{...t})}function _5({preset:e=q.DEFAULT,...t}){let n=m5(e);return(0,$.jsx)(n.Content,{...t})}var v5=Xs(B.LOW_LEVEL_PAGINATION,`Pagination`,[`Content`,`Item`,`Link`,`Previous`,`Next`,`Ellipsis`]);function gOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n,{...t})}function _Oe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Content,{...t})}function vOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Item,{...t})}function yOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Link,{...t})}function bOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Previous,{...t})}function xOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Next,{...t})}function SOe({preset:e=q.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Ellipsis,{...t})}var y5=Xs(B.LOW_LEVEL_STACKED_LAYOUT,`StackedLayout`,[`Header`,`Title`,`Subtitle`,`Actions`,`Toolbar`,`Body`,`Aside`,`Content`,`Section`]);function COe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n,{...t})}function wOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Header,{...t})}function TOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Title,{...t})}function EOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Subtitle,{...t})}function DOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Actions,{...t})}function OOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Toolbar,{...t})}function kOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Body,{...t})}function AOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Aside,{...t})}function jOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Content,{...t})}function MOe({preset:e=q.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Section,{...t})}var b5=Xs(B.LOW_LEVEL_AI_ARTIFACT,`AI_Artifact`,[`Header`,`Close`,`Content`,`Title`,`Description`,`Actions`,`Action`]);function NOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n,{...t})}function POe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Header,{...t})}function FOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Close,{...t})}function IOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Content,{...t})}function LOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Title,{...t})}function ROe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Description,{...t})}function zOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Actions,{...t})}function BOe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Action,{...t})}function x5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CODE_BLOCK,`AI_CodeBlock`)(e);return(0,$.jsx)(n,{...t})}function S5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_DIFF_BLOCK,`AI_DiffBlock`)(e);return(0,$.jsx)(n,{...t})}var C5;(function(e){e.CONTEXT=`context`,e.ADDED=`added`,e.REMOVED=`removed`,e.NOTE=`note`})(C5||={});var VOe=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,HOe=/^diff --git (?:a\/)?(\S+) (?:b\/)?(\S+)$/,UOe=/^--- (?:a\/)?(.*)$/,WOe=/^\+\+\+ (?:b\/)?(.*)$/,GOe=/^Binary files .* differ$/,KOe=`/dev/null`;function w5(e){if(e===void 0)return;let t=e.trim();return t===KOe||t===``?void 0:t}function T5(e){let t=e.replace(/\r\n/g,`
44
- `).split(`
45
- `);t.length>0&&t[t.length-1]===``&&t.pop();let n=[],r=null,i=null,a=0,o=0,s=()=>{i&&r&&r.hunks.push({...i,lines:[...i.lines]}),i=null},c=()=>{s(),r&&n.push({...r.newPath??r.oldPath?{path:r.newPath??r.oldPath}:{},...r.oldPath?{oldPath:r.oldPath}:{},...r.newPath?{newPath:r.newPath}:{},isBinary:r.isBinary,hunks:r.hunks,added:r.added,removed:r.removed}),r=null},l=()=>{c(),r={pathHeaderSeen:!1,isBinary:!1,hunks:[],added:0,removed:0}};for(let e of t){let t=HOe.exec(e);if(t){l(),r.oldPath=w5(t[1]),r.newPath=w5(t[2]);continue}let n=i===null?UOe.exec(e):null;if(n){(!r||r.pathHeaderSeen||r.hunks.length>0)&&l(),r.pathHeaderSeen=!0,r.oldPath=w5(n[1]);continue}let c=i===null?WOe.exec(e):null;if(c){r||l(),r.newPath=w5(c[1]);continue}if(GOe.test(e)){r||l(),r.isBinary=!0;continue}let u=VOe.exec(e);if(u){r||l(),s();let t=Number(u[1]),n=Number(u[3]);i={header:e,oldStart:t,oldLines:u[2]===void 0?1:Number(u[2]),newStart:n,newLines:u[4]===void 0?1:Number(u[4]),lines:[]},a=t,o=n;continue}if(!i||!r)continue;let d=e.charAt(0),f=e.slice(1);switch(d){case`+`:i.lines.push({kind:C5.ADDED,text:f,newNumber:o}),o+=1,r.added+=1;break;case`-`:i.lines.push({kind:C5.REMOVED,text:f,oldNumber:a}),a+=1,r.removed+=1;break;case`\\`:i.lines.push({kind:C5.NOTE,text:f.trim()});break;default:i.lines.push({kind:C5.CONTEXT,text:d===` `?f:e,oldNumber:a,newNumber:o}),a+=1,o+=1}}return c(),n}function E5(e){return e.hunks.reduce((e,t)=>e+t.lines.length+1,0)}function qOe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_IMAGE,`AI_Image`)(e);return(0,$.jsx)(n,{...t})}var D5=Xs(B.LOW_LEVEL_AI_WEB_PREVIEW,`AI_WebPreview`,[`Navigation`,`NavigationButton`,`Url`,`Body`,`Console`]);function JOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n,{...t})}function YOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Navigation,{...t})}function XOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.NavigationButton,{...t})}function ZOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Url,{...t})}function QOe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Body,{...t})}function $Oe({preset:e=q.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Console,{...t})}var O5=Xs(B.LOW_LEVEL_AI_CONVERSATION,`AI_Conversation`,[`Content`,`EmptyState`,`ScrollButton`]);function k5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n,{...t})}function A5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.Content,{...t})}function j5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.EmptyState,{...t})}function M5({preset:e=q.DEFAULT,...t}){let n=O5(e);return(0,$.jsx)(n.ScrollButton,{...t})}var N5=Xs(B.LOW_LEVEL_AI_PROMPT_INPUT,`AI_PromptInput`,`Provider.Attachment.Attachments.Body.Textarea.Header.Footer.Tools.Button.Submit.ActionMenu.ActionMenuTrigger.ActionMenuContent.ActionMenuItem.ActionAddAttachments.SpeechButton.Select.SelectTrigger.SelectContent.SelectItem.SelectValue.Command.CommandInput.CommandList.CommandEmpty.CommandGroup.CommandItem.CommandSeparator.HoverCard.HoverCardTrigger.HoverCardContent.TabsList.Tab.TabLabel.TabBody.TabItem`.split(`.`));function P5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n,{...t})}function eke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Provider,{...t})}function tke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Attachment,{...t})}function nke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Attachments,{...t})}function rke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Body,{...t})}function F5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Textarea,{...t})}function ike({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Header,{...t})}function I5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Footer,{...t})}function ake({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Tools,{...t})}function oke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Button,{...t})}function L5({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Submit,{...t})}function ske({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenu,{...t})}function cke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuTrigger,{...t})}function lke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuContent,{...t})}function uke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionMenuItem,{...t})}function dke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.ActionAddAttachments,{...t})}function fke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SpeechButton,{...t})}function pke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Select,{...t})}function mke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectTrigger,{...t})}function hke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectContent,{...t})}function gke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectItem,{...t})}function _ke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.SelectValue,{...t})}function vke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Command,{...t})}function yke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandInput,{...t})}function bke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandList,{...t})}function xke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandEmpty,{...t})}function Ske({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandGroup,{...t})}function Cke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandItem,{...t})}function wke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.CommandSeparator,{...t})}function Tke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCard,{...t})}function Eke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCardTrigger,{...t})}function Dke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.HoverCardContent,{...t})}function Oke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabsList,{...t})}function kke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.Tab,{...t})}function Ake({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabLabel,{...t})}function jke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabBody,{...t})}function Mke({preset:e=q.DEFAULT,...t}){let n=N5(e);return(0,$.jsx)(n.TabItem,{...t})}var R5=Xs(B.LOW_LEVEL_AI_SOURCES,`AI_Sources`,[`Trigger`,`Content`,`Source`]);function z5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n,{...t})}function B5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Trigger,{...t})}function V5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Content,{...t})}function H5({preset:e=q.DEFAULT,...t}){let n=R5(e);return(0,$.jsx)(n.Source,{...t})}function U5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SUGGESTIONS,`AI_Suggestions`)(e);return(0,$.jsx)(n,{...t})}function W5({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SUGGESTION,`AI_Suggestion`)(e);return(0,$.jsx)(n,{...t})}function Nke({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONFIRMATION,`AI_Confirmation`)(e);return(0,$.jsx)(n,{...t})}var G5=Xs(B.LOW_LEVEL_AI_QUEUE,`AI_Queue`,[`List`,`Item`,`ItemIndicator`,`ItemContent`,`ItemDescription`,`ItemActions`,`ItemAction`,`ItemAttachment`,`ItemImage`,`ItemFile`,`Section`,`SectionTrigger`,`SectionLabel`,`SectionContent`,`TodoItem`,`MessageItem`]);function Pke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n,{...t})}function Fke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.List,{...t})}function Ike({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Item,{...t})}function Lke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemIndicator,{...t})}function Rke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemContent,{...t})}function zke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemDescription,{...t})}function Bke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemActions,{...t})}function Vke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemAction,{...t})}function Hke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemAttachment,{...t})}function Uke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemImage,{...t})}function Wke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemFile,{...t})}function Gke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Section,{...t})}function Kke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionTrigger,{...t})}function qke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionLabel,{...t})}function Jke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.SectionContent,{...t})}function Yke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.TodoItem,{...t})}function Xke({preset:e=q.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.MessageItem,{...t})}var K5=Xs(B.LOW_LEVEL_AI_TASK,`AI_Task`,[`Trigger`,`Content`,`Item`,`ItemFile`]);function Zke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n,{...t})}function Qke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Trigger,{...t})}function $ke({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Content,{...t})}function eAe({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.Item,{...t})}function q5({preset:e=q.DEFAULT,...t}){let n=K5(e);return(0,$.jsx)(n.ItemFile,{...t})}var J5=Xs(B.LOW_LEVEL_AI_TOOL,`AI_Tool`,[`Header`,`Content`,`Input`,`Output`]);function Y5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n,{...t})}function X5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Header,{...t})}function Z5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Content,{...t})}function Q5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Input,{...t})}function $5({preset:e=q.DEFAULT,...t}){let n=J5(e);return(0,$.jsx)(n.Output,{...t})}function tAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_EXECUTION_STREAM,`AI_ExecutionStream`)(e);return(0,$.jsx)(n,{...t})}function nAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONNECTION,`AI_Connection`)(e);return(0,$.jsx)(n,{...t})}function rAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_EDGE,`AI_Edge`)(e);return(0,$.jsx)(n,{...t})}function e7({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_PANEL,`AI_Panel`)(e);return(0,$.jsx)(n,{...t})}function iAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_TOOLBAR,`AI_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function aAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CONTEXT,`AI_Context`)(e);return(0,$.jsx)(n,{...t})}function oAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_MODEL_SELECTOR,`AI_ModelSelector`)(e);return(0,$.jsx)(n,{...t})}function sAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_OPEN_IN_CHAT,`AI_OpenInChat`)(e);return(0,$.jsx)(n,{...t})}function cAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_LOADER,`AI_Loader`)(e);return(0,$.jsx)(n,{...t})}function t7({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_SHIMMER,`AI_Shimmer`)(e);return(0,$.jsx)(n,{...t})}var n7=Xs(B.LOW_LEVEL_AI_CHAIN_OF_THOUGHT,`AI_ChainOfThought`,[`Header`,`Step`,`SearchResults`,`SearchResult`,`Content`,`Image`]);function r7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n,{...t})}function i7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Header,{...t})}function a7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Step,{...t})}function lAe({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.SearchResults,{...t})}function uAe({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.SearchResult,{...t})}function o7({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Content,{...t})}function dAe({preset:e=q.DEFAULT,...t}){let n=n7(e);return(0,$.jsx)(n.Image,{...t})}function fAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_CHECKPOINT,`AI_Checkpoint`)(e);return(0,$.jsx)(n,{...t})}function pAe({preset:e=q.DEFAULT,...t}){let n=G(B.LOW_LEVEL_AI_INLINE_CITATION,`AI_InlineCitation`)(e);return(0,$.jsx)(n,{...t})}var s7=Xs(B.LOW_LEVEL_AI_PLAN,`AI_Plan`,[`Header`,`Trigger`,`Content`,`Title`,`Description`,`Action`,`Footer`]);function mAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n,{...t})}function hAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Header,{...t})}function gAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Trigger,{...t})}function _Ae({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Content,{...t})}function vAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Title,{...t})}function yAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Description,{...t})}function bAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Action,{...t})}function xAe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Footer,{...t})}var c7=Xs(B.LOW_LEVEL_AI_REASONING,`AI_Reasoning`,[`Trigger`,`Content`]);function l7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n,{...t})}function u7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Trigger,{...t})}function d7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Content,{...t})}function f7(){let e=nh(),t=cg(),n=Pl[fo.HOME].route,{navigate:r}=wS(),{isNavigationItemActive:i}=Px(),{emit:a}=Ao();return{isNavigationItemActive:i,handleNavigationClick:(0,Q.useCallback)((e,t)=>{zm.dispatchNavigationForItem(r,e,t)},[r]),handleHomeClick:(0,Q.useCallback)(()=>{Ph({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 SAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function CAe(e){switch(e){case xa.VERTICAL_RAIL:return{direction:bc.VERTICAL,borderSide:Zs.END,tooltipSide:Zs.END,orientation:bc.VERTICAL};case xa.HORIZONTAL_BAR:return{direction:bc.HORIZONTAL,borderSide:Zs.BOTTOM,tooltipSide:Zs.TOP,orientation:bc.HORIZONTAL};case xa.BOTTOM_TAB_BAR:return{direction:bc.HORIZONTAL,borderSide:Zs.TOP,tooltipSide:Zs.TOP,orientation:bc.HORIZONTAL};default:return{direction:bc.VERTICAL,borderSide:Zs.END,tooltipSide:Zs.END,orientation:bc.VERTICAL}}}function p7(){let{UIConfig:e,appComponentsConfiguration:t}=Rg(),n=eS(),r=t?.[Fr.ACTIVITY_BAR],i=e?.currentBreakpoint===xl.MOBILE,a=(0,Q.useMemo)(()=>SAe(r)?i?r.mobileRendering??xa.BOTTOM_TAB_BAR:r.desktopRendering??xa.VERTICAL_RAIL:i?xa.BOTTOM_TAB_BAR:xa.VERTICAL_RAIL,[r,i]),o=(0,Q.useMemo)(()=>CAe(a),[a]);return{availableModes:(0,Q.useMemo)(()=>n?.availableModes??[],[n?.availableModes]),activeMode:n?.activeMode??null,setActiveMode:n?.setActiveMode??(()=>{}),hasModes:n?.hasModes??!1,activeRenderingMode:a,layout:o,isNavigationLoading:!n}}var m7=`engine:primary`;function h7(){return{requiredCapabilities:[Bv.ANSWERER]}}function g7(e,t){return(e??[]).some(e=>e.kind===mu.ENGINE_PAGE&&e.pageRef===t||g7(e.children,t))}function wAe(e,t){if(!t||(e??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&g7(e.children,fo.DECISIONS)))return e;let n={kind:mu.ENGINE_PAGE,pageRef:fo.DECISIONS,runtimeAvailability:h7()},r=(e??[]).findIndex(e=>e.contentKind===ze.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:ze.NAVIGATION_LIST,ref:m7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e;return{...i,children:[n,...i.children]}})}function TAe(e,t){return!t||(e??[]).some(e=>e.kind===mu.ENGINE_PAGE&&e.pageRef===fo.DECISIONS)?e:[...e??[],{kind:mu.ENGINE_PAGE,pageRef:fo.DECISIONS,runtimeAvailability:h7()}]}function _7(){return{kind:mu.RESOURCE_OPERATION,resourceType:ll.ORGANIZATION_REPRESENTATIONS,operation:W.LIST,runtimeAvailability:{requiredCapabilities:[pv.REPRESENTS]}}}function v7(e){return(e??[]).some(e=>e.kind===mu.RESOURCE_OPERATION&&e.resourceType===ll.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST||v7(e.children))}function EAe(e,t){if(t?.includes(rm.CLIENTS)||(e??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&v7(e.children)))return e;let n=_7(),r=(e??[]).findIndex(e=>e.contentKind===ze.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:ze.NAVIGATION_LIST,ref:m7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e,a=i.children.findIndex(e=>e.kind!==mu.ENGINE_PAGE||e.pageRef!==fo.DECISIONS),o=a===-1?i.children.length:a;return{...i,children:[...i.children.slice(0,o),n,...i.children.slice(o)]}})}function DAe(e,t){return t?.includes(rm.CLIENTS)||(e??[]).some(e=>e.kind===mu.RESOURCE_OPERATION&&e.resourceType===ll.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST)?e:[...e??[],_7()]}var y7=rs.getLogger(),b7=y7.debugByType(`SidebarBehavior`);y7.setDebugTypeLogging(`SidebarBehavior`,!1);var x7=[xl.MOBILE,xl.VERT_TABLET,xl.DESKTOP];function S7(e,t){return x7.indexOf(e)<=x7.indexOf(t)}function C7(e,t){if(e===!1||!t)return!1;let n=a2(e)?e:void 0;return(n?.policy??Au.BURGER)===Au.BURGER&&S7(t,n?.responsiveBreakpoint??xl.MOBILE)}function w7(){let{UIConfig:e,appComponentsConfiguration:t}=Rg(),n=t?.[Fr.SIDEBAR];return n!==!1&&n!==void 0&&C7(n,e?.currentBreakpoint)}function OAe(){let e=qs(fs.SIDEBAR_COLLAPSED);return e===null?null:e===`true`}function T7(e={}){let{placement:t=Zc.START,isCollapsed:n,onToggleCollapse:r}=e,i=f7(),{isNavigationItemActive:a}=i,o=F$(),s=Jp(),c=gS(),{UIConfig:l,appComponentsConfiguration:u,sidebarCompactLabelMode:d,navigationLayout:f,suppressedEngineNavigationEntries:p}=Rg(),{navigate:m,navigateToResource:h}=wS(),{registry:g}=lm(),_=u?.[Fr.SIDEBAR],v=_!==!1,y=l?.currentBreakpoint,{on:b}=Ao(),x=Tu().appConfig.decisionInbox,S=a2(_)?_.contentSections:void 0,C=(0,Q.useMemo)(()=>v?EAe(wAe(S,x),p):S,[v,S,x,p]),w=a2(_)?_.defaultSection:void 0,T=(a2(_)?_.homeDisplayMode:void 0)??Gu.NAVIGATION_ITEM,E=h2({theme:a2(_)?_.brandMarkTheme:void 0}),D=T===Gu.BRAND_HEADER?E:void 0,O=(0,Q.useMemo)(()=>{let e=a2(_)?_.hostedComponents:void 0;return _2(Fr.SIDEBAR,e,u,y,al.TOP,f)},[_,u,y,f]),k=c.activeMode,A=c.availableModes,j=c.allScopeValues,M=(0,Q.useMemo)(()=>{if(!C)return;let e=X3(j,k,A);return $le(Y3(C,k,e,ya.isDevelopment()),c)},[C,k,A,j,c]);(0,Q.useEffect)(()=>{if(!ya.isDevelopment()||!C||!window.__WILDO_DEBUG_SIDEBAR__)return;let e=X3(j,k,A);Z3(C,k,e)},[C,k,A,j]);let N=(0,Q.useRef)(OAe()),P=a2(_)?_.defaultCollapsed:void 0,[F,I]=(0,Q.useState)(N.current),ee=F??P??!1,L=(0,Q.useCallback)(e=>{I(e),so(fs.SIDEBAR_COLLAPSED,String(e))},[]),R=n===void 0?ee:n,z=v&&C7(_,y),[te,ne]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{z||ne(!1)},[z]);let[re,ie]=(0,Q.useState)(()=>{try{let e=localStorage.getItem(fs.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=qs(fs.SIDEBAR_FAVORITES),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}});(0,Q.useEffect)(()=>{so(fs.SIDEBAR_FAVORITES,JSON.stringify(de))},[de]),(0,Q.useEffect)(()=>{try{localStorage.setItem(fs.SIDEBAR_SECTION_COLLAPSED,JSON.stringify(re))}catch{}},[re]);let pe=(0,Q.useMemo)(()=>{let e=y===xl.MOBILE,t=a2(_)?_:void 0,n=d===gie.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=a2(_)?_:void 0;if(e?.policy!==Au.DRAWER||!y)return;let t=e.responsiveBreakpoint??xl.MOBILE,r=S7(y,t),i=me.current;me.current=r,i===!0&&!r&&n===void 0&&L(!1)},[y,_,n,L]);let he=(0,Q.useMemo)(()=>!M||!o?[]:Rm(M,o),[M,o]),ge=(0,Q.useMemo)(()=>{let e=he.map((e,t)=>kAe(e,t)),t=new Map,n=e=>{for(let r of e)t.has(r.id)||t.set(r.id,r),r.children?.length&&n(r.children)};for(let t of e)t.contentKind===ze.NAVIGATION_LIST&&t.section.behavior!==it.FAVORITES&&(n(t.items),n(t.moreMenuItems));let r=e.map(e=>{if(e.contentKind!==ze.NAVIGATION_LIST||e.section.behavior!==it.FAVORITES)return e;let n=de.map(e=>t.get(e)).filter(e=>e!==void 0).map(e=>({...e,id:`favorite-${e.id}`,favoriteId:e.id,children:void 0}));return{...e,items:n}}).filter(e=>e.contentKind!==ze.NAVIGATION_LIST||e.items.length>0||e.moreMenuItems.length>0||e.section.inlineCreate!==Sc.NONE),i=e=>e.section.isPrimary?0:e.section.behavior===it.FAVORITES?1:2;return r.map((e,t)=>({group:e,declaredIndex:t})).sort((e,t)=>i(e.group)-i(t.group)||e.declaredIndex-t.declaredIndex).map(e=>e.group)},[he,de]),_e=(0,Q.useMemo)(()=>{let e=[],t=n=>{for(let r of n)r.urlPath&&e.push({id:r.id,urlPath:r.urlPath}),r.children?.length&&t(r.children)};for(let e of ge)t(e.items),t(e.moreMenuItems);return e},[ge]),ve=(0,Q.useMemo)(()=>zm.getMostSpecificActiveRoute(_e.map(e=>e.urlPath),a),[_e,a]),ye=(0,Q.useMemo)(()=>{if(ve)return _e.find(e=>e.urlPath===ve)?.id},[_e,ve]),be=(0,Q.useCallback)(e=>!!ye&&e.id===ye,[ye]),xe=!z&&R,Se=(0,Q.useMemo)(()=>({isCollapsible:!a2(_)||_.collapsible!==!1,responsivePolicy:a2(_)?_.policy:Au.BURGER,currentWidth:xe?pe.collapsedWidth:pe.width}),[_,xe,pe]),Ce=(0,Q.useCallback)(()=>{z?ne(e=>!e):r?r():L(!R)},[z,R,r,L]),we=(0,Q.useCallback)(()=>{ne(!1)},[]),Te=(0,Q.useRef)(Ce);Te.current=Ce,(0,Q.useEffect)(()=>{if(v)return b(wc.HOTKEY_SIDEBAR_TOGGLE,()=>{Te.current()})},[b,v]);let Ee=(0,Q.useCallback)((e,t)=>{ie(n=>({...n,[e]:t}))},[]),De=(0,Q.useCallback)(e=>{if(!e.collapsible)return!1;let t=re[e.ref];return t===void 0?w&&e.ref===w?!1:e.defaultCollapsed??!1:t},[re,w]),Oe=(0,Q.useCallback)(e=>{oe(t=>({...t,[e]:!t[e]}))},[]),ke=(0,Q.useCallback)(e=>{b7(`handleNavigationClick`,{itemId:e.id,itemLabel:e.label,urlPath:e.urlPath}),i.handleNavigationClick(e,Fr.SIDEBAR),z&&ne(!1)},[i.handleNavigationClick,z]),Ae=(0,Q.useCallback)(()=>{b7(`handleHomeClick: START`),i.handleHomeClick(),z&&ne(!1),b7(`handleHomeClick: DONE`)},[i.handleHomeClick,z]),je=(0,Q.useCallback)(e=>{ce(e),ue(``)},[]),Me=(0,Q.useCallback)(()=>{ce(null),ue(``)},[]),Ne=(0,Q.useCallback)((e,t)=>{if(!t)return;let n=(a2(_)?_.contentSections:void 0)?.find(t=>t.ref===e),r=n?.contentKind===ze.NAVIGATION_LIST&&n.inlineCreate===Sc.DIALOG;if(!r&&!le.trim())return;let i=(n?.contentKind===ze.NAVIGATION_LIST?n.inlineCreateField:void 0)??`title`,a=g.resourceConfigurations[t],o=a?.operations?.find(e=>String(e.operationIdentifier)===W.CREATE);if(!a||!o)return;let c=On.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:o,contextResourceIdentifiers:s?.buildContextResourceIdentifiers()??{},...r?{}:{additionalContext:{defaultValuesOverride:{[i]:le.trim()}}}});r?h(c,zm.createAppLevelInitiator(Fr.SIDEBAR),void 0,Rt.OVERLAY):(m({content:{contentType:od.RESOURCE_OPERATION,resourceContext:c},initiator:zm.createAppLevelInitiator(Fr.SIDEBAR)}),Me())},[le,m,h,Me,_,g,s]),Pe=(0,Q.useCallback)(e=>ae[e]??!1,[ae]),Fe=(0,Q.useCallback)(e=>de.includes(e.favoriteId??e.id),[de]),B=(0,Q.useCallback)(e=>{let t=e.favoriteId??e.id;fe(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},[]),Ie=(0,Q.useMemo)(()=>(M??[]).some(e=>e.contentKind===ze.NAVIGATION_LIST&&e.behavior===it.FAVORITES),[M]);return{groupedSections:ge,hostedComponents:O,isCollapsed:xe,isHomeActive:i.isHomeActive,dimensions:pe,sidebarConfig:Se,isNavigationLoading:!o,hasItems:ge.length>0||T===Gu.NAVIGATION_ITEM,placement:t,isMobileDrawerMode:z,isMobileDrawerOpen:te,closeMobileDrawer:we,homeDisplayMode:T,brandHeader:D,isNavigationItemActive:be,isSectionCollapsed:De,isItemCollapsed:Pe,handleNavigationClick:ke,handleHomeClick:Ae,handleToggleCollapse:Ce,handleSetSectionCollapsed:Ee,handleToggleItemCollapse:Oe,isItemFavorite:Fe,handleToggleItemFavorite:B,hasFavoritesSection:Ie,inlineCreate:{activeSection:se,value:le,start:je,cancel:Me,submit:Ne,setValue:ue}}}function kAe(e,t){let n={ref:e.ref,label:e.label,showLabel:e.showLabel!==!1,collapsible:e.collapsible??!1,defaultCollapsed:e.defaultCollapsed??!1,behavior:it.STATIC,inlineCreate:Sc.NONE,nested:!1,maxNestingDepth:1};switch(e.contentKind){case ze.NAVIGATION_LIST:{let t={...n,behavior:e.behavior??it.STATIC,inlineCreate:e.inlineCreate??Sc.NONE,inlineCreateResourceType:e.inlineCreateResourceType,nested:e.nested??!0,maxNestingDepth:e.maxNestingDepth??1,isPrimary:e.isPrimary??!1,...e.isPrimary?{showLabel:!1,collapsible:!1}:{}},r=E7(e.items.map(e=>D7(e)).filter(e=>e!==null),t.nested??!0,t.maxNestingDepth??1);return{section:t,items:r.filter(e=>e.displayPolicy!==dn.SECTION_MORE_MENU),moreMenuItems:r.filter(e=>e.displayPolicy===dn.SECTION_MORE_MENU),contentKind:ze.NAVIGATION_LIST}}case ze.RESOURCE_BROWSER:return{section:n,items:[],moreMenuItems:[],contentKind:ze.RESOURCE_BROWSER,resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant,navigateOperation:e.navigateOperation,navigateOperationVariant:e.navigateOperationVariant,instanceFilter:e.instanceFilter,onInstanceClick:e.onInstanceClick};case ze.GUIDANCE_WIDGET:return{section:n,items:[],moreMenuItems:[],contentKind:ze.GUIDANCE_WIDGET,guidanceRef:e.guidanceRef};case ze.CUSTOM_COMPONENT:return{section:n,items:[],moreMenuItems:[],contentKind:ze.CUSTOM_COMPONENT,componentRef:e.componentRef}}}function E7(e,t,n){let r=t?Math.max(1,Math.floor(n)):0,i=e=>e.flatMap(e=>[{...e,children:void 0},...i(e.children??[])]),a=(e,t)=>e.flatMap(e=>{let n=e.children??[];return n.length===0?[e]:t===0?[{...e,children:void 0},...i(n)]:[{...e,children:a(n,t-1)}]});return a(e,r)}function AAe(e,t){y7.warn(`Navigation item "${e.id}" ${t} — dropped from the sidebar`,{itemId:e.id,ref:e.ref,contentType:e.contentType})}function D7(e){let t={id:e.id,ref:e.ref,label:e.label,urlPath:e.urlPath,iconReference:e.iconReference,displayPolicy:e.displayPolicy,notificationBadgeRef:e.notificationBadgeRef,children:e.children?.map(D7).filter(e=>e!==null)};return e.operation&&e.resourceContext?(ya.isDevelopment()&&(e.resourceType||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing resourceType`),e.operationIdentifier||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing operationIdentifier`)),{...t,itemType:ra.RESOURCE,resourceType:e.resourceType??``,operationIdentifier:e.operationIdentifier??``,operation:e.operation,resourceContext:e.resourceContext}):e.contentType===od.ENGINE_PAGE?e.pageRef?{...t,itemType:ra.ENGINE_PAGE,pageRef:e.pageRef}:(AAe(e,"declares contentType ENGINE_PAGE with no `pageRef`"),null):e.contentType===od.SETTINGS_HUB?{...t,itemType:ra.SETTINGS_HUB,sectionRef:e.sectionRef}:e.componentRef?{...t,itemType:ra.CUSTOM_COMPONENT,componentRef:e.componentRef,contextResourceIdentifiers:e.contextResourceIdentifiers}:{...t,itemType:ra.VIEW,viewRef:e.viewRef??e.ref,contentType:e.contentType??od.COMPOSITE_VIEW,contextResourceIdentifiers:e.contextResourceIdentifiers,flowsActorsSystemRef:e.flowsActorsSystemRef,fullCustomComponentRef:e.fullCustomComponentRef,requiredFeatures:e.requiredFeatures}}function O7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k7(e={}){let{mode:t}=e,{UIConfig:n,appComponentsConfiguration:r,navigationLayout:i,homeDefinition:a}=Rg(),o=F$(),{navigate:s}=wS(),c=gS(),{isNavigationItemActive:l,isHomeActive:u,handleHomeClick:d}=f7(),f=a?.compositeViewReference,p=r?.[Fr.MENUBAR],m=n?.currentBreakpoint,h=h2({theme:O7(p)?p.brandMarkTheme:void 0}),g=O7(p)&&p.brandHeader===!0?h:void 0,_=(0,Q.useMemo)(()=>O7(p)?_2(Fr.MENUBAR,p.hostedComponents,r,m,Zc.START,i):[],[r,p,m,i]),v=(0,Q.useMemo)(()=>O7(p)?aue(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=Km(void 0,v,o),t=zm.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:()=>{zm.dispatchNavigationForResolvedTarget(s,e,Fr.MENUBAR)}}))},[v,o,s,l,u,f]),menubarConfig:(0,Q.useMemo)(()=>{let e=t||(O7(p)?p.displayPolicy??`FIXED`:typeof p==`string`?p:`FIXED`),n=e===`OVERLAY`;return{mode:e,isOverlay:n,showMobileLayout:m===xl.MOBILE&&n}},[p,t,m]),mapToFrontendComponentType:f2}}function A7(e,t){if(!e)return;let n=e.resourceConfigurations[t.resourceType];if(!n?.mainSchema)return;let r=V.resolveFieldShapeOfAnyVariant(n),i=r?.[t.fieldIdentifier];if(i)return{schema:i,isPrimaryKeyFallback:!1};if(t.fieldIdentifier!==n.resourceFieldIdentifier)return;let a=r?._id??r?.id;return a?{schema:a,isPrimaryKeyFallback:!0}:void 0}function j7(e={}){let t=Jp(),{on:n}=Ao(),{registry:r}=lm(),[i,a]=(0,Q.useState)(0),o=e.focusTrigger??i;(0,Q.useEffect)(()=>{if(e.focusTrigger===void 0)return n(wc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{a(e=>e+1)})},[n,e.focusTrigger]);let s=Nw({mode:`onChange`,defaultValues:t?.customScopeValues??{}}),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)((e,t)=>e==null?t?[]:void 0:Array.isArray(e)?t?e:e[0]:t?[e]:e,[]),u=(0,Q.useMemo)(()=>t?.customScopeFields?[...t.customScopeFields].sort((e,t)=>(e.position??999)-(t.position??999)):[],[t?.customScopeFields]),d=(0,Q.useMemo)(()=>{let e=new Map;if(!r)return e;for(let t of u){let n=A7(r,t);n&&e.set(t.fieldIdentifier,n)}return e},[u,r]);(0,Q.useEffect)(()=>{if(t?.customScopeValues){c.current=!0;for(let e of t.customScopeFields){let n=e.fieldIdentifier,r=t.customScopeValues[n],i=s.getValues(n),a=d.get(n)?.schema,o=a?me(a)===_u.ARRAY:Array.isArray(r),c=l(r??null,o);JSON.stringify(i)!==JSON.stringify(c)&&s.setValue(n,c)}queueMicrotask(()=>{c.current=!1})}},[t?.customScopeValues,t?.customScopeFields,s,l,d]);let f=(0,Q.useMemo)(()=>{let e=new Set;for(let t of u)e.add(t.resourceType);return Array.from(e)},[u]),{tResourceHeader:p}=K({component:B.APPLICATION_LEVEL_QUICK_SWITCHER,resource:f}),m=(0,Q.useMemo)(()=>u.map(e=>e.fieldIdentifier),[u]),h=zC({control:s.control,name:m});(0,Q.useEffect)(()=>{c.current||m.forEach((e,n)=>{let r=h[n],i=t?.customScopeValues[e],a=d.get(e)?.schema,o=a?me(a)===_u.ARRAY:!1,s;if(r===void 0||r===``||r===null)s=null;else if(o){let e=Array.isArray(r)?r.filter(e=>typeof e==`string`&&e.length>0):[String(r)];s=e.length>0?e:null}else s=Array.isArray(r)?r[0]??null:String(r);JSON.stringify(s)!==JSON.stringify(i??null)&&t?.setScopeValue(e,s,{initiator:At.USER_SELECTION})})},[h,m,t,u,d]);let g=(0,Q.useCallback)(e=>{let n=e.dependsOn?t?.allScopeValues?.[e.dependsOn]:null;return e.dependsOn?Array.isArray(n)?n.length===0:!n:!1},[t?.allScopeValues]);return{fields:(0,Q.useMemo)(()=>u.flatMap(e=>{let t=e.fieldIdentifier,n=d.get(t);if(!n)return ya.isDevelopment()&&console.warn(`[QuickSwitcher] No schema found for scope field "${t}" — field will not render.`),[];let{schema:r,isPrimaryKeyFallback:i}=n,a=me(r)===_u.ARRAY,o=a?ja(r)??r:r,c=me(o),l=Po(o)||i?c2.RESOURCE_REFERENCE:c===_u.ENUM?c2.ENUM:c2.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??Ul,presentation:e.presentation??Gp.CONTROL_ONLY,onClear:()=>s.setValue(t,a?[]:void 0,{shouldDirty:!0,shouldTouch:!0}),hasValue:(()=>{let e=s.getValues(t);return Array.isArray(e)?e.length>0:e!=null&&e!==``})(),definition:e}]}),[u,d,p,g,s,h]),formMethods:s,layoutDirection:(0,Q.useMemo)(()=>e.containerType===Fr.SIDEBAR?`vertical`:`horizontal`,[e.containerType]),focusTrigger:o}}function M7(e=al.BOTTOM){let{UIConfig:t,appComponentsConfiguration:n,shellAppearance:r}=Rg(),{tComponent:i}=K({component:B.APPLICATION_LEVEL_STATUS_BAR}),{status:a}=sp(),{notifications:o}=Mm(),s=n?.[Fr.STATUS_BAR],c=t?.currentBreakpoint,l=o2(s)?s:void 0,u=l?.showConnectionStatus??!0,d=l?.showConnectionStatusOnMobile??!1,f=l?.showNotificationCount??!0,p=l?.showMemoryUsage??!1,m=(0,Q.useMemo)(()=>f?o.length:0,[f,o.length]),h=(0,Q.useMemo)(()=>(l?.statusItems??[]).map(e=>{let t=e.value==null?void 0:String(e.value);switch(e.type){case $i.LINK:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:l2.LINK,href:e.href}};case $i.BUTTON:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:l2.BUTTON,onClick:e.onClick}};case $i.TEXT:default:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:l2.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===xl.MOBILE;return{height:l?.height??(e?28:32)}},[c,l]),v=(0,Q.useMemo)(()=>{let t=e===al.TOP,n=e===al.BOTTOM,i=c===xl.MOBILE,a=r===Xo.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===xl.MOBILE;return u&&(!e||d)},[c,u,d]),b=f&&m>0,x=(0,Q.useMemo)(()=>!p||typeof performance>`u`||!(`memory`in performance)?null:`${Math.round((performance.memory?.usedJSHeapSize??0)/1048576)}MB`,[p]),S=(0,Q.useMemo)(()=>Jt(m),[m]);return{totalBadgeCount:m,connectionStatus:a,showConnectionStatus:u,showConnectionStatusOnMobile:d,shouldShowConnectionStatus:y,showNotificationCount:f,shouldShowNotificationCount:b,showMemoryUsage:p,memoryUsageLabel:x,notificationCountLabel:S,notificationCountAriaLabel:(0,Q.useMemo)(()=>i(B.APPLICATION_LEVEL_STATUS_BAR,`notificationCount`,{count:S}),[S,i]),connectionStatusLabel:(0,Q.useMemo)(()=>{switch(a){case Xp.CONNECTED:return i(B.APPLICATION_LEVEL_STATUS_BAR,`connected`);case Xp.CONNECTING:case Xp.RECONNECTING:return i(B.APPLICATION_LEVEL_STATUS_BAR,`reconnecting`);case Xp.DISCONNECTED:case Xp.ERROR:default:return i(B.APPLICATION_LEVEL_STATUS_BAR,`disconnected`)}},[a,i]),statusItems:h,dimensions:_,statusBarConfig:v,authoredAppearance:g,currentBreakpoint:c}}function jAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N7(){let{UIConfig:e,appComponentsConfiguration:t}=Rg(),n=F$(),{navigate:r}=wS(),i=gS(),a=t?.[Fr.TOOLBAR],o=e?.currentBreakpoint,s=o===xl.MOBILE,c=jAe(a)?a:void 0,l=(0,Q.useMemo)(()=>nue(c?.tools,i),[c?.tools,i]),u=(0,Q.useMemo)(()=>!l?.length||!n?[]:Hm(l,n),[l,n]),d=(0,Q.useMemo)(()=>u.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,iconOnly:e.iconOnly,onClick:()=>zm.dispatchNavigationForResolvedTarget(r,e,Fr.TOOLBAR)})),[u,r]),f=(0,Q.useMemo)(()=>({placement:c?.placement??`top`,compact:c?.compact??!1,showSeparator:c?.showSeparator??!0,hideOnMobile:c?.hideOnMobile??!1}),[c]);return{tools:d,toolbarConfig:f,shouldRender:d.length>0&&!(s&&f.hideOnMobile),currentBreakpoint:o}}function P7(e){return No.isRegistered(e,q.DEFAULT)}function F7(e,t,n=P7){return e.map(e=>{if(e.kind===mu.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:mu.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:mu.CUSTOM_COMPONENT,componentRef:e.componentRef,resolvedComponentRef:r?e.componentRef:null,icon:e.icon,label:e.label}})}function I7(e){if(e)return pr.map(t=>`${t}:${e.zones[t].stack.map(e=>e.id).join(`,`)}#${e.zones[t].activeTabId??``}`).join(`|`)}function L7(e=Zc.END,t){let{UIConfig:n,appComponentsConfiguration:r,flowsActorsViews:i}=Rg(),[a,o]=(0,Q.useState)(!1),s=I7((0,Q.useContext)(dh)?.state),c=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{a?c.current===void 0?c.current=s:s!==c.current&&o(!1):c.current=void 0},[a,s]);let l=n?.currentBreakpoint,u=r?.[Fr.UTILITY_PANEL],d=s2(u)?u:void 0,f=(0,Q.useMemo)(()=>F7(t??d?.items??[],i?.map(e=>e.ref)??[]),[d,t,i]),p=(0,Q.useMemo)(()=>d?.position??e,[d,e]),m=f.length===1?f[0]:void 0,h=m?.kind===mu.VIEW?KY(m.viewRef):void 0,g=(0,Q.useMemo)(()=>h?[GY({family:iu.FLOWS_ACTORS,translationRef:h})]:[],[h]),{tComponent:_,tView:v,isReady:y}=K({component:B.APPLICATION_LEVEL_UTILITY_PANEL,keys:g}),b=h?v(iu.FLOWS_ACTORS,h,`title`):m?.kind===mu.CUSTOM_COMPONENT?m.label:gp({tComponent:_,componentType:B.APPLICATION_LEVEL_UTILITY_PANEL,key:`title`}),x=d?.icon??(f.length===1?f[0].icon:void 0);return{isOpen:a,setIsOpen:o,items:f,itemCount:f.length,position:p,triggerIcon:x,panelName:b,isPanelNameReady:y,currentBreakpoint:l}}function MAe(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function R7(e=Zc.END,t=[]){let{UIConfig:n,appComponentsConfiguration:r}=Rg(),i=F$(),{navigate:a}=wS(),{tComponent:o}=K({component:B.APPLICATION_LEVEL_CONTROL_PANEL}),s=gS(),[c,l]=(0,Q.useState)(!1),u=n?.currentBreakpoint,d=r?.[Fr.CONTROL_PANEL],f=typeof d==`object`&&d?d.items:void 0,p=(0,Q.useMemo)(()=>rue(f,s),[f,s]),m=(0,Q.useMemo)(()=>!p||!i?[]:jm(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 u2.BUTTON:return{id:e.id,label:e.label,type:u2.BUTTON,disabled:t,onTrigger:()=>e.onChange?.(!0)};case u2.TOGGLE:{let n=e.value===!0;return{id:e.id,label:e.label,type:u2.TOGGLE,disabled:t,value:n,onToggle:()=>e.onChange?.(!n)}}case u2.SELECT:return{id:e.id,label:e.label,type:u2.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 u2.SLIDER:{let n=e.min??0,r=e.max??100,i=e.step??1,a=MAe(e.value,n);return{id:e.id,label:e.label,type:u2.SLIDER,disabled:t,value:a,min:n,max:r,step:i,onValueChange:t=>e.onChange?.(t)}}}}),[t]);return{isOpen:c,setIsOpen:l,groupedItems:h,sections:(0,Q.useMemo)(()=>Object.entries(h).filter(([,e])=>e.length>0).map(([e,t])=>({id:e,label:e===`uncategorized`?o(B.APPLICATION_LEVEL_CONTROL_PANEL,`actions`):o(B.APPLICATION_LEVEL_CONTROL_PANEL,e),items:t})),[h,o]),controls:g,handleItemClick:(0,Q.useCallback)(e=>{l(!1),zm.dispatchNavigationForResolvedTarget(a,e,Fr.CONTROL_PANEL)},[a]),sheetSide:(0,Q.useMemo)(()=>{let t=e;return t===Zc.START?Zs.START:t===Zc.END?Zs.END:t===al.TOP?Zs.TOP:t===al.BOTTOM?Zs.BOTTOM:Zs.END},[e]),isNavigationLoading:!i,navigationItemCount:m.length,currentBreakpoint:u}}function z7(e,t,n,r){let i=B.APPLICATION_LEVEL_NOTIFICATION_CENTER,a=e(i,t,r);return a===`components.${i}.${t}`?n??a:a}function NAe(e,t,n,r){let i=t-e,a=Math.floor(i/6e4),o=Math.floor(i/36e5),s=Math.floor(i/864e5);return a<1?z7(n,`timeJustNow`):a<60?z7(n,`timeMinutesAgo`,void 0,{count:a}):o<24?z7(n,`timeHoursAgo`,void 0,{count:o}):s<7?z7(n,`timeDaysAgo`,void 0,{count:s}):r(e)}function PAe(e){switch(e){case`success`:return H.CHECK_CIRCLE;case`warning`:return H.WARNING;case`error`:return H.X_CIRCLE;default:return H.INFO}}function B7(e,t,n={}){let{notifications:r,clearAll:i,removeNotification:a}=Mm(),{on:o}=Ao(),{tComponent:s,formatDate:c}=K({component:B.APPLICATION_LEVEL_NOTIFICATION_CENTER}),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(()=>Date.now()),p=n.listenForHotkeys!==!1,m=e!==void 0&&t!==void 0,h=m?e:l,g=(0,Q.useRef)(h);g.current=h;let _=(0,Q.useCallback)(e=>{m&&t?t(e):u(e)},[m,t]);(0,Q.useEffect)(()=>{if(p)return o(wc.HOTKEY_NOTIFICATIONS_OPEN,()=>{_(!g.current)})},[o,p,_]),(0,Q.useEffect)(()=>{let e=globalThis.setInterval(()=>{f(Date.now())},6e4);return()=>globalThis.clearInterval(e)},[]);let v=(0,Q.useMemo)(()=>r.map(e=>{let t=``,n=e.message;return e.source===`resource`&&e.resourceContext?(t=z7(s,`resourceNotificationTitle`,e.resourceContext.resourceType,{resourceType:e.resourceContext.resourceType}),n||=z7(s,`resourceNotificationMessage`,e.resourceContext.operationIdentifier,{operation:e.resourceContext.operationIdentifier})):e.source===`custom`&&e.identifier&&(t=``),!t&&n&&(t=n,n=``),!t&&e.identifier&&(t=e.identifier),t||=s(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`title`),{id:e.id,type:e.type,source:e.source,timestamp:e.timestamp,displayTitle:t,displayMessage:n,relativeTimeLabel:NAe(e.timestamp,d,s,c),iconReference:PAe(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 FAe=[Fn.NAVIGATION,Fn.ACTIONS],V7=0,IAe=1e3,LAe=300,RAe=2,zAe=5,H7=rs.getLogger(),BAe={[W.CREATE]:`keywordsCreate`,[W.CREATE_MANY]:`keywordsCreate`,[W.LIST]:`keywordsList`,[W.SEARCH]:`keywordsSearch`,[W.READ]:`keywordsRead`,[W.UPDATE]:`keywordsUpdate`,[W.UPDATE_MANY]:`keywordsUpdate`,[W.DELETE]:`keywordsDelete`,[W.DELETE_MANY]:`keywordsDelete`};function U7(e,t){let n=B.APPLICATION_LEVEL_COMMAND_MENU,r=`components.${n}.${t}`,i=e(n,t);return!i||i===r?[]:i.split(`,`).map(e=>e.trim()).filter(Boolean)}function VAe(e,t){if(!t)return[];let n=_l(t),r=n?BAe[n]:void 0;return r?U7(e,r):[]}function W7(e,t,n){return Pie(n)?t(B.APPLICATION_LEVEL_COMMAND_MENU,n):e(`${oi.COMMAND_CATEGORIES}.${n}.label`)}function G7(e,t,n){return n.category===void 0?e(`${oi.RESOURCES}.${n.resourceType}.header.title`):W7(e,t,n.category)}function HAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K7(e,t,n={}){let r=F$(),{navigate:i,navigateToResource:a}=wS(),{registry:o,doOperation:s}=lm(),c=Jp(),{appComponentsConfiguration:l,suppressedEngineNavigationEntries:u}=Rg(),{on:d,emit:f}=Ao(),{register:p}=j$(),{t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({component:B.APPLICATION_LEVEL_COMMAND_MENU}),v=l?.[Fr.COMMAND_MENU],y=HAe(v)?v:void 0,b=y?.openShortcut,x=y?.showRecent!==!1,S=y?.maxRecentItems??5,C=y?.showShortcuts!==!1,w=y?.defaultCategory??Fn.NAVIGATION,T=y?.categoryOrder??FAe,E=y?.policy===hm.OMNIBOX,D=y?.searchResources,k=y?.dialogWidth,A=gS(),j=(0,Q.useContext)(Fi)?.appConfig?.decisionInbox,M=(0,Q.useMemo)(()=>eue(DAe(TAe(y?.commands,j),u),A),[y?.commands,j,u,A]),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(``),[ee,L]=(0,Q.useState)([]),R=e!==void 0&&t!==void 0,z=R?e:N,te=(0,Q.useRef)(z);te.current=z;let ne=n.listenForHotkeys!==!1,re=(0,Q.useCallback)(e=>{R&&t?t(e):P(e),e||I(``)},[R,t]);(0,Q.useEffect)(()=>{if(ne)return d(wc.HOTKEY_COMMAND_MENU_OPEN,()=>{re(!te.current)})},[d,re,ne]),(0,Q.useEffect)(()=>{if(ne&&b&&v!==!1)return p({id:`app-command-menu-open-shortcut`,shortcut:b,description:m(`engine.hotkeys.commandMenuOpen`),scope:cd.GLOBAL,group:yi.NAVIGATION,launcher:Fr.COMMAND_MENU,preventDefault:!0,handler:()=>{f(wc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[b,v,p,f,m,ne]);let ie=(0,Q.useMemo)(()=>!M||!r?[]:Mh(M,r),[M,r]),ae=(0,Q.useMemo)(()=>ie.filter(e=>{let t=e.displayPolicy;return t===void 0||t===Mt.ALWAYS?!0:t===Mt.NEVER?!1:t===Mt.RECENT?!0:t===Mt.CONTEXTUAL?(ya.isDevelopment()&&console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for "${e.id}"`),!1):(ya.isDevelopment()&&console.warn(`[CommandMenu] Unknown displayPolicy "${t}" for command "${e.id}" — treating as ALWAYS`),!0)}).map(e=>({id:e.id,label:e.label,shortcut:e.shortcut??``,iconReference:e.iconReference,category:e.category??w,keywords:[...VAe(h,e.operation),...e.searchKeywords??[]],displayPolicy:e.displayPolicy,onExecute:()=>{re(!1),L(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,S)),e.urlPath&&zm.dispatchNavigationForResolvedTarget(i,e,Fr.COMMAND_MENU)}})),[ie,re,i,S,w,h]),oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of ae){if(t.displayPolicy===Mt.RECENT)continue;let n=t.category,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>e.label.localeCompare(t.label));let t=[];for(let n of T){let r=e.get(n);r&&(t.push({category:n,label:W7(m,h,n),items:r}),e.delete(n))}for(let[n,r]of e.entries())t.push({category:n,label:W7(m,h,n),items:r});return t},[ae,T,m,h]),se=(0,Q.useMemo)(()=>{if(ee.length===0)return[];let e=new Map(ae.map(e=>[e.id,e]));return ee.map(t=>e.get(t)).filter(Boolean)},[ae,ee]),[ce,le]=(0,Q.useState)([]),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(s);fe.current=s;let pe=(0,Q.useRef)(o);pe.current=o;let me=(0,Q.useRef)(c);me.current=c;let he=(0,Q.useRef)(a);he.current=a;let ge=(0,Q.useRef)(re);ge.current=re;let _e=(0,Q.useRef)(m);_e.current=m;let ve=(0,Q.useRef)(g);ve.current=g;let ye=(0,Q.useRef)(_);ye.current=_;let be=(0,Q.useRef)(h);be.current=h;let xe=(0,Q.useRef)(D);xe.current=D;let Se=(0,Q.useRef)(null),Ce=(0,Q.useCallback)(e=>{let t=me.current,n=Qp.buildInitiatorIds({userId:t?.currentUserId,organizationId:t?.currentOrganizationId,applicationId:t?.currentApplicationId,anonymousUserId:t?.currentAnonymousUserId});return{...Qp.primaryScopeToContextIdentifiers(n,e),...t?.buildContextResourceIdentifiers()??{}}},[]),we=(0,Q.useCallback)((e,t)=>{let n=pe.current,r=n.resourceConfigurations[e];if(!r)return;let i=$l(r.operations??[],W.READ);if(!i){H7.warn(`[CommandMenu] Omnibox result has no addressable READ operation`,{resourceType:e,recordId:t});return}let a=q7({scopeIdentifiers:Ce(r.resourcePrimaryScope),resourceType:e,recordId:t,registry:n}),o=On.buildParentResourcesRequirements(e,a,n),s=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:i,contextResourceIdentifiers:a,parentResourcesRequirements:o});ge.current(!1),he.current(s,zm.createAppLevelInitiator(Fr.COMMAND_MENU))},[Ce]),Te=(0,Q.useMemo)(()=>JSON.stringify(D??[]),[D]),Ee=E&&!!D&&D.length>0;(0,Q.useEffect)(()=>{if(Se.current&&=(clearTimeout(Se.current),null),!z||!Ee||F.trim().length<RAe){le([]),de(!1);return}let e=!1,t=F.trim();de(!0);let n=async()=>{let n=pe.current,r=xe.current??[],i=await Promise.all(r.map(async e=>{let r=n.resourceConfigurations[e.resourceType];if(!r)return H7.warn(`[CommandMenu] Omnibox searchResource not in registry — skipped`,{resourceType:e.resourceType}),null;let i;try{i=V.buildForeignKeySearchOperationPath(e.resourceType,n)}catch{return H7.warn(`[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped`,{resourceType:e.resourceType}),null}let a=V.buildForeignKeySearchParams(t,e.maxResults??zAe,{resourceType:e.resourceType,registry:n}),o;try{o=await fe.current(i,{contextualParameters:Ce(r.resourcePrimaryScope),queryParameters:a.queryParameters,dataMode:a.dataMode})}catch(t){return H7.error(`[CommandMenu] Omnibox search failed`,{resourceType:e.resourceType,...O(t),error:t}),null}let s=[];if(Array.isArray(o))s=o;else if(o&&typeof o==`object`){let e=o;s=e.data??e.items??[]}if(s.length===0)return null;let c=V.getResourceFieldIdentifierForType(e.resourceType,n),l=e.category??e.resourceType,u=e.resultDisplay===tt.LABEL||e.resultDisplay===tt.ID?tt.LABEL:tt.SUMMARY,d=[t,...U7(be.current,`keywordsSearch`),...e.searchKeywords??[]],f=s.flatMap(t=>{let r=V.getResourceObjectId(t,c);if(!r)return[];let i=V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:n,currentObject:t,t:_e.current,formatDate:ve.current,formatDateTime:ye.current})??r;return[{id:`omnibox:${e.resourceType}:${r}`,resourceType:e.resourceType,record:t,label:i,keywords:d,onExecute:()=>we(e.resourceType,r)}]});return f.length===0?null:{category:l,label:G7(_e.current,be.current,e),displayMode:u,items:f}}));e||(le(i.filter(e=>e!==null)),de(!1))};return Se.current=setTimeout(()=>{n()},LAe),()=>{e=!0,Se.current&&=(clearTimeout(Se.current),null)}},[z,F,Ee,Te,Ce,we]);let De=(0,Q.useMemo)(()=>{let e=new Map;return(D??[]).forEach((t,n)=>{let r=t.category??t.resourceType;e.set(r,t.order??V7+n)}),e},[D]),Oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of D??[])e.set(t.category??t.resourceType,t);return e},[D]),ke=(0,Q.useMemo)(()=>ce.map(e=>{let t=Oe.get(e.category);return t?{...e,label:G7(m,h,t)}:e}),[ce,Oe,m,h]);return{isOpen:z,handleOpenChange:re,searchQuery:F,setSearchQuery:I,commandItems:ae,groupedItems:oe,recentItems:se,searchResultGroups:ke,orderedGroups:(0,Q.useMemo)(()=>{let e=[];return ke.forEach((t,n)=>{e.push({kind:d2.RECORDS,order:De.get(t.category)??V7+n,group:t})}),oe.forEach((t,n)=>{e.push({kind:d2.COMMANDS,order:IAe+n,group:t})}),e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)},[ke,oe,De]),isSearching:ue,isNavigationLoading:!r,showRecent:x,showShortcuts:C,openShortcut:b,authoredDialogWidth:k}}function q7(e){return{...Im({hostIdentifiers:e.scopeIdentifiers,hostContextualParameters:{},targetResourceType:e.resourceType,targetId:e.recordId,registry:e.registry}).identifiers,[e.resourceType]:e.recordId}}function UAe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J7(){let{UIConfig:e,appComponentsConfiguration:t}=Rg(),n=F$(),{navigate:r}=wS(),i=gS(),a=t?.[Fr.QUICK_ACTION_BUTTON],o=UAe(a)?a:void 0,s=(0,Q.useMemo)(()=>tue(o?.actions,i),[o?.actions,i]),c=(0,Q.useMemo)(()=>!s?.length||!n?[]:Xm(s,n),[s,n]),l=(0,Q.useMemo)(()=>c.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,displayPolicy:e.displayPolicy,onClick:()=>zm.dispatchNavigationForResolvedTarget(r,e,Fr.QUICK_ACTION_BUTTON)})),[c,r]),{primaryAction:u,menuActions:d}=(0,Q.useMemo)(()=>({primaryAction:l.find(e=>e.displayPolicy===he.PRIMARY)??null,menuActions:l.filter(e=>e.displayPolicy!==he.PRIMARY)}),[l]),[f,p]=(0,Q.useState)(!1);return{allItems:l,primaryAction:u,menuActions:d,isOpen:f,setIsOpen:p,handleActionClick:(0,Q.useCallback)(e=>{p(!1),e.onClick()},[]),hasActions:!!s?.length,isNavigationLoading:!!s?.length&&n===null,currentBreakpoint:e?.currentBreakpoint}}function WAe(e){let{registry:t,doOperation:n}=lm(),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?.[ll.ORGANIZATIONS]?.operations.find(e=>e.operationIdentifier===W.SEARCH&&e.variantType===at.API_CALL&&e.variantKey===kee.MINE);return e?Ca.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:ll.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;rs.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 GAe(e){let{httpClient:t}=Tu(),[n,r]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(!e){r(null);return}let n=!1,i=null,a=new AbortController;return t.fetchFileBlob(e,{signal:a.signal}).then(e=>{n||(i=URL.createObjectURL(e),r(i))}).catch(()=>{n||r(null)}),()=>{n=!0,a.abort(),i&&URL.revokeObjectURL(i)}},[e,t]),n}var Y7=Object.freeze([]);function KAe(e){return typeof e==`object`&&!!e}var X7=[ip.USER_INFO,ip.ORG_SWITCHER,ip.SETTINGS,ip.LOGOUT];function Z7(e,t){let{appComponentsConfiguration:n}=Rg(),{user:r,organizations:i,getCurrentOrganization:a,setCurrentOrganization:o,logout:s,isAuthenticated:c,permissions:l}=sg(),{registry:u}=lm(),d=F$(),f=nh(),p=gS(),[m,h]=(0,Q.useState)(!1),g=n?.[Fr.USER_DROPDOWN],_=(0,Q.useMemo)(()=>{let e=KAe(g)?g:void 0;if(e)return{avatarDisplay:e.avatarDisplay??Np.AVATAR_ONLY,sections:e.sections??X7,showOrgSwitcher:e.showOrgSwitcher??!0,showLogout:e.showLogout??!0,settingsEntries:e.settingsEntries??Y7}},[g]),v=a(),y=_?.sections??X7,b=_?.avatarDisplay??Np.AVATAR_ONLY,x=_?.showOrgSwitcher!==!1,S=_?.showLogout!==!1,C=_?.settingsEntries??Y7;p.activeMode,p.availableModes,p.allScopeValues;let w=(0,Q.useMemo)(()=>e===Fr.MENUBAR?t===Zc.END?{align:Rr.END,side:Zs.BOTTOM}:{align:Rr.START,side:Zs.BOTTOM}:e===Fr.SIDEBAR?t===al.BOTTOM?{align:Rr.END,side:Zs.END}:{align:Rr.START,side:Zs.END}:{align:Rr.END,side:Zs.BOTTOM},[e,t]),T=(0,Q.useMemo)(()=>d?C.flatMap(e=>{let t=Wm({kind:mu.SETTINGS_SECTION,sectionRef:e},d);return t?[t]:[]}):[],[d,C]),E=(0,Q.useMemo)(()=>d?Wm({kind:mu.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 kh(l?.accessProfile).filter(t=>!e.has(t)).length},[i,l?.accessProfile]),j=WAe(m&&A>0),M=(0,Q.useCallback)(()=>{h(!1),s()},[s]),N=(0,Q.useCallback)(e=>{h(!1),o(e)},[o]),P=(0,Q.useCallback)(e=>{h(!1),f(e.urlPath||Ln.settings)},[f]),F=D?.avatar,I=GAe((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?.[ll.USER_SELF_PROFILES],a=V.resolveSingleResourceReadOperation(ll.USER_SELF_PROFILES,u);if(!i||!a)return null;let o={[ll.USER_SELF]:e},s=nH({registry:u,resourceConfig:i,operation:a,resourceType:ll.USER_SELF_PROFILES,fieldName:`avatar`,recordId:t,contextResourceIdentifiers:o,contextualParameters:V.buildContextualParameters(o,u),apiBaseUrl:ya.getApiUrl()});return s?iH(`${s}/${encodeURIComponent(n)}`):null},[u,r,D,F?.fileId]))??void 0,ee=r?.email??``,L=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r?.organizationMembers??[]){if(!Tl(t))continue;let n=t.representingOrganizationName;typeof n==`string`&&n.length>0&&e.set(String(t.organizationId),n)}return e},[r?.organizationMembers]);return{isOpen:m,setIsOpen:h,isUserAuthenticated:c()&&!!r,userInitials:O,displayName:k,email:ee,avatarUrl:I,currentOrganization:v?{_id:v._id,name:v.name}:void 0,organizations:(i??[]).map(e=>{let t=L.get(String(e._id));return{_id:e._id,name:e.name,...t?{viaOrganizationName:t}:{}}}),unlistedOrganizationCount:A,organizationSearchQuery:j.query,setOrganizationSearchQuery:j.setQuery,organizationSearchResults:j.results,isSearchingOrganizations:j.isSearching,organizationSearchFailed:j.failed,sections:y,avatarDisplay:b,showOrgSwitcher:x,showLogout:S,settingsTarget:E,settingsTargets:T,popupAlignment:w,handleLogout:M,handleSwitchOrg:N,handleNavigateToSettingsTarget:P}}function qAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_COMMAND_MENU,`ApplicationLevel_CommandMenu`)(e);return(0,$.jsx)(n,{...t})}function JAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_CONTROL_PANEL,`ApplicationLevel_ControlPanel`)(e);return(0,$.jsx)(n,{...t})}function YAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_USER_DROPDOWN,`ApplicationLevel_MenuUserOrg`)(e);return(0,$.jsx)(n,{...t})}function XAe(e){return e.tResourceEmptyState(e.resourceType,`title`)||e.tComponent(B.RESOURCES_LAYOUTS_LIST,`noItems`)}var Q7=rs.getLogger(),$7=Q7.debugByType(`sidebar-resource-browser`);Q7.setDebugTypeLogging(`sidebar-resource-browser`,!1);var ZAe=[B.APPLICATION_LEVEL_SIDEBAR,B.RESOURCES_LAYOUTS_LIST],e9=({resourceType:e,operation:t,operationVariant:n,navigateOperation:r,navigateOperationVariant:i,instanceFilter:a,onInstanceClick:o,isCollapsed:s=!1})=>{let{registry:c,doOperation:l}=lm(),{navigateToResource:u}=wS(),d=Jp(),{tResourceHeader:f,tResourceEmptyState:p,t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({resource:e,component:ZAe}),v=ap(),{renderIcon:y}=Of(),[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 sh(k,t??W.LIST,n)},[k,t,n]),j=(0,Q.useMemo)(()=>{if(k)return r?sh(k,r,i):t&&t!==W.LIST?sh(k,t,n):sh(k,W.READ)??A},[k,r,i,t,n,A]),M=(0,Q.useMemo)(()=>{if(!k)return{};let e=Qp.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId});return{...Qp.primaryScopeToContextIdentifiers(e,k.resourcePrimaryScope),...d?.buildContextResourceIdentifiers()??{}}},[k,d?.currentUserId,d?.currentOrganizationId,d?.currentApplicationId,d?.currentAnonymousUserId,d]),N=(0,Q.useMemo)(()=>A?Ca.createOperationPathKeyFromOperation(A):null,[A]);(0,Q.useEffect)(()=>{if(D(!!k&&!N),!N||!k){if(x([]),k&&!N){let r=`Sidebar resource browser cannot resolve operation "${t??W.LIST}" on resource "${e}".`;T(null),Q7.warn(r,{resourceType:e,operationIdentifier:t??W.LIST,operationVariant:n})}else k||Q7.warn(`Sidebar resource browser: resource type "${e}" is not registered.`,{resourceType:e}),T(null);C(!1);return}let r=!1;return(async()=>{C(!0),T(null);try{$7(`Fetching resource instances`,{resourceType:e,operationPathKey:N});let t=await O.current(N,{contextualParameters:M,queryParameters:{limit:100}});if(r)return;let n=Array.isArray(t)?t:t?.data??[];x(n),$7(`Fetched instances`,{count:n.length})}catch(t){if(r)return;T(v(t)),Q7.error(`SidebarResourceBrowser fetch failed`,{resourceType:e,error:t})}finally{r||C(!1)}})(),()=>{r=!0}},[N,e,k,M,t,n]);let P=(0,Q.useMemo)(()=>a?b.filter(a):b,[b,a]),F=(0,Q.useMemo)(()=>Up({tResourceHeader:f,resourceType:e,key:`title`}),[e,f]),I=(0,Q.useCallback)(t=>{let n=t.id??t._id??``;if(o)o({resourceType:e,instanceId:n,instanceData:t});else if(k&&j){let t={...M,[e]:n},r=On.buildParentResourcesRequirements(e,t,c),i=On.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:j,contextResourceIdentifiers:t,parentResourcesRequirements:r});u(i,zm.createAppLevelInitiator(Fr.SIDEBAR))}else Q7.warn(`SidebarResourceBrowser navigation skipped: no navigation operation resolved`,{resourceType:e,fetchOperationIdentifier:A?.operationIdentifier,navigationOperationIdentifier:r??W.READ,navigationOperationVariant:i,instanceId:n})},[e,o,k,j,r,i,M,c,u,A]),ee=(0,Q.useCallback)(t=>V.computeFrontendResourceLabel({resourceType:e,registry:c,currentObject:t,t:m,formatDate:g,formatDateTime:_})??String(t._id??``),[e,c,m,g,_]),L=(0,Q.useMemo)(()=>y({category:re.RESOURCES,resourceType:e},{size:ca.SM}),[y,e]),R=(0,Q.useMemo)(()=>A?[dg({resourceType:e,operation:A.operationIdentifier})]:[],[e,A]),z=(0,Q.useMemo)(()=>[`resources.${e}`],[e]),te=(0,Q.useCallback)(()=>(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs space-y-item-xs`,role:`status`,"aria-live":`polite`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`animate-pulse motion-reduce:animate-none h-7 bg-surface-sunken-accent rounded`,"aria-hidden":`true`},e))}),[]);if(!k)return(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:h(B.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`)});let ne=E||w?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:E?h(B.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`):w}):P.length===0?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-muted-foreground`,children:XAe({resourceType:e,tResourceEmptyState:p,tComponent:h})}):s?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-item-xs py-item-xs`,children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:P.length})]}):(0,$.jsx)(`div`,{className:`space-y-item-xs`,role:`listbox`,"aria-label":F,children:P.map((e,t)=>{let n=ee(e);e.id??e._id;let r=e.id??e._id??`sidebar-resource-${t}`;return(0,$.jsxs)(`button`,{type:`button`,role:`option`,onClick:()=>I(e),className:U(`w-full text-start px-card-sm py-item-xs text-sm rounded-sm hover:bg-surface-sunken-accent/50 transition-colors flex items-center gap-field-sm min-h-7`,Mg(a_.INSET)),children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:n})]},String(r))})});return(0,$.jsx)(nb,{i18nKeys:z,loadingScopes:R,readiness:[{id:`sidebar-resource-browser-data`,isReady:!S||w!==null}],renderLoading:te,children:ne})};function QAe({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_NOTIFICATION_CENTER,`ApplicationLevel_NotificationCenter`)(e);return(0,$.jsx)(n,{...t})}function $Ae({preset:e=q.DEFAULT,...t}){let n=G(B.APPLICATION_LEVEL_QUICK_SWITCHER,`ApplicationLevel_QuickSwitcher`)(e);return(0,$.jsx)(n,{...t})}var t9=({resourceContext:e})=>{let{registry:t,doOperation:n}=lm(),{resourceContext:r,navigationZone:i,navigationInitiator:a,resourceType:o,contextualParameters:s,reportError:c,navigateToPreferredRead:l,goBackWithinZone:u}=oC(),{closeOverlay:d}=wS(),{makeTrComponent:f,isReady:p}=K({component:B.RESOURCES_LAYOUTS_CREATE}),m=f(B.RESOURCES_LAYOUTS_CREATE),h=ap(),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=Ca.createOperationPathKey({resourceIdentifier:o,operationIdentifier:oo.DISCOVER_ENDPOINTS,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),i=await n(t,{contextualParameters:s,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{metadataUrl:e}}),a=(i.x509Certificates??[]).join(`
46
- `);w({protocol:_ne.SAML,displayName:i.entityId?.split(`/`).pop()??`SAML Connection`,saml:{entityId:i.entityId,ssoUrl:i.ssoUrl,sloUrl:i.sloUrl,nameIdFormat:i.nameIdFormat,x509CertificatePem:a}})}catch(e){S(h(e))}finally{b(!1)}}},[s,r.parentResourcesRequirements,n,_,o,h,m]),E=(0,Q.useCallback)(e=>{if(g){i===rr.OVERLAY?d():u();return}let n=qz({result:e,resourceType:o,registry:t});n&&l({contextResourceIdentifiers:On.buildRecordIdentifiersFromCollection(r.contextResourceIdentifiers,o,n),fallbackToGoBack:!1})||u()},[d,r.contextResourceIdentifiers,u,g,l,i,t,o]),D=(0,Q.useCallback)(e=>{c(e,`Form submission failed`,`ResourceLayoutPreset_Create_SamlWizard`)},[c]);if(!p)return null;let O=m(`saml.import`);return(0,$.jsx)(bD,{voice:void 0,children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(uV,{resourceContext:r,navigationZone:i,navigationInitiator:a}),(0,$.jsxs)(ET,{className:`max-w-2xl`,children:[(0,$.jsx)(OT,{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)($M,{name:`saml-metadata-url`,schema:yd(),type:`url`,placeholder:m(`saml.metadataUrlPlaceholder`),value:_,onChange:e=>v(String(e)),className:`flex-1`}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:T,disabled:y,children:y?m(`saml.importing`):O})]}),x&&(0,$.jsx)(`p`,{className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:x}),C&&(0,$.jsx)(`p`,{className:`text-sm text-success-subtle-foreground mt-item-xs`,role:`status`,children:m(`saml.importSuccess`)})]}),(0,$.jsx)(vB,{resourceContext:r,navigationZone:i,onSuccess:E,onError:D,onCancel:i===rr.OVERLAY?()=>d():void 0,showErrorSummary:!0,className:`max-w-2xl`,defaultValuesOverride:C})]})})};function eje({resourceContext:e}){let{resourceType:t,contextResourceIdentifiers:n}=e,{registry:r,doOperation:i}=lm(),{makeTrComponent:a,isReady:o}=K({component:B.RESOURCES_LAYOUTS_READ}),s=a(B.RESOURCES_LAYOUTS_READ),c=ap(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=n,m=p.organizations?On.getResourceId(p.organizations):void 0,h=p.applications?On.getResourceId(p.applications):void 0,g=m==null?Ys.APPLICATION:Ys.ORGANIZATION,_=String(m??h??``),v=(0,Q.useMemo)(()=>_?`${ya.getApiUrl()}/auth/saml/metadata/${g}/${_}`:null,[g,_]),y=(0,Q.useCallback)(async()=>{f(!0),u(null);try{let a=Ca.createOperationPathKey({resourceIdentifier:t,operationIdentifier:oo.TEST_CONNECTION,variantType:at.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),o=V.buildContextualParameters(n,r),s=p[t]?On.getResourceId(p[t]):``,c=await i(a,{contextualParameters:o,parentResourcesRequirements:e.parentResourcesRequirements,requestData:{connectionId:s}});u(c)}catch(e){u({overallStatus:`fail`,errors:[c(e)]})}finally{f(!1)}},[t,e.parentResourcesRequirements,n,r,i,p,c]);if(!o)return null;let b=s(`saml.testConnection`),x=s(`saml.downloadSpMetadata`);return(0,$.jsxs)(`div`,{className:`space-y-section max-w-4xl`,children:[(0,$.jsxs)(ET,{children:[(0,$.jsx)(OT,{children:s(`saml.samlTools`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-field`,children:[v&&(0,$.jsx)(X,{variant:J.OUTLINE,asChild:!0,children:(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,children:x})}),(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:y,disabled:d,children:d?s(`saml.testing`):b})]})]}),l&&(0,$.jsxs)(ET,{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)(OT,{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)(eje,{resourceContext:e.resourceContext})});function r9(e,t){return V.buildConfigurationError(ql.CONFIGURATION,{message:e,component:`useCompositeResourceOperationContextBuilder`,...t})}function tje(e){return`operationIdentifier`in e}function nje(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 rje(e,t,n,r,i){if(!e)throw r9(`Composite resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(tje(n)){let a=nje(e,t,n);if(Am({operation:a,resourceType:t,resourceConfig:e})&&a.isBulkOperation!==!0&&!Gh({resourceConfig:e,operation:a,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw r9(`Composite resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return a}let a=n.operationLike,o=a===W.READ||a===W.UPDATE||a===W.DELETE,s=n.requireAddressable||o?lh({resourceConfig:e,operations:e.operations??[],coreOperation:a,registry:r,hasResourceId:On.getResourceId(i[t]).length>0,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}):$l(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}=lm(),t=WU(),n=Jp();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=Qp.mergeContextResourceIdentifiers(void 0,n?.buildContextResourceIdentifiers()??{},o)??{},c=r.resourceId?{...Im({hostIdentifiers:r.contextResourceIdentifiers?n?.buildContextResourceIdentifiers()??{}:s,hostContextualParameters:{},hostRecord:{resourceType:r.resourceType,id:r.contextResourceIdentifiers?``:On.getResourceId(o?.[r.resourceType])},targetResourceType:r.resourceType,targetId:r.resourceId,registry:e}).identifiers,...r.contextResourceIdentifiers?o:{},[r.resourceType]:r.resourceId}:s,l=rje(i,r.resourceType,r,e,c),u=On.buildParentResourcesRequirements(r.resourceType,c,e,r.relationshipFieldOverrides);return On.createFrontendResourceOperationContextFromOperation({resourceType:r.resourceType,operation:l,contextResourceIdentifiers:c,additionalContext:r.additionalContext,parentResourcesRequirements:u})},[n,t?.contextResourceIdentifiers,e])}}function a9({childContext:e,inlineLimit:t,showViewAllLink:n,childResourceType:r,onViewAll:i}){let{registry:a,doOperation:o}=lm(),{t:s,formatDate:c,formatDateTime:l,tComponent:u,isReady:d}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:e.resourceType}),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(!0),[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(o);b.current=o;let x=t,S=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),C=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]);if((0,Q.useEffect)(()=>{if(x===0){_(!1);return}let t=!1;return(async()=>{_(!0),y(!1);let n=a.resourceConfigurations[r],i=V.buildContextualParameters(e.contextResourceIdentifiers,a),o=e.operation&&_l(e.operation)===W.LIST?e.operation:n?$l((n.operations??[]).filter(t=>fY(t,e,i)),W.LIST):void 0,s=e.pinnedFilters;if(s&&o&&o!==e.operation&&rs.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=Ca.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)($y,{size:20,className:`text-muted-foreground`})});if(v)return(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:u(B.RESOURCES_LAYOUTS_CONTAINER_NESTED,`previewLoadFailed`)});if(!d)return null;if(x===0){if(!n)return null;let e=gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAll`});return(0,$.jsx)(X,{variant:J.LINK,size:Y.SM,className:`px-0`,onClick:i,children:e})}if(f.length===0){let e=gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`emptyState`});return(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})}let w=m>x,T=gp({tComponent:u,componentType:B.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAllWithCount`,params:{total:m}});return(0,$.jsxs)(`div`,{className:`space-y-xs`,children:[(0,$.jsx)(`ul`,{className:`space-y-xs`,children:f.map((e,t)=>{let n=e._id??e.id??t,i=V.computeFrontendResourceLabel({resourceType:r,registry:a,currentObject:e,t:s,formatDate:c,formatDateTime:l})??String(n);return(0,$.jsx)(`li`,{className:`text-sm px-sm py-xs rounded-radius border border-border bg-card`,children:i},n)})}),n&&w&&(0,$.jsx)(X,{variant:J.LINK,size:Y.SM,className:`px-0`,onClick:i,children:T})]})}function ije({resourceType:e,limit:t,showViewAllLink:n=!0,viaForeignKey:r,className:i}){cY(e);let{buildOperationContext:a}=W6(),{navigationZone:o}=zU(),{navigate:s}=wS(),c=(0,Q.useMemo)(()=>a({resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:r}),[a,e,JSON.stringify(r??null)]);return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)(a9,{childContext:c,inlineLimit:t,showViewAllLink:n&&!(c.pinnedFilters&&Object.keys(c.pinnedFilters).length>0),childResourceType:e,onViewAll:()=>s({content:{contentType:od.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}=K({component:B.GUIDANCE_ONBOARDING_VIEW,keys:b});(0,Q.useEffect)(()=>{if(!_){let t=e.elements.map(e=>e.ref).join(`, `);console.warn(`[OnboardingView] Mounted with no persistable identity (ref="${g??`(none)`}", viewRef="${a??`(none)`}", elements=[${t}]). Dismiss, complete, and skip actions will only affect local component state and will NOT be persisted to the backend. To persist, either declare this onboarding view (by ref) in the app frontend config so it is registered, or pass the guidanceFlowRef prop matching a registered GuidanceFlowDefinition.`)}},[]);let w=(0,Q.useMemo)(()=>({...e.options,...t}),[e.options,t]),T=(0,Q.useMemo)(()=>[...e.elements].sort((e,t)=>e.order-t.order),[e.elements]),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)({status:Hr.IN_PROGRESS,elements:{},triggerCount:1}),A=T.length;(0,Q.useEffect)(()=>{D(0),k({status:Hr.IN_PROGRESS,elements:{},triggerCount:1})},[v]);let j=_?s[g]??O:O,M=(0,Q.useCallback)(e=>j?.elements?.[e],[j]),N=(0,Q.useMemo)(()=>j?.elements?Object.values(j.elements).filter(e=>e.status===Hr.COMPLETED).length:0,[j]),P=(0,Q.useCallback)((e,t,n)=>{let r=t===Hr.COMPLETED?new Date:void 0;k(i=>({...i,elements:{...i.elements,[e]:{...i.elements[e],status:t,completedAt:r,surveyAnswers:n?.surveyAnswers??i.elements[e]?.surveyAnswers,lastStepIndex:n?.lastStepIndex??i.elements[e]?.lastStepIndex}}}))},[]),F=(0,Q.useCallback)(e=>{let t=new Date;k(n=>({...n,status:e,completedAt:e===Hr.COMPLETED?t:n.completedAt,dismissedAt:e===Hr.DISMISSED?t:n.dismissedAt}))},[]),I=(0,Q.useCallback)(async(e,t)=>{P(e,Hr.COMPLETED,t),_&&c(g,e,t),r?.(e,Hr.COMPLETED),E<A-1?D(e=>e+1):(F(Hr.COMPLETED),_&&l(g))},[c,l,E,_,g,r,P,F,A]),ee=(0,Q.useCallback)(e=>{P(e,Hr.DISMISSED),r?.(e,Hr.DISMISSED),w.allowDismiss&&(F(Hr.DISMISSED),_&&u(g))},[u,_,g,w.allowDismiss,r,P,F]),L=(0,Q.useCallback)(e=>{let t=T[E];i?.(t?.ref??``,e)},[i,T,E]),R=(0,Q.useCallback)(()=>{if(E<A-1){D(e=>e+1);return}let e=T[E];e?I(e.ref):(F(Hr.COMPLETED),_&&l(g))},[E,A,T,I,l,_,g,F]),z=(0,Q.useCallback)(()=>{E>0&&D(e=>e-1)},[E]),te=(0,Q.useCallback)(()=>{F(Hr.SKIPPED),_&&d(g)},[_,g,F,d]);if(!C||_&&p)return null;if(T.length===0)return(0,$.jsx)(`div`,{className:U(`p-container-xl text-center text-muted-foreground`,n),children:S(B.GUIDANCE_ONBOARDING_VIEW,`empty`)});if(Tt(j?.status))return null;let ne=T[E];if(!ne)return null;let re=Q2(ne.type),ie=M(ne.ref),ae=x(y,ne.ref,Lc(ne));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-element`,n),children:[w.showProgress&&A>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center text-[0.8125rem] text-muted-foreground font-medium`,children:[(0,$.jsx)(`span`,{children:S(B.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A})}),(0,$.jsxs)(`span`,{className:`text-xs`,children:[N,`/`,A]})]}),(0,$.jsx)(b_,{value:A>0?(E+1)/A*100:0,className:`h-1`,"aria-label":S(B.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A}),"aria-valuenow":E+1,"aria-valuemin":1,"aria-valuemax":A})]}),re&&(0,$.jsx)(re,{element:ne,flowRef:v,state:ie,onComplete:I,onDismiss:ee,onAction:L,t:ae}),A>1&&(0,$.jsxs)(`div`,{className:`flex justify-between items-center pt-item`,children:[(0,$.jsx)(`div`,{children:E>0&&(0,$.jsx)(X,{variant:J.OUTLINE,size:Y.SM,onClick:z,children:S(B.GUIDANCE_ONBOARDING_VIEW,`back`)})}),(0,$.jsxs)(`div`,{className:`flex gap-item items-center`,children:[w.allowSkip&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:te,children:S(B.GUIDANCE_ONBOARDING_VIEW,`skip`)}),(0,$.jsx)(X,{variant:J.DEFAULT,size:Y.SM,onClick:R,children:E===A-1?S(B.GUIDANCE_ONBOARDING_VIEW,`complete`):S(B.GUIDANCE_ONBOARDING_VIEW,`next`)})]})]}),A===1&&(0,$.jsxs)(`div`,{className:`flex justify-end gap-item items-center`,children:[w.allowDismiss&&(0,$.jsx)(X,{variant:J.GHOST,size:Y.SM,onClick:()=>ee(ne.ref),children:S(B.GUIDANCE_ONBOARDING_VIEW,`dismiss`)}),(0,$.jsx)(X,{variant:J.DEFAULT,size:Y.SM,onClick:R,children:S(B.GUIDANCE_ONBOARDING_VIEW,`complete`)})]})]})},s9=Object.freeze({});function aje(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}=lm(),[r,i]=(0,Q.useState)(s9),{hostResourceType:a,hostResourceId:o,hostResourceConfig:s,contextResourceIdentifiers:c,parentResourcesRequirements:l}=e,u=(0,Q.useMemo)(()=>o?(l??[]).filter(e=>{if(!e.foreignKeyField)return!1;let t=On.getResourceId(c[e.resourceType]);return!(t&&t.length>0)}).map(e=>({resourceType:e.resourceType,foreignKeyField:e.foreignKeyField})):[],[l,c,o]),d=(0,Q.useMemo)(()=>u.map(e=>`${e.resourceType}:${e.foreignKeyField}`).sort().join(`|`),[u]),f=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(c),[c]),p=(0,Q.useRef)(null),m=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=lh({resourceConfig:s,operations:s.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:c,contextualParameters:e});if(!r){i(s9);return}let m=Ca.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=aje(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}=lm(),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=vp(e.resourceType,{ref:e.viewRef});return(0,$.jsx)(`div`,{className:e.className,children:(0,$.jsx)(Kh,{requiredFeatures:n.chartDefinition.requiredFeatures,children:(0,$.jsx)(BJ,{viewRef:r.insertedViewRef,viewDefinition:n,runtimeDescriptor:pp({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 oje({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 sje({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)($Y,{viewRef:e,navigationZone:t,contextResourceIdentifiers:n})})})}function cje({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(ql.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)(Gk.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 lje({className:e,...t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=W6();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=W6(),{registry:a}=lm(),o=(0,Q.useMemo)(()=>{if(!t.resourceType)throw p9(`EmbedRelatedResourceOperation() requires a target resourceType.`,{target:t});return i.buildOperationContext(t)},[i,JSON.stringify(t)]),s=(0,Q.useMemo)(()=>{let{hostResourceType:e,hostResourceId:n,hostResourceConfig:r}=i,s=t.resourceType===e&&!H6({target:t,hostResourceType:e,operation:o.operation,registry:a});if(!t.resourceType||s||!r?.resourceRelationships)return;let c=t.relationshipFieldOverrides?.[e],l=Hi(r.resourceRelationships).map(t=>xj({parentResourceType:e,relationship:t,registry:a})).filter(e=>e!==void 0).filter(e=>e.childResourceType===t.resourceType).filter(e=>c===void 0||e.foreignKeyField===c);if(l.length!==1)return;let u=l[0];return{parentResourceType:e,parentResourceId:n||void 0,childResourceType:u.childResourceType,foreignKeyField:u.foreignKeyField,relationshipEdgeKey:u.relationshipEdgeKey,inChildView:u.inChildView}},[i,a,o,JSON.stringify(t)]);return h9(o,n,(0,Q.useMemo)(()=>s?{...r??{sourceZone:n},sourceRelationship:s}:r,[r,n,s]),e)}function v9({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:t,className:n})}function uje({className:e}){let{navigationZone:t,navigationInitiator:n}=zU(),r=W6(),{hostResourceType:i,hostResourceId:a}=r;return h9((0,Q.useMemo)(()=>{if(!a)throw p9(`EmbedLinkedConversations() needs a host RECORD: place it on a READ surface, where the record it lists conversations for exists.`,{hostResourceType:i});return r.buildOperationContext({resourceType:ll.CONVERSATION_THREADS,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[Gn.RESOURCE_TYPE]:i,[Gn.RESOURCE_ID]:a}})},[r,i,a]),t,n,e)}var dje={[ll.USER_FLOW_ACTOR_EXECUTIONS]:ll.USER_AGENT_WORK_DECISIONS,[ll.ORGANIZATION_FLOW_ACTOR_EXECUTIONS]:ll.ORGANIZATION_AGENT_WORK_DECISIONS,[ll.APPLICATION_FLOW_ACTOR_EXECUTIONS]:ll.APPLICATION_AGENT_WORK_DECISIONS};function y9({executionId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=W6(),{hostResourceType:a}=i;return h9((0,Q.useMemo)(()=>{let t=dje[a];if(!t)throw p9(`EmbedExecutionDecisions() lists the decisions of a conversational RUN: place it on a flowActorExecutions READ surface.`,{hostResourceType:a});return i.buildOperationContext({resourceType:t,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[mr.KIND]:pe.CONVERSATIONAL_EXECUTION,[mr.ID]:e}})},[i,a,e]),n,r,t)}var b9=new Set;function fje(e,t,n){let r=`${e}::${t}`;b9.has(r)||(b9.add(r),rs.getLogger().warn(`[related-resource-list] the "${t}" LIST cannot be embedded on "${e}", so a section asking whether the viewer may read it is not drawn.${n?` ${n}`:``}`))}function x9(e,t){let n=W6(),r=cS(),i=t?JSON.stringify(t):``;return(0,Q.useMemo)(()=>{if(t===null)return!1;let a;try{a=n.buildOperationContext({resourceType:e,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:t?JSON.parse(i):void 0})}catch(t){return fje(n.hostResourceType,e,nK(t)),!1}let o=a.operation;return Vm({...o,resourceType:e},r)},[n,e,r,i,t===null])}function S9(e){let t=W6(),{hostResourceType:n}=t,{embedName:r,resourceType:i,pinnedFilters:a}=e,o=x9(i,a),s=JSON.stringify(a);return(0,Q.useMemo)(()=>{if(n!==ll.ORGANIZATION_REPRESENTATIONS)throw p9(`${r}() lists what belongs to one client relationship: place it on an organizationRepresentations READ surface.`,{hostResourceType:n});return o?t.buildOperationContext({resourceType:i,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:JSON.parse(s)}):null},[t,n,o,r,i,s])}function C9({organizationRepresentationId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=zU(),i=S9({embedName:`EmbedRepresentationTeam`,resourceType:ll.REPRESENTATIVE_ASSIGNMENTS,pinnedFilters:{[l]: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:ll.RELATIONSHIP_MAILBOXES,pinnedFilters:{[kn]:e}});return i?h9(i,n,r,t):null}function pje({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:W.SEARCH,relationshipFieldOverrides:t,className:n})}function mje({viewRef:e,inputs:t,urlParamValues:n,className:r,...i}){let a=W6(),o=a.buildOperationContext({...i,operationLike:W.READ}),s=c9(a);return(0,$.jsx)(u9,{resourceType:a.hostResourceType,viewRef:e,contextResourceIdentifiers:l9(V.flattenContextIdentifiers(o.contextResourceIdentifiers),s),inputs:t,urlParamValues:n,className:r})}function hje({resourceType:e,viewRef:t,inputs:n,urlParamValues:r,className:i,...a}){if(!e)throw p9(`EmbedRelatedChart() requires a target resourceType.`,{target:a});let o=W6().deriveRelatedScopeIdentifiers({...a,resourceType:e,operationLike:W.LIST});return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:o,inputs:n,urlParamValues:r,className:i})}function gje({viewRef:e,className:t,...n}){let{navigationZone:r}=zU(),i=W6(),a=i.buildOperationContext({...n,operationLike:W.READ}),o=c9(i);return f9(cp(i.hostResourceType,{ref:e}).insertedViewRef,r,l9(V.flattenContextIdentifiers(a.contextResourceIdentifiers),o),t)}function _je({resourceType:e,viewRef:t,className:n,...r}){let{navigationZone:i}=zU(),a=W6();if(!e)throw p9(`EmbedRelatedExecution() requires a target resourceType.`,{target:{resourceType:e,viewRef:t,...r}});let o=a.buildOperationContext({...r,resourceType:e,operationLike:W.READ});return f9(cp(e,{ref:t}).insertedViewRef,i,V.flattenContextIdentifiers(o.contextResourceIdentifiers),n)}function vje(e){if(!e.hostRelationships)return!1;let t=Hi(e.hostRelationships).filter(t=>(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType);return t.length>0&&t.every(t=>!Bl.isRelationshipActiveForParent(t,e.hostRecord,{onMissingParentResource:`exclude`,onConditionError:`exclude`}))}var T9=new Set;function yje(e,t,n){let r=`${e}::${t}`;T9.has(r)||(T9.add(r),rs.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=U6(),a=i?.hostResourceType??``,o=i?.hostResourceConfig?.resourceRelationships,s=rk(),c=s?.data,{tResourceHeader:l,isReady:u}=K({component:B.RESOURCES_LAYOUTS_CONTAINER_NESTED}),d=(0,Q.useMemo)(()=>r.filter(e=>{if(!i)return!0;if(s&&vje({hostResourceType:a,hostRelationships:o,targetResourceType:e.resourceType,hostRecord:c}))return!1;try{return i.buildOperationContext({resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey}),!0}catch(t){return yje(a,e.resourceType,nK(t)),!1}}),[r,i,a,o,s,c]),f=(0,Q.useMemo)(()=>d.map(e=>({id:e.resourceType,title:Up({tResourceHeader:l,resourceType:e.resourceType,key:`title`}),content:(0,$.jsx)(Gk.Provider,{value:!0,children:(0,$.jsx)(_9,{resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey})})})),[d,l]);if(f.length===0)return null;let p=d.some(e=>{let t=e.operationLike??W.LIST;return t===W.LIST||t===W.SEARCH}),m=u?(0,$.jsx)(UO,{sections:f,config:t,className:n}):null;return p?(0,$.jsx)(`div`,{[pA]:!0,children:m}):m}function D9({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-element-sm gap-y-element-xs`,`[&>*:not(:first-child)]:shrink-0 [&>*:not(:first-child)]:w-auto [&>*:not(:first-child)]:max-w-full`,`[&>[data-summary-title]]:basis-auto`,`[&>:has(>[data-summary-title])]:w-auto [&>:has(>[data-summary-title])]:min-w-0 [&>:has(>[data-summary-title])]:flex-auto`,e),children:t})}function O9({name:e,className:t,children:n}){let[r]=(0,Q.useState)(()=>new Set),i=$D(),a=(0,Q.useContext)(QD),o=(0,Q.useRef)(!1),s=(0,Q.useCallback)(t=>{r.add(t),i?.registerStep(e,r)},[r,e,i]),c=(0,Q.useCallback)(t=>{r.delete(t),i?.registerStep(e,r)},[r,e,i]),l=(0,Q.useMemo)(()=>({registerField:s,unregisterField:c}),[s,c]);(0,Q.useEffect)(()=>{if(i&&!o.current){o.current=!0;let t=requestAnimationFrame(()=>{i.registerStep(e,r)});return()=>cancelAnimationFrame(t)}},[i,e,r]);let u=`wizard-step-${e}`;return(0,$.jsx)(NM.Provider,{value:l,children:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,t),id:u,"data-guidance-wizard-step":e,role:`group`,"aria-labelledby":`wizard-tab-${e}`,tabIndex:-1,children:[n,a]})})}var bje=rs.getLogger(),xje=new Set;function Sje(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}var Cje=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`,`range`,`color`,`hidden`]),wje=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)?bje.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 Tje({className:e,initialStep:t=0,validateOnStepChange:n=!0,onStepChange:r,submitButton:i,children:a}){Ide();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)(xje),g=UC(),_=LT(),v=aE(),y=v?.claimFooter,b=(0,Q.useContext)(QR),x=b?.claim;(0,Q.useLayoutEffect)(()=>x?.(),[x]),(0,Q.useLayoutEffect)(()=>y?.(),[y]);let{tComponent:S,isReady:C}=K({component:B.LOW_LEVEL_FORM_MESSAGE}),w=(0,Q.useMemo)(()=>k9(a),[a]),T=w.length,E=Math.min(o,Math.max(T-1,0)),D=(0,Q.useCallback)((e,t)=>{c.current.set(e,t)},[]),O=(0,Q.useCallback)(()=>{let e=w[E]?.name;if(!e)return;let t=c.current.get(e);return t?Array.from(t):void 0},[E,w]),k=(0,Q.useMemo)(()=>({registerStep:D,getCurrentStepFieldNames:O,currentStep:E,totalSteps:T}),[D,O,E,T]),A=(e,t)=>_?.wizardStepLabels?.[e]?_.wizardStepLabels[e]:S(B.LOW_LEVEL_FORM_MESSAGE,`wizardStepDefault`,{index:String(t+1)}),j=()=>{l.current?.scrollIntoView({behavior:`smooth`,block:`start`})},M=e=>{let t=E;d.current=Date.now(),s(e),p(t=>Math.max(t,e)),r?.(t,e)};(0,Q.useEffect)(()=>{if(!g)return;let e=e=>{let t=new Set;w.forEach((n,r)=>{let i=c.current.get(n.name);i&&Array.from(i).some(t=>CC(e,t)!==void 0)&&t.add(r)}),h(e=>Sje(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=VD(e=>{let t=w.findIndex(t=>t.name===e);return t<0||t===E?!1:(M(t),!0)});(0,Q.useEffect)(()=>{if(!u.current)return;u.current=!1;let e=w[E]?.name;e&&document.getElementById(`wizard-step-${e}`)?.focus({preventScroll:!0})},[E,w]);let F=()=>{E>0&&N(E-1)},I=async e=>{e>E&&!await ee(E,e)||N(e)},ee=async(e,t)=>{if(!n||!g)return!0;let r=w.slice(e,t).flatMap(e=>Array.from(c.current.get(e.name)??[]));return $O(g,r)},L=async()=>{if(n&&g){let e=w[E]?.name,t=e?c.current.get(e):void 0;if(!await $O(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&&!Cje.has(t.type)&&(e.preventDefault(),L())},ne=e=>{e.detail>1&&Date.now()-d.current<wje&&(e.preventDefault(),e.stopPropagation())};if(!C)return null;let re=S(B.LOW_LEVEL_FORM_MESSAGE,`wizardPrevious`),ie=S(B.LOW_LEVEL_FORM_MESSAGE,`wizardNext`),ae=i??v?.submitButton??(0,$.jsx)(X,{type:`submit`,disabled:_?.disabled,children:S(B.LOW_LEVEL_FORM_MESSAGE,`wizardSubmit`)},`submit`),oe=_?.isExisting===!0;return(0,$.jsx)(ZD.Provider,{value:k,children:(0,$.jsxs)(`div`,{className:e,"data-guidance-wizard":``,onKeyDown:te,children:[(0,$.jsx)(`div`,{ref:l,children:(0,$.jsx)(EO,{currentStep:E,totalSteps:T,orientation:pu.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)(DO,{step:t,role:`listitem`,"aria-current":t===E?`step`:void 0,children:[(0,$.jsx)(OO,{step:t,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex flex-col items-center text-center`,children:(0,$.jsx)(AO,{step:t,children:(0,$.jsx)(`span`,{id:`wizard-tab-${e.name}`,children:A(e.name,t)})})})]}),t<T-1&&(0,$.jsx)(kO,{step:t,"aria-hidden":`true`})]},e.name))})}),w.map((e,t)=>{let n=_?.wizardStepDescriptions?.[e.name];return(0,$.jsxs)(`div`,{hidden:t!==E,...HD(P,e.name),children:[n?(0,$.jsx)(`p`,{className:`mb-field text-sm text-muted-foreground`,children:n}):null,(0,$.jsx)(Uy,{children:(0,$.jsx)(QD.Provider,{value:t===T-1?b?.content??null:null,children:e.element})})]},e.name)}),v?.submissionNotice,(0,$.jsxs)(`div`,{className:`flex justify-between gap-field pt-field`,onClickCapture:ne,children:[(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:F,disabled:R||_?.disabled,children:re}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[v?.cancelButton,v?.draftSaveButton,(z||oe)&&(0,$.jsx)(Q.Fragment,{children:ae},`submit`),!z&&(0,$.jsx)(X,{type:`button`,variant:oe?J.OUTLINE:void 0,onClick:L,disabled:_?.disabled,children:ie},`next`)]})]})]})})}function A9({name:e,className:t,children:n}){let r=LT(),i=rk(),{getRecipe:a}=Rg(),o=r?.groupLabels?.[e]??i?.groupLabels?.[e];return(0,$.jsxs)(`div`,{className:t,"data-guidance-group":e,children:[o&&(0,$.jsx)(`h3`,{className:U(`col-span-full mb-element`,a(oc.TYPOGRAPHY,y.EYEBROW).base),children:o}),n]})}A9.displayName=`Group`;function j9({className:e,children:t}){return e?(0,$.jsx)(`div`,{className:e,children:t}):(0,$.jsx)($.Fragment,{children:t})}function M9({name:e,className:t,addLabel:n,removeLabel:r,minItems:i,maxItems:a,children:o}){let s=ED(e),{control:c}=UC(),{fields:l,append:u,remove:d}=Mw({control:c,name:s});mk(s),PM(s);let{tComponent:f,isReady:p}=K({component:B.LOW_LEVEL_FORM_MESSAGE});if(!p)return null;let m=Eje(o),h=a===void 0||l.length<a,g=i===void 0||l.length>i,_=n??f(B.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),v=f(B.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`);return(0,$.jsxs)(`div`,{className:t,"data-guidance-array":e,children:[l.map((e,t)=>(0,$.jsxs)(`div`,{className:`relative`,"data-guidance-array-item":t,children:[(0,$.jsx)(wD,{pathPrefix:`${s}[${t}]`,children:m?Q.cloneElement(m):null}),g&&(0,$.jsx)(X,{type:`button`,variant:J.GHOST,onClick:()=>d(t),className:`mt-1`,children:r??f(B.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:`${v} ${t+1}`})})]},e.id)),h&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,onClick:()=>u({}),className:`mt-2`,children:_})]})}function Eje(e){let t=null;return Q.Children.forEach(e,e=>{!t&&Q.isValidElement(e)&&e.type===j9&&(t=e)}),t}Mk(M9);function Dje({className:e}){return(0,$.jsx)(`hr`,{className:e})}function Oje(e){let{resourceType:t,viewRef:n,contextResourceIdentifiers:r,inputs:i,urlParamValues:a,localErrorOnly:o=!1}=e,{registry:s}=lm(),{resolvedRegionalPreferences:c}=K(),l=s.resourceConfigurations[t]?.frontendConfiguration?.chartViews?.find(e=>e.ref===n);if(!l)throw Error(`useResourceChartData: resource "${t}" declares no chart view "${n}".`);let u=(0,Q.useMemo)(()=>pp({identity:vp(t,{ref:n}),chartView:l,contextResourceIdentifiers:r??{}}),[t,n,l,r]),d=x_({surfaceDefinition:l,runtimeDescriptor:u,explicitContextResourceIdentifiers:r,explicitInputs:i,urlParamValues:a});return g_(d?.chartDefinition,d?.executionChartRef,d?.resolvedInputs,d?.contextResourceIdentifiers,a,o,c.timezone)}function kje(e,t){let n=(Array.isArray(e?.operations)?e.operations:[]).find(e=>String(e.operationIdentifier)===W.LIST&&e.isOperationDefault===!0);if(!n||!Array.isArray(n.roles))return;let r=n.roles.map(String);return t?r.filter(e=>t.includes(e)):r}function Aje(e,t){let n=e.accessProfile,r=Ke(n?.organizationOwnRows,t),i=ut(n?.organizationAssignedRows,t);if(!r&&!i)return e.organizationRoles;let a=t=>Ws(t,e.roleTables.orgRolesConfig);return e.organizationRoles.filter(e=>ute({role:e,ownRowsDeclaration:r,assignedRowsDeclaration:i,roleHierarchyOf:a}))}function N9(e,t,n){return[e.dataQuery.mainResourceType,...(e.dataQuery.joins??[]).map(e=>e.resourceType)].every(r=>{let i=kje(t.resourceConfigurations[r],e.accessControl?.roles);return!i||i.length===0?!1:Nm(i,{...n,organizationRoles:Aje(n,r)})})}function P9(e){return e.rows??Kc.ONE}function jje(e,t){if(e.height!==void 0)return t===P9(e)?e.height:t===Kc.TWO?e.height*2+32:Math.max(1,Math.round((e.height-32)/2))}function F9(e,t,n){let r=jje(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=>[Es(e),e])),r=new Set,i=[];for(let e of t){let t=Es(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(Es(t))||i.push({tile:t,declared:t,hidden:!1});return i}function Mje(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??Hs.ONE,rows:P9(e),hidden:t}))}function R9(e,t){let n=e?Pje:Nje;return t===Kc.TWO&&!e?n*2+32:n}var Nje=280,Pje=64,Fje=rs.getLogger(),z9=ll.ORGANIZATION_DASHBOARD_LAYOUTS,B9;(function(e){e.LOADING=`loading`,e.SETTLED=`settled`})(B9||={});var V9=new Map;function H9(e){V9.get(e)?.forEach(e=>e())}function U9(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===at.API_CALL)}function W9(e){return t=>{throw H9(e),t}}function Ije(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}function Lje(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}=lm(),i=Jp()?.currentOrganizationId??null,a=n.resourceConfigurations[z9],o=a?.operations,s=n.resourceConfigurations[ll.ORGANIZATIONS]?.resourceFieldIdentifier??`organizationId`,c=a?.resourceFieldIdentifier,l=(0,Q.useMemo)(()=>({list:U9(o,W.LIST),create:U9(o,W.CREATE),update:U9(o,W.UPDATE),remove:U9(o,W.DELETE)}),[o]),u=e=>!!e&&Vm({...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(Ca.buildOperationPathKeyFromOperation(l.list),{contextualParameters:{[s]:i},queryParameters:{dashboardRef:e,page:1,limit:1}},{silent:!0}).then(t=>n(Ije(t).find(t=>t.dashboardRef===e))).catch(t=>{Fje.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=Lje(await(y?v.current(Ca.buildOperationPathKeyFromOperation(l.update),{contextualParameters:{...n,[c]:y._id},requestData:{tiles:t}}):v.current(Ca.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(Ca.buildOperationPathKeyFromOperation(l.remove),{contextualParameters:{[s]:i,[c]:y._id}}).catch(W9(p)),h({key:p,stored:void 0}),H9(p))},[p,i,l.remove,c,s,y])}}var K9=B.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,q9=Od(Hs),J9=Od(Kc),Rje=Object.values(Hs),zje=Object.values(Kc);function Bje(e){return`${e.resourceType}:${e.chartViewRef}`}function Y9(e,t,n){let r=t+n;if(r<0||r>=e.length)return[...e];let i=[...e],[a]=i.splice(t,1);return i.splice(r,0,a),i}function X9({tiles:e,layout:t,onDone:n}){let{tComponent:r,tView:i,isReady:a}=K({component:K9}),{renderIcon:o}=Of(),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)(()=>Rje.map(e=>({value:e,label:s(`span_${e}`)})),[s]),_=(0,Q.useMemo)(()=>zje.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=Bje(e.tile),r=i(iu.CHART,`resources.${e.tile.resourceType}.${e.tile.chartViewRef}`,`title`)||n,a=e.tile.span??Hs.ONE,d=e.tile.rows??Kc.ONE;return(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-item`,"data-chart-dashboard-layout-tile":n,"data-hidden":e.hidden?``:void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col`,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,"aria-label":s(`moveUp`),disabled:u||t===0,onClick:()=>l(e=>Y9(e,t,-1)),children:o(H.CHEVRON_UP,{size:ca.XS})}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.ICON_SM,"aria-label":s(`moveDown`),disabled:u||t===c.length-1,onClick:()=>l(e=>Y9(e,t,1)),children:o(H.CHEVRON_DOWN,{size:ca.XS})})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.BODY,children:r}),(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`tilePosition`,{position:t+1,count:c.length})})]}),(0,$.jsx)(CI,{name:`${n}:shown`,schema:Dd(),"aria-label":s(`shownLabel`),checked:!e.hidden,disabled:u,onCheckedChange:e=>m(t,t=>({...t,hidden:!e}))}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`widthLabel`)}),(0,$.jsx)(gF,{name:`${n}:span`,schema:q9,options:g,value:a,disabled:u,onChange:e=>m(t,t=>({...t,tile:F9(t.declared,q9.parse(e),d)}))})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:y.DESCRIPTION,children:s(`heightLabel`)}),(0,$.jsx)(gF,{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)(AD,{variant:`destructive`,children:(0,$.jsx)(MD,{children:s(`saveFailed`)})}),(0,$.jsxs)(oG,{children:[t.stored&&(0,$.jsx)(X,{type:`button`,variant:J.OUTLINE,disabled:u,onClick:()=>void h(t.reset),"data-chart-dashboard-layout-reset":!0,children:s(`resetButton`)}),(0,$.jsx)(X,{type:`button`,variant:J.GHOST,disabled:u,onClick:n,children:s(`cancelButton`)}),(0,$.jsx)(X,{type:`button`,variant:J.DEFAULT,loading:u,disabled:u,onClick:()=>void h(()=>t.save(L9(c))),"data-chart-dashboard-layout-save":!0,children:s(`saveButton`)})]})]}):null}function Z9({tiles:e,layout:t}){let{tComponent:n,isReady:r}=K({component:K9}),[i,a]=(0,Q.useState)(!1),o=(0,Q.useCallback)(()=>a(!1),[]);return r?(0,$.jsxs)(`div`,{className:`flex justify-end`,"data-chart-dashboard-layout-control":!0,children:[(0,$.jsx)(X,{type:`button`,variant:J.GHOST,size:Y.SM,onClick:()=>a(!0),"data-chart-dashboard-layout-open":!0,children:n(K9,`customizeButton`)}),(0,$.jsx)(tG,{open:i,onOpenChange:a,children:(0,$.jsxs)(rG,{children:[(0,$.jsxs)(aG,{children:[(0,$.jsx)(sG,{children:n(K9,`title`)}),(0,$.jsx)(cG,{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}=lm(),a=cS(),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===vne.KPI}]}),[s,i,a]);if(o.readState===B9.LOADING||c.length===0&&!o.canEdit)return null;let l=Vje[t];return(0,$.jsxs)(`div`,{className:U(`@container flex w-full flex-col gap-element`,r),"data-chart-dashboard":!0,children:[o.canEdit&&(0,$.jsx)(Z9,{tiles:e,layout:o}),c.length>0&&(0,$.jsx)(`div`,{className:U(`grid grid-cols-1 gap-group`,l.columns),children:c.map(({tile:e,isFigure:t})=>(0,$.jsx)(Uje,{tile:e,isFigure:t,grid:l},`${e.resourceType}:${e.chartViewRef}`))})]})}var Vje={[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 Hje(e,t){let n=e.span??Hs.ONE;return U(n===Hs.TWO&&t.spanTwo,n===Hs.FULL&&`col-span-full`,e.rows===Kc.TWO&&t.rowsTwo)}function Uje({tile:e,isFigure:t,grid:n}){let{tView:r}=K(),i=r(iu.CHART,`resources.${e.resourceType}.${e.chartViewRef}`,`title`);return(0,$.jsxs)(`section`,{className:U(`flex min-w-0 flex-col gap-element`,Hje(e,n)),"data-chart-dashboard-tile":`${e.resourceType}:${e.chartViewRef}`,"data-chart-dashboard-figure":t?``:void 0,children:[i&&(0,$.jsx)(Z,{as:`div`,typography:y.EYEBROW,children:i}),(0,$.jsx)(d9,{resourceType:e.resourceType,viewRef:e.chartViewRef,height:e.height??R9(t,e.rows)})]})}function Wje(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 yp(a,i)}function Gje(e,t=Zp.APPLICATION){return op.parse({ref:e,scope:t,options:{showProgress:!0,allowDismiss:!0,persistState:!0},elements:[]})}function Kje(e,t){return{...e,elements:[...e.elements,t]}}function qje(e,t){return{...e,elements:e.elements.filter(e=>e.ref!==t)}}function Jje(e,t,n){return{...e,elements:e.elements.map(e=>e.ref===t?{...e,status:n}:e)}}function Yje(e){if(e.elements.length===0)return 0;let t=e.elements.filter(e=>e.status===Hr.COMPLETED).length;return Math.round(t/e.elements.length*100)}function Xje(e){return e.elements.every(e=>e.status===Hr.COMPLETED)}function Zje(e,t){return e.elements.filter(e=>e.type===t)}function Qje(e){return JSON.stringify(e,null,2)}function $je(e){let t=JSON.parse(e);return op.parse(t)}var eMe=t({ACTOR_TASK_TOPICS_VOCABULARY:()=>Wf,AI_ActorCard:()=>p6,AI_ActorExecutionModeBadge:()=>h6,AI_ActorRoleBadge:()=>m6,AI_ActorTeam:()=>sEe,AI_AgentCapabilities:()=>UEe,AI_AgentCard:()=>l8,AI_AgentList:()=>c8,AI_AgentPromptSpec:()=>HEe,AI_ApprovalQueue:()=>aW,AI_ApprovalRequest:()=>iW,AI_Artifact:()=>NOe,AI_ArtifactAction:()=>BOe,AI_ArtifactActions:()=>zOe,AI_ArtifactClose:()=>FOe,AI_ArtifactContent:()=>IOe,AI_ArtifactDescription:()=>ROe,AI_ArtifactFileContent:()=>LEe,AI_ArtifactHeader:()=>POe,AI_ArtifactItem:()=>o8,AI_ArtifactList:()=>a8,AI_ArtifactOrigin:()=>FEe,AI_ArtifactStructuredContent:()=>REe,AI_ArtifactTextContent:()=>IEe,AI_ArtifactTitle:()=>LOe,AI_Canvas:()=>lf,AI_ChainOfThought:()=>r7,AI_ChainOfThoughtContent:()=>o7,AI_ChainOfThoughtHeader:()=>i7,AI_ChainOfThoughtImage:()=>dAe,AI_ChainOfThoughtSearchResult:()=>uAe,AI_ChainOfThoughtSearchResults:()=>lAe,AI_ChainOfThoughtStep:()=>a7,AI_Checkpoint:()=>fAe,AI_CodeBlock:()=>x5,AI_Confirmation:()=>Nke,AI_Connection:()=>nAe,AI_Context:()=>aAe,AI_Controls:()=>wf,AI_Conversation:()=>k5,AI_ConversationContent:()=>A5,AI_ConversationEmptyState:()=>j5,AI_ConversationScrollButton:()=>M5,AI_ConversationThread:()=>bQ,AI_ConversationThreadComposer:()=>xQ,AI_ConversationThreadDiscussions:()=>SQ,AI_DecisionRequest:()=>oW,AI_DiffBlock:()=>S5,AI_Edge:()=>rAe,AI_ExecutionPlan:()=>D6,AI_ExecutionPlanProgress:()=>k6,AI_ExecutionPlanStep:()=>O6,AI_ExecutionStream:()=>tAe,AI_ExecutionUsage:()=>Y6,AI_ExecutionUsageSummary:()=>Z6,AI_FlowExecutionCanvas:()=>mEe,AI_FlowExecutionSummary:()=>hEe,AI_FlowExecutionTimeline:()=>_6,AI_FlowExecutionTimelineItem:()=>gEe,AI_FlowNodeStatusBadge:()=>hf,AI_FlowNodeStepBadge:()=>vf,AI_GraphViewer:()=>g6,AI_HumanInputRequest:()=>sW,AI_Image:()=>qOe,AI_InlineCitation:()=>pAe,AI_Loader:()=>cAe,AI_Message:()=>EQ,AI_MessageAction:()=>AQ,AI_MessageActions:()=>kQ,AI_MessageAttachment:()=>Hbe,AI_MessageAttachments:()=>Ube,AI_MessageBranch:()=>Ibe,AI_MessageBranchContent:()=>Lbe,AI_MessageBranchNext:()=>Bbe,AI_MessageBranchPage:()=>Vbe,AI_MessageBranchPrevious:()=>zbe,AI_MessageBranchSelector:()=>Rbe,AI_MessageContent:()=>DQ,AI_MessageResponse:()=>OQ,AI_MessageToolbar:()=>Wbe,AI_ModelSelector:()=>oAe,AI_Node:()=>Hf,AI_OpenInChat:()=>sAe,AI_Panel:()=>e7,AI_Plan:()=>mAe,AI_PlanAction:()=>bAe,AI_PlanContent:()=>_Ae,AI_PlanDescription:()=>yAe,AI_PlanFooter:()=>xAe,AI_PlanHeader:()=>hAe,AI_PlanTitle:()=>vAe,AI_PlanTrigger:()=>gAe,AI_PromptInput:()=>P5,AI_PromptInputActionAddAttachments:()=>dke,AI_PromptInputActionMenu:()=>ske,AI_PromptInputActionMenuContent:()=>lke,AI_PromptInputActionMenuItem:()=>uke,AI_PromptInputActionMenuTrigger:()=>cke,AI_PromptInputAttachment:()=>tke,AI_PromptInputAttachments:()=>nke,AI_PromptInputBody:()=>rke,AI_PromptInputButton:()=>oke,AI_PromptInputCommand:()=>vke,AI_PromptInputCommandEmpty:()=>xke,AI_PromptInputCommandGroup:()=>Ske,AI_PromptInputCommandInput:()=>yke,AI_PromptInputCommandItem:()=>Cke,AI_PromptInputCommandList:()=>bke,AI_PromptInputCommandSeparator:()=>wke,AI_PromptInputFooter:()=>I5,AI_PromptInputHeader:()=>ike,AI_PromptInputHoverCard:()=>Tke,AI_PromptInputHoverCardContent:()=>Dke,AI_PromptInputHoverCardTrigger:()=>Eke,AI_PromptInputProvider:()=>eke,AI_PromptInputSelect:()=>pke,AI_PromptInputSelectContent:()=>hke,AI_PromptInputSelectItem:()=>gke,AI_PromptInputSelectTrigger:()=>mke,AI_PromptInputSelectValue:()=>_ke,AI_PromptInputSpeechButton:()=>fke,AI_PromptInputSubmit:()=>L5,AI_PromptInputTab:()=>kke,AI_PromptInputTabBody:()=>jke,AI_PromptInputTabItem:()=>Mke,AI_PromptInputTabLabel:()=>Ake,AI_PromptInputTabsList:()=>Oke,AI_PromptInputTextarea:()=>F5,AI_PromptInputTools:()=>ake,AI_Queue:()=>Pke,AI_QueueItem:()=>Ike,AI_QueueItemAction:()=>Vke,AI_QueueItemActions:()=>Bke,AI_QueueItemAttachment:()=>Hke,AI_QueueItemContent:()=>Rke,AI_QueueItemDescription:()=>zke,AI_QueueItemFile:()=>Wke,AI_QueueItemImage:()=>Uke,AI_QueueItemIndicator:()=>Lke,AI_QueueList:()=>Fke,AI_QueueMessageItem:()=>Xke,AI_QueueSection:()=>Gke,AI_QueueSectionContent:()=>Jke,AI_QueueSectionLabel:()=>qke,AI_QueueSectionTrigger:()=>Kke,AI_QueueTodoItem:()=>Yke,AI_Reasoning:()=>l7,AI_ReasoningContent:()=>d7,AI_ReasoningTrigger:()=>u7,AI_RiskLevelBadge:()=>T6,AI_Shimmer:()=>t7,AI_Source:()=>H5,AI_Sources:()=>z5,AI_SourcesContent:()=>V5,AI_SourcesTrigger:()=>B5,AI_Suggestion:()=>W5,AI_Suggestions:()=>U5,AI_SystemCard:()=>y6,AI_SystemCardCompact:()=>b6,AI_SystemCatalog:()=>yEe,AI_SystemDetail:()=>x6,AI_SystemKindBadge:()=>C6,AI_SystemStatusBadge:()=>w6,AI_Task:()=>Zke,AI_TaskContent:()=>$ke,AI_TaskDetail:()=>M6,AI_TaskItem:()=>eAe,AI_TaskItemFile:()=>q5,AI_TaskList:()=>P6,AI_TaskMemory:()=>OEe,AI_TaskMemoryEntryItem:()=>R6,AI_TaskMemoryScope:()=>L6,AI_TaskTimeline:()=>F6,AI_TaskTrigger:()=>Qke,AI_Tool:()=>Y5,AI_ToolContent:()=>Z5,AI_ToolHeader:()=>X5,AI_ToolInput:()=>Q5,AI_ToolOutput:()=>$5,AI_Toolbar:()=>iAe,AI_WebPreview:()=>JOe,AI_WebPreviewBody:()=>QOe,AI_WebPreviewConsole:()=>$Oe,AI_WebPreviewNavigation:()=>YOe,AI_WebPreviewNavigationButton:()=>XOe,AI_WebPreviewUrl:()=>ZOe,APP_LEVEL_NAVIGATION_SOURCE:()=>Dn,APP_SCOPE_FIELD_DEFAULT_POSITION:()=>999,ARRAY_ROW_TEMPLATE_GUTTER_CLASS:()=>`w-7`,Accordion:()=>fO,AccordionContent:()=>hO,AccordionItem:()=>pO,AccordionTrigger:()=>mO,ActionBar:()=>XS,ActionBarPopoverChrome:()=>qS,ActionButton:()=>d8,ActionPlacement:()=>ec,ActionVisibility:()=>mo,ActivityBarRendering:()=>xa,ActivityBarRenderingSchema:()=>Kte,ActorActivity:()=>d6,Alert:()=>AD,AlertDescription:()=>MD,AlertDialog:()=>Vw,AlertDialogAction:()=>Jw,AlertDialogCancel:()=>Yw,AlertDialogContent:()=>Uw,AlertDialogDescription:()=>qw,AlertDialogFooter:()=>Gw,AlertDialogHeader:()=>Ww,AlertDialogTitle:()=>Kw,AlertDialogTrigger:()=>Hw,AlertTitle:()=>jD,AnalyticsContext:()=>m$,AnalyticsContextProvider:()=>g$,AnalyticsIdentityPublisherContext:()=>h$,AnalyticsProviderRegistry:()=>f$,AnonymousSessionProvider:()=>rp,AnonymousSessionStatus:()=>nse,ApiNotReadyError:()=>pie,ApiReadinessChecker:()=>$ne,AppCelebrationOverlay:()=>XQ,AppConfiguration_Frontend_Schema:()=>bm,AppLayoutPreset_ErrorBoundary_Default:()=>By,AppLayoutPreset_Home_Default:()=>XU,AppLayoutPreset_RouterErrorBoundary_Default:()=>Wy,AppLayout_AuthenticatedRoute:()=>UH,AppLayout_ConsentGate:()=>LH,AppLayout_DocumentAcceptanceGate:()=>BH,AppLayout_ErrorBoundary:()=>Vy,AppLayout_Home:()=>ZU,AppLayout_MainContainer:()=>PH,AppLayout_NotificationCenter:()=>k8,AppLayout_RouterErrorBoundary:()=>Gy,AppLevelComponentConfigurationSchema:()=>Woe,AppLoadingGate:()=>sb,AppLoadingIdentifier:()=>m,AppModeDefinitionSchema:()=>si,AppModeProvider:()=>$x,AppNotificationCenter:()=>O8,AppScopeContext:()=>zoe,AppScopeProvider:()=>Sm,AppScopeSessionMode:()=>mee,AppShellContentOutlet:()=>p4,AppShellLoadingState:()=>l4,AppShellOverlayPortalLayer:()=>d4,AppShellOverlaysOutlet:()=>m4,AppShellProviders:()=>u4,AppShellRegionOutlet:()=>f4,ApplicationContext:()=>Fi,ApplicationLevelComponentType:()=>Fr,ApplicationLevel_ActivityBar:()=>k2,ApplicationLevel_CommandMenu:()=>qAe,ApplicationLevel_ControlPanel:()=>JAe,ApplicationLevel_MenuBar:()=>A2,ApplicationLevel_MenuUserOrg:()=>YAe,ApplicationLevel_NavigationBack:()=>CB,ApplicationLevel_NotificationCenter:()=>QAe,ApplicationLevel_QuickActionButton:()=>j2,ApplicationLevel_QuickSwitcher:()=>$Ae,ApplicationLevel_Sidebar:()=>M2,ApplicationLevel_StatusBar:()=>N2,ApplicationLevel_Toolbar:()=>P2,ApplicationLevel_UtilityPanel:()=>F2,ApplicationMainProvider:()=>q$,ApprovalSeal:()=>$j,ApprovalSealCheckState:()=>Qj,ApprovalSealReadState:()=>Zj,ArrayAutosavesContext:()=>uI,ArrayField:()=>M9,ArrayItemTemplate:()=>j9,AspectRatio:()=>oDe,AuthPage_OneOffSession:()=>EZ,AuthSessionContext:()=>Voe,AuthSessionProvider:()=>em,AuthSessionUtils:()=>Um,Auth_AuthCallback:()=>bX,Auth_ChatIdentityLink:()=>BZ,Auth_ConfirmEmail:()=>gZ,Auth_EnrollmentRequired:()=>rZ,Auth_Invitation:()=>CZ,Auth_MagicLinkVerify:()=>wX,Auth_Main:()=>pZ,Auth_MfaChallenge:()=>eZ,Auth_OAuthConsent:()=>FZ,Auth_OAuthLoggedOut:()=>HZ,Auth_OAuthLogoutConfirm:()=>GZ,Auth_OneOffSession:()=>TZ,Auth_OrganizationOnboarding:()=>cZ,Auth_PasswordLost:()=>NZ,Auth_Register:()=>ZZ,AutomatedArrayField:()=>vI,AutomatedForm:()=>nE,AutomatedLayoutFrontendUtils:()=>hr,AutomatedLayoutTemplateKind:()=>AT,AutomaticDisplayer:()=>BB,AutosaveFieldState:()=>tT,AutosaveIndicator:()=>UM,AutosaveProvider:()=>TE,AutosaveTrigger:()=>au,Avatar:()=>g8,AvatarFallback:()=>v8,AvatarImage:()=>_8,BADGE_DISPLAY_CAP:()=>99,BADGE_VARIANT_INDICATOR:()=>n_,BILLING_COMMAND_MENU_ITEM:()=>e6,BILLING_SETTINGS_SECTION_REF:()=>$3,BackendProxyAnalyticsProvider:()=>d$,Badge:()=>Mf,BillingContext:()=>Fh,BillingPortalLink:()=>P1,BillingProvider:()=>wh,Breadcrumb:()=>TB,BreadcrumbEllipsis:()=>jB,BreadcrumbItem:()=>DB,BreadcrumbLink:()=>OB,BreadcrumbList:()=>EB,BreadcrumbPage:()=>kB,BreadcrumbSeparator:()=>AB,Button:()=>X,ButtonGroup:()=>f8,ButtonGroupSeparator:()=>YEe,ButtonGroupText:()=>p8,ButtonLabelOverflow:()=>Zd,ButtonVariants_Variant:()=>J,CATEGORY_LOADING_DEFAULTS:()=>ab,CHART_DASHBOARD_ROW_GAP_PX:()=>32,CHART_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Uae,CHART_ROUTE_PATH_PREFIX:()=>hoe,COLLECTION_SURFACE_ATTRIBUTE:()=>pA,COMMON_ENUM_DISPLAY_CONFIG:()=>S_,COMPOSITE_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>aoe,Calendar:()=>M8,CalendarDayButton:()=>N8,Card:()=>OF,CardAction:()=>NF,CardActionPlacementSchema:()=>zre,CardContent:()=>FF,CardDescription:()=>PF,CardFooter:()=>jF,CardHeader:()=>AF,CardLayoutStyle:()=>Xl,CardListbox:()=>kF,CardStatusEdge:()=>EF,CardTitle:()=>MF,Carousel:()=>H8,CarouselContent:()=>U8,CarouselItem:()=>W8,CarouselNext:()=>cDe,CarouselPrevious:()=>sDe,ChartDashboard:()=>$9,ChartDashboardColumns:()=>Q9,ChartDashboardLayoutControl:()=>Z9,ChartDashboardLayoutEditor:()=>X9,ChartDashboardLayoutReadState:()=>B9,ChartEmptyState:()=>C_,ChartErrorState:()=>y_,ChartLoadingSkeleton:()=>ym,ChartView:()=>BJ,ChartWidget:()=>Qh,ChatSignInCompletionOutcome:()=>Vb,Checkbox:()=>EI,CheckboxRoot:()=>DI,ChipsInput:()=>lI,Code:()=>f_,Collapsible:()=>SO,CollapsibleContent:()=>wO,CollapsibleTrigger:()=>CO,CollectionBoardConfigSchema:()=>Sne,CollectionCalendarConfigSchema:()=>hre,CollectionDisplayMode:()=>gu,CollectionFilterPanelVisibility:()=>Go,CollectionFilterPresetContextValue:()=>ls,CollectionFilterPresetRelativeMonthRange:()=>hl,CollectionFilterPresetRelativeRange:()=>Gc,CollectionFilterPresetSchema:()=>Vs,CollectionFilterPresetValueSchema:()=>Ts,CollectionTimelineConfigSchema:()=>rne,CollectionToolbarPresence:()=>bu,ColorInput:()=>FI,ColorNotation:()=>F3,Combobox:()=>px,ComboboxMultiple:()=>mx,Command:()=>wV,CommandBarPolicy:()=>hm,CommandDialog:()=>TV,CommandEmpty:()=>OV,CommandGroup:()=>kV,CommandInput:()=>EV,CommandItem:()=>AV,CommandList:()=>DV,CommandMenuCommandSchema:()=>u,CommandMenuDisplayPolicy:()=>Mt,CommandMenuPaletteGroupKind:()=>d2,CommandMenuSearchResourceSchema:()=>Lne,CommandSeparator:()=>MV,CommandShortcut:()=>jV,ComponentNotInjected:()=>il,ComponentRegistryKeyBuilder:()=>Vl,ComponentRegistryService:()=>No,ComponentsViewportProvider:()=>Zg,ComposedChildrenRegistryProvider:()=>oY,CompositeLayout:()=>QU,CompositeView:()=>GU,CompositeViewDefinitionBaseSchema:()=>Roe,CompositeViewDefinitionSchema:()=>Bae,CompositeViewProvider:()=>HU,CompositeView_BaseFieldsSchema:()=>Foe,ConnectionStatusNotifier:()=>l$,ConsentBasedProviderActivationsContext:()=>Cx,ConsentBasedProviderSdksProvider:()=>wx,ConsentGateStatus:()=>qb,ConsoleAnalyticsProvider:()=>u$,ContentAreaRenderBranch:()=>q0,ContentSection:()=>ET,ContentSectionContainer:()=>UO,ContentSectionGroup:()=>DT,ContentSectionLegend:()=>OT,ContextLoadingIdentifier:()=>es,ContextMenu:()=>$De,ContextMenuCheckboxItem:()=>rOe,ContextMenuContent:()=>n5,ContextMenuGroup:()=>tOe,ContextMenuItem:()=>nOe,ContextMenuLabel:()=>oOe,ContextMenuRadioGroup:()=>iOe,ContextMenuRadioItem:()=>aOe,ContextMenuSeparator:()=>sOe,ContextMenuShortcut:()=>cOe,ContextMenuSub:()=>lOe,ContextMenuSubContent:()=>r5,ContextMenuSubTrigger:()=>uOe,ContextMenuTrigger:()=>eOe,ControlPanelControlType:()=>u2,ControlPanelItemSchema:()=>_ie,ConversationThreadEntryKind:()=>oQ,ConversationTurnState:()=>sQ,CoreIconRegistry:()=>yf,CrossFrontendHandoffClientError:()=>K3,CustomComponentItemRefSchema:()=>kre,DEFAULT_ACTION_DISCLOSURE:()=>tae,DEFAULT_BUTTON_COMPONENT_REQUIREMENT:()=>Yf,DEFAULT_CHART_STYLE_PRESET:()=>vg,DEFAULT_ICON_CONFIG:()=>If,DEFAULT_INSERTED_VIEW_LAUNCHER:()=>Zae,DEFAULT_MATERIAL_RUNTIME_POLICY:()=>Jg,DEFAULT_MAX_EMBEDDED_RESOURCE_DEPTH:()=>3,DEFAULT_SUMMARY_CHROME_MODE:()=>mG,DEFAULT_VALIDATION_MODE:()=>kT,DUPLICATE_KEY_ERROR_TYPE:()=>sT,DangerZone:()=>xY,DatePicker:()=>tN,DateRangePicker:()=>fN,DateTimePicker:()=>iN,DateTimeRangePicker:()=>hN,DecisionApprovalSeal:()=>rM,DecisionInboxCapability:()=>Bv,DefaultHotkeyHandler:()=>L$,DescriptionDetails:()=>H1,DescriptionList:()=>B1,DescriptionTerm:()=>V1,DeviceInfoSchema:()=>vce,DeviceType:()=>Fy,Dialog:()=>tG,DialogClose:()=>iG,DialogContent:()=>rG,DialogDescription:()=>cG,DialogFooter:()=>oG,DialogHeader:()=>aG,DialogTitle:()=>sG,DialogTrigger:()=>nG,DiffLineKind:()=>C5,DirectoryProvisioningCapability:()=>vv,DisabledActionHandling:()=>Eo,DiscriminatorSwitch:()=>MR,DisplayChromeContext:()=>ik,DisplayChromeProvider:()=>ak,DisplayContextKind:()=>NA,DisplayContextKindProvider:()=>FA,DisplayDiscriminatorSwitch:()=>NR,DisplayField:()=>xR,DisplayFieldAddress:()=>Gj,DisplayFieldArray:()=>j8,DisplayFieldBigDecimal:()=>Kj,DisplayFieldBoolean:()=>Lj,DisplayFieldChrome:()=>sj,DisplayFieldCode:()=>qj,DisplayFieldDate:()=>sM,DisplayFieldDateTime:()=>cM,DisplayFieldDuration:()=>Uj,DisplayFieldEditable:()=>iR,DisplayFieldEnum:()=>Vj,DisplayFieldErrorBoundary:()=>SR,DisplayFieldFile:()=>iM,DisplayFieldFileAudio:()=>T8,DisplayFieldFileDocument:()=>E8,DisplayFieldFileGallery:()=>D8,DisplayFieldFileImage:()=>C8,DisplayFieldFileVideo:()=>w8,DisplayFieldJson:()=>Yj,DisplayFieldMoney:()=>Hj,DisplayFieldNumber:()=>Bj,DisplayFieldPhone:()=>Wj,DisplayFieldRangeBigDecimal:()=>aM,DisplayFieldRangeDate:()=>dM,DisplayFieldRangeDateTime:()=>fM,DisplayFieldRangeMoney:()=>oM,DisplayFieldRangeNumber:()=>uM,DisplayFieldRangeTime:()=>pM,DisplayFieldReadOnly:()=>xM,DisplayFieldString:()=>zj,DisplayFieldTime:()=>lM,DisplayLayout:()=>mA,DisplayTemplateProvider:()=>tk,DisplayValueDispatcher:()=>bM,Divider:()=>lDe,DocumentAcceptanceGateStatus:()=>RH,Drawer:()=>l1,DrawerClose:()=>f1,DrawerContent:()=>d1,DrawerDescription:()=>g1,DrawerFooter:()=>m1,DrawerHeader:()=>p1,DrawerTitle:()=>h1,DrawerTrigger:()=>u1,DropdownMenu:()=>a5,DropdownMenuCheckboxItem:()=>fOe,DropdownMenuContent:()=>s5,DropdownMenuGroup:()=>dOe,DropdownMenuItem:()=>c5,DropdownMenuLabel:()=>l5,DropdownMenuRadioGroup:()=>pOe,DropdownMenuRadioItem:()=>mOe,DropdownMenuSeparator:()=>u5,DropdownMenuShortcut:()=>hOe,DropdownMenuSub:()=>d5,DropdownMenuSubContent:()=>p5,DropdownMenuSubTrigger:()=>f5,DropdownMenuTrigger:()=>o5,Duration:()=>x8,EMPTY_AUTH_STATE:()=>$oe,ENGINE_DEFAULT_HOTKEY_EMIT_SHORTCUTS:()=>I$,ENGINE_PAGE_METADATA:()=>Pl,ENGINE_SETTINGS_DESTINATIONS:()=>Tv,ERROR_DEDUPLICATION_WINDOW_MS:()=>Aee,ERROR_MAX_DUPLICATES:()=>3,EXECUTION_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>qoe,EmbedChart:()=>d9,EmbedComposite:()=>sje,EmbedExecution:()=>cje,EmbedExecutionDecisions:()=>y9,EmbedHostChart:()=>mje,EmbedHostExecution:()=>gje,EmbedHostResourceOperation:()=>lje,EmbedLinkedConversations:()=>uje,EmbedOnboarding:()=>oje,EmbedRelatedChart:()=>hje,EmbedRelatedExecution:()=>_je,EmbedRelatedResourceList:()=>v9,EmbedRelatedResourceOperation:()=>_9,EmbedRelatedResourceSearch:()=>pje,EmbedRepresentationMailboxes:()=>w9,EmbedRepresentationTeam:()=>C9,EmbedResourceOperation:()=>g9,EmbedResourceOwnedChartView:()=>Yve,EmbedResourceOwnedCompositeView:()=>nX,EmbedResourceOwnedExecutionView:()=>Xve,EmbeddedResourceDescentBoundary:()=>iY,EmbeddedResourceHostProvider:()=>RU,EmphasisedActionLabelsProvider:()=>QS,EmptyState:()=>cm,EmptyValueMark:()=>Pj,EngineNavigationEntry:()=>rm,EnginePageItemRefSchema:()=>Yne,EnginePageRef:()=>fo,EnginePageRefSchema:()=>Lre,EnvVariableLoaderFrontendService:()=>zte,EphemeralSessionTokenStorage:()=>$p,ErrorBoundary:()=>Uy,ErrorBuilderFrontend:()=>De,ErrorContext:()=>Vie,ErrorDisplay:()=>zy,ErrorManagementService:()=>Ui,ErrorPageActionSchema:()=>Soe,ErrorPageActionType:()=>dm,ErrorPageConfigDefinitionSchema:()=>Xoe,ErrorPageConfigSchema:()=>Eoe,ErrorPageFeatureGuideItemSchema:()=>Boe,ErrorPageLeadMagnetType:()=>Qoe,ErrorPageSupportAccessSchema:()=>Ooe,ErrorPageSupportType:()=>Aoe,ErrorProvider:()=>bi,EventBusContext:()=>Wi,EventBusProvider:()=>pt,ExecutionAnchorSource:()=>$v,ExecutionConcreteOperationIdentitySchema:()=>Uoe,ExecutionDirtyMarkerScope:()=>ny,ExecutionDirtyMarkerScopeContext:()=>Dy,ExecutionDirtyMarkerScopeProvider:()=>Oy,ExecutionFailedActionScope:()=>oy,ExecutionNavigationHandlingMode:()=>nm,ExecutionNavigationPolicyDefinitionSchema:()=>Noe,ExecutionNavigationPolicyExceptionRuleSchema:()=>xoe,ExecutionParticipationDefinitionSchema:()=>tse,ExecutionParticipationPrefetchIntent:()=>ey,ExecutionParticipationSource:()=>Om,ExecutionRuntimeContext:()=>cy,ExecutionRuntimeProvider:()=>uy,ExecutionSurfaceInOperationSchema:()=>Toe,ExecutionUsageReadState:()=>K6,ExecutionView:()=>$Y,ExecutionViewAnchorBindingSource:()=>Em,ExecutionViewAnchorDefinitionSchema:()=>loe,ExecutionViewDefinitionSchema:()=>Wae,FILE_VALIDATION_ERROR_TYPE:()=>oI,FLOWS_ACTORS_RELATION_VOCABULARY:()=>Ff,FLOWS_ACTORS_STATUS_VOCABULARY:()=>kf,FLOW_STEP_CATEGORY_ICONS:()=>Xf,FLOW_TRIGGER_TYPE_LABEL_KEYS:()=>Xd,FOCUS_INDICATOR_CLASSES:()=>gg,FORM_ERROR_SUMMARY_ATTRIBUTE:()=>WD,FORM_LEVEL_ERROR_PATH:()=>oT,FRONTEND_DECLARED_SCHEMA_KEY:()=>Ju,FRONTEND_PRODUCED_BADGE_SCOPE_ID:()=>i6,FRONTEND_SCHEMA_KEY:()=>Di,FeatureGate:()=>E0,FeatureLimitIndicator:()=>Q3,FeatureLockBadge:()=>QTe,FeatureRouteGuard:()=>Kh,FeatureUnavailableDialog:()=>ZTe,FeatureUnavailablePrompt:()=>zh,FeaturesContext:()=>fh,FeaturesProvider:()=>rg,Field:()=>sx,FieldContent:()=>ux,FieldControlAriaProvider:()=>BM,FieldDescription:()=>dx,FieldError:()=>fx,FieldLabel:()=>cx,FieldScopeProvider:()=>wD,FieldSeparator:()=>ple,FieldTiles:()=>CA,FieldTitle:()=>lx,FieldValueMembersChromeBoundary:()=>sk,FieldVariants_Orientation:()=>ox,FileApprovalSeal:()=>nM,FileUpload:()=>F8,FilesPage_UploadGrant:()=>jZ,Files_UploadGrantDrop:()=>AZ,FlowStepCategory:()=>Fae,FlowsActorsContext:()=>CW,FlowsActorsExecutionStatus:()=>yW,FlowsActorsProvider:()=>wW,FlowsActorsUIUtils:()=>Bd,FlowsActorsView:()=>FQ,FlowsActorsViewDefinitionSchema:()=>Kae,FlowsActors_AgentCard:()=>JEe,FlowsActors_AgentList:()=>qEe,FlowsActors_ApprovalQueue:()=>JW,FlowsActors_ApprovalRequest:()=>RW,FlowsActors_ArtifactItem:()=>VEe,FlowsActors_ArtifactList:()=>BEe,FlowsActors_ExecutionUsage:()=>X6,FlowsActors_ExecutionUsageSummary:()=>Q6,FocusIndicatorShape:()=>a_,Form:()=>NT,FormChromeContext:()=>Xw,FormChromeProvider:()=>Zw,FormContextUtils:()=>FD,FormControl:()=>nDe,FormDescription:()=>rDe,FormErrorSummary:()=>XD,FormErrorSummarySlot:()=>eO,FormField:()=>QL,FormFieldAddress:()=>uL,FormFieldAddress_Preset_Default:()=>lL,FormFieldArray:()=>A8,FormFieldBigDecimal:()=>pL,FormFieldBigDecimal_Preset_Default:()=>fL,FormFieldBoolean:()=>AI,FormFieldBoolean_Preset_Default:()=>kI,FormFieldCheckboxGroup:()=>rI,FormFieldChrome:()=>qM,FormFieldCode:()=>mL,FormFieldComposite:()=>SN,FormFieldContext:()=>R8,FormFieldDate:()=>rN,FormFieldDateTime:()=>oN,FormFieldDateTime_Preset_Default:()=>aN,FormFieldDate_Preset_Default:()=>nN,FormFieldDuration:()=>QI,FormFieldDuration_Preset_Default:()=>ZI,FormFieldEnum:()=>aI,FormFieldEnum_Preset_Default:()=>iI,FormFieldFile:()=>WL,FormFieldFile_Preset_Default:()=>UL,FormFieldLegendVoice:()=>xD,FormFieldMoney:()=>XI,FormFieldMoney_Preset_Default:()=>YI,FormFieldNumber:()=>qI,FormFieldNumber_Preset_Default:()=>KI,FormFieldPhone:()=>aL,FormFieldPhone_Preset_Default:()=>iL,FormFieldPrimitive:()=>aDe,FormFieldRangeBigDecimal:()=>gL,FormFieldRangeBigDecimal_Preset_Default:()=>hL,FormFieldRangeDate:()=>mN,FormFieldRangeDateTime:()=>_N,FormFieldRangeDateTime_Preset_Default:()=>gN,FormFieldRangeDate_Preset_Default:()=>pN,FormFieldRangeMoney:()=>vL,FormFieldRangeMoney_Preset_Default:()=>_L,FormFieldRangeNumber:()=>dN,FormFieldRangeNumber_Preset_Default:()=>uN,FormFieldRangeTime:()=>bN,FormFieldRangeTime_Preset_Default:()=>yN,FormFieldString:()=>GI,FormFieldString_Preset_Default:()=>WI,FormFieldTime:()=>lN,FormFieldTime_Preset_Default:()=>cN,FormItem:()=>eDe,FormItemContext:()=>z8,FormLabel:()=>tDe,FormLayout:()=>tA,FormMessage:()=>iDe,FormRoot:()=>$Ee,FormSchemaContext:()=>nT,FormSchemaKind:()=>eT,FormSchemaProvider:()=>rT,FormTemplateProvider:()=>FT,FrontEndEvent_BasicUser_Schema:()=>uae,FrontendEventBadgeCountChangedSchema:()=>le,FrontendEventBulkJobProgressSchema:()=>Ete,FrontendEventCategory:()=>on,FrontendEventCategoryMap:()=>yte,FrontendEventCustomSchema:()=>Nte,FrontendEventErrorOccuredSchema:()=>Ht,FrontendEventLoadingResourceSchema:()=>nr,FrontendEventNoDataSchema:()=>iie,FrontendEventNotifyCustomSchema:()=>Bn,FrontendEventOrgBillingStatusChangedSchema:()=>Vte,FrontendEventOrgStatusChangedSchema:()=>Sa,FrontendEventOrganizationBrandingChangedSchema:()=>Yte,FrontendEventResourceCustomSchema:()=>li,FrontendEventResourceEditingSchema:()=>f,FrontendEventResourceOperationSchema:()=>Bne,FrontendEventSchemas:()=>xie,FrontendEventUserLoginSchema:()=>jre,FrontendEventUserLogoutSchema:()=>fie,FrontendEventUserPreferencesChangedSchema:()=>Qne,FrontendEventUserStatusChangedSchema:()=>dne,FrontendEvent_AnalyticsMomentAchievedSchema:()=>Hre,FrontendEvent_AppScopeChangedSchema:()=>eu,FrontendEvent_GuidanceElementSchema:()=>wne,FrontendEvent_GuidanceFlowSchema:()=>vre,FrontendEvent_HotkeyCommandMenuOpenSchema:()=>kie,FrontendEvent_HotkeyNotificationsOpenSchema:()=>Mne,FrontendEvent_HotkeyQuickSwitcherOpenSchema:()=>Kne,FrontendEvent_HotkeyShortcutsHelpSchema:()=>Zre,FrontendEvent_HotkeySidebarToggleSchema:()=>Dre,FrontendEvent_LifecycleStageChangedSchema:()=>Ks,FrontendEvent_MilestoneAchievedSchema:()=>ks,FrontendEvent_NavigationClearZoneSchema:()=>ine,FrontendEvent_NavigationCloseSchema:()=>Cu,FrontendEvent_NavigationOrganizationFollowedSchema:()=>iae,FrontendEvent_NavigationPopSchema:()=>gne,FrontendEvent_NavigationPushSchema:()=>qie,FrontendEvent_NavigationReplaceSchema:()=>Mi,FrontendEvent_NavigationRequestSchema:()=>ke,FrontendEvent_NavigationUrlPathUpdatedSchema:()=>Bu,FrontendEvent_NavigationZoneChangedSchema:()=>fte,FrontendEvent_PrimaryScopeChangedSchema:()=>ft,FrontendEvent_ProgressionUpdatedSchema:()=>qe,FrontendEvent_ResourceCollectionFiltersChangedSchema:()=>jee,FrontendEvents:()=>wc,FrontendInsertedViewHostKind:()=>Lp,FrontendInsertedViewIdentitySchema:()=>qae,FrontendInsertedViewKind:()=>_p,FrontendResourceOperationAddressingMode:()=>vse,FrontendResourceOperationContextSchema:()=>Te,FrontendResourceOperationPathSchema:()=>Ka,FrontendResourcePathSchema:()=>Gee,FrontendResource_ParentResourceRequirementSchema:()=>c,FrontendView_DefinitionSchema:()=>zae,FrontendView_ScopeMode:()=>Zp,FullCustomView:()=>aQ,FullCustomViewDefinitionSchema:()=>doe,GENERIC_ERROR_WORDING_BY_ERROR_TYPE:()=>ioe,GRAPH_VIEW_ADMITS_PORT:()=>Iae,GRAPH_VIEW_GATE_PORT:()=>Hd,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:()=>Z2,GUIDANCE_FALLBACK:()=>iU,GenericErrorWording:()=>Loe,GlobalErrorHandler:()=>Xy,GoogleFontPresets:()=>_g,GovernedDocumentAcceptanceControl:()=>qZ,GraphCanvasInteraction:()=>Nf,GraphHandleRole:()=>jf,GraphLegendMark:()=>Bf,GraphNodeSide:()=>Rf,GraphViewEdgeKind:()=>$f,GraphViewLayoutDirection:()=>Gd,GraphViewNodeKind:()=>Pae,GraphViewerPresentation:()=>pf,Group:()=>A9,GroupedSectionBody:()=>Yk,GuidanceAnnouncement:()=>K2,GuidanceBadge:()=>q2,GuidanceBanner:()=>G2,GuidanceCard:()=>J2,GuidanceChecklist:()=>B2,GuidanceChecklistItem:()=>V2,GuidanceContext:()=>ZH,GuidanceContextProvider:()=>bU,GuidanceModal:()=>W2,GuidanceRenderer:()=>r4,GuidanceSurvey:()=>Y2,GuidanceTooltip:()=>U2,GuidanceTour:()=>H2,HOTKEY_DEFAULT_PRIORITY:()=>0,HOTKEY_FRAMEWORK_DEFAULT_PRIORITY:()=>C$,HOTKEY_SCOPE_SPECIFICITY:()=>w$,HTTP_ERROR_BEHAVIOR_MATRIX:()=>Ge,HeaderIconPlacement:()=>Iu,Heading:()=>SY,HomeDefinitionSchema:()=>Koe,HostFormActionsFooter:()=>oE,HostedComponentInteractionsProvider:()=>z2,HostedTriggerAppearance:()=>Kl,HotkeyBindingSchema:()=>xne,HotkeyDispatchableEvent:()=>jn,HotkeyEmitShortcutSchema:()=>oee,HotkeyGroup:()=>yi,HotkeyRegistryContext:()=>O$,HotkeyRegistryProvider:()=>A$,HotkeyScope:()=>cd,HotkeyShortcutsHelpDialog:()=>V$,HoverCard:()=>h5,HoverCardContent:()=>_5,HoverCardTrigger:()=>g5,HumanDecisionForm:()=>r8,I18nContext:()=>jc,I18nProvider:()=>du,ICON_SIZE_MAP:()=>rd,INDICATOR_BADGE_VARIANT:()=>Xg,IconCategory:()=>re,IconCategorySchema:()=>Cte,IconPropsSchema:()=>en,IconRegistryBridge:()=>QQ,IconRegistryContext:()=>Gf,IconRegistryProvider:()=>gf,IconRequestSchema:()=>hte,IconSize:()=>ca,IconSizeSchema:()=>Lt,Identifier:()=>b8,ImageCrop:()=>wL,InMemoryFrontendProviderRegistryFrontendService:()=>Rb,InitializationStatusSchema:()=>Qe,InlineEditMutationError:()=>dj,InlineEditState:()=>jT,InlineEditText:()=>P8,Input:()=>$M,InputGroup:()=>$I,InputGroupAddon:()=>eL,InputGroupButton:()=>tL,InputGroupInput:()=>nL,InputGroupText:()=>ihe,InputGroupTextarea:()=>rL,InputOTP:()=>zI,InputOTPGroup:()=>BI,InputOTPSeparator:()=>Xme,InputOTPSlot:()=>VI,InputRoot:()=>eN,InsertedChartDeclarationSchema:()=>Yae,InsertedViewInputBindingSchema:()=>Joe,InsertedViewInputBindingSource:()=>Qae,InsertedViewLauncherConfigSchema:()=>noe,InsertedViewLauncherPlacement:()=>Mp,InsertedViewRenderSlot:()=>rX,InvoiceHistory:()=>z1,Kbd:()=>R$,LIFECYCLE_DEFAULTS:()=>rU,LOCAL_STORAGE_KEYS:()=>fs,Label:()=>VX,LauncherItemRefSchema:()=>pre,LauncherItemTargetKind:()=>mu,LauncherItemTargetKindSchema:()=>One,LauncherRuntimeAvailabilityConfigSchema:()=>Wne,LauncherVerificationErrorCode:()=>Nv,LauncherVerificationSeverity:()=>Mv,LayoutDivider:()=>Dje,LazyDoorErrorBoundary:()=>RJ,LazyDoorUnavailableFrame:()=>zJ,Link:()=>_X,LinkVariants_Underline:()=>hX,LinkVariants_Variant:()=>mX,LinkVariants_Weight:()=>gX,LoadingBarrier:()=>Ice,LoadingContext:()=>Ym,LoadingGate:()=>nb,LoadingOverlay:()=>eb,LoadingPhase:()=>lu,LoadingProvider:()=>Lm,LoadingSpinner:()=>$y,LoadingTier:()=>el,LoadingTreatment:()=>Il,LoggerFrontendService:()=>rs,MOBILE_DETAIL_MAX_PRIMARY_ACTIONS:()=>1,MOBILE_SUMMARY_MAX_PRIMARY_ACTIONS:()=>0,MainContextInitComponents:()=>Pe,MarkdownEditor:()=>PI,MaterialRefractiveBudgetManager:()=>r_,MaterialRuntimeGroup:()=>Vg,MaterialRuntimePolicyProvider:()=>Hg,MenuBarDisplayPolicy:()=>Hoe,Menubar:()=>uDe,MenubarCheckboxItem:()=>mDe,MenubarContent:()=>J8,MenubarGroup:()=>fDe,MenubarHostedComponentSchema:()=>Kre,MenubarItem:()=>pDe,MenubarLabel:()=>_De,MenubarLauncherItemSchema:()=>Cre,MenubarMenu:()=>dDe,MenubarRadioGroup:()=>hDe,MenubarRadioItem:()=>gDe,MenubarSeparator:()=>vDe,MenubarShortcut:()=>yDe,MenubarSub:()=>bDe,MenubarSubContent:()=>Y8,MenubarSubTrigger:()=>xDe,MenubarTrigger:()=>q8,MilestoneStatus:()=>TU,MissingRMMRuntimeError:()=>ua,ModifierKey:()=>x$,NAVIGATION_STRUCTURAL_ZONES:()=>pr,NON_CANONICAL_SHELL_SURFACE_POLICY_OVERRIDE:()=>WE,NOTIFICATION_DISPLAY_POLICY:()=>_se,NOTIFICATION_SOURCE_OVERRIDES:()=>Wh,NavigationBackHost:()=>xB,NavigationContentAreas:()=>r2,NavigationContentRenderer:()=>L0,NavigationContentSchema:()=>nte,NavigationContentType:()=>od,NavigationContext:()=>dh,NavigationInitiatorContextSchema:()=>de,NavigationItemBadge:()=>G8,NavigationItemType:()=>ra,NavigationMenu:()=>SDe,NavigationMenuContent:()=>TDe,NavigationMenuIndicator:()=>ODe,NavigationMenuItem:()=>wDe,NavigationMenuLink:()=>DDe,NavigationMenuList:()=>CDe,NavigationMenuTrigger:()=>EDe,NavigationMenuViewport:()=>kDe,NavigationOperationOverrideSchema:()=>We,NavigationOverlays:()=>i2,NavigationPlacementAdjustment:()=>cn,NavigationProvider:()=>Zm,NavigationSource:()=>Qi,NavigationStackEntrySchema:()=>Pte,NavigationTransitionSource:()=>Wt,NavigationUtils:()=>zm,NavigationZone:()=>rr,NavigationZoneSchema:()=>aie,NetworkOfflineError:()=>Yn,NetworkOfflineReason:()=>tie,NotificationBadgeMemoryBoundary:()=>i$,NotificationContext:()=>oh,NotificationIndicator:()=>y8,NotificationProvider:()=>Bm,ObjectScope:()=>jR,OfflineReplayPolicy:()=>Nn,OnboardingView:()=>o9,OnboardingViewDefinitionSchema:()=>op,OperationsConfirmCritical:()=>Pw,OverlayContainer:()=>y1,PRIMARY_SCOPE_FIELDS:()=>wee,PROFESSIONAL_QUALIFICATIONS_DECLARED_CAPABILITY:()=>wv,PROGRESSION_DEFAULTS:()=>nU,PROVIDER_ADDRESS_LOOKUP_DEBOUNCE_MS:()=>300,PROVIDER_ADDRESS_LOOKUP_MINIMUM_QUERY_LENGTH:()=>3,Pagination:()=>gOe,PaginationContent:()=>_Oe,PaginationEllipsis:()=>SOe,PaginationItem:()=>vOe,PaginationLink:()=>yOe,PaginationNext:()=>xOe,PaginationPrevious:()=>bOe,PasskeyAutofillExpiredError:()=>Dm,PasskeyAutofillSupersededError:()=>Coe,PasskeySignInMediation:()=>Tm,PasswordInput:()=>LI,PendingDecisionsReadState:()=>fW,PersistentSessionTokenStorage:()=>boe,PlanChangePreview:()=>I1,Popover:()=>pq,PopoverAnchor:()=>gq,PopoverContent:()=>hq,PopoverTrigger:()=>mq,PortalContainerContext:()=>w2,PricingTable:()=>L1,Progress:()=>b_,ProgressionAchievementBadge:()=>eEe,ProgressionMilestoneTracker:()=>IU,ProviderAddressLookupAttribution:()=>gx,ProviderAddressLookupCombobox:()=>vx,ProviderAddressLookupHost:()=>xx,ProviderAddressLookupNotice:()=>bx,ProviderAddressLookupPlaceWithoutAddressError:()=>hx,ProviderAddressLookupRejectionKind:()=>nx,ProviderFilePickerHost:()=>ax,ProviderFileSelectionRejectionKind:()=>ex,PublicLayoutPreset_AuthCallback_Default:()=>yX,PublicLayoutPreset_ChatIdentityLink_Default:()=>zZ,PublicLayoutPreset_EnrollmentRequired_Default:()=>nZ,PublicLayoutPreset_FileUploadGrant_Default:()=>kZ,PublicLayoutPreset_MagicLinkVerify_Default:()=>CX,PublicLayoutPreset_MfaChallenge_Default:()=>$X,PublicLayoutPreset_OAuthConsent_Default:()=>PZ,PublicLayoutPreset_OAuthLoggedOut_Default:()=>VZ,PublicLayoutPreset_OAuthLogoutConfirm_Default:()=>WZ,PublicLayoutPreset_OneOffSession_Default:()=>wZ,PublicLayoutPreset_OrganizationOnboarding_Default:()=>sZ,PublicLayoutPreset_StaticContentContainer_Default:()=>M3,PublicLayoutPreset_UserAuth_Default:()=>fZ,PublicLayoutPreset_UserConfirmEmail_Default:()=>hZ,PublicLayoutPreset_UserInvitation_Default:()=>SZ,PublicLayoutPreset_UserPasswordLost_Default:()=>MZ,PublicLayoutPreset_UserRegister_Default:()=>XZ,PublicLayout_LegalNotice:()=>$Z,PublicLayout_MainContainer:()=>pX,PublicLayout_StaticContentContainer:()=>PTe,PublicLayout_Terms:()=>QZ,PublicShellIdentityMode:()=>tm,QuickActionButtonPlacement:()=>zs,QuickActionButtonPlacementSchema:()=>Ss,QuickActionDisplayPolicy:()=>he,QuickActionItemSchema:()=>tne,QuickActionPlacement:()=>Moe,QuickSwitcherFieldControlKind:()=>c2,QuickSwitcherFieldPresentation:()=>Gp,QuickSwitcherPlacement:()=>ese,QuickSwitcherScopeFieldSchema:()=>ase,READ_RETRY_FIRST_DELAY_MS:()=>ZJ,READ_RETRY_MAX_DELAY_MS:()=>QJ,REGIONAL_PREFERENCE_FRAMEWORK_FLOOR:()=>gs,RETRYABLE_CLIENT_ERROR_STATUSES:()=>uc,REVEAL_FIELD_EVENT:()=>ID,RUNTIME_SCOPED_STORAGE_KEYS:()=>Qre,RadioGroup:()=>CF,RadioGroupItem:()=>TF,RadioGroupRoot:()=>wF,RangeSlider:()=>ZM,RecordApprovalSeal:()=>pfe,RecordFactRole:()=>EA,RecordKeepingFacts:()=>TA,RecordState:()=>wA,RegionalReaderStanding:()=>ene,RegionalReaderStandingPublisherContext:()=>Dne,RegistrationOutcome:()=>Ap,RelatedResourcePreview:()=>ije,RelatedResourcePreviewSurface:()=>a9,RelatedResourceSections:()=>E9,RelationshipShapeCapability:()=>gv,RelationshipSideCapability:()=>pv,ResizableHandle:()=>$$,ResizablePanel:()=>Q$,ResizablePanelGroup:()=>Z$,ResolvedInsertedChartDescriptorSchema:()=>moe,ResolvedInsertedViewDescriptorSchema:()=>voe,ResourceAutomatedForm:()=>vB,ResourceAutomaticDisplayer:()=>eY,ResourceCollectionQuickFilterTabs:()=>uq,ResourceDisplayContext:()=>lj,ResourceEmptyState:()=>cK,ResourceFieldDisplay_ResourceReference:()=>Rj,ResourceFieldEdit_ResourceReference:()=>yI,ResourceFormActionsProvider:()=>iE,ResourceFrontend_EmptyStateSecondaryActionType:()=>Wr,ResourceFrontend_GuidanceFlowTriggerType:()=>lre,ResourceHeaderContextProvider:()=>HB,ResourceHeaderLeading:()=>JB,ResourceHeaderTitle:()=>qB,ResourceHeaderTitleHeading:()=>WB,ResourceHeaderTitlePlaceholder:()=>GB,ResourceLayoutInlineEditDefault:()=>E,ResourceLayoutPreset_Action_Default:()=>QW,ResourceLayoutPreset_Breadcrumb_Default:()=>PB,ResourceLayoutPreset_ContainerDialogs_Default:()=>O3,ResourceLayoutPreset_ContainerNested_Default:()=>_Y,ResourceLayoutPreset_Create_Default:()=>uG,ResourceLayoutPreset_Create_SamlWizard:()=>t9,ResourceLayoutPreset_DangerZone_Default:()=>wY,ResourceLayoutPreset_Filters_Default:()=>k3,ResourceLayoutPreset_Header_Default:()=>lV,ResourceLayoutPreset_List_Default:()=>uX,ResourceLayoutPreset_OperationsBulk_Default:()=>FJ,ResourceLayoutPreset_OperationsItems_Default:()=>yY,ResourceLayoutPreset_Pagination_Default:()=>rK,ResourceLayoutPreset_ReadSummary_Default:()=>j3,ResourceLayoutPreset_Read_Default:()=>FY,ResourceLayoutPreset_Read_Expandable:()=>A3,ResourceLayoutPreset_Read_SsoSaml:()=>n9,ResourceLayoutPreset_RecordSharing_Default:()=>jY,ResourceLayoutPreset_Search_Default:()=>zY,ResourceLayoutPreset_Update_Default:()=>VY,ResourceLayout_Action:()=>$W,ResourceLayout_Breadcrumb:()=>IB,ResourceLayout_ContainerDialogs:()=>OTe,ResourceLayout_ContainerNested:()=>vY,ResourceLayout_Create:()=>dG,ResourceLayout_DangerZone:()=>TY,ResourceLayout_Filters:()=>kTe,ResourceLayout_Header:()=>uV,ResourceLayout_InsertedViews:()=>aX,ResourceLayout_List:()=>dX,ResourceLayout_OperationBulk:()=>IJ,ResourceLayout_OperationsItems:()=>bY,ResourceLayout_Pagination:()=>iK,ResourceLayout_Read:()=>LY,ResourceLayout_ReadSummary:()=>jTe,ResourceLayout_RecordSharing:()=>MY,ResourceLayout_Search:()=>BY,ResourceLayout_Update:()=>HY,ResourceOperationActionPresentation:()=>cc,ResourceOperationActionScope:()=>Sr,ResourceOperationFrontendConfigSchema:()=>See,ResourceOperationItemRefSchema:()=>Fie,ResourceRegistryContext:()=>im,ResourceRegistryProvider:()=>qp,ResourceSummaryDisplayer:()=>_G,ResourceViewItemRefSchema:()=>$ie,ResourcesRepositoryFrontendService:()=>FS,RouterErrorBoundary:()=>qy,SCAFFOLD_SETTINGS_HUB_CONFIG:()=>Nse,SCAFFOLD_SETTINGS_RAIL_GROUPS:()=>Ev,SCOPE_PARAM_PREFIX:()=>zee,SERVER_ERROR_TYPE:()=>iT,SESSION_STORAGE_KEYS:()=>Ore,SETTINGS_HUB_TITLE_LABEL_KEY:()=>Jm,SHELL_ANCHORED_POPUP_ORIGINS:()=>K4,SHELL_CENTRED_POPUP_SLOTS:()=>nTe,SHELL_GHOST_ATTRIBUTE:()=>N4,SHELL_GHOST_LAYER_ATTRIBUTE:()=>M4,SHELL_MODAL_POPUP_SLOTS:()=>q4,SHELL_OBJECT_ATTRIBUTE:()=>j4,SHELL_PANE_SELECTOR:()=>z4,SHELL_PICTURE_STRIPPED_ATTRIBUTES:()=>P4,SHELL_POPUP_OPEN_STATES:()=>J4,SHELL_PRESS_ORIGIN_MAX_AGE_MS:()=>800,SHELL_PROXY_ATTRIBUTE:()=>A4,SHELL_PROXY_FLIGHT_SHARE:()=>k4,STATUS_BAR_PLACEMENTS:()=>Ate,SameSite:()=>Iy,ScopeChangeInitiator:()=>At,ScopeUtilsService:()=>Qp,ScopedNavigationControllerContext:()=>SS,ScrollArea:()=>af,ScrollAreaType:()=>rf,ScrollBar:()=>of,Section:()=>Jk,SectionLegendVoiceHost:()=>bD,SectionSaveButton:()=>Zk,SectionStageBindingError:()=>NO,SectionStageState:()=>MO,Select:()=>gF,SelectContent:()=>yF,SelectGroup:()=>ume,SelectItem:()=>xF,SelectLabel:()=>dme,SelectMultiple:()=>IF,SelectPosition:()=>mF,SelectRoot:()=>_F,SelectScrollDownButton:()=>mme,SelectScrollUpButton:()=>pme,SelectSeparator:()=>fme,SelectTrigger:()=>vF,SelectValue:()=>bF,Separator:()=>T1,SessionEndReason:()=>j,SessionEstablishment:()=>fc,SettingsHubVerificationErrorCode:()=>Wv,SettingsHubVerificationSeverity:()=>Uv,SettingsPanelRef:()=>fv,SettingsSectionItemRefSchema:()=>So,SettingsSectionTargetKind:()=>dv,Sheet:()=>t1,SheetClose:()=>SSe,SheetContent:()=>r1,SheetDescription:()=>s1,SheetFooter:()=>a1,SheetHeader:()=>i1,SheetTitle:()=>o1,SheetTrigger:()=>n1,ShellDialogArrival:()=>O4,ShellGhostKind:()=>F4,ShellGhostLayer:()=>I4,ShellGhostPose:()=>w4,ShellIdentitySchema:()=>woe,ShellLayoutFamily:()=>g4,ShellLayoutPlacementKind:()=>h4,ShellMotionDip:()=>T4,ShellPaneArrival:()=>E4,ShellPaneResize:()=>D4,ShellPlaceChange:()=>C4,ShellPopupSlot:()=>G4,Sidebar:()=>ADe,SidebarCollapsible:()=>Q8,SidebarContent:()=>jDe,SidebarFooter:()=>MDe,SidebarGroup:()=>NDe,SidebarGroupAction:()=>PDe,SidebarGroupContent:()=>FDe,SidebarGroupLabel:()=>IDe,SidebarHeader:()=>LDe,SidebarHomeDisplayMode:()=>Gu,SidebarHostedComponentSchema:()=>Ci,SidebarInput:()=>RDe,SidebarInset:()=>zDe,SidebarItemDisplayPolicy:()=>dn,SidebarItemSchema:()=>xe,SidebarMenu:()=>BDe,SidebarMenuAction:()=>VDe,SidebarMenuBadge:()=>HDe,SidebarMenuButton:()=>UDe,SidebarMenuButtonVariant:()=>$8,SidebarMenuItem:()=>WDe,SidebarMenuSkeleton:()=>GDe,SidebarMenuSub:()=>KDe,SidebarMenuSubButton:()=>qDe,SidebarMenuSubItem:()=>JDe,SidebarProvider:()=>YDe,SidebarRail:()=>XDe,SidebarResourceBrowser:()=>e9,SidebarResponsivePolicy:()=>Au,SidebarResponsivePolicySchema:()=>cte,SidebarSectionBehavior:()=>it,SidebarSectionContentKind:()=>ze,SidebarSectionContentKindSchema:()=>Dee,SidebarSectionInlineCreate:()=>Sc,SidebarSectionSchema:()=>S,SidebarSection_CustomComponentSchema:()=>nre,SidebarSection_GuidanceWidgetSchema:()=>lee,SidebarSection_NavigationListSchema:()=>bee,SidebarSection_ResourceBrowserSchema:()=>ei,SidebarSeparator:()=>ZDe,SidebarTrigger:()=>QDe,SidebarVariant:()=>Z8,Skeleton:()=>um,Slider:()=>YM,SliderRoot:()=>XM,StackedActions:()=>DOe,StackedAside:()=>AOe,StackedBody:()=>kOe,StackedContent:()=>jOe,StackedHeader:()=>wOe,StackedLayout:()=>COe,StackedSection:()=>MOe,StackedSubtitle:()=>EOe,StackedTitle:()=>TOe,StackedToolbar:()=>OOe,StandardIconReference:()=>H,StandardIconReferenceSchema:()=>rie,StartApplicationFrontendService:()=>qQ,StatusBarDisplayInteractionType:()=>l2,StatusBarItemSchema:()=>ise,StatusBarItemType:()=>$i,StatusBarPlacementSchema:()=>Ite,StepUpAuthContext:()=>TH,StepUpAuthProvider:()=>EH,StepUpRefusalOrigin:()=>Ki,Stepper:()=>EO,StepperDescription:()=>jO,StepperIndicator:()=>OO,StepperItem:()=>DO,StepperSeparator:()=>kO,StepperTitle:()=>AO,Strong:()=>p_,Subheading:()=>CY,SubmitButton:()=>nO,SubscriptionStatus:()=>N1,SummaryFlow:()=>OR,SummaryHeader:()=>D9,SummaryLayout:()=>AR,SummaryMeta:()=>vG,SummaryTitle:()=>ER,SummaryTitlePlacement:()=>DR,SummaryTitleScale:()=>TR,Surface:()=>_D,SurfaceAction:()=>gD,SurfaceBody:()=>mD,SurfaceErrorBoundary:()=>BE,SurfaceFooter:()=>hD,SurfaceHeader:()=>pD,SurfacePolicyContext:()=>Je,SurveyBindingWriteOutcome:()=>pU,Switch:()=>CI,SwitchRoot:()=>wI,TONE_DOT_CLASS:()=>Yd,TONE_INK:()=>Nae,TONE_MARKER_COLOUR:()=>_f,TONE_MARKER_FILL:()=>Uf,Table:()=>gJ,TableBody:()=>vJ,TableCaption:()=>P_e,TableCell:()=>xJ,TableFooter:()=>N_e,TableHead:()=>bJ,TableHeader:()=>_J,TableRow:()=>yJ,Tabs:()=>sO,TabsActivationMode:()=>rO,TabsContent:()=>uO,TabsLevel:()=>iO,TabsLevelContext:()=>aO,TabsList:()=>cO,TabsTrigger:()=>lO,Text:()=>Z,TextDirection:()=>Rd,TextLink:()=>v_,TextSize:()=>Le,TextVariant:()=>zr,Textarea:()=>MI,TextareaRoot:()=>NI,TimePicker:()=>sN,TimeRangePicker:()=>vN,Timeline:()=>zf,TimelineActions:()=>Tf,TimelineBody:()=>uf,TimelineEntry:()=>Pf,TimelineMarker:()=>Vf,TimelineTime:()=>mf,Toaster:()=>ZQ,Toggle:()=>L8,ToggleGroup:()=>yO,ToggleGroupAppearance:()=>_O,ToggleGroupBoolean:()=>OI,ToggleGroupItem:()=>bO,ToggleGroupType:()=>gO,ToggleVariants_Variant:()=>I8,ToolbarItemRefSchema:()=>St,ToolbarItemSchema:()=>_n,Tooltip:()=>ej,TooltipContent:()=>nj,TooltipProvider:()=>rj,TooltipTrigger:()=>tj,TruncatedText:()=>m8,TypographyScope:()=>h_,UIContext:()=>t_,UIProvider:()=>Bg,UNIQUE_ERROR_TYPE:()=>aT,UpdateLikeMutationFallbackMode:()=>Bt,UsageDashboard:()=>R1,UserDropdownAvatarDisplay:()=>Np,UserDropdownSection:()=>ip,UserOrgsContext:()=>th,UserOrgsProvider:()=>Pm,UtilityPanelItemSchema:()=>ur,ValidationMode:()=>ta,ViewItemRefSchema:()=>Qee,ViewLayout_Header:()=>QY,ViewNotFound:()=>u_,WINDOW_EVENTS_SLUGS:()=>_e,WebSocketContext:()=>sm,WebSocketEventBridge:()=>o$,WebSocketProvider:()=>Cm,WebSocketResourceValidationService:()=>HJ,WebSocketStatus:()=>Xp,WildoBackendHttpClient:()=>oa,WildoBackendHttpClient_ManualCalls:()=>Ir,WildoBackendHttpClient_Resources:()=>Mx,WizardLayout:()=>Tje,WizardStep:()=>O9,ZoneContentRenderer:()=>z0,_clearContributedProviderComponentLoaders:()=>ule,actionBarItemCannotRun:()=>JS,actorActivityLabelKey:()=>f6,actorModeDescriptionKey:()=>l6,actorModeLabelKey:()=>c6,actorRoleLabelKey:()=>s6,actorSystemExecutionGraph:()=>tf,addElement:()=>Kje,allocateActionBarSlots:()=>YS,allowsDirectOperationFallback:()=>tr,appendFileServeVariant:()=>rH,appendNavChildrenToSidebarSection:()=>ev,applyChartColorPalette:()=>Og,applyCustomTokens:()=>qg,applyDesignSystemConfiguration:()=>mg,applyDesignTokens:()=>Kg,applyFrontendConfigOverrides:()=>Py,applyTypographyConfiguration:()=>Eg,arrangeChartDashboardTiles:()=>I9,assertExecutionDirtyMarkerShape:()=>ry,assertExecutionEmbeddableContent:()=>ay,assertExecutionFailedActionShape:()=>sy,assertExecutionLocalPanePayloadIsNotEmbeddableContent:()=>iy,assertExecutionPendingPrefetchShape:()=>ty,assertExecutionRuntimeContext:()=>ly,assertRegistryCompleteness:()=>zTe,assertSectionStageBinding:()=>PO,attachBackendErrorEnvelope:()=>fee,authFactorLevelForUiLevel:()=>coe,backendNotificationDestination:()=>xse,backendNotificationI18nParams:()=>Cse,badgeVariantIndicator:()=>e_,brandShellLayoutMainContainer:()=>b4,buildAppLoadingScope:()=>mse,buildApplicationCompositeViewDefinitions:()=>bp,buildApplicationCompositeViewTranslationRef:()=>Cp,buildApplicationViewTranslationRef:()=>Zoe,buildAuthoredIconRegistry:()=>$Q,buildChartRouteUrlPath:()=>Rp,buildCompositeRouteUrlPath:()=>Ep,buildContextLoadingScope:()=>yse,buildExecutionConcreteOperationIdentity:()=>rse,buildExecutionDirtyMarker:()=>_ce,buildExecutionFailedAction:()=>my,buildExecutionRouteUrlPath:()=>Pp,buildFileServeThumbnailUrl:()=>iH,buildFrontendInsertedViewRef:()=>_oe,buildFrontendModuleAppComponentsConfiguration:()=>uv,buildFrontendModuleAppScope:()=>cv,buildFrontendModuleConfigOverrides:()=>Ny,buildFrontendModuleRegistry:()=>sv,buildFrontendModuleSidebarSections:()=>lv,buildLoadingScopeKey:()=>$m,buildOmniboxRecordContextIdentifiers:()=>q7,buildResolvedInsertedChartDescriptor:()=>pp,buildResourceCompositeViewTranslationRef:()=>up,buildResourceFileServeBaseUrl:()=>nH,buildResourceInsertedChartIdentity:()=>vp,buildResourceInsertedCompositeIdentity:()=>hp,buildResourceInsertedExecutionIdentity:()=>cp,buildResourceLoadingScope:()=>dg,buildScopeConditionParams:()=>X3,buildSummaryRecordIdentifiers:()=>hG,calculateGlassBezelResponse:()=>Qg,calculateGlassBoundaryCoverage:()=>Yg,calculateGlassEdgeResponse:()=>Wg,calculateGlassRefractionProfile:()=>Ug,calculateRoundedRectangleOutwardNormal:()=>Lg,canExportWithinAllowedMimeTypes:()=>PL,cardsAfterWithdrawal:()=>uW,cascadeShellRows:()=>s3,choreographyGraph:()=>Rae,clampCropOffset:()=>OL,clampStaticSidePanels:()=>Y0,classifyRecordFact:()=>jA,classifyRegistrationOutcome:()=>ose,clearAllProviderScopeReauthorizationOffers:()=>v,clearAppliedDesignTokens:()=>Dg,clearProviderScopeReauthorizationOffer:()=>rc,clickDownloadLink:()=>Ry,cn:()=>U,collectBillingProviderLabelKeys:()=>j1,collectErroredFieldPaths:()=>GD,collectExecutionViewSurfaceRefsByOperation:()=>Gae,collectFrontendChartRegistrationRefs:()=>Yoe,collectFrontendChartRegistrationRefsFromUIBehavior:()=>$ae,collectFrontendProviderDisplayLabelKeys:()=>cb,collectOperationLikeViewRefs:()=>ooe,collectResourceLabelFieldEntries:()=>dl,combineModuleSidebarSections:()=>X_,composeConsentDecision:()=>Yb,composeUiBehaviorPresentation:()=>AS,computeCoverScale:()=>DL,computeCropSourceRect:()=>kL,computePanelSizes:()=>Z0,computeRegistryCompleteness:()=>P3,computeSurfacePolicyContextValue:()=>Kr,configureClientInstanceIdPolicy:()=>Bo,consentWithdrawalCost:()=>Xb,contributeProviderComponentLoaders:()=>Gb,conversationThreadModel:()=>fQ,countDiffLines:()=>E5,createComponentResolver:()=>G,createComponentResolverWithRef:()=>Ml,createCompoundComponentResolver:()=>Xs,createCompoundPreset:()=>sne,createDesignSystemConfigurationFromSourceConfig:()=>BTe,createEmojiIcon:()=>Af,createEmptyOnboardingView:()=>Gje,createFrontendInsertedViewIdentity:()=>yoe,createFrontendProviderRegistryFrontendService:()=>zb,createOpenSessionOverlayModeResolver:()=>v1,createPolymorphicFrontendPreset:()=>Iee,createShellLayoutMainContainer:()=>x4,darkModeUtils:()=>kg,debugSectionVisibility:()=>Z3,decisionQuestionOf:()=>GW,decisionStepUpRequestOfRefusal:()=>Nt,defaultChartDashboardTileHeight:()=>R9,defaultOfflineReplayPolicyForMethod:()=>Aa,defaultTheme:()=>jg,defineChartDashboardView:()=>Wje,defineCompositeView:()=>yp,deriveBreadcrumbAncestors:()=>NB,deriveConsentGateState:()=>Jb,deriveDecisionInboxCapabilities:()=>Hv,deriveDirectoryProvisioningCapabilities:()=>bv,deriveRegionalReaderStanding:()=>Nie,deriveRelationshipShapeCapabilities:()=>_v,deriveRelationshipSideCapabilities:()=>hv,describeDecisionHolder:()=>zW,describeDecisionRequester:()=>VW,describePauseState:()=>FW,describeReasonCodeOptions:()=>PW,deserializeOnboardingView:()=>$je,determineValidationMode:()=>xL,documentReadKey:()=>KZ,embeddedResourceDescentKey:()=>m9,emptyValueTypographyFor:()=>Ij,envLoader:()=>ya,errorManagement:()=>lt,evaluateGlassSurfaceHeight:()=>i_,executionPlanGraph:()=>ef,exportCroppedImageFile:()=>IL,extractChartRouteContextResourceIdentifiers:()=>Hp,extractChartRouteUrlParamValues:()=>Bp,extractCompositeRouteContextResourceIdentifiers:()=>jp,extractEphemeralFields:()=>KS,extractErrorInfo:()=>O,extractExecutionRouteContextResourceIdentifiers:()=>om,extractPrimaryFontFamily:()=>yg,extractSchemaFieldList:()=>FR,fieldRevealPanelAttributes:()=>HD,fieldsHoldingTheRecordName:()=>MA,fileTypeIsAccepted:()=>OZ,filterVisibleSections:()=>Y3,findDuplicateAppScopeResourceTypes:()=>wm,findProviderScopeReauthorizationOffer:()=>_r,findUnknownDestinationRefs:()=>Av,flowGraph:()=>nf,flowGraphInputOf:()=>Lae,flowGraphNodeId:()=>Wd,flowNodeStatusIndicator:()=>Sf,flowStepCategory:()=>Jf,flowTriggerTypeVisual:()=>Qd,flowsActorsStatusColour:()=>bf,flowsActorsStatusDotClass:()=>sf,flowsActorsStatusIsMoving:()=>Kf,flyShellProxy:()=>r3,focusIndicatorClasses:()=>Mg,fontConfigToGoogleFontConfig:()=>Sg,forgetNotificationBadgeCounts:()=>r$,formatBadgeCount:()=>Jt,formatHsvAsCssColor:()=>GTe,formatRgbAsCssColor:()=>W3,generateChartConfig:()=>Tg,generateDefaultDisplayTemplate:()=>WR,generateDefaultFormTemplate:()=>zR,generateDefaultSummaryTemplate:()=>XR,generateGoogleFontsUrl:()=>Ag,generateTokensCSS:()=>c_,getChartColorPaletteFromCSS:()=>hg,getChartColors:()=>Pg,getClientInstanceId:()=>yre,getClientInstanceIdScope:()=>Aie,getCommonEnumDisplayConfig:()=>d_,getCompletionPercentage:()=>Yje,getContentKey:()=>I0,getElementsByType:()=>Zje,getFieldError:()=>cI,getIconAnimation:()=>Cf,getLoadingStats:()=>xTe,getLocalStorageItem:()=>qs,getManualCallsHttpClient:()=>vc,getNotificationDisplayBehavior:()=>hse,getProviderScopeReauthorizationOffers:()=>Er,getReadinessChecker:()=>fne,getTailwindColor:()=>xg,getZodErrorCode:()=>ghe,getZodErrorParams:()=>SL,graphViewParentOf:()=>Kd,graphViewerEdgeLabelKey:()=>Df,growShellPane:()=>i3,hasValidAnimationSource:()=>xf,hslToRgb:()=>H3,hsvToRgb:()=>V3,humanDecisionFormLabels:()=>$6,humanDecisionQuestionOf:()=>WW,indicatorBadgeVariant:()=>Gg,installShellLayoutStylesheet:()=>X4,isApiNotReadyError:()=>cl,isBackendRefusal:()=>jr,isBackendRefusalShownToUser:()=>ii,isCollectionScopedOperation:()=>Et,isCroppableRasterImageFile:()=>TL,isCustomComponentNavigationItem:()=>Un,isDirectlyDisplayableImageUrl:()=>p2,isEmphasisButtonVariant:()=>$d,isEnginePageNavigationItem:()=>Wte,isErrorMarkedByHttpClient:()=>py,isFinalBackendRefusal:()=>Ot,isFrontendOperationAddressableForCurrentContext:()=>Gh,isGlyphKey:()=>T$,isGoogleFont:()=>Ng,isHostedInShellChrome:()=>v2,isNamelessDisplayContent:()=>kA,isNetworkOfflineRejection:()=>ha,isOnboardingComplete:()=>Xje,isOperationAddressable:()=>Sn,isOperationHeadless:()=>fr,isRecordSharingOffered:()=>AY,isRequiredFieldError:()=>sI,isResourceNavigationItem:()=>wa,isResourceReachable:()=>koe,isSectionVisible:()=>J3,isSelfReferencingRelatedCollectionTarget:()=>H6,isSettingsHubNavigationItem:()=>Zte,isShellLayoutMainContainer:()=>v4,isShellSidePane:()=>U4,isShellSideZone:()=>W4,isSidebarConfigObject:()=>a2,isSpentOrganizationOnboardingSession:()=>Vae,isStandaloneRoutableCompositeView:()=>sse,isStandaloneRoutableExecutionView:()=>np,isStandaloneRoutableInsertedChartView:()=>Wp,isStandaloneRoutableInsertedCompositeView:()=>Hae,isStandaloneRoutableResolvedCompositeView:()=>Ip,isStatusBarConfigObject:()=>o2,isStatusBarPlacement:()=>or,isUnrevokedScimTokenProbeNeeded:()=>yv,isUtilityPanelComponentRegistered:()=>P7,isUtilityPanelConfigObject:()=>s2,isViewNavigationItem:()=>Kee,launcherItemRefKey:()=>$_,layoutGraphView:()=>Jd,listContributedProviderComponentLoaders:()=>Kb,loadCroppableImage:()=>EL,loadCustomComponents:()=>bTe,loadFontsFromTypography:()=>Fg,loadGoogleFonts:()=>bg,makeComponentLabelResolver:()=>pm,makeShellPicture:()=>v3,mapApplicationLevelToFrontendComponentType:()=>f2,matchesExecutionConcreteOperationIdentity:()=>Ioe,matchesShortcut:()=>D$,mergeAppModes:()=>J_,mergeAppScope:()=>q_,mergeCommandMenuCommandLists:()=>tv,mergeDesignSystemConfiguration:()=>wg,mergeFrontendComponentRegistrations:()=>ov,mergeFrontendDomainModules:()=>Ase,mergeFullCustomViewsByRef:()=>rv,mergeHotkeyEmitShortcuts:()=>N$,mergeMenubarLauncherItems:()=>nv,mergeQuickSwitcherFields:()=>Q_,mergeSidebarSections:()=>Y_,mergeSurfacePolicy:()=>Tc,obtainStepUpToken:()=>DH,offsetWithin:()=>m3,olderHistoryCursor:()=>_Q,onboardingObligationsFromSessionState:()=>oZ,operationTargetsCurrentResource:()=>gse,optionalMaxInlineSizeStyle:()=>tD,organizationOnboardingNavigationTarget:()=>Fp,parkedOrganizationOnboardingSessionId:()=>Jae,parseChartColorPalette:()=>$g,parseCssColorToRgb:()=>L3,parseFrontendInsertedViewRef:()=>Op,parseShortcut:()=>E$,parseUnifiedDiff:()=>T5,pickInlineFieldWriteOperation:()=>uh,pickPreferredOperationForCoreSemanticAddressability:()=>lh,playbookCatalogGraph:()=>Lf,playbookCatalogNodeId:()=>Ud,polymorphicResourceUIBehavior:()=>ete,polymorphicResourceUIBehaviorFrom:()=>lae,providerScopeReauthorizationOfferKey:()=>Xr,pruneDirtyMarkersForPaneTransition:()=>My,pruneDirtyMarkersForScopeChange:()=>jy,pruneFailedActionsForPaneTransition:()=>fy,pruneFailedActionsForPrefetchSettlement:()=>hy,pruneFailedActionsForScopeChange:()=>dy,publishNotificationBadgeCount:()=>n$,readAllConversationHistory:()=>vQ,readBrowserRegionalEvidence:()=>Zie,readComputedCssColorViaDom:()=>z3,readDisplayableErrorFacts:()=>tp,readProviderScopeReauthorizationOffer:()=>vt,receiveProviderAddressLookupSelection:()=>rx,receiveProviderFileSelections:()=>tx,recordProviderScopeReauthorizationOffer:()=>pn,registerCommonEnum:()=>__,registerFrameworkLayouts:()=>LTe,registerFrontendComponentRegistrations:()=>STe,registerIconAnimation:()=>cf,registerIconAnimations:()=>qf,registerShellLayout:()=>S4,registerStandardIcon:()=>Qf,registerStandardIcons:()=>ff,registryDeclaresSmsNotification:()=>n6,relationshipTargetRef:()=>j6,relativeLuminance:()=>G3,removeElement:()=>qje,removeLocalStorageItem:()=>As,replaceFileExtension:()=>FL,reportLauncherVerificationResults:()=>zv,reportSettingsHubVerificationResults:()=>qv,requestCrossFrontendHandoff:()=>q3,requestFieldReveal:()=>zD,resetClientInstanceIdPolicy:()=>Nne,resizeChartDashboardTile:()=>F9,resolveActionDisclosure:()=>se,resolveActionSurfaceOrganizationId:()=>$V,resolveApplicationLevelNavigationBackZone:()=>SB,resolveAuthoredOperationUnavailableReason:()=>am,resolveAutomaticRelationshipDisplayShaping:()=>wj,resolveBillingProviderDisplayName:()=>M1,resolveCommandMenuCommands:()=>Mh,resolveComponentLabel:()=>gp,resolveCompositeViewDefinition:()=>mp,resolveCompositeViewPrimaryScope:()=>poe,resolveContentAreaRenderBranch:()=>J0,resolveContextualDisplayParams:()=>RA,resolveControlPanelItems:()=>jm,resolveCssColorViaDom:()=>R3,resolveCurrentSectionStage:()=>FO,resolveDrawnActionVariant:()=>Vd,resolveEffectiveChromeMode:()=>GM,resolveEffectiveDisplayChromeMode:()=>aj,resolveEnumDisplayConfig:()=>w_,resolveErrorReferenceLabel:()=>roe,resolveExecutionNavigationHandlingMode:()=>xp,resolveExecutionViewDefinition:()=>wp,resolveFieldAutosaveTrigger:()=>EE,resolveFieldControlVariant:()=>Ig,resolveFrontendProviderDisplayLabel:()=>lb,resolveFrontendResourceOperationAddressability:()=>wse,resolveGuidanceElementRenderer:()=>Q2,resolveHostedComponents:()=>_2,resolveHotkeyBindings:()=>Ah,resolveInsertedChartView:()=>kp,resolveInsertedViewLauncherConfig:()=>km,resolveItemRef:()=>Wm,resolveLoadingPolicy:()=>Lce,resolveMenubarContent:()=>Km,resolveMilestoneLabel:()=>pse,resolveOperationFeatureAvailability:()=>Yh,resolveOperationIdempotencyHeaders:()=>kx,resolveOperationRefusalLabel:()=>Sp,resolveOperationRequestTimeout:()=>Ox,resolveOptionalComponentLabel:()=>Vp,resolveOptionalResourceHeaderDescription:()=>zp,resolveQuickActions:()=>Xm,resolveQuickSwitcherFieldSchema:()=>A7,resolveRecordOrganizationId:()=>Qm,resolveRefusalCodeLabel:()=>Tp,resolveRegionalFormatting:()=>_o,resolveRelationshipInlineEditSurface:()=>yj,resolveRelationshipNavigationSurface:()=>Cj,resolveRelationshipNestedReadSurface:()=>xj,resolveRelationshipQuickCreateCreateOperation:()=>mj,resolveRelationshipReadSurface:()=>vj,resolveRelationshipSurfaceRuntime:()=>Tj,resolveRelationshipWriteSurface:()=>_j,resolveResourceHeaderLabel:()=>Up,resolveResourceLabelEnumSchema:()=>Vc,resolveResourceLabelSystemEnumName:()=>Fs,resolveSearchGroupLabel:()=>G7,resolveSectionStageStates:()=>IO,resolveSettingsDestinationCatalog:()=>Ov,resolveSettingsHubConfig:()=>kv,resolveShellLayoutPlacement:()=>y4,resolveSidebarMobileDrawerMode:()=>C7,resolveSidebarSections:()=>Rm,resolveStatusBarPlacement:()=>b2,resolveSurfaceAutoFieldDensity:()=>qL,resolveSurfaceAutoLabelPlacement:()=>KL,resolveSurfaceFormChromeMode:()=>GL,resolveSurfaceOverlayMode:()=>_1,resolveSurfacePolicyStackingClass:()=>D2,resolveToolbarTools:()=>Hm,resolveTranslationKey:()=>Dp,resolveUpdateLikeMutationFallbackMode:()=>wl,resolveUserFacingErrorMessage:()=>lp,resolveUtilityPanelItems:()=>F7,resolveVisibleEntryIndex:()=>Jh,resourceExecutionView:()=>soe,resourceHasFieldWriteRoute:()=>zn,resourceUIBehavior:()=>Tte,resourceUIBehaviorFrom:()=>an,responsiveMaxWidthToCssValue:()=>eD,rgbToHex:()=>U3,rgbToHsv:()=>B3,sampleGlassRefractionProfile:()=>s_,saveBlobAsFile:()=>Ly,scrollAndFocusFirstErroredField:()=>KD,sectionHeadingClassName:()=>SD,selectMaterialCapabilityTier:()=>zg,serializeOnboardingView:()=>Qje,serializeSurfaceOperation:()=>dp,setLocalStorageItem:()=>so,settingsHubSectionLabelKey:()=>bse,settingsSectionVisibilityOf:()=>eh,shapeSectionNesting:()=>E7,sharedErrorBuilder:()=>Ru,shellModalOpenClause:()=>rTe,shellPaneRows:()=>o3,shellPaneSelectorForZone:()=>B4,shellPaneZone:()=>V4,shellRegionSelector:()=>L4,shellRowBox:()=>t3,shellStageRects:()=>p3,shouldRequireCurrentContextAddressabilityForOperation:()=>Am,slideShellPaneHome:()=>a3,splitDividerOrientationToPanelGroupDirection:()=>B0,startApplicationService:()=>YQ,staticZoneDividers:()=>X0,storedLayoutTilesOf:()=>L9,tellChatSignInCompletionSinks:()=>Hb,toDateOrUndefined:()=>ai,toast:()=>ch,turnStatusFromServer:()=>xW,unresolvedLabel:()=>is,updateElementStatus:()=>Jje,useActionOperationSurface:()=>Eue,useActivityBarBehavior:()=>p7,useAnalytics:()=>p$,useAnonymousSession:()=>uoe,useAppLoading:()=>Zy,useAppMode:()=>Fle,useAppModeSafe:()=>eS,useAppScope:()=>_m,useAppScopeInternal:()=>Doe,useAppScopeSafe:()=>Jp,useAppShellFirstReady:()=>c4,useAppShellLayout:()=>x2,useApplication:()=>Tu,useArrayItemAutosaveField:()=>dI,useAuthSession:()=>fm,useBarrierParticipant:()=>Fce,useBilling:()=>bh,useBillingAction:()=>Eh,useBillingSafe:()=>Hh,useBrandIdentity:()=>h2,useBrandPresentation:()=>g2,useChartDashboardLayout:()=>G9,useChartData:()=>g_,useChatSignInCompletion:()=>Ub,useClaimChildComposition:()=>uY,useCommandMenuBehavior:()=>K7,useComponentLoading:()=>Qy,useComposedChildren:()=>Lve,useCompositeResourceOperationContextBuilder:()=>i9,useCompositeViewContext:()=>UU,useConsentBasedProviderActivations:()=>Sx,useConsentGateBehavior:()=>IH,useContextualDisplayParams:()=>LA,useControlPanelBehavior:()=>R7,useCreateOperationSurface:()=>Cue,useCrossFrontendHandoff:()=>YTe,useDisplayChromeContext:()=>ok,useDisplayContextKind:()=>IA,useDisplayTemplateContext:()=>nk,useDisplayableImageUrl:()=>m2,useDocumentAcceptanceGateBehavior:()=>zH,useEmbeddedResourceContext:()=>W6,useEmbeddedResourceDescent:()=>nY,useEmbeddedResourceHostContext:()=>zU,useEmitLoadingScope:()=>Gm,useEmphasisedActionLabels:()=>$S,useError:()=>ep,useEventBus:()=>Ao,useEventEmit:()=>Jie,useEventSubscription:()=>ate,useExecution:()=>uce,useExecutionDirtyBridge:()=>ky,useExecutionDirtyMarkerScope:()=>dce,useExecutionParticipationDataPrefetch:()=>gce,useExecutionParticipationPrefetch:()=>Ay,useFeatureAvailability:()=>T0,useFeatureGate:()=>XTe,useFeatures:()=>gh,useFieldControlAria:()=>VM,useFieldControlLabelId:()=>HM,useFieldRevealRequests:()=>VD,useFieldScope:()=>TD,useFileActivation:()=>S8,useFlowsActors:()=>TW,useFlowsActorsSafe:()=>EW,useFlowsActorsStatusWord:()=>Zf,useFormChromeContext:()=>Qw,useFormField:()=>B8,useFormSchemaContext:()=>ND,useFormTemplateContext:()=>IT,useGlobalNavigationController:()=>CS,useGrantedConsentPurposes:()=>Zb,useGuidance:()=>xU,useHostedComponentInteractions:()=>L2,useHostlessResourceNavigation:()=>TS,useHotkey:()=>Bxe,useHotkeyPause:()=>Hxe,useHotkeyRegistry:()=>j$,useHotkeyScope:()=>Uxe,useHotkeys:()=>Vxe,useI18n:()=>K,useIconRegistry:()=>Of,useIsInFramedAncestor:()=>M,useKeepsHiddenPanelsMounted:()=>UD,useLauncherResolutionContext:()=>F$,useLifecycle:()=>SU,useListOperationSurface:()=>Sue,useLoading:()=>jce,useMaterialRuntime:()=>o_,useMenuBarBehavior:()=>k7,useMenuUserOrgBehavior:()=>Z7,useMfaContinuationNavigation:()=>SX,useNavigationBehaviors:()=>f7,useNavigationController:()=>wS,useNavigationState:()=>Px,useNotification:()=>Mm,useNotificationBadges:()=>a$,useNotificationCenterBehavior:()=>B7,useNotificationPreferenceKinds:()=>t6,useOperationEnabled:()=>BS,useOperationFeatureAvailability:()=>kse,useOperationsEnabled:()=>HS,useOptionalAutosave:()=>wE,useOptionalCompositeResourceContext:()=>U6,useOptionalCompositeViewContext:()=>WU,useOptionalDisplayTemplateContext:()=>rk,useOptionalEmbeddedResourceHostContext:()=>BU,useOptionalFormSchemaContext:()=>PD,useOptionalFormTemplateContext:()=>LT,useOptionalResourceFormActions:()=>aE,useOptionalResourceHeaderContext:()=>UB,useOverlayTitle:()=>Y$,usePendingDecisions:()=>pW,usePortalContainer:()=>T2,useProgression:()=>CU,useProviderComponent:()=>$b,useProviderComponentChoices:()=>Qb,useProviderScopeReauthorizationOffers:()=>sr,usePublicShellLayout:()=>S2,usePublishNotificationBadgeCount:()=>a6,useQuickActionButtonBehavior:()=>J7,useQuickSwitcherBehavior:()=>j7,useReadOperationSurface:()=>xue,useReadPageRecord:()=>PY,useRegisterComposedChild:()=>cY,useReportAutomaticComposition:()=>dY,useResolvedAuthConfig:()=>Xx,useResolvedFieldName:()=>ED,useResourceChartData:()=>Oje,useResourceDisplayContext:()=>uj,useResourceEmptyStateOffersPrimaryAction:()=>aK,useResourceOperationActions:()=>eH,useResourceOperationSurface:()=>rC,useResourceReachability:()=>xm,useResourceRegistry:()=>lm,useResourceRegistrySafe:()=>gm,useResourceRoom:()=>$Te,useResourceSearch:()=>SV,useResourceSelection:()=>tH,useSearchOperationSurface:()=>Tue,useSectionLegendVoice:()=>yD,useServerErrorInjection:()=>$R,useSettingsHubConfig:()=>jv,useShellColumnMotion:()=>S3,useShellDialogArrival:()=>c3,useShellFrontPane:()=>g3,useShellMotion:()=>C3,useShellPaneMotion:()=>x3,useShellPlaceChanges:()=>_3,useShellPressOrigin:()=>n3,useShellStageMeasurement:()=>h3,useSidebarBehavior:()=>T7,useSidebarMobileDrawerMode:()=>w7,useSmsConsentOffered:()=>r6,useStatusBarBehavior:()=>M7,useStepUpAuth:()=>KTe,useSurfaceBodyScrollLock:()=>JE,useSurfaceFocusTrap:()=>YE,useSurfacePolicy:()=>pc,useSurfacePolicyPortalTarget:()=>E2,useSurfacePolicyStackingClass:()=>O2,useSurfaceVariant:()=>hee,useTemplateOwnsChildComposition:()=>lY,useThemePreferenceControl:()=>O1,useToolbarBehavior:()=>N7,useTypographyScope:()=>m_,useUI:()=>Rg,useUpdateOperationSurface:()=>wue,useUserFacingErrorMessage:()=>ap,useUserOrgs:()=>sg,useUtilityPanelBehavior:()=>L7,useViewerMayListRelatedResource:()=>x9,useViewerMayPerformResourceOperation:()=>_Se,useVocabularyWord:()=>df,useWebSocket:()=>sp,utilityPanelWorkspaceSignature:()=>I7,variant:()=>_te,verifyLauncherContent:()=>Rv,verifySettingsHubContent:()=>Kv,viewerBelongsToOrganization:()=>fg,viewerHoldsOneOfRoles:()=>Nm,viewerIsKnownOutsideOrganization:()=>Sse,viewerMayHaveDecisionsWaiting:()=>Vv,viewerMayPerformOperation:()=>Vm,viewerMayReadChart:()=>N9,viewerReachesUserSubject:()=>ah,visibleChartDashboardTiles:()=>Mje,waitForFontsLoaded:()=>Cg,whenRendered:()=>BD,wildoErrorIsShownToUser:()=>Tn,withErrorBoundary:()=>bce,withFocusedDecisionFirst:()=>qW,withNewestHistoryPage:()=>hQ,withOlderHistoryPage:()=>gQ,withPendingSend:()=>cQ,withoutHiddenParentReference:()=>cj,wrapWithAutosaveIndicator:()=>WM,zoneMutationTargetIndex:()=>Oh,zoneTabDomIds:()=>R0});export{k5 as $,wO as $a,aI as $i,E0 as $n,vx as $o,_G as $r,_6 as $t,u7 as A,eN as Aa,DR as Ai,L4 as An,IT as Ao,qZ as Ar,M8 as At,Q5 as B,uj as Ba,xL as Bi,u4 as Bn,Ww as Bo,SY as Br,g8 as Bt,j7 as C,yF as Ca,qB as Ci,O4 as Cn,_D as Co,bQ as Cr,U8 as Ct,p7 as D,vF as Da,jR as Di,E4 as Dn,pde as Do,sQ as Dr,B8 as Dt,w7 as E,_F as Ea,NR as Ei,T4 as En,IE as Eo,oQ as Er,z8 as Et,t7 as F,Qj as Fa,OL as Fi,y4 as Fn,Jw as Fo,gX as Fr,w8 as Ft,H5 as G,LA as Ga,nL as Gi,O2 as Gn,zC as Go,xJ as Gr,p8 as Gt,q5 as H,nj as Ha,$I as Hi,c4 as Hn,Hw as Ho,zJ as Hr,_8 as Ht,e7 as I,Zj as Ia,DL as Ii,p4 as In,Yw as Io,pX as Ir,C8 as It,B5 as J,Jk as Ja,EI as Ji,g2 as Jn,YS as Jo,yJ as Jr,X6 as Jt,z5 as K,mA as Ka,rL as Ki,S2 as Kn,qS as Ko,bJ as Kr,d8 as Kt,Y5 as L,Rj as La,kL as Li,l4 as Ln,Uw as Lo,QY as Lr,S8 as Lt,o7 as M,qM as Ma,TR as Mi,h4 as Mn,rT as Mo,_X as Mr,D8 as Mt,i7 as N,VM as Na,xR as Ni,b4 as Nn,tT as No,hX as Nr,E8 as Nt,l7 as O,bF as Oa,OR as Oi,D4 as On,ME as Oo,fQ as Or,L8 as Ot,a7 as P,HM as Pa,QL as Pi,S4 as Pn,Vw as Po,mX as Pr,T8 as Pt,F5 as Q,SO as Qa,dI as Qi,l2 as Qn,Px as Qo,vG as Qr,D6 as Qt,Z5 as R,Pj as Ra,IL as Ri,d4 as Rn,qw as Ro,FY as Rr,x8 as Rt,M7 as S,gF as Sa,JB as Si,k4 as Sn,yD as So,OQ as Sr,H8 as St,T7 as T,mF as Ta,SB as Ti,w4 as Tn,LE as To,vQ as Tr,R8 as Tt,W5 as U,rj as Ua,eL as Ui,L2 as Un,VC as Uo,gJ as Ur,m8 as Ut,$5 as V,ej as Va,SL as Vi,f4 as Vn,Kw as Vo,RJ as Vr,v8 as Vt,U5 as W,tj as Wa,tL as Wi,E2 as Wn,WC as Wo,vJ as Wr,f8 as Wt,I5 as X,nk as Xa,CI as Xi,u2 as Xn,TS as Xo,hq as Xr,P6 as Xt,P5 as Y,tk as Ya,DI as Yi,d2 as Yn,$S as Yo,pq as Yr,Q6 as Yt,L5 as Z,rk as Za,yI as Zi,c2 as Zn,wS as Zo,mq as Zr,F6 as Zt,K7 as _,jF as _a,EV as _i,M4 as _n,UD as _o,R$ as _r,p5 as _t,v9 as a,HF as aa,sG as ai,Q3 as an,fO as ao,v1 as ar,zy as as,T5 as at,L7 as b,EF as ba,MV as bi,z4 as bn,jD as bo,kQ as br,$8 as bt,C9 as c,zF as ca,TW as ci,V3 as cn,mO as co,g1 as cr,Ny as cs,h5 as ct,i9 as d,LF as da,QU as di,R3 as dn,iO as do,r1 as dr,gv as ds,a5 as dt,XF as ea,tG as ei,g6 as en,CO as eo,T0 as er,ox as es,A5 as et,n9 as f,IF as fa,iH as fi,U3 as fn,aO as fo,s1 as fr,pv as fs,s5 as ft,J7 as g,PF as ga,kV as gi,K4 as gn,VD as go,q$ as gr,d5 as gt,Z7 as h,FF as ha,OV as hi,X4 as hn,HD as ho,n1 as hr,T_ as hs,u5 as ht,y9 as i,UF as ia,aG as ii,e6 as in,gO as io,T1 as ir,$y as is,E5 as it,r7 as j,XM as ja,ER as ji,g4 as jn,LT as jo,VX as jr,j8 as jt,d7 as k,$M as ka,AR as ki,G4 as kn,NE as ko,cQ as kr,I8 as kt,g9 as l,RF as la,EW as li,L3 as ln,sO as lo,h1 as lr,kv as ls,_5 as lt,e9 as m,NF as ma,TV as mi,C3 as mn,lO as mo,o1 as mr,tv as ms,l5 as mt,D9 as n,GF as na,cG as ni,r6 as nn,_O as no,B1 as nr,Gb as ns,M5 as nt,_9 as o,VF as oa,nG as oi,F3 as on,hO as oo,l1 as or,Ry as os,S5 as ot,t9 as p,OF as pa,wV as pi,B3 as pn,cO as po,i1 as pr,sv as ps,c5 as pt,V5 as q,tA as qa,NI as qi,x2 as qn,JS as qo,_J as qr,r8 as qt,E9 as r,wme as ra,oG as ri,t6 as rn,bO as ro,V1 as rr,eb as rs,C5 as rt,w9 as s,BF as sa,RW as si,W3 as sn,pO as so,d1 as sr,Ly as ss,x5 as st,eMe as t,QF as ta,rG as ti,a6 as tn,yO as to,H1 as tr,qb as ts,j5 as tt,x9 as u,gme as ua,yW as ui,G3 as un,uO as uo,t1 as ur,vv as us,g5 as ut,B7 as v,AF as va,AV as vi,q4 as vn,AD as vo,FQ as vr,f5 as vt,k7 as w,xF as wa,BB as wi,I4 as wn,WE as wo,xQ as wr,W8 as wt,N7 as x,MF as xa,jV as xi,J4 as xn,SD as xo,DQ as xr,G8 as xt,R7 as y,kF as ya,DV as yi,j4 as yn,MD as yo,EQ as yr,o5 as yt,X5 as z,lj as za,EL as zi,m4 as zn,Gw as zo,PY as zr,b8 as zt};