mada-design-system 1.3.2 → 1.4.0

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 (634) hide show
  1. package/index.cjs103.js +1 -1
  2. package/index.cjs110.js +1 -1
  3. package/index.cjs111.js +1 -1
  4. package/index.cjs112.js +1 -1
  5. package/index.cjs113.js +1 -1
  6. package/index.cjs114.js +1 -1
  7. package/index.cjs115.js +1 -1
  8. package/index.cjs116.js +1 -1
  9. package/index.cjs117.js +1 -1
  10. package/index.cjs120.js +1 -1
  11. package/index.cjs122.js +1 -1
  12. package/index.cjs123.js +1 -1
  13. package/index.cjs124.js +1 -1
  14. package/index.cjs125.js +1 -1
  15. package/index.cjs127.js +1 -1
  16. package/index.cjs128.js +1 -1
  17. package/index.cjs129.js +1 -1
  18. package/index.cjs130.js +1 -1
  19. package/index.cjs131.js +1 -1
  20. package/index.cjs132.js +1 -1
  21. package/index.cjs133.js +1 -1
  22. package/index.cjs134.js +1 -1
  23. package/index.cjs136.js +1 -1
  24. package/index.cjs137.js +1 -1
  25. package/index.cjs138.js +1 -1
  26. package/index.cjs139.js +1 -1
  27. package/index.cjs140.js +1 -1
  28. package/index.cjs141.js +1 -1
  29. package/index.cjs142.js +1 -1
  30. package/index.cjs143.js +1 -1
  31. package/index.cjs144.js +1 -1
  32. package/index.cjs145.js +1 -1
  33. package/index.cjs146.js +1 -1
  34. package/index.cjs147.js +1 -1
  35. package/index.cjs148.js +1 -1
  36. package/index.cjs149.js +1 -1
  37. package/index.cjs151.js +1 -1
  38. package/index.cjs152.js +1 -1
  39. package/index.cjs153.js +1 -1
  40. package/index.cjs154.js +1 -1
  41. package/index.cjs155.js +1 -1
  42. package/index.cjs156.js +1 -1
  43. package/index.cjs157.js +1 -1
  44. package/index.cjs158.js +1 -1
  45. package/index.cjs159.js +1 -1
  46. package/index.cjs160.js +1 -1
  47. package/index.cjs161.js +1 -1
  48. package/index.cjs162.js +1 -1
  49. package/index.cjs163.js +1 -1
  50. package/index.cjs164.js +1 -1
  51. package/index.cjs171.js +1 -1
  52. package/index.cjs172.js +1 -1
  53. package/index.cjs173.js +1 -1
  54. package/index.cjs174.js +1 -1
  55. package/index.cjs175.js +1 -1
  56. package/index.cjs176.js +1 -1
  57. package/index.cjs177.js +1 -1
  58. package/index.cjs178.js +1 -1
  59. package/index.cjs181.js +1 -1
  60. package/index.cjs182.js +1 -1
  61. package/index.cjs183.js +1 -1
  62. package/index.cjs184.js +1 -1
  63. package/index.cjs185.js +1 -1
  64. package/index.cjs186.js +1 -1
  65. package/index.cjs187.js +1 -1
  66. package/index.cjs188.js +1 -1
  67. package/index.cjs189.js +1 -1
  68. package/index.cjs191.js +1 -1
  69. package/index.cjs192.js +1 -1
  70. package/index.cjs193.js +1 -1
  71. package/index.cjs195.js +1 -1
  72. package/index.cjs197.js +1 -1
  73. package/index.cjs198.js +1 -1
  74. package/index.cjs199.js +1 -1
  75. package/index.cjs200.js +1 -1
  76. package/index.cjs201.js +1 -1
  77. package/index.cjs202.js +1 -1
  78. package/index.cjs203.js +1 -1
  79. package/index.cjs204.js +1 -1
  80. package/index.cjs205.js +1 -1
  81. package/index.cjs206.js +1 -1
  82. package/index.cjs207.js +1 -1
  83. package/index.cjs208.js +1 -1
  84. package/index.cjs209.js +1 -1
  85. package/index.cjs210.js +1 -1
  86. package/index.cjs211.js +1 -1
  87. package/index.cjs212.js +1 -1
  88. package/index.cjs213.js +1 -1
  89. package/index.cjs214.js +1 -1
  90. package/index.cjs215.js +1 -1
  91. package/index.cjs216.js +1 -1
  92. package/index.cjs217.js +1 -1
  93. package/index.cjs218.js +1 -1
  94. package/index.cjs219.js +1 -1
  95. package/index.cjs220.js +1 -1
  96. package/index.cjs221.js +1 -1
  97. package/index.cjs222.js +1 -1
  98. package/index.cjs223.js +1 -1
  99. package/index.cjs224.js +1 -1
  100. package/index.cjs225.js +1 -1
  101. package/index.cjs226.js +1 -1
  102. package/index.cjs227.js +1 -1
  103. package/index.cjs228.js +1 -1
  104. package/index.cjs229.js +1 -1
  105. package/index.cjs230.js +1 -1
  106. package/index.cjs231.js +1 -1
  107. package/index.cjs232.js +1 -1
  108. package/index.cjs233.js +1 -1
  109. package/index.cjs234.js +1 -1
  110. package/index.cjs235.js +1 -1
  111. package/index.cjs236.js +1 -1
  112. package/index.cjs237.js +1 -1
  113. package/index.cjs238.js +1 -1
  114. package/index.cjs239.js +1 -1
  115. package/index.cjs240.js +1 -1
  116. package/index.cjs241.js +1 -1
  117. package/index.cjs242.js +1 -1
  118. package/index.cjs243.js +1 -1
  119. package/index.cjs244.js +1 -1
  120. package/index.cjs245.js +1 -1
  121. package/index.cjs246.js +1 -1
  122. package/index.cjs247.js +1 -1
  123. package/index.cjs248.js +1 -1
  124. package/index.cjs249.js +1 -1
  125. package/index.cjs250.js +1 -1
  126. package/index.cjs251.js +1 -1
  127. package/index.cjs252.js +1 -1
  128. package/index.cjs253.js +1 -1
  129. package/index.cjs254.js +1 -1
  130. package/index.cjs255.js +1 -1
  131. package/index.cjs256.js +1 -1
  132. package/index.cjs257.js +1 -1
  133. package/index.cjs258.js +1 -1
  134. package/index.cjs259.js +1 -1
  135. package/index.cjs260.js +1 -1
  136. package/index.cjs261.js +1 -1
  137. package/index.cjs262.js +1 -1
  138. package/index.cjs263.js +1 -1
  139. package/index.cjs264.js +1 -1
  140. package/index.cjs265.js +1 -1
  141. package/index.cjs266.js +1 -1
  142. package/index.cjs267.js +1 -1
  143. package/index.cjs268.js +1 -1
  144. package/index.cjs269.js +1 -1
  145. package/index.cjs270.js +1 -1
  146. package/index.cjs271.js +1 -1
  147. package/index.cjs272.js +1 -1
  148. package/index.cjs273.js +1 -1
  149. package/index.cjs274.js +1 -1
  150. package/index.cjs275.js +1 -1
  151. package/index.cjs276.js +1 -1
  152. package/index.cjs277.js +1 -1
  153. package/index.cjs278.js +1 -1
  154. package/index.cjs279.js +1 -1
  155. package/index.cjs28.js +1 -1
  156. package/index.cjs280.js +1 -1
  157. package/index.cjs281.js +1 -1
  158. package/index.cjs282.js +1 -1
  159. package/index.cjs283.js +1 -1
  160. package/index.cjs284.js +1 -1
  161. package/index.cjs285.js +1 -1
  162. package/index.cjs286.js +1 -1
  163. package/index.cjs287.js +1 -1
  164. package/index.cjs288.js +1 -1
  165. package/index.cjs289.js +1 -1
  166. package/index.cjs29.js +1 -1
  167. package/index.cjs290.js +1 -1
  168. package/index.cjs291.js +1 -1
  169. package/index.cjs292.js +1 -1
  170. package/index.cjs293.js +1 -1
  171. package/index.cjs294.js +1 -1
  172. package/index.cjs295.js +1 -1
  173. package/index.cjs296.js +1 -1
  174. package/index.cjs297.js +1 -1
  175. package/index.cjs298.js +1 -1
  176. package/index.cjs299.js +1 -1
  177. package/index.cjs300.js +1 -1
  178. package/index.cjs301.js +1 -1
  179. package/index.cjs302.js +1 -1
  180. package/index.cjs303.js +1 -1
  181. package/index.cjs304.js +1 -1
  182. package/index.cjs305.js +1 -1
  183. package/index.cjs306.js +1 -1
  184. package/index.cjs307.js +1 -1
  185. package/index.cjs308.js +1 -1
  186. package/index.cjs309.js +1 -1
  187. package/index.cjs310.js +1 -1
  188. package/index.cjs311.js +1 -1
  189. package/index.cjs312.js +1 -1
  190. package/index.cjs313.js +1 -1
  191. package/index.cjs314.js +1 -1
  192. package/index.cjs315.js +1 -1
  193. package/index.cjs316.js +1 -1
  194. package/index.cjs317.js +1 -1
  195. package/index.cjs318.js +1 -1
  196. package/index.cjs319.js +1 -1
  197. package/index.cjs320.js +1 -1
  198. package/index.cjs321.js +1 -1
  199. package/index.cjs322.js +1 -1
  200. package/index.cjs323.js +1 -1
  201. package/index.cjs324.js +1 -1
  202. package/index.cjs325.js +1 -1
  203. package/index.cjs326.js +1 -1
  204. package/index.cjs327.js +1 -1
  205. package/index.cjs328.js +1 -1
  206. package/index.cjs329.js +1 -1
  207. package/index.cjs330.js +1 -1
  208. package/index.cjs331.js +1 -1
  209. package/index.cjs332.js +1 -1
  210. package/index.cjs333.js +1 -1
  211. package/index.cjs334.js +1 -1
  212. package/index.cjs335.js +1 -1
  213. package/index.cjs336.js +1 -1
  214. package/index.cjs337.js +1 -1
  215. package/index.cjs338.js +1 -1
  216. package/index.cjs339.js +1 -1
  217. package/index.cjs34.js +1 -1
  218. package/index.cjs340.js +1 -1
  219. package/index.cjs341.js +1 -1
  220. package/index.cjs342.js +1 -1
  221. package/index.cjs343.js +1 -1
  222. package/index.cjs344.js +1 -1
  223. package/index.cjs345.js +1 -1
  224. package/index.cjs346.js +1 -1
  225. package/index.cjs347.js +1 -1
  226. package/index.cjs348.js +1 -1
  227. package/index.cjs349.js +1 -1
  228. package/index.cjs35.js +1 -1
  229. package/index.cjs350.js +1 -1
  230. package/index.cjs351.js +1 -1
  231. package/index.cjs352.js +1 -1
  232. package/index.cjs353.js +1 -1
  233. package/index.cjs354.js +1 -1
  234. package/index.cjs355.js +1 -1
  235. package/index.cjs356.js +1 -1
  236. package/index.cjs357.js +1 -1
  237. package/index.cjs358.js +1 -1
  238. package/index.cjs359.js +1 -1
  239. package/index.cjs36.js +1 -1
  240. package/index.cjs360.js +1 -1
  241. package/index.cjs361.js +1 -1
  242. package/index.cjs362.js +1 -1
  243. package/index.cjs363.js +1 -1
  244. package/index.cjs364.js +1 -1
  245. package/index.cjs365.js +1 -1
  246. package/index.cjs366.js +1 -1
  247. package/index.cjs367.js +1 -1
  248. package/index.cjs368.js +1 -1
  249. package/index.cjs369.js +1 -1
  250. package/index.cjs370.js +1 -1
  251. package/index.cjs371.js +1 -1
  252. package/index.cjs372.js +1 -1
  253. package/index.cjs373.js +1 -1
  254. package/index.cjs374.js +1 -1
  255. package/index.cjs375.js +1 -1
  256. package/index.cjs376.js +1 -1
  257. package/index.cjs377.js +1 -1
  258. package/index.cjs378.js +1 -1
  259. package/index.cjs379.js +1 -1
  260. package/index.cjs380.js +1 -1
  261. package/index.cjs381.js +1 -1
  262. package/index.cjs382.js +1 -1
  263. package/index.cjs383.js +1 -1
  264. package/index.cjs384.js +1 -1
  265. package/index.cjs385.js +1 -1
  266. package/index.cjs386.js +1 -1
  267. package/index.cjs387.js +1 -1
  268. package/index.cjs388.js +1 -1
  269. package/index.cjs389.js +1 -1
  270. package/index.cjs390.js +1 -1
  271. package/index.cjs391.js +1 -1
  272. package/index.cjs392.js +1 -1
  273. package/index.cjs393.js +1 -1
  274. package/index.cjs394.js +1 -1
  275. package/index.cjs395.js +1 -1
  276. package/index.cjs396.js +1 -1
  277. package/index.cjs397.js +1 -1
  278. package/index.cjs398.js +1 -1
  279. package/index.cjs399.js +1 -1
  280. package/index.cjs400.js +1 -1
  281. package/index.cjs401.js +1 -1
  282. package/index.cjs402.js +1 -1
  283. package/index.cjs403.js +1 -1
  284. package/index.cjs404.js +1 -1
  285. package/index.cjs405.js +1 -1
  286. package/index.cjs406.js +1 -1
  287. package/index.cjs407.js +1 -1
  288. package/index.cjs408.js +1 -1
  289. package/index.cjs409.js +1 -1
  290. package/index.cjs410.js +1 -1
  291. package/index.cjs411.js +1 -1
  292. package/index.cjs412.js +1 -1
  293. package/index.cjs413.js +1 -1
  294. package/index.cjs414.js +1 -1
  295. package/index.cjs415.js +1 -1
  296. package/index.cjs416.js +1 -1
  297. package/index.cjs417.js +1 -1
  298. package/index.cjs418.js +1 -1
  299. package/index.cjs419.js +1 -1
  300. package/index.cjs420.js +1 -1
  301. package/index.cjs421.js +1 -1
  302. package/index.cjs422.js +1 -1
  303. package/index.cjs423.js +1 -1
  304. package/index.cjs424.js +1 -1
  305. package/index.cjs425.js +1 -1
  306. package/index.cjs426.js +1 -1
  307. package/index.cjs427.js +1 -1
  308. package/index.cjs45.js +1 -1
  309. package/index.cjs46.js +1 -1
  310. package/index.cjs47.js +1 -1
  311. package/index.cjs49.js +1 -1
  312. package/index.cjs52.js +1 -1
  313. package/index.cjs73.js +1 -1
  314. package/index.cjs90.js +1 -1
  315. package/index.cjs92.js +1 -1
  316. package/index.cjs96.js +1 -1
  317. package/index.es.d.ts +3 -1
  318. package/index.es103.js +1 -1
  319. package/index.es110.js +474 -2376
  320. package/index.es111.js +2408 -15
  321. package/index.es112.js +14 -10
  322. package/index.es113.js +10 -6
  323. package/index.es114.js +6 -56
  324. package/index.es115.js +57 -19
  325. package/index.es116.js +10 -10
  326. package/index.es117.js +17 -504
  327. package/index.es120.js +1 -1
  328. package/index.es122.js +1 -1
  329. package/index.es123.js +1 -1
  330. package/index.es124.js +1 -1
  331. package/index.es125.js +1 -1
  332. package/index.es127.js +1 -1
  333. package/index.es128.js +2 -2
  334. package/index.es129.js +1 -1
  335. package/index.es130.js +1 -1
  336. package/index.es131.js +1 -1
  337. package/index.es132.js +1 -1
  338. package/index.es133.js +1 -1
  339. package/index.es134.js +2 -2
  340. package/index.es136.js +1 -1
  341. package/index.es137.js +1 -1
  342. package/index.es138.js +1 -1
  343. package/index.es139.js +1 -1
  344. package/index.es140.js +1 -1
  345. package/index.es141.js +1 -1
  346. package/index.es142.js +21 -21
  347. package/index.es143.js +1 -1
  348. package/index.es144.js +1 -1
  349. package/index.es145.js +1 -1
  350. package/index.es146.js +1 -1
  351. package/index.es147.js +1 -1
  352. package/index.es148.js +1 -1
  353. package/index.es149.js +1 -1
  354. package/index.es151.js +1 -1
  355. package/index.es152.js +1 -1
  356. package/index.es153.js +1 -1
  357. package/index.es154.js +1 -1
  358. package/index.es155.js +1 -1
  359. package/index.es156.js +5 -5
  360. package/index.es157.js +1 -1
  361. package/index.es158.js +8 -8
  362. package/index.es159.js +1 -1
  363. package/index.es160.js +1 -1
  364. package/index.es161.js +1 -1
  365. package/index.es162.js +1 -1
  366. package/index.es163.js +1 -1
  367. package/index.es164.js +1 -1
  368. package/index.es171.js +1 -1
  369. package/index.es172.js +1 -1
  370. package/index.es173.js +1 -1
  371. package/index.es174.js +1 -1
  372. package/index.es175.js +1 -1
  373. package/index.es176.js +1 -1
  374. package/index.es177.js +1 -1
  375. package/index.es178.js +1 -1
  376. package/index.es181.js +1 -1
  377. package/index.es182.js +1 -1
  378. package/index.es183.js +1 -1
  379. package/index.es184.js +1 -1
  380. package/index.es185.js +2 -2
  381. package/index.es186.js +1 -1
  382. package/index.es187.js +1 -1
  383. package/index.es188.js +1 -1
  384. package/index.es189.js +1 -1
  385. package/index.es191.js +1 -1
  386. package/index.es192.js +1 -1
  387. package/index.es193.js +1 -1
  388. package/index.es195.js +1 -1
  389. package/index.es197.js +10 -2
  390. package/index.es198.js +5 -232
  391. package/index.es199.js +5 -53
  392. package/index.es200.js +17 -478
  393. package/index.es201.js +5 -14
  394. package/index.es202.js +5 -32
  395. package/index.es203.js +7 -1202
  396. package/index.es204.js +14 -31
  397. package/index.es205.js +16 -12
  398. package/index.es206.js +8 -38
  399. package/index.es207.js +7 -98
  400. package/index.es208.js +11 -31
  401. package/index.es209.js +15 -9
  402. package/index.es210.js +6 -141
  403. package/index.es211.js +15 -117
  404. package/index.es212.js +6 -98
  405. package/index.es213.js +9 -31
  406. package/index.es214.js +7 -9
  407. package/index.es215.js +5 -141
  408. package/index.es216.js +7 -117
  409. package/index.es217.js +579 -66
  410. package/index.es218.js +49 -30
  411. package/index.es219.js +18 -9
  412. package/index.es220.js +9 -153
  413. package/index.es221.js +7 -108
  414. package/index.es222.js +7 -7
  415. package/index.es223.js +5 -5
  416. package/index.es224.js +6 -5
  417. package/index.es225.js +9 -17
  418. package/index.es226.js +5 -5
  419. package/index.es227.js +8 -5
  420. package/index.es228.js +13 -7
  421. package/index.es229.js +5 -13
  422. package/index.es230.js +9 -15
  423. package/index.es231.js +8 -8
  424. package/index.es232.js +10 -6
  425. package/index.es233.js +14 -10
  426. package/index.es234.js +5 -14
  427. package/index.es235.js +5 -5
  428. package/index.es236.js +4 -14
  429. package/index.es237.js +11 -5
  430. package/index.es238.js +10 -8
  431. package/index.es239.js +10 -6
  432. package/index.es240.js +11 -4
  433. package/index.es241.js +11 -6
  434. package/index.es242.js +35 -577
  435. package/index.es243.js +64 -49
  436. package/index.es244.js +9 -17
  437. package/index.es245.js +8 -8
  438. package/index.es246.js +7 -6
  439. package/index.es247.js +10 -7
  440. package/index.es248.js +7 -5
  441. package/index.es249.js +7 -6
  442. package/index.es250.js +6 -9
  443. package/index.es251.js +15 -5
  444. package/index.es252.js +98 -9
  445. package/index.es253.js +31 -13
  446. package/index.es254.js +9 -6
  447. package/index.es255.js +141 -10
  448. package/index.es256.js +117 -9
  449. package/index.es257.js +98 -11
  450. package/index.es258.js +31 -15
  451. package/index.es259.js +9 -6
  452. package/index.es260.js +141 -6
  453. package/index.es261.js +117 -5
  454. package/index.es262.js +68 -12
  455. package/index.es263.js +31 -11
  456. package/index.es264.js +9 -11
  457. package/index.es265.js +153 -12
  458. package/index.es266.js +108 -12
  459. package/index.es267.js +11 -37
  460. package/index.es268.js +25 -65
  461. package/index.es269.js +10 -9
  462. package/index.es270.js +38 -8
  463. package/index.es271.js +1999 -7
  464. package/index.es272.js +6 -10
  465. package/index.es273.js +71 -7
  466. package/index.es274.js +24 -7
  467. package/index.es275.js +478 -6
  468. package/index.es276.js +2 -18
  469. package/index.es277.js +232 -12
  470. package/index.es278.js +52 -23
  471. package/index.es279.js +4 -10
  472. package/index.es28.js +36 -36
  473. package/index.es280.js +56 -38
  474. package/index.es281.js +29 -1998
  475. package/index.es282.js +46 -6
  476. package/index.es283.js +66 -71
  477. package/index.es284.js +34 -21
  478. package/index.es285.js +15 -79
  479. package/index.es286.js +73 -2
  480. package/index.es287.js +73 -52
  481. package/index.es288.js +74 -4
  482. package/index.es289.js +74 -4
  483. package/index.es29.js +2 -2
  484. package/index.es290.js +45 -15
  485. package/index.es291.js +46 -5
  486. package/index.es292.js +58 -8
  487. package/index.es293.js +48 -16
  488. package/index.es294.js +46 -4
  489. package/index.es295.js +77 -4
  490. package/index.es296.js +77 -5
  491. package/index.es297.js +102 -5
  492. package/index.es298.js +46 -4
  493. package/index.es299.js +46 -4
  494. package/index.es300.js +46 -6
  495. package/index.es301.js +30 -24
  496. package/index.es302.js +29 -6
  497. package/index.es303.js +29 -4
  498. package/index.es304.js +30 -6
  499. package/index.es305.js +29 -5
  500. package/index.es306.js +29 -4
  501. package/index.es307.js +19 -5
  502. package/index.es308.js +45 -4
  503. package/index.es309.js +45 -8
  504. package/index.es310.js +19 -5
  505. package/index.es311.js +19 -4
  506. package/index.es312.js +6 -4
  507. package/index.es313.js +15 -6
  508. package/index.es314.js +11 -38
  509. package/index.es315.js +28 -4
  510. package/index.es316.js +95 -5
  511. package/index.es317.js +24 -12
  512. package/index.es318.js +37 -6
  513. package/index.es319.js +38 -10
  514. package/index.es320.js +31 -11
  515. package/index.es321.js +12 -9
  516. package/index.es322.js +82 -13
  517. package/index.es323.js +2 -24
  518. package/index.es324.js +20 -20
  519. package/index.es325.js +100 -53
  520. package/index.es326.js +47 -74
  521. package/index.es327.js +14 -9
  522. package/index.es328.js +32 -20
  523. package/index.es329.js +1200 -15
  524. package/index.es330.js +52 -20
  525. package/index.es331.js +4 -6
  526. package/index.es332.js +4 -5
  527. package/index.es333.js +15 -23
  528. package/index.es334.js +6 -16
  529. package/index.es335.js +8 -6
  530. package/index.es336.js +16 -4
  531. package/index.es337.js +4 -4
  532. package/index.es338.js +4 -4
  533. package/index.es339.js +5 -4
  534. package/index.es34.js +1 -1
  535. package/index.es340.js +5 -3
  536. package/index.es341.js +4 -6
  537. package/index.es342.js +4 -7
  538. package/index.es343.js +6 -6
  539. package/index.es344.js +24 -5
  540. package/index.es345.js +6 -3
  541. package/index.es346.js +4 -3
  542. package/index.es347.js +6 -3
  543. package/index.es348.js +5 -3
  544. package/index.es349.js +4 -4
  545. package/index.es35.js +1 -1
  546. package/index.es350.js +5 -3
  547. package/index.es351.js +4 -3
  548. package/index.es352.js +8 -3
  549. package/index.es353.js +6 -12
  550. package/index.es354.js +4 -58
  551. package/index.es355.js +4 -66
  552. package/index.es356.js +6 -6
  553. package/index.es357.js +39 -4
  554. package/index.es358.js +4 -23
  555. package/index.es359.js +7 -16
  556. package/index.es36.js +1 -1
  557. package/index.es360.js +13 -7
  558. package/index.es361.js +7 -10
  559. package/index.es362.js +10 -10
  560. package/index.es363.js +10 -21
  561. package/index.es364.js +8 -10
  562. package/index.es365.js +12 -8
  563. package/index.es366.js +24 -10
  564. package/index.es367.js +20 -5
  565. package/index.es368.js +53 -5
  566. package/index.es369.js +73 -16
  567. package/index.es370.js +9 -9
  568. package/index.es371.js +17 -15
  569. package/index.es372.js +16 -15
  570. package/index.es373.js +19 -12
  571. package/index.es374.js +6 -6
  572. package/index.es375.js +5 -15
  573. package/index.es376.js +23 -12
  574. package/index.es377.js +16 -29
  575. package/index.es378.js +6 -4
  576. package/index.es379.js +5 -57
  577. package/index.es380.js +4 -30
  578. package/index.es381.js +4 -46
  579. package/index.es382.js +4 -66
  580. package/index.es383.js +3 -37
  581. package/index.es384.js +6 -18
  582. package/index.es385.js +7 -72
  583. package/index.es386.js +6 -72
  584. package/index.es387.js +5 -74
  585. package/index.es388.js +3 -74
  586. package/index.es389.js +3 -45
  587. package/index.es390.js +3 -46
  588. package/index.es391.js +3 -58
  589. package/index.es392.js +4 -48
  590. package/index.es393.js +3 -46
  591. package/index.es394.js +3 -77
  592. package/index.es395.js +3 -77
  593. package/index.es396.js +11 -102
  594. package/index.es397.js +57 -45
  595. package/index.es398.js +63 -43
  596. package/index.es399.js +6 -46
  597. package/index.es400.js +4 -30
  598. package/index.es401.js +22 -28
  599. package/index.es402.js +13 -26
  600. package/index.es403.js +7 -30
  601. package/index.es404.js +10 -29
  602. package/index.es405.js +10 -29
  603. package/index.es406.js +21 -19
  604. package/index.es407.js +10 -45
  605. package/index.es408.js +9 -45
  606. package/index.es409.js +9 -19
  607. package/index.es410.js +4 -19
  608. package/index.es411.js +5 -97
  609. package/index.es412.js +15 -24
  610. package/index.es413.js +9 -38
  611. package/index.es414.js +18 -8
  612. package/index.es415.js +15 -19
  613. package/index.es416.js +12 -16
  614. package/index.es417.js +8 -5
  615. package/index.es418.js +18 -4
  616. package/index.es419.js +15 -28
  617. package/index.es420.js +4 -11
  618. package/index.es421.js +4 -24
  619. package/index.es422.js +29 -5
  620. package/index.es423.js +12 -12
  621. package/index.es424.js +25 -4
  622. package/index.es425.js +5 -19
  623. package/index.es426.js +4 -100
  624. package/index.es427.js +13 -47
  625. package/index.es45.js +1 -1
  626. package/index.es46.js +1 -1
  627. package/index.es47.js +1 -1
  628. package/index.es49.js +2 -2
  629. package/index.es52.js +182 -176
  630. package/index.es73.js +1 -1
  631. package/index.es90.js +1 -1
  632. package/index.es92.js +1 -1
  633. package/index.es96.js +6 -6
  634. package/package.json +1 -1
package/index.es110.js CHANGED
@@ -1,2410 +1,508 @@
1
- import { jwtDecode as Te } from "./index.es196.js";
2
- var Pe = {
3
- debug: () => {
1
+ var B = Symbol.for("immer-nothing"), R = Symbol.for("immer-draftable"), u = Symbol.for("immer-state"), Y = process.env.NODE_ENV !== "production" ? [
2
+ // All error codes, starting by 0:
3
+ function(e) {
4
+ return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
4
5
  },
5
- info: () => {
6
+ function(e) {
7
+ return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
6
8
  },
7
- warn: () => {
9
+ "This object has been frozen and should not be mutated",
10
+ function(e) {
11
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
8
12
  },
9
- error: () => {
10
- }
11
- }, b, k, D = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(D || {});
12
- ((e) => {
13
- function t() {
14
- b = 3, k = Pe;
15
- }
16
- e.reset = t;
17
- function s(r) {
18
- if (!(0 <= r && r <= 4))
19
- throw new Error("Invalid log level");
20
- b = r;
21
- }
22
- e.setLevel = s;
23
- function i(r) {
24
- k = r;
25
- }
26
- e.setLogger = i;
27
- })(D || (D = {}));
28
- var g = class y {
29
- constructor(t) {
30
- this._name = t;
31
- }
32
- /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
33
- debug(...t) {
34
- b >= 4 && k.debug(y._format(this._name, this._method), ...t);
35
- }
36
- info(...t) {
37
- b >= 3 && k.info(y._format(this._name, this._method), ...t);
38
- }
39
- warn(...t) {
40
- b >= 2 && k.warn(y._format(this._name, this._method), ...t);
41
- }
42
- error(...t) {
43
- b >= 1 && k.error(y._format(this._name, this._method), ...t);
44
- }
45
- /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
46
- throw(t) {
47
- throw this.error(t), t;
48
- }
49
- create(t) {
50
- const s = Object.create(this);
51
- return s._method = t, s.debug("begin"), s;
52
- }
53
- static createStatic(t, s) {
54
- const i = new y(`${t}.${s}`);
55
- return i.debug("begin"), i;
56
- }
57
- static _format(t, s) {
58
- const i = `[${t}]`;
59
- return s ? `${i} ${s}:` : i;
60
- }
61
- /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
62
- // helpers for static class methods
63
- static debug(t, ...s) {
64
- b >= 4 && k.debug(y._format(t), ...s);
65
- }
66
- static info(t, ...s) {
67
- b >= 3 && k.info(y._format(t), ...s);
68
- }
69
- static warn(t, ...s) {
70
- b >= 2 && k.warn(y._format(t), ...s);
71
- }
72
- static error(t, ...s) {
73
- b >= 1 && k.error(y._format(t), ...s);
74
- }
75
- /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
76
- };
77
- D.reset();
78
- var H = class {
79
- // IMPORTANT: doesn't validate the token
80
- static decode(e) {
81
- try {
82
- return Te(e);
83
- } catch (t) {
84
- throw g.error("JwtUtils.decode", t), t;
85
- }
86
- }
87
- static async generateSignedJwt(e, t, s) {
88
- const i = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), o = `${i}.${r}`, n = await window.crypto.subtle.sign(
89
- {
90
- name: "ECDSA",
91
- hash: { name: "SHA-256" }
92
- },
93
- s,
94
- new TextEncoder().encode(o)
95
- ), a = _.encodeBase64Url(new Uint8Array(n));
96
- return `${o}.${a}`;
97
- }
98
- static async generateSignedJwtWithHmac(e, t, s) {
99
- const i = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), o = `${i}.${r}`, n = await window.crypto.subtle.sign(
100
- "HMAC",
101
- s,
102
- new TextEncoder().encode(o)
103
- ), a = _.encodeBase64Url(new Uint8Array(n));
104
- return `${o}.${a}`;
105
- }
106
- }, Re = "10000000-1000-4000-8000-100000000000", K = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), ie = class m {
107
- static _randomWord() {
108
- const t = new Uint32Array(1);
109
- return crypto.getRandomValues(t), t[0];
110
- }
111
- /**
112
- * Generates RFC4122 version 4 guid
113
- */
114
- static generateUUIDv4() {
115
- return Re.replace(
116
- /[018]/g,
117
- (s) => (+s ^ m._randomWord() & 15 >> +s / 4).toString(16)
118
- ).replace(/-/g, "");
119
- }
120
- /**
121
- * PKCE: Generate a code verifier
122
- */
123
- static generateCodeVerifier() {
124
- return m.generateUUIDv4() + m.generateUUIDv4() + m.generateUUIDv4();
125
- }
126
- /**
127
- * PKCE: Generate a code challenge
128
- */
129
- static async generateCodeChallenge(t) {
130
- if (!crypto.subtle)
131
- throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");
132
- try {
133
- const i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
134
- return K(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
135
- } catch (s) {
136
- throw g.error("CryptoUtils.generateCodeChallenge", s), s;
137
- }
138
- }
139
- /**
140
- * Generates a base64-encoded string for a basic auth header
141
- */
142
- static generateBasicAuth(t, s) {
143
- const r = new TextEncoder().encode([t, s].join(":"));
144
- return K(r);
145
- }
146
- /**
147
- * Generates a hash of a string using a given algorithm
148
- * @param alg
149
- * @param message
150
- */
151
- static async hash(t, s) {
152
- const i = new TextEncoder().encode(s), r = await crypto.subtle.digest(t, i);
153
- return new Uint8Array(r);
154
- }
155
- /**
156
- * Generates a rfc7638 compliant jwk thumbprint
157
- * @param jwk
158
- */
159
- static async customCalculateJwkThumbprint(t) {
160
- let s;
161
- switch (t.kty) {
162
- case "RSA":
163
- s = {
164
- e: t.e,
165
- kty: t.kty,
166
- n: t.n
167
- };
168
- break;
169
- case "EC":
170
- s = {
171
- crv: t.crv,
172
- kty: t.kty,
173
- x: t.x,
174
- y: t.y
175
- };
176
- break;
177
- case "OKP":
178
- s = {
179
- crv: t.crv,
180
- kty: t.kty,
181
- x: t.x
182
- };
183
- break;
184
- case "oct":
185
- s = {
186
- crv: t.k,
187
- kty: t.kty
188
- };
189
- break;
190
- default:
191
- throw new Error("Unknown jwk type");
192
- }
193
- const i = await m.hash("SHA-256", JSON.stringify(s));
194
- return m.encodeBase64Url(i);
195
- }
196
- static async generateDPoPProof({
197
- url: t,
198
- accessToken: s,
199
- httpMethod: i,
200
- keyPair: r,
201
- nonce: o
202
- }) {
203
- let n, a;
204
- const c = {
205
- jti: window.crypto.randomUUID(),
206
- htm: i ?? "GET",
207
- htu: t,
208
- iat: Math.floor(Date.now() / 1e3)
209
- };
210
- s && (n = await m.hash("SHA-256", s), a = m.encodeBase64Url(n), c.ath = a), o && (c.nonce = o);
211
- try {
212
- const l = await crypto.subtle.exportKey("jwk", r.publicKey), d = {
213
- alg: "ES256",
214
- typ: "dpop+jwt",
215
- jwk: {
216
- crv: l.crv,
217
- kty: l.kty,
218
- x: l.x,
219
- y: l.y
220
- }
221
- };
222
- return await H.generateSignedJwt(d, c, r.privateKey);
223
- } catch (l) {
224
- throw l instanceof TypeError ? new Error(`Error exporting dpop public key: ${l.message}`) : l;
225
- }
226
- }
227
- static async generateDPoPJkt(t) {
228
- try {
229
- const s = await crypto.subtle.exportKey("jwk", t.publicKey);
230
- return await m.customCalculateJwkThumbprint(s);
231
- } catch (s) {
232
- throw s instanceof TypeError ? new Error(`Could not retrieve dpop keys from storage: ${s.message}`) : s;
233
- }
234
- }
235
- static async generateDPoPKeys() {
236
- return await window.crypto.subtle.generateKey(
237
- {
238
- name: "ECDSA",
239
- namedCurve: "P-256"
240
- },
241
- !1,
242
- ["sign", "verify"]
243
- );
244
- }
245
- /**
246
- * Generates a client assertion JWT for client_secret_jwt authentication
247
- * @param client_id The client identifier
248
- * @param client_secret The client secret
249
- * @param audience The token endpoint URL (audience)
250
- * @param algorithm The HMAC algorithm to use (HS256, HS384, HS512). Defaults to HS256
251
- */
252
- static async generateClientAssertionJwt(t, s, i, r = "HS256") {
253
- const o = Math.floor(Date.now() / 1e3), n = {
254
- alg: r,
255
- typ: "JWT"
256
- }, a = {
257
- iss: t,
258
- sub: t,
259
- aud: i,
260
- jti: m.generateUUIDv4(),
261
- exp: o + 300,
262
- // 5 minutes
263
- iat: o
264
- }, l = {
265
- HS256: "SHA-256",
266
- HS384: "SHA-384",
267
- HS512: "SHA-512"
268
- }[r];
269
- if (!l)
270
- throw new Error(`Unsupported algorithm: ${r}. Supported algorithms are: HS256, HS384, HS512`);
271
- const d = new TextEncoder(), h = await crypto.subtle.importKey(
272
- "raw",
273
- d.encode(s),
274
- { name: "HMAC", hash: l },
275
- !1,
276
- ["sign"]
277
- );
278
- return await H.generateSignedJwtWithHmac(n, a, h);
279
- }
280
- };
281
- ie.encodeBase64Url = (e) => K(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
282
- var _ = ie, I = class {
283
- constructor(e) {
284
- this._name = e, this._callbacks = [], this._logger = new g(`Event('${this._name}')`);
285
- }
286
- addHandler(e) {
287
- return this._callbacks.push(e), () => this.removeHandler(e);
288
- }
289
- removeHandler(e) {
290
- const t = this._callbacks.lastIndexOf(e);
291
- t >= 0 && this._callbacks.splice(t, 1);
292
- }
293
- async raise(...e) {
294
- this._logger.debug("raise:", ...e);
295
- for (const t of this._callbacks)
296
- await t(...e);
297
- }
298
- }, Z = class {
299
- /**
300
- * Populates a map of window features with a placement centered in front of
301
- * the current window. If no explicit width is given, a default value is
302
- * binned into [800, 720, 600, 480, 360] based on the current window's width.
303
- */
304
- static center({ ...e }) {
305
- var t, s, i;
306
- return e.width == null && (e.width = (t = [800, 720, 600, 480].find((r) => r <= window.outerWidth / 1.618)) != null ? t : 360), (s = e.left) != null || (e.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - e.width) / 2))), e.height != null && ((i = e.top) != null || (e.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - e.height) / 2)))), e;
307
- }
308
- static serialize(e) {
309
- return Object.entries(e).filter(([, t]) => t != null).map(([t, s]) => `${t}=${typeof s != "boolean" ? s : s ? "yes" : "no"}`).join(",");
310
- }
311
- }, T = class j extends I {
312
- constructor() {
313
- super(...arguments), this._logger = new g(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
314
- const t = this._expiration - j.getEpochTime();
315
- this._logger.debug("timer completes in", t), this._expiration <= j.getEpochTime() && (this.cancel(), super.raise());
316
- };
317
- }
318
- // get the time
319
- static getEpochTime() {
320
- return Math.floor(Date.now() / 1e3);
321
- }
322
- init(t) {
323
- const s = this._logger.create("init");
324
- t = Math.max(Math.floor(t), 1);
325
- const i = j.getEpochTime() + t;
326
- if (this.expiration === i && this._timerHandle) {
327
- s.debug("skipping since already initialized for expiration at", this.expiration);
328
- return;
329
- }
330
- this.cancel(), s.debug("using duration", t), this._expiration = i;
331
- const r = Math.min(t, 5);
332
- this._timerHandle = setInterval(this._callback, r * 1e3);
333
- }
334
- get expiration() {
335
- return this._expiration;
336
- }
337
- cancel() {
338
- this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
339
- }
340
- }, L = class {
341
- static readParams(e, t = "query") {
342
- if (!e) throw new TypeError("Invalid URL");
343
- const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
344
- return new URLSearchParams(i.slice(1));
345
- }
346
- }, N = ";", q = class extends Error {
347
- constructor(e, t) {
348
- var s, i, r;
349
- if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
350
- throw g.error("ErrorResponse", "No error passed"), new Error("No error passed");
351
- this.error = e.error, this.error_description = (s = e.error_description) != null ? s : null, this.error_uri = (i = e.error_uri) != null ? i : null, this.state = e.userState, this.session_state = (r = e.session_state) != null ? r : null, this.url_state = e.url_state;
352
- }
353
- }, G = class extends Error {
354
- constructor(e) {
355
- super(e), this.name = "ErrorTimeout";
356
- }
357
- }, Ie = class {
358
- constructor(e) {
359
- this._logger = new g("AccessTokenEvents"), this._expiringTimer = new T("Access token expiring"), this._expiredTimer = new T("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
360
- }
361
- async load(e) {
362
- const t = this._logger.create("load");
363
- if (e.access_token && e.expires_in !== void 0) {
364
- const s = e.expires_in;
365
- if (t.debug("access token present, remaining duration:", s), s > 0) {
366
- let r = s - this._expiringNotificationTimeInSeconds;
367
- r <= 0 && (r = 1), t.debug("registering expiring timer, raising in", r, "seconds"), this._expiringTimer.init(r);
368
- } else
369
- t.debug("canceling existing expiring timer because we're past expiration."), this._expiringTimer.cancel();
370
- const i = s + 1;
371
- t.debug("registering expired timer, raising in", i, "seconds"), this._expiredTimer.init(i);
372
- } else
373
- this._expiringTimer.cancel(), this._expiredTimer.cancel();
374
- }
375
- async unload() {
376
- this._logger.debug("unload: canceling existing access token timers"), this._expiringTimer.cancel(), this._expiredTimer.cancel();
377
- }
378
- /**
379
- * Add callback: Raised prior to the access token expiring.
380
- */
381
- addAccessTokenExpiring(e) {
382
- return this._expiringTimer.addHandler(e);
383
- }
384
- /**
385
- * Remove callback: Raised prior to the access token expiring.
386
- */
387
- removeAccessTokenExpiring(e) {
388
- this._expiringTimer.removeHandler(e);
389
- }
390
- /**
391
- * Add callback: Raised after the access token has expired.
392
- */
393
- addAccessTokenExpired(e) {
394
- return this._expiredTimer.addHandler(e);
395
- }
396
- /**
397
- * Remove callback: Raised after the access token has expired.
398
- */
399
- removeAccessTokenExpired(e) {
400
- this._expiredTimer.removeHandler(e);
401
- }
402
- }, Ce = class {
403
- constructor(e, t, s, i, r) {
404
- this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new g("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (n) => {
405
- n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(n.data + " message from check session op iframe"));
406
- };
407
- const o = new URL(s);
408
- this._frame_origin = o.origin, this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "fixed", this._frame.style.left = "-1000px", this._frame.style.top = "0", this._frame.width = "0", this._frame.height = "0", this._frame.src = o.href;
409
- }
410
- load() {
411
- return new Promise((e) => {
412
- this._frame.onload = () => {
413
- e();
414
- }, window.document.body.appendChild(this._frame), window.addEventListener("message", this._message, !1);
415
- });
416
- }
417
- start(e) {
418
- if (this._session_state === e)
419
- return;
420
- this._logger.create("start"), this.stop(), this._session_state = e;
421
- const t = () => {
422
- !this._frame.contentWindow || !this._session_state || this._frame.contentWindow.postMessage(this._client_id + " " + this._session_state, this._frame_origin);
423
- };
424
- t(), this._timer = setInterval(t, this._intervalInSeconds * 1e3);
425
- }
426
- stop() {
427
- this._logger.create("stop"), this._session_state = null, this._timer && (clearInterval(this._timer), this._timer = null);
428
- }
429
- }, re = class {
430
- constructor() {
431
- this._logger = new g("InMemoryWebStorage"), this._data = {};
432
- }
433
- clear() {
434
- this._logger.create("clear"), this._data = {};
435
- }
436
- getItem(e) {
437
- return this._logger.create(`getItem('${e}')`), this._data[e];
438
- }
439
- setItem(e, t) {
440
- this._logger.create(`setItem('${e}')`), this._data[e] = t;
441
- }
442
- removeItem(e) {
443
- this._logger.create(`removeItem('${e}')`), delete this._data[e];
444
- }
445
- get length() {
446
- return Object.getOwnPropertyNames(this._data).length;
447
- }
448
- key(e) {
449
- return Object.getOwnPropertyNames(this._data)[e];
450
- }
451
- }, F = class extends Error {
452
- constructor(e, t) {
453
- super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
454
- }
455
- }, Q = class {
456
- constructor(e = [], t = null, s = {}) {
457
- this._jwtHandler = t, this._extraHeaders = s, this._logger = new g("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
458
- }
459
- async fetchWithTimeout(e, t = {}) {
460
- const { timeoutInSeconds: s, ...i } = t;
461
- if (!s)
462
- return await fetch(e, i);
463
- const r = new AbortController(), o = setTimeout(() => r.abort(), s * 1e3);
464
- try {
465
- return await fetch(e, {
466
- ...t,
467
- signal: r.signal
468
- });
469
- } catch (n) {
470
- throw n instanceof DOMException && n.name === "AbortError" ? new G("Network timed out") : n;
471
- } finally {
472
- clearTimeout(o);
473
- }
474
- }
475
- async getJson(e, {
476
- token: t,
477
- credentials: s,
478
- timeoutInSeconds: i
479
- } = {}) {
480
- const r = this._logger.create("getJson"), o = {
481
- Accept: this._contentTypes.join(", ")
482
- };
483
- t && (r.debug("token passed, setting Authorization header"), o.Authorization = "Bearer " + t), this._appendExtraHeaders(o);
484
- let n;
485
- try {
486
- r.debug("url:", e), n = await this.fetchWithTimeout(e, { method: "GET", headers: o, timeoutInSeconds: i, credentials: s });
487
- } catch (l) {
488
- throw r.error("Network Error"), l;
489
- }
490
- r.debug("HTTP response received, status", n.status);
491
- const a = n.headers.get("Content-Type");
492
- if (a && !this._contentTypes.find((l) => a.startsWith(l)) && r.throw(new Error(`Invalid response Content-Type: ${a ?? "undefined"}, from URL: ${e}`)), n.ok && this._jwtHandler && (a != null && a.startsWith("application/jwt")))
493
- return await this._jwtHandler(await n.text());
494
- let c;
495
- try {
496
- c = await n.json();
497
- } catch (l) {
498
- throw r.error("Error parsing JSON response", l), n.ok ? l : new Error(`${n.statusText} (${n.status})`);
499
- }
500
- if (!n.ok)
501
- throw r.error("Error from server:", c), c.error ? new q(c) : new Error(`${n.statusText} (${n.status}): ${JSON.stringify(c)}`);
502
- return c;
503
- }
504
- async postForm(e, {
505
- body: t,
506
- basicAuth: s,
507
- timeoutInSeconds: i,
508
- initCredentials: r,
509
- extraHeaders: o
510
- }) {
511
- const n = this._logger.create("postForm"), a = {
512
- Accept: this._contentTypes.join(", "),
513
- "Content-Type": "application/x-www-form-urlencoded",
514
- ...o
515
- };
516
- s !== void 0 && (a.Authorization = "Basic " + s), this._appendExtraHeaders(a);
517
- let c;
518
- try {
519
- n.debug("url:", e), c = await this.fetchWithTimeout(e, { method: "POST", headers: a, body: t, timeoutInSeconds: i, credentials: r });
520
- } catch (u) {
521
- throw n.error("Network error"), u;
522
- }
523
- n.debug("HTTP response received, status", c.status);
524
- const l = c.headers.get("Content-Type");
525
- if (l && !this._contentTypes.find((u) => l.startsWith(u)))
526
- throw new Error(`Invalid response Content-Type: ${l ?? "undefined"}, from URL: ${e}`);
527
- const d = await c.text();
528
- let h = {};
529
- if (d)
530
- try {
531
- h = JSON.parse(d);
532
- } catch (u) {
533
- throw n.error("Error parsing JSON response", u), c.ok ? u : new Error(`${c.statusText} (${c.status})`);
534
- }
535
- if (!c.ok) {
536
- if (n.error("Error from server:", h), c.headers.has("dpop-nonce")) {
537
- const u = c.headers.get("dpop-nonce");
538
- throw new F(u, `${JSON.stringify(h)}`);
539
- }
540
- throw h.error ? new q(h, t) : new Error(`${c.statusText} (${c.status}): ${JSON.stringify(h)}`);
541
- }
542
- return h;
543
- }
544
- _appendExtraHeaders(e) {
545
- const t = this._logger.create("appendExtraHeaders"), s = Object.keys(this._extraHeaders), i = [
546
- "accept",
547
- "content-type"
548
- ], r = [
549
- "authorization"
550
- ];
551
- s.length !== 0 && s.forEach((o) => {
552
- if (i.includes(o.toLocaleLowerCase())) {
553
- t.warn("Protected header could not be set", o, i);
554
- return;
555
- }
556
- if (r.includes(o.toLocaleLowerCase()) && Object.keys(e).includes(o)) {
557
- t.warn("Header could not be overridden", o, r);
558
- return;
559
- }
560
- const n = typeof this._extraHeaders[o] == "function" ? this._extraHeaders[o]() : this._extraHeaders[o];
561
- n && n !== "" && (e[o] = n);
562
- });
563
- }
564
- }, xe = class {
565
- constructor(e) {
566
- this._settings = e, this._logger = new g("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new Q(
567
- ["application/jwk-set+json"],
568
- null,
569
- this._settings.extraHeaders
570
- ), this._settings.signingKeys && (this._logger.debug("using signingKeys from settings"), this._signingKeys = this._settings.signingKeys), this._settings.metadata && (this._logger.debug("using metadata from settings"), this._metadata = this._settings.metadata), this._settings.fetchRequestCredentials && (this._logger.debug("using fetchRequestCredentials from settings"), this._fetchRequestCredentials = this._settings.fetchRequestCredentials);
571
- }
572
- resetSigningKeys() {
573
- this._signingKeys = null;
574
- }
575
- async getMetadata() {
576
- const e = this._logger.create("getMetadata");
577
- if (this._metadata)
578
- return e.debug("using cached values"), this._metadata;
579
- if (!this._metadataUrl)
580
- throw e.throw(new Error("No authority or metadataUrl configured on settings")), null;
581
- e.debug("getting metadata from", this._metadataUrl);
582
- const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });
583
- return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, t, this._settings.metadataSeed), this._metadata;
584
- }
585
- getIssuer() {
586
- return this._getMetadataProperty("issuer");
587
- }
588
- getAuthorizationEndpoint() {
589
- return this._getMetadataProperty("authorization_endpoint");
590
- }
591
- getUserInfoEndpoint() {
592
- return this._getMetadataProperty("userinfo_endpoint");
593
- }
594
- getTokenEndpoint(e = !0) {
595
- return this._getMetadataProperty("token_endpoint", e);
596
- }
597
- getCheckSessionIframe() {
598
- return this._getMetadataProperty("check_session_iframe", !0);
599
- }
600
- getEndSessionEndpoint() {
601
- return this._getMetadataProperty("end_session_endpoint", !0);
602
- }
603
- getRevocationEndpoint(e = !0) {
604
- return this._getMetadataProperty("revocation_endpoint", e);
605
- }
606
- getKeysEndpoint(e = !0) {
607
- return this._getMetadataProperty("jwks_uri", e);
608
- }
609
- async _getMetadataProperty(e, t = !1) {
610
- const s = this._logger.create(`_getMetadataProperty('${e}')`), i = await this.getMetadata();
611
- if (s.debug("resolved"), i[e] === void 0) {
612
- if (t === !0) {
613
- s.warn("Metadata does not contain optional property");
614
- return;
615
- }
616
- s.throw(new Error("Metadata does not contain property " + e));
617
- }
618
- return i[e];
619
- }
620
- async getSigningKeys() {
621
- const e = this._logger.create("getSigningKeys");
622
- if (this._signingKeys)
623
- return e.debug("returning signingKeys from cache"), this._signingKeys;
624
- const t = await this.getKeysEndpoint(!1);
625
- e.debug("got jwks_uri", t);
626
- const s = await this._jsonService.getJson(t, { timeoutInSeconds: this._settings.requestTimeoutInSeconds });
627
- if (e.debug("got key set", s), !Array.isArray(s.keys))
628
- throw e.throw(new Error("Missing keys on keyset")), null;
629
- return this._signingKeys = s.keys, this._signingKeys;
630
- }
631
- }, ne = class {
632
- constructor({
633
- prefix: e = "oidc.",
634
- store: t = localStorage
635
- } = {}) {
636
- this._logger = new g("WebStorageStateStore"), this._store = t, this._prefix = e;
637
- }
638
- async set(e, t) {
639
- this._logger.create(`set('${e}')`), e = this._prefix + e, await this._store.setItem(e, t);
640
- }
641
- async get(e) {
642
- return this._logger.create(`get('${e}')`), e = this._prefix + e, await this._store.getItem(e);
643
- }
644
- async remove(e) {
645
- this._logger.create(`remove('${e}')`), e = this._prefix + e;
646
- const t = await this._store.getItem(e);
647
- return await this._store.removeItem(e), t;
648
- }
649
- async getAllKeys() {
650
- this._logger.create("getAllKeys");
651
- const e = await this._store.length, t = [];
652
- for (let s = 0; s < e; s++) {
653
- const i = await this._store.key(s);
654
- i && i.indexOf(this._prefix) === 0 && t.push(i.substr(this._prefix.length));
655
- }
656
- return t;
657
- }
658
- }, Ue = "code", Ae = "openid", Oe = "client_secret_post", qe = 900, z = class {
659
- constructor({
660
- // metadata related
661
- authority: e,
662
- metadataUrl: t,
663
- metadata: s,
664
- signingKeys: i,
665
- metadataSeed: r,
666
- // client related
667
- client_id: o,
668
- client_secret: n,
669
- response_type: a = Ue,
670
- scope: c = Ae,
671
- redirect_uri: l,
672
- post_logout_redirect_uri: d,
673
- client_authentication: h = Oe,
674
- token_endpoint_auth_signing_alg: u = "HS256",
675
- // optional protocol
676
- prompt: w,
677
- display: C,
678
- max_age: x,
679
- ui_locales: U,
680
- acr_values: A,
681
- resource: P,
682
- response_mode: O,
683
- // behavior flags
684
- filterProtocolClaims: R = !0,
685
- loadUserInfo: S = !1,
686
- requestTimeoutInSeconds: p,
687
- staleStateAgeInSeconds: E = qe,
688
- mergeClaimsStrategy: v = { array: "replace" },
689
- disablePKCE: f = !1,
690
- // other behavior
691
- stateStore: M,
692
- revokeTokenAdditionalContentTypes: fe,
693
- fetchRequestCredentials: X,
694
- refreshTokenAllowedScope: me,
695
- // extra
696
- extraQueryParams: Se = {},
697
- extraTokenParams: ve = {},
698
- extraHeaders: ye = {},
699
- dpop: be,
700
- omitScopeWhenRequesting: ke = !1
701
- }) {
702
- var Y;
703
- if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = o, this.client_secret = n, this.response_type = a, this.scope = c, this.redirect_uri = l, this.post_logout_redirect_uri = d, this.client_authentication = h, this.token_endpoint_auth_signing_alg = u, this.prompt = w, this.display = C, this.max_age = x, this.ui_locales = U, this.acr_values = A, this.resource = P, this.response_mode = O, this.filterProtocolClaims = R ?? !0, this.loadUserInfo = !!S, this.staleStateAgeInSeconds = E, this.mergeClaimsStrategy = v, this.omitScopeWhenRequesting = ke, this.disablePKCE = !!f, this.revokeTokenAdditionalContentTypes = fe, this.fetchRequestCredentials = X || "same-origin", this.requestTimeoutInSeconds = p, M)
704
- this.stateStore = M;
705
- else {
706
- const Ee = typeof window < "u" ? window.localStorage : new re();
707
- this.stateStore = new ne({ store: Ee });
708
- }
709
- if (this.refreshTokenAllowedScope = me, this.extraQueryParams = Se, this.extraTokenParams = ve, this.extraHeaders = ye, this.dpop = be, this.dpop && !((Y = this.dpop) != null && Y.store))
710
- throw new Error("A DPoPStore is required when dpop is enabled");
711
- }
712
- }, Ne = class {
713
- constructor(e, t) {
714
- this._settings = e, this._metadataService = t, this._logger = new g("UserInfoService"), this._getClaimsFromJwt = async (s) => {
715
- const i = this._logger.create("_getClaimsFromJwt");
716
- try {
717
- const r = H.decode(s);
718
- return i.debug("JWT decoding successful"), r;
719
- } catch (r) {
720
- throw i.error("Error parsing JWT response"), r;
721
- }
722
- }, this._jsonService = new Q(
723
- void 0,
724
- this._getClaimsFromJwt,
725
- this._settings.extraHeaders
726
- );
727
- }
728
- async getClaims(e) {
729
- const t = this._logger.create("getClaims");
730
- e || this._logger.throw(new Error("No token passed"));
731
- const s = await this._metadataService.getUserInfoEndpoint();
732
- t.debug("got userinfo url", s);
733
- const i = await this._jsonService.getJson(s, {
734
- token: e,
735
- credentials: this._settings.fetchRequestCredentials,
736
- timeoutInSeconds: this._settings.requestTimeoutInSeconds
737
- });
738
- return t.debug("got claims", i), i;
739
- }
740
- }, oe = class {
741
- constructor(e, t) {
742
- this._settings = e, this._metadataService = t, this._logger = new g("TokenClient"), this._jsonService = new Q(
743
- this._settings.revokeTokenAdditionalContentTypes,
744
- null,
745
- this._settings.extraHeaders
746
- );
747
- }
748
- /**
749
- * Exchange code.
750
- *
751
- * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3
752
- */
753
- async exchangeCode({
754
- grant_type: e = "authorization_code",
755
- redirect_uri: t = this._settings.redirect_uri,
756
- client_id: s = this._settings.client_id,
757
- client_secret: i = this._settings.client_secret,
758
- extraHeaders: r,
759
- ...o
760
- }) {
761
- const n = this._logger.create("exchangeCode");
762
- s || n.throw(new Error("A client_id is required")), t || n.throw(new Error("A redirect_uri is required")), o.code || n.throw(new Error("A code is required"));
763
- const a = new URLSearchParams({ grant_type: e, redirect_uri: t });
764
- for (const [h, u] of Object.entries(o))
765
- u != null && a.set(h, u);
766
- if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && i == null)
767
- throw n.throw(new Error("A client_secret is required")), null;
768
- let c;
769
- const l = await this._metadataService.getTokenEndpoint(!1);
770
- switch (this._settings.client_authentication) {
771
- case "client_secret_basic":
772
- c = _.generateBasicAuth(s, i);
773
- break;
774
- case "client_secret_post":
775
- a.append("client_id", s), i && a.append("client_secret", i);
776
- break;
777
- case "client_secret_jwt": {
778
- const h = await _.generateClientAssertionJwt(s, i, l, this._settings.token_endpoint_auth_signing_alg);
779
- a.append("client_id", s), a.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), a.append("client_assertion", h);
780
- break;
781
- }
782
- }
783
- n.debug("got token endpoint");
784
- const d = await this._jsonService.postForm(l, {
785
- body: a,
786
- basicAuth: c,
787
- timeoutInSeconds: this._settings.requestTimeoutInSeconds,
788
- initCredentials: this._settings.fetchRequestCredentials,
789
- extraHeaders: r
790
- });
791
- return n.debug("got response"), d;
792
- }
793
- /**
794
- * Exchange credentials.
795
- *
796
- * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.3.2
797
- */
798
- async exchangeCredentials({
799
- grant_type: e = "password",
800
- client_id: t = this._settings.client_id,
801
- client_secret: s = this._settings.client_secret,
802
- scope: i = this._settings.scope,
803
- ...r
804
- }) {
805
- const o = this._logger.create("exchangeCredentials");
806
- t || o.throw(new Error("A client_id is required"));
807
- const n = new URLSearchParams({ grant_type: e });
808
- this._settings.omitScopeWhenRequesting || n.set("scope", i);
809
- for (const [d, h] of Object.entries(r))
810
- h != null && n.set(d, h);
811
- if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && s == null)
812
- throw o.throw(new Error("A client_secret is required")), null;
813
- let a;
814
- const c = await this._metadataService.getTokenEndpoint(!1);
815
- switch (this._settings.client_authentication) {
816
- case "client_secret_basic":
817
- a = _.generateBasicAuth(t, s);
818
- break;
819
- case "client_secret_post":
820
- n.append("client_id", t), s && n.append("client_secret", s);
821
- break;
822
- case "client_secret_jwt": {
823
- const d = await _.generateClientAssertionJwt(t, s, c, this._settings.token_endpoint_auth_signing_alg);
824
- n.append("client_id", t), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", d);
825
- break;
826
- }
827
- }
828
- o.debug("got token endpoint");
829
- const l = await this._jsonService.postForm(c, { body: n, basicAuth: a, timeoutInSeconds: this._settings.requestTimeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials });
830
- return o.debug("got response"), l;
831
- }
832
- /**
833
- * Exchange a refresh token.
834
- *
835
- * @see https://www.rfc-editor.org/rfc/rfc6749#section-6
836
- */
837
- async exchangeRefreshToken({
838
- grant_type: e = "refresh_token",
839
- client_id: t = this._settings.client_id,
840
- client_secret: s = this._settings.client_secret,
841
- timeoutInSeconds: i,
842
- extraHeaders: r,
843
- ...o
844
- }) {
845
- const n = this._logger.create("exchangeRefreshToken");
846
- t || n.throw(new Error("A client_id is required")), o.refresh_token || n.throw(new Error("A refresh_token is required"));
847
- const a = new URLSearchParams({ grant_type: e });
848
- for (const [h, u] of Object.entries(o))
849
- Array.isArray(u) ? u.forEach((w) => a.append(h, w)) : u != null && a.set(h, u);
850
- if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && s == null)
851
- throw n.throw(new Error("A client_secret is required")), null;
852
- let c;
853
- const l = await this._metadataService.getTokenEndpoint(!1);
854
- switch (this._settings.client_authentication) {
855
- case "client_secret_basic":
856
- c = _.generateBasicAuth(t, s);
857
- break;
858
- case "client_secret_post":
859
- a.append("client_id", t), s && a.append("client_secret", s);
860
- break;
861
- case "client_secret_jwt": {
862
- const h = await _.generateClientAssertionJwt(t, s, l, this._settings.token_endpoint_auth_signing_alg);
863
- a.append("client_id", t), a.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), a.append("client_assertion", h);
864
- break;
865
- }
866
- }
867
- n.debug("got token endpoint");
868
- const d = await this._jsonService.postForm(l, { body: a, basicAuth: c, timeoutInSeconds: i, initCredentials: this._settings.fetchRequestCredentials, extraHeaders: r });
869
- return n.debug("got response"), d;
870
- }
871
- /**
872
- * Revoke an access or refresh token.
873
- *
874
- * @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.1
875
- */
876
- async revoke(e) {
877
- var t;
878
- const s = this._logger.create("revoke");
879
- e.token || s.throw(new Error("A token is required"));
880
- const i = await this._metadataService.getRevocationEndpoint(!1);
881
- s.debug(`got revocation endpoint, revoking ${(t = e.token_type_hint) != null ? t : "default token type"}`);
882
- const r = new URLSearchParams();
883
- for (const [o, n] of Object.entries(e))
884
- n != null && r.set(o, n);
885
- r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r, timeoutInSeconds: this._settings.requestTimeoutInSeconds }), s.debug("got response");
886
- }
887
- }, Me = class {
888
- constructor(e, t, s) {
889
- this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new g("ResponseValidator"), this._userInfoService = new Ne(this._settings, this._metadataService), this._tokenClient = new oe(this._settings, this._metadataService);
890
- }
891
- async validateSigninResponse(e, t, s) {
892
- const i = this._logger.create("validateSigninResponse");
893
- this._processSigninState(e, t), i.debug("state processed"), await this._processCode(e, t, s), i.debug("code processed"), e.isOpenId && this._validateIdTokenAttributes(e), i.debug("tokens validated"), await this._processClaims(e, t == null ? void 0 : t.skipUserInfo, e.isOpenId), i.debug("claims processed");
894
- }
895
- async validateCredentialsResponse(e, t) {
896
- const s = this._logger.create("validateCredentialsResponse"), i = e.isOpenId && !!e.id_token;
897
- i && this._validateIdTokenAttributes(e), s.debug("tokens validated"), await this._processClaims(e, t, i), s.debug("claims processed");
898
- }
899
- async validateRefreshResponse(e, t) {
900
- var s, i;
901
- const r = this._logger.create("validateRefreshResponse");
902
- e.userState = t.data, (s = e.session_state) != null || (e.session_state = t.session_state), (i = e.scope) != null || (e.scope = t.scope), e.isOpenId && e.id_token && (this._validateIdTokenAttributes(e, t.id_token), r.debug("ID Token validated")), e.id_token || (e.id_token = t.id_token, e.profile = t.profile);
903
- const o = e.isOpenId && !!e.id_token;
904
- await this._processClaims(e, !1, o), r.debug("claims processed");
905
- }
906
- validateSignoutResponse(e, t) {
907
- const s = this._logger.create("validateSignoutResponse");
908
- if (t.id !== e.state && s.throw(new Error("State does not match")), s.debug("state validated"), e.userState = t.data, e.error)
909
- throw s.warn("Response was error", e.error), new q(e);
910
- }
911
- _processSigninState(e, t) {
912
- var s;
913
- const i = this._logger.create("_processSigninState");
914
- if (t.id !== e.state && i.throw(new Error("State does not match")), t.client_id || i.throw(new Error("No client_id on state")), t.authority || i.throw(new Error("No authority on state")), this._settings.authority !== t.authority && i.throw(new Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && i.throw(new Error("client_id mismatch on settings vs. signin state")), i.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, (s = e.scope) != null || (e.scope = t.scope), e.error)
915
- throw i.warn("Response was error", e.error), new q(e);
916
- t.code_verifier && !e.code && i.throw(new Error("Expected code in response"));
917
- }
918
- async _processClaims(e, t = !1, s = !0) {
919
- const i = this._logger.create("_processClaims");
920
- if (e.profile = this._claimsService.filterProtocolClaims(e.profile), t || !this._settings.loadUserInfo || !e.access_token) {
921
- i.debug("not loading user info");
922
- return;
923
- }
924
- i.debug("loading user info");
925
- const r = await this._userInfoService.getClaims(e.access_token);
926
- i.debug("user info claims received from user info endpoint"), s && r.sub !== e.profile.sub && i.throw(new Error("subject from UserInfo response does not match subject in ID Token")), e.profile = this._claimsService.mergeClaims(e.profile, this._claimsService.filterProtocolClaims(r)), i.debug("user info claims received, updated profile:", e.profile);
927
- }
928
- async _processCode(e, t, s) {
929
- const i = this._logger.create("_processCode");
930
- if (e.code) {
931
- i.debug("Validating code");
932
- const r = await this._tokenClient.exchangeCode({
933
- client_id: t.client_id,
934
- client_secret: t.client_secret,
935
- code: e.code,
936
- redirect_uri: t.redirect_uri,
937
- code_verifier: t.code_verifier,
938
- extraHeaders: s,
939
- ...t.extraTokenParams
13
+ "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
14
+ "Immer forbids circular references",
15
+ "The first or second argument to `produce` must be a function",
16
+ "The third argument to `produce` must be a function or undefined",
17
+ "First argument to `createDraft` must be a plain object, an array, or an immerable object",
18
+ "First argument to `finishDraft` must be a draft returned by `createDraft`",
19
+ function(e) {
20
+ return `'current' expects a draft, got: ${e}`;
21
+ },
22
+ "Object.defineProperty() cannot be used on an Immer draft",
23
+ "Object.setPrototypeOf() cannot be used on an Immer draft",
24
+ "Immer only supports deleting array indices",
25
+ "Immer only supports setting array indices and the 'length' property",
26
+ function(e) {
27
+ return `'original' expects a draft, got: ${e}`;
28
+ }
29
+ // Note: if more errors are added, the errorOffset in Patches.ts should be increased
30
+ // See Patches.ts for additional errors
31
+ ] : [];
32
+ function f(e, ...t) {
33
+ if (process.env.NODE_ENV !== "production") {
34
+ const r = Y[e], n = typeof r == "function" ? r.apply(null, t) : r;
35
+ throw new Error(`[Immer] ${n}`);
36
+ }
37
+ throw new Error(
38
+ `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
39
+ );
40
+ }
41
+ var h = Object.getPrototypeOf;
42
+ function m(e) {
43
+ return !!e && !!e[u];
44
+ }
45
+ function _(e) {
46
+ var t;
47
+ return e ? G(e) || Array.isArray(e) || !!e[R] || !!((t = e.constructor) != null && t[R]) || b(e) || v(e) : !1;
48
+ }
49
+ var Z = Object.prototype.constructor.toString(), x = /* @__PURE__ */ new WeakMap();
50
+ function G(e) {
51
+ if (!e || typeof e != "object")
52
+ return !1;
53
+ const t = Object.getPrototypeOf(e);
54
+ if (t === null || t === Object.prototype)
55
+ return !0;
56
+ const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
57
+ if (r === Object)
58
+ return !0;
59
+ if (typeof r != "function")
60
+ return !1;
61
+ let n = x.get(r);
62
+ return n === void 0 && (n = Function.toString.call(r), x.set(r, n)), n === Z;
63
+ }
64
+ function z(e, t, r = !0) {
65
+ S(e) === 0 ? (r ? Reflect.ownKeys(e) : Object.keys(e)).forEach((i) => {
66
+ t(i, e[i], e);
67
+ }) : e.forEach((n, i) => t(i, n, e));
68
+ }
69
+ function S(e) {
70
+ const t = e[u];
71
+ return t ? t.type_ : Array.isArray(e) ? 1 : b(e) ? 2 : v(e) ? 3 : 0;
72
+ }
73
+ function E(e, t) {
74
+ return S(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
75
+ }
76
+ function H(e, t, r) {
77
+ const n = S(e);
78
+ n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
79
+ }
80
+ function L(e, t) {
81
+ return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
82
+ }
83
+ function b(e) {
84
+ return e instanceof Map;
85
+ }
86
+ function v(e) {
87
+ return e instanceof Set;
88
+ }
89
+ function l(e) {
90
+ return e.copy_ || e.base_;
91
+ }
92
+ function N(e, t) {
93
+ if (b(e))
94
+ return new Map(e);
95
+ if (v(e))
96
+ return new Set(e);
97
+ if (Array.isArray(e))
98
+ return Array.prototype.slice.call(e);
99
+ const r = G(e);
100
+ if (t === !0 || t === "class_only" && !r) {
101
+ const n = Object.getOwnPropertyDescriptors(e);
102
+ delete n[u];
103
+ let i = Reflect.ownKeys(n);
104
+ for (let o = 0; o < i.length; o++) {
105
+ const s = i[o], c = n[s];
106
+ c.writable === !1 && (c.writable = !0, c.configurable = !0), (c.get || c.set) && (n[s] = {
107
+ configurable: !0,
108
+ writable: !0,
109
+ // could live with !!desc.set as well here...
110
+ enumerable: c.enumerable,
111
+ value: e[s]
940
112
  });
941
- Object.assign(e, r);
942
- } else
943
- i.debug("No code to process");
944
- }
945
- _validateIdTokenAttributes(e, t) {
946
- var s;
947
- const i = this._logger.create("_validateIdTokenAttributes");
948
- i.debug("decoding ID Token JWT");
949
- const r = H.decode((s = e.id_token) != null ? s : "");
950
- if (r.sub || i.throw(new Error("ID Token is missing a subject claim")), t) {
951
- const o = H.decode(t);
952
- r.sub !== o.sub && i.throw(new Error("sub in id_token does not match current sub")), r.auth_time && r.auth_time !== o.auth_time && i.throw(new Error("auth_time in id_token does not match original auth_time")), r.azp && r.azp !== o.azp && i.throw(new Error("azp in id_token does not match original azp")), !r.azp && o.azp && i.throw(new Error("azp not in id_token, but present in original id_token"));
953
- }
954
- e.profile = r;
955
- }
956
- }, $ = class B {
957
- constructor(t) {
958
- this.id = t.id || _.generateUUIDv4(), this.data = t.data, t.created && t.created > 0 ? this.created = t.created : this.created = T.getEpochTime(), this.request_type = t.request_type, this.url_state = t.url_state;
959
- }
960
- toStorageString() {
961
- return new g("State").create("toStorageString"), JSON.stringify({
962
- id: this.id,
963
- data: this.data,
964
- created: this.created,
965
- request_type: this.request_type,
966
- url_state: this.url_state
967
- });
968
- }
969
- static fromStorageString(t) {
970
- return g.createStatic("State", "fromStorageString"), Promise.resolve(new B(JSON.parse(t)));
971
- }
972
- static async clearStaleState(t, s) {
973
- const i = g.createStatic("State", "clearStaleState"), r = T.getEpochTime() - s, o = await t.getAllKeys();
974
- i.debug("got keys", o);
975
- for (let n = 0; n < o.length; n++) {
976
- const a = o[n], c = await t.get(a);
977
- let l = !1;
978
- if (c)
979
- try {
980
- const d = await B.fromStorageString(c);
981
- i.debug("got item from key:", a, d.created), d.created <= r && (l = !0);
982
- } catch (d) {
983
- i.error("Error parsing state for key:", a, d), l = !0;
984
- }
985
- else
986
- i.debug("no item in storage for key:", a), l = !0;
987
- l && (i.debug("removed item for key:", a), t.remove(a));
988
113
  }
989
- }
990
- }, ae = class V extends $ {
991
- constructor(t) {
992
- super(t), this.code_verifier = t.code_verifier, this.code_challenge = t.code_challenge, this.authority = t.authority, this.client_id = t.client_id, this.redirect_uri = t.redirect_uri, this.scope = t.scope, this.client_secret = t.client_secret, this.extraTokenParams = t.extraTokenParams, this.response_mode = t.response_mode, this.skipUserInfo = t.skipUserInfo;
993
- }
994
- static async create(t) {
995
- const s = t.code_verifier === !0 ? _.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await _.generateCodeChallenge(s) : void 0;
996
- return new V({
997
- ...t,
998
- code_verifier: s,
999
- code_challenge: i
1000
- });
1001
- }
1002
- toStorageString() {
1003
- return new g("SigninState").create("toStorageString"), JSON.stringify({
1004
- id: this.id,
1005
- data: this.data,
1006
- created: this.created,
1007
- request_type: this.request_type,
1008
- url_state: this.url_state,
1009
- code_verifier: this.code_verifier,
1010
- authority: this.authority,
1011
- client_id: this.client_id,
1012
- redirect_uri: this.redirect_uri,
1013
- scope: this.scope,
1014
- client_secret: this.client_secret,
1015
- extraTokenParams: this.extraTokenParams,
1016
- response_mode: this.response_mode,
1017
- skipUserInfo: this.skipUserInfo
1018
- });
1019
- }
1020
- static fromStorageString(t) {
1021
- g.createStatic("SigninState", "fromStorageString");
1022
- const s = JSON.parse(t);
1023
- return V.create(s);
1024
- }
1025
- }, ce = class le {
1026
- constructor(t) {
1027
- this.url = t.url, this.state = t.state;
1028
- }
1029
- static async create({
1030
- // mandatory
1031
- url: t,
1032
- authority: s,
1033
- client_id: i,
1034
- redirect_uri: r,
1035
- response_type: o,
1036
- scope: n,
1037
- // optional
1038
- state_data: a,
1039
- response_mode: c,
1040
- request_type: l,
1041
- client_secret: d,
1042
- nonce: h,
1043
- url_state: u,
1044
- resource: w,
1045
- skipUserInfo: C,
1046
- extraQueryParams: x,
1047
- extraTokenParams: U,
1048
- disablePKCE: A,
1049
- dpopJkt: P,
1050
- omitScopeWhenRequesting: O,
1051
- ...R
1052
- }) {
1053
- if (!t)
1054
- throw this._logger.error("create: No url passed"), new Error("url");
1055
- if (!i)
1056
- throw this._logger.error("create: No client_id passed"), new Error("client_id");
1057
- if (!r)
1058
- throw this._logger.error("create: No redirect_uri passed"), new Error("redirect_uri");
1059
- if (!o)
1060
- throw this._logger.error("create: No response_type passed"), new Error("response_type");
1061
- if (!n)
1062
- throw this._logger.error("create: No scope passed"), new Error("scope");
1063
- if (!s)
1064
- throw this._logger.error("create: No authority passed"), new Error("authority");
1065
- const S = await ae.create({
1066
- data: a,
1067
- request_type: l,
1068
- url_state: u,
1069
- code_verifier: !A,
1070
- client_id: i,
1071
- authority: s,
1072
- redirect_uri: r,
1073
- response_mode: c,
1074
- client_secret: d,
1075
- scope: n,
1076
- extraTokenParams: U,
1077
- skipUserInfo: C
1078
- }), p = new URL(t);
1079
- p.searchParams.append("client_id", i), p.searchParams.append("redirect_uri", r), p.searchParams.append("response_type", o), O || p.searchParams.append("scope", n), h && p.searchParams.append("nonce", h), P && p.searchParams.append("dpop_jkt", P);
1080
- let E = S.id;
1081
- u && (E = `${E}${N}${u}`), p.searchParams.append("state", E), S.code_challenge && (p.searchParams.append("code_challenge", S.code_challenge), p.searchParams.append("code_challenge_method", "S256")), w && (Array.isArray(w) ? w : [w]).forEach((f) => p.searchParams.append("resource", f));
1082
- for (const [v, f] of Object.entries({ response_mode: c, ...R, ...x }))
1083
- f != null && p.searchParams.append(v, f.toString());
1084
- return new le({
1085
- url: p.href,
1086
- state: S
1087
- });
1088
- }
114
+ return Object.create(h(e), n);
115
+ } else {
116
+ const n = h(e);
117
+ if (n !== null && r)
118
+ return { ...e };
119
+ const i = Object.create(n);
120
+ return Object.assign(i, e);
121
+ }
122
+ }
123
+ function j(e, t = !1) {
124
+ return I(e) || m(e) || !_(e) || (S(e) > 1 && Object.defineProperties(e, {
125
+ set: w,
126
+ add: w,
127
+ clear: w,
128
+ delete: w
129
+ }), Object.freeze(e), t && Object.values(e).forEach((r) => j(r, !0))), e;
130
+ }
131
+ function V() {
132
+ f(2);
133
+ }
134
+ var w = {
135
+ value: V
1089
136
  };
1090
- ce._logger = new g("SigninRequest");
1091
- var He = ce, je = "openid", J = class {
1092
- constructor(e) {
1093
- if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
1094
- const t = decodeURIComponent(this.state).split(N);
1095
- this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(N));
1096
- }
1097
- this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
1098
- }
1099
- get expires_in() {
1100
- if (this.expires_at !== void 0)
1101
- return this.expires_at - T.getEpochTime();
1102
- }
1103
- set expires_in(e) {
1104
- typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) + T.getEpochTime());
1105
- }
1106
- get isOpenId() {
1107
- var e;
1108
- return ((e = this.scope) == null ? void 0 : e.split(" ").includes(je)) || !!this.id_token;
1109
- }
1110
- }, De = class {
1111
- constructor({
1112
- url: e,
1113
- state_data: t,
1114
- id_token_hint: s,
1115
- post_logout_redirect_uri: i,
1116
- extraQueryParams: r,
1117
- request_type: o,
1118
- client_id: n,
1119
- url_state: a
1120
- }) {
1121
- if (this._logger = new g("SignoutRequest"), !e)
1122
- throw this._logger.error("ctor: No url passed"), new Error("url");
1123
- const c = new URL(e);
1124
- if (s && c.searchParams.append("id_token_hint", s), n && c.searchParams.append("client_id", n), i && (c.searchParams.append("post_logout_redirect_uri", i), t || a)) {
1125
- this.state = new $({ data: t, request_type: o, url_state: a });
1126
- let l = this.state.id;
1127
- a && (l = `${l}${N}${a}`), c.searchParams.append("state", l);
1128
- }
1129
- for (const [l, d] of Object.entries({ ...r }))
1130
- d != null && c.searchParams.append(l, d.toString());
1131
- this.url = c.href;
1132
- }
1133
- }, $e = class {
1134
- constructor(e) {
1135
- if (this.state = e.get("state"), this.state) {
1136
- const t = decodeURIComponent(this.state).split(N);
1137
- this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(N));
1138
- }
1139
- this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
1140
- }
1141
- }, Je = [
1142
- "nbf",
1143
- "jti",
1144
- "auth_time",
1145
- "nonce",
1146
- "acr",
1147
- "amr",
1148
- "azp",
1149
- "at_hash"
1150
- // https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
1151
- ], We = ["sub", "iss", "aud", "exp", "iat"], Ke = class {
1152
- constructor(e) {
1153
- this._settings = e, this._logger = new g("ClaimsService");
1154
- }
1155
- filterProtocolClaims(e) {
1156
- const t = { ...e };
1157
- if (this._settings.filterProtocolClaims) {
1158
- let s;
1159
- Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s = Je;
1160
- for (const i of s)
1161
- We.includes(i) || delete t[i];
1162
- }
137
+ function I(e) {
138
+ return e === null || typeof e != "object" ? !0 : Object.isFrozen(e);
139
+ }
140
+ var ee = {};
141
+ function d(e) {
142
+ const t = ee[e];
143
+ return t || f(0, e), t;
144
+ }
145
+ var p;
146
+ function X() {
147
+ return p;
148
+ }
149
+ function te(e, t) {
150
+ return {
151
+ drafts_: [],
152
+ parent_: e,
153
+ immer_: t,
154
+ // Whenever the modified draft contains a draft from another scope, we
155
+ // need to prevent auto-freezing so the unowned draft can be finalized.
156
+ canAutoFreeze_: !0,
157
+ unfinalizedDrafts_: 0
158
+ };
159
+ }
160
+ function U(e, t) {
161
+ t && (d("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
162
+ }
163
+ function A(e) {
164
+ k(e), e.drafts_.forEach(re), e.drafts_ = null;
165
+ }
166
+ function k(e) {
167
+ e === p && (p = e.parent_);
168
+ }
169
+ function $(e) {
170
+ return p = te(p, e);
171
+ }
172
+ function re(e) {
173
+ const t = e[u];
174
+ t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
175
+ }
176
+ function K(e, t) {
177
+ t.unfinalizedDrafts_ = t.drafts_.length;
178
+ const r = t.drafts_[0];
179
+ return e !== void 0 && e !== r ? (r[u].modified_ && (A(t), f(4)), _(e) && (e = O(t, e), t.parent_ || g(t, e)), t.patches_ && d("Patches").generateReplacementPatches_(
180
+ r[u].base_,
181
+ e,
182
+ t.patches_,
183
+ t.inversePatches_
184
+ )) : e = O(t, r, []), A(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== B ? e : void 0;
185
+ }
186
+ function O(e, t, r) {
187
+ if (I(t))
1163
188
  return t;
189
+ const n = e.immer_.shouldUseStrictIteration(), i = t[u];
190
+ if (!i)
191
+ return z(
192
+ t,
193
+ (o, s) => W(e, i, t, o, s, r),
194
+ n
195
+ ), t;
196
+ if (i.scope_ !== e)
197
+ return t;
198
+ if (!i.modified_)
199
+ return g(e, i.base_, !0), i.base_;
200
+ if (!i.finalized_) {
201
+ i.finalized_ = !0, i.scope_.unfinalizedDrafts_--;
202
+ const o = i.copy_;
203
+ let s = o, c = !1;
204
+ i.type_ === 3 && (s = new Set(o), o.clear(), c = !0), z(
205
+ s,
206
+ (a, y) => W(
207
+ e,
208
+ i,
209
+ o,
210
+ a,
211
+ y,
212
+ r,
213
+ c
214
+ ),
215
+ n
216
+ ), g(e, o, !1), r && e.patches_ && d("Patches").generatePatches_(
217
+ i,
218
+ r,
219
+ e.patches_,
220
+ e.inversePatches_
221
+ );
1164
222
  }
1165
- mergeClaims(e, t) {
1166
- const s = { ...e };
1167
- for (const [i, r] of Object.entries(t))
1168
- if (s[i] !== r)
1169
- if (Array.isArray(s[i]) || Array.isArray(r))
1170
- if (this._settings.mergeClaimsStrategy.array == "replace")
1171
- s[i] = r;
1172
- else {
1173
- const o = Array.isArray(s[i]) ? s[i] : [s[i]];
1174
- for (const n of Array.isArray(r) ? r : [r])
1175
- o.includes(n) || o.push(n);
1176
- s[i] = o;
1177
- }
1178
- else typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
1179
- return s;
1180
- }
1181
- }, de = class {
1182
- constructor(e, t) {
1183
- this.keys = e, this.nonce = t;
1184
- }
1185
- }, Le = class {
1186
- constructor(e, t) {
1187
- this._logger = new g("OidcClient"), this.settings = e instanceof z ? e : new z(e), this.metadataService = t ?? new xe(this.settings), this._claimsService = new Ke(this.settings), this._validator = new Me(this.settings, this.metadataService, this._claimsService), this._tokenClient = new oe(this.settings, this.metadataService);
1188
- }
1189
- async createSigninRequest({
1190
- state: e,
1191
- request: t,
1192
- request_uri: s,
1193
- request_type: i,
1194
- id_token_hint: r,
1195
- login_hint: o,
1196
- skipUserInfo: n,
1197
- nonce: a,
1198
- url_state: c,
1199
- response_type: l = this.settings.response_type,
1200
- scope: d = this.settings.scope,
1201
- redirect_uri: h = this.settings.redirect_uri,
1202
- prompt: u = this.settings.prompt,
1203
- display: w = this.settings.display,
1204
- max_age: C = this.settings.max_age,
1205
- ui_locales: x = this.settings.ui_locales,
1206
- acr_values: U = this.settings.acr_values,
1207
- resource: A = this.settings.resource,
1208
- response_mode: P = this.settings.response_mode,
1209
- extraQueryParams: O = this.settings.extraQueryParams,
1210
- extraTokenParams: R = this.settings.extraTokenParams,
1211
- dpopJkt: S,
1212
- omitScopeWhenRequesting: p = this.settings.omitScopeWhenRequesting
1213
- }) {
1214
- const E = this._logger.create("createSigninRequest");
1215
- if (l !== "code")
1216
- throw new Error("Only the Authorization Code flow (with PKCE) is supported");
1217
- const v = await this.metadataService.getAuthorizationEndpoint();
1218
- E.debug("Received authorization endpoint", v);
1219
- const f = await He.create({
1220
- url: v,
1221
- authority: this.settings.authority,
1222
- client_id: this.settings.client_id,
1223
- redirect_uri: h,
1224
- response_type: l,
1225
- scope: d,
1226
- state_data: e,
1227
- url_state: c,
1228
- prompt: u,
1229
- display: w,
1230
- max_age: C,
1231
- ui_locales: x,
1232
- id_token_hint: r,
1233
- login_hint: o,
1234
- acr_values: U,
1235
- dpopJkt: S,
1236
- resource: A,
1237
- request: t,
1238
- request_uri: s,
1239
- extraQueryParams: O,
1240
- extraTokenParams: R,
1241
- request_type: i,
1242
- response_mode: P,
1243
- client_secret: this.settings.client_secret,
1244
- skipUserInfo: n,
1245
- nonce: a,
1246
- disablePKCE: this.settings.disablePKCE,
1247
- omitScopeWhenRequesting: p
1248
- });
1249
- await this.clearStaleState();
1250
- const M = f.state;
1251
- return await this.settings.stateStore.set(M.id, M.toStorageString()), f;
1252
- }
1253
- async readSigninResponseState(e, t = !1) {
1254
- const s = this._logger.create("readSigninResponseState"), i = new J(L.readParams(e, this.settings.response_mode));
1255
- if (!i.state)
1256
- throw s.throw(new Error("No state in response")), null;
1257
- const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
1258
- if (!r)
1259
- throw s.throw(new Error("No matching state found in storage")), null;
1260
- return { state: await ae.fromStorageString(r), response: i };
1261
- }
1262
- async processSigninResponse(e, t, s = !0) {
1263
- const i = this._logger.create("processSigninResponse"), { state: r, response: o } = await this.readSigninResponseState(e, s);
1264
- if (i.debug("received state from storage; validating response"), this.settings.dpop && this.settings.dpop.store) {
1265
- const n = await this.getDpopProof(this.settings.dpop.store);
1266
- t = { ...t, DPoP: n };
1267
- }
1268
- try {
1269
- await this._validator.validateSigninResponse(o, r, t);
1270
- } catch (n) {
1271
- if (n instanceof F && this.settings.dpop) {
1272
- const a = await this.getDpopProof(this.settings.dpop.store, n.nonce);
1273
- t.DPoP = a, await this._validator.validateSigninResponse(o, r, t);
1274
- } else
1275
- throw n;
1276
- }
1277
- return o;
1278
- }
1279
- async getDpopProof(e, t) {
1280
- let s, i;
1281
- return (await e.getAllKeys()).includes(this.settings.client_id) ? (i = await e.get(this.settings.client_id), i.nonce !== t && t && (i.nonce = t, await e.set(this.settings.client_id, i))) : (s = await _.generateDPoPKeys(), i = new de(s, t), await e.set(this.settings.client_id, i)), await _.generateDPoPProof({
1282
- url: await this.metadataService.getTokenEndpoint(!1),
1283
- httpMethod: "POST",
1284
- keyPair: i.keys,
1285
- nonce: i.nonce
1286
- });
1287
- }
1288
- async processResourceOwnerPasswordCredentials({
1289
- username: e,
1290
- password: t,
1291
- skipUserInfo: s = !1,
1292
- extraTokenParams: i = {}
1293
- }) {
1294
- const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), o = new J(new URLSearchParams());
1295
- return Object.assign(o, r), await this._validator.validateCredentialsResponse(o, s), o;
1296
- }
1297
- async useRefreshToken({
1298
- state: e,
1299
- redirect_uri: t,
1300
- resource: s,
1301
- timeoutInSeconds: i,
1302
- extraHeaders: r,
1303
- extraTokenParams: o
1304
- }) {
1305
- var n;
1306
- const a = this._logger.create("useRefreshToken");
1307
- let c;
1308
- if (this.settings.refreshTokenAllowedScope === void 0)
1309
- c = e.scope;
1310
- else {
1311
- const h = this.settings.refreshTokenAllowedScope.split(" ");
1312
- c = (((n = e.scope) == null ? void 0 : n.split(" ")) || []).filter((w) => h.includes(w)).join(" ");
1313
- }
1314
- if (this.settings.dpop && this.settings.dpop.store) {
1315
- const h = await this.getDpopProof(this.settings.dpop.store);
1316
- r = { ...r, DPoP: h };
1317
- }
1318
- let l;
1319
- try {
1320
- l = await this._tokenClient.exchangeRefreshToken({
1321
- refresh_token: e.refresh_token,
1322
- // provide the (possible filtered) scope list
1323
- scope: c,
1324
- redirect_uri: t,
1325
- resource: s,
1326
- timeoutInSeconds: i,
1327
- extraHeaders: r,
1328
- ...o
1329
- });
1330
- } catch (h) {
1331
- if (h instanceof F && this.settings.dpop)
1332
- r.DPoP = await this.getDpopProof(this.settings.dpop.store, h.nonce), l = await this._tokenClient.exchangeRefreshToken({
1333
- refresh_token: e.refresh_token,
1334
- // provide the (possible filtered) scope list
1335
- scope: c,
1336
- redirect_uri: t,
1337
- resource: s,
1338
- timeoutInSeconds: i,
1339
- extraHeaders: r,
1340
- ...o
1341
- });
223
+ return i.copy_;
224
+ }
225
+ function W(e, t, r, n, i, o, s) {
226
+ if (i == null || typeof i != "object" && !s)
227
+ return;
228
+ const c = I(i);
229
+ if (!(c && !s)) {
230
+ if (process.env.NODE_ENV !== "production" && i === r && f(5), m(i)) {
231
+ const a = o && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
232
+ !E(t.assigned_, n) ? o.concat(n) : void 0, y = O(e, i, a);
233
+ if (H(r, n, y), m(y))
234
+ e.canAutoFreeze_ = !1;
1342
235
  else
1343
- throw h;
1344
- }
1345
- const d = new J(new URLSearchParams());
1346
- return Object.assign(d, l), a.debug("validating response", d), await this._validator.validateRefreshResponse(d, {
1347
- ...e,
1348
- // override the scope in the state handed over to the validator
1349
- // so it can set the granted scope to the requested scope in case none is included in the response
1350
- scope: c
1351
- }), d;
1352
- }
1353
- async createSignoutRequest({
1354
- state: e,
1355
- id_token_hint: t,
1356
- client_id: s,
1357
- request_type: i,
1358
- url_state: r,
1359
- post_logout_redirect_uri: o = this.settings.post_logout_redirect_uri,
1360
- extraQueryParams: n = this.settings.extraQueryParams
1361
- } = {}) {
1362
- const a = this._logger.create("createSignoutRequest"), c = await this.metadataService.getEndSessionEndpoint();
1363
- if (!c)
1364
- throw a.throw(new Error("No end session endpoint")), null;
1365
- a.debug("Received end session endpoint", c), !s && o && !t && (s = this.settings.client_id);
1366
- const l = new De({
1367
- url: c,
1368
- id_token_hint: t,
1369
- client_id: s,
1370
- post_logout_redirect_uri: o,
1371
- state_data: e,
1372
- extraQueryParams: n,
1373
- request_type: i,
1374
- url_state: r
1375
- });
1376
- await this.clearStaleState();
1377
- const d = l.state;
1378
- return d && (a.debug("Signout request has state to persist"), await this.settings.stateStore.set(d.id, d.toStorageString())), l;
1379
- }
1380
- async readSignoutResponseState(e, t = !1) {
1381
- const s = this._logger.create("readSignoutResponseState"), i = new $e(L.readParams(e, this.settings.response_mode));
1382
- if (!i.state) {
1383
- if (s.debug("No state in response"), i.error)
1384
- throw s.warn("Response was error:", i.error), new q(i);
1385
- return { state: void 0, response: i };
1386
- }
1387
- const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
1388
- if (!r)
1389
- throw s.throw(new Error("No matching state found in storage")), null;
1390
- return { state: await $.fromStorageString(r), response: i };
1391
- }
1392
- async processSignoutResponse(e) {
1393
- const t = this._logger.create("processSignoutResponse"), { state: s, response: i } = await this.readSignoutResponseState(e, !0);
1394
- return s ? (t.debug("Received state from storage; validating response"), this._validator.validateSignoutResponse(i, s)) : t.debug("No state from storage; skipping response validation"), i;
1395
- }
1396
- clearStaleState() {
1397
- return this._logger.create("clearStaleState"), $.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
1398
- }
1399
- async revokeToken(e, t) {
1400
- return this._logger.create("revokeToken"), await this._tokenClient.revoke({
1401
- token: e,
1402
- token_type_hint: t
1403
- });
1404
- }
1405
- }, Fe = class {
1406
- constructor(e) {
1407
- this._userManager = e, this._logger = new g("SessionMonitor"), this._start = async (t) => {
1408
- const s = t.session_state;
1409
- if (!s)
1410
236
  return;
1411
- const i = this._logger.create("_start");
1412
- if (t.profile ? (this._sub = t.profile.sub, i.debug("session_state", s, ", sub", this._sub)) : (this._sub = void 0, i.debug("session_state", s, ", anonymous user")), this._checkSessionIFrame) {
1413
- this._checkSessionIFrame.start(s);
237
+ } else s && r.add(i);
238
+ if (_(i) && !c) {
239
+ if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1 || t && t.base_ && t.base_[n] === i && c)
1414
240
  return;
1415
- }
1416
- try {
1417
- const r = await this._userManager.metadataService.getCheckSessionIframe();
1418
- if (r) {
1419
- i.debug("initializing check session iframe");
1420
- const o = this._userManager.settings.client_id, n = this._userManager.settings.checkSessionIntervalInSeconds, a = this._userManager.settings.stopCheckSessionOnError, c = new Ce(this._callback, o, r, n, a);
1421
- await c.load(), this._checkSessionIFrame = c, c.start(s);
1422
- } else
1423
- i.warn("no check session iframe found in the metadata");
1424
- } catch (r) {
1425
- i.error("Error from getCheckSessionIframe:", r instanceof Error ? r.message : r);
1426
- }
1427
- }, this._stop = () => {
1428
- const t = this._logger.create("_stop");
1429
- if (this._sub = void 0, this._checkSessionIFrame && this._checkSessionIFrame.stop(), this._userManager.settings.monitorAnonymousSession) {
1430
- const s = setInterval(async () => {
1431
- clearInterval(s);
1432
- try {
1433
- const i = await this._userManager.querySessionStatus();
1434
- if (i) {
1435
- const r = {
1436
- session_state: i.session_state,
1437
- profile: i.sub ? {
1438
- sub: i.sub
1439
- } : null
1440
- };
1441
- this._start(r);
1442
- }
1443
- } catch (i) {
1444
- t.error("error from querySessionStatus", i instanceof Error ? i.message : i);
1445
- }
1446
- }, 1e3);
1447
- }
1448
- }, this._callback = async () => {
1449
- const t = this._logger.create("_callback");
1450
- try {
1451
- const s = await this._userManager.querySessionStatus();
1452
- let i = !0;
1453
- s && this._checkSessionIFrame ? s.sub === this._sub ? (i = !1, this._checkSessionIFrame.start(s.session_state), t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state", s.session_state), await this._userManager.events._raiseUserSessionChanged()) : t.debug("different subject signed into OP", s.sub) : t.debug("subject no longer signed into OP"), i ? this._sub ? await this._userManager.events._raiseUserSignedOut() : await this._userManager.events._raiseUserSignedIn() : t.debug("no change in session detected, no event to raise");
1454
- } catch (s) {
1455
- this._sub && (t.debug("Error calling queryCurrentSigninSession; raising signed out event", s), await this._userManager.events._raiseUserSignedOut());
1456
- }
1457
- }, e || this._logger.throw(new Error("No user manager passed")), this._userManager.events.addUserLoaded(this._start), this._userManager.events.addUserUnloaded(this._stop), this._init().catch((t) => {
1458
- this._logger.error(t);
1459
- });
1460
- }
1461
- async _init() {
1462
- this._logger.create("_init");
1463
- const e = await this._userManager.getUser();
1464
- if (e)
1465
- this._start(e);
1466
- else if (this._userManager.settings.monitorAnonymousSession) {
1467
- const t = await this._userManager.querySessionStatus();
1468
- if (t) {
1469
- const s = {
1470
- session_state: t.session_state,
1471
- profile: t.sub ? {
1472
- sub: t.sub
1473
- } : null
241
+ O(e, i), (!t || !t.scope_.parent_) && typeof n != "symbol" && (b(r) ? r.has(n) : Object.prototype.propertyIsEnumerable.call(r, n)) && g(e, i);
242
+ }
243
+ }
244
+ }
245
+ function g(e, t, r = !1) {
246
+ !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && j(t, r);
247
+ }
248
+ function ne(e, t) {
249
+ const r = Array.isArray(e), n = {
250
+ type_: r ? 1 : 0,
251
+ // Track which produce call this is associated with.
252
+ scope_: t ? t.scope_ : X(),
253
+ // True for both shallow and deep changes.
254
+ modified_: !1,
255
+ // Used during finalization.
256
+ finalized_: !1,
257
+ // Track which properties have been assigned (true) or deleted (false).
258
+ assigned_: {},
259
+ // The parent draft state.
260
+ parent_: t,
261
+ // The base state.
262
+ base_: e,
263
+ // The base proxy.
264
+ draft_: null,
265
+ // set below
266
+ // The base copy with any updated values.
267
+ copy_: null,
268
+ // Called by the `produce` function.
269
+ revoke_: null,
270
+ isManual_: !1
271
+ };
272
+ let i = n, o = T;
273
+ r && (i = [n], o = P);
274
+ const { revoke: s, proxy: c } = Proxy.revocable(i, o);
275
+ return n.draft_ = c, n.revoke_ = s, c;
276
+ }
277
+ var T = {
278
+ get(e, t) {
279
+ if (t === u)
280
+ return e;
281
+ const r = l(e);
282
+ if (!E(r, t))
283
+ return ie(e, r, t);
284
+ const n = r[t];
285
+ return e.finalized_ || !_(n) ? n : n === D(e.base_, t) ? (F(e), e.copy_[t] = M(n, e)) : n;
286
+ },
287
+ has(e, t) {
288
+ return t in l(e);
289
+ },
290
+ ownKeys(e) {
291
+ return Reflect.ownKeys(l(e));
292
+ },
293
+ set(e, t, r) {
294
+ const n = q(l(e), t);
295
+ if (n != null && n.set)
296
+ return n.set.call(e.draft_, r), !0;
297
+ if (!e.modified_) {
298
+ const i = D(l(e), t), o = i == null ? void 0 : i[u];
299
+ if (o && o.base_ === r)
300
+ return e.copy_[t] = r, e.assigned_[t] = !1, !0;
301
+ if (L(r, i) && (r !== void 0 || E(e.base_, t)))
302
+ return !0;
303
+ F(e), C(e);
304
+ }
305
+ return e.copy_[t] === r && // special case: handle new props with value 'undefined'
306
+ (r !== void 0 || t in e.copy_) || // special case: NaN
307
+ Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
308
+ },
309
+ deleteProperty(e, t) {
310
+ return D(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, F(e), C(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
311
+ },
312
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
313
+ // the same guarantee in ES5 mode.
314
+ getOwnPropertyDescriptor(e, t) {
315
+ const r = l(e), n = Reflect.getOwnPropertyDescriptor(r, t);
316
+ return n && {
317
+ writable: !0,
318
+ configurable: e.type_ !== 1 || t !== "length",
319
+ enumerable: n.enumerable,
320
+ value: r[t]
321
+ };
322
+ },
323
+ defineProperty() {
324
+ f(11);
325
+ },
326
+ getPrototypeOf(e) {
327
+ return h(e.base_);
328
+ },
329
+ setPrototypeOf() {
330
+ f(12);
331
+ }
332
+ }, P = {};
333
+ z(T, (e, t) => {
334
+ P[e] = function() {
335
+ return arguments[0] = arguments[0][0], t.apply(this, arguments);
336
+ };
337
+ });
338
+ P.deleteProperty = function(e, t) {
339
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && f(13), P.set.call(this, e, t, void 0);
340
+ };
341
+ P.set = function(e, t, r) {
342
+ return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && f(14), T.set.call(this, e[0], t, r, e[0]);
343
+ };
344
+ function D(e, t) {
345
+ const r = e[u];
346
+ return (r ? l(r) : e)[t];
347
+ }
348
+ function ie(e, t, r) {
349
+ var i;
350
+ const n = q(t, r);
351
+ return n ? "value" in n ? n.value : (
352
+ // This is a very special case, if the prop is a getter defined by the
353
+ // prototype, we should invoke it with the draft as context!
354
+ (i = n.get) == null ? void 0 : i.call(e.draft_)
355
+ ) : void 0;
356
+ }
357
+ function q(e, t) {
358
+ if (!(t in e))
359
+ return;
360
+ let r = h(e);
361
+ for (; r; ) {
362
+ const n = Object.getOwnPropertyDescriptor(r, t);
363
+ if (n)
364
+ return n;
365
+ r = h(r);
366
+ }
367
+ }
368
+ function C(e) {
369
+ e.modified_ || (e.modified_ = !0, e.parent_ && C(e.parent_));
370
+ }
371
+ function F(e) {
372
+ e.copy_ || (e.copy_ = N(
373
+ e.base_,
374
+ e.scope_.immer_.useStrictShallowCopy_
375
+ ));
376
+ }
377
+ var oe = class {
378
+ constructor(e) {
379
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !0, this.produce = (t, r, n) => {
380
+ if (typeof t == "function" && typeof r != "function") {
381
+ const o = r;
382
+ r = t;
383
+ const s = this;
384
+ return function(a = o, ...y) {
385
+ return s.produce(a, (Q) => r.call(this, Q, ...y));
1474
386
  };
1475
- this._start(s);
1476
387
  }
1477
- }
1478
- }
1479
- }, W = class he {
1480
- constructor(t) {
1481
- var s;
1482
- this.id_token = t.id_token, this.session_state = (s = t.session_state) != null ? s : null, this.access_token = t.access_token, this.refresh_token = t.refresh_token, this.token_type = t.token_type, this.scope = t.scope, this.profile = t.profile, this.expires_at = t.expires_at, this.state = t.userState, this.url_state = t.url_state;
1483
- }
1484
- /** Computed number of seconds the access token has remaining. */
1485
- get expires_in() {
1486
- if (this.expires_at !== void 0)
1487
- return this.expires_at - T.getEpochTime();
1488
- }
1489
- set expires_in(t) {
1490
- t !== void 0 && (this.expires_at = Math.floor(t) + T.getEpochTime());
1491
- }
1492
- /** Computed value indicating if the access token is expired. */
1493
- get expired() {
1494
- const t = this.expires_in;
1495
- if (t !== void 0)
1496
- return t <= 0;
1497
- }
1498
- /** Array representing the parsed values from the `scope`. */
1499
- get scopes() {
1500
- var t, s;
1501
- return (s = (t = this.scope) == null ? void 0 : t.split(" ")) != null ? s : [];
1502
- }
1503
- toStorageString() {
1504
- return new g("User").create("toStorageString"), JSON.stringify({
1505
- id_token: this.id_token,
1506
- session_state: this.session_state,
1507
- access_token: this.access_token,
1508
- refresh_token: this.refresh_token,
1509
- token_type: this.token_type,
1510
- scope: this.scope,
1511
- profile: this.profile,
1512
- expires_at: this.expires_at
1513
- });
1514
- }
1515
- static fromStorageString(t) {
1516
- return g.createStatic("User", "fromStorageString"), new he(JSON.parse(t));
1517
- }
1518
- }, ee = "oidc-client", ge = class {
1519
- constructor() {
1520
- this._abort = new I("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
1521
- }
1522
- async navigate(e) {
1523
- const t = this._logger.create("navigate");
1524
- if (!this._window)
1525
- throw new Error("Attempted to navigate on a disposed window");
1526
- t.debug("setting URL in window"), this._window.location.replace(e.url);
1527
- const { url: s, keepOpen: i } = await new Promise((r, o) => {
1528
- const n = (c) => {
1529
- var l;
1530
- const d = c.data, h = (l = e.scriptOrigin) != null ? l : window.location.origin;
1531
- if (!(c.origin !== h || (d == null ? void 0 : d.source) !== ee)) {
1532
- try {
1533
- const u = L.readParams(d.url, e.response_mode).get("state");
1534
- if (u || t.warn("no state found in response url"), c.source !== this._window && u !== e.state)
1535
- return;
1536
- } catch {
1537
- this._dispose(), o(new Error("Invalid response from window"));
1538
- }
1539
- r(d);
388
+ typeof r != "function" && f(6), n !== void 0 && typeof n != "function" && f(7);
389
+ let i;
390
+ if (_(t)) {
391
+ const o = $(this), s = M(t, void 0);
392
+ let c = !0;
393
+ try {
394
+ i = r(s), c = !1;
395
+ } finally {
396
+ c ? A(o) : k(o);
1540
397
  }
1541
- };
1542
- window.addEventListener("message", n, !1), this._disposeHandlers.add(() => window.removeEventListener("message", n, !1));
1543
- const a = new BroadcastChannel(`oidc-client-popup-${e.state}`);
1544
- a.addEventListener("message", n, !1), this._disposeHandlers.add(() => a.close()), this._disposeHandlers.add(this._abort.addHandler((c) => {
1545
- this._dispose(), o(c);
1546
- }));
1547
- });
1548
- return t.debug("got response from window"), this._dispose(), i || this.close(), { url: s };
1549
- }
1550
- _dispose() {
1551
- this._logger.create("_dispose");
1552
- for (const e of this._disposeHandlers)
1553
- e();
1554
- this._disposeHandlers.clear();
1555
- }
1556
- static _notifyParent(e, t, s = !1, i = window.location.origin) {
1557
- const r = {
1558
- source: ee,
1559
- url: t,
1560
- keepOpen: s
1561
- }, o = new g("_notifyParent");
1562
- if (e)
1563
- o.debug("With parent. Using parent.postMessage."), e.postMessage(r, i);
1564
- else {
1565
- o.debug("No parent. Using BroadcastChannel.");
1566
- const n = new URL(t).searchParams.get("state");
1567
- if (!n)
1568
- throw new Error("No parent and no state in URL. Can't complete notification.");
1569
- const a = new BroadcastChannel(`oidc-client-popup-${n}`);
1570
- a.postMessage(r), a.close();
1571
- }
1572
- }
1573
- }, ue = {
1574
- location: !1,
1575
- toolbar: !1,
1576
- height: 640,
1577
- closePopupWindowAfterInSeconds: -1
1578
- }, _e = "_blank", ze = 60, Be = 2, pe = 10, Ve = class extends z {
1579
- constructor(e) {
1580
- const {
1581
- popup_redirect_uri: t = e.redirect_uri,
1582
- popup_post_logout_redirect_uri: s = e.post_logout_redirect_uri,
1583
- popupWindowFeatures: i = ue,
1584
- popupWindowTarget: r = _e,
1585
- redirectMethod: o = "assign",
1586
- redirectTarget: n = "self",
1587
- iframeNotifyParentOrigin: a = e.iframeNotifyParentOrigin,
1588
- iframeScriptOrigin: c = e.iframeScriptOrigin,
1589
- requestTimeoutInSeconds: l,
1590
- silent_redirect_uri: d = e.redirect_uri,
1591
- silentRequestTimeoutInSeconds: h,
1592
- automaticSilentRenew: u = !0,
1593
- validateSubOnSilentRenew: w = !0,
1594
- includeIdTokenInSilentRenew: C = !1,
1595
- monitorSession: x = !1,
1596
- monitorAnonymousSession: U = !1,
1597
- checkSessionIntervalInSeconds: A = Be,
1598
- query_status_response_type: P = "code",
1599
- stopCheckSessionOnError: O = !0,
1600
- revokeTokenTypes: R = ["access_token", "refresh_token"],
1601
- revokeTokensOnSignout: S = !1,
1602
- includeIdTokenInSilentSignout: p = !1,
1603
- accessTokenExpiringNotificationTimeInSeconds: E = ze,
1604
- userStore: v
1605
- } = e;
1606
- if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = o, this.redirectTarget = n, this.iframeNotifyParentOrigin = a, this.iframeScriptOrigin = c, this.silent_redirect_uri = d, this.silentRequestTimeoutInSeconds = h || l || pe, this.automaticSilentRenew = u, this.validateSubOnSilentRenew = w, this.includeIdTokenInSilentRenew = C, this.monitorSession = x, this.monitorAnonymousSession = U, this.checkSessionIntervalInSeconds = A, this.stopCheckSessionOnError = O, this.query_status_response_type = P, this.revokeTokenTypes = R, this.revokeTokensOnSignout = S, this.includeIdTokenInSilentSignout = p, this.accessTokenExpiringNotificationTimeInSeconds = E, v)
1607
- this.userStore = v;
1608
- else {
1609
- const f = typeof window < "u" ? window.sessionStorage : new re();
1610
- this.userStore = new ne({ store: f });
1611
- }
1612
- }
1613
- }, te = class we extends ge {
1614
- constructor({
1615
- silentRequestTimeoutInSeconds: t = pe
1616
- }) {
1617
- super(), this._logger = new g("IFrameWindow"), this._timeoutInSeconds = t, this._frame = we.createHiddenIframe(), this._window = this._frame.contentWindow;
1618
- }
1619
- static createHiddenIframe() {
1620
- const t = window.document.createElement("iframe");
1621
- return t.style.visibility = "hidden", t.style.position = "fixed", t.style.left = "-1000px", t.style.top = "0", t.width = "0", t.height = "0", window.document.body.appendChild(t), t;
1622
- }
1623
- async navigate(t) {
1624
- this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
1625
- const s = setTimeout(() => void this._abort.raise(new G("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
1626
- return this._disposeHandlers.add(() => clearTimeout(s)), await super.navigate(t);
1627
- }
1628
- close() {
1629
- var t;
1630
- this._frame && (this._frame.parentNode && (this._frame.addEventListener("load", (s) => {
1631
- var i;
1632
- const r = s.target;
1633
- (i = r.parentNode) == null || i.removeChild(r), this._abort.raise(new Error("IFrame removed from DOM"));
1634
- }, !0), (t = this._frame.contentWindow) == null || t.location.replace("about:blank")), this._frame = null), this._window = null;
1635
- }
1636
- static notifyParent(t, s) {
1637
- return super._notifyParent(window.parent, t, !1, s);
1638
- }
1639
- }, Ge = class {
1640
- constructor(e) {
1641
- this._settings = e, this._logger = new g("IFrameNavigator");
1642
- }
1643
- async prepare({
1644
- silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
1645
- }) {
1646
- return new te({ silentRequestTimeoutInSeconds: e });
1647
- }
1648
- async callback(e) {
1649
- this._logger.create("callback"), te.notifyParent(e, this._settings.iframeNotifyParentOrigin);
1650
- }
1651
- }, Qe = 500, Xe = 1e3, se = class extends ge {
1652
- constructor({
1653
- popupWindowTarget: e = _e,
1654
- popupWindowFeatures: t = {},
1655
- popupSignal: s,
1656
- popupAbortOnClose: i
1657
- }) {
1658
- super(), this._logger = new g("PopupWindow");
1659
- const r = Z.center({ ...ue, ...t });
1660
- this._window = window.open(void 0, e, Z.serialize(r)), this.abortOnClose = !!i, s && s.addEventListener("abort", () => {
1661
- var o;
1662
- this._abort.raise(new Error((o = s.reason) != null ? o : "Popup aborted"));
1663
- }), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
1664
- if (!this._window || typeof this._window.closed != "boolean" || this._window.closed) {
1665
- this._abort.raise(new Error("Popup blocked by user"));
1666
- return;
1667
- }
1668
- this.close();
1669
- }, t.closePopupWindowAfterInSeconds * Xe);
1670
- }
1671
- async navigate(e) {
1672
- var t;
1673
- (t = this._window) == null || t.focus();
1674
- const s = setInterval(() => {
1675
- (!this._window || this._window.closed) && (this._logger.debug("Popup closed by user or isolated by redirect"), i(), this._disposeHandlers.delete(i), this.abortOnClose && this._abort.raise(new Error("Popup closed by user")));
1676
- }, Qe), i = () => clearInterval(s);
1677
- return this._disposeHandlers.add(i), await super.navigate(e);
1678
- }
1679
- close() {
1680
- this._window && (this._window.closed || (this._window.close(), this._abort.raise(new Error("Popup closed")))), this._window = null;
1681
- }
1682
- static notifyOpener(e, t) {
1683
- super._notifyParent(window.opener, e, t), !t && !window.opener && window.close();
1684
- }
1685
- }, Ye = class {
1686
- constructor(e) {
1687
- this._settings = e, this._logger = new g("PopupNavigator");
1688
- }
1689
- async prepare({
1690
- popupWindowFeatures: e = this._settings.popupWindowFeatures,
1691
- popupWindowTarget: t = this._settings.popupWindowTarget,
1692
- popupSignal: s,
1693
- popupAbortOnClose: i
1694
- }) {
1695
- return new se({
1696
- popupWindowFeatures: e,
1697
- popupWindowTarget: t,
1698
- popupSignal: s,
1699
- popupAbortOnClose: i
1700
- });
1701
- }
1702
- async callback(e, { keepOpen: t = !1 }) {
1703
- this._logger.create("callback"), se.notifyOpener(e, t);
1704
- }
1705
- }, Ze = class {
1706
- constructor(e) {
1707
- this._settings = e, this._logger = new g("RedirectNavigator");
1708
- }
1709
- async prepare({
1710
- redirectMethod: e = this._settings.redirectMethod,
1711
- redirectTarget: t = this._settings.redirectTarget
1712
- }) {
1713
- var s;
1714
- this._logger.create("prepare");
1715
- let i = window.self;
1716
- t === "top" && (i = (s = window.top) != null ? s : window.self);
1717
- const r = i.location[e].bind(i.location);
1718
- let o;
1719
- return {
1720
- navigate: async (n) => (this._logger.create("navigate"), await new Promise((c, l) => {
1721
- o = l, window.addEventListener("pageshow", () => c(window.location.href)), r(n.url);
1722
- })),
1723
- close: () => {
1724
- this._logger.create("close"), o == null || o(new Error("Redirect aborted")), i.stop();
1725
- }
1726
- };
1727
- }
1728
- async callback() {
1729
- }
1730
- }, et = class extends Ie {
1731
- constructor(e) {
1732
- super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new g("UserManagerEvents"), this._userLoaded = new I("User loaded"), this._userUnloaded = new I("User unloaded"), this._silentRenewError = new I("Silent renew error"), this._userSignedIn = new I("User signed in"), this._userSignedOut = new I("User signed out"), this._userSessionChanged = new I("User session changed");
1733
- }
1734
- async load(e, t = !0) {
1735
- await super.load(e), t && await this._userLoaded.raise(e);
1736
- }
1737
- async unload() {
1738
- await super.unload(), await this._userUnloaded.raise();
1739
- }
1740
- /**
1741
- * Add callback: Raised when a user session has been established (or re-established).
1742
- */
1743
- addUserLoaded(e) {
1744
- return this._userLoaded.addHandler(e);
1745
- }
1746
- /**
1747
- * Remove callback: Raised when a user session has been established (or re-established).
1748
- */
1749
- removeUserLoaded(e) {
1750
- return this._userLoaded.removeHandler(e);
1751
- }
1752
- /**
1753
- * Add callback: Raised when a user session has been terminated.
1754
- */
1755
- addUserUnloaded(e) {
1756
- return this._userUnloaded.addHandler(e);
1757
- }
1758
- /**
1759
- * Remove callback: Raised when a user session has been terminated.
1760
- */
1761
- removeUserUnloaded(e) {
1762
- return this._userUnloaded.removeHandler(e);
1763
- }
1764
- /**
1765
- * Add callback: Raised when the automatic silent renew has failed.
1766
- */
1767
- addSilentRenewError(e) {
1768
- return this._silentRenewError.addHandler(e);
1769
- }
1770
- /**
1771
- * Remove callback: Raised when the automatic silent renew has failed.
1772
- */
1773
- removeSilentRenewError(e) {
1774
- return this._silentRenewError.removeHandler(e);
1775
- }
1776
- /**
1777
- * @internal
1778
- */
1779
- async _raiseSilentRenewError(e) {
1780
- await this._silentRenewError.raise(e);
1781
- }
1782
- /**
1783
- * Add callback: Raised when the user is signed in (when `monitorSession` is set).
1784
- * @see {@link UserManagerSettings.monitorSession}
1785
- */
1786
- addUserSignedIn(e) {
1787
- return this._userSignedIn.addHandler(e);
1788
- }
1789
- /**
1790
- * Remove callback: Raised when the user is signed in (when `monitorSession` is set).
1791
- */
1792
- removeUserSignedIn(e) {
1793
- this._userSignedIn.removeHandler(e);
1794
- }
1795
- /**
1796
- * @internal
1797
- */
1798
- async _raiseUserSignedIn() {
1799
- await this._userSignedIn.raise();
1800
- }
1801
- /**
1802
- * Add callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).
1803
- * @see {@link UserManagerSettings.monitorSession}
1804
- */
1805
- addUserSignedOut(e) {
1806
- return this._userSignedOut.addHandler(e);
1807
- }
1808
- /**
1809
- * Remove callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).
1810
- */
1811
- removeUserSignedOut(e) {
1812
- this._userSignedOut.removeHandler(e);
1813
- }
1814
- /**
1815
- * @internal
1816
- */
1817
- async _raiseUserSignedOut() {
1818
- await this._userSignedOut.raise();
1819
- }
1820
- /**
1821
- * Add callback: Raised when the user session changed (when `monitorSession` is set).
1822
- * @see {@link UserManagerSettings.monitorSession}
1823
- */
1824
- addUserSessionChanged(e) {
1825
- return this._userSessionChanged.addHandler(e);
1826
- }
1827
- /**
1828
- * Remove callback: Raised when the user session changed (when `monitorSession` is set).
1829
- */
1830
- removeUserSessionChanged(e) {
1831
- this._userSessionChanged.removeHandler(e);
1832
- }
1833
- /**
1834
- * @internal
1835
- */
1836
- async _raiseUserSessionChanged() {
1837
- await this._userSessionChanged.raise();
1838
- }
1839
- }, tt = class {
1840
- constructor(e) {
1841
- this._userManager = e, this._logger = new g("SilentRenewService"), this._isStarted = !1, this._retryTimer = new T("Retry Silent Renew"), this._tokenExpiring = async () => {
1842
- const t = this._logger.create("_tokenExpiring");
1843
- try {
1844
- await this._userManager.signinSilent(), t.debug("silent token renewal successful");
1845
- } catch (s) {
1846
- if (s instanceof G) {
1847
- t.warn("ErrorTimeout from signinSilent:", s, "retry in 5s"), this._retryTimer.init(5);
1848
- return;
398
+ return U(o, n), K(i, o);
399
+ } else if (!t || typeof t != "object") {
400
+ if (i = r(t), i === void 0 && (i = t), i === B && (i = void 0), this.autoFreeze_ && j(i, !0), n) {
401
+ const o = [], s = [];
402
+ d("Patches").generateReplacementPatches_(t, i, o, s), n(o, s);
1849
403
  }
1850
- t.error("Error from signinSilent:", s), await this._userManager.events._raiseSilentRenewError(s);
1851
- }
1852
- };
1853
- }
1854
- async start() {
1855
- const e = this._logger.create("start");
1856
- if (!this._isStarted) {
1857
- this._isStarted = !0, this._userManager.events.addAccessTokenExpiring(this._tokenExpiring), this._retryTimer.addHandler(this._tokenExpiring);
1858
- try {
1859
- await this._userManager.getUser();
1860
- } catch (t) {
1861
- e.error("getUser error", t);
1862
- }
1863
- }
1864
- }
1865
- stop() {
1866
- this._isStarted && (this._retryTimer.cancel(), this._retryTimer.removeHandler(this._tokenExpiring), this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring), this._isStarted = !1);
1867
- }
1868
- }, st = class {
1869
- constructor(e) {
1870
- this.refresh_token = e.refresh_token, this.id_token = e.id_token, this.session_state = e.session_state, this.scope = e.scope, this.profile = e.profile, this.data = e.state;
1871
- }
1872
- }, rt = class {
1873
- constructor(e, t, s, i) {
1874
- this._logger = new g("UserManager"), this.settings = new Ve(e), this._client = new Le(e), this._redirectNavigator = t ?? new Ze(this.settings), this._popupNavigator = s ?? new Ye(this.settings), this._iframeNavigator = i ?? new Ge(this.settings), this._events = new et(this.settings), this._silentRenewService = new tt(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new Fe(this));
1875
- }
1876
- /**
1877
- * Get object used to register for events raised by the `UserManager`.
1878
- */
1879
- get events() {
1880
- return this._events;
1881
- }
1882
- /**
1883
- * Get object used to access the metadata configuration of the identity provider.
1884
- */
1885
- get metadataService() {
1886
- return this._client.metadataService;
1887
- }
1888
- /**
1889
- * Load the `User` object for the currently authenticated user.
1890
- *
1891
- * @param raiseEvent - If `true`, the `UserLoaded` event will be raised. Defaults to false.
1892
- * @returns A promise
1893
- */
1894
- async getUser(e = !1) {
1895
- const t = this._logger.create("getUser"), s = await this._loadUser();
1896
- return s ? (t.info("user loaded"), await this._events.load(s, e), s) : (t.info("user not found in storage"), null);
1897
- }
1898
- /**
1899
- * Remove from any storage the currently authenticated user.
1900
- *
1901
- * @returns A promise
1902
- */
1903
- async removeUser() {
1904
- const e = this._logger.create("removeUser");
1905
- await this.storeUser(null), e.info("user removed from storage"), await this._events.unload();
1906
- }
1907
- /**
1908
- * Trigger a redirect of the current window to the authorization endpoint.
1909
- *
1910
- * @returns A promise
1911
- *
1912
- * @throws `Error` In cases of wrong authentication.
1913
- */
1914
- async signinRedirect(e = {}) {
1915
- var t;
1916
- this._logger.create("signinRedirect");
1917
- const {
1918
- redirectMethod: s,
1919
- ...i
1920
- } = e;
1921
- let r;
1922
- (t = this.settings.dpop) != null && t.bind_authorization_code && (r = await this.generateDPoPJkt(this.settings.dpop));
1923
- const o = await this._redirectNavigator.prepare({ redirectMethod: s });
1924
- await this._signinStart({
1925
- request_type: "si:r",
1926
- dpopJkt: r,
1927
- ...i
1928
- }, o);
1929
- }
1930
- /**
1931
- * Process the response (callback) from the authorization endpoint.
1932
- * It is recommended to use {@link UserManager.signinCallback} instead.
1933
- *
1934
- * @returns A promise containing the authenticated `User`.
1935
- *
1936
- * @see {@link UserManager.signinCallback}
1937
- */
1938
- async signinRedirectCallback(e = window.location.href) {
1939
- const t = this._logger.create("signinRedirectCallback"), s = await this._signinEnd(e);
1940
- return s.profile && s.profile.sub ? t.info("success, signed in subject", s.profile.sub) : t.info("no subject"), s;
1941
- }
1942
- /**
1943
- * Trigger the signin with user/password.
1944
- *
1945
- * @returns A promise containing the authenticated `User`.
1946
- * @throws {@link ErrorResponse} In cases of wrong authentication.
1947
- */
1948
- async signinResourceOwnerCredentials({
1949
- username: e,
1950
- password: t,
1951
- skipUserInfo: s = !1
1952
- }) {
1953
- const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({
1954
- username: e,
1955
- password: t,
1956
- skipUserInfo: s,
1957
- extraTokenParams: this.settings.extraTokenParams
1958
- });
1959
- i.debug("got signin response");
1960
- const o = await this._buildUser(r);
1961
- return o.profile && o.profile.sub ? i.info("success, signed in subject", o.profile.sub) : i.info("no subject"), o;
1962
- }
1963
- /**
1964
- * Trigger a request (via a popup window) to the authorization endpoint.
404
+ return i;
405
+ } else
406
+ f(1, t);
407
+ }, this.produceWithPatches = (t, r) => {
408
+ if (typeof t == "function")
409
+ return (s, ...c) => this.produceWithPatches(s, (a) => t(a, ...c));
410
+ let n, i;
411
+ return [this.produce(t, r, (s, c) => {
412
+ n = s, i = c;
413
+ }), n, i];
414
+ }, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy), typeof (e == null ? void 0 : e.useStrictIteration) == "boolean" && this.setUseStrictIteration(e.useStrictIteration);
415
+ }
416
+ createDraft(e) {
417
+ _(e) || f(8), m(e) && (e = se(e));
418
+ const t = $(this), r = M(e, void 0);
419
+ return r[u].isManual_ = !0, k(t), r;
420
+ }
421
+ finishDraft(e, t) {
422
+ const r = e && e[u];
423
+ (!r || !r.isManual_) && f(9);
424
+ const { scope_: n } = r;
425
+ return U(n, t), K(void 0, n);
426
+ }
427
+ /**
428
+ * Pass true to automatically freeze all copies created by Immer.
1965
429
  *
1966
- * @returns A promise containing the authenticated `User`.
1967
- * @throws `Error` In cases of wrong authentication.
430
+ * By default, auto-freezing is enabled.
1968
431
  */
1969
- async signinPopup(e = {}) {
1970
- var t;
1971
- const s = this._logger.create("signinPopup");
1972
- let i;
1973
- (t = this.settings.dpop) != null && t.bind_authorization_code && (i = await this.generateDPoPJkt(this.settings.dpop));
1974
- const {
1975
- popupWindowFeatures: r,
1976
- popupWindowTarget: o,
1977
- popupSignal: n,
1978
- popupAbortOnClose: a,
1979
- ...c
1980
- } = e, l = this.settings.popup_redirect_uri;
1981
- l || s.throw(new Error("No popup_redirect_uri configured"));
1982
- const d = await this._popupNavigator.prepare({ popupWindowFeatures: r, popupWindowTarget: o, popupSignal: n, popupAbortOnClose: a }), h = await this._signin({
1983
- request_type: "si:p",
1984
- redirect_uri: l,
1985
- display: "popup",
1986
- dpopJkt: i,
1987
- ...c
1988
- }, d);
1989
- return h && (h.profile && h.profile.sub ? s.info("success, signed in subject", h.profile.sub) : s.info("no subject")), h;
432
+ setAutoFreeze(e) {
433
+ this.autoFreeze_ = e;
1990
434
  }
1991
435
  /**
1992
- * Notify the opening window of response (callback) from the authorization endpoint.
1993
- * It is recommended to use {@link UserManager.signinCallback} instead.
1994
- *
1995
- * @returns A promise
436
+ * Pass true to enable strict shallow copy.
1996
437
  *
1997
- * @see {@link UserManager.signinCallback}
438
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1998
439
  */
1999
- async signinPopupCallback(e = window.location.href, t = !1) {
2000
- const s = this._logger.create("signinPopupCallback");
2001
- await this._popupNavigator.callback(e, { keepOpen: t }), s.info("success");
440
+ setUseStrictShallowCopy(e) {
441
+ this.useStrictShallowCopy_ = e;
2002
442
  }
2003
443
  /**
2004
- * Trigger a silent request (via refresh token or an iframe) to the authorization endpoint.
444
+ * Pass false to use faster iteration that skips non-enumerable properties
445
+ * but still handles symbols for compatibility.
2005
446
  *
2006
- * @returns A promise that contains the authenticated `User`.
447
+ * By default, strict iteration is enabled (includes all own properties).
2007
448
  */
2008
- async signinSilent(e = {}) {
2009
- var t, s;
2010
- const i = this._logger.create("signinSilent"), {
2011
- silentRequestTimeoutInSeconds: r,
2012
- ...o
2013
- } = e;
2014
- let n = await this._loadUser();
2015
- if (!e.forceIframeAuth && (n != null && n.refresh_token)) {
2016
- i.debug("using refresh token");
2017
- const h = new st(n);
2018
- return await this._useRefreshToken({
2019
- state: h,
2020
- redirect_uri: o.redirect_uri,
2021
- resource: o.resource,
2022
- extraTokenParams: o.extraTokenParams,
2023
- timeoutInSeconds: r
2024
- });
2025
- }
2026
- let a;
2027
- (t = this.settings.dpop) != null && t.bind_authorization_code && (a = await this.generateDPoPJkt(this.settings.dpop));
2028
- const c = this.settings.silent_redirect_uri;
2029
- c || i.throw(new Error("No silent_redirect_uri configured"));
2030
- let l;
2031
- n && this.settings.validateSubOnSilentRenew && (i.debug("subject prior to silent renew:", n.profile.sub), l = n.profile.sub);
2032
- const d = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: r });
2033
- return n = await this._signin({
2034
- request_type: "si:s",
2035
- redirect_uri: c,
2036
- prompt: "none",
2037
- id_token_hint: this.settings.includeIdTokenInSilentRenew ? n == null ? void 0 : n.id_token : void 0,
2038
- dpopJkt: a,
2039
- ...o
2040
- }, d, l), n && ((s = n.profile) != null && s.sub ? i.info("success, signed in subject", n.profile.sub) : i.info("no subject")), n;
449
+ setUseStrictIteration(e) {
450
+ this.useStrictIteration_ = e;
2041
451
  }
2042
- async _useRefreshToken(e) {
2043
- const t = await this._client.useRefreshToken({
2044
- timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
2045
- ...e
2046
- }), s = new W({ ...e.state, ...t });
2047
- return await this.storeUser(s), await this._events.load(s), s;
2048
- }
2049
- /**
2050
- *
2051
- * Notify the parent window of response (callback) from the authorization endpoint.
2052
- * It is recommended to use {@link UserManager.signinCallback} instead.
2053
- *
2054
- * @returns A promise
2055
- *
2056
- * @see {@link UserManager.signinCallback}
2057
- */
2058
- async signinSilentCallback(e = window.location.href) {
2059
- const t = this._logger.create("signinSilentCallback");
2060
- await this._iframeNavigator.callback(e), t.info("success");
452
+ shouldUseStrictIteration() {
453
+ return this.useStrictIteration_;
2061
454
  }
2062
- /**
2063
- * Process any response (callback) from the authorization endpoint, by dispatching the request_type
2064
- * and executing one of the following functions:
2065
- * - {@link UserManager.signinRedirectCallback}
2066
- * - {@link UserManager.signinPopupCallback}
2067
- * - {@link UserManager.signinSilentCallback}
2068
- *
2069
- * @throws `Error` If request_type is unknown or signin cannot be processed.
2070
- */
2071
- async signinCallback(e = window.location.href) {
2072
- const { state: t } = await this._client.readSigninResponseState(e);
2073
- switch (t.request_type) {
2074
- case "si:r":
2075
- return await this.signinRedirectCallback(e);
2076
- case "si:p":
2077
- await this.signinPopupCallback(e);
2078
- break;
2079
- case "si:s":
2080
- await this.signinSilentCallback(e);
455
+ applyPatches(e, t) {
456
+ let r;
457
+ for (r = t.length - 1; r >= 0; r--) {
458
+ const i = t[r];
459
+ if (i.path.length === 0 && i.op === "replace") {
460
+ e = i.value;
2081
461
  break;
2082
- default:
2083
- throw new Error("invalid response_type in state");
2084
- }
2085
- }
2086
- /**
2087
- * Process any response (callback) from the end session endpoint, by dispatching the request_type
2088
- * and executing one of the following functions:
2089
- * - {@link UserManager.signoutRedirectCallback}
2090
- * - {@link UserManager.signoutPopupCallback}
2091
- * - {@link UserManager.signoutSilentCallback}
2092
- *
2093
- * @throws `Error` If request_type is unknown or signout cannot be processed.
2094
- */
2095
- async signoutCallback(e = window.location.href, t = !1) {
2096
- const { state: s } = await this._client.readSignoutResponseState(e);
2097
- if (s)
2098
- switch (s.request_type) {
2099
- case "so:r":
2100
- return await this.signoutRedirectCallback(e);
2101
- case "so:p":
2102
- await this.signoutPopupCallback(e, t);
2103
- break;
2104
- case "so:s":
2105
- await this.signoutSilentCallback(e);
2106
- break;
2107
- default:
2108
- throw new Error("invalid response_type in state");
2109
462
  }
2110
- }
2111
- /**
2112
- * Query OP for user's current signin status.
2113
- *
2114
- * @returns A promise object with session_state and subject identifier.
2115
- */
2116
- async querySessionStatus(e = {}) {
2117
- const t = this._logger.create("querySessionStatus"), {
2118
- silentRequestTimeoutInSeconds: s,
2119
- ...i
2120
- } = e, r = this.settings.silent_redirect_uri;
2121
- r || t.throw(new Error("No silent_redirect_uri configured"));
2122
- const o = await this._loadUser(), n = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: s }), a = await this._signinStart({
2123
- request_type: "si:s",
2124
- // this acts like a signin silent
2125
- redirect_uri: r,
2126
- prompt: "none",
2127
- id_token_hint: this.settings.includeIdTokenInSilentRenew ? o == null ? void 0 : o.id_token : void 0,
2128
- response_type: this.settings.query_status_response_type,
2129
- scope: "openid",
2130
- skipUserInfo: !0,
2131
- ...i
2132
- }, n);
2133
- try {
2134
- const c = {}, l = await this._client.processSigninResponse(a.url, c);
2135
- return t.debug("got signin response"), l.session_state && l.profile.sub ? (t.info("success for subject", l.profile.sub), {
2136
- session_state: l.session_state,
2137
- sub: l.profile.sub
2138
- }) : (t.info("success, user not authenticated"), null);
2139
- } catch (c) {
2140
- if (this.settings.monitorAnonymousSession && c instanceof q)
2141
- switch (c.error) {
2142
- case "login_required":
2143
- case "consent_required":
2144
- case "interaction_required":
2145
- case "account_selection_required":
2146
- return t.info("success for anonymous user"), {
2147
- session_state: c.session_state
2148
- };
2149
- }
2150
- throw c;
2151
463
  }
2152
- }
2153
- async _signin(e, t, s) {
2154
- const i = await this._signinStart(e, t);
2155
- return await this._signinEnd(i.url, s);
2156
- }
2157
- async _signinStart(e, t) {
2158
- const s = this._logger.create("_signinStart");
2159
- try {
2160
- const i = await this._client.createSigninRequest(e);
2161
- return s.debug("got signin request"), await t.navigate({
2162
- url: i.url,
2163
- state: i.state.id,
2164
- response_mode: i.state.response_mode,
2165
- scriptOrigin: this.settings.iframeScriptOrigin
2166
- });
2167
- } catch (i) {
2168
- throw s.debug("error after preparing navigator, closing navigator window"), t.close(), i;
2169
- }
2170
- }
2171
- async _signinEnd(e, t) {
2172
- const s = this._logger.create("_signinEnd"), i = {}, r = await this._client.processSigninResponse(e, i);
2173
- return s.debug("got signin response"), await this._buildUser(r, t);
2174
- }
2175
- async _buildUser(e, t) {
2176
- const s = this._logger.create("_buildUser"), i = new W(e);
2177
- if (t) {
2178
- if (t !== i.profile.sub)
2179
- throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new q({ ...e, error: "login_required" });
2180
- s.debug("current user matches user returned from signin");
2181
- }
2182
- return await this.storeUser(i), s.debug("user stored"), await this._events.load(i), i;
2183
- }
2184
- /**
2185
- * Trigger a redirect of the current window to the end session endpoint.
2186
- *
2187
- * @returns A promise
2188
- */
2189
- async signoutRedirect(e = {}) {
2190
- const t = this._logger.create("signoutRedirect"), {
2191
- redirectMethod: s,
2192
- ...i
2193
- } = e, r = await this._redirectNavigator.prepare({ redirectMethod: s });
2194
- await this._signoutStart({
2195
- request_type: "so:r",
2196
- post_logout_redirect_uri: this.settings.post_logout_redirect_uri,
2197
- ...i
2198
- }, r), t.info("success");
2199
- }
2200
- /**
2201
- * Process response (callback) from the end session endpoint.
2202
- * It is recommended to use {@link UserManager.signoutCallback} instead.
2203
- *
2204
- * @returns A promise containing signout response
2205
- *
2206
- * @see {@link UserManager.signoutCallback}
2207
- */
2208
- async signoutRedirectCallback(e = window.location.href) {
2209
- const t = this._logger.create("signoutRedirectCallback"), s = await this._signoutEnd(e);
2210
- return t.info("success"), s;
2211
- }
2212
- /**
2213
- * Trigger a redirect of a popup window to the end session endpoint.
2214
- *
2215
- * @returns A promise
2216
- */
2217
- async signoutPopup(e = {}) {
2218
- const t = this._logger.create("signoutPopup"), {
2219
- popupWindowFeatures: s,
2220
- popupWindowTarget: i,
2221
- popupSignal: r,
2222
- ...o
2223
- } = e, n = this.settings.popup_post_logout_redirect_uri, a = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i, popupSignal: r });
2224
- await this._signout({
2225
- request_type: "so:p",
2226
- post_logout_redirect_uri: n,
2227
- // we're putting a dummy entry in here because we
2228
- // need a unique id from the state for notification
2229
- // to the parent window, which is necessary if we
2230
- // plan to return back to the client after signout
2231
- // and so we can close the popup after signout
2232
- state: n == null ? void 0 : {},
2233
- ...o
2234
- }, a), t.info("success");
2235
- }
2236
- /**
2237
- * Process response (callback) from the end session endpoint from a popup window.
2238
- * It is recommended to use {@link UserManager.signoutCallback} instead.
2239
- *
2240
- * @returns A promise
2241
- *
2242
- * @see {@link UserManager.signoutCallback}
2243
- */
2244
- async signoutPopupCallback(e = window.location.href, t = !1) {
2245
- const s = this._logger.create("signoutPopupCallback");
2246
- await this._popupNavigator.callback(e, { keepOpen: t }), s.info("success");
2247
- }
2248
- async _signout(e, t) {
2249
- const s = await this._signoutStart(e, t);
2250
- return await this._signoutEnd(s.url);
2251
- }
2252
- async _signoutStart(e = {}, t) {
2253
- var s;
2254
- const i = this._logger.create("_signoutStart");
2255
- try {
2256
- const r = await this._loadUser();
2257
- i.debug("loaded current user from storage"), this.settings.revokeTokensOnSignout && await this._revokeInternal(r);
2258
- const o = e.id_token_hint || r && r.id_token;
2259
- o && (i.debug("setting id_token_hint in signout request"), e.id_token_hint = o), await this.removeUser(), i.debug("user removed, creating signout request");
2260
- const n = await this._client.createSignoutRequest(e);
2261
- return i.debug("got signout request"), await t.navigate({
2262
- url: n.url,
2263
- state: (s = n.state) == null ? void 0 : s.id,
2264
- scriptOrigin: this.settings.iframeScriptOrigin
2265
- });
2266
- } catch (r) {
2267
- throw i.debug("error after preparing navigator, closing navigator window"), t.close(), r;
2268
- }
2269
- }
2270
- async _signoutEnd(e) {
2271
- const t = this._logger.create("_signoutEnd"), s = await this._client.processSignoutResponse(e);
2272
- return t.debug("got signout response"), s;
2273
- }
2274
- /**
2275
- * Trigger a silent request (via an iframe) to the end session endpoint.
2276
- *
2277
- * @returns A promise
2278
- */
2279
- async signoutSilent(e = {}) {
2280
- var t;
2281
- const s = this._logger.create("signoutSilent"), {
2282
- silentRequestTimeoutInSeconds: i,
2283
- ...r
2284
- } = e, o = this.settings.includeIdTokenInSilentSignout ? (t = await this._loadUser()) == null ? void 0 : t.id_token : void 0, n = this.settings.popup_post_logout_redirect_uri, a = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
2285
- await this._signout({
2286
- request_type: "so:s",
2287
- post_logout_redirect_uri: n,
2288
- id_token_hint: o,
2289
- ...r
2290
- }, a), s.info("success");
2291
- }
2292
- /**
2293
- * Notify the parent window of response (callback) from the end session endpoint.
2294
- * It is recommended to use {@link UserManager.signoutCallback} instead.
2295
- *
2296
- * @returns A promise
2297
- *
2298
- * @see {@link UserManager.signoutCallback}
2299
- */
2300
- async signoutSilentCallback(e = window.location.href) {
2301
- const t = this._logger.create("signoutSilentCallback");
2302
- await this._iframeNavigator.callback(e), t.info("success");
2303
- }
2304
- async revokeTokens(e) {
2305
- const t = await this._loadUser();
2306
- await this._revokeInternal(t, e);
2307
- }
2308
- async _revokeInternal(e, t = this.settings.revokeTokenTypes) {
2309
- const s = this._logger.create("_revokeInternal");
2310
- if (!e) return;
2311
- const i = t.filter((r) => typeof e[r] == "string");
2312
- if (!i.length) {
2313
- s.debug("no need to revoke due to no token(s)");
2314
- return;
2315
- }
2316
- for (const r of i)
2317
- await this._client.revokeToken(
2318
- e[r],
2319
- r
2320
- ), s.info(`${r} revoked successfully`), r !== "access_token" && (e[r] = null);
2321
- await this.storeUser(e), s.debug("user stored"), await this._events.load(e);
2322
- }
2323
- /**
2324
- * Enables silent renew for the `UserManager`.
2325
- */
2326
- startSilentRenew() {
2327
- this._logger.create("startSilentRenew"), this._silentRenewService.start();
2328
- }
2329
- /**
2330
- * Disables silent renew for the `UserManager`.
2331
- */
2332
- stopSilentRenew() {
2333
- this._silentRenewService.stop();
2334
- }
2335
- get _userStoreKey() {
2336
- return `user:${this.settings.authority}:${this.settings.client_id}`;
2337
- }
2338
- async _loadUser() {
2339
- const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
2340
- return t ? (e.debug("user storageString loaded"), W.fromStorageString(t)) : (e.debug("no user storageString"), null);
2341
- }
2342
- async storeUser(e) {
2343
- const t = this._logger.create("storeUser");
2344
- if (e) {
2345
- t.debug("storing user");
2346
- const s = e.toStorageString();
2347
- await this.settings.userStore.set(this._userStoreKey, s);
2348
- } else
2349
- this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey), this.settings.dpop && await this.settings.dpop.store.remove(this.settings.client_id);
2350
- }
2351
- /**
2352
- * Removes stale state entries in storage for incomplete authorize requests.
2353
- */
2354
- async clearStaleState() {
2355
- await this._client.clearStaleState();
2356
- }
2357
- /**
2358
- * Dynamically generates a DPoP proof for a given user, URL and optional Http method.
2359
- * This method is useful when you need to make a request to a resource server
2360
- * with fetch or similar, and you need to include a DPoP proof in a DPoP header.
2361
- * @param url - The URL to generate the DPoP proof for
2362
- * @param user - The user to generate the DPoP proof for
2363
- * @param httpMethod - Optional, defaults to "GET"
2364
- * @param nonce - Optional nonce provided by the resource server
2365
- *
2366
- * @returns A promise containing the DPoP proof or undefined if DPoP is not enabled/no user is found.
2367
- */
2368
- async dpopProof(e, t, s, i) {
2369
- var r, o;
2370
- const n = await ((o = (r = this.settings.dpop) == null ? void 0 : r.store) == null ? void 0 : o.get(this.settings.client_id));
2371
- if (n)
2372
- return await _.generateDPoPProof({
2373
- url: e,
2374
- accessToken: t == null ? void 0 : t.access_token,
2375
- httpMethod: s,
2376
- keyPair: n.keys,
2377
- nonce: i
2378
- });
2379
- }
2380
- async generateDPoPJkt(e) {
2381
- let t = await e.store.get(this.settings.client_id);
2382
- if (!t) {
2383
- const s = await _.generateDPoPKeys();
2384
- t = new de(s), await e.store.set(this.settings.client_id, t);
2385
- }
2386
- return await _.generateDPoPJkt(t.keys);
464
+ r > -1 && (t = t.slice(r + 1));
465
+ const n = d("Patches").applyPatches_;
466
+ return m(e) ? n(e, t) : this.produce(
467
+ e,
468
+ (i) => n(i, t)
469
+ );
2387
470
  }
2388
471
  };
472
+ function M(e, t) {
473
+ const r = b(e) ? d("MapSet").proxyMap_(e, t) : v(e) ? d("MapSet").proxySet_(e, t) : ne(e, t);
474
+ return (t ? t.scope_ : X()).drafts_.push(r), r;
475
+ }
476
+ function se(e) {
477
+ return m(e) || f(10, e), J(e);
478
+ }
479
+ function J(e) {
480
+ if (!_(e) || I(e))
481
+ return e;
482
+ const t = e[u];
483
+ let r, n = !0;
484
+ if (t) {
485
+ if (!t.modified_)
486
+ return t.base_;
487
+ t.finalized_ = !0, r = N(e, t.scope_.immer_.useStrictShallowCopy_), n = t.scope_.immer_.shouldUseStrictIteration();
488
+ } else
489
+ r = N(e, !0);
490
+ return z(
491
+ r,
492
+ (i, o) => {
493
+ H(r, i, J(o));
494
+ },
495
+ n
496
+ ), t && (t.finalized_ = !1), r;
497
+ }
498
+ var ce = new oe(), fe = ce.produce;
2389
499
  export {
2390
- Ie as AccessTokenEvents,
2391
- Ce as CheckSessionIFrame,
2392
- de as DPoPState,
2393
- q as ErrorResponse,
2394
- G as ErrorTimeout,
2395
- re as InMemoryWebStorage,
2396
- D as Log,
2397
- g as Logger,
2398
- xe as MetadataService,
2399
- Le as OidcClient,
2400
- z as OidcClientSettingsStore,
2401
- Fe as SessionMonitor,
2402
- J as SigninResponse,
2403
- ae as SigninState,
2404
- $e as SignoutResponse,
2405
- $ as State,
2406
- W as User,
2407
- rt as UserManager,
2408
- Ve as UserManagerSettingsStore,
2409
- ne as WebStorageStateStore
500
+ oe as Immer,
501
+ se as current,
502
+ j as freeze,
503
+ R as immerable,
504
+ m as isDraft,
505
+ _ as isDraftable,
506
+ B as nothing,
507
+ fe as produce
2410
508
  };