@datalayer/agent-runtimes 1.6.46 → 1.6.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/dist-embed/chunks/{AgentDetails-DC7O2VWb.js → AgentDetails-CFUOZ-Bq.js} +1 -1
  2. package/dist-embed/chunks/{AgentDetailsDialog-BTJCl-o-.js → AgentDetailsDialog-0OQcRHgy.js} +1 -1
  3. package/dist-embed/chunks/{AgentInspector-BXqYY8g-.js → AgentInspector-CMjveNA0.js} +1 -1
  4. package/dist-embed/chunks/{AgentInspectorDialog-dRHZ1p73.js → AgentInspectorDialog-B_ii1_F3.js} +1 -1
  5. package/dist-embed/chunks/{CellSidebarExtension-DXPIz0Km.js → CellSidebarExtension-vXN5wge0.js} +7 -7
  6. package/dist-embed/chunks/ChatView-BGIbssMm.js +32 -0
  7. package/dist-embed/chunks/{CollapsiblePlugin-BPlfrDQU.js → CollapsiblePlugin-DyobyCLm.js} +1 -1
  8. package/dist-embed/chunks/{ContextPie-BHiGwDpa.js → ContextPie-CY7-2OcN.js} +1 -1
  9. package/dist-embed/chunks/DatalayerAgentBridge-X6uBhrBZ.js +1 -0
  10. package/dist-embed/chunks/{DeckComponent-jvb83Q__.js → DeckComponent-B5IMw4r1.js} +2 -2
  11. package/dist-embed/chunks/{DocumentView-BrdFnTVh.js → DocumentView-IqGVIpnF.js} +1 -1
  12. package/dist-embed/chunks/{EphemeralDocument-CkPQKyfy.js → EphemeralDocument-DZ8Wk5du.js} +1 -1
  13. package/dist-embed/chunks/{EphemeralNotebook-CiQIC3MG.js → EphemeralNotebook-B3ZMORn1.js} +2 -2
  14. package/dist-embed/chunks/{ExcalidrawComponent-D6Cr_b0Z.js → ExcalidrawComponent-9ant-hu6.js} +1 -1
  15. package/dist-embed/chunks/{ExcalidrawModal-Bso7oDbl.js → ExcalidrawModal-92wiYWnH.js} +1 -1
  16. package/dist-embed/chunks/{JupyterLexicalExtension-DuD7IV6j.js → JupyterLexicalExtension-DbMi7Dam.js} +9 -9
  17. package/dist-embed/chunks/{KernelVariables-CXQagESp.js → KernelVariables-lzdkfkh4.js} +2 -2
  18. package/dist-embed/chunks/{LexicalToolRegistry-LfEpCrfD.js → LexicalToolRegistry-Bd1yXjzB.js} +2 -2
  19. package/dist-embed/chunks/{NotebookSkeleton-CvO9WylK.js → NotebookSkeleton-BaU6vrsb.js} +1 -1
  20. package/dist-embed/chunks/{NotebookToolSurfaces-B9fkzQNR.js → NotebookToolSurfaces-Gk8Hsn0c.js} +1 -1
  21. package/dist-embed/chunks/{NotebookToolbar-D36duUxK.js → NotebookToolbar-CO_qaXBp.js} +1 -1
  22. package/dist-embed/chunks/{NotebookView-BrdHwtKH.js → NotebookView-B5jqU279.js} +1 -1
  23. package/dist-embed/chunks/{Output-D9cwH5rg.js → Output-DtWAAuKd.js} +1 -1
  24. package/dist-embed/chunks/{SandboxDetailsDialog-BYgLjg3W.js → SandboxDetailsDialog-4cOtcyub.js} +1 -1
  25. package/dist-embed/chunks/{SchemaForm-B3qMIWMy.js → SchemaForm-CulhQBil.js} +1 -1
  26. package/dist-embed/chunks/{SheetTabs-BR72mzuo.js → SheetTabs-Bc8bBVQ1.js} +3 -3
  27. package/dist-embed/chunks/{SpreadsheetPreviewView-RA8ASTBV.js → SpreadsheetPreviewView-nFAjWUZ5.js} +1 -1
  28. package/dist-embed/chunks/{SpreadsheetView-BfScdA-X.js → SpreadsheetView-CBC_KFON.js} +1 -1
  29. package/dist-embed/chunks/{Toolbar-BAjGB6b-.js → Toolbar-ByUGXe7J.js} +1 -1
  30. package/dist-embed/chunks/{WidgetVariableView-7lvDcxCg.js → WidgetVariableView-CE4nO4my.js} +1 -1
  31. package/dist-embed/chunks/{YouTubePlugin-BbjCzaT_.js → YouTubePlugin-DS4rJSGB.js} +1 -1
  32. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-COr9T6op.js → abnfDiagram-VCTEODGH-BAFsXu3t.js} +1 -1
  33. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-Ct4NEcIK.js → abnfDiagram-VCTEODGH-B_sHPJUN.js} +1 -1
  34. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-BRIqJ785.js → abnfDiagram-VCTEODGH-Nk_v6YcC.js} +1 -1
  35. package/dist-embed/chunks/{ar-SA-G6X2FPQ2-D4M2b5Lr.js → ar-SA-G6X2FPQ2-oGeNqqRN.js} +1 -1
  36. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-D4oRtyHS.js → architectureDiagram-5GKGNRK7-1ZoJLZwi.js} +1 -1
  37. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-C7u5kHjb.js → architectureDiagram-5GKGNRK7-CSwlFsek.js} +1 -1
  38. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-BjY5iY3I.js → architectureDiagram-5GKGNRK7-CXh0a2fl.js} +1 -1
  39. package/dist-embed/chunks/{az-AZ-76LH7QW2-Rn7oINhz.js → az-AZ-76LH7QW2-Ckdua9fG.js} +1 -1
  40. package/dist-embed/chunks/{bg-BG-XCXSNQG7-xztohKe7.js → bg-BG-XCXSNQG7-D0NWa5AJ.js} +1 -1
  41. package/dist-embed/chunks/{blockDiagram-868be97b-CovMH3zl.js → blockDiagram-868be97b-CXF_hory.js} +1 -1
  42. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-CkSMfCfm.js → blockDiagram-I7D4REHJ-C9eqiZJU.js} +1 -1
  43. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-GfTzHDnC.js → blockDiagram-I7D4REHJ-CajpRIdD.js} +1 -1
  44. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-B4X_5qFz.js → blockDiagram-I7D4REHJ-DltT5qVn.js} +1 -1
  45. package/dist-embed/chunks/{bn-BD-2XOGV67Q-C7Ssg1_2.js → bn-BD-2XOGV67Q-CZbU71zu.js} +1 -1
  46. package/dist-embed/chunks/{c4Diagram-3f4bdde3-DjidyC1r.js → c4Diagram-3f4bdde3-CcVl9FWN.js} +1 -1
  47. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-BqdUJ-a0.js → c4Diagram-7LVT6UL2-BHH3V3vI.js} +1 -1
  48. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-BQzLCwYE.js → c4Diagram-7LVT6UL2-Qn3VrAmQ.js} +1 -1
  49. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-CvxA6W4e.js → c4Diagram-7LVT6UL2-gcd6QnFn.js} +1 -1
  50. package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Cr0zd8Z6.js → ca-ES-6MX7JW3Y-CDkEhhvJ.js} +1 -1
  51. package/dist-embed/chunks/{celltoolbartracker-D1C_kGQL.js → celltoolbartracker-BiNbwXlm.js} +1 -1
  52. package/dist-embed/chunks/{chunk-2Q5K7J3B-BU7nuyLy.js → chunk-2Q5K7J3B-BOvbpwkI.js} +1 -1
  53. package/dist-embed/chunks/{chunk-2Q5K7J3B-DTLOUvry.js → chunk-2Q5K7J3B-C2sNsgev.js} +1 -1
  54. package/dist-embed/chunks/{chunk-2Q5K7J3B-0A899Arf.js → chunk-2Q5K7J3B-GG70N9jl.js} +1 -1
  55. package/dist-embed/chunks/{chunk-5VM5RSS4-Bx2V6Nrr.js → chunk-5VM5RSS4-CAAgFs5e.js} +1 -1
  56. package/dist-embed/chunks/{chunk-5VM5RSS4-DXLjroNr.js → chunk-5VM5RSS4-Cle_89ej.js} +1 -1
  57. package/dist-embed/chunks/{chunk-5VM5RSS4-Tu_sNIjZ.js → chunk-5VM5RSS4-FA3LbrKz.js} +1 -1
  58. package/dist-embed/chunks/{chunk-F27PBJKO-DlCzGOX7.js → chunk-F27PBJKO-3X0ZipiC.js} +1 -1
  59. package/dist-embed/chunks/{chunk-F27PBJKO--AK2bGwU.js → chunk-F27PBJKO-Cgut8fat.js} +1 -1
  60. package/dist-embed/chunks/{chunk-F27PBJKO-DH0Y71GT.js → chunk-F27PBJKO-RLRQOyxZ.js} +1 -1
  61. package/dist-embed/chunks/{chunk-IMKFNOWR-D7LtolQ9.js → chunk-IMKFNOWR-BHFcfXrD.js} +1 -1
  62. package/dist-embed/chunks/{chunk-IMKFNOWR-DwaJo6nd.js → chunk-IMKFNOWR-C4ydUPhx.js} +1 -1
  63. package/dist-embed/chunks/{chunk-IMKFNOWR-CAMMjZDn.js → chunk-IMKFNOWR-CbVrj1-B.js} +1 -1
  64. package/dist-embed/chunks/{chunk-JWPE2WC7-B4ZyAymW.js → chunk-JWPE2WC7-Cyj9DtDK.js} +1 -1
  65. package/dist-embed/chunks/{chunk-JWPE2WC7-DAHI-TVh.js → chunk-JWPE2WC7-DIamN27i.js} +1 -1
  66. package/dist-embed/chunks/{chunk-JWPE2WC7-PrapfKnD.js → chunk-JWPE2WC7-DjRj5y1C.js} +1 -1
  67. package/dist-embed/chunks/{chunk-POPQ4Y6H-CPqfpqZP.js → chunk-POPQ4Y6H-B4VehBHR.js} +1 -1
  68. package/dist-embed/chunks/{chunk-POPQ4Y6H-COTyhLEP.js → chunk-POPQ4Y6H-Cz3CE_QJ.js} +1 -1
  69. package/dist-embed/chunks/{chunk-POPQ4Y6H-NHNNgLDe.js → chunk-POPQ4Y6H-P4Z54Nsh.js} +1 -1
  70. package/dist-embed/chunks/{chunk-SVP7TREG-Cs2sH6R-.js → chunk-SVP7TREG-BcAM4zz1.js} +1 -1
  71. package/dist-embed/chunks/{chunk-SVP7TREG-CbTLnK0f.js → chunk-SVP7TREG-BvC6HSBM.js} +1 -1
  72. package/dist-embed/chunks/{chunk-SVP7TREG-dVSPfe2c.js → chunk-SVP7TREG-e7xrbkXt.js} +1 -1
  73. package/dist-embed/chunks/{chunk-TICWLB2K-BB_Y-4ml.js → chunk-TICWLB2K-DXyPfm2K.js} +1 -1
  74. package/dist-embed/chunks/{chunk-TICWLB2K-CfOjQFyb.js → chunk-TICWLB2K-Dq04meN3.js} +1 -1
  75. package/dist-embed/chunks/{chunk-TICWLB2K-87-bxVAe.js → chunk-TICWLB2K-DryI_fVu.js} +1 -1
  76. package/dist-embed/chunks/{chunk-XXDRQBXY-iJemHF_x.js → chunk-XXDRQBXY-Bg1z5wvl.js} +1 -1
  77. package/dist-embed/chunks/{chunk-XXDRQBXY-5ZZJYzFF.js → chunk-XXDRQBXY-DdaBayRJ.js} +1 -1
  78. package/dist-embed/chunks/{chunk-XXDRQBXY-DSsbiqRJ.js → chunk-XXDRQBXY-RiUzxSa_.js} +1 -1
  79. package/dist-embed/chunks/{classDiagram-ZZMXUADV-ClW13A2U.js → classDiagram-ZZMXUADV-DN-XosUZ.js} +1 -1
  80. package/dist-embed/chunks/{classDiagram-ZZMXUADV-CAHeG1gF.js → classDiagram-ZZMXUADV-DTxXqjtH.js} +1 -1
  81. package/dist-embed/chunks/{classDiagram-ZZMXUADV-Vh4RzyKh.js → classDiagram-ZZMXUADV-xUvH8sEw.js} +1 -1
  82. package/dist-embed/chunks/{classDiagram-f62afe4f-CMi22C0U.js → classDiagram-f62afe4f-Dn229LPE.js} +1 -1
  83. package/dist-embed/chunks/{classDiagram-v2-604399ef-C26x9ueJ.js → classDiagram-v2-604399ef-CiWW9MIF.js} +1 -1
  84. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-ClW13A2U.js → classDiagram-v2-VYDZK3BY-DN-XosUZ.js} +1 -1
  85. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-CAHeG1gF.js → classDiagram-v2-VYDZK3BY-DTxXqjtH.js} +1 -1
  86. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-Vh4RzyKh.js → classDiagram-v2-VYDZK3BY-xUvH8sEw.js} +1 -1
  87. package/dist-embed/chunks/{code-block-IT6T5CEO-DYCIn_7v.js → code-block-IT6T5CEO-CLvXlBx2.js} +8 -8
  88. package/dist-embed/chunks/{component-CmnuUtgX.js → component-D0l01bm2.js} +1 -1
  89. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-BgIgDbgt.js → cose-bilkent-JH36ORCC-BYjRJxfr.js} +1 -1
  90. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-ChaVAK2T.js → cose-bilkent-JH36ORCC-DttpaBKc.js} +1 -1
  91. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-BsiPRKfh.js → cose-bilkent-JH36ORCC-KUtlO0wZ.js} +1 -1
  92. package/dist-embed/chunks/{createText-aed3d8b3-B86AevE1.js → createText-aed3d8b3-BoxGA1kU.js} +1 -1
  93. package/dist-embed/chunks/{cs-CZ-2BRQDIVT-G9tBUkZh.js → cs-CZ-2BRQDIVT-D3Tf2yLX.js} +1 -1
  94. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-Bx_RkYqS.js → cynefinDiagram-5FMLGOSQ-B2ciR9HO.js} +1 -1
  95. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-bJ9Z5Mhd.js → cynefinDiagram-5FMLGOSQ-CkZtxa_j.js} +1 -1
  96. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DriUtMtG.js → cynefinDiagram-5FMLGOSQ-DLxzMI8R.js} +1 -1
  97. package/dist-embed/chunks/{da-DK-5WZEPLOC-91_vyLpq.js → da-DK-5WZEPLOC-8FuM_s_4.js} +1 -1
  98. package/dist-embed/chunks/{dagre-GXQ25YYZ-D3sdZMQI.js → dagre-GXQ25YYZ-B_GD3wQW.js} +1 -1
  99. package/dist-embed/chunks/{dagre-GXQ25YYZ-C-JIsuS8.js → dagre-GXQ25YYZ-BzK8S8ZN.js} +1 -1
  100. package/dist-embed/chunks/{dagre-GXQ25YYZ-DBL7Fy3A.js → dagre-GXQ25YYZ-D1SrKOMG.js} +1 -1
  101. package/dist-embed/chunks/{de-DE-XR44H4JA-Bb9tvIZa.js → de-DE-XR44H4JA-BczLv19p.js} +1 -1
  102. package/dist-embed/chunks/{diagram-S7CK7UJ4-D1nmgrkv.js → diagram-S7CK7UJ4-BFa-cF0f.js} +1 -1
  103. package/dist-embed/chunks/{diagram-S7CK7UJ4-DfneUYZ2.js → diagram-S7CK7UJ4-DD7qiEfG.js} +1 -1
  104. package/dist-embed/chunks/{diagram-S7CK7UJ4-4Qtqvrkr.js → diagram-S7CK7UJ4-DRQoONLl.js} +1 -1
  105. package/dist-embed/chunks/{diagram-UQ7AKVKN-CfcZ1PQb.js → diagram-UQ7AKVKN-CiW_VcOF.js} +1 -1
  106. package/dist-embed/chunks/{diagram-UQ7AKVKN-ADhyCAdr.js → diagram-UQ7AKVKN-D2IdtRtZ.js} +1 -1
  107. package/dist-embed/chunks/{diagram-UQ7AKVKN-1KwF4Mkc.js → diagram-UQ7AKVKN-DonHWSMp.js} +1 -1
  108. package/dist-embed/chunks/{diagram-VSXAHHWV-Cdcv0UHd.js → diagram-VSXAHHWV-BVjz0vRe.js} +1 -1
  109. package/dist-embed/chunks/{diagram-VSXAHHWV-C1l71k44.js → diagram-VSXAHHWV-Cw-PrCH0.js} +1 -1
  110. package/dist-embed/chunks/{diagram-VSXAHHWV-w4XrywKL.js → diagram-VSXAHHWV-DRDfYlTN.js} +1 -1
  111. package/dist-embed/chunks/{diagram-VX7I27RA-BSxXMnjW.js → diagram-VX7I27RA-DwAkBxoG.js} +1 -1
  112. package/dist-embed/chunks/{diagram-VX7I27RA-BNRSlia4.js → diagram-VX7I27RA-UIWotGW-.js} +1 -1
  113. package/dist-embed/chunks/{diagram-VX7I27RA-DY396bQc.js → diagram-VX7I27RA-eXyjCSfi.js} +1 -1
  114. package/dist-embed/chunks/{diagram-Z3DM3KII-Bts1R_lM.js → diagram-Z3DM3KII-C_tHi2zd.js} +1 -1
  115. package/dist-embed/chunks/{diagram-Z3DM3KII-CfBEqPQi.js → diagram-Z3DM3KII-DIayrWqD.js} +1 -1
  116. package/dist-embed/chunks/{diagram-Z3DM3KII-B4sR_460.js → diagram-Z3DM3KII-DRxec16z.js} +1 -1
  117. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DeJx0KuC.js → ebnfDiagram-PWID7BFC-CZS5hRDB.js} +1 -1
  118. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-BCOkfz5d.js → ebnfDiagram-PWID7BFC-DViSeEkV.js} +1 -1
  119. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DS3AbLt0.js → ebnfDiagram-PWID7BFC-z6EZsNAn.js} +1 -1
  120. package/dist-embed/chunks/{edges-b2856ca0-CaCZ7ENn.js → edges-b2856ca0-GkzwR7tH.js} +1 -1
  121. package/dist-embed/chunks/{el-GR-BZB4AONW-B5kc3JC5.js → el-GR-BZB4AONW-XmdkMj04.js} +1 -1
  122. package/dist-embed/chunks/{erDiagram-5d81789a-BC4jofcY.js → erDiagram-5d81789a-B-A6M2ym.js} +1 -1
  123. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-CHQgrXAV.js → erDiagram-RLTQ6QDP-BxUZGGsY.js} +1 -1
  124. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-CXED7TDM.js → erDiagram-RLTQ6QDP-DnyCH2Db.js} +1 -1
  125. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-UsFx9ZR6.js → erDiagram-RLTQ6QDP-V_YalCFO.js} +1 -1
  126. package/dist-embed/chunks/{es-ES-U4NZUMDT-CpFB18Kf.js → es-ES-U4NZUMDT-BM8o7VhK.js} +1 -1
  127. package/dist-embed/chunks/{esm-BqqxV5QL.js → esm-Bgc-xY8g.js} +1 -1
  128. package/dist-embed/chunks/{esm-Co3TYtt_.js → esm-C8NQHqRw.js} +1 -1
  129. package/dist-embed/chunks/{eu-ES-A7QVB2H4-CqCALK0Q.js → eu-ES-A7QVB2H4-C92PACcO.js} +1 -1
  130. package/dist-embed/chunks/{fa-IR-HGAKTJCU-BzSY8fri.js → fa-IR-HGAKTJCU-C0v8l3W9.js} +1 -1
  131. package/dist-embed/chunks/{fi-FI-Z5N7JZ37-DPRPVT_v.js → fi-FI-Z5N7JZ37-C5OmBq6V.js} +1 -1
  132. package/dist-embed/chunks/{flowDb-185abca5-DiOj0UBd.js → flowDb-185abca5-DEP1pb38.js} +1 -1
  133. package/dist-embed/chunks/{flowDiagram-1629c991-D2rlxs4P.js → flowDiagram-1629c991-CKDo2Uo8.js} +1 -1
  134. package/dist-embed/chunks/{flowDiagram-HODETNUW-DnphRIev.js → flowDiagram-HODETNUW-BCHMnvj-.js} +1 -1
  135. package/dist-embed/chunks/{flowDiagram-HODETNUW-BAAyHp4o.js → flowDiagram-HODETNUW-DlFftQTx.js} +1 -1
  136. package/dist-embed/chunks/{flowDiagram-HODETNUW-CIEoNVmM.js → flowDiagram-HODETNUW-JbcKRj53.js} +1 -1
  137. package/dist-embed/chunks/{flowDiagram-v2-1d953310-CFBK75mM.js → flowDiagram-v2-1d953310-LUQyiANW.js} +1 -1
  138. package/dist-embed/chunks/{flowchart-elk-definition-6df44142-oM65WKay.js → flowchart-elk-definition-6df44142-C3W5GB7k.js} +1 -1
  139. package/dist-embed/chunks/{fr-FR-RHASNOE6-Cr4lVSvD.js → fr-FR-RHASNOE6-D2EL4poR.js} +1 -1
  140. package/dist-embed/chunks/{ganttDiagram-3b0b3873-onXTRtkk.js → ganttDiagram-3b0b3873-B7mJgJVE.js} +1 -1
  141. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-Hu286RYG.js → ganttDiagram-EL5Y4UJY-CMnOlTLP.js} +1 -1
  142. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-Boj571YL.js → ganttDiagram-EL5Y4UJY-Dh0UlkHT.js} +1 -1
  143. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-BXjqihIe.js → ganttDiagram-EL5Y4UJY-ZBBC8Bv6.js} +1 -1
  144. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-D-0lvFne.js → gitGraphDiagram-WWUBYQGX-CH3JDxr0.js} +1 -1
  145. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-Dn83WGOl.js → gitGraphDiagram-WWUBYQGX-DPjPLqu4.js} +1 -1
  146. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-CVSBq_5E.js → gitGraphDiagram-WWUBYQGX-fWclmxuk.js} +1 -1
  147. package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-DUmhUEtF.js → gitGraphDiagram-f01e8bc2-CGKGKetD.js} +1 -1
  148. package/dist-embed/chunks/{gl-ES-HMX3MZ6V-CZUw7dN0.js → gl-ES-HMX3MZ6V-YWFm4WxA.js} +1 -1
  149. package/dist-embed/chunks/{he-IL-6SHJWFNN-DaU5Odek.js → he-IL-6SHJWFNN-mX7JSlN-.js} +1 -1
  150. package/dist-embed/chunks/{hi-IN-IWLTKZ5I-BZ84Rooc.js → hi-IN-IWLTKZ5I-D6yhTM4e.js} +1 -1
  151. package/dist-embed/chunks/{hu-HU-A5ZG7DT2-SZiCSe0B.js → hu-HU-A5ZG7DT2-eb6aNn0F.js} +1 -1
  152. package/dist-embed/chunks/{id-ID-SAP4L64H-DrRa3vVi.js → id-ID-SAP4L64H-EhGa_Mrn.js} +1 -1
  153. package/dist-embed/chunks/{index-9bae90f3-OqtwF7zW.js → index-9bae90f3-Mi-C8rGJ.js} +1 -1
  154. package/dist-embed/chunks/{index-DBu0kmO8.js → index-C53VIWpA.js} +10 -10
  155. package/dist-embed/chunks/{index-B0Wuj2eL.js → index-CKrG-XEr.js} +1 -1
  156. package/dist-embed/chunks/{index-DpN8KK6c.js → index-CQzZPse_.js} +1 -1
  157. package/dist-embed/chunks/{index-CEeyR3FZ.js → index-CW9jwmnF.js} +1 -1
  158. package/dist-embed/chunks/{index-JmqWOkdt.js → index-CcDn6aA5.js} +2 -2
  159. package/dist-embed/chunks/{index-FucnjX8K.js → index-Cn1erzsp.js} +4 -4
  160. package/dist-embed/chunks/{index-BeQu6wh3.js → index-Mx7RvmI-.js} +4 -4
  161. package/dist-embed/chunks/{index-qhxI1VzX.js → index-Xpn7qE4M.js} +2 -2
  162. package/dist-embed/chunks/{index-hhftmReh.js → index-ke4HKN0W.js} +1 -1
  163. package/dist-embed/chunks/{index-B6-uQd5L.js → index-mXYl0SDo.js} +2 -2
  164. package/dist-embed/chunks/{index.esm-Bvtnemp7.js → index.esm-DFnCYMX-.js} +1 -1
  165. package/dist-embed/chunks/{index.esm-C6blgTRD.js → index.esm-Qo5C9a62.js} +1 -1
  166. package/dist-embed/chunks/{infoDiagram-27XIBGKW-BMVi2kA7.js → infoDiagram-27XIBGKW-BLbH-ZwT.js} +1 -1
  167. package/dist-embed/chunks/{infoDiagram-27XIBGKW-CIOfWKZS.js → infoDiagram-27XIBGKW-CVdKLCRu.js} +1 -1
  168. package/dist-embed/chunks/{infoDiagram-27XIBGKW-B6mmRg3n.js → infoDiagram-27XIBGKW-DKfKrKV3.js} +1 -1
  169. package/dist-embed/chunks/{infoDiagram-a29d40f1-C176duia.js → infoDiagram-a29d40f1-DtjZgHpG.js} +1 -1
  170. package/dist-embed/chunks/{isEqual-BYxXubsX.js → isEqual-CO9-1hO8.js} +1 -1
  171. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-aoviUwQy.js → ishikawaDiagram-5VMMS53U-0oKH5_3F.js} +1 -1
  172. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-D5ALaQir.js → ishikawaDiagram-5VMMS53U-BBHuXOEP.js} +1 -1
  173. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-pCzmYyRW.js → ishikawaDiagram-5VMMS53U-DIZaJSHk.js} +1 -1
  174. package/dist-embed/chunks/{it-IT-JPQ66NNP-_TEhDIcF.js → it-IT-JPQ66NNP-BEhvmrUK.js} +1 -1
  175. package/dist-embed/chunks/{ja-JP-DBVTYXUO-IJaTVgTb.js → ja-JP-DBVTYXUO-lmsxmH6A.js} +1 -1
  176. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-CDvOmpvU.js → journeyDiagram-3NMN7TZE-DkG1XeCY.js} +1 -1
  177. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DwMRB_U9.js → journeyDiagram-3NMN7TZE-fkubBGZE.js} +1 -1
  178. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-BwEZ7tUE.js → journeyDiagram-3NMN7TZE-j2SA8xPg.js} +1 -1
  179. package/dist-embed/chunks/{journeyDiagram-95396277-eNxCaz5h.js → journeyDiagram-95396277-CJ_CSiyl.js} +1 -1
  180. package/dist-embed/chunks/{kaa-6HZHGXH3-CTksAiLJ.js → kaa-6HZHGXH3-C2eZOrFk.js} +1 -1
  181. package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-DbA7aOfU.js → kab-KAB-ZGHBKWFO-BtO_Ccgd.js} +1 -1
  182. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-CJ9VIyON.js → kanban-definition-UXKFOSKX-Bfl0iItE.js} +1 -1
  183. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Ca27l5x1.js → kanban-definition-UXKFOSKX-D1mvDB88.js} +1 -1
  184. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-4HMvq5Ms.js → kanban-definition-UXKFOSKX-DSbwi_qW.js} +1 -1
  185. package/dist-embed/chunks/{kk-KZ-P5N5QNE5-Bdzg30AB.js → kk-KZ-P5N5QNE5-BlIG0olU.js} +1 -1
  186. package/dist-embed/chunks/{km-KH-HSX4SM5Z-Bwn2NP1-.js → km-KH-HSX4SM5Z-Dixy2EU_.js} +1 -1
  187. package/dist-embed/chunks/{ko-KR-MTYHY66A-KUaxlo0q.js → ko-KR-MTYHY66A-CUkVgSOW.js} +1 -1
  188. package/dist-embed/chunks/{ku-TR-6OUDTVRD-DRegsFXo.js → ku-TR-6OUDTVRD-BKl1H1lo.js} +1 -1
  189. package/dist-embed/chunks/{layout-CfByO2og.js → layout-C8rF9YGx.js} +1 -1
  190. package/dist-embed/chunks/{layout-Bww76Fbs.js → layout-CG9LV3Hx.js} +1 -1
  191. package/dist-embed/chunks/{layout-XYFfX1M2.js → layout-DoJGfXjC.js} +1 -1
  192. package/dist-embed/chunks/{lexicalHooks-BtjglRXO.js → lexicalHooks-DClcl3Q8.js} +1 -1
  193. package/dist-embed/chunks/{lib-D7CvuX1J.js → lib-3oZnFGZf.js} +1 -1
  194. package/dist-embed/chunks/{lib-COJY2oKd.js → lib-B9Uql7XT.js} +1 -1
  195. package/dist-embed/chunks/{lib-C2mgrsS1.js → lib-BBoRpP0j.js} +1 -1
  196. package/dist-embed/chunks/{lib-BpltV-0Y.js → lib-BCX_PXlV.js} +1 -1
  197. package/dist-embed/chunks/{lib-DrEcjKb5.js → lib-Bj5kYV-X.js} +1 -1
  198. package/dist-embed/chunks/{lib-csBGF1d0.js → lib-BpgMIewI.js} +2 -2
  199. package/dist-embed/chunks/{lib-CQeoQJWp.js → lib-BuHiJKfL.js} +6 -6
  200. package/dist-embed/chunks/{lib-9S57siQD.js → lib-ByfYxpOp.js} +1 -1
  201. package/dist-embed/chunks/{lib-Dh9o1esj.js → lib-C1F_0rhP.js} +1 -1
  202. package/dist-embed/chunks/{lib-DOnguzJf.js → lib-C3UM0Dbg.js} +1 -1
  203. package/dist-embed/chunks/{lib-CHID83aM.js → lib-C65GpCKu.js} +1 -1
  204. package/dist-embed/chunks/{lib-ox3VOLDA.js → lib-CblY5Fcs.js} +1 -1
  205. package/dist-embed/chunks/{lib-C46CpvHb.js → lib-ClP1grrt.js} +1 -1
  206. package/dist-embed/chunks/{lib-rn9DpcHi.js → lib-D7ZIPOgc.js} +1 -1
  207. package/dist-embed/chunks/{lib-op0DTswa.js → lib-DEmXqC05.js} +1 -1
  208. package/dist-embed/chunks/{lib--J3JPp2K.js → lib-DHfhUiNX.js} +6 -6
  209. package/dist-embed/chunks/{lib-QmOij8gS.js → lib-DdpVsCS-.js} +1 -1
  210. package/dist-embed/chunks/{lib-CjBEbEzm.js → lib-DgCQUDNp.js} +1 -1
  211. package/dist-embed/chunks/{lib-Cpc8Fspj.js → lib-UcItgdUY.js} +1 -1
  212. package/dist-embed/chunks/{lib-PbTUB5SW.js → lib-jE6-GvLb.js} +4 -4
  213. package/dist-embed/chunks/{lt-LT-XHIRWOB4-c6CdaS7u.js → lt-LT-XHIRWOB4-TTj82TW7.js} +1 -1
  214. package/dist-embed/chunks/{lv-LV-5QDEKY6T-D9RognOk.js → lv-LV-5QDEKY6T-DLiLVd-V.js} +1 -1
  215. package/dist-embed/chunks/{mermaid.core-Esvc6Hnq.js → mermaid.core-DNh2XcNw.js} +5 -5
  216. package/dist-embed/chunks/{mermaid.core-S-dRFFrX.js → mermaid.core-YqoEZ53F.js} +3 -3
  217. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-ByNYsSBG.js → mindmap-definition-YA3MSWOX-9Zysg0pA.js} +1 -1
  218. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-Df1_M5n9.js → mindmap-definition-YA3MSWOX-B_htE6P9.js} +1 -1
  219. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-B3dWXyS3.js → mindmap-definition-YA3MSWOX-Bverytf0.js} +1 -1
  220. package/dist-embed/chunks/{mindmap-definition-e4c1d938-OxJ5FL_j.js → mindmap-definition-e4c1d938-BZ0_IMAi.js} +1 -1
  221. package/dist-embed/chunks/{mr-IN-CRQNXWMA-ht3P_mrN.js → mr-IN-CRQNXWMA-CiVi-oiY.js} +1 -1
  222. package/dist-embed/chunks/{my-MM-5M5IBNSE-CsIkhWRp.js → my-MM-5M5IBNSE-DiSnYIcD.js} +1 -1
  223. package/dist-embed/chunks/{nb-NO-T6EIAALU-DJw7Uvbx.js → nb-NO-T6EIAALU-DfSOBb64.js} +1 -1
  224. package/dist-embed/chunks/{nl-NL-IS3SIHDZ-Dcrp-zwB.js → nl-NL-IS3SIHDZ-BF72RX5n.js} +1 -1
  225. package/dist-embed/chunks/{nn-NO-6E72VCQL-DaBAIbM9.js → nn-NO-6E72VCQL-Ck3xjqMu.js} +1 -1
  226. package/dist-embed/chunks/{oc-FR-POXYY2M6-DSdMEDCa.js → oc-FR-POXYY2M6-CEdstZI1.js} +1 -1
  227. package/dist-embed/chunks/{pa-IN-N4M65BXN-BMyPito1.js → pa-IN-N4M65BXN-D8DDwUFn.js} +1 -1
  228. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-kBah6ESG.js → pegDiagram-XKGWAZYB-BKyBaYIN.js} +1 -1
  229. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-BSS-6ffj.js → pegDiagram-XKGWAZYB-JwxbEaY4.js} +1 -1
  230. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-Cp-YO1Nz.js → pegDiagram-XKGWAZYB-pjI6nL6b.js} +1 -1
  231. package/dist-embed/chunks/{percentages-BXMCSKIN-pswfKMt2.js → percentages-BXMCSKIN-CxyBCxgG.js} +6 -6
  232. package/dist-embed/chunks/{pica-9l-d47El.js → pica-DX7g0w-h.js} +1 -1
  233. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-O8OeQHh3.js → pieDiagram-E7YTZNPT-B68DSrPX.js} +1 -1
  234. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-BxyKuocY.js → pieDiagram-E7YTZNPT-Bkr2CIvA.js} +1 -1
  235. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-Bm12iDY2.js → pieDiagram-E7YTZNPT-D7XWQ97B.js} +1 -1
  236. package/dist-embed/chunks/{pieDiagram-c941bede-CIoxBoJu.js → pieDiagram-c941bede-d4RaoKUh.js} +1 -1
  237. package/dist-embed/chunks/{pl-PL-T2D74RX3-CFk8rHgP.js → pl-PL-T2D74RX3-bJIlJVUJ.js} +1 -1
  238. package/dist-embed/chunks/{plugin-NcgdmcAO.js → plugin-CCnESDIv.js} +1 -1
  239. package/dist-embed/chunks/{plugin-BpyrQiv7.js → plugin-CYxMm8BZ.js} +1 -1
  240. package/dist-embed/chunks/{portable-BXor4J0S.js → portable-QzxJi8wl.js} +1 -1
  241. package/dist-embed/chunks/{pt-BR-5N22H2LF-BYlDcalT.js → pt-BR-5N22H2LF-T_zS_1UI.js} +1 -1
  242. package/dist-embed/chunks/{pt-PT-UZXXM6DQ-xXdoFOOb.js → pt-PT-UZXXM6DQ-BGYBI-AZ.js} +1 -1
  243. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-BzjPv9Mo.js → quadrantDiagram-AXDQQJYC-B4R-yitO.js} +1 -1
  244. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-B676z1mV.js → quadrantDiagram-AXDQQJYC-CGpes8qr.js} +1 -1
  245. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-DFY8ZLzp.js → quadrantDiagram-AXDQQJYC-rgXt1vGm.js} +1 -1
  246. package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-DEYbq8W_.js → quadrantDiagram-cf8b8fe0-5H46snRs.js} +1 -1
  247. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-_NlqSOsS.js → railroadDiagram-O6MQD6OU-C4f7oKun.js} +1 -1
  248. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-BrFHqmp2.js → railroadDiagram-O6MQD6OU-CJTiXlK1.js} +1 -1
  249. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-xlRvlaA2.js → railroadDiagram-O6MQD6OU-DJaPMu7R.js} +1 -1
  250. package/dist-embed/chunks/{renderer-We9CyR7b.js → renderer-CKt61TR-.js} +1 -1
  251. package/dist-embed/chunks/{requirementDiagram-53bda41b-BzE9FWgv.js → requirementDiagram-53bda41b-DuuN6U8q.js} +1 -1
  252. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-DJ5PUfXx.js → requirementDiagram-BXWQKSXE-C4rko1x6.js} +1 -1
  253. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-CqWfurTm.js → requirementDiagram-BXWQKSXE-CEpmAL1v.js} +1 -1
  254. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-Hehk-IFe.js → requirementDiagram-BXWQKSXE-DsV3syx6.js} +1 -1
  255. package/dist-embed/chunks/{ro-RO-JPDTUUEW-e-URCww-.js → ro-RO-JPDTUUEW-BF-LNyWr.js} +1 -1
  256. package/dist-embed/chunks/{ru-RU-B4JR7IUQ-CrXBOpZl.js → ru-RU-B4JR7IUQ-CYsp0VFS.js} +1 -1
  257. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-DSrV5Rcy.js → sankeyDiagram-P5KCCOFB-8-my5aGt.js} +1 -1
  258. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-CTPOOwMI.js → sankeyDiagram-P5KCCOFB-B2FnnI1e.js} +1 -1
  259. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-DUA8-DLK.js → sankeyDiagram-P5KCCOFB-BmOnDwNP.js} +1 -1
  260. package/dist-embed/chunks/{sankeyDiagram-c3ef121a-yZIQ5S7q.js → sankeyDiagram-c3ef121a-CoUNmipD.js} +1 -1
  261. package/dist-embed/chunks/{sequenceDiagram-82a5b84f-AtgiqM7O.js → sequenceDiagram-82a5b84f-CXh2tfZw.js} +1 -1
  262. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-B1cw5Oup.js → sequenceDiagram-WJ2MYXX4-B3OnNwUZ.js} +1 -1
  263. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CXsr6X8d.js → sequenceDiagram-WJ2MYXX4-DLJTx5HG.js} +1 -1
  264. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-B6CSGaEA.js → sequenceDiagram-WJ2MYXX4-jYhIJWPU.js} +1 -1
  265. package/dist-embed/chunks/{server-extension-D9R-wwz5.js → server-extension-uXAt_Cce.js} +1 -1
  266. package/dist-embed/chunks/{sessions-DdXtI_C1.js → sessions-CmElNrqo.js} +2 -2
  267. package/dist-embed/chunks/{si-LK-N5RQ5JYF-DmJK04-A.js → si-LK-N5RQ5JYF-DPP2zzI4.js} +1 -1
  268. package/dist-embed/chunks/{sizeCapture-INFHLROL-BWyPehjY.js → sizeCapture-INFHLROL-Bw-7LloZ.js} +1 -1
  269. package/dist-embed/chunks/{sizeCapture-INFHLROL-jPyERZ1n.js → sizeCapture-INFHLROL-ClUFT0bL.js} +1 -1
  270. package/dist-embed/chunks/{sizeCapture-INFHLROL-C_RJNTEe.js → sizeCapture-INFHLROL-DKI7jpZK.js} +1 -1
  271. package/dist-embed/chunks/{sk-SK-C5VTKIMK-BDHycW1Q.js → sk-SK-C5VTKIMK-Bsy5tZJ9.js} +1 -1
  272. package/dist-embed/chunks/{sl-SI-NN7IZMDC-Bv9ZQTNb.js → sl-SI-NN7IZMDC-BSN6metY.js} +1 -1
  273. package/dist-embed/chunks/{state-ChvKybRM.js → state-Bvubz6wh.js} +1 -1
  274. package/dist-embed/chunks/{stateDiagram-43e79a5f-CjdmUJOd.js → stateDiagram-43e79a5f-FLMfzXB-.js} +1 -1
  275. package/dist-embed/chunks/{stateDiagram-D77RDMKH-BXnmKNN1.js → stateDiagram-D77RDMKH-2CWWTXaI.js} +1 -1
  276. package/dist-embed/chunks/{stateDiagram-D77RDMKH-CUt1Zkau.js → stateDiagram-D77RDMKH-2sTmMX8Y.js} +1 -1
  277. package/dist-embed/chunks/{stateDiagram-D77RDMKH-CrFujTYb.js → stateDiagram-D77RDMKH-7giqZmW7.js} +1 -1
  278. package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-DFbRZC_o.js → stateDiagram-v2-2041ed4f-D2F_d6ME.js} +1 -1
  279. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-5Xtf4H1i.js → stateDiagram-v2-MP3YSRHH-BVtW8oDF.js} +1 -1
  280. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-C0LD6d-h.js → stateDiagram-v2-MP3YSRHH-Bx_0d80j.js} +1 -1
  281. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-D0VxqcOS.js → stateDiagram-v2-MP3YSRHH-KSrY0YAO.js} +1 -1
  282. package/dist-embed/chunks/{styles-455b33cd-d_tMvz1K.js → styles-455b33cd-Bu2zKHp4.js} +1 -1
  283. package/dist-embed/chunks/{styles-f932cba9-CEfonQZW.js → styles-f932cba9-C9jkvhYd.js} +1 -1
  284. package/dist-embed/chunks/{styles-fcc2142b-CJtnKcrY.js → styles-fcc2142b-DOM8RBzL.js} +1 -1
  285. package/dist-embed/chunks/{subset-shared.chunk-B0WCMaCa.js → subset-shared.chunk-cWEwjmHn.js} +1 -1
  286. package/dist-embed/chunks/{subset-worker.chunk-i0SNRqXr.js → subset-worker.chunk-CoJnEmh6.js} +1 -1
  287. package/dist-embed/chunks/{substates-CqYxDlIh.js → substates-jb_LtnyU.js} +1 -1
  288. package/dist-embed/chunks/{sv-SE-XGPEYMSR-_HPzcZFc.js → sv-SE-XGPEYMSR-DtD64Ekq.js} +1 -1
  289. package/dist-embed/chunks/{svgDrawCommon-148a3cd9-Chk2X9i7.js → svgDrawCommon-148a3cd9-9JymGxYl.js} +1 -1
  290. package/dist-embed/chunks/{swimlanes-42K2YHIH-CMfuNOKB.js → swimlanes-42K2YHIH-BFOVykjS.js} +1 -1
  291. package/dist-embed/chunks/{swimlanes-42K2YHIH-BV3XvQft.js → swimlanes-42K2YHIH-DgPipNZK.js} +1 -1
  292. package/dist-embed/chunks/{swimlanes-42K2YHIH-da8v0JDr.js → swimlanes-42K2YHIH-Dm0fKZOd.js} +1 -1
  293. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-U1nDoVzD.js → swimlanesDiagram-VR7AAH4N-DQtryFsY.js} +1 -1
  294. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-CoxoxRv8.js → swimlanesDiagram-VR7AAH4N-DmI51dbU.js} +1 -1
  295. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BQ0QVA2n.js → swimlanesDiagram-VR7AAH4N-Nfw6c9qs.js} +1 -1
  296. package/dist-embed/chunks/{ta-IN-2NMHFXQM-Ccvi-lqm.js → ta-IN-2NMHFXQM-DgbGGIjW.js} +1 -1
  297. package/dist-embed/chunks/{th-TH-HPSO5L25-DvAg4Mv1.js → th-TH-HPSO5L25-CCZDC3pr.js} +1 -1
  298. package/dist-embed/chunks/{timeline-definition-24CTP7MA-BEfC9HaT.js → timeline-definition-24CTP7MA-BH6wgq9g.js} +1 -1
  299. package/dist-embed/chunks/{timeline-definition-24CTP7MA-C4dXdolh.js → timeline-definition-24CTP7MA-BHxdIfP8.js} +1 -1
  300. package/dist-embed/chunks/{timeline-definition-24CTP7MA-CJeNJmUn.js → timeline-definition-24CTP7MA-D7CF0GIK.js} +1 -1
  301. package/dist-embed/chunks/{timeline-definition-7545f45a-B9mNe698.js → timeline-definition-7545f45a-D4OzFMpR.js} +1 -1
  302. package/dist-embed/chunks/{tr-TR-DEFEU3FU-DJsjfrja.js → tr-TR-DEFEU3FU-akGa6iYJ.js} +1 -1
  303. package/dist-embed/chunks/{uk-UA-QMV73CPH-3fvexlQA.js → uk-UA-QMV73CPH-t35eBlzl.js} +1 -1
  304. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-BxXmlFlS.js → vennDiagram-4TSXK5OY-CRm97qMj.js} +1 -1
  305. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-Cb7TJzRk.js → vennDiagram-4TSXK5OY-Df2NdsCe.js} +1 -1
  306. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-Bsn5zjyD.js → vennDiagram-4TSXK5OY-jiuY4qr2.js} +1 -1
  307. package/dist-embed/chunks/{vi-VN-M7AON7JQ-BoQ3ayAr.js → vi-VN-M7AON7JQ-xWA8FWTO.js} +1 -1
  308. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-hcToOz3-.js → wardleyDiagram-VM6X3IG4-Dl6htcV4.js} +1 -1
  309. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-D7coqIlJ.js → wardleyDiagram-VM6X3IG4-DvfGuTUK.js} +1 -1
  310. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-DQqVVzTS.js → wardleyDiagram-VM6X3IG4-SCgxQpjj.js} +1 -1
  311. package/dist-embed/chunks/{xychartDiagram-3f383b91-DgRDb1pL.js → xychartDiagram-3f383b91-CpDYNTsR.js} +1 -1
  312. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-9a5I7o20.js → xychartDiagram-S5SC5T6Z-B7z8joDc.js} +1 -1
  313. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DD72ULmZ.js → xychartDiagram-S5SC5T6Z-CeiEf5TT.js} +1 -1
  314. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-CCp_tU6h.js → xychartDiagram-S5SC5T6Z-fil-wQKb.js} +1 -1
  315. package/dist-embed/chunks/{zh-CN-LNUGB5OW-Dzh0Ni_q.js → zh-CN-LNUGB5OW-D7M8yyYf.js} +1 -1
  316. package/dist-embed/chunks/{zh-HK-E62DVLB3-_1FpSc_d.js → zh-HK-E62DVLB3-DvMmnROR.js} +1 -1
  317. package/dist-embed/chunks/{zh-TW-RAJ6MFWO-CU-R8eF0.js → zh-TW-RAJ6MFWO-DSL_-5li.js} +1 -1
  318. package/dist-embed/datalayer-app-main.js +53 -53
  319. package/lib/apps/apps/visitorToken.d.ts +10 -0
  320. package/lib/apps/apps/visitorToken.js +31 -5
  321. package/lib/apps/embed/element.js +16 -8
  322. package/lib/apps/plugins/agents/DatalayerAgentBridge.js +36 -12
  323. package/lib/apps/plugins/chat/ChatView.js +28 -3
  324. package/lib/chat/base/ChatBase.js +13 -1
  325. package/lib/chat/header/ChatHeaderBase.js +17 -12
  326. package/lib/specs/agents/agents.d.ts +2 -0
  327. package/lib/specs/agents/agents.js +186 -2
  328. package/lib/specs/mcpServers.d.ts +1 -0
  329. package/lib/specs/mcpServers.js +35 -0
  330. package/lib/state/substates/RuntimesState.js +4 -3
  331. package/package.json +1 -1
  332. package/dist-embed/chunks/ChatView-zs95MHcU.js +0 -32
  333. package/dist-embed/chunks/DatalayerAgentBridge-D01Ek4NE.js +0 -1
@@ -1,4 +1,4 @@
1
- import{dk as Nt,as as Gh}from"../datalayer-app-main.js";function Wh(V,Se){for(var Be=0;Be<Se.length;Be++){const Te=Se[Be];if(typeof Te!="string"&&!Array.isArray(Te)){for(const Ce in Te)if(Ce!=="default"&&!(Ce in V)){const ge=Object.getOwnPropertyDescriptor(Te,Ce);ge&&Object.defineProperty(V,Ce,ge.get?ge:{enumerable:!0,get:()=>Te[Ce]})}}}return Object.freeze(Object.defineProperty(V,Symbol.toStringTag,{value:"Module"}))}var As={},Aa={},$c;function Pc(){if($c)return Aa;$c=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.baseAssetPath=void 0;const Se=typeof window<"u"&&typeof window.document<"u"?window.document.currentScript:null;let Be="/";return Se&&(Be=Se.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^/]+$/,"/")),Aa.baseAssetPath=Be,Aa}var Oa={},vc;function Ms(){if(vc)return Oa;vc=1,Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.defaultModelFetcher=void 0;const V=Se=>fetch(Se).then(Be=>Be.arrayBuffer());return Oa.defaultModelFetcher=V,Oa}var fr={},Ra={},xc;function Ua(){if(xc)return Ra;xc=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.log=void 0;const V=Se=>Be=>{console.log(`VAD | ${Se} >`,Be)};return Ra.log={error:V("error"),debug:V("debug"),warn:V("warn")},Ra}var Ba={},Sc;function un(){if(Sc)return Ba;Sc=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.Message=void 0;var V;return(function(Se){Se.AudioFrame="AUDIO_FRAME",Se.SpeechStart="SPEECH_START",Se.VADMisfire="VAD_MISFIRE",Se.SpeechEnd="SPEECH_END",Se.SpeechStop="SPEECH_STOP",Se.SpeechRealStart="SPEECH_REAL_START",Se.FrameProcessed="FRAME_PROCESSED"})(V||(Ba.Message=V={})),Ba}var Tc;function Ds(){if(Tc)return fr;Tc=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.FrameProcessor=fr.validateOptions=fr.defaultFrameProcessorOptions=void 0;const V=Ua(),Se=un();fr.defaultFrameProcessorOptions={positiveSpeechThreshold:.3,negativeSpeechThreshold:.25,preSpeechPadMs:800,redemptionMs:1400,minSpeechMs:400,submitUserSpeechOnPause:!1};function Be(ne){(ne.positiveSpeechThreshold<0||ne.positiveSpeechThreshold>1)&&V.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(ne.negativeSpeechThreshold<0||ne.negativeSpeechThreshold>ne.positiveSpeechThreshold)&&V.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),ne.preSpeechPadMs<0&&V.log.error("preSpeechPadMs should be positive"),ne.redemptionMs<0&&V.log.error("redemptionMs should be positive"),ne.minSpeechMs<0&&V.log.error("minSpeechMs should be positive")}fr.validateOptions=Be;const Te=ne=>{const W=ne.reduce((X,$e)=>(X.push(X.at(-1)+$e.length),X),[0]),k=new Float32Array(W.at(-1));return ne.forEach((X,$e)=>{const ke=W[$e];k.set(X,ke)}),k};function Ce(ne,W){const k=Math.floor(ne.redemptionMs/W),X=Math.floor(ne.preSpeechPadMs/W),$e=Math.floor(ne.minSpeechMs/W);return{redemptionFrames:k,preSpeechPadFrames:X,minSpeechFrames:$e}}class ge{constructor(W,k,X,$e){this.modelProcessFunc=W,this.modelResetFunc=k,this.options=X,this.msPerFrame=$e,this.speaking=!1,this.redemptionCounter=0,this.speechFrameCount=0,this.active=!1,this.speechRealStartFired=!1,this.setOptions=ee=>{this.options={...this.options,...ee};const{redemptionFrames:H,preSpeechPadFrames:Me,minSpeechFrames:Xe}=Ce(this.options,this.msPerFrame);this.redemptionFrames=H,this.preSpeechPadFrames=Me,this.minSpeechFrames=Xe},this.reset=()=>{this.speaking=!1,this.speechRealStartFired=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0,this.speechFrameCount=0},this.pause=ee=>{this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment(ee):this.reset()},this.resume=()=>{this.active=!0},this.endSegment=ee=>{const H=this.audioBuffer;this.audioBuffer=[];const Me=this.speaking;if(this.reset(),Me)if(H.reduce((Ee,ye)=>ye.isSpeech?Ee+1:Ee,0)>=this.minSpeechFrames){const Ee=Te(H.map(ye=>ye.frame));ee({msg:Se.Message.SpeechEnd,audio:Ee})}else ee({msg:Se.Message.VADMisfire});return{}},this.process=async(ee,H)=>{if(!this.active)return;const Me=await this.modelProcessFunc(ee),Xe=Me.isSpeech>=this.options.positiveSpeechThreshold;if(H({probs:Me,msg:Se.Message.FrameProcessed,frame:ee}),this.audioBuffer.push({frame:ee,isSpeech:Xe}),Xe&&(this.speechFrameCount++,this.redemptionCounter=0),Xe&&!this.speaking&&(this.speaking=!0,H({msg:Se.Message.SpeechStart})),this.speaking&&this.speechFrameCount===this.minSpeechFrames&&!this.speechRealStartFired&&(this.speechRealStartFired=!0,H({msg:Se.Message.SpeechRealStart})),Me.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.redemptionFrames){this.redemptionCounter=0,this.speechFrameCount=0,this.speaking=!1,this.speechRealStartFired=!1;const Ee=this.audioBuffer;if(this.audioBuffer=[],Ee.reduce((we,Le)=>Le.isSpeech?we+1:we,0)>=this.minSpeechFrames){const we=Te(Ee.map(Le=>Le.frame));H({msg:Se.Message.SpeechEnd,audio:we})}else H({msg:Se.Message.VADMisfire})}if(!this.speaking){for(;this.audioBuffer.length>this.preSpeechPadFrames;)this.audioBuffer.shift();this.speechFrameCount=0}},this.audioBuffer=[];const{redemptionFrames:ke,preSpeechPadFrames:le,minSpeechFrames:re}=Ce(this.options,this.msPerFrame);this.redemptionFrames=ke,this.preSpeechPadFrames=le,this.minSpeechFrames=re,this.reset()}}return fr.FrameProcessor=ge,fr}var mr={},Os={exports:{}},Ec;function jh(){return Ec||(Ec=1,(function(V,Se){var Be=(()=>{var Te=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyNames,ne=Object.prototype.hasOwnProperty,W=(e=>typeof Nt<"u"?Nt:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Nt<"u"?Nt:t)[r]}):e)(function(e){if(typeof Nt<"u")return Nt.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),k=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}},X=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ge(t))!ne.call(e,a)&&a!==r&&Te(e,a,{get:()=>t[a],enumerable:!(i=Ce(t,a))||i.enumerable});return e},ke=e=>$e(Te({},"__esModule",{value:!0}),e),le,re,ee,H,Me,Xe,Ee,ye=k(()=>{"use strict";le=new Map,re=[],ee=new WeakMap,H=(e,t,r)=>{if(t&&typeof t.init=="function"&&typeof t.createInferenceSessionHandler=="function"){let i=le.get(e);if(i===void 0)le.set(e,{backend:t,priority:r});else{if(i.priority>r)return;if(i.priority===r&&i.backend!==t)throw new Error(`cannot register backend "${e}" using priority ${r}`)}if(r>=0){let a=re.indexOf(e);a!==-1&&re.splice(a,1);for(let n=0;n<re.length;n++)if(le.get(re[n]).priority<=r){re.splice(n,0,e);return}re.push(e)}return}throw new TypeError("not a valid backend")},Me=async e=>{let t=le.get(e);if(!t)return"backend not found.";if(t.initialized)return t.backend;if(t.aborted)return t.error;{let r=!!t.initPromise;try{if(!r){let i=t.backend,a=ee.get(i);t.initPromise=a?a.then(async()=>i.init(e),async()=>i.init(e)):i.init(e),ee.set(i,t.initPromise)}return await t.initPromise,t.initialized=!0,t.backend}catch(i){return r||(t.error=`${i}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},Xe=async e=>{let t=e.executionProviders||[],r=t.map(u=>typeof u=="string"?u:u.name),i=r.length===0?re:r,a,n=[],s=new Set;for(let u of i){let l=await Me(u);typeof l=="string"?n.push({name:u,err:l}):(a||(a=l),a===l&&s.add(u))}if(!a)throw new Error(`no available backend found. ERR: ${n.map(u=>`[${u.name}] ${u.err}`).join(", ")}`);for(let{name:u,err:l}of n)r.includes(u)&&console.warn(`removing requested execution provider "${u}" from session options because it is not available: ${l}`);let o=t.filter(u=>s.has(typeof u=="string"?u:u.name));return[a,new Proxy(e,{get:(u,l)=>l==="executionProviders"?o:Reflect.get(u,l)})]},Ee=async()=>{let e=[];for(let r of re){if(typeof le.get(r).backend.createLoraAdapterHandler!="function")continue;let i=await Me(r);if(typeof i!="string")return i;e.push({name:r,err:i})}let t=e.length===0?"":` ERR: ${e.map(r=>`[${r.name}] ${r.err}`).join(", ")}`;throw new Error(`no available backend supports LoRA adapters.${t}`)}}),we=k(()=>{"use strict";ye()}),Le,dt=k(()=>{"use strict";Le="1.31.1"}),je,_e,at=k(()=>{"use strict";dt(),je="warning",_e={wasm:{},webgl:{},webgpu:{},versions:{common:Le},set logLevel(e){if(e!==void 0){if(typeof e!="string"||["verbose","info","warning","error","fatal"].indexOf(e)===-1)throw new Error(`Unsupported logging level: ${e}`);je=e}},get logLevel(){return je}},Object.defineProperty(_e,"logLevel",{enumerable:!0})}),te,er=k(()=>{"use strict";at(),te=_e}),ht,qt,Ze,He,Re,pt,tr=k(()=>{"use strict";at(),ht=(e,t)=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.timeStamp(`${e}::ORT::${t}`)},qt=(e,t)=>{let r=new Error().stack?.split(/\r\n|\r|\n/g)||[],i=!1;for(let a=0;a<r.length;a++){if(i&&!r[a].includes("TRACE_FUNC")){let n=`FUNC_${e}::${r[a].trim().split(" ")[1]}`;t&&(n+=`::${t}`),ht("CPU",n);return}r[a].includes("TRACE_FUNC")&&(i=!0)}},Ze=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||qt("BEGIN",e)},He=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||qt("END",e)},Re=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.time(`ORT::${e}`)},pt=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.timeEnd(`ORT::${e}`)}}),Kt,Ii=k(()=>{"use strict";ye(),tr(),Kt=class Uc{constructor(t,r){this.backend=t,this.handler=r}static async create(t){if(Ze(),typeof t!="string"&&!(t instanceof Uint8Array))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let r=await Ee(),i=await r.createLoraAdapterHandler(t);return He(),new Uc(r,i)}async release(){return this.handler.dispose()}}}),zi,Ci,ln=k(()=>{"use strict";zi=(e,t)=>{let r=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);r.width=e.dims[3],r.height=e.dims[2];let i=r.getContext("2d");if(i!=null){let a,n;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(a=e.dims[2],n=e.dims[3]):(a=e.dims[3],n=e.dims[2]);let s=t?.format!==void 0?t.format:"RGB",o=t?.norm,u,l;o===void 0||o.mean===void 0?u=[255,255,255,255]:typeof o.mean=="number"?u=[o.mean,o.mean,o.mean,o.mean]:(u=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(u[3]=o.mean[3])),o===void 0||o.bias===void 0?l=[0,0,0,0]:typeof o.bias=="number"?l=[o.bias,o.bias,o.bias,o.bias]:(l=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(l[3]=o.bias[3]));let d=n*a,c=0,h=d,m=d*2,f=-1;s==="RGBA"?(c=0,h=d,m=d*2,f=d*3):s==="RGB"?(c=0,h=d,m=d*2):s==="RBG"&&(c=0,m=d,h=d*2);for(let b=0;b<n;b++)for(let x=0;x<a;x++){let _=(e.data[c++]-l[0])*u[0],y=(e.data[h++]-l[1])*u[1],S=(e.data[m++]-l[2])*u[2],T=f===-1?255:(e.data[f++]-l[3])*u[3];i.fillStyle="rgba("+_+","+y+","+S+","+T+")",i.fillRect(x,b,1,1)}if("toDataURL"in r)return r.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},Ci=(e,t)=>{let r=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),i;if(r!=null){let a,n,s;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(a=e.dims[2],n=e.dims[1],s=e.dims[3]):(a=e.dims[3],n=e.dims[2],s=e.dims[1]);let o=t!==void 0&&t.format!==void 0?t.format:"RGB",u=t?.norm,l,d;u===void 0||u.mean===void 0?l=[255,255,255,255]:typeof u.mean=="number"?l=[u.mean,u.mean,u.mean,u.mean]:(l=[u.mean[0],u.mean[1],u.mean[2],255],u.mean[3]!==void 0&&(l[3]=u.mean[3])),u===void 0||u.bias===void 0?d=[0,0,0,0]:typeof u.bias=="number"?d=[u.bias,u.bias,u.bias,u.bias]:(d=[u.bias[0],u.bias[1],u.bias[2],0],u.bias[3]!==void 0&&(d[3]=u.bias[3]));let c=n*a;if(t!==void 0&&(t.format!==void 0&&s===4&&t.format!=="RGBA"||s===3&&t.format!=="RGB"&&t.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,m=0,f=1,b=2,x=3,_=0,y=c,S=c*2,T=-1;o==="RGBA"?(_=0,y=c,S=c*2,T=c*3):o==="RGB"?(_=0,y=c,S=c*2):o==="RBG"&&(_=0,S=c,y=c*2),i=r.createImageData(a,n);for(let E=0;E<n*a;m+=h,f+=h,b+=h,x+=h,E++)i.data[m]=(e.data[_++]-d[0])*l[0],i.data[f]=(e.data[y++]-d[1])*l[1],i.data[b]=(e.data[S++]-d[2])*l[2],i.data[x]=T===-1?255:(e.data[T++]-d[3])*l[3]}else throw new Error("Can not access image data");return i}}),rr,Ai,Oi,Ri,Bi,Mi,dn=k(()=>{"use strict";Ir(),rr=(e,t)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(t.height===void 0||t.width===void 0)throw new Error("Image height and width must be defined");if(t.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:r,width:i}=t,a=t.norm??{mean:255,bias:0},n,s;typeof a.mean=="number"?n=[a.mean,a.mean,a.mean,a.mean]:n=[a.mean[0],a.mean[1],a.mean[2],a.mean[3]??255],typeof a.bias=="number"?s=[a.bias,a.bias,a.bias,a.bias]:s=[a.bias[0],a.bias[1],a.bias[2],a.bias[3]??0];let o=t.format!==void 0?t.format:"RGBA",u=t.tensorFormat!==void 0&&t.tensorFormat!==void 0?t.tensorFormat:"RGB",l=r*i,d=u==="RGBA"?new Float32Array(l*4):new Float32Array(l*3),c=4,h=0,m=1,f=2,b=3,x=0,_=l,y=l*2,S=-1;o==="RGB"&&(c=3,h=0,m=1,f=2,b=-1),u==="RGBA"?S=l*3:u==="RBG"?(x=0,y=l,_=l*2):u==="BGR"&&(y=0,_=l,x=l*2);for(let T=0;T<l;T++,h+=c,f+=c,m+=c,b+=c)d[x++]=(e[h]+s[0])/n[0],d[_++]=(e[m]+s[1])/n[1],d[y++]=(e[f]+s[2])/n[2],S!==-1&&b!==-1&&(d[S++]=(e[b]+s[3])/n[3]);return u==="RGBA"?new Ve("float32",d,[1,4,r,i]):new Ve("float32",d,[1,3,r,i])},Ai=async(e,t)=>{let r=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,i=typeof ImageData<"u"&&e instanceof ImageData,a=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",s,o=t??{},u=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},l=d=>typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement||d instanceof OffscreenCanvas?d.getContext("2d"):null;if(r){let d=u();d.width=e.width,d.height=e.height;let c=l(d);if(c!=null){let h=e.height,m=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(h=t.resizedHeight,m=t.resizedWidth),t!==void 0){if(o=t,t.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=h,o.width=m}else o.tensorFormat="RGBA",o.height=h,o.width=m;c.drawImage(e,0,0),s=c.getImageData(0,0,m,h).data}else throw new Error("Can not access image data")}else if(i){let d,c;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(d=t.resizedHeight,c=t.resizedWidth):(d=e.height,c=e.width),t!==void 0&&(o=t),o.format="RGBA",o.height=d,o.width=c,t!==void 0){let h=u();h.width=c,h.height=d;let m=l(h);if(m!=null)m.putImageData(e,0,0),s=m.getImageData(0,0,c,d).data;else throw new Error("Can not access image data")}else s=e.data}else if(a){if(t===void 0)throw new Error("Please provide image config with format for Imagebitmap");let d=u();d.width=e.width,d.height=e.height;let c=l(d);if(c!=null){let h=e.height,m=e.width;return c.drawImage(e,0,0,m,h),s=c.getImageData(0,0,m,h).data,o.height=h,o.width=m,rr(s,o)}else throw new Error("Can not access image data")}else{if(n)return new Promise((d,c)=>{let h=u(),m=l(h);if(!e||!m)return c();let f=new Image;f.crossOrigin="Anonymous",f.src=e,f.onload=()=>{h.width=f.width,h.height=f.height,m.drawImage(f,0,0,h.width,h.height);let b=m.getImageData(0,0,h.width,h.height);o.height=h.height,o.width=h.width,d(rr(b.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(s!==void 0)return rr(s,o);throw new Error("Input data provided is not supported - aborted tensor creation")},Oi=(e,t)=>{let{width:r,height:i,download:a,dispose:n}=t,s=[1,i,r,4];return new Ve({location:"texture",type:"float32",texture:e,dims:s,download:a,dispose:n})},Ri=(e,t)=>{let{dataType:r,dims:i,download:a,dispose:n}=t;return new Ve({location:"gpu-buffer",type:r??"float32",gpuBuffer:e,dims:i,download:a,dispose:n})},Bi=(e,t)=>{let{dataType:r,dims:i,download:a,dispose:n}=t;return new Ve({location:"ml-tensor",type:r??"float32",mlTensor:e,dims:i,download:a,dispose:n})},Mi=(e,t,r)=>new Ve({location:"cpu-pinned",type:e,data:t,dims:r??[t.length]})}),vt,Ft,kr,Di,pn=k(()=>{"use strict";vt=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Ft=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),kr=!1,Di=()=>{if(!kr){kr=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,t=typeof BigUint64Array<"u"&&BigUint64Array.from,r=globalThis.Float16Array,i=typeof r<"u"&&r.from;e&&(vt.set("int64",BigInt64Array),Ft.set(BigInt64Array,"int64")),t&&(vt.set("uint64",BigUint64Array),Ft.set(BigUint64Array,"uint64")),i?(vt.set("float16",r),Ft.set(r,"float16")):vt.set("float16",Uint16Array)}}}),Pi,Ui,cn=k(()=>{"use strict";Ir(),Pi=e=>{let t=1;for(let r=0;r<e.length;r++){let i=e[r];if(typeof i!="number"||!Number.isSafeInteger(i))throw new TypeError(`dims[${r}] must be an integer, got: ${i}`);if(i<0)throw new RangeError(`dims[${r}] must be a non-negative integer, got: ${i}`);t*=i}return t},Ui=(e,t)=>{switch(e.location){case"cpu":return new Ve(e.type,e.data,t);case"cpu-pinned":return new Ve({location:"cpu-pinned",data:e.data,type:e.type,dims:t});case"texture":return new Ve({location:"texture",texture:e.texture,type:e.type,dims:t});case"gpu-buffer":return new Ve({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case"ml-tensor":return new Ve({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:t});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Ve,Ir=k(()=>{"use strict";ln(),dn(),pn(),cn(),Ve=class{constructor(e,t,r){Di();let i,a;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,i=e.type,a=e.dims,e.location){case"cpu-pinned":{let s=vt.get(i);if(!s)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(e.data instanceof s))throw new TypeError(`buffer should be of type ${s.name}`);this.cpuData=e.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let s,o;if(typeof e=="string")if(i=e,o=r,e==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");s=t}else{let u=vt.get(e);if(u===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e==="float16"&&u===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${u.name} as data.`);e==="uint64"||e==="int64"?s=u.from(t,BigInt):s=u.from(t)}else if(t instanceof u)s=t;else if(t instanceof Uint8ClampedArray)if(e==="uint8")s=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&t instanceof Uint16Array&&u!==Uint16Array)s=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${i} tensor's data must be type of ${u}`)}else if(o=t,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let u=typeof e[0];if(u==="string")i="string",s=e;else if(u==="boolean")i="bool",s=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${u}.`)}else if(e instanceof Uint8ClampedArray)i="uint8",s=Uint8Array.from(e);else{let u=Ft.get(e.constructor);if(u===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);i=u,s=e}if(o===void 0)o=[s.length];else if(!Array.isArray(o))throw new TypeError("A tensor's dims must be a number array");a=o,this.cpuData=s,this.dataLocation="cpu"}let n=Pi(a);if(this.cpuData&&n!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=a,this.size=n}static async fromImage(e,t){return Ai(e,t)}static fromTexture(e,t){return Oi(e,t)}static fromGpuBuffer(e,t){return Ri(e,t)}static fromMLTensor(e,t){return Bi(e,t)}static fromPinnedBuffer(e,t,r){return Mi(e,t,r)}toDataURL(e){return zi(this,e)}toImageData(e){return Ci(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Ui(this,e)}}}),Ye,Li=k(()=>{"use strict";Ir(),Ye=Ve}),Ni,hn=k(()=>{"use strict";ye(),Ii(),Li(),tr(),Ni=class Lc{constructor(t,r){this.handler=t,this.backend=r}async run(t,r,i){Ze(),Re("InferenceSession.run");let a={},n={};if(typeof t!="object"||t===null||t instanceof Ye||Array.isArray(t))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let s=!0;if(typeof r=="object"){if(r===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(r instanceof Ye)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(r)){if(r.length===0)throw new TypeError("'fetches' cannot be an empty array.");s=!1;for(let d of r){if(typeof d!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(d)===-1)throw new RangeError(`'fetches' contains invalid output name: ${d}.`);a[d]=null}if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else{let d=!1,c=Object.getOwnPropertyNames(r);for(let h of this.outputNames)if(c.indexOf(h)!==-1){let m=r[h];(m===null||m instanceof Ye)&&(d=!0,s=!1,a[h]=m)}if(d){if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else n=r}}else if(typeof r<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let d of this.inputNames)if(typeof t[d]>"u")throw new Error(`input '${d}' is missing in 'feeds'.`);if(s)for(let d of this.outputNames)a[d]=null;let o;if(n.activeLoraAdapters!==void 0){if(!Array.isArray(n.activeLoraAdapters))throw new TypeError("'activeLoraAdapters' must be an array.");o=n.activeLoraAdapters.map(d=>{if(!(d instanceof Kt))throw new TypeError("'activeLoraAdapters' must be an array of LoraAdapter objects.");if(d.backend!==this.backend)throw new Error("LoRA adapter was created by a different backend than the session.");return d.handler})}let u=await this.handler.run(t,a,n,o),l={};for(let d in u)if(Object.hasOwnProperty.call(u,d)){let c=u[d];c instanceof Ye?l[d]=c:l[d]=new Ye(c.type,c.data,c.dims)}return pt("InferenceSession.run"),He(),l}async release(){return this.handler.dispose()}static async create(t,r,i,a){Ze(),Re("InferenceSession.create");let n,s={};if(typeof t=="string"){if(n=t,typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof Uint8Array){if(n=t,typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){let d=t,c=0,h=t.byteLength;if(typeof r=="object"&&r!==null)s=r;else if(typeof r=="number"){if(c=r,!Number.isSafeInteger(c))throw new RangeError("'byteOffset' must be an integer.");if(c<0||c>=d.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${d.byteLength}).`);if(h=t.byteLength-c,typeof i=="number"){if(h=i,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||c+h>d.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${d.byteLength-c}].`);if(typeof a=="object"&&a!==null)s=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else if(typeof i<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof r<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(d,c,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[o,u]=await Xe(s),l=await o.createInferenceSessionHandler(n,u);return pt("InferenceSession.create"),He(),new Lc(l,o)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),zr,fn=k(()=>{"use strict";hn(),zr=Ni}),Cr,mn=k(()=>{"use strict";Ii(),Cr=Kt}),gn=k(()=>{"use strict"}),yn=k(()=>{"use strict"}),wn=k(()=>{"use strict"}),_n=k(()=>{"use strict"}),qi={};X(qi,{InferenceSession:()=>zr,LoraAdapter:()=>Cr,TRACE:()=>ht,TRACE_EVENT_BEGIN:()=>Re,TRACE_EVENT_END:()=>pt,TRACE_FUNC_BEGIN:()=>Ze,TRACE_FUNC_END:()=>He,Tensor:()=>Ye,env:()=>te,registerBackend:()=>H});var rt=k(()=>{"use strict";we(),er(),fn(),mn(),Li(),gn(),yn(),tr(),wn(),_n()}),Ar=k(()=>{"use strict"}),Fi={};X(Fi,{default:()=>Vi});var Or,Rr,Vi,bn=k(()=>{"use strict";ic(),Tt(),Ur(),Or="ort-wasm-proxy-worker",Rr=globalThis.self?.name===Or,Rr&&(self.onmessage=e=>{let{type:t,in:r}=e.data;try{switch(t){case"init-wasm":qr(r.wasm).then(()=>{gs(r).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})})},i=>{postMessage({type:t,err:i})});break;case"init-ep":{let{epName:i,env:a}=r;ys(a,i).then(()=>{postMessage({type:t})},n=>{postMessage({type:t,err:n})});break}case"copy-from":{let{buffer:i}=r,a=an(i);postMessage({type:t,out:a});break}case"create":{let{model:i,options:a}=r;_s(i,a).then(n=>{postMessage({type:t,out:n})},n=>{postMessage({type:t,err:n})});break}case"release":bs(r),postMessage({type:t});break;case"run":{let{sessionId:i,inputIndices:a,inputs:n,outputIndices:s,options:o}=r;vs(i,a,n,s,new Array(s.length).fill(null),o).then(u=>{u.some(l=>l[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:u},Ss([...n,...u]))},u=>{postMessage({type:t,err:u})});break}case"end-profiling":xs(r),postMessage({type:t});break;default:}}catch(i){postMessage({type:t,err:i})}}),Vi=Rr?null:e=>new Worker(e??Ge,{type:"classic",name:Or})}),Gi,Wi,Ge,Br,ir,ji,Hi,Mr,Ki,Dr,Zi,Pr,Qi,Ur=k(()=>{"use strict";Ar(),Gi=typeof location>"u"?void 0:location.origin,Wi=()=>typeof document<"u"?document.currentScript?.src:typeof self<"u"?self.location?.href:void 0,Ge=Wi(),Br=()=>{if(Ge&&!Ge.startsWith("blob:"))return Ge.substring(0,Ge.lastIndexOf("/")+1)},ir=(e,t)=>{try{let r=t??Ge;return(r?new URL(e,r):new URL(e)).origin===Gi}catch{return!1}},ji=(e,t)=>{let r=t??Ge;try{return(r?new URL(e,r):new URL(e)).href}catch{return}},Hi=(e,t)=>`${t??"./"}${e}`,Mr=async e=>{let t=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(t)},Ki=async e=>(await import(e)).default,Dr=(bn(),ke(Fi)).default,Zi=async()=>{if(!Ge)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ir(Ge))return[void 0,Dr()];let e=await Mr(Ge);return[e,Dr(e)]},Pr=void 0,Qi=async(e,t,r,i)=>{let a=Pr&&!(e||t);if(a)if(Ge)a=ir(Ge)||i&&!r;else if(i&&!r)a=!0;else throw new Error("cannot determine the script source URL.");if(a)return[void 0,Pr];{let n="ort-wasm-simd-threaded.jsep.mjs",s=e??ji(n,t),o=r&&s&&!ir(s,t),u=o?await Mr(s):s??Hi(n,t);return[o?u:void 0,await Ki(u)]}}}),Lr,ar,Vt,Nr,Xi,Yi,Ji,qr,ie,Tt=k(()=>{"use strict";Ur(),ar=!1,Vt=!1,Nr=!1,Xi=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},Yi=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Ji=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},qr=async e=>{if(ar)return Promise.resolve();if(Vt)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Nr)throw new Error("previous call to 'initializeWebAssembly()' failed.");Vt=!0;let t=e.initTimeout,r=e.numThreads;if(e.simd!==!1){if(e.simd==="relaxed"){if(!Ji())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!Yi())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let i=Xi();r>1&&!i&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+r+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=r=1);let a=e.wasmPaths,n=typeof a=="string"?a:void 0,s=a?.mjs,o=s?.href??s,u=a?.wasm,l=u?.href??u,d=e.wasmBinary,[c,h]=await Qi(o,n,r>1,!!d||!!l),m=!1,f=[];if(t>0&&f.push(new Promise(b=>{setTimeout(()=>{m=!0,b()},t)})),f.push(new Promise((b,x)=>{let _={numThreads:r};if(d)_.wasmBinary=d,_.locateFile=y=>y;else if(l||n)_.locateFile=y=>l??n+y;else if(o&&o.indexOf("blob:")!==0)_.locateFile=y=>new URL(y,o).href;else if(c){let y=Br();y&&(_.locateFile=S=>y+S)}h(_).then(y=>{Vt=!1,ar=!0,Lr=y,b(),c&&URL.revokeObjectURL(c)},y=>{Vt=!1,Nr=!0,x(y)})})),await Promise.race(f),m)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},ie=()=>{if(ar&&Lr)return Lr;throw new Error("WebAssembly is not initialized yet.")}}),Je,nr,Z,Fr=k(()=>{"use strict";Tt(),Je=(e,t)=>{let r=ie(),i=r.lengthBytesUTF8(e)+1,a=r._malloc(i);return r.stringToUTF8(e,a,i),t.push(a),a},nr=(e,t,r,i)=>{if(typeof e=="object"&&e!==null){if(r.has(e))throw new Error("Circular reference in options");r.add(e)}Object.entries(e).forEach(([a,n])=>{let s=t?t+a:a;if(typeof n=="object")nr(n,s+".",r,i);else if(typeof n=="string"||typeof n=="number")i(s,n.toString());else if(typeof n=="boolean")i(s,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},Z=e=>{let t=ie(),r=t.stackSave();try{let i=t.PTR_SIZE,a=t.stackAlloc(2*i);t._OrtGetLastError(a,a+i);let n=Number(t.getValue(a,i===4?"i32":"i64")),s=t.getValue(a+i,"*"),o=s?t.UTF8ToString(s):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(r)}}}),ea,$n=k(()=>{"use strict";Tt(),Fr(),ea=(e,t)=>{let r=ie(),i=0,a=[],n=e||{};try{if(e?.logSeverityLevel===void 0)n.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)n.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(n.terminate=!1);let s=0;e?.tag!==void 0&&(s=Je(e.tag,a)),i=r._OrtCreateRunOptions(n.logSeverityLevel,n.logVerbosityLevel,!!n.terminate,s),i===0&&Z("Can't create run options."),e?.extra!==void 0&&nr(e.extra,"",new WeakSet,(o,u)=>{let l=Je(o,a),d=Je(u,a);r._OrtAddRunConfigEntry(i,l,d)!==0&&Z(`Can't set a run config entry: ${o} - ${u}.`)});for(let o of t)r._OrtRunOptionsAddActiveLoraAdapter(i,o)!==0&&Z("Can't add an active LoRA adapter.");return[i,a]}catch(s){throw i!==0&&r._OrtReleaseRunOptions(i),a.forEach(o=>r._free(o)),s}}}),ta,ra,ia,xt,aa,na,vn=k(()=>{"use strict";Tt(),Fr(),ta=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"layout":return 3;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},ra=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},ia=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(r=>(typeof r=="string"?r:r.name)==="webgpu")&&(e.enableMemPattern=!1)},xt=(e,t,r,i)=>{let a=Je(t,i),n=Je(r,i);ie()._OrtAddSessionConfigEntry(e,a,n)!==0&&Z(`Can't set a session config entry: ${t} - ${r}.`)},aa=async(e,t,r)=>{let i=t.executionProviders;for(let a of i){let n=typeof a=="string"?a:a.name,s=[],o;switch(n){case"webnn":if(n="WEBNN",xt(e,"session.disable_quant_qdq","1",r),xt(e,"session.disable_qdq_constant_folding","1",r),typeof a!="string"){let h=a?.deviceType;h&&xt(e,"deviceType",h,r)}break;case"webgpu":if(n="JS",typeof a!="string"){let h=a;if(h?.preferredLayout){if(h.preferredLayout!=="NCHW"&&h.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${h.preferredLayout}`);xt(e,"preferredLayout",h.preferredLayout,r)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${n}`)}let u=s.length,l=0,d=0;if(u>0){l=ie()._malloc(u*ie().PTR_SIZE),r.push(l),d=ie()._malloc(u*ie().PTR_SIZE),r.push(d);for(let h=0;h<u;h++)ie().setValue(l+h*ie().PTR_SIZE,s[h][0],"*"),ie().setValue(d+h*ie().PTR_SIZE,s[h][1],"*")}let c;if(o===void 0){let h=Je(n,r);c=await ie()._OrtAppendExecutionProvider(e,h,l,d,u)}c!==0&&Z(`Can't append execution provider: ${n}.`)}},na=async e=>{let t=ie(),r=0,i=[],a=e||{};ia(a);try{let n=ta(a.graphOptimizationLevel??"all"),s=ra(a.executionMode??"sequential"),o=typeof a.logId=="string"?Je(a.logId,i):0,u=a.logSeverityLevel??2;if(!Number.isInteger(u)||u<0||u>4)throw new Error(`log severity level is not valid: ${u}`);let l=a.logVerbosityLevel??0;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log verbosity level is not valid: ${l}`);let d=typeof a.optimizedModelFilePath=="string"?Je(a.optimizedModelFilePath,i):0;if(r=t._OrtCreateSessionOptions(n,!!a.enableCpuMemArena,!!a.enableMemPattern,s,!!a.enableProfiling,0,o,u,l,d),r===0&&Z("Can't create session options."),a.executionProviders&&await aa(r,a,i),a.enableGraphCapture!==void 0){if(typeof a.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${a.enableGraphCapture}`);xt(r,"enableGraphCapture",a.enableGraphCapture.toString(),i)}if(a.freeDimensionOverrides)for(let[c,h]of Object.entries(a.freeDimensionOverrides)){if(typeof c!="string")throw new Error(`free dimension override name must be a string: ${c}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let m=Je(c,i);t._OrtAddFreeDimensionOverride(r,m,h)!==0&&Z(`Can't set a free dimension override: ${c} - ${h}.`)}return a.extra!==void 0&&nr(a.extra,"",new WeakSet,(c,h)=>{xt(r,c,h,i)}),[r,i]}catch(n){throw r!==0&&t._OrtReleaseSessionOptions(r)!==0&&Z("Can't release session options."),i.forEach(s=>t._free(s)),n}}}),Et,kt,It,Vr,Gr,Wr,jr,di,ae=k(()=>{"use strict";Et=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},kt=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},It=(e,t)=>{let r=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],i=typeof t=="number"?t:t.reduce((a,n)=>a*n,1);return r>0?Math.ceil(i*r):void 0},Vr=e=>{switch(e){case"float16":return typeof Float16Array<"u"?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},Gr=e=>{switch(e){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${e}`)}},Wr=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",jr=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",di=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),sr,Hr=k(()=>{"use strict";Ar(),sr=async e=>{if(typeof e=="string"){let t=await fetch(e);if(!t.ok)throw new Error(`failed to load external data file: ${e}`);let r=t.headers.get("Content-Length"),i=r?parseInt(r,10):0;if(i<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let a=t.body.getReader(),n;try{n=new ArrayBuffer(i)}catch(o){if(o instanceof RangeError){let u=Math.ceil(i/65536);n=new WebAssembly.Memory({initial:u,maximum:u}).buffer}else throw o}let s=0;for(;;){let{done:o,value:u}=await a.read();if(o)break;let l=u.byteLength;new Uint8Array(n,s,l).set(u),s+=l}return new Uint8Array(n,0,i)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),sa,pi,ci,Zt,hi,fi,Ae,At=k(()=>{"use strict";ae(),sa=["V","I","W","E","F"],pi=(e,t)=>{console.log(`[${sa[e]},${new Date().toISOString()}]${t}`)},hi=(e,t)=>{ci=e,Zt=t},fi=(e,t)=>{let r=Gr(e),i=Gr(ci);r>=i&&pi(r,typeof t=="function"?t():t)},Ae=(...e)=>{Zt&&fi(...e)}}),mi,Mt,R,Dt,oa,ua,gi,de=k(()=>{"use strict";mi=class{static calcMatMulShape(e,t){return e[1]!==t[0]?void 0:[e[0],t[1]]}},Mt=class{static calcShape(e,t,r=!1){let i=e.length,a=t.length;if(i===0)return t;if(a===0)return e;let n=Math.max(e.length,t.length),s=new Array(n);if(r){if(i<2||a<2)return;let o=mi.calcMatMulShape([e[i-2],e[i-1]],[t[a-2],t[a-1]]);if(o===void 0)return;[s[n-2],s[n-1]]=o}for(let o=r?3:1;o<=n;o++){let u=i-o<0?1:e[i-o],l=a-o<0?1:t[a-o];if(u!==l&&u>1&&l>1)return;let d=Math.max(u,l);if(u&&l)s[n-o]=Math.max(u,l);else{if(d>1)return;s[n-o]=0}}return s}static isValidBroadcast(e,t){let r=e.length,i=t.length;if(r>i)return!1;for(let a=1;a<=r;a++)if(e[r-a]!==1&&e[r-a]!==t[i-a])return!1;return!0}},R=class on{static size(t){return on.getSizeFromDimensionRange(t,0,t.length)}static convertShape(t,r=4){let i=t.length;if(i===0)return[];let a=new Array(i),n=i-1;for(;n>=0;){if(t[n]%r===0){a[n]=t[n]/r;break}if(r%t[n]!==0)throw new Error("cannot convert shape");a[n]=1,r/=t[n],n--}for(n--;n>=0;n--)a[n]=t[n];return a}static sizeFromDimension(t,r){if(r<0||r>t.length)throw new Error(`invalid dimension of ${r} for sizeFromDimension as Tensor has ${t.length} dimensions.`);return on.getSizeFromDimensionRange(t,r,t.length)}static sizeToDimension(t,r){if(r<0||r>t.length)throw new Error(`invalid dimension of ${r} for sizeToDimension as Tensor has ${t.length} dimensions.`);return on.getSizeFromDimensionRange(t,0,r)}static getSizeFromDimensionRange(t,r,i){let a=1;for(let n=r;n<i;n++){if(t[n]<0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains negative values in them.");a*=Number(t[n])}return a}static computeStrides(t){let r=t.length;if(r===0)return[];if(r===1)return[1];let i=new Array(r);i[r-1]=1,i[r-2]=t[r-1];for(let a=r-3;a>=0;--a)i[a]=i[a+1]*t[a+1];return i}static normalizeAxis(t,r){if(t<-r&&t>=r)throw new Error("unsupported axis for this operation.");return t<0?t+r:t}static normalizeAxes(t,r){return t.map(i=>this.normalizeAxis(i,r??t.length))}static sortBasedOnPerm(t,r){return r?r.map(i=>t[i]):t.slice().reverse()}static padShape(t,r){let i=t.length;return t.map((a,n)=>a+r[n]+r[n+i])}static areEqual(t,r){return t.length!==r.length?!1:t.every((i,a)=>i===r[a])}},Dt=class Er{static adjustPoolAttributes(t,r,i,a,n,s){if(!t&&i.length!==r.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(t)for(let o=0;o<r.length-2;o++)o>=i.length?i.push(r[o+2]):i[o]=r[o+2];for(let o=0;o<i.length;o++)if(o<a.length){if(a[o]<0)throw new Error("strides should be greater than or equal to 1")}else a.push(1);for(let o=0;o<i.length;o++)if(o<n.length){if(n[o]<0)throw new Error("dilations should be greater than or equal to 1")}else n.push(1);for(let o=0;o<i.length*2;o++)if(o<s.length){if(s[o]<0)throw new Error("pad should be greater than or equal to 1")}else s.push(0);for(let o=0;o<i.length;o++){if(i[o]<=0)throw new Error("kernel shapes need to be greater than 0");if(s[o]>=i[o]||s[o+i.length]>=i[o])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(t,r,i,a,n,s,o){if(o){if(n.length!==2*(t.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(r.length!==t.length-2)throw new Error("length of strides should be the length of data dimensions");if(a.length!==t.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let u=0;u<t.length-2;u++)Er.adjustPadAndReturnShape(t[u+(s?1:2)],r[u],i[u],a[u],n,u,u+t.length-2,o)}}static computePoolOutputShape(t,r,i,a,n,s,o,u=0){if(r.length<=0)throw new Error("input shape must be of size greater than 0");let l=[r[0],r[1]];return Er.computeShapeHelper(t,r,l,i,a,n,s,o,u),l}static computeConvOutputShape(t,r,i,a,n,s,o){if(t.length<=0||r.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");let u=[t[0],r[0]];return Er.computeShapeHelper(!1,t,u,i,a,n,s,o),u}static computeShapeHelper(t,r,i,a,n,s,o,u,l=0){if(t)for(let d=0;d<r.length-2;d++)i.push(1);else for(let d=0;d<r.length-2;d++)i.push(Er.adjustPadAndReturnShape(r[d+2],a[d],n[d],s[d],o,d,d+r.length-2,u,l))}static computeOutputSize(t,r,i,a,n){let s=Math.floor(t/r)+1;return n===1&&(s=Math.ceil(t/r)+1,(s-1)*r>=i+a&&(s-=1)),s}static adjustPadAndReturnShape(t,r,i,a,n,s,o,u,l=0){let d=i*(a-1)+1;if(u&&u!=="NOTSET")switch(u){case"VALID":return n[s]=0,n[o]=0,Er.computeOutputSize(t-d,r,t,0,l);case"SAME_LOWER":case"SAME_UPPER":if(i!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let c=(Math.floor((t+r-1)/r)-1)*r+a-t;return n[s]=Math.floor(u==="SAME_LOWER"?(c+1)/2:c/2),n[o]=c-n[s],Er.computeOutputSize(t+n[s]+n[o]-d,r,t,n[s],l)}default:throw new Error("Unsupported AutoPad type")}else return Er.computeOutputSize(t+n[s]+n[o]-d,r,t,n[s],l)}},oa=class{static getShapeOfGemmResult(e,t,r,i,a){if(e.length!==2||r.length!==2)throw new Error("shape need to be of size 2");let n,s,o;t?(n=e[1],s=e[0]):(n=e[0],s=e[1]);let u=-1;if(i?(o=r[0],u=1):(o=r[1],u=0),r[u]!==s)throw new Error("dimension mismatch");if(n<=0||o<=0||s<=0)throw new Error("invalid shape specified");if(a&&!Mt.isValidBroadcast(a,[n,o]))throw new Error("gemm: invalid bias shape for broadcast");return[n,o,s]}},ua=-34028234663852886e22,gi=34028234663852886e22}),Kr,yi=k(()=>{"use strict";ae(),Kr=(e,t)=>new(Vr(t))(e)}),wi,Ot,bt,or,ur,yr,wr,Zr,_r,Qt,Xt,La=k(()=>{"use strict";ae(),At(),wi=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Ot=(e,t)=>{if(t==="int32")return e;let r=wi.get(t);if(!r)throw new Error(`WebNN backend does not support data type: ${t}`);let i=r/8;if(e.byteLength%i!==0)throw new Error(`Invalid Uint8Array length - must be a multiple of ${i}.`);let a=e.byteLength/i,n=new(Vr(t))(e.buffer,e.byteOffset,a);switch(t){case"int64":case"uint64":{let s=new Int32Array(a);for(let o=0;o<a;o++){let u=n[o];if(u>2147483647n||u<-2147483648n)throw new Error("Can not convert int64 data to int32 - value out of range.");s[o]=Number(u)}return new Uint8Array(s.buffer)}case"int8":case"uint8":case"uint32":{if(t==="uint32"&&n.some(o=>o>2147483647))throw new Error("Can not convert uint32 data to int32 - value out of range.");let s=Int32Array.from(n,Number);return new Uint8Array(s.buffer)}default:throw new Error(`Unsupported data conversion from ${t} to 'int32'`)}},bt=(e,t)=>{if(t==="int32")return e;if(e.byteLength%4!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 4 (int32).");let r=e.byteLength/4,i=new Int32Array(e.buffer,e.byteOffset,r);switch(t){case"int64":{let a=BigInt64Array.from(i,BigInt);return new Uint8Array(a.buffer)}case"uint64":{if(i.some(n=>n<0))throw new Error("Can not convert int32 data to uin64 - negative value found.");let a=BigUint64Array.from(i,BigInt);return new Uint8Array(a.buffer)}case"int8":{if(i.some(n=>n<-128||n>127))throw new Error("Can not convert int32 data to int8 - value out of range.");let a=Int8Array.from(i,Number);return new Uint8Array(a.buffer)}case"uint8":{if(i.some(a=>a<0||a>255))throw new Error("Can not convert int32 data to uint8 - value out of range.");return Uint8Array.from(i,Number)}case"uint32":{if(i.some(n=>n<0))throw new Error("Can not convert int32 data to uint32 - negative value found.");let a=Uint32Array.from(i,Number);return new Uint8Array(a.buffer)}default:throw new Error(`Unsupported data conversion from 'int32' to ${t}`)}},or=1,ur=()=>or++,yr=new Map([["int8","int32"],["uint8","int32"],["uint32","int32"],["int64","int32"]]),wr=(e,t)=>{let r=wi.get(e);if(!r)throw new Error(`WebNN backend does not support data type: ${e}`);return t.length>0?Math.ceil(t.reduce((i,a)=>i*a)*r/8):0},Zr=class{constructor(e){this.isDataConverted=!1;let{sessionId:t,context:r,tensor:i,dataType:a,shape:n,fallbackDataType:s}=e;this.sessionId=t,this.mlContext=r,this.mlTensor=i,this.dataType=a,this.tensorShape=n,this.fallbackDataType=s}get tensor(){return this.mlTensor}get type(){return this.dataType}get fallbackType(){return this.fallbackDataType}get shape(){return this.tensorShape}get byteLength(){return wr(this.dataType,this.tensorShape)}destroy(){Ae("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e){if(this.fallbackDataType){let t=await this.mlContext.readTensor(this.mlTensor),r=bt(new Uint8Array(t),this.dataType);if(e){(e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).set(r);return}else return new Uint8Array(r).buffer}else return e?this.mlContext.readTensor(this.mlTensor,e):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,t,r){return this.mlContext===e&&this.dataType===t&&this.tensorShape.length===r.length&&this.tensorShape.every((i,a)=>i===r[a])}setIsDataConverted(e){this.isDataConverted=e}},_r=class{constructor(e,t){this.tensorManager=e,this.wrapper=t}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,t,r,i){let a=this.tensorManager.getMLContext(e),n=this.tensorManager.getMLOpSupportLimits(e),s;if(!n?.input.dataTypes.includes(t)){if(s=yr.get(t),!s||!n?.input.dataTypes.includes(s))throw new Error(`WebNN backend does not support data type: ${t}`);Ae("verbose",()=>`[WebNN] TensorIdTracker.ensureTensor: fallback dataType from ${t} to ${s}`)}if(this.wrapper){if(this.wrapper.canReuseTensor(a,t,r))return this.wrapper.tensor;if(i){if(this.wrapper.byteLength!==wr(t,r))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let o=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,t,r,o,!0,!0,s),i&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){let t=e;if(this.wrapper){if(this.wrapper.fallbackType)if(this.wrapper.fallbackType==="int32")t=Ot(e,this.wrapper.type),this.wrapper.setIsDataConverted(!0);else throw new Error(`Unsupported fallback data type: ${this.wrapper.fallbackType}`);if(e.byteLength===this.wrapper.byteLength){this.wrapper.write(t);return}else Ae("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor()}this.activeUpload?this.activeUpload.set(t):this.activeUpload=new Uint8Array(t)}async download(e){if(this.activeUpload){let t=this.wrapper?.isDataConverted?bt(this.activeUpload,this.wrapper?.type):this.activeUpload;if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(t):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(t);return}else return t.buffer}if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read(e):this.wrapper.read()}},Qt=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let t=this.backend.getMLContext(e);if(!t)throw new Error("MLContext not found for session.");return t}getMLOpSupportLimits(e){return this.backend.getMLOpSupportLimits(e)}reserveTensorId(){let e=ur();return this.tensorTrackersById.set(e,new _r(this)),e}releaseTensorId(e){let t=this.tensorTrackersById.get(e);t&&(this.tensorTrackersById.delete(e),t.tensorWrapper&&this.releaseTensor(t.tensorWrapper))}async ensureTensor(e,t,r,i,a){Ae("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${t}, dataType: ${r}, shape: ${i}, copyOld: ${a}}`);let n=this.tensorTrackersById.get(t);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,r,i,a)}upload(e,t){let r=this.tensorTrackersById.get(e);if(!r)throw new Error("Tensor not found.");r.upload(t)}async download(e,t){Ae("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${t?.byteLength}}`);let r=this.tensorTrackersById.get(e);if(!r)throw new Error("Tensor not found.");return r.download(t)}releaseTensorsForSession(e){for(let t of this.freeTensors)t.sessionId===e&&t.destroy();this.freeTensors=this.freeTensors.filter(t=>t.sessionId!==e)}registerTensor(e,t,r,i){let a=this.getMLContext(e),n=ur(),s=new Zr({sessionId:e,context:a,tensor:t,dataType:r,shape:i});return this.tensorTrackersById.set(n,new _r(this,s)),this.externalTensors.add(s),n}async getCachedTensor(e,t,r,i,a,n,s){let o=this.getMLContext(e);for(let[l,d]of this.freeTensors.entries())if(d.canReuseTensor(o,t,r)){Ae("verbose",()=>`[WebNN] Reusing tensor {dataType: ${t}, ${s?`fallbackDataType: ${s},`:""} shape: ${r}`);let c=this.freeTensors.splice(l,1)[0];return c.sessionId=e,c}Ae("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${t}, ${s?`fallbackDataType: ${s},`:""} shape: ${r}}`);let u=await o.createTensor({dataType:s??t,shape:r,dimensions:r,usage:i,writable:a,readable:n});return new Zr({sessionId:e,context:o,tensor:u,dataType:t,shape:r,fallbackDataType:s})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},Xt=(...e)=>new Qt(...e)}),br,la,da,Na=k(()=>{"use strict";ae(),Tt(),yi(),La(),At(),br=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),la=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0)return!1;let r=Object.keys(e).sort(),i=Object.keys(t).sort();return r.length===i.length&&r.every((a,n)=>a===i[n]&&e[a]===t[a])},da=class{constructor(e){this.tensorManager=Xt(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.sessionGraphOutputs=new Map,this.temporaryGraphInputs=[],this.temporaryGraphOutputs=[],this.temporarySessionTensorIds=new Map,this.mlOpSupportLimitsBySessionId=new Map,hi(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){Ae("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){Ae("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let t=this.temporarySessionTensorIds.get(e);if(t){for(let r of t)Ae("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${r}}`),this.tensorManager.releaseTensorId(r);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let r=this.mlContextCache.findIndex(i=>i.gpuDevice===e);if(r!==-1)return this.mlContextCache[r].mlContext;{let i=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:i}),i}}else if(e===void 0){let r=this.mlContextCache.findIndex(i=>i.options===void 0&&i.gpuDevice===void 0);if(r!==-1)return this.mlContextCache[r].mlContext;{let i=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:i}),i}}let t=this.mlContextCache.findIndex(r=>la(r.options,e));if(t!==-1)return this.mlContextCache[t].mlContext;{let r=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:r}),r}}registerMLContext(e,t){this.mlContextBySessionId.set(e,t);let r=this.sessionIdsByMLContext.get(t);r||(r=new Set,this.sessionIdsByMLContext.set(t,r)),r.add(e),this.mlOpSupportLimitsBySessionId.has(e)||this.mlOpSupportLimitsBySessionId.set(e,t.opSupportLimits()),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[]),this.temporaryGraphOutputs.length>0&&(this.sessionGraphOutputs.set(e,this.temporaryGraphOutputs),this.temporaryGraphOutputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e),this.sessionGraphOutputs.delete(e);let t=this.mlContextBySessionId.get(e);if(!t)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e),this.mlOpSupportLimitsBySessionId.delete(e);let r=this.sessionIdsByMLContext.get(t);if(r.delete(e),r.size===0){this.sessionIdsByMLContext.delete(t);let i=this.mlContextCache.findIndex(a=>a.mlContext===t);i!==-1&&this.mlContextCache.splice(i,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}getMLOpSupportLimits(e){return this.mlOpSupportLimitsBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){Ae("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,t,r,i,a){let n=br.get(r);if(!n)throw new Error(`Unsupported ONNX data type: ${r}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,t,n,i,a)}async createTemporaryTensor(e,t,r){Ae("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${t}, shape: ${r}}`);let i=br.get(t);if(!i)throw new Error(`Unsupported ONNX data type: ${t}`);let a=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,a,i,r,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(a):this.temporarySessionTensorIds.set(e,[a]),a}uploadTensor(e,t){if(!ie().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");Ae("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${t.byteLength}}`),this.tensorManager.upload(e,t)}async downloadTensor(e,t){return this.tensorManager.download(e,t)}createMLTensorDownloader(e,t){return async()=>{let r=await this.tensorManager.download(e);return Kr(r,t)}}registerMLTensor(e,t,r,i){let a=br.get(r);if(!a)throw new Error(`Unsupported ONNX data type: ${r}`);let n=this.tensorManager.registerTensor(e,t,a,i);return Ae("verbose",()=>`[WebNN] registerMLTensor {tensor: ${t}, dataType: ${a}, dimensions: ${i}} -> {tensorId: ${n}}`),n}registerGraphInput(e){this.temporaryGraphInputs.push(e)}registerGraphOutput(e){this.temporaryGraphOutputs.push(e)}isGraphInput(e,t){let r=this.sessionGraphInputs.get(e);return r?r.includes(t):!1}isGraphOutput(e,t){let r=this.sessionGraphOutputs.get(e);return r?r.includes(t):!1}isGraphInputOutputTypeSupported(e,t,r=!0){let i=br.get(Et(t)),a=this.mlOpSupportLimitsBySessionId.get(e);return typeof i>"u"?!1:r?!!a?.input.dataTypes.includes(i):!!a?.output.dataTypes.includes(i)}flush(){}}}),_i=k(()=>{"use strict"}),bi,Qr,Xr,pa,$i,Yr,vi,xi,ca,qa=k(()=>{"use strict";At(),_i(),bi=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),Qr=[],Xr=e=>Math.ceil(Number(e)/16)*16,pa=e=>{for(let t=0;t<Qr.length;t++){let r=Qr[t];if(e<=r)return r}return Math.ceil(e/16)*16},$i=1,Yr=()=>$i++,vi=async(e,t,r,i)=>{let a=Xr(r),n=e.device.createBuffer({size:a,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let s=e.getCommandEncoder();e.endComputePass(),s.copyBufferToBuffer(t,0,n,0,a),e.flush(),await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange();if(i){let u=i();return u.set(new Uint8Array(o,0,r)),u}else return new Uint8Array(o.slice(0,r))}finally{n.destroy()}},xi=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[t]of bi)Qr.push(t),this.freeBuffers.set(t,[]),this.freeUniformBuffers.set(t,[]);this.sessionCount=0}upload(e,t){let r=t.buffer,i=t.byteOffset,a=t.byteLength,n=Xr(a),s=this.storageCache.get(e);if(!s)throw new Error("gpu data for uploading does not exist");if(Number(s.originalSize)!==a)throw new Error(`inconsistent data size. gpu data size=${s.originalSize}, data size=${a}`);if(n===a&&i%4===0)this.backend.device.queue.writeBuffer(s.gpuData.buffer,0,r,i,a);else{let o=new Uint8Array(n);o.set(t),this.backend.device.queue.writeBuffer(s.gpuData.buffer,0,o,0,n)}Ae("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,t){let r=this.storageCache.get(e);if(!r)throw new Error("source gpu data for memcpy does not exist");let i=this.storageCache.get(t);if(!i)throw new Error("destination gpu data for memcpy does not exist");if(r.originalSize!==i.originalSize)throw new Error("inconsistent source and destination gpu data size");let a=Xr(r.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(r.gpuData.buffer,0,i.gpuData.buffer,0,a)}registerExternalBuffer(e,t,r){let i;if(r){if(i=r[0],e===r[1])return Ae("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${t}) => id=${i}, buffer is the same, skip.`),i;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet.
1
+ import{dm as Nt,as as Gh}from"../datalayer-app-main.js";function Wh(V,Se){for(var Be=0;Be<Se.length;Be++){const Te=Se[Be];if(typeof Te!="string"&&!Array.isArray(Te)){for(const Ce in Te)if(Ce!=="default"&&!(Ce in V)){const ge=Object.getOwnPropertyDescriptor(Te,Ce);ge&&Object.defineProperty(V,Ce,ge.get?ge:{enumerable:!0,get:()=>Te[Ce]})}}}return Object.freeze(Object.defineProperty(V,Symbol.toStringTag,{value:"Module"}))}var As={},Aa={},$c;function Pc(){if($c)return Aa;$c=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.baseAssetPath=void 0;const Se=typeof window<"u"&&typeof window.document<"u"?window.document.currentScript:null;let Be="/";return Se&&(Be=Se.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^/]+$/,"/")),Aa.baseAssetPath=Be,Aa}var Oa={},vc;function Ms(){if(vc)return Oa;vc=1,Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.defaultModelFetcher=void 0;const V=Se=>fetch(Se).then(Be=>Be.arrayBuffer());return Oa.defaultModelFetcher=V,Oa}var fr={},Ra={},xc;function Ua(){if(xc)return Ra;xc=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.log=void 0;const V=Se=>Be=>{console.log(`VAD | ${Se} >`,Be)};return Ra.log={error:V("error"),debug:V("debug"),warn:V("warn")},Ra}var Ba={},Sc;function un(){if(Sc)return Ba;Sc=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.Message=void 0;var V;return(function(Se){Se.AudioFrame="AUDIO_FRAME",Se.SpeechStart="SPEECH_START",Se.VADMisfire="VAD_MISFIRE",Se.SpeechEnd="SPEECH_END",Se.SpeechStop="SPEECH_STOP",Se.SpeechRealStart="SPEECH_REAL_START",Se.FrameProcessed="FRAME_PROCESSED"})(V||(Ba.Message=V={})),Ba}var Tc;function Ds(){if(Tc)return fr;Tc=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.FrameProcessor=fr.validateOptions=fr.defaultFrameProcessorOptions=void 0;const V=Ua(),Se=un();fr.defaultFrameProcessorOptions={positiveSpeechThreshold:.3,negativeSpeechThreshold:.25,preSpeechPadMs:800,redemptionMs:1400,minSpeechMs:400,submitUserSpeechOnPause:!1};function Be(ne){(ne.positiveSpeechThreshold<0||ne.positiveSpeechThreshold>1)&&V.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(ne.negativeSpeechThreshold<0||ne.negativeSpeechThreshold>ne.positiveSpeechThreshold)&&V.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),ne.preSpeechPadMs<0&&V.log.error("preSpeechPadMs should be positive"),ne.redemptionMs<0&&V.log.error("redemptionMs should be positive"),ne.minSpeechMs<0&&V.log.error("minSpeechMs should be positive")}fr.validateOptions=Be;const Te=ne=>{const W=ne.reduce((X,$e)=>(X.push(X.at(-1)+$e.length),X),[0]),k=new Float32Array(W.at(-1));return ne.forEach((X,$e)=>{const ke=W[$e];k.set(X,ke)}),k};function Ce(ne,W){const k=Math.floor(ne.redemptionMs/W),X=Math.floor(ne.preSpeechPadMs/W),$e=Math.floor(ne.minSpeechMs/W);return{redemptionFrames:k,preSpeechPadFrames:X,minSpeechFrames:$e}}class ge{constructor(W,k,X,$e){this.modelProcessFunc=W,this.modelResetFunc=k,this.options=X,this.msPerFrame=$e,this.speaking=!1,this.redemptionCounter=0,this.speechFrameCount=0,this.active=!1,this.speechRealStartFired=!1,this.setOptions=ee=>{this.options={...this.options,...ee};const{redemptionFrames:H,preSpeechPadFrames:Me,minSpeechFrames:Xe}=Ce(this.options,this.msPerFrame);this.redemptionFrames=H,this.preSpeechPadFrames=Me,this.minSpeechFrames=Xe},this.reset=()=>{this.speaking=!1,this.speechRealStartFired=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0,this.speechFrameCount=0},this.pause=ee=>{this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment(ee):this.reset()},this.resume=()=>{this.active=!0},this.endSegment=ee=>{const H=this.audioBuffer;this.audioBuffer=[];const Me=this.speaking;if(this.reset(),Me)if(H.reduce((Ee,ye)=>ye.isSpeech?Ee+1:Ee,0)>=this.minSpeechFrames){const Ee=Te(H.map(ye=>ye.frame));ee({msg:Se.Message.SpeechEnd,audio:Ee})}else ee({msg:Se.Message.VADMisfire});return{}},this.process=async(ee,H)=>{if(!this.active)return;const Me=await this.modelProcessFunc(ee),Xe=Me.isSpeech>=this.options.positiveSpeechThreshold;if(H({probs:Me,msg:Se.Message.FrameProcessed,frame:ee}),this.audioBuffer.push({frame:ee,isSpeech:Xe}),Xe&&(this.speechFrameCount++,this.redemptionCounter=0),Xe&&!this.speaking&&(this.speaking=!0,H({msg:Se.Message.SpeechStart})),this.speaking&&this.speechFrameCount===this.minSpeechFrames&&!this.speechRealStartFired&&(this.speechRealStartFired=!0,H({msg:Se.Message.SpeechRealStart})),Me.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.redemptionFrames){this.redemptionCounter=0,this.speechFrameCount=0,this.speaking=!1,this.speechRealStartFired=!1;const Ee=this.audioBuffer;if(this.audioBuffer=[],Ee.reduce((we,Le)=>Le.isSpeech?we+1:we,0)>=this.minSpeechFrames){const we=Te(Ee.map(Le=>Le.frame));H({msg:Se.Message.SpeechEnd,audio:we})}else H({msg:Se.Message.VADMisfire})}if(!this.speaking){for(;this.audioBuffer.length>this.preSpeechPadFrames;)this.audioBuffer.shift();this.speechFrameCount=0}},this.audioBuffer=[];const{redemptionFrames:ke,preSpeechPadFrames:le,minSpeechFrames:re}=Ce(this.options,this.msPerFrame);this.redemptionFrames=ke,this.preSpeechPadFrames=le,this.minSpeechFrames=re,this.reset()}}return fr.FrameProcessor=ge,fr}var mr={},Os={exports:{}},Ec;function jh(){return Ec||(Ec=1,(function(V,Se){var Be=(()=>{var Te=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyNames,ne=Object.prototype.hasOwnProperty,W=(e=>typeof Nt<"u"?Nt:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Nt<"u"?Nt:t)[r]}):e)(function(e){if(typeof Nt<"u")return Nt.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),k=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}},X=(e,t)=>{for(var r in t)Te(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ge(t))!ne.call(e,a)&&a!==r&&Te(e,a,{get:()=>t[a],enumerable:!(i=Ce(t,a))||i.enumerable});return e},ke=e=>$e(Te({},"__esModule",{value:!0}),e),le,re,ee,H,Me,Xe,Ee,ye=k(()=>{"use strict";le=new Map,re=[],ee=new WeakMap,H=(e,t,r)=>{if(t&&typeof t.init=="function"&&typeof t.createInferenceSessionHandler=="function"){let i=le.get(e);if(i===void 0)le.set(e,{backend:t,priority:r});else{if(i.priority>r)return;if(i.priority===r&&i.backend!==t)throw new Error(`cannot register backend "${e}" using priority ${r}`)}if(r>=0){let a=re.indexOf(e);a!==-1&&re.splice(a,1);for(let n=0;n<re.length;n++)if(le.get(re[n]).priority<=r){re.splice(n,0,e);return}re.push(e)}return}throw new TypeError("not a valid backend")},Me=async e=>{let t=le.get(e);if(!t)return"backend not found.";if(t.initialized)return t.backend;if(t.aborted)return t.error;{let r=!!t.initPromise;try{if(!r){let i=t.backend,a=ee.get(i);t.initPromise=a?a.then(async()=>i.init(e),async()=>i.init(e)):i.init(e),ee.set(i,t.initPromise)}return await t.initPromise,t.initialized=!0,t.backend}catch(i){return r||(t.error=`${i}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},Xe=async e=>{let t=e.executionProviders||[],r=t.map(u=>typeof u=="string"?u:u.name),i=r.length===0?re:r,a,n=[],s=new Set;for(let u of i){let l=await Me(u);typeof l=="string"?n.push({name:u,err:l}):(a||(a=l),a===l&&s.add(u))}if(!a)throw new Error(`no available backend found. ERR: ${n.map(u=>`[${u.name}] ${u.err}`).join(", ")}`);for(let{name:u,err:l}of n)r.includes(u)&&console.warn(`removing requested execution provider "${u}" from session options because it is not available: ${l}`);let o=t.filter(u=>s.has(typeof u=="string"?u:u.name));return[a,new Proxy(e,{get:(u,l)=>l==="executionProviders"?o:Reflect.get(u,l)})]},Ee=async()=>{let e=[];for(let r of re){if(typeof le.get(r).backend.createLoraAdapterHandler!="function")continue;let i=await Me(r);if(typeof i!="string")return i;e.push({name:r,err:i})}let t=e.length===0?"":` ERR: ${e.map(r=>`[${r.name}] ${r.err}`).join(", ")}`;throw new Error(`no available backend supports LoRA adapters.${t}`)}}),we=k(()=>{"use strict";ye()}),Le,dt=k(()=>{"use strict";Le="1.31.1"}),je,_e,at=k(()=>{"use strict";dt(),je="warning",_e={wasm:{},webgl:{},webgpu:{},versions:{common:Le},set logLevel(e){if(e!==void 0){if(typeof e!="string"||["verbose","info","warning","error","fatal"].indexOf(e)===-1)throw new Error(`Unsupported logging level: ${e}`);je=e}},get logLevel(){return je}},Object.defineProperty(_e,"logLevel",{enumerable:!0})}),te,er=k(()=>{"use strict";at(),te=_e}),ht,qt,Ze,He,Re,pt,tr=k(()=>{"use strict";at(),ht=(e,t)=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.timeStamp(`${e}::ORT::${t}`)},qt=(e,t)=>{let r=new Error().stack?.split(/\r\n|\r|\n/g)||[],i=!1;for(let a=0;a<r.length;a++){if(i&&!r[a].includes("TRACE_FUNC")){let n=`FUNC_${e}::${r[a].trim().split(" ")[1]}`;t&&(n+=`::${t}`),ht("CPU",n);return}r[a].includes("TRACE_FUNC")&&(i=!0)}},Ze=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||qt("BEGIN",e)},He=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||qt("END",e)},Re=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.time(`ORT::${e}`)},pt=e=>{(typeof _e.trace>"u"?!_e.wasm.trace:!_e.trace)||console.timeEnd(`ORT::${e}`)}}),Kt,Ii=k(()=>{"use strict";ye(),tr(),Kt=class Uc{constructor(t,r){this.backend=t,this.handler=r}static async create(t){if(Ze(),typeof t!="string"&&!(t instanceof Uint8Array))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let r=await Ee(),i=await r.createLoraAdapterHandler(t);return He(),new Uc(r,i)}async release(){return this.handler.dispose()}}}),zi,Ci,ln=k(()=>{"use strict";zi=(e,t)=>{let r=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);r.width=e.dims[3],r.height=e.dims[2];let i=r.getContext("2d");if(i!=null){let a,n;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(a=e.dims[2],n=e.dims[3]):(a=e.dims[3],n=e.dims[2]);let s=t?.format!==void 0?t.format:"RGB",o=t?.norm,u,l;o===void 0||o.mean===void 0?u=[255,255,255,255]:typeof o.mean=="number"?u=[o.mean,o.mean,o.mean,o.mean]:(u=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(u[3]=o.mean[3])),o===void 0||o.bias===void 0?l=[0,0,0,0]:typeof o.bias=="number"?l=[o.bias,o.bias,o.bias,o.bias]:(l=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(l[3]=o.bias[3]));let d=n*a,c=0,h=d,m=d*2,f=-1;s==="RGBA"?(c=0,h=d,m=d*2,f=d*3):s==="RGB"?(c=0,h=d,m=d*2):s==="RBG"&&(c=0,m=d,h=d*2);for(let b=0;b<n;b++)for(let x=0;x<a;x++){let _=(e.data[c++]-l[0])*u[0],y=(e.data[h++]-l[1])*u[1],S=(e.data[m++]-l[2])*u[2],T=f===-1?255:(e.data[f++]-l[3])*u[3];i.fillStyle="rgba("+_+","+y+","+S+","+T+")",i.fillRect(x,b,1,1)}if("toDataURL"in r)return r.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},Ci=(e,t)=>{let r=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),i;if(r!=null){let a,n,s;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(a=e.dims[2],n=e.dims[1],s=e.dims[3]):(a=e.dims[3],n=e.dims[2],s=e.dims[1]);let o=t!==void 0&&t.format!==void 0?t.format:"RGB",u=t?.norm,l,d;u===void 0||u.mean===void 0?l=[255,255,255,255]:typeof u.mean=="number"?l=[u.mean,u.mean,u.mean,u.mean]:(l=[u.mean[0],u.mean[1],u.mean[2],255],u.mean[3]!==void 0&&(l[3]=u.mean[3])),u===void 0||u.bias===void 0?d=[0,0,0,0]:typeof u.bias=="number"?d=[u.bias,u.bias,u.bias,u.bias]:(d=[u.bias[0],u.bias[1],u.bias[2],0],u.bias[3]!==void 0&&(d[3]=u.bias[3]));let c=n*a;if(t!==void 0&&(t.format!==void 0&&s===4&&t.format!=="RGBA"||s===3&&t.format!=="RGB"&&t.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,m=0,f=1,b=2,x=3,_=0,y=c,S=c*2,T=-1;o==="RGBA"?(_=0,y=c,S=c*2,T=c*3):o==="RGB"?(_=0,y=c,S=c*2):o==="RBG"&&(_=0,S=c,y=c*2),i=r.createImageData(a,n);for(let E=0;E<n*a;m+=h,f+=h,b+=h,x+=h,E++)i.data[m]=(e.data[_++]-d[0])*l[0],i.data[f]=(e.data[y++]-d[1])*l[1],i.data[b]=(e.data[S++]-d[2])*l[2],i.data[x]=T===-1?255:(e.data[T++]-d[3])*l[3]}else throw new Error("Can not access image data");return i}}),rr,Ai,Oi,Ri,Bi,Mi,dn=k(()=>{"use strict";Ir(),rr=(e,t)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(t.height===void 0||t.width===void 0)throw new Error("Image height and width must be defined");if(t.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:r,width:i}=t,a=t.norm??{mean:255,bias:0},n,s;typeof a.mean=="number"?n=[a.mean,a.mean,a.mean,a.mean]:n=[a.mean[0],a.mean[1],a.mean[2],a.mean[3]??255],typeof a.bias=="number"?s=[a.bias,a.bias,a.bias,a.bias]:s=[a.bias[0],a.bias[1],a.bias[2],a.bias[3]??0];let o=t.format!==void 0?t.format:"RGBA",u=t.tensorFormat!==void 0&&t.tensorFormat!==void 0?t.tensorFormat:"RGB",l=r*i,d=u==="RGBA"?new Float32Array(l*4):new Float32Array(l*3),c=4,h=0,m=1,f=2,b=3,x=0,_=l,y=l*2,S=-1;o==="RGB"&&(c=3,h=0,m=1,f=2,b=-1),u==="RGBA"?S=l*3:u==="RBG"?(x=0,y=l,_=l*2):u==="BGR"&&(y=0,_=l,x=l*2);for(let T=0;T<l;T++,h+=c,f+=c,m+=c,b+=c)d[x++]=(e[h]+s[0])/n[0],d[_++]=(e[m]+s[1])/n[1],d[y++]=(e[f]+s[2])/n[2],S!==-1&&b!==-1&&(d[S++]=(e[b]+s[3])/n[3]);return u==="RGBA"?new Ve("float32",d,[1,4,r,i]):new Ve("float32",d,[1,3,r,i])},Ai=async(e,t)=>{let r=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,i=typeof ImageData<"u"&&e instanceof ImageData,a=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",s,o=t??{},u=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},l=d=>typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement||d instanceof OffscreenCanvas?d.getContext("2d"):null;if(r){let d=u();d.width=e.width,d.height=e.height;let c=l(d);if(c!=null){let h=e.height,m=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(h=t.resizedHeight,m=t.resizedWidth),t!==void 0){if(o=t,t.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=h,o.width=m}else o.tensorFormat="RGBA",o.height=h,o.width=m;c.drawImage(e,0,0),s=c.getImageData(0,0,m,h).data}else throw new Error("Can not access image data")}else if(i){let d,c;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(d=t.resizedHeight,c=t.resizedWidth):(d=e.height,c=e.width),t!==void 0&&(o=t),o.format="RGBA",o.height=d,o.width=c,t!==void 0){let h=u();h.width=c,h.height=d;let m=l(h);if(m!=null)m.putImageData(e,0,0),s=m.getImageData(0,0,c,d).data;else throw new Error("Can not access image data")}else s=e.data}else if(a){if(t===void 0)throw new Error("Please provide image config with format for Imagebitmap");let d=u();d.width=e.width,d.height=e.height;let c=l(d);if(c!=null){let h=e.height,m=e.width;return c.drawImage(e,0,0,m,h),s=c.getImageData(0,0,m,h).data,o.height=h,o.width=m,rr(s,o)}else throw new Error("Can not access image data")}else{if(n)return new Promise((d,c)=>{let h=u(),m=l(h);if(!e||!m)return c();let f=new Image;f.crossOrigin="Anonymous",f.src=e,f.onload=()=>{h.width=f.width,h.height=f.height,m.drawImage(f,0,0,h.width,h.height);let b=m.getImageData(0,0,h.width,h.height);o.height=h.height,o.width=h.width,d(rr(b.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(s!==void 0)return rr(s,o);throw new Error("Input data provided is not supported - aborted tensor creation")},Oi=(e,t)=>{let{width:r,height:i,download:a,dispose:n}=t,s=[1,i,r,4];return new Ve({location:"texture",type:"float32",texture:e,dims:s,download:a,dispose:n})},Ri=(e,t)=>{let{dataType:r,dims:i,download:a,dispose:n}=t;return new Ve({location:"gpu-buffer",type:r??"float32",gpuBuffer:e,dims:i,download:a,dispose:n})},Bi=(e,t)=>{let{dataType:r,dims:i,download:a,dispose:n}=t;return new Ve({location:"ml-tensor",type:r??"float32",mlTensor:e,dims:i,download:a,dispose:n})},Mi=(e,t,r)=>new Ve({location:"cpu-pinned",type:e,data:t,dims:r??[t.length]})}),vt,Ft,kr,Di,pn=k(()=>{"use strict";vt=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Ft=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),kr=!1,Di=()=>{if(!kr){kr=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,t=typeof BigUint64Array<"u"&&BigUint64Array.from,r=globalThis.Float16Array,i=typeof r<"u"&&r.from;e&&(vt.set("int64",BigInt64Array),Ft.set(BigInt64Array,"int64")),t&&(vt.set("uint64",BigUint64Array),Ft.set(BigUint64Array,"uint64")),i?(vt.set("float16",r),Ft.set(r,"float16")):vt.set("float16",Uint16Array)}}}),Pi,Ui,cn=k(()=>{"use strict";Ir(),Pi=e=>{let t=1;for(let r=0;r<e.length;r++){let i=e[r];if(typeof i!="number"||!Number.isSafeInteger(i))throw new TypeError(`dims[${r}] must be an integer, got: ${i}`);if(i<0)throw new RangeError(`dims[${r}] must be a non-negative integer, got: ${i}`);t*=i}return t},Ui=(e,t)=>{switch(e.location){case"cpu":return new Ve(e.type,e.data,t);case"cpu-pinned":return new Ve({location:"cpu-pinned",data:e.data,type:e.type,dims:t});case"texture":return new Ve({location:"texture",texture:e.texture,type:e.type,dims:t});case"gpu-buffer":return new Ve({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case"ml-tensor":return new Ve({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:t});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Ve,Ir=k(()=>{"use strict";ln(),dn(),pn(),cn(),Ve=class{constructor(e,t,r){Di();let i,a;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,i=e.type,a=e.dims,e.location){case"cpu-pinned":{let s=vt.get(i);if(!s)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(e.data instanceof s))throw new TypeError(`buffer should be of type ${s.name}`);this.cpuData=e.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let s,o;if(typeof e=="string")if(i=e,o=r,e==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");s=t}else{let u=vt.get(e);if(u===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e==="float16"&&u===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${u.name} as data.`);e==="uint64"||e==="int64"?s=u.from(t,BigInt):s=u.from(t)}else if(t instanceof u)s=t;else if(t instanceof Uint8ClampedArray)if(e==="uint8")s=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&t instanceof Uint16Array&&u!==Uint16Array)s=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${i} tensor's data must be type of ${u}`)}else if(o=t,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let u=typeof e[0];if(u==="string")i="string",s=e;else if(u==="boolean")i="bool",s=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${u}.`)}else if(e instanceof Uint8ClampedArray)i="uint8",s=Uint8Array.from(e);else{let u=Ft.get(e.constructor);if(u===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);i=u,s=e}if(o===void 0)o=[s.length];else if(!Array.isArray(o))throw new TypeError("A tensor's dims must be a number array");a=o,this.cpuData=s,this.dataLocation="cpu"}let n=Pi(a);if(this.cpuData&&n!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=a,this.size=n}static async fromImage(e,t){return Ai(e,t)}static fromTexture(e,t){return Oi(e,t)}static fromGpuBuffer(e,t){return Ri(e,t)}static fromMLTensor(e,t){return Bi(e,t)}static fromPinnedBuffer(e,t,r){return Mi(e,t,r)}toDataURL(e){return zi(this,e)}toImageData(e){return Ci(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Ui(this,e)}}}),Ye,Li=k(()=>{"use strict";Ir(),Ye=Ve}),Ni,hn=k(()=>{"use strict";ye(),Ii(),Li(),tr(),Ni=class Lc{constructor(t,r){this.handler=t,this.backend=r}async run(t,r,i){Ze(),Re("InferenceSession.run");let a={},n={};if(typeof t!="object"||t===null||t instanceof Ye||Array.isArray(t))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let s=!0;if(typeof r=="object"){if(r===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(r instanceof Ye)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(r)){if(r.length===0)throw new TypeError("'fetches' cannot be an empty array.");s=!1;for(let d of r){if(typeof d!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(d)===-1)throw new RangeError(`'fetches' contains invalid output name: ${d}.`);a[d]=null}if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else{let d=!1,c=Object.getOwnPropertyNames(r);for(let h of this.outputNames)if(c.indexOf(h)!==-1){let m=r[h];(m===null||m instanceof Ye)&&(d=!0,s=!1,a[h]=m)}if(d){if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else n=r}}else if(typeof r<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let d of this.inputNames)if(typeof t[d]>"u")throw new Error(`input '${d}' is missing in 'feeds'.`);if(s)for(let d of this.outputNames)a[d]=null;let o;if(n.activeLoraAdapters!==void 0){if(!Array.isArray(n.activeLoraAdapters))throw new TypeError("'activeLoraAdapters' must be an array.");o=n.activeLoraAdapters.map(d=>{if(!(d instanceof Kt))throw new TypeError("'activeLoraAdapters' must be an array of LoraAdapter objects.");if(d.backend!==this.backend)throw new Error("LoRA adapter was created by a different backend than the session.");return d.handler})}let u=await this.handler.run(t,a,n,o),l={};for(let d in u)if(Object.hasOwnProperty.call(u,d)){let c=u[d];c instanceof Ye?l[d]=c:l[d]=new Ye(c.type,c.data,c.dims)}return pt("InferenceSession.run"),He(),l}async release(){return this.handler.dispose()}static async create(t,r,i,a){Ze(),Re("InferenceSession.create");let n,s={};if(typeof t=="string"){if(n=t,typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof Uint8Array){if(n=t,typeof r=="object"&&r!==null)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){let d=t,c=0,h=t.byteLength;if(typeof r=="object"&&r!==null)s=r;else if(typeof r=="number"){if(c=r,!Number.isSafeInteger(c))throw new RangeError("'byteOffset' must be an integer.");if(c<0||c>=d.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${d.byteLength}).`);if(h=t.byteLength-c,typeof i=="number"){if(h=i,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||c+h>d.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${d.byteLength-c}].`);if(typeof a=="object"&&a!==null)s=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else if(typeof i<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof r<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(d,c,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[o,u]=await Xe(s),l=await o.createInferenceSessionHandler(n,u);return pt("InferenceSession.create"),He(),new Lc(l,o)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),zr,fn=k(()=>{"use strict";hn(),zr=Ni}),Cr,mn=k(()=>{"use strict";Ii(),Cr=Kt}),gn=k(()=>{"use strict"}),yn=k(()=>{"use strict"}),wn=k(()=>{"use strict"}),_n=k(()=>{"use strict"}),qi={};X(qi,{InferenceSession:()=>zr,LoraAdapter:()=>Cr,TRACE:()=>ht,TRACE_EVENT_BEGIN:()=>Re,TRACE_EVENT_END:()=>pt,TRACE_FUNC_BEGIN:()=>Ze,TRACE_FUNC_END:()=>He,Tensor:()=>Ye,env:()=>te,registerBackend:()=>H});var rt=k(()=>{"use strict";we(),er(),fn(),mn(),Li(),gn(),yn(),tr(),wn(),_n()}),Ar=k(()=>{"use strict"}),Fi={};X(Fi,{default:()=>Vi});var Or,Rr,Vi,bn=k(()=>{"use strict";ic(),Tt(),Ur(),Or="ort-wasm-proxy-worker",Rr=globalThis.self?.name===Or,Rr&&(self.onmessage=e=>{let{type:t,in:r}=e.data;try{switch(t){case"init-wasm":qr(r.wasm).then(()=>{gs(r).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})})},i=>{postMessage({type:t,err:i})});break;case"init-ep":{let{epName:i,env:a}=r;ys(a,i).then(()=>{postMessage({type:t})},n=>{postMessage({type:t,err:n})});break}case"copy-from":{let{buffer:i}=r,a=an(i);postMessage({type:t,out:a});break}case"create":{let{model:i,options:a}=r;_s(i,a).then(n=>{postMessage({type:t,out:n})},n=>{postMessage({type:t,err:n})});break}case"release":bs(r),postMessage({type:t});break;case"run":{let{sessionId:i,inputIndices:a,inputs:n,outputIndices:s,options:o}=r;vs(i,a,n,s,new Array(s.length).fill(null),o).then(u=>{u.some(l=>l[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:u},Ss([...n,...u]))},u=>{postMessage({type:t,err:u})});break}case"end-profiling":xs(r),postMessage({type:t});break;default:}}catch(i){postMessage({type:t,err:i})}}),Vi=Rr?null:e=>new Worker(e??Ge,{type:"classic",name:Or})}),Gi,Wi,Ge,Br,ir,ji,Hi,Mr,Ki,Dr,Zi,Pr,Qi,Ur=k(()=>{"use strict";Ar(),Gi=typeof location>"u"?void 0:location.origin,Wi=()=>typeof document<"u"?document.currentScript?.src:typeof self<"u"?self.location?.href:void 0,Ge=Wi(),Br=()=>{if(Ge&&!Ge.startsWith("blob:"))return Ge.substring(0,Ge.lastIndexOf("/")+1)},ir=(e,t)=>{try{let r=t??Ge;return(r?new URL(e,r):new URL(e)).origin===Gi}catch{return!1}},ji=(e,t)=>{let r=t??Ge;try{return(r?new URL(e,r):new URL(e)).href}catch{return}},Hi=(e,t)=>`${t??"./"}${e}`,Mr=async e=>{let t=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(t)},Ki=async e=>(await import(e)).default,Dr=(bn(),ke(Fi)).default,Zi=async()=>{if(!Ge)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ir(Ge))return[void 0,Dr()];let e=await Mr(Ge);return[e,Dr(e)]},Pr=void 0,Qi=async(e,t,r,i)=>{let a=Pr&&!(e||t);if(a)if(Ge)a=ir(Ge)||i&&!r;else if(i&&!r)a=!0;else throw new Error("cannot determine the script source URL.");if(a)return[void 0,Pr];{let n="ort-wasm-simd-threaded.jsep.mjs",s=e??ji(n,t),o=r&&s&&!ir(s,t),u=o?await Mr(s):s??Hi(n,t);return[o?u:void 0,await Ki(u)]}}}),Lr,ar,Vt,Nr,Xi,Yi,Ji,qr,ie,Tt=k(()=>{"use strict";Ur(),ar=!1,Vt=!1,Nr=!1,Xi=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},Yi=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Ji=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},qr=async e=>{if(ar)return Promise.resolve();if(Vt)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Nr)throw new Error("previous call to 'initializeWebAssembly()' failed.");Vt=!0;let t=e.initTimeout,r=e.numThreads;if(e.simd!==!1){if(e.simd==="relaxed"){if(!Ji())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!Yi())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let i=Xi();r>1&&!i&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+r+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=r=1);let a=e.wasmPaths,n=typeof a=="string"?a:void 0,s=a?.mjs,o=s?.href??s,u=a?.wasm,l=u?.href??u,d=e.wasmBinary,[c,h]=await Qi(o,n,r>1,!!d||!!l),m=!1,f=[];if(t>0&&f.push(new Promise(b=>{setTimeout(()=>{m=!0,b()},t)})),f.push(new Promise((b,x)=>{let _={numThreads:r};if(d)_.wasmBinary=d,_.locateFile=y=>y;else if(l||n)_.locateFile=y=>l??n+y;else if(o&&o.indexOf("blob:")!==0)_.locateFile=y=>new URL(y,o).href;else if(c){let y=Br();y&&(_.locateFile=S=>y+S)}h(_).then(y=>{Vt=!1,ar=!0,Lr=y,b(),c&&URL.revokeObjectURL(c)},y=>{Vt=!1,Nr=!0,x(y)})})),await Promise.race(f),m)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},ie=()=>{if(ar&&Lr)return Lr;throw new Error("WebAssembly is not initialized yet.")}}),Je,nr,Z,Fr=k(()=>{"use strict";Tt(),Je=(e,t)=>{let r=ie(),i=r.lengthBytesUTF8(e)+1,a=r._malloc(i);return r.stringToUTF8(e,a,i),t.push(a),a},nr=(e,t,r,i)=>{if(typeof e=="object"&&e!==null){if(r.has(e))throw new Error("Circular reference in options");r.add(e)}Object.entries(e).forEach(([a,n])=>{let s=t?t+a:a;if(typeof n=="object")nr(n,s+".",r,i);else if(typeof n=="string"||typeof n=="number")i(s,n.toString());else if(typeof n=="boolean")i(s,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},Z=e=>{let t=ie(),r=t.stackSave();try{let i=t.PTR_SIZE,a=t.stackAlloc(2*i);t._OrtGetLastError(a,a+i);let n=Number(t.getValue(a,i===4?"i32":"i64")),s=t.getValue(a+i,"*"),o=s?t.UTF8ToString(s):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(r)}}}),ea,$n=k(()=>{"use strict";Tt(),Fr(),ea=(e,t)=>{let r=ie(),i=0,a=[],n=e||{};try{if(e?.logSeverityLevel===void 0)n.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)n.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(n.terminate=!1);let s=0;e?.tag!==void 0&&(s=Je(e.tag,a)),i=r._OrtCreateRunOptions(n.logSeverityLevel,n.logVerbosityLevel,!!n.terminate,s),i===0&&Z("Can't create run options."),e?.extra!==void 0&&nr(e.extra,"",new WeakSet,(o,u)=>{let l=Je(o,a),d=Je(u,a);r._OrtAddRunConfigEntry(i,l,d)!==0&&Z(`Can't set a run config entry: ${o} - ${u}.`)});for(let o of t)r._OrtRunOptionsAddActiveLoraAdapter(i,o)!==0&&Z("Can't add an active LoRA adapter.");return[i,a]}catch(s){throw i!==0&&r._OrtReleaseRunOptions(i),a.forEach(o=>r._free(o)),s}}}),ta,ra,ia,xt,aa,na,vn=k(()=>{"use strict";Tt(),Fr(),ta=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"layout":return 3;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},ra=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},ia=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(r=>(typeof r=="string"?r:r.name)==="webgpu")&&(e.enableMemPattern=!1)},xt=(e,t,r,i)=>{let a=Je(t,i),n=Je(r,i);ie()._OrtAddSessionConfigEntry(e,a,n)!==0&&Z(`Can't set a session config entry: ${t} - ${r}.`)},aa=async(e,t,r)=>{let i=t.executionProviders;for(let a of i){let n=typeof a=="string"?a:a.name,s=[],o;switch(n){case"webnn":if(n="WEBNN",xt(e,"session.disable_quant_qdq","1",r),xt(e,"session.disable_qdq_constant_folding","1",r),typeof a!="string"){let h=a?.deviceType;h&&xt(e,"deviceType",h,r)}break;case"webgpu":if(n="JS",typeof a!="string"){let h=a;if(h?.preferredLayout){if(h.preferredLayout!=="NCHW"&&h.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${h.preferredLayout}`);xt(e,"preferredLayout",h.preferredLayout,r)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${n}`)}let u=s.length,l=0,d=0;if(u>0){l=ie()._malloc(u*ie().PTR_SIZE),r.push(l),d=ie()._malloc(u*ie().PTR_SIZE),r.push(d);for(let h=0;h<u;h++)ie().setValue(l+h*ie().PTR_SIZE,s[h][0],"*"),ie().setValue(d+h*ie().PTR_SIZE,s[h][1],"*")}let c;if(o===void 0){let h=Je(n,r);c=await ie()._OrtAppendExecutionProvider(e,h,l,d,u)}c!==0&&Z(`Can't append execution provider: ${n}.`)}},na=async e=>{let t=ie(),r=0,i=[],a=e||{};ia(a);try{let n=ta(a.graphOptimizationLevel??"all"),s=ra(a.executionMode??"sequential"),o=typeof a.logId=="string"?Je(a.logId,i):0,u=a.logSeverityLevel??2;if(!Number.isInteger(u)||u<0||u>4)throw new Error(`log severity level is not valid: ${u}`);let l=a.logVerbosityLevel??0;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log verbosity level is not valid: ${l}`);let d=typeof a.optimizedModelFilePath=="string"?Je(a.optimizedModelFilePath,i):0;if(r=t._OrtCreateSessionOptions(n,!!a.enableCpuMemArena,!!a.enableMemPattern,s,!!a.enableProfiling,0,o,u,l,d),r===0&&Z("Can't create session options."),a.executionProviders&&await aa(r,a,i),a.enableGraphCapture!==void 0){if(typeof a.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${a.enableGraphCapture}`);xt(r,"enableGraphCapture",a.enableGraphCapture.toString(),i)}if(a.freeDimensionOverrides)for(let[c,h]of Object.entries(a.freeDimensionOverrides)){if(typeof c!="string")throw new Error(`free dimension override name must be a string: ${c}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let m=Je(c,i);t._OrtAddFreeDimensionOverride(r,m,h)!==0&&Z(`Can't set a free dimension override: ${c} - ${h}.`)}return a.extra!==void 0&&nr(a.extra,"",new WeakSet,(c,h)=>{xt(r,c,h,i)}),[r,i]}catch(n){throw r!==0&&t._OrtReleaseSessionOptions(r)!==0&&Z("Can't release session options."),i.forEach(s=>t._free(s)),n}}}),Et,kt,It,Vr,Gr,Wr,jr,di,ae=k(()=>{"use strict";Et=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},kt=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},It=(e,t)=>{let r=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],i=typeof t=="number"?t:t.reduce((a,n)=>a*n,1);return r>0?Math.ceil(i*r):void 0},Vr=e=>{switch(e){case"float16":return typeof Float16Array<"u"?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},Gr=e=>{switch(e){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${e}`)}},Wr=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",jr=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",di=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),sr,Hr=k(()=>{"use strict";Ar(),sr=async e=>{if(typeof e=="string"){let t=await fetch(e);if(!t.ok)throw new Error(`failed to load external data file: ${e}`);let r=t.headers.get("Content-Length"),i=r?parseInt(r,10):0;if(i<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let a=t.body.getReader(),n;try{n=new ArrayBuffer(i)}catch(o){if(o instanceof RangeError){let u=Math.ceil(i/65536);n=new WebAssembly.Memory({initial:u,maximum:u}).buffer}else throw o}let s=0;for(;;){let{done:o,value:u}=await a.read();if(o)break;let l=u.byteLength;new Uint8Array(n,s,l).set(u),s+=l}return new Uint8Array(n,0,i)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),sa,pi,ci,Zt,hi,fi,Ae,At=k(()=>{"use strict";ae(),sa=["V","I","W","E","F"],pi=(e,t)=>{console.log(`[${sa[e]},${new Date().toISOString()}]${t}`)},hi=(e,t)=>{ci=e,Zt=t},fi=(e,t)=>{let r=Gr(e),i=Gr(ci);r>=i&&pi(r,typeof t=="function"?t():t)},Ae=(...e)=>{Zt&&fi(...e)}}),mi,Mt,R,Dt,oa,ua,gi,de=k(()=>{"use strict";mi=class{static calcMatMulShape(e,t){return e[1]!==t[0]?void 0:[e[0],t[1]]}},Mt=class{static calcShape(e,t,r=!1){let i=e.length,a=t.length;if(i===0)return t;if(a===0)return e;let n=Math.max(e.length,t.length),s=new Array(n);if(r){if(i<2||a<2)return;let o=mi.calcMatMulShape([e[i-2],e[i-1]],[t[a-2],t[a-1]]);if(o===void 0)return;[s[n-2],s[n-1]]=o}for(let o=r?3:1;o<=n;o++){let u=i-o<0?1:e[i-o],l=a-o<0?1:t[a-o];if(u!==l&&u>1&&l>1)return;let d=Math.max(u,l);if(u&&l)s[n-o]=Math.max(u,l);else{if(d>1)return;s[n-o]=0}}return s}static isValidBroadcast(e,t){let r=e.length,i=t.length;if(r>i)return!1;for(let a=1;a<=r;a++)if(e[r-a]!==1&&e[r-a]!==t[i-a])return!1;return!0}},R=class on{static size(t){return on.getSizeFromDimensionRange(t,0,t.length)}static convertShape(t,r=4){let i=t.length;if(i===0)return[];let a=new Array(i),n=i-1;for(;n>=0;){if(t[n]%r===0){a[n]=t[n]/r;break}if(r%t[n]!==0)throw new Error("cannot convert shape");a[n]=1,r/=t[n],n--}for(n--;n>=0;n--)a[n]=t[n];return a}static sizeFromDimension(t,r){if(r<0||r>t.length)throw new Error(`invalid dimension of ${r} for sizeFromDimension as Tensor has ${t.length} dimensions.`);return on.getSizeFromDimensionRange(t,r,t.length)}static sizeToDimension(t,r){if(r<0||r>t.length)throw new Error(`invalid dimension of ${r} for sizeToDimension as Tensor has ${t.length} dimensions.`);return on.getSizeFromDimensionRange(t,0,r)}static getSizeFromDimensionRange(t,r,i){let a=1;for(let n=r;n<i;n++){if(t[n]<0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains negative values in them.");a*=Number(t[n])}return a}static computeStrides(t){let r=t.length;if(r===0)return[];if(r===1)return[1];let i=new Array(r);i[r-1]=1,i[r-2]=t[r-1];for(let a=r-3;a>=0;--a)i[a]=i[a+1]*t[a+1];return i}static normalizeAxis(t,r){if(t<-r&&t>=r)throw new Error("unsupported axis for this operation.");return t<0?t+r:t}static normalizeAxes(t,r){return t.map(i=>this.normalizeAxis(i,r??t.length))}static sortBasedOnPerm(t,r){return r?r.map(i=>t[i]):t.slice().reverse()}static padShape(t,r){let i=t.length;return t.map((a,n)=>a+r[n]+r[n+i])}static areEqual(t,r){return t.length!==r.length?!1:t.every((i,a)=>i===r[a])}},Dt=class Er{static adjustPoolAttributes(t,r,i,a,n,s){if(!t&&i.length!==r.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(t)for(let o=0;o<r.length-2;o++)o>=i.length?i.push(r[o+2]):i[o]=r[o+2];for(let o=0;o<i.length;o++)if(o<a.length){if(a[o]<0)throw new Error("strides should be greater than or equal to 1")}else a.push(1);for(let o=0;o<i.length;o++)if(o<n.length){if(n[o]<0)throw new Error("dilations should be greater than or equal to 1")}else n.push(1);for(let o=0;o<i.length*2;o++)if(o<s.length){if(s[o]<0)throw new Error("pad should be greater than or equal to 1")}else s.push(0);for(let o=0;o<i.length;o++){if(i[o]<=0)throw new Error("kernel shapes need to be greater than 0");if(s[o]>=i[o]||s[o+i.length]>=i[o])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(t,r,i,a,n,s,o){if(o){if(n.length!==2*(t.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(r.length!==t.length-2)throw new Error("length of strides should be the length of data dimensions");if(a.length!==t.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let u=0;u<t.length-2;u++)Er.adjustPadAndReturnShape(t[u+(s?1:2)],r[u],i[u],a[u],n,u,u+t.length-2,o)}}static computePoolOutputShape(t,r,i,a,n,s,o,u=0){if(r.length<=0)throw new Error("input shape must be of size greater than 0");let l=[r[0],r[1]];return Er.computeShapeHelper(t,r,l,i,a,n,s,o,u),l}static computeConvOutputShape(t,r,i,a,n,s,o){if(t.length<=0||r.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");let u=[t[0],r[0]];return Er.computeShapeHelper(!1,t,u,i,a,n,s,o),u}static computeShapeHelper(t,r,i,a,n,s,o,u,l=0){if(t)for(let d=0;d<r.length-2;d++)i.push(1);else for(let d=0;d<r.length-2;d++)i.push(Er.adjustPadAndReturnShape(r[d+2],a[d],n[d],s[d],o,d,d+r.length-2,u,l))}static computeOutputSize(t,r,i,a,n){let s=Math.floor(t/r)+1;return n===1&&(s=Math.ceil(t/r)+1,(s-1)*r>=i+a&&(s-=1)),s}static adjustPadAndReturnShape(t,r,i,a,n,s,o,u,l=0){let d=i*(a-1)+1;if(u&&u!=="NOTSET")switch(u){case"VALID":return n[s]=0,n[o]=0,Er.computeOutputSize(t-d,r,t,0,l);case"SAME_LOWER":case"SAME_UPPER":if(i!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let c=(Math.floor((t+r-1)/r)-1)*r+a-t;return n[s]=Math.floor(u==="SAME_LOWER"?(c+1)/2:c/2),n[o]=c-n[s],Er.computeOutputSize(t+n[s]+n[o]-d,r,t,n[s],l)}default:throw new Error("Unsupported AutoPad type")}else return Er.computeOutputSize(t+n[s]+n[o]-d,r,t,n[s],l)}},oa=class{static getShapeOfGemmResult(e,t,r,i,a){if(e.length!==2||r.length!==2)throw new Error("shape need to be of size 2");let n,s,o;t?(n=e[1],s=e[0]):(n=e[0],s=e[1]);let u=-1;if(i?(o=r[0],u=1):(o=r[1],u=0),r[u]!==s)throw new Error("dimension mismatch");if(n<=0||o<=0||s<=0)throw new Error("invalid shape specified");if(a&&!Mt.isValidBroadcast(a,[n,o]))throw new Error("gemm: invalid bias shape for broadcast");return[n,o,s]}},ua=-34028234663852886e22,gi=34028234663852886e22}),Kr,yi=k(()=>{"use strict";ae(),Kr=(e,t)=>new(Vr(t))(e)}),wi,Ot,bt,or,ur,yr,wr,Zr,_r,Qt,Xt,La=k(()=>{"use strict";ae(),At(),wi=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Ot=(e,t)=>{if(t==="int32")return e;let r=wi.get(t);if(!r)throw new Error(`WebNN backend does not support data type: ${t}`);let i=r/8;if(e.byteLength%i!==0)throw new Error(`Invalid Uint8Array length - must be a multiple of ${i}.`);let a=e.byteLength/i,n=new(Vr(t))(e.buffer,e.byteOffset,a);switch(t){case"int64":case"uint64":{let s=new Int32Array(a);for(let o=0;o<a;o++){let u=n[o];if(u>2147483647n||u<-2147483648n)throw new Error("Can not convert int64 data to int32 - value out of range.");s[o]=Number(u)}return new Uint8Array(s.buffer)}case"int8":case"uint8":case"uint32":{if(t==="uint32"&&n.some(o=>o>2147483647))throw new Error("Can not convert uint32 data to int32 - value out of range.");let s=Int32Array.from(n,Number);return new Uint8Array(s.buffer)}default:throw new Error(`Unsupported data conversion from ${t} to 'int32'`)}},bt=(e,t)=>{if(t==="int32")return e;if(e.byteLength%4!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 4 (int32).");let r=e.byteLength/4,i=new Int32Array(e.buffer,e.byteOffset,r);switch(t){case"int64":{let a=BigInt64Array.from(i,BigInt);return new Uint8Array(a.buffer)}case"uint64":{if(i.some(n=>n<0))throw new Error("Can not convert int32 data to uin64 - negative value found.");let a=BigUint64Array.from(i,BigInt);return new Uint8Array(a.buffer)}case"int8":{if(i.some(n=>n<-128||n>127))throw new Error("Can not convert int32 data to int8 - value out of range.");let a=Int8Array.from(i,Number);return new Uint8Array(a.buffer)}case"uint8":{if(i.some(a=>a<0||a>255))throw new Error("Can not convert int32 data to uint8 - value out of range.");return Uint8Array.from(i,Number)}case"uint32":{if(i.some(n=>n<0))throw new Error("Can not convert int32 data to uint32 - negative value found.");let a=Uint32Array.from(i,Number);return new Uint8Array(a.buffer)}default:throw new Error(`Unsupported data conversion from 'int32' to ${t}`)}},or=1,ur=()=>or++,yr=new Map([["int8","int32"],["uint8","int32"],["uint32","int32"],["int64","int32"]]),wr=(e,t)=>{let r=wi.get(e);if(!r)throw new Error(`WebNN backend does not support data type: ${e}`);return t.length>0?Math.ceil(t.reduce((i,a)=>i*a)*r/8):0},Zr=class{constructor(e){this.isDataConverted=!1;let{sessionId:t,context:r,tensor:i,dataType:a,shape:n,fallbackDataType:s}=e;this.sessionId=t,this.mlContext=r,this.mlTensor=i,this.dataType=a,this.tensorShape=n,this.fallbackDataType=s}get tensor(){return this.mlTensor}get type(){return this.dataType}get fallbackType(){return this.fallbackDataType}get shape(){return this.tensorShape}get byteLength(){return wr(this.dataType,this.tensorShape)}destroy(){Ae("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e){if(this.fallbackDataType){let t=await this.mlContext.readTensor(this.mlTensor),r=bt(new Uint8Array(t),this.dataType);if(e){(e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).set(r);return}else return new Uint8Array(r).buffer}else return e?this.mlContext.readTensor(this.mlTensor,e):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,t,r){return this.mlContext===e&&this.dataType===t&&this.tensorShape.length===r.length&&this.tensorShape.every((i,a)=>i===r[a])}setIsDataConverted(e){this.isDataConverted=e}},_r=class{constructor(e,t){this.tensorManager=e,this.wrapper=t}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,t,r,i){let a=this.tensorManager.getMLContext(e),n=this.tensorManager.getMLOpSupportLimits(e),s;if(!n?.input.dataTypes.includes(t)){if(s=yr.get(t),!s||!n?.input.dataTypes.includes(s))throw new Error(`WebNN backend does not support data type: ${t}`);Ae("verbose",()=>`[WebNN] TensorIdTracker.ensureTensor: fallback dataType from ${t} to ${s}`)}if(this.wrapper){if(this.wrapper.canReuseTensor(a,t,r))return this.wrapper.tensor;if(i){if(this.wrapper.byteLength!==wr(t,r))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let o=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,t,r,o,!0,!0,s),i&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){let t=e;if(this.wrapper){if(this.wrapper.fallbackType)if(this.wrapper.fallbackType==="int32")t=Ot(e,this.wrapper.type),this.wrapper.setIsDataConverted(!0);else throw new Error(`Unsupported fallback data type: ${this.wrapper.fallbackType}`);if(e.byteLength===this.wrapper.byteLength){this.wrapper.write(t);return}else Ae("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor()}this.activeUpload?this.activeUpload.set(t):this.activeUpload=new Uint8Array(t)}async download(e){if(this.activeUpload){let t=this.wrapper?.isDataConverted?bt(this.activeUpload,this.wrapper?.type):this.activeUpload;if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(t):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(t);return}else return t.buffer}if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read(e):this.wrapper.read()}},Qt=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let t=this.backend.getMLContext(e);if(!t)throw new Error("MLContext not found for session.");return t}getMLOpSupportLimits(e){return this.backend.getMLOpSupportLimits(e)}reserveTensorId(){let e=ur();return this.tensorTrackersById.set(e,new _r(this)),e}releaseTensorId(e){let t=this.tensorTrackersById.get(e);t&&(this.tensorTrackersById.delete(e),t.tensorWrapper&&this.releaseTensor(t.tensorWrapper))}async ensureTensor(e,t,r,i,a){Ae("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${t}, dataType: ${r}, shape: ${i}, copyOld: ${a}}`);let n=this.tensorTrackersById.get(t);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,r,i,a)}upload(e,t){let r=this.tensorTrackersById.get(e);if(!r)throw new Error("Tensor not found.");r.upload(t)}async download(e,t){Ae("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${t?.byteLength}}`);let r=this.tensorTrackersById.get(e);if(!r)throw new Error("Tensor not found.");return r.download(t)}releaseTensorsForSession(e){for(let t of this.freeTensors)t.sessionId===e&&t.destroy();this.freeTensors=this.freeTensors.filter(t=>t.sessionId!==e)}registerTensor(e,t,r,i){let a=this.getMLContext(e),n=ur(),s=new Zr({sessionId:e,context:a,tensor:t,dataType:r,shape:i});return this.tensorTrackersById.set(n,new _r(this,s)),this.externalTensors.add(s),n}async getCachedTensor(e,t,r,i,a,n,s){let o=this.getMLContext(e);for(let[l,d]of this.freeTensors.entries())if(d.canReuseTensor(o,t,r)){Ae("verbose",()=>`[WebNN] Reusing tensor {dataType: ${t}, ${s?`fallbackDataType: ${s},`:""} shape: ${r}`);let c=this.freeTensors.splice(l,1)[0];return c.sessionId=e,c}Ae("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${t}, ${s?`fallbackDataType: ${s},`:""} shape: ${r}}`);let u=await o.createTensor({dataType:s??t,shape:r,dimensions:r,usage:i,writable:a,readable:n});return new Zr({sessionId:e,context:o,tensor:u,dataType:t,shape:r,fallbackDataType:s})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},Xt=(...e)=>new Qt(...e)}),br,la,da,Na=k(()=>{"use strict";ae(),Tt(),yi(),La(),At(),br=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),la=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0)return!1;let r=Object.keys(e).sort(),i=Object.keys(t).sort();return r.length===i.length&&r.every((a,n)=>a===i[n]&&e[a]===t[a])},da=class{constructor(e){this.tensorManager=Xt(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.sessionGraphOutputs=new Map,this.temporaryGraphInputs=[],this.temporaryGraphOutputs=[],this.temporarySessionTensorIds=new Map,this.mlOpSupportLimitsBySessionId=new Map,hi(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){Ae("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){Ae("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let t=this.temporarySessionTensorIds.get(e);if(t){for(let r of t)Ae("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${r}}`),this.tensorManager.releaseTensorId(r);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let r=this.mlContextCache.findIndex(i=>i.gpuDevice===e);if(r!==-1)return this.mlContextCache[r].mlContext;{let i=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:i}),i}}else if(e===void 0){let r=this.mlContextCache.findIndex(i=>i.options===void 0&&i.gpuDevice===void 0);if(r!==-1)return this.mlContextCache[r].mlContext;{let i=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:i}),i}}let t=this.mlContextCache.findIndex(r=>la(r.options,e));if(t!==-1)return this.mlContextCache[t].mlContext;{let r=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:r}),r}}registerMLContext(e,t){this.mlContextBySessionId.set(e,t);let r=this.sessionIdsByMLContext.get(t);r||(r=new Set,this.sessionIdsByMLContext.set(t,r)),r.add(e),this.mlOpSupportLimitsBySessionId.has(e)||this.mlOpSupportLimitsBySessionId.set(e,t.opSupportLimits()),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[]),this.temporaryGraphOutputs.length>0&&(this.sessionGraphOutputs.set(e,this.temporaryGraphOutputs),this.temporaryGraphOutputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e),this.sessionGraphOutputs.delete(e);let t=this.mlContextBySessionId.get(e);if(!t)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e),this.mlOpSupportLimitsBySessionId.delete(e);let r=this.sessionIdsByMLContext.get(t);if(r.delete(e),r.size===0){this.sessionIdsByMLContext.delete(t);let i=this.mlContextCache.findIndex(a=>a.mlContext===t);i!==-1&&this.mlContextCache.splice(i,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}getMLOpSupportLimits(e){return this.mlOpSupportLimitsBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){Ae("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,t,r,i,a){let n=br.get(r);if(!n)throw new Error(`Unsupported ONNX data type: ${r}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,t,n,i,a)}async createTemporaryTensor(e,t,r){Ae("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${t}, shape: ${r}}`);let i=br.get(t);if(!i)throw new Error(`Unsupported ONNX data type: ${t}`);let a=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,a,i,r,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(a):this.temporarySessionTensorIds.set(e,[a]),a}uploadTensor(e,t){if(!ie().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");Ae("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${t.byteLength}}`),this.tensorManager.upload(e,t)}async downloadTensor(e,t){return this.tensorManager.download(e,t)}createMLTensorDownloader(e,t){return async()=>{let r=await this.tensorManager.download(e);return Kr(r,t)}}registerMLTensor(e,t,r,i){let a=br.get(r);if(!a)throw new Error(`Unsupported ONNX data type: ${r}`);let n=this.tensorManager.registerTensor(e,t,a,i);return Ae("verbose",()=>`[WebNN] registerMLTensor {tensor: ${t}, dataType: ${a}, dimensions: ${i}} -> {tensorId: ${n}}`),n}registerGraphInput(e){this.temporaryGraphInputs.push(e)}registerGraphOutput(e){this.temporaryGraphOutputs.push(e)}isGraphInput(e,t){let r=this.sessionGraphInputs.get(e);return r?r.includes(t):!1}isGraphOutput(e,t){let r=this.sessionGraphOutputs.get(e);return r?r.includes(t):!1}isGraphInputOutputTypeSupported(e,t,r=!0){let i=br.get(Et(t)),a=this.mlOpSupportLimitsBySessionId.get(e);return typeof i>"u"?!1:r?!!a?.input.dataTypes.includes(i):!!a?.output.dataTypes.includes(i)}flush(){}}}),_i=k(()=>{"use strict"}),bi,Qr,Xr,pa,$i,Yr,vi,xi,ca,qa=k(()=>{"use strict";At(),_i(),bi=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),Qr=[],Xr=e=>Math.ceil(Number(e)/16)*16,pa=e=>{for(let t=0;t<Qr.length;t++){let r=Qr[t];if(e<=r)return r}return Math.ceil(e/16)*16},$i=1,Yr=()=>$i++,vi=async(e,t,r,i)=>{let a=Xr(r),n=e.device.createBuffer({size:a,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let s=e.getCommandEncoder();e.endComputePass(),s.copyBufferToBuffer(t,0,n,0,a),e.flush(),await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange();if(i){let u=i();return u.set(new Uint8Array(o,0,r)),u}else return new Uint8Array(o.slice(0,r))}finally{n.destroy()}},xi=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[t]of bi)Qr.push(t),this.freeBuffers.set(t,[]),this.freeUniformBuffers.set(t,[]);this.sessionCount=0}upload(e,t){let r=t.buffer,i=t.byteOffset,a=t.byteLength,n=Xr(a),s=this.storageCache.get(e);if(!s)throw new Error("gpu data for uploading does not exist");if(Number(s.originalSize)!==a)throw new Error(`inconsistent data size. gpu data size=${s.originalSize}, data size=${a}`);if(n===a&&i%4===0)this.backend.device.queue.writeBuffer(s.gpuData.buffer,0,r,i,a);else{let o=new Uint8Array(n);o.set(t),this.backend.device.queue.writeBuffer(s.gpuData.buffer,0,o,0,n)}Ae("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,t){let r=this.storageCache.get(e);if(!r)throw new Error("source gpu data for memcpy does not exist");let i=this.storageCache.get(t);if(!i)throw new Error("destination gpu data for memcpy does not exist");if(r.originalSize!==i.originalSize)throw new Error("inconsistent source and destination gpu data size");let a=Xr(r.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(r.gpuData.buffer,0,i.gpuData.buffer,0,a)}registerExternalBuffer(e,t,r){let i;if(r){if(i=r[0],e===r[1])return Ae("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${t}) => id=${i}, buffer is the same, skip.`),i;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet.
2
2
  Please use the previous external buffer!`)}else i=Yr();return this.storageCache.set(i,{gpuData:{id:i,type:0,buffer:e},originalSize:t}),Ae("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${t}) => id=${i}, registered.`),i}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),Ae("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,t=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let r=pa(e),i,a=(t&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,n=(t&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(a||n){let o=(a?this.freeBuffers:this.freeUniformBuffers).get(r);o?o.length>0?i=o.pop():i=this.backend.device.createBuffer({size:r,usage:t}):i=this.backend.device.createBuffer({size:r,usage:t})}else i=this.backend.device.createBuffer({size:r,usage:t});let s={id:Yr(),type:0,buffer:i};return this.storageCache.set(s.id,{gpuData:s,originalSize:Number(e)}),Ae("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${s.id}`),s}get(e){return this.storageCache.get(e)?.gpuData}release(e){let t=typeof e=="bigint"?Number(e):e,r=this.storageCache.get(t);if(!r){if(this.storageCache.size===0)return 0;throw new Error("releasing data does not exist")}return Ae("verbose",()=>`[WebGPU] GpuDataManager.release(id=${t}), gpuDataId=${r.gpuData.id}`),this.storageCache.delete(t),this.buffersPending.push(r.gpuData.buffer),r.originalSize}async download(e,t){let r=this.storageCache.get(Number(e));if(!r)throw new Error("data does not exist");await vi(this.backend,r.gpuData.buffer,r.originalSize,t)}refreshPendingBuffers(){if(this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let t=bi.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let r=this.freeBuffers.get(e.size)||[];t===void 0||r.length>=t?e.destroy():r.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let r=this.freeUniformBuffers.get(e.size)||[];t===void 0||r.length>=t?e.destroy():r.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let t of this.buffersPending)e.push(t);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(t=>{t.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(t=>{t.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(t=>{t.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onCreateSession(){this.sessionCount+=1}onReleaseSession(e){let t=this.capturedPendingBuffers.get(e);t&&(t.forEach(r=>{r.destroy()}),this.capturedPendingBuffers.delete(e)),this.sessionCount-=1,this.sessionCount===0&&(Ae("warning",()=>"[WebGPU] Clearing webgpu buffer cache"),this.storageCache.forEach(r=>{r.gpuData.buffer.destroy()}),this.storageCache=new Map)}},ca=(...e)=>new xi(...e)}),Fa,De,Ke=k(()=>{"use strict";Fa=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},De=e=>new Fa(e)}),lr,$r,et,it,J,We,ha,vr,p,g,v,w,$,O,D,z,A,B=k(()=>{"use strict";ae(),de(),lr=64,$r=(e,t)=>{if(t===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(Number(e)){case 10:return t>1?`vec${t}<f16>`:"f16";case 1:return t>1?`vec${t}<f32>`:"f32";case 6:return t>1?`vec${t}<i32>`:"i32";case 12:return t>1?`vec${t}<u32>`:"u32";case 7:if(t>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2<u32>","i32"];case 13:if(t>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2<u32>","u32"];case 9:if(t!==4)throw new Error("bool must be vec4");return["u32","vec4<bool>"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},et=(e,t=1)=>{let r=$r(e,t);return typeof r=="string"?r:r[0]},it=(e,t=1)=>{let r=$r(e,t);return typeof r=="string"?r:r[1]},J=(...e)=>{let t=[];return e.forEach(r=>{r.length!==0&&t.push({type:12,data:r},{type:12,data:R.computeStrides(r)})}),t},We=e=>e%4===0?4:e%2===0?2:1,ha=(e="f32",t,r="0")=>!t||t===1?`${e}(${r})`:`vec${t}<${e}>(${r})`,vr=(e,t,r)=>e==="f32"?r:t===1?`f32(${r})`:`vec${t}<f32>(${r})`,p=(e,t)=>t===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:t===2?`(${e}.x + ${e}.y)`:t===3?`(${e}.x + ${e}.y + ${e}.z)`:e,g=(e,t,r,i)=>e.startsWith("uniforms.")&&r>4?typeof t=="string"?i==="f16"?`${e}[(${t}) / 8][(${t}) % 8 / 4][(${t}) % 8 % 4]`:`${e}[(${t}) / 4][(${t}) % 4]`:i==="f16"?`${e}[${Math.floor(t/8)}][${Math.floor(t%8/4)}][${t%8%4}]`:`${e}[${Math.floor(t/4)}][${t%4}]`:r>1?`${e}[${t}]`:e,v=(e,t,r,i,a)=>{let n=typeof r=="number",s=n?r:r.length,o=[...new Array(s).keys()],u=s<2?"u32":s<=4?`vec${s}<u32>`:`array<u32, ${s}>`,l=$r(t,a),d=typeof l=="string"?l:l[1],c=typeof l=="string"?l:l[0],h={indices:u,value:d,storage:c,tensor:t},m=q=>typeof q=="string"?q:`${q}u`,f={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},b=n?"uniforms.":"",x=`${b}${e}_shape`,_=`${b}${e}_strides`,y="";for(let q=0;q<s-1;q++)y+=`
3
3
  let dim${q} = current / ${g(_,q,s)};
4
4
  let rest${q} = current % ${g(_,q,s)};
@@ -1 +1 @@
1
- import{r as g,g4 as ke,bl as W,cB as _,j as c,bn as le,g5 as je,f4 as oe,J as F,bq as ye,g6 as Be,g7 as Ne,g8 as we,g9 as We,ga as Y,bp as re,bw as z,v as ce,gb as Me,bk as ie,gc as ae,gd as Re,bs as Se,y as $e}from"../datalayer-app-main.js";const de=g.createContext({theme:{},setChildrenWidth:()=>null,setNoIconChildrenWidth:()=>null,loadingCounters:!1,iconsVisible:!0}),_e=i=>({display:"inline-block",borderLeft:"1px solid",width:"1px",borderLeftColor:`${i?.colors.border.muted}`,marginRight:1,height:"24px"}),Ae={margin:0,border:0,background:"transparent",fontWeight:"normal",boxShadow:"none",paddingY:1,paddingX:2,'& > span[data-component="trailingVisual"]':{marginLeft:0}},Le={"& > span":{display:"none"},textDecoration:"none"},ue=192,ee={position:"absolute",zIndex:1,top:"90%",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",borderRadius:"12px",backgroundColor:"canvas.overlay",listStyle:"none",minWidth:`${ue}px`,maxWidth:"640px",right:"0"},Pe=(i,t)=>{if(i&&t){const{left:e}=ke(i,t,{align:"start",side:"outside-bottom"}),{right:n,...s}=ee;return{...s,left:e}}return ee};var G={UnderlineWrapper:"prc-components-UnderlineWrapper-oOh5J",UnderlineItemList:"prc-components-UnderlineItemList-b23Hf",UnderlineItem:"prc-components-UnderlineItem-lJsg-",LoadingCounter:"prc-components-LoadingCounter-Ps-0Q"};const Oe=8,Ue=g.forwardRef((i,t)=>{const e=W.c(11);let n,s,l;e[0]!==i?({children:n,className:s,...l}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l):(n=e[1],s=e[2],l=e[3]);let o;e[4]!==s?(o=_(G.UnderlineWrapper,s),e[4]=s,e[5]=o):o=e[5];let r;return e[6]!==n||e[7]!==t||e[8]!==l||e[9]!==o?(r=c.jsx(le,{className:o,ref:t,...l,children:n}),e[6]=n,e[7]=t,e[8]=l,e[9]=o,e[10]=r):r=e[10],r}),Ve=g.forwardRef((i,t)=>{const e=W.c(7);let n,s;e[0]!==i?({children:n,...s}=i,e[0]=i,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let l;return e[3]!==n||e[4]!==t||e[5]!==s?(l=c.jsx("ul",{className:G.UnderlineItemList,ref:t,...s,children:n}),e[3]=n,e[4]=t,e[5]=s,e[6]=l):l=e[6],l}),fe=()=>{const i=W.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx("span",{className:G.LoadingCounter}),i[0]=t):t=i[0],t},Ee=g.forwardRef((i,t)=>{const e=W.c(27);let n,s,l,o,r,a,u,p;e[0]!==i?({as:p,children:s,counter:o,icon:n,iconsVisible:r,loadingCounters:a,className:l,...u}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l,e[4]=o,e[5]=r,e[6]=a,e[7]=u,e[8]=p):(n=e[1],s=e[2],l=e[3],o=e[4],r=e[5],a=e[6],u=e[7],p=e[8]);const x=p===void 0?"a":p;let I;e[9]!==l?(I=_(G.UnderlineItem,l),e[9]=l,e[10]=I):I=e[10];let m;e[11]!==n||e[12]!==r?(m=r&&n&&c.jsx("span",{"data-component":"icon",children:je.isElement(n)?n:c.jsx(n,{})}),e[11]=n,e[12]=r,e[13]=m):m=e[13];let b;e[14]!==s?(b=s&&c.jsx("span",{"data-component":"text","data-content":s,children:s}),e[14]=s,e[15]=b):b=e[15];let C;e[16]!==o||e[17]!==a?(C=o!==void 0?a?c.jsx("span",{"data-component":"counter",children:c.jsx(fe,{})}):c.jsx("span",{"data-component":"counter",children:c.jsx(oe,{children:o})}):null,e[16]=o,e[17]=a,e[18]=C):C=e[18];let h;return e[19]!==x||e[20]!==t||e[21]!==u||e[22]!==I||e[23]!==m||e[24]!==b||e[25]!==C?(h=c.jsxs(le,{ref:t,as:x,className:I,...u,children:[m,b,C]}),e[19]=x,e[20]=t,e[21]=u,e[22]=I,e[23]=m,e[24]=b,e[25]=C,e[26]=h):h=e[26],h}),Te=86,De=45;ae.ul.withConfig({displayName:"UnderlineNav__NavigationList",componentId:"sc-1jfr31k-0"})(["",";"],Re);const He=ae.li.withConfig({displayName:"UnderlineNav__MoreMenuListItem",componentId:"sc-1jfr31k-1"})(["display:flex;align-items:center;height:","px;"],De),ze=(i,t,e,n,s,l)=>{let o=!0;n.length===0&&l({items:e,menuItems:[]},o);const r=Z(n,i),a=Z(s,i),u=Z(s,i,t||Te),p=[],x=[];if(e.length<=r)p.push(...e);else if(e.length<=a)o=!1,p.push(...e);else{o=!1;const m=e.length-u===1?u-1:u;for(const[b,C]of e.entries())if(b<m)p.push(C);else{const h=C.props["aria-current"];if(!!h&&h!=="false"&&m>0){const j=m-1,B=p.splice(j,1,C)[0];x.push(B)}else x.push(C)}}l({items:p,menuItems:x},o)},Fe=i=>F.Children.toArray(i).filter(t=>F.isValidElement(t)),Z=(i,t,e=0)=>{const n=t-e;let s=i.length,l=0;for(const[o,r]of i.entries())if(l=l+r.width+Oe,l>n){s=o;break}else continue;return s},me=g.forwardRef(({as:i="nav","aria-label":t,sx:e=re,loadingCounters:n=!1,variant:s="inset",className:l,children:o},r)=>{var a;const u=g.useRef(null),p=r??u,x=g.useRef(null),I=g.useRef(null),m=g.useRef(null),b=F.useRef(null),C=ye(),{theme:h}=Be(),[k,j]=g.useState(!1),[B,T]=g.useState(!0),[P,O]=g.useState([]),[A,D]=g.useState([]),R=Fe(o),[w,U]=g.useState({items:R,menuItems:[]}),V=w.items.map(d=>{var f;return(f=R.find(v=>v.key===d.key))!==null&&f!==void 0?f:d}),y=w.menuItems.map(d=>{var f;return(f=R.find(v=>v.key===d.key))!==null&&f!==void 0?f:d}),S=w.items.length===0;function J(d){var f,v;return(f=(v=A.find(N=>N.text===d))===null||v===void 0?void 0:v.width)!==null&&f!==void 0?f:0}const H=(d,f,v,N)=>{var M,$;const Q=J(d.props.children),E=p.current.getBoundingClientRect().width-((M=($=x.current)===null||$===void 0?void 0:$.getBoundingClientRect().width)!==null&&M!==void 0?M:0),Ce=X(Q,E),ne=w.items.length-1-Ce,ve=[...[...w.items].slice(0,ne),d],Ie=[...w.items].slice(ne),se=[...y];se.splice(f,1,...Ie),N({items:ve,menuItems:se},!1)};function X(d,f){let v=0,N=0;for(const[M,$]of[...w.items].reverse().entries())if(v+=J($.props.children),d<v+f){N=M;break}return N}const q=g.useCallback((d,f)=>{U(d),T(f)},[]),xe=g.useCallback(d=>{O(f=>[...f,d])},[]),ge=g.useCallback(d=>{D(f=>[...f,d])},[]),K=F.useCallback(()=>{j(!1)},[j]),te=F.useCallback(()=>{var d;(d=m.current)===null||d===void 0||d.focus()},[]),be=g.useCallback(d=>{d.defaultPrevented||d.button!==0||j(f=>!f)},[]);return Ne(d=>{k&&(d.preventDefault(),K(),te())},[k]),we({onClickOutside:K,containerRef:b,ignoreClickRefs:[m]}),We(d=>{var f,v;const N=d[0].contentRect.width,M=(f=(v=I.current)===null||v===void 0?void 0:v.getBoundingClientRect().width)!==null&&f!==void 0?f:0;N!==0&&ze(N,M,R,P,A,q)},p),c.jsxs(de.Provider,{value:{theme:h,setChildrenWidth:xe,setNoIconChildrenWidth:ge,loadingCounters:n,iconsVisible:B},children:[t&&c.jsx(Y,{as:"h2",children:`${t} navigation`}),c.jsx(Ue,{as:i,"aria-label":t,className:l,ref:p,sx:e,"data-variant":s,children:c.jsxs(Ve,{ref:x,role:"list",children:[V,y.length>0&&c.jsxs(He,{ref:I,children:[!S&&c.jsx(z,{sx:_e(h)}),c.jsx(ce,{ref:m,sx:Ae,"aria-controls":C,"aria-expanded":k,onClick:be,trailingAction:Me,children:c.jsx(z,{as:"span",children:S?c.jsxs(c.Fragment,{children:[c.jsxs(Y,{as:"span",children:[`${t}`," "]}),"Menu"]}):c.jsxs(c.Fragment,{children:["More",c.jsxs(Y,{as:"span",children:[" ",`${t} items`]})]})})}),c.jsx(ie,{selectionVariant:"single",ref:b,id:C,sx:(a=x.current)!==null&&a!==void 0&&a.clientWidth&&x.current.clientWidth>=ue?ee:Pe(b.current,x.current),style:{display:k?"block":"none"},children:y.map((d,f)=>{const{children:v,counter:N,"aria-current":M,onSelect:$,...Q}=d.props;if(M&&M!=="false"){const E=new MouseEvent("click");!S&&H(d,f,E,q)}return c.jsx(ie.LinkItem,{sx:Le,onClick:E=>{!S&&H(d,f,E,q),K(),te(),typeof $=="function"&&$(E)},...Q,children:c.jsxs(z,{as:"span",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[v,n?c.jsx(fe,{}):N!==void 0&&c.jsx(z,{as:"span","data-component":"counter",children:c.jsx(oe,{children:N})})]})},v)})})]})]})})]})});me.displayName="UnderlineNav";const he=g.forwardRef((i,t)=>{const e=W.c(34);let n,s,l,o,r,a,u,p,x;e[0]!==i?({sx:u,as:p,href:x,children:l,counter:o,onSelect:r,"aria-current":s,icon:n,...a}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l,e[4]=o,e[5]=r,e[6]=a,e[7]=u,e[8]=p,e[9]=x):(n=e[1],s=e[2],l=e[3],o=e[4],r=e[5],a=e[6],u=e[7],p=e[8],x=e[9]);const I=u===void 0?re:u,m=p===void 0?"a":p,b=x===void 0?"#":x,C=g.useRef(null),h=t??C,{setChildrenWidth:k,setNoIconChildrenWidth:j,loadingCounters:B,iconsVisible:T}=g.useContext(de);let P,O;e[10]!==h||e[11]!==k||e[12]!==j?(P=()=>{if(h.current){const y=h.current.getBoundingClientRect(),S=Array.from(h.current.children).find(Ge),H=Array.from(h.current.children).find(Je).textContent,X=S?S.getBoundingClientRect().width+Number(getComputedStyle(S).marginRight.slice(0,-2))+Number(getComputedStyle(S).marginLeft.slice(0,-2)):0;k({text:H,width:y.width}),j({text:H,width:y.width-X})}},O=[h,k,j],e[10]=h,e[11]=k,e[12]=j,e[13]=P,e[14]=O):(P=e[13],O=e[14]),Se(P,O);let A;e[15]!==r?(A=y=>{(y.key===" "||y.key==="Enter")&&!y.defaultPrevented&&typeof r=="function"&&r(y)},e[15]=r,e[16]=A):A=e[16];const D=A;let R;e[17]!==r?(R=y=>{!y.defaultPrevented&&typeof r=="function"&&r(y)},e[17]=r,e[18]=R):R=e[18];const w=R;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U={display:"flex",flexDirection:"column",alignItems:"center"},e[19]=U):U=e[19];let V;return e[20]!==m||e[21]!==n||e[22]!==s||e[23]!==l||e[24]!==w||e[25]!==o||e[26]!==b||e[27]!==T||e[28]!==D||e[29]!==B||e[30]!==a||e[31]!==h||e[32]!==I?(V=c.jsx(z,{as:"li",sx:U,children:c.jsx(Ee,{ref:h,as:m,href:b,"aria-current":s,onKeyDown:D,onClick:w,counter:o,icon:n,loadingCounters:B,iconsVisible:T,sx:I,...a,children:l})}),e[20]=m,e[21]=n,e[22]=s,e[23]=l,e[24]=w,e[25]=o,e[26]=b,e[27]=T,e[28]=D,e[29]=B,e[30]=a,e[31]=h,e[32]=I,e[33]=V):V=e[33],V});he.displayName="UnderlineNavItem";function Ge(i){return i.getAttribute("data-component")==="icon"}function Je(i){return i.getAttribute("data-component")==="text"}const it=Object.assign(me,{Item:he}),pe=g.createContext(null);function Xe(){const i=g.useContext(pe);if(!i)throw new Error("useBlankslate must be used within a BlankslateProvider");return i}const qe=pe.Provider;var L={Container:"prc-Blankslate-Container-XATLP",Blankslate:"prc-Blankslate-Blankslate-7GPW-",Description:"prc-Blankslate-Description-OGHRk",Heading:"prc-Blankslate-Heading-H4xby",Visual:"prc-Blankslate-Visual-PeTD-",Action:"prc-Blankslate-Action-SK5XS"};function Ke(i){const t=W.c(25);let e,n,s,l,o,r,a;t[0]!==i?({border:e,children:n,narrow:l,spacious:r,className:s,size:a,...o}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s,t[4]=l,t[5]=o,t[6]=r,t[7]=a):(e=t[1],n=t[2],s=t[3],l=t[4],o=t[5],r=t[6],a=t[7]);const u=a===void 0?"medium":a;let p,x;t[8]!==u?(x={size:u},t[8]=u,t[9]=x):x=t[9],p=x;const I=p;let m;t[10]!==s?(m=_(L.Blankslate,s),t[10]=s,t[11]=m):m=t[11];const b=e?"":void 0,C=l?"":void 0,h=r?"":void 0;let k;t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==b||t[16]!==C||t[17]!==h?(k=c.jsx("div",{className:m,"data-border":b,"data-narrow":C,"data-spacious":h,"data-size":u,children:n}),t[12]=n,t[13]=u,t[14]=m,t[15]=b,t[16]=C,t[17]=h,t[18]=k):k=t[18];let j;t[19]!==o||t[20]!==k?(j=c.jsx("div",{...o,className:L.Container,children:k}),t[19]=o,t[20]=k,t[21]=j):j=t[21];let B;return t[22]!==j||t[23]!==I?(B=c.jsx(qe,{value:I,children:j}),t[22]=j,t[23]=I,t[24]=B):B=t[24],B}function Qe(i){const t=W.c(10);let e,n,s;t[0]!==i?({children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);let l;t[4]!==n?(l=_("Blankslate-Visual",L.Visual,n),t[4]=n,t[5]=l):l=t[5];let o;return t[6]!==e||t[7]!==s||t[8]!==l?(o=c.jsx("span",{...s,className:l,children:e}),t[6]=e,t[7]=s,t[8]=l,t[9]=o):o=t[9],o}function Ye(i){const t=W.c(12);let e,n,s,l;t[0]!==i?({as:l,children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s,t[4]=l):(e=t[1],n=t[2],s=t[3],l=t[4]);const o=l===void 0?"h2":l;let r;t[5]!==n?(r=_("Blankslate-Heading",L.Heading,n),t[5]=n,t[6]=r):r=t[6];let a;return t[7]!==o||t[8]!==e||t[9]!==s||t[10]!==r?(a=c.jsx(o,{...s,className:r,children:e}),t[7]=o,t[8]=e,t[9]=s,t[10]=r,t[11]=a):a=t[11],a}function Ze(i){const t=W.c(10);let e,n,s;t[0]!==i?({children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);let l;t[4]!==n?(l=_("Blankslate-Description",L.Description,n),t[4]=n,t[5]=l):l=t[5];let o;return t[6]!==e||t[7]!==s||t[8]!==l?(o=c.jsx("p",{...s,className:l,children:e}),t[6]=e,t[7]=s,t[8]=l,t[9]=o):o=t[9],o}function et(i){const t=W.c(11);let e,n,s;t[0]!==i?({children:e,href:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);const{size:l}=Xe();let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=_("Blankslate-Action",L.Action),t[4]=o):o=t[4];const r=n?"a":"button",a=l==="small"?"small":void 0;let u;return t[5]!==e||t[6]!==n||t[7]!==s||t[8]!==r||t[9]!==a?(u=c.jsx("div",{className:o,children:c.jsx(ce,{...s,as:r,href:n,variant:"primary",size:a,children:e})}),t[5]=e,t[6]=n,t[7]=s,t[8]=r,t[9]=a,t[10]=u):u=t[10],u}function tt(i){const t=W.c(4),{children:e,href:n}=i;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=_("Blankslate-Action",L.Action),t[0]=s):s=t[0];let l;return t[1]!==e||t[2]!==n?(l=c.jsx("div",{className:s,children:c.jsx($e,{href:n,children:e})}),t[1]=e,t[2]=n,t[3]=l):l=t[3],l}const lt=Object.assign(Ke,{Visual:Qe,Heading:Ye,Description:Ze,PrimaryAction:et,SecondaryAction:tt});export{lt as B,it as U};
1
+ import{r as g,g6 as ke,bl as W,cB as _,j as c,bn as le,g7 as je,f6 as oe,J as F,bq as ye,g8 as Be,g9 as Ne,ga as we,gb as We,gc as Y,bp as re,bw as z,v as ce,gd as Me,bk as ie,ge as ae,gf as Re,bs as Se,y as $e}from"../datalayer-app-main.js";const de=g.createContext({theme:{},setChildrenWidth:()=>null,setNoIconChildrenWidth:()=>null,loadingCounters:!1,iconsVisible:!0}),_e=i=>({display:"inline-block",borderLeft:"1px solid",width:"1px",borderLeftColor:`${i?.colors.border.muted}`,marginRight:1,height:"24px"}),Ae={margin:0,border:0,background:"transparent",fontWeight:"normal",boxShadow:"none",paddingY:1,paddingX:2,'& > span[data-component="trailingVisual"]':{marginLeft:0}},Le={"& > span":{display:"none"},textDecoration:"none"},ue=192,ee={position:"absolute",zIndex:1,top:"90%",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",borderRadius:"12px",backgroundColor:"canvas.overlay",listStyle:"none",minWidth:`${ue}px`,maxWidth:"640px",right:"0"},Pe=(i,t)=>{if(i&&t){const{left:e}=ke(i,t,{align:"start",side:"outside-bottom"}),{right:n,...s}=ee;return{...s,left:e}}return ee};var G={UnderlineWrapper:"prc-components-UnderlineWrapper-oOh5J",UnderlineItemList:"prc-components-UnderlineItemList-b23Hf",UnderlineItem:"prc-components-UnderlineItem-lJsg-",LoadingCounter:"prc-components-LoadingCounter-Ps-0Q"};const Oe=8,Ue=g.forwardRef((i,t)=>{const e=W.c(11);let n,s,l;e[0]!==i?({children:n,className:s,...l}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l):(n=e[1],s=e[2],l=e[3]);let o;e[4]!==s?(o=_(G.UnderlineWrapper,s),e[4]=s,e[5]=o):o=e[5];let r;return e[6]!==n||e[7]!==t||e[8]!==l||e[9]!==o?(r=c.jsx(le,{className:o,ref:t,...l,children:n}),e[6]=n,e[7]=t,e[8]=l,e[9]=o,e[10]=r):r=e[10],r}),Ve=g.forwardRef((i,t)=>{const e=W.c(7);let n,s;e[0]!==i?({children:n,...s}=i,e[0]=i,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let l;return e[3]!==n||e[4]!==t||e[5]!==s?(l=c.jsx("ul",{className:G.UnderlineItemList,ref:t,...s,children:n}),e[3]=n,e[4]=t,e[5]=s,e[6]=l):l=e[6],l}),fe=()=>{const i=W.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx("span",{className:G.LoadingCounter}),i[0]=t):t=i[0],t},Ee=g.forwardRef((i,t)=>{const e=W.c(27);let n,s,l,o,r,a,u,p;e[0]!==i?({as:p,children:s,counter:o,icon:n,iconsVisible:r,loadingCounters:a,className:l,...u}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l,e[4]=o,e[5]=r,e[6]=a,e[7]=u,e[8]=p):(n=e[1],s=e[2],l=e[3],o=e[4],r=e[5],a=e[6],u=e[7],p=e[8]);const x=p===void 0?"a":p;let I;e[9]!==l?(I=_(G.UnderlineItem,l),e[9]=l,e[10]=I):I=e[10];let m;e[11]!==n||e[12]!==r?(m=r&&n&&c.jsx("span",{"data-component":"icon",children:je.isElement(n)?n:c.jsx(n,{})}),e[11]=n,e[12]=r,e[13]=m):m=e[13];let b;e[14]!==s?(b=s&&c.jsx("span",{"data-component":"text","data-content":s,children:s}),e[14]=s,e[15]=b):b=e[15];let C;e[16]!==o||e[17]!==a?(C=o!==void 0?a?c.jsx("span",{"data-component":"counter",children:c.jsx(fe,{})}):c.jsx("span",{"data-component":"counter",children:c.jsx(oe,{children:o})}):null,e[16]=o,e[17]=a,e[18]=C):C=e[18];let h;return e[19]!==x||e[20]!==t||e[21]!==u||e[22]!==I||e[23]!==m||e[24]!==b||e[25]!==C?(h=c.jsxs(le,{ref:t,as:x,className:I,...u,children:[m,b,C]}),e[19]=x,e[20]=t,e[21]=u,e[22]=I,e[23]=m,e[24]=b,e[25]=C,e[26]=h):h=e[26],h}),Te=86,De=45;ae.ul.withConfig({displayName:"UnderlineNav__NavigationList",componentId:"sc-1jfr31k-0"})(["",";"],Re);const He=ae.li.withConfig({displayName:"UnderlineNav__MoreMenuListItem",componentId:"sc-1jfr31k-1"})(["display:flex;align-items:center;height:","px;"],De),ze=(i,t,e,n,s,l)=>{let o=!0;n.length===0&&l({items:e,menuItems:[]},o);const r=Z(n,i),a=Z(s,i),u=Z(s,i,t||Te),p=[],x=[];if(e.length<=r)p.push(...e);else if(e.length<=a)o=!1,p.push(...e);else{o=!1;const m=e.length-u===1?u-1:u;for(const[b,C]of e.entries())if(b<m)p.push(C);else{const h=C.props["aria-current"];if(!!h&&h!=="false"&&m>0){const j=m-1,B=p.splice(j,1,C)[0];x.push(B)}else x.push(C)}}l({items:p,menuItems:x},o)},Fe=i=>F.Children.toArray(i).filter(t=>F.isValidElement(t)),Z=(i,t,e=0)=>{const n=t-e;let s=i.length,l=0;for(const[o,r]of i.entries())if(l=l+r.width+Oe,l>n){s=o;break}else continue;return s},me=g.forwardRef(({as:i="nav","aria-label":t,sx:e=re,loadingCounters:n=!1,variant:s="inset",className:l,children:o},r)=>{var a;const u=g.useRef(null),p=r??u,x=g.useRef(null),I=g.useRef(null),m=g.useRef(null),b=F.useRef(null),C=ye(),{theme:h}=Be(),[k,j]=g.useState(!1),[B,T]=g.useState(!0),[P,O]=g.useState([]),[A,D]=g.useState([]),R=Fe(o),[w,U]=g.useState({items:R,menuItems:[]}),V=w.items.map(d=>{var f;return(f=R.find(v=>v.key===d.key))!==null&&f!==void 0?f:d}),y=w.menuItems.map(d=>{var f;return(f=R.find(v=>v.key===d.key))!==null&&f!==void 0?f:d}),S=w.items.length===0;function J(d){var f,v;return(f=(v=A.find(N=>N.text===d))===null||v===void 0?void 0:v.width)!==null&&f!==void 0?f:0}const H=(d,f,v,N)=>{var M,$;const Q=J(d.props.children),E=p.current.getBoundingClientRect().width-((M=($=x.current)===null||$===void 0?void 0:$.getBoundingClientRect().width)!==null&&M!==void 0?M:0),Ce=X(Q,E),ne=w.items.length-1-Ce,ve=[...[...w.items].slice(0,ne),d],Ie=[...w.items].slice(ne),se=[...y];se.splice(f,1,...Ie),N({items:ve,menuItems:se},!1)};function X(d,f){let v=0,N=0;for(const[M,$]of[...w.items].reverse().entries())if(v+=J($.props.children),d<v+f){N=M;break}return N}const q=g.useCallback((d,f)=>{U(d),T(f)},[]),xe=g.useCallback(d=>{O(f=>[...f,d])},[]),ge=g.useCallback(d=>{D(f=>[...f,d])},[]),K=F.useCallback(()=>{j(!1)},[j]),te=F.useCallback(()=>{var d;(d=m.current)===null||d===void 0||d.focus()},[]),be=g.useCallback(d=>{d.defaultPrevented||d.button!==0||j(f=>!f)},[]);return Ne(d=>{k&&(d.preventDefault(),K(),te())},[k]),we({onClickOutside:K,containerRef:b,ignoreClickRefs:[m]}),We(d=>{var f,v;const N=d[0].contentRect.width,M=(f=(v=I.current)===null||v===void 0?void 0:v.getBoundingClientRect().width)!==null&&f!==void 0?f:0;N!==0&&ze(N,M,R,P,A,q)},p),c.jsxs(de.Provider,{value:{theme:h,setChildrenWidth:xe,setNoIconChildrenWidth:ge,loadingCounters:n,iconsVisible:B},children:[t&&c.jsx(Y,{as:"h2",children:`${t} navigation`}),c.jsx(Ue,{as:i,"aria-label":t,className:l,ref:p,sx:e,"data-variant":s,children:c.jsxs(Ve,{ref:x,role:"list",children:[V,y.length>0&&c.jsxs(He,{ref:I,children:[!S&&c.jsx(z,{sx:_e(h)}),c.jsx(ce,{ref:m,sx:Ae,"aria-controls":C,"aria-expanded":k,onClick:be,trailingAction:Me,children:c.jsx(z,{as:"span",children:S?c.jsxs(c.Fragment,{children:[c.jsxs(Y,{as:"span",children:[`${t}`," "]}),"Menu"]}):c.jsxs(c.Fragment,{children:["More",c.jsxs(Y,{as:"span",children:[" ",`${t} items`]})]})})}),c.jsx(ie,{selectionVariant:"single",ref:b,id:C,sx:(a=x.current)!==null&&a!==void 0&&a.clientWidth&&x.current.clientWidth>=ue?ee:Pe(b.current,x.current),style:{display:k?"block":"none"},children:y.map((d,f)=>{const{children:v,counter:N,"aria-current":M,onSelect:$,...Q}=d.props;if(M&&M!=="false"){const E=new MouseEvent("click");!S&&H(d,f,E,q)}return c.jsx(ie.LinkItem,{sx:Le,onClick:E=>{!S&&H(d,f,E,q),K(),te(),typeof $=="function"&&$(E)},...Q,children:c.jsxs(z,{as:"span",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[v,n?c.jsx(fe,{}):N!==void 0&&c.jsx(z,{as:"span","data-component":"counter",children:c.jsx(oe,{children:N})})]})},v)})})]})]})})]})});me.displayName="UnderlineNav";const he=g.forwardRef((i,t)=>{const e=W.c(34);let n,s,l,o,r,a,u,p,x;e[0]!==i?({sx:u,as:p,href:x,children:l,counter:o,onSelect:r,"aria-current":s,icon:n,...a}=i,e[0]=i,e[1]=n,e[2]=s,e[3]=l,e[4]=o,e[5]=r,e[6]=a,e[7]=u,e[8]=p,e[9]=x):(n=e[1],s=e[2],l=e[3],o=e[4],r=e[5],a=e[6],u=e[7],p=e[8],x=e[9]);const I=u===void 0?re:u,m=p===void 0?"a":p,b=x===void 0?"#":x,C=g.useRef(null),h=t??C,{setChildrenWidth:k,setNoIconChildrenWidth:j,loadingCounters:B,iconsVisible:T}=g.useContext(de);let P,O;e[10]!==h||e[11]!==k||e[12]!==j?(P=()=>{if(h.current){const y=h.current.getBoundingClientRect(),S=Array.from(h.current.children).find(Ge),H=Array.from(h.current.children).find(Je).textContent,X=S?S.getBoundingClientRect().width+Number(getComputedStyle(S).marginRight.slice(0,-2))+Number(getComputedStyle(S).marginLeft.slice(0,-2)):0;k({text:H,width:y.width}),j({text:H,width:y.width-X})}},O=[h,k,j],e[10]=h,e[11]=k,e[12]=j,e[13]=P,e[14]=O):(P=e[13],O=e[14]),Se(P,O);let A;e[15]!==r?(A=y=>{(y.key===" "||y.key==="Enter")&&!y.defaultPrevented&&typeof r=="function"&&r(y)},e[15]=r,e[16]=A):A=e[16];const D=A;let R;e[17]!==r?(R=y=>{!y.defaultPrevented&&typeof r=="function"&&r(y)},e[17]=r,e[18]=R):R=e[18];const w=R;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U={display:"flex",flexDirection:"column",alignItems:"center"},e[19]=U):U=e[19];let V;return e[20]!==m||e[21]!==n||e[22]!==s||e[23]!==l||e[24]!==w||e[25]!==o||e[26]!==b||e[27]!==T||e[28]!==D||e[29]!==B||e[30]!==a||e[31]!==h||e[32]!==I?(V=c.jsx(z,{as:"li",sx:U,children:c.jsx(Ee,{ref:h,as:m,href:b,"aria-current":s,onKeyDown:D,onClick:w,counter:o,icon:n,loadingCounters:B,iconsVisible:T,sx:I,...a,children:l})}),e[20]=m,e[21]=n,e[22]=s,e[23]=l,e[24]=w,e[25]=o,e[26]=b,e[27]=T,e[28]=D,e[29]=B,e[30]=a,e[31]=h,e[32]=I,e[33]=V):V=e[33],V});he.displayName="UnderlineNavItem";function Ge(i){return i.getAttribute("data-component")==="icon"}function Je(i){return i.getAttribute("data-component")==="text"}const it=Object.assign(me,{Item:he}),pe=g.createContext(null);function Xe(){const i=g.useContext(pe);if(!i)throw new Error("useBlankslate must be used within a BlankslateProvider");return i}const qe=pe.Provider;var L={Container:"prc-Blankslate-Container-XATLP",Blankslate:"prc-Blankslate-Blankslate-7GPW-",Description:"prc-Blankslate-Description-OGHRk",Heading:"prc-Blankslate-Heading-H4xby",Visual:"prc-Blankslate-Visual-PeTD-",Action:"prc-Blankslate-Action-SK5XS"};function Ke(i){const t=W.c(25);let e,n,s,l,o,r,a;t[0]!==i?({border:e,children:n,narrow:l,spacious:r,className:s,size:a,...o}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s,t[4]=l,t[5]=o,t[6]=r,t[7]=a):(e=t[1],n=t[2],s=t[3],l=t[4],o=t[5],r=t[6],a=t[7]);const u=a===void 0?"medium":a;let p,x;t[8]!==u?(x={size:u},t[8]=u,t[9]=x):x=t[9],p=x;const I=p;let m;t[10]!==s?(m=_(L.Blankslate,s),t[10]=s,t[11]=m):m=t[11];const b=e?"":void 0,C=l?"":void 0,h=r?"":void 0;let k;t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==b||t[16]!==C||t[17]!==h?(k=c.jsx("div",{className:m,"data-border":b,"data-narrow":C,"data-spacious":h,"data-size":u,children:n}),t[12]=n,t[13]=u,t[14]=m,t[15]=b,t[16]=C,t[17]=h,t[18]=k):k=t[18];let j;t[19]!==o||t[20]!==k?(j=c.jsx("div",{...o,className:L.Container,children:k}),t[19]=o,t[20]=k,t[21]=j):j=t[21];let B;return t[22]!==j||t[23]!==I?(B=c.jsx(qe,{value:I,children:j}),t[22]=j,t[23]=I,t[24]=B):B=t[24],B}function Qe(i){const t=W.c(10);let e,n,s;t[0]!==i?({children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);let l;t[4]!==n?(l=_("Blankslate-Visual",L.Visual,n),t[4]=n,t[5]=l):l=t[5];let o;return t[6]!==e||t[7]!==s||t[8]!==l?(o=c.jsx("span",{...s,className:l,children:e}),t[6]=e,t[7]=s,t[8]=l,t[9]=o):o=t[9],o}function Ye(i){const t=W.c(12);let e,n,s,l;t[0]!==i?({as:l,children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s,t[4]=l):(e=t[1],n=t[2],s=t[3],l=t[4]);const o=l===void 0?"h2":l;let r;t[5]!==n?(r=_("Blankslate-Heading",L.Heading,n),t[5]=n,t[6]=r):r=t[6];let a;return t[7]!==o||t[8]!==e||t[9]!==s||t[10]!==r?(a=c.jsx(o,{...s,className:r,children:e}),t[7]=o,t[8]=e,t[9]=s,t[10]=r,t[11]=a):a=t[11],a}function Ze(i){const t=W.c(10);let e,n,s;t[0]!==i?({children:e,className:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);let l;t[4]!==n?(l=_("Blankslate-Description",L.Description,n),t[4]=n,t[5]=l):l=t[5];let o;return t[6]!==e||t[7]!==s||t[8]!==l?(o=c.jsx("p",{...s,className:l,children:e}),t[6]=e,t[7]=s,t[8]=l,t[9]=o):o=t[9],o}function et(i){const t=W.c(11);let e,n,s;t[0]!==i?({children:e,href:n,...s}=i,t[0]=i,t[1]=e,t[2]=n,t[3]=s):(e=t[1],n=t[2],s=t[3]);const{size:l}=Xe();let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=_("Blankslate-Action",L.Action),t[4]=o):o=t[4];const r=n?"a":"button",a=l==="small"?"small":void 0;let u;return t[5]!==e||t[6]!==n||t[7]!==s||t[8]!==r||t[9]!==a?(u=c.jsx("div",{className:o,children:c.jsx(ce,{...s,as:r,href:n,variant:"primary",size:a,children:e})}),t[5]=e,t[6]=n,t[7]=s,t[8]=r,t[9]=a,t[10]=u):u=t[10],u}function tt(i){const t=W.c(4),{children:e,href:n}=i;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=_("Blankslate-Action",L.Action),t[0]=s):s=t[0];let l;return t[1]!==e||t[2]!==n?(l=c.jsx("div",{className:s,children:c.jsx($e,{href:n,children:e})}),t[1]=e,t[2]=n,t[3]=l):l=t[3],l}const lt=Object.assign(Ke,{Visual:Qe,Heading:Ye,Description:Ze,PrimaryAction:et,SecondaryAction:tt});export{lt as B,it as U};