@authhero/saml 0.4.2 → 0.4.3

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.
@@ -1,27 +1,27 @@
1
1
  //#region src/signers/local.ts
2
- var e = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", t = "http://www.w3.org/2001/04/xmlenc#sha256", n = "http://www.w3.org/2001/10/xml-exc-c14n#", r = class {
3
- async signSAML(r, i, a) {
2
+ var e = "http://www.w3.org/2001/10/xml-exc-c14n#", t = class {
3
+ async signSAML(t, n, r) {
4
4
  try {
5
- let o = await import("xml-crypto"), s = o.SignedXml || o.default?.SignedXml;
6
- if (!s) throw Error("SignedXml not found in xml-crypto module");
7
- let c = new s({
8
- privateKey: i,
9
- publicCert: a
5
+ let i = await import("xml-crypto"), a = i.SignedXml || i.default?.SignedXml;
6
+ if (!a) throw Error("SignedXml not found in xml-crypto module");
7
+ let o = new a({
8
+ privateKey: n,
9
+ publicCert: r
10
10
  });
11
- c.canonicalizationAlgorithm = n, c.addReference({
11
+ o.canonicalizationAlgorithm = e, o.addReference({
12
12
  xpath: "(/*[local-name()='Response']/*[local-name()='Assertion'])[1]",
13
- digestAlgorithm: t,
14
- transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", n]
15
- }), c.signatureAlgorithm = e;
16
- let l = a.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
17
- return c.keyInfoProvider = { getKeyInfo: () => `<X509Data><X509Certificate>${l}</X509Certificate></X509Data>` }, c.computeSignature(r, { location: {
13
+ digestAlgorithm: "http://www.w3.org/2001/04/xmlenc#sha256",
14
+ transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", e]
15
+ }), o.signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
16
+ let s = r.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
17
+ return o.keyInfoProvider = { getKeyInfo: () => `<X509Data><X509Certificate>${s}</X509Certificate></X509Data>` }, o.computeSignature(t, { location: {
18
18
  reference: "/*[local-name()='Response']/*[local-name()='Assertion']/*[local-name()='Issuer']",
19
19
  action: "after"
20
- } }), c.getSignedXml();
20
+ } }), o.getSignedXml();
21
21
  } catch (e) {
22
22
  throw Error(`Failed to sign SAML locally. Make sure xml-crypto is installed. Error: ${e}`);
23
23
  }
24
24
  }
25
25
  };
26
26
  //#endregion
27
- export { r as LocalSamlSigner };
27
+ export { t as LocalSamlSigner };
package/dist/saml.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);let t=require("@hono/zod-openapi");var n=t.z.object({"#text":t.z.string()}),r=t.z.object({"#text":t.z.string(),"@_xmlns:saml":t.z.string().optional()}),i=t.z.object({"samlp:AuthnRequest":t.z.object({"saml:Issuer":r,"@_xmlns:samlp":t.z.string(),"@_xmlns:saml":t.z.string().optional(),"@_ForceAuthn":t.z.string().transform(e=>e.toLowerCase()===`true`).optional(),"@_ID":t.z.string(),"@_IssueInstant":t.z.string().datetime(),"@_Destination":t.z.string().url(),"@_AssertionConsumerServiceURL":t.z.string().url().optional(),"@_ProtocolBinding":t.z.string().optional(),"@_Version":t.z.string()})}),a=t.z.array(t.z.object({":@":t.z.object({"@_xmlns":t.z.string(),"@_entityID":t.z.string()}),EntityDescriptor:t.z.array(t.z.object({":@":t.z.object({"@_protocolSupportEnumeration":t.z.string()}),IDPSSODescriptor:t.z.array(t.z.union([t.z.object({KeyDescriptor:t.z.array(t.z.object({KeyInfo:t.z.array(t.z.object({X509Data:t.z.array(t.z.object({X509Certificate:t.z.array(n)}))})),":@":t.z.object({"@_xmlns":t.z.string()})})),":@":t.z.object({"@_use":t.z.string()})}),t.z.object({SingleLogoutService:t.z.array(t.z.object({})),":@":t.z.object({"@_Binding":t.z.string(),"@_Location":t.z.string()})}),t.z.object({NameIDFormat:t.z.array(n)}),t.z.object({SingleSignOnService:t.z.array(t.z.object({})),":@":t.z.object({"@_Binding":t.z.string(),"@_Location":t.z.string()})}),t.z.object({Attribute:t.z.array(t.z.object({})),":@":t.z.object({"@_Name":t.z.string(),"@_NameFormat":t.z.string(),"@_FriendlyName":t.z.string(),"@_xmlns":t.z.string()})})]))}))})),o=t.z.object({"saml:Attribute":t.z.array(t.z.object({"saml:AttributeValue":t.z.array(t.z.object({"#text":t.z.string()})),":@":t.z.object({"@_xmlns:xs":t.z.string().optional(),"@_xmlns:xsi":t.z.string(),"@_xsi:type":t.z.string()}).optional()})),":@":t.z.object({"@_Name":t.z.string(),"@_NameFormat":t.z.string(),"@_FriendlyName":t.z.string().optional()})}),s=t.z.object({"ds:Transform":t.z.array(t.z.any()),":@":t.z.object({"@_Algorithm":t.z.string()})}),c=t.z.object({"ds:Signature":t.z.array(t.z.union([t.z.object({"ds:SignedInfo":t.z.array(t.z.union([t.z.object({"ds:CanonicalizationMethod":t.z.array(t.z.object({":@":t.z.object({"@_Algorithm":t.z.string()})}))}),t.z.object({"ds:SignatureMethod":t.z.array(t.z.object({":@":t.z.object({"@_Algorithm":t.z.string()})}))}),t.z.object({"ds:Reference":t.z.array(t.z.union([t.z.object({"ds:Transforms":t.z.array(s)}),t.z.object({"ds:DigestMethod":t.z.array(t.z.object({":@":t.z.object({"@_Algorithm":t.z.string()})}))}),t.z.object({"ds:DigestValue":t.z.array(n)})])),":@":t.z.object({"@_URI":t.z.string().optional()}).optional()})]))}),t.z.object({"ds:SignatureValue":t.z.array(n)}),t.z.object({"ds:KeyInfo":t.z.array(t.z.union([t.z.object({"ds:KeyValue":t.z.array(t.z.object({"ds:RSAKeyValue":t.z.array(t.z.union([t.z.object({"ds:Modulus":t.z.array(n)}),t.z.object({"ds:Exponent":t.z.array(n)})]))}))}),t.z.object({"ds:X509Data":t.z.array(t.z.object({"ds:X509Certificate":t.z.array(n)}))}),t.z.object({"ds:KeyValue":t.z.array(t.z.object({"ds:RSAKeyValue":t.z.array(t.z.union([t.z.object({"ds:Modulus":t.z.array(n)}),t.z.object({"ds:Exponent":t.z.array(n)})]))})),"ds:X509Data":t.z.array(t.z.object({"ds:X509Certificate":t.z.array(n)}))})]))})])),":@":t.z.object({"@_xmlns:ds":t.z.string().optional()}).optional()}),l=t.z.array(t.z.object({"samlp:Response":t.z.array(t.z.union([t.z.object({"saml:Issuer":t.z.array(n)}),c,t.z.object({"samlp:Status":t.z.array(t.z.object({"samlp:StatusCode":t.z.array(n),":@":t.z.object({"@_Value":t.z.string()})}))}),t.z.object({"saml:Assertion":t.z.array(t.z.union([t.z.object({"saml:Issuer":t.z.array(n)}),c,t.z.object({"saml:Subject":t.z.array(t.z.union([t.z.object({"saml:NameID":t.z.array(n),":@":t.z.object({"@_Format":t.z.string()})}),t.z.object({"saml:SubjectConfirmation":t.z.array(t.z.object({"saml:SubjectConfirmationData":t.z.array(t.z.any()),":@":t.z.object({"@_InResponseTo":t.z.string(),"@_NotOnOrAfter":t.z.string(),"@_Recipient":t.z.string()})})),":@":t.z.object({"@_Method":t.z.string()})})]))}),t.z.object({"saml:Conditions":t.z.array(t.z.object({"saml:AudienceRestriction":t.z.array(t.z.object({"saml:Audience":t.z.array(n)}))})),":@":t.z.object({"@_NotBefore":t.z.string(),"@_NotOnOrAfter":t.z.string()})}),t.z.object({"saml:AuthnStatement":t.z.array(t.z.object({"saml:AuthnContext":t.z.array(t.z.object({"saml:AuthnContextClassRef":t.z.array(n)}))})),":@":t.z.object({"@_AuthnInstant":t.z.string(),"@_SessionIndex":t.z.string(),"@_SessionNotOnOrAfter":t.z.string()})}),t.z.object({"saml:AttributeStatement":t.z.array(o)})])),":@":t.z.object({"@_xmlns":t.z.string(),"@_ID":t.z.string(),"@_IssueInstant":t.z.string(),"@_Version":t.z.string()})})])),":@":t.z.object({"@_xmlns:samlp":t.z.string(),"@_xmlns:saml":t.z.string(),"@_Destination":t.z.string(),"@_ID":t.z.string(),"@_InResponseTo":t.z.string(),"@_IssueInstant":t.z.string(),"@_Version":t.z.string()})})),u=e((e=>{var t=`[: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][: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\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*`,n=RegExp(`^[: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][: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\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`);e.isExist=function(e){return e!==void 0},e.isEmptyObject=function(e){return Object.keys(e).length===0},e.merge=function(e,t,n){if(t){let r=Object.keys(t),i=r.length;for(let a=0;a<i;a++)n===`strict`?e[r[a]]=[t[r[a]]]:e[r[a]]=t[r[a]]}},e.getValue=function(t){return e.isExist(t)?t:``},e.isName=function(e){return n.exec(e)!=null},e.getAllMatches=function(e,t){let n=[],r=t.exec(e);for(;r;){let i=[];i.startIndex=t.lastIndex-r[0].length;let a=r.length;for(let e=0;e<a;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},e.nameRegexp=t,e.DANGEROUS_PROPERTY_NAMES=[`hasOwnProperty`,`toString`,`valueOf`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`],e.criticalProperties=[`__proto__`,`constructor`,`prototype`]})),d=e((e=>{var t=u(),n={allowBooleanAttributes:!1,unpairedTags:[]};e.validate=function(e,t){t=Object.assign({},n,t);let o=[],s=!1,l=!1;e[0]===``&&(e=e.substr(1));for(let n=0;n<e.length;n++)if(e[n]===`<`&&e[n+1]===`?`){if(n+=2,n=i(e,n),n.err)return n}else if(e[n]===`<`){let u=n;if(n++,e[n]===`!`){n=a(e,n);continue}else{let f=!1;e[n]===`/`&&(f=!0,n++);let h=``;for(;n<e.length&&e[n]!==`>`&&e[n]!==` `&&e[n]!==` `&&e[n]!==`
2
2
  `&&e[n]!==`\r`;n++)h+=e[n];if(h=h.trim(),h[h.length-1]===`/`&&(h=h.substring(0,h.length-1),n--),!g(h)){let t;return t=h.trim().length===0?`Invalid space after '<'.`:`Tag '`+h+`' is an invalid name.`,m(`InvalidTag`,t,_(e,n))}let v=c(e,n);if(v===!1)return m(`InvalidAttr`,`Attributes for '`+h+`' have open quote.`,_(e,n));let y=v.value;if(n=v.index,y[y.length-1]===`/`){let r=n-y.length;y=y.substring(0,y.length-1);let i=d(y,t);if(i===!0)s=!0;else return m(i.err.code,i.err.msg,_(e,r+i.err.line))}else if(f){if(!v.tagClosed)return m(`InvalidTag`,`Closing tag '`+h+`' doesn't have proper closing.`,_(e,n));if(y.trim().length>0)return m(`InvalidTag`,`Closing tag '`+h+`' can't have attributes or invalid starting.`,_(e,u));if(o.length===0)return m(`InvalidTag`,`Closing tag '`+h+`' has not been opened.`,_(e,u));{let t=o.pop();if(h!==t.tagName){let n=_(e,t.tagStartPos);return m(`InvalidTag`,`Expected closing tag '`+t.tagName+`' (opened in line `+n.line+`, col `+n.col+`) instead of closing tag '`+h+`'.`,_(e,u))}o.length==0&&(l=!0)}}else{let r=d(y,t);if(r!==!0)return m(r.err.code,r.err.msg,_(e,n-y.length+r.err.line));if(l===!0)return m(`InvalidXml`,`Multiple possible root nodes found.`,_(e,n));t.unpairedTags.indexOf(h)!==-1||o.push({tagName:h,tagStartPos:u}),s=!0}for(n++;n<e.length;n++)if(e[n]===`<`)if(e[n+1]===`!`){n++,n=a(e,n);continue}else if(e[n+1]===`?`){if(n=i(e,++n),n.err)return n}else break;else if(e[n]===`&`){let t=p(e,n);if(t==-1)return m(`InvalidChar`,`char '&' is not expected.`,_(e,n));n=t}else if(l===!0&&!r(e[n]))return m(`InvalidXml`,`Extra text at the end`,_(e,n));e[n]===`<`&&n--}}else{if(r(e[n]))continue;return m(`InvalidChar`,`char '`+e[n]+`' is not expected.`,_(e,n))}return s?o.length==1?m(`InvalidTag`,`Unclosed tag '`+o[0].tagName+`'.`,_(e,o[0].tagStartPos)):o.length>0?m(`InvalidXml`,`Invalid '`+JSON.stringify(o.map(e=>e.tagName),null,4).replace(/\r?\n/g,``)+`' found.`,{line:1,col:1}):!0:m(`InvalidXml`,`Start tag expected.`,1)};function r(e){return e===` `||e===` `||e===`
3
- `||e===`\r`}function i(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let r=e.substr(n,t-n);if(t>5&&r===`xml`)return m(`InvalidXml`,`XML declaration allowed only at the start of the document.`,_(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}else continue}return t}function a(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t<e.length;t++)if(e[t]===`-`&&e[t+1]===`-`&&e[t+2]===`>`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}var o=`"`,s=`'`;function c(e,t){let n=``,r=``,i=!1;for(;t<e.length;t++){if(e[t]===o||e[t]===s)r===``?r=e[t]:r!==e[t]||(r=``);else if(e[t]===`>`&&r===``){i=!0;break}n+=e[t]}return r===``?{value:n,index:t,tagClosed:i}:!1}var l=RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,`g`);function d(e,n){let r=t.getAllMatches(e,l),i={};for(let e=0;e<r.length;e++){if(r[e][1].length===0)return m(`InvalidAttr`,`Attribute '`+r[e][2]+`' has no space in starting.`,v(r[e]));if(r[e][3]!==void 0&&r[e][4]===void 0)return m(`InvalidAttr`,`Attribute '`+r[e][2]+`' is without value.`,v(r[e]));if(r[e][3]===void 0&&!n.allowBooleanAttributes)return m(`InvalidAttr`,`boolean attribute '`+r[e][2]+`' is not allowed.`,v(r[e]));let t=r[e][2];if(!h(t))return m(`InvalidAttr`,`Attribute '`+t+`' is an invalid name.`,v(r[e]));if(!i.hasOwnProperty(t))i[t]=1;else return m(`InvalidAttr`,`Attribute '`+t+`' is repeated.`,v(r[e]))}return!0}function f(e,t){let n=/\d/;for(e[t]===`x`&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===`;`)return t;if(!e[t].match(n))break}return-1}function p(e,t){if(t++,e[t]===`;`)return-1;if(e[t]===`#`)return t++,f(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===`;`)break;return-1}return t}function m(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function h(e){return t.isName(e)}function g(e){return t.isName(e)}function _(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(e){return e.startIndex+e[1].length}})),f=e((e=>{var{DANGEROUS_PROPERTY_NAMES:t,criticalProperties:n}=u(),r=e=>t.includes(e)?`__`+e:e,i={preserveOrder:!1,attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:r};function a(e,r){if(typeof e!=`string`)return;let i=e.toLowerCase();if(t.some(e=>i===e.toLowerCase())||n.some(e=>i===e.toLowerCase()))throw Error(`[SECURITY] Invalid ${r}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function o(e){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof e==`object`&&e?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:o(!0)}e.buildOptions=function(e){let t=Object.assign({},i,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&a(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=r),t.processEntities=o(t.processEntities),t},e.defaultOptions=i})),p=e(((e,t)=>{t.exports=class{constructor(e){this.tagname=e,this.child=[],this[`:@`]={}}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child})}}})),m=e(((e,t)=>{var n=u(),r=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,t){let n=Object.create(null),r=0;if(e[t+3]===`O`&&e[t+4]===`C`&&e[t+5]===`T`&&e[t+6]===`Y`&&e[t+7]===`P`&&e[t+8]===`E`){t+=9;let i=1,o=!1,s=!1,c=``;for(;t<e.length;t++)if(e[t]===`<`&&!s){if(o&&a(e,`!ENTITY`,t)){t+=7;let i,a;if([i,a,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),a.indexOf(`&`)===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);let e=i.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);n[i]={regx:RegExp(`&${e};`,`g`),val:a},r++}}else if(o&&a(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(o&&a(e,`!ATTLIST`,t))t+=8;else if(o&&a(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else if(a(e,`!--`,t))s=!0;else throw Error(`Invalid DOCTYPE`);i++,c=``}else if(e[t]===`>`){if(s?e[t-1]===`-`&&e[t-2]===`-`&&(s=!1,i--):i--,i===0)break}else e[t]===`[`?o=!0:c+=e[t];if(i!==0)throw Error(`Unclosed DOCTYPE`)}else throw Error(`Invalid Tag instead of DOCTYPE`);return{entities:n,i:t}}readEntityExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)n+=e[t],t++;if(o(n),t=i(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let r=``;if([t,r]=this.readIdentifierVal(e,t,`entity`),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&r.length>this.options.maxEntitySize)throw Error(`Entity "${n}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[n,r,t]}readNotationExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;!this.suppressValidationErr&&o(n),t=i(e,t);let r=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&r!==`SYSTEM`&&r!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${r}"`);t+=r.length,t=i(e,t);let a=null,s=null;if(r===`PUBLIC`)[t,a]=this.readIdentifierVal(e,t,`publicIdentifier`),t=i(e,t),(e[t]===`"`||e[t]===`'`)&&([t,s]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(r===`SYSTEM`&&([t,s]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!s))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:n,publicIdentifier:a,systemIdentifier:s,index:--t}}readIdentifierVal(e,t,n){let r=``,i=e[t];if(i!==`"`&&i!==`'`)throw Error(`Expected quoted string, found "${i}"`);for(t++;t<e.length&&e[t]!==i;)r+=e[t],t++;if(e[t]!==i)throw Error(`Unterminated ${n} value`);return t++,[t,r]}readElementExp(e,t){t=i(e,t);let r=``;for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!this.suppressValidationErr&&!n.isName(r))throw Error(`Invalid element name: "${r}"`);t=i(e,t);let o=``;if(e[t]===`E`&&a(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&a(e,`NY`,t))t+=2;else if(e[t]===`(`){for(t++;t<e.length&&e[t]!==`)`;)o+=e[t],t++;if(e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:o.trim(),index:t}}readAttlistExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;o(n),t=i(e,t);let r=``;for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!o(r))throw Error(`Invalid attribute name: "${r}"`);t=i(e,t);let a=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(a=`NOTATION`,t+=8,t=i(e,t),e[t]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let r=``;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)r+=e[t],t++;if(r=r.trim(),!o(r))throw Error(`Invalid notation name: "${r}"`);n.push(r),e[t]===`|`&&(t++,t=i(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,a+=` (`+n.join(`|`)+`)`}else{for(;t<e.length&&!/\s/.test(e[t]);)a+=e[t],t++;if(!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(a.toUpperCase()))throw Error(`Invalid attribute type: "${a}"`)}t=i(e,t);let s=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(s=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(s=`#IMPLIED`,t+=7):[t,s]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:n,attributeName:r,attributeType:a,defaultValue:s,index:t}}},i=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function a(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function o(e){if(n.isName(e))return e;throw Error(`Invalid entity name ${e}`)}t.exports=r})),h=e(((e,t)=>{var n=/^[-+]?0x[a-fA-F0-9]+$/,r=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,i={hex:!0,leadingZeros:!0,decimalPoint:`.`,eNotation:!0};function a(e,t={}){if(t=Object.assign({},i,t),!e||typeof e!=`string`)return e;let a=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(a))return e;if(e===`0`)return 0;if(t.hex&&n.test(a))return s(a,16);if(a.search(/[eE]/)!==-1){let n=a.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(n){if(t.leadingZeros)a=(n[1]||``)+n[3];else if(!(n[2]===`0`&&n[3][0]===`.`))return e;return t.eNotation?Number(a):e}else return e}else{let n=r.exec(a);if(n){let r=n[1],i=n[2],s=o(n[3]);if(!t.leadingZeros&&i.length>0&&r&&a[2]!==`.`||!t.leadingZeros&&i.length>0&&!r&&a[1]!==`.`)return e;if(t.leadingZeros&&i===e)return 0;{let n=Number(a),o=``+n;return o.search(/[eE]/)===-1?a.indexOf(`.`)===-1?i?s===o||r+s===o?n:e:a===o||a===r+o?n:e:o===`0`&&s===``||o===s||r&&o===`-`+s?n:e:t.eNotation?n:e}}else return e}}function o(e){return e&&e.indexOf(`.`)!==-1?(e=e.replace(/0+$/,``),e===`.`?e=`0`:e[0]===`.`?e=`0`+e:e[e.length-1]===`.`&&(e=e.substr(0,e.length-1)),e):e}function s(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}t.exports=a})),g=e(((e,t)=>{function n(e){return typeof e==`function`?e:Array.isArray(e)?t=>{for(let n of e)if(typeof n==`string`&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}t.exports=n})),_=e(((e,t)=>{var n=u(),r=p(),i=m(),a=h(),o=g(),s=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:`'`},gt:{regex:/&(gt|#62|#x3E);/g,val:`>`},lt:{regex:/&(lt|#60|#x3C);/g,val:`<`},quot:{regex:/&(quot|#34|#x22);/g,val:`"`}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:`&`},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:` `},cent:{regex:/&(cent|#162);/g,val:`¢`},pound:{regex:/&(pound|#163);/g,val:`£`},yen:{regex:/&(yen|#165);/g,val:`¥`},euro:{regex:/&(euro|#8364);/g,val:`€`},copyright:{regex:/&(copy|#169);/g,val:`©`},reg:{regex:/&(reg|#174);/g,val:`®`},inr:{regex:/&(inr|#8377);/g,val:`₹`},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>O(t,10,`&#`)},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>O(t,16,`&#x`)}},this.addExternalEntities=c,this.parseXml=v,this.parseTextData=l,this.resolveNameSpace=d,this.buildAttributesMap=_,this.isItStopNode=S,this.replaceEntitiesValue=b,this.readStopNodeData=E,this.saveTextToParentTag=x,this.addChild=y,this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let e=0;e<this.options.stopNodes.length;e++){let t=this.options.stopNodes[e];typeof t==`string`&&(t.startsWith(`*.`)?this.stopNodesWildcard.add(t.substring(2)):this.stopNodesExact.add(t))}}}};function c(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n],i=r.replace(/[.\-+*:]/g,`\\.`);this.lastEntities[r]={regex:RegExp(`&`+i+`;`,`g`),val:e[r]}}}function l(e,t,n,r,i,a,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,n));let r=this.options.tagValueProcessor(t,e,n,i,a);return r==null?e:typeof r!=typeof e||r!==e?r:this.options.trimValues||e.trim()===e?D(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function d(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}var f=RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function _(e,t,r){if(this.options.ignoreAttributes!==!0&&typeof e==`string`){let i=n.getAllMatches(e,f),a=i.length,o={};for(let e=0;e<a;e++){let n=this.resolveNameSpace(i[e][1]);if(this.ignoreAttributesFn(n,t))continue;let a=i[e][4],s=this.options.attributeNamePrefix+n;if(n.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),s=k(s,this.options),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,r,t);let e=this.options.attributeValueProcessor(n,a,t);e==null?o[s]=a:typeof e!=typeof a||e!==a?o[s]=e:o[s]=D(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[s]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let e={};return e[this.options.attributesGroupName]=o,e}return o}}var v=function(e){e=e.replace(/\r\n?/g,`
4
- `);let t=new r(`!xml`),n=t,a=``,o=``;this.entityExpansionCount=0,this.currentExpandedLength=0;let s=new i(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]===`<`)if(e[i+1]===`/`){let t=w(e,`>`,i,`Closing Tag is not closed.`),r=e.substring(i+2,t).trim();if(this.options.removeNSPrefix){let e=r.indexOf(`:`);e!==-1&&(r=r.substr(e+1))}this.options.transformTagName&&(r=this.options.transformTagName(r)),n&&(a=this.saveTextToParentTag(a,n,o));let s=o.substring(o.lastIndexOf(`.`)+1);if(r&&this.options.unpairedTags.indexOf(r)!==-1)throw Error(`Unpaired tag can not be used as closing tag: </${r}>`);let c=0;s&&this.options.unpairedTags.indexOf(s)!==-1?(c=o.lastIndexOf(`.`,o.lastIndexOf(`.`)-1),this.tagsNodeStack.pop()):c=o.lastIndexOf(`.`),o=o.substring(0,c),n=this.tagsNodeStack.pop(),a=``,i=t}else if(e[i+1]===`?`){let t=T(e,i,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);if(a=this.saveTextToParentTag(a,n,o),!(this.options.ignoreDeclaration&&t.tagName===`?xml`||this.options.ignorePiTags)){let e=new r(t.tagName);e.add(this.options.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[`:@`]=this.buildAttributesMap(t.tagExp,o,t.tagName)),this.addChild(n,e,o,i)}i=t.closeIndex+1}else if(e.substr(i+1,3)===`!--`){let t=w(e,`-->`,i+4,`Comment is not closed.`);if(this.options.commentPropName){let r=e.substring(i+4,t-2);a=this.saveTextToParentTag(a,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:r}])}i=t}else if(e.substr(i+1,2)===`!D`){let t=s.readDocType(e,i);this.docTypeEntities=t.entities,i=t.i}else if(e.substr(i+1,2)===`![`){let t=w(e,`]]>`,i,`CDATA is not closed.`)-2,r=e.substring(i+9,t);a=this.saveTextToParentTag(a,n,o);let s=this.parseTextData(r,n.tagname,o,!0,!1,!0,!0);s??=``,this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:r}]):n.add(this.options.textNodeName,s),i=t+2}else{let s=T(e,i,this.options.removeNSPrefix),c=s.tagName,l=s.rawTagName,u=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;if(this.options.transformTagName){let e=this.options.transformTagName(c);u===c&&(u=e),c=e}if(this.options.strictReservedNames&&(c===this.options.commentPropName||c===this.options.cdataPropName||c===this.options.textNodeName||c===this.options.attributesGroupName))throw Error(`Invalid tag name: ${c}`);n&&a&&n.tagname!==`!xml`&&(a=this.saveTextToParentTag(a,n,o,!1));let p=n;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf(`.`))),c!==t.tagname&&(o+=o?`.`+c:c);let m=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,c)){let t=``;if(u.length>0&&u.lastIndexOf(`/`)===u.length-1)c[c.length-1]===`/`?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=s.closeIndex;else{let n=this.readStopNodeData(e,l,f+1);if(!n)throw Error(`Unexpected end of ${l}`);i=n.i,t=n.tagContent}let a=new r(c);c!==u&&d&&(a[`:@`]=this.buildAttributesMap(u,o,c)),t&&=this.parseTextData(t,c,o,!0,d,!0,!0),o=o.substr(0,o.lastIndexOf(`.`)),a.add(this.options.textNodeName,t),this.addChild(n,a,o,m)}else{if(u.length>0&&u.lastIndexOf(`/`)===u.length-1){if(c[c.length-1]===`/`?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName){let e=this.options.transformTagName(c);u===c&&(u=e),c=e}let e=new r(c);c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o,c)),this.addChild(n,e,o,m),o=o.substr(0,o.lastIndexOf(`.`))}else if(this.options.unpairedTags.indexOf(c)!==-1){let e=new r(c);c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o)),this.addChild(n,e,o,m),o=o.substr(0,o.lastIndexOf(`.`)),i=s.closeIndex;continue}else{let e=new r(c);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o,c)),this.addChild(n,e,o),n=e}a=``,i=f}}else a+=e[i];return t.child};function y(e,t,n,r){this.options.captureMetaData||(r=void 0);let i=this.options.updateTag(t.tagname,n,t[`:@`]);i===!1||(typeof i==`string`&&(t.tagname=i),e.addChild(t,r))}var b=function(e,t,n){if(e.indexOf(`&`)===-1)return e;let r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(t)||r.tagFilter&&!r.tagFilter(t,n))return e;for(let t in this.docTypeEntities){let n=this.docTypeEntities[t],i=e.match(n.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);let t=e.length;if(e=e.replace(n.regx,n.val),r.maxExpandedLength&&(this.currentExpandedLength+=e.length-t,this.currentExpandedLength>r.maxExpandedLength))throw Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(e.indexOf(`&`)===-1)return e;for(let t of Object.keys(this.lastEntities)){let n=this.lastEntities[t],i=e.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}if(e.indexOf(`&`)===-1)return e;if(this.options.htmlEntities)for(let t of Object.keys(this.htmlEntities)){let n=this.htmlEntities[t],i=e.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}return e=e.replace(this.ampEntity.regex,this.ampEntity.val),e};function x(e,t,n,r){return e&&=(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[`:@`]?Object.keys(t[`:@`]).length!==0:!1,r),e!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function S(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function C(e,t,n=`>`){let r,i=``;for(let a=t;a<e.length;a++){let t=e[a];if(r)t===r&&(r=``);else if(t===`"`||t===`'`)r=t;else if(t===n[0])if(n[1]){if(e[a+1]===n[1])return{data:i,index:a}}else return{data:i,index:a};else t===` `&&(t=` `);i+=t}}function w(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}function T(e,t,n,r=`>`){let i=C(e,t+1,r);if(!i)return;let a=i.data,o=i.index,s=a.search(/\s/),c=a,l=!0;s!==-1&&(c=a.substring(0,s),a=a.substring(s+1).trimStart());let u=c;if(n){let e=c.indexOf(`:`);e!==-1&&(c=c.substr(e+1),l=c!==i.data.substr(e+1))}return{tagName:c,tagExp:a,closeIndex:o,attrExpPresent:l,rawTagName:u}}function E(e,t,n){let r=n,i=1;for(;n<e.length;n++)if(e[n]===`<`)if(e[n+1]===`/`){let a=w(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(r,n),i:a};n=a}else if(e[n+1]===`?`)n=w(e,`?>`,n+1,`StopNode is not closed.`);else if(e.substr(n+1,3)===`!--`)n=w(e,`-->`,n+3,`StopNode is not closed.`);else if(e.substr(n+1,2)===`![`)n=w(e,`]]>`,n,`StopNode is not closed.`)-2;else{let r=T(e,n,`>`);r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!==`/`&&i++,n=r.closeIndex)}}function D(e,t,r){if(t&&typeof e==`string`){let t=e.trim();return t===`true`?!0:t===`false`?!1:a(e,r)}else if(n.isExist(e))return e;else return``}function O(e,t,n){let r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+`;`}function k(e,t){if(n.criticalProperties.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return n.DANGEROUS_PROPERTY_NAMES.includes(e)?t.onDangerousProperty(e):e}t.exports=s})),v=e((e=>{function t(e,t){return n(e,t)}function n(e,t,o){let s,c={};for(let l=0;l<e.length;l++){let u=e[l],d=r(u),f=``;if(f=o===void 0?d:o+`.`+d,d===t.textNodeName)s===void 0?s=u[d]:s+=``+u[d];else if(d===void 0)continue;else if(u[d]){let e=n(u[d],t,f),r=a(e,t);u[`:@`]?i(e,u[`:@`],f,t):Object.keys(e).length===1&&e[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?e=e[t.textNodeName]:Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``),c[d]!==void 0&&c.hasOwnProperty(d)?(Array.isArray(c[d])||(c[d]=[c[d]]),c[d].push(e)):t.isArray(d,f,r)?c[d]=[e]:c[d]=e}}return typeof s==`string`?s.length>0&&(c[t.textNodeName]=s):s!==void 0&&(c[t.textNodeName]=s),c}function r(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function i(e,t,n,r){if(t){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let a=i[o];r.isArray(a,n+`.`+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function a(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]==`boolean`||e[n]===0))}e.prettify=t})),y=e(((e,t)=>{var{buildOptions:n}=f(),r=_(),{prettify:i}=v(),a=d();t.exports=class{constructor(e){this.externalEntities={},this.options=n(e)}parse(e,t){if(typeof e!=`string`)if(e.toString)e=e.toString();else throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){t===!0&&(t={});let n=a.validate(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new r(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:i(o,this.options)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}}})),b=e(((e,t)=>{var n=`
5
- `;function r(e,t){let r=``;return t.format&&t.indentBy.length>0&&(r=n),i(e,t,``,r)}function i(e,t,n,r){let l=``,u=!1;if(!Array.isArray(e)){if(e!=null){let n=e.toString();return n=c(n,t),n}return``}for(let d=0;d<e.length;d++){let f=e[d],p=a(f);if(p===void 0)continue;let m=``;if(m=n.length===0?p:`${n}.${p}`,p===t.textNodeName){let e=f[p];s(m,t)||(e=t.tagValueProcessor(p,e),e=c(e,t)),u&&(l+=r),l+=e,u=!1;continue}else if(p===t.cdataPropName){u&&(l+=r),l+=`<![CDATA[${f[p][0][t.textNodeName]}]]>`,u=!1;continue}else if(p===t.commentPropName){l+=r+`<!--${f[p][0][t.textNodeName]}-->`,u=!0;continue}else if(p[0]===`?`){let e=o(f[`:@`],t),n=p===`?xml`?``:r,i=f[p][0][t.textNodeName];i=i.length===0?``:` `+i,l+=n+`<${p}${i}${e}?>`,u=!0;continue}let h=r;h!==``&&(h+=t.indentBy);let g=r+`<${p}${o(f[`:@`],t)}`,_=i(f[p],t,m,h);t.unpairedTags.indexOf(p)===-1?(!_||_.length===0)&&t.suppressEmptyNode?l+=g+`/>`:_&&_.endsWith(`>`)?l+=g+`>${_}${r}</${p}>`:(l+=g+`>`,_&&r!==``&&(_.includes(`/>`)||_.includes(`</`))?l+=r+t.indentBy+_+r:l+=_,l+=`</${p}>`):t.suppressUnpairedNode?l+=g+`>`:l+=g+`/>`,u=!0}return l}function a(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==`:@`)return r}}function o(e,t){let n=``;if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t.attributeValueProcessor(r,e[r]);i=c(i,t),i===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function s(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(`.`)+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]===`*.`+n)return!0;return!1}function c(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}t.exports=r})),x=e(((e,t)=>{var n=b(),r=g(),i={attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:` `,suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:RegExp(`&`,`g`),val:`&amp;`},{regex:RegExp(`>`,`g`),val:`&gt;`},{regex:RegExp(`<`,`g`),val:`&lt;`},{regex:RegExp(`'`,`g`),val:`&apos;`},{regex:RegExp(`"`,`g`),val:`&quot;`}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(e){this.options=Object.assign({},i,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=r(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=s,this.tagEndChar=`>
3
+ `||e===`\r`}function i(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let r=e.substr(n,t-n);if(t>5&&r===`xml`)return m(`InvalidXml`,`XML declaration allowed only at the start of the document.`,_(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}else continue}return t}function a(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t<e.length;t++)if(e[t]===`-`&&e[t+1]===`-`&&e[t+2]===`>`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}var o=`"`,s=`'`;function c(e,t){let n=``,r=``,i=!1;for(;t<e.length;t++){if(e[t]===o||e[t]===s)r===``?r=e[t]:r!==e[t]||(r=``);else if(e[t]===`>`&&r===``){i=!0;break}n+=e[t]}return r===``&&{value:n,index:t,tagClosed:i}}var l=RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,`g`);function d(e,n){let r=t.getAllMatches(e,l),i={};for(let e=0;e<r.length;e++){if(r[e][1].length===0)return m(`InvalidAttr`,`Attribute '`+r[e][2]+`' has no space in starting.`,v(r[e]));if(r[e][3]!==void 0&&r[e][4]===void 0)return m(`InvalidAttr`,`Attribute '`+r[e][2]+`' is without value.`,v(r[e]));if(r[e][3]===void 0&&!n.allowBooleanAttributes)return m(`InvalidAttr`,`boolean attribute '`+r[e][2]+`' is not allowed.`,v(r[e]));let t=r[e][2];if(!h(t))return m(`InvalidAttr`,`Attribute '`+t+`' is an invalid name.`,v(r[e]));if(!i.hasOwnProperty(t))i[t]=1;else return m(`InvalidAttr`,`Attribute '`+t+`' is repeated.`,v(r[e]))}return!0}function f(e,t){let n=/\d/;for(e[t]===`x`&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===`;`)return t;if(!e[t].match(n))break}return-1}function p(e,t){if(t++,e[t]===`;`)return-1;if(e[t]===`#`)return t++,f(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===`;`)break;return-1}return t}function m(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function h(e){return t.isName(e)}function g(e){return t.isName(e)}function _(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(e){return e.startIndex+e[1].length}})),f=e((e=>{var{DANGEROUS_PROPERTY_NAMES:t,criticalProperties:n}=u(),r=e=>t.includes(e)?`__`+e:e,i={preserveOrder:!1,attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:r};function a(e,r){if(typeof e!=`string`)return;let i=e.toLowerCase();if(t.some(e=>i===e.toLowerCase())||n.some(e=>i===e.toLowerCase()))throw Error(`[SECURITY] Invalid ${r}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function o(e){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof e==`object`&&e?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:o(!0)}e.buildOptions=function(e){let t=Object.assign({},i,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&a(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=r),t.processEntities=o(t.processEntities),t},e.defaultOptions=i})),p=e(((e,t)=>{t.exports=class{constructor(e){this.tagname=e,this.child=[],this[`:@`]={}}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child})}}})),m=e(((e,t)=>{var n=u(),r=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,t){let n=Object.create(null),r=0;if(e[t+3]===`O`&&e[t+4]===`C`&&e[t+5]===`T`&&e[t+6]===`Y`&&e[t+7]===`P`&&e[t+8]===`E`){t+=9;let i=1,o=!1,s=!1,c=``;for(;t<e.length;t++)if(e[t]===`<`&&!s){if(o&&a(e,`!ENTITY`,t)){t+=7;let i,a;if([i,a,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),a.indexOf(`&`)===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);let e=i.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);n[i]={regx:RegExp(`&${e};`,`g`),val:a},r++}}else if(o&&a(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(o&&a(e,`!ATTLIST`,t))t+=8;else if(o&&a(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else if(a(e,`!--`,t))s=!0;else throw Error(`Invalid DOCTYPE`);i++,c=``}else if(e[t]===`>`){if(s?e[t-1]===`-`&&e[t-2]===`-`&&(s=!1,i--):i--,i===0)break}else e[t]===`[`?o=!0:c+=e[t];if(i!==0)throw Error(`Unclosed DOCTYPE`)}else throw Error(`Invalid Tag instead of DOCTYPE`);return{entities:n,i:t}}readEntityExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)n+=e[t],t++;if(o(n),t=i(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let r=``;if([t,r]=this.readIdentifierVal(e,t,`entity`),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&r.length>this.options.maxEntitySize)throw Error(`Entity "${n}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[n,r,t]}readNotationExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;!this.suppressValidationErr&&o(n),t=i(e,t);let r=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&r!==`SYSTEM`&&r!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${r}"`);t+=r.length,t=i(e,t);let a=null,s=null;if(r===`PUBLIC`)[t,a]=this.readIdentifierVal(e,t,`publicIdentifier`),t=i(e,t),(e[t]===`"`||e[t]===`'`)&&([t,s]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(r===`SYSTEM`&&([t,s]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!s))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:n,publicIdentifier:a,systemIdentifier:s,index:--t}}readIdentifierVal(e,t,n){let r=``,i=e[t];if(i!==`"`&&i!==`'`)throw Error(`Expected quoted string, found "${i}"`);for(t++;t<e.length&&e[t]!==i;)r+=e[t],t++;if(e[t]!==i)throw Error(`Unterminated ${n} value`);return t++,[t,r]}readElementExp(e,t){t=i(e,t);let r=``;for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!this.suppressValidationErr&&!n.isName(r))throw Error(`Invalid element name: "${r}"`);t=i(e,t);let o=``;if(e[t]===`E`&&a(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&a(e,`NY`,t))t+=2;else if(e[t]===`(`){for(t++;t<e.length&&e[t]!==`)`;)o+=e[t],t++;if(e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:o.trim(),index:t}}readAttlistExp(e,t){t=i(e,t);let n=``;for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;o(n),t=i(e,t);let r=``;for(;t<e.length&&!/\s/.test(e[t]);)r+=e[t],t++;if(!o(r))throw Error(`Invalid attribute name: "${r}"`);t=i(e,t);let a=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(a=`NOTATION`,t+=8,t=i(e,t),e[t]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let r=``;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)r+=e[t],t++;if(r=r.trim(),!o(r))throw Error(`Invalid notation name: "${r}"`);n.push(r),e[t]===`|`&&(t++,t=i(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,a+=` (`+n.join(`|`)+`)`}else{for(;t<e.length&&!/\s/.test(e[t]);)a+=e[t],t++;if(!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(a.toUpperCase()))throw Error(`Invalid attribute type: "${a}"`)}t=i(e,t);let s=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(s=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(s=`#IMPLIED`,t+=7):[t,s]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:n,attributeName:r,attributeType:a,defaultValue:s,index:t}}},i=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function a(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function o(e){if(n.isName(e))return e;throw Error(`Invalid entity name ${e}`)}t.exports=r})),h=e(((e,t)=>{var n=/^[-+]?0x[a-fA-F0-9]+$/,r=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,i={hex:!0,leadingZeros:!0,decimalPoint:`.`,eNotation:!0};function a(e,t={}){if(t=Object.assign({},i,t),!e||typeof e!=`string`)return e;let a=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(a))return e;if(e===`0`)return 0;if(t.hex&&n.test(a))return s(a,16);if(a.search(/[eE]/)!==-1){let n=a.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(n){if(t.leadingZeros)a=(n[1]||``)+n[3];else if(!(n[2]===`0`&&n[3][0]===`.`))return e;return t.eNotation?Number(a):e}else return e}else{let n=r.exec(a);if(n){let r=n[1],i=n[2],s=o(n[3]);if(!t.leadingZeros&&i.length>0&&r&&a[2]!==`.`||!t.leadingZeros&&i.length>0&&!r&&a[1]!==`.`)return e;if(t.leadingZeros&&i===e)return 0;{let n=Number(a),o=``+n;return o.search(/[eE]/)===-1?a.indexOf(`.`)===-1?i?s===o||r+s===o?n:e:a===o||a===r+o?n:e:o===`0`&&s===``||o===s||r&&o===`-`+s?n:e:t.eNotation?n:e}}else return e}}function o(e){return e&&e.indexOf(`.`)!==-1?(e=e.replace(/0+$/,``),e===`.`?e=`0`:e[0]===`.`?e=`0`+e:e[e.length-1]===`.`&&(e=e.substr(0,e.length-1)),e):e}function s(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}t.exports=a})),g=e(((e,t)=>{function n(e){return typeof e==`function`?e:Array.isArray(e)?t=>{for(let n of e)if(typeof n==`string`&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}t.exports=n})),_=e(((e,t)=>{var n=u(),r=p(),i=m(),a=h(),o=g(),s=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:`'`},gt:{regex:/&(gt|#62|#x3E);/g,val:`>`},lt:{regex:/&(lt|#60|#x3C);/g,val:`<`},quot:{regex:/&(quot|#34|#x22);/g,val:`"`}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:`&`},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:` `},cent:{regex:/&(cent|#162);/g,val:`¢`},pound:{regex:/&(pound|#163);/g,val:`£`},yen:{regex:/&(yen|#165);/g,val:`¥`},euro:{regex:/&(euro|#8364);/g,val:`€`},copyright:{regex:/&(copy|#169);/g,val:`©`},reg:{regex:/&(reg|#174);/g,val:`®`},inr:{regex:/&(inr|#8377);/g,val:`₹`},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>O(t,10,`&#`)},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>O(t,16,`&#x`)}},this.addExternalEntities=c,this.parseXml=v,this.parseTextData=l,this.resolveNameSpace=d,this.buildAttributesMap=_,this.isItStopNode=S,this.replaceEntitiesValue=b,this.readStopNodeData=E,this.saveTextToParentTag=x,this.addChild=y,this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let e=0;e<this.options.stopNodes.length;e++){let t=this.options.stopNodes[e];typeof t==`string`&&(t.startsWith(`*.`)?this.stopNodesWildcard.add(t.substring(2)):this.stopNodesExact.add(t))}}}};function c(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n],i=r.replace(/[.\-+*:]/g,`\\.`);this.lastEntities[r]={regex:RegExp(`&`+i+`;`,`g`),val:e[r]}}}function l(e,t,n,r,i,a,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,n));let r=this.options.tagValueProcessor(t,e,n,i,a);return r==null?e:typeof r!=typeof e||r!==e?r:this.options.trimValues||e.trim()===e?D(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function d(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}var f=RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function _(e,t,r){if(this.options.ignoreAttributes!==!0&&typeof e==`string`){let i=n.getAllMatches(e,f),a=i.length,o={};for(let e=0;e<a;e++){let n=this.resolveNameSpace(i[e][1]);if(this.ignoreAttributesFn(n,t))continue;let a=i[e][4],s=this.options.attributeNamePrefix+n;if(n.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),s=k(s,this.options),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,r,t);let e=this.options.attributeValueProcessor(n,a,t);e==null?o[s]=a:typeof e!=typeof a||e!==a?o[s]=e:o[s]=D(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[s]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let e={};return e[this.options.attributesGroupName]=o,e}return o}}var v=function(e){e=e.replace(/\r\n?/g,`
4
+ `);let t=new r(`!xml`),n=t,a=``,o=``;this.entityExpansionCount=0,this.currentExpandedLength=0;let s=new i(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]===`<`)if(e[i+1]===`/`){let t=w(e,`>`,i,`Closing Tag is not closed.`),r=e.substring(i+2,t).trim();if(this.options.removeNSPrefix){let e=r.indexOf(`:`);e!==-1&&(r=r.substr(e+1))}this.options.transformTagName&&(r=this.options.transformTagName(r)),n&&(a=this.saveTextToParentTag(a,n,o));let s=o.substring(o.lastIndexOf(`.`)+1);if(r&&this.options.unpairedTags.indexOf(r)!==-1)throw Error(`Unpaired tag can not be used as closing tag: </${r}>`);let c=0;s&&this.options.unpairedTags.indexOf(s)!==-1?(c=o.lastIndexOf(`.`,o.lastIndexOf(`.`)-1),this.tagsNodeStack.pop()):c=o.lastIndexOf(`.`),o=o.substring(0,c),n=this.tagsNodeStack.pop(),a=``,i=t}else if(e[i+1]===`?`){let t=T(e,i,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);if(a=this.saveTextToParentTag(a,n,o),!(this.options.ignoreDeclaration&&t.tagName===`?xml`||this.options.ignorePiTags)){let e=new r(t.tagName);e.add(this.options.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[`:@`]=this.buildAttributesMap(t.tagExp,o,t.tagName)),this.addChild(n,e,o,i)}i=t.closeIndex+1}else if(e.substr(i+1,3)===`!--`){let t=w(e,`-->`,i+4,`Comment is not closed.`);if(this.options.commentPropName){let r=e.substring(i+4,t-2);a=this.saveTextToParentTag(a,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:r}])}i=t}else if(e.substr(i+1,2)===`!D`){let t=s.readDocType(e,i);this.docTypeEntities=t.entities,i=t.i}else if(e.substr(i+1,2)===`![`){let t=w(e,`]]>`,i,`CDATA is not closed.`)-2,r=e.substring(i+9,t);a=this.saveTextToParentTag(a,n,o);let s=this.parseTextData(r,n.tagname,o,!0,!1,!0,!0);s??=``,this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:r}]):n.add(this.options.textNodeName,s),i=t+2}else{let s=T(e,i,this.options.removeNSPrefix),c=s.tagName,l=s.rawTagName,u=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;if(this.options.transformTagName){let e=this.options.transformTagName(c);u===c&&(u=e),c=e}if(this.options.strictReservedNames&&(c===this.options.commentPropName||c===this.options.cdataPropName||c===this.options.textNodeName||c===this.options.attributesGroupName))throw Error(`Invalid tag name: ${c}`);n&&a&&n.tagname!==`!xml`&&(a=this.saveTextToParentTag(a,n,o,!1));let p=n;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf(`.`))),c!==t.tagname&&(o+=o?`.`+c:c);let m=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,c)){let t=``;if(u.length>0&&u.lastIndexOf(`/`)===u.length-1)c[c.length-1]===`/`?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=s.closeIndex;else{let n=this.readStopNodeData(e,l,f+1);if(!n)throw Error(`Unexpected end of ${l}`);i=n.i,t=n.tagContent}let a=new r(c);c!==u&&d&&(a[`:@`]=this.buildAttributesMap(u,o,c)),t&&=this.parseTextData(t,c,o,!0,d,!0,!0),o=o.substr(0,o.lastIndexOf(`.`)),a.add(this.options.textNodeName,t),this.addChild(n,a,o,m)}else{if(u.length>0&&u.lastIndexOf(`/`)===u.length-1){if(c[c.length-1]===`/`?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName){let e=this.options.transformTagName(c);u===c&&(u=e),c=e}let e=new r(c);c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o,c)),this.addChild(n,e,o,m),o=o.substr(0,o.lastIndexOf(`.`))}else if(this.options.unpairedTags.indexOf(c)!==-1){let e=new r(c);c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o)),this.addChild(n,e,o,m),o=o.substr(0,o.lastIndexOf(`.`)),i=s.closeIndex;continue}else{let e=new r(c);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),c!==u&&d&&(e[`:@`]=this.buildAttributesMap(u,o,c)),this.addChild(n,e,o),n=e}a=``,i=f}}else a+=e[i];return t.child};function y(e,t,n,r){this.options.captureMetaData||(r=void 0);let i=this.options.updateTag(t.tagname,n,t[`:@`]);i===!1||(typeof i==`string`&&(t.tagname=i),e.addChild(t,r))}var b=function(e,t,n){if(e.indexOf(`&`)===-1)return e;let r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(t)||r.tagFilter&&!r.tagFilter(t,n))return e;for(let t in this.docTypeEntities){let n=this.docTypeEntities[t],i=e.match(n.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);let t=e.length;if(e=e.replace(n.regx,n.val),r.maxExpandedLength&&(this.currentExpandedLength+=e.length-t,this.currentExpandedLength>r.maxExpandedLength))throw Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(e.indexOf(`&`)===-1)return e;for(let t of Object.keys(this.lastEntities)){let n=this.lastEntities[t],i=e.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}if(e.indexOf(`&`)===-1)return e;if(this.options.htmlEntities)for(let t of Object.keys(this.htmlEntities)){let n=this.htmlEntities[t],i=e.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);e=e.replace(n.regex,n.val)}return e=e.replace(this.ampEntity.regex,this.ampEntity.val),e};function x(e,t,n,r){return e&&=(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[`:@`]?Object.keys(t[`:@`]).length!==0:!1,r),e!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function S(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function C(e,t,n=`>`){let r,i=``;for(let a=t;a<e.length;a++){let t=e[a];if(r)t===r&&(r=``);else if(t===`"`||t===`'`)r=t;else if(t===n[0])if(n[1]){if(e[a+1]===n[1])return{data:i,index:a}}else return{data:i,index:a};else t===` `&&(t=` `);i+=t}}function w(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}function T(e,t,n,r=`>`){let i=C(e,t+1,r);if(!i)return;let a=i.data,o=i.index,s=a.search(/\s/),c=a,l=!0;s!==-1&&(c=a.substring(0,s),a=a.substring(s+1).trimStart());let u=c;if(n){let e=c.indexOf(`:`);e!==-1&&(c=c.substr(e+1),l=c!==i.data.substr(e+1))}return{tagName:c,tagExp:a,closeIndex:o,attrExpPresent:l,rawTagName:u}}function E(e,t,n){let r=n,i=1;for(;n<e.length;n++)if(e[n]===`<`)if(e[n+1]===`/`){let a=w(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(r,n),i:a};n=a}else if(e[n+1]===`?`)n=w(e,`?>`,n+1,`StopNode is not closed.`);else if(e.substr(n+1,3)===`!--`)n=w(e,`-->`,n+3,`StopNode is not closed.`);else if(e.substr(n+1,2)===`![`)n=w(e,`]]>`,n,`StopNode is not closed.`)-2;else{let r=T(e,n,`>`);r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!==`/`&&i++,n=r.closeIndex)}}function D(e,t,r){if(t&&typeof e==`string`){let t=e.trim();return t===`true`||t!==`false`&&a(e,r)}else if(n.isExist(e))return e;else return``}function O(e,t,n){let r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+`;`}function k(e,t){if(n.criticalProperties.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return n.DANGEROUS_PROPERTY_NAMES.includes(e)?t.onDangerousProperty(e):e}t.exports=s})),v=e((e=>{function t(e,t){return n(e,t)}function n(e,t,o){let s,c={};for(let l=0;l<e.length;l++){let u=e[l],d=r(u),f=``;if(f=o===void 0?d:o+`.`+d,d===t.textNodeName)s===void 0?s=u[d]:s+=``+u[d];else if(d===void 0)continue;else if(u[d]){let e=n(u[d],t,f),r=a(e,t);u[`:@`]?i(e,u[`:@`],f,t):Object.keys(e).length===1&&e[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?e=e[t.textNodeName]:Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``),c[d]!==void 0&&c.hasOwnProperty(d)?(Array.isArray(c[d])||(c[d]=[c[d]]),c[d].push(e)):t.isArray(d,f,r)?c[d]=[e]:c[d]=e}}return typeof s==`string`?s.length>0&&(c[t.textNodeName]=s):s!==void 0&&(c[t.textNodeName]=s),c}function r(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function i(e,t,n,r){if(t){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let a=i[o];r.isArray(a,n+`.`+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function a(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]==`boolean`||e[n]===0))}e.prettify=t})),y=e(((e,t)=>{var{buildOptions:n}=f(),r=_(),{prettify:i}=v(),a=d();t.exports=class{constructor(e){this.externalEntities={},this.options=n(e)}parse(e,t){if(typeof e!=`string`)if(e.toString)e=e.toString();else throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){t===!0&&(t={});let n=a.validate(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new r(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:i(o,this.options)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}}})),b=e(((e,t)=>{function n(e,t){let n=``;return t.format&&t.indentBy.length>0&&(n=`
5
+ `),r(e,t,``,n)}function r(e,t,n,c){let l=``,u=!1;if(!Array.isArray(e)){if(e!=null){let n=e.toString();return n=s(n,t),n}return``}for(let d=0;d<e.length;d++){let f=e[d],p=i(f);if(p===void 0)continue;let m=``;if(m=n.length===0?p:`${n}.${p}`,p===t.textNodeName){let e=f[p];o(m,t)||(e=t.tagValueProcessor(p,e),e=s(e,t)),u&&(l+=c),l+=e,u=!1;continue}else if(p===t.cdataPropName){u&&(l+=c);let e=String(f[p][0][t.textNodeName]).replace(/\]\]>/g,`]]]]><![CDATA[>`);l+=`<![CDATA[${e}]]>`,u=!1;continue}else if(p===t.commentPropName){let e=String(f[p][0][t.textNodeName]).replace(/--/g,`- -`).replace(/-$/,`- `);l+=c+`<!--${e}-->`,u=!0;continue}else if(p[0]===`?`){let e=a(f[`:@`],t),n=p===`?xml`?``:c,r=f[p][0][t.textNodeName];r=r.length===0?``:` `+r,l+=n+`<${p}${r}${e}?>`,u=!0;continue}let h=c;h!==``&&(h+=t.indentBy);let g=c+`<${p}${a(f[`:@`],t)}`,_=r(f[p],t,m,h);t.unpairedTags.indexOf(p)===-1?(!_||_.length===0)&&t.suppressEmptyNode?l+=g+`/>`:_&&_.endsWith(`>`)?l+=g+`>${_}${c}</${p}>`:(l+=g+`>`,_&&c!==``&&(_.includes(`/>`)||_.includes(`</`))?l+=c+t.indentBy+_+c:l+=_,l+=`</${p}>`):t.suppressUnpairedNode?l+=g+`>`:l+=g+`/>`,u=!0}return l}function i(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==`:@`)return r}}function a(e,t){let n=``;if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t.attributeValueProcessor(r,e[r]);i=s(i,t),i===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function o(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(`.`)+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]===`*.`+n)return!0;return!1}function s(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}t.exports=n})),x=e(((e,t)=>{var n=b(),r=g(),i={attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:` `,suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:RegExp(`&`,`g`),val:`&amp;`},{regex:RegExp(`>`,`g`),val:`&gt;`},{regex:RegExp(`<`,`g`),val:`&lt;`},{regex:RegExp(`'`,`g`),val:`&apos;`},{regex:RegExp(`"`,`g`),val:`&quot;`}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(e){this.options=Object.assign({},i,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=r(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=s,this.tagEndChar=`>
6
6
  `,this.newLine=`
7
- `):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``)}a.prototype.build=function(e){return this.options.preserveOrder?n(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},a.prototype.j2x=function(e,t,n){let r=``,i=``,a=n.join(`.`);for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(e[o]===void 0)this.isAttribute(o)&&(i+=``);else if(e[o]===null)this.isAttribute(o)||o===this.options.cdataPropName?i+=``:o[0]===`?`?i+=this.indentate(t)+`<`+o+`?`+this.tagEndChar:i+=this.indentate(t)+`<`+o+`/`+this.tagEndChar;else if(e[o]instanceof Date)i+=this.buildTextValNode(e[o],o,``,t);else if(typeof e[o]!=`object`){let n=this.isAttribute(o);if(n&&!this.ignoreAttributesFn(n,a))r+=this.buildAttrPairStr(n,``+e[o]);else if(!n)if(o===this.options.textNodeName){let t=this.options.tagValueProcessor(o,``+e[o]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[o],o,``,t)}else if(Array.isArray(e[o])){let r=e[o].length,a=``,s=``;for(let c=0;c<r;c++){let r=e[o][c];if(r!==void 0)if(r===null)o[0]===`?`?i+=this.indentate(t)+`<`+o+`?`+this.tagEndChar:i+=this.indentate(t)+`<`+o+`/`+this.tagEndChar;else if(typeof r==`object`)if(this.options.oneListGroup){let e=this.j2x(r,t+1,n.concat(o));a+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(s+=e.attrStr)}else a+=this.processTextOrObjNode(r,o,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(o,r);e=this.replaceEntitiesValue(e),a+=e}else a+=this.buildTextValNode(r,o,``,t)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,t)),i+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let t=Object.keys(e[o]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],``+e[o][t[i]])}else i+=this.processTextOrObjNode(e[o],o,t,n);return{attrStr:r,val:i}},a.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,``+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t===`true`?` `+e:` `+e+`="`+t+`"`};function o(e,t,n,r){let i=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}a.prototype.buildObjectNode=function(e,t,n,r){if(e===``)return t[0]===`?`?this.indentate(r)+`<`+t+n+`?`+this.tagEndChar:this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar;{let i=`</`+t+this.tagEndChar,a=``;return t[0]===`?`&&(a=`?`,i=``),(n||n===``)&&e.indexOf(`<`)===-1?this.indentate(r)+`<`+t+n+a+`>`+e+i:this.options.commentPropName!==!1&&t===this.options.commentPropName&&a.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+`<`+t+n+a+this.tagEndChar+e+this.indentate(r)+i}},a.prototype.closeTag=function(e){let t=``;return this.options.unpairedTags.indexOf(e)===-1?t=this.options.suppressEmptyNode?`/`:`></${e}`:this.options.suppressUnpairedNode||(t=`/`),t},a.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===``?this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+`<`+t+n+`>`+i+`</`+t+this.tagEndChar}},a.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function s(e){return this.options.indentBy.repeat(e)}function c(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}t.exports=a})),S=e(((e,t)=>{var n=d();t.exports={XMLParser:y(),XMLValidator:n,XMLBuilder:x()}}))(),C=class{alphabet;padding;decodeMap=new Map;constructor(e,t){if(e.length!==32)throw Error(`Invalid alphabet`);if(this.alphabet=e,this.padding=t?.padding??`=`,this.alphabet.includes(this.padding)||this.padding.length!==1)throw Error(`Invalid padding`);for(let t=0;t<e.length;t++)this.decodeMap.set(e[t],t)}encode(e,t){let n=``,r=0,i=0;for(let t=0;t<e.length;t++)for(r=r<<8|e[t],i+=8;i>=5;)i-=5,n+=this.alphabet[r>>i&31];if(i>0&&(n+=this.alphabet[r<<5-i&31]),t?.includePadding??!0){let e=(8-n.length%8)%8;for(let t=0;t<e;t++)n+=`=`}return n}decode(e,t){let n=t?.strict??!0,r=Math.ceil(e.length/8),i=[];for(let t=0;t<r;t++){let a=0,o=[];for(let i=0;i<8;i++){let s=e[t*8+i];if(s===`=`){if(t+1!==r)throw Error(`Invalid character: ${s}`);a+=1;continue}if(s===void 0){if(n)throw Error(`Invalid data`);a+=1;continue}let c=this.decodeMap.get(s)??null;if(c===null)throw Error(`Invalid character: ${s}`);o.push(c)}if(a===8||a===7||a===5||a===2)throw Error(`Invalid padding`);let s=(o[0]<<3)+(o[1]>>2);if(i.push(s),a<6){let e=((o[1]&3)<<6)+(o[2]<<1)+(o[3]>>4);i.push(e)}if(a<4){let e=((o[3]&255)<<4)+(o[4]>>1);i.push(e)}if(a<3){let e=((o[4]&1)<<7)+(o[5]<<2)+(o[6]>>3);i.push(e)}if(a<1){let e=((o[6]&7)<<5)+o[7];i.push(e)}}return Uint8Array.from(i)}};new C(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`),new C(`0123456789ABCDEFGHIJKLMNOPQRSTUV`);var w=class{alphabet;padding;decodeMap=new Map;constructor(e,t){if(e.length!==64)throw Error(`Invalid alphabet`);if(this.alphabet=e,this.padding=t?.padding??`=`,this.alphabet.includes(this.padding)||this.padding.length!==1)throw Error(`Invalid padding`);for(let t=0;t<e.length;t++)this.decodeMap.set(e[t],t)}encode(e,t){let n=``,r=0,i=0;for(let t=0;t<e.length;t++)for(r=r<<8|e[t],i+=8;i>=6;)i+=-6,n+=this.alphabet[r>>i&63];if(i>0&&(n+=this.alphabet[r<<6-i&63]),t?.includePadding??!0){let e=(4-n.length%4)%4;for(let t=0;t<e;t++)n+=`=`}return n}decode(e,t){let n=t?.strict??!0,r=Math.ceil(e.length/4),i=[];for(let t=0;t<r;t++){let a=0,o=0;for(let i=0;i<4;i++){let s=e[t*4+i];if(s===`=`){if(t+1!==r)throw Error(`Invalid character: ${s}`);a+=1;continue}if(s===void 0){if(n)throw Error(`Invalid data`);a+=1;continue}let c=this.decodeMap.get(s)??null;if(c===null)throw Error(`Invalid character: ${s}`);o+=c<<6*(3-i)}i.push(o>>16&255),a<2&&i.push(o>>8&255),a<1&&i.push(o&255)}return Uint8Array.from(i)}},T=new w(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`);new w(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`);var E=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,D=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=E[n[e]&63];return t};async function O(e){let t=new DecompressionStream(`deflate-raw`),n=new Uint8Array(e),r=new Blob([n]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}async function k(e){let t=await T.decode(e.replace(/ /g,`+`));try{let e=await O(t);return new TextDecoder().decode(e)}catch(e){return console.warn(`Decompression failed, assuming data is not compressed:`,e),new TextDecoder().decode(t)}}async function A(e){let t=await k(e),n=new S.XMLParser({attributeNamePrefix:`@_`,alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(t);return i.parse(n)}function j(e){let t=e.certificates.map(e=>({"@_use":`signing`,KeyInfo:{"@_xmlns":`http://www.w3.org/2000/09/xmldsig#`,X509Data:{X509Certificate:e}}})),n={EntityDescriptor:{"@_entityID":e.entityId,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:metadata`,IDPSSODescriptor:{"@_protocolSupportEnumeration":`urn:oasis:names:tc:SAML:2.0:protocol`,KeyDescriptor:t,SingleLogoutService:[{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`,"@_Location":e.singleLogoutServiceUrl},{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`,"@_Location":e.singleLogoutServiceUrl}],NameIDFormat:[`urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`,`urn:oasis:names:tc:SAML:2.0:nameid-format:persistent`,`urn:oasis:names:tc:SAML:2.0:nameid-format:transient`],SingleSignOnService:[{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`,"@_Location":e.assertionConsumerServiceUrl},{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`,"@_Location":e.assertionConsumerServiceUrl}],Attribute:[{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`E-Mail Address`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Given Name`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Name`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Surname`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Name ID`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`}]}}};return new S.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!1,format:!0,attributeNamePrefix:`@_`}).build(n)}async function M(e,t){let n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+600*1e3).toISOString(),i=e.issueInstant||n,a=e.sessionNotOnOrAfter||r,o=e.responseId||`_${D()}`,s=e.assertionId||`_${D()}`,c=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":`urn:oasis:names:tc:SAML:2.0:status:Success`}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":`urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":`urn:oasis:names:tc:SAML:2.0:cm:bearer`}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":`urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified`}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":a}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_FriendlyName":`persistent`,"@_Name":`id`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`email`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`manage-account`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`default-roles-master`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`offline_access`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`view-profile`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`uma_authorization`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`manage-account-links`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}}]}],":@":{"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`,"@_ID":s,"@_IssueInstant":i,"@_Version":`2.0`}}],":@":{"@_xmlns:samlp":`urn:oasis:names:tc:SAML:2.0:protocol`,"@_xmlns:saml":`urn:oasis:names:tc:SAML:2.0:assertion`,"@_Destination":e.destination,"@_ID":o,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":`2.0`}}],l=new S.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(c);return e.signature&&t&&(l=await t.signSAML(l,e.signature.privateKeyPem,e.signature.cert)),e.encode===!1?l:btoa(l)}var N=`http://www.w3.org/2001/04/xmldsig-more#rsa-sha256`,P=`http://www.w3.org/2001/04/xmlenc#sha256`,F=`http://www.w3.org/2001/10/xml-exc-c14n#`,I=class{async signSAML(e,t,n){try{let r=await import(`xml-crypto`),i=r.SignedXml||r.default?.SignedXml;if(!i)throw Error(`SignedXml not found in xml-crypto module`);let a=new i({privateKey:t,publicCert:n});a.canonicalizationAlgorithm=F,a.addReference({xpath:`(/*[local-name()='Response']/*[local-name()='Assertion'])[1]`,digestAlgorithm:P,transforms:[`http://www.w3.org/2000/09/xmldsig#enveloped-signature`,F]}),a.signatureAlgorithm=N;let o=n.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g,``).replace(/\s/g,``);return a.keyInfoProvider={getKeyInfo:()=>`<X509Data><X509Certificate>${o}</X509Certificate></X509Data>`},a.computeSignature(e,{location:{reference:`/*[local-name()='Response']/*[local-name()='Assertion']/*[local-name()='Issuer']`,action:`after`}}),a.getSignedXml()}catch(e){throw Error(`Failed to sign SAML locally. Make sure xml-crypto is installed. Error: ${e}`)}}},L=class{signUrl;constructor(e){this.signUrl=e}async signSAML(e,t,n){let r=await fetch(this.signUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({xmlContent:e,privateKey:t,publicCert:n})});if(!r.ok)throw Error(`Failed to sign SAML via HTTP: ${r.status} ${r.statusText}`);return await r.text()}};exports.HttpSamlSigner=L,exports.LocalSamlSigner=I,exports.createSamlMetadata=j,exports.createSamlResponse=M,exports.dsSignatureSchema=c,exports.inflateDecompress=k,exports.inflateRaw=O,exports.parseSamlRequestQuery=A,exports.samlIssuerSchema=r,exports.samlMetadataResponseSchema=a,exports.samlRequestSchema=i,exports.samlResponseJsonSchema=l;
7
+ `):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``)}a.prototype.build=function(e){return this.options.preserveOrder?n(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},a.prototype.j2x=function(e,t,n){let r=``,i=``,a=n.join(`.`);for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(e[o]===void 0)this.isAttribute(o)&&(i+=``);else if(e[o]===null)this.isAttribute(o)||o===this.options.cdataPropName?i+=``:o[0]===`?`?i+=this.indentate(t)+`<`+o+`?`+this.tagEndChar:i+=this.indentate(t)+`<`+o+`/`+this.tagEndChar;else if(e[o]instanceof Date)i+=this.buildTextValNode(e[o],o,``,t);else if(typeof e[o]!=`object`){let n=this.isAttribute(o);if(n&&!this.ignoreAttributesFn(n,a))r+=this.buildAttrPairStr(n,``+e[o]);else if(!n)if(o===this.options.textNodeName){let t=this.options.tagValueProcessor(o,``+e[o]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[o],o,``,t)}else if(Array.isArray(e[o])){let r=e[o].length,a=``,s=``;for(let c=0;c<r;c++){let r=e[o][c];if(r!==void 0)if(r===null)o[0]===`?`?i+=this.indentate(t)+`<`+o+`?`+this.tagEndChar:i+=this.indentate(t)+`<`+o+`/`+this.tagEndChar;else if(typeof r==`object`)if(this.options.oneListGroup){let e=this.j2x(r,t+1,n.concat(o));a+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(s+=e.attrStr)}else a+=this.processTextOrObjNode(r,o,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(o,r);e=this.replaceEntitiesValue(e),a+=e}else a+=this.buildTextValNode(r,o,``,t)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,t)),i+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let t=Object.keys(e[o]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],``+e[o][t[i]])}else i+=this.processTextOrObjNode(e[o],o,t,n);return{attrStr:r,val:i}},a.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,``+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t===`true`?` `+e:` `+e+`="`+t+`"`};function o(e,t,n,r){let i=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}a.prototype.buildObjectNode=function(e,t,n,r){if(e===``)return t[0]===`?`?this.indentate(r)+`<`+t+n+`?`+this.tagEndChar:this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar;{let i=`</`+t+this.tagEndChar,a=``;if(t[0]===`?`&&(a=`?`,i=``),(n||n===``)&&e.indexOf(`<`)===-1)return this.indentate(r)+`<`+t+n+a+`>`+e+i;if(this.options.commentPropName!==!1&&t===this.options.commentPropName&&a.length===0){let t=String(e).replace(/--/g,`- -`).replace(/-$/,`- `);return this.indentate(r)+`<!--${t}-->`+this.newLine}else return this.indentate(r)+`<`+t+n+a+this.tagEndChar+e+this.indentate(r)+i}},a.prototype.closeTag=function(e){let t=``;return this.options.unpairedTags.indexOf(e)===-1?t=this.options.suppressEmptyNode?`/`:`></${e}`:this.options.suppressUnpairedNode||(t=`/`),t},a.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName){let t=String(e).replace(/\]\]>/g,`]]]]><![CDATA[>`);return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&t===this.options.commentPropName){let t=String(e).replace(/--/g,`- -`).replace(/-$/,`- `);return this.indentate(r)+`<!--${t}-->`+this.newLine}else if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;else{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===``?this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+`<`+t+n+`>`+i+`</`+t+this.tagEndChar}},a.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function s(e){return this.options.indentBy.repeat(e)}function c(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}t.exports=a})),S=e(((e,t)=>{var n=d();t.exports={XMLParser:y(),XMLValidator:n,XMLBuilder:x()}}))(),C=t.z.object({created_at:t.z.string(),updated_at:t.z.string()}),w=t.z.object({id:t.z.string(),version:t.z.string().optional()}),T=t.z.object({name:t.z.string(),version:t.z.string()}),E=t.z.object({name:t.z.string(),value:t.z.string().optional()}),D=t.z.object({name:t.z.string().max(255),code:t.z.string().max(1e5),supported_triggers:t.z.array(w).optional(),runtime:t.z.string().max(50).optional(),dependencies:t.z.array(T).optional(),secrets:t.z.array(E).optional(),is_system:t.z.boolean().optional(),inherit:t.z.boolean().optional()});D.partial().extend({status:t.z.enum([`draft`,`built`]).optional(),deployed_at:t.z.string().optional()}),D.extend({id:t.z.string(),tenant_id:t.z.string(),status:t.z.enum([`draft`,`built`]).default(`built`),deployed_at:t.z.string().optional(),secrets:t.z.array(t.z.object({name:t.z.string(),value:t.z.string().optional()})).optional()}).extend(C.shape);var O=t.z.string(),k=t.z.enum([`unspecified`,`pending`,`final`,`partial`,`canceled`,`suspended`]),ee=t.z.object({id:t.z.string(),msg:t.z.string(),url:t.z.string().optional()}),te=t.z.object({action_name:t.z.string(),error:ee.nullable(),started_at:t.z.string(),ended_at:t.z.string()}),ne=t.z.object({level:t.z.enum([`log`,`info`,`warn`,`error`,`debug`]),message:t.z.string()}),re=t.z.array(t.z.object({action_name:t.z.string(),lines:t.z.array(ne)}));t.z.object({id:t.z.string(),tenant_id:t.z.string(),trigger_id:O,status:k,results:t.z.array(te),logs:re.optional(),created_at:t.z.string(),updated_at:t.z.string()}).omit({tenant_id:!0,created_at:!0,updated_at:!0}),t.z.object({action_id:t.z.string(),code:t.z.string().max(1e5),runtime:t.z.string().max(50).optional(),dependencies:t.z.array(T).optional(),secrets:t.z.array(E).optional(),supported_triggers:t.z.array(w).optional(),deployed:t.z.boolean().default(!0)}).extend({id:t.z.string(),tenant_id:t.z.string(),number:t.z.number().int()}).extend(C.shape);var ie=t.z.enum([`user_action`,`admin_action`,`system`,`api`]),ae=t.z.object({type:t.z.enum([`user`,`admin`,`system`,`api_key`,`client_credentials`]),id:t.z.string().optional(),email:t.z.string().optional(),org_id:t.z.string().optional(),org_name:t.z.string().optional(),scopes:t.z.array(t.z.string()).optional(),client_id:t.z.string().optional()}),oe=t.z.object({type:t.z.string(),id:t.z.string(),before:t.z.record(t.z.string(),t.z.unknown()).optional(),after:t.z.record(t.z.string(),t.z.unknown()).optional(),diff:t.z.record(t.z.string(),t.z.object({old:t.z.unknown(),new:t.z.unknown()})).optional()}),se=t.z.object({method:t.z.string(),path:t.z.string(),query:t.z.record(t.z.string(),t.z.string()).optional(),body:t.z.unknown().optional(),ip:t.z.string(),user_agent:t.z.string().optional(),correlation_id:t.z.string().optional()}),ce=t.z.object({status_code:t.z.number(),body:t.z.unknown().optional()}),le=t.z.object({country_code:t.z.string(),city_name:t.z.string(),latitude:t.z.string(),longitude:t.z.string(),time_zone:t.z.string(),continent_code:t.z.string()}),ue=t.z.object({name:t.z.string(),version:t.z.string(),env:t.z.record(t.z.string(),t.z.string()).optional()});t.z.object({tenant_id:t.z.string(),event_type:t.z.string(),log_type:t.z.string(),description:t.z.string().optional(),category:ie,actor:ae,target:oe,request:se,response:ce.optional(),connection:t.z.string().optional(),connection_id:t.z.string().optional(),client_name:t.z.string().optional(),strategy:t.z.string().optional(),strategy_type:t.z.string().optional(),audience:t.z.string().optional(),scope:t.z.string().optional(),location:le.optional(),auth0_client:ue.optional(),hostname:t.z.string(),is_mobile:t.z.boolean().optional(),timestamp:t.z.string()}).extend({id:t.z.string()}),t.z.enum([`AUTH0`,`EMAIL`,`REDIRECT`]),t.z.enum([`CREATE_USER`,`GET_USER`,`UPDATE_USER`,`SEND_REQUEST`,`SEND_EMAIL`]),t.z.enum([`VERIFY_EMAIL`]);var de=t.z.object({require_mx_record:t.z.boolean().optional(),block_aliases:t.z.boolean().optional(),block_free_emails:t.z.boolean().optional(),block_disposable_emails:t.z.boolean().optional(),blocklist:t.z.array(t.z.string()).optional(),allowlist:t.z.array(t.z.string()).optional()}),fe=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal(`AUTH0`),action:t.z.literal(`UPDATE_USER`),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({connection_id:t.z.string().optional(),user_id:t.z.string(),changes:t.z.record(t.z.string(),t.z.any())})}),pe=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal(`EMAIL`),action:t.z.literal(`VERIFY_EMAIL`),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({email:t.z.string(),rules:de.optional()})}),me=t.z.enum([`change-email`,`account`,`custom`]),he=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal(`REDIRECT`),action:t.z.literal(`REDIRECT_USER`),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({target:me.openapi({description:`The predefined target to redirect to, or 'custom' for a custom URL`}),custom_url:t.z.string().optional().openapi({description:`Custom URL to redirect to when target is 'custom'`})})}),ge=t.z.union([fe,pe,he]);t.z.object({name:t.z.string().min(1).max(150).openapi({description:`The name of the flow`}),actions:t.z.array(ge).optional().default([]).openapi({description:`The list of actions to execute in sequence`})}).extend(C.shape).extend({id:t.z.string().openapi({description:`Unique identifier for the flow`,example:`af_12tMpdJ3iek7svMyZkSh5M`})}),t.z.object({page:t.z.string().min(0).optional().default(`0`).transform(e=>parseInt(e,10)).openapi({description:`The page number where 0 is the first page`}),per_page:t.z.string().min(1).optional().default(`10`).transform(e=>parseInt(e,10)).openapi({description:`The number of items per page`}),include_totals:t.z.string().optional().default(`false`).transform(e=>e===`true`).openapi({description:`If the total number of items should be included in the response`}),sort:t.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:`A property that should have the format 'string:-1' or 'string:1'`}),q:t.z.string().optional().openapi({description:`A lucene query string used to filter the results`})}),t.z.object({start:t.z.number(),limit:t.z.number(),length:t.z.number(),total:t.z.number().optional(),next:t.z.string().optional()});var _e=t.z.object({email:t.z.string().optional(),email_verified:t.z.boolean().optional(),name:t.z.string().optional(),username:t.z.string().optional(),given_name:t.z.string().optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),family_name:t.z.string().optional()}).catchall(t.z.any()),ve=t.z.object({connection:t.z.string(),user_id:t.z.string(),provider:t.z.string(),isSocial:t.z.boolean(),email:t.z.string().optional(),email_verified:t.z.boolean().optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),username:t.z.string().optional(),access_token:t.z.string().optional(),access_token_secret:t.z.string().optional(),refresh_token:t.z.string().optional(),profileData:_e.optional()}),ye=t.z.object({formatted:t.z.string().optional(),street_address:t.z.string().optional(),locality:t.z.string().optional(),region:t.z.string().optional(),postal_code:t.z.string().optional(),country:t.z.string().optional()}).optional(),A=t.z.object({email:t.z.string().transform(e=>e.toLowerCase()).optional(),username:t.z.string().refine(e=>!e.includes(`@`),{message:`Usernames must not contain "@". Use the email field for email addresses.`}).optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),given_name:t.z.string().optional(),family_name:t.z.string().optional(),nickname:t.z.string().optional(),name:t.z.string().optional(),picture:t.z.string().optional(),locale:t.z.string().optional(),linked_to:t.z.string().optional(),profileData:t.z.string().optional(),user_id:t.z.string().optional(),app_metadata:t.z.any().default({}).optional(),user_metadata:t.z.any().default({}).optional(),middle_name:t.z.string().optional(),preferred_username:t.z.string().optional(),profile:t.z.string().optional(),website:t.z.string().optional(),gender:t.z.string().optional(),birthdate:t.z.string().optional(),zoneinfo:t.z.string().optional(),address:ye});A.extend({email_verified:t.z.boolean().default(!1),verify_email:t.z.boolean().optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string().optional(),provider:t.z.string().optional(),connection:t.z.string(),is_social:t.z.boolean().optional(),registration_completed_at:t.z.string().optional(),password:t.z.object({hash:t.z.string(),algorithm:t.z.string()}).optional()}).omit({password:!0}).extend(C.shape).extend({user_id:t.z.string(),provider:t.z.string(),is_social:t.z.boolean(),email:t.z.string().optional(),login_count:t.z.number().default(0),identities:t.z.array(ve).optional()}).omit({registration_completed_at:!0}),A.extend({login_count:t.z.number(),multifactor:t.z.array(t.z.string()).optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string()}).catchall(t.z.any());var be=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,xe=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=be[n[e]&63];return t},Se=t.z.object({client_id:t.z.string().optional().openapi({description:`ID of this client. Generated server-side if omitted (Auth0 behavior).`}),name:t.z.string().min(1).openapi({description:`Name of this client (min length: 1 character, does not allow < or >).`}),description:t.z.string().max(140).optional().openapi({description:`Free text description of this client (max length: 140 characters).`}),global:t.z.boolean().default(!1).openapi({description:`Whether this is your global 'All Applications' client representing legacy tenant settings (true) or a regular client (false).`}),client_secret:t.z.string().default(()=>xe()).optional().openapi({description:`Client secret (which you must not make public).`}),app_type:t.z.enum([`native`,`spa`,`regular_web`,`non_interactive`,`resource_server`,`express_configuration`,`rms`,`box`,`cloudbees`,`concur`,`dropbox`,`mscrm`,`echosign`,`egnyte`,`newrelic`,`office365`,`salesforce`,`sentry`,`sharepoint`,`slack`,`springcm`,`zendesk`,`zoom`,`sso_integration`,`oag`]).default(`regular_web`).optional().openapi({description:`The type of application this client represents`}),logo_uri:t.z.string().url().optional().openapi({description:`URL of the logo to display for this client. Recommended size is 150x150 pixels.`}),is_first_party:t.z.boolean().default(!0).openapi({description:`Whether this client is a first party client (true) or not (false). First-party clients skip the consent screen; third-party clients require explicit user consent for non-basic scopes.`}),oidc_conformant:t.z.boolean().default(!0).openapi({description:`Whether this client conforms to strict OIDC specifications (true) or uses legacy features (false).`}),auth0_conformant:t.z.boolean().default(!0).openapi({description:`Whether this client follows Auth0-compatible behavior (true) or strict OIDC behavior (false). When true, profile/email claims are included in the ID token when scopes are requested. When false, these claims are only available from the userinfo endpoint (strict OIDC 5.4 compliance).`}),callbacks:t.z.array(t.z.string()).default([]).optional().openapi({description:`Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication.`}),allowed_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:`Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs.`}),web_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:`Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode.`}),client_aliases:t.z.array(t.z.string()).default([]).optional().openapi({description:`List of audiences/realms for SAML protocol. Used by the wsfed addon.`}),allowed_clients:t.z.array(t.z.string()).default([]).optional().openapi({description:`List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed.`}),connections:t.z.array(t.z.string()).default([]).optional().openapi({description:`List of connection IDs enabled for this client. The order determines the display order on the login page.`}),allowed_logout_urls:t.z.array(t.z.string()).default([]).optional().openapi({description:`Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains.`}),session_transfer:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Native to Web SSO Configuration`}),oidc_logout:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Configuration for OIDC backchannel logout`}),grant_types:t.z.array(t.z.string()).default([]).optional().openapi({description:`List of grant types supported for this application. Can include authorization_code, implicit, refresh_token, client_credentials, password, http://auth0.com/oauth/grant-type/password-realm, http://auth0.com/oauth/grant-type/mfa-oob, http://auth0.com/oauth/grant-type/mfa-otp, http://auth0.com/oauth/grant-type/mfa-recovery-code, urn:openid:params:grant-type:ciba, and urn:ietf:params:oauth:grant-type:device_code.`}),jwt_configuration:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Configuration related to JWTs for the client.`}),signing_keys:t.z.array(t.z.record(t.z.string(),t.z.any())).default([]).optional().openapi({description:`Signing certificates associated with this client.`}),encryption_key:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Encryption used for WsFed responses with this client.`}),sso:t.z.boolean().default(!1).openapi({description:`Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false).`}),sso_disabled:t.z.boolean().default(!1).openapi({description:`Whether Single Sign On is disabled for this client. When true, existing SSO sessions will not be reused and users must authenticate every time.`}),cross_origin_authentication:t.z.boolean().default(!1).openapi({description:`Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false).`}),cross_origin_loc:t.z.string().url().optional().openapi({description:`URL of the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.`}),custom_login_page_on:t.z.boolean().default(!1).openapi({description:`Whether a custom login page is to be used (true) or the default provided login page (false).`}),custom_login_page:t.z.string().optional().openapi({description:`The content (HTML, CSS, JS) of the custom login page.`}),custom_login_page_preview:t.z.string().optional().openapi({description:`The content (HTML, CSS, JS) of the custom login page. (Used on Previews)`}),form_template:t.z.string().optional().openapi({description:`HTML form template to be used for WS-Federation.`}),addons:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Addons enabled for this client and their associated configurations.`}),token_endpoint_auth_method:t.z.enum([`none`,`client_secret_post`,`client_secret_basic`,`client_secret_jwt`,`private_key_jwt`]).default(`client_secret_basic`).optional().openapi({description:"Defines the requested authentication method for the token endpoint. `none` (public client), `client_secret_post` / `client_secret_basic` (HTTP POST / Basic), `client_secret_jwt` (RFC 7523 HMAC assertion using client_secret), or `private_key_jwt` (RFC 7523 asymmetric assertion verified against the client's `jwks` / `jwks_uri`)."}),client_metadata:t.z.record(t.z.string(),t.z.string().max(255)).default({}).optional().openapi({description:`Metadata associated with the client, in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed. Field names (max 255 chars) are alphanumeric and may only include the following special characters: :,-+=_*?"/()<>@ [Tab][Space]`}),hide_sign_up_disabled_error:t.z.boolean().default(!1).optional().openapi({description:"Enumeration-safe variant of the connection-level `disable_signup` flag. When a signup is blocked by the password connection and this is true, the identifier screen does not reveal that an email is unknown — it advances to the OTP/password challenge as if the account existed and fails at credential check. Mitigates email enumeration at the cost of UX: users without an account see a generic credential failure instead of an explicit signup-disabled message."}),mobile:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Additional configuration for native mobile apps.`}),initiate_login_uri:t.z.string().url().optional().openapi({description:`Initiate login uri, must be https`}),native_social_login:t.z.record(t.z.string(),t.z.any()).default({}).optional(),refresh_token:t.z.object({rotation_type:t.z.enum([`rotating`,`non-rotating`]).optional().openapi({description:`Whether refresh tokens for this client are rotated on every exchange (Auth0 'rotating' behavior) or kept stable (legacy non-rotating). Defaults to 'non-rotating' when unset.`}),leeway:t.z.number().int().min(0).max(600).optional().openapi({description:`Seconds after a parent token's first rotation during which presenting it again still mints a fresh sibling child instead of triggering reuse-detection. Defaults to 30s when unset.`}),expiration_type:t.z.enum([`expiring`,`non-expiring`]).optional().openapi({description:`Auth0-compatible: whether refresh tokens expire.`}),token_lifetime:t.z.number().int().min(0).optional().openapi({description:`Auth0-compatible: refresh-token absolute lifetime in seconds.`}),infinite_token_lifetime:t.z.boolean().optional().openapi({description:`Auth0-compatible: when true, refresh tokens have no absolute expiry.`}),idle_token_lifetime:t.z.number().int().min(0).optional().openapi({description:`Auth0-compatible: refresh-token idle (sliding) lifetime in seconds.`}),infinite_idle_token_lifetime:t.z.boolean().optional().openapi({description:`Auth0-compatible: when true, refresh tokens have no idle expiry.`})}).default({}).optional().openapi({description:`Refresh token configuration`}),default_organization:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Defines the default Organization ID and flows`}),organization_usage:t.z.enum([`deny`,`allow`,`require`]).default(`deny`).optional().openapi({description:`Defines how to proceed during an authentication transaction with regards an organization. Can be deny (default), allow or require.`}),organization_require_behavior:t.z.enum([`no_prompt`,`pre_login_prompt`,`post_login_prompt`]).default(`no_prompt`).optional().openapi({description:`Defines how to proceed during an authentication transaction when client.organization_usage: 'require'. Can be no_prompt (default), pre_login_prompt or post_login_prompt. post_login_prompt requires oidc_conformant: true.`}),client_authentication_methods:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Defines client authentication methods.`}),require_pushed_authorization_requests:t.z.boolean().default(!1).openapi({description:`Makes the use of Pushed Authorization Requests mandatory for this client`}),require_proof_of_possession:t.z.boolean().default(!1).openapi({description:`Makes the use of Proof-of-Possession mandatory for this client`}),signed_request_object:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`JWT-secured Authorization Requests (JAR) settings.`}),compliance_level:t.z.enum([`none`,`fapi1_adv_pkj_par`,`fapi1_adv_mtls_par`,`fapi2_sp_pkj_mtls`,`fapi2_sp_mtls_mtls`]).optional().openapi({description:`Defines the compliance level for this client, which may restrict it's capabilities`}),par_request_expiry:t.z.number().optional().openapi({description:`Specifies how long, in seconds, a Pushed Authorization Request URI remains valid`}),token_quota:t.z.record(t.z.string(),t.z.any()).default({}).optional(),owner_user_id:t.z.string().optional().openapi({description:`User ID of the consenting user when this client was created via IAT-gated Dynamic Client Registration. NULL for clients created via the Management API or open DCR.`}),registration_type:t.z.enum([`manual`,`open_dcr`,`iat_dcr`]).optional().openapi({description:"Provenance of this client. `manual` = Management API; `open_dcr` = RFC 7591 without IAT; `iat_dcr` = RFC 7591 with an Initial Access Token."}),registration_metadata:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:"Arbitrary metadata captured at Dynamic Client Registration time that isn't a first-class client field (e.g. integration_type, domain). Also stores `iat_constraints` for clients created via IAT so RFC 7592 PUT can enforce field immutability."}),user_linking_mode:t.z.enum([`builtin`,`off`]).optional().openapi({description:"Per-client override for the built-in email-based user-linking path. `builtin` runs the legacy in-process linking at user creation/email update. `off` disables the legacy path; linking only happens if the tenant has enabled the `account-linking` template hook. When unset, the service-level `userLinkingMode` default applies."})});t.z.object({created_at:t.z.string(),updated_at:t.z.string()}).extend(Se.shape).extend({client_id:t.z.string()});var Ce=t.z.object({client_id:t.z.string().min(1).openapi({description:`ID of the client.`}),audience:t.z.string().min(1).openapi({description:`The audience (API identifier) of this client grant.`}),scope:t.z.array(t.z.string()).optional().openapi({description:`Scopes allowed for this client grant.`}),organization_usage:t.z.enum([`deny`,`allow`,`require`]).optional().openapi({description:`Defines whether organizations can be used with client credentials exchanges for this grant.`}),allow_any_organization:t.z.boolean().optional().openapi({description:`If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.`}),is_system:t.z.boolean().optional().openapi({description:`If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly.`}),subject_type:t.z.enum([`client`,`user`]).optional().openapi({description:`The type of application access the client grant allows. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement.`}),authorization_details_types:t.z.array(t.z.string()).optional().openapi({description:`Types of authorization_details allowed for this client grant. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement.`})}),we=t.z.object({id:t.z.string().openapi({description:`ID of the client grant.`})}).extend(Ce.shape).extend({created_at:t.z.string().optional(),updated_at:t.z.string().optional()});t.z.array(we);var Te=t.z.enum([`iat`,`rat`]),Ee=t.z.object({id:t.z.string(),token_hash:t.z.string(),type:Te,client_id:t.z.string().optional(),sub:t.z.string().optional(),constraints:t.z.record(t.z.string(),t.z.unknown()).optional(),single_use:t.z.boolean().default(!1),expires_at:t.z.string().optional()});t.z.object({created_at:t.z.string(),used_at:t.z.string().optional(),revoked_at:t.z.string().optional()}).extend(Ee.shape);var j=t.z.object({x:t.z.number(),y:t.z.number()}),De=function(e){return e.RICH_TEXT=`RICH_TEXT`,e.NEXT_BUTTON=`NEXT_BUTTON`,e.BACK_BUTTON=`BACK_BUTTON`,e.SUBMIT_BUTTON=`SUBMIT_BUTTON`,e.DIVIDER=`DIVIDER`,e.TEXT=`TEXT`,e.EMAIL=`EMAIL`,e.PASSWORD=`PASSWORD`,e.NUMBER=`NUMBER`,e.PHONE=`PHONE`,e.DATE=`DATE`,e.CHECKBOX=`CHECKBOX`,e.RADIO=`RADIO`,e.SELECT=`SELECT`,e.HIDDEN=`HIDDEN`,e.LEGAL=`LEGAL`,e}({}),Oe=function(e){return e.BLOCK=`BLOCK`,e.FIELD=`FIELD`,e}({}),M=t.z.object({id:t.z.string(),category:t.z.nativeEnum(Oe),type:t.z.nativeEnum(De)}),ke=M.extend({category:t.z.literal(`BLOCK`),type:t.z.literal(`RICH_TEXT`),config:t.z.object({content:t.z.string()}).passthrough()}),Ae=M.extend({category:t.z.literal(`BLOCK`),type:t.z.union([t.z.literal(`NEXT_BUTTON`),t.z.literal(`BACK_BUTTON`),t.z.literal(`SUBMIT_BUTTON`)]),config:t.z.object({text:t.z.string()}).passthrough()}),je=M.extend({category:t.z.literal(`FIELD`),type:t.z.literal(`LEGAL`),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({text:t.z.string()}).passthrough()}),Me=M.extend({category:t.z.literal(`FIELD`),type:t.z.union([t.z.literal(`TEXT`),t.z.literal(`EMAIL`),t.z.literal(`PASSWORD`),t.z.literal(`NUMBER`),t.z.literal(`PHONE`),t.z.literal(`DATE`),t.z.literal(`CHECKBOX`),t.z.literal(`RADIO`),t.z.literal(`SELECT`),t.z.literal(`HIDDEN`)]),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({label:t.z.string().optional(),placeholder:t.z.string().optional()}).passthrough()}),Ne=t.z.object({id:t.z.string(),category:t.z.string(),type:t.z.string()}).passthrough(),Pe=t.z.union([ke,Ae,je,Me,Ne]),Fe=t.z.object({id:t.z.string(),type:t.z.literal(`STEP`),coordinates:j,alias:t.z.string().optional(),config:t.z.object({components:t.z.array(Pe),next_node:t.z.string()}).passthrough()}),Ie=t.z.object({id:t.z.string(),type:t.z.literal(`FLOW`),coordinates:j,alias:t.z.string().optional(),config:t.z.object({flow_id:t.z.string(),next_node:t.z.string()})}),Le=t.z.object({id:t.z.string(),type:t.z.literal(`ACTION`),coordinates:j,alias:t.z.string().optional(),config:t.z.object({action_type:t.z.enum([`REDIRECT`]).openapi({description:`The type of action to perform`}),target:t.z.enum([`change-email`,`account`,`custom`]).openapi({description:`The predefined target to redirect to`}),custom_url:t.z.string().optional().openapi({description:`Custom URL when target is 'custom'`}),next_node:t.z.string().openapi({description:`The next node to navigate to after action (for non-redirect actions)`})}).passthrough()}),Re=t.z.object({id:t.z.string(),type:t.z.string(),coordinates:j}).passthrough(),ze=t.z.union([Fe,Ie,Le,Re]),Be=t.z.object({next_node:t.z.string(),coordinates:j}).passthrough(),Ve=t.z.object({resume_flow:t.z.boolean().optional(),coordinates:j}).passthrough();t.z.object({id:t.z.string(),name:t.z.string(),languages:t.z.object({primary:t.z.string()}).passthrough(),nodes:t.z.array(ze),start:Be,ending:Ve,created_at:t.z.string(),updated_at:t.z.string(),links:t.z.object({sdkSrc:t.z.string().optional(),sdk_src:t.z.string().optional()}).passthrough()}).passthrough().omit({id:!0,created_at:!0,updated_at:!0});var He=function(e){return e.TOKEN=`token`,e.ID_TOKEN=`id_token`,e.TOKEN_ID_TOKEN=`id_token token`,e.CODE=`code`,e.CODE_ID_TOKEN=`code id_token`,e.CODE_TOKEN=`code token`,e.CODE_ID_TOKEN_TOKEN=`code id_token token`,e}({}),Ue=function(e){return e.QUERY=`query`,e.FRAGMENT=`fragment`,e.FORM_POST=`form_post`,e.WEB_MESSAGE=`web_message`,e.SAML_POST=`saml_post`,e}({}),We=function(e){return e.S256=`S256`,e.Plain=`plain`,e}({}),N=t.z.union([t.z.null(),t.z.object({essential:t.z.boolean().optional(),value:t.z.unknown().optional(),values:t.z.array(t.z.unknown()).optional()})]).nullable(),Ge=t.z.object({userinfo:t.z.record(t.z.string(),N).optional(),id_token:t.z.record(t.z.string(),N).optional()}),Ke=t.z.object({client_id:t.z.string(),act_as:t.z.string().optional(),response_type:t.z.nativeEnum(He).optional(),response_mode:t.z.nativeEnum(Ue).optional(),redirect_uri:t.z.string().optional(),audience:t.z.string().optional(),organization:t.z.string().optional(),state:t.z.string().optional(),nonce:t.z.string().optional(),scope:t.z.string().optional(),prompt:t.z.string().optional(),code_challenge_method:t.z.nativeEnum(We).optional(),code_challenge:t.z.string().optional(),username:t.z.string().optional(),ui_locales:t.z.string().optional(),max_age:t.z.number().optional(),acr_values:t.z.string().optional(),claims:Ge.optional(),vendor_id:t.z.string().optional()});t.z.object({colors:t.z.object({primary:t.z.string(),page_background:t.z.union([t.z.string(),t.z.object({type:t.z.string().optional(),start:t.z.string().optional(),end:t.z.string().optional(),angle_deg:t.z.number().optional()})]).optional()}).optional(),logo_url:t.z.string().optional(),favicon_url:t.z.string().optional(),powered_by_logo_url:t.z.string().optional(),font:t.z.object({url:t.z.string()}).optional(),dark_mode:t.z.enum([`dark`,`light`,`auto`]).optional()});var qe=t.z.enum([`password_reset`,`email_verification`,`otp`,`mfa_otp`,`authorization_code`,`oauth2_state`,`ticket`]);t.z.object({code_id:t.z.string().openapi({description:`The code that will be used in for instance an email verification flow`}),login_id:t.z.string().openapi({description:`The id of the login session that the code is connected to`}),connection_id:t.z.string().optional().openapi({description:`The connection that the code is connected to`}),code_type:qe,code_verifier:t.z.string().optional().openapi({description:`The code verifier used in PKCE in outbound flows`}),code_challenge:t.z.string().optional().openapi({description:`The code challenge used in PKCE in outbound flows`}),code_challenge_method:t.z.enum([`plain`,`S256`]).optional().openapi({description:`The code challenge method used in PKCE in outbound flows`}),redirect_uri:t.z.string().optional().openapi({description:`The redirect URI associated with the code`}),otp:t.z.string().optional().openapi({description:`The one-time password value for OTP-based flows`}),nonce:t.z.string().optional().openapi({description:`The nonce value used for security in OIDC flows`}),state:t.z.string().optional().openapi({description:`The state parameter used for CSRF protection in OAuth flows`}),expires_at:t.z.string(),used_at:t.z.string().optional(),user_id:t.z.string().optional()}).extend({created_at:t.z.string()});var Je=t.z.object({kid:t.z.string().optional(),team_id:t.z.string().optional(),realms:t.z.string().optional(),authentication_method:t.z.string().optional(),client_id:t.z.string().optional(),client_secret:t.z.string().optional(),app_secret:t.z.string().optional(),scope:t.z.string().optional(),authorization_endpoint:t.z.string().optional(),token_endpoint:t.z.string().optional(),userinfo_endpoint:t.z.string().optional(),jwks_uri:t.z.string().optional(),discovery_url:t.z.string().optional(),issuer:t.z.string().optional(),token_endpoint_auth_method:t.z.enum([`client_secret_basic`,`client_secret_post`]).optional(),provider:t.z.string().optional(),from:t.z.string().optional(),twilio_sid:t.z.string().optional(),twilio_token:t.z.string().optional(),icon_url:t.z.string().optional(),domain_aliases:t.z.array(t.z.string()).optional(),callback_url:t.z.string().url().optional(),passwordPolicy:t.z.enum([`none`,`low`,`fair`,`good`,`excellent`]).optional(),password_complexity_options:t.z.object({min_length:t.z.number().optional()}).optional(),password_history:t.z.object({enable:t.z.boolean().optional(),size:t.z.number().optional()}).optional(),password_no_personal_info:t.z.object({enable:t.z.boolean().optional()}).optional(),password_dictionary:t.z.object({enable:t.z.boolean().optional(),dictionary:t.z.array(t.z.string()).optional()}).optional(),disable_signup:t.z.boolean().optional(),brute_force_protection:t.z.boolean().optional(),import_mode:t.z.boolean().optional(),configuration:t.z.object({token_endpoint:t.z.string().optional(),userinfo_endpoint:t.z.string().optional(),client_id:t.z.string().optional(),client_secret:t.z.string().optional(),realm:t.z.string().optional()}).optional(),attributes:t.z.object({email:t.z.object({identifier:t.z.object({active:t.z.boolean().optional()}).optional(),signup:t.z.object({status:t.z.enum([`required`,`optional`,`disabled`]).optional(),verification:t.z.object({active:t.z.boolean().optional()}).optional()}).optional(),validation:t.z.object({allowed:t.z.boolean().optional()}).optional(),unique:t.z.boolean().optional(),profile_required:t.z.boolean().optional(),verification_method:t.z.enum([`link`,`code`]).optional()}).optional(),username:t.z.object({identifier:t.z.object({active:t.z.boolean().optional()}).optional(),signup:t.z.object({status:t.z.enum([`required`,`optional`,`disabled`]).optional()}).optional(),validation:t.z.object({max_length:t.z.number().optional(),min_length:t.z.number().optional(),allowed_types:t.z.object({email:t.z.boolean().optional(),phone_number:t.z.boolean().optional()}).optional()}).optional(),profile_required:t.z.boolean().optional()}).optional(),phone_number:t.z.object({identifier:t.z.object({active:t.z.boolean().optional()}).optional(),signup:t.z.object({status:t.z.enum([`required`,`optional`,`disabled`]).optional()}).optional()}).optional()}).optional(),authentication_methods:t.z.object({password:t.z.object({enabled:t.z.boolean().optional()}).optional(),passkey:t.z.object({enabled:t.z.boolean().optional()}).optional()}).optional(),passkey_options:t.z.object({challenge_ui:t.z.enum([`both`,`autofill`,`button`]).optional(),local_enrollment_enabled:t.z.boolean().optional(),progressive_enrollment_enabled:t.z.boolean().optional()}).optional(),requires_username:t.z.boolean().optional(),validation:t.z.object({username:t.z.object({min:t.z.number().optional(),max:t.z.number().optional()}).optional()}).optional(),set_user_root_attributes:t.z.enum([`on_each_login`,`on_first_login`,`never_on_login`]).optional()});function P(e){if(e!==null){if(Array.isArray(e))return e.filter(e=>e!==null).map(P);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))r!==null&&(t[n]=P(r));return t}return e}}var Ye=t.z.object({id:t.z.string().optional(),name:t.z.string(),display_name:t.z.string().optional(),strategy:t.z.string(),options:t.z.preprocess(e=>e===null?{}:P(e),Je).default({}),enabled_clients:t.z.array(t.z.string()).default([]).optional(),response_type:t.z.custom().optional(),response_mode:t.z.custom().optional(),is_domain_connection:t.z.boolean().optional(),show_as_button:t.z.boolean().optional(),metadata:t.z.record(t.z.string(),t.z.any()).optional(),is_system:t.z.boolean().optional()});t.z.object({id:t.z.string(),created_at:t.z.string().transform(e=>e===null?``:e),updated_at:t.z.string().transform(e=>e===null?``:e)}).extend(Ye.shape);var F=t.z.object({domain:t.z.string(),custom_domain_id:t.z.string().optional(),type:t.z.enum([`auth0_managed_certs`,`self_managed_certs`]),verification_method:t.z.enum([`txt`]).optional(),tls_policy:t.z.enum([`recommended`]).optional(),custom_client_ip_header:t.z.enum([`true-client-ip`,`cf-connecting-ip`,`x-forwarded-for`,`x-azure-clientip`,`null`]).optional(),domain_metadata:t.z.record(t.z.string(),t.z.string().max(255)).optional()}),Xe=t.z.discriminatedUnion(`name`,[t.z.object({name:t.z.literal(`txt`),record:t.z.string(),domain:t.z.string()}),t.z.object({name:t.z.literal(`http`),http_body:t.z.string(),http_url:t.z.string()})]),Ze=F.extend({custom_domain_id:t.z.string(),primary:t.z.boolean(),status:t.z.enum([`disabled`,`pending`,`pending_verification`,`ready`]),origin_domain_name:t.z.string().optional(),verification:t.z.object({methods:t.z.array(Xe)}).optional(),tls_policy:t.z.string().optional()});F.pick({tls_policy:!0,custom_client_ip_header:!0,domain_metadata:!0}).strict(),Ze.extend({tenant_id:t.z.string()}),t.z.object({certificate:t.z.string().regex(/^-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----\s*$/,`must be PEM-encoded; include the full certificate chain in leaf-first order`),private_key:t.z.string().regex(/-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----[\s\S]+-----END \1PRIVATE KEY-----\s*$/,`must be a PEM-encoded private key`)});var I=t.z.object({id:t.z.string(),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0)}),L=I.extend({category:t.z.literal(`BLOCK`).optional()}),Qe=L.extend({type:t.z.literal(`DIVIDER`),config:t.z.object({text:t.z.string().optional()}).optional()}),$e=L.extend({type:t.z.literal(`HTML`),config:t.z.object({content:t.z.string().optional()}).optional()}),et=L.extend({type:t.z.literal(`IMAGE`),config:t.z.object({src:t.z.string().optional(),alt:t.z.string().optional(),width:t.z.number().optional(),height:t.z.number().optional()}).optional()}),tt=L.extend({type:t.z.literal(`JUMP_BUTTON`),config:t.z.object({text:t.z.string().optional(),target_step:t.z.string().optional()})}),nt=L.extend({type:t.z.literal(`RESEND_BUTTON`),config:t.z.object({text:t.z.string().optional(),resend_action:t.z.string().optional()})}),rt=L.extend({type:t.z.literal(`NEXT_BUTTON`),config:t.z.object({text:t.z.string().optional()})}),it=L.extend({type:t.z.literal(`PREVIOUS_BUTTON`),config:t.z.object({text:t.z.string().optional()})}),at=L.extend({type:t.z.literal(`RICH_TEXT`),config:t.z.object({content:t.z.string().optional()}).optional()}),R=I.extend({category:t.z.literal(`WIDGET`).optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),ot=R.extend({type:t.z.literal(`AUTH0_VERIFIABLE_CREDENTIALS`),config:t.z.object({credential_type:t.z.string().optional()})}),st=R.extend({type:t.z.literal(`GMAPS_ADDRESS`),config:t.z.object({api_key:t.z.string().optional()})}),ct=R.extend({type:t.z.literal(`RECAPTCHA`),config:t.z.object({site_key:t.z.string().optional()})}),z=I.extend({category:t.z.literal(`FIELD`).optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),messages:t.z.array(t.z.object({id:t.z.number().optional(),text:t.z.string(),type:t.z.enum([`info`,`error`,`success`,`warning`])})).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),lt=z.extend({type:t.z.literal(`BOOLEAN`),config:t.z.object({default_value:t.z.boolean().optional()}).optional()}),ut=z.extend({type:t.z.literal(`CARDS`),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string(),description:t.z.string().optional(),image:t.z.string().optional()})).optional(),multi_select:t.z.boolean().optional()}).optional()}),dt=z.extend({type:t.z.literal(`CHOICE`),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),display:t.z.enum([`radio`,`checkbox`]).optional(),multiple:t.z.boolean().optional(),default_value:t.z.union([t.z.string(),t.z.array(t.z.string())]).optional()}).optional()}),ft=z.extend({type:t.z.literal(`CODE`),config:t.z.object({length:t.z.number().int().positive().max(100).optional(),mode:t.z.enum([`numeric`,`alphanumeric`]).optional(),auto_submit:t.z.boolean().optional(),group_size:t.z.number().int().min(0).max(100).optional(),separator:t.z.string().optional(),placeholder:t.z.string().optional(),default_value:t.z.string().optional()}).refine(e=>e.group_size===void 0||e.length===void 0||e.group_size<=e.length,{message:`group_size cannot exceed length`,path:[`group_size`]}).refine(e=>e.default_value===void 0||e.length===void 0||e.default_value.length<=e.length,{message:`default_value is longer than the configured length`,path:[`default_value`]}).optional()}),pt=z.extend({type:t.z.literal(`CUSTOM`),config:t.z.object({component:t.z.string().optional(),props:t.z.record(t.z.string(),t.z.any()).optional(),schema:t.z.record(t.z.string(),t.z.any()).optional(),code:t.z.string().optional()})}),mt=z.extend({type:t.z.literal(`DATE`),config:t.z.object({format:t.z.string().optional(),min:t.z.string().optional(),max:t.z.string().optional(),default_value:t.z.string().optional()}).optional()}),ht=z.extend({type:t.z.literal(`DROPDOWN`),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),placeholder:t.z.string().optional(),searchable:t.z.boolean().optional(),multiple:t.z.boolean().optional(),default_value:t.z.union([t.z.string(),t.z.array(t.z.string())]).optional()}).optional()}),gt=z.extend({type:t.z.literal(`EMAIL`),config:t.z.object({placeholder:t.z.string().optional(),default_value:t.z.string().optional()}).optional()}),_t=z.extend({type:t.z.literal(`FILE`),config:t.z.object({accept:t.z.string().optional(),max_size:t.z.number().optional(),multiple:t.z.boolean().optional()}).optional()}),vt=z.extend({type:t.z.literal(`LEGAL`),config:t.z.object({text:t.z.string(),html:t.z.boolean().optional()}).optional()}),yt=z.extend({type:t.z.literal(`NUMBER`),config:t.z.object({placeholder:t.z.string().optional(),min:t.z.number().optional(),max:t.z.number().optional(),step:t.z.number().optional(),default_value:t.z.string().optional()}).optional()}),bt=z.extend({type:t.z.literal(`PASSWORD`),config:t.z.object({placeholder:t.z.string().optional(),min_length:t.z.number().optional(),show_toggle:t.z.boolean().optional(),forgot_password_link:t.z.string().optional(),default_value:t.z.string().optional()}).optional()}),xt=z.extend({type:t.z.literal(`PAYMENT`),config:t.z.object({provider:t.z.string().optional(),currency:t.z.string().optional()}).optional()}),St=z.extend({type:t.z.literal(`SOCIAL`),config:t.z.object({providers:t.z.array(t.z.string()).optional(),provider_details:t.z.array(t.z.object({name:t.z.string(),strategy:t.z.string().optional(),display_name:t.z.string().optional(),icon_url:t.z.string().optional(),href:t.z.string().optional()})).optional()}).optional()}),Ct=z.extend({type:t.z.literal(`TEL`),config:t.z.object({placeholder:t.z.string().optional(),default_country:t.z.string().optional(),default_value:t.z.string().optional(),allow_email:t.z.boolean().optional()}).optional()}),wt=z.extend({type:t.z.literal(`TEXT`),config:t.z.object({placeholder:t.z.string().optional(),multiline:t.z.boolean().optional(),max_length:t.z.number().optional(),default_value:t.z.string().optional()}).optional()}),Tt=z.extend({type:t.z.literal(`COUNTRY`),config:t.z.object({placeholder:t.z.string().optional(),default_value:t.z.string().optional()}).optional()}),Et=z.extend({type:t.z.literal(`URL`),config:t.z.object({placeholder:t.z.string().optional(),default_value:t.z.string().optional()}).optional()}),Dt=t.z.discriminatedUnion(`type`,[Qe,$e,et,tt,nt,rt,it,at]),Ot=t.z.discriminatedUnion(`type`,[ot,st,ct]),kt=t.z.discriminatedUnion(`type`,[lt,ut,dt,ft,Tt,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Et]),B=t.z.union([Dt,Ot,kt]);t.z.object({id:t.z.string(),type:t.z.literal(`submit`),label:t.z.string(),className:t.z.string().optional(),disabled:t.z.boolean().optional().default(!1),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0),customizations:t.z.record(t.z.string(),t.z.any()).optional()});var V=t.z.object({x:t.z.number(),y:t.z.number()}),At=t.z.object({id:t.z.string(),type:t.z.literal(`FLOW`),coordinates:V,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({flow_id:t.z.string().max(30),next_node:t.z.string().optional()})}),jt=t.z.object({id:t.z.string(),type:t.z.literal(`ROUTER`),coordinates:V,alias:t.z.string().min(1).max(150),config:t.z.object({rules:t.z.array(t.z.object({id:t.z.string(),alias:t.z.string().min(1).max(150).optional(),condition:t.z.any(),next_node:t.z.string()})),fallback:t.z.string()})}),Mt=t.z.object({id:t.z.string(),type:t.z.literal(`STEP`),coordinates:V,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({components:t.z.array(B),next_node:t.z.string().optional()})}),Nt=t.z.discriminatedUnion(`type`,[At,jt,Mt]),Pt=t.z.object({name:t.z.string().openapi({description:`The name of the form`}),messages:t.z.object({errors:t.z.record(t.z.string(),t.z.any()).optional(),custom:t.z.record(t.z.string(),t.z.any()).optional()}).optional(),languages:t.z.object({primary:t.z.string().optional(),default:t.z.string().optional()}).optional(),translations:t.z.record(t.z.string(),t.z.any()).optional(),nodes:t.z.array(Nt).optional(),start:t.z.object({hidden_fields:t.z.array(t.z.object({key:t.z.string(),value:t.z.string()})).optional(),next_node:t.z.string().optional(),coordinates:V.optional()}).optional(),ending:t.z.object({redirection:t.z.object({delay:t.z.number().optional(),target:t.z.string().optional()}).optional(),after_submit:t.z.object({flow_id:t.z.string().optional()}).optional(),coordinates:V.optional(),resume_flow:t.z.boolean().optional()}).optional(),style:t.z.object({css:t.z.string().optional()}).optional(),links:t.z.object({sdkSrc:t.z.string().optional(),sdk_src:t.z.string().optional()}).optional()}).openapi({description:`Schema for flow-based forms (matches Auth0 Forms structure)`});C.extend(Pt.shape).extend({id:t.z.string()});var Ft=t.z.object({id:t.z.number().optional(),text:t.z.string(),type:t.z.enum([`info`,`error`,`success`,`warning`])}),It=t.z.object({id:t.z.string().optional(),text:t.z.string(),href:t.z.string(),linkText:t.z.string().optional()});t.z.object({name:t.z.string().optional(),action:t.z.string(),method:t.z.enum([`POST`,`GET`]),title:t.z.string().optional(),description:t.z.string().optional(),components:t.z.array(B),messages:t.z.array(Ft).optional(),links:t.z.array(It).optional(),footer:t.z.string().optional()});var H=t.z.enum([`pre-user-registration`,`post-user-registration`,`post-user-login`,`post-user-update`,`validate-registration-username`,`pre-user-deletion`,`post-user-deletion`]),U=t.z.enum([`pre-user-registration`,`post-user-registration`,`post-user-login`,`validate-registration-username`,`pre-user-deletion`,`post-user-deletion`]),W=t.z.enum([`post-user-login`,`post-user-registration`,`post-user-update`,`credentials-exchange`]),G=t.z.enum([`post-user-login`,`credentials-exchange`,`pre-user-registration`,`post-user-registration`]),K=t.z.enum([`ensure-username`,`set-preferred-username`,`account-linking`]),q={enabled:t.z.boolean().default(!1),synchronous:t.z.boolean().default(!1),priority:t.z.number().optional(),hook_id:t.z.string().optional(),metadata:t.z.record(t.z.string(),t.z.unknown()).optional()},Lt=t.z.object({...q,trigger_id:H,url:t.z.string()}),Rt=t.z.object({...q,trigger_id:U,form_id:t.z.string()}),zt=t.z.object({...q,trigger_id:W,template_id:K}),Bt=t.z.object({...q,trigger_id:G,code_id:t.z.string()});t.z.union([Lt,Rt,zt,Bt]);var Vt=t.z.object({...q,trigger_id:H}).extend(C.shape).extend({hook_id:t.z.string(),url:t.z.string()}),Ht=t.z.object({...q,trigger_id:U}).extend(C.shape).extend({hook_id:t.z.string(),form_id:t.z.string()}),Ut=t.z.object({...q,trigger_id:W}).extend(C.shape).extend({hook_id:t.z.string(),template_id:K}),Wt=t.z.object({...q,trigger_id:G}).extend(C.shape).extend({hook_id:t.z.string(),code_id:t.z.string()});t.z.union([Vt,Ht,Ut,Wt]),t.z.object({code:t.z.string().max(1e5),secrets:t.z.record(t.z.string(),t.z.string()).optional()}).extend({id:t.z.string(),tenant_id:t.z.string()}).extend(C.shape);var Gt=t.z.object({name:t.z.string().optional()}),Kt=t.z.object({email:t.z.string().optional()}),qt=t.z.object({id:t.z.string().optional(),organization_id:t.z.string().max(50),inviter:Gt,invitee:Kt,invitation_url:t.z.string().url(),client_id:t.z.string(),connection_id:t.z.string().optional(),app_metadata:t.z.record(t.z.string(),t.z.any()).default({}).optional(),user_metadata:t.z.record(t.z.string(),t.z.any()).default({}).optional(),ttl_sec:t.z.number().int().max(2592e3).default(604800).optional(),roles:t.z.array(t.z.string()).default([]).optional(),send_invitation_email:t.z.boolean().default(!0).optional()});t.z.object({id:t.z.string(),organization_id:t.z.string().max(50),created_at:t.z.string().datetime(),expires_at:t.z.string().datetime(),ticket_id:t.z.string().optional()}).extend(qt.omit({id:!0}).shape);var Jt=t.z.object({alg:t.z.enum([`RS256`,`RS384`,`RS512`,`ES256`,`ES384`,`ES512`,`HS256`,`HS384`,`HS512`]),kid:t.z.string().optional(),kty:t.z.enum([`RSA`,`EC`,`oct`]),use:t.z.enum([`sig`,`enc`]).optional(),n:t.z.string().optional(),e:t.z.string().optional(),crv:t.z.string().optional(),x:t.z.string().optional(),y:t.z.string().optional(),x5t:t.z.string().optional(),x5c:t.z.array(t.z.string()).optional()}).superRefine((e,n)=>{if(e.kty===`RSA`)for(let r of[`n`,`e`])e[r]||n.addIssue({code:t.z.ZodIssueCode.custom,path:[r],message:`RSA JWK is missing required member '${r}'`});else if(e.kty===`EC`)for(let r of[`crv`,`x`,`y`])e[r]||n.addIssue({code:t.z.ZodIssueCode.custom,path:[r],message:`EC JWK is missing required member '${r}'`})});t.z.object({keys:t.z.array(Jt)}),t.z.object({issuer:t.z.string(),authorization_endpoint:t.z.string(),token_endpoint:t.z.string(),userinfo_endpoint:t.z.string(),jwks_uri:t.z.string(),registration_endpoint:t.z.string().optional(),revocation_endpoint:t.z.string(),end_session_endpoint:t.z.string().optional(),scopes_supported:t.z.array(t.z.string()),response_types_supported:t.z.array(t.z.string()),grant_types_supported:t.z.array(t.z.string()).optional(),code_challenge_methods_supported:t.z.array(t.z.string()),response_modes_supported:t.z.array(t.z.string()),subject_types_supported:t.z.array(t.z.string()),id_token_signing_alg_values_supported:t.z.array(t.z.string()),token_endpoint_auth_methods_supported:t.z.array(t.z.string()),claims_supported:t.z.array(t.z.string()),request_uri_parameter_supported:t.z.boolean(),request_parameter_supported:t.z.boolean(),claims_parameter_supported:t.z.boolean().optional(),request_object_signing_alg_values_supported:t.z.array(t.z.string()).optional(),token_endpoint_auth_signing_alg_values_supported:t.z.array(t.z.string()),client_id_metadata_document_supported:t.z.boolean().optional()});var Yt=function(e){return e.PENDING=`pending`,e.AUTHENTICATED=`authenticated`,e.AWAITING_EMAIL_VERIFICATION=`awaiting_email_verification`,e.AWAITING_MFA=`awaiting_mfa`,e.AWAITING_HOOK=`awaiting_hook`,e.AWAITING_CONTINUATION=`awaiting_continuation`,e.AWAITING_CONSENT=`awaiting_consent`,e.COMPLETED=`completed`,e.FAILED=`failed`,e.EXPIRED=`expired`,e}({}),Xt=t.z.nativeEnum(Yt),Zt=t.z.object({strategy:t.z.string(),strategy_type:t.z.string()});t.z.object({csrf_token:t.z.string(),auth0Client:t.z.string().optional(),authParams:Ke,expires_at:t.z.string(),deleted_at:t.z.string().optional(),ip:t.z.string().optional(),useragent:t.z.string().optional(),session_id:t.z.string().optional(),authorization_url:t.z.string().optional(),state:Xt.optional().default(`pending`),state_data:t.z.string().optional(),failure_reason:t.z.string().optional(),user_id:t.z.string().optional(),auth_connection:t.z.string().optional(),auth_strategy:Zt.optional(),authenticated_at:t.z.string().optional()}).openapi({description:`This represents a login sesion`}).extend({id:t.z.string().openapi({description:`This is is used as the state in the universal login`}),created_at:t.z.string(),updated_at:t.z.string()});var J={ACLS_SUMMARY:`acls_summary`,ACTIONS_EXECUTION_FAILED:`actions_execution_failed`,API_LIMIT:`api_limit`,API_LIMIT_WARNING:`api_limit_warning`,APPI:`appi`,CIBA_EXCHANGE_FAILED:`ciba_exchange_failed`,CIBA_EXCHANGE_SUCCEEDED:`ciba_exchange_succeeded`,CIBA_START_FAILED:`ciba_start_failed`,CIBA_START_SUCCEEDED:`ciba_start_succeeded`,CODE_LINK_SENT:`cls`,CODE_SENT:`cs`,DEPRECATION_NOTICE:`depnote`,FAILED_LOGIN:`f`,FAILED_BY_CONNECTOR:`fc`,FAILED_CHANGE_EMAIL:`fce`,FAILED_BY_CORS:`fco`,FAILED_CROSS_ORIGIN_AUTHENTICATION:`fcoa`,FAILED_CHANGE_PASSWORD:`fcp`,FAILED_POST_CHANGE_PASSWORD_HOOK:`fcph`,FAILED_CHANGE_PHONE_NUMBER:`fcpn`,FAILED_CHANGE_PASSWORD_REQUEST:`fcpr`,FAILED_CONNECTOR_PROVISIONING:`fcpro`,FAILED_CHANGE_USERNAME:`fcu`,FAILED_DELEGATION:`fd`,FAILED_DEVICE_ACTIVATION:`fdeac`,FAILED_DEVICE_AUTHORIZATION_REQUEST:`fdeaz`,USER_CANCELED_DEVICE_CONFIRMATION:`fdecc`,FAILED_USER_DELETION:`fdu`,FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:`feacft`,FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:`feccft`,FAILED_EXCHANGE_CUSTOM_TOKEN:`fecte`,FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:`fede`,FAILED_FEDERATED_LOGOUT:`federated_logout_failed`,FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:`fens`,FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:`feoobft`,FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:`feotpft`,FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:`fepft`,FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:`fepotpft`,FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:`fercft`,FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:`ferrt`,FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:`fertft`,FAILED_EXCHANGE_SUBJECT_TOKEN_FOR_ACCESS_TOKEN:`festft`,FAILED_HOOK:`fh`,FAILED_IMPERSONATION:`fimp`,FAILED_INVITE_ACCEPT:`fi`,FAILED_LOGOUT:`flo`,FLOWS_EXECUTION_COMPLETED:`flows_execution_completed`,FLOWS_EXECUTION_FAILED:`flows_execution_failed`,FAILED_SENDING_NOTIFICATION:`fn`,FORMS_SUBMISSION_FAILED:`forms_submission_failed`,FORMS_SUBMISSION_SUCCEEDED:`forms_submission_succeeded`,FAILED_LOGIN_INCORRECT_PASSWORD:`fp`,FAILED_PUSHED_AUTHORIZATION_REQUEST:`fpar`,FAILED_POST_USER_REGISTRATION_HOOK:`fpurh`,FAILED_SIGNUP:`fs`,FAILED_SILENT_AUTH:`fsa`,FAILED_LOGIN_INVALID_EMAIL_USERNAME:`fu`,FAILED_USERS_IMPORT:`fui`,FAILED_VERIFICATION_EMAIL:`fv`,FAILED_VERIFICATION_EMAIL_REQUEST:`fvr`,EMAIL_VERIFICATION_CONFIRMED:`gd_auth_email_verification`,EMAIL_VERIFICATION_FAILED:`gd_auth_fail_email_verification`,MFA_AUTH_FAILED:`gd_auth_failed`,MFA_AUTH_REJECTED:`gd_auth_rejected`,MFA_AUTH_SUCCESS:`gd_auth_succeed`,MFA_ENROLLMENT_COMPLETE:`gd_enrollment_complete`,TOO_MANY_MFA_FAILURES:`gd_otp_rate_limit_exceed`,MFA_RECOVERY_FAILED:`gd_recovery_failed`,MFA_RECOVERY_RATE_LIMIT_EXCEED:`gd_recovery_rate_limit_exceed`,MFA_RECOVERY_SUCCESS:`gd_recovery_succeed`,MFA_EMAIL_SENT:`gd_send_email`,EMAIL_VERIFICATION_SENT:`gd_send_email_verification`,EMAIL_VERIFICATION_SEND_FAILURE:`gd_send_email_verification_failure`,PUSH_NOTIFICATION_SENT:`gd_send_pn`,ERROR_SENDING_MFA_PUSH_NOTIFICATION:`gd_send_pn_failure`,MFA_SMS_SENT:`gd_send_sms`,ERROR_SENDING_MFA_SMS:`gd_send_sms_failure`,MFA_VOICE_CALL_SUCCESS:`gd_send_voice`,MFA_VOICE_CALL_FAILED:`gd_send_voice_failure`,SECOND_FACTOR_STARTED:`gd_start_auth`,MFA_ENROLL_STARTED:`gd_start_enroll`,MFA_ENROLLMENT_FAILED:`gd_start_enroll_failed`,GUARDIAN_TENANT_UPDATE:`gd_tenant_update`,UNENROLL_DEVICE_ACCOUNT:`gd_unenroll`,UPDATE_DEVICE_ACCOUNT:`gd_update_device_account`,WEBAUTHN_CHALLENGE_FAILED:`gd_webauthn_challenge_failed`,WEBAUTHN_ENROLLMENT_FAILED:`gd_webauthn_enrollment_failed`,FAILED_KMS_API_OPERATION:`kms_key_management_failure`,SUCCESS_KMS_API_OPERATION:`kms_key_management_success`,KMS_KEY_STATE_CHANGED:`kms_key_state_changed`,TOO_MANY_CALLS_TO_DELEGATION:`limit_delegation`,BLOCKED_IP_ADDRESS:`limit_mu`,BLOCKED_ACCOUNT_IP:`limit_sul`,BLOCKED_ACCOUNT_EMAIL:`limit_wc`,INFORMATION:`i`,MFA_REQUIRED:`mfar`,MANAGEMENT_API_READ_OPERATION:`mgmt_api_read`,FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:`my_account_authentication_method_failed`,SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:`my_account_authentication_method_succeeded`,FAILED_OIDC_BACKCHANNEL_LOGOUT:`oidc_backchannel_logout_failed`,SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:`oidc_backchannel_logout_succeeded`,ORGANIZATION_MEMBER_ADDED:`organization_member_added`,PASSKEY_CHALLENGE_FAILED:`passkey_challenge_failed`,PASSKEY_CHALLENGE_STARTED:`passkey_challenge_started`,PRE_LOGIN_ASSESSMENT:`pla`,BREACHED_PASSWORD:`pwd_leak`,BREACHED_PASSWORD_ON_RESET:`reset_pwd_leak`,SUCCESS_RESOURCE_CLEANUP:`resource_cleanup`,RICH_CONSENTS_ACCESS_ERROR:`rich_consents_access_error`,SUCCESS_LOGIN:`s`,SUCCESS_API_OPERATION:`sapi`,FAILED_API_OPERATION:`fapi`,SUCCESS_CHANGE_EMAIL:`sce`,SUCCESS_CROSS_ORIGIN_AUTHENTICATION:`scoa`,SUCCESS_CHANGE_PASSWORD:`scp`,SUCCESS_CHANGE_PHONE_NUMBER:`scpn`,SUCCESS_CHANGE_PASSWORD_REQUEST:`scpr`,SUCCESS_CHANGE_USERNAME:`scu`,SUCCESS_CREDENTIAL_VALIDATION:`scv`,SUCCESS_DELEGATION:`sd`,SUCCESS_USER_DELETION:`sdu`,SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:`seacft`,SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:`seccft`,SUCCESS_EXCHANGE_CUSTOM_TOKEN:`secte`,SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:`sede`,SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:`sens`,SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:`seoobft`,SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:`seotpft`,SUCCESS_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:`sepotpft`,SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:`sepft`,SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:`sepkoobft`,SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:`sepkotpft`,SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:`sepkrcft`,SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:`sercft`,SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:`sertft`,SUCCESS_EXCHANGE_SUBJECT_TOKEN_FOR_ACCESS_TOKEN:`sestft`,SUCCESS_IMPERSONATION:`simp`,SUCCESSFULLY_ACCEPTED_USER_INVITE:`si`,BREACHED_PASSWORD_ON_SIGNUP:`signup_pwd_leak`,SUCCESS_LOGOUT:`slo`,SUCCESS_HOOK:`sh`,SUCCESS_PASSWORD_MIGRATION:`spm`,SUCCESS_REVOCATION:`srrt`,SUCCESS_SIGNUP:`ss`,FAILED_SS_SSO_OPERATION:`ss_sso_failure`,INFORMATION_FROM_SS_SSO_OPERATION:`ss_sso_info`,SUCCESS_SS_SSO_OPERATION:`ss_sso_success`,SUCCESS_SILENT_AUTH:`ssa`,SUCCESSFUL_SCIM_OPERATION:`sscim`,SUCCESSFULLY_IMPORTED_USERS:`sui`,SUCCESS_VERIFICATION_EMAIL:`sv`,SUCCESS_VERIFICATION_EMAIL_REQUEST:`svr`,MAX_AMOUNT_OF_AUTHENTICATORS:`too_many_records`,USER_LOGIN_BLOCK_RELEASED:`ublkdu`,FAILED_UNIVERSAL_LOGOUT:`universal_logout_failed`,SUCCESSFUL_UNIVERSAL_LOGOUT:`universal_logout_succeeded`,WARNING_DURING_LOGIN:`w`,WARNING_SENDING_NOTIFICATION:`wn`,WARNING_USER_MANAGEMENT:`wum`},Qt=t.z.string().refine(e=>Object.values(J).includes(e),{message:`Invalid log type`});J.ACLS_SUMMARY,J.ACTIONS_EXECUTION_FAILED,J.API_LIMIT,J.API_LIMIT_WARNING,J.APPI,J.CIBA_EXCHANGE_FAILED,J.CIBA_EXCHANGE_SUCCEEDED,J.CIBA_START_FAILED,J.CIBA_START_SUCCEEDED,J.CODE_LINK_SENT,J.CODE_SENT,J.DEPRECATION_NOTICE,J.FAILED_LOGIN,J.FAILED_BY_CONNECTOR,J.FAILED_CHANGE_EMAIL,J.FAILED_BY_CORS,J.FAILED_CROSS_ORIGIN_AUTHENTICATION,J.FAILED_CHANGE_PASSWORD,J.FAILED_POST_CHANGE_PASSWORD_HOOK,J.FAILED_CHANGE_PHONE_NUMBER,J.FAILED_CHANGE_PASSWORD_REQUEST,J.FAILED_CONNECTOR_PROVISIONING,J.FAILED_CHANGE_USERNAME,J.FAILED_DELEGATION,J.FAILED_DEVICE_ACTIVATION,J.FAILED_DEVICE_AUTHORIZATION_REQUEST,J.USER_CANCELED_DEVICE_CONFIRMATION,J.FAILED_USER_DELETION,J.FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS,J.FAILED_EXCHANGE_CUSTOM_TOKEN,J.FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN,J.FAILED_FEDERATED_LOGOUT,J.FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN,J.FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN,J.FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN,J.FAILED_EXCHANGE_SUBJECT_TOKEN_FOR_ACCESS_TOKEN,J.FAILED_HOOK,J.FAILED_IMPERSONATION,J.FAILED_INVITE_ACCEPT,J.FAILED_LOGOUT,J.FLOWS_EXECUTION_COMPLETED,J.FLOWS_EXECUTION_FAILED,J.FAILED_SENDING_NOTIFICATION,J.FORMS_SUBMISSION_FAILED,J.FORMS_SUBMISSION_SUCCEEDED,J.FAILED_LOGIN_INCORRECT_PASSWORD,J.FAILED_PUSHED_AUTHORIZATION_REQUEST,J.FAILED_POST_USER_REGISTRATION_HOOK,J.FAILED_SIGNUP,J.FAILED_SILENT_AUTH,J.FAILED_LOGIN_INVALID_EMAIL_USERNAME,J.FAILED_USERS_IMPORT,J.FAILED_VERIFICATION_EMAIL,J.FAILED_VERIFICATION_EMAIL_REQUEST,J.EMAIL_VERIFICATION_CONFIRMED,J.EMAIL_VERIFICATION_FAILED,J.MFA_AUTH_FAILED,J.MFA_AUTH_REJECTED,J.MFA_AUTH_SUCCESS,J.MFA_ENROLLMENT_COMPLETE,J.TOO_MANY_MFA_FAILURES,J.MFA_RECOVERY_FAILED,J.MFA_RECOVERY_RATE_LIMIT_EXCEED,J.MFA_RECOVERY_SUCCESS,J.MFA_EMAIL_SENT,J.EMAIL_VERIFICATION_SENT,J.EMAIL_VERIFICATION_SEND_FAILURE,J.PUSH_NOTIFICATION_SENT,J.ERROR_SENDING_MFA_PUSH_NOTIFICATION,J.MFA_SMS_SENT,J.ERROR_SENDING_MFA_SMS,J.MFA_VOICE_CALL_SUCCESS,J.MFA_VOICE_CALL_FAILED,J.SECOND_FACTOR_STARTED,J.MFA_ENROLL_STARTED,J.MFA_ENROLLMENT_FAILED,J.GUARDIAN_TENANT_UPDATE,J.UNENROLL_DEVICE_ACCOUNT,J.UPDATE_DEVICE_ACCOUNT,J.WEBAUTHN_CHALLENGE_FAILED,J.WEBAUTHN_ENROLLMENT_FAILED,J.FAILED_KMS_API_OPERATION,J.SUCCESS_KMS_API_OPERATION,J.KMS_KEY_STATE_CHANGED,J.TOO_MANY_CALLS_TO_DELEGATION,J.BLOCKED_IP_ADDRESS,J.BLOCKED_ACCOUNT_IP,J.BLOCKED_ACCOUNT_EMAIL,J.INFORMATION,J.MFA_REQUIRED,J.MANAGEMENT_API_READ_OPERATION,J.FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT,J.SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT,J.FAILED_OIDC_BACKCHANNEL_LOGOUT,J.SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT,J.ORGANIZATION_MEMBER_ADDED,J.PASSKEY_CHALLENGE_FAILED,J.PASSKEY_CHALLENGE_STARTED,J.PRE_LOGIN_ASSESSMENT,J.BREACHED_PASSWORD,J.BREACHED_PASSWORD_ON_RESET,J.SUCCESS_RESOURCE_CLEANUP,J.RICH_CONSENTS_ACCESS_ERROR,J.SUCCESS_LOGIN,J.SUCCESS_API_OPERATION,J.FAILED_API_OPERATION,J.SUCCESS_CHANGE_EMAIL,J.SUCCESS_CROSS_ORIGIN_AUTHENTICATION,J.SUCCESS_CHANGE_PASSWORD,J.SUCCESS_CHANGE_PHONE_NUMBER,J.SUCCESS_CHANGE_PASSWORD_REQUEST,J.SUCCESS_CHANGE_USERNAME,J.SUCCESS_CREDENTIAL_VALIDATION,J.SUCCESS_DELEGATION,J.SUCCESS_USER_DELETION,J.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS,J.SUCCESS_EXCHANGE_CUSTOM_TOKEN,J.SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN,J.SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN,J.SUCCESS_EXCHANGE_SUBJECT_TOKEN_FOR_ACCESS_TOKEN,J.SUCCESS_IMPERSONATION,J.SUCCESSFULLY_ACCEPTED_USER_INVITE,J.BREACHED_PASSWORD_ON_SIGNUP,J.SUCCESS_LOGOUT,J.SUCCESS_HOOK,J.SUCCESS_PASSWORD_MIGRATION,J.SUCCESS_REVOCATION,J.SUCCESS_SIGNUP,J.FAILED_SS_SSO_OPERATION,J.INFORMATION_FROM_SS_SSO_OPERATION,J.SUCCESS_SS_SSO_OPERATION,J.SUCCESS_SILENT_AUTH,J.SUCCESSFUL_SCIM_OPERATION,J.SUCCESSFULLY_IMPORTED_USERS,J.SUCCESS_VERIFICATION_EMAIL,J.SUCCESS_VERIFICATION_EMAIL_REQUEST,J.MAX_AMOUNT_OF_AUTHENTICATORS,J.USER_LOGIN_BLOCK_RELEASED,J.FAILED_UNIVERSAL_LOGOUT,J.SUCCESSFUL_UNIVERSAL_LOGOUT,J.WARNING_DURING_LOGIN,J.WARNING_SENDING_NOTIFICATION,J.WARNING_USER_MANAGEMENT,(()=>{let e={};for(let[t,n]of Object.entries(J))t.startsWith(`SUCCESS_`)||t.startsWith(`SUCCESSFUL_`)||t.startsWith(`SUCCESSFULLY_`)||t.endsWith(`_SUCCEEDED`)||t.endsWith(`_COMPLETED`)?e[n]=`success`:t.startsWith(`FAILED_`)||t.startsWith(`ERROR_`)||t.startsWith(`BREACHED_`)||t.startsWith(`BLOCKED_`)||t===`MFA_AUTH_FAILED`||t===`MFA_AUTH_REJECTED`||t===`MFA_RECOVERY_FAILED`||t===`MFA_ENROLLMENT_FAILED`||t===`EMAIL_VERIFICATION_FAILED`||t===`WEBAUTHN_CHALLENGE_FAILED`||t===`WEBAUTHN_ENROLLMENT_FAILED`||t===`PASSKEY_CHALLENGE_FAILED`||t===`FLOWS_EXECUTION_FAILED`||t===`FORMS_SUBMISSION_FAILED`||t===`CIBA_EXCHANGE_FAILED`||t===`CIBA_START_FAILED`||t===`ACTIONS_EXECUTION_FAILED`||t===`RICH_CONSENTS_ACCESS_ERROR`||t===`USER_CANCELED_DEVICE_CONFIRMATION`||t===`TOO_MANY_MFA_FAILURES`||t===`MFA_RECOVERY_RATE_LIMIT_EXCEED`||t===`API_LIMIT`||t===`MAX_AMOUNT_OF_AUTHENTICATORS`?e[n]=`failure`:t.startsWith(`WARNING_`)||t===`API_LIMIT_WARNING`||t===`DEPRECATION_NOTICE`||t===`PRE_LOGIN_ASSESSMENT`?e[n]=`warning`:t===`CODE_SENT`||t===`CODE_LINK_SENT`||t===`MFA_EMAIL_SENT`||t===`MFA_SMS_SENT`||t===`EMAIL_VERIFICATION_SENT`||t===`PUSH_NOTIFICATION_SENT`?e[n]=`code_sent`:t===`INFORMATION`||t===`INFORMATION_FROM_SS_SSO_OPERATION`||t===`MANAGEMENT_API_READ_OPERATION`||t===`APPI`||t===`ACLS_SUMMARY`||t===`ORGANIZATION_MEMBER_ADDED`?e[n]=`info`:e[n]=`other`;return e})();var $t=t.z.object({name:t.z.string(),version:t.z.string(),env:t.z.object({node:t.z.string().optional()}).optional()}),en=t.z.object({country_code:t.z.string().length(2),city_name:t.z.string(),latitude:t.z.string(),longitude:t.z.string(),time_zone:t.z.string(),continent_code:t.z.string()});t.z.object({type:Qt,date:t.z.string(),description:t.z.string().optional(),ip:t.z.string().optional(),user_agent:t.z.string().optional(),details:t.z.any().optional(),isMobile:t.z.boolean(),user_id:t.z.string().optional(),user_name:t.z.string().optional(),connection:t.z.string().optional(),connection_id:t.z.string().optional(),client_id:t.z.string().optional(),client_name:t.z.string().optional(),audience:t.z.string().optional(),scope:t.z.string().optional(),strategy:t.z.string().optional(),strategy_type:t.z.string().optional(),hostname:t.z.string().optional(),auth0_client:$t.optional(),log_id:t.z.string().optional(),location_info:en.optional()}).extend({log_id:t.z.string()});var tn=t.z.enum([`http`,`eventbridge`,`eventgrid`,`splunk`,`datadog`,`sumo`]),Y=t.z.enum([`active`,`paused`,`suspended`]),nn=t.z.object({type:t.z.string(),name:t.z.string()});t.z.object({name:t.z.string(),type:tn,status:Y.optional(),sink:t.z.record(t.z.string(),t.z.unknown()),filters:t.z.array(nn).optional(),isPriority:t.z.boolean().optional()}).extend({id:t.z.string(),status:Y,created_at:t.z.string().optional(),updated_at:t.z.string().optional()});var rn=t.z.enum([`auth0`,`cognito`,`okta`,`oidc`]),an=t.z.object({domain:t.z.string(),client_id:t.z.string(),client_secret:t.z.string(),audience:t.z.string().optional(),scope:t.z.string().optional()}),on=t.z.object({id:t.z.string().optional(),name:t.z.string(),provider:rn,connection:t.z.string(),enabled:t.z.boolean().default(!0),credentials:an});t.z.object({id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()}).extend(on.shape);var sn=t.z.object({enabled:t.z.boolean().optional(),shields:t.z.array(t.z.string()).optional(),admin_notification_frequency:t.z.array(t.z.string()).optional(),method:t.z.string().optional(),stage:t.z.object({"pre-user-registration":t.z.object({shields:t.z.array(t.z.string()).optional()}).optional(),"pre-change-password":t.z.object({shields:t.z.array(t.z.string()).optional()}).optional()}).optional()}),cn=t.z.object({enabled:t.z.boolean().optional(),shields:t.z.array(t.z.string()).optional(),allowlist:t.z.array(t.z.string()).optional(),mode:t.z.string().optional(),max_attempts:t.z.number().optional()}),ln=t.z.object({enabled:t.z.boolean().optional(),shields:t.z.array(t.z.string()).optional(),allowlist:t.z.array(t.z.string()).optional(),stage:t.z.object({"pre-login":t.z.object({max_attempts:t.z.number().optional(),rate:t.z.number().optional()}).optional(),"pre-user-registration":t.z.object({max_attempts:t.z.number().optional(),rate:t.z.number().optional()}).optional()}).optional()}),un=t.z.object({breached_password_detection:sn.optional(),brute_force_protection:cn.optional(),suspicious_ip_throttling:ln.optional()});t.z.object({id:t.z.string().optional(),user_id:t.z.string(),password:t.z.string(),algorithm:t.z.enum([`bcrypt`,`argon2id`]).default(`argon2id`),is_current:t.z.boolean().default(!0)}).extend({id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()});var X=t.z.object({initial_user_agent:t.z.string().describe(`First user agent of the device from which this user logged in`),initial_ip:t.z.string().describe(`First IP address associated with this session`),initial_asn:t.z.string().describe(`First autonomous system number associated with this session`),last_user_agent:t.z.string().describe(`Last user agent of the device from which this user logged in`),last_ip:t.z.string().describe(`Last IP address from which this user logged in`),last_asn:t.z.string().describe(`Last autonomous system number from which this user logged in`)}),dn=t.z.object({id:t.z.string(),revoked_at:t.z.string().optional(),used_at:t.z.string().optional(),user_id:t.z.string().describe(`The user ID associated with the session`),expires_at:t.z.string().optional(),login_session_id:t.z.string(),idle_expires_at:t.z.string().optional(),device:X.describe(`Metadata related to the device used in the session`),clients:t.z.array(t.z.string()).describe(`List of client details for the session`)});t.z.object({created_at:t.z.string(),updated_at:t.z.string(),authenticated_at:t.z.string(),last_interaction_at:t.z.string()}).extend(dn.shape),t.z.object({kid:t.z.string().openapi({description:`The key id of the signing key`}),tenant_id:t.z.string().optional().openapi({description:`The tenant the key belongs to. Omitted means the key is shared / control-plane scoped.`}),cert:t.z.string().openapi({description:`The public certificate of the signing key`}),fingerprint:t.z.string().openapi({description:`The cert fingerprint`}),thumbprint:t.z.string().openapi({description:`The cert thumbprint`}),pkcs7:t.z.string().optional().openapi({description:`The private key in pkcs7 format`}),current:t.z.boolean().optional().openapi({description:`True if the key is the current key`}),next:t.z.boolean().optional().openapi({description:`True if the key is the next key`}),previous:t.z.boolean().optional().openapi({description:`True if the key is the previous key`}),current_since:t.z.string().optional().openapi({description:`The date and time when the key became the current key`}),current_until:t.z.string().optional().openapi({description:`The date and time when the current key was rotated`}),revoked:t.z.boolean().optional().openapi({description:`True if the key is revoked`}),revoked_at:t.z.string().optional().openapi({description:`The date and time when the key was revoked`}),connection:t.z.string().optional().openapi({description:`The connection identifier associated with the key`}),type:t.z.enum([`jwt_signing`,`saml_encryption`]).openapi({description:`The type of the signing key`})});var fn=t.z.object({id:t.z.string().optional(),audience:t.z.string().optional(),friendly_name:t.z.string(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sender_email:t.z.string().email().optional(),sender_name:t.z.string().optional(),session_lifetime:t.z.number().optional(),idle_session_lifetime:t.z.number().optional(),ephemeral_session_lifetime:t.z.number().optional(),idle_ephemeral_session_lifetime:t.z.number().optional(),session_cookie:t.z.object({mode:t.z.enum([`persistent`,`non-persistent`]).optional()}).optional(),allowed_logout_urls:t.z.array(t.z.string()).optional(),default_redirection_uri:t.z.string().optional(),default_client_id:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).nullish(),flags:t.z.object({allow_changing_enable_sso:t.z.boolean().optional(),allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),change_pwd_flow_v1:t.z.boolean().optional(),client_id_metadata_document_registration:t.z.boolean().optional(),custom_domains_provisioning:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),disable_impersonation:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),dcr_require_initial_access_token:t.z.boolean().optional(),dcr_allowed_grant_types:t.z.array(t.z.string()).optional(),allow_http_return_to:t.z.array(t.z.string().refine(e=>{try{let t=new URL(e);return t.protocol===`http:`&&(t.pathname===``||t.pathname===`/`)&&!t.search&&!t.hash&&e===t.origin}catch{return!1}},{message:`must be a fully-qualified http origin (scheme + host + port, no path)`})).optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),enable_sso:t.z.boolean().optional(),enforce_client_authentication_on_passwordless_start:t.z.boolean().optional(),genai_trial:t.z.boolean().optional(),improved_signup_bot_detection_in_classic:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional(),no_disclose_enterprise_connections:t.z.boolean().optional(),remove_alg_from_jwks:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),trust_azure_adfs_email_verified_connection_property:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),inherit_global_permissions_in_organizations:t.z.boolean().optional(),restrict_undefined_scopes:t.z.boolean().optional()}).optional(),sandbox_version:t.z.string().optional(),legacy_sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),device_flow:t.z.object({charset:t.z.enum([`base20`,`digits`]).optional(),mask:t.z.string().max(20).optional()}).optional(),default_token_quota:t.z.object({clients:t.z.object({client_credentials:t.z.record(t.z.string(),t.z.any()).optional()}).optional(),organizations:t.z.object({client_credentials:t.z.record(t.z.string(),t.z.any()).optional()}).optional()}).nullish(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional(),oidc_logout:t.z.object({rp_logout_end_session_endpoint_discovery:t.z.boolean().optional()}).optional(),allow_organization_name_in_authentication_api:t.z.boolean().optional(),customize_mfa_in_postlogin_action:t.z.boolean().optional(),acr_values_supported:t.z.array(t.z.string()).optional(),mtls:t.z.object({enable_endpoint_aliases:t.z.boolean().optional()}).nullish(),pushed_authorization_requests_supported:t.z.boolean().optional(),authorization_response_iss_parameter_supported:t.z.boolean().optional(),deployment_type:t.z.enum([`shared`,`wfp`]).default(`shared`).optional(),provisioning_state:t.z.enum([`pending`,`ready`,`failed`]).default(`ready`).optional(),provisioning_error:t.z.string().max(2048).optional(),provisioning_state_changed_at:t.z.string().optional(),bundle_configuration:t.z.string().max(64).optional(),worker_version:t.z.string().max(64).optional(),database_version:t.z.string().max(64).optional(),worker_script_name:t.z.string().max(255).optional(),storage_kind:t.z.enum([`own_d1`,`existing_d1`,`shared_planetscale`]).optional(),d1_database_id:t.z.string().max(64).optional(),attack_protection:un.optional(),mfa:t.z.object({policy:t.z.enum([`never`,`always`]).default(`never`).optional(),factors:t.z.object({sms:t.z.boolean().default(!1),otp:t.z.boolean().default(!1),email:t.z.boolean().default(!1),push_notification:t.z.boolean().default(!1),webauthn_roaming:t.z.boolean().default(!1),webauthn_platform:t.z.boolean().default(!1),recovery_code:t.z.boolean().default(!1),duo:t.z.boolean().default(!1)}).optional(),sms_provider:t.z.object({provider:t.z.enum([`twilio`,`vonage`,`aws_sns`,`phone_message_hook`]).optional()}).optional(),twilio:t.z.object({sid:t.z.string().optional(),auth_token:t.z.string().optional(),from:t.z.string().optional(),messaging_service_sid:t.z.string().optional()}).optional(),phone_message:t.z.object({message:t.z.string().optional()}).optional()}).optional()});t.z.object({created_at:t.z.string().nullable().transform(e=>e??``),updated_at:t.z.string().nullable().transform(e=>e??``)}).extend(fn.shape).extend({id:t.z.string(),is_control_plane:t.z.boolean().optional()});var pn=t.z.enum([`provision`,`seed`,`upgrade`,`backup`,`deprovision`]),mn=t.z.enum([`pending`,`running`,`succeeded`,`failed`,`cancelled`]),hn=t.z.enum([`inline`,`cloudflare-workflows`]);t.z.object({tenant_id:t.z.string().max(255).nullable().default(null),rollout_id:t.z.string().max(255).nullable().optional(),kind:pn,engine:hn,engine_instance_id:t.z.string().max(100).nullable().optional(),target_worker_version:t.z.string().max(255).nullable().optional(),target_database_version:t.z.string().max(255).nullable().optional(),initiated_by:t.z.string().max(255).nullable().optional()}).extend({id:t.z.string(),status:mn,current_step:t.z.string().max(255).nullable().optional(),error:t.z.string().nullable().optional(),created_at:t.z.string(),updated_at:t.z.string(),finished_at:t.z.string().nullable().optional()}).pick({status:!0,current_step:!0,engine_instance_id:!0,target_worker_version:!0,target_database_version:!0,error:!0,finished_at:!0}).partial();var gn=t.z.enum([`started`,`succeeded`,`failed`,`retried`,`skipped`,`reconciled`]);t.z.object({operation_id:t.z.string().max(255),step:t.z.string().max(255),outcome:gn,detail:t.z.record(t.z.string(),t.z.unknown()).nullable().optional(),attempt:t.z.number().int().min(1).default(1)}).extend({id:t.z.string(),created_at:t.z.string()});var _n=t.z.enum([`upgrade`,`reseed`,`backup`]),vn=t.z.enum([`pending`,`canary`,`rolling`,`paused`,`done`,`failed`]);t.z.object({kind:_n,target_worker_version:t.z.string().max(255).nullable().optional(),target_database_version:t.z.string().max(255).nullable().optional(),wave_size:t.z.number().int().min(1).default(10),canary_tenant_ids:t.z.array(t.z.string()).nullable().optional(),filter:t.z.record(t.z.string(),t.z.unknown()).nullable().optional(),initiated_by:t.z.string().max(255).nullable().optional()}).extend({id:t.z.string(),status:vn,created_at:t.z.string(),updated_at:t.z.string(),finished_at:t.z.string().nullable().optional()}).pick({status:!0,wave_size:!0,canary_tenant_ids:!0,filter:!0,finished_at:!0}).partial(),t.z.object({access_token:t.z.string(),id_token:t.z.string().optional(),scope:t.z.string().optional(),state:t.z.string().optional(),refresh_token:t.z.string().optional(),token_type:t.z.string(),expires_in:t.z.number()}),t.z.object({code:t.z.string(),state:t.z.string().optional()});var yn=t.z.object({button_border_radius:t.z.number(),button_border_weight:t.z.number(),buttons_style:t.z.enum([`pill`,`rounded`,`sharp`]),input_border_radius:t.z.number(),input_border_weight:t.z.number(),inputs_style:t.z.enum([`pill`,`rounded`,`sharp`]),show_widget_shadow:t.z.boolean(),widget_border_weight:t.z.number(),widget_corner_radius:t.z.number()}),bn=t.z.object({base_focus_color:t.z.string(),base_hover_color:t.z.string(),body_text:t.z.string(),captcha_widget_theme:t.z.enum([`auto`,`dark`,`light`]),error:t.z.string(),header:t.z.string(),icons:t.z.string(),input_background:t.z.string(),input_border:t.z.string(),input_filled_text:t.z.string(),input_labels_placeholders:t.z.string(),links_focused_components:t.z.string(),primary_button:t.z.string(),primary_button_label:t.z.string(),secondary_button_border:t.z.string(),secondary_button_label:t.z.string(),success:t.z.string(),widget_background:t.z.string(),widget_border:t.z.string()}),Z=t.z.object({bold:t.z.boolean(),size:t.z.number()}),xn=t.z.object({body_text:Z,buttons_text:Z,font_url:t.z.string(),input_labels:Z,links:Z,links_style:t.z.enum([`normal`,`underlined`]),reference_text_size:t.z.number(),subtitle:Z,title:Z}),Sn=t.z.object({background_color:t.z.string(),background_image_url:t.z.string(),page_layout:t.z.enum([`center`,`left`,`right`]),logo_placement:t.z.enum([`widget`,`chip`,`none`]).optional()}),Cn=t.z.object({header_text_alignment:t.z.enum([`center`,`left`,`right`]),logo_height:t.z.number(),logo_position:t.z.enum([`center`,`left`,`none`,`right`]),logo_url:t.z.string(),social_buttons_layout:t.z.enum([`bottom`,`top`])});t.z.object({borders:yn,colors:bn,displayName:t.z.string(),fonts:xn,page_background:Sn,widget:Cn}).extend({themeId:t.z.string()}),t.z.object({universal_login_experience:t.z.enum([`new`,`classic`]).default(`new`),identifier_first:t.z.boolean().default(!0),password_first:t.z.boolean().default(!1),webauthn_platform_first_factor:t.z.boolean()});var wn=t.z.object({hosts:t.z.array(t.z.string()).optional(),methods:t.z.array(t.z.string()).optional(),path:t.z.string().default(`/*`),headers:t.z.record(t.z.string(),t.z.string()).optional(),query:t.z.record(t.z.string(),t.z.string()).optional()}),Tn=t.z.object({type:t.z.string(),options:t.z.record(t.z.string(),t.z.unknown()).default({})}),Q=t.z.object({id:t.z.string().optional(),custom_domain_id:t.z.string(),priority:t.z.number().int().default(100),match:wn,handlers:t.z.array(Tn).min(1)});Q.extend({id:t.z.string(),tenant_id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()}),Q.partial().omit({id:!0,custom_domain_id:!0}),t.z.object({name:t.z.string(),enabled:t.z.boolean().optional().default(!0),default_from_address:t.z.string().optional(),credentials:t.z.record(t.z.string(),t.z.unknown()),settings:t.z.object({}).optional()});var En=t.z.enum([`verify_email`,`verify_email_by_code`,`reset_email`,`reset_email_by_code`,`welcome_email`,`blocked_account`,`stolen_credentials`,`enrollment_email`,`mfa_oob_code`,`change_password`,`password_reset`,`user_invitation`]);t.z.object({template:En,body:t.z.string(),from:t.z.string(),subject:t.z.string(),syntax:t.z.literal(`liquid`).default(`liquid`),resultUrl:t.z.string().optional(),urlLifetimeInSeconds:t.z.number().int().nonnegative().optional(),includeEmailInRedirect:t.z.boolean().default(!1),enabled:t.z.boolean().default(!0)}),t.z.object({id:t.z.string(),login_id:t.z.string(),user_id:t.z.string(),client_id:t.z.string(),expires_at:t.z.string().optional(),idle_expires_at:t.z.string().optional(),last_exchanged_at:t.z.string().optional(),device:X,resource_servers:t.z.array(t.z.object({audience:t.z.string(),scopes:t.z.string()})),rotating:t.z.boolean(),token_lookup:t.z.string().optional(),token_hash:t.z.string().optional(),family_id:t.z.string().optional(),rotated_to:t.z.string().optional(),rotated_at:t.z.string().optional()}).extend({created_at:t.z.string(),revoked_at:t.z.string().optional()}),t.z.object({to:t.z.string(),message:t.z.string()}),t.z.object({name:t.z.string(),options:t.z.object({})});var Dn=t.z.object({value:t.z.string(),description:t.z.string().optional()}),On=t.z.object({token_dialect:t.z.enum([`access_token`,`access_token_authz`]).optional(),enforce_policies:t.z.boolean().optional(),allow_skipping_userinfo:t.z.boolean().optional(),skip_userinfo:t.z.boolean().optional(),persist_client_authorization:t.z.boolean().optional(),enable_introspection_endpoint:t.z.boolean().optional(),mtls:t.z.object({bound_access_tokens:t.z.boolean().optional()}).optional()}),kn=t.z.object({id:t.z.string().optional(),name:t.z.string(),identifier:t.z.string(),scopes:t.z.array(Dn).optional(),signing_alg:t.z.string().optional(),signing_secret:t.z.string().optional(),token_lifetime:t.z.number().default(86400),token_lifetime_for_web:t.z.number().default(7200),skip_consent_for_verifiable_first_party_clients:t.z.boolean().optional(),allow_offline_access:t.z.boolean().optional(),verificationKey:t.z.string().optional(),options:On.optional(),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.string(),t.z.any()).optional()}).extend({created_at:t.z.string().optional(),updated_at:t.z.string().optional()});t.z.array(kn);var An=t.z.object({role_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string()}).extend({created_at:t.z.string()});t.z.array(An),t.z.object({user_id:t.z.string().openapi({description:`The id of the user that granted the consent`}),clientID:t.z.string().openapi({description:`The id of the client the grant was issued to`}),audience:t.z.string().optional().openapi({description:`The audience the grant applies to`}),scope:t.z.array(t.z.string()).default([]).openapi({description:`The list of OAuth scopes the user has consented to`})}).extend({id:t.z.string()}),t.z.object({user_id:t.z.string(),last_login:t.z.string().optional(),last_ip:t.z.string().optional(),login_count:t.z.number().default(0),failed_logins:t.z.array(t.z.string()).optional(),last_password_reset:t.z.string().optional()});var jn=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string(),organization_id:t.z.string().optional()}).extend({tenant_id:t.z.string(),created_at:t.z.string().optional()});t.z.array(jn);var Mn=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),resource_server_name:t.z.string(),permission_name:t.z.string(),description:t.z.string().nullable().optional(),created_at:t.z.string().optional(),organization_id:t.z.string().optional()});t.z.array(Mn);var Nn=t.z.object({user_id:t.z.string(),role_id:t.z.string(),organization_id:t.z.string().optional()}).extend({tenant_id:t.z.string(),created_at:t.z.string().optional()});t.z.array(Nn);var Pn=t.z.object({id:t.z.string().optional().openapi({description:`The unique identifier of the role. If not provided, one will be generated.`}),name:t.z.string().min(1).max(50).openapi({description:`The name of the role. Cannot include '<' or '>'`}),description:t.z.string().max(255).optional().openapi({description:`The description of the role`}),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.string(),t.z.any()).optional().openapi({description:`Metadata associated with the role. Can be used to control sync behavior in multi-tenancy scenarios.`})}).extend({id:t.z.string().openapi({description:`The unique identifier of the role`}),created_at:t.z.string().optional(),updated_at:t.z.string().optional()});t.z.array(Pn);var Fn=t.z.object({logo_url:t.z.string().optional().openapi({description:`URL of the organization's logo`}),colors:t.z.object({primary:t.z.string().optional().openapi({description:`Primary color in hex format (e.g., #FF0000)`}),page_background:t.z.string().optional().openapi({description:`Page background color in hex format (e.g., #FFFFFF)`})}).optional()}).optional(),In=t.z.object({connection_id:t.z.string().openapi({description:`ID of the connection`}),assign_membership_on_login:t.z.boolean().default(!1).openapi({description:`Whether to assign membership to the organization on login`}),show_as_button:t.z.boolean().default(!0).openapi({description:`Whether to show this connection as a button in the login screen`}),is_signup_enabled:t.z.boolean().default(!0).openapi({description:`Whether signup is enabled for this connection`})}),Ln=t.z.object({client_credentials:t.z.object({enforce:t.z.boolean().default(!1).openapi({description:`Whether to enforce token quota limits`}),per_day:t.z.number().min(0).default(0).openapi({description:`Maximum tokens per day (0 = unlimited)`}),per_hour:t.z.number().min(0).default(0).openapi({description:`Maximum tokens per hour (0 = unlimited)`})}).optional()}).optional();t.z.object({id:t.z.string().optional(),name:t.z.string().min(1).regex(/^[a-z0-9_-]+$/,{message:`Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores`}).openapi({description:`The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores.`}),display_name:t.z.string().optional().openapi({description:`The display name of the organization`}),branding:Fn,metadata:t.z.record(t.z.string(),t.z.any()).default({}).optional().openapi({description:`Custom metadata for the organization`}),enabled_connections:t.z.array(In).default([]).optional().openapi({description:`List of enabled connections for the organization`}),token_quota:Ln}).extend(C.shape).extend({id:t.z.string(),name:t.z.string().min(1).openapi({description:`The name of the organization`})});var Rn=t.z.object({connection_id:t.z.string().openapi({description:`ID of the tenant-level connection to enable for the org.`}),assign_membership_on_login:t.z.boolean().optional().default(!1),show_as_button:t.z.boolean().optional().default(!0),is_signup_enabled:t.z.boolean().optional().default(!0)}).extend({connection:t.z.object({name:t.z.string().optional(),strategy:t.z.string().optional()}).optional(),created_at:t.z.string().optional(),updated_at:t.z.string().optional()});t.z.array(Rn),t.z.object({user_id:t.z.string().openapi({description:`ID of the user`}),organization_id:t.z.string().openapi({description:`ID of the organization`})}).extend(C.shape).extend({id:t.z.string()}),t.z.object({idle_session_lifetime:t.z.number().default(72),session_lifetime:t.z.number().default(168),session_cookie:t.z.object({mode:t.z.enum([`persistent`,`non-persistent`]).optional()}).optional(),enable_client_connections:t.z.boolean().optional(),default_redirection_uri:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).optional(),flags:t.z.object({allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional()}).optional(),friendly_name:t.z.string().optional(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional(),mfa:t.z.object({policy:t.z.enum([`never`,`always`]).default(`never`).optional(),factors:t.z.object({sms:t.z.boolean().default(!1),otp:t.z.boolean().default(!1),email:t.z.boolean().default(!1),push_notification:t.z.boolean().default(!1),webauthn_roaming:t.z.boolean().default(!1),webauthn_platform:t.z.boolean().default(!1),recovery_code:t.z.boolean().default(!1),duo:t.z.boolean().default(!1)}).optional(),sms_provider:t.z.object({provider:t.z.enum([`twilio`,`vonage`,`aws_sns`,`phone_message_hook`]).optional()}).optional(),twilio:t.z.object({sid:t.z.string().optional(),auth_token:t.z.string().optional(),from:t.z.string().optional(),messaging_service_sid:t.z.string().optional()}).optional(),phone_message:t.z.object({message:t.z.string().optional()}).optional()}).optional()}),t.z.object({date:t.z.string().openapi({description:`Date these events occurred in ISO 8601 format`,example:`2025-12-19`}),logins:t.z.number().openapi({description:`Number of logins on this date`,example:150}),signups:t.z.number().openapi({description:`Number of signups on this date`,example:25}),leaked_passwords:t.z.number().openapi({description:`Number of breached-password detections on this date (subscription required)`,example:0}),updated_at:t.z.string().openapi({description:`Date and time this stats entry was last updated in ISO 8601 format`,example:`2025-12-19T10:30:00.000Z`}),created_at:t.z.string().openapi({description:`Approximate date and time the first event occurred in ISO 8601 format`,example:`2025-12-19T00:00:00.000Z`})}),t.z.number().openapi({description:`Number of active users in the last 30 days`,example:1234}),t.z.enum([`active-users`,`logins`,`signups`,`refresh-tokens`,`sessions`,`logouts`,`password-changes`,`password-migrations`,`mfa`,`email-verifications`,`codes-sent`]),t.z.enum([`hour`,`day`,`week`,`month`]),t.z.enum([`time`,`connection`,`client_id`,`user_type`,`event`]),t.z.enum([`password`,`social`,`passwordless`,`enterprise`]);var zn=t.z.object({name:t.z.string(),type:t.z.string()}),Bn=t.z.object({elapsed:t.z.number(),rows_read:t.z.number().optional(),bytes_read:t.z.number().optional()});t.z.object({meta:t.z.array(zn),data:t.z.array(t.z.record(t.z.string(),t.z.any())),rows:t.z.number(),rows_before_limit_at_least:t.z.number().optional(),statistics:Bn.optional()});var Vn=t.z.enum(`login.login-id.login-password.signup.signup-id.signup-password.reset-password.consent.mfa.mfa-push.mfa-otp.mfa-voice.mfa-phone.mfa-webauthn.mfa-email.mfa-recovery-code.status.device-flow.email-verification.email-otp-challenge.organizations.invitation.common.passkeys.captcha.custom-form.login-passwordless.mfa-login-options`.split(`.`)),Hn=t.z.record(t.z.string(),t.z.record(t.z.string(),t.z.string())).openapi({type:`object`,additionalProperties:{type:`object`,additionalProperties:{type:`string`}}});t.z.object({prompt:Vn,language:t.z.string(),custom_text:Hn});var Un=t.z.enum([`phone`,`totp`,`email`,`push`,`webauthn-roaming`,`webauthn-platform`,`passkey`]),$=t.z.object({user_id:t.z.string(),type:Un,phone_number:t.z.string().optional(),totp_secret:t.z.string().optional(),credential_id:t.z.string().optional(),public_key:t.z.string().optional(),sign_count:t.z.number().int().nonnegative().optional(),credential_backed_up:t.z.boolean().optional(),transports:t.z.array(t.z.string()).optional(),friendly_name:t.z.string().optional(),confirmed:t.z.boolean().default(!1)});function Wn(e,n){e.type===`phone`&&!e.phone_number&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`phone_number is required when type is 'phone'`,path:[`phone_number`]}),e.type===`totp`&&!e.totp_secret&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`totp_secret is required when type is 'totp'`,path:[`totp_secret`]}),[`webauthn-roaming`,`webauthn-platform`,`passkey`].includes(e.type)&&(e.credential_id||n.addIssue({code:t.z.ZodIssueCode.custom,message:`credential_id is required when type is '${e.type}'`,path:[`credential_id`]}),e.public_key||n.addIssue({code:t.z.ZodIssueCode.custom,message:`public_key is required when type is '${e.type}'`,path:[`public_key`]}))}$.superRefine(Wn),$.extend({id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()}).superRefine(Wn),t.z.object({id:t.z.string().optional(),created_at:t.z.string().datetime({offset:!0}).optional(),updated_at:t.z.string().datetime({offset:!0}).optional()});function Gn(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var Kn=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,qn=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Kn[n[e]&63];return t};async function Jn(e){let t=new DecompressionStream(`deflate-raw`),n=new Uint8Array(e),r=new Blob([n]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}async function Yn(e){let t=Gn(e.replace(/ /g,`+`));try{let e=await Jn(t);return new TextDecoder().decode(e)}catch(e){return console.warn(`Decompression failed, assuming data is not compressed:`,e),new TextDecoder().decode(t)}}async function Xn(e){let t=await Yn(e),n=new S.XMLParser({attributeNamePrefix:`@_`,alwaysCreateTextNode:!0,ignoreAttributes:!1}).parse(t);return i.parse(n)}function Zn(e){let t=e.certificates.map(e=>({"@_use":`signing`,KeyInfo:{"@_xmlns":`http://www.w3.org/2000/09/xmldsig#`,X509Data:{X509Certificate:e}}})),n={EntityDescriptor:{"@_entityID":e.entityId,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:metadata`,IDPSSODescriptor:{"@_protocolSupportEnumeration":`urn:oasis:names:tc:SAML:2.0:protocol`,KeyDescriptor:t,SingleLogoutService:[{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`,"@_Location":e.singleLogoutServiceUrl},{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`,"@_Location":e.singleLogoutServiceUrl}],NameIDFormat:[`urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`,`urn:oasis:names:tc:SAML:2.0:nameid-format:persistent`,`urn:oasis:names:tc:SAML:2.0:nameid-format:transient`],SingleSignOnService:[{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`,"@_Location":e.assertionConsumerServiceUrl},{"@_Binding":`urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`,"@_Location":e.assertionConsumerServiceUrl}],Attribute:[{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`E-Mail Address`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Given Name`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Name`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Surname`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`},{"@_Name":`http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:uri`,"@_FriendlyName":`Name ID`,"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`}]}}};return new S.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!1,format:!0,attributeNamePrefix:`@_`}).build(n)}async function Qn(e,t){let n=e.notBefore||new Date().toISOString(),r=e.notAfter||new Date(new Date(n).getTime()+600*1e3).toISOString(),i=e.issueInstant||n,a=e.sessionNotOnOrAfter||r,o=e.responseId||`_${qn()}`,s=e.assertionId||`_${qn()}`,c=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":`urn:oasis:names:tc:SAML:2.0:status:Success`}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":`urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":r,"@_Recipient":e.destination}}],":@":{"@_Method":`urn:oasis:names:tc:SAML:2.0:cm:bearer`}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":n,"@_NotOnOrAfter":r}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":`urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified`}]}]}],":@":{"@_AuthnInstant":i,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":a}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_FriendlyName":`persistent`,"@_Name":`id`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`email`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`manage-account`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`default-roles-master`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`offline_access`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`view-profile`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`uma_authorization`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":`manage-account-links`}],":@":{"@_xmlns:xs":`http://www.w3.org/2001/XMLSchema`,"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xsi:type":`xs:string`}}],":@":{"@_Name":`Role`,"@_NameFormat":`urn:oasis:names:tc:SAML:2.0:attrname-format:basic`}}]}],":@":{"@_xmlns":`urn:oasis:names:tc:SAML:2.0:assertion`,"@_ID":s,"@_IssueInstant":i,"@_Version":`2.0`}}],":@":{"@_xmlns:samlp":`urn:oasis:names:tc:SAML:2.0:protocol`,"@_xmlns:saml":`urn:oasis:names:tc:SAML:2.0:assertion`,"@_Destination":e.destination,"@_ID":o,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":i,"@_Version":`2.0`}}],l=new S.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(c);return e.signature&&t&&(l=await t.signSAML(l,e.signature.privateKeyPem,e.signature.cert)),e.encode===!1?l:btoa(l)}var $n=`http://www.w3.org/2001/04/xmldsig-more#rsa-sha256`,er=`http://www.w3.org/2001/04/xmlenc#sha256`,tr=`http://www.w3.org/2001/10/xml-exc-c14n#`,nr=class{async signSAML(e,t,n){try{let r=await import(`xml-crypto`),i=r.SignedXml||r.default?.SignedXml;if(!i)throw Error(`SignedXml not found in xml-crypto module`);let a=new i({privateKey:t,publicCert:n});a.canonicalizationAlgorithm=tr,a.addReference({xpath:`(/*[local-name()='Response']/*[local-name()='Assertion'])[1]`,digestAlgorithm:er,transforms:[`http://www.w3.org/2000/09/xmldsig#enveloped-signature`,tr]}),a.signatureAlgorithm=$n;let o=n.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g,``).replace(/\s/g,``);return a.keyInfoProvider={getKeyInfo:()=>`<X509Data><X509Certificate>${o}</X509Certificate></X509Data>`},a.computeSignature(e,{location:{reference:`/*[local-name()='Response']/*[local-name()='Assertion']/*[local-name()='Issuer']`,action:`after`}}),a.getSignedXml()}catch(e){throw Error(`Failed to sign SAML locally. Make sure xml-crypto is installed. Error: ${e}`)}}},rr=class{signUrl;constructor(e){this.signUrl=e}async signSAML(e,t,n){let r=await fetch(this.signUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({xmlContent:e,privateKey:t,publicCert:n})});if(!r.ok)throw Error(`Failed to sign SAML via HTTP: ${r.status} ${r.statusText}`);return await r.text()}};exports.HttpSamlSigner=rr,exports.LocalSamlSigner=nr,exports.createSamlMetadata=Zn,exports.createSamlResponse=Qn,exports.dsSignatureSchema=c,exports.inflateDecompress=Yn,exports.inflateRaw=Jn,exports.parseSamlRequestQuery=Xn,exports.samlIssuerSchema=r,exports.samlMetadataResponseSchema=a,exports.samlRequestSchema=i,exports.samlResponseJsonSchema=l;