@authhero/saml 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +6 -6
- package/dist/core.d.ts +237 -3961
- package/dist/core.mjs +1394 -1138
- package/dist/saml.cjs +6 -6
- package/dist/saml.d.ts +237 -3961
- package/dist/saml.mjs +1413 -1157
- package/package.json +3 -3
package/dist/core.mjs
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (
|
|
4
|
-
import { z as
|
|
5
|
-
const
|
|
6
|
-
"#text":
|
|
7
|
-
"@_xmlns:saml":
|
|
8
|
-
}),
|
|
9
|
-
"samlp:AuthnRequest":
|
|
10
|
-
"saml:Issuer":
|
|
11
|
-
"@_xmlns:samlp":
|
|
12
|
-
"@_xmlns:saml":
|
|
13
|
-
"@_ForceAuthn":
|
|
14
|
-
"@_ID":
|
|
15
|
-
"@_IssueInstant":
|
|
16
|
-
"@_Destination":
|
|
17
|
-
"@_AssertionConsumerServiceURL":
|
|
18
|
-
"@_ProtocolBinding":
|
|
19
|
-
"@_Version":
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var oe = (t, e, n) => e in t ? ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var A = (t, e, n) => oe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { z as i } from "@hono/zod-openapi";
|
|
5
|
+
const N = i.object({ "#text": i.string() }), ae = i.object({
|
|
6
|
+
"#text": i.string(),
|
|
7
|
+
"@_xmlns:saml": i.string().optional()
|
|
8
|
+
}), ue = i.object({
|
|
9
|
+
"samlp:AuthnRequest": i.object({
|
|
10
|
+
"saml:Issuer": ae,
|
|
11
|
+
"@_xmlns:samlp": i.string(),
|
|
12
|
+
"@_xmlns:saml": i.string().optional(),
|
|
13
|
+
"@_ForceAuthn": i.string().transform((t) => t.toLowerCase() === "true").optional(),
|
|
14
|
+
"@_ID": i.string(),
|
|
15
|
+
"@_IssueInstant": i.string().datetime(),
|
|
16
|
+
"@_Destination": i.string().url(),
|
|
17
|
+
"@_AssertionConsumerServiceURL": i.string().url().optional(),
|
|
18
|
+
"@_ProtocolBinding": i.string().optional(),
|
|
19
|
+
"@_Version": i.string()
|
|
20
20
|
})
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
":@":
|
|
24
|
-
"@_xmlns":
|
|
25
|
-
"@_entityID":
|
|
21
|
+
}), Ct = i.array(
|
|
22
|
+
i.object({
|
|
23
|
+
":@": i.object({
|
|
24
|
+
"@_xmlns": i.string(),
|
|
25
|
+
"@_entityID": i.string()
|
|
26
26
|
}),
|
|
27
|
-
EntityDescriptor:
|
|
28
|
-
|
|
29
|
-
":@":
|
|
30
|
-
"@_protocolSupportEnumeration":
|
|
27
|
+
EntityDescriptor: i.array(
|
|
28
|
+
i.object({
|
|
29
|
+
":@": i.object({
|
|
30
|
+
"@_protocolSupportEnumeration": i.string()
|
|
31
31
|
}),
|
|
32
|
-
IDPSSODescriptor:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
KeyDescriptor:
|
|
36
|
-
|
|
37
|
-
KeyInfo:
|
|
38
|
-
|
|
39
|
-
X509Data:
|
|
40
|
-
|
|
41
|
-
X509Certificate:
|
|
32
|
+
IDPSSODescriptor: i.array(
|
|
33
|
+
i.union([
|
|
34
|
+
i.object({
|
|
35
|
+
KeyDescriptor: i.array(
|
|
36
|
+
i.object({
|
|
37
|
+
KeyInfo: i.array(
|
|
38
|
+
i.object({
|
|
39
|
+
X509Data: i.array(
|
|
40
|
+
i.object({
|
|
41
|
+
X509Certificate: i.array(N)
|
|
42
42
|
})
|
|
43
43
|
)
|
|
44
44
|
})
|
|
45
45
|
),
|
|
46
|
-
":@":
|
|
47
|
-
"@_xmlns":
|
|
46
|
+
":@": i.object({
|
|
47
|
+
"@_xmlns": i.string()
|
|
48
48
|
})
|
|
49
49
|
})
|
|
50
50
|
),
|
|
51
|
-
":@":
|
|
52
|
-
"@_use":
|
|
51
|
+
":@": i.object({
|
|
52
|
+
"@_use": i.string()
|
|
53
53
|
})
|
|
54
54
|
}),
|
|
55
|
-
|
|
56
|
-
SingleLogoutService:
|
|
57
|
-
":@":
|
|
58
|
-
"@_Binding":
|
|
59
|
-
"@_Location":
|
|
55
|
+
i.object({
|
|
56
|
+
SingleLogoutService: i.array(i.object({})),
|
|
57
|
+
":@": i.object({
|
|
58
|
+
"@_Binding": i.string(),
|
|
59
|
+
"@_Location": i.string()
|
|
60
60
|
})
|
|
61
61
|
}),
|
|
62
|
-
|
|
63
|
-
NameIDFormat:
|
|
62
|
+
i.object({
|
|
63
|
+
NameIDFormat: i.array(N)
|
|
64
64
|
}),
|
|
65
|
-
|
|
66
|
-
SingleSignOnService:
|
|
67
|
-
":@":
|
|
68
|
-
"@_Binding":
|
|
69
|
-
"@_Location":
|
|
65
|
+
i.object({
|
|
66
|
+
SingleSignOnService: i.array(i.object({})),
|
|
67
|
+
":@": i.object({
|
|
68
|
+
"@_Binding": i.string(),
|
|
69
|
+
"@_Location": i.string()
|
|
70
70
|
})
|
|
71
71
|
}),
|
|
72
|
-
|
|
73
|
-
Attribute:
|
|
74
|
-
":@":
|
|
75
|
-
"@_Name":
|
|
76
|
-
"@_NameFormat":
|
|
77
|
-
"@_FriendlyName":
|
|
78
|
-
"@_xmlns":
|
|
72
|
+
i.object({
|
|
73
|
+
Attribute: i.array(i.object({})),
|
|
74
|
+
":@": i.object({
|
|
75
|
+
"@_Name": i.string(),
|
|
76
|
+
"@_NameFormat": i.string(),
|
|
77
|
+
"@_FriendlyName": i.string(),
|
|
78
|
+
"@_xmlns": i.string()
|
|
79
79
|
})
|
|
80
80
|
})
|
|
81
81
|
])
|
|
@@ -83,124 +83,128 @@ const b = s.object({ "#text": s.string() }), W = s.object({
|
|
|
83
83
|
})
|
|
84
84
|
)
|
|
85
85
|
})
|
|
86
|
-
),
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
"@_xmlns:
|
|
97
|
-
"@
|
|
98
|
-
"@_xsi:type": s.string()
|
|
86
|
+
), le = i.object({
|
|
87
|
+
"saml:Attribute": i.array(
|
|
88
|
+
i.object({
|
|
89
|
+
"saml:AttributeValue": i.array(
|
|
90
|
+
i.object({
|
|
91
|
+
"#text": i.string()
|
|
92
|
+
})
|
|
93
|
+
),
|
|
94
|
+
":@": i.object({
|
|
95
|
+
"@_xmlns:xs": i.string().optional(),
|
|
96
|
+
"@_xmlns:xsi": i.string(),
|
|
97
|
+
"@_xsi:type": i.string()
|
|
99
98
|
}).optional()
|
|
100
99
|
})
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"@
|
|
100
|
+
),
|
|
101
|
+
":@": i.object({
|
|
102
|
+
"@_Name": i.string(),
|
|
103
|
+
"@_NameFormat": i.string(),
|
|
104
|
+
"@_FriendlyName": i.string().optional()
|
|
105
|
+
})
|
|
106
|
+
}), ce = i.object({
|
|
107
|
+
"ds:Transform": i.array(i.any()),
|
|
108
|
+
":@": i.object({
|
|
109
|
+
"@_Algorithm": i.string()
|
|
106
110
|
})
|
|
107
|
-
}),
|
|
108
|
-
"ds:Signature":
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"ds:SignedInfo":
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"ds:CanonicalizationMethod":
|
|
115
|
-
|
|
116
|
-
":@":
|
|
117
|
-
"@_Algorithm":
|
|
111
|
+
}), X = i.object({
|
|
112
|
+
"ds:Signature": i.array(
|
|
113
|
+
i.union([
|
|
114
|
+
i.object({
|
|
115
|
+
"ds:SignedInfo": i.array(
|
|
116
|
+
i.union([
|
|
117
|
+
i.object({
|
|
118
|
+
"ds:CanonicalizationMethod": i.array(
|
|
119
|
+
i.object({
|
|
120
|
+
":@": i.object({
|
|
121
|
+
"@_Algorithm": i.string()
|
|
118
122
|
})
|
|
119
123
|
})
|
|
120
124
|
)
|
|
121
125
|
}),
|
|
122
|
-
|
|
123
|
-
"ds:SignatureMethod":
|
|
124
|
-
|
|
125
|
-
":@":
|
|
126
|
-
"@_Algorithm":
|
|
126
|
+
i.object({
|
|
127
|
+
"ds:SignatureMethod": i.array(
|
|
128
|
+
i.object({
|
|
129
|
+
":@": i.object({
|
|
130
|
+
"@_Algorithm": i.string()
|
|
127
131
|
})
|
|
128
132
|
})
|
|
129
133
|
)
|
|
130
134
|
}),
|
|
131
|
-
|
|
132
|
-
"ds:Reference":
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"ds:Transforms":
|
|
135
|
+
i.object({
|
|
136
|
+
"ds:Reference": i.array(
|
|
137
|
+
i.union([
|
|
138
|
+
i.object({
|
|
139
|
+
"ds:Transforms": i.array(ce)
|
|
136
140
|
}),
|
|
137
|
-
|
|
138
|
-
"ds:DigestMethod":
|
|
139
|
-
|
|
140
|
-
":@":
|
|
141
|
-
"@_Algorithm":
|
|
141
|
+
i.object({
|
|
142
|
+
"ds:DigestMethod": i.array(
|
|
143
|
+
i.object({
|
|
144
|
+
":@": i.object({
|
|
145
|
+
"@_Algorithm": i.string()
|
|
142
146
|
})
|
|
143
147
|
})
|
|
144
148
|
)
|
|
145
149
|
}),
|
|
146
|
-
|
|
150
|
+
i.object({ "ds:DigestValue": i.array(N) })
|
|
147
151
|
])
|
|
148
152
|
),
|
|
149
|
-
":@":
|
|
150
|
-
"@_URI":
|
|
153
|
+
":@": i.object({
|
|
154
|
+
"@_URI": i.string().optional()
|
|
151
155
|
}).optional()
|
|
152
156
|
})
|
|
153
157
|
])
|
|
154
158
|
)
|
|
155
159
|
}),
|
|
156
|
-
|
|
157
|
-
"ds:SignatureValue":
|
|
160
|
+
i.object({
|
|
161
|
+
"ds:SignatureValue": i.array(N)
|
|
158
162
|
}),
|
|
159
|
-
|
|
160
|
-
"ds:KeyInfo":
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"ds:KeyValue":
|
|
164
|
-
|
|
165
|
-
"ds:RSAKeyValue":
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
"ds:Modulus":
|
|
163
|
+
i.object({
|
|
164
|
+
"ds:KeyInfo": i.array(
|
|
165
|
+
i.union([
|
|
166
|
+
i.object({
|
|
167
|
+
"ds:KeyValue": i.array(
|
|
168
|
+
i.object({
|
|
169
|
+
"ds:RSAKeyValue": i.array(
|
|
170
|
+
i.union([
|
|
171
|
+
i.object({
|
|
172
|
+
"ds:Modulus": i.array(N)
|
|
169
173
|
}),
|
|
170
|
-
|
|
171
|
-
"ds:Exponent":
|
|
174
|
+
i.object({
|
|
175
|
+
"ds:Exponent": i.array(N)
|
|
172
176
|
})
|
|
173
177
|
])
|
|
174
178
|
)
|
|
175
179
|
})
|
|
176
180
|
)
|
|
177
181
|
}),
|
|
178
|
-
|
|
179
|
-
"ds:X509Data":
|
|
180
|
-
|
|
181
|
-
"ds:X509Certificate":
|
|
182
|
+
i.object({
|
|
183
|
+
"ds:X509Data": i.array(
|
|
184
|
+
i.object({
|
|
185
|
+
"ds:X509Certificate": i.array(N)
|
|
182
186
|
})
|
|
183
187
|
)
|
|
184
188
|
}),
|
|
185
189
|
// Support KeyInfo with both KeyValue and X509Data
|
|
186
|
-
|
|
187
|
-
"ds:KeyValue":
|
|
188
|
-
|
|
189
|
-
"ds:RSAKeyValue":
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"ds:Modulus":
|
|
190
|
+
i.object({
|
|
191
|
+
"ds:KeyValue": i.array(
|
|
192
|
+
i.object({
|
|
193
|
+
"ds:RSAKeyValue": i.array(
|
|
194
|
+
i.union([
|
|
195
|
+
i.object({
|
|
196
|
+
"ds:Modulus": i.array(N)
|
|
193
197
|
}),
|
|
194
|
-
|
|
195
|
-
"ds:Exponent":
|
|
198
|
+
i.object({
|
|
199
|
+
"ds:Exponent": i.array(N)
|
|
196
200
|
})
|
|
197
201
|
])
|
|
198
202
|
)
|
|
199
203
|
})
|
|
200
204
|
),
|
|
201
|
-
"ds:X509Data":
|
|
202
|
-
|
|
203
|
-
"ds:X509Certificate":
|
|
205
|
+
"ds:X509Data": i.array(
|
|
206
|
+
i.object({
|
|
207
|
+
"ds:X509Certificate": i.array(N)
|
|
204
208
|
})
|
|
205
209
|
)
|
|
206
210
|
})
|
|
@@ -209,385 +213,394 @@ const b = s.object({ "#text": s.string() }), W = s.object({
|
|
|
209
213
|
})
|
|
210
214
|
])
|
|
211
215
|
),
|
|
212
|
-
":@":
|
|
213
|
-
"@_xmlns:ds":
|
|
216
|
+
":@": i.object({
|
|
217
|
+
"@_xmlns:ds": i.string().optional()
|
|
214
218
|
}).optional()
|
|
215
|
-
}),
|
|
216
|
-
|
|
217
|
-
"samlp:Response":
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
"saml:Issuer":
|
|
219
|
+
}), Pt = i.array(
|
|
220
|
+
i.object({
|
|
221
|
+
"samlp:Response": i.array(
|
|
222
|
+
i.union([
|
|
223
|
+
i.object({
|
|
224
|
+
"saml:Issuer": i.array(N)
|
|
221
225
|
}),
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"samlp:Status":
|
|
225
|
-
|
|
226
|
-
"samlp:StatusCode":
|
|
227
|
-
":@":
|
|
228
|
-
"@_Value":
|
|
226
|
+
X,
|
|
227
|
+
i.object({
|
|
228
|
+
"samlp:Status": i.array(
|
|
229
|
+
i.object({
|
|
230
|
+
"samlp:StatusCode": i.array(N),
|
|
231
|
+
":@": i.object({
|
|
232
|
+
"@_Value": i.string()
|
|
229
233
|
})
|
|
230
234
|
})
|
|
231
235
|
)
|
|
232
236
|
}),
|
|
233
|
-
|
|
234
|
-
"saml:Assertion":
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"saml:Issuer":
|
|
237
|
+
i.object({
|
|
238
|
+
"saml:Assertion": i.array(
|
|
239
|
+
i.union([
|
|
240
|
+
i.object({
|
|
241
|
+
"saml:Issuer": i.array(N)
|
|
238
242
|
}),
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
"saml:Subject":
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
"saml:NameID":
|
|
245
|
-
":@":
|
|
246
|
-
"@_Format":
|
|
243
|
+
X,
|
|
244
|
+
i.object({
|
|
245
|
+
"saml:Subject": i.array(
|
|
246
|
+
i.union([
|
|
247
|
+
i.object({
|
|
248
|
+
"saml:NameID": i.array(N),
|
|
249
|
+
":@": i.object({
|
|
250
|
+
"@_Format": i.string()
|
|
247
251
|
})
|
|
248
252
|
}),
|
|
249
|
-
|
|
250
|
-
"saml:SubjectConfirmation":
|
|
251
|
-
|
|
252
|
-
"saml:SubjectConfirmationData":
|
|
253
|
-
":@":
|
|
254
|
-
"@_InResponseTo":
|
|
255
|
-
"@_NotOnOrAfter":
|
|
256
|
-
"@_Recipient":
|
|
253
|
+
i.object({
|
|
254
|
+
"saml:SubjectConfirmation": i.array(
|
|
255
|
+
i.object({
|
|
256
|
+
"saml:SubjectConfirmationData": i.array(i.any()),
|
|
257
|
+
":@": i.object({
|
|
258
|
+
"@_InResponseTo": i.string(),
|
|
259
|
+
"@_NotOnOrAfter": i.string(),
|
|
260
|
+
"@_Recipient": i.string()
|
|
257
261
|
})
|
|
258
262
|
})
|
|
259
263
|
),
|
|
260
|
-
":@":
|
|
261
|
-
"@_Method":
|
|
264
|
+
":@": i.object({
|
|
265
|
+
"@_Method": i.string()
|
|
262
266
|
})
|
|
263
267
|
})
|
|
264
268
|
])
|
|
265
269
|
)
|
|
266
270
|
}),
|
|
267
|
-
|
|
268
|
-
"saml:Conditions":
|
|
269
|
-
|
|
270
|
-
"saml:AudienceRestriction":
|
|
271
|
-
|
|
272
|
-
"saml:Audience":
|
|
271
|
+
i.object({
|
|
272
|
+
"saml:Conditions": i.array(
|
|
273
|
+
i.object({
|
|
274
|
+
"saml:AudienceRestriction": i.array(
|
|
275
|
+
i.object({
|
|
276
|
+
"saml:Audience": i.array(N)
|
|
273
277
|
})
|
|
274
278
|
)
|
|
275
279
|
})
|
|
276
280
|
),
|
|
277
|
-
":@":
|
|
278
|
-
"@_NotBefore":
|
|
279
|
-
"@_NotOnOrAfter":
|
|
281
|
+
":@": i.object({
|
|
282
|
+
"@_NotBefore": i.string(),
|
|
283
|
+
"@_NotOnOrAfter": i.string()
|
|
280
284
|
})
|
|
281
285
|
}),
|
|
282
|
-
|
|
283
|
-
"saml:AuthnStatement":
|
|
284
|
-
|
|
285
|
-
"saml:AuthnContext":
|
|
286
|
-
|
|
287
|
-
"saml:AuthnContextClassRef":
|
|
286
|
+
i.object({
|
|
287
|
+
"saml:AuthnStatement": i.array(
|
|
288
|
+
i.object({
|
|
289
|
+
"saml:AuthnContext": i.array(
|
|
290
|
+
i.object({
|
|
291
|
+
"saml:AuthnContextClassRef": i.array(N)
|
|
288
292
|
})
|
|
289
293
|
)
|
|
290
294
|
})
|
|
291
295
|
),
|
|
292
|
-
":@":
|
|
293
|
-
"@_AuthnInstant":
|
|
294
|
-
"@_SessionIndex":
|
|
295
|
-
"@_SessionNotOnOrAfter":
|
|
296
|
+
":@": i.object({
|
|
297
|
+
"@_AuthnInstant": i.string(),
|
|
298
|
+
"@_SessionIndex": i.string(),
|
|
299
|
+
"@_SessionNotOnOrAfter": i.string()
|
|
296
300
|
})
|
|
297
301
|
}),
|
|
298
|
-
|
|
299
|
-
"saml:AttributeStatement":
|
|
300
|
-
s.object({
|
|
301
|
-
"saml:Attribute": s.array(D)
|
|
302
|
-
})
|
|
303
|
-
)
|
|
302
|
+
i.object({
|
|
303
|
+
"saml:AttributeStatement": i.array(le)
|
|
304
304
|
})
|
|
305
305
|
])
|
|
306
306
|
),
|
|
307
|
-
":@":
|
|
308
|
-
"@_xmlns":
|
|
309
|
-
"@_ID":
|
|
310
|
-
"@_IssueInstant":
|
|
311
|
-
"@_Version":
|
|
307
|
+
":@": i.object({
|
|
308
|
+
"@_xmlns": i.string(),
|
|
309
|
+
"@_ID": i.string(),
|
|
310
|
+
"@_IssueInstant": i.string(),
|
|
311
|
+
"@_Version": i.string()
|
|
312
312
|
})
|
|
313
313
|
})
|
|
314
314
|
])
|
|
315
315
|
),
|
|
316
|
-
":@":
|
|
317
|
-
"@_xmlns:samlp":
|
|
318
|
-
"@_xmlns:saml":
|
|
319
|
-
"@_Destination":
|
|
320
|
-
"@_ID":
|
|
321
|
-
"@_InResponseTo":
|
|
322
|
-
"@_IssueInstant":
|
|
323
|
-
"@_Version":
|
|
316
|
+
":@": i.object({
|
|
317
|
+
"@_xmlns:samlp": i.string(),
|
|
318
|
+
"@_xmlns:saml": i.string(),
|
|
319
|
+
"@_Destination": i.string(),
|
|
320
|
+
"@_ID": i.string(),
|
|
321
|
+
"@_InResponseTo": i.string(),
|
|
322
|
+
"@_IssueInstant": i.string(),
|
|
323
|
+
"@_Version": i.string()
|
|
324
324
|
})
|
|
325
325
|
})
|
|
326
326
|
);
|
|
327
|
-
var
|
|
328
|
-
(function(
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
let
|
|
332
|
-
for (;
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
for (let
|
|
337
|
-
|
|
338
|
-
|
|
327
|
+
var z = {}, P = {};
|
|
328
|
+
(function(t) {
|
|
329
|
+
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", s = "[" + e + "][" + n + "]*", r = new RegExp("^" + s + "$"), o = function(l, f) {
|
|
330
|
+
const d = [];
|
|
331
|
+
let h = f.exec(l);
|
|
332
|
+
for (; h; ) {
|
|
333
|
+
const m = [];
|
|
334
|
+
m.startIndex = f.lastIndex - h[0].length;
|
|
335
|
+
const b = h.length;
|
|
336
|
+
for (let y = 0; y < b; y++)
|
|
337
|
+
m.push(h[y]);
|
|
338
|
+
d.push(m), h = f.exec(l);
|
|
339
339
|
}
|
|
340
|
-
return
|
|
341
|
-
},
|
|
342
|
-
const
|
|
343
|
-
return !(
|
|
340
|
+
return d;
|
|
341
|
+
}, a = function(l) {
|
|
342
|
+
const f = r.exec(l);
|
|
343
|
+
return !(f === null || typeof f > "u");
|
|
344
344
|
};
|
|
345
|
-
|
|
346
|
-
return typeof
|
|
347
|
-
},
|
|
348
|
-
return Object.keys(
|
|
349
|
-
},
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
for (let
|
|
353
|
-
|
|
345
|
+
t.isExist = function(l) {
|
|
346
|
+
return typeof l < "u";
|
|
347
|
+
}, t.isEmptyObject = function(l) {
|
|
348
|
+
return Object.keys(l).length === 0;
|
|
349
|
+
}, t.merge = function(l, f, d) {
|
|
350
|
+
if (f) {
|
|
351
|
+
const h = Object.keys(f), m = h.length;
|
|
352
|
+
for (let b = 0; b < m; b++)
|
|
353
|
+
d === "strict" ? l[h[b]] = [f[h[b]]] : l[h[b]] = f[h[b]];
|
|
354
354
|
}
|
|
355
|
-
},
|
|
356
|
-
return
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
355
|
+
}, t.getValue = function(l) {
|
|
356
|
+
return t.isExist(l) ? l : "";
|
|
357
|
+
};
|
|
358
|
+
const c = [
|
|
359
|
+
// '__proto__',
|
|
360
|
+
// 'constructor',
|
|
361
|
+
// 'prototype',
|
|
362
|
+
"hasOwnProperty",
|
|
363
|
+
"toString",
|
|
364
|
+
"valueOf",
|
|
365
|
+
"__defineGetter__",
|
|
366
|
+
"__defineSetter__",
|
|
367
|
+
"__lookupGetter__",
|
|
368
|
+
"__lookupSetter__"
|
|
369
|
+
], u = ["__proto__", "constructor", "prototype"];
|
|
370
|
+
t.isName = a, t.getAllMatches = o, t.nameRegexp = s, t.DANGEROUS_PROPERTY_NAMES = c, t.criticalProperties = u;
|
|
371
|
+
})(P);
|
|
372
|
+
const $ = P, de = {
|
|
360
373
|
allowBooleanAttributes: !1,
|
|
361
374
|
//A tag can have attributes without any value
|
|
362
375
|
unpairedTags: []
|
|
363
376
|
};
|
|
364
|
-
|
|
365
|
-
|
|
377
|
+
z.validate = function(t, e) {
|
|
378
|
+
e = Object.assign({}, de, e);
|
|
366
379
|
const n = [];
|
|
367
|
-
let
|
|
368
|
-
|
|
369
|
-
for (let
|
|
370
|
-
if (
|
|
371
|
-
if (
|
|
372
|
-
} else if (
|
|
373
|
-
let
|
|
374
|
-
if (
|
|
375
|
-
|
|
380
|
+
let s = !1, r = !1;
|
|
381
|
+
t[0] === "\uFEFF" && (t = t.substr(1));
|
|
382
|
+
for (let o = 0; o < t.length; o++)
|
|
383
|
+
if (t[o] === "<" && t[o + 1] === "?") {
|
|
384
|
+
if (o += 2, o = U(t, o), o.err) return o;
|
|
385
|
+
} else if (t[o] === "<") {
|
|
386
|
+
let a = o;
|
|
387
|
+
if (o++, t[o] === "!") {
|
|
388
|
+
o = k(t, o);
|
|
376
389
|
continue;
|
|
377
390
|
} else {
|
|
378
|
-
let
|
|
379
|
-
|
|
380
|
-
let
|
|
381
|
-
for (;
|
|
382
|
-
` &&
|
|
383
|
-
|
|
384
|
-
if (
|
|
391
|
+
let c = !1;
|
|
392
|
+
t[o] === "/" && (c = !0, o++);
|
|
393
|
+
let u = "";
|
|
394
|
+
for (; o < t.length && t[o] !== ">" && t[o] !== " " && t[o] !== " " && t[o] !== `
|
|
395
|
+
` && t[o] !== "\r"; o++)
|
|
396
|
+
u += t[o];
|
|
397
|
+
if (u = u.trim(), u[u.length - 1] === "/" && (u = u.substring(0, u.length - 1), o--), !we(u)) {
|
|
385
398
|
let d;
|
|
386
|
-
return
|
|
399
|
+
return u.trim().length === 0 ? d = "Invalid space after '<'." : d = "Tag '" + u + "' is an invalid name.", p("InvalidTag", d, w(t, o));
|
|
387
400
|
}
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
return
|
|
391
|
-
let
|
|
392
|
-
if (
|
|
393
|
-
const d =
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
if (
|
|
397
|
-
|
|
401
|
+
const l = ge(t, o);
|
|
402
|
+
if (l === !1)
|
|
403
|
+
return p("InvalidAttr", "Attributes for '" + u + "' have open quote.", w(t, o));
|
|
404
|
+
let f = l.value;
|
|
405
|
+
if (o = l.index, f[f.length - 1] === "/") {
|
|
406
|
+
const d = o - f.length;
|
|
407
|
+
f = f.substring(0, f.length - 1);
|
|
408
|
+
const h = G(f, e);
|
|
409
|
+
if (h === !0)
|
|
410
|
+
s = !0;
|
|
398
411
|
else
|
|
399
|
-
return h
|
|
400
|
-
} else if (
|
|
401
|
-
if (
|
|
402
|
-
if (
|
|
403
|
-
return
|
|
412
|
+
return p(h.err.code, h.err.msg, w(t, d + h.err.line));
|
|
413
|
+
} else if (c)
|
|
414
|
+
if (l.tagClosed) {
|
|
415
|
+
if (f.trim().length > 0)
|
|
416
|
+
return p("InvalidTag", "Closing tag '" + u + "' can't have attributes or invalid starting.", w(t, a));
|
|
404
417
|
if (n.length === 0)
|
|
405
|
-
return
|
|
418
|
+
return p("InvalidTag", "Closing tag '" + u + "' has not been opened.", w(t, a));
|
|
406
419
|
{
|
|
407
420
|
const d = n.pop();
|
|
408
|
-
if (
|
|
409
|
-
let
|
|
410
|
-
return
|
|
421
|
+
if (u !== d.tagName) {
|
|
422
|
+
let h = w(t, d.tagStartPos);
|
|
423
|
+
return p(
|
|
411
424
|
"InvalidTag",
|
|
412
|
-
"Expected closing tag '" + d.tagName + "' (opened in line " +
|
|
413
|
-
|
|
425
|
+
"Expected closing tag '" + d.tagName + "' (opened in line " + h.line + ", col " + h.col + ") instead of closing tag '" + u + "'.",
|
|
426
|
+
w(t, a)
|
|
414
427
|
);
|
|
415
428
|
}
|
|
416
|
-
n.length == 0 && (
|
|
429
|
+
n.length == 0 && (r = !0);
|
|
417
430
|
}
|
|
418
|
-
} else return
|
|
431
|
+
} else return p("InvalidTag", "Closing tag '" + u + "' doesn't have proper closing.", w(t, o));
|
|
419
432
|
else {
|
|
420
|
-
const d =
|
|
433
|
+
const d = G(f, e);
|
|
421
434
|
if (d !== !0)
|
|
422
|
-
return
|
|
423
|
-
if (
|
|
424
|
-
return
|
|
425
|
-
|
|
435
|
+
return p(d.err.code, d.err.msg, w(t, o - f.length + d.err.line));
|
|
436
|
+
if (r === !0)
|
|
437
|
+
return p("InvalidXml", "Multiple possible root nodes found.", w(t, o));
|
|
438
|
+
e.unpairedTags.indexOf(u) !== -1 || n.push({ tagName: u, tagStartPos: a }), s = !0;
|
|
426
439
|
}
|
|
427
|
-
for (
|
|
428
|
-
if (
|
|
429
|
-
if (
|
|
430
|
-
|
|
440
|
+
for (o++; o < t.length; o++)
|
|
441
|
+
if (t[o] === "<")
|
|
442
|
+
if (t[o + 1] === "!") {
|
|
443
|
+
o++, o = k(t, o);
|
|
431
444
|
continue;
|
|
432
|
-
} else if (
|
|
433
|
-
if (
|
|
445
|
+
} else if (t[o + 1] === "?") {
|
|
446
|
+
if (o = U(t, ++o), o.err) return o;
|
|
434
447
|
} else
|
|
435
448
|
break;
|
|
436
|
-
else if (
|
|
437
|
-
const d =
|
|
449
|
+
else if (t[o] === "&") {
|
|
450
|
+
const d = be(t, o);
|
|
438
451
|
if (d == -1)
|
|
439
|
-
return
|
|
440
|
-
|
|
441
|
-
} else if (
|
|
442
|
-
return
|
|
443
|
-
|
|
452
|
+
return p("InvalidChar", "char '&' is not expected.", w(t, o));
|
|
453
|
+
o = d;
|
|
454
|
+
} else if (r === !0 && !B(t[o]))
|
|
455
|
+
return p("InvalidXml", "Extra text at the end", w(t, o));
|
|
456
|
+
t[o] === "<" && o--;
|
|
444
457
|
}
|
|
445
458
|
} else {
|
|
446
|
-
if (
|
|
459
|
+
if (B(t[o]))
|
|
447
460
|
continue;
|
|
448
|
-
return
|
|
461
|
+
return p("InvalidChar", "char '" + t[o] + "' is not expected.", w(t, o));
|
|
449
462
|
}
|
|
450
|
-
if (
|
|
463
|
+
if (s) {
|
|
451
464
|
if (n.length == 1)
|
|
452
|
-
return
|
|
465
|
+
return p("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", w(t, n[0].tagStartPos));
|
|
453
466
|
if (n.length > 0)
|
|
454
|
-
return
|
|
455
|
-
} else return
|
|
467
|
+
return p("InvalidXml", "Invalid '" + JSON.stringify(n.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
468
|
+
} else return p("InvalidXml", "Start tag expected.", 1);
|
|
456
469
|
return !0;
|
|
457
470
|
};
|
|
458
|
-
function
|
|
459
|
-
return
|
|
460
|
-
` ||
|
|
471
|
+
function B(t) {
|
|
472
|
+
return t === " " || t === " " || t === `
|
|
473
|
+
` || t === "\r";
|
|
461
474
|
}
|
|
462
|
-
function
|
|
463
|
-
const n =
|
|
464
|
-
for (;
|
|
465
|
-
if (e
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
return
|
|
469
|
-
if (e
|
|
470
|
-
|
|
475
|
+
function U(t, e) {
|
|
476
|
+
const n = e;
|
|
477
|
+
for (; e < t.length; e++)
|
|
478
|
+
if (t[e] == "?" || t[e] == " ") {
|
|
479
|
+
const s = t.substr(n, e - n);
|
|
480
|
+
if (e > 5 && s === "xml")
|
|
481
|
+
return p("InvalidXml", "XML declaration allowed only at the start of the document.", w(t, e));
|
|
482
|
+
if (t[e] == "?" && t[e + 1] == ">") {
|
|
483
|
+
e++;
|
|
471
484
|
break;
|
|
472
485
|
} else
|
|
473
486
|
continue;
|
|
474
487
|
}
|
|
475
|
-
return
|
|
488
|
+
return e;
|
|
476
489
|
}
|
|
477
|
-
function
|
|
478
|
-
if (
|
|
479
|
-
for (
|
|
480
|
-
if (e
|
|
481
|
-
|
|
490
|
+
function k(t, e) {
|
|
491
|
+
if (t.length > e + 5 && t[e + 1] === "-" && t[e + 2] === "-") {
|
|
492
|
+
for (e += 3; e < t.length; e++)
|
|
493
|
+
if (t[e] === "-" && t[e + 1] === "-" && t[e + 2] === ">") {
|
|
494
|
+
e += 2;
|
|
482
495
|
break;
|
|
483
496
|
}
|
|
484
|
-
} else if (
|
|
497
|
+
} 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") {
|
|
485
498
|
let n = 1;
|
|
486
|
-
for (
|
|
487
|
-
if (e
|
|
499
|
+
for (e += 8; e < t.length; e++)
|
|
500
|
+
if (t[e] === "<")
|
|
488
501
|
n++;
|
|
489
|
-
else if (e
|
|
502
|
+
else if (t[e] === ">" && (n--, n === 0))
|
|
490
503
|
break;
|
|
491
|
-
} else if (
|
|
492
|
-
for (
|
|
493
|
-
if (e
|
|
494
|
-
|
|
504
|
+
} 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] === "[") {
|
|
505
|
+
for (e += 8; e < t.length; e++)
|
|
506
|
+
if (t[e] === "]" && t[e + 1] === "]" && t[e + 2] === ">") {
|
|
507
|
+
e += 2;
|
|
495
508
|
break;
|
|
496
509
|
}
|
|
497
510
|
}
|
|
498
|
-
return
|
|
511
|
+
return e;
|
|
499
512
|
}
|
|
500
|
-
const
|
|
501
|
-
function
|
|
502
|
-
let n = "",
|
|
503
|
-
for (;
|
|
504
|
-
if (e
|
|
505
|
-
|
|
506
|
-
else if (e
|
|
507
|
-
|
|
513
|
+
const fe = '"', he = "'";
|
|
514
|
+
function ge(t, e) {
|
|
515
|
+
let n = "", s = "", r = !1;
|
|
516
|
+
for (; e < t.length; e++) {
|
|
517
|
+
if (t[e] === fe || t[e] === he)
|
|
518
|
+
s === "" ? s = t[e] : s !== t[e] || (s = "");
|
|
519
|
+
else if (t[e] === ">" && s === "") {
|
|
520
|
+
r = !0;
|
|
508
521
|
break;
|
|
509
522
|
}
|
|
510
|
-
n += e
|
|
523
|
+
n += t[e];
|
|
511
524
|
}
|
|
512
|
-
return
|
|
525
|
+
return s !== "" ? !1 : {
|
|
513
526
|
value: n,
|
|
514
|
-
index:
|
|
515
|
-
tagClosed:
|
|
527
|
+
index: e,
|
|
528
|
+
tagClosed: r
|
|
516
529
|
};
|
|
517
530
|
}
|
|
518
|
-
const
|
|
519
|
-
function
|
|
520
|
-
const n =
|
|
521
|
-
for (let
|
|
522
|
-
if (n[
|
|
523
|
-
return
|
|
524
|
-
if (n[
|
|
525
|
-
return
|
|
526
|
-
if (n[
|
|
527
|
-
return
|
|
528
|
-
const
|
|
529
|
-
if (!
|
|
530
|
-
return
|
|
531
|
-
if (!
|
|
532
|
-
o
|
|
531
|
+
const pe = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
532
|
+
function G(t, e) {
|
|
533
|
+
const n = $.getAllMatches(t, pe), s = {};
|
|
534
|
+
for (let r = 0; r < n.length; r++) {
|
|
535
|
+
if (n[r][1].length === 0)
|
|
536
|
+
return p("InvalidAttr", "Attribute '" + n[r][2] + "' has no space in starting.", O(n[r]));
|
|
537
|
+
if (n[r][3] !== void 0 && n[r][4] === void 0)
|
|
538
|
+
return p("InvalidAttr", "Attribute '" + n[r][2] + "' is without value.", O(n[r]));
|
|
539
|
+
if (n[r][3] === void 0 && !e.allowBooleanAttributes)
|
|
540
|
+
return p("InvalidAttr", "boolean attribute '" + n[r][2] + "' is not allowed.", O(n[r]));
|
|
541
|
+
const o = n[r][2];
|
|
542
|
+
if (!Ne(o))
|
|
543
|
+
return p("InvalidAttr", "Attribute '" + o + "' is an invalid name.", O(n[r]));
|
|
544
|
+
if (!s.hasOwnProperty(o))
|
|
545
|
+
s[o] = 1;
|
|
533
546
|
else
|
|
534
|
-
return
|
|
547
|
+
return p("InvalidAttr", "Attribute '" + o + "' is repeated.", O(n[r]));
|
|
535
548
|
}
|
|
536
549
|
return !0;
|
|
537
550
|
}
|
|
538
|
-
function
|
|
551
|
+
function me(t, e) {
|
|
539
552
|
let n = /\d/;
|
|
540
|
-
for (e
|
|
541
|
-
if (e
|
|
542
|
-
return
|
|
543
|
-
if (!e
|
|
553
|
+
for (t[e] === "x" && (e++, n = /[\da-fA-F]/); e < t.length; e++) {
|
|
554
|
+
if (t[e] === ";")
|
|
555
|
+
return e;
|
|
556
|
+
if (!t[e].match(n))
|
|
544
557
|
break;
|
|
545
558
|
}
|
|
546
559
|
return -1;
|
|
547
560
|
}
|
|
548
|
-
function
|
|
549
|
-
if (
|
|
561
|
+
function be(t, e) {
|
|
562
|
+
if (e++, t[e] === ";")
|
|
550
563
|
return -1;
|
|
551
|
-
if (e
|
|
552
|
-
return
|
|
564
|
+
if (t[e] === "#")
|
|
565
|
+
return e++, me(t, e);
|
|
553
566
|
let n = 0;
|
|
554
|
-
for (;
|
|
555
|
-
if (!(e
|
|
556
|
-
if (e
|
|
567
|
+
for (; e < t.length; e++, n++)
|
|
568
|
+
if (!(t[e].match(/\w/) && n < 20)) {
|
|
569
|
+
if (t[e] === ";")
|
|
557
570
|
break;
|
|
558
571
|
return -1;
|
|
559
572
|
}
|
|
560
|
-
return
|
|
573
|
+
return e;
|
|
561
574
|
}
|
|
562
|
-
function
|
|
575
|
+
function p(t, e, n) {
|
|
563
576
|
return {
|
|
564
577
|
err: {
|
|
565
|
-
code:
|
|
566
|
-
msg:
|
|
578
|
+
code: t,
|
|
579
|
+
msg: e,
|
|
567
580
|
line: n.line || n,
|
|
568
581
|
col: n.col
|
|
569
582
|
}
|
|
570
583
|
};
|
|
571
584
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
585
|
+
function Ne(t) {
|
|
586
|
+
return $.isName(t);
|
|
574
587
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
588
|
+
function we(t) {
|
|
589
|
+
return $.isName(t);
|
|
577
590
|
}
|
|
578
|
-
function
|
|
579
|
-
const n =
|
|
591
|
+
function w(t, e) {
|
|
592
|
+
const n = t.substring(0, e).split(/\r?\n/);
|
|
580
593
|
return {
|
|
581
594
|
line: n.length,
|
|
582
595
|
// column number is last line's length + 1, because column numbering starts at 1:
|
|
583
596
|
col: n[n.length - 1].length + 1
|
|
584
597
|
};
|
|
585
598
|
}
|
|
586
|
-
function
|
|
587
|
-
return
|
|
599
|
+
function O(t) {
|
|
600
|
+
return t.startIndex + t[1].length;
|
|
588
601
|
}
|
|
589
|
-
var
|
|
590
|
-
const
|
|
602
|
+
var F = {};
|
|
603
|
+
const { DANGEROUS_PROPERTY_NAMES: Z, criticalProperties: Ee } = P, q = (t) => Z.includes(t) ? "__" + t : t, W = {
|
|
591
604
|
preserveOrder: !1,
|
|
592
605
|
attributeNamePrefix: "@_",
|
|
593
606
|
attributesGroupName: !1,
|
|
@@ -608,11 +621,11 @@ const R = {
|
|
|
608
621
|
leadingZeros: !0,
|
|
609
622
|
eNotation: !0
|
|
610
623
|
},
|
|
611
|
-
tagValueProcessor: function(
|
|
612
|
-
return
|
|
624
|
+
tagValueProcessor: function(t, e) {
|
|
625
|
+
return e;
|
|
613
626
|
},
|
|
614
|
-
attributeValueProcessor: function(
|
|
615
|
-
return
|
|
627
|
+
attributeValueProcessor: function(t, e) {
|
|
628
|
+
return e;
|
|
616
629
|
},
|
|
617
630
|
stopNodes: [],
|
|
618
631
|
//nested tags will not be parsed even for errors
|
|
@@ -626,138 +639,324 @@ const R = {
|
|
|
626
639
|
ignorePiTags: !1,
|
|
627
640
|
transformTagName: !1,
|
|
628
641
|
transformAttributeName: !1,
|
|
629
|
-
updateTag: function(
|
|
630
|
-
return
|
|
631
|
-
}
|
|
642
|
+
updateTag: function(t, e, n) {
|
|
643
|
+
return t;
|
|
644
|
+
},
|
|
632
645
|
// skipEmptyListItem: false
|
|
633
|
-
|
|
634
|
-
|
|
646
|
+
captureMetaData: !1,
|
|
647
|
+
maxNestedTags: 100,
|
|
648
|
+
strictReservedNames: !0,
|
|
649
|
+
onDangerousProperty: q
|
|
650
|
+
};
|
|
651
|
+
function ye(t, e) {
|
|
652
|
+
if (typeof t != "string")
|
|
653
|
+
return;
|
|
654
|
+
const n = t.toLowerCase();
|
|
655
|
+
if (Z.some((s) => n === s.toLowerCase()))
|
|
656
|
+
throw new Error(
|
|
657
|
+
`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
658
|
+
);
|
|
659
|
+
if (Ee.some((s) => n === s.toLowerCase()))
|
|
660
|
+
throw new Error(
|
|
661
|
+
`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
function H(t) {
|
|
665
|
+
return typeof t == "boolean" ? {
|
|
666
|
+
enabled: t,
|
|
667
|
+
// true or false
|
|
668
|
+
maxEntitySize: 1e4,
|
|
669
|
+
maxExpansionDepth: 10,
|
|
670
|
+
maxTotalExpansions: 1e3,
|
|
671
|
+
maxExpandedLength: 1e5,
|
|
672
|
+
allowedTags: null,
|
|
673
|
+
tagFilter: null
|
|
674
|
+
} : typeof t == "object" && t !== null ? {
|
|
675
|
+
enabled: t.enabled !== !1,
|
|
676
|
+
maxEntitySize: Math.max(1, t.maxEntitySize ?? 1e4),
|
|
677
|
+
maxExpansionDepth: Math.max(1, t.maxExpansionDepth ?? 1e4),
|
|
678
|
+
maxTotalExpansions: Math.max(1, t.maxTotalExpansions ?? 1 / 0),
|
|
679
|
+
maxExpandedLength: Math.max(1, t.maxExpandedLength ?? 1e5),
|
|
680
|
+
maxEntityCount: Math.max(1, t.maxEntityCount ?? 1e3),
|
|
681
|
+
allowedTags: t.allowedTags ?? null,
|
|
682
|
+
tagFilter: t.tagFilter ?? null
|
|
683
|
+
} : H(!0);
|
|
684
|
+
}
|
|
685
|
+
const xe = function(t) {
|
|
686
|
+
const e = Object.assign({}, W, t), n = [
|
|
687
|
+
{ value: e.attributeNamePrefix, name: "attributeNamePrefix" },
|
|
688
|
+
{ value: e.attributesGroupName, name: "attributesGroupName" },
|
|
689
|
+
{ value: e.textNodeName, name: "textNodeName" },
|
|
690
|
+
{ value: e.cdataPropName, name: "cdataPropName" },
|
|
691
|
+
{ value: e.commentPropName, name: "commentPropName" }
|
|
692
|
+
];
|
|
693
|
+
for (const { value: s, name: r } of n)
|
|
694
|
+
s && ye(s, r);
|
|
695
|
+
return e.onDangerousProperty === null && (e.onDangerousProperty = q), e.processEntities = H(e.processEntities), e;
|
|
635
696
|
};
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
class
|
|
639
|
-
constructor(
|
|
640
|
-
this.tagname =
|
|
697
|
+
F.buildOptions = xe;
|
|
698
|
+
F.defaultOptions = W;
|
|
699
|
+
class Ae {
|
|
700
|
+
constructor(e) {
|
|
701
|
+
this.tagname = e, this.child = [], this[":@"] = {};
|
|
641
702
|
}
|
|
642
|
-
add(
|
|
643
|
-
|
|
703
|
+
add(e, n) {
|
|
704
|
+
e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: n });
|
|
644
705
|
}
|
|
645
|
-
addChild(
|
|
646
|
-
|
|
706
|
+
addChild(e) {
|
|
707
|
+
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 });
|
|
647
708
|
}
|
|
648
709
|
}
|
|
649
|
-
var
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
710
|
+
var _e = Ae;
|
|
711
|
+
const Q = P;
|
|
712
|
+
let Te = class {
|
|
713
|
+
constructor(e) {
|
|
714
|
+
this.suppressValidationErr = !e, this.options = e || {};
|
|
715
|
+
}
|
|
716
|
+
readDocType(e, n) {
|
|
717
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
718
|
+
let r = 0;
|
|
719
|
+
if (e[n + 3] === "O" && e[n + 4] === "C" && e[n + 5] === "T" && e[n + 6] === "Y" && e[n + 7] === "P" && e[n + 8] === "E") {
|
|
720
|
+
n = n + 9;
|
|
721
|
+
let o = 1, a = !1, c = !1, u = "";
|
|
722
|
+
for (; n < e.length; n++)
|
|
723
|
+
if (e[n] === "<" && !c) {
|
|
724
|
+
if (a && _(e, "!ENTITY", n)) {
|
|
725
|
+
n += 7;
|
|
726
|
+
let l, f;
|
|
727
|
+
if ([l, f, n] = this.readEntityExp(e, n + 1, this.suppressValidationErr), f.indexOf("&") === -1) {
|
|
728
|
+
if (this.options.enabled !== !1 && this.options.maxEntityCount != null && r >= this.options.maxEntityCount)
|
|
729
|
+
throw new Error(
|
|
730
|
+
`Entity count (${r + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
731
|
+
);
|
|
732
|
+
const d = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
733
|
+
s[l] = {
|
|
734
|
+
regx: RegExp(`&${d};`, "g"),
|
|
735
|
+
val: f
|
|
736
|
+
}, r++;
|
|
737
|
+
}
|
|
738
|
+
} else if (a && _(e, "!ELEMENT", n)) {
|
|
739
|
+
n += 8;
|
|
740
|
+
const { index: l } = this.readElementExp(e, n + 1);
|
|
741
|
+
n = l;
|
|
742
|
+
} else if (a && _(e, "!ATTLIST", n))
|
|
743
|
+
n += 8;
|
|
744
|
+
else if (a && _(e, "!NOTATION", n)) {
|
|
745
|
+
n += 9;
|
|
746
|
+
const { index: l } = this.readNotationExp(e, n + 1, this.suppressValidationErr);
|
|
747
|
+
n = l;
|
|
748
|
+
} else if (_(e, "!--", n))
|
|
749
|
+
c = !0;
|
|
750
|
+
else
|
|
751
|
+
throw new Error("Invalid DOCTYPE");
|
|
752
|
+
o++, u = "";
|
|
753
|
+
} else if (e[n] === ">") {
|
|
754
|
+
if (c ? e[n - 1] === "-" && e[n - 2] === "-" && (c = !1, o--) : o--, o === 0)
|
|
755
|
+
break;
|
|
756
|
+
} else e[n] === "[" ? a = !0 : u += e[n];
|
|
757
|
+
if (o !== 0)
|
|
758
|
+
throw new Error("Unclosed DOCTYPE");
|
|
759
|
+
} else
|
|
760
|
+
throw new Error("Invalid Tag instead of DOCTYPE");
|
|
761
|
+
return { entities: s, i: n };
|
|
762
|
+
}
|
|
763
|
+
readEntityExp(e, n) {
|
|
764
|
+
n = E(e, n);
|
|
765
|
+
let s = "";
|
|
766
|
+
for (; n < e.length && !/\s/.test(e[n]) && e[n] !== '"' && e[n] !== "'"; )
|
|
767
|
+
s += e[n], n++;
|
|
768
|
+
if (C(s), n = E(e, n), !this.suppressValidationErr) {
|
|
769
|
+
if (e.substring(n, n + 6).toUpperCase() === "SYSTEM")
|
|
770
|
+
throw new Error("External entities are not supported");
|
|
771
|
+
if (e[n] === "%")
|
|
772
|
+
throw new Error("Parameter entities are not supported");
|
|
773
|
+
}
|
|
774
|
+
let r = "";
|
|
775
|
+
if ([n, r] = this.readIdentifierVal(e, n, "entity"), this.options.enabled !== !1 && this.options.maxEntitySize != null && r.length > this.options.maxEntitySize)
|
|
776
|
+
throw new Error(
|
|
777
|
+
`Entity "${s}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
778
|
+
);
|
|
779
|
+
return n--, [s, r, n];
|
|
780
|
+
}
|
|
781
|
+
readNotationExp(e, n) {
|
|
782
|
+
n = E(e, n);
|
|
783
|
+
let s = "";
|
|
784
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
785
|
+
s += e[n], n++;
|
|
786
|
+
!this.suppressValidationErr && C(s), n = E(e, n);
|
|
787
|
+
const r = e.substring(n, n + 6).toUpperCase();
|
|
788
|
+
if (!this.suppressValidationErr && r !== "SYSTEM" && r !== "PUBLIC")
|
|
789
|
+
throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);
|
|
790
|
+
n += r.length, n = E(e, n);
|
|
791
|
+
let o = null, a = null;
|
|
792
|
+
if (r === "PUBLIC")
|
|
793
|
+
[n, o] = this.readIdentifierVal(e, n, "publicIdentifier"), n = E(e, n), (e[n] === '"' || e[n] === "'") && ([n, a] = this.readIdentifierVal(e, n, "systemIdentifier"));
|
|
794
|
+
else if (r === "SYSTEM" && ([n, a] = this.readIdentifierVal(e, n, "systemIdentifier"), !this.suppressValidationErr && !a))
|
|
795
|
+
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
796
|
+
return { notationName: s, publicIdentifier: o, systemIdentifier: a, index: --n };
|
|
797
|
+
}
|
|
798
|
+
readIdentifierVal(e, n, s) {
|
|
799
|
+
let r = "";
|
|
800
|
+
const o = e[n];
|
|
801
|
+
if (o !== '"' && o !== "'")
|
|
802
|
+
throw new Error(`Expected quoted string, found "${o}"`);
|
|
803
|
+
for (n++; n < e.length && e[n] !== o; )
|
|
804
|
+
r += e[n], n++;
|
|
805
|
+
if (e[n] !== o)
|
|
806
|
+
throw new Error(`Unterminated ${s} value`);
|
|
807
|
+
return n++, [n, r];
|
|
808
|
+
}
|
|
809
|
+
readElementExp(e, n) {
|
|
810
|
+
n = E(e, n);
|
|
811
|
+
let s = "";
|
|
812
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
813
|
+
s += e[n], n++;
|
|
814
|
+
if (!this.suppressValidationErr && !Q.isName(s))
|
|
815
|
+
throw new Error(`Invalid element name: "${s}"`);
|
|
816
|
+
n = E(e, n);
|
|
817
|
+
let r = "";
|
|
818
|
+
if (e[n] === "E" && _(e, "MPTY", n))
|
|
819
|
+
n += 4;
|
|
820
|
+
else if (e[n] === "A" && _(e, "NY", n))
|
|
821
|
+
n += 2;
|
|
822
|
+
else if (e[n] === "(") {
|
|
823
|
+
for (n++; n < e.length && e[n] !== ")"; )
|
|
824
|
+
r += e[n], n++;
|
|
825
|
+
if (e[n] !== ")")
|
|
826
|
+
throw new Error("Unterminated content model");
|
|
827
|
+
} else if (!this.suppressValidationErr)
|
|
828
|
+
throw new Error(`Invalid Element Expression, found "${e[n]}"`);
|
|
829
|
+
return {
|
|
830
|
+
elementName: s,
|
|
831
|
+
contentModel: r.trim(),
|
|
832
|
+
index: n
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
readAttlistExp(e, n) {
|
|
836
|
+
n = E(e, n);
|
|
837
|
+
let s = "";
|
|
838
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
839
|
+
s += e[n], n++;
|
|
840
|
+
C(s), n = E(e, n);
|
|
841
|
+
let r = "";
|
|
842
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
843
|
+
r += e[n], n++;
|
|
844
|
+
if (!C(r))
|
|
845
|
+
throw new Error(`Invalid attribute name: "${r}"`);
|
|
846
|
+
n = E(e, n);
|
|
847
|
+
let o = "";
|
|
848
|
+
if (e.substring(n, n + 8).toUpperCase() === "NOTATION") {
|
|
849
|
+
if (o = "NOTATION", n += 8, n = E(e, n), e[n] !== "(")
|
|
850
|
+
throw new Error(`Expected '(', found "${e[n]}"`);
|
|
851
|
+
n++;
|
|
852
|
+
let c = [];
|
|
853
|
+
for (; n < e.length && e[n] !== ")"; ) {
|
|
854
|
+
let u = "";
|
|
855
|
+
for (; n < e.length && e[n] !== "|" && e[n] !== ")"; )
|
|
856
|
+
u += e[n], n++;
|
|
857
|
+
if (u = u.trim(), !C(u))
|
|
858
|
+
throw new Error(`Invalid notation name: "${u}"`);
|
|
859
|
+
c.push(u), e[n] === "|" && (n++, n = E(e, n));
|
|
860
|
+
}
|
|
861
|
+
if (e[n] !== ")")
|
|
862
|
+
throw new Error("Unterminated list of notations");
|
|
863
|
+
n++, o += " (" + c.join("|") + ")";
|
|
864
|
+
} else {
|
|
865
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
866
|
+
o += e[n], n++;
|
|
867
|
+
const c = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
868
|
+
if (!this.suppressValidationErr && !c.includes(o.toUpperCase()))
|
|
869
|
+
throw new Error(`Invalid attribute type: "${o}"`);
|
|
870
|
+
}
|
|
871
|
+
n = E(e, n);
|
|
872
|
+
let a = "";
|
|
873
|
+
return e.substring(n, n + 8).toUpperCase() === "#REQUIRED" ? (a = "#REQUIRED", n += 8) : e.substring(n, n + 7).toUpperCase() === "#IMPLIED" ? (a = "#IMPLIED", n += 7) : [n, a] = this.readIdentifierVal(e, n, "ATTLIST"), {
|
|
874
|
+
elementName: s,
|
|
875
|
+
attributeName: r,
|
|
876
|
+
attributeType: o,
|
|
877
|
+
defaultValue: a,
|
|
878
|
+
index: n
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
const E = (t, e) => {
|
|
883
|
+
for (; e < t.length && /\s/.test(t[e]); )
|
|
884
|
+
e++;
|
|
885
|
+
return e;
|
|
886
|
+
};
|
|
887
|
+
function _(t, e, n) {
|
|
888
|
+
for (let s = 0; s < e.length; s++)
|
|
889
|
+
if (e[s] !== t[n + s + 1]) return !1;
|
|
890
|
+
return !0;
|
|
706
891
|
}
|
|
707
|
-
function
|
|
708
|
-
if (
|
|
709
|
-
return
|
|
710
|
-
throw new Error(`Invalid entity name ${
|
|
892
|
+
function C(t) {
|
|
893
|
+
if (Q.isName(t))
|
|
894
|
+
return t;
|
|
895
|
+
throw new Error(`Invalid entity name ${t}`);
|
|
711
896
|
}
|
|
712
|
-
var
|
|
713
|
-
const
|
|
714
|
-
!Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt);
|
|
715
|
-
!Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
|
|
716
|
-
const Ee = {
|
|
897
|
+
var Se = Te;
|
|
898
|
+
const Ie = /^[-+]?0x[a-fA-F0-9]+$/, Oe = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, Ce = {
|
|
717
899
|
hex: !0,
|
|
900
|
+
// oct: false,
|
|
718
901
|
leadingZeros: !0,
|
|
719
902
|
decimalPoint: ".",
|
|
720
903
|
eNotation: !0
|
|
721
904
|
//skipLike: /regex/
|
|
722
905
|
};
|
|
723
|
-
function
|
|
724
|
-
if (
|
|
725
|
-
let n =
|
|
726
|
-
if (
|
|
727
|
-
if (t
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
if (!
|
|
736
|
-
|
|
906
|
+
function Pe(t, e = {}) {
|
|
907
|
+
if (e = Object.assign({}, Ce, e), !t || typeof t != "string") return t;
|
|
908
|
+
let n = t.trim();
|
|
909
|
+
if (e.skipLike !== void 0 && e.skipLike.test(n)) return t;
|
|
910
|
+
if (t === "0") return 0;
|
|
911
|
+
if (e.hex && Ie.test(n))
|
|
912
|
+
return Me(n, 16);
|
|
913
|
+
if (n.search(/[eE]/) !== -1) {
|
|
914
|
+
const s = n.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
|
|
915
|
+
if (s) {
|
|
916
|
+
if (e.leadingZeros)
|
|
917
|
+
n = (s[1] || "") + s[3];
|
|
918
|
+
else if (!(s[2] === "0" && s[3][0] === ".")) return t;
|
|
919
|
+
return e.eNotation ? Number(n) : t;
|
|
920
|
+
} else
|
|
921
|
+
return t;
|
|
922
|
+
} else {
|
|
923
|
+
const s = Oe.exec(n);
|
|
924
|
+
if (s) {
|
|
925
|
+
const r = s[1], o = s[2];
|
|
926
|
+
let a = Le(s[3]);
|
|
927
|
+
if (!e.leadingZeros && o.length > 0 && r && n[2] !== ".") return t;
|
|
928
|
+
if (!e.leadingZeros && o.length > 0 && !r && n[1] !== ".") return t;
|
|
929
|
+
if (e.leadingZeros && o === t) return 0;
|
|
737
930
|
{
|
|
738
|
-
const
|
|
739
|
-
return
|
|
931
|
+
const c = Number(n), u = "" + c;
|
|
932
|
+
return u.search(/[eE]/) !== -1 ? e.eNotation ? c : t : n.indexOf(".") !== -1 ? u === "0" && a === "" || u === a || r && u === "-" + a ? c : t : o ? a === u || r + a === u ? c : t : n === u || n === r + u ? c : t;
|
|
740
933
|
}
|
|
741
934
|
} else
|
|
742
|
-
return
|
|
935
|
+
return t;
|
|
743
936
|
}
|
|
744
937
|
}
|
|
745
|
-
function
|
|
746
|
-
return
|
|
938
|
+
function Le(t) {
|
|
939
|
+
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;
|
|
747
940
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
941
|
+
function Me(t, e) {
|
|
942
|
+
if (parseInt) return parseInt(t, e);
|
|
943
|
+
if (Number.parseInt) return Number.parseInt(t, e);
|
|
944
|
+
if (window && window.parseInt) return window.parseInt(t, e);
|
|
945
|
+
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
946
|
+
}
|
|
947
|
+
var je = Pe;
|
|
948
|
+
function ve(t) {
|
|
949
|
+
return typeof t == "function" ? t : Array.isArray(t) ? (e) => {
|
|
950
|
+
for (const n of t)
|
|
951
|
+
if (typeof n == "string" && e === n || n instanceof RegExp && n.test(e))
|
|
753
952
|
return !0;
|
|
754
953
|
} : () => !1;
|
|
755
954
|
}
|
|
756
|
-
var
|
|
757
|
-
const
|
|
758
|
-
let
|
|
759
|
-
constructor(
|
|
760
|
-
this.options =
|
|
955
|
+
var D = ve;
|
|
956
|
+
const L = P, I = _e, Ve = Se, $e = je, Fe = D;
|
|
957
|
+
let Re = class {
|
|
958
|
+
constructor(e) {
|
|
959
|
+
if (this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
761
960
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
762
961
|
gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
763
962
|
lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
@@ -776,423 +975,482 @@ let ve = class {
|
|
|
776
975
|
copyright: { regex: /&(copy|#169);/g, val: "©" },
|
|
777
976
|
reg: { regex: /&(reg|#174);/g, val: "®" },
|
|
778
977
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
779
|
-
num_dec: { regex: /&#([0-9]{1,7});/g, val: (n,
|
|
780
|
-
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (n,
|
|
781
|
-
}, this.addExternalEntities =
|
|
978
|
+
num_dec: { regex: /&#([0-9]{1,7});/g, val: (n, s) => Y(s, 10, "&#") },
|
|
979
|
+
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (n, s) => Y(s, 16, "&#x") }
|
|
980
|
+
}, this.addExternalEntities = Xe, this.parseXml = Ye, this.parseTextData = Be, this.resolveNameSpace = Ue, this.buildAttributesMap = Ge, this.isItStopNode = Ze, this.replaceEntitiesValue = Je, this.readStopNodeData = We, this.saveTextToParentTag = ze, this.addChild = Ke, this.ignoreAttributesFn = Fe(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
981
|
+
this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
|
|
982
|
+
for (let n = 0; n < this.options.stopNodes.length; n++) {
|
|
983
|
+
const s = this.options.stopNodes[n];
|
|
984
|
+
typeof s == "string" && (s.startsWith("*.") ? this.stopNodesWildcard.add(s.substring(2)) : this.stopNodesExact.add(s));
|
|
985
|
+
}
|
|
986
|
+
}
|
|
782
987
|
}
|
|
783
988
|
};
|
|
784
|
-
function
|
|
785
|
-
const
|
|
786
|
-
for (let n = 0; n <
|
|
787
|
-
const
|
|
788
|
-
this.lastEntities[
|
|
789
|
-
regex: new RegExp("&" +
|
|
790
|
-
val:
|
|
989
|
+
function Xe(t) {
|
|
990
|
+
const e = Object.keys(t);
|
|
991
|
+
for (let n = 0; n < e.length; n++) {
|
|
992
|
+
const s = e[n], r = s.replace(/[.\-+*:]/g, "\\.");
|
|
993
|
+
this.lastEntities[s] = {
|
|
994
|
+
regex: new RegExp("&" + r + ";", "g"),
|
|
995
|
+
val: t[s]
|
|
791
996
|
};
|
|
792
997
|
}
|
|
793
998
|
}
|
|
794
|
-
function
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
const
|
|
798
|
-
return
|
|
999
|
+
function Be(t, e, n, s, r, o, a) {
|
|
1000
|
+
if (t !== void 0 && (this.options.trimValues && !s && (t = t.trim()), t.length > 0)) {
|
|
1001
|
+
a || (t = this.replaceEntitiesValue(t, e, n));
|
|
1002
|
+
const c = this.options.tagValueProcessor(e, t, n, r, o);
|
|
1003
|
+
return c == null ? t : typeof c != typeof t || c !== t ? c : this.options.trimValues ? v(t, this.options.parseTagValue, this.options.numberParseOptions) : t.trim() === t ? v(t, this.options.parseTagValue, this.options.numberParseOptions) : t;
|
|
799
1004
|
}
|
|
800
1005
|
}
|
|
801
|
-
function
|
|
1006
|
+
function Ue(t) {
|
|
802
1007
|
if (this.options.removeNSPrefix) {
|
|
803
|
-
const
|
|
804
|
-
if (
|
|
1008
|
+
const e = t.split(":"), n = t.charAt(0) === "/" ? "/" : "";
|
|
1009
|
+
if (e[0] === "xmlns")
|
|
805
1010
|
return "";
|
|
806
|
-
|
|
1011
|
+
e.length === 2 && (t = n + e[1]);
|
|
807
1012
|
}
|
|
808
|
-
return
|
|
1013
|
+
return t;
|
|
809
1014
|
}
|
|
810
|
-
const
|
|
811
|
-
function
|
|
812
|
-
if (this.options.ignoreAttributes !== !0 && typeof
|
|
813
|
-
const
|
|
814
|
-
for (let
|
|
815
|
-
const
|
|
816
|
-
if (this.ignoreAttributesFn(
|
|
1015
|
+
const ke = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1016
|
+
function Ge(t, e, n) {
|
|
1017
|
+
if (this.options.ignoreAttributes !== !0 && typeof t == "string") {
|
|
1018
|
+
const s = L.getAllMatches(t, ke), r = s.length, o = {};
|
|
1019
|
+
for (let a = 0; a < r; a++) {
|
|
1020
|
+
const c = this.resolveNameSpace(s[a][1]);
|
|
1021
|
+
if (this.ignoreAttributesFn(c, e))
|
|
817
1022
|
continue;
|
|
818
|
-
let
|
|
819
|
-
if (
|
|
820
|
-
if (this.options.transformAttributeName && (
|
|
821
|
-
this.options.trimValues && (
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
1023
|
+
let u = s[a][4], l = this.options.attributeNamePrefix + c;
|
|
1024
|
+
if (c.length)
|
|
1025
|
+
if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l = He(l, this.options), u !== void 0) {
|
|
1026
|
+
this.options.trimValues && (u = u.trim()), u = this.replaceEntitiesValue(u, n, e);
|
|
1027
|
+
const f = this.options.attributeValueProcessor(c, u, e);
|
|
1028
|
+
f == null ? o[l] = u : typeof f != typeof u || f !== u ? o[l] = f : o[l] = v(
|
|
1029
|
+
u,
|
|
825
1030
|
this.options.parseAttributeValue,
|
|
826
1031
|
this.options.numberParseOptions
|
|
827
1032
|
);
|
|
828
|
-
} else this.options.allowBooleanAttributes && (
|
|
1033
|
+
} else this.options.allowBooleanAttributes && (o[l] = !0);
|
|
829
1034
|
}
|
|
830
|
-
if (!Object.keys(
|
|
1035
|
+
if (!Object.keys(o).length)
|
|
831
1036
|
return;
|
|
832
1037
|
if (this.options.attributesGroupName) {
|
|
833
|
-
const
|
|
834
|
-
return
|
|
1038
|
+
const a = {};
|
|
1039
|
+
return a[this.options.attributesGroupName] = o, a;
|
|
835
1040
|
}
|
|
836
|
-
return
|
|
1041
|
+
return o;
|
|
837
1042
|
}
|
|
838
1043
|
}
|
|
839
|
-
const
|
|
840
|
-
|
|
1044
|
+
const Ye = function(t) {
|
|
1045
|
+
t = t.replace(/\r\n?/g, `
|
|
841
1046
|
`);
|
|
842
|
-
const
|
|
843
|
-
let n =
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
1047
|
+
const e = new I("!xml");
|
|
1048
|
+
let n = e, s = "", r = "";
|
|
1049
|
+
this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
1050
|
+
const o = new Ve(this.options.processEntities);
|
|
1051
|
+
for (let a = 0; a < t.length; a++)
|
|
1052
|
+
if (t[a] === "<")
|
|
1053
|
+
if (t[a + 1] === "/") {
|
|
1054
|
+
const u = T(t, ">", a, "Closing Tag is not closed.");
|
|
1055
|
+
let l = t.substring(a + 2, u).trim();
|
|
849
1056
|
if (this.options.removeNSPrefix) {
|
|
850
|
-
const
|
|
851
|
-
|
|
1057
|
+
const h = l.indexOf(":");
|
|
1058
|
+
h !== -1 && (l = l.substr(h + 1));
|
|
852
1059
|
}
|
|
853
|
-
this.options.transformTagName && (
|
|
854
|
-
const f =
|
|
855
|
-
if (
|
|
856
|
-
throw new Error(`Unpaired tag can not be used as closing tag: </${
|
|
857
|
-
let
|
|
858
|
-
f && this.options.unpairedTags.indexOf(f) !== -1 ? (
|
|
859
|
-
} else if (
|
|
860
|
-
let u =
|
|
1060
|
+
this.options.transformTagName && (l = this.options.transformTagName(l)), n && (s = this.saveTextToParentTag(s, n, r));
|
|
1061
|
+
const f = r.substring(r.lastIndexOf(".") + 1);
|
|
1062
|
+
if (l && this.options.unpairedTags.indexOf(l) !== -1)
|
|
1063
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
|
|
1064
|
+
let d = 0;
|
|
1065
|
+
f && this.options.unpairedTags.indexOf(f) !== -1 ? (d = r.lastIndexOf(".", r.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : d = r.lastIndexOf("."), r = r.substring(0, d), n = this.tagsNodeStack.pop(), s = "", a = u;
|
|
1066
|
+
} else if (t[a + 1] === "?") {
|
|
1067
|
+
let u = j(t, a, !1, "?>");
|
|
861
1068
|
if (!u) throw new Error("Pi Tag is not closed.");
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
|
|
1069
|
+
if (s = this.saveTextToParentTag(s, n, r), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
1070
|
+
const l = new I(u.tagName);
|
|
1071
|
+
l.add(this.options.textNodeName, ""), u.tagName !== u.tagExp && u.attrExpPresent && (l[":@"] = this.buildAttributesMap(u.tagExp, r, u.tagName)), this.addChild(n, l, r, a);
|
|
865
1072
|
}
|
|
866
|
-
|
|
867
|
-
} else if (
|
|
868
|
-
const u =
|
|
1073
|
+
a = u.closeIndex + 1;
|
|
1074
|
+
} else if (t.substr(a + 1, 3) === "!--") {
|
|
1075
|
+
const u = T(t, "-->", a + 4, "Comment is not closed.");
|
|
869
1076
|
if (this.options.commentPropName) {
|
|
870
|
-
const
|
|
871
|
-
|
|
1077
|
+
const l = t.substring(a + 4, u - 2);
|
|
1078
|
+
s = this.saveTextToParentTag(s, n, r), n.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
|
|
872
1079
|
}
|
|
873
|
-
|
|
874
|
-
} else if (
|
|
875
|
-
const u =
|
|
876
|
-
this.docTypeEntities = u.entities,
|
|
877
|
-
} else if (
|
|
878
|
-
const u =
|
|
879
|
-
|
|
880
|
-
let f = this.parseTextData(
|
|
881
|
-
f == null && (f = ""), this.options.cdataPropName ? n.add(this.options.cdataPropName, [{ [this.options.textNodeName]:
|
|
1080
|
+
a = u;
|
|
1081
|
+
} else if (t.substr(a + 1, 2) === "!D") {
|
|
1082
|
+
const u = o.readDocType(t, a);
|
|
1083
|
+
this.docTypeEntities = u.entities, a = u.i;
|
|
1084
|
+
} else if (t.substr(a + 1, 2) === "![") {
|
|
1085
|
+
const u = T(t, "]]>", a, "CDATA is not closed.") - 2, l = t.substring(a + 9, u);
|
|
1086
|
+
s = this.saveTextToParentTag(s, n, r);
|
|
1087
|
+
let f = this.parseTextData(l, n.tagname, r, !0, !1, !0, !0);
|
|
1088
|
+
f == null && (f = ""), this.options.cdataPropName ? n.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : n.add(this.options.textNodeName, f), a = u + 2;
|
|
882
1089
|
} else {
|
|
883
|
-
let u =
|
|
1090
|
+
let u = j(t, a, this.options.removeNSPrefix), l = u.tagName;
|
|
884
1091
|
const f = u.rawTagName;
|
|
885
|
-
let
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1092
|
+
let d = u.tagExp, h = u.attrExpPresent, m = u.closeIndex;
|
|
1093
|
+
if (this.options.transformTagName) {
|
|
1094
|
+
const g = this.options.transformTagName(l);
|
|
1095
|
+
d === l && (d = g), l = g;
|
|
1096
|
+
}
|
|
1097
|
+
if (this.options.strictReservedNames && (l === this.options.commentPropName || l === this.options.cdataPropName || l === this.options.textNodeName || l === this.options.attributesGroupName))
|
|
1098
|
+
throw new Error(`Invalid tag name: ${l}`);
|
|
1099
|
+
n && s && n.tagname !== "!xml" && (s = this.saveTextToParentTag(s, n, r, !1));
|
|
1100
|
+
const b = n;
|
|
1101
|
+
b && this.options.unpairedTags.indexOf(b.tagname) !== -1 && (n = this.tagsNodeStack.pop(), r = r.substring(0, r.lastIndexOf("."))), l !== e.tagname && (r += r ? "." + l : l);
|
|
1102
|
+
const y = a;
|
|
1103
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, r, l)) {
|
|
1104
|
+
let g = "";
|
|
1105
|
+
if (d.length > 0 && d.lastIndexOf("/") === d.length - 1)
|
|
1106
|
+
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), r = r.substr(0, r.length - 1), d = l) : d = d.substr(0, d.length - 1), a = u.closeIndex;
|
|
1107
|
+
else if (this.options.unpairedTags.indexOf(l) !== -1)
|
|
1108
|
+
a = u.closeIndex;
|
|
894
1109
|
else {
|
|
895
|
-
const
|
|
896
|
-
if (!
|
|
897
|
-
|
|
1110
|
+
const M = this.readStopNodeData(t, f, m + 1);
|
|
1111
|
+
if (!M) throw new Error(`Unexpected end of ${f}`);
|
|
1112
|
+
a = M.i, g = M.tagContent;
|
|
898
1113
|
}
|
|
899
|
-
const
|
|
900
|
-
|
|
1114
|
+
const S = new I(l);
|
|
1115
|
+
l !== d && h && (S[":@"] = this.buildAttributesMap(d, r, l)), g && (g = this.parseTextData(g, l, r, !0, h, !0, !0)), r = r.substr(0, r.lastIndexOf(".")), S.add(this.options.textNodeName, g), this.addChild(n, S, r, y);
|
|
901
1116
|
} else {
|
|
902
|
-
if (
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1117
|
+
if (d.length > 0 && d.lastIndexOf("/") === d.length - 1) {
|
|
1118
|
+
if (l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), r = r.substr(0, r.length - 1), d = l) : d = d.substr(0, d.length - 1), this.options.transformTagName) {
|
|
1119
|
+
const S = this.options.transformTagName(l);
|
|
1120
|
+
d === l && (d = S), l = S;
|
|
1121
|
+
}
|
|
1122
|
+
const g = new I(l);
|
|
1123
|
+
l !== d && h && (g[":@"] = this.buildAttributesMap(d, r, l)), this.addChild(n, g, r, y), r = r.substr(0, r.lastIndexOf("."));
|
|
1124
|
+
} else if (this.options.unpairedTags.indexOf(l) !== -1) {
|
|
1125
|
+
const g = new I(l);
|
|
1126
|
+
l !== d && h && (g[":@"] = this.buildAttributesMap(d, r)), this.addChild(n, g, r, y), r = r.substr(0, r.lastIndexOf(".")), a = u.closeIndex;
|
|
1127
|
+
continue;
|
|
906
1128
|
} else {
|
|
907
|
-
const
|
|
908
|
-
this.tagsNodeStack.
|
|
1129
|
+
const g = new I(l);
|
|
1130
|
+
if (this.tagsNodeStack.length > this.options.maxNestedTags)
|
|
1131
|
+
throw new Error("Maximum nested tags exceeded");
|
|
1132
|
+
this.tagsNodeStack.push(n), l !== d && h && (g[":@"] = this.buildAttributesMap(d, r, l)), this.addChild(n, g, r), n = g;
|
|
909
1133
|
}
|
|
910
|
-
|
|
1134
|
+
s = "", a = m;
|
|
911
1135
|
}
|
|
912
1136
|
}
|
|
913
1137
|
else
|
|
914
|
-
|
|
915
|
-
return
|
|
1138
|
+
s += t[a];
|
|
1139
|
+
return e.child;
|
|
916
1140
|
};
|
|
917
|
-
function
|
|
918
|
-
|
|
919
|
-
|
|
1141
|
+
function Ke(t, e, n, s) {
|
|
1142
|
+
this.options.captureMetaData || (s = void 0);
|
|
1143
|
+
const r = this.options.updateTag(e.tagname, n, e[":@"]);
|
|
1144
|
+
r === !1 || (typeof r == "string" && (e.tagname = r), t.addChild(e, s));
|
|
920
1145
|
}
|
|
921
|
-
const
|
|
922
|
-
if (
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1146
|
+
const Je = function(t, e, n) {
|
|
1147
|
+
if (t.indexOf("&") === -1)
|
|
1148
|
+
return t;
|
|
1149
|
+
const s = this.options.processEntities;
|
|
1150
|
+
if (!s.enabled || s.allowedTags && !s.allowedTags.includes(e) || s.tagFilter && !s.tagFilter(e, n))
|
|
1151
|
+
return t;
|
|
1152
|
+
for (let r in this.docTypeEntities) {
|
|
1153
|
+
const o = this.docTypeEntities[r], a = t.match(o.regx);
|
|
1154
|
+
if (a) {
|
|
1155
|
+
if (this.entityExpansionCount += a.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions)
|
|
1156
|
+
throw new Error(
|
|
1157
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1158
|
+
);
|
|
1159
|
+
const c = t.length;
|
|
1160
|
+
if (t = t.replace(o.regx, o.val), s.maxExpandedLength && (this.currentExpandedLength += t.length - c, this.currentExpandedLength > s.maxExpandedLength))
|
|
1161
|
+
throw new Error(
|
|
1162
|
+
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${s.maxExpandedLength}`
|
|
1163
|
+
);
|
|
930
1164
|
}
|
|
931
|
-
if (this.options.htmlEntities)
|
|
932
|
-
for (let t in this.htmlEntities) {
|
|
933
|
-
const n = this.htmlEntities[t];
|
|
934
|
-
e = e.replace(n.regex, n.val);
|
|
935
|
-
}
|
|
936
|
-
e = e.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
937
1165
|
}
|
|
938
|
-
return
|
|
1166
|
+
if (t.indexOf("&") === -1) return t;
|
|
1167
|
+
for (const r of Object.keys(this.lastEntities)) {
|
|
1168
|
+
const o = this.lastEntities[r], a = t.match(o.regex);
|
|
1169
|
+
if (a && (this.entityExpansionCount += a.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions))
|
|
1170
|
+
throw new Error(
|
|
1171
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1172
|
+
);
|
|
1173
|
+
t = t.replace(o.regex, o.val);
|
|
1174
|
+
}
|
|
1175
|
+
if (t.indexOf("&") === -1) return t;
|
|
1176
|
+
if (this.options.htmlEntities)
|
|
1177
|
+
for (const r of Object.keys(this.htmlEntities)) {
|
|
1178
|
+
const o = this.htmlEntities[r], a = t.match(o.regex);
|
|
1179
|
+
if (a && (this.entityExpansionCount += a.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions))
|
|
1180
|
+
throw new Error(
|
|
1181
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1182
|
+
);
|
|
1183
|
+
t = t.replace(o.regex, o.val);
|
|
1184
|
+
}
|
|
1185
|
+
return t = t.replace(this.ampEntity.regex, this.ampEntity.val), t;
|
|
939
1186
|
};
|
|
940
|
-
function
|
|
941
|
-
return
|
|
942
|
-
|
|
943
|
-
|
|
1187
|
+
function ze(t, e, n, s) {
|
|
1188
|
+
return t && (s === void 0 && (s = e.child.length === 0), t = this.parseTextData(
|
|
1189
|
+
t,
|
|
1190
|
+
e.tagname,
|
|
944
1191
|
n,
|
|
945
1192
|
!1,
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
),
|
|
1193
|
+
e[":@"] ? Object.keys(e[":@"]).length !== 0 : !1,
|
|
1194
|
+
s
|
|
1195
|
+
), t !== void 0 && t !== "" && e.add(this.options.textNodeName, t), t = ""), t;
|
|
949
1196
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
952
|
-
for (const i in e) {
|
|
953
|
-
const r = e[i];
|
|
954
|
-
if (o === r || t === r) return !0;
|
|
955
|
-
}
|
|
956
|
-
return !1;
|
|
1197
|
+
function Ze(t, e, n, s) {
|
|
1198
|
+
return !!(e && e.has(s) || t && t.has(n));
|
|
957
1199
|
}
|
|
958
|
-
function
|
|
959
|
-
let
|
|
960
|
-
for (let
|
|
961
|
-
let
|
|
962
|
-
if (
|
|
963
|
-
|
|
964
|
-
else if (
|
|
965
|
-
|
|
966
|
-
else if (
|
|
1200
|
+
function qe(t, e, n = ">") {
|
|
1201
|
+
let s, r = "";
|
|
1202
|
+
for (let o = e; o < t.length; o++) {
|
|
1203
|
+
let a = t[o];
|
|
1204
|
+
if (s)
|
|
1205
|
+
a === s && (s = "");
|
|
1206
|
+
else if (a === '"' || a === "'")
|
|
1207
|
+
s = a;
|
|
1208
|
+
else if (a === n[0])
|
|
967
1209
|
if (n[1]) {
|
|
968
|
-
if (
|
|
1210
|
+
if (t[o + 1] === n[1])
|
|
969
1211
|
return {
|
|
970
|
-
data:
|
|
971
|
-
index:
|
|
1212
|
+
data: r,
|
|
1213
|
+
index: o
|
|
972
1214
|
};
|
|
973
1215
|
} else
|
|
974
1216
|
return {
|
|
975
|
-
data:
|
|
976
|
-
index:
|
|
1217
|
+
data: r,
|
|
1218
|
+
index: o
|
|
977
1219
|
};
|
|
978
|
-
else
|
|
979
|
-
|
|
1220
|
+
else a === " " && (a = " ");
|
|
1221
|
+
r += a;
|
|
980
1222
|
}
|
|
981
1223
|
}
|
|
982
|
-
function
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
throw new Error(
|
|
986
|
-
return
|
|
1224
|
+
function T(t, e, n, s) {
|
|
1225
|
+
const r = t.indexOf(e, n);
|
|
1226
|
+
if (r === -1)
|
|
1227
|
+
throw new Error(s);
|
|
1228
|
+
return r + e.length - 1;
|
|
987
1229
|
}
|
|
988
|
-
function
|
|
989
|
-
const
|
|
990
|
-
if (!
|
|
991
|
-
let
|
|
992
|
-
const
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
-
const
|
|
1230
|
+
function j(t, e, n, s = ">") {
|
|
1231
|
+
const r = qe(t, e + 1, s);
|
|
1232
|
+
if (!r) return;
|
|
1233
|
+
let o = r.data;
|
|
1234
|
+
const a = r.index, c = o.search(/\s/);
|
|
1235
|
+
let u = o, l = !0;
|
|
1236
|
+
c !== -1 && (u = o.substring(0, c), o = o.substring(c + 1).trimStart());
|
|
1237
|
+
const f = u;
|
|
996
1238
|
if (n) {
|
|
997
|
-
const d =
|
|
998
|
-
d !== -1 && (
|
|
1239
|
+
const d = u.indexOf(":");
|
|
1240
|
+
d !== -1 && (u = u.substr(d + 1), l = u !== r.data.substr(d + 1));
|
|
999
1241
|
}
|
|
1000
1242
|
return {
|
|
1001
|
-
tagName:
|
|
1002
|
-
tagExp:
|
|
1003
|
-
closeIndex:
|
|
1004
|
-
attrExpPresent:
|
|
1005
|
-
rawTagName:
|
|
1243
|
+
tagName: u,
|
|
1244
|
+
tagExp: o,
|
|
1245
|
+
closeIndex: a,
|
|
1246
|
+
attrExpPresent: l,
|
|
1247
|
+
rawTagName: f
|
|
1006
1248
|
};
|
|
1007
1249
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const
|
|
1010
|
-
let
|
|
1011
|
-
for (; n <
|
|
1012
|
-
if (
|
|
1013
|
-
if (
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1250
|
+
function We(t, e, n) {
|
|
1251
|
+
const s = n;
|
|
1252
|
+
let r = 1;
|
|
1253
|
+
for (; n < t.length; n++)
|
|
1254
|
+
if (t[n] === "<")
|
|
1255
|
+
if (t[n + 1] === "/") {
|
|
1256
|
+
const o = T(t, ">", n, `${e} is not closed`);
|
|
1257
|
+
if (t.substring(n + 2, o).trim() === e && (r--, r === 0))
|
|
1016
1258
|
return {
|
|
1017
|
-
tagContent:
|
|
1018
|
-
i:
|
|
1259
|
+
tagContent: t.substring(s, n),
|
|
1260
|
+
i: o
|
|
1019
1261
|
};
|
|
1020
|
-
n =
|
|
1021
|
-
} else if (
|
|
1022
|
-
n =
|
|
1023
|
-
else if (
|
|
1024
|
-
n =
|
|
1025
|
-
else if (
|
|
1026
|
-
n =
|
|
1262
|
+
n = o;
|
|
1263
|
+
} else if (t[n + 1] === "?")
|
|
1264
|
+
n = T(t, "?>", n + 1, "StopNode is not closed.");
|
|
1265
|
+
else if (t.substr(n + 1, 3) === "!--")
|
|
1266
|
+
n = T(t, "-->", n + 3, "StopNode is not closed.");
|
|
1267
|
+
else if (t.substr(n + 1, 2) === "![")
|
|
1268
|
+
n = T(t, "]]>", n, "StopNode is not closed.") - 2;
|
|
1027
1269
|
else {
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1270
|
+
const o = j(t, n, ">");
|
|
1271
|
+
o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && r++, n = o.closeIndex);
|
|
1030
1272
|
}
|
|
1031
1273
|
}
|
|
1032
|
-
function
|
|
1033
|
-
if (
|
|
1034
|
-
const
|
|
1035
|
-
return
|
|
1274
|
+
function v(t, e, n) {
|
|
1275
|
+
if (e && typeof t == "string") {
|
|
1276
|
+
const s = t.trim();
|
|
1277
|
+
return s === "true" ? !0 : s === "false" ? !1 : $e(t, n);
|
|
1036
1278
|
} else
|
|
1037
|
-
return
|
|
1279
|
+
return L.isExist(t) ? t : "";
|
|
1038
1280
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
return
|
|
1281
|
+
function Y(t, e, n) {
|
|
1282
|
+
const s = Number.parseInt(t, e);
|
|
1283
|
+
return s >= 0 && s <= 1114111 ? String.fromCodePoint(s) : n + t + ";";
|
|
1042
1284
|
}
|
|
1043
|
-
function
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1285
|
+
function He(t, e) {
|
|
1286
|
+
if (L.criticalProperties.includes(t))
|
|
1287
|
+
throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
1288
|
+
return L.DANGEROUS_PROPERTY_NAMES.includes(t) ? e.onDangerousProperty(t) : t;
|
|
1289
|
+
}
|
|
1290
|
+
var Qe = Re, ee = {};
|
|
1291
|
+
function De(t, e) {
|
|
1292
|
+
return te(t, e);
|
|
1293
|
+
}
|
|
1294
|
+
function te(t, e, n) {
|
|
1295
|
+
let s;
|
|
1296
|
+
const r = {};
|
|
1297
|
+
for (let o = 0; o < t.length; o++) {
|
|
1298
|
+
const a = t[o], c = et(a);
|
|
1299
|
+
let u = "";
|
|
1300
|
+
if (n === void 0 ? u = c : u = n + "." + c, c === e.textNodeName)
|
|
1301
|
+
s === void 0 ? s = a[c] : s += "" + a[c];
|
|
1051
1302
|
else {
|
|
1052
|
-
if (
|
|
1303
|
+
if (c === void 0)
|
|
1053
1304
|
continue;
|
|
1054
|
-
if (
|
|
1055
|
-
let
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1305
|
+
if (a[c]) {
|
|
1306
|
+
let l = te(a[c], e, u);
|
|
1307
|
+
const f = nt(l, e);
|
|
1308
|
+
a[":@"] ? tt(l, a[":@"], u, e) : Object.keys(l).length === 1 && l[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? l = l[e.textNodeName] : Object.keys(l).length === 0 && (e.alwaysCreateTextNode ? l[e.textNodeName] = "" : l = ""), r[c] !== void 0 && r.hasOwnProperty(c) ? (Array.isArray(r[c]) || (r[c] = [r[c]]), r[c].push(l)) : e.isArray(c, u, f) ? r[c] = [l] : r[c] = l;
|
|
1058
1309
|
}
|
|
1059
1310
|
}
|
|
1060
1311
|
}
|
|
1061
|
-
return typeof
|
|
1312
|
+
return typeof s == "string" ? s.length > 0 && (r[e.textNodeName] = s) : s !== void 0 && (r[e.textNodeName] = s), r;
|
|
1062
1313
|
}
|
|
1063
|
-
function
|
|
1064
|
-
const
|
|
1065
|
-
for (let n = 0; n <
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1314
|
+
function et(t) {
|
|
1315
|
+
const e = Object.keys(t);
|
|
1316
|
+
for (let n = 0; n < e.length; n++) {
|
|
1317
|
+
const s = e[n];
|
|
1318
|
+
if (s !== ":@") return s;
|
|
1068
1319
|
}
|
|
1069
1320
|
}
|
|
1070
|
-
function
|
|
1071
|
-
if (
|
|
1072
|
-
const
|
|
1073
|
-
for (let
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1321
|
+
function tt(t, e, n, s) {
|
|
1322
|
+
if (e) {
|
|
1323
|
+
const r = Object.keys(e), o = r.length;
|
|
1324
|
+
for (let a = 0; a < o; a++) {
|
|
1325
|
+
const c = r[a];
|
|
1326
|
+
s.isArray(c, n + "." + c, !0, !0) ? t[c] = [e[c]] : t[c] = e[c];
|
|
1076
1327
|
}
|
|
1077
1328
|
}
|
|
1078
1329
|
}
|
|
1079
|
-
function
|
|
1080
|
-
const { textNodeName: n } =
|
|
1081
|
-
return !!(
|
|
1330
|
+
function nt(t, e) {
|
|
1331
|
+
const { textNodeName: n } = e, s = Object.keys(t).length;
|
|
1332
|
+
return !!(s === 0 || s === 1 && (t[n] || typeof t[n] == "boolean" || t[n] === 0));
|
|
1082
1333
|
}
|
|
1083
|
-
|
|
1084
|
-
const { buildOptions:
|
|
1085
|
-
let
|
|
1086
|
-
constructor(
|
|
1087
|
-
this.externalEntities = {}, this.options =
|
|
1334
|
+
ee.prettify = De;
|
|
1335
|
+
const { buildOptions: st } = F, rt = Qe, { prettify: it } = ee, ot = z;
|
|
1336
|
+
let at = class {
|
|
1337
|
+
constructor(e) {
|
|
1338
|
+
this.externalEntities = {}, this.options = st(e);
|
|
1088
1339
|
}
|
|
1089
1340
|
/**
|
|
1090
1341
|
* Parse XML dats to JS object
|
|
1091
1342
|
* @param {string|Buffer} xmlData
|
|
1092
1343
|
* @param {boolean|Object} validationOption
|
|
1093
1344
|
*/
|
|
1094
|
-
parse(
|
|
1095
|
-
if (typeof
|
|
1096
|
-
|
|
1345
|
+
parse(e, n) {
|
|
1346
|
+
if (typeof e != "string") if (e.toString)
|
|
1347
|
+
e = e.toString();
|
|
1097
1348
|
else
|
|
1098
1349
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1099
1350
|
if (n) {
|
|
1100
1351
|
n === !0 && (n = {});
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1103
|
-
throw Error(`${
|
|
1352
|
+
const o = ot.validate(e, n);
|
|
1353
|
+
if (o !== !0)
|
|
1354
|
+
throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
|
|
1104
1355
|
}
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
return this.options.preserveOrder ||
|
|
1356
|
+
const s = new rt(this.options);
|
|
1357
|
+
s.addExternalEntities(this.externalEntities);
|
|
1358
|
+
const r = s.parseXml(e);
|
|
1359
|
+
return this.options.preserveOrder || r === void 0 ? r : it(r, this.options);
|
|
1109
1360
|
}
|
|
1110
1361
|
/**
|
|
1111
1362
|
* Add Entity which is not by default supported by this library
|
|
1112
1363
|
* @param {string} key
|
|
1113
1364
|
* @param {string} value
|
|
1114
1365
|
*/
|
|
1115
|
-
addEntity(
|
|
1366
|
+
addEntity(e, n) {
|
|
1116
1367
|
if (n.indexOf("&") !== -1)
|
|
1117
1368
|
throw new Error("Entity value can't have '&'");
|
|
1118
|
-
if (
|
|
1369
|
+
if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1)
|
|
1119
1370
|
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1120
1371
|
if (n === "&")
|
|
1121
1372
|
throw new Error("An entity with value '&' is not permitted");
|
|
1122
|
-
this.externalEntities[
|
|
1373
|
+
this.externalEntities[e] = n;
|
|
1123
1374
|
}
|
|
1124
1375
|
};
|
|
1125
|
-
var
|
|
1126
|
-
const
|
|
1376
|
+
var ut = at;
|
|
1377
|
+
const lt = `
|
|
1127
1378
|
`;
|
|
1128
|
-
function
|
|
1379
|
+
function ct(t, e) {
|
|
1129
1380
|
let n = "";
|
|
1130
|
-
return
|
|
1381
|
+
return e.format && e.indentBy.length > 0 && (n = lt), ne(t, e, "", n);
|
|
1131
1382
|
}
|
|
1132
|
-
function
|
|
1133
|
-
let
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1383
|
+
function ne(t, e, n, s) {
|
|
1384
|
+
let r = "", o = !1;
|
|
1385
|
+
if (!Array.isArray(t)) {
|
|
1386
|
+
if (t != null) {
|
|
1387
|
+
let a = t.toString();
|
|
1388
|
+
return a = V(a, e), a;
|
|
1389
|
+
}
|
|
1390
|
+
return "";
|
|
1391
|
+
}
|
|
1392
|
+
for (let a = 0; a < t.length; a++) {
|
|
1393
|
+
const c = t[a], u = dt(c);
|
|
1394
|
+
if (u === void 0) continue;
|
|
1395
|
+
let l = "";
|
|
1396
|
+
if (n.length === 0 ? l = u : l = `${n}.${u}`, u === e.textNodeName) {
|
|
1397
|
+
let b = c[u];
|
|
1398
|
+
ft(l, e) || (b = e.tagValueProcessor(u, b), b = V(b, e)), o && (r += s), r += b, o = !1;
|
|
1141
1399
|
continue;
|
|
1142
|
-
} else if (
|
|
1143
|
-
|
|
1400
|
+
} else if (u === e.cdataPropName) {
|
|
1401
|
+
o && (r += s), r += `<![CDATA[${c[u][0][e.textNodeName]}]]>`, o = !1;
|
|
1144
1402
|
continue;
|
|
1145
|
-
} else if (
|
|
1146
|
-
|
|
1403
|
+
} else if (u === e.commentPropName) {
|
|
1404
|
+
r += s + `<!--${c[u][0][e.textNodeName]}-->`, o = !0;
|
|
1147
1405
|
continue;
|
|
1148
|
-
} else if (
|
|
1149
|
-
const
|
|
1150
|
-
let
|
|
1151
|
-
|
|
1406
|
+
} else if (u[0] === "?") {
|
|
1407
|
+
const b = K(c[":@"], e), y = u === "?xml" ? "" : s;
|
|
1408
|
+
let g = c[u][0][e.textNodeName];
|
|
1409
|
+
g = g.length !== 0 ? " " + g : "", r += y + `<${u}${g}${b}?>`, o = !0;
|
|
1152
1410
|
continue;
|
|
1153
1411
|
}
|
|
1154
|
-
let
|
|
1155
|
-
|
|
1156
|
-
const d =
|
|
1157
|
-
|
|
1412
|
+
let f = s;
|
|
1413
|
+
f !== "" && (f += e.indentBy);
|
|
1414
|
+
const d = K(c[":@"], e), h = s + `<${u}${d}`, m = ne(c[u], e, l, f);
|
|
1415
|
+
e.unpairedTags.indexOf(u) !== -1 ? e.suppressUnpairedNode ? r += h + ">" : r += h + "/>" : (!m || m.length === 0) && e.suppressEmptyNode ? r += h + "/>" : m && m.endsWith(">") ? r += h + `>${m}${s}</${u}>` : (r += h + ">", m && s !== "" && (m.includes("/>") || m.includes("</")) ? r += s + e.indentBy + m + s : r += m, r += `</${u}>`), o = !0;
|
|
1158
1416
|
}
|
|
1159
|
-
return
|
|
1417
|
+
return r;
|
|
1160
1418
|
}
|
|
1161
|
-
function
|
|
1162
|
-
const
|
|
1163
|
-
for (let n = 0; n <
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1166
|
-
return
|
|
1419
|
+
function dt(t) {
|
|
1420
|
+
const e = Object.keys(t);
|
|
1421
|
+
for (let n = 0; n < e.length; n++) {
|
|
1422
|
+
const s = e[n];
|
|
1423
|
+
if (Object.prototype.hasOwnProperty.call(t, s) && s !== ":@")
|
|
1424
|
+
return s;
|
|
1167
1425
|
}
|
|
1168
1426
|
}
|
|
1169
|
-
function
|
|
1427
|
+
function K(t, e) {
|
|
1170
1428
|
let n = "";
|
|
1171
|
-
if (
|
|
1172
|
-
for (let
|
|
1173
|
-
if (!
|
|
1174
|
-
let
|
|
1175
|
-
|
|
1429
|
+
if (t && !e.ignoreAttributes)
|
|
1430
|
+
for (let s in t) {
|
|
1431
|
+
if (!Object.prototype.hasOwnProperty.call(t, s)) continue;
|
|
1432
|
+
let r = e.attributeValueProcessor(s, t[s]);
|
|
1433
|
+
r = V(r, e), r === !0 && e.suppressBooleanAttributes ? n += ` ${s.substr(e.attributeNamePrefix.length)}` : n += ` ${s.substr(e.attributeNamePrefix.length)}="${r}"`;
|
|
1176
1434
|
}
|
|
1177
1435
|
return n;
|
|
1178
1436
|
}
|
|
1179
|
-
function
|
|
1180
|
-
|
|
1181
|
-
let n =
|
|
1182
|
-
for (let
|
|
1183
|
-
if (
|
|
1437
|
+
function ft(t, e) {
|
|
1438
|
+
t = t.substr(0, t.length - e.textNodeName.length - 1);
|
|
1439
|
+
let n = t.substr(t.lastIndexOf(".") + 1);
|
|
1440
|
+
for (let s in e.stopNodes)
|
|
1441
|
+
if (e.stopNodes[s] === t || e.stopNodes[s] === "*." + n) return !0;
|
|
1184
1442
|
return !1;
|
|
1185
1443
|
}
|
|
1186
|
-
function
|
|
1187
|
-
if (
|
|
1188
|
-
for (let n = 0; n <
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1444
|
+
function V(t, e) {
|
|
1445
|
+
if (t && t.length > 0 && e.processEntities)
|
|
1446
|
+
for (let n = 0; n < e.entities.length; n++) {
|
|
1447
|
+
const s = e.entities[n];
|
|
1448
|
+
t = t.replace(s.regex, s.val);
|
|
1191
1449
|
}
|
|
1192
|
-
return
|
|
1450
|
+
return t;
|
|
1193
1451
|
}
|
|
1194
|
-
var
|
|
1195
|
-
const
|
|
1452
|
+
var ht = ct;
|
|
1453
|
+
const gt = ht, pt = D, mt = {
|
|
1196
1454
|
attributeNamePrefix: "@_",
|
|
1197
1455
|
attributesGroupName: !1,
|
|
1198
1456
|
textNodeName: "#text",
|
|
@@ -1203,11 +1461,11 @@ const ut = at, lt = k, ct = {
|
|
|
1203
1461
|
suppressEmptyNode: !1,
|
|
1204
1462
|
suppressUnpairedNode: !0,
|
|
1205
1463
|
suppressBooleanAttributes: !0,
|
|
1206
|
-
tagValueProcessor: function(
|
|
1207
|
-
return
|
|
1464
|
+
tagValueProcessor: function(t, e) {
|
|
1465
|
+
return e;
|
|
1208
1466
|
},
|
|
1209
|
-
attributeValueProcessor: function(
|
|
1210
|
-
return
|
|
1467
|
+
attributeValueProcessor: function(t, e) {
|
|
1468
|
+
return e;
|
|
1211
1469
|
},
|
|
1212
1470
|
preserveOrder: !1,
|
|
1213
1471
|
commentPropName: !1,
|
|
@@ -1226,303 +1484,301 @@ const ut = at, lt = k, ct = {
|
|
|
1226
1484
|
// transformAttributeName: false,
|
|
1227
1485
|
oneListGroup: !1
|
|
1228
1486
|
};
|
|
1229
|
-
function
|
|
1230
|
-
this.options = Object.assign({},
|
|
1487
|
+
function x(t) {
|
|
1488
|
+
this.options = Object.assign({}, mt, t), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1231
1489
|
return !1;
|
|
1232
|
-
} : (this.ignoreAttributesFn =
|
|
1490
|
+
} : (this.ignoreAttributesFn = pt(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = wt), this.processTextOrObjNode = bt, this.options.format ? (this.indentate = Nt, this.tagEndChar = `>
|
|
1233
1491
|
`, this.newLine = `
|
|
1234
1492
|
`) : (this.indentate = function() {
|
|
1235
1493
|
return "";
|
|
1236
1494
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
1237
1495
|
}
|
|
1238
|
-
|
|
1239
|
-
return this.options.preserveOrder ?
|
|
1240
|
-
[this.options.arrayNodeName]:
|
|
1241
|
-
}), this.j2x(
|
|
1496
|
+
x.prototype.build = function(t) {
|
|
1497
|
+
return this.options.preserveOrder ? gt(t, this.options) : (Array.isArray(t) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t = {
|
|
1498
|
+
[this.options.arrayNodeName]: t
|
|
1499
|
+
}), this.j2x(t, 0, []).val);
|
|
1242
1500
|
};
|
|
1243
|
-
|
|
1244
|
-
let
|
|
1245
|
-
const
|
|
1246
|
-
for (let
|
|
1247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1248
|
-
if (typeof
|
|
1249
|
-
this.isAttribute(
|
|
1250
|
-
else if (
|
|
1251
|
-
this.isAttribute(
|
|
1252
|
-
else if (
|
|
1253
|
-
|
|
1254
|
-
else if (typeof
|
|
1255
|
-
const
|
|
1256
|
-
if (
|
|
1257
|
-
|
|
1258
|
-
else if (!
|
|
1259
|
-
if (
|
|
1260
|
-
let
|
|
1261
|
-
|
|
1501
|
+
x.prototype.j2x = function(t, e, n) {
|
|
1502
|
+
let s = "", r = "";
|
|
1503
|
+
const o = n.join(".");
|
|
1504
|
+
for (let a in t)
|
|
1505
|
+
if (Object.prototype.hasOwnProperty.call(t, a))
|
|
1506
|
+
if (typeof t[a] > "u")
|
|
1507
|
+
this.isAttribute(a) && (r += "");
|
|
1508
|
+
else if (t[a] === null)
|
|
1509
|
+
this.isAttribute(a) || a === this.options.cdataPropName ? r += "" : a[0] === "?" ? r += this.indentate(e) + "<" + a + "?" + this.tagEndChar : r += this.indentate(e) + "<" + a + "/" + this.tagEndChar;
|
|
1510
|
+
else if (t[a] instanceof Date)
|
|
1511
|
+
r += this.buildTextValNode(t[a], a, "", e);
|
|
1512
|
+
else if (typeof t[a] != "object") {
|
|
1513
|
+
const c = this.isAttribute(a);
|
|
1514
|
+
if (c && !this.ignoreAttributesFn(c, o))
|
|
1515
|
+
s += this.buildAttrPairStr(c, "" + t[a]);
|
|
1516
|
+
else if (!c)
|
|
1517
|
+
if (a === this.options.textNodeName) {
|
|
1518
|
+
let u = this.options.tagValueProcessor(a, "" + t[a]);
|
|
1519
|
+
r += this.replaceEntitiesValue(u);
|
|
1262
1520
|
} else
|
|
1263
|
-
|
|
1264
|
-
} else if (Array.isArray(
|
|
1265
|
-
const
|
|
1266
|
-
let
|
|
1267
|
-
for (let
|
|
1268
|
-
const d =
|
|
1521
|
+
r += this.buildTextValNode(t[a], a, "", e);
|
|
1522
|
+
} else if (Array.isArray(t[a])) {
|
|
1523
|
+
const c = t[a].length;
|
|
1524
|
+
let u = "", l = "";
|
|
1525
|
+
for (let f = 0; f < c; f++) {
|
|
1526
|
+
const d = t[a][f];
|
|
1269
1527
|
if (!(typeof d > "u")) if (d === null)
|
|
1270
|
-
|
|
1528
|
+
a[0] === "?" ? r += this.indentate(e) + "<" + a + "?" + this.tagEndChar : r += this.indentate(e) + "<" + a + "/" + this.tagEndChar;
|
|
1271
1529
|
else if (typeof d == "object")
|
|
1272
1530
|
if (this.options.oneListGroup) {
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1531
|
+
const h = this.j2x(d, e + 1, n.concat(a));
|
|
1532
|
+
u += h.val, this.options.attributesGroupName && d.hasOwnProperty(this.options.attributesGroupName) && (l += h.attrStr);
|
|
1275
1533
|
} else
|
|
1276
|
-
|
|
1534
|
+
u += this.processTextOrObjNode(d, a, e, n);
|
|
1277
1535
|
else if (this.options.oneListGroup) {
|
|
1278
|
-
let
|
|
1279
|
-
|
|
1536
|
+
let h = this.options.tagValueProcessor(a, d);
|
|
1537
|
+
h = this.replaceEntitiesValue(h), u += h;
|
|
1280
1538
|
} else
|
|
1281
|
-
|
|
1539
|
+
u += this.buildTextValNode(d, a, "", e);
|
|
1282
1540
|
}
|
|
1283
|
-
this.options.oneListGroup && (
|
|
1284
|
-
} else if (this.options.attributesGroupName &&
|
|
1285
|
-
const
|
|
1286
|
-
for (let
|
|
1287
|
-
|
|
1541
|
+
this.options.oneListGroup && (u = this.buildObjectNode(u, a, l, e)), r += u;
|
|
1542
|
+
} else if (this.options.attributesGroupName && a === this.options.attributesGroupName) {
|
|
1543
|
+
const c = Object.keys(t[a]), u = c.length;
|
|
1544
|
+
for (let l = 0; l < u; l++)
|
|
1545
|
+
s += this.buildAttrPairStr(c[l], "" + t[a][c[l]]);
|
|
1288
1546
|
} else
|
|
1289
|
-
|
|
1290
|
-
return { attrStr:
|
|
1547
|
+
r += this.processTextOrObjNode(t[a], a, e, n);
|
|
1548
|
+
return { attrStr: s, val: r };
|
|
1291
1549
|
};
|
|
1292
|
-
|
|
1293
|
-
return
|
|
1550
|
+
x.prototype.buildAttrPairStr = function(t, e) {
|
|
1551
|
+
return e = this.options.attributeValueProcessor(t, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + t : " " + t + '="' + e + '"';
|
|
1294
1552
|
};
|
|
1295
|
-
function
|
|
1296
|
-
const
|
|
1297
|
-
return
|
|
1553
|
+
function bt(t, e, n, s) {
|
|
1554
|
+
const r = this.j2x(t, n + 1, s.concat(e));
|
|
1555
|
+
return t[this.options.textNodeName] !== void 0 && Object.keys(t).length === 1 ? this.buildTextValNode(t[this.options.textNodeName], e, r.attrStr, n) : this.buildObjectNode(r.val, e, r.attrStr, n);
|
|
1298
1556
|
}
|
|
1299
|
-
|
|
1300
|
-
if (
|
|
1301
|
-
return
|
|
1557
|
+
x.prototype.buildObjectNode = function(t, e, n, s) {
|
|
1558
|
+
if (t === "")
|
|
1559
|
+
return e[0] === "?" ? this.indentate(s) + "<" + e + n + "?" + this.tagEndChar : this.indentate(s) + "<" + e + n + this.closeTag(e) + this.tagEndChar;
|
|
1302
1560
|
{
|
|
1303
|
-
let
|
|
1304
|
-
return
|
|
1561
|
+
let r = "</" + e + this.tagEndChar, o = "";
|
|
1562
|
+
return e[0] === "?" && (o = "?", r = ""), (n || n === "") && t.indexOf("<") === -1 ? this.indentate(s) + "<" + e + n + o + ">" + t + r : this.options.commentPropName !== !1 && e === this.options.commentPropName && o.length === 0 ? this.indentate(s) + `<!--${t}-->` + this.newLine : this.indentate(s) + "<" + e + n + o + this.tagEndChar + t + this.indentate(s) + r;
|
|
1305
1563
|
}
|
|
1306
1564
|
};
|
|
1307
|
-
|
|
1308
|
-
let
|
|
1309
|
-
return this.options.unpairedTags.indexOf(
|
|
1565
|
+
x.prototype.closeTag = function(t) {
|
|
1566
|
+
let e = "";
|
|
1567
|
+
return this.options.unpairedTags.indexOf(t) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${t}`, e;
|
|
1310
1568
|
};
|
|
1311
|
-
|
|
1312
|
-
if (this.options.cdataPropName !== !1 &&
|
|
1313
|
-
return this.indentate(
|
|
1314
|
-
if (this.options.commentPropName !== !1 &&
|
|
1315
|
-
return this.indentate(
|
|
1316
|
-
if (
|
|
1317
|
-
return this.indentate(
|
|
1569
|
+
x.prototype.buildTextValNode = function(t, e, n, s) {
|
|
1570
|
+
if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
|
|
1571
|
+
return this.indentate(s) + `<![CDATA[${t}]]>` + this.newLine;
|
|
1572
|
+
if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
|
|
1573
|
+
return this.indentate(s) + `<!--${t}-->` + this.newLine;
|
|
1574
|
+
if (e[0] === "?")
|
|
1575
|
+
return this.indentate(s) + "<" + e + n + "?" + this.tagEndChar;
|
|
1318
1576
|
{
|
|
1319
|
-
let
|
|
1320
|
-
return
|
|
1577
|
+
let r = this.options.tagValueProcessor(e, t);
|
|
1578
|
+
return r = this.replaceEntitiesValue(r), r === "" ? this.indentate(s) + "<" + e + n + this.closeTag(e) + this.tagEndChar : this.indentate(s) + "<" + e + n + ">" + r + "</" + e + this.tagEndChar;
|
|
1321
1579
|
}
|
|
1322
1580
|
};
|
|
1323
|
-
|
|
1324
|
-
if (
|
|
1325
|
-
for (let
|
|
1326
|
-
const n = this.options.entities[
|
|
1327
|
-
|
|
1581
|
+
x.prototype.replaceEntitiesValue = function(t) {
|
|
1582
|
+
if (t && t.length > 0 && this.options.processEntities)
|
|
1583
|
+
for (let e = 0; e < this.options.entities.length; e++) {
|
|
1584
|
+
const n = this.options.entities[e];
|
|
1585
|
+
t = t.replace(n.regex, n.val);
|
|
1328
1586
|
}
|
|
1329
|
-
return
|
|
1587
|
+
return t;
|
|
1330
1588
|
};
|
|
1331
|
-
function
|
|
1332
|
-
return this.options.indentBy.repeat(
|
|
1589
|
+
function Nt(t) {
|
|
1590
|
+
return this.options.indentBy.repeat(t);
|
|
1333
1591
|
}
|
|
1334
|
-
function
|
|
1335
|
-
return
|
|
1592
|
+
function wt(t) {
|
|
1593
|
+
return t.startsWith(this.options.attributeNamePrefix) && t !== this.options.textNodeName ? t.substr(this.attrPrefixLen) : !1;
|
|
1336
1594
|
}
|
|
1337
|
-
var
|
|
1338
|
-
const
|
|
1339
|
-
var
|
|
1340
|
-
XMLParser:
|
|
1341
|
-
|
|
1342
|
-
XMLBuilder: bt
|
|
1595
|
+
var Et = x;
|
|
1596
|
+
const yt = ut, xt = Et;
|
|
1597
|
+
var R = {
|
|
1598
|
+
XMLParser: yt,
|
|
1599
|
+
XMLBuilder: xt
|
|
1343
1600
|
};
|
|
1344
|
-
class
|
|
1345
|
-
constructor(
|
|
1601
|
+
class se {
|
|
1602
|
+
constructor(e, n) {
|
|
1346
1603
|
A(this, "alphabet");
|
|
1347
1604
|
A(this, "padding");
|
|
1348
1605
|
A(this, "decodeMap", /* @__PURE__ */ new Map());
|
|
1349
|
-
if (
|
|
1606
|
+
if (e.length !== 32)
|
|
1350
1607
|
throw new Error("Invalid alphabet");
|
|
1351
|
-
if (this.alphabet =
|
|
1608
|
+
if (this.alphabet = e, this.padding = (n == null ? void 0 : n.padding) ?? "=", this.alphabet.includes(this.padding) || this.padding.length !== 1)
|
|
1352
1609
|
throw new Error("Invalid padding");
|
|
1353
|
-
for (let
|
|
1354
|
-
this.decodeMap.set(
|
|
1610
|
+
for (let s = 0; s < e.length; s++)
|
|
1611
|
+
this.decodeMap.set(e[s], s);
|
|
1355
1612
|
}
|
|
1356
|
-
encode(
|
|
1357
|
-
let
|
|
1358
|
-
for (let
|
|
1359
|
-
for (
|
|
1360
|
-
|
|
1361
|
-
if (
|
|
1362
|
-
const
|
|
1363
|
-
for (let
|
|
1364
|
-
|
|
1613
|
+
encode(e, n) {
|
|
1614
|
+
let s = "", r = 0, o = 0;
|
|
1615
|
+
for (let c = 0; c < e.length; c++)
|
|
1616
|
+
for (r = r << 8 | e[c], o += 8; o >= 5; )
|
|
1617
|
+
o -= 5, s += this.alphabet[r >> o & 31];
|
|
1618
|
+
if (o > 0 && (s += this.alphabet[r << 5 - o & 31]), (n == null ? void 0 : n.includePadding) ?? !0) {
|
|
1619
|
+
const c = (8 - s.length % 8) % 8;
|
|
1620
|
+
for (let u = 0; u < c; u++)
|
|
1621
|
+
s += "=";
|
|
1365
1622
|
}
|
|
1366
|
-
return
|
|
1623
|
+
return s;
|
|
1367
1624
|
}
|
|
1368
|
-
decode(
|
|
1369
|
-
const
|
|
1370
|
-
for (let
|
|
1371
|
-
let
|
|
1372
|
-
const
|
|
1373
|
-
for (let
|
|
1374
|
-
const d =
|
|
1625
|
+
decode(e, n) {
|
|
1626
|
+
const s = (n == null ? void 0 : n.strict) ?? !0, r = Math.ceil(e.length / 8), o = [];
|
|
1627
|
+
for (let a = 0; a < r; a++) {
|
|
1628
|
+
let c = 0;
|
|
1629
|
+
const u = [];
|
|
1630
|
+
for (let f = 0; f < 8; f++) {
|
|
1631
|
+
const d = e[a * 8 + f];
|
|
1375
1632
|
if (d === "=") {
|
|
1376
|
-
if (
|
|
1633
|
+
if (a + 1 !== r)
|
|
1377
1634
|
throw new Error(`Invalid character: ${d}`);
|
|
1378
|
-
|
|
1635
|
+
c += 1;
|
|
1379
1636
|
continue;
|
|
1380
1637
|
}
|
|
1381
1638
|
if (d === void 0) {
|
|
1382
|
-
if (
|
|
1639
|
+
if (s)
|
|
1383
1640
|
throw new Error("Invalid data");
|
|
1384
|
-
|
|
1641
|
+
c += 1;
|
|
1385
1642
|
continue;
|
|
1386
1643
|
}
|
|
1387
|
-
const
|
|
1388
|
-
if (
|
|
1644
|
+
const h = this.decodeMap.get(d) ?? null;
|
|
1645
|
+
if (h === null)
|
|
1389
1646
|
throw new Error(`Invalid character: ${d}`);
|
|
1390
|
-
|
|
1647
|
+
u.push(h);
|
|
1391
1648
|
}
|
|
1392
|
-
if (
|
|
1649
|
+
if (c === 8 || c === 7 || c === 5 || c === 2)
|
|
1393
1650
|
throw new Error("Invalid padding");
|
|
1394
|
-
const
|
|
1395
|
-
if (
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1651
|
+
const l = (u[0] << 3) + (u[1] >> 2);
|
|
1652
|
+
if (o.push(l), c < 6) {
|
|
1653
|
+
const f = ((u[1] & 3) << 6) + (u[2] << 1) + (u[3] >> 4);
|
|
1654
|
+
o.push(f);
|
|
1398
1655
|
}
|
|
1399
|
-
if (
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1656
|
+
if (c < 4) {
|
|
1657
|
+
const f = ((u[3] & 255) << 4) + (u[4] >> 1);
|
|
1658
|
+
o.push(f);
|
|
1402
1659
|
}
|
|
1403
|
-
if (
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1660
|
+
if (c < 3) {
|
|
1661
|
+
const f = ((u[4] & 1) << 7) + (u[5] << 2) + (u[6] >> 3);
|
|
1662
|
+
o.push(f);
|
|
1406
1663
|
}
|
|
1407
|
-
if (
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1664
|
+
if (c < 1) {
|
|
1665
|
+
const f = ((u[6] & 7) << 5) + u[7];
|
|
1666
|
+
o.push(f);
|
|
1410
1667
|
}
|
|
1411
1668
|
}
|
|
1412
|
-
return Uint8Array.from(
|
|
1669
|
+
return Uint8Array.from(o);
|
|
1413
1670
|
}
|
|
1414
1671
|
}
|
|
1415
|
-
new
|
|
1416
|
-
new
|
|
1417
|
-
class
|
|
1418
|
-
constructor(
|
|
1672
|
+
new se("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");
|
|
1673
|
+
new se("0123456789ABCDEFGHIJKLMNOPQRSTUV");
|
|
1674
|
+
class re {
|
|
1675
|
+
constructor(e, n) {
|
|
1419
1676
|
A(this, "alphabet");
|
|
1420
1677
|
A(this, "padding");
|
|
1421
1678
|
A(this, "decodeMap", /* @__PURE__ */ new Map());
|
|
1422
|
-
if (
|
|
1679
|
+
if (e.length !== 64)
|
|
1423
1680
|
throw new Error("Invalid alphabet");
|
|
1424
|
-
if (this.alphabet =
|
|
1681
|
+
if (this.alphabet = e, this.padding = (n == null ? void 0 : n.padding) ?? "=", this.alphabet.includes(this.padding) || this.padding.length !== 1)
|
|
1425
1682
|
throw new Error("Invalid padding");
|
|
1426
|
-
for (let
|
|
1427
|
-
this.decodeMap.set(
|
|
1683
|
+
for (let s = 0; s < e.length; s++)
|
|
1684
|
+
this.decodeMap.set(e[s], s);
|
|
1428
1685
|
}
|
|
1429
|
-
encode(
|
|
1430
|
-
let
|
|
1431
|
-
for (let
|
|
1432
|
-
for (
|
|
1433
|
-
|
|
1434
|
-
if (
|
|
1435
|
-
const
|
|
1436
|
-
for (let
|
|
1437
|
-
|
|
1686
|
+
encode(e, n) {
|
|
1687
|
+
let s = "", r = 0, o = 0;
|
|
1688
|
+
for (let c = 0; c < e.length; c++)
|
|
1689
|
+
for (r = r << 8 | e[c], o += 8; o >= 6; )
|
|
1690
|
+
o += -6, s += this.alphabet[r >> o & 63];
|
|
1691
|
+
if (o > 0 && (s += this.alphabet[r << 6 - o & 63]), (n == null ? void 0 : n.includePadding) ?? !0) {
|
|
1692
|
+
const c = (4 - s.length % 4) % 4;
|
|
1693
|
+
for (let u = 0; u < c; u++)
|
|
1694
|
+
s += "=";
|
|
1438
1695
|
}
|
|
1439
|
-
return
|
|
1696
|
+
return s;
|
|
1440
1697
|
}
|
|
1441
|
-
decode(
|
|
1442
|
-
const
|
|
1443
|
-
for (let
|
|
1444
|
-
let
|
|
1445
|
-
for (let
|
|
1446
|
-
const
|
|
1447
|
-
if (
|
|
1448
|
-
if (
|
|
1449
|
-
throw new Error(`Invalid character: ${
|
|
1450
|
-
|
|
1698
|
+
decode(e, n) {
|
|
1699
|
+
const s = (n == null ? void 0 : n.strict) ?? !0, r = Math.ceil(e.length / 4), o = [];
|
|
1700
|
+
for (let a = 0; a < r; a++) {
|
|
1701
|
+
let c = 0, u = 0;
|
|
1702
|
+
for (let l = 0; l < 4; l++) {
|
|
1703
|
+
const f = e[a * 4 + l];
|
|
1704
|
+
if (f === "=") {
|
|
1705
|
+
if (a + 1 !== r)
|
|
1706
|
+
throw new Error(`Invalid character: ${f}`);
|
|
1707
|
+
c += 1;
|
|
1451
1708
|
continue;
|
|
1452
1709
|
}
|
|
1453
|
-
if (
|
|
1454
|
-
if (
|
|
1710
|
+
if (f === void 0) {
|
|
1711
|
+
if (s)
|
|
1455
1712
|
throw new Error("Invalid data");
|
|
1456
|
-
|
|
1713
|
+
c += 1;
|
|
1457
1714
|
continue;
|
|
1458
1715
|
}
|
|
1459
|
-
const d = this.decodeMap.get(
|
|
1716
|
+
const d = this.decodeMap.get(f) ?? null;
|
|
1460
1717
|
if (d === null)
|
|
1461
|
-
throw new Error(`Invalid character: ${
|
|
1462
|
-
|
|
1718
|
+
throw new Error(`Invalid character: ${f}`);
|
|
1719
|
+
u += d << 6 * (3 - l);
|
|
1463
1720
|
}
|
|
1464
|
-
|
|
1721
|
+
o.push(u >> 16 & 255), c < 2 && o.push(u >> 8 & 255), c < 1 && o.push(u & 255);
|
|
1465
1722
|
}
|
|
1466
|
-
return Uint8Array.from(
|
|
1723
|
+
return Uint8Array.from(o);
|
|
1467
1724
|
}
|
|
1468
1725
|
}
|
|
1469
|
-
const
|
|
1470
|
-
new
|
|
1471
|
-
|
|
1472
|
-
let
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
return t;
|
|
1726
|
+
const At = new re("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
|
|
1727
|
+
new re("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
|
|
1728
|
+
let _t = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", J = (t = 21) => {
|
|
1729
|
+
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
1730
|
+
for (; t--; )
|
|
1731
|
+
e += _t[n[t] & 63];
|
|
1732
|
+
return e;
|
|
1477
1733
|
};
|
|
1478
|
-
async function
|
|
1479
|
-
const
|
|
1480
|
-
return new Uint8Array(await new Response(
|
|
1734
|
+
async function Tt(t) {
|
|
1735
|
+
const e = new DecompressionStream("deflate-raw"), n = new Uint8Array(t), s = new Blob([n]).stream().pipeThrough(e);
|
|
1736
|
+
return new Uint8Array(await new Response(s).arrayBuffer());
|
|
1481
1737
|
}
|
|
1482
|
-
async function
|
|
1483
|
-
const
|
|
1738
|
+
async function St(t) {
|
|
1739
|
+
const e = await At.decode(t.replace(/ /g, "+"));
|
|
1484
1740
|
try {
|
|
1485
|
-
const n = await
|
|
1741
|
+
const n = await Tt(e);
|
|
1486
1742
|
return new TextDecoder().decode(n);
|
|
1487
1743
|
} catch (n) {
|
|
1488
1744
|
return console.warn(
|
|
1489
1745
|
"Decompression failed, assuming data is not compressed:",
|
|
1490
1746
|
n
|
|
1491
|
-
), new TextDecoder().decode(
|
|
1747
|
+
), new TextDecoder().decode(e);
|
|
1492
1748
|
}
|
|
1493
1749
|
}
|
|
1494
|
-
async function
|
|
1495
|
-
const
|
|
1750
|
+
async function vt(t) {
|
|
1751
|
+
const e = await St(t), s = new R.XMLParser({
|
|
1496
1752
|
attributeNamePrefix: "@_",
|
|
1497
1753
|
alwaysCreateTextNode: !0,
|
|
1498
1754
|
ignoreAttributes: !1
|
|
1499
|
-
}).parse(
|
|
1500
|
-
return
|
|
1755
|
+
}).parse(e);
|
|
1756
|
+
return ue.parse(s);
|
|
1501
1757
|
}
|
|
1502
|
-
function
|
|
1503
|
-
const
|
|
1758
|
+
function Vt(t) {
|
|
1759
|
+
const e = t.certificates.map((r) => ({
|
|
1504
1760
|
"@_use": "signing",
|
|
1505
1761
|
KeyInfo: {
|
|
1506
1762
|
"@_xmlns": "http://www.w3.org/2000/09/xmldsig#",
|
|
1507
1763
|
X509Data: {
|
|
1508
|
-
X509Certificate:
|
|
1764
|
+
X509Certificate: r
|
|
1509
1765
|
}
|
|
1510
1766
|
}
|
|
1511
1767
|
})), n = {
|
|
1512
1768
|
EntityDescriptor: {
|
|
1513
|
-
"@_entityID":
|
|
1769
|
+
"@_entityID": t.entityId,
|
|
1514
1770
|
"@_xmlns": "urn:oasis:names:tc:SAML:2.0:metadata",
|
|
1515
1771
|
IDPSSODescriptor: {
|
|
1516
1772
|
"@_protocolSupportEnumeration": "urn:oasis:names:tc:SAML:2.0:protocol",
|
|
1517
|
-
KeyDescriptor:
|
|
1773
|
+
KeyDescriptor: e,
|
|
1518
1774
|
SingleLogoutService: [
|
|
1519
1775
|
{
|
|
1520
1776
|
"@_Binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect",
|
|
1521
|
-
"@_Location":
|
|
1777
|
+
"@_Location": t.singleLogoutServiceUrl
|
|
1522
1778
|
},
|
|
1523
1779
|
{
|
|
1524
1780
|
"@_Binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
|
1525
|
-
"@_Location":
|
|
1781
|
+
"@_Location": t.singleLogoutServiceUrl
|
|
1526
1782
|
}
|
|
1527
1783
|
],
|
|
1528
1784
|
NameIDFormat: [
|
|
@@ -1533,11 +1789,11 @@ function Ct(e) {
|
|
|
1533
1789
|
SingleSignOnService: [
|
|
1534
1790
|
{
|
|
1535
1791
|
"@_Binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect",
|
|
1536
|
-
"@_Location":
|
|
1792
|
+
"@_Location": t.assertionConsumerServiceUrl
|
|
1537
1793
|
},
|
|
1538
1794
|
{
|
|
1539
1795
|
"@_Binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
|
1540
|
-
"@_Location":
|
|
1796
|
+
"@_Location": t.assertionConsumerServiceUrl
|
|
1541
1797
|
}
|
|
1542
1798
|
],
|
|
1543
1799
|
Attribute: [
|
|
@@ -1575,7 +1831,7 @@ function Ct(e) {
|
|
|
1575
1831
|
}
|
|
1576
1832
|
}
|
|
1577
1833
|
};
|
|
1578
|
-
return new
|
|
1834
|
+
return new R.XMLBuilder({
|
|
1579
1835
|
ignoreAttributes: !1,
|
|
1580
1836
|
suppressEmptyNode: !0,
|
|
1581
1837
|
preserveOrder: !1,
|
|
@@ -1583,12 +1839,12 @@ function Ct(e) {
|
|
|
1583
1839
|
attributeNamePrefix: "@_"
|
|
1584
1840
|
}).build(n);
|
|
1585
1841
|
}
|
|
1586
|
-
async function
|
|
1587
|
-
const n =
|
|
1842
|
+
async function $t(t, e) {
|
|
1843
|
+
const n = t.notBefore || (/* @__PURE__ */ new Date()).toISOString(), s = t.notAfter || new Date(new Date(n).getTime() + 10 * 60 * 1e3).toISOString(), r = t.issueInstant || n, o = t.sessionNotOnOrAfter || s, a = t.responseId || `_${J()}`, c = t.assertionId || `_${J()}`, u = [
|
|
1588
1844
|
{
|
|
1589
1845
|
"samlp:Response": [
|
|
1590
1846
|
{
|
|
1591
|
-
"saml:Issuer": [{ "#text":
|
|
1847
|
+
"saml:Issuer": [{ "#text": t.issuer }]
|
|
1592
1848
|
},
|
|
1593
1849
|
{
|
|
1594
1850
|
"samlp:Status": [
|
|
@@ -1603,14 +1859,14 @@ async function Lt(e, t) {
|
|
|
1603
1859
|
{
|
|
1604
1860
|
"saml:Issuer": [
|
|
1605
1861
|
{
|
|
1606
|
-
"#text":
|
|
1862
|
+
"#text": t.issuer
|
|
1607
1863
|
}
|
|
1608
1864
|
]
|
|
1609
1865
|
},
|
|
1610
1866
|
{
|
|
1611
1867
|
"saml:Subject": [
|
|
1612
1868
|
{
|
|
1613
|
-
"saml:NameID": [{ "#text":
|
|
1869
|
+
"saml:NameID": [{ "#text": t.email }],
|
|
1614
1870
|
":@": {
|
|
1615
1871
|
"@_Format": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
|
|
1616
1872
|
}
|
|
@@ -1620,9 +1876,9 @@ async function Lt(e, t) {
|
|
|
1620
1876
|
{
|
|
1621
1877
|
"saml:SubjectConfirmationData": [],
|
|
1622
1878
|
":@": {
|
|
1623
|
-
"@_InResponseTo":
|
|
1624
|
-
"@_NotOnOrAfter":
|
|
1625
|
-
"@_Recipient":
|
|
1879
|
+
"@_InResponseTo": t.inResponseTo,
|
|
1880
|
+
"@_NotOnOrAfter": s,
|
|
1881
|
+
"@_Recipient": t.destination
|
|
1626
1882
|
}
|
|
1627
1883
|
}
|
|
1628
1884
|
],
|
|
@@ -1637,7 +1893,7 @@ async function Lt(e, t) {
|
|
|
1637
1893
|
{
|
|
1638
1894
|
"saml:Audience": [
|
|
1639
1895
|
{
|
|
1640
|
-
"#text":
|
|
1896
|
+
"#text": t.audience
|
|
1641
1897
|
}
|
|
1642
1898
|
]
|
|
1643
1899
|
}
|
|
@@ -1646,7 +1902,7 @@ async function Lt(e, t) {
|
|
|
1646
1902
|
],
|
|
1647
1903
|
":@": {
|
|
1648
1904
|
"@_NotBefore": n,
|
|
1649
|
-
"@_NotOnOrAfter":
|
|
1905
|
+
"@_NotOnOrAfter": s
|
|
1650
1906
|
}
|
|
1651
1907
|
},
|
|
1652
1908
|
{
|
|
@@ -1664,9 +1920,9 @@ async function Lt(e, t) {
|
|
|
1664
1920
|
}
|
|
1665
1921
|
],
|
|
1666
1922
|
":@": {
|
|
1667
|
-
"@_AuthnInstant":
|
|
1668
|
-
"@_SessionIndex":
|
|
1669
|
-
"@_SessionNotOnOrAfter":
|
|
1923
|
+
"@_AuthnInstant": r,
|
|
1924
|
+
"@_SessionIndex": t.sessionIndex,
|
|
1925
|
+
"@_SessionNotOnOrAfter": o
|
|
1670
1926
|
}
|
|
1671
1927
|
},
|
|
1672
1928
|
{
|
|
@@ -1674,171 +1930,171 @@ async function Lt(e, t) {
|
|
|
1674
1930
|
{
|
|
1675
1931
|
"saml:Attribute": [
|
|
1676
1932
|
{
|
|
1677
|
-
":@": {
|
|
1678
|
-
"@_FriendlyName": "persistent",
|
|
1679
|
-
"@_Name": "id",
|
|
1680
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
|
|
1681
|
-
},
|
|
1682
1933
|
"saml:AttributeValue": [
|
|
1683
1934
|
{
|
|
1684
|
-
"#text":
|
|
1685
|
-
":@": {
|
|
1686
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1687
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1688
|
-
"@_xsi:type": "xs:string"
|
|
1689
|
-
}
|
|
1935
|
+
"#text": t.userId
|
|
1690
1936
|
}
|
|
1691
|
-
]
|
|
1937
|
+
],
|
|
1938
|
+
":@": {
|
|
1939
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1940
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1941
|
+
"@_xsi:type": "xs:string"
|
|
1942
|
+
}
|
|
1692
1943
|
}
|
|
1693
|
-
]
|
|
1944
|
+
],
|
|
1945
|
+
":@": {
|
|
1946
|
+
"@_FriendlyName": "persistent",
|
|
1947
|
+
"@_Name": "id",
|
|
1948
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
|
|
1949
|
+
}
|
|
1694
1950
|
},
|
|
1695
1951
|
{
|
|
1696
1952
|
"saml:Attribute": [
|
|
1697
1953
|
{
|
|
1698
|
-
":@": {
|
|
1699
|
-
"@_Name": "email",
|
|
1700
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1701
|
-
},
|
|
1702
1954
|
"saml:AttributeValue": [
|
|
1703
1955
|
{
|
|
1704
|
-
"#text":
|
|
1705
|
-
":@": {
|
|
1706
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1707
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1708
|
-
"@_xsi:type": "xs:string"
|
|
1709
|
-
}
|
|
1956
|
+
"#text": t.email
|
|
1710
1957
|
}
|
|
1711
|
-
]
|
|
1958
|
+
],
|
|
1959
|
+
":@": {
|
|
1960
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1961
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1962
|
+
"@_xsi:type": "xs:string"
|
|
1963
|
+
}
|
|
1712
1964
|
}
|
|
1713
|
-
]
|
|
1965
|
+
],
|
|
1966
|
+
":@": {
|
|
1967
|
+
"@_Name": "email",
|
|
1968
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1969
|
+
}
|
|
1714
1970
|
},
|
|
1715
1971
|
{
|
|
1716
1972
|
"saml:Attribute": [
|
|
1717
1973
|
{
|
|
1718
|
-
":@": {
|
|
1719
|
-
"@_Name": "Role",
|
|
1720
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1721
|
-
},
|
|
1722
1974
|
"saml:AttributeValue": [
|
|
1723
1975
|
{
|
|
1724
|
-
"#text": "manage-account"
|
|
1725
|
-
":@": {
|
|
1726
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1727
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1728
|
-
"@_xsi:type": "xs:string"
|
|
1729
|
-
}
|
|
1976
|
+
"#text": "manage-account"
|
|
1730
1977
|
}
|
|
1731
|
-
]
|
|
1978
|
+
],
|
|
1979
|
+
":@": {
|
|
1980
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1981
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1982
|
+
"@_xsi:type": "xs:string"
|
|
1983
|
+
}
|
|
1732
1984
|
}
|
|
1733
|
-
]
|
|
1985
|
+
],
|
|
1986
|
+
":@": {
|
|
1987
|
+
"@_Name": "Role",
|
|
1988
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1989
|
+
}
|
|
1734
1990
|
},
|
|
1735
1991
|
{
|
|
1736
1992
|
"saml:Attribute": [
|
|
1737
1993
|
{
|
|
1738
|
-
":@": {
|
|
1739
|
-
"@_Name": "Role",
|
|
1740
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1741
|
-
},
|
|
1742
1994
|
"saml:AttributeValue": [
|
|
1743
1995
|
{
|
|
1744
|
-
"#text": "default-roles-master"
|
|
1745
|
-
":@": {
|
|
1746
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1747
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1748
|
-
"@_xsi:type": "xs:string"
|
|
1749
|
-
}
|
|
1996
|
+
"#text": "default-roles-master"
|
|
1750
1997
|
}
|
|
1751
|
-
]
|
|
1998
|
+
],
|
|
1999
|
+
":@": {
|
|
2000
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
2001
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
2002
|
+
"@_xsi:type": "xs:string"
|
|
2003
|
+
}
|
|
1752
2004
|
}
|
|
1753
|
-
]
|
|
2005
|
+
],
|
|
2006
|
+
":@": {
|
|
2007
|
+
"@_Name": "Role",
|
|
2008
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
2009
|
+
}
|
|
1754
2010
|
},
|
|
1755
2011
|
{
|
|
1756
2012
|
"saml:Attribute": [
|
|
1757
2013
|
{
|
|
1758
|
-
":@": {
|
|
1759
|
-
"@_Name": "Role",
|
|
1760
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1761
|
-
},
|
|
1762
2014
|
"saml:AttributeValue": [
|
|
1763
2015
|
{
|
|
1764
|
-
"#text": "offline_access"
|
|
1765
|
-
":@": {
|
|
1766
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1767
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1768
|
-
"@_xsi:type": "xs:string"
|
|
1769
|
-
}
|
|
2016
|
+
"#text": "offline_access"
|
|
1770
2017
|
}
|
|
1771
|
-
]
|
|
2018
|
+
],
|
|
2019
|
+
":@": {
|
|
2020
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
2021
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
2022
|
+
"@_xsi:type": "xs:string"
|
|
2023
|
+
}
|
|
1772
2024
|
}
|
|
1773
|
-
]
|
|
2025
|
+
],
|
|
2026
|
+
":@": {
|
|
2027
|
+
"@_Name": "Role",
|
|
2028
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
2029
|
+
}
|
|
1774
2030
|
},
|
|
1775
2031
|
{
|
|
1776
2032
|
"saml:Attribute": [
|
|
1777
2033
|
{
|
|
1778
|
-
":@": {
|
|
1779
|
-
"@_Name": "Role",
|
|
1780
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1781
|
-
},
|
|
1782
2034
|
"saml:AttributeValue": [
|
|
1783
2035
|
{
|
|
1784
|
-
"#text": "view-profile"
|
|
1785
|
-
":@": {
|
|
1786
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1787
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1788
|
-
"@_xsi:type": "xs:string"
|
|
1789
|
-
}
|
|
2036
|
+
"#text": "view-profile"
|
|
1790
2037
|
}
|
|
1791
|
-
]
|
|
2038
|
+
],
|
|
2039
|
+
":@": {
|
|
2040
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
2041
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
2042
|
+
"@_xsi:type": "xs:string"
|
|
2043
|
+
}
|
|
1792
2044
|
}
|
|
1793
|
-
]
|
|
2045
|
+
],
|
|
2046
|
+
":@": {
|
|
2047
|
+
"@_Name": "Role",
|
|
2048
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
2049
|
+
}
|
|
1794
2050
|
},
|
|
1795
2051
|
{
|
|
1796
2052
|
"saml:Attribute": [
|
|
1797
2053
|
{
|
|
1798
|
-
":@": {
|
|
1799
|
-
"@_Name": "Role",
|
|
1800
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1801
|
-
},
|
|
1802
2054
|
"saml:AttributeValue": [
|
|
1803
2055
|
{
|
|
1804
|
-
"#text": "uma_authorization"
|
|
1805
|
-
":@": {
|
|
1806
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1807
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1808
|
-
"@_xsi:type": "xs:string"
|
|
1809
|
-
}
|
|
2056
|
+
"#text": "uma_authorization"
|
|
1810
2057
|
}
|
|
1811
|
-
]
|
|
2058
|
+
],
|
|
2059
|
+
":@": {
|
|
2060
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
2061
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
2062
|
+
"@_xsi:type": "xs:string"
|
|
2063
|
+
}
|
|
1812
2064
|
}
|
|
1813
|
-
]
|
|
2065
|
+
],
|
|
2066
|
+
":@": {
|
|
2067
|
+
"@_Name": "Role",
|
|
2068
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
2069
|
+
}
|
|
1814
2070
|
},
|
|
1815
2071
|
{
|
|
1816
2072
|
"saml:Attribute": [
|
|
1817
2073
|
{
|
|
1818
|
-
":@": {
|
|
1819
|
-
"@_Name": "Role",
|
|
1820
|
-
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
1821
|
-
},
|
|
1822
2074
|
"saml:AttributeValue": [
|
|
1823
2075
|
{
|
|
1824
|
-
"#text": "manage-account-links"
|
|
1825
|
-
":@": {
|
|
1826
|
-
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
1827
|
-
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
1828
|
-
"@_xsi:type": "xs:string"
|
|
1829
|
-
}
|
|
2076
|
+
"#text": "manage-account-links"
|
|
1830
2077
|
}
|
|
1831
|
-
]
|
|
2078
|
+
],
|
|
2079
|
+
":@": {
|
|
2080
|
+
"@_xmlns:xs": "http://www.w3.org/2001/XMLSchema",
|
|
2081
|
+
"@_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
|
2082
|
+
"@_xsi:type": "xs:string"
|
|
2083
|
+
}
|
|
1832
2084
|
}
|
|
1833
|
-
]
|
|
2085
|
+
],
|
|
2086
|
+
":@": {
|
|
2087
|
+
"@_Name": "Role",
|
|
2088
|
+
"@_NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
|
|
2089
|
+
}
|
|
1834
2090
|
}
|
|
1835
2091
|
]
|
|
1836
2092
|
}
|
|
1837
2093
|
],
|
|
1838
2094
|
":@": {
|
|
1839
2095
|
"@_xmlns": "urn:oasis:names:tc:SAML:2.0:assertion",
|
|
1840
|
-
"@_ID":
|
|
1841
|
-
"@_IssueInstant":
|
|
2096
|
+
"@_ID": c,
|
|
2097
|
+
"@_IssueInstant": r,
|
|
1842
2098
|
"@_Version": "2.0"
|
|
1843
2099
|
}
|
|
1844
2100
|
}
|
|
@@ -1846,58 +2102,58 @@ async function Lt(e, t) {
|
|
|
1846
2102
|
":@": {
|
|
1847
2103
|
"@_xmlns:samlp": "urn:oasis:names:tc:SAML:2.0:protocol",
|
|
1848
2104
|
"@_xmlns:saml": "urn:oasis:names:tc:SAML:2.0:assertion",
|
|
1849
|
-
"@_Destination":
|
|
1850
|
-
"@_ID":
|
|
1851
|
-
"@_InResponseTo":
|
|
1852
|
-
"@_IssueInstant":
|
|
2105
|
+
"@_Destination": t.destination,
|
|
2106
|
+
"@_ID": a,
|
|
2107
|
+
"@_InResponseTo": t.inResponseTo,
|
|
2108
|
+
"@_IssueInstant": r,
|
|
1853
2109
|
"@_Version": "2.0"
|
|
1854
2110
|
}
|
|
1855
2111
|
}
|
|
1856
2112
|
];
|
|
1857
|
-
let
|
|
2113
|
+
let f = new R.XMLBuilder({
|
|
1858
2114
|
ignoreAttributes: !1,
|
|
1859
2115
|
suppressEmptyNode: !0,
|
|
1860
2116
|
preserveOrder: !0
|
|
1861
|
-
}).build(
|
|
1862
|
-
return
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
)),
|
|
2117
|
+
}).build(u);
|
|
2118
|
+
return t.signature && e && (f = await e.signSAML(
|
|
2119
|
+
f,
|
|
2120
|
+
t.signature.privateKeyPem,
|
|
2121
|
+
t.signature.cert
|
|
2122
|
+
)), t.encode === !1 ? f : btoa(f);
|
|
1867
2123
|
}
|
|
1868
|
-
class
|
|
1869
|
-
constructor(
|
|
1870
|
-
this.signUrl =
|
|
2124
|
+
class Ft {
|
|
2125
|
+
constructor(e) {
|
|
2126
|
+
this.signUrl = e;
|
|
1871
2127
|
}
|
|
1872
|
-
async signSAML(
|
|
1873
|
-
const
|
|
2128
|
+
async signSAML(e, n, s) {
|
|
2129
|
+
const r = await fetch(this.signUrl, {
|
|
1874
2130
|
method: "POST",
|
|
1875
2131
|
headers: {
|
|
1876
2132
|
"Content-Type": "application/json"
|
|
1877
2133
|
},
|
|
1878
2134
|
body: JSON.stringify({
|
|
1879
|
-
xmlContent:
|
|
2135
|
+
xmlContent: e,
|
|
1880
2136
|
privateKey: n,
|
|
1881
|
-
publicCert:
|
|
2137
|
+
publicCert: s
|
|
1882
2138
|
})
|
|
1883
2139
|
});
|
|
1884
|
-
if (!
|
|
2140
|
+
if (!r.ok)
|
|
1885
2141
|
throw new Error(
|
|
1886
|
-
`Failed to sign SAML via HTTP: ${
|
|
2142
|
+
`Failed to sign SAML via HTTP: ${r.status} ${r.statusText}`
|
|
1887
2143
|
);
|
|
1888
|
-
return await
|
|
2144
|
+
return await r.text();
|
|
1889
2145
|
}
|
|
1890
2146
|
}
|
|
1891
2147
|
export {
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
2148
|
+
Ft as HttpSamlSigner,
|
|
2149
|
+
Vt as createSamlMetadata,
|
|
2150
|
+
$t as createSamlResponse,
|
|
2151
|
+
X as dsSignatureSchema,
|
|
2152
|
+
St as inflateDecompress,
|
|
2153
|
+
Tt as inflateRaw,
|
|
2154
|
+
vt as parseSamlRequestQuery,
|
|
2155
|
+
ae as samlIssuerSchema,
|
|
2156
|
+
Ct as samlMetadataResponseSchema,
|
|
2157
|
+
ue as samlRequestSchema,
|
|
2158
|
+
Pt as samlResponseJsonSchema
|
|
1903
2159
|
};
|