authhero 0.255.0 → 0.255.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.
- package/dist/authhero.cjs +3 -3
- package/dist/authhero.mjs +123 -123
- package/dist/stats.html +1 -1
- package/package.json +2 -2
package/dist/authhero.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
3
3
|
* Released under the Apache License, Version 2.0
|
|
4
4
|
* see: https://github.com/dcodeIO/bcrypt.js for details
|
|
5
|
-
*/(function(e,n){typeof Qw=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Sl,function(){var e={},n=null;function r(C){if(t&&t.exports)try{return n2.randomBytes(C)}catch{}try{var E;return(self.crypto||self.msCrypto).getRandomValues(E=new Uint32Array(C)),Array.prototype.slice.call(E)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(C)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(C){n=C},e.genSaltSync=function(C,E){if(C=C||v,typeof C!="number")throw Error("Illegal arguments: "+typeof C+", "+typeof E);C<4?C=4:C>31&&(C=31);var z=[];return z.push("$2a$"),C<10&&z.push("0"),z.push(C.toString()),z.push("$"),z.push(f(r(y),y)),z.join("")},e.genSalt=function(C,E,z){if(typeof E=="function"&&(z=E,E=void 0),typeof C=="function"&&(z=C,C=void 0),typeof C>"u")C=v;else if(typeof C!="number")throw Error("illegal arguments: "+typeof C);function x(k){a(function(){try{k(null,e.genSaltSync(C))}catch(I){k(I)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(k,I){x(function(L,q){if(L){I(L);return}k(q)})})},e.hashSync=function(C,E){if(typeof E>"u"&&(E=v),typeof E=="number"&&(E=e.genSaltSync(E)),typeof C!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof C+", "+typeof E);return le(C,E)},e.hash=function(C,E,z,x){function k(I){typeof C=="string"&&typeof E=="number"?e.genSalt(E,function(L,q){le(C,q,I,x)}):typeof C=="string"&&typeof E=="string"?le(C,E,I,x):a(I.bind(this,Error("Illegal arguments: "+typeof C+", "+typeof E)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(I,L){k(function(q,F){if(q){L(q);return}I(F)})})};function s(C,E){for(var z=0,x=0,k=0,I=C.length;k<I;++k)C.charCodeAt(k)===E.charCodeAt(k)?++z:++x;return z<0?!1:x===0}e.compareSync=function(C,E){if(typeof C!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof C+", "+typeof E);return E.length!==60?!1:s(e.hashSync(C,E.substr(0,E.length-31)),E)},e.compare=function(C,E,z,x){function k(I){if(typeof C!="string"||typeof E!="string"){a(I.bind(this,Error("Illegal arguments: "+typeof C+", "+typeof E)));return}if(E.length!==60){a(I.bind(this,null,!1));return}e.hash(C,E.substr(0,29),function(L,q){L?I(L):I(null,s(q,E))},x)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(I,L){k(function(q,F){if(q){L(q);return}I(F)})})},e.getRounds=function(C){if(typeof C!="string")throw Error("Illegal arguments: "+typeof C);return parseInt(C.split("$")[2],10)},e.getSalt=function(C){if(typeof C!="string")throw Error("Illegal arguments: "+typeof C);if(C.length!==60)throw Error("Illegal hash length: "+C.length+" != 60");return C.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(C){var E=[],z=0;return m.encodeUTF16toUTF8(function(){return z>=C.length?null:C.charCodeAt(z++)},function(x){E.push(x)}),E}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],u=String.fromCharCode;function f(C,E){var z=0,x=[],k,I;if(E<=0||E>C.length)throw Error("Illegal len: "+E);for(;z<E;){if(k=C[z++]&255,x.push(l[k>>2&63]),k=(k&3)<<4,z>=E){x.push(l[k&63]);break}if(I=C[z++]&255,k|=I>>4&15,x.push(l[k&63]),k=(I&15)<<2,z>=E){x.push(l[k&63]);break}I=C[z++]&255,k|=I>>6&3,x.push(l[k&63]),x.push(l[I&63])}return x.join("")}function h(C,E){var z=0,x=C.length,k=0,I=[],L,q,F,Z,oe,D;if(E<=0)throw Error("Illegal len: "+E);for(;z<x-1&&k<E&&(D=C.charCodeAt(z++),L=D<d.length?d[D]:-1,D=C.charCodeAt(z++),q=D<d.length?d[D]:-1,!(L==-1||q==-1||(oe=L<<2>>>0,oe|=(q&48)>>4,I.push(u(oe)),++k>=E||z>=x)||(D=C.charCodeAt(z++),F=D<d.length?d[D]:-1,F==-1)||(oe=(q&15)<<4>>>0,oe|=(F&60)>>2,I.push(u(oe)),++k>=E||z>=x)));)D=C.charCodeAt(z++),Z=D<d.length?d[D]:-1,oe=(F&3)<<6>>>0,oe|=Z,I.push(u(oe)),++k;var pe=[];for(z=0;z<k;z++)pe.push(I[z].charCodeAt(0));return pe}var m=function(){var C={};return C.MAX_CODEPOINT=1114111,C.encodeUTF8=function(E,z){var x=null;for(typeof E=="number"&&(x=E,E=function(){return null});x!==null||(x=E())!==null;)x<128?z(x&127):x<2048?(z(x>>6&31|192),z(x&63|128)):x<65536?(z(x>>12&15|224),z(x>>6&63|128),z(x&63|128)):(z(x>>18&7|240),z(x>>12&63|128),z(x>>6&63|128),z(x&63|128)),x=null},C.decodeUTF8=function(E,z){for(var x,k,I,L,q=function(F){F=F.slice(0,F.indexOf(null));var Z=Error(F.toString());throw Z.name="TruncatedError",Z.bytes=F,Z};(x=E())!==null;)if(!(x&128))z(x);else if((x&224)===192)(k=E())===null&&q([x,k]),z((x&31)<<6|k&63);else if((x&240)===224)((k=E())===null||(I=E())===null)&&q([x,k,I]),z((x&15)<<12|(k&63)<<6|I&63);else if((x&248)===240)((k=E())===null||(I=E())===null||(L=E())===null)&&q([x,k,I,L]),z((x&7)<<18|(k&63)<<12|(I&63)<<6|L&63);else throw RangeError("Illegal starting byte: "+x)},C.UTF16toUTF8=function(E,z){for(var x,k=null;(x=k!==null?k:E())!==null;){if(x>=55296&&x<=57343&&(k=E())!==null&&k>=56320&&k<=57343){z((x-55296)*1024+k-56320+65536),k=null;continue}z(x)}k!==null&&z(k)},C.UTF8toUTF16=function(E,z){var x=null;for(typeof E=="number"&&(x=E,E=function(){return null});x!==null||(x=E())!==null;)x<=65535?z(x):(x-=65536,z((x>>10)+55296),z(x%1024+56320)),x=null},C.encodeUTF16toUTF8=function(E,z){C.UTF16toUTF8(E,function(x){C.encodeUTF8(x,z)})},C.decodeUTF8toUTF16=function(E,z){C.decodeUTF8(E,function(x){C.UTF8toUTF16(x,z)})},C.calculateCodePoint=function(E){return E<128?1:E<2048?2:E<65536?3:4},C.calculateUTF8=function(E){for(var z,x=0;(z=E())!==null;)x+=C.calculateCodePoint(z);return x},C.calculateUTF16asUTF8=function(E){var z=0,x=0;return C.UTF16toUTF8(E,function(k){++z,x+=C.calculateCodePoint(k)}),[z,x]},C}();Date.now=Date.now||function(){return+new Date};var y=16,v=10,$=16,N=100,O=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],U=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],T=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function R(C,E,z,x){var k,I=C[E],L=C[E+1];return I^=z[0],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[1],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[2],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[3],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[4],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[5],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[6],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[7],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[8],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[9],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[10],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[11],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[12],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[13],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[14],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[15],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[16],C[E]=L^z[$+1],C[E+1]=I,C}function W(C,E){for(var z=0,x=0;z<4;++z)x=x<<8|C[E]&255,E=(E+1)%C.length;return{key:x,offp:E}}function te(C,E,z){for(var x=0,k=[0,0],I=E.length,L=z.length,q,F=0;F<I;F++)q=W(C,x),x=q.offp,E[F]=E[F]^q.key;for(F=0;F<I;F+=2)k=R(k,0,E,z),E[F]=k[0],E[F+1]=k[1];for(F=0;F<L;F+=2)k=R(k,0,E,z),z[F]=k[0],z[F+1]=k[1]}function Q(C,E,z,x){for(var k=0,I=[0,0],L=z.length,q=x.length,F,Z=0;Z<L;Z++)F=W(E,k),k=F.offp,z[Z]=z[Z]^F.key;for(k=0,Z=0;Z<L;Z+=2)F=W(C,k),k=F.offp,I[0]^=F.key,F=W(C,k),k=F.offp,I[1]^=F.key,I=R(I,0,z,x),z[Z]=I[0],z[Z+1]=I[1];for(Z=0;Z<q;Z+=2)F=W(C,k),k=F.offp,I[0]^=F.key,F=W(C,k),k=F.offp,I[1]^=F.key,I=R(I,0,z,x),x[Z]=I[0],x[Z+1]=I[1]}function K(C,E,z,x,k){var I=T.slice(),L=I.length,q;if(z<4||z>31)if(q=Error("Illegal number of rounds (4-31): "+z),x){a(x.bind(this,q));return}else throw q;if(E.length!==y)if(q=Error("Illegal salt length: "+E.length+" != "+y),x){a(x.bind(this,q));return}else throw q;z=1<<z>>>0;var F,Z,oe=0,D;Int32Array?(F=new Int32Array(O),Z=new Int32Array(U)):(F=O.slice(),Z=U.slice()),Q(E,C,F,Z);function pe(){if(k&&k(oe/z),oe<z)for(var ae=Date.now();oe<z&&(oe=oe+1,te(C,F,Z),te(E,F,Z),!(Date.now()-ae>N)););else{for(oe=0;oe<64;oe++)for(D=0;D<L>>1;D++)R(I,D<<1,F,Z);var de=[];for(oe=0;oe<L;oe++)de.push((I[oe]>>24&255)>>>0),de.push((I[oe]>>16&255)>>>0),de.push((I[oe]>>8&255)>>>0),de.push((I[oe]&255)>>>0);if(x){x(null,de);return}else return de}x&&a(pe)}if(typeof x<"u")pe();else for(var be;;)if(typeof(be=pe())<"u")return be||[]}function le(C,E,z,x){var k;if(typeof C!="string"||typeof E!="string")if(k=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,k));return}else throw k;var I,L;if(E.charAt(0)!=="$"||E.charAt(1)!=="2")if(k=Error("Invalid salt version: "+E.substring(0,2)),z){a(z.bind(this,k));return}else throw k;if(E.charAt(2)==="$")I="\0",L=3;else{if(I=E.charAt(2),I!=="a"&&I!=="b"&&I!=="y"||E.charAt(3)!=="$")if(k=Error("Invalid salt revision: "+E.substring(2,4)),z){a(z.bind(this,k));return}else throw k;L=4}if(E.charAt(L+2)>"$")if(k=Error("Missing salt rounds"),z){a(z.bind(this,k));return}else throw k;var q=parseInt(E.substring(L,L+1),10)*10,F=parseInt(E.substring(L+1,L+2),10),Z=q+F,oe=E.substring(L+3,L+25);C+=I>="a"?"\0":"";var D=c(C),pe=h(oe,y);function be(ae){var de=[];return de.push("$2"),I>="a"&&de.push(I),de.push("$"),Z<10&&de.push("0"),de.push(Z.toString()),de.push("$"),de.push(f(pe,pe.length)),de.push(f(ae,T.length*4-1)),de.join("")}if(typeof z>"u")return be(K(D,pe,Z));K(D,pe,Z,function(ae,de){ae?z(ae,null):z(null,be(de))},x)}return e.encodeBase64=f,e.decodeBase64=h,e})})(um);var r2=um.exports;const ei=dm(r2),i2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let o2=t=>crypto.getRandomValues(new Uint8Array(t)),s2=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(s=e)=>{let a="";for(;;){let c=n(i),l=i;for(;l--;)if(a+=t[c[l]&r]||"",a.length===s)return a}}},pm=(t,e=21)=>s2(t,e,o2),Ne=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=i2[n[t]&63];return e};const a2=24;function Ba(){return pm("0123456789abcdef",a2)()}function ts(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function c2(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await zu({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function ve(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:e.connection||t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:e.audience||"",scope:e.scope?e.scope.split(" "):[]}}class Fs{constructor(e,n){se(this,"value");se(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Fs(Math.round(this.milliseconds()*e),"ms")}}class l2{constructor(e){se(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function fm(t){return await crypto.subtle.digest("SHA-256",t)}const of="0123456789abcdef";function zl(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=of[i];const s=e[r]&15;n+=of[s]}return n}class hm{constructor(e,n){se(this,"alphabet");se(this,"padding");se(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const c=(8-r.length%8)%8;for(let l=0;l<c;l++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let c=0;const l=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);l.push(h)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const d=(l[0]<<3)+(l[1]>>2);if(s.push(d),c<6){const u=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(u)}if(c<4){const u=((l[3]&255)<<4)+(l[4]>>1);s.push(u)}if(c<3){const u=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(u)}if(c<1){const u=((l[6]&7)<<5)+l[7];s.push(u)}}return Uint8Array.from(s)}}new hm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new hm("0123456789ABCDEFGHIJKLMNOPQRSTUV");class gm{constructor(e,n){se(this,"alphabet");se(this,"padding");se(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const c=(4-r.length%4)%4;for(let l=0;l<c;l++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let c=0,l=0;for(let d=0;d<4;d++){const u=e[a*4+d];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);l+=f<<6*(3-d)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const d2=new gm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),pr=new gm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function sf(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},s={...n};(r==null?void 0:r.audiences)!==void 0&&(s.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(s.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(s.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(s.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(s.nbf=Math.floor(r.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=pr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),l=pr.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),d=a.encode([c,l].join(".")),u=await p2(t).sign(e,d),f=pr.encode(new Uint8Array(u),{includePadding:!1});return[c,l,f].join(".")}function u2(t){const e=t.split(".");return e.length!==3?null:e}function La(t){const e=u2(t);if(!e)return null;const n=new TextDecoder,r=pr.decode(e[0],{strict:!1}),i=pr.decode(e[1],{strict:!1}),s=JSON.parse(n.decode(r));if(typeof s!="object"||s===null||!("alg"in s)||!f2(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const l of a.aud)if(typeof l!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:t,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...c}}function p2(t){return new l2(h2[t])}function f2(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const h2={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function g2(){const t=new Uint8Array(32);return crypto.getRandomValues(t),pr.encode(t,{includePadding:!1})}function m2(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function _2(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await fm(n);return pr.encode(new Uint8Array(r),{includePadding:!1})}const ns=60*5,Ua=30*24*60*60,mr=24*60*60,y2="auth-token",fs=30*60*1e3,Al=7*24*60*60*1e3,w2=5*60,v2=5*60,b2=30*60*1e3,$2=30*60*1e3,k2=24*60*60*1e3;function mm(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function x2(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),s=i[0],a=i[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function vu(t){return`${t}-${y2}`}function _m(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function ti(t,e){return e?x2(e).get(vu(t)):void 0}function S2(t,e){return mm(vu(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?_m(e):void 0})}function qs(t,e,n){return mm(vu(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:Ua,sameSite:"none",domain:n?_m(n):void 0})}var z2=Object.defineProperty,A2=(t,e,n)=>e in t?z2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wr=(t,e,n)=>A2(t,typeof e!="symbol"?e+"":e,n);const dt=o.z.object({"#text":o.z.string()}),E2=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()});o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":E2,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(dt)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(dt)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const N2=o.z.object({":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string().optional()}),"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string(),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string()}).optional()}))}),C2=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),af=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(C2)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:DigestValue":o.z.array(dt)})])),":@":o.z.object({"@_URI":o.z.string().optional()}).optional()})]))}),o.z.object({"ds:SignatureValue":o.z.array(dt)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.union([o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(dt)}),o.z.object({"ds:Exponent":o.z.array(dt)})]))}))}),o.z.object({"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(dt)}))}),o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(dt)}),o.z.object({"ds:Exponent":o.z.array(dt)})]))})),"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(dt)}))})]))})])),":@":o.z.object({"@_xmlns:ds":o.z.string().optional()}).optional()});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(dt)}),af,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(dt),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(dt)}),af,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(dt),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(dt)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(dt)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(o.z.object({"saml:Attribute":o.z.array(N2)}))})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var bu={},Da={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),s=function(c,l){const d=[];let u=l.exec(c);for(;u;){const f=[];f.startIndex=l.lastIndex-u[0].length;const h=u.length;for(let m=0;m<h;m++)f.push(u[m]);d.push(f),u=l.exec(c)}return d},a=function(c){const l=i.exec(c);return!(l===null||typeof l>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,l,d){if(l){const u=Object.keys(l),f=u.length;for(let h=0;h<f;h++)d==="strict"?c[u[h]]=[l[u[h]]]:c[u[h]]=l[u[h]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Da);const $u=Da,I2={allowBooleanAttributes:!1,unpairedTags:[]};bu.validate=function(t,e){e=Object.assign({},I2,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=lf(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=df(t,s);continue}else{let c=!1;t[s]==="/"&&(c=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
|
|
5
|
+
*/(function(e,n){typeof Qw=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Sl,function(){var e={},n=null;function r(C){if(t&&t.exports)try{return n2.randomBytes(C)}catch{}try{var E;return(self.crypto||self.msCrypto).getRandomValues(E=new Uint32Array(C)),Array.prototype.slice.call(E)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(C)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(C){n=C},e.genSaltSync=function(C,E){if(C=C||v,typeof C!="number")throw Error("Illegal arguments: "+typeof C+", "+typeof E);C<4?C=4:C>31&&(C=31);var z=[];return z.push("$2a$"),C<10&&z.push("0"),z.push(C.toString()),z.push("$"),z.push(f(r(y),y)),z.join("")},e.genSalt=function(C,E,z){if(typeof E=="function"&&(z=E,E=void 0),typeof C=="function"&&(z=C,C=void 0),typeof C>"u")C=v;else if(typeof C!="number")throw Error("illegal arguments: "+typeof C);function x(k){a(function(){try{k(null,e.genSaltSync(C))}catch(I){k(I)}})}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);x(z)}else return new Promise(function(k,I){x(function(L,q){if(L){I(L);return}k(q)})})},e.hashSync=function(C,E){if(typeof E>"u"&&(E=v),typeof E=="number"&&(E=e.genSaltSync(E)),typeof C!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof C+", "+typeof E);return le(C,E)},e.hash=function(C,E,z,x){function k(I){typeof C=="string"&&typeof E=="number"?e.genSalt(E,function(L,q){le(C,q,I,x)}):typeof C=="string"&&typeof E=="string"?le(C,E,I,x):a(I.bind(this,Error("Illegal arguments: "+typeof C+", "+typeof E)))}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(I,L){k(function(q,F){if(q){L(q);return}I(F)})})};function s(C,E){for(var z=0,x=0,k=0,I=C.length;k<I;++k)C.charCodeAt(k)===E.charCodeAt(k)?++z:++x;return z<0?!1:x===0}e.compareSync=function(C,E){if(typeof C!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof C+", "+typeof E);return E.length!==60?!1:s(e.hashSync(C,E.substr(0,E.length-31)),E)},e.compare=function(C,E,z,x){function k(I){if(typeof C!="string"||typeof E!="string"){a(I.bind(this,Error("Illegal arguments: "+typeof C+", "+typeof E)));return}if(E.length!==60){a(I.bind(this,null,!1));return}e.hash(C,E.substr(0,29),function(L,q){L?I(L):I(null,s(q,E))},x)}if(z){if(typeof z!="function")throw Error("Illegal callback: "+typeof z);k(z)}else return new Promise(function(I,L){k(function(q,F){if(q){L(q);return}I(F)})})},e.getRounds=function(C){if(typeof C!="string")throw Error("Illegal arguments: "+typeof C);return parseInt(C.split("$")[2],10)},e.getSalt=function(C){if(typeof C!="string")throw Error("Illegal arguments: "+typeof C);if(C.length!==60)throw Error("Illegal hash length: "+C.length+" != 60");return C.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(C){var E=[],z=0;return m.encodeUTF16toUTF8(function(){return z>=C.length?null:C.charCodeAt(z++)},function(x){E.push(x)}),E}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],u=String.fromCharCode;function f(C,E){var z=0,x=[],k,I;if(E<=0||E>C.length)throw Error("Illegal len: "+E);for(;z<E;){if(k=C[z++]&255,x.push(l[k>>2&63]),k=(k&3)<<4,z>=E){x.push(l[k&63]);break}if(I=C[z++]&255,k|=I>>4&15,x.push(l[k&63]),k=(I&15)<<2,z>=E){x.push(l[k&63]);break}I=C[z++]&255,k|=I>>6&3,x.push(l[k&63]),x.push(l[I&63])}return x.join("")}function h(C,E){var z=0,x=C.length,k=0,I=[],L,q,F,Z,oe,D;if(E<=0)throw Error("Illegal len: "+E);for(;z<x-1&&k<E&&(D=C.charCodeAt(z++),L=D<d.length?d[D]:-1,D=C.charCodeAt(z++),q=D<d.length?d[D]:-1,!(L==-1||q==-1||(oe=L<<2>>>0,oe|=(q&48)>>4,I.push(u(oe)),++k>=E||z>=x)||(D=C.charCodeAt(z++),F=D<d.length?d[D]:-1,F==-1)||(oe=(q&15)<<4>>>0,oe|=(F&60)>>2,I.push(u(oe)),++k>=E||z>=x)));)D=C.charCodeAt(z++),Z=D<d.length?d[D]:-1,oe=(F&3)<<6>>>0,oe|=Z,I.push(u(oe)),++k;var pe=[];for(z=0;z<k;z++)pe.push(I[z].charCodeAt(0));return pe}var m=function(){var C={};return C.MAX_CODEPOINT=1114111,C.encodeUTF8=function(E,z){var x=null;for(typeof E=="number"&&(x=E,E=function(){return null});x!==null||(x=E())!==null;)x<128?z(x&127):x<2048?(z(x>>6&31|192),z(x&63|128)):x<65536?(z(x>>12&15|224),z(x>>6&63|128),z(x&63|128)):(z(x>>18&7|240),z(x>>12&63|128),z(x>>6&63|128),z(x&63|128)),x=null},C.decodeUTF8=function(E,z){for(var x,k,I,L,q=function(F){F=F.slice(0,F.indexOf(null));var Z=Error(F.toString());throw Z.name="TruncatedError",Z.bytes=F,Z};(x=E())!==null;)if(!(x&128))z(x);else if((x&224)===192)(k=E())===null&&q([x,k]),z((x&31)<<6|k&63);else if((x&240)===224)((k=E())===null||(I=E())===null)&&q([x,k,I]),z((x&15)<<12|(k&63)<<6|I&63);else if((x&248)===240)((k=E())===null||(I=E())===null||(L=E())===null)&&q([x,k,I,L]),z((x&7)<<18|(k&63)<<12|(I&63)<<6|L&63);else throw RangeError("Illegal starting byte: "+x)},C.UTF16toUTF8=function(E,z){for(var x,k=null;(x=k!==null?k:E())!==null;){if(x>=55296&&x<=57343&&(k=E())!==null&&k>=56320&&k<=57343){z((x-55296)*1024+k-56320+65536),k=null;continue}z(x)}k!==null&&z(k)},C.UTF8toUTF16=function(E,z){var x=null;for(typeof E=="number"&&(x=E,E=function(){return null});x!==null||(x=E())!==null;)x<=65535?z(x):(x-=65536,z((x>>10)+55296),z(x%1024+56320)),x=null},C.encodeUTF16toUTF8=function(E,z){C.UTF16toUTF8(E,function(x){C.encodeUTF8(x,z)})},C.decodeUTF8toUTF16=function(E,z){C.decodeUTF8(E,function(x){C.UTF8toUTF16(x,z)})},C.calculateCodePoint=function(E){return E<128?1:E<2048?2:E<65536?3:4},C.calculateUTF8=function(E){for(var z,x=0;(z=E())!==null;)x+=C.calculateCodePoint(z);return x},C.calculateUTF16asUTF8=function(E){var z=0,x=0;return C.UTF16toUTF8(E,function(k){++z,x+=C.calculateCodePoint(k)}),[z,x]},C}();Date.now=Date.now||function(){return+new Date};var y=16,v=10,$=16,N=100,O=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],U=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],T=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function R(C,E,z,x){var k,I=C[E],L=C[E+1];return I^=z[0],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[1],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[2],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[3],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[4],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[5],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[6],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[7],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[8],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[9],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[10],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[11],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[12],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[13],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[14],k=x[I>>>24],k+=x[256|I>>16&255],k^=x[512|I>>8&255],k+=x[768|I&255],L^=k^z[15],k=x[L>>>24],k+=x[256|L>>16&255],k^=x[512|L>>8&255],k+=x[768|L&255],I^=k^z[16],C[E]=L^z[$+1],C[E+1]=I,C}function W(C,E){for(var z=0,x=0;z<4;++z)x=x<<8|C[E]&255,E=(E+1)%C.length;return{key:x,offp:E}}function te(C,E,z){for(var x=0,k=[0,0],I=E.length,L=z.length,q,F=0;F<I;F++)q=W(C,x),x=q.offp,E[F]=E[F]^q.key;for(F=0;F<I;F+=2)k=R(k,0,E,z),E[F]=k[0],E[F+1]=k[1];for(F=0;F<L;F+=2)k=R(k,0,E,z),z[F]=k[0],z[F+1]=k[1]}function Q(C,E,z,x){for(var k=0,I=[0,0],L=z.length,q=x.length,F,Z=0;Z<L;Z++)F=W(E,k),k=F.offp,z[Z]=z[Z]^F.key;for(k=0,Z=0;Z<L;Z+=2)F=W(C,k),k=F.offp,I[0]^=F.key,F=W(C,k),k=F.offp,I[1]^=F.key,I=R(I,0,z,x),z[Z]=I[0],z[Z+1]=I[1];for(Z=0;Z<q;Z+=2)F=W(C,k),k=F.offp,I[0]^=F.key,F=W(C,k),k=F.offp,I[1]^=F.key,I=R(I,0,z,x),x[Z]=I[0],x[Z+1]=I[1]}function K(C,E,z,x,k){var I=T.slice(),L=I.length,q;if(z<4||z>31)if(q=Error("Illegal number of rounds (4-31): "+z),x){a(x.bind(this,q));return}else throw q;if(E.length!==y)if(q=Error("Illegal salt length: "+E.length+" != "+y),x){a(x.bind(this,q));return}else throw q;z=1<<z>>>0;var F,Z,oe=0,D;Int32Array?(F=new Int32Array(O),Z=new Int32Array(U)):(F=O.slice(),Z=U.slice()),Q(E,C,F,Z);function pe(){if(k&&k(oe/z),oe<z)for(var ae=Date.now();oe<z&&(oe=oe+1,te(C,F,Z),te(E,F,Z),!(Date.now()-ae>N)););else{for(oe=0;oe<64;oe++)for(D=0;D<L>>1;D++)R(I,D<<1,F,Z);var de=[];for(oe=0;oe<L;oe++)de.push((I[oe]>>24&255)>>>0),de.push((I[oe]>>16&255)>>>0),de.push((I[oe]>>8&255)>>>0),de.push((I[oe]&255)>>>0);if(x){x(null,de);return}else return de}x&&a(pe)}if(typeof x<"u")pe();else for(var be;;)if(typeof(be=pe())<"u")return be||[]}function le(C,E,z,x){var k;if(typeof C!="string"||typeof E!="string")if(k=Error("Invalid string / salt: Not a string"),z){a(z.bind(this,k));return}else throw k;var I,L;if(E.charAt(0)!=="$"||E.charAt(1)!=="2")if(k=Error("Invalid salt version: "+E.substring(0,2)),z){a(z.bind(this,k));return}else throw k;if(E.charAt(2)==="$")I="\0",L=3;else{if(I=E.charAt(2),I!=="a"&&I!=="b"&&I!=="y"||E.charAt(3)!=="$")if(k=Error("Invalid salt revision: "+E.substring(2,4)),z){a(z.bind(this,k));return}else throw k;L=4}if(E.charAt(L+2)>"$")if(k=Error("Missing salt rounds"),z){a(z.bind(this,k));return}else throw k;var q=parseInt(E.substring(L,L+1),10)*10,F=parseInt(E.substring(L+1,L+2),10),Z=q+F,oe=E.substring(L+3,L+25);C+=I>="a"?"\0":"";var D=c(C),pe=h(oe,y);function be(ae){var de=[];return de.push("$2"),I>="a"&&de.push(I),de.push("$"),Z<10&&de.push("0"),de.push(Z.toString()),de.push("$"),de.push(f(pe,pe.length)),de.push(f(ae,T.length*4-1)),de.join("")}if(typeof z>"u")return be(K(D,pe,Z));K(D,pe,Z,function(ae,de){ae?z(ae,null):z(null,be(de))},x)}return e.encodeBase64=f,e.decodeBase64=h,e})})(um);var r2=um.exports;const ei=dm(r2),i2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let o2=t=>crypto.getRandomValues(new Uint8Array(t)),s2=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(s=e)=>{let a="";for(;;){let c=n(i),l=i;for(;l--;)if(a+=t[c[l]&r]||"",a.length===s)return a}}},pm=(t,e=21)=>s2(t,e,o2),Ne=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=i2[n[t]&63];return e};const a2=24;function Ba(){return pm("0123456789abcdef",a2)()}function ts(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function c2(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await zu({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function ve(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:e.connection||t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:e.audience||"",scope:e.scope?e.scope.split(" "):[]}}class Fs{constructor(e,n){se(this,"value");se(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Fs(Math.round(this.milliseconds()*e),"ms")}}class l2{constructor(e){se(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function fm(t){return await crypto.subtle.digest("SHA-256",t)}const of="0123456789abcdef";function zl(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=of[i];const s=e[r]&15;n+=of[s]}return n}class hm{constructor(e,n){se(this,"alphabet");se(this,"padding");se(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const c=(8-r.length%8)%8;for(let l=0;l<c;l++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let c=0;const l=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);l.push(h)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const d=(l[0]<<3)+(l[1]>>2);if(s.push(d),c<6){const u=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(u)}if(c<4){const u=((l[3]&255)<<4)+(l[4]>>1);s.push(u)}if(c<3){const u=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(u)}if(c<1){const u=((l[6]&7)<<5)+l[7];s.push(u)}}return Uint8Array.from(s)}}new hm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new hm("0123456789ABCDEFGHIJKLMNOPQRSTUV");class gm{constructor(e,n){se(this,"alphabet");se(this,"padding");se(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let c=0;c<e.length;c++)for(i=i<<8|e[c],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const c=(4-r.length%4)%4;for(let l=0;l<c;l++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let c=0,l=0;for(let d=0;d<4;d++){const u=e[a*4+d];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);l+=f<<6*(3-d)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const d2=new gm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),pr=new gm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function sf(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},s={...n};(r==null?void 0:r.audiences)!==void 0&&(s.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(s.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(s.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(s.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(s.nbf=Math.floor(r.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=pr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),l=pr.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),d=a.encode([c,l].join(".")),u=await p2(t).sign(e,d),f=pr.encode(new Uint8Array(u),{includePadding:!1});return[c,l,f].join(".")}function u2(t){const e=t.split(".");return e.length!==3?null:e}function La(t){const e=u2(t);if(!e)return null;const n=new TextDecoder,r=pr.decode(e[0],{strict:!1}),i=pr.decode(e[1],{strict:!1}),s=JSON.parse(n.decode(r));if(typeof s!="object"||s===null||!("alg"in s)||!f2(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const l of a.aud)if(typeof l!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:t,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...c}}function p2(t){return new l2(h2[t])}function f2(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const h2={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function g2(){const t=new Uint8Array(32);return crypto.getRandomValues(t),pr.encode(t,{includePadding:!1})}function m2(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function _2(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await fm(n);return pr.encode(new Uint8Array(r),{includePadding:!1})}const ns=60*5,Ua=30*24*60*60,mr=24*60*60,y2="auth-token",fs=30*60*1e3,Al=7*24*60*60*1e3,w2=5*60,v2=5*60,b2=30*60*1e3,$2=30*60*1e3,k2=24*60*60*1e3;function mm(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function x2(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),s=i[0],a=i[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function vu(t){return`${t}-${y2}`}function _m(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function ti(t,e){return e?x2(e).get(vu(t)):void 0}function S2(t,e){return mm(vu(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?_m(e):void 0})}function qs(t,e,n){return mm(vu(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:Ua,sameSite:"none",domain:n?_m(n):void 0})}var z2=Object.defineProperty,A2=(t,e,n)=>e in t?z2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wr=(t,e,n)=>A2(t,typeof e!="symbol"?e+"":e,n);const dt=o.z.object({"#text":o.z.string()}),E2=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()});o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":E2,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(dt)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(dt)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const N2=o.z.object({"saml:Attribute":o.z.array(o.z.object({"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string()})),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string()}).optional()})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string().optional()})}),C2=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),af=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(C2)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:DigestValue":o.z.array(dt)})])),":@":o.z.object({"@_URI":o.z.string().optional()}).optional()})]))}),o.z.object({"ds:SignatureValue":o.z.array(dt)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.union([o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(dt)}),o.z.object({"ds:Exponent":o.z.array(dt)})]))}))}),o.z.object({"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(dt)}))}),o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(dt)}),o.z.object({"ds:Exponent":o.z.array(dt)})]))})),"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(dt)}))})]))})])),":@":o.z.object({"@_xmlns:ds":o.z.string().optional()}).optional()});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(dt)}),af,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(dt),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(dt)}),af,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(dt),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(dt)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(dt)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(N2)})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var bu={},Da={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),s=function(c,l){const d=[];let u=l.exec(c);for(;u;){const f=[];f.startIndex=l.lastIndex-u[0].length;const h=u.length;for(let m=0;m<h;m++)f.push(u[m]);d.push(f),u=l.exec(c)}return d},a=function(c){const l=i.exec(c);return!(l===null||typeof l>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,l,d){if(l){const u=Object.keys(l),f=u.length;for(let h=0;h<f;h++)d==="strict"?c[u[h]]=[l[u[h]]]:c[u[h]]=l[u[h]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Da);const $u=Da,I2={allowBooleanAttributes:!1,unpairedTags:[]};bu.validate=function(t,e){e=Object.assign({},I2,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=lf(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=df(t,s);continue}else{let c=!1;t[s]==="/"&&(c=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
|
|
6
6
|
`&&t[s]!=="\r";s++)l+=t[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!U2(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Me("InvalidTag",f,ht(t,s))}const d=T2(t,s);if(d===!1)return Me("InvalidAttr","Attributes for '"+l+"' have open quote.",ht(t,s));let u=d.value;if(s=d.index,u[u.length-1]==="/"){const f=s-u.length;u=u.substring(0,u.length-1);const h=uf(u,e);if(h===!0)r=!0;else return Me(h.err.code,h.err.msg,ht(t,f+h.err.line))}else if(c)if(d.tagClosed){if(u.trim().length>0)return Me("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",ht(t,a));if(n.length===0)return Me("InvalidTag","Closing tag '"+l+"' has not been opened.",ht(t,a));{const f=n.pop();if(l!==f.tagName){let h=ht(t,f.tagStartPos);return Me("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+l+"'.",ht(t,a))}n.length==0&&(i=!0)}}else return Me("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",ht(t,s));else{const f=uf(u,e);if(f!==!0)return Me(f.err.code,f.err.msg,ht(t,s-u.length+f.err.line));if(i===!0)return Me("InvalidXml","Multiple possible root nodes found.",ht(t,s));e.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=df(t,s);continue}else if(t[s+1]==="?"){if(s=lf(t,++s),s.err)return s}else break;else if(t[s]==="&"){const f=B2(t,s);if(f==-1)return Me("InvalidChar","char '&' is not expected.",ht(t,s));s=f}else if(i===!0&&!cf(t[s]))return Me("InvalidXml","Extra text at the end",ht(t,s));t[s]==="<"&&s--}}else{if(cf(t[s]))continue;return Me("InvalidChar","char '"+t[s]+"' is not expected.",ht(t,s))}if(r){if(n.length==1)return Me("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ht(t,n[0].tagStartPos));if(n.length>0)return Me("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Me("InvalidXml","Start tag expected.",1);return!0};function cf(t){return t===" "||t===" "||t===`
|
|
7
7
|
`||t==="\r"}function lf(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return Me("InvalidXml","XML declaration allowed only at the start of the document.",ht(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function df(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const j2='"',O2="'";function T2(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===j2||t[e]===O2)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const P2=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function uf(t,e){const n=$u.getAllMatches(t,P2),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Me("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",Ri(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Me("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",Ri(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Me("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",Ri(n[i]));const s=n[i][2];if(!L2(s))return Me("InvalidAttr","Attribute '"+s+"' is an invalid name.",Ri(n[i]));if(!r.hasOwnProperty(s))r[s]=1;else return Me("InvalidAttr","Attribute '"+s+"' is repeated.",Ri(n[i]))}return!0}function R2(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function B2(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,R2(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function Me(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function L2(t){return $u.isName(t)}function U2(t){return $u.isName(t)}function ht(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Ri(t){return t.startIndex+t[1].length}var ku={};const ym={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}},D2=function(t){return Object.assign({},ym,t)};ku.buildOptions=D2;ku.defaultOptions=ym;let M2=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};var F2=M2;const q2=Da;function H2(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,s=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!s){if(i&&G2(t,e)){e+=7;let c,l;[c,l,e]=V2(t,e+1),l.indexOf("&")===-1&&(n[Z2(c)]={regx:RegExp(`&${c};`,"g"),val:l})}else if(i&&W2(t,e))e+=8;else if(i&&J2(t,e))e+=8;else if(i&&X2(t,e))e+=9;else if(K2)s=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:e}}function V2(t,e){let n="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)n+=t[e];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function K2(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function G2(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function W2(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function J2(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function X2(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function Z2(t){if(q2.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var Y2=H2;const Q2=/^[-+]?0x[a-fA-F0-9]+$/,ev=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const tv={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function nv(t,e={}){if(e=Object.assign({},tv,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(e.hex&&Q2.test(n))return Number.parseInt(n,16);{const r=ev.exec(n);if(r){const i=r[1],s=r[2];let a=rv(r[3]);const c=r[4]||r[6];if(!e.leadingZeros&&s.length>0&&i&&n[2]!=="."||!e.leadingZeros&&s.length>0&&!i&&n[1]!==".")return t;{const l=Number(n),d=""+l;return d.search(/[eE]/)!==-1||c?e.eNotation?l:t:n.indexOf(".")!==-1?d==="0"&&a===""||d===a||i&&d==="-"+a?l:t:s?a===d||i+a===d?l:t:n===d||n===i+d?l:t}}else return t}}function rv(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var iv=nv;function ov(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}var wm=ov;const vm=Da,Bi=F2,sv=Y2,av=iv,cv=wm;let lv=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=dv,this.parseXml=gv,this.parseTextData=uv,this.resolveNameSpace=pv,this.buildAttributesMap=hv,this.isItStopNode=wv,this.replaceEntitiesValue=_v,this.readStopNodeData=bv,this.saveTextToParentTag=yv,this.addChild=mv,this.ignoreAttributesFn=cv(this.options.ignoreAttributes)}};function dv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function uv(t,e,n,r,i,s,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const c=this.options.tagValueProcessor(e,t,n,i,s);return c==null?t:typeof c!=typeof t||c!==t?c:this.options.trimValues?Nl(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Nl(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function pv(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const fv=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function hv(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=vm.getAllMatches(t,fv),i=r.length,s={};for(let a=0;a<i;a++){const c=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(c,e))continue;let l=r[a][4],d=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const u=this.options.attributeValueProcessor(c,l,e);u==null?s[d]=l:typeof u!=typeof l||u!==l?s[d]=u:s[d]=Nl(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[d]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const gv=function(t){t=t.replace(/\r\n?/g,`
|
|
8
8
|
`);const e=new Bi("!xml");let n=e,r="",i="";for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const a=lr(t,">",s,"Closing Tag is not closed.");let c=t.substring(s+2,a).trim();if(this.options.removeNSPrefix){const u=c.indexOf(":");u!==-1&&(c=c.substr(u+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,i));const l=i.substring(i.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let d=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(d=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=i.lastIndexOf("."),i=i.substring(0,d),n=this.tagsNodeStack.pop(),r="",s=a}else if(t[s+1]==="?"){let a=El(t,s,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new Bi(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,i,a.tagName)),this.addChild(n,c,i)}s=a.closeIndex+1}else if(t.substr(s+1,3)==="!--"){const a=lr(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const c=t.substring(s+4,a-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}s=a}else if(t.substr(s+1,2)==="!D"){const a=sv(t,s);this.docTypeEntities=a.entities,s=a.i}else if(t.substr(s+1,2)==="!["){const a=lr(t,"]]>",s,"CDATA is not closed.")-2,c=t.substring(s+9,a);r=this.saveTextToParentTag(r,n,i);let l=this.parseTextData(c,n.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,l),s=a+2}else{let a=El(t,s,this.options.removeNSPrefix),c=a.tagName;const l=a.rawTagName;let d=a.tagExp,u=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const h=n;if(h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),c!==e.tagname&&(i+=i?"."+c:c),this.isItStopNode(this.options.stopNodes,i,c)){let m="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),d=c):d=d.substr(0,d.length-1),s=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)s=a.closeIndex;else{const v=this.readStopNodeData(t,l,f+1);if(!v)throw new Error(`Unexpected end of ${l}`);s=v.i,m=v.tagContent}const y=new Bi(c);c!==d&&u&&(y[":@"]=this.buildAttributesMap(d,i,c)),m&&(m=this.parseTextData(m,c,i,!0,u,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),y.add(this.options.textNodeName,m),this.addChild(n,y,i)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),d=c):d=d.substr(0,d.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const m=new Bi(c);c!==d&&u&&(m[":@"]=this.buildAttributesMap(d,i,c)),this.addChild(n,m,i),i=i.substr(0,i.lastIndexOf("."))}else{const m=new Bi(c);this.tagsNodeStack.push(n),c!==d&&u&&(m[":@"]=this.buildAttributesMap(d,i,c)),this.addChild(n,m,i),n=m}r="",s=f}}else r+=t[s];return e.child};function mv(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const _v=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function yv(t,e,n,r){return t&&(r===void 0&&(r=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function wv(t,e,n){const r="*."+n;for(const i in t){const s=t[i];if(r===s||e===s)return!0}return!1}function vv(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let a=t[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(t[s+1]===n[1])return{data:i,index:s}}else return{data:i,index:s};else a===" "&&(a=" ");i+=a}}function lr(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function El(t,e,n,r=">"){const i=vv(t,e+1,r);if(!i)return;let s=i.data;const a=i.index,c=s.search(/\s/);let l=s,d=!0;c!==-1&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());const u=l;if(n){const f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),d=l!==i.data.substr(f+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:d,rawTagName:u}}function bv(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const s=lr(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:s};n=s}else if(t[n+1]==="?")n=lr(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=lr(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=lr(t,"]]>",n,"StopNode is not closed.")-2;else{const s=El(t,n,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,n=s.closeIndex)}}function Nl(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:av(t,n)}else return vm.isExist(t)?t:""}var $v=lv,bm={};function kv(t,e){return $m(t,e)}function $m(t,e,n){let r;const i={};for(let s=0;s<t.length;s++){const a=t[s],c=xv(a);let l="";if(n===void 0?l=c:l=n+"."+c,c===e.textNodeName)r===void 0?r=a[c]:r+=""+a[c];else{if(c===void 0)continue;if(a[c]){let d=$m(a[c],e,l);const u=zv(d,e);a[":@"]?Sv(d,a[":@"],l,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),i[c]!==void 0&&i.hasOwnProperty(c)?(Array.isArray(i[c])||(i[c]=[i[c]]),i[c].push(d)):e.isArray(c,l,u)?i[c]=[d]:i[c]=d}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function xv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Sv(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let a=0;a<s;a++){const c=i[a];r.isArray(c,n+"."+c,!0,!0)?t[c]=[e[c]]:t[c]=e[c]}}}function zv(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}bm.prettify=kv;const{buildOptions:Av}=ku,Ev=$v,{prettify:Nv}=bm,Cv=bu;let Iv=class{constructor(e){this.externalEntities={},this.options=Av(e)}parse(e,n){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const s=Cv.validate(e,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new Ev(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Nv(i,this.options)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}};var jv=Iv;const Ov=`
|
|
9
9
|
`;function Tv(t,e){let n="";return e.format&&e.indentBy.length>0&&(n=Ov),km(t,e,"",n)}function km(t,e,n,r){let i="",s=!1;for(let a=0;a<t.length;a++){const c=t[a],l=Pv(c);if(l===void 0)continue;let d="";if(n.length===0?d=l:d=`${n}.${l}`,l===e.textNodeName){let y=c[l];Rv(d,e)||(y=e.tagValueProcessor(l,y),y=xm(y,e)),s&&(i+=r),i+=y,s=!1;continue}else if(l===e.cdataPropName){s&&(i+=r),i+=`<![CDATA[${c[l][0][e.textNodeName]}]]>`,s=!1;continue}else if(l===e.commentPropName){i+=r+`<!--${c[l][0][e.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const y=pf(c[":@"],e),v=l==="?xml"?"":r;let $=c[l][0][e.textNodeName];$=$.length!==0?" "+$:"",i+=v+`<${l}${$}${y}?>`,s=!0;continue}let u=r;u!==""&&(u+=e.indentBy);const f=pf(c[":@"],e),h=r+`<${l}${f}`,m=km(c[l],e,d,u);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?i+=h+">":i+=h+"/>":(!m||m.length===0)&&e.suppressEmptyNode?i+=h+"/>":m&&m.endsWith(">")?i+=h+`>${m}${r}</${l}>`:(i+=h+">",m&&r!==""&&(m.includes("/>")||m.includes("</"))?i+=r+e.indentBy+m+r:i+=m,i+=`</${l}>`),s=!0}return i}function Pv(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&r!==":@")return r}}function pf(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=xm(i,e),i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function Rv(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let n=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function xm(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}var Bv=Tv;const Lv=Bv,Uv=wm,Dv={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Yn(t){this.options=Object.assign({},Dv,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Uv(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=qv),this.processTextOrObjNode=Mv,this.options.format?(this.indentate=Fv,this.tagEndChar=`>
|
|
10
10
|
`,this.newLine=`
|
|
11
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Yn.prototype.build=function(t){return this.options.preserveOrder?Lv(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};Yn.prototype.j2x=function(t,e,n){let r="",i="";const s=n.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(typeof t[a]>"u")this.isAttribute(a)&&(i+="");else if(t[a]===null)this.isAttribute(a)?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e);else if(typeof t[a]!="object"){const c=this.isAttribute(a);if(c&&!this.ignoreAttributesFn(c,s))r+=this.buildAttrPairStr(c,""+t[a]);else if(!c)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(l)}else i+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){const c=t[a].length;let l="",d="";for(let u=0;u<c;u++){const f=t[a][u];if(!(typeof f>"u"))if(f===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const h=this.j2x(f,e+1,n.concat(a));l+=h.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(d+=h.attrStr)}else l+=this.processTextOrObjNode(f,a,e,n);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(a,f);h=this.replaceEntitiesValue(h),l+=h}else l+=this.buildTextValNode(f,a,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,d,e)),i+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const c=Object.keys(t[a]),l=c.length;for(let d=0;d<l;d++)r+=this.buildAttrPairStr(c[d],""+t[a][c[d]])}else i+=this.processTextOrObjNode(t[a],a,e,n);return{attrStr:r,val:i}};Yn.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Mv(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}Yn.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Yn.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Yn.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};Yn.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function Fv(t){return this.options.indentBy.repeat(t)}function qv(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var Hv=Yn;const Vv=bu,Kv=jv,Gv=Hv;var Wv={XMLParser:Kv,XMLValidator:Vv,XMLBuilder:Gv};let Sm=class{constructor(e,n){if(Wr(this,"alphabet"),Wr(this,"padding"),Wr(this,"decodeMap",new Map),e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let a=0;a<e.length;a++)for(i=i<<8|e[a],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const a=(8-r.length%8)%8;for(let c=0;c<a;c++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let c=0;const l=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);l.push(h)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const d=(l[0]<<3)+(l[1]>>2);if(s.push(d),c<6){const u=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(u)}if(c<4){const u=((l[3]&255)<<4)+(l[4]>>1);s.push(u)}if(c<3){const u=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(u)}if(c<1){const u=((l[6]&7)<<5)+l[7];s.push(u)}}return Uint8Array.from(s)}};new Sm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new Sm("0123456789ABCDEFGHIJKLMNOPQRSTUV");let zm=class{constructor(e,n){if(Wr(this,"alphabet"),Wr(this,"padding"),Wr(this,"decodeMap",new Map),e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let a=0;a<e.length;a++)for(i=i<<8|e[a],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const a=(4-r.length%4)%4;for(let c=0;c<a;c++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let c=0,l=0;for(let d=0;d<4;d++){const u=e[a*4+d];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);l+=f<<6*(3-d)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}};new zm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");new zm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");const Jv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ff=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Jv[n[t]&63];return e};async function Xv(t,e){const n=t.notBefore||new Date().toISOString(),r=t.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=t.issueInstant||n,s=t.sessionNotOnOrAfter||r,a=t.responseId||`_${ff()}`,c=t.assertionId||`_${ff()}`,l=[{"samlp:Response":[{"saml:Issuer":[{"#text":t.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":t.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":t.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":t.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":t.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":t.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":t.sessionIndex,"@_SessionNotOnOrAfter":s}},{"saml:AttributeStatement":[{"saml:Attribute":[{":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"},"saml:AttributeValue":[{"#text":t.userId,":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":t.email,":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"manage-account",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"default-roles-master",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"offline_access",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"view-profile",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"uma_authorization",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]},{"saml:Attribute":[{":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"},"saml:AttributeValue":[{"#text":"manage-account-links",":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}]}]}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":t.destination,"@_ID":a,"@_InResponseTo":t.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let d=new Wv.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(l);return t.signature&&e&&(d=await e.signSAML(d,t.signature.privateKeyPem,t.signature.cert)),t.encode===!1?d:btoa(d)}let Am=class{constructor(e){this.signUrl=e}async signSAML(e,n,r){const i=await fetch(this.signUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:e,privateKey:n,publicCert:r})});if(!i.ok)throw new Error(`Failed to sign SAML via HTTP: ${i.status} ${i.statusText}`);return await i.text()}};function Zv(t,e,n){const r=n?`<input type="hidden" name="RelayState" value="${n}" />`:"",i=`
|
|
11
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Yn.prototype.build=function(t){return this.options.preserveOrder?Lv(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};Yn.prototype.j2x=function(t,e,n){let r="",i="";const s=n.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(typeof t[a]>"u")this.isAttribute(a)&&(i+="");else if(t[a]===null)this.isAttribute(a)?i+="":a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e);else if(typeof t[a]!="object"){const c=this.isAttribute(a);if(c&&!this.ignoreAttributesFn(c,s))r+=this.buildAttrPairStr(c,""+t[a]);else if(!c)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(l)}else i+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){const c=t[a].length;let l="",d="";for(let u=0;u<c;u++){const f=t[a][u];if(!(typeof f>"u"))if(f===null)a[0]==="?"?i+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const h=this.j2x(f,e+1,n.concat(a));l+=h.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(d+=h.attrStr)}else l+=this.processTextOrObjNode(f,a,e,n);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(a,f);h=this.replaceEntitiesValue(h),l+=h}else l+=this.buildTextValNode(f,a,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,d,e)),i+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const c=Object.keys(t[a]),l=c.length;for(let d=0;d<l;d++)r+=this.buildAttrPairStr(c[d],""+t[a][c[d]])}else i+=this.processTextOrObjNode(t[a],a,e,n);return{attrStr:r,val:i}};Yn.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Mv(t,e,n,r){const i=this.j2x(t,n+1,r.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,n):this.buildObjectNode(i.val,e,i.attrStr,n)}Yn.prototype.buildObjectNode=function(t,e,n,r){if(t==="")return e[0]==="?"?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",i=""),(n||n==="")&&t.indexOf("<")===-1?this.indentate(r)+"<"+e+n+s+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${t}-->`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i}};Yn.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};Yn.prototype.buildTextValNode=function(t,e,n,r){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}};Yn.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};function Fv(t){return this.options.indentBy.repeat(t)}function qv(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}var Hv=Yn;const Vv=bu,Kv=jv,Gv=Hv;var Wv={XMLParser:Kv,XMLValidator:Vv,XMLBuilder:Gv};let Sm=class{constructor(e,n){if(Wr(this,"alphabet"),Wr(this,"padding"),Wr(this,"decodeMap",new Map),e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let a=0;a<e.length;a++)for(i=i<<8|e[a],s+=8;s>=5;)s-=5,r+=this.alphabet[i>>s&31];if(s>0&&(r+=this.alphabet[i<<5-s&31]),(n==null?void 0:n.includePadding)??!0){const a=(8-r.length%8)%8;for(let c=0;c<a;c++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),s=[];for(let a=0;a<i;a++){let c=0;const l=[];for(let u=0;u<8;u++){const f=e[a*8+u];if(f==="="){if(a+1!==i)throw new Error(`Invalid character: ${f}`);c+=1;continue}if(f===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const h=this.decodeMap.get(f)??null;if(h===null)throw new Error(`Invalid character: ${f}`);l.push(h)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const d=(l[0]<<3)+(l[1]>>2);if(s.push(d),c<6){const u=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(u)}if(c<4){const u=((l[3]&255)<<4)+(l[4]>>1);s.push(u)}if(c<3){const u=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(u)}if(c<1){const u=((l[6]&7)<<5)+l[7];s.push(u)}}return Uint8Array.from(s)}};new Sm("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new Sm("0123456789ABCDEFGHIJKLMNOPQRSTUV");let zm=class{constructor(e,n){if(Wr(this,"alphabet"),Wr(this,"padding"),Wr(this,"decodeMap",new Map),e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,s=0;for(let a=0;a<e.length;a++)for(i=i<<8|e[a],s+=8;s>=6;)s+=-6,r+=this.alphabet[i>>s&63];if(s>0&&(r+=this.alphabet[i<<6-s&63]),(n==null?void 0:n.includePadding)??!0){const a=(4-r.length%4)%4;for(let c=0;c<a;c++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),s=[];for(let a=0;a<i;a++){let c=0,l=0;for(let d=0;d<4;d++){const u=e[a*4+d];if(u==="="){if(a+1!==i)throw new Error(`Invalid character: ${u}`);c+=1;continue}if(u===void 0){if(r)throw new Error("Invalid data");c+=1;continue}const f=this.decodeMap.get(u)??null;if(f===null)throw new Error(`Invalid character: ${u}`);l+=f<<6*(3-d)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}};new zm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");new zm("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");const Jv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ff=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Jv[n[t]&63];return e};async function Xv(t,e){const n=t.notBefore||new Date().toISOString(),r=t.notAfter||new Date(new Date(n).getTime()+10*60*1e3).toISOString(),i=t.issueInstant||n,s=t.sessionNotOnOrAfter||r,a=t.responseId||`_${ff()}`,c=t.assertionId||`_${ff()}`,l=[{"samlp:Response":[{"saml:Issuer":[{"#text":t.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":t.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":t.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":t.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":t.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":t.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":t.sessionIndex,"@_SessionNotOnOrAfter":s}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":t.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":t.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":i,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":t.destination,"@_ID":a,"@_InResponseTo":t.inResponseTo,"@_IssueInstant":i,"@_Version":"2.0"}}];let d=new Wv.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(l);return t.signature&&e&&(d=await e.signSAML(d,t.signature.privateKeyPem,t.signature.cert)),t.encode===!1?d:btoa(d)}let Am=class{constructor(e){this.signUrl=e}async signSAML(e,n,r){const i=await fetch(this.signUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:e,privateKey:n,publicCert:r})});if(!i.ok)throw new Error(`Failed to sign SAML via HTTP: ${i.status} ${i.statusText}`);return await i.text()}};function Zv(t,e,n){const r=n?`<input type="hidden" name="RelayState" value="${n}" />`:"",i=`
|
|
12
12
|
<!DOCTYPE html>
|
|
13
13
|
<html>
|
|
14
14
|
<body onload="document.forms[0].submit()">
|
|
@@ -259,7 +259,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
259
259
|
details > summary::-webkit-details-marker {
|
|
260
260
|
display: none;
|
|
261
261
|
}
|
|
262
|
-
`})]})},i0=({error:t,theme:e,branding:n,state:r,user:i,className:s})=>{var z,x,k,I,L,q,F,Z,oe,D,pe,be,ae,de,ze,Ae,Pe,xe,Oe,Re,Ke;const a=((z=e==null?void 0:e.colors)==null?void 0:z.primary_button)||((x=n==null?void 0:n.colors)==null?void 0:x.primary)||"#0066cc",c=((k=e==null?void 0:e.colors)==null?void 0:k.primary_button_label)||"#ffffff",l=((I=e==null?void 0:e.colors)==null?void 0:I.body_text)||"#333333",d=((L=e==null?void 0:e.colors)==null?void 0:L.input_border)||"#d1d5db",u=((q=e==null?void 0:e.colors)==null?void 0:q.widget_background)||"#ffffff",f=((F=e==null?void 0:e.colors)==null?void 0:F.widget_border)||"#e5e7eb",h=((Z=e==null?void 0:e.borders)==null?void 0:Z.widget_corner_radius)||8,m=((oe=e==null?void 0:e.borders)==null?void 0:oe.button_border_radius)||4,y=((D=e==null?void 0:e.borders)==null?void 0:D.show_widget_shadow)??!0,v=((be=(pe=e==null?void 0:e.fonts)==null?void 0:pe.title)==null?void 0:be.size)||24,$=((de=(ae=e==null?void 0:e.fonts)==null?void 0:ae.title)==null?void 0:de.bold)??!0,N=((Ae=(ze=e==null?void 0:e.fonts)==null?void 0:ze.body_text)==null?void 0:Ae.size)||14,O={backgroundColor:u,borderColor:f,borderRadius:`${h}px`,boxShadow:y?"0 1px 3px 0 rgba(0, 0, 0, 0.1)":"none",color:l},U={fontSize:`${v}px`,fontWeight:$?"700":"400",color:((Pe=e==null?void 0:e.colors)==null?void 0:Pe.header)||l},T={fontSize:`${N}px`,color:((xe=e==null?void 0:e.colors)==null?void 0:xe.input_labels_placeholders)||"#6b7280"},R={backgroundColor:a,color:c,borderRadius:`${m}px`},W={backgroundColor:"transparent",color:l,borderColor:d,borderRadius:`${m}px`},te={color:((Oe=e==null?void 0:e.colors)==null?void 0:Oe.links_focused_components)||a,fontSize:`${N}px`},Q={borderColor:d,borderRadius:`${m}px`,fontSize:`${N}px`,color:l},K=((Re=e==null?void 0:e.widget)==null?void 0:Re.logo_position)||"center",le=K==="left"?"text-left":K==="right"?"text-right":"text-center",C=((Ke=e==null?void 0:e.widget)==null?void 0:Ke.logo_url)||(n==null?void 0:n.logo_url),E=K!=="none"&&C;return p("div",{className:he("flex flex-col gap-6 w-full max-w-sm",s),children:p(mn,{style:O,className:"border",children:[p(_n,{children:[E&&p("div",{className:he("mb-4",le),children:p(nn,{theme:e,branding:n})}),p(yn,{style:U,children:w.t("impersonation","Impersonation")}),p(wn,{style:T,children:w.t("impersonation_description","You have permission to impersonate other users.")})]}),p(vn,{children:p("div",{className:"space-y-4",children:[p("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[p("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[w.t("current_user","Current user"),":"]}),p("p",{className:"font-semibold",style:{fontSize:`${N}px`},children:i.email})]}),p("form",{method:"post",action:`/u/impersonate/continue?state=${encodeURIComponent(r)}`,children:p(pn,{type:"submit",className:"w-full transition-colors hover:brightness-90",style:R,children:w.t("continue","Continue")})}),p("div",{className:"relative",children:[p("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:p("div",{className:"w-full border-t",style:{borderColor:f}})}),p("div",{className:"relative flex justify-center text-xs uppercase",children:p("span",{className:"px-2",style:{backgroundColor:u,...T},children:w.t("or","Or")})})]}),p("details",{className:"group",children:[p("summary",{className:"cursor-pointer select-none flex items-center justify-between p-3 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",style:te,children:[p("span",{className:"font-medium",children:w.t("advanced_options","Advanced Options")}),p("svg",{className:"w-5 h-5 transition-transform group-open:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]}),p("div",{className:"mt-3 p-4 border rounded-md",style:{borderColor:f},children:p("form",{method:"post",action:`/u/impersonate/switch?state=${encodeURIComponent(r)}`,children:p("div",{className:"space-y-4",children:[p("div",{className:"space-y-2",children:[p(Bt,{htmlFor:"user_id",style:T,children:w.t("user_id_to_impersonate","User ID to Impersonate")}),p(Yt,{type:"text",id:"user_id",name:"user_id",placeholder:w.t("enter_user_id","Enter user ID"),required:!0,style:Q,className:"w-full"}),t&&p(Qe,{children:t})]}),p(pn,{type:"submit",variant:"outline",className:"w-full transition-colors border",style:W,children:w.t("impersonate_user","Impersonate User")})]})})})]})]})}),p(S1,{children:p("a",{href:`/u/login/identifier?state=${encodeURIComponent(r)}`,className:"text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors w-full text-center",style:te,children:w.t("go_back","Go back")})})]})})},P8=new o.OpenAPIHono().openapi(o.createRoute({tags:["impersonation"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Impersonation page"},400:{description:"Bad Request"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:s,useShadcn:a}=await Ee(t,e,!0);if(!s.session_id)throw new b(400,{message:"No session linked to login session"});const c=await t.env.data.sessions.get(i.tenant.id,s.session_id);if(!c)throw new b(400,{message:"Session not found"});const l=await t.env.data.users.get(i.tenant.id,c.user_id);if(!l)throw new b(400,{message:"User not found"});return(await t.env.data.userPermissions.list(i.tenant.id,l.user_id)).some(f=>f.permission_name==="users:impersonate")?a?t.html(p(je,{title:w.t("impersonation","Impersonation"),theme:n,branding:r,client:i,children:p(i0,{theme:n,branding:r,client:i,user:l,state:e})})):t.html(p(r0,{theme:n,branding:r,client:i,user:l,state:e})):t.html(p(Ut,{theme:n,branding:r,client:i,state:e,pageTitle:"Access Denied",message:"You do not have permission to impersonate other users."}),403)}).openapi(o.createRoute({tags:["impersonation"],method:"post",path:"/continue",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow",headers:o.z.object({Location:o.z.string().url()})}}}),async t=>{const{state:e}=t.req.valid("query"),{client:n,loginSession:r}=await Ee(t,e,!0);if(!r.session_id)throw new b(400,{message:"No session linked to login session"});const i=await t.env.data.sessions.get(n.tenant.id,r.session_id);if(!i)throw new b(400,{message:"Session not found"});const s=await t.env.data.users.get(n.tenant.id,i.user_id);if(!s)throw new b(400,{message:"User not found"});if(!(await t.env.data.userPermissions.list(n.tenant.id,s.user_id)).some(l=>l.permission_name==="users:impersonate"))throw new b(403,{message:"Access denied: insufficient permissions"});return dn(t,{client:n,authParams:r.authParams,loginSession:r,user:s,sessionId:i.id,skipHooks:!0})}).openapi(o.createRoute({tags:["impersonation"],method:"post",path:"/switch",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({user_id:o.z.string().min(1,"User ID is required")})}}}},responses:{302:{description:"Redirect to continue authentication flow as impersonated user",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request - User not found or impersonation failed"}}}),async t=>{const{state:e}=t.req.valid("query"),{user_id:n}=t.req.valid("form"),{theme:r,branding:i,client:s,loginSession:a,useShadcn:c}=await Ee(t,e,!0);if(!a.session_id)throw new b(400,{message:"No session linked to login session"});const l=await t.env.data.sessions.get(s.tenant.id,a.session_id);if(!l)throw new b(400,{message:"Current session not found"});const d=await t.env.data.users.get(s.tenant.id,l.user_id);if(!d)throw new b(400,{message:"Current user not found"});if(!(await t.env.data.userPermissions.list(s.tenant.id,d.user_id)).some(y=>y.permission_name==="users:impersonate"))return t.html(p(Ut,{theme:r,branding:i,client:s,state:e,pageTitle:"Access Denied",message:"You do not have permission to impersonate other users."}),403);const h=await t.env.data.users.get(s.tenant.id,n);if(!h)return c?t.html(p(je,{title:w.t("impersonation","Impersonation"),theme:r,branding:i,client:s,children:p(i0,{theme:r,branding:i,client:s,user:d,state:e,error:`User with ID "${n}" not found.`})}),400):t.html(p(r0,{theme:r,branding:i,client:s,user:d,state:e,error:`User with ID "${n}" not found.`}),400);await t.env.data.sessions.update(s.tenant.id,l.id,{user_id:h.user_id});const m=ve(t,{type:me.SUCCESS_LOGIN,description:`${h.email||h.user_id} (impersonated by ${d.email||d.user_id})`,userId:h.user_id,connection:h.connection,strategy:h.connection,strategy_type:h.is_social?"social":"database"});return we(t,t.env.data.logs.create(s.tenant.id,m)),dn(t,{client:s,authParams:{...a.authParams,response_type:Nt.TOKEN_ID_TOKEN,response_mode:Gt.QUERY},loginSession:a,user:h,sessionId:l.id,skipHooks:!0,impersonatingUser:d})});function R8(t){const e=new o.OpenAPIHono,n=t.dataAdapter.cache||qo({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),r=t.dataAdapter.cache?300:0;e.onError((s,a)=>s instanceof Cr?a.redirect(s.location,s.status):s instanceof b?a.text(s.message||"Error",s.status):a.text("Unexpected error",500)),e.get("/css/tailwind.css",async s=>{const a=Dp;return s.text(a,200,{"content-type":"text/css; charset=utf-8"})}),e.get("/js/client.js",async s=>s.text(N8,200,{"content-type":"application/javascript; charset=utf-8"})),e.use(async(s,a)=>{const c=ko(s,t.dataAdapter),l=Lc(c,{defaultTtl:r,cacheEntities:["tenants","connections","clients","legacyClients","customDomains","resourceServers","roles","organizations","userRoles","userPermissions","branding","themes","promptSettings","forms"],cache:n});return s.env.data=Tc(s,l),a()}).use(Bc).use(Rc);const i=e.route("/info",x8).route("/check-account",g8).route("/account",y8).route("/account/change-email",w8).route("/account/change-email-verify",v8).route("/account/change-email-confirmation",b8).route("/login/identifier",jx).route("/enter-code",i8).route("/enter-password",l8).route("/invalid-session",k8).route("/pre-signup",$8).route("/pre-signup-sent",A8).route("/reset-password",u8).route("/forgot-password",f8).route("/validate-email",z8).route("/signup",d8).route("/impersonate",P8).route("/forms",T8);return i.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),i}var B8=Object.defineProperty,L8=(t,e,n)=>e in t?B8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qr=(t,e,n)=>L8(t,typeof e!="symbol"?e+"":e,n);const ut=o.z.object({"#text":o.z.string()}),U8=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()}),D8=o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":U8,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(ut)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(ut)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const M8=o.z.object({":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string().optional()}),"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string(),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string()}).optional()}))}),F8=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o0=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(F8)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:DigestValue":o.z.array(ut)})])),":@":o.z.object({"@_URI":o.z.string().optional()}).optional()})]))}),o.z.object({"ds:SignatureValue":o.z.array(ut)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.union([o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(ut)}),o.z.object({"ds:Exponent":o.z.array(ut)})]))}))}),o.z.object({"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(ut)}))}),o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(ut)}),o.z.object({"ds:Exponent":o.z.array(ut)})]))})),"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(ut)}))})]))})])),":@":o.z.object({"@_xmlns:ds":o.z.string().optional()}).optional()});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(ut)}),o0,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(ut),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(ut)}),o0,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(ut),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(ut)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(ut)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(o.z.object({"saml:Attribute":o.z.array(M8)}))})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var Mp={},Hc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),s=function(c,l){const d=[];let u=l.exec(c);for(;u;){const f=[];f.startIndex=l.lastIndex-u[0].length;const h=u.length;for(let m=0;m<h;m++)f.push(u[m]);d.push(f),u=l.exec(c)}return d},a=function(c){const l=i.exec(c);return!(l===null||typeof l>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,l,d){if(l){const u=Object.keys(l),f=u.length;for(let h=0;h<f;h++)d==="strict"?c[u[h]]=[l[u[h]]]:c[u[h]]=l[u[h]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Hc);const Fp=Hc,q8={allowBooleanAttributes:!1,unpairedTags:[]};Mp.validate=function(t,e){e=Object.assign({},q8,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=a0(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=c0(t,s);continue}else{let c=!1;t[s]==="/"&&(c=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
|
|
262
|
+
`})]})},i0=({error:t,theme:e,branding:n,state:r,user:i,className:s})=>{var z,x,k,I,L,q,F,Z,oe,D,pe,be,ae,de,ze,Ae,Pe,xe,Oe,Re,Ke;const a=((z=e==null?void 0:e.colors)==null?void 0:z.primary_button)||((x=n==null?void 0:n.colors)==null?void 0:x.primary)||"#0066cc",c=((k=e==null?void 0:e.colors)==null?void 0:k.primary_button_label)||"#ffffff",l=((I=e==null?void 0:e.colors)==null?void 0:I.body_text)||"#333333",d=((L=e==null?void 0:e.colors)==null?void 0:L.input_border)||"#d1d5db",u=((q=e==null?void 0:e.colors)==null?void 0:q.widget_background)||"#ffffff",f=((F=e==null?void 0:e.colors)==null?void 0:F.widget_border)||"#e5e7eb",h=((Z=e==null?void 0:e.borders)==null?void 0:Z.widget_corner_radius)||8,m=((oe=e==null?void 0:e.borders)==null?void 0:oe.button_border_radius)||4,y=((D=e==null?void 0:e.borders)==null?void 0:D.show_widget_shadow)??!0,v=((be=(pe=e==null?void 0:e.fonts)==null?void 0:pe.title)==null?void 0:be.size)||24,$=((de=(ae=e==null?void 0:e.fonts)==null?void 0:ae.title)==null?void 0:de.bold)??!0,N=((Ae=(ze=e==null?void 0:e.fonts)==null?void 0:ze.body_text)==null?void 0:Ae.size)||14,O={backgroundColor:u,borderColor:f,borderRadius:`${h}px`,boxShadow:y?"0 1px 3px 0 rgba(0, 0, 0, 0.1)":"none",color:l},U={fontSize:`${v}px`,fontWeight:$?"700":"400",color:((Pe=e==null?void 0:e.colors)==null?void 0:Pe.header)||l},T={fontSize:`${N}px`,color:((xe=e==null?void 0:e.colors)==null?void 0:xe.input_labels_placeholders)||"#6b7280"},R={backgroundColor:a,color:c,borderRadius:`${m}px`},W={backgroundColor:"transparent",color:l,borderColor:d,borderRadius:`${m}px`},te={color:((Oe=e==null?void 0:e.colors)==null?void 0:Oe.links_focused_components)||a,fontSize:`${N}px`},Q={borderColor:d,borderRadius:`${m}px`,fontSize:`${N}px`,color:l},K=((Re=e==null?void 0:e.widget)==null?void 0:Re.logo_position)||"center",le=K==="left"?"text-left":K==="right"?"text-right":"text-center",C=((Ke=e==null?void 0:e.widget)==null?void 0:Ke.logo_url)||(n==null?void 0:n.logo_url),E=K!=="none"&&C;return p("div",{className:he("flex flex-col gap-6 w-full max-w-sm",s),children:p(mn,{style:O,className:"border",children:[p(_n,{children:[E&&p("div",{className:he("mb-4",le),children:p(nn,{theme:e,branding:n})}),p(yn,{style:U,children:w.t("impersonation","Impersonation")}),p(wn,{style:T,children:w.t("impersonation_description","You have permission to impersonate other users.")})]}),p(vn,{children:p("div",{className:"space-y-4",children:[p("div",{className:"p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[p("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[w.t("current_user","Current user"),":"]}),p("p",{className:"font-semibold",style:{fontSize:`${N}px`},children:i.email})]}),p("form",{method:"post",action:`/u/impersonate/continue?state=${encodeURIComponent(r)}`,children:p(pn,{type:"submit",className:"w-full transition-colors hover:brightness-90",style:R,children:w.t("continue","Continue")})}),p("div",{className:"relative",children:[p("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:p("div",{className:"w-full border-t",style:{borderColor:f}})}),p("div",{className:"relative flex justify-center text-xs uppercase",children:p("span",{className:"px-2",style:{backgroundColor:u,...T},children:w.t("or","Or")})})]}),p("details",{className:"group",children:[p("summary",{className:"cursor-pointer select-none flex items-center justify-between p-3 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",style:te,children:[p("span",{className:"font-medium",children:w.t("advanced_options","Advanced Options")}),p("svg",{className:"w-5 h-5 transition-transform group-open:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]}),p("div",{className:"mt-3 p-4 border rounded-md",style:{borderColor:f},children:p("form",{method:"post",action:`/u/impersonate/switch?state=${encodeURIComponent(r)}`,children:p("div",{className:"space-y-4",children:[p("div",{className:"space-y-2",children:[p(Bt,{htmlFor:"user_id",style:T,children:w.t("user_id_to_impersonate","User ID to Impersonate")}),p(Yt,{type:"text",id:"user_id",name:"user_id",placeholder:w.t("enter_user_id","Enter user ID"),required:!0,style:Q,className:"w-full"}),t&&p(Qe,{children:t})]}),p(pn,{type:"submit",variant:"outline",className:"w-full transition-colors border",style:W,children:w.t("impersonate_user","Impersonate User")})]})})})]})]})}),p(S1,{children:p("a",{href:`/u/login/identifier?state=${encodeURIComponent(r)}`,className:"text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors w-full text-center",style:te,children:w.t("go_back","Go back")})})]})})},P8=new o.OpenAPIHono().openapi(o.createRoute({tags:["impersonation"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Impersonation page"},400:{description:"Bad Request"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:s,useShadcn:a}=await Ee(t,e,!0);if(!s.session_id)throw new b(400,{message:"No session linked to login session"});const c=await t.env.data.sessions.get(i.tenant.id,s.session_id);if(!c)throw new b(400,{message:"Session not found"});const l=await t.env.data.users.get(i.tenant.id,c.user_id);if(!l)throw new b(400,{message:"User not found"});return(await t.env.data.userPermissions.list(i.tenant.id,l.user_id)).some(f=>f.permission_name==="users:impersonate")?a?t.html(p(je,{title:w.t("impersonation","Impersonation"),theme:n,branding:r,client:i,children:p(i0,{theme:n,branding:r,client:i,user:l,state:e})})):t.html(p(r0,{theme:n,branding:r,client:i,user:l,state:e})):t.html(p(Ut,{theme:n,branding:r,client:i,state:e,pageTitle:"Access Denied",message:"You do not have permission to impersonate other users."}),403)}).openapi(o.createRoute({tags:["impersonation"],method:"post",path:"/continue",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow",headers:o.z.object({Location:o.z.string().url()})}}}),async t=>{const{state:e}=t.req.valid("query"),{client:n,loginSession:r}=await Ee(t,e,!0);if(!r.session_id)throw new b(400,{message:"No session linked to login session"});const i=await t.env.data.sessions.get(n.tenant.id,r.session_id);if(!i)throw new b(400,{message:"Session not found"});const s=await t.env.data.users.get(n.tenant.id,i.user_id);if(!s)throw new b(400,{message:"User not found"});if(!(await t.env.data.userPermissions.list(n.tenant.id,s.user_id)).some(l=>l.permission_name==="users:impersonate"))throw new b(403,{message:"Access denied: insufficient permissions"});return dn(t,{client:n,authParams:r.authParams,loginSession:r,user:s,sessionId:i.id,skipHooks:!0})}).openapi(o.createRoute({tags:["impersonation"],method:"post",path:"/switch",request:{query:o.z.object({state:o.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({user_id:o.z.string().min(1,"User ID is required")})}}}},responses:{302:{description:"Redirect to continue authentication flow as impersonated user",headers:o.z.object({Location:o.z.string().url()})},400:{description:"Bad Request - User not found or impersonation failed"}}}),async t=>{const{state:e}=t.req.valid("query"),{user_id:n}=t.req.valid("form"),{theme:r,branding:i,client:s,loginSession:a,useShadcn:c}=await Ee(t,e,!0);if(!a.session_id)throw new b(400,{message:"No session linked to login session"});const l=await t.env.data.sessions.get(s.tenant.id,a.session_id);if(!l)throw new b(400,{message:"Current session not found"});const d=await t.env.data.users.get(s.tenant.id,l.user_id);if(!d)throw new b(400,{message:"Current user not found"});if(!(await t.env.data.userPermissions.list(s.tenant.id,d.user_id)).some(y=>y.permission_name==="users:impersonate"))return t.html(p(Ut,{theme:r,branding:i,client:s,state:e,pageTitle:"Access Denied",message:"You do not have permission to impersonate other users."}),403);const h=await t.env.data.users.get(s.tenant.id,n);if(!h)return c?t.html(p(je,{title:w.t("impersonation","Impersonation"),theme:r,branding:i,client:s,children:p(i0,{theme:r,branding:i,client:s,user:d,state:e,error:`User with ID "${n}" not found.`})}),400):t.html(p(r0,{theme:r,branding:i,client:s,user:d,state:e,error:`User with ID "${n}" not found.`}),400);await t.env.data.sessions.update(s.tenant.id,l.id,{user_id:h.user_id});const m=ve(t,{type:me.SUCCESS_LOGIN,description:`${h.email||h.user_id} (impersonated by ${d.email||d.user_id})`,userId:h.user_id,connection:h.connection,strategy:h.connection,strategy_type:h.is_social?"social":"database"});return we(t,t.env.data.logs.create(s.tenant.id,m)),dn(t,{client:s,authParams:{...a.authParams,response_type:Nt.TOKEN_ID_TOKEN,response_mode:Gt.QUERY},loginSession:a,user:h,sessionId:l.id,skipHooks:!0,impersonatingUser:d})});function R8(t){const e=new o.OpenAPIHono,n=t.dataAdapter.cache||qo({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),r=t.dataAdapter.cache?300:0;e.onError((s,a)=>s instanceof Cr?a.redirect(s.location,s.status):s instanceof b?a.text(s.message||"Error",s.status):a.text("Unexpected error",500)),e.get("/css/tailwind.css",async s=>{const a=Dp;return s.text(a,200,{"content-type":"text/css; charset=utf-8"})}),e.get("/js/client.js",async s=>s.text(N8,200,{"content-type":"application/javascript; charset=utf-8"})),e.use(async(s,a)=>{const c=ko(s,t.dataAdapter),l=Lc(c,{defaultTtl:r,cacheEntities:["tenants","connections","clients","legacyClients","customDomains","resourceServers","roles","organizations","userRoles","userPermissions","branding","themes","promptSettings","forms"],cache:n});return s.env.data=Tc(s,l),a()}).use(Bc).use(Rc);const i=e.route("/info",x8).route("/check-account",g8).route("/account",y8).route("/account/change-email",w8).route("/account/change-email-verify",v8).route("/account/change-email-confirmation",b8).route("/login/identifier",jx).route("/enter-code",i8).route("/enter-password",l8).route("/invalid-session",k8).route("/pre-signup",$8).route("/pre-signup-sent",A8).route("/reset-password",u8).route("/forgot-password",f8).route("/validate-email",z8).route("/signup",d8).route("/impersonate",P8).route("/forms",T8);return i.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),i}var B8=Object.defineProperty,L8=(t,e,n)=>e in t?B8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qr=(t,e,n)=>L8(t,typeof e!="symbol"?e+"":e,n);const ut=o.z.object({"#text":o.z.string()}),U8=o.z.object({"#text":o.z.string(),"@_xmlns:saml":o.z.string().optional()}),D8=o.z.object({"samlp:AuthnRequest":o.z.object({"saml:Issuer":U8,"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string().optional(),"@_ForceAuthn":o.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string().datetime(),"@_Destination":o.z.string().url(),"@_AssertionConsumerServiceURL":o.z.string().url().optional(),"@_ProtocolBinding":o.z.string().optional(),"@_Version":o.z.string()})});o.z.array(o.z.object({":@":o.z.object({"@_xmlns":o.z.string(),"@_entityID":o.z.string()}),EntityDescriptor:o.z.array(o.z.object({":@":o.z.object({"@_protocolSupportEnumeration":o.z.string()}),IDPSSODescriptor:o.z.array(o.z.union([o.z.object({KeyDescriptor:o.z.array(o.z.object({KeyInfo:o.z.array(o.z.object({X509Data:o.z.array(o.z.object({X509Certificate:o.z.array(ut)}))})),":@":o.z.object({"@_xmlns":o.z.string()})})),":@":o.z.object({"@_use":o.z.string()})}),o.z.object({SingleLogoutService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({NameIDFormat:o.z.array(ut)}),o.z.object({SingleSignOnService:o.z.array(o.z.object({})),":@":o.z.object({"@_Binding":o.z.string(),"@_Location":o.z.string()})}),o.z.object({Attribute:o.z.array(o.z.object({})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string(),"@_xmlns":o.z.string()})})]))}))}));const M8=o.z.object({"saml:Attribute":o.z.array(o.z.object({"saml:AttributeValue":o.z.array(o.z.object({"#text":o.z.string()})),":@":o.z.object({"@_xmlns:xs":o.z.string().optional(),"@_xmlns:xsi":o.z.string(),"@_xsi:type":o.z.string()}).optional()})),":@":o.z.object({"@_Name":o.z.string(),"@_NameFormat":o.z.string(),"@_FriendlyName":o.z.string().optional()})}),F8=o.z.object({"ds:Transform":o.z.array(o.z.any()),":@":o.z.object({"@_Algorithm":o.z.string()})}),o0=o.z.object({"ds:Signature":o.z.array(o.z.union([o.z.object({"ds:SignedInfo":o.z.array(o.z.union([o.z.object({"ds:CanonicalizationMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:SignatureMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:Reference":o.z.array(o.z.union([o.z.object({"ds:Transforms":o.z.array(F8)}),o.z.object({"ds:DigestMethod":o.z.array(o.z.object({":@":o.z.object({"@_Algorithm":o.z.string()})}))}),o.z.object({"ds:DigestValue":o.z.array(ut)})])),":@":o.z.object({"@_URI":o.z.string().optional()}).optional()})]))}),o.z.object({"ds:SignatureValue":o.z.array(ut)}),o.z.object({"ds:KeyInfo":o.z.array(o.z.union([o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(ut)}),o.z.object({"ds:Exponent":o.z.array(ut)})]))}))}),o.z.object({"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(ut)}))}),o.z.object({"ds:KeyValue":o.z.array(o.z.object({"ds:RSAKeyValue":o.z.array(o.z.union([o.z.object({"ds:Modulus":o.z.array(ut)}),o.z.object({"ds:Exponent":o.z.array(ut)})]))})),"ds:X509Data":o.z.array(o.z.object({"ds:X509Certificate":o.z.array(ut)}))})]))})])),":@":o.z.object({"@_xmlns:ds":o.z.string().optional()}).optional()});o.z.array(o.z.object({"samlp:Response":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(ut)}),o0,o.z.object({"samlp:Status":o.z.array(o.z.object({"samlp:StatusCode":o.z.array(ut),":@":o.z.object({"@_Value":o.z.string()})}))}),o.z.object({"saml:Assertion":o.z.array(o.z.union([o.z.object({"saml:Issuer":o.z.array(ut)}),o0,o.z.object({"saml:Subject":o.z.array(o.z.union([o.z.object({"saml:NameID":o.z.array(ut),":@":o.z.object({"@_Format":o.z.string()})}),o.z.object({"saml:SubjectConfirmation":o.z.array(o.z.object({"saml:SubjectConfirmationData":o.z.array(o.z.any()),":@":o.z.object({"@_InResponseTo":o.z.string(),"@_NotOnOrAfter":o.z.string(),"@_Recipient":o.z.string()})})),":@":o.z.object({"@_Method":o.z.string()})})]))}),o.z.object({"saml:Conditions":o.z.array(o.z.object({"saml:AudienceRestriction":o.z.array(o.z.object({"saml:Audience":o.z.array(ut)}))})),":@":o.z.object({"@_NotBefore":o.z.string(),"@_NotOnOrAfter":o.z.string()})}),o.z.object({"saml:AuthnStatement":o.z.array(o.z.object({"saml:AuthnContext":o.z.array(o.z.object({"saml:AuthnContextClassRef":o.z.array(ut)}))})),":@":o.z.object({"@_AuthnInstant":o.z.string(),"@_SessionIndex":o.z.string(),"@_SessionNotOnOrAfter":o.z.string()})}),o.z.object({"saml:AttributeStatement":o.z.array(M8)})])),":@":o.z.object({"@_xmlns":o.z.string(),"@_ID":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})})])),":@":o.z.object({"@_xmlns:samlp":o.z.string(),"@_xmlns:saml":o.z.string(),"@_Destination":o.z.string(),"@_ID":o.z.string(),"@_InResponseTo":o.z.string(),"@_IssueInstant":o.z.string(),"@_Version":o.z.string()})}));var Mp={},Hc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),s=function(c,l){const d=[];let u=l.exec(c);for(;u;){const f=[];f.startIndex=l.lastIndex-u[0].length;const h=u.length;for(let m=0;m<h;m++)f.push(u[m]);d.push(f),u=l.exec(c)}return d},a=function(c){const l=i.exec(c);return!(l===null||typeof l>"u")};t.isExist=function(c){return typeof c<"u"},t.isEmptyObject=function(c){return Object.keys(c).length===0},t.merge=function(c,l,d){if(l){const u=Object.keys(l),f=u.length;for(let h=0;h<f;h++)d==="strict"?c[u[h]]=[l[u[h]]]:c[u[h]]=l[u[h]]}},t.getValue=function(c){return t.isExist(c)?c:""},t.isName=a,t.getAllMatches=s,t.nameRegexp=r})(Hc);const Fp=Hc,q8={allowBooleanAttributes:!1,unpairedTags:[]};Mp.validate=function(t,e){e=Object.assign({},q8,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s<t.length;s++)if(t[s]==="<"&&t[s+1]==="?"){if(s+=2,s=a0(t,s),s.err)return s}else if(t[s]==="<"){let a=s;if(s++,t[s]==="!"){s=c0(t,s);continue}else{let c=!1;t[s]==="/"&&(c=!0,s++);let l="";for(;s<t.length&&t[s]!==">"&&t[s]!==" "&&t[s]!==" "&&t[s]!==`
|
|
263
263
|
`&&t[s]!=="\r";s++)l+=t[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!Z8(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Fe("InvalidTag",f,gt(t,s))}const d=K8(t,s);if(d===!1)return Fe("InvalidAttr","Attributes for '"+l+"' have open quote.",gt(t,s));let u=d.value;if(s=d.index,u[u.length-1]==="/"){const f=s-u.length;u=u.substring(0,u.length-1);const h=l0(u,e);if(h===!0)r=!0;else return Fe(h.err.code,h.err.msg,gt(t,f+h.err.line))}else if(c)if(d.tagClosed){if(u.trim().length>0)return Fe("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",gt(t,a));if(n.length===0)return Fe("InvalidTag","Closing tag '"+l+"' has not been opened.",gt(t,a));{const f=n.pop();if(l!==f.tagName){let h=gt(t,f.tagStartPos);return Fe("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+l+"'.",gt(t,a))}n.length==0&&(i=!0)}}else return Fe("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",gt(t,s));else{const f=l0(u,e);if(f!==!0)return Fe(f.err.code,f.err.msg,gt(t,s-u.length+f.err.line));if(i===!0)return Fe("InvalidXml","Multiple possible root nodes found.",gt(t,s));e.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="!"){s++,s=c0(t,s);continue}else if(t[s+1]==="?"){if(s=a0(t,++s),s.err)return s}else break;else if(t[s]==="&"){const f=J8(t,s);if(f==-1)return Fe("InvalidChar","char '&' is not expected.",gt(t,s));s=f}else if(i===!0&&!s0(t[s]))return Fe("InvalidXml","Extra text at the end",gt(t,s));t[s]==="<"&&s--}}else{if(s0(t[s]))continue;return Fe("InvalidChar","char '"+t[s]+"' is not expected.",gt(t,s))}if(r){if(n.length==1)return Fe("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",gt(t,n[0].tagStartPos));if(n.length>0)return Fe("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Fe("InvalidXml","Start tag expected.",1);return!0};function s0(t){return t===" "||t===" "||t===`
|
|
264
264
|
`||t==="\r"}function a0(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return Fe("InvalidXml","XML declaration allowed only at the start of the document.",gt(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function c0(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const H8='"',V8="'";function K8(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===H8||t[e]===V8)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const G8=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function l0(t,e){const n=Fp.getAllMatches(t,G8),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Fe("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",Fi(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Fe("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",Fi(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Fe("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",Fi(n[i]));const s=n[i][2];if(!X8(s))return Fe("InvalidAttr","Attribute '"+s+"' is an invalid name.",Fi(n[i]));if(!r.hasOwnProperty(s))r[s]=1;else return Fe("InvalidAttr","Attribute '"+s+"' is repeated.",Fi(n[i]))}return!0}function W8(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function J8(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,W8(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function Fe(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function X8(t){return Fp.isName(t)}function Z8(t){return Fp.isName(t)}function gt(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Fi(t){return t.startIndex+t[1].length}var qp={};const V1={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}},Y8=function(t){return Object.assign({},V1,t)};qp.buildOptions=Y8;qp.defaultOptions=V1;class Q8{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var eS=Q8;const tS=Hc;function nS(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,s=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!s){if(i&&oS(t,e)){e+=7;let c,l;[c,l,e]=rS(t,e+1),l.indexOf("&")===-1&&(n[lS(c)]={regx:RegExp(`&${c};`,"g"),val:l})}else if(i&&sS(t,e))e+=8;else if(i&&aS(t,e))e+=8;else if(i&&cS(t,e))e+=9;else if(iS)s=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:e}}function rS(t,e){let n="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)n+=t[e];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function iS(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function oS(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function sS(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function aS(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function cS(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function lS(t){if(tS.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var dS=nS;const uS=/^[-+]?0x[a-fA-F0-9]+$/,pS=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const fS={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function hS(t,e={}){if(e=Object.assign({},fS,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(e.hex&&uS.test(n))return Number.parseInt(n,16);{const r=pS.exec(n);if(r){const i=r[1],s=r[2];let a=gS(r[3]);const c=r[4]||r[6];if(!e.leadingZeros&&s.length>0&&i&&n[2]!=="."||!e.leadingZeros&&s.length>0&&!i&&n[1]!==".")return t;{const l=Number(n),d=""+l;return d.search(/[eE]/)!==-1||c?e.eNotation?l:t:n.indexOf(".")!==-1?d==="0"&&a===""||d===a||i&&d==="-"+a?l:t:s?a===d||i+a===d?l:t:n===d||n===i+d?l:t}}else return t}}function gS(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var mS=hS;function _S(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}var K1=_S;const G1=Hc,qi=eS,yS=dS,wS=mS,vS=K1;let bS=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=$S,this.parseXml=AS,this.parseTextData=kS,this.resolveNameSpace=xS,this.buildAttributesMap=zS,this.isItStopNode=IS,this.replaceEntitiesValue=NS,this.readStopNodeData=OS,this.saveTextToParentTag=CS,this.addChild=ES,this.ignoreAttributesFn=vS(this.options.ignoreAttributes)}};function $S(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function kS(t,e,n,r,i,s,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const c=this.options.tagValueProcessor(e,t,n,i,s);return c==null?t:typeof c!=typeof t||c!==t?c:this.options.trimValues?pu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?pu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function xS(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const SS=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function zS(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=G1.getAllMatches(t,SS),i=r.length,s={};for(let a=0;a<i;a++){const c=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(c,e))continue;let l=r[a][4],d=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const u=this.options.attributeValueProcessor(c,l,e);u==null?s[d]=l:typeof u!=typeof l||u!==l?s[d]=u:s[d]=pu(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[d]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const AS=function(t){t=t.replace(/\r\n?/g,`
|
|
265
265
|
`);const e=new qi("!xml");let n=e,r="",i="";for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const a=ur(t,">",s,"Closing Tag is not closed.");let c=t.substring(s+2,a).trim();if(this.options.removeNSPrefix){const u=c.indexOf(":");u!==-1&&(c=c.substr(u+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,i));const l=i.substring(i.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let d=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(d=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=i.lastIndexOf("."),i=i.substring(0,d),n=this.tagsNodeStack.pop(),r="",s=a}else if(t[s+1]==="?"){let a=uu(t,s,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new qi(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,i,a.tagName)),this.addChild(n,c,i)}s=a.closeIndex+1}else if(t.substr(s+1,3)==="!--"){const a=ur(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const c=t.substring(s+4,a-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}s=a}else if(t.substr(s+1,2)==="!D"){const a=yS(t,s);this.docTypeEntities=a.entities,s=a.i}else if(t.substr(s+1,2)==="!["){const a=ur(t,"]]>",s,"CDATA is not closed.")-2,c=t.substring(s+9,a);r=this.saveTextToParentTag(r,n,i);let l=this.parseTextData(c,n.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,l),s=a+2}else{let a=uu(t,s,this.options.removeNSPrefix),c=a.tagName;const l=a.rawTagName;let d=a.tagExp,u=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const h=n;if(h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),c!==e.tagname&&(i+=i?"."+c:c),this.isItStopNode(this.options.stopNodes,i,c)){let m="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),d=c):d=d.substr(0,d.length-1),s=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)s=a.closeIndex;else{const v=this.readStopNodeData(t,l,f+1);if(!v)throw new Error(`Unexpected end of ${l}`);s=v.i,m=v.tagContent}const y=new qi(c);c!==d&&u&&(y[":@"]=this.buildAttributesMap(d,i,c)),m&&(m=this.parseTextData(m,c,i,!0,u,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),y.add(this.options.textNodeName,m),this.addChild(n,y,i)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),i=i.substr(0,i.length-1),d=c):d=d.substr(0,d.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const m=new qi(c);c!==d&&u&&(m[":@"]=this.buildAttributesMap(d,i,c)),this.addChild(n,m,i),i=i.substr(0,i.lastIndexOf("."))}else{const m=new qi(c);this.tagsNodeStack.push(n),c!==d&&u&&(m[":@"]=this.buildAttributesMap(d,i,c)),this.addChild(n,m,i),n=m}r="",s=f}}else r+=t[s];return e.child};function ES(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const NS=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function CS(t,e,n,r){return t&&(r===void 0&&(r=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function IS(t,e,n){const r="*."+n;for(const i in t){const s=t[i];if(r===s||e===s)return!0}return!1}function jS(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let a=t[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(t[s+1]===n[1])return{data:i,index:s}}else return{data:i,index:s};else a===" "&&(a=" ");i+=a}}function ur(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function uu(t,e,n,r=">"){const i=jS(t,e+1,r);if(!i)return;let s=i.data;const a=i.index,c=s.search(/\s/);let l=s,d=!0;c!==-1&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());const u=l;if(n){const f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),d=l!==i.data.substr(f+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:d,rawTagName:u}}function OS(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const s=ur(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:s};n=s}else if(t[n+1]==="?")n=ur(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=ur(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=ur(t,"]]>",n,"StopNode is not closed.")-2;else{const s=uu(t,n,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,n=s.closeIndex)}}function pu(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:wS(t,n)}else return G1.isExist(t)?t:""}var TS=bS,W1={};function PS(t,e){return J1(t,e)}function J1(t,e,n){let r;const i={};for(let s=0;s<t.length;s++){const a=t[s],c=RS(a);let l="";if(n===void 0?l=c:l=n+"."+c,c===e.textNodeName)r===void 0?r=a[c]:r+=""+a[c];else{if(c===void 0)continue;if(a[c]){let d=J1(a[c],e,l);const u=LS(d,e);a[":@"]?BS(d,a[":@"],l,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),i[c]!==void 0&&i.hasOwnProperty(c)?(Array.isArray(i[c])||(i[c]=[i[c]]),i[c].push(d)):e.isArray(c,l,u)?i[c]=[d]:i[c]=d}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function RS(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function BS(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let a=0;a<s;a++){const c=i[a];r.isArray(c,n+"."+c,!0,!0)?t[c]=[e[c]]:t[c]=e[c]}}}function LS(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}W1.prettify=PS;const{buildOptions:US}=qp,DS=TS,{prettify:MS}=W1,FS=Mp;let qS=class{constructor(t){this.externalEntities={},this.options=US(t)}parse(t,e){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});const i=FS.validate(t,e);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const n=new DS(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(t);return this.options.preserveOrder||r===void 0?r:MS(r,this.options)}addEntity(t,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}};var HS=qS;const VS=`
|