mada-design-system 0.8.0 → 0.8.1

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 (408) hide show
  1. package/index.cjs128.js +1 -1
  2. package/index.cjs141.js +1 -1
  3. package/index.cjs144.js +1 -1
  4. package/index.cjs145.js +1 -1
  5. package/index.cjs146.js +1 -1
  6. package/index.cjs147.js +1 -1
  7. package/index.cjs185.js +1 -1
  8. package/index.cjs186.js +1 -1
  9. package/index.cjs187.js +1 -1
  10. package/index.cjs188.js +1 -1
  11. package/index.cjs189.js +1 -1
  12. package/index.cjs190.js +1 -1
  13. package/index.cjs205.js +1 -1
  14. package/index.cjs225.js +1 -1
  15. package/index.cjs231.js +1 -1
  16. package/index.cjs236.js +1 -1
  17. package/index.cjs237.js +1 -1
  18. package/index.cjs238.js +1 -1
  19. package/index.cjs239.js +1 -1
  20. package/index.cjs240.js +1 -1
  21. package/index.cjs241.js +1 -1
  22. package/index.cjs242.js +1 -1
  23. package/index.cjs243.js +1 -1
  24. package/index.cjs244.js +1 -1
  25. package/index.cjs245.js +1 -1
  26. package/index.cjs246.js +1 -1
  27. package/index.cjs247.js +1 -1
  28. package/index.cjs248.js +1 -1
  29. package/index.cjs249.js +1 -1
  30. package/index.cjs250.js +1 -1
  31. package/index.cjs251.js +1 -1
  32. package/index.cjs252.js +1 -1
  33. package/index.cjs253.js +1 -1
  34. package/index.cjs254.js +1 -1
  35. package/index.cjs255.js +1 -1
  36. package/index.cjs256.js +1 -1
  37. package/index.cjs257.js +1 -1
  38. package/index.cjs258.js +1 -1
  39. package/index.cjs259.js +1 -1
  40. package/index.cjs260.js +1 -1
  41. package/index.cjs261.js +1 -1
  42. package/index.cjs262.js +1 -1
  43. package/index.cjs263.js +1 -1
  44. package/index.cjs264.js +1 -1
  45. package/index.cjs265.js +1 -1
  46. package/index.cjs266.js +1 -1
  47. package/index.cjs267.js +1 -1
  48. package/index.cjs268.js +1 -1
  49. package/index.cjs269.js +1 -1
  50. package/index.cjs270.js +1 -1
  51. package/index.cjs271.js +1 -1
  52. package/index.cjs272.js +1 -1
  53. package/index.cjs273.js +1 -1
  54. package/index.cjs274.js +1 -1
  55. package/index.cjs275.js +1 -1
  56. package/index.cjs276.js +1 -1
  57. package/index.cjs277.js +1 -1
  58. package/index.cjs278.js +1 -1
  59. package/index.cjs282.js +1 -1
  60. package/index.cjs283.js +1 -1
  61. package/index.cjs284.js +1 -1
  62. package/index.cjs285.js +1 -1
  63. package/index.cjs286.js +1 -1
  64. package/index.cjs287.js +1 -1
  65. package/index.cjs288.js +1 -1
  66. package/index.cjs289.js +1 -1
  67. package/index.cjs290.js +1 -1
  68. package/index.cjs291.js +1 -1
  69. package/index.cjs301.js +1 -1
  70. package/index.cjs304.js +1 -1
  71. package/index.cjs306.js +1 -1
  72. package/index.cjs310.js +1 -1
  73. package/index.cjs312.js +1 -1
  74. package/index.cjs313.js +1 -1
  75. package/index.cjs314.js +1 -1
  76. package/index.cjs315.js +1 -1
  77. package/index.cjs316.js +1 -1
  78. package/index.cjs317.js +1 -1
  79. package/index.cjs318.js +1 -1
  80. package/index.cjs319.js +1 -1
  81. package/index.cjs320.js +1 -1
  82. package/index.cjs321.js +1 -1
  83. package/index.cjs322.js +1 -1
  84. package/index.cjs323.js +1 -1
  85. package/index.cjs324.js +1 -1
  86. package/index.cjs325.js +1 -1
  87. package/index.cjs326.js +1 -1
  88. package/index.cjs327.js +1 -1
  89. package/index.cjs328.js +1 -1
  90. package/index.cjs329.js +1 -1
  91. package/index.cjs330.js +1 -1
  92. package/index.cjs331.js +1 -1
  93. package/index.cjs332.js +1 -1
  94. package/index.cjs333.js +1 -1
  95. package/index.cjs334.js +1 -1
  96. package/index.cjs335.js +1 -1
  97. package/index.cjs336.js +1 -1
  98. package/index.cjs337.js +1 -1
  99. package/index.cjs338.js +1 -1
  100. package/index.cjs339.js +1 -1
  101. package/index.cjs340.js +1 -1
  102. package/index.cjs341.js +1 -1
  103. package/index.cjs342.js +1 -1
  104. package/index.cjs343.js +1 -1
  105. package/index.cjs344.js +1 -1
  106. package/index.cjs345.js +1 -1
  107. package/index.cjs346.js +1 -1
  108. package/index.cjs347.js +1 -1
  109. package/index.cjs348.js +1 -1
  110. package/index.cjs356.js +1 -1
  111. package/index.cjs357.js +1 -1
  112. package/index.cjs365.js +1 -1
  113. package/index.cjs371.js +1 -1
  114. package/index.cjs373.js +1 -1
  115. package/index.cjs374.js +1 -1
  116. package/index.cjs376.js +1 -1
  117. package/index.cjs378.js +1 -1
  118. package/index.cjs383.js +1 -1
  119. package/index.cjs384.js +1 -1
  120. package/index.cjs385.js +1 -1
  121. package/index.cjs395.js +1 -1
  122. package/index.cjs396.js +1 -1
  123. package/index.cjs401.js +1 -1
  124. package/index.cjs403.js +1 -1
  125. package/index.cjs404.js +1 -1
  126. package/index.cjs405.js +1 -1
  127. package/index.cjs406.js +1 -1
  128. package/index.cjs407.js +1 -1
  129. package/index.cjs408.js +1 -1
  130. package/index.cjs409.js +1 -1
  131. package/index.cjs410.js +1 -1
  132. package/index.cjs411.js +1 -1
  133. package/index.cjs412.js +1 -1
  134. package/index.cjs413.js +1 -1
  135. package/index.cjs414.js +1 -1
  136. package/index.cjs415.js +1 -1
  137. package/index.cjs416.js +1 -1
  138. package/index.cjs417.js +1 -1
  139. package/index.cjs418.js +1 -1
  140. package/index.cjs419.js +1 -1
  141. package/index.cjs420.js +1 -1
  142. package/index.cjs421.js +1 -1
  143. package/index.cjs422.js +1 -1
  144. package/index.cjs423.js +1 -1
  145. package/index.cjs424.js +1 -1
  146. package/index.cjs425.js +1 -1
  147. package/index.cjs426.js +1 -1
  148. package/index.cjs427.js +1 -1
  149. package/index.cjs428.js +1 -1
  150. package/index.cjs429.js +1 -1
  151. package/index.cjs430.js +1 -1
  152. package/index.cjs431.js +1 -1
  153. package/index.cjs432.js +1 -1
  154. package/index.cjs433.js +1 -1
  155. package/index.cjs434.js +1 -1
  156. package/index.cjs435.js +1 -1
  157. package/index.cjs436.js +1 -1
  158. package/index.cjs437.js +1 -1
  159. package/index.cjs438.js +1 -1
  160. package/index.cjs439.js +1 -1
  161. package/index.cjs440.js +1 -1
  162. package/index.cjs441.js +1 -1
  163. package/index.cjs455.js +1 -1
  164. package/index.cjs460.js +1 -1
  165. package/index.cjs461.js +1 -1
  166. package/index.cjs462.js +1 -1
  167. package/index.cjs463.js +2 -1
  168. package/index.cjs464.js +1 -1
  169. package/index.cjs465.js +1 -1
  170. package/index.cjs466.js +1 -2
  171. package/index.cjs467.js +1 -1
  172. package/index.cjs468.js +1 -1
  173. package/index.cjs469.js +1 -1
  174. package/index.cjs47.js +1 -1
  175. package/index.cjs470.js +1 -1
  176. package/index.cjs471.js +1 -1
  177. package/index.cjs472.js +1 -1
  178. package/index.cjs473.js +1 -1
  179. package/index.cjs474.js +1 -1
  180. package/index.cjs475.js +1 -1
  181. package/index.cjs479.js +1 -1
  182. package/index.cjs480.js +1 -1
  183. package/index.cjs484.js +1 -1
  184. package/index.cjs486.js +1 -1
  185. package/index.cjs487.js +1 -1
  186. package/index.cjs488.js +1 -1
  187. package/index.cjs489.js +1 -1
  188. package/index.cjs490.js +1 -1
  189. package/index.cjs491.js +1 -1
  190. package/index.cjs492.js +1 -1
  191. package/index.cjs493.js +1 -1
  192. package/index.cjs494.js +1 -1
  193. package/index.cjs495.js +1 -1
  194. package/index.cjs496.js +1 -1
  195. package/index.cjs497.js +1 -1
  196. package/index.cjs498.js +1 -1
  197. package/index.cjs499.js +1 -1
  198. package/index.cjs500.js +1 -1
  199. package/index.cjs85.js +1 -1
  200. package/index.cjs86.js +1 -1
  201. package/index.cjs89.js +1 -1
  202. package/index.cjs92.js +1 -1
  203. package/index.cjs96.js +1 -1
  204. package/index.es128.js +1 -1
  205. package/index.es141.js +6 -6
  206. package/index.es144.js +5 -5
  207. package/index.es145.js +1 -1
  208. package/index.es146.js +7 -7
  209. package/index.es147.js +5 -5
  210. package/index.es185.js +443 -2310
  211. package/index.es186.js +2300 -2114
  212. package/index.es187.js +2152 -11
  213. package/index.es188.js +11 -139
  214. package/index.es189.js +139 -6
  215. package/index.es190.js +6 -471
  216. package/index.es205.js +2 -2
  217. package/index.es225.js +4 -4
  218. package/index.es231.js +1 -1
  219. package/index.es236.js +98 -8
  220. package/index.es237.js +31 -6
  221. package/index.es238.js +9 -6
  222. package/index.es239.js +141 -7
  223. package/index.es240.js +117 -14
  224. package/index.es241.js +68 -16
  225. package/index.es242.js +31 -9
  226. package/index.es243.js +9 -7
  227. package/index.es244.js +153 -5
  228. package/index.es245.js +106 -513
  229. package/index.es246.js +8 -50
  230. package/index.es247.js +5 -18
  231. package/index.es248.js +5 -6
  232. package/index.es249.js +7 -9
  233. package/index.es250.js +13 -6
  234. package/index.es251.js +15 -5
  235. package/index.es252.js +8 -6
  236. package/index.es253.js +6 -9
  237. package/index.es254.js +4 -5
  238. package/index.es255.js +514 -8
  239. package/index.es256.js +50 -13
  240. package/index.es257.js +18 -9
  241. package/index.es258.js +6 -8
  242. package/index.es259.js +8 -10
  243. package/index.es260.js +6 -14
  244. package/index.es261.js +5 -4
  245. package/index.es262.js +6 -38
  246. package/index.es263.js +10 -65
  247. package/index.es264.js +5 -9
  248. package/index.es265.js +8 -8
  249. package/index.es266.js +12 -7
  250. package/index.es267.js +9 -7
  251. package/index.es268.js +8 -15
  252. package/index.es269.js +11 -98
  253. package/index.es270.js +15 -31
  254. package/index.es271.js +5 -9
  255. package/index.es272.js +37 -139
  256. package/index.es273.js +64 -116
  257. package/index.es274.js +10 -68
  258. package/index.es275.js +9 -31
  259. package/index.es276.js +8 -9
  260. package/index.es277.js +8 -153
  261. package/index.es278.js +16 -108
  262. package/index.es282.js +12 -3
  263. package/index.es283.js +25 -2
  264. package/index.es284.js +10 -12
  265. package/index.es285.js +38 -24
  266. package/index.es286.js +1997 -8
  267. package/index.es287.js +6 -38
  268. package/index.es288.js +71 -1999
  269. package/index.es289.js +24 -6
  270. package/index.es290.js +3 -71
  271. package/index.es291.js +2 -25
  272. package/index.es301.js +1 -1
  273. package/index.es304.js +1 -1
  274. package/index.es306.js +1 -1
  275. package/index.es310.js +2 -2
  276. package/index.es312.js +6 -4
  277. package/index.es313.js +15 -56
  278. package/index.es314.js +28 -27
  279. package/index.es315.js +14 -46
  280. package/index.es316.js +4 -66
  281. package/index.es317.js +56 -37
  282. package/index.es318.js +22 -13
  283. package/index.es319.js +38 -59
  284. package/index.es320.js +47 -48
  285. package/index.es321.js +21 -52
  286. package/index.es322.js +13 -63
  287. package/index.es323.js +47 -25
  288. package/index.es324.js +47 -26
  289. package/index.es325.js +47 -37
  290. package/index.es326.js +47 -27
  291. package/index.es327.js +37 -34
  292. package/index.es328.js +26 -51
  293. package/index.es329.js +39 -52
  294. package/index.es330.js +27 -75
  295. package/index.es331.js +28 -32
  296. package/index.es332.js +56 -31
  297. package/index.es333.js +60 -35
  298. package/index.es334.js +88 -22
  299. package/index.es335.js +39 -22
  300. package/index.es336.js +39 -22
  301. package/index.es337.js +39 -23
  302. package/index.es338.js +22 -21
  303. package/index.es339.js +20 -20
  304. package/index.es340.js +24 -14
  305. package/index.es341.js +23 -38
  306. package/index.es342.js +22 -38
  307. package/index.es343.js +24 -14
  308. package/index.es344.js +14 -14
  309. package/index.es345.js +45 -6
  310. package/index.es346.js +44 -14
  311. package/index.es347.js +19 -28
  312. package/index.es348.js +19 -14
  313. package/index.es356.js +1 -1
  314. package/index.es357.js +1 -1
  315. package/index.es365.js +8 -8
  316. package/index.es371.js +4 -4
  317. package/index.es373.js +5 -5
  318. package/index.es374.js +4 -4
  319. package/index.es376.js +1 -1
  320. package/index.es378.js +3 -3
  321. package/index.es383.js +3 -3
  322. package/index.es384.js +1 -1
  323. package/index.es385.js +1 -1
  324. package/index.es395.js +1 -1
  325. package/index.es396.js +1 -1
  326. package/index.es401.js +6 -2
  327. package/index.es402.js +2 -2
  328. package/index.es403.js +2 -13
  329. package/index.es404.js +24 -143
  330. package/index.es405.js +19 -41
  331. package/index.es406.js +32 -3
  332. package/index.es407.js +6 -41
  333. package/index.es408.js +2 -7
  334. package/index.es409.js +6 -75
  335. package/index.es410.js +3 -54
  336. package/index.es411.js +18 -7
  337. package/index.es412.js +64 -73
  338. package/index.es413.js +15 -23
  339. package/index.es414.js +15 -62
  340. package/index.es415.js +3 -4
  341. package/index.es416.js +12 -6
  342. package/index.es417.js +143 -32
  343. package/index.es418.js +42 -58
  344. package/index.es419.js +3 -13
  345. package/index.es420.js +41 -4
  346. package/index.es421.js +7 -9
  347. package/index.es422.js +75 -54
  348. package/index.es423.js +54 -3
  349. package/index.es424.js +8 -5
  350. package/index.es425.js +76 -17
  351. package/index.es426.js +24 -17
  352. package/index.es427.js +62 -17
  353. package/index.es428.js +5 -17
  354. package/index.es429.js +59 -17
  355. package/index.es430.js +13 -17
  356. package/index.es431.js +3 -16
  357. package/index.es432.js +9 -5
  358. package/index.es433.js +55 -24
  359. package/index.es434.js +5 -21
  360. package/index.es435.js +17 -6
  361. package/index.es436.js +17 -3
  362. package/index.es437.js +16 -3
  363. package/index.es438.js +17 -19
  364. package/index.es439.js +17 -67
  365. package/index.es440.js +17 -16
  366. package/index.es441.js +17 -15
  367. package/index.es455.js +1 -1
  368. package/index.es460.js +2 -11
  369. package/index.es461.js +66 -3
  370. package/index.es462.js +65 -8
  371. package/index.es463.js +78 -4
  372. package/index.es464.js +255 -42
  373. package/index.es465.js +31 -24
  374. package/index.es466.js +6 -78
  375. package/index.es467.js +120 -247
  376. package/index.es468.js +17 -34
  377. package/index.es469.js +7 -6
  378. package/index.es47.js +2 -2
  379. package/index.es470.js +3 -131
  380. package/index.es471.js +48 -17
  381. package/index.es472.js +24 -6
  382. package/index.es473.js +11 -2
  383. package/index.es474.js +3 -66
  384. package/index.es475.js +8 -65
  385. package/index.es479.js +1 -1
  386. package/index.es480.js +1 -1
  387. package/index.es484.js +1 -1
  388. package/index.es486.js +1 -1
  389. package/index.es487.js +2 -8
  390. package/index.es488.js +2 -7
  391. package/index.es489.js +7 -19
  392. package/index.es490.js +7 -51
  393. package/index.es491.js +18 -247
  394. package/index.es492.js +51 -43
  395. package/index.es493.js +247 -14
  396. package/index.es494.js +43 -10
  397. package/index.es495.js +15 -47
  398. package/index.es496.js +10 -26
  399. package/index.es497.js +37 -118
  400. package/index.es498.js +23 -109
  401. package/index.es499.js +129 -2
  402. package/index.es500.js +112 -2
  403. package/index.es85.js +1 -1
  404. package/index.es86.js +1 -1
  405. package/index.es89.js +2 -2
  406. package/index.es92.js +2 -2
  407. package/index.es96.js +1 -1
  408. package/package.json +1 -1
package/index.cjs128.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index.cjs207.js"),M=require("./index.cjs186.js"),d=require("./index.cjs129.js"),l={iY:{sectionType:"year",contentType:"letter"},iYY:{sectionType:"year",contentType:"letter"},iYYYY:{sectionType:"year",contentType:"letter"},iM:"month",iMM:"month",iMMM:{sectionType:"month",contentType:"letter"},iMMMM:{sectionType:"month",contentType:"letter"},iD:{sectionType:"day",contentType:"digit",maxLength:2},iDD:"day",A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},u={year:"iYYYY",month:"iMMMM",monthShort:"iMMM",dayOfMonth:"iD",weekday:"dddd",weekdayShort:"ddd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"iYYYY, iMMMM Do",fullDateWithWeekday:"iYYYY, iMMMM Do, dddd",keyboardDateTime:"iYYYY/iMM/iDD LT",shortDate:"iD iMMM",normalDate:"dddd, iD iMMM",normalDateWithWeekday:"DD iMMMM",monthAndYear:"iMMMM iYYYY",monthAndDate:"iD iMMMM",fullTime:"LT",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",fullDateTime:"iYYYY, iMMMM Do, hh:mm A",fullDateTime12h:"iD iMMMM hh:mm A",fullDateTime24h:"iD iMMMM HH:mm",keyboardDate:"iYYYY/iMM/iDD",keyboardDateTime12h:"iYYYY/iMM/iDD hh:mm A",keyboardDateTime24h:"iYYYY/iMM/iDD HH:mm"},c={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"};class Y extends d.AdapterMoment{constructor({formats:h,instance:a}={}){super({locale:"ar-SA",instance:a}),this.lib="moment-hijri",this.moment=void 0,this.isTimezoneCompatible=!1,this.formatTokenMap=l,this.date=e=>e===null?null:this.moment(e).locale("ar-SA"),this.dateWithTimezone=e=>this.date(e),this.getTimezone=()=>"default",this.setTimezone=e=>e,this.parse=(e,t)=>e===""?null:this.moment(e,t,!0).locale("ar-SA"),this.getFormatHelperText=e=>this.expandFormat(e).replace(/a/gi,"(a|p)m").replace("iY","Y").replace("iM","M").replace("iD","D").toLocaleLowerCase(),this.formatNumber=e=>e.replace(/\d/g,t=>c[t]).replace(/,/g,"،"),this.isEqual=(e,t)=>e===null&&t===null?!0:this.moment(e).isSame(t),this.startOfYear=e=>e.clone().startOf("iYear"),this.startOfMonth=e=>e.clone().startOf("iMonth"),this.endOfYear=e=>e.clone().endOf("iYear"),this.endOfMonth=e=>e.clone().endOf("iMonth"),this.addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"iYear"):e.clone().add(t,"iYear"),this.addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"iMonth"):e.clone().add(t,"iMonth"),this.getYear=e=>e.iYear(),this.getMonth=e=>e.iMonth(),this.getDate=e=>e.iDate(),this.setYear=(e,t)=>e.clone().iYear(t),this.setMonth=(e,t)=>e.clone().iMonth(t),this.setDate=(e,t)=>e.clone().iDate(t),this.getNextMonth=e=>e.clone().add(1,"iMonth"),this.getPreviousMonth=e=>e.clone().subtract(1,"iMonth"),this.getWeekdays=()=>[0,1,2,3,4,5,6].map(e=>this.date().weekday(e).format("dd")),this.getWeekArray=e=>{const t=e.clone().startOf("iMonth").startOf("week"),o=e.clone().endOf("iMonth").endOf("week");let n=0,r=t;const i=[];for(;r.isBefore(o);){const s=Math.floor(n/7);i[s]=i[s]||[],i[s].push(r),r=r.clone().add(1,"day"),n+=1}return i},this.getWeekNumber=e=>e.iWeek(),this.getYearRange=(e,t)=>{if(e.isBefore("1937-03-14"))throw new Error("min date must be on or after 1356-01-01 H (1937-03-14)");if(t.isAfter("2076-11-26"))throw new Error("max date must be on or before 1499-12-29 H (2076-11-26)");const o=this.moment(e).startOf("iYear"),n=this.moment(t).endOf("iYear"),r=[];let i=o;for(;i.isBefore(n);)r.push(i),i=i.clone().add(1,"iYear");return r},this.getMeridiemText=e=>e==="am"?this.date().hours(2).format("A"):this.date().hours(14).format("A"),this.moment=a||M.default,this.locale="ar-SA",this.formats=m.default({},u,h)}}exports.AdapterMomentHijri=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index.cjs207.js"),M=require("./index.cjs187.js"),d=require("./index.cjs129.js"),l={iY:{sectionType:"year",contentType:"letter"},iYY:{sectionType:"year",contentType:"letter"},iYYYY:{sectionType:"year",contentType:"letter"},iM:"month",iMM:"month",iMMM:{sectionType:"month",contentType:"letter"},iMMMM:{sectionType:"month",contentType:"letter"},iD:{sectionType:"day",contentType:"digit",maxLength:2},iDD:"day",A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},u={year:"iYYYY",month:"iMMMM",monthShort:"iMMM",dayOfMonth:"iD",weekday:"dddd",weekdayShort:"ddd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"iYYYY, iMMMM Do",fullDateWithWeekday:"iYYYY, iMMMM Do, dddd",keyboardDateTime:"iYYYY/iMM/iDD LT",shortDate:"iD iMMM",normalDate:"dddd, iD iMMM",normalDateWithWeekday:"DD iMMMM",monthAndYear:"iMMMM iYYYY",monthAndDate:"iD iMMMM",fullTime:"LT",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",fullDateTime:"iYYYY, iMMMM Do, hh:mm A",fullDateTime12h:"iD iMMMM hh:mm A",fullDateTime24h:"iD iMMMM HH:mm",keyboardDate:"iYYYY/iMM/iDD",keyboardDateTime12h:"iYYYY/iMM/iDD hh:mm A",keyboardDateTime24h:"iYYYY/iMM/iDD HH:mm"},c={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"};class Y extends d.AdapterMoment{constructor({formats:h,instance:a}={}){super({locale:"ar-SA",instance:a}),this.lib="moment-hijri",this.moment=void 0,this.isTimezoneCompatible=!1,this.formatTokenMap=l,this.date=e=>e===null?null:this.moment(e).locale("ar-SA"),this.dateWithTimezone=e=>this.date(e),this.getTimezone=()=>"default",this.setTimezone=e=>e,this.parse=(e,t)=>e===""?null:this.moment(e,t,!0).locale("ar-SA"),this.getFormatHelperText=e=>this.expandFormat(e).replace(/a/gi,"(a|p)m").replace("iY","Y").replace("iM","M").replace("iD","D").toLocaleLowerCase(),this.formatNumber=e=>e.replace(/\d/g,t=>c[t]).replace(/,/g,"،"),this.isEqual=(e,t)=>e===null&&t===null?!0:this.moment(e).isSame(t),this.startOfYear=e=>e.clone().startOf("iYear"),this.startOfMonth=e=>e.clone().startOf("iMonth"),this.endOfYear=e=>e.clone().endOf("iYear"),this.endOfMonth=e=>e.clone().endOf("iMonth"),this.addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"iYear"):e.clone().add(t,"iYear"),this.addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"iMonth"):e.clone().add(t,"iMonth"),this.getYear=e=>e.iYear(),this.getMonth=e=>e.iMonth(),this.getDate=e=>e.iDate(),this.setYear=(e,t)=>e.clone().iYear(t),this.setMonth=(e,t)=>e.clone().iMonth(t),this.setDate=(e,t)=>e.clone().iDate(t),this.getNextMonth=e=>e.clone().add(1,"iMonth"),this.getPreviousMonth=e=>e.clone().subtract(1,"iMonth"),this.getWeekdays=()=>[0,1,2,3,4,5,6].map(e=>this.date().weekday(e).format("dd")),this.getWeekArray=e=>{const t=e.clone().startOf("iMonth").startOf("week"),o=e.clone().endOf("iMonth").endOf("week");let n=0,r=t;const i=[];for(;r.isBefore(o);){const s=Math.floor(n/7);i[s]=i[s]||[],i[s].push(r),r=r.clone().add(1,"day"),n+=1}return i},this.getWeekNumber=e=>e.iWeek(),this.getYearRange=(e,t)=>{if(e.isBefore("1937-03-14"))throw new Error("min date must be on or after 1356-01-01 H (1937-03-14)");if(t.isAfter("2076-11-26"))throw new Error("max date must be on or before 1499-12-29 H (2076-11-26)");const o=this.moment(e).startOf("iYear"),n=this.moment(t).endOf("iYear"),r=[];let i=o;for(;i.isBefore(n);)r.push(i),i=i.clone().add(1,"iYear");return r},this.getMeridiemText=e=>e==="am"?this.date().hours(2).format("A"):this.date().hours(14).format("A"),this.moment=a||M.default,this.locale="ar-SA",this.formats=m.default({},u,h)}}exports.AdapterMomentHijri=Y;
package/index.cjs141.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("./index.cjs244.js"),i=require("./index.cjs245.js"),S=require("./index.cjs246.js"),u=require("./index.cjs247.js"),F=require("./index.cjs248.js"),P=require("./index.cjs238.js"),R=require("./index.cjs144.js"),W=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Y=/^'([^]*?)'?$/,y=/''/g,z=/[a-zA-Z]/;function m(a,n,e){var k,d,g,h,T,w,D,O;const c=C.getDefaultOptions(),l=(e==null?void 0:e.locale)??c.locale??R.enUS,v=(e==null?void 0:e.firstWeekContainsDate)??((d=(k=e==null?void 0:e.locale)==null?void 0:k.options)==null?void 0:d.firstWeekContainsDate)??c.firstWeekContainsDate??((h=(g=c.locale)==null?void 0:g.options)==null?void 0:h.firstWeekContainsDate)??1,E=(e==null?void 0:e.weekStartsOn)??((w=(T=e==null?void 0:e.locale)==null?void 0:T.options)==null?void 0:w.weekStartsOn)??c.weekStartsOn??((O=(D=c.locale)==null?void 0:D.options)==null?void 0:O.weekStartsOn)??0,o=P.toDate(a,e==null?void 0:e.in);if(!F.isValid(o))throw new RangeError("Invalid time value");let s=n.match(x).map(t=>{const r=t[0];if(r==="p"||r==="P"){const f=S.longFormatters[r];return f(t,l.formatLong)}return t}).join("").match(W).map(t=>{if(t==="''")return{isToken:!1,value:"'"};const r=t[0];if(r==="'")return{isToken:!1,value:$(t)};if(i.formatters[r])return{isToken:!0,value:t};if(r.match(z))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return{isToken:!1,value:t}});l.localize.preprocessor&&(s=l.localize.preprocessor(o,s));const q={firstWeekContainsDate:v,weekStartsOn:E,locale:l};return s.map(t=>{if(!t.isToken)return t.value;const r=t.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&u.isProtectedWeekYearToken(r)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&u.isProtectedDayOfYearToken(r))&&u.warnOrThrowProtectedError(r,n,String(a));const f=i.formatters[r[0]];return f(o,r,l.localize,q)}).join("")}function $(a){const n=a.match(Y);return n?n[1].replace(y,"'"):a}exports.formatters=i.formatters;exports.longFormatters=S.longFormatters;exports.default=m;exports.format=m;exports.formatDate=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("./index.cjs254.js"),i=require("./index.cjs255.js"),S=require("./index.cjs256.js"),u=require("./index.cjs257.js"),F=require("./index.cjs258.js"),P=require("./index.cjs248.js"),R=require("./index.cjs144.js"),W=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Y=/^'([^]*?)'?$/,y=/''/g,z=/[a-zA-Z]/;function m(a,n,e){var k,d,g,h,T,w,D,O;const c=C.getDefaultOptions(),l=(e==null?void 0:e.locale)??c.locale??R.enUS,v=(e==null?void 0:e.firstWeekContainsDate)??((d=(k=e==null?void 0:e.locale)==null?void 0:k.options)==null?void 0:d.firstWeekContainsDate)??c.firstWeekContainsDate??((h=(g=c.locale)==null?void 0:g.options)==null?void 0:h.firstWeekContainsDate)??1,E=(e==null?void 0:e.weekStartsOn)??((w=(T=e==null?void 0:e.locale)==null?void 0:T.options)==null?void 0:w.weekStartsOn)??c.weekStartsOn??((O=(D=c.locale)==null?void 0:D.options)==null?void 0:O.weekStartsOn)??0,o=P.toDate(a,e==null?void 0:e.in);if(!F.isValid(o))throw new RangeError("Invalid time value");let s=n.match(x).map(t=>{const r=t[0];if(r==="p"||r==="P"){const f=S.longFormatters[r];return f(t,l.formatLong)}return t}).join("").match(W).map(t=>{if(t==="''")return{isToken:!1,value:"'"};const r=t[0];if(r==="'")return{isToken:!1,value:$(t)};if(i.formatters[r])return{isToken:!0,value:t};if(r.match(z))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return{isToken:!1,value:t}});l.localize.preprocessor&&(s=l.localize.preprocessor(o,s));const q={firstWeekContainsDate:v,weekStartsOn:E,locale:l};return s.map(t=>{if(!t.isToken)return t.value;const r=t.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&u.isProtectedWeekYearToken(r)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&u.isProtectedDayOfYearToken(r))&&u.warnOrThrowProtectedError(r,n,String(a));const f=i.formatters[r[0]];return f(o,r,l.localize,q)}).join("")}function $(a){const n=a.match(Y);return n?n[1].replace(y,"'"):a}exports.formatters=i.formatters;exports.longFormatters=S.longFormatters;exports.default=m;exports.format=m;exports.formatDate=m;
package/index.cjs144.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs274.js"),o=require("./index.cjs275.js"),a=require("./index.cjs276.js"),r=require("./index.cjs277.js"),i=require("./index.cjs278.js"),e={code:"en-US",formatDistance:t.formatDistance,formatLong:o.formatLong,formatRelative:a.formatRelative,localize:r.localize,match:i.match,options:{weekStartsOn:0,firstWeekContainsDate:1}};exports.default=e;exports.enUS=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs241.js"),o=require("./index.cjs242.js"),a=require("./index.cjs243.js"),r=require("./index.cjs244.js"),i=require("./index.cjs245.js"),e={code:"en-US",formatDistance:t.formatDistance,formatLong:o.formatLong,formatRelative:a.formatRelative,localize:r.localize,match:i.match,options:{weekStartsOn:0,firstWeekContainsDate:1}};exports.default=e;exports.enUS=e;
package/index.cjs145.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./index.cjs248.js"),a=require("./index.cjs146.js");function e(t,i,r){return s.isValid(a.parse(t,i,new Date,r))}exports.default=e;exports.isMatch=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./index.cjs258.js"),a=require("./index.cjs146.js");function e(t,i,r){return s.isValid(a.parse(t,i,new Date,r))}exports.default=e;exports.isMatch=e;
package/index.cjs146.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./index.cjs246.js"),f=require("./index.cjs247.js"),j=require("./index.cjs237.js"),L=require("./index.cjs251.js"),C=require("./index.cjs238.js"),M=require("./index.cjs262.js"),W=require("./index.cjs263.js"),S=require("./index.cjs144.js"),z=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,U=/^'([^]*?)'?$/,_=/''/g,H=/\S/,I=/[a-zA-Z]/;function A(a,i,u,e){var T,O,y,D,E,F,q,P;const s=()=>j.constructFrom((e==null?void 0:e.in)||u,NaN),l=L.getDefaultOptions(),o=(e==null?void 0:e.locale)??l.locale??S.enUS,$=(e==null?void 0:e.firstWeekContainsDate)??((O=(T=e==null?void 0:e.locale)==null?void 0:T.options)==null?void 0:O.firstWeekContainsDate)??l.firstWeekContainsDate??((D=(y=l.locale)==null?void 0:y.options)==null?void 0:D.firstWeekContainsDate)??1,Y=(e==null?void 0:e.weekStartsOn)??((F=(E=e==null?void 0:e.locale)==null?void 0:E.options)==null?void 0:F.weekStartsOn)??l.weekStartsOn??((P=(q=l.locale)==null?void 0:q.options)==null?void 0:P.weekStartsOn)??0;if(!i)return a?s():C.toDate(u,e==null?void 0:e.in);const g={firstWeekContainsDate:$,weekStartsOn:Y,locale:o},m=[new M.DateTimezoneSetter(e==null?void 0:e.in,u)],v=i.match(Q).map(r=>{const t=r[0];if(t in d.longFormatters){const n=d.longFormatters[t];return n(r,o.formatLong)}return r}).join("").match(z),k=[];for(let r of v){!(e!=null&&e.useAdditionalWeekYearTokens)&&f.isProtectedWeekYearToken(r)&&f.warnOrThrowProtectedError(r,i,a),!(e!=null&&e.useAdditionalDayOfYearTokens)&&f.isProtectedDayOfYearToken(r)&&f.warnOrThrowProtectedError(r,i,a);const t=r[0],n=W.parsers[t];if(n){const{incompatibleTokens:R}=n;if(Array.isArray(R)){const b=k.find(x=>R.includes(x.token)||x.token===t);if(b)throw new RangeError(`The format string mustn't contain \`${b.fullToken}\` and \`${r}\` at the same time`)}else if(n.incompatibleTokens==="*"&&k.length>0)throw new RangeError(`The format string mustn't contain \`${r}\` and any other token at the same time`);k.push({token:t,fullToken:r});const h=n.run(a,r,o.match,g);if(!h)return s();m.push(h.setter),a=h.rest}else{if(t.match(I))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");if(r==="''"?r="'":t==="'"&&(r=K(r)),a.indexOf(r)===0)a=a.slice(r.length);else return s()}}if(a.length>0&&H.test(a))return s();const N=m.map(r=>r.priority).sort((r,t)=>t-r).filter((r,t,n)=>n.indexOf(r)===t).map(r=>m.filter(t=>t.priority===r).sort((t,n)=>n.subPriority-t.subPriority)).map(r=>r[0]);let c=C.toDate(u,e==null?void 0:e.in);if(isNaN(+c))return s();const w={};for(const r of N){if(!r.validate(c,g))return s();const t=r.set(c,w,g);Array.isArray(t)?(c=t[0],Object.assign(w,t[1])):c=t}return c}function K(a){return a.match(U)[1].replace(_,"'")}exports.longFormatters=d.longFormatters;exports.parsers=W.parsers;exports.default=A;exports.parse=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./index.cjs256.js"),f=require("./index.cjs257.js"),j=require("./index.cjs247.js"),L=require("./index.cjs261.js"),C=require("./index.cjs248.js"),M=require("./index.cjs272.js"),W=require("./index.cjs273.js"),S=require("./index.cjs144.js"),z=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,U=/^'([^]*?)'?$/,_=/''/g,H=/\S/,I=/[a-zA-Z]/;function A(a,i,u,e){var T,O,y,D,E,F,q,P;const s=()=>j.constructFrom((e==null?void 0:e.in)||u,NaN),l=L.getDefaultOptions(),o=(e==null?void 0:e.locale)??l.locale??S.enUS,$=(e==null?void 0:e.firstWeekContainsDate)??((O=(T=e==null?void 0:e.locale)==null?void 0:T.options)==null?void 0:O.firstWeekContainsDate)??l.firstWeekContainsDate??((D=(y=l.locale)==null?void 0:y.options)==null?void 0:D.firstWeekContainsDate)??1,Y=(e==null?void 0:e.weekStartsOn)??((F=(E=e==null?void 0:e.locale)==null?void 0:E.options)==null?void 0:F.weekStartsOn)??l.weekStartsOn??((P=(q=l.locale)==null?void 0:q.options)==null?void 0:P.weekStartsOn)??0;if(!i)return a?s():C.toDate(u,e==null?void 0:e.in);const g={firstWeekContainsDate:$,weekStartsOn:Y,locale:o},m=[new M.DateTimezoneSetter(e==null?void 0:e.in,u)],v=i.match(Q).map(r=>{const t=r[0];if(t in d.longFormatters){const n=d.longFormatters[t];return n(r,o.formatLong)}return r}).join("").match(z),k=[];for(let r of v){!(e!=null&&e.useAdditionalWeekYearTokens)&&f.isProtectedWeekYearToken(r)&&f.warnOrThrowProtectedError(r,i,a),!(e!=null&&e.useAdditionalDayOfYearTokens)&&f.isProtectedDayOfYearToken(r)&&f.warnOrThrowProtectedError(r,i,a);const t=r[0],n=W.parsers[t];if(n){const{incompatibleTokens:R}=n;if(Array.isArray(R)){const b=k.find(x=>R.includes(x.token)||x.token===t);if(b)throw new RangeError(`The format string mustn't contain \`${b.fullToken}\` and \`${r}\` at the same time`)}else if(n.incompatibleTokens==="*"&&k.length>0)throw new RangeError(`The format string mustn't contain \`${r}\` and any other token at the same time`);k.push({token:t,fullToken:r});const h=n.run(a,r,o.match,g);if(!h)return s();m.push(h.setter),a=h.rest}else{if(t.match(I))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");if(r==="''"?r="'":t==="'"&&(r=K(r)),a.indexOf(r)===0)a=a.slice(r.length);else return s()}}if(a.length>0&&H.test(a))return s();const N=m.map(r=>r.priority).sort((r,t)=>t-r).filter((r,t,n)=>n.indexOf(r)===t).map(r=>m.filter(t=>t.priority===r).sort((t,n)=>n.subPriority-t.subPriority)).map(r=>r[0]);let c=C.toDate(u,e==null?void 0:e.in);if(isNaN(+c))return s();const w={};for(const r of N){if(!r.validate(c,g))return s();const t=r.set(c,w,g);Array.isArray(t)?(c=t[0],Object.assign(w,t[1])):c=t}return c}function K(a){return a.match(U)[1].replace(_,"'")}exports.longFormatters=d.longFormatters;exports.parsers=W.parsers;exports.default=A;exports.parse=A;
package/index.cjs147.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs269.js"),a=require("./index.cjs270.js"),o=require("./index.cjs271.js"),r=require("./index.cjs272.js"),i=require("./index.cjs273.js"),e={code:"ar-SA",formatDistance:t.formatDistance,formatLong:a.formatLong,formatRelative:o.formatRelative,localize:r.localize,match:i.match,options:{weekStartsOn:0,firstWeekContainsDate:1}};exports.arSA=e;exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index.cjs236.js"),a=require("./index.cjs237.js"),o=require("./index.cjs238.js"),r=require("./index.cjs239.js"),i=require("./index.cjs240.js"),e={code:"ar-SA",formatDistance:t.formatDistance,formatLong:a.formatLong,formatRelative:o.formatRelative,localize:r.localize,match:i.match,options:{weekStartsOn:0,firstWeekContainsDate:1}};exports.arSA=e;exports.default=e;
package/index.cjs185.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("./index.cjs203.js");var Ue={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},b,k;exports.Log=(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))(exports.Log||{});(e=>{function t(){b=3,k=Ue}e.reset=t;function s(r){if(!(0<=r&&r<=4))throw new Error("Invalid log level");b=r}e.setLevel=s;function i(r){k=r}e.setLogger=i})(exports.Log||(exports.Log={}));var g=class v{constructor(t){this._name=t}debug(...t){b>=4&&k.debug(v._format(this._name,this._method),...t)}info(...t){b>=3&&k.info(v._format(this._name,this._method),...t)}warn(...t){b>=2&&k.warn(v._format(this._name,this._method),...t)}error(...t){b>=1&&k.error(v._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){const s=Object.create(this);return s._method=t,s.debug("begin"),s}static createStatic(t,s){const i=new v(`${t}.${s}`);return i.debug("begin"),i}static _format(t,s){const i=`[${t}]`;return s?`${i} ${s}:`:i}static debug(t,...s){b>=4&&k.debug(v._format(t),...s)}static info(t,...s){b>=3&&k.info(v._format(t),...s)}static warn(t,...s){b>=2&&k.warn(v._format(t),...s)}static error(t,...s){b>=1&&k.error(v._format(t),...s)}};exports.Log.reset();var $=class{static decode(e){try{return Ce.jwtDecode(e)}catch(t){throw g.error("JwtUtils.decode",t),t}}static async generateSignedJwt(e,t,s){const i=f.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=f.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),o=`${i}.${r}`,n=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},s,new TextEncoder().encode(o)),c=f.encodeBase64Url(new Uint8Array(n));return`${o}.${c}`}},Oe="10000000-1000-4000-8000-100000000000",L=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),oe=class y{static _randomWord(){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return Oe.replace(/[018]/g,s=>(+s^y._randomWord()&15>>+s/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return y.generateUUIDv4()+y.generateUUIDv4()+y.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{const i=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",i);return L(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(s){throw g.error("CryptoUtils.generateCodeChallenge",s),s}}static generateBasicAuth(t,s){const r=new TextEncoder().encode([t,s].join(":"));return L(r)}static async hash(t,s){const i=new TextEncoder().encode(s),r=await crypto.subtle.digest(t,i);return new Uint8Array(r)}static async customCalculateJwkThumbprint(t){let s;switch(t.kty){case"RSA":s={e:t.e,kty:t.kty,n:t.n};break;case"EC":s={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":s={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":s={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}const i=await y.hash("SHA-256",JSON.stringify(s));return y.encodeBase64Url(i)}static async generateDPoPProof({url:t,accessToken:s,httpMethod:i,keyPair:r,nonce:o}){let n,c;const a={jti:window.crypto.randomUUID(),htm:i??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};s&&(n=await y.hash("SHA-256",s),c=y.encodeBase64Url(n),a.ath=c),o&&(a.nonce=o);try{const l=await crypto.subtle.exportKey("jwk",r.publicKey),d={alg:"ES256",typ:"dpop+jwt",jwk:{crv:l.crv,kty:l.kty,x:l.x,y:l.y}};return await $.generateSignedJwt(d,a,r.privateKey)}catch(l){throw l instanceof TypeError?new Error(`Error exporting dpop public key: ${l.message}`):l}}static async generateDPoPJkt(t){try{const s=await crypto.subtle.exportKey("jwk",t.publicKey);return await y.customCalculateJwkThumbprint(s)}catch(s){throw s instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${s.message}`):s}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}};oe.encodeBase64Url=e=>L(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var f=oe,I=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new g(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)await t(...e)}},se=class{static center({...e}){var t,s,i;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}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,s])=>`${t}=${typeof s!="boolean"?s:s?"yes":"no"}`).join(",")}},T=class H extends I{constructor(){super(...arguments),this._logger=new g(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const t=this._expiration-H.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=H.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){const s=this._logger.create("init");t=Math.max(Math.floor(t),1);const i=H.getEpochTime()+t;if(this.expiration===i&&this._timerHandle){s.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),s.debug("using duration",t),this._expiration=i;const r=Math.min(t,5);this._timerHandle=setInterval(this._callback,r*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},F=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const i=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(i.slice(1))}},N=";",x=class extends Error{constructor(e,t){var s,i,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw g.error("ErrorResponse","No error passed"),new Error("No error passed");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}},K=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},ae=class{constructor(e){this._logger=new g("AccessTokenEvents"),this._expiringTimer=new T("Access token expiring"),this._expiredTimer=new T("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){const t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){const s=e.expires_in;if(t.debug("access token present, remaining duration:",s),s>0){let r=s-this._expiringNotificationTimeInSeconds;r<=0&&(r=1),t.debug("registering expiring timer, raising in",r,"seconds"),this._expiringTimer.init(r)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const i=s+1;t.debug("registering expired timer, raising in",i,"seconds"),this._expiredTimer.init(i)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},ce=class{constructor(e,t,s,i,r){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=>{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"))};const o=new URL(s);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}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},G=class{constructor(){this._logger=new g("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},z=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},Q=class{constructor(e=[],t=null,s={}){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")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:s,...i}=t;if(!s)return await fetch(e,i);const r=new AbortController,o=setTimeout(()=>r.abort(),s*1e3);try{return await fetch(e,{...t,signal:r.signal})}catch(n){throw n instanceof DOMException&&n.name==="AbortError"?new K("Network timed out"):n}finally{clearTimeout(o)}}async getJson(e,{token:t,credentials:s,timeoutInSeconds:i}={}){const r=this._logger.create("getJson"),o={Accept:this._contentTypes.join(", ")};t&&(r.debug("token passed, setting Authorization header"),o.Authorization="Bearer "+t),this._appendExtraHeaders(o);let n;try{r.debug("url:",e),n=await this.fetchWithTimeout(e,{method:"GET",headers:o,timeoutInSeconds:i,credentials:s})}catch(l){throw r.error("Network Error"),l}r.debug("HTTP response received, status",n.status);const c=n.headers.get("Content-Type");if(c&&!this._contentTypes.find(l=>c.startsWith(l))&&r.throw(new Error(`Invalid response Content-Type: ${c??"undefined"}, from URL: ${e}`)),n.ok&&this._jwtHandler&&(c!=null&&c.startsWith("application/jwt")))return await this._jwtHandler(await n.text());let a;try{a=await n.json()}catch(l){throw r.error("Error parsing JSON response",l),n.ok?l:new Error(`${n.statusText} (${n.status})`)}if(!n.ok)throw r.error("Error from server:",a),a.error?new x(a):new Error(`${n.statusText} (${n.status}): ${JSON.stringify(a)}`);return a}async postForm(e,{body:t,basicAuth:s,timeoutInSeconds:i,initCredentials:r,extraHeaders:o}){const n=this._logger.create("postForm"),c={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...o};s!==void 0&&(c.Authorization="Basic "+s),this._appendExtraHeaders(c);let a;try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:c,body:t,timeoutInSeconds:i,credentials:r})}catch(u){throw n.error("Network error"),u}n.debug("HTTP response received, status",a.status);const l=a.headers.get("Content-Type");if(l&&!this._contentTypes.find(u=>l.startsWith(u)))throw new Error(`Invalid response Content-Type: ${l??"undefined"}, from URL: ${e}`);const d=await a.text();let h={};if(d)try{h=JSON.parse(d)}catch(u){throw n.error("Error parsing JSON response",u),a.ok?u:new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",h),a.headers.has("dpop-nonce")){const u=a.headers.get("dpop-nonce");throw new z(u,`${JSON.stringify(h)}`)}throw h.error?new x(h,t):new Error(`${a.statusText} (${a.status}): ${JSON.stringify(h)}`)}return h}_appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),s=Object.keys(this._extraHeaders),i=["accept","content-type"],r=["authorization"];s.length!==0&&s.forEach(o=>{if(i.includes(o.toLocaleLowerCase())){t.warn("Protected header could not be set",o,i);return}if(r.includes(o.toLocaleLowerCase())&&Object.keys(e).includes(o)){t.warn("Header could not be overridden",o,r);return}const n=typeof this._extraHeaders[o]=="function"?this._extraHeaders[o]():this._extraHeaders[o];n&&n!==""&&(e[o]=n)})}},le=class{constructor(e){this._settings=e,this._logger=new g("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Q(["application/jwk-set+json"],null,this._settings.extraHeaders),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)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const s=this._logger.create(`_getMetadataProperty('${e}')`),i=await this.getMetadata();if(s.debug("resolved"),i[e]===void 0){if(t===!0){s.warn("Metadata does not contain optional property");return}s.throw(new Error("Metadata does not contain property "+e))}return i[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const s=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",s),!Array.isArray(s.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=s.keys,this._signingKeys}},X=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new g("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let s=0;s<e;s++){const i=await this._store.key(s);i&&i.indexOf(this._prefix)===0&&t.push(i.substr(this._prefix.length))}return t}},Ae="code",qe="openid",Ne="client_secret_post",Me=60*15,J=class{constructor({authority:e,metadataUrl:t,metadata:s,signingKeys:i,metadataSeed:r,client_id:o,client_secret:n,response_type:c=Ae,scope:a=qe,redirect_uri:l,post_logout_redirect_uri:d,client_authentication:h=Ne,prompt:u,display:p,max_age:C,ui_locales:U,acr_values:O,resource:A,response_mode:R,filterProtocolClaims:P=!0,loadUserInfo:q=!1,requestTimeoutInSeconds:m,staleStateAgeInSeconds:_=Me,mergeClaimsStrategy:E={array:"replace"},disablePKCE:S=!1,stateStore:w,revokeTokenAdditionalContentTypes:j,fetchRequestCredentials:ee,refreshTokenAllowedScope:ke,extraQueryParams:Ee={},extraTokenParams:Te={},extraHeaders:Re={},dpop:Pe,omitScopeWhenRequesting:Ie=!1}){var te;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=c,this.scope=a,this.redirect_uri=l,this.post_logout_redirect_uri=d,this.client_authentication=h,this.prompt=u,this.display=p,this.max_age=C,this.ui_locales=U,this.acr_values=O,this.resource=A,this.response_mode=R,this.filterProtocolClaims=P??!0,this.loadUserInfo=!!q,this.staleStateAgeInSeconds=_,this.mergeClaimsStrategy=E,this.omitScopeWhenRequesting=Ie,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=j,this.fetchRequestCredentials=ee||"same-origin",this.requestTimeoutInSeconds=m,w)this.stateStore=w;else{const xe=typeof window<"u"?window.localStorage:new G;this.stateStore=new X({store:xe})}if(this.refreshTokenAllowedScope=ke,this.extraQueryParams=Ee,this.extraTokenParams=Te,this.extraHeaders=Re,this.dpop=Pe,this.dpop&&!((te=this.dpop)!=null&&te.store))throw new Error("A DPoPStore is required when dpop is enabled")}},je=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new g("UserInfoService"),this._getClaimsFromJwt=async s=>{const i=this._logger.create("_getClaimsFromJwt");try{const r=$.decode(s);return i.debug("JWT decoding successful"),r}catch(r){throw i.error("Error parsing JWT response"),r}},this._jsonService=new Q(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const s=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",s);const i=await this._jsonService.getJson(s,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",i),i}},de=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new g("TokenClient"),this._jsonService=new Q(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:s=this._settings.client_id,client_secret:i=this._settings.client_secret,extraHeaders:r,...o}){const n=this._logger.create("exchangeCode");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"));const c=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[h,u]of Object.entries(o))u!=null&&c.set(h,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(i==null)throw n.throw(new Error("A client_secret is required")),null;a=f.generateBasicAuth(s,i);break;case"client_secret_post":c.append("client_id",s),i&&c.append("client_secret",i);break}const l=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");const d=await this._jsonService.postForm(l,{body:c,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return n.debug("got response"),d}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:s=this._settings.client_secret,scope:i=this._settings.scope,...r}){const o=this._logger.create("exchangeCredentials");t||o.throw(new Error("A client_id is required"));const n=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||n.set("scope",i);for(const[d,h]of Object.entries(r))h!=null&&n.set(d,h);let c;switch(this._settings.client_authentication){case"client_secret_basic":if(s==null)throw o.throw(new Error("A client_secret is required")),null;c=f.generateBasicAuth(t,s);break;case"client_secret_post":n.append("client_id",t),s&&n.append("client_secret",s);break}const a=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const l=await this._jsonService.postForm(a,{body:n,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:s=this._settings.client_secret,timeoutInSeconds:i,extraHeaders:r,...o}){const n=this._logger.create("exchangeRefreshToken");t||n.throw(new Error("A client_id is required")),o.refresh_token||n.throw(new Error("A refresh_token is required"));const c=new URLSearchParams({grant_type:e});for(const[h,u]of Object.entries(o))Array.isArray(u)?u.forEach(p=>c.append(h,p)):u!=null&&c.set(h,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(s==null)throw n.throw(new Error("A client_secret is required")),null;a=f.generateBasicAuth(t,s);break;case"client_secret_post":c.append("client_id",t),s&&c.append("client_secret",s);break}const l=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");const d=await this._jsonService.postForm(l,{body:c,basicAuth:a,timeoutInSeconds:i,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return n.debug("got response"),d}async revoke(e){var t;const s=this._logger.create("revoke");e.token||s.throw(new Error("A token is required"));const i=await this._metadataService.getRevocationEndpoint(!1);s.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);const r=new URLSearchParams;for(const[o,n]of Object.entries(e))n!=null&&r.set(o,n);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")}},He=class{constructor(e,t,s){this._settings=e,this._metadataService=t,this._claimsService=s,this._logger=new g("ResponseValidator"),this._userInfoService=new je(this._settings,this._metadataService),this._tokenClient=new de(this._settings,this._metadataService)}async validateSigninResponse(e,t,s){const i=this._logger.create("validateSigninResponse");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")}async validateCredentialsResponse(e,t){const s=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),s.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),s.debug("claims processed")}async validateRefreshResponse(e,t){var s,i;const r=this._logger.create("validateRefreshResponse");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);const o=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,o),r.debug("claims processed")}validateSignoutResponse(e,t){const s=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&s.throw(new Error("State does not match")),s.debug("state validated"),e.userState=t.data,e.error)throw s.warn("Response was error",e.error),new x(e)}_processSigninState(e,t){var s;const i=this._logger.create("_processSigninState");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)throw i.warn("Response was error",e.error),new x(e);t.code_verifier&&!e.code&&i.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,s=!0){const i=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){i.debug("not loading user info");return}i.debug("loading user info");const r=await this._userInfoService.getClaims(e.access_token);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)}async _processCode(e,t,s){const i=this._logger.create("_processCode");if(e.code){i.debug("Validating code");const r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:s,...t.extraTokenParams});Object.assign(e,r)}else i.debug("No code to process")}_validateIdTokenAttributes(e,t){var s;const i=this._logger.create("_validateIdTokenAttributes");i.debug("decoding ID Token JWT");const r=$.decode((s=e.id_token)!=null?s:"");if(r.sub||i.throw(new Error("ID Token is missing a subject claim")),t){const o=$.decode(t);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"))}e.profile=r}},M=class B{constructor(t){this.id=t.id||f.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}toStorageString(){return new g("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return g.createStatic("State","fromStorageString"),Promise.resolve(new B(JSON.parse(t)))}static async clearStaleState(t,s){const i=g.createStatic("State","clearStaleState"),r=T.getEpochTime()-s,o=await t.getAllKeys();i.debug("got keys",o);for(let n=0;n<o.length;n++){const c=o[n],a=await t.get(c);let l=!1;if(a)try{const d=await B.fromStorageString(a);i.debug("got item from key:",c,d.created),d.created<=r&&(l=!0)}catch(d){i.error("Error parsing state for key:",c,d),l=!0}else i.debug("no item in storage for key:",c),l=!0;l&&(i.debug("removed item for key:",c),t.remove(c))}}},Y=class V extends M{constructor(t){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}static async create(t){const s=t.code_verifier===!0?f.generateCodeVerifier():t.code_verifier||void 0,i=s?await f.generateCodeChallenge(s):void 0;return new V({...t,code_verifier:s,code_challenge:i})}toStorageString(){return new g("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(t){g.createStatic("SigninState","fromStorageString");const s=JSON.parse(t);return V.create(s)}},he=class ge{constructor(t){this.url=t.url,this.state=t.state}static async create({url:t,authority:s,client_id:i,redirect_uri:r,response_type:o,scope:n,state_data:c,response_mode:a,request_type:l,client_secret:d,nonce:h,url_state:u,resource:p,skipUserInfo:C,extraQueryParams:U,extraTokenParams:O,disablePKCE:A,dpopJkt:R,omitScopeWhenRequesting:P,...q}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!i)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!o)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!n)throw this._logger.error("create: No scope passed"),new Error("scope");if(!s)throw this._logger.error("create: No authority passed"),new Error("authority");const m=await Y.create({data:c,request_type:l,url_state:u,code_verifier:!A,client_id:i,authority:s,redirect_uri:r,response_mode:a,client_secret:d,scope:n,extraTokenParams:O,skipUserInfo:C}),_=new URL(t);_.searchParams.append("client_id",i),_.searchParams.append("redirect_uri",r),_.searchParams.append("response_type",o),P||_.searchParams.append("scope",n),h&&_.searchParams.append("nonce",h),R&&_.searchParams.append("dpop_jkt",R);let E=m.id;u&&(E=`${E}${N}${u}`),_.searchParams.append("state",E),m.code_challenge&&(_.searchParams.append("code_challenge",m.code_challenge),_.searchParams.append("code_challenge_method","S256")),p&&(Array.isArray(p)?p:[p]).forEach(w=>_.searchParams.append("resource",w));for(const[S,w]of Object.entries({response_mode:a,...q,...U}))w!=null&&_.searchParams.append(S,w.toString());return new ge({url:_.href,state:m})}};he._logger=new g("SigninRequest");var De=he,We="openid",D=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const t=decodeURIComponent(this.state).split(N);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(N))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-T.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+T.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(We))||!!this.id_token}},$e=class{constructor({url:e,state_data:t,id_token_hint:s,post_logout_redirect_uri:i,extraQueryParams:r,request_type:o,client_id:n,url_state:c}){if(this._logger=new g("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const a=new URL(e);if(s&&a.searchParams.append("id_token_hint",s),n&&a.searchParams.append("client_id",n),i&&(a.searchParams.append("post_logout_redirect_uri",i),t||c)){this.state=new M({data:t,request_type:o,url_state:c});let l=this.state.id;c&&(l=`${l}${N}${c}`),a.searchParams.append("state",l)}for(const[l,d]of Object.entries({...r}))d!=null&&a.searchParams.append(l,d.toString());this.url=a.href}},ue=class{constructor(e){if(this.state=e.get("state"),this.state){const t=decodeURIComponent(this.state).split(N);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(N))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},Je=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],Ke=["sub","iss","aud","exp","iat"],Le=class{constructor(e){this._settings=e,this._logger=new g("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let s;Array.isArray(this._settings.filterProtocolClaims)?s=this._settings.filterProtocolClaims:s=Je;for(const i of s)Ke.includes(i)||delete t[i]}return t}mergeClaims(e,t){const s={...e};for(const[i,r]of Object.entries(t))if(s[i]!==r)if(Array.isArray(s[i])||Array.isArray(r))if(this._settings.mergeClaimsStrategy.array=="replace")s[i]=r;else{const o=Array.isArray(s[i])?s[i]:[s[i]];for(const n of Array.isArray(r)?r:[r])o.includes(n)||o.push(n);s[i]=o}else typeof s[i]=="object"&&typeof r=="object"?s[i]=this.mergeClaims(s[i],r):s[i]=r;return s}},Z=class{constructor(e,t){this.keys=e,this.nonce=t}},_e=class{constructor(e,t){this._logger=new g("OidcClient"),this.settings=e instanceof J?e:new J(e),this.metadataService=t??new le(this.settings),this._claimsService=new Le(this.settings),this._validator=new He(this.settings,this.metadataService,this._claimsService),this._tokenClient=new de(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:s,request_type:i,id_token_hint:r,login_hint:o,skipUserInfo:n,nonce:c,url_state:a,response_type:l=this.settings.response_type,scope:d=this.settings.scope,redirect_uri:h=this.settings.redirect_uri,prompt:u=this.settings.prompt,display:p=this.settings.display,max_age:C=this.settings.max_age,ui_locales:U=this.settings.ui_locales,acr_values:O=this.settings.acr_values,resource:A=this.settings.resource,response_mode:R=this.settings.response_mode,extraQueryParams:P=this.settings.extraQueryParams,extraTokenParams:q=this.settings.extraTokenParams,dpopJkt:m,omitScopeWhenRequesting:_=this.settings.omitScopeWhenRequesting}){const E=this._logger.create("createSigninRequest");if(l!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");const S=await this.metadataService.getAuthorizationEndpoint();E.debug("Received authorization endpoint",S);const w=await De.create({url:S,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:h,response_type:l,scope:d,state_data:e,url_state:a,prompt:u,display:p,max_age:C,ui_locales:U,id_token_hint:r,login_hint:o,acr_values:O,dpopJkt:m,resource:A,request:t,request_uri:s,extraQueryParams:P,extraTokenParams:q,request_type:i,response_mode:R,client_secret:this.settings.client_secret,skipUserInfo:n,nonce:c,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:_});await this.clearStaleState();const j=w.state;return await this.settings.stateStore.set(j.id,j.toStorageString()),w}async readSigninResponseState(e,t=!1){const s=this._logger.create("readSigninResponseState"),i=new D(F.readParams(e,this.settings.response_mode));if(!i.state)throw s.throw(new Error("No state in response")),null;const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw s.throw(new Error("No matching state found in storage")),null;return{state:await Y.fromStorageString(r),response:i}}async processSigninResponse(e,t,s=!0){const i=this._logger.create("processSigninResponse"),{state:r,response:o}=await this.readSigninResponseState(e,s);if(i.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){const n=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:n}}try{await this._validator.validateSigninResponse(o,r,t)}catch(n){if(n instanceof z&&this.settings.dpop){const c=await this.getDpopProof(this.settings.dpop.store,n.nonce);t.DPoP=c,await this._validator.validateSigninResponse(o,r,t)}else throw n}return o}async getDpopProof(e,t){let s,i;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 f.generateDPoPKeys(),i=new Z(s,t),await e.set(this.settings.client_id,i)),await f.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:i.keys,nonce:i.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:s=!1,extraTokenParams:i={}}){const r=await this._tokenClient.exchangeCredentials({username:e,password:t,...i}),o=new D(new URLSearchParams);return Object.assign(o,r),await this._validator.validateCredentialsResponse(o,s),o}async useRefreshToken({state:e,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,extraTokenParams:o}){var n;const c=this._logger.create("useRefreshToken");let a;if(this.settings.refreshTokenAllowedScope===void 0)a=e.scope;else{const h=this.settings.refreshTokenAllowedScope.split(" ");a=(((n=e.scope)==null?void 0:n.split(" "))||[]).filter(p=>h.includes(p)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){const h=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:h}}let l;try{l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:a,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,...o})}catch(h){if(h instanceof z&&this.settings.dpop)r.DPoP=await this.getDpopProof(this.settings.dpop.store,h.nonce),l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:a,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,...o});else throw h}const d=new D(new URLSearchParams);return Object.assign(d,l),c.debug("validating response",d),await this._validator.validateRefreshResponse(d,{...e,scope:a}),d}async createSignoutRequest({state:e,id_token_hint:t,client_id:s,request_type:i,url_state:r,post_logout_redirect_uri:o=this.settings.post_logout_redirect_uri,extraQueryParams:n=this.settings.extraQueryParams}={}){const c=this._logger.create("createSignoutRequest"),a=await this.metadataService.getEndSessionEndpoint();if(!a)throw c.throw(new Error("No end session endpoint")),null;c.debug("Received end session endpoint",a),!s&&o&&!t&&(s=this.settings.client_id);const l=new $e({url:a,id_token_hint:t,client_id:s,post_logout_redirect_uri:o,state_data:e,extraQueryParams:n,request_type:i,url_state:r});await this.clearStaleState();const d=l.state;return d&&(c.debug("Signout request has state to persist"),await this.settings.stateStore.set(d.id,d.toStorageString())),l}async readSignoutResponseState(e,t=!1){const s=this._logger.create("readSignoutResponseState"),i=new ue(F.readParams(e,this.settings.response_mode));if(!i.state){if(s.debug("No state in response"),i.error)throw s.warn("Response was error:",i.error),new x(i);return{state:void 0,response:i}}const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw s.throw(new Error("No matching state found in storage")),null;return{state:await M.fromStorageString(r),response:i}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:s,response:i}=await this.readSignoutResponseState(e,!0);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}clearStaleState(){return this._logger.create("clearStaleState"),M.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},pe=class{constructor(e){this._userManager=e,this._logger=new g("SessionMonitor"),this._start=async t=>{const s=t.session_state;if(!s)return;const i=this._logger.create("_start");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){this._checkSessionIFrame.start(s);return}try{const r=await this._userManager.metadataService.getCheckSessionIframe();if(r){i.debug("initializing check session iframe");const o=this._userManager.settings.client_id,n=this._userManager.settings.checkSessionIntervalInSeconds,c=this._userManager.settings.stopCheckSessionOnError,a=new ce(this._callback,o,r,n,c);await a.load(),this._checkSessionIFrame=a,a.start(s)}else i.warn("no check session iframe found in the metadata")}catch(r){i.error("Error from getCheckSessionIframe:",r instanceof Error?r.message:r)}},this._stop=()=>{const t=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const s=setInterval(async()=>{clearInterval(s);try{const i=await this._userManager.querySessionStatus();if(i){const r={session_state:i.session_state,profile:i.sub?{sub:i.sub}:null};this._start(r)}}catch(i){t.error("error from querySessionStatus",i instanceof Error?i.message:i)}},1e3)}},this._callback=async()=>{const t=this._logger.create("_callback");try{const s=await this._userManager.querySessionStatus();let i=!0;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")}catch(s){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",s),await this._userManager.events._raiseUserSignedOut())}},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=>{this._logger.error(t)})}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const t=await this._userManager.querySessionStatus();if(t){const s={session_state:t.session_state,profile:t.sub?{sub:t.sub}:null};this._start(s)}}}},W=class fe{constructor(t){var s;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}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-T.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+T.getEpochTime())}get expired(){const t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,s;return(s=(t=this.scope)==null?void 0:t.split(" "))!=null?s:[]}toStorageString(){return new g("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return g.createStatic("User","fromStorageString"),new fe(JSON.parse(t))}},ie="oidc-client",we=class{constructor(){this._abort=new I("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:s,keepOpen:i}=await new Promise((r,o)=>{const n=c=>{var a;const l=c.data,d=(a=e.scriptOrigin)!=null?a:window.location.origin;if(!(c.origin!==d||(l==null?void 0:l.source)!==ie)){try{const h=F.readParams(l.url,e.response_mode).get("state");if(h||t.warn("no state found in response url"),c.source!==this._window&&h!==e.state)return}catch{this._dispose(),o(new Error("Invalid response from window"))}r(l)}};window.addEventListener("message",n,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",n,!1)),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),o(c)}))});return t.debug("got response from window"),this._dispose(),i||this.close(),{url:s}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,s=!1,i=window.location.origin){e.postMessage({source:ie,url:t,keepOpen:s},i)}},me={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Se="_blank",Fe=60,ze=2,ve=10,ye=class extends J{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:s=e.post_logout_redirect_uri,popupWindowFeatures:i=me,popupWindowTarget:r=Se,redirectMethod:o="assign",redirectTarget:n="self",iframeNotifyParentOrigin:c=e.iframeNotifyParentOrigin,iframeScriptOrigin:a=e.iframeScriptOrigin,requestTimeoutInSeconds:l,silent_redirect_uri:d=e.redirect_uri,silentRequestTimeoutInSeconds:h,automaticSilentRenew:u=!0,validateSubOnSilentRenew:p=!0,includeIdTokenInSilentRenew:C=!1,monitorSession:U=!1,monitorAnonymousSession:O=!1,checkSessionIntervalInSeconds:A=ze,query_status_response_type:R="code",stopCheckSessionOnError:P=!0,revokeTokenTypes:q=["access_token","refresh_token"],revokeTokensOnSignout:m=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=Fe,userStore:S}=e;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=c,this.iframeScriptOrigin=a,this.silent_redirect_uri=d,this.silentRequestTimeoutInSeconds=h||l||ve,this.automaticSilentRenew=u,this.validateSubOnSilentRenew=p,this.includeIdTokenInSilentRenew=C,this.monitorSession=U,this.monitorAnonymousSession=O,this.checkSessionIntervalInSeconds=A,this.stopCheckSessionOnError=P,this.query_status_response_type=R,this.revokeTokenTypes=q,this.revokeTokensOnSignout=m,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,S)this.userStore=S;else{const w=typeof window<"u"?window.sessionStorage:new G;this.userStore=new X({store:w})}}},re=class be extends we{constructor({silentRequestTimeoutInSeconds:t=ve}){super(),this._logger=new g("IFrameWindow"),this._timeoutInSeconds=t,this._frame=be.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const t=window.document.createElement("iframe");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}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const s=setTimeout(()=>void this._abort.raise(new K("IFrame timed out without a response")),this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(s)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",s=>{var i;const r=s.target;(i=r.parentNode)==null||i.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,s){return super._notifyParent(window.parent,t,!1,s)}},Be=class{constructor(e){this._settings=e,this._logger=new g("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new re({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),re.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},Ve=500,Ge=1e3,ne=class extends we{constructor({popupWindowTarget:e=Se,popupWindowFeatures:t={},popupSignal:s}){super(),this._logger=new g("PopupWindow");const i=se.center({...me,...t});this._window=window.open(void 0,e,se.serialize(i)),s&&s.addEventListener("abort",()=>{var r;this._abort.raise(new Error((r=s.reason)!=null?r:"Popup aborted"))}),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*Ge)}async navigate(e){var t;(t=this._window)==null||t.focus();const s=setInterval(()=>{(!this._window||this._window.closed)&&this._abort.raise(new Error("Popup closed by user"))},Ve);return this._disposeHandlers.add(()=>clearInterval(s)),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},Qe=class{constructor(e){this._settings=e,this._logger=new g("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:s}){return new ne({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:s})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),ne.notifyOpener(e,t)}},Xe=class{constructor(e){this._settings=e,this._logger=new g("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var s;this._logger.create("prepare");let i=window.self;t==="top"&&(i=(s=window.top)!=null?s:window.self);const r=i.location[e].bind(i.location);let o;return{navigate:async n=>{this._logger.create("navigate");const c=new Promise((a,l)=>{o=l});return r(n.url),await c},close:()=>{this._logger.create("close"),o==null||o(new Error("Redirect aborted")),i.stop()}}}async callback(){}},Ye=class extends ae{constructor(e){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")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},Ze=class{constructor(e){this._userManager=e,this._logger=new g("SilentRenewService"),this._isStarted=!1,this._retryTimer=new T("Retry Silent Renew"),this._tokenExpiring=async()=>{const t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),t.debug("silent token renewal successful")}catch(s){if(s instanceof K){t.warn("ErrorTimeout from signinSilent:",s,"retry in 5s"),this._retryTimer.init(5);return}t.error("Error from signinSilent:",s),await this._userManager.events._raiseSilentRenewError(s)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},et=class{constructor(e){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}},tt=class{constructor(e,t,s,i){this._logger=new g("UserManager"),this.settings=new ye(e),this._client=new _e(e),this._redirectNavigator=t??new Xe(this.settings),this._popupNavigator=s??new Qe(this.settings),this._iframeNavigator=i??new Be(this.settings),this._events=new Ye(this.settings),this._silentRenewService=new Ze(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new pe(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){const t=this._logger.create("getUser"),s=await this._loadUser();return s?(t.info("user loaded"),await this._events.load(s,e),s):(t.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");const{redirectMethod:s,...i}=e;let r;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(r=await this.generateDPoPJkt(this.settings.dpop));const o=await this._redirectNavigator.prepare({redirectMethod:s});await this._signinStart({request_type:"si:r",dpopJkt:r,...i},o)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),s=await this._signinEnd(e);return s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject"),s}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:s=!1}){const i=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:s,extraTokenParams:this.settings.extraTokenParams});i.debug("got signin response");const o=await this._buildUser(r);return o.profile&&o.profile.sub?i.info("success, signed in subject",o.profile.sub):i.info("no subject"),o}async signinPopup(e={}){var t;const s=this._logger.create("signinPopup");let i;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(i=await this.generateDPoPJkt(this.settings.dpop));const{popupWindowFeatures:r,popupWindowTarget:o,popupSignal:n,...c}=e,a=this.settings.popup_redirect_uri;a||s.throw(new Error("No popup_redirect_uri configured"));const l=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:o,popupSignal:n}),d=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",dpopJkt:i,...c},l);return d&&(d.profile&&d.profile.sub?s.info("success, signed in subject",d.profile.sub):s.info("no subject")),d}async signinPopupCallback(e=window.location.href,t=!1){const s=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),s.info("success")}async signinSilent(e={}){var t,s;const i=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...o}=e;let n=await this._loadUser();if(n!=null&&n.refresh_token){i.debug("using refresh token");const h=new et(n);return await this._useRefreshToken({state:h,redirect_uri:o.redirect_uri,resource:o.resource,extraTokenParams:o.extraTokenParams,timeoutInSeconds:r})}let c;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(c=await this.generateDPoPJkt(this.settings.dpop));const a=this.settings.silent_redirect_uri;a||i.throw(new Error("No silent_redirect_uri configured"));let l;n&&this.settings.validateSubOnSilentRenew&&(i.debug("subject prior to silent renew:",n.profile.sub),l=n.profile.sub);const d=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return n=await this._signin({request_type:"si:s",redirect_uri:a,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?n==null?void 0:n.id_token:void 0,dpopJkt:c,...o},d,l),n&&((s=n.profile)!=null&&s.sub?i.info("success, signed in subject",n.profile.sub):i.info("no subject")),n}async _useRefreshToken(e){const t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),s=new W({...e.state,...t});return await this.storeUser(s),await this._events.load(s),s}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:s}=await this._client.readSignoutResponseState(e);if(s)switch(s.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:s,...i}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));const o=await this._loadUser(),n=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s}),c=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?o==null?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...i},n);try{const a={},l=await this._client.processSigninResponse(c.url,a);return t.debug("got signin response"),l.session_state&&l.profile.sub?(t.info("success for subject",l.profile.sub),{session_state:l.session_state,sub:l.profile.sub}):(t.info("success, user not authenticated"),null)}catch(a){if(this.settings.monitorAnonymousSession&&a instanceof x)switch(a.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:a.session_state}}throw a}}async _signin(e,t,s){const i=await this._signinStart(e,t);return await this._signinEnd(i.url,s)}async _signinStart(e,t){const s=this._logger.create("_signinStart");try{const i=await this._client.createSigninRequest(e);return s.debug("got signin request"),await t.navigate({url:i.url,state:i.state.id,response_mode:i.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw s.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signinEnd(e,t){const s=this._logger.create("_signinEnd"),i={},r=await this._client.processSigninResponse(e,i);return s.debug("got signin response"),await this._buildUser(r,t)}async _buildUser(e,t){const s=this._logger.create("_buildUser"),i=new W(e);if(t){if(t!==i.profile.sub)throw s.debug("current user does not match user returned from signin. sub from signin:",i.profile.sub),new x({...e,error:"login_required"});s.debug("current user matches user returned from signin")}return await this.storeUser(i),s.debug("user stored"),await this._events.load(i),i}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:s,...i}=e,r=await this._redirectNavigator.prepare({redirectMethod:s});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...i},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),s=await this._signoutEnd(e);return t.info("success"),s}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:s,popupWindowTarget:i,popupSignal:r,...o}=e,n=this.settings.popup_post_logout_redirect_uri,c=await this._popupNavigator.prepare({popupWindowFeatures:s,popupWindowTarget:i,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:n,state:n==null?void 0:{},...o},c),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const s=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),s.info("success")}async _signout(e,t){const s=await this._signoutStart(e,t);return await this._signoutEnd(s.url)}async _signoutStart(e={},t){var s;const i=this._logger.create("_signoutStart");try{const r=await this._loadUser();i.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);const o=e.id_token_hint||r&&r.id_token;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");const n=await this._client.createSignoutRequest(e);return i.debug("got signout request"),await t.navigate({url:n.url,state:(s=n.state)==null?void 0:s.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(r){throw i.debug("error after preparing navigator, closing navigator window"),t.close(),r}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),s=await this._client.processSignoutResponse(e);return t.debug("got signout response"),s}async signoutSilent(e={}){var t;const s=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:i,...r}=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,c=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});await this._signout({request_type:"so:s",post_logout_redirect_uri:n,id_token_hint:o,...r},c),s.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const s=this._logger.create("_revokeInternal");if(!e)return;const i=t.filter(r=>typeof e[r]=="string");if(!i.length){s.debug("no need to revoke due to no token(s)");return}for(const r of i)await this._client.revokeToken(e[r],r),s.info(`${r} revoked successfully`),r!=="access_token"&&(e[r]=null);await this.storeUser(e),s.debug("user stored"),await this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),W.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const s=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,s)}else 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)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,s,i){var r,o;const n=await((o=(r=this.settings.dpop)==null?void 0:r.store)==null?void 0:o.get(this.settings.client_id));if(n)return await f.generateDPoPProof({url:e,accessToken:t==null?void 0:t.access_token,httpMethod:s,keyPair:n.keys,nonce:i})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){const s=await f.generateDPoPKeys();t=new Z(s),await e.store.set(this.settings.client_id,t)}return await f.generateDPoPJkt(t.keys)}};exports.AccessTokenEvents=ae;exports.CheckSessionIFrame=ce;exports.DPoPState=Z;exports.ErrorResponse=x;exports.ErrorTimeout=K;exports.InMemoryWebStorage=G;exports.Logger=g;exports.MetadataService=le;exports.OidcClient=_e;exports.OidcClientSettingsStore=J;exports.SessionMonitor=pe;exports.SigninResponse=D;exports.SigninState=Y;exports.SignoutResponse=ue;exports.State=M;exports.User=W;exports.UserManager=tt;exports.UserManagerSettingsStore=ye;exports.WebStorageStateStore=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var R=Symbol.for("immer-nothing"),A=Symbol.for("immer-draftable"),u=Symbol.for("immer-state"),Z=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){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}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function f(e,...t){if(process.env.NODE_ENV!=="production"){const r=Z[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var p=Object.getPrototypeOf;function y(e){return!!e&&!!e[u]}function d(e){var t;return e?U(e)||Array.isArray(e)||!!e[A]||!!((t=e.constructor)!=null&&t[A])||D(e)||O(e):!1}var L=Object.prototype.constructor.toString();function U(e){if(!e||typeof e!="object")return!1;const t=p(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===L}function b(e,t){z(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function z(e){const t=e[u];return t?t.type_:Array.isArray(e)?1:D(e)?2:O(e)?3:0}function N(e,t){return z(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function B(e,t,r){const n=z(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function V(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function D(e){return e instanceof Map}function O(e){return e instanceof Set}function _(e){return e.copy_||e.base_}function C(e,t){if(D(e))return new Map(e);if(O(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=U(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[u];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){const c=i[o],s=n[c];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[c]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[c]})}return Object.create(p(e),n)}else{const n=p(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function S(e,t=!1){return F(e)||y(e)||!d(e)||(z(e)>1&&(e.set=e.add=e.clear=e.delete=ee),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>S(n,!0))),e}function ee(){f(2)}function F(e){return Object.isFrozen(e)}var te={};function m(e){const t=te[e];return t||f(0,e),t}var h;function G(){return h}function re(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function x(e,t){t&&(m("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function I(e){k(e),e.drafts_.forEach(ne),e.drafts_=null}function k(e){e===h&&(h=e.parent_)}function $(e){return h=re(h,e)}function ne(e){const t=e[u];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function K(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[u].modified_&&(I(t),f(4)),d(e)&&(e=g(t,e),t.parent_||w(t,e)),t.patches_&&m("Patches").generateReplacementPatches_(r[u].base_,e,t.patches_,t.inversePatches_)):e=g(t,r,[]),I(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==R?e:void 0}function g(e,t,r){if(F(t))return t;const n=t[u];if(!n)return b(t,(i,o)=>W(e,n,t,i,o,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return w(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const i=n.copy_;let o=i,c=!1;n.type_===3&&(o=new Set(i),i.clear(),c=!0),b(o,(s,l)=>W(e,n,i,s,l,r,c)),w(e,i,!1),r&&e.patches_&&m("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function W(e,t,r,n,i,o,c){if(process.env.NODE_ENV!=="production"&&i===r&&f(5),y(i)){const s=o&&t&&t.type_!==3&&!N(t.assigned_,n)?o.concat(n):void 0,l=g(e,i,s);if(B(r,n,l),y(l))e.canAutoFreeze_=!1;else return}else c&&r.add(i);if(d(i)&&!F(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;g(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&w(e,i)}}function w(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&S(t,r)}function ie(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:G(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,o=j;r&&(i=[n],o=P);const{revoke:c,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=c,s}var j={get(e,t){if(t===u)return e;const r=_(e);if(!N(r,t))return oe(e,r,t);const n=r[t];return e.finalized_||!d(n)?n:n===E(e.base_,t)?(v(e),e.copy_[t]=M(n,e)):n},has(e,t){return t in _(e)},ownKeys(e){return Reflect.ownKeys(_(e))},set(e,t,r){const n=H(_(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=E(_(e),t),o=i==null?void 0:i[u];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(V(r,i)&&(r!==void 0||N(e.base_,t)))return!0;v(e),T(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return E(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,v(e),T(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=_(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){f(11)},getPrototypeOf(e){return p(e.base_)},setPrototypeOf(){f(12)}},P={};b(j,(e,t)=>{P[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});P.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&f(13),P.set.call(this,e,t,void 0)};P.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&f(14),j.set.call(this,e[0],t,r,e[0])};function E(e,t){const r=e[u];return(r?_(r):e)[t]}function oe(e,t,r){var i;const n=H(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function H(e,t){if(!(t in e))return;let r=p(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=p(r)}}function T(e){e.modified_||(e.modified_=!0,e.parent_&&T(e.parent_))}function v(e){e.copy_||(e.copy_=C(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var X=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const o=r;r=t;const c=this;return function(l=o,...Q){return c.produce(l,Y=>r.call(this,Y,...Q))}}typeof r!="function"&&f(6),n!==void 0&&typeof n!="function"&&f(7);let i;if(d(t)){const o=$(this),c=M(t,void 0);let s=!0;try{i=r(c),s=!1}finally{s?I(o):k(o)}return x(o,n),K(i,o)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===R&&(i=void 0),this.autoFreeze_&&S(i,!0),n){const o=[],c=[];m("Patches").generateReplacementPatches_(t,i,o,c),n(o,c)}return i}else f(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(c,...s)=>this.produceWithPatches(c,l=>t(l,...s));let n,i;return[this.produce(t,r,(c,s)=>{n=c,i=s}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){d(e)||f(8),y(e)&&(e=q(e));const t=$(this),r=M(e,void 0);return r[u].isManual_=!0,k(t),r}finishDraft(e,t){const r=e&&e[u];(!r||!r.isManual_)&&f(9);const{scope_:n}=r;return x(n,t),K(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=m("Patches").applyPatches_;return y(e)?n(e,t):this.produce(e,i=>n(i,t))}};function M(e,t){const r=D(e)?m("MapSet").proxyMap_(e,t):O(e)?m("MapSet").proxySet_(e,t):ie(e,t);return(t?t.scope_:G()).drafts_.push(r),r}function q(e){return y(e)||f(10,e),J(e)}function J(e){if(!d(e)||F(e))return e;const t=e[u];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=C(e,t.scope_.immer_.useStrictShallowCopy_)}else r=C(e,!0);return b(r,(n,i)=>{B(r,n,J(i))}),t&&(t.finalized_=!1),r}var a=new X,ce=a.produce;a.produceWithPatches.bind(a);a.setAutoFreeze.bind(a);a.setUseStrictShallowCopy.bind(a);a.applyPatches.bind(a);a.createDraft.bind(a);a.finishDraft.bind(a);exports.Immer=X;exports.current=q;exports.freeze=S;exports.immerable=A;exports.isDraft=y;exports.isDraftable=d;exports.nothing=R;exports.produce=ce;
package/index.cjs186.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./index.cjs196.js"),C=require("./index.cjs204.js"),o3=require("./index.cjs205.js");(function(G,l3){(function(h,D){G.exports=D(o3.__require())})(L.commonjsGlobal,function(h){if(h==null)throw new Error("Cannot find moment");var D={ummalquraData:[28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},w=/(\[[^\[]*\])|(\\)?i(Mo|MM?M?M?|Do|DDDo|DD?D?D?|w[o|w]?|YYYYY|YYYY|YY|gg(ggg?)?)|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,F=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,v=/\d\d?/,S=/\d{1,3}/,O=/\d{3}/,b=/\d{1,4}/,j=/[+\-]?\d{1,6}/,x=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.?)|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,z=/Z|[\+\-]\d\d:?\d\d/i,E=/T/i,J=/[\+\-]?\d+(\.\d{1,3})?/,Z={hd:"idate",hm:"imonth",hy:"iyear"},T={},P="DDD w M D".split(" "),I="M D w".split(" "),l={iM:function(){return this.iMonth()+1},iMMM:function(e){return this.localeData().iMonthsShort(this,e)},iMMMM:function(e){return this.localeData().iMonths(this,e)},iD:function(){return this.iDate()},iDDD:function(){return this.iDayOfYear()},iw:function(){return this.iWeek()},iYY:function(){return d(this.iYear()%100,2)},iYYYY:function(){return d(this.iYear(),4)},iYYYYY:function(){return d(this.iYear(),5)},igg:function(){return d(this.iWeekYear()%100,2)},igggg:function(){return this.iWeekYear()},iggggg:function(){return d(this.iWeekYear(),5)}},M;function A(e,t){return function(i){return d(e.call(this,i),t)}}function V(e,t){return function(i){return this.localeData().ordinal(e.call(this,i),t)}}for(;P.length;)M=P.pop(),l["i"+M+"o"]=V(l["i"+M],M);for(;I.length;)M=I.pop(),l["i"+M+M]=A(l["i"+M],2);l.iDDDD=A(l.iDDD,3);function p(e,t){var i;for(i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function d(e,t){for(var i=e+"";i.length<t;)i="0"+i;return i}function U(e){return Object.prototype.toString.call(e)==="[object Array]"}function m(e){return e&&(Z[e]||e.toLowerCase().replace(/(.)s$/,"$1"))}function _(e,t,i,r){var a=e._isUTC?"UTC":"";e._d["set"+a+"FullYear"](t),e._d["set"+a+"Month"](i),e._d["set"+a+"Date"](r)}function H(e){function t(){}return t.prototype=e,new t}function $(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):"".__proto__?e.__proto__:e.constructor.prototype}p($(h.localeData()),{_iMonths:["Muharram","Safar","Rabi' al-Awwal","Rabi' al-Thani","Jumada al-Ula","Jumada al-Alkhirah","Rajab","Sha’ban","Ramadhan","Shawwal","Thul-Qi’dah","Thul-Hijjah"],iMonths:function(e){return this._iMonths[e.iMonth()]},_iMonthsShort:["Muh","Saf","Rab-I","Rab-II","Jum-I","Jum-II","Raj","Sha","Ram","Shw","Dhu-Q","Dhu-H"],iMonthsShort:function(e){return this._iMonthsShort[e.iMonth()]},iMonthsParse:function(e){var t,i,r;for(this._iMonthsParse||(this._iMonthsParse=[]),t=0;t<12;t+=1)if(this._iMonthsParse[t]||(i=s([2e3,(2+t)%12,25]),r="^"+this.iMonths(i,"")+"$|^"+this.iMonthsShort(i,"")+"$",this._iMonthsParse[t]=new RegExp(r.replace(".",""),"i")),this._iMonthsParse[t].test(e))return t}});var q={iMonths:"محرم_صفر_ربيع الأول_ربيع الثاني_جمادى الأولى_جمادى الآخرة_رجب_شعبان_رمضان_شوال_ذو القعدة_ذو الحجة".split("_"),iMonthsShort:"محرم_صفر_ربيع ١_ربيع ٢_جمادى ١_جمادى ٢_رجب_شعبان_رمضان_شوال_ذو القعدة_ذو الحجة".split("_")};if(typeof h.updateLocale=="function")h.updateLocale("ar-sa",q);else{var B=h.locale();h.defineLocale("ar-sa",q),h.locale(B)}function Q(e){var t=e.match(w),i=t.length,r;for(r=0;r<i;r+=1)l[t[r]]&&(t[r]=l[t[r]]);return function(a){var n="";for(r=0;r<i;r+=1)n+=t[r]instanceof Function?"["+t[r].call(a,e)+"]":t[r];return n}}function N(e,t){switch(e){case"iDDDD":return O;case"iYYYY":return b;case"iYYYYY":return j;case"iDDD":return S;case"iMMM":case"iMMMM":return x;case"iMM":case"iDD":case"iYY":case"iM":case"iD":return v;case"DDDD":return O;case"YYYY":return b;case"YYYYY":return j;case"S":case"SS":case"SSS":case"DDD":return S;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return x;case"a":case"A":return h.localeData(t._l)._meridiemParse;case"X":return J;case"Z":case"ZZ":return z;case"T":return E;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return v;default:return new RegExp(e.replace("\\",""))}}function X(e,t,i){var r,a=i._a;switch(e){case"iM":case"iMM":a[1]=t==null?0:~~t-1;break;case"iMMM":case"iMMMM":r=h.localeData(i._l).iMonthsParse(t),r!=null?a[1]=r:i._isValid=!1;break;case"iD":case"iDD":case"iDDD":case"iDDDD":t!=null&&(a[2]=~~t);break;case"iYY":a[0]=~~t+(~~t>47?1300:1400);break;case"iYYYY":case"iYYYYY":a[0]=~~t}t==null&&(i._isValid=!1)}function K(e){var t,i,r=e._a[0],a=e._a[1],n=e._a[2];return r==null&&a==null&&n==null?[0,0,1]:(r=r||0,a=a||0,n=n||1,(n<1||n>s.iDaysInMonth(r,a))&&(e._isValid=!1),t=g(r,a,n),i=Y(t.gy,t.gm,t.gd),e._hDiff=0,~~i.hy!==r&&(e._hDiff+=1),~~i.hm!==a&&(e._hDiff+=1),~~i.hd!==n&&(e._hDiff+=1),[t.gy,t.gm,t.gd])}function e3(e){var t=e._f.match(w),i=e._i,r=t.length,a,n,o;for(e._a=[],a=0;a<r;a+=1)n=t[a],o=(N(n,e).exec(i)||[])[0],o&&(i=i.slice(i.indexOf(o)+o.length)),l[n]&&X(n,o,e);return i&&(e._il=i),K(e)}function t3(e,t){var i=e._f.length,r,a,n,o,u,c;if(i===0)return k(new Date(NaN));for(r=0;r<i;r+=1)a=e._f[r],u=0,n=k(e._i,a,e._l,t),n.isValid()&&(u+=n._hDiff,n._il&&(u+=n._il.length),(c==null||u<c)&&(c=u,o=n));return o}function i3(e){var t=e._i,i="",r="",a=e._f.match(w),n=a.length,o,u,c;for(o=0;o<n;o+=1)u=a[o],c=(N(u,e).exec(t)||[])[0],c&&(t=t.slice(t.indexOf(c)+c.length)),l[u]instanceof Function||(r+=u,c&&(i+=c));e._i=i,e._f=r}function W(e,t,i){var r=i-t,a=i-e.day(),n;return a>r&&(a-=7),a<r-7&&(a+=7),n=s(e).add(a,"d"),{week:Math.ceil(n.iDayOfYear()/7),year:n.iYear()}}function k(e,t,i,r){var a={_i:e,_f:t,_l:i},n,o,u;if(t){if(U(t))return t3(a,r);n=e3(a),i3(a),t="YYYY-MM-DD-"+a._f,e=d(n[0],4)+"-"+d(n[1]+1,2)+"-"+d(n[2],2)+"-"+a._i}return r?o=h.utc(e,t,i):o=h(e,t,i),a._isValid===!1&&(o._isValid=!1),o._hDiff=a._hDiff||0,u=H(s.fn),p(u,o),u}function s(e,t,i){return k(e,t,i,!1)}p(s,h),s.fn=H(h.fn),s.utc=function(e,t,i){return k(e,t,i,!0)},s.fn.format=function(e){var t,i,r=this;if(e){for(t=5,i=function(a){return r.localeData().longDateFormat(a)||a};t>0&&F.test(e);)t-=1,e=e.replace(F,i);T[e]||(T[e]=Q(e)),e=T[e](this)}return h.fn.format.call(this,e)},s.fn.iYear=function(e){var t,i,r;return typeof e=="number"?(i=Y(this.year(),this.month(),this.date()),t=Math.min(i.hd,s.iDaysInMonth(e,i.hm)),r=g(e,i.hm,t),_(this,r.gy,r.gm,r.gd),(this.month()!==r.gm||this.date()!==r.gd||this.year()!==r.gy)&&_(this,r.gy,r.gm,r.gd),h.updateOffset(this),this):Y(this.year(),this.month(),this.date()).hy},s.fn.iMonth=function(e){var t,i,r;if(e!=null){if(typeof e=="string")if(e=this.localeData().iMonthsParse(e),e>=0)e-=1;else return this;return i=Y(this.year(),this.month(),this.date()),t=Math.min(i.hd,s.iDaysInMonth(i.hy,e)),this.iYear(i.hy+f(e,12)),e=y(e,12),e<0&&(e+=12,this.iYear(this.iYear()-1)),r=g(this.iYear(),e,t),_(this,r.gy,r.gm,r.gd),(this.month()!==r.gm||this.date()!==r.gd||this.year()!==r.gy)&&_(this,r.gy,r.gm,r.gd),h.updateOffset(this),this}else return Y(this.year(),this.month(),this.date()).hm},s.fn.iDate=function(e){var t,i;return typeof e=="number"?(t=Y(this.year(),this.month(),this.date()),i=g(t.hy,t.hm,e),_(this,i.gy,i.gm,i.gd),(this.month()!==i.gm||this.date()!==i.gd||this.year()!==i.gy)&&_(this,i.gy,i.gm,i.gd),h.updateOffset(this),this):Y(this.year(),this.month(),this.date()).hd},s.fn.iDayOfYear=function(e){var t=Math.round((s(this).startOf("day")-s(this).startOf("iYear"))/864e5)+1;return e==null?t:this.add(e-t,"d")},s.fn.iDaysInMonth=function(){return parseInt(s(this).endOf("iMonth").format("iDD"))},s.fn.iWeek=function(e){var t=W(this,this.localeData()._week.dow,this.localeData()._week.doy).week;return e==null?t:this.add((e-t)*7,"d")},s.fn.iWeekYear=function(e){var t=W(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return e==null?t:this.add(e-t,"y")},s.fn.add=function(e,t){var i;return t!==null&&!isNaN(+t)&&(i=e,e=t,t=i),t=m(t),t==="iyear"?this.iYear(this.iYear()+e):t==="imonth"?this.iMonth(this.iMonth()+e):t==="idate"?this.iDate(this.iDate()+e):h.fn.add.call(this,e,t),this},s.fn.subtract=function(e,t){var i;return t!==null&&!isNaN(+t)&&(i=e,e=t,t=i),t=m(t),t==="iyear"?this.iYear(this.iYear()-e):t==="imonth"?this.iMonth(this.iMonth()-e):t==="idate"?this.iDate(this.iDate()-e):h.fn.subtract.call(this,e,t),this},s.fn.startOf=function(e){return e=m(e),e==="iyear"||e==="imonth"?(e==="iyear"&&this.iMonth(0),this.iDate(1),this.hours(0),this.minutes(0),this.seconds(0),this.milliseconds(0),this):h.fn.startOf.call(this,e)},s.fn.endOf=function(e){return e=m(e),e===void 0||e==="milisecond"?this:this.startOf(e).add(1,e==="isoweek"?"week":e).subtract(1,"milliseconds")},s.fn.clone=function(){return s(this)},s.fn.iYears=s.fn.iYear,s.fn.iMonths=s.fn.iMonth,s.fn.iDates=s.fn.iDate,s.fn.iWeeks=s.fn.iWeek,s.iDaysInMonth=function(e,t){var i=R(e,t+1),r=D.ummalquraData[i]-D.ummalquraData[i-1];return r};function Y(e,t,i){var r=a3(n3(e,t+1,i));return r.hm-=1,r}function g(e,t,i){var r=s3(r3(e,t+1,i));return r.gm-=1,r}return s.iConvert={toHijri:Y,toGregorian:g},s;function f(e,t){return~~(e/t)}function y(e,t){return e-~~(e/t)*t}function r3(e,t,i){var r=R(e,t),a=i+D.ummalquraData[r-1]-1,n=a+24e5;return n}function a3(e){var t=e-24e5,i=h3(t),r=i+16260,a=Math.floor((r-1)/12),n=a+1,o=r-12*a,u=t-D.ummalquraData[i-1]+1;return{hy:n,hm:o,hd:u}}function n3(e,t,i){var r=f((e+f(t-8,6)+100100)*1461,4)+f(153*y(t+9,12)+2,5)+i-34840408;return r=r-f(f(e+100100+f(t-8,6),100)*3,4)+752,r}function s3(e){var t,i,r,a,n;return t=4*e+139361631,t=t+f(f(4*e+183187720,146097)*3,4)*4-3908,i=f(y(t,1461),4)*5+308,r=f(y(i,153),5)+1,a=y(f(i,153),12)+1,n=f(t,1461)-100100+f(8-a,6),{gy:n,gm:a,gd:r}}function R(e,t){var i=e-1,r=i*12+1+(t-1),a=r-16260;return a}function h3(e){for(var t=0;t<D.ummalquraData.length;t=t+1)if(D.ummalquraData[t]>e)return t}})})(C.__module);var u3=C.__module.exports;const f3=L.getDefaultExportFromCjs(u3);exports.default=f3;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("./index.cjs203.js");var Ue={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},b,k;exports.Log=(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))(exports.Log||{});(e=>{function t(){b=3,k=Ue}e.reset=t;function s(r){if(!(0<=r&&r<=4))throw new Error("Invalid log level");b=r}e.setLevel=s;function i(r){k=r}e.setLogger=i})(exports.Log||(exports.Log={}));var g=class v{constructor(t){this._name=t}debug(...t){b>=4&&k.debug(v._format(this._name,this._method),...t)}info(...t){b>=3&&k.info(v._format(this._name,this._method),...t)}warn(...t){b>=2&&k.warn(v._format(this._name,this._method),...t)}error(...t){b>=1&&k.error(v._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){const s=Object.create(this);return s._method=t,s.debug("begin"),s}static createStatic(t,s){const i=new v(`${t}.${s}`);return i.debug("begin"),i}static _format(t,s){const i=`[${t}]`;return s?`${i} ${s}:`:i}static debug(t,...s){b>=4&&k.debug(v._format(t),...s)}static info(t,...s){b>=3&&k.info(v._format(t),...s)}static warn(t,...s){b>=2&&k.warn(v._format(t),...s)}static error(t,...s){b>=1&&k.error(v._format(t),...s)}};exports.Log.reset();var $=class{static decode(e){try{return Ce.jwtDecode(e)}catch(t){throw g.error("JwtUtils.decode",t),t}}static async generateSignedJwt(e,t,s){const i=f.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=f.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),o=`${i}.${r}`,n=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},s,new TextEncoder().encode(o)),c=f.encodeBase64Url(new Uint8Array(n));return`${o}.${c}`}},Oe="10000000-1000-4000-8000-100000000000",L=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),oe=class y{static _randomWord(){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return Oe.replace(/[018]/g,s=>(+s^y._randomWord()&15>>+s/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return y.generateUUIDv4()+y.generateUUIDv4()+y.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{const i=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",i);return L(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(s){throw g.error("CryptoUtils.generateCodeChallenge",s),s}}static generateBasicAuth(t,s){const r=new TextEncoder().encode([t,s].join(":"));return L(r)}static async hash(t,s){const i=new TextEncoder().encode(s),r=await crypto.subtle.digest(t,i);return new Uint8Array(r)}static async customCalculateJwkThumbprint(t){let s;switch(t.kty){case"RSA":s={e:t.e,kty:t.kty,n:t.n};break;case"EC":s={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":s={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":s={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}const i=await y.hash("SHA-256",JSON.stringify(s));return y.encodeBase64Url(i)}static async generateDPoPProof({url:t,accessToken:s,httpMethod:i,keyPair:r,nonce:o}){let n,c;const a={jti:window.crypto.randomUUID(),htm:i??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};s&&(n=await y.hash("SHA-256",s),c=y.encodeBase64Url(n),a.ath=c),o&&(a.nonce=o);try{const l=await crypto.subtle.exportKey("jwk",r.publicKey),d={alg:"ES256",typ:"dpop+jwt",jwk:{crv:l.crv,kty:l.kty,x:l.x,y:l.y}};return await $.generateSignedJwt(d,a,r.privateKey)}catch(l){throw l instanceof TypeError?new Error(`Error exporting dpop public key: ${l.message}`):l}}static async generateDPoPJkt(t){try{const s=await crypto.subtle.exportKey("jwk",t.publicKey);return await y.customCalculateJwkThumbprint(s)}catch(s){throw s instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${s.message}`):s}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}};oe.encodeBase64Url=e=>L(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var f=oe,I=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new g(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)await t(...e)}},se=class{static center({...e}){var t,s,i;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}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,s])=>`${t}=${typeof s!="boolean"?s:s?"yes":"no"}`).join(",")}},T=class H extends I{constructor(){super(...arguments),this._logger=new g(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const t=this._expiration-H.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=H.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){const s=this._logger.create("init");t=Math.max(Math.floor(t),1);const i=H.getEpochTime()+t;if(this.expiration===i&&this._timerHandle){s.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),s.debug("using duration",t),this._expiration=i;const r=Math.min(t,5);this._timerHandle=setInterval(this._callback,r*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},F=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const i=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(i.slice(1))}},N=";",x=class extends Error{constructor(e,t){var s,i,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw g.error("ErrorResponse","No error passed"),new Error("No error passed");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}},K=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},ae=class{constructor(e){this._logger=new g("AccessTokenEvents"),this._expiringTimer=new T("Access token expiring"),this._expiredTimer=new T("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){const t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){const s=e.expires_in;if(t.debug("access token present, remaining duration:",s),s>0){let r=s-this._expiringNotificationTimeInSeconds;r<=0&&(r=1),t.debug("registering expiring timer, raising in",r,"seconds"),this._expiringTimer.init(r)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const i=s+1;t.debug("registering expired timer, raising in",i,"seconds"),this._expiredTimer.init(i)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},ce=class{constructor(e,t,s,i,r){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=>{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"))};const o=new URL(s);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}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},G=class{constructor(){this._logger=new g("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},z=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},Q=class{constructor(e=[],t=null,s={}){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")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:s,...i}=t;if(!s)return await fetch(e,i);const r=new AbortController,o=setTimeout(()=>r.abort(),s*1e3);try{return await fetch(e,{...t,signal:r.signal})}catch(n){throw n instanceof DOMException&&n.name==="AbortError"?new K("Network timed out"):n}finally{clearTimeout(o)}}async getJson(e,{token:t,credentials:s,timeoutInSeconds:i}={}){const r=this._logger.create("getJson"),o={Accept:this._contentTypes.join(", ")};t&&(r.debug("token passed, setting Authorization header"),o.Authorization="Bearer "+t),this._appendExtraHeaders(o);let n;try{r.debug("url:",e),n=await this.fetchWithTimeout(e,{method:"GET",headers:o,timeoutInSeconds:i,credentials:s})}catch(l){throw r.error("Network Error"),l}r.debug("HTTP response received, status",n.status);const c=n.headers.get("Content-Type");if(c&&!this._contentTypes.find(l=>c.startsWith(l))&&r.throw(new Error(`Invalid response Content-Type: ${c??"undefined"}, from URL: ${e}`)),n.ok&&this._jwtHandler&&(c!=null&&c.startsWith("application/jwt")))return await this._jwtHandler(await n.text());let a;try{a=await n.json()}catch(l){throw r.error("Error parsing JSON response",l),n.ok?l:new Error(`${n.statusText} (${n.status})`)}if(!n.ok)throw r.error("Error from server:",a),a.error?new x(a):new Error(`${n.statusText} (${n.status}): ${JSON.stringify(a)}`);return a}async postForm(e,{body:t,basicAuth:s,timeoutInSeconds:i,initCredentials:r,extraHeaders:o}){const n=this._logger.create("postForm"),c={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...o};s!==void 0&&(c.Authorization="Basic "+s),this._appendExtraHeaders(c);let a;try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:c,body:t,timeoutInSeconds:i,credentials:r})}catch(u){throw n.error("Network error"),u}n.debug("HTTP response received, status",a.status);const l=a.headers.get("Content-Type");if(l&&!this._contentTypes.find(u=>l.startsWith(u)))throw new Error(`Invalid response Content-Type: ${l??"undefined"}, from URL: ${e}`);const d=await a.text();let h={};if(d)try{h=JSON.parse(d)}catch(u){throw n.error("Error parsing JSON response",u),a.ok?u:new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",h),a.headers.has("dpop-nonce")){const u=a.headers.get("dpop-nonce");throw new z(u,`${JSON.stringify(h)}`)}throw h.error?new x(h,t):new Error(`${a.statusText} (${a.status}): ${JSON.stringify(h)}`)}return h}_appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),s=Object.keys(this._extraHeaders),i=["accept","content-type"],r=["authorization"];s.length!==0&&s.forEach(o=>{if(i.includes(o.toLocaleLowerCase())){t.warn("Protected header could not be set",o,i);return}if(r.includes(o.toLocaleLowerCase())&&Object.keys(e).includes(o)){t.warn("Header could not be overridden",o,r);return}const n=typeof this._extraHeaders[o]=="function"?this._extraHeaders[o]():this._extraHeaders[o];n&&n!==""&&(e[o]=n)})}},le=class{constructor(e){this._settings=e,this._logger=new g("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Q(["application/jwk-set+json"],null,this._settings.extraHeaders),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)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const s=this._logger.create(`_getMetadataProperty('${e}')`),i=await this.getMetadata();if(s.debug("resolved"),i[e]===void 0){if(t===!0){s.warn("Metadata does not contain optional property");return}s.throw(new Error("Metadata does not contain property "+e))}return i[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const s=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",s),!Array.isArray(s.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=s.keys,this._signingKeys}},X=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new g("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let s=0;s<e;s++){const i=await this._store.key(s);i&&i.indexOf(this._prefix)===0&&t.push(i.substr(this._prefix.length))}return t}},Ae="code",qe="openid",Ne="client_secret_post",Me=60*15,J=class{constructor({authority:e,metadataUrl:t,metadata:s,signingKeys:i,metadataSeed:r,client_id:o,client_secret:n,response_type:c=Ae,scope:a=qe,redirect_uri:l,post_logout_redirect_uri:d,client_authentication:h=Ne,prompt:u,display:p,max_age:C,ui_locales:U,acr_values:O,resource:A,response_mode:R,filterProtocolClaims:P=!0,loadUserInfo:q=!1,requestTimeoutInSeconds:m,staleStateAgeInSeconds:_=Me,mergeClaimsStrategy:E={array:"replace"},disablePKCE:S=!1,stateStore:w,revokeTokenAdditionalContentTypes:j,fetchRequestCredentials:ee,refreshTokenAllowedScope:ke,extraQueryParams:Ee={},extraTokenParams:Te={},extraHeaders:Re={},dpop:Pe,omitScopeWhenRequesting:Ie=!1}){var te;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=c,this.scope=a,this.redirect_uri=l,this.post_logout_redirect_uri=d,this.client_authentication=h,this.prompt=u,this.display=p,this.max_age=C,this.ui_locales=U,this.acr_values=O,this.resource=A,this.response_mode=R,this.filterProtocolClaims=P??!0,this.loadUserInfo=!!q,this.staleStateAgeInSeconds=_,this.mergeClaimsStrategy=E,this.omitScopeWhenRequesting=Ie,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=j,this.fetchRequestCredentials=ee||"same-origin",this.requestTimeoutInSeconds=m,w)this.stateStore=w;else{const xe=typeof window<"u"?window.localStorage:new G;this.stateStore=new X({store:xe})}if(this.refreshTokenAllowedScope=ke,this.extraQueryParams=Ee,this.extraTokenParams=Te,this.extraHeaders=Re,this.dpop=Pe,this.dpop&&!((te=this.dpop)!=null&&te.store))throw new Error("A DPoPStore is required when dpop is enabled")}},je=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new g("UserInfoService"),this._getClaimsFromJwt=async s=>{const i=this._logger.create("_getClaimsFromJwt");try{const r=$.decode(s);return i.debug("JWT decoding successful"),r}catch(r){throw i.error("Error parsing JWT response"),r}},this._jsonService=new Q(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const s=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",s);const i=await this._jsonService.getJson(s,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",i),i}},de=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new g("TokenClient"),this._jsonService=new Q(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:s=this._settings.client_id,client_secret:i=this._settings.client_secret,extraHeaders:r,...o}){const n=this._logger.create("exchangeCode");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"));const c=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[h,u]of Object.entries(o))u!=null&&c.set(h,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(i==null)throw n.throw(new Error("A client_secret is required")),null;a=f.generateBasicAuth(s,i);break;case"client_secret_post":c.append("client_id",s),i&&c.append("client_secret",i);break}const l=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");const d=await this._jsonService.postForm(l,{body:c,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return n.debug("got response"),d}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:s=this._settings.client_secret,scope:i=this._settings.scope,...r}){const o=this._logger.create("exchangeCredentials");t||o.throw(new Error("A client_id is required"));const n=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||n.set("scope",i);for(const[d,h]of Object.entries(r))h!=null&&n.set(d,h);let c;switch(this._settings.client_authentication){case"client_secret_basic":if(s==null)throw o.throw(new Error("A client_secret is required")),null;c=f.generateBasicAuth(t,s);break;case"client_secret_post":n.append("client_id",t),s&&n.append("client_secret",s);break}const a=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const l=await this._jsonService.postForm(a,{body:n,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:s=this._settings.client_secret,timeoutInSeconds:i,extraHeaders:r,...o}){const n=this._logger.create("exchangeRefreshToken");t||n.throw(new Error("A client_id is required")),o.refresh_token||n.throw(new Error("A refresh_token is required"));const c=new URLSearchParams({grant_type:e});for(const[h,u]of Object.entries(o))Array.isArray(u)?u.forEach(p=>c.append(h,p)):u!=null&&c.set(h,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(s==null)throw n.throw(new Error("A client_secret is required")),null;a=f.generateBasicAuth(t,s);break;case"client_secret_post":c.append("client_id",t),s&&c.append("client_secret",s);break}const l=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");const d=await this._jsonService.postForm(l,{body:c,basicAuth:a,timeoutInSeconds:i,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return n.debug("got response"),d}async revoke(e){var t;const s=this._logger.create("revoke");e.token||s.throw(new Error("A token is required"));const i=await this._metadataService.getRevocationEndpoint(!1);s.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);const r=new URLSearchParams;for(const[o,n]of Object.entries(e))n!=null&&r.set(o,n);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")}},He=class{constructor(e,t,s){this._settings=e,this._metadataService=t,this._claimsService=s,this._logger=new g("ResponseValidator"),this._userInfoService=new je(this._settings,this._metadataService),this._tokenClient=new de(this._settings,this._metadataService)}async validateSigninResponse(e,t,s){const i=this._logger.create("validateSigninResponse");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")}async validateCredentialsResponse(e,t){const s=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),s.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),s.debug("claims processed")}async validateRefreshResponse(e,t){var s,i;const r=this._logger.create("validateRefreshResponse");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);const o=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,o),r.debug("claims processed")}validateSignoutResponse(e,t){const s=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&s.throw(new Error("State does not match")),s.debug("state validated"),e.userState=t.data,e.error)throw s.warn("Response was error",e.error),new x(e)}_processSigninState(e,t){var s;const i=this._logger.create("_processSigninState");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)throw i.warn("Response was error",e.error),new x(e);t.code_verifier&&!e.code&&i.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,s=!0){const i=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){i.debug("not loading user info");return}i.debug("loading user info");const r=await this._userInfoService.getClaims(e.access_token);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)}async _processCode(e,t,s){const i=this._logger.create("_processCode");if(e.code){i.debug("Validating code");const r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:s,...t.extraTokenParams});Object.assign(e,r)}else i.debug("No code to process")}_validateIdTokenAttributes(e,t){var s;const i=this._logger.create("_validateIdTokenAttributes");i.debug("decoding ID Token JWT");const r=$.decode((s=e.id_token)!=null?s:"");if(r.sub||i.throw(new Error("ID Token is missing a subject claim")),t){const o=$.decode(t);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"))}e.profile=r}},M=class B{constructor(t){this.id=t.id||f.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}toStorageString(){return new g("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return g.createStatic("State","fromStorageString"),Promise.resolve(new B(JSON.parse(t)))}static async clearStaleState(t,s){const i=g.createStatic("State","clearStaleState"),r=T.getEpochTime()-s,o=await t.getAllKeys();i.debug("got keys",o);for(let n=0;n<o.length;n++){const c=o[n],a=await t.get(c);let l=!1;if(a)try{const d=await B.fromStorageString(a);i.debug("got item from key:",c,d.created),d.created<=r&&(l=!0)}catch(d){i.error("Error parsing state for key:",c,d),l=!0}else i.debug("no item in storage for key:",c),l=!0;l&&(i.debug("removed item for key:",c),t.remove(c))}}},Y=class V extends M{constructor(t){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}static async create(t){const s=t.code_verifier===!0?f.generateCodeVerifier():t.code_verifier||void 0,i=s?await f.generateCodeChallenge(s):void 0;return new V({...t,code_verifier:s,code_challenge:i})}toStorageString(){return new g("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(t){g.createStatic("SigninState","fromStorageString");const s=JSON.parse(t);return V.create(s)}},he=class ge{constructor(t){this.url=t.url,this.state=t.state}static async create({url:t,authority:s,client_id:i,redirect_uri:r,response_type:o,scope:n,state_data:c,response_mode:a,request_type:l,client_secret:d,nonce:h,url_state:u,resource:p,skipUserInfo:C,extraQueryParams:U,extraTokenParams:O,disablePKCE:A,dpopJkt:R,omitScopeWhenRequesting:P,...q}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!i)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!o)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!n)throw this._logger.error("create: No scope passed"),new Error("scope");if(!s)throw this._logger.error("create: No authority passed"),new Error("authority");const m=await Y.create({data:c,request_type:l,url_state:u,code_verifier:!A,client_id:i,authority:s,redirect_uri:r,response_mode:a,client_secret:d,scope:n,extraTokenParams:O,skipUserInfo:C}),_=new URL(t);_.searchParams.append("client_id",i),_.searchParams.append("redirect_uri",r),_.searchParams.append("response_type",o),P||_.searchParams.append("scope",n),h&&_.searchParams.append("nonce",h),R&&_.searchParams.append("dpop_jkt",R);let E=m.id;u&&(E=`${E}${N}${u}`),_.searchParams.append("state",E),m.code_challenge&&(_.searchParams.append("code_challenge",m.code_challenge),_.searchParams.append("code_challenge_method","S256")),p&&(Array.isArray(p)?p:[p]).forEach(w=>_.searchParams.append("resource",w));for(const[S,w]of Object.entries({response_mode:a,...q,...U}))w!=null&&_.searchParams.append(S,w.toString());return new ge({url:_.href,state:m})}};he._logger=new g("SigninRequest");var De=he,We="openid",D=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const t=decodeURIComponent(this.state).split(N);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(N))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-T.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+T.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(We))||!!this.id_token}},$e=class{constructor({url:e,state_data:t,id_token_hint:s,post_logout_redirect_uri:i,extraQueryParams:r,request_type:o,client_id:n,url_state:c}){if(this._logger=new g("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const a=new URL(e);if(s&&a.searchParams.append("id_token_hint",s),n&&a.searchParams.append("client_id",n),i&&(a.searchParams.append("post_logout_redirect_uri",i),t||c)){this.state=new M({data:t,request_type:o,url_state:c});let l=this.state.id;c&&(l=`${l}${N}${c}`),a.searchParams.append("state",l)}for(const[l,d]of Object.entries({...r}))d!=null&&a.searchParams.append(l,d.toString());this.url=a.href}},ue=class{constructor(e){if(this.state=e.get("state"),this.state){const t=decodeURIComponent(this.state).split(N);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(N))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},Je=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],Ke=["sub","iss","aud","exp","iat"],Le=class{constructor(e){this._settings=e,this._logger=new g("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let s;Array.isArray(this._settings.filterProtocolClaims)?s=this._settings.filterProtocolClaims:s=Je;for(const i of s)Ke.includes(i)||delete t[i]}return t}mergeClaims(e,t){const s={...e};for(const[i,r]of Object.entries(t))if(s[i]!==r)if(Array.isArray(s[i])||Array.isArray(r))if(this._settings.mergeClaimsStrategy.array=="replace")s[i]=r;else{const o=Array.isArray(s[i])?s[i]:[s[i]];for(const n of Array.isArray(r)?r:[r])o.includes(n)||o.push(n);s[i]=o}else typeof s[i]=="object"&&typeof r=="object"?s[i]=this.mergeClaims(s[i],r):s[i]=r;return s}},Z=class{constructor(e,t){this.keys=e,this.nonce=t}},_e=class{constructor(e,t){this._logger=new g("OidcClient"),this.settings=e instanceof J?e:new J(e),this.metadataService=t??new le(this.settings),this._claimsService=new Le(this.settings),this._validator=new He(this.settings,this.metadataService,this._claimsService),this._tokenClient=new de(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:s,request_type:i,id_token_hint:r,login_hint:o,skipUserInfo:n,nonce:c,url_state:a,response_type:l=this.settings.response_type,scope:d=this.settings.scope,redirect_uri:h=this.settings.redirect_uri,prompt:u=this.settings.prompt,display:p=this.settings.display,max_age:C=this.settings.max_age,ui_locales:U=this.settings.ui_locales,acr_values:O=this.settings.acr_values,resource:A=this.settings.resource,response_mode:R=this.settings.response_mode,extraQueryParams:P=this.settings.extraQueryParams,extraTokenParams:q=this.settings.extraTokenParams,dpopJkt:m,omitScopeWhenRequesting:_=this.settings.omitScopeWhenRequesting}){const E=this._logger.create("createSigninRequest");if(l!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");const S=await this.metadataService.getAuthorizationEndpoint();E.debug("Received authorization endpoint",S);const w=await De.create({url:S,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:h,response_type:l,scope:d,state_data:e,url_state:a,prompt:u,display:p,max_age:C,ui_locales:U,id_token_hint:r,login_hint:o,acr_values:O,dpopJkt:m,resource:A,request:t,request_uri:s,extraQueryParams:P,extraTokenParams:q,request_type:i,response_mode:R,client_secret:this.settings.client_secret,skipUserInfo:n,nonce:c,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:_});await this.clearStaleState();const j=w.state;return await this.settings.stateStore.set(j.id,j.toStorageString()),w}async readSigninResponseState(e,t=!1){const s=this._logger.create("readSigninResponseState"),i=new D(F.readParams(e,this.settings.response_mode));if(!i.state)throw s.throw(new Error("No state in response")),null;const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw s.throw(new Error("No matching state found in storage")),null;return{state:await Y.fromStorageString(r),response:i}}async processSigninResponse(e,t,s=!0){const i=this._logger.create("processSigninResponse"),{state:r,response:o}=await this.readSigninResponseState(e,s);if(i.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){const n=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:n}}try{await this._validator.validateSigninResponse(o,r,t)}catch(n){if(n instanceof z&&this.settings.dpop){const c=await this.getDpopProof(this.settings.dpop.store,n.nonce);t.DPoP=c,await this._validator.validateSigninResponse(o,r,t)}else throw n}return o}async getDpopProof(e,t){let s,i;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 f.generateDPoPKeys(),i=new Z(s,t),await e.set(this.settings.client_id,i)),await f.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:i.keys,nonce:i.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:s=!1,extraTokenParams:i={}}){const r=await this._tokenClient.exchangeCredentials({username:e,password:t,...i}),o=new D(new URLSearchParams);return Object.assign(o,r),await this._validator.validateCredentialsResponse(o,s),o}async useRefreshToken({state:e,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,extraTokenParams:o}){var n;const c=this._logger.create("useRefreshToken");let a;if(this.settings.refreshTokenAllowedScope===void 0)a=e.scope;else{const h=this.settings.refreshTokenAllowedScope.split(" ");a=(((n=e.scope)==null?void 0:n.split(" "))||[]).filter(p=>h.includes(p)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){const h=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:h}}let l;try{l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:a,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,...o})}catch(h){if(h instanceof z&&this.settings.dpop)r.DPoP=await this.getDpopProof(this.settings.dpop.store,h.nonce),l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:a,redirect_uri:t,resource:s,timeoutInSeconds:i,extraHeaders:r,...o});else throw h}const d=new D(new URLSearchParams);return Object.assign(d,l),c.debug("validating response",d),await this._validator.validateRefreshResponse(d,{...e,scope:a}),d}async createSignoutRequest({state:e,id_token_hint:t,client_id:s,request_type:i,url_state:r,post_logout_redirect_uri:o=this.settings.post_logout_redirect_uri,extraQueryParams:n=this.settings.extraQueryParams}={}){const c=this._logger.create("createSignoutRequest"),a=await this.metadataService.getEndSessionEndpoint();if(!a)throw c.throw(new Error("No end session endpoint")),null;c.debug("Received end session endpoint",a),!s&&o&&!t&&(s=this.settings.client_id);const l=new $e({url:a,id_token_hint:t,client_id:s,post_logout_redirect_uri:o,state_data:e,extraQueryParams:n,request_type:i,url_state:r});await this.clearStaleState();const d=l.state;return d&&(c.debug("Signout request has state to persist"),await this.settings.stateStore.set(d.id,d.toStorageString())),l}async readSignoutResponseState(e,t=!1){const s=this._logger.create("readSignoutResponseState"),i=new ue(F.readParams(e,this.settings.response_mode));if(!i.state){if(s.debug("No state in response"),i.error)throw s.warn("Response was error:",i.error),new x(i);return{state:void 0,response:i}}const r=await this.settings.stateStore[t?"remove":"get"](i.state);if(!r)throw s.throw(new Error("No matching state found in storage")),null;return{state:await M.fromStorageString(r),response:i}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:s,response:i}=await this.readSignoutResponseState(e,!0);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}clearStaleState(){return this._logger.create("clearStaleState"),M.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},pe=class{constructor(e){this._userManager=e,this._logger=new g("SessionMonitor"),this._start=async t=>{const s=t.session_state;if(!s)return;const i=this._logger.create("_start");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){this._checkSessionIFrame.start(s);return}try{const r=await this._userManager.metadataService.getCheckSessionIframe();if(r){i.debug("initializing check session iframe");const o=this._userManager.settings.client_id,n=this._userManager.settings.checkSessionIntervalInSeconds,c=this._userManager.settings.stopCheckSessionOnError,a=new ce(this._callback,o,r,n,c);await a.load(),this._checkSessionIFrame=a,a.start(s)}else i.warn("no check session iframe found in the metadata")}catch(r){i.error("Error from getCheckSessionIframe:",r instanceof Error?r.message:r)}},this._stop=()=>{const t=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const s=setInterval(async()=>{clearInterval(s);try{const i=await this._userManager.querySessionStatus();if(i){const r={session_state:i.session_state,profile:i.sub?{sub:i.sub}:null};this._start(r)}}catch(i){t.error("error from querySessionStatus",i instanceof Error?i.message:i)}},1e3)}},this._callback=async()=>{const t=this._logger.create("_callback");try{const s=await this._userManager.querySessionStatus();let i=!0;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")}catch(s){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",s),await this._userManager.events._raiseUserSignedOut())}},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=>{this._logger.error(t)})}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const t=await this._userManager.querySessionStatus();if(t){const s={session_state:t.session_state,profile:t.sub?{sub:t.sub}:null};this._start(s)}}}},W=class fe{constructor(t){var s;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}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-T.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+T.getEpochTime())}get expired(){const t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,s;return(s=(t=this.scope)==null?void 0:t.split(" "))!=null?s:[]}toStorageString(){return new g("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return g.createStatic("User","fromStorageString"),new fe(JSON.parse(t))}},ie="oidc-client",we=class{constructor(){this._abort=new I("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:s,keepOpen:i}=await new Promise((r,o)=>{const n=c=>{var a;const l=c.data,d=(a=e.scriptOrigin)!=null?a:window.location.origin;if(!(c.origin!==d||(l==null?void 0:l.source)!==ie)){try{const h=F.readParams(l.url,e.response_mode).get("state");if(h||t.warn("no state found in response url"),c.source!==this._window&&h!==e.state)return}catch{this._dispose(),o(new Error("Invalid response from window"))}r(l)}};window.addEventListener("message",n,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",n,!1)),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),o(c)}))});return t.debug("got response from window"),this._dispose(),i||this.close(),{url:s}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,s=!1,i=window.location.origin){e.postMessage({source:ie,url:t,keepOpen:s},i)}},me={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Se="_blank",Fe=60,ze=2,ve=10,ye=class extends J{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:s=e.post_logout_redirect_uri,popupWindowFeatures:i=me,popupWindowTarget:r=Se,redirectMethod:o="assign",redirectTarget:n="self",iframeNotifyParentOrigin:c=e.iframeNotifyParentOrigin,iframeScriptOrigin:a=e.iframeScriptOrigin,requestTimeoutInSeconds:l,silent_redirect_uri:d=e.redirect_uri,silentRequestTimeoutInSeconds:h,automaticSilentRenew:u=!0,validateSubOnSilentRenew:p=!0,includeIdTokenInSilentRenew:C=!1,monitorSession:U=!1,monitorAnonymousSession:O=!1,checkSessionIntervalInSeconds:A=ze,query_status_response_type:R="code",stopCheckSessionOnError:P=!0,revokeTokenTypes:q=["access_token","refresh_token"],revokeTokensOnSignout:m=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=Fe,userStore:S}=e;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=c,this.iframeScriptOrigin=a,this.silent_redirect_uri=d,this.silentRequestTimeoutInSeconds=h||l||ve,this.automaticSilentRenew=u,this.validateSubOnSilentRenew=p,this.includeIdTokenInSilentRenew=C,this.monitorSession=U,this.monitorAnonymousSession=O,this.checkSessionIntervalInSeconds=A,this.stopCheckSessionOnError=P,this.query_status_response_type=R,this.revokeTokenTypes=q,this.revokeTokensOnSignout=m,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,S)this.userStore=S;else{const w=typeof window<"u"?window.sessionStorage:new G;this.userStore=new X({store:w})}}},re=class be extends we{constructor({silentRequestTimeoutInSeconds:t=ve}){super(),this._logger=new g("IFrameWindow"),this._timeoutInSeconds=t,this._frame=be.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const t=window.document.createElement("iframe");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}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const s=setTimeout(()=>void this._abort.raise(new K("IFrame timed out without a response")),this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(s)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",s=>{var i;const r=s.target;(i=r.parentNode)==null||i.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,s){return super._notifyParent(window.parent,t,!1,s)}},Be=class{constructor(e){this._settings=e,this._logger=new g("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new re({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),re.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},Ve=500,Ge=1e3,ne=class extends we{constructor({popupWindowTarget:e=Se,popupWindowFeatures:t={},popupSignal:s}){super(),this._logger=new g("PopupWindow");const i=se.center({...me,...t});this._window=window.open(void 0,e,se.serialize(i)),s&&s.addEventListener("abort",()=>{var r;this._abort.raise(new Error((r=s.reason)!=null?r:"Popup aborted"))}),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*Ge)}async navigate(e){var t;(t=this._window)==null||t.focus();const s=setInterval(()=>{(!this._window||this._window.closed)&&this._abort.raise(new Error("Popup closed by user"))},Ve);return this._disposeHandlers.add(()=>clearInterval(s)),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},Qe=class{constructor(e){this._settings=e,this._logger=new g("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:s}){return new ne({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:s})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),ne.notifyOpener(e,t)}},Xe=class{constructor(e){this._settings=e,this._logger=new g("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var s;this._logger.create("prepare");let i=window.self;t==="top"&&(i=(s=window.top)!=null?s:window.self);const r=i.location[e].bind(i.location);let o;return{navigate:async n=>{this._logger.create("navigate");const c=new Promise((a,l)=>{o=l});return r(n.url),await c},close:()=>{this._logger.create("close"),o==null||o(new Error("Redirect aborted")),i.stop()}}}async callback(){}},Ye=class extends ae{constructor(e){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")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},Ze=class{constructor(e){this._userManager=e,this._logger=new g("SilentRenewService"),this._isStarted=!1,this._retryTimer=new T("Retry Silent Renew"),this._tokenExpiring=async()=>{const t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),t.debug("silent token renewal successful")}catch(s){if(s instanceof K){t.warn("ErrorTimeout from signinSilent:",s,"retry in 5s"),this._retryTimer.init(5);return}t.error("Error from signinSilent:",s),await this._userManager.events._raiseSilentRenewError(s)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},et=class{constructor(e){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}},tt=class{constructor(e,t,s,i){this._logger=new g("UserManager"),this.settings=new ye(e),this._client=new _e(e),this._redirectNavigator=t??new Xe(this.settings),this._popupNavigator=s??new Qe(this.settings),this._iframeNavigator=i??new Be(this.settings),this._events=new Ye(this.settings),this._silentRenewService=new Ze(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new pe(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){const t=this._logger.create("getUser"),s=await this._loadUser();return s?(t.info("user loaded"),await this._events.load(s,e),s):(t.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");const{redirectMethod:s,...i}=e;let r;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(r=await this.generateDPoPJkt(this.settings.dpop));const o=await this._redirectNavigator.prepare({redirectMethod:s});await this._signinStart({request_type:"si:r",dpopJkt:r,...i},o)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),s=await this._signinEnd(e);return s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject"),s}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:s=!1}){const i=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:s,extraTokenParams:this.settings.extraTokenParams});i.debug("got signin response");const o=await this._buildUser(r);return o.profile&&o.profile.sub?i.info("success, signed in subject",o.profile.sub):i.info("no subject"),o}async signinPopup(e={}){var t;const s=this._logger.create("signinPopup");let i;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(i=await this.generateDPoPJkt(this.settings.dpop));const{popupWindowFeatures:r,popupWindowTarget:o,popupSignal:n,...c}=e,a=this.settings.popup_redirect_uri;a||s.throw(new Error("No popup_redirect_uri configured"));const l=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:o,popupSignal:n}),d=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",dpopJkt:i,...c},l);return d&&(d.profile&&d.profile.sub?s.info("success, signed in subject",d.profile.sub):s.info("no subject")),d}async signinPopupCallback(e=window.location.href,t=!1){const s=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),s.info("success")}async signinSilent(e={}){var t,s;const i=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...o}=e;let n=await this._loadUser();if(n!=null&&n.refresh_token){i.debug("using refresh token");const h=new et(n);return await this._useRefreshToken({state:h,redirect_uri:o.redirect_uri,resource:o.resource,extraTokenParams:o.extraTokenParams,timeoutInSeconds:r})}let c;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(c=await this.generateDPoPJkt(this.settings.dpop));const a=this.settings.silent_redirect_uri;a||i.throw(new Error("No silent_redirect_uri configured"));let l;n&&this.settings.validateSubOnSilentRenew&&(i.debug("subject prior to silent renew:",n.profile.sub),l=n.profile.sub);const d=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return n=await this._signin({request_type:"si:s",redirect_uri:a,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?n==null?void 0:n.id_token:void 0,dpopJkt:c,...o},d,l),n&&((s=n.profile)!=null&&s.sub?i.info("success, signed in subject",n.profile.sub):i.info("no subject")),n}async _useRefreshToken(e){const t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),s=new W({...e.state,...t});return await this.storeUser(s),await this._events.load(s),s}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:s}=await this._client.readSignoutResponseState(e);if(s)switch(s.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:s,...i}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));const o=await this._loadUser(),n=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s}),c=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?o==null?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...i},n);try{const a={},l=await this._client.processSigninResponse(c.url,a);return t.debug("got signin response"),l.session_state&&l.profile.sub?(t.info("success for subject",l.profile.sub),{session_state:l.session_state,sub:l.profile.sub}):(t.info("success, user not authenticated"),null)}catch(a){if(this.settings.monitorAnonymousSession&&a instanceof x)switch(a.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:a.session_state}}throw a}}async _signin(e,t,s){const i=await this._signinStart(e,t);return await this._signinEnd(i.url,s)}async _signinStart(e,t){const s=this._logger.create("_signinStart");try{const i=await this._client.createSigninRequest(e);return s.debug("got signin request"),await t.navigate({url:i.url,state:i.state.id,response_mode:i.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw s.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signinEnd(e,t){const s=this._logger.create("_signinEnd"),i={},r=await this._client.processSigninResponse(e,i);return s.debug("got signin response"),await this._buildUser(r,t)}async _buildUser(e,t){const s=this._logger.create("_buildUser"),i=new W(e);if(t){if(t!==i.profile.sub)throw s.debug("current user does not match user returned from signin. sub from signin:",i.profile.sub),new x({...e,error:"login_required"});s.debug("current user matches user returned from signin")}return await this.storeUser(i),s.debug("user stored"),await this._events.load(i),i}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:s,...i}=e,r=await this._redirectNavigator.prepare({redirectMethod:s});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...i},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),s=await this._signoutEnd(e);return t.info("success"),s}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:s,popupWindowTarget:i,popupSignal:r,...o}=e,n=this.settings.popup_post_logout_redirect_uri,c=await this._popupNavigator.prepare({popupWindowFeatures:s,popupWindowTarget:i,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:n,state:n==null?void 0:{},...o},c),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const s=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),s.info("success")}async _signout(e,t){const s=await this._signoutStart(e,t);return await this._signoutEnd(s.url)}async _signoutStart(e={},t){var s;const i=this._logger.create("_signoutStart");try{const r=await this._loadUser();i.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);const o=e.id_token_hint||r&&r.id_token;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");const n=await this._client.createSignoutRequest(e);return i.debug("got signout request"),await t.navigate({url:n.url,state:(s=n.state)==null?void 0:s.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(r){throw i.debug("error after preparing navigator, closing navigator window"),t.close(),r}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),s=await this._client.processSignoutResponse(e);return t.debug("got signout response"),s}async signoutSilent(e={}){var t;const s=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:i,...r}=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,c=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});await this._signout({request_type:"so:s",post_logout_redirect_uri:n,id_token_hint:o,...r},c),s.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const s=this._logger.create("_revokeInternal");if(!e)return;const i=t.filter(r=>typeof e[r]=="string");if(!i.length){s.debug("no need to revoke due to no token(s)");return}for(const r of i)await this._client.revokeToken(e[r],r),s.info(`${r} revoked successfully`),r!=="access_token"&&(e[r]=null);await this.storeUser(e),s.debug("user stored"),await this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),W.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const s=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,s)}else 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)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,s,i){var r,o;const n=await((o=(r=this.settings.dpop)==null?void 0:r.store)==null?void 0:o.get(this.settings.client_id));if(n)return await f.generateDPoPProof({url:e,accessToken:t==null?void 0:t.access_token,httpMethod:s,keyPair:n.keys,nonce:i})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){const s=await f.generateDPoPKeys();t=new Z(s),await e.store.set(this.settings.client_id,t)}return await f.generateDPoPJkt(t.keys)}};exports.AccessTokenEvents=ae;exports.CheckSessionIFrame=ce;exports.DPoPState=Z;exports.ErrorResponse=x;exports.ErrorTimeout=K;exports.InMemoryWebStorage=G;exports.Logger=g;exports.MetadataService=le;exports.OidcClient=_e;exports.OidcClientSettingsStore=J;exports.SessionMonitor=pe;exports.SigninResponse=D;exports.SigninState=Y;exports.SignoutResponse=ue;exports.State=M;exports.User=W;exports.UserManager=tt;exports.UserManagerSettingsStore=ye;exports.WebStorageStateStore=X;
package/index.cjs187.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index.cjs285.js"),a=require("./index.cjs288.js"),u=require("./index.cjs291.js");function g(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++)n[e-1]=arguments[e];return typeof r=="function"?i.createTailwindMerge.apply(void 0,[a.getDefaultConfig,r].concat(n)):i.createTailwindMerge.apply(void 0,[function(){return u.mergeConfigs(a.getDefaultConfig(),r)}].concat(n))}exports.extendTailwindMerge=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./index.cjs196.js"),C=require("./index.cjs204.js"),o3=require("./index.cjs205.js");(function(G,l3){(function(h,D){G.exports=D(o3.__require())})(L.commonjsGlobal,function(h){if(h==null)throw new Error("Cannot find moment");var D={ummalquraData:[28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},w=/(\[[^\[]*\])|(\\)?i(Mo|MM?M?M?|Do|DDDo|DD?D?D?|w[o|w]?|YYYYY|YYYY|YY|gg(ggg?)?)|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,F=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,v=/\d\d?/,S=/\d{1,3}/,O=/\d{3}/,b=/\d{1,4}/,j=/[+\-]?\d{1,6}/,x=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.?)|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,z=/Z|[\+\-]\d\d:?\d\d/i,E=/T/i,J=/[\+\-]?\d+(\.\d{1,3})?/,Z={hd:"idate",hm:"imonth",hy:"iyear"},T={},P="DDD w M D".split(" "),I="M D w".split(" "),l={iM:function(){return this.iMonth()+1},iMMM:function(e){return this.localeData().iMonthsShort(this,e)},iMMMM:function(e){return this.localeData().iMonths(this,e)},iD:function(){return this.iDate()},iDDD:function(){return this.iDayOfYear()},iw:function(){return this.iWeek()},iYY:function(){return d(this.iYear()%100,2)},iYYYY:function(){return d(this.iYear(),4)},iYYYYY:function(){return d(this.iYear(),5)},igg:function(){return d(this.iWeekYear()%100,2)},igggg:function(){return this.iWeekYear()},iggggg:function(){return d(this.iWeekYear(),5)}},M;function A(e,t){return function(i){return d(e.call(this,i),t)}}function V(e,t){return function(i){return this.localeData().ordinal(e.call(this,i),t)}}for(;P.length;)M=P.pop(),l["i"+M+"o"]=V(l["i"+M],M);for(;I.length;)M=I.pop(),l["i"+M+M]=A(l["i"+M],2);l.iDDDD=A(l.iDDD,3);function p(e,t){var i;for(i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function d(e,t){for(var i=e+"";i.length<t;)i="0"+i;return i}function U(e){return Object.prototype.toString.call(e)==="[object Array]"}function m(e){return e&&(Z[e]||e.toLowerCase().replace(/(.)s$/,"$1"))}function _(e,t,i,r){var a=e._isUTC?"UTC":"";e._d["set"+a+"FullYear"](t),e._d["set"+a+"Month"](i),e._d["set"+a+"Date"](r)}function H(e){function t(){}return t.prototype=e,new t}function $(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):"".__proto__?e.__proto__:e.constructor.prototype}p($(h.localeData()),{_iMonths:["Muharram","Safar","Rabi' al-Awwal","Rabi' al-Thani","Jumada al-Ula","Jumada al-Alkhirah","Rajab","Sha’ban","Ramadhan","Shawwal","Thul-Qi’dah","Thul-Hijjah"],iMonths:function(e){return this._iMonths[e.iMonth()]},_iMonthsShort:["Muh","Saf","Rab-I","Rab-II","Jum-I","Jum-II","Raj","Sha","Ram","Shw","Dhu-Q","Dhu-H"],iMonthsShort:function(e){return this._iMonthsShort[e.iMonth()]},iMonthsParse:function(e){var t,i,r;for(this._iMonthsParse||(this._iMonthsParse=[]),t=0;t<12;t+=1)if(this._iMonthsParse[t]||(i=s([2e3,(2+t)%12,25]),r="^"+this.iMonths(i,"")+"$|^"+this.iMonthsShort(i,"")+"$",this._iMonthsParse[t]=new RegExp(r.replace(".",""),"i")),this._iMonthsParse[t].test(e))return t}});var q={iMonths:"محرم_صفر_ربيع الأول_ربيع الثاني_جمادى الأولى_جمادى الآخرة_رجب_شعبان_رمضان_شوال_ذو القعدة_ذو الحجة".split("_"),iMonthsShort:"محرم_صفر_ربيع ١_ربيع ٢_جمادى ١_جمادى ٢_رجب_شعبان_رمضان_شوال_ذو القعدة_ذو الحجة".split("_")};if(typeof h.updateLocale=="function")h.updateLocale("ar-sa",q);else{var B=h.locale();h.defineLocale("ar-sa",q),h.locale(B)}function Q(e){var t=e.match(w),i=t.length,r;for(r=0;r<i;r+=1)l[t[r]]&&(t[r]=l[t[r]]);return function(a){var n="";for(r=0;r<i;r+=1)n+=t[r]instanceof Function?"["+t[r].call(a,e)+"]":t[r];return n}}function N(e,t){switch(e){case"iDDDD":return O;case"iYYYY":return b;case"iYYYYY":return j;case"iDDD":return S;case"iMMM":case"iMMMM":return x;case"iMM":case"iDD":case"iYY":case"iM":case"iD":return v;case"DDDD":return O;case"YYYY":return b;case"YYYYY":return j;case"S":case"SS":case"SSS":case"DDD":return S;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return x;case"a":case"A":return h.localeData(t._l)._meridiemParse;case"X":return J;case"Z":case"ZZ":return z;case"T":return E;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return v;default:return new RegExp(e.replace("\\",""))}}function X(e,t,i){var r,a=i._a;switch(e){case"iM":case"iMM":a[1]=t==null?0:~~t-1;break;case"iMMM":case"iMMMM":r=h.localeData(i._l).iMonthsParse(t),r!=null?a[1]=r:i._isValid=!1;break;case"iD":case"iDD":case"iDDD":case"iDDDD":t!=null&&(a[2]=~~t);break;case"iYY":a[0]=~~t+(~~t>47?1300:1400);break;case"iYYYY":case"iYYYYY":a[0]=~~t}t==null&&(i._isValid=!1)}function K(e){var t,i,r=e._a[0],a=e._a[1],n=e._a[2];return r==null&&a==null&&n==null?[0,0,1]:(r=r||0,a=a||0,n=n||1,(n<1||n>s.iDaysInMonth(r,a))&&(e._isValid=!1),t=g(r,a,n),i=Y(t.gy,t.gm,t.gd),e._hDiff=0,~~i.hy!==r&&(e._hDiff+=1),~~i.hm!==a&&(e._hDiff+=1),~~i.hd!==n&&(e._hDiff+=1),[t.gy,t.gm,t.gd])}function e3(e){var t=e._f.match(w),i=e._i,r=t.length,a,n,o;for(e._a=[],a=0;a<r;a+=1)n=t[a],o=(N(n,e).exec(i)||[])[0],o&&(i=i.slice(i.indexOf(o)+o.length)),l[n]&&X(n,o,e);return i&&(e._il=i),K(e)}function t3(e,t){var i=e._f.length,r,a,n,o,u,c;if(i===0)return k(new Date(NaN));for(r=0;r<i;r+=1)a=e._f[r],u=0,n=k(e._i,a,e._l,t),n.isValid()&&(u+=n._hDiff,n._il&&(u+=n._il.length),(c==null||u<c)&&(c=u,o=n));return o}function i3(e){var t=e._i,i="",r="",a=e._f.match(w),n=a.length,o,u,c;for(o=0;o<n;o+=1)u=a[o],c=(N(u,e).exec(t)||[])[0],c&&(t=t.slice(t.indexOf(c)+c.length)),l[u]instanceof Function||(r+=u,c&&(i+=c));e._i=i,e._f=r}function W(e,t,i){var r=i-t,a=i-e.day(),n;return a>r&&(a-=7),a<r-7&&(a+=7),n=s(e).add(a,"d"),{week:Math.ceil(n.iDayOfYear()/7),year:n.iYear()}}function k(e,t,i,r){var a={_i:e,_f:t,_l:i},n,o,u;if(t){if(U(t))return t3(a,r);n=e3(a),i3(a),t="YYYY-MM-DD-"+a._f,e=d(n[0],4)+"-"+d(n[1]+1,2)+"-"+d(n[2],2)+"-"+a._i}return r?o=h.utc(e,t,i):o=h(e,t,i),a._isValid===!1&&(o._isValid=!1),o._hDiff=a._hDiff||0,u=H(s.fn),p(u,o),u}function s(e,t,i){return k(e,t,i,!1)}p(s,h),s.fn=H(h.fn),s.utc=function(e,t,i){return k(e,t,i,!0)},s.fn.format=function(e){var t,i,r=this;if(e){for(t=5,i=function(a){return r.localeData().longDateFormat(a)||a};t>0&&F.test(e);)t-=1,e=e.replace(F,i);T[e]||(T[e]=Q(e)),e=T[e](this)}return h.fn.format.call(this,e)},s.fn.iYear=function(e){var t,i,r;return typeof e=="number"?(i=Y(this.year(),this.month(),this.date()),t=Math.min(i.hd,s.iDaysInMonth(e,i.hm)),r=g(e,i.hm,t),_(this,r.gy,r.gm,r.gd),(this.month()!==r.gm||this.date()!==r.gd||this.year()!==r.gy)&&_(this,r.gy,r.gm,r.gd),h.updateOffset(this),this):Y(this.year(),this.month(),this.date()).hy},s.fn.iMonth=function(e){var t,i,r;if(e!=null){if(typeof e=="string")if(e=this.localeData().iMonthsParse(e),e>=0)e-=1;else return this;return i=Y(this.year(),this.month(),this.date()),t=Math.min(i.hd,s.iDaysInMonth(i.hy,e)),this.iYear(i.hy+f(e,12)),e=y(e,12),e<0&&(e+=12,this.iYear(this.iYear()-1)),r=g(this.iYear(),e,t),_(this,r.gy,r.gm,r.gd),(this.month()!==r.gm||this.date()!==r.gd||this.year()!==r.gy)&&_(this,r.gy,r.gm,r.gd),h.updateOffset(this),this}else return Y(this.year(),this.month(),this.date()).hm},s.fn.iDate=function(e){var t,i;return typeof e=="number"?(t=Y(this.year(),this.month(),this.date()),i=g(t.hy,t.hm,e),_(this,i.gy,i.gm,i.gd),(this.month()!==i.gm||this.date()!==i.gd||this.year()!==i.gy)&&_(this,i.gy,i.gm,i.gd),h.updateOffset(this),this):Y(this.year(),this.month(),this.date()).hd},s.fn.iDayOfYear=function(e){var t=Math.round((s(this).startOf("day")-s(this).startOf("iYear"))/864e5)+1;return e==null?t:this.add(e-t,"d")},s.fn.iDaysInMonth=function(){return parseInt(s(this).endOf("iMonth").format("iDD"))},s.fn.iWeek=function(e){var t=W(this,this.localeData()._week.dow,this.localeData()._week.doy).week;return e==null?t:this.add((e-t)*7,"d")},s.fn.iWeekYear=function(e){var t=W(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return e==null?t:this.add(e-t,"y")},s.fn.add=function(e,t){var i;return t!==null&&!isNaN(+t)&&(i=e,e=t,t=i),t=m(t),t==="iyear"?this.iYear(this.iYear()+e):t==="imonth"?this.iMonth(this.iMonth()+e):t==="idate"?this.iDate(this.iDate()+e):h.fn.add.call(this,e,t),this},s.fn.subtract=function(e,t){var i;return t!==null&&!isNaN(+t)&&(i=e,e=t,t=i),t=m(t),t==="iyear"?this.iYear(this.iYear()-e):t==="imonth"?this.iMonth(this.iMonth()-e):t==="idate"?this.iDate(this.iDate()-e):h.fn.subtract.call(this,e,t),this},s.fn.startOf=function(e){return e=m(e),e==="iyear"||e==="imonth"?(e==="iyear"&&this.iMonth(0),this.iDate(1),this.hours(0),this.minutes(0),this.seconds(0),this.milliseconds(0),this):h.fn.startOf.call(this,e)},s.fn.endOf=function(e){return e=m(e),e===void 0||e==="milisecond"?this:this.startOf(e).add(1,e==="isoweek"?"week":e).subtract(1,"milliseconds")},s.fn.clone=function(){return s(this)},s.fn.iYears=s.fn.iYear,s.fn.iMonths=s.fn.iMonth,s.fn.iDates=s.fn.iDate,s.fn.iWeeks=s.fn.iWeek,s.iDaysInMonth=function(e,t){var i=R(e,t+1),r=D.ummalquraData[i]-D.ummalquraData[i-1];return r};function Y(e,t,i){var r=a3(n3(e,t+1,i));return r.hm-=1,r}function g(e,t,i){var r=s3(r3(e,t+1,i));return r.gm-=1,r}return s.iConvert={toHijri:Y,toGregorian:g},s;function f(e,t){return~~(e/t)}function y(e,t){return e-~~(e/t)*t}function r3(e,t,i){var r=R(e,t),a=i+D.ummalquraData[r-1]-1,n=a+24e5;return n}function a3(e){var t=e-24e5,i=h3(t),r=i+16260,a=Math.floor((r-1)/12),n=a+1,o=r-12*a,u=t-D.ummalquraData[i-1]+1;return{hy:n,hm:o,hd:u}}function n3(e,t,i){var r=f((e+f(t-8,6)+100100)*1461,4)+f(153*y(t+9,12)+2,5)+i-34840408;return r=r-f(f(e+100100+f(t-8,6),100)*3,4)+752,r}function s3(e){var t,i,r,a,n;return t=4*e+139361631,t=t+f(f(4*e+183187720,146097)*3,4)*4-3908,i=f(y(t,1461),4)*5+308,r=f(y(i,153),5)+1,a=y(f(i,153),12)+1,n=f(t,1461)-100100+f(8-a,6),{gy:n,gm:a,gd:r}}function R(e,t){var i=e-1,r=i*12+1+(t-1),a=r-16260;return a}function h3(e){for(var t=0;t<D.ummalquraData.length;t=t+1)if(D.ummalquraData[t]>e)return t}})})(C.__module);var u3=C.__module.exports;const f3=L.getDefaultExportFromCjs(u3);exports.default=f3;
package/index.cjs188.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=new Map,v=d=>{const a=y.get(d);return a?Object.fromEntries(Object.entries(a.stores).map(([i,c])=>[i,c.getState()])):{}},O=(d,a,i)=>{if(d===void 0)return{type:"untracked",connection:a.connect(i)};const c=y.get(i.name);if(c)return{type:"tracked",store:d,...c};const n={connection:a.connect(i),stores:{}};return y.set(i.name,n),{type:"tracked",store:d,...n}},R=(d,a={})=>(i,c,n)=>{const{enabled:A,anonymousActionType:C,store:r,...f}=a;let E;try{E=(A??!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!E)return d(i,c,n);const{connection:t,...p}=O(r,E,f);let _=!0;n.setState=(o,l,e)=>{const s=i(o,l);if(!_)return s;const T=e===void 0?{type:C||"anonymous"}:typeof e=="string"?{type:e}:e;return r===void 0?(t==null||t.send(T,c()),s):(t==null||t.send({...T,type:`${r}/${T.type}`},{...v(f.name),[r]:n.getState()}),s)};const u=(...o)=>{const l=_;_=!1,i(...o),_=l},S=d(n.setState,c,n);if(p.type==="untracked"?t==null||t.init(S):(p.stores[p.store]=n,t==null||t.init(Object.fromEntries(Object.entries(p.stores).map(([o,l])=>[o,o===p.store?S:l.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let o=!1;const l=n.dispatch;n.dispatch=(...e)=>{l(...e)}}return t.subscribe(o=>{var l;switch(o.type){case"ACTION":return typeof o.payload!="string"?void 0:I(o.payload,e=>{if(e.type==="__setState"){if(r===void 0){u(e.state);return}Object.keys(e.state).length;const s=e.state[r];if(s==null)return;JSON.stringify(n.getState())!==JSON.stringify(s)&&u(s);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(e)});case"DISPATCH":switch(o.payload.type){case"RESET":return u(S),r===void 0?t==null?void 0:t.init(n.getState()):t==null?void 0:t.init(v(f.name));case"COMMIT":if(r===void 0){t==null||t.init(n.getState());return}return t==null?void 0:t.init(v(f.name));case"ROLLBACK":return I(o.state,e=>{if(r===void 0){u(e),t==null||t.init(n.getState());return}u(e[r]),t==null||t.init(v(f.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return I(o.state,e=>{if(r===void 0){u(e);return}JSON.stringify(n.getState())!==JSON.stringify(e[r])&&u(e[r])});case"IMPORT_STATE":{const{nextLiftedState:e}=o.payload,s=(l=e.computedStates.slice(-1)[0])==null?void 0:l.state;if(!s)return;u(r===void 0?s:s[r]),t==null||t.send(null,e);return}case"PAUSE_RECORDING":return _=!_}return}}),S},h=R,I=(d,a)=>{let i;try{i=JSON.parse(d)}catch{}i!==void 0&&a(i)};exports.devtools=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index.cjs283.js"),a=require("./index.cjs286.js"),u=require("./index.cjs289.js");function g(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),e=1;e<t;e++)n[e-1]=arguments[e];return typeof r=="function"?i.createTailwindMerge.apply(void 0,[a.getDefaultConfig,r].concat(n)):i.createTailwindMerge.apply(void 0,[function(){return u.mergeConfigs(a.getDefaultConfig(),r)}].concat(n))}exports.extendTailwindMerge=g;
package/index.cjs189.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index.cjs190.js"),u=n=>(r,m,e)=>(e.setState=(t,i,...o)=>{const c=typeof t=="function"?s.produce(t):t;return r(c,i,...o)},n(e.setState,m,e)),S=u;exports.immer=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=new Map,v=d=>{const a=y.get(d);return a?Object.fromEntries(Object.entries(a.stores).map(([i,c])=>[i,c.getState()])):{}},O=(d,a,i)=>{if(d===void 0)return{type:"untracked",connection:a.connect(i)};const c=y.get(i.name);if(c)return{type:"tracked",store:d,...c};const n={connection:a.connect(i),stores:{}};return y.set(i.name,n),{type:"tracked",store:d,...n}},R=(d,a={})=>(i,c,n)=>{const{enabled:A,anonymousActionType:C,store:r,...f}=a;let E;try{E=(A??!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!E)return d(i,c,n);const{connection:t,...p}=O(r,E,f);let _=!0;n.setState=(o,l,e)=>{const s=i(o,l);if(!_)return s;const T=e===void 0?{type:C||"anonymous"}:typeof e=="string"?{type:e}:e;return r===void 0?(t==null||t.send(T,c()),s):(t==null||t.send({...T,type:`${r}/${T.type}`},{...v(f.name),[r]:n.getState()}),s)};const u=(...o)=>{const l=_;_=!1,i(...o),_=l},S=d(n.setState,c,n);if(p.type==="untracked"?t==null||t.init(S):(p.stores[p.store]=n,t==null||t.init(Object.fromEntries(Object.entries(p.stores).map(([o,l])=>[o,o===p.store?S:l.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let o=!1;const l=n.dispatch;n.dispatch=(...e)=>{l(...e)}}return t.subscribe(o=>{var l;switch(o.type){case"ACTION":return typeof o.payload!="string"?void 0:I(o.payload,e=>{if(e.type==="__setState"){if(r===void 0){u(e.state);return}Object.keys(e.state).length;const s=e.state[r];if(s==null)return;JSON.stringify(n.getState())!==JSON.stringify(s)&&u(s);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(e)});case"DISPATCH":switch(o.payload.type){case"RESET":return u(S),r===void 0?t==null?void 0:t.init(n.getState()):t==null?void 0:t.init(v(f.name));case"COMMIT":if(r===void 0){t==null||t.init(n.getState());return}return t==null?void 0:t.init(v(f.name));case"ROLLBACK":return I(o.state,e=>{if(r===void 0){u(e),t==null||t.init(n.getState());return}u(e[r]),t==null||t.init(v(f.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return I(o.state,e=>{if(r===void 0){u(e);return}JSON.stringify(n.getState())!==JSON.stringify(e[r])&&u(e[r])});case"IMPORT_STATE":{const{nextLiftedState:e}=o.payload,s=(l=e.computedStates.slice(-1)[0])==null?void 0:l.state;if(!s)return;u(r===void 0?s:s[r]),t==null||t.send(null,e);return}case"PAUSE_RECORDING":return _=!_}return}}),S},h=R,I=(d,a)=>{let i;try{i=JSON.parse(d)}catch{}i!==void 0&&a(i)};exports.devtools=h;