"use strict";var Lm=Object.create;var Fn=Object.defineProperty,Wm=Object.defineProperties,Dm=Object.getOwnPropertyDescriptor,jm=Object.getOwnPropertyDescriptors,Bm=Object.getOwnPropertyNames,tu=Object.getOwnPropertySymbols,Km=Object.getPrototypeOf,nu=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable;var fa=(n,o,i)=>o in n?Fn(n,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[o]=i,Fe=(n,o)=>{for(var i in o||(o={}))nu.call(o,i)&&fa(n,i,o[i]);if(tu)for(var i of tu(o))Gm.call(o,i)&&fa(n,i,o[i]);return n},jt=(n,o)=>Wm(n,jm(o));var zm=(n,o)=>{for(var i in o)Fn(n,i,{get:o[i],enumerable:!0})},ru=(n,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of Bm(o))!nu.call(n,m)&&m!==i&&Fn(n,m,{get:()=>o[m],enumerable:!(l=Dm(o,m))||l.enumerable});return n};var Hm=(n,o,i)=>(i=n!=null?Lm(Km(n)):{},ru(o||!n||!n.__esModule?Fn(i,"default",{value:n,enumerable:!0}):i,n)),Vm=n=>ru(Fn({},"__esModule",{value:!0}),n);var Xe=(n,o,i)=>(fa(n,typeof o!="symbol"?o+"":o,i),i);var v=(n,o,i)=>new Promise((l,m)=>{var f=L=>{try{W(i.next(L))}catch(K){m(K)}},S=L=>{try{W(i.throw(L))}catch(K){m(K)}},W=L=>L.done?l(L.value):Promise.resolve(L.value).then(f,S);W((i=i.apply(n,o)).next())});var L_={};zm(L_,{AppAuthFallbackMethodEnum:()=>ya,AuthenticatorAttachment:()=>xn,Identifier:()=>Mu,Passage:()=>Ra,PassageApp:()=>Dn,PassageCurrentUser:()=>Un,PassageError:()=>se,PassageErrorCode:()=>ue,PassageMagicLink:()=>Bn,PassageOneTimePasscode:()=>Wn,PassagePasskey:()=>jn,PassageSession:()=>Mn,PassageSocial:()=>Ln,PassageTokenStore:()=>Jn,ReadOnlyTokenStore:()=>Wr,RequiredIdentifier:()=>Wu,SocialConnection:()=>Uu,TokenStore:()=>En,TtlDisplayUnit:()=>va,UserMetadataType:()=>Lu,UserStatus:()=>Ur,WebAuthnType:()=>Mr,captureEvent:()=>M_,cleanSentryConfig:()=>Bu,isFullTokenStore:()=>sn});module.exports=Vm(L_);var $m=Object.create,fu=Object.defineProperty,Ym=Object.getOwnPropertyDescriptor,Zm=Object.getOwnPropertyNames,Xm=Object.getPrototypeOf,Qm=Object.prototype.hasOwnProperty,ev=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports),tv=(n,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of Zm(o))!Qm.call(n,m)&&m!==i&&fu(n,m,{get:()=>o[m],enumerable:!(l=Ym(o,m))||l.enumerable});return n},hu=(n,o,i)=>(i=n!=null?$m(Xm(n)):{},tv(o||!n||!n.__esModule?fu(i,"default",{value:n,enumerable:!0}):i,n)),gu=ev((n,o)=>{"use strict";(function(){var i,l="4.17.21",m=200,f="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",S="Expected a function",W="Invalid `variable` option passed into `_.template`",L="__lodash_hash_undefined__",K=500,Y="__lodash_placeholder__",ae=1,xe=2,Z=4,oe=1,H=2,D=1,Q=2,Pt=4,he=8,Ke=16,Ee=32,gt=64,Ge=128,qt=256,cn=512,Gr=30,Ku="...",Gu=800,zu=16,Sa=1,Hu=2,Vu=3,Ft=1/0,mt=9007199254740991,$u=17976931348623157e292,Kn=NaN,Qe=4294967295,Yu=Qe-1,Zu=Qe>>>1,Xu=[["ary",Ge],["bind",D],["bindKey",Q],["curry",he],["curryRight",Ke],["flip",cn],["partial",Ee],["partialRight",gt],["rearg",qt]],Kt="[object Arguments]",Gn="[object Array]",Qu="[object AsyncFunction]",ln="[object Boolean]",dn="[object Date]",ec="[object DOMException]",zn="[object Error]",Hn="[object Function]",ba="[object GeneratorFunction]",ze="[object Map]",pn="[object Number]",tc="[object Null]",rt="[object Object]",Ca="[object Promise]",nc="[object Proxy]",fn="[object RegExp]",He="[object Set]",hn="[object String]",Vn="[object Symbol]",rc="[object Undefined]",gn="[object WeakMap]",ic="[object WeakSet]",mn="[object ArrayBuffer]",Gt="[object DataView]",zr="[object Float32Array]",Hr="[object Float64Array]",Vr="[object Int8Array]",$r="[object Int16Array]",Yr="[object Int32Array]",Zr="[object Uint8Array]",Xr="[object Uint8ClampedArray]",Qr="[object Uint16Array]",ei="[object Uint32Array]",ac=/\b__p \+= '';/g,oc=/\b(__p \+=) '' \+/g,sc=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ka=/&(?:amp|lt|gt|quot|#39);/g,Ta=/[&<>"']/g,uc=RegExp(ka.source),cc=RegExp(Ta.source),lc=/<%-([\s\S]+?)%>/g,dc=/<%([\s\S]+?)%>/g,Oa=/<%=([\s\S]+?)%>/g,pc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fc=/^\w*$/,hc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ti=/[\\^$.*+?()[\]{}|]/g,gc=RegExp(ti.source),ni=/^\s+/,mc=/\s/,vc=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,yc=/\{\n\/\* \[wrapped with (.+)\] \*/,_c=/,? & /,wc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rc=/[()=,{}\[\]\/\s]/,Sc=/\\(\\)?/g,bc=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ia=/\w*$/,Cc=/^[-+]0x[0-9a-f]+$/i,kc=/^0b[01]+$/i,Tc=/^\[object .+?Constructor\]$/,Oc=/^0o[0-7]+$/i,Ic=/^(?:0|[1-9]\d*)$/,Ac=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$n=/($^)/,Pc=/['\n\r\u2028\u2029\\]/g,Yn="\\ud800-\\udfff",qc="\\u0300-\\u036f",Fc="\\ufe20-\\ufe2f",Nc="\\u20d0-\\u20ff",Aa=qc+Fc+Nc,Pa="\\u2700-\\u27bf",qa="a-z\\xdf-\\xf6\\xf8-\\xff",xc="\\xac\\xb1\\xd7\\xf7",Ec="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Jc="\\u2000-\\u206f",Uc=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Fa="A-Z\\xc0-\\xd6\\xd8-\\xde",Na="\\ufe0e\\ufe0f",xa=xc+Ec+Jc+Uc,ri="['\u2019]",Mc="["+Yn+"]",Ea="["+xa+"]",Zn="["+Aa+"]",Ja="\\d+",Lc="["+Pa+"]",Ua="["+qa+"]",Ma="[^"+Yn+xa+Ja+Pa+qa+Fa+"]",ii="\\ud83c[\\udffb-\\udfff]",Wc="(?:"+Zn+"|"+ii+")",La="[^"+Yn+"]",ai="(?:\\ud83c[\\udde6-\\uddff]){2}",oi="[\\ud800-\\udbff][\\udc00-\\udfff]",zt="["+Fa+"]",Wa="\\u200d",Da="(?:"+Ua+"|"+Ma+")",Dc="(?:"+zt+"|"+Ma+")",ja="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",Ba="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",Ka=Wc+"?",Ga="["+Na+"]?",jc="(?:"+Wa+"(?:"+[La,ai,oi].join("|")+")"+Ga+Ka+")*",Bc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Kc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",za=Ga+Ka+jc,Gc="(?:"+[Lc,ai,oi].join("|")+")"+za,zc="(?:"+[La+Zn+"?",Zn,ai,oi,Mc].join("|")+")",Hc=RegExp(ri,"g"),Vc=RegExp(Zn,"g"),si=RegExp(ii+"(?="+ii+")|"+zc+za,"g"),$c=RegExp([zt+"?"+Ua+"+"+ja+"(?="+[Ea,zt,"$"].join("|")+")",Dc+"+"+Ba+"(?="+[Ea,zt+Da,"$"].join("|")+")",zt+"?"+Da+"+"+ja,zt+"+"+Ba,Kc,Bc,Ja,Gc].join("|"),"g"),Yc=RegExp("["+Wa+Yn+Aa+Na+"]"),Zc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xc=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qc=-1,X={};X[zr]=X[Hr]=X[Vr]=X[$r]=X[Yr]=X[Zr]=X[Xr]=X[Qr]=X[ei]=!0,X[Kt]=X[Gn]=X[mn]=X[ln]=X[Gt]=X[dn]=X[zn]=X[Hn]=X[ze]=X[pn]=X[rt]=X[fn]=X[He]=X[hn]=X[gn]=!1;var $={};$[Kt]=$[Gn]=$[mn]=$[Gt]=$[ln]=$[dn]=$[zr]=$[Hr]=$[Vr]=$[$r]=$[Yr]=$[ze]=$[pn]=$[rt]=$[fn]=$[He]=$[hn]=$[Vn]=$[Zr]=$[Xr]=$[Qr]=$[ei]=!0,$[zn]=$[Hn]=$[gn]=!1;var el={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},tl={"&":"&","<":"<",">":">",'"':""","'":"'"},nl={"&":"&","<":"<",">":">",""":'"',"'":"'"},rl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},il=parseFloat,al=parseInt,Ha=typeof global=="object"&&global&&global.Object===Object&&global,ol=typeof self=="object"&&self&&self.Object===Object&&self,de=Ha||ol||Function("return this")(),ui=typeof n=="object"&&n&&!n.nodeType&&n,Nt=ui&&typeof o=="object"&&o&&!o.nodeType&&o,Va=Nt&&Nt.exports===ui,ci=Va&&Ha.process,Je=function(){try{var h=Nt&&Nt.require&&Nt.require("util").types;return h||ci&&ci.binding&&ci.binding("util")}catch(_){}}(),$a=Je&&Je.isArrayBuffer,Ya=Je&&Je.isDate,Za=Je&&Je.isMap,Xa=Je&&Je.isRegExp,Qa=Je&&Je.isSet,eo=Je&&Je.isTypedArray;function Te(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function sl(h,_,y,T){for(var q=-1,j=h==null?0:h.length;++q-1}function li(h,_,y){for(var T=-1,q=h==null?0:h.length;++T-1;);return y}function uo(h,_){for(var y=h.length;y--&&Ht(_,h[y],0)>-1;);return y}function ml(h,_){for(var y=h.length,T=0;y--;)h[y]===_&&++T;return T}var vl=hi(el),yl=hi(tl);function _l(h){return"\\"+rl[h]}function wl(h,_){return h==null?i:h[_]}function Vt(h){return Yc.test(h)}function Rl(h){return Zc.test(h)}function Sl(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function yi(h){var _=-1,y=Array(h.size);return h.forEach(function(T,q){y[++_]=[q,T]}),y}function co(h,_){return function(y){return h(_(y))}}function _t(h,_){for(var y=-1,T=h.length,q=0,j=[];++y-1}function cd(e,t){var r=this.__data__,a=gr(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}it.prototype.clear=ad,it.prototype.delete=od,it.prototype.get=sd,it.prototype.has=ud,it.prototype.set=cd;function at(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t=t?e:t)),e}function We(e,t,r,a,s,c){var d,p=t&ae,g=t&xe,w=t&Z;if(r&&(d=s?r(e,a,s,c):r(e)),d!==i)return d;if(!te(e))return e;var R=F(e);if(R){if(d=fp(e),!p)return Se(e,d)}else{var b=ve(e),C=b==Hn||b==ba;if(Tt(e))return zo(e,p);if(b==rt||b==Kt||C&&!s){if(d=g||C?{}:ds(e),!p)return g?np(e,kd(d,e)):tp(e,So(d,e))}else{if(!$[b])return s?e:{};d=hp(e,b,p)}}c||(c=new $e);var O=c.get(e);if(O)return O;c.set(e,d),Ws(e)?e.forEach(function(P){d.add(We(P,t,r,P,e,c))}):Ms(e)&&e.forEach(function(P,J){d.set(J,We(P,t,r,J,e,c))});var A=w?g?Ki:Bi:g?Ce:pe,x=R?i:A(e);return Ue(x||e,function(P,J){x&&(J=P,P=e[J]),bn(d,J,We(P,t,r,J,e,c))}),d}function Td(e){var t=pe(e);return function(r){return bo(r,e,t)}}function bo(e,t,r){var a=r.length;if(e==null)return!a;for(e=V(e);a--;){var s=r[a],c=t[s],d=e[s];if(d===i&&!(s in e)||!c(d))return!1}return!0}function Co(e,t,r){if(typeof e!="function")throw new Me(S);return Pn(function(){e.apply(i,r)},t)}function Cn(e,t,r,a){var s=-1,c=Xn,d=!0,p=e.length,g=[],w=t.length;if(!p)return g;r&&(t=ee(t,Oe(r))),a?(c=li,d=!1):t.length>=m&&(c=vn,d=!1,t=new Jt(t));e:for(;++ss?0:s+r),a=a===i||a>s?s:N(a),a<0&&(a+=s),a=r>a?0:js(a);r0&&r(p)?t>1?ge(p,t-1,r,a,s):yt(s,p):a||(s[s.length]=p)}return s}var ki=Xo(),Oo=Xo(!0);function et(e,t){return e&&ki(e,t,pe)}function Ti(e,t){return e&&Oo(e,t,pe)}function vr(e,t){return vt(t,function(r){return lt(e[r])})}function Mt(e,t){t=Ct(t,e);for(var r=0,a=t.length;e!=null&&rt}function Ad(e,t){return e!=null&&G.call(e,t)}function Pd(e,t){return e!=null&&t in V(e)}function qd(e,t,r){return e>=me(t,r)&&e=120&&R.length>=120)?new Jt(d&&R):i}R=e[0];var b=-1,C=p[0];e:for(;++b-1;)p!==e&&ur.call(p,g,1),ur.call(e,g,1);return e}function Mo(e,t){for(var r=e?t.length:0,a=r-1;r--;){var s=t[r];if(r==a||s!==c){var c=s;ct(s)?ur.call(e,s,1):Ji(e,s)}}return e}function Ni(e,t){return e+dr(yo()*(t-e+1))}function Kd(e,t,r,a){for(var s=-1,c=le(lr((t-e)/(r||1)),0),d=y(c);c--;)d[a?c:++s]=e,e+=r;return d}function xi(e,t){var r="";if(!e||t<1||t>mt)return r;do t%2&&(r+=e),t=dr(t/2),t&&(e+=e);while(t);return r}function E(e,t){return Zi(hs(e,t,ke),e+"")}function Gd(e){return Ro(an(e))}function zd(e,t){var r=an(e);return Ir(r,Ut(t,0,r.length))}function On(e,t,r,a){if(!te(e))return e;t=Ct(t,e);for(var s=-1,c=t.length,d=c-1,p=e;p!=null&&++ss?0:s+t),r=r>s?s:r,r<0&&(r+=s),s=t>r?0:r-t>>>0,t>>>=0;for(var c=y(s);++a>>1,d=e[c];d!==null&&!Ae(d)&&(r?d<=t:d=m){var w=t?null:op(e);if(w)return er(w);d=!1,s=vn,g=new Jt}else g=t?[]:p;e:for(;++a=a?e:De(e,t,r)}var Go=Ul||function(e){return de.clearTimeout(e)};function zo(e,t){if(t)return e.slice();var r=e.length,a=fo?fo(r):new e.constructor(r);return e.copy(a),a}function Wi(e){var t=new e.constructor(e.byteLength);return new or(t).set(new or(e)),t}function Zd(e,t){var r=t?Wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Xd(e){var t=new e.constructor(e.source,Ia.exec(e));return t.lastIndex=e.lastIndex,t}function Qd(e){return Sn?V(Sn.call(e)):{}}function Ho(e,t){var r=t?Wi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Vo(e,t){if(e!==t){var r=e!==i,a=e===null,s=e===e,c=Ae(e),d=t!==i,p=t===null,g=t===t,w=Ae(t);if(!p&&!w&&!c&&e>t||c&&d&&g&&!p&&!w||a&&d&&g||!r&&g||!s)return 1;if(!a&&!c&&!w&&e=p)return g;var w=r[a];return g*(w=="desc"?-1:1)}}return e.index-t.index}function $o(e,t,r,a){for(var s=-1,c=e.length,d=r.length,p=-1,g=t.length,w=le(c-d,0),R=y(g+w),b=!a;++p1?r[s-1]:i,d=s>2?r[2]:i;for(c=e.length>3&&typeof c=="function"?(s--,c):i,d&&_e(r[0],r[1],d)&&(c=s<3?i:c,s=1),t=V(t);++a-1?s[c?t[d]:d]:i}}function ts(e){return ut(function(t){var r=t.length,a=r,s=Le.prototype.thru;for(e&&t.reverse();a--;){var c=t[a];if(typeof c!="function")throw new Me(S);if(s&&!d&&Tr(c)=="wrapper")var d=new Le([],!0)}for(a=d?a:r;++a1&&M.reverse(),R&&gp))return!1;var w=c.get(e),R=c.get(t);if(w&&R)return w==t&&R==e;var b=-1,C=!0,O=r&H?new Jt:i;for(c.set(e,t),c.set(t,e);++b1?"& ":"")+t[a],t=t.join(r>2?", ":" "),e.replace(vc,`{ /* [wrapped with `+t+`] */ `)}function mp(e){return F(e)||Dt(e)||!!(mo&&e&&e[mo])}function ct(e,t){var r=typeof e;return t=t!=null?t:mt,!!t&&(r=="number"||r!="symbol"&&Ic.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Gu)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ir(e,t){var r=-1,a=e.length,s=a-1;for(t=t===i?a:t;++r1?e[t-1]:i;return r=typeof r=="function"?(e.pop(),r):i,Ts(e,r)});function Os(e){var t=u(e);return t.__chain__=!0,t}function If(e,t){return t(e),e}function Ar(e,t){return t(e)}var Af=ut(function(e){var t=e.length,r=t?e[0]:0,a=this.__wrapped__,s=function(c){return Ci(c,e)};return t>1||this.__actions__.length||!(a instanceof U)||!ct(r)?this.thru(s):(a=a.slice(r,+r+(t?1:0)),a.__actions__.push({func:Ar,args:[s],thisArg:i}),new Le(a,this.__chain__).thru(function(c){return t&&!c.length&&c.push(i),c}))});function Pf(){return Os(this)}function qf(){return new Le(this.value(),this.__chain__)}function Ff(){this.__values__===i&&(this.__values__=Ds(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function Nf(){return this}function xf(e){for(var t,r=this;r instanceof hr;){var a=ws(r);a.__index__=0,a.__values__=i,t?s.__wrapped__=a:t=a;var s=a;r=r.__wrapped__}return s.__wrapped__=e,t}function Ef(){var e=this.__wrapped__;if(e instanceof U){var t=e;return this.__actions__.length&&(t=new U(this)),t=t.reverse(),t.__actions__.push({func:Ar,args:[Xi],thisArg:i}),new Le(t,this.__chain__)}return this.thru(Xi)}function Jf(){return Bo(this.__wrapped__,this.__actions__)}var Uf=Rr(function(e,t,r){G.call(e,r)?++e[r]:ot(e,r,1)});function Mf(e,t,r){var a=F(e)?to:Od;return r&&_e(e,t,r)&&(t=i),a(e,I(t,3))}function Lf(e,t){var r=F(e)?vt:To;return r(e,I(t,3))}var Wf=es(Rs),Df=es(Ss);function jf(e,t){return ge(Pr(e,t),1)}function Bf(e,t){return ge(Pr(e,t),Ft)}function Kf(e,t,r){return r=r===i?1:N(r),ge(Pr(e,t),r)}function Is(e,t){var r=F(e)?Ue:St;return r(e,I(t,3))}function As(e,t){var r=F(e)?ul:ko;return r(e,I(t,3))}var Gf=Rr(function(e,t,r){G.call(e,r)?e[r].push(t):ot(e,r,[t])});function zf(e,t,r,a){e=be(e)?e:an(e),r=r&&!a?N(r):0;var s=e.length;return r<0&&(r=le(s+r,0)),Er(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&Ht(e,t,r)>-1}var Hf=E(function(e,t,r){var a=-1,s=typeof t=="function",c=be(e)?y(e.length):[];return St(e,function(d){c[++a]=s?Te(t,d,r):kn(d,t,r)}),c}),Vf=Rr(function(e,t,r){ot(e,r,t)});function Pr(e,t){var r=F(e)?ee:Fo;return r(e,I(t,3))}function $f(e,t,r,a){return e==null?[]:(F(t)||(t=t==null?[]:[t]),r=a?i:r,F(r)||(r=r==null?[]:[r]),Jo(e,t,r))}var Yf=Rr(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Zf(e,t,r){var a=F(e)?di:ao,s=arguments.length<3;return a(e,I(t,4),r,s,St)}function Xf(e,t,r){var a=F(e)?cl:ao,s=arguments.length<3;return a(e,I(t,4),r,s,ko)}function Qf(e,t){var r=F(e)?vt:To;return r(e,Nr(I(t,3)))}function eh(e){var t=F(e)?Ro:Gd;return t(e)}function th(e,t,r){(r?_e(e,t,r):t===i)?t=1:t=N(t);var a=F(e)?Sd:zd;return a(e,t)}function nh(e){var t=F(e)?bd:Vd;return t(e)}function rh(e){if(e==null)return 0;if(be(e))return Er(e)?$t(e):e.length;var t=ve(e);return t==ze||t==He?e.size:Pi(e).length}function ih(e,t,r){var a=F(e)?pi:$d;return r&&_e(e,t,r)&&(t=i),a(e,I(t,3))}var ah=E(function(e,t){if(e==null)return[];var r=t.length;return r>1&&_e(e,t[0],t[1])?t=[]:r>2&&_e(t[0],t[1],t[2])&&(t=[t[0]]),Jo(e,ge(t,1),[])}),qr=Ml||function(){return de.Date.now()};function oh(e,t){if(typeof t!="function")throw new Me(S);return e=N(e),function(){if(--e<1)return t.apply(this,arguments)}}function Ps(e,t,r){return t=r?i:t,t=e&&t==null?e.length:t,st(e,Ge,i,i,i,i,t)}function qs(e,t){var r;if(typeof t!="function")throw new Me(S);return e=N(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var ea=E(function(e,t,r){var a=D;if(r.length){var s=_t(r,nn(ea));a|=Ee}return st(e,a,t,r,s)}),Fs=E(function(e,t,r){var a=D|Q;if(r.length){var s=_t(r,nn(Fs));a|=Ee}return st(t,a,e,r,s)});function Ns(e,t,r){t=r?i:t;var a=st(e,he,i,i,i,i,i,t);return a.placeholder=Ns.placeholder,a}function xs(e,t,r){t=r?i:t;var a=st(e,Ke,i,i,i,i,i,t);return a.placeholder=xs.placeholder,a}function Es(e,t,r){var a,s,c,d,p,g,w=0,R=!1,b=!1,C=!0;if(typeof e!="function")throw new Me(S);t=Be(t)||0,te(r)&&(R=!!r.leading,b="maxWait"in r,c=b?le(Be(r.maxWait)||0,t):c,C="trailing"in r?!!r.trailing:C);function O(ie){var Ze=a,pt=s;return a=s=i,w=ie,d=e.apply(pt,Ze),d}function A(ie){return w=ie,p=Pn(J,t),R?O(ie):d}function x(ie){var Ze=ie-g,pt=ie-w,eu=t-Ze;return b?me(eu,c-pt):eu}function P(ie){var Ze=ie-g,pt=ie-w;return g===i||Ze>=t||Ze<0||b&&pt>=c}function J(){var ie=qr();if(P(ie))return M(ie);p=Pn(J,x(ie))}function M(ie){return p=i,C&&a?O(ie):(a=s=i,d)}function Pe(){p!==i&&Go(p),w=0,a=g=s=p=i}function we(){return p===i?d:M(qr())}function qe(){var ie=qr(),Ze=P(ie);if(a=arguments,s=this,g=ie,Ze){if(p===i)return A(g);if(b)return Go(p),p=Pn(J,t),O(g)}return p===i&&(p=Pn(J,t)),d}return qe.cancel=Pe,qe.flush=we,qe}var sh=E(function(e,t){return Co(e,1,t)}),uh=E(function(e,t,r){return Co(e,Be(t)||0,r)});function ch(e){return st(e,cn)}function Fr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Me(S);var r=function(){var a=arguments,s=t?t.apply(this,a):a[0],c=r.cache;if(c.has(s))return c.get(s);var d=e.apply(this,a);return r.cache=c.set(s,d)||c,d};return r.cache=new(Fr.Cache||at),r}Fr.Cache=at;function Nr(e){if(typeof e!="function")throw new Me(S);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function lh(e){return qs(2,e)}var dh=Yd(function(e,t){t=t.length==1&&F(t[0])?ee(t[0],Oe(I())):ee(ge(t,1),Oe(I()));var r=t.length;return E(function(a){for(var s=-1,c=me(a.length,r);++s=t}),Dt=Ao(function(){return arguments}())?Ao:function(e){return ne(e)&&G.call(e,"callee")&&!go.call(e,"callee")},F=y.isArray,Th=$a?Oe($a):Nd;function be(e){return e!=null&&xr(e.length)&&!lt(e)}function re(e){return ne(e)&&be(e)}function Oh(e){return e===!0||e===!1||ne(e)&&ye(e)==ln}var Tt=Wl||pa,Ih=Ya?Oe(Ya):xd;function Ah(e){return ne(e)&&e.nodeType===1&&!qn(e)}function Ph(e){if(e==null)return!0;if(be(e)&&(F(e)||typeof e=="string"||typeof e.splice=="function"||Tt(e)||rn(e)||Dt(e)))return!e.length;var t=ve(e);if(t==ze||t==He)return!e.size;if(An(e))return!Pi(e).length;for(var r in e)if(G.call(e,r))return!1;return!0}function qh(e,t){return Tn(e,t)}function Fh(e,t,r){r=typeof r=="function"?r:i;var a=r?r(e,t):i;return a===i?Tn(e,t,i,r):!!a}function na(e){if(!ne(e))return!1;var t=ye(e);return t==zn||t==ec||typeof e.message=="string"&&typeof e.name=="string"&&!qn(e)}function Nh(e){return typeof e=="number"&&vo(e)}function lt(e){if(!te(e))return!1;var t=ye(e);return t==Hn||t==ba||t==Qu||t==nc}function Us(e){return typeof e=="number"&&e==N(e)}function xr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mt}function te(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ne(e){return e!=null&&typeof e=="object"}var Ms=Za?Oe(Za):Jd;function xh(e,t){return e===t||Ai(e,t,zi(t))}function Eh(e,t,r){return r=typeof r=="function"?r:i,Ai(e,t,zi(t),r)}function Jh(e){return Ls(e)&&e!=+e}function Uh(e){if(_p(e))throw new q(f);return Po(e)}function Mh(e){return e===null}function Lh(e){return e==null}function Ls(e){return typeof e=="number"||ne(e)&&ye(e)==pn}function qn(e){if(!ne(e)||ye(e)!=rt)return!1;var t=sr(e);if(t===null)return!0;var r=G.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&rr.call(r)==xl}var ra=Xa?Oe(Xa):Ud;function Wh(e){return Us(e)&&e>=-mt&&e<=mt}var Ws=Qa?Oe(Qa):Md;function Er(e){return typeof e=="string"||!F(e)&&ne(e)&&ye(e)==hn}function Ae(e){return typeof e=="symbol"||ne(e)&&ye(e)==Vn}var rn=eo?Oe(eo):Ld;function Dh(e){return e===i}function jh(e){return ne(e)&&ve(e)==gn}function Bh(e){return ne(e)&&ye(e)==ic}var Kh=kr(qi),Gh=kr(function(e,t){return e<=t});function Ds(e){if(!e)return[];if(be(e))return Er(e)?Ve(e):Se(e);if(yn&&e[yn])return Sl(e[yn]());var t=ve(e),r=t==ze?yi:t==He?er:an;return r(e)}function dt(e){if(!e)return e===0?e:0;if(e=Be(e),e===Ft||e===-Ft){var t=e<0?-1:1;return t*$u}return e===e?e:0}function N(e){var t=dt(e),r=t%1;return t===t?r?t-r:t:0}function js(e){return e?Ut(N(e),0,Qe):0}function Be(e){if(typeof e=="number")return e;if(Ae(e))return Kn;if(te(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=te(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=oo(e);var r=kc.test(e);return r||Oc.test(e)?al(e.slice(2),r?2:8):Cc.test(e)?Kn:+e}function Bs(e){return tt(e,Ce(e))}function zh(e){return e?Ut(N(e),-mt,mt):e===0?e:0}function B(e){return e==null?"":Ie(e)}var Hh=en(function(e,t){if(An(t)||be(t)){tt(t,pe(t),e);return}for(var r in t)G.call(t,r)&&bn(e,r,t[r])}),Ks=en(function(e,t){tt(t,Ce(t),e)}),Jr=en(function(e,t,r,a){tt(t,Ce(t),e,a)}),Vh=en(function(e,t,r,a){tt(t,pe(t),e,a)}),$h=ut(Ci);function Yh(e,t){var r=Qt(e);return t==null?r:So(r,t)}var Zh=E(function(e,t){e=V(e);var r=-1,a=t.length,s=a>2?t[2]:i;for(s&&_e(t[0],t[1],s)&&(a=1);++r1),c}),tt(e,Ki(e),r),a&&(r=We(r,ae|xe|Z,sp));for(var s=t.length;s--;)Ji(r,t[s]);return r});function gg(e,t){return zs(e,Nr(I(t)))}var mg=ut(function(e,t){return e==null?{}:jd(e,t)});function zs(e,t){if(e==null)return{};var r=ee(Ki(e),function(a){return[a]});return t=I(t),Uo(e,r,function(a,s){return t(a,s[0])})}function vg(e,t,r){t=Ct(t,e);var a=-1,s=t.length;for(s||(s=1,e=i);++at){var a=e;e=t,t=a}if(r||e%1||t%1){var s=yo();return me(e+s*(t-e+il("1e-"+((s+"").length-1))),t)}return Ni(e,t)}var Ig=tn(function(e,t,r){return t=t.toLowerCase(),e+(r?$s(t):t)});function $s(e){return oa(B(e).toLowerCase())}function Ys(e){return e=B(e),e&&e.replace(Ac,vl).replace(Vc,"")}function Ag(e,t,r){e=B(e),t=Ie(t);var a=e.length;r=r===i?a:Ut(N(r),0,a);var s=r;return r-=t.length,r>=0&&e.slice(r,s)==t}function Pg(e){return e=B(e),e&&cc.test(e)?e.replace(Ta,yl):e}function qg(e){return e=B(e),e&&gc.test(e)?e.replace(ti,"\\$&"):e}var Fg=tn(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Ng=tn(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),xg=Qo("toLowerCase");function Eg(e,t,r){e=B(e),t=N(t);var a=t?$t(e):0;if(!t||a>=t)return e;var s=(t-a)/2;return Cr(dr(s),r)+e+Cr(lr(s),r)}function Jg(e,t,r){e=B(e),t=N(t);var a=t?$t(e):0;return t&&a>>0,r?(e=B(e),e&&(typeof t=="string"||t!=null&&!ra(t))&&(t=Ie(t),!t&&Vt(e))?kt(Ve(e),0,r):e.split(t,r)):[]}var Bg=tn(function(e,t,r){return e+(r?" ":"")+oa(t)});function Kg(e,t,r){return e=B(e),r=r==null?0:Ut(N(r),0,e.length),t=Ie(t),e.slice(r,r+t.length)==t}function Gg(e,t,r){var a=u.templateSettings;r&&_e(e,t,r)&&(t=i),e=B(e),t=Jr({},t,a,os);var s=Jr({},t.imports,a.imports,os),c=pe(s),d=vi(s,c),p,g,w=0,R=t.interpolate||$n,b="__p += '",C=_i((t.escape||$n).source+"|"+R.source+"|"+(R===Oa?bc:$n).source+"|"+(t.evaluate||$n).source+"|$","g"),O="//# sourceURL="+(G.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qc+"]")+` `;e.replace(C,function(P,J,M,Pe,we,qe){return M||(M=Pe),b+=e.slice(w,qe).replace(Pc,_l),J&&(p=!0,b+=`' + __e(`+J+`) + '`),we&&(g=!0,b+=`'; `+we+`; __p += '`),M&&(b+=`' + ((__t = (`+M+`)) == null ? '' : __t) + '`),w=qe+P.length,P}),b+=`'; `;var A=G.call(t,"variable")&&t.variable;if(!A)b=`with (obj) { `+b+` } `;else if(Rc.test(A))throw new q(W);b=(g?b.replace(ac,""):b).replace(oc,"$1").replace(sc,"$1;"),b="function("+(A||"obj")+`) { `+(A?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(p?", __e = _.escape":"")+(g?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+b+`return __p }`;var x=Xs(function(){return j(c,O+"return "+b).apply(i,d)});if(x.source=b,na(x))throw x;return x}function zg(e){return B(e).toLowerCase()}function Hg(e){return B(e).toUpperCase()}function Vg(e,t,r){if(e=B(e),e&&(r||t===i))return oo(e);if(!e||!(t=Ie(t)))return e;var a=Ve(e),s=Ve(t),c=so(a,s),d=uo(a,s)+1;return kt(a,c,d).join("")}function $g(e,t,r){if(e=B(e),e&&(r||t===i))return e.slice(0,lo(e)+1);if(!e||!(t=Ie(t)))return e;var a=Ve(e),s=uo(a,Ve(t))+1;return kt(a,0,s).join("")}function Yg(e,t,r){if(e=B(e),e&&(r||t===i))return e.replace(ni,"");if(!e||!(t=Ie(t)))return e;var a=Ve(e),s=so(a,Ve(t));return kt(a,s).join("")}function Zg(e,t){var r=Gr,a=Ku;if(te(t)){var s="separator"in t?t.separator:s;r="length"in t?N(t.length):r,a="omission"in t?Ie(t.omission):a}e=B(e);var c=e.length;if(Vt(e)){var d=Ve(e);c=d.length}if(r>=c)return e;var p=r-$t(a);if(p<1)return a;var g=d?kt(d,0,p).join(""):e.slice(0,p);if(s===i)return g+a;if(d&&(p+=g.length-p),ra(s)){if(e.slice(p).search(s)){var w,R=g;for(s.global||(s=_i(s.source,B(Ia.exec(s))+"g")),s.lastIndex=0;w=s.exec(R);)var b=w.index;g=g.slice(0,b===i?p:b)}}else if(e.indexOf(Ie(s),p)!=p){var C=g.lastIndexOf(s);C>-1&&(g=g.slice(0,C))}return g+a}function Xg(e){return e=B(e),e&&uc.test(e)?e.replace(ka,Tl):e}var Qg=tn(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),oa=Qo("toUpperCase");function Zs(e,t,r){return e=B(e),t=r?i:t,t===i?Rl(e)?Al(e):pl(e):e.match(t)||[]}var Xs=E(function(e,t){try{return Te(e,i,t)}catch(r){return na(r)?r:new q(r)}}),em=ut(function(e,t){return Ue(t,function(r){r=nt(r),ot(e,r,ea(e[r],e))}),e});function tm(e){var t=e==null?0:e.length,r=I();return e=t?ee(e,function(a){if(typeof a[1]!="function")throw new Me(S);return[r(a[0]),a[1]]}):[],E(function(a){for(var s=-1;++smt)return[];var r=Qe,a=me(e,Qe);t=I(t),e-=Qe;for(var s=mi(a,t);++r0||t<0)?new U(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(t=N(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},U.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},U.prototype.toArray=function(){return this.take(Qe)},et(U.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),s=u[a?"take"+(t=="last"?"Right":""):t],c=a||/^find/.test(t);s&&(u.prototype[t]=function(){var d=this.__wrapped__,p=a?[1]:arguments,g=d instanceof U,w=p[0],R=g||F(d),b=function(J){var M=s.apply(u,yt([J],p));return a&&C?M[0]:M};R&&r&&typeof w=="function"&&w.length!=1&&(g=R=!1);var C=this.__chain__,O=!!this.__actions__.length,A=c&&!C,x=g&&!O;if(!c&&R){d=x?d:new U(this);var P=e.apply(d,p);return P.__actions__.push({func:Ar,args:[b],thisArg:i}),new Le(P,C)}return A&&x?e.apply(this,p):(P=this.thru(b),A?a?P.value()[0]:P.value():P)})}),Ue(["pop","push","shift","sort","splice","unshift"],function(e){var t=tr[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",a=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var s=arguments;if(a&&!this.__chain__){var c=this.value();return t.apply(F(c)?c:[],s)}return this[r](function(d){return t.apply(F(d)?d:[],s)})}}),et(U.prototype,function(e,t){var r=u[t];if(r){var a=r.name+"";G.call(Xt,a)||(Xt[a]=[]),Xt[a].push({name:t,func:r})}}),Xt[Sr(i,Q).name]=[{name:"wrapper",func:i}],U.prototype.clone=Zl,U.prototype.reverse=Xl,U.prototype.value=Ql,u.prototype.at=Af,u.prototype.chain=Pf,u.prototype.commit=qf,u.prototype.next=Ff,u.prototype.plant=xf,u.prototype.reverse=Ef,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=Jf,u.prototype.first=u.prototype.head,yn&&(u.prototype[yn]=Nf),u},wt=Pl();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(de._=wt,define(function(){return wt})):Nt?((Nt.exports=wt)._=wt,ui._=wt):de._=wt}).call(n)}),Re=class{static encodeBytes(n){let o=btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/g,"-").replace(/\//g,"_");return iu(o)}static decodeBytes(n){let o=n.replace(/-/g,"+").replace(/_/g,"/"),i=iu(o);return Uint8Array.from(atob(i),l=>l.charCodeAt(0))}},iu=n=>{let o=n.indexOf("=");return n.slice(0,o===-1?n.length:o)},se=class extends Error{constructor(o,i){super();Xe(this,"statusCode");Xe(this,"statusText");Xe(this,"message");Xe(this,"name");this.name="PassageError",this.statusCode=i.status,this.statusText=i.statusText,this.message=this._parsePsgErrorResponse(o)}_parsePsgErrorResponse(o){try{return o=JSON.parse(o),o.error?o.error:""}catch(i){return o}}},ue=(n=>(n[n.MultipleChoice=300]="MultipleChoice",n[n.MovedPermanantly=301]="MovedPermanantly",n[n.Found=302]="Found",n[n.SeeOther=303]="SeeOther",n[n.NotModified=304]="NotModified",n[n.TemporaryRedirect=307]="TemporaryRedirect",n[n.PermanentRedirect=308]="PermanentRedirect",n[n.BadRequest=400]="BadRequest",n[n.Unauthorized=401]="Unauthorized",n[n.PaymentRequired=402]="PaymentRequired",n[n.Forbidden=403]="Forbidden",n[n.NotFound=404]="NotFound",n[n.MethodNotAllowed=405]="MethodNotAllowed",n[n.NotAcceptable=406]="NotAcceptable",n[n.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",n[n.RequestTimeout=408]="RequestTimeout",n[n.Conflict=409]="Conflict",n[n.Gone=410]="Gone",n[n.LengthRequired=411]="LengthRequired",n[n.PreconditionFailed=412]="PreconditionFailed",n[n.PayloadTooLarge=413]="PayloadTooLarge",n[n.URITooLong=414]="URITooLong",n[n.UnsupportedMediaType=415]="UnsupportedMediaType",n[n.RangeNotSatisfiable=416]="RangeNotSatisfiable",n[n.ExpectationFailed=417]="ExpectationFailed",n[n.MisdirectedRequest=421]="MisdirectedRequest",n[n.UnprocessableEntity=422]="UnprocessableEntity",n[n.Locked=423]="Locked",n[n.FailedDependency=424]="FailedDependency",n[n.TooEarly=425]="TooEarly",n[n.UpgradeRequired=426]="UpgradeRequired",n[n.PreconditionRequired=428]="PreconditionRequired",n[n.TooManyRequests=429]="TooManyRequests",n[n.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",n[n.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",n[n.InternalServerError=500]="InternalServerError",n[n.NotImplemented=501]="NotImplemented",n[n.BadGateway=502]="BadGateway",n[n.ServiceUnavailable=503]="ServiceUnavailable",n[n.GatewayTimeout=504]="GatewayTimeout",n[n.HTTPVersionNotSupported=505]="HTTPVersionNotSupported",n[n.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",n[n.InsufficientStorage=507]="InsufficientStorage",n[n.LoopDetected=508]="LoopDetected",n[n.NotExtended=510]="NotExtended",n[n.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",n[n.PSGCredObjectDoesNotExist=700]="PSGCredObjectDoesNotExist",n[n.PSGParsePublicKeyForNewDeviceFailed=701]="PSGParsePublicKeyForNewDeviceFailed",n[n.PSGParsePublicKeyForLoginFailed=702]="PSGParsePublicKeyForLoginFailed",n[n.PSGCouldNotGetUserCredential=703]="PSGCouldNotGetUserCredential",n[n.PSGLoginRequired=704]="PSGLoginRequired",n[n.PSGSecureContextRequired=705]="PSGSecureContextRequired",n[n.PSGSocialSessionStorageError=706]="PSGSocialSessionStorageError",n[n.PSGParsePublicKeyForRegistrationFailed=707]="PSGParsePublicKeyForRegistrationFailed",n[n.PSGCanAuthenticateWithPasskeyFailed=708]="PSGCanAuthenticateWithPasskeyFailed",n[n.PSGCanRegisterWithPasskeyFailed=709]="PSGCanRegisterWithPasskeyFailed",n[n.PSGCanUseConditionalMediationFailed=710]="PSGCanUseConditionalMediationFailed",n[n.PSGAuthOriginConfigurationError=711]="PSGAuthOriginConfigurationError",n[n.PSGMustRunInBrowserContext=712]="PSGMustRunInBrowserContext",n))(ue||{});var nv=()=>(n,o)=>v(void 0,null,function*(){}),rv=()=>(n,o,...i)=>v(void 0,null,function*(){return i}),iv=()=>(n,o,i)=>v(void 0,null,function*(){return i.data}),av=()=>(n,o,i)=>{throw console.error(i),i},ov=()=>(n,o)=>v(void 0,null,function*(){}),sv=()=>({onStart:nv(),onBeforeRequest:rv(),onResponseSuccess:iv(),onError:av(),onFinish:ov()}),uv=(n,o,i,l)=>{let{onStart:m,onBeforeRequest:f,onResponseSuccess:S,onError:W,onFinish:L}=sv(),{onStart:K=m,onBeforeRequest:Y=f,onResponseSuccess:ae=S,onError:xe=W,onFinish:Z=L}=i;return(...oe)=>v(void 0,null,function*(){K&&(yield K(l,o));try{let H;Y?H=yield Y(l,o,...oe):H=oe;let D=yield o.apply(n,H),Q;return ae?Q=yield ae(l,o,D):Q=D.data,Q}catch(H){throw xe?yield xe(l,o,H):H}finally{Z&&(yield Z(l,o))}})},Nn=hu(gu()),cv=(n,o)=>({lookupValue:(i,l,m)=>m!=null?(0,Nn.get)(l,i,(0,Nn.get)(n,i,m)):(0,Nn.get)(l,i,(0,Nn.get)(n,i,(0,Nn.get)(o,i,void 0)))}),lv=hu(gu());function dv(n){return"response"in n}var pv={},fv=(n,o)=>{let{lookupValue:i}=cv(n,pv),l=(Z,oe)=>v(void 0,null,function*(){}),m=(Z,oe,...H)=>v(void 0,null,function*(){let D=i("requestNormalizer",Z),Q=D?D(H):H;if(i("requiresAppId",Z)){if(!o)throw new Error("App ID is required.");Q.unshift(`${o}`)}return Q}),f=(Z,oe,H)=>v(void 0,null,function*(){let D=i("responseDataKey",Z),Q;D?Q=(0,lv.get)(H,D,void 0):Q=H;let Pt=i("responseSerializer",Z),he;Pt?he=yield Pt(Q):he=Q;let Ke=i("onResponseSuccess",Z);return Ke&&(yield Ke(Q,he)),he}),S=(Z,oe)=>v(void 0,null,function*(){}),W=(Z,oe,H)=>v(void 0,null,function*(){if(!dv(H))throw H;let D=H.response,Q=yield D.text();return new se(Q,D)}),L=()=>l,K=()=>m,Y=()=>f,ae=()=>S,xe=()=>W;return{handlers:()=>({onStart:L(),onBeforeRequest:K(),onResponseSuccess:Y(),onFinish:ae(),onError:xe()})}},hv="https://auth.passage.id/v1".replace(/\/+$/,""),mu=class{constructor(n={}){this.configuration=n}set config(n){this.configuration=n}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:hv}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||vu}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let n=this.configuration.apiKey;if(n)return typeof n=="function"?n:()=>n}get accessToken(){let n=this.configuration.accessToken;if(n)return typeof n=="function"?n:()=>v(this,null,function*(){return n})}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}},gv=new mu,on,ht=(on=class{constructor(o=gv){Xe(this,"middleware");Xe(this,"fetchApi",(o,i)=>v(this,null,function*(){let l={url:o,init:i};for(let f of this.middleware)f.pre&&(l=(yield f.pre(Fe({fetch:this.fetchApi},l)))||l);let m;try{m=yield(this.configuration.fetchApi||fetch)(l.url,l.init)}catch(f){for(let S of this.middleware)S.onError&&(m=(yield S.onError({fetch:this.fetchApi,url:l.url,init:l.init,error:f,response:m?m.clone():void 0}))||m);if(m===void 0)throw f instanceof Error?new _v(f,"The request failed and the interceptors did not return an alternative response"):f}for(let f of this.middleware)f.post&&(m=(yield f.post({fetch:this.fetchApi,url:l.url,init:l.init,response:m.clone()}))||m);return m}));this.configuration=o,this.middleware=o.middleware}withMiddleware(...o){let i=this.clone();return i.middleware=i.middleware.concat(...o),i}withPreMiddleware(...o){let i=o.map(l=>({pre:l}));return this.withMiddleware(...i)}withPostMiddleware(...o){let i=o.map(l=>({post:l}));return this.withMiddleware(...i)}isJsonMime(o){return o?on.jsonRegex.test(o):!1}request(o,i){return v(this,null,function*(){let{url:l,init:m}=yield this.createFetchParams(o,i),f=yield this.fetchApi(l,m);if(f&&f.status>=200&&f.status<300)return f;throw new yv(f,"Response returned an error code")})}createFetchParams(o,i){return v(this,null,function*(){let l=this.configuration.basePath+o.path;o.query!==void 0&&Object.keys(o.query).length!==0&&(l+="?"+this.configuration.queryParamsStringify(o.query));let m=Object.assign({},this.configuration.headers,o.headers);Object.keys(m).forEach(Y=>m[Y]===void 0?delete m[Y]:{});let f=typeof i=="function"?i:()=>v(this,null,function*(){return i}),S={method:o.method,headers:m,body:o.body,credentials:this.configuration.credentials},W=Fe(Fe({},S),yield f({init:S,context:o})),L;vv(W.body)||W.body instanceof URLSearchParams||mv(W.body)?L=W.body:this.isJsonMime(m["Content-Type"])?L=JSON.stringify(W.body):L=W.body;let K=jt(Fe({},W),{body:L});return{url:l,init:K}})}clone(){let o=this.constructor,i=new o(this.configuration);return i.middleware=this.middleware.slice(),i}},Xe(on,"jsonRegex",new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i")),on);function mv(n){return typeof Blob<"u"&&n instanceof Blob}function vv(n){return typeof FormData<"u"&&n instanceof FormData}var yv=class extends Error{constructor(o,i){super(i);Xe(this,"name","ResponseError");this.response=o}},_v=class extends Error{constructor(o,i){super(i);Xe(this,"name","FetchError");this.cause=o}},k=class extends Error{constructor(o,i){super(i);Xe(this,"name","RequiredError");this.field=o}};function vu(n,o=""){return Object.keys(n).map(i=>yu(i,n[i],o)).filter(i=>i.length>0).join("&")}function yu(n,o,i=""){let l=i+(i.length?`[${n}]`:n);if(o instanceof Array){let m=o.map(f=>encodeURIComponent(String(f))).join(`&${encodeURIComponent(l)}=`);return`${encodeURIComponent(l)}=${m}`}if(o instanceof Set){let m=Array.from(o);return yu(n,m,i)}return o instanceof Date?`${encodeURIComponent(l)}=${encodeURIComponent(o.toISOString())}`:o instanceof Object?vu(o,l):`${encodeURIComponent(l)}=${encodeURIComponent(String(o))}`}function au(n){for(let o of n)if(o.contentType==="multipart/form-data")return!0;return!1}var z=class{constructor(n,o=i=>i){this.raw=n,this.transformer=o}value(){return v(this,null,function*(){return this.transformer(yield this.raw.json())})}},ft=class{constructor(n){this.raw=n}value(){return v(this,null,function*(){})}};function wv(n){return n==null?n:{magic_link:n.magicLink}}function Rv(n){return n==null?n:{otp:n.otp,otp_id:n.otpId}}function Sv(n){return n==null?n:{attestationObject:n.attestationObject,clientDataJSON:n.clientDataJSON,transports:n.transports}}function ha(n){return n==null?n:{authenticatorAttachment:n.authenticatorAttachment,clientExtensionResults:n.clientExtensionResults,id:n.id,rawId:n.rawId,response:Sv(n.response),transports:n.transports,type:n.type}}function bv(n){return n==null?n:{handshake_id:n.handshakeId,handshake_response:ha(n.handshakeResponse),user_id:n.userId}}function Cv(n){return kv(n,!1)}function kv(n,o){return n==null?n:{icon:n.icon==null?void 0:n.icon,id:n.id==null?void 0:n.id,name:n.name==null?void 0:n.name}}function Tv(n){return Ov(n,!1)}function Ov(n,o){return n==null?n:{displayName:n.displayName==null?void 0:n.displayName,icon:n.icon==null?void 0:n.icon,id:n.id==null?void 0:n.id,name:n.name==null?void 0:n.name}}function Iv(n){return Av(n,!1)}function Av(n,o){return n==null?n:{id:n.id==null?void 0:n.id,transports:n.transports==null?void 0:n.transports,type:n.type==null?void 0:n.type}}function Pv(n){return qv(n,!1)}function qv(n,o){return n==null?n:{alg:n.alg==null?void 0:n.alg,type:n.type==null?void 0:n.type}}function Fv(n){return Nv(n,!1)}function Nv(n,o){return n==null?n:{authenticatorAttachment:n.authenticatorAttachment==null?void 0:n.authenticatorAttachment,requireResidentKey:n.requireResidentKey==null?void 0:n.requireResidentKey,residentKey:n.residentKey==null?void 0:n.residentKey,userVerification:n.userVerification==null?void 0:n.userVerification}}function xv(n){return Ev(n,!1)}function Ev(n,o){return n==null?n:{attestation:n.attestation==null?void 0:n.attestation,authenticatorSelection:n.authenticatorSelection==null?void 0:Fv(n.authenticatorSelection),challenge:n.challenge==null?void 0:n.challenge,excludeCredentials:n.excludeCredentials==null?void 0:n.excludeCredentials.map(Iv),extensions:n.extensions==null?void 0:n.extensions,pubKeyCredParams:n.pubKeyCredParams==null?void 0:n.pubKeyCredParams.map(Pv),rp:n.rp==null?void 0:Cv(n.rp),timeout:n.timeout==null?void 0:n.timeout,user:n.user==null?void 0:Tv(n.user)}}function Jv(n){return Uv(n,!1)}function Uv(n,o){return n==null?n:{publicKey:n.publicKey==null?void 0:xv(n.publicKey)}}function ga(n){return Mv(n,!1)}function Mv(n,o){return n==null?n:{challenge:Jv(n.challenge),id:n.id}}var Ur=(n=>(n.Active="active",n.Inactive="inactive",n.Pending="pending",n))(Ur||{});function _u(n){return Lv(n,!1)}function Lv(n,o){return n}var Mr=(n=>(n.Passkey="passkey",n.SecurityKey="security_key",n.Platform="platform",n))(Mr||{});function ma(n){return Wv(n,!1)}function Wv(n,o){return n}function Lr(n){return Dv(n,!1)}function Dv(n,o){var i,l;return n==null?n:{email:n.email,emailVerified:n.email_verified,id:n.id,phone:n.phone,phoneVerified:n.phone_verified,status:_u(n.status),userMetadata:n.user_metadata,webauthn:n.webauthn,webauthnTypes:(l=(i=n.webauthn_types)==null?void 0:i.map(ma))!=null?l:[]}}function jv(n){return Bv(n,!1)}function Bv(n,o){return n==null?n:{handshake:ga(n.handshake),user:n.user==null?void 0:Lr(n.user)}}var va=(n=>(n.S="s",n.M="m",n.H="h",n.D="d",n))(va||{});function wu(n){return Kv(n,!1)}function Kv(n,o){return n}function Gv(n){return zv(n,!1)}function zv(n,o){return n==null?n:{ttl:n.ttl==null?void 0:n.ttl,ttlDisplayUnit:n.ttl_display_unit==null?void 0:wu(n.ttl_display_unit)}}function Hv(n){return Vv(n,!1)}function Vv(n,o){return n==null?n:{ttl:n.ttl==null?void 0:n.ttl,ttlDisplayUnit:n.ttl_display_unit==null?void 0:wu(n.ttl_display_unit)}}function $v(n){return Yv(n,!1)}function Yv(n,o){return n==null?n:{passkeys:n.passkeys==null?void 0:n.passkeys,otp:n.otp==null?void 0:Hv(n.otp),magicLink:n.magic_link==null?void 0:Gv(n.magic_link)}}function ou(n){return Zv(n,!1)}function Zv(n,o){return n==null?n:{h:n.h,id:n.id,w:n.w,x:n.x,y:n.y}}function Xv(n){return Qv(n,!1)}function Qv(n,o){return n==null?n:{profile:n.profile.map(ou),registration:n.registration.map(ou)}}function ey(n){return ty(n,!1)}function ty(n,o){return n==null?n:{apple:n.apple==null?void 0:n.apple,google:n.google==null?void 0:n.google,github:n.github==null?void 0:n.github}}function ny(n){return ry(n,!1)}function ry(n,o){return n==null?n:{fieldName:n.field_name,friendlyName:n.friendly_name,id:n.id,profile:n.profile,registration:n.registration,type:n.type}}var iy=(n=>(n.Helvetica="Helvetica",n.Arial="Arial",n.ArialBlack="Arial Black",n.Verdana="Verdana",n.Tahoma="Tahoma",n.TrebuchetMs="Trebuchet MS",n.Impact="Impact",n.GillSans="Gill Sans",n.TimesNewRoman="Times New Roman",n.Georgia="Georgia",n.Palatino="Palatino",n.Baskerville="Baskerville",n.AndalMono="Andal\xE9 Mono",n.Courier="Courier",n.Lucida="Lucida",n.Monaco="Monaco",n.BradleyHand="Bradley Hand",n.BrushScriptMt="Brush Script MT",n.Luminari="Luminari",n.ComicSansMs="Comic Sans MS",n))(iy||{});function su(n){return ay(n,!1)}function ay(n,o){return n}function uu(n){return oy(n,!1)}function oy(n,o){return n==null?n:{passageContainerBackgroundColor:n.passage_container_background_color==null?void 0:n.passage_container_background_color,passageContainerMaxWidth:n.passage_container_max_width==null?void 0:n.passage_container_max_width,passageInputBoxBackgroundColor:n.passage_input_box_background_color==null?void 0:n.passage_input_box_background_color,passageInputBoxBorderRadius:n.passage_input_box_border_radius==null?void 0:n.passage_input_box_border_radius,passageHeaderFontFamily:n.passage_header_font_family==null?void 0:su(n.passage_header_font_family),passageBodyFontFamily:n.passage_body_font_family==null?void 0:su(n.passage_body_font_family),passageHeaderTextColor:n.passage_header_text_color==null?void 0:n.passage_header_text_color,passageBodyTextColor:n.passage_body_text_color==null?void 0:n.passage_body_text_color,passagePrimaryButtonBackgroundColor:n.passage_primary_button_background_color==null?void 0:n.passage_primary_button_background_color,passagePrimaryButtonTextColor:n.passage_primary_button_text_color==null?void 0:n.passage_primary_button_text_color,passagePrimaryButtonHoverColor:n.passage_primary_button_hover_color==null?void 0:n.passage_primary_button_hover_color,passagePrimaryButtonBorderRadius:n.passage_primary_button_border_radius==null?void 0:n.passage_primary_button_border_radius,passagePrimaryButtonBorderColor:n.passage_primary_button_border_color==null?void 0:n.passage_primary_button_border_color,passagePrimaryButtonBorderWidth:n.passage_primary_button_border_width==null?void 0:n.passage_primary_button_border_width,passageSecondaryButtonBackgroundColor:n.passage_secondary_button_background_color==null?void 0:n.passage_secondary_button_background_color,passageSecondaryButtonTextColor:n.passage_secondary_button_text_color==null?void 0:n.passage_secondary_button_text_color,passageSecondaryButtonHoverColor:n.passage_secondary_button_hover_color==null?void 0:n.passage_secondary_button_hover_color,passageSecondaryButtonBorderRadius:n.passage_secondary_button_border_radius==null?void 0:n.passage_secondary_button_border_radius,passageSecondaryButtonBorderColor:n.passage_secondary_button_border_color==null?void 0:n.passage_secondary_button_border_color,passageSecondaryButtonBorderWidth:n.passage_secondary_button_border_width==null?void 0:n.passage_secondary_button_border_width}}var ya=(n=>(n.MagicLink="magic_link",n.Otp="otp",n.None="none",n))(ya||{});function sy(n){return uy(n,!1)}function uy(n,o){return n==null?n:{allowedIdentifier:n.allowed_identifier,authFallbackMethod:n.auth_fallback_method,authFallbackMethodTtl:n.auth_fallback_method_ttl,authMethods:$v(n.auth_methods),authOrigin:n.auth_origin,defaultLanguage:n.default_language,elementCustomization:uu(n.element_customization),elementCustomizationDark:uu(n.element_customization_dark),ephemeral:n.ephemeral,id:n.id,layouts:Xv(n.layouts),loginUrl:n.login_url,name:n.name,passageBranding:n.passage_branding,publicSignup:n.public_signup,profileManagement:n.profile_management,redirectUrl:n.redirect_url,requireEmailVerification:n.require_email_verification,requireIdentifierVerification:n.require_identifier_verification,requiredIdentifier:n.required_identifier,rsaPublicKey:n.rsa_public_key,sessionTimeoutLength:n.session_timeout_length,socialConnections:ey(n.social_connections),userMetadataSchema:n.user_metadata_schema.map(ny)}}function cy(n){return ly(n,!1)}function ly(n,o){return n==null?n:{providerId:n.provider_id,createdAt:new Date(n.created_at),lastLoginAt:new Date(n.last_login_at),providerIdentifier:n.provider_identifier}}function dy(n){return py(n,!1)}function py(n,o){return n==null?n:{authToken:n.auth_token,redirectUrl:n.redirect_url,refreshToken:n.refresh_token==null?void 0:n.refresh_token,refreshTokenExpiration:n.refresh_token_expiration==null?void 0:n.refresh_token_expiration}}function Ot(n){return fy(n,!1)}function fy(n,o){return n==null?n:{authResult:dy(n.auth_result)}}function hy(n){return n==null?n:{authenticatorData:n.authenticatorData,clientDataJSON:n.clientDataJSON,signature:n.signature,userHandle:n.userHandle}}function gy(n){return n==null?n:{authenticatorAttachment:n.authenticatorAttachment,clientExtensionResults:n.clientExtensionResults,id:n.id,rawId:n.rawId,response:hy(n.response),type:n.type}}function my(n){return vy(n,!1)}function vy(n,o){return n==null?n:{id:n.id,transports:n.transports==null?void 0:n.transports,type:n.type}}function yy(n){return _y(n,!1)}function _y(n,o){return n==null?n:{allowCredentials:n.allowCredentials==null?void 0:n.allowCredentials.map(my),challenge:n.challenge,extensions:n.extensions==null?void 0:n.extensions,rpId:n.rpId==null?void 0:n.rpId,timeout:n.timeout==null?void 0:n.timeout,userVerification:n.userVerification==null?void 0:n.userVerification}}function wy(n){return Ry(n,!1)}function Ry(n,o){return n==null?n:{publicKey:yy(n.publicKey)}}function Sy(n){return by(n,!1)}function by(n,o){return n==null?n:{challenge:wy(n.challenge),id:n.id}}var xn=(n=>(n.Platform="platform",n.CrossPlatform="cross-platform",n.Any="any",n))(xn||{});function Cy(n){return n==null?n:{identifier:n.identifier,user_metadata:n.userMetadata}}function ky(n){return Ty(n,!1)}function Ty(n,o){return n==null?n:{light:n.light,dark:n.dark}}function _a(n){return Oy(n,!1)}function Oy(n,o){return n==null?n:{createdAt:n.created_at,credId:n.cred_id,friendlyName:n.friendly_name,id:n.id,lastLoginAt:n.last_login_at,type:ma(n.type),updatedAt:n.updated_at,usageCount:n.usage_count,userId:n.user_id,icons:ky(n.icons)}}function Iy(n){return Ay(n,!1)}function Ay(n,o){return n==null?n:{providerId:n.provider_id,createdAt:new Date(n.created_at),lastLoginAt:new Date(n.last_login_at),providerIdentifier:n.provider_identifier}}function Py(n){return qy(n,!1)}function qy(n,o){return n==null?n:{providerId:n.provider_id,createdAt:new Date(n.created_at),lastLoginAt:new Date(n.last_login_at),providerIdentifier:n.provider_identifier}}function Ru(n){return Fy(n,!1)}function Fy(n,o){return n==null?n:{apple:n.apple==null?void 0:cy(n.apple),github:n.github==null?void 0:Py(n.github),google:n.google==null?void 0:Iy(n.google)}}function Ny(n){return xy(n,!1)}function xy(n,o){return n==null?n:{createdAt:n.created_at,email:n.email,emailVerified:n.email_verified,id:n.id,lastLoginAt:n.last_login_at,loginCount:n.login_count,phone:n.phone,phoneVerified:n.phone_verified,socialConnections:Ru(n.social_connections),status:_u(n.status),updatedAt:n.updated_at,userMetadata:n.user_metadata,webauthn:n.webauthn,webauthnDevices:n.webauthn_devices.map(_a),webauthnTypes:n.webauthn_types.map(ma)}}function cu(n){return Ey(n,!1)}function Ey(n,o){return n==null?n:{device:_a(n.device)}}function Jy(n){return Uy(n,!1)}function Uy(n,o){return n==null?n:{devices:n.devices.map(_a)}}function My(n){return n==null?n:{authenticator_attachment:n.authenticatorAttachment}}function lu(n){return Ly(n,!1)}function Ly(n,o){return n==null?n:{user:Ny(n.user)}}function Wy(n){return Dy(n,!1)}function Dy(n,o){return n==null?n:{app:sy(n.app)}}function jy(n){return n==null?n:{id:n.id}}var By=(n=>(n.Apple="apple",n.Google="google",n))(By||{});function Ky(n){return n==null?n:{code:n.code,id_token:n.idToken,connection_type:n.connectionType}}function Gy(n){return n==null?n:{identifier:n.identifier,language:n.language,magic_link_path:n.magicLinkPath}}function wa(n){return zy(n,!1)}function zy(n,o){return n==null?n:{id:n.id}}function Hy(n){return Vy(n,!1)}function Vy(n,o){return n==null?n:{magicLink:wa(n.magic_link)}}function $y(n){return n==null?n:{identifier:n.identifier,language:n.language}}function Yy(n){return n==null?n:{handshake_id:n.handshakeId,handshake_response:gy(n.handshakeResponse),user_id:n.userId}}function Zy(n){return n==null?n:{identifier:n.identifier}}function Xy(n){return Qy(n,!1)}function Qy(n,o){return n==null?n:{handshake:Sy(n.handshake),user:n.user==null?void 0:Lr(n.user)}}function du(n){return e_(n,!1)}function e_(n,o){return n==null?n:{magicLink:wa(n.magic_link)}}var t_=(n=>(n.Request="invalid_request",n.ClientVersion="invalid_client_version",n))(t_||{});var n_=(n=>(n.DiscoverableLoginFailed="discoverable_login_failed",n.WebauthnLoginFailed="webauthn_login_failed",n.InvalidMagicLink="invalid_magic_link",n.InvalidAccessToken="invalid_access_token",n.InvalidRefreshToken="invalid_refresh_token",n.ExceededAttempts="exceeded_attempts",n))(n_||{});var r_=(n=>(n.IdentifierNotVerified="identifier_not_verified",n.OperationNotAllowed="operation_not_allowed",n.UserNotActive="user_not_active",n))(r_||{});var i_=(n=>(n.AppNotFound="app_not_found",n.UserNotFound="user_not_found",n.MagicLinkNotFound="magic_link_not_found",n.SocialConnectionNotFound="social_connection_not_found",n.TransactionNotFound="transaction_not_found",n))(i_||{});var a_=(n=>(n.UserHasNoPasskeys="user_has_no_passkeys",n))(a_||{});var o_=(n=>(n.InternalServerError="internal_server_error",n))(o_||{});function s_(n){return u_(n,!1)}function u_(n,o){return n==null?n:{nonce:n.nonce}}function Su(n){return c_(n,!1)}function c_(n,o){return n==null?n:{otpId:n.otp_id}}function l_(n){return n==null?n:{refresh_token:n.refreshToken}}function d_(n){return n==null?n:{identifier:n.identifier,language:n.language,magic_link_path:n.magicLinkPath}}function p_(n){return f_(n,!1)}function f_(n,o){return n==null?n:{magicLink:wa(n.magic_link)}}function h_(n){return n==null?n:{identifier:n.identifier,language:n.language}}function g_(n){return n==null?n:{handshake_id:n.handshakeId,handshake_response:ha(n.handshakeResponse),user_id:n.userId}}function m_(n){return n==null?n:{handshake_id:n.handshakeId,handshake_response:ha(n.handshakeResponse),transaction_id:n.transactionId}}function v_(n){return n==null?n:{identifier:n.identifier,authenticator_attachment:n.authenticatorAttachment}}function y_(n){return __(n,!1)}function __(n,o){return n==null?n:{handshake:ga(n.handshake),user:n.user==null?void 0:Lr(n.user)}}function w_(n){return n==null?n:{transaction_id:n.transactionId,authenticator_attachment:n.authenticatorAttachment}}function R_(n){return S_(n,!1)}function S_(n,o){return n==null?n:{handshake:ga(n.handshake),transactionId:n.transaction_id==null?void 0:n.transaction_id}}function b_(n){return C_(n,!1)}function C_(n,o){return n==null?n:{socialConnections:Ru(n.social_connections)}}function k_(n){return n==null?n:{friendly_name:n.friendlyName}}function T_(n){return n==null?n:{user_metadata:n.userMetadata}}function O_(n){return n==null?n:{language:n.language,magic_link_path:n.magicLinkPath,new_email:n.newEmail,redirect_url:n.redirectUrl}}function I_(n){return n==null?n:{language:n.language,magic_link_path:n.magicLinkPath,new_phone:n.newPhone,redirect_url:n.redirectUrl}}function A_(n){return P_(n,!1)}function P_(n,o){return n==null?n:{userMetadata:n.user_metadata}}function pu(n){return q_(n,!1)}function q_(n,o){return n==null?n:{user:Lr(n.user)}}var bu=class extends ht{getAppRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getApp().');let i={},l={},m=yield this.request({path:"/apps/{app_id}".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>Wy(f))})}getApp(n,o){return v(this,null,function*(){return yield(yield this.getAppRaw({appId:n},o)).value()})}};var Cu=class extends ht{deleteCurrentuserDeviceRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling deleteCurrentuserDevice().');if(n.deviceId==null)throw new k("deviceId",'Required parameter "deviceId" was null or undefined when calling deleteCurrentuserDevice().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/devices/{device_id}".replace("{app_id}",encodeURIComponent(String(n.appId))).replace("{device_id}",encodeURIComponent(String(n.deviceId))),method:"DELETE",headers:l,query:i},o);return new ft(m)})}deleteCurrentuserDevice(n,o,i){return v(this,null,function*(){yield this.deleteCurrentuserDeviceRaw({appId:n,deviceId:o},i)})}deleteCurrentuserSocialConnectionRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling deleteCurrentuserSocialConnection().');if(n.socialConnectionType==null)throw new k("socialConnectionType",'Required parameter "socialConnectionType" was null or undefined when calling deleteCurrentuserSocialConnection().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/social-connections/{social_connection_type}".replace("{app_id}",encodeURIComponent(String(n.appId))).replace("{social_connection_type}",encodeURIComponent(String(n.socialConnectionType))),method:"DELETE",headers:l,query:i},o);return new ft(m)})}deleteCurrentuserSocialConnection(n,o,i){return v(this,null,function*(){yield this.deleteCurrentuserSocialConnectionRaw({appId:n,socialConnectionType:o},i)})}getCurrentuserRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getCurrentuser().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>lu(f))})}getCurrentuser(n,o){return v(this,null,function*(){return yield(yield this.getCurrentuserRaw({appId:n},o)).value()})}getCurrentuserDevicesRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getCurrentuserDevices().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/devices".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>Jy(f))})}getCurrentuserDevices(n,o){return v(this,null,function*(){return yield(yield this.getCurrentuserDevicesRaw({appId:n},o)).value()})}getCurrentuserMetadataRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getCurrentuserMetadata().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/user-metadata".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>A_(f))})}getCurrentuserMetadata(n,o){return v(this,null,function*(){return yield(yield this.getCurrentuserMetadataRaw({appId:n},o)).value()})}getCurrentuserSocialConnectionsRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getCurrentuserSocialConnections().');let i={},l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/social-connections".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>b_(f))})}getCurrentuserSocialConnections(n,o){return v(this,null,function*(){return yield(yield this.getCurrentuserSocialConnectionsRaw({appId:n},o)).value()})}postCurrentuserAddDeviceFinishRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling postCurrentuserAddDeviceFinish().');if(n.addDeviceFinishRequest==null)throw new k("addDeviceFinishRequest",'Required parameter "addDeviceFinishRequest" was null or undefined when calling postCurrentuserAddDeviceFinish().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/devices/finish".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:bv(n.addDeviceFinishRequest)},o);return new z(m,f=>cu(f))})}postCurrentuserAddDeviceFinish(n,o,i){return v(this,null,function*(){return yield(yield this.postCurrentuserAddDeviceFinishRaw({appId:n,addDeviceFinishRequest:o},i)).value()})}postCurrentuserAddDeviceStartRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling postCurrentuserAddDeviceStart().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/devices/start".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:My(n.currentUserDevicesStartRequest)},o);return new z(m,f=>jv(f))})}postCurrentuserAddDeviceStart(n,o,i){return v(this,null,function*(){return yield(yield this.postCurrentuserAddDeviceStartRaw({appId:n,currentUserDevicesStartRequest:o},i)).value()})}updateCurrentuserDeviceRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling updateCurrentuserDevice().');if(n.deviceId==null)throw new k("deviceId",'Required parameter "deviceId" was null or undefined when calling updateCurrentuserDevice().');if(n.updateDeviceRequest==null)throw new k("updateDeviceRequest",'Required parameter "updateDeviceRequest" was null or undefined when calling updateCurrentuserDevice().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/devices/{device_id}".replace("{app_id}",encodeURIComponent(String(n.appId))).replace("{device_id}",encodeURIComponent(String(n.deviceId))),method:"PATCH",headers:l,query:i,body:k_(n.updateDeviceRequest)},o);return new z(m,f=>cu(f))})}updateCurrentuserDevice(n,o,i,l){return v(this,null,function*(){return yield(yield this.updateCurrentuserDeviceRaw({appId:n,deviceId:o,updateDeviceRequest:i},l)).value()})}updateCurrentuserMetadataRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling updateCurrentuserMetadata().');if(n.updateMetadataRequest==null)throw new k("updateMetadataRequest",'Required parameter "updateMetadataRequest" was null or undefined when calling updateCurrentuserMetadata().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/user-metadata".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"PATCH",headers:l,query:i,body:T_(n.updateMetadataRequest)},o);return new z(m,f=>lu(f))})}updateCurrentuserMetadata(n,o,i){return v(this,null,function*(){return yield(yield this.updateCurrentuserMetadataRaw({appId:n,updateMetadataRequest:o},i)).value()})}updateEmailCurrentuserRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling updateEmailCurrentuser().');if(n.updateUserEmailRequest==null)throw new k("updateUserEmailRequest",'Required parameter "updateUserEmailRequest" was null or undefined when calling updateEmailCurrentuser().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/email".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"PATCH",headers:l,query:i,body:O_(n.updateUserEmailRequest)},o);return new z(m,f=>du(f))})}updateEmailCurrentuser(n,o,i){return v(this,null,function*(){return yield(yield this.updateEmailCurrentuserRaw({appId:n,updateUserEmailRequest:o},i)).value()})}updatePhoneCurrentuserRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling updatePhoneCurrentuser().');if(n.updateUserPhoneRequest==null)throw new k("updateUserPhoneRequest",'Required parameter "updateUserPhoneRequest" was null or undefined when calling updatePhoneCurrentuser().');let i={},l={};if(l["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/phone".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"PATCH",headers:l,query:i,body:I_(n.updateUserPhoneRequest)},o);return new z(m,f=>du(f))})}updatePhoneCurrentuser(n,o,i){return v(this,null,function*(){return yield(yield this.updatePhoneCurrentuserRaw({appId:n,updateUserPhoneRequest:o},i)).value()})}},F_=(n=>(n.Apple="apple",n.Github="github",n.Google="google",n))(F_||{});var ku=class extends ht{loginMagicLinkRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling loginMagicLink().');if(n.loginMagicLinkRequest==null)throw new k("loginMagicLinkRequest",'Required parameter "loginMagicLinkRequest" was null or undefined when calling loginMagicLink().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/login/magic-link".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Gy(n.loginMagicLinkRequest)},o);return new z(m,f=>Hy(f))})}loginMagicLink(n,o,i){return v(this,null,function*(){return yield(yield this.loginMagicLinkRaw({appId:n,loginMagicLinkRequest:o},i)).value()})}loginOneTimePasscodeRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling loginOneTimePasscode().');if(n.loginOneTimePasscodeRequest==null)throw new k("loginOneTimePasscodeRequest",'Required parameter "loginOneTimePasscodeRequest" was null or undefined when calling loginOneTimePasscode().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/login/otp".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:$y(n.loginOneTimePasscodeRequest)},o);return new z(m,f=>Su(f))})}loginOneTimePasscode(n,o,i){return v(this,null,function*(){return yield(yield this.loginOneTimePasscodeRaw({appId:n,loginOneTimePasscodeRequest:o},i)).value()})}loginWebauthnFinishRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling loginWebauthnFinish().');if(n.loginWebAuthnFinishRequest==null)throw new k("loginWebAuthnFinishRequest",'Required parameter "loginWebAuthnFinishRequest" was null or undefined when calling loginWebauthnFinish().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/login/webauthn/finish".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Yy(n.loginWebAuthnFinishRequest)},o);return new z(m,f=>Ot(f))})}loginWebauthnFinish(n,o,i){return v(this,null,function*(){return yield(yield this.loginWebauthnFinishRaw({appId:n,loginWebAuthnFinishRequest:o},i)).value()})}loginWebauthnStartRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling loginWebauthnStart().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/login/webauthn/start".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Zy(n.loginWebAuthnStartRequest)},o);return new z(m,f=>Xy(f))})}loginWebauthnStart(n,o,i){return v(this,null,function*(){return yield(yield this.loginWebauthnStartRaw({appId:n,loginWebAuthnStartRequest:o},i)).value()})}},Tu=class extends ht{activateMagicLinkRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling activateMagicLink().');if(n.activateMagicLinkRequest==null)throw new k("activateMagicLinkRequest",'Required parameter "activateMagicLinkRequest" was null or undefined when calling activateMagicLink().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/magic-link/activate".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"PATCH",headers:l,query:i,body:wv(n.activateMagicLinkRequest)},o);return new z(m,f=>Ot(f))})}activateMagicLink(n,o,i){return v(this,null,function*(){return yield(yield this.activateMagicLinkRaw({appId:n,activateMagicLinkRequest:o},i)).value()})}magicLinkStatusRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling magicLinkStatus().');if(n.getMagicLinkStatusRequest==null)throw new k("getMagicLinkStatusRequest",'Required parameter "getMagicLinkStatusRequest" was null or undefined when calling magicLinkStatus().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/magic-link/status".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:jy(n.getMagicLinkStatusRequest)},o);return new z(m,f=>Ot(f))})}magicLinkStatus(n,o,i){return v(this,null,function*(){return yield(yield this.magicLinkStatusRaw({appId:n,getMagicLinkStatusRequest:o},i)).value()})}},Ou=class extends ht{appleOauth2CallbackRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling appleOauth2Callback().');if(n.state==null)throw new k("state",'Required parameter "state" was null or undefined when calling appleOauth2Callback().');let i={},l={},m=au([{contentType:"application/x-www-form-urlencoded"}]),f;f=new URLSearchParams,n.code!=null&&f.append("code",n.code),n.idToken!=null&&f.append("id_token",n.idToken),n.state!=null&&f.append("state",n.state),n.user!=null&&f.append("user",n.user),n.error!=null&&f.append("error",n.error);let S=yield this.request({path:"/apps/{app_id}/social/oauth2_callback".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:f},o);return new ft(S)})}appleOauth2Callback(n,o,i,l,m,f,S){return v(this,null,function*(){yield this.appleOauth2CallbackRaw({appId:n,state:o,code:i,idToken:l,user:m,error:f},S)})}appleOauth2CallbackDefaultDevRaw(n,o){return v(this,null,function*(){if(n.state==null)throw new k("state",'Required parameter "state" was null or undefined when calling appleOauth2CallbackDefaultDev().');let i={},l={},m=au([{contentType:"application/x-www-form-urlencoded"}]),f;f=new URLSearchParams,n.code!=null&&f.append("code",n.code),n.idToken!=null&&f.append("id_token",n.idToken),n.state!=null&&f.append("state",n.state),n.user!=null&&f.append("user",n.user),n.error!=null&&f.append("error",n.error);let S=yield this.request({path:"/social/oauth2_callback",method:"POST",headers:l,query:i,body:f},o);return new ft(S)})}appleOauth2CallbackDefaultDev(n,o,i,l,m,f){return v(this,null,function*(){yield this.appleOauth2CallbackDefaultDevRaw({state:n,code:o,idToken:i,user:l,error:m},f)})}currentuserSocialLinkAccountRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling currentuserSocialLinkAccount().');if(n.code==null)throw new k("code",'Required parameter "code" was null or undefined when calling currentuserSocialLinkAccount().');if(n.verifier==null)throw new k("verifier",'Required parameter "verifier" was null or undefined when calling currentuserSocialLinkAccount().');let i={};n.code!=null&&(i.code=n.code),n.verifier!=null&&(i.verifier=n.verifier);let l={};if(this.configuration&&this.configuration.accessToken){let f=this.configuration.accessToken,S=yield f("bearerAuth",[]);S&&(l.Authorization=`Bearer ${S}`)}let m=yield this.request({path:"/apps/{app_id}/currentuser/social/link_account".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new ft(m)})}currentuserSocialLinkAccount(n,o,i,l){return v(this,null,function*(){yield this.currentuserSocialLinkAccountRaw({appId:n,code:o,verifier:i},l)})}exchangeSocialIdTokenRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling exchangeSocialIdToken().');if(n.idTokenRequest==null)throw new k("idTokenRequest",'Required parameter "idTokenRequest" was null or undefined when calling exchangeSocialIdToken().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/social/id_token".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Ky(n.idTokenRequest)},o);return new z(m,f=>Ot(f))})}exchangeSocialIdToken(n,o,i){return v(this,null,function*(){return yield(yield this.exchangeSocialIdTokenRaw({appId:n,idTokenRequest:o},i)).value()})}exchangeSocialTokenRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling exchangeSocialToken().');if(n.code==null)throw new k("code",'Required parameter "code" was null or undefined when calling exchangeSocialToken().');if(n.verifier==null)throw new k("verifier",'Required parameter "verifier" was null or undefined when calling exchangeSocialToken().');let i={};n.code!=null&&(i.code=n.code),n.verifier!=null&&(i.verifier=n.verifier);let l={},m=yield this.request({path:"/apps/{app_id}/social/token".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>Ot(f))})}exchangeSocialToken(n,o,i,l){return v(this,null,function*(){return yield(yield this.exchangeSocialTokenRaw({appId:n,code:o,verifier:i},l)).value()})}getAuthorizeRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling getAuthorize().');if(n.redirectUri==null)throw new k("redirectUri",'Required parameter "redirectUri" was null or undefined when calling getAuthorize().');if(n.codeChallenge==null)throw new k("codeChallenge",'Required parameter "codeChallenge" was null or undefined when calling getAuthorize().');if(n.codeChallengeMethod==null)throw new k("codeChallengeMethod",'Required parameter "codeChallengeMethod" was null or undefined when calling getAuthorize().');if(n.connectionType==null)throw new k("connectionType",'Required parameter "connectionType" was null or undefined when calling getAuthorize().');let i={};n.redirectUri!=null&&(i.redirect_uri=n.redirectUri),n.state!=null&&(i.state=n.state),n.codeChallenge!=null&&(i.code_challenge=n.codeChallenge),n.codeChallengeMethod!=null&&(i.code_challenge_method=n.codeChallengeMethod),n.connectionType!=null&&(i.connection_type=n.connectionType);let l={},m=yield this.request({path:"/apps/{app_id}/social/authorize".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new ft(m)})}getAuthorize(n,o,i,l,m,f,S){return v(this,null,function*(){yield this.getAuthorizeRaw({appId:n,redirectUri:o,codeChallenge:i,codeChallengeMethod:l,connectionType:m,state:f},S)})}oauth2CallbackRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling oauth2Callback().');if(n.code==null)throw new k("code",'Required parameter "code" was null or undefined when calling oauth2Callback().');let i={};n.code!=null&&(i.code=n.code),n.state!=null&&(i.state=n.state),n.error!=null&&(i.error=n.error),n.errorDescription!=null&&(i.error_description=n.errorDescription);let l={},m=yield this.request({path:"/apps/{app_id}/social/oauth2_callback".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new ft(m)})}oauth2Callback(n,o,i,l,m,f){return v(this,null,function*(){yield this.oauth2CallbackRaw({appId:n,code:o,state:i,error:l,errorDescription:m},f)})}oauth2CallbackDefaultDevRaw(n,o){return v(this,null,function*(){if(n.code==null)throw new k("code",'Required parameter "code" was null or undefined when calling oauth2CallbackDefaultDev().');let i={};n.code!=null&&(i.code=n.code),n.state!=null&&(i.state=n.state),n.error!=null&&(i.error=n.error),n.errorDescription!=null&&(i.error_description=n.errorDescription);let l={},m=yield this.request({path:"/social/oauth2_callback",method:"GET",headers:l,query:i},o);return new ft(m)})}oauth2CallbackDefaultDev(n,o,i,l,m){return v(this,null,function*(){yield this.oauth2CallbackDefaultDevRaw({code:n,state:o,error:i,errorDescription:l},m)})}},N_=(n=>(n.UserCancelledAuthorize="user_cancelled_authorize",n))(N_||{}),x_=(n=>(n.UserCancelledAuthorize="user_cancelled_authorize",n))(x_||{}),E_=(n=>(n.Apple="apple",n.Github="github",n.Google="google",n.Passage="passage",n))(E_||{}),J_=(n=>(n.InteractionRequired="interaction_required",n.LoginRequired="login_required",n.AccountSelectionRequired="account_selection_required",n.ConsentRequired="consent_required",n.InvalidRequestUri="invalid_request_uri",n.InvalidRequestObject="invalid_request_object",n.RequestNotSupported="request_not_supported",n.RequestUriNotSupported="request_uri_not_supported",n.RegistrationNotSupported="registration_not_supported",n))(J_||{}),U_=(n=>(n.InteractionRequired="interaction_required",n.LoginRequired="login_required",n.AccountSelectionRequired="account_selection_required",n.ConsentRequired="consent_required",n.InvalidRequestUri="invalid_request_uri",n.InvalidRequestObject="invalid_request_object",n.RequestNotSupported="request_not_supported",n.RequestUriNotSupported="request_uri_not_supported",n.RegistrationNotSupported="registration_not_supported",n))(U_||{}),Iu=class extends ht{activateOneTimePasscodeRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling activateOneTimePasscode().');if(n.activateOneTimePasscodeRequest==null)throw new k("activateOneTimePasscodeRequest",'Required parameter "activateOneTimePasscodeRequest" was null or undefined when calling activateOneTimePasscode().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/otp/activate".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Rv(n.activateOneTimePasscodeRequest)},o);return new z(m,f=>Ot(f))})}activateOneTimePasscode(n,o,i){return v(this,null,function*(){return yield(yield this.activateOneTimePasscodeRaw({appId:n,activateOneTimePasscodeRequest:o},i)).value()})}};var Au=class extends ht{registerMagicLinkRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerMagicLink().');if(n.user==null)throw new k("user",'Required parameter "user" was null or undefined when calling registerMagicLink().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/magic-link".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:d_(n.user)},o);return new z(m,f=>p_(f))})}registerMagicLink(n,o,i){return v(this,null,function*(){return yield(yield this.registerMagicLinkRaw({appId:n,user:o},i)).value()})}registerOneTimePasscodeRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerOneTimePasscode().');if(n.registerOneTimePasscodeRequest==null)throw new k("registerOneTimePasscodeRequest",'Required parameter "registerOneTimePasscodeRequest" was null or undefined when calling registerOneTimePasscode().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/otp".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:h_(n.registerOneTimePasscodeRequest)},o);return new z(m,f=>Su(f))})}registerOneTimePasscode(n,o,i){return v(this,null,function*(){return yield(yield this.registerOneTimePasscodeRaw({appId:n,registerOneTimePasscodeRequest:o},i)).value()})}registerWebauthnFinishRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnFinish().');if(n.registerWebAuthnFinishRequest==null)throw new k("registerWebAuthnFinishRequest",'Required parameter "registerWebAuthnFinishRequest" was null or undefined when calling registerWebauthnFinish().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/webauthn/finish".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:g_(n.registerWebAuthnFinishRequest)},o);return new z(m,f=>Ot(f))})}registerWebauthnFinish(n,o,i){return v(this,null,function*(){return yield(yield this.registerWebauthnFinishRaw({appId:n,registerWebAuthnFinishRequest:o},i)).value()})}registerWebauthnFinishWithTransactionRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnFinishWithTransaction().');if(n.registerWebAuthnFinishWithTransactionRequest==null)throw new k("registerWebAuthnFinishWithTransactionRequest",'Required parameter "registerWebAuthnFinishWithTransactionRequest" was null or undefined when calling registerWebauthnFinishWithTransaction().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/transactions/webauthn/finish".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:m_(n.registerWebAuthnFinishWithTransactionRequest)},o);return new z(m,f=>s_(f))})}registerWebauthnFinishWithTransaction(n,o,i){return v(this,null,function*(){return yield(yield this.registerWebauthnFinishWithTransactionRaw({appId:n,registerWebAuthnFinishWithTransactionRequest:o},i)).value()})}registerWebauthnStartRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnStart().');if(n.registerWebAuthnStartRequest==null)throw new k("registerWebAuthnStartRequest",'Required parameter "registerWebAuthnStartRequest" was null or undefined when calling registerWebauthnStart().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/webauthn/start".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:v_(n.registerWebAuthnStartRequest)},o);return new z(m,f=>y_(f))})}registerWebauthnStart(n,o,i){return v(this,null,function*(){return yield(yield this.registerWebauthnStartRaw({appId:n,registerWebAuthnStartRequest:o},i)).value()})}registerWebauthnStartWithTransactionRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnStartWithTransaction().');if(n.registerWebAuthnStartWithTransactionRequest==null)throw new k("registerWebAuthnStartWithTransactionRequest",'Required parameter "registerWebAuthnStartWithTransactionRequest" was null or undefined when calling registerWebauthnStartWithTransaction().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/register/transactions/webauthn/start".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:w_(n.registerWebAuthnStartWithTransactionRequest)},o);return new z(m,f=>R_(f))})}registerWebauthnStartWithTransaction(n,o,i){return v(this,null,function*(){return yield(yield this.registerWebauthnStartWithTransactionRaw({appId:n,registerWebAuthnStartWithTransactionRequest:o},i)).value()})}},Pu=class extends ht{refreshAuthTokenRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling refreshAuthToken().');if(n.refreshAuthTokenRequest==null)throw new k("refreshAuthTokenRequest",'Required parameter "refreshAuthTokenRequest" was null or undefined when calling refreshAuthToken().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/tokens".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:l_(n.refreshAuthTokenRequest)},o);return new z(m,f=>Ot(f))})}refreshAuthToken(n,o,i){return v(this,null,function*(){return yield(yield this.refreshAuthTokenRaw({appId:n,refreshAuthTokenRequest:o},i)).value()})}revokeRefreshTokenRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling revokeRefreshToken().');if(n.refreshToken==null)throw new k("refreshToken",'Required parameter "refreshToken" was null or undefined when calling revokeRefreshToken().');let i={};n.refreshToken!=null&&(i.refresh_token=n.refreshToken);let l={},m=yield this.request({path:"/apps/{app_id}/tokens".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"DELETE",headers:l,query:i},o);return new ft(m)})}revokeRefreshToken(n,o,i){return v(this,null,function*(){yield this.revokeRefreshTokenRaw({appId:n,refreshToken:o},i)})}},qu=class extends ht{checkUserIdentifierRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling checkUserIdentifier().');if(n.identifier==null)throw new k("identifier",'Required parameter "identifier" was null or undefined when calling checkUserIdentifier().');let i={};n.identifier!=null&&(i.identifier=n.identifier);let l={},m=yield this.request({path:"/apps/{app_id}/users".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"GET",headers:l,query:i},o);return new z(m,f=>pu(f))})}checkUserIdentifier(n,o,i){return v(this,null,function*(){return yield(yield this.checkUserIdentifierRaw({appId:n,identifier:o},i)).value()})}createUserRaw(n,o){return v(this,null,function*(){if(n.appId==null)throw new k("appId",'Required parameter "appId" was null or undefined when calling createUser().');if(n.createUserParams==null)throw new k("createUserParams",'Required parameter "createUserParams" was null or undefined when calling createUser().');let i={},l={};l["Content-Type"]="application/json";let m=yield this.request({path:"/apps/{app_id}/users".replace("{app_id}",encodeURIComponent(String(n.appId))),method:"POST",headers:l,query:i,body:Cy(n.createUserParams)},o);return new z(m,f=>pu(f))})}createUser(n,o,i){return v(this,null,function*(){return yield(yield this.createUserRaw({appId:n,createUserParams:o},i)).value()})}},Fu=(n,o,i)=>{let{appId:l,basePath:m,authToken:f,additionalHeaders:S}=o,W={basePath:m,accessToken:f,headers:S},L=new mu(W),K=new n(L),{handlers:Y}=fv(i!=null?i:{},l),ae=(oe,H,D={})=>Z(oe,Fe({requiresAppId:!0},H),D),xe=(oe,H,D={})=>Z(oe,Fe({requiresAppId:!1},H),D),Z=(oe,H,D={})=>{let{onStart:Q,onBeforeRequest:Pt,onResponseSuccess:he,onError:Ke,onFinish:Ee}=Y(),{onStart:gt=Q,onBeforeRequest:Ge=Pt,onResponseSuccess:qt=he,onError:cn=Ke,onFinish:Gr=Ee}=D!=null?D:{};return uv(K,oe,{onStart:gt,onBeforeRequest:Ge,onResponseSuccess:qt,onError:cn,onFinish:Gr},H)};return{service:K,wrapPassageAPIEndpoint:Z,wrapPassageApplicationEndpoint:ae,wrapPassageNonApplicationEndpoint:xe}};var Bt=class{setPsgCredID(o,i){if(!i)throw new se("Could not get user's credential",{status:ue.PSGCouldNotGetUserCredential,statusText:"PSG Could Not Get User Credential"});let l=this.getPsgCredObj();if(l){let m=JSON.parse(l);m[o]=i==null?void 0:i.id,this.setPsgCredObj(JSON.stringify(m))}else this.setPsgCredObj(JSON.stringify({[o]:i==null?void 0:i.id}))}removeCredential(o){let i=this.getPsgCredObj();if(i===void 0)return;let l=JSON.parse(i);Object.keys(l).forEach(m=>{l[m]===o&&delete l[m]}),this.setPsgCredObj(JSON.stringify(l))}getPsgCredObj(){let o=localStorage.getItem("psg_cred_obj");if(o!==null)return o}setPsgCredObj(o){localStorage.setItem("psg_cred_obj",o)}};var Wr=class{getRefreshToken(){return Promise.resolve(void 0)}},En=class extends Wr{clearTokens(){return Promise.resolve()}};function sn(n){return n.setTokens!==void 0}var Jn=class extends En{getAuthToken(){return v(this,null,function*(){this._checkLocalStorage();let o=localStorage.getItem("psg_auth_token");return o===null?"":o})}getRefreshToken(){return v(this,null,function*(){this._checkLocalStorage();let o=localStorage.getItem("psg_refresh_token");if(o!==null)return o})}setTokens(o){return v(this,null,function*(){this._checkLocalStorage(),this._setAuthToken(o.authToken),o.refreshToken&&this._setRefreshToken(o.refreshToken)})}clearTokens(){return v(this,null,function*(){this._checkLocalStorage(),localStorage.removeItem("psg_auth_token"),document.cookie="psg_auth_token=; expires=Thu, 01 Jan 1970 00:00:00 UTC;",localStorage.removeItem("psg_refresh_token")})}_setAuthToken(o){return v(this,null,function*(){this._checkLocalStorage(),localStorage.setItem("psg_auth_token",o);let i=!this._isHttps()&&this._isLocalHost();document.cookie=`psg_auth_token = ${o}; path=/ ${i?"":";secure"}`})}_setRefreshToken(o){return v(this,null,function*(){this._checkLocalStorage(),localStorage.setItem("psg_refresh_token",o)})}_isLocalHost(){return!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))}_isHttps(){return location.protocol==="https:"}_checkLocalStorage(){if(typeof window=="undefined")throw new se("Not run in browser context.",{status:ue.PSGMustRunInBrowserContext,statusText:"Failed to access localStorage or cookies. Must be run in a browser."})}};var Dr=class{constructor(o,i,l){this.instanceConfig=o;let{appId:m,basePath:f,additionalHeaders:S}=o,W={appId:m,basePath:f,additionalHeaders:S,authToken:l},{wrapPassageApplicationEndpoint:L,service:K}=Fu(i,W);this.wrapPassageApplicationEndpoint=L,this.service=K}storeTokens(o){return v(this,null,function*(){let{tokenStore:i}=this.instanceConfig;sn(i)&&i.setTokens(o)})}},fe=class extends Dr{constructor(o,i){super(o,i)}},jr=class extends Dr{constructor(o,i,l){super(o,i,l)}};var xu=require("@passageidentity/webauthnutils");var Nu=new Bt,Un=class extends jr{constructor(o,i){let l=()=>v(this,null,function*(){return yield i.getAuthToken()});super(o,Cu,l)}userInfo(){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.getCurrentuser,{responseDataKey:"user"})()})}changeEmail(o,i){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.updateEmailCurrentuser,{responseDataKey:"magicLink"})({newEmail:o,language:i})})}changePhone(o,i){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.updatePhoneCurrentuser,{responseDataKey:"magicLink"})({newPhone:o,language:i})})}passkeys(){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.getCurrentuserDevices,{responseDataKey:"devices"})()})}editPasskey(o,i){return v(this,null,function*(){if(o==="")throw new se("A passkey ID is required for an edit device request.",{status:ue.BadRequest,statusText:"Bad Request"});return yield this.wrapPassageApplicationEndpoint(this.service.updateCurrentuserDevice,{responseDataKey:"device"})(o,{friendlyName:i})})}addPasskey(o){return v(this,null,function*(){var ae,xe;let l=yield this.wrapPassageApplicationEndpoint(this.service.postCurrentuserAddDeviceStart,{})({authenticatorAttachment:(ae=o==null?void 0:o.authenticatorAttachment)!=null?ae:xn.Platform}),m=l.handshake.challenge.publicKey,{credential:f,transports:S}=yield xu.CreateCredentialUtils.createCredential(m).catch(Z=>{throw new se("Error creating credential",{status:ue.PSGParsePublicKeyForNewDeviceFailed,statusText:Z.message})}),W=(xe=l.user)==null?void 0:xe.id,L=new Uint8Array(f==null?void 0:f.response.attestationObject),Y=yield this.wrapPassageApplicationEndpoint(this.service.postCurrentuserAddDeviceFinish,{responseDataKey:"device"})({userId:W,handshakeId:l.handshake.id,handshakeResponse:{rawId:Re.encodeBytes(f==null?void 0:f.rawId),id:f==null?void 0:f.id,type:f==null?void 0:f.type,response:{attestationObject:Re.encodeBytes(L),clientDataJSON:Re.encodeBytes(f==null?void 0:f.response.clientDataJSON)},transports:S}});return Nu.setPsgCredID(W,f),Y})}deletePasskey(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.deleteCurrentuserDevice,{})(o.id),Nu.removeCredential(o.credId),!0})}listSocialConnections(){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.getCurrentuserSocialConnections,{responseDataKey:"socialConnections"})()})}deleteSocialConnection(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.deleteCurrentuserSocialConnection,{})(o),!0})}metadata(){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.getCurrentuserMetadata,{responseDataKey:"userMetadata"})()})}updateMetadata(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.updateCurrentuserMetadata,{responseDataKey:"user"})({userMetadata:o})})}};var Br=Hm(require("jwt-decode"),1),Eu=require("async-mutex");var Mn=class extends fe{constructor(o){super(o,Pu),this.tokenStore=o.tokenStore}authGuard(){return v(this,null,function*(){try{let o=yield this.tokenStore.getAuthToken(),i=(0,Br.default)(o,{header:!0}),l=(0,Br.default)(o);return!!(l!==void 0&&i!==void 0&&this._validJWTPayload(l)&&this._validJWTHeader(i))}catch(o){return!1}})}signOut(){return v(this,null,function*(){let o=yield this.tokenStore.getRefreshToken();return o?(yield this.wrapPassageApplicationEndpoint(this.service.revokeRefreshToken,{})(o),sn(this.tokenStore)&&this.tokenStore.clearTokens(),!0):(sn(this.tokenStore)&&this.tokenStore.clearTokens(),!0)})}getAuthToken(){return v(this,null,function*(){let o=yield this._getMutex("getAuthToken").acquire(),i=yield this.tokenStore.getAuthToken();if((yield this.tokenStore.getRefreshToken())===void 0){if(!i)throw o(),new se("Login required",{status:ue.PSGLoginRequired,statusText:"Login required"});return o(),i}if(i){let m=(0,Br.default)(i);if(m!==void 0&&this._validJWTPayload(m))return o(),Promise.resolve(i)}return this.refresh().then(m=>m.authToken).finally(()=>{o()})})}refresh(){return v(this,null,function*(){let o=yield this._getMutex("refresh").acquire(),i=new se("Login required",{status:ue.PSGLoginRequired,statusText:"Login required"}),l=yield this.tokenStore.getRefreshToken();if(!l)return o(),Promise.reject(i);let f=yield this.wrapPassageApplicationEndpoint(this.service.refreshAuthToken,{responseDataKey:"authResult"})({refreshToken:l});return yield this.storeTokens(f),o(),f})}_validJWTPayload(o){let i=["exp","iss","sub"],l=Math.floor(Date.now()/1e3);return i.forEach(m=>{if(!(m in o))return!1}),!(o.exp&&l>o.exp)}_validJWTHeader(o){let i={alg:"RS256",typ:"JWT"};return!(o.alg!==i.alg||o.typ!==i.typ)}_getMutex(o){let i=globalThis;return(i.__PASSAGE__===void 0||i.__PASSAGE__.mutexes===void 0)&&(i.__PASSAGE__={mutexes:{}}),i.__PASSAGE__.mutexes[o]===void 0&&(i.__PASSAGE__.mutexes[o]=new Eu.Mutex),i.__PASSAGE__.mutexes[o]}};var Ju={URL:"https://auth.passage.id",version:"@passageidentity/passage-js 4.0.3",CAPTURE_EVENT_URL:"https://us-central1-passage-prod.cloudfunctions.net/capture-event",SENTRY_RELEASE:"passage-js@4.0.3-prod",SENTRY_PROJECT:"passage-js",SENTRY_PROJECT_DSN:"",SENTRY_PROJECT_ENV:"prod",SENTRY_PROJECT_VERSION:"4.0.3"};var Ne=Ju;var Ln=class extends fe{constructor(o){super(o,Ou),this.apiUrl=`${o.basePath}/apps/${o.appId}/social`}authorize(o){return v(this,null,function*(){if(!window.isSecureContext)throw new se("Passage Social Login requires a secure context (HTTPS or localhost)",{status:ue.PSGSecureContextRequired,statusText:"Secure context required"});sessionStorage.setItem("oauth2Connection",o);let i=yield this._getQueryParams(o);window.location.href=`${this.apiUrl}/authorize?${i}`})}finish(o){return v(this,null,function*(){let i=sessionStorage.getItem("oauth2Verifier");if(i===null||i===""||i===" ")throw new se("Social login verifier not found",{status:ue.PSGSocialSessionStorageError,statusText:"Social login verifier not found"});let m=yield this.wrapPassageApplicationEndpoint(this.service.exchangeSocialToken,{responseDataKey:"authResult"})(o,i);return yield this.storeTokens(m),m})}_getQueryParams(o){return v(this,null,function*(){let i=window.location.href,l=this._getRandomString(32);sessionStorage.setItem("oauth2State",l);let m=yield this._getCodeChallenge(),S={redirect_uri:i,state:l,code_challenge:m,code_challenge_method:"S256",connection_type:o};return new URLSearchParams(S).toString()})}_getCodeChallenge(){return v(this,null,function*(){let o=this._getRandomString(32);return sessionStorage.setItem("oauth2Verifier",o),yield this._sha256Hash(o)})}_getRandomString(o){return window.crypto.getRandomValues(new Uint8Array(o)).toString().replace(/,/g,"")}_sha256Hash(o){return v(this,null,function*(){let l=new TextEncoder().encode(o),m=yield window.crypto.subtle.digest("SHA-256",l);return Re.encodeBytes(m)})}};var Uu=(l=>(l.Apple="apple",l.Github="github",l.Google="google",l))(Uu||{});var It=class extends fe{constructor(o){super(o,ku)}webAuthnStart(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.loginWebauthnStart,{})(o)})}webAuthnFinish(o){return v(this,null,function*(){let l=yield this.wrapPassageApplicationEndpoint(this.service.loginWebauthnFinish,{responseDataKey:"authResult"})(o);return yield this.storeTokens(l),l})}magicLink(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.loginMagicLink,{responseDataKey:"magicLink"})(o)})}otp(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.loginOneTimePasscode,{})(o)})}};var At=class extends fe{constructor(o){super(o,Au)}webAuthnStart(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.registerWebauthnStart,{})(o)})}webAuthnFinish(o){return v(this,null,function*(){let l=yield this.wrapPassageApplicationEndpoint(this.service.registerWebauthnFinish,{responseDataKey:"authResult"})(o);return yield this.storeTokens(l),l})}magicLink(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.registerMagicLink,{responseDataKey:"magicLink"})(o)})}otp(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.registerOneTimePasscode,{})(o)})}};var Wn=class extends fe{constructor(o){super(o,Iu),this.registerInternal=new At(o),this.loginInternal=new It(o)}register(o,i){return this.registerInternal.otp({identifier:o,language:i})}login(o,i){return this.loginInternal.otp({identifier:o,language:i})}activate(o,i){return v(this,null,function*(){let l=yield this.wrapPassageApplicationEndpoint(this.service.activateOneTimePasscode,{responseDataKey:"authResult"})({otp:o,otpId:i});return yield this.storeTokens(l),l})}};var Kr=class extends fe{constructor(o){super(o,qu)}userExists(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.checkUserIdentifier,{responseDataKey:"user"})(o)})}createUser(o){return v(this,null,function*(){return yield this.wrapPassageApplicationEndpoint(this.service.createUser,{responseDataKey:"user"})(o)})}};var Dn=class extends fe{constructor(i){super(i,bu);this.cachedAppInfo=void 0;this.userInternal=new Kr(i)}info(){return v(this,null,function*(){if(this.cachedAppInfo)return this.cachedAppInfo;let i=this.wrapPassageApplicationEndpoint(this.service.getApp,{responseDataKey:"app"});return this.cachedAppInfo=yield i(),this.cachedAppInfo})}userExists(i){return v(this,null,function*(){return this.userInternal.userExists(i)})}createUser(i,l){return v(this,null,function*(){return this.userInternal.createUser({identifier:i,userMetadata:l})})}};var Mu=(l=>(l.email="email",l.phone="phone",l.both="both",l))(Mu||{}),Lu=(S=>(S.STRING="string",S.BOOLEAN="boolean",S.INTEGER="integer",S.DATE="date",S.PHONE="phone",S.EMAIL="email",S))(Lu||{}),Wu=(m=>(m.Phone="phone",m.Email="email",m.Both="both",m.Either="either",m))(Wu||{});var un=require("@passageidentity/webauthnutils");var jn=class{constructor(o,i){this.app=i;this.psgCredObjHelper=new Bt;this.registerInternal=new At(o),this.loginInternal=new It(o)}register(o,i){return v(this,null,function*(){var Y;let l=yield this.registerInternal.webAuthnStart({identifier:o,authenticatorAttachment:i==null?void 0:i.authenticatorAttachment}),m=l.handshake.challenge.publicKey,{credential:f,transports:S}=yield un.CreateCredentialUtils.createCredential(m).catch(ae=>{throw new se("Error creating creadential",{status:ue.PSGParsePublicKeyForRegistrationFailed,statusText:ae.message})}),W=new Uint8Array(f==null?void 0:f.response.attestationObject),L=(Y=l.user)==null?void 0:Y.id,K=yield this.registerInternal.webAuthnFinish({userId:L,handshakeId:l.handshake.id,handshakeResponse:{rawId:Re.encodeBytes(f==null?void 0:f.rawId),id:f==null?void 0:f.id,type:f==null?void 0:f.type,response:{attestationObject:Re.encodeBytes(W),clientDataJSON:Re.encodeBytes(f==null?void 0:f.response.clientDataJSON)},transports:S}});return yield this.psgCredObjHelper.setPsgCredID(L,f),K})}login(o,i){return v(this,null,function*(){var W;let l=yield this.loginInternal.webAuthnStart({identifier:o}),m=l.handshake.challenge.publicKey,f={mediation:i!=null&&i.isConditionalMediation?"conditional":void 0,signal:i==null?void 0:i.abortSignal},S=yield un.GetCredentialUtils.getCredential(m,f).catch(L=>{throw new se("Error getting credential",{status:ue.PSGParsePublicKeyForLoginFailed,statusText:L.message})});if(!S)throw new se("Error getting credential: no assertion found",{status:ue.PSGParsePublicKeyForLoginFailed,statusText:"No assertion returned"});return yield this.loginInternal.webAuthnFinish({userId:o!=null?(W=l.user)==null?void 0:W.id:void 0,handshakeId:l.handshake.id,handshakeResponse:{id:S.id,rawId:Re.encodeBytes(S.rawId),type:S.type,response:{clientDataJSON:Re.encodeBytes(S.response.clientDataJSON),authenticatorData:Re.encodeBytes(S.response.authenticatorData),signature:Re.encodeBytes(S.response.signature),userHandle:Re.encodeBytes(S.response.userHandle)}}})})}getCredentialAvailable(){return v(this,null,function*(){return yield un.GetCredentialUtils.getCredentialAvailable()})}createCredentialAvailable(){return v(this,null,function*(){return yield un.CreateCredentialUtils.createCredentialAvailable()})}hasLocalPasskey(o){let i=new Bt().getPsgCredObj();return i?!!JSON.parse(i)[o]:!1}checkPasskeyOrigin(){return v(this,null,function*(){let o=!0;return(yield this.app.info()).authOrigin.replace(/\/$/,"")!=window.location.origin.replace(/\/$/,"")&&(console.error('The auth_origin configured for webauthn in your app settings does not match the "origin" of your current URL. Please reconfigure this in the admin console. (Your current "origin" is `'+window.location.origin+"`) Passage will continue to work with other authentication methods."),o=!1),o})}};var Bn=class extends fe{constructor(o){super(o,Tu),this.registerInternal=new At(o),this.loginInternal=new It(o)}register(o,i){return v(this,null,function*(){let l=this.getMagicLinkPath();return yield this.registerInternal.magicLink({identifier:o,language:i,magicLinkPath:l})})}login(o,i){return v(this,null,function*(){let l=this.getMagicLinkPath();return yield this.loginInternal.magicLink({identifier:o,language:i,magicLinkPath:l})})}activate(o){return v(this,null,function*(){let l=yield this.wrapPassageApplicationEndpoint(this.service.activateMagicLink,{responseDataKey:"authResult"})({magicLink:o});return yield this.storeTokens(l),l})}status(o){return v(this,null,function*(){let l=yield this.wrapPassageApplicationEndpoint(this.service.magicLinkStatus,{responseDataKey:"authResult"})({id:o});return yield this.storeTokens(l),l})}getMagicLinkPath(){return window.location.pathname+window.location.search+window.location.hash}};function Du(n){let o=Ne.version,i=Ne.EXTRA_HEADERS;return jt(Fe(Fe({},n),i),{"Passage-Version":o!=null?o:""})}var Ra=class{constructor(o,i){this.appID=o;let l="v1";(i==null?void 0:i.tokenStore)===void 0?this.tokenStore=new Jn:this.tokenStore=i.tokenStore,this.extraHeaders=i==null?void 0:i.extraHeaders,Ne.EXTRA_HEADERS=this.extraHeaders;let m=`${Ne.URL}/${l}`,f=Du(),S={appId:this.appID,tokenStore:this.tokenStore,basePath:m,additionalHeaders:f};this.app=new Dn(S),this.passkey=new jn(S,this.app),this.magicLink=new Bn(S),this.oneTimePasscode=new Wn(S),this.social=new Ln(S),this.session=new Mn(S),this.currentUser=new Un(S,this.session)}};var ju=require("serialize-error");var Bu=n=>JSON.parse(JSON.stringify(n,(o,i)=>{if(!(i==null||i==="undefined"))return i})),M_=n=>v(void 0,null,function*(){try{let{error:o,message:i,sentryConfig:{url:l=Ne.CAPTURE_EVENT_URL,project:m=Ne.SENTRY_PROJECT,dsn:f=Ne.SENTRY_PROJECT_DSN,environment:S=Ne.SENTRY_PROJECT_ENV,release:W=Ne.SENTRY_RELEASE,version:L=Ne.SENTRY_PROJECT_VERSION}={}}=n,K=Bu({project:m,dsn:f,environment:S,url:l,release:W,version:L});if(!(K.project&&K.url)||!(o||i))return;let Y={project:K.project,dsn:K.dsn,environment:K.environment,release:K.release,version:K.version};i&&(Y=jt(Fe({},Y),{message:i})),o&&(Y=jt(Fe({},Y),{serializedError:(0,ju.serializeError)(typeof o=="string"?new Error(o):o)})),yield fetch(K.url,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",body:JSON.stringify(Y)})}catch(o){console.error(o)}});0&&(module.exports={AppAuthFallbackMethodEnum,AuthenticatorAttachment,Identifier,Passage,PassageApp,PassageCurrentUser,PassageError,PassageErrorCode,PassageMagicLink,PassageOneTimePasscode,PassagePasskey,PassageSession,PassageSocial,PassageTokenStore,ReadOnlyTokenStore,RequiredIdentifier,SocialConnection,TokenStore,TtlDisplayUnit,UserMetadataType,UserStatus,WebAuthnType,captureEvent,cleanSentryConfig,isFullTokenStore}); /*! Bundled license information: lodash/lodash.js: (** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) */ //#