"use strict";var Ui=Object.defineProperty;var Lg=Object.getOwnPropertyDescriptor;var Dg=Object.getOwnPropertyNames;var jg=Object.prototype.hasOwnProperty;var Bg=(r,d)=>{for(var u in d)Ui(r,u,{get:d[u],enumerable:!0})},Kg=(r,d,u,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let R of Dg(d))!jg.call(r,R)&&R!==u&&Ui(r,R,{get:()=>d[R],enumerable:!(m=Lg(d,R))||m.enumerable});return r};var zg=r=>Kg(Ui({},"__esModule",{value:!0}),r);var U_={};Bg(U_,{PassageFlex:()=>Li});module.exports=zg(U_);var Eu=require("@passageidentity/webauthnutils");var Gg=Object.create,Ru=Object.defineProperty,Vg=Object.getOwnPropertyDescriptor,$g=Object.getOwnPropertyNames,Hg=Object.getPrototypeOf,Zg=Object.prototype.hasOwnProperty,Yg=(r,d)=>()=>(d||r((d={exports:{}}).exports,d),d.exports),Xg=(r,d,u,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let R of $g(d))!Zg.call(r,R)&&R!==u&&Ru(r,R,{get:()=>d[R],enumerable:!(m=Vg(d,R))||m.enumerable});return r},Su=(r,d,u)=>(u=r!=null?Gg(Hg(r)):{},Xg(d||!r||!r.__esModule?Ru(u,"default",{value:r,enumerable:!0}):u,r)),bu=Yg((r,d)=>{"use strict";(function(){var u,m="4.17.21",R=200,O="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",P="Expected a function",te="Invalid `variable` option passed into `_.template`",ne="__lodash_hash_undefined__",Oe=500,ue="__lodash_placeholder__",ce=1,Ze=2,V=4,X=1,D=2,U=1,z=2,wt=4,ae=8,Ee=16,Te=32,ut=64,Ue=128,Rt=256,$t=512,vr=30,zu="...",Gu=800,Vu=16,Di=1,$u=2,Hu=3,St=1/0,st=9007199254740991,Zu=17976931348623157e292,Rn=NaN,ze=4294967295,Yu=ze-1,Xu=ze>>>1,Qu=[["ary",Ue],["bind",U],["bindKey",z],["curry",ae],["curryRight",Ee],["flip",$t],["partial",Te],["partialRight",ut],["rearg",Rt]],Pt="[object Arguments]",Sn="[object Array]",es="[object AsyncFunction]",Ht="[object Boolean]",Zt="[object Date]",ts="[object DOMException]",bn="[object Error]",Cn="[object Function]",ji="[object GeneratorFunction]",Me="[object Map]",Yt="[object Number]",ns="[object Null]",Ye="[object Object]",Bi="[object Promise]",rs="[object Proxy]",Xt="[object RegExp]",Le="[object Set]",Qt="[object String]",On="[object Symbol]",is="[object Undefined]",en="[object WeakMap]",as="[object WeakSet]",tn="[object ArrayBuffer]",Nt="[object DataView]",_r="[object Float32Array]",yr="[object Float64Array]",mr="[object Int8Array]",wr="[object Int16Array]",Rr="[object Int32Array]",Sr="[object Uint8Array]",br="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Or="[object Uint32Array]",os=/\b__p \+= '';/g,us=/\b(__p \+=) '' \+/g,ss=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ki=/&(?:amp|lt|gt|quot|#39);/g,zi=/[&<>"']/g,ls=RegExp(Ki.source),cs=RegExp(zi.source),ds=/<%-([\s\S]+?)%>/g,ps=/<%([\s\S]+?)%>/g,Gi=/<%=([\s\S]+?)%>/g,fs=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hs=/^\w*$/,gs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tr=/[\\^$.*+?()[\]{}|]/g,vs=RegExp(Tr.source),kr=/^\s+/,_s=/\s/,ys=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ms=/\{\n\/\* \[wrapped with (.+)\] \*/,ws=/,? & /,Rs=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ss=/[()=,{}\[\]\/\s]/,bs=/\\(\\)?/g,Cs=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Vi=/\w*$/,Os=/^[-+]0x[0-9a-f]+$/i,Ts=/^0b[01]+$/i,ks=/^\[object .+?Constructor\]$/,Is=/^0o[0-7]+$/i,As=/^(?:0|[1-9]\d*)$/,qs=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tn=/($^)/,Fs=/['\n\r\u2028\u2029\\]/g,kn="\\ud800-\\udfff",Ps="\\u0300-\\u036f",Ns="\\ufe20-\\ufe2f",Js="\\u20d0-\\u20ff",$i=Ps+Ns+Js,Hi="\\u2700-\\u27bf",Zi="a-z\\xdf-\\xf6\\xf8-\\xff",Ws="\\xac\\xb1\\xd7\\xf7",xs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Es="\\u2000-\\u206f",Us=" \\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",Yi="A-Z\\xc0-\\xd6\\xd8-\\xde",Xi="\\ufe0e\\ufe0f",Qi=Ws+xs+Es+Us,Ir="['\u2019]",Ms="["+kn+"]",ea="["+Qi+"]",In="["+$i+"]",ta="\\d+",Ls="["+Hi+"]",na="["+Zi+"]",ra="[^"+kn+Qi+ta+Hi+Zi+Yi+"]",Ar="\\ud83c[\\udffb-\\udfff]",Ds="(?:"+In+"|"+Ar+")",ia="[^"+kn+"]",qr="(?:\\ud83c[\\udde6-\\uddff]){2}",Fr="[\\ud800-\\udbff][\\udc00-\\udfff]",Jt="["+Yi+"]",aa="\\u200d",oa="(?:"+na+"|"+ra+")",js="(?:"+Jt+"|"+ra+")",ua="(?:"+Ir+"(?:d|ll|m|re|s|t|ve))?",sa="(?:"+Ir+"(?:D|LL|M|RE|S|T|VE))?",la=Ds+"?",ca="["+Xi+"]?",Bs="(?:"+aa+"(?:"+[ia,qr,Fr].join("|")+")"+ca+la+")*",Ks="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zs="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",da=ca+la+Bs,Gs="(?:"+[Ls,qr,Fr].join("|")+")"+da,Vs="(?:"+[ia+In+"?",In,qr,Fr,Ms].join("|")+")",$s=RegExp(Ir,"g"),Hs=RegExp(In,"g"),Pr=RegExp(Ar+"(?="+Ar+")|"+Vs+da,"g"),Zs=RegExp([Jt+"?"+na+"+"+ua+"(?="+[ea,Jt,"$"].join("|")+")",js+"+"+sa+"(?="+[ea,Jt+oa,"$"].join("|")+")",Jt+"?"+oa+"+"+ua,Jt+"+"+sa,zs,Ks,ta,Gs].join("|"),"g"),Ys=RegExp("["+aa+kn+$i+Xi+"]"),Xs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qs=["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"],el=-1,K={};K[_r]=K[yr]=K[mr]=K[wr]=K[Rr]=K[Sr]=K[br]=K[Cr]=K[Or]=!0,K[Pt]=K[Sn]=K[tn]=K[Ht]=K[Nt]=K[Zt]=K[bn]=K[Cn]=K[Me]=K[Yt]=K[Ye]=K[Xt]=K[Le]=K[Qt]=K[en]=!1;var B={};B[Pt]=B[Sn]=B[tn]=B[Nt]=B[Ht]=B[Zt]=B[_r]=B[yr]=B[mr]=B[wr]=B[Rr]=B[Me]=B[Yt]=B[Ye]=B[Xt]=B[Le]=B[Qt]=B[On]=B[Sr]=B[br]=B[Cr]=B[Or]=!0,B[bn]=B[Cn]=B[en]=!1;var tl={\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"},nl={"&":"&","<":"<",">":">",'"':""","'":"'"},rl={"&":"&","<":"<",">":">",""":'"',"'":"'"},il={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},al=parseFloat,ol=parseInt,pa=typeof global=="object"&&global&&global.Object===Object&&global,ul=typeof self=="object"&&self&&self.Object===Object&&self,re=pa||ul||Function("return this")(),Nr=typeof r=="object"&&r&&!r.nodeType&&r,bt=Nr&&typeof d=="object"&&d&&!d.nodeType&&d,fa=bt&&bt.exports===Nr,Jr=fa&&pa.process,ke=function(){try{var p=bt&&bt.require&&bt.require("util").types;return p||Jr&&Jr.binding&&Jr.binding("util")}catch{}}(),ha=ke&&ke.isArrayBuffer,ga=ke&&ke.isDate,va=ke&&ke.isMap,_a=ke&&ke.isRegExp,ya=ke&&ke.isSet,ma=ke&&ke.isTypedArray;function me(p,g,h){switch(h.length){case 0:return p.call(g);case 1:return p.call(g,h[0]);case 2:return p.call(g,h[0],h[1]);case 3:return p.call(g,h[0],h[1],h[2])}return p.apply(g,h)}function sl(p,g,h,S){for(var I=-1,E=p==null?0:p.length;++I-1}function Wr(p,g,h){for(var S=-1,I=p==null?0:p.length;++S-1;);return h}function ka(p,g){for(var h=p.length;h--&&Wt(g,p[h],0)>-1;);return h}function _l(p,g){for(var h=p.length,S=0;h--;)p[h]===g&&++S;return S}var yl=Mr(tl),ml=Mr(nl);function wl(p){return"\\"+il[p]}function Rl(p,g){return p==null?u:p[g]}function xt(p){return Ys.test(p)}function Sl(p){return Xs.test(p)}function bl(p){for(var g,h=[];!(g=p.next()).done;)h.push(g.value);return h}function Br(p){var g=-1,h=Array(p.size);return p.forEach(function(S,I){h[++g]=[I,S]}),h}function Ia(p,g){return function(h){return p(g(h))}}function dt(p,g){for(var h=-1,S=p.length,I=0,E=[];++h-1}function cc(e,t){var n=this.__data__,i=Gn(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}Xe.prototype.clear=oc,Xe.prototype.delete=uc,Xe.prototype.get=sc,Xe.prototype.has=lc,Xe.prototype.set=cc;function Qe(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t=t?e:t)),e}function Fe(e,t,n,i,a,s){var l,c=t&ce,f=t&Ze,v=t&V;if(n&&(l=a?n(e,i,a,s):n(e)),l!==u)return l;if(!$(e))return e;var _=A(e);if(_){if(l=hd(e),!c)return ge(e,l)}else{var y=le(e),w=y==Cn||y==ji;if(yt(e))return co(e,c);if(y==Ye||y==Pt||w&&!a){if(l=f||w?{}:qo(e),!c)return f?rd(e,Tc(l,e)):nd(e,La(l,e))}else{if(!B[y])return a?e:{};l=gd(e,y,c)}}s||(s=new je);var b=s.get(e);if(b)return b;s.set(e,l),au(e)?e.forEach(function(k){l.add(Fe(k,t,n,k,e,s))}):ru(e)&&e.forEach(function(k,J){l.set(J,Fe(k,t,n,J,e,s))});var T=v?f?gi:hi:f?_e:ie,F=_?u:T(e);return Ie(F||e,function(k,J){F&&(J=k,k=e[J]),ln(l,J,Fe(k,t,n,J,e,s))}),l}function kc(e){var t=ie(e);return function(n){return Da(n,e,t)}}function Da(e,t,n){var i=n.length;if(e==null)return!i;for(e=j(e);i--;){var a=n[i],s=t[a],l=e[a];if(l===u&&!(a in e)||!s(l))return!1}return!0}function ja(e,t,n){if(typeof e!="function")throw new Ae(P);return vn(function(){e.apply(u,n)},t)}function cn(e,t,n,i){var a=-1,s=An,l=!0,c=e.length,f=[],v=t.length;if(!c)return f;n&&(t=G(t,we(n))),i?(s=Wr,l=!1):t.length>=R&&(s=nn,l=!1,t=new Tt(t));e:for(;++aa?0:a+n),i=i===u||i>a?a:q(i),i<0&&(i+=a),i=n>i?0:uu(i);n0&&n(c)?t>1?oe(c,t-1,n,i,a):ct(a,c):i||(a[a.length]=c)}return a}var Zr=_o(),za=_o(!0);function Ge(e,t){return e&&Zr(e,t,ie)}function Yr(e,t){return e&&za(e,t,ie)}function $n(e,t){return lt(t,function(n){return it(e[n])})}function It(e,t){t=vt(t,e);for(var n=0,i=t.length;e!=null&&nt}function qc(e,t){return e!=null&&L.call(e,t)}function Fc(e,t){return e!=null&&t in j(e)}function Pc(e,t,n){return e>=se(t,n)&&e=120&&_.length>=120)?new Tt(l&&_):u}_=e[0];var y=-1,w=c[0];e:for(;++y-1;)c!==e&&Mn.call(c,f,1),Mn.call(e,f,1);return e}function no(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==s){var s=a;rt(a)?Mn.call(e,a,1):ui(e,a)}}return e}function ii(e,t){return e+jn(xa()*(t-e+1))}function zc(e,t,n,i){for(var a=-1,s=ee(Dn((t-e)/(n||1)),0),l=h(s);s--;)l[i?s:++a]=e,e+=n;return l}function ai(e,t){var n="";if(!e||t<1||t>st)return n;do t%2&&(n+=e),t=jn(t/2),t&&(e+=e);while(t);return n}function N(e,t){return Si(No(e,t,ye),e+"")}function Gc(e){return Ma(Gt(e))}function Vc(e,t){var n=Gt(e);return ar(n,kt(t,0,n.length))}function fn(e,t,n,i){if(!$(e))return e;t=vt(t,e);for(var a=-1,s=t.length,l=s-1,c=e;c!=null&&++aa?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var s=h(a);++i>>1,l=e[s];l!==null&&!Se(l)&&(n?l<=t:l=R){var v=t?null:ud(e);if(v)return Fn(v);l=!1,a=nn,f=new Tt}else f=t?[]:c;e:for(;++i=i?e:Pe(e,t,n)}var lo=Ul||function(e){return re.clearTimeout(e)};function co(e,t){if(t)return e.slice();var n=e.length,i=Fa?Fa(n):new e.constructor(n);return e.copy(i),i}function di(e){var t=new e.constructor(e.byteLength);return new En(t).set(new En(e)),t}function Xc(e,t){var n=t?di(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Qc(e){var t=new e.constructor(e.source,Vi.exec(e));return t.lastIndex=e.lastIndex,t}function ed(e){return sn?j(sn.call(e)):{}}function po(e,t){var n=t?di(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function fo(e,t){if(e!==t){var n=e!==u,i=e===null,a=e===e,s=Se(e),l=t!==u,c=t===null,f=t===t,v=Se(t);if(!c&&!v&&!s&&e>t||s&&l&&f&&!c&&!v||i&&l&&f||!n&&f||!a)return 1;if(!i&&!s&&!v&&e=c)return f;var v=n[i];return f*(v=="desc"?-1:1)}}return e.index-t.index}function ho(e,t,n,i){for(var a=-1,s=e.length,l=n.length,c=-1,f=t.length,v=ee(s-l,0),_=h(f+v),y=!i;++c1?n[a-1]:u,l=a>2?n[2]:u;for(s=e.length>3&&typeof s=="function"?(a--,s):u,l&&pe(n[0],n[1],l)&&(s=a<3?u:s,a=1),t=j(t);++i-1?a[s?t[l]:l]:u}}function wo(e){return nt(function(t){var n=t.length,i=n,a=qe.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if(typeof s!="function")throw new Ae(P);if(a&&!l&&rr(s)=="wrapper")var l=new qe([],!0)}for(i=l?i:n;++i1&&x.reverse(),_&&fc))return!1;var v=s.get(e),_=s.get(t);if(v&&_)return v==t&&_==e;var y=-1,w=!0,b=n&D?new Tt:u;for(s.set(e,t),s.set(t,e);++y1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(ys,`{ /* [wrapped with `+t+`] */ `)}function _d(e){return A(e)||Ft(e)||!!(Ja&&e&&e[Ja])}function rt(e,t){var n=typeof e;return t=t??st,!!t&&(n=="number"||n!="symbol"&&As.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Gu)return arguments[0]}else t=0;return e.apply(u,arguments)}}function ar(e,t){var n=-1,i=e.length,a=i-1;for(t=t===u?i:t;++n1?e[t-1]:u;return n=typeof n=="function"?(e.pop(),n):u,zo(e,n)});function Go(e){var t=o(e);return t.__chain__=!0,t}function Ip(e,t){return t(e),e}function or(e,t){return t(e)}var Ap=nt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(s){return Hr(s,e)};return t>1||this.__actions__.length||!(i instanceof W)||!rt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:or,args:[a],thisArg:u}),new qe(i,this.__chain__).thru(function(s){return t&&!s.length&&s.push(u),s}))});function qp(){return Go(this)}function Fp(){return new qe(this.value(),this.__chain__)}function Pp(){this.__values__===u&&(this.__values__=ou(this.value()));var e=this.__index__>=this.__values__.length,t=e?u:this.__values__[this.__index__++];return{done:e,value:t}}function Np(){return this}function Jp(e){for(var t,n=this;n instanceof zn;){var i=Mo(n);i.__index__=0,i.__values__=u,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function Wp(){var e=this.__wrapped__;if(e instanceof W){var t=e;return this.__actions__.length&&(t=new W(this)),t=t.reverse(),t.__actions__.push({func:or,args:[bi],thisArg:u}),new qe(t,this.__chain__)}return this.thru(bi)}function xp(){return uo(this.__wrapped__,this.__actions__)}var Ep=Xn(function(e,t,n){L.call(e,n)?++e[n]:et(e,n,1)});function Up(e,t,n){var i=A(e)?wa:Ic;return n&&pe(e,t,n)&&(t=u),i(e,C(t,3))}function Mp(e,t){var n=A(e)?lt:Ka;return n(e,C(t,3))}var Lp=mo(Lo),Dp=mo(Do);function jp(e,t){return oe(ur(e,t),1)}function Bp(e,t){return oe(ur(e,t),St)}function Kp(e,t,n){return n=n===u?1:q(n),oe(ur(e,t),n)}function Vo(e,t){var n=A(e)?Ie:ht;return n(e,C(t,3))}function $o(e,t){var n=A(e)?ll:Ba;return n(e,C(t,3))}var zp=Xn(function(e,t,n){L.call(e,n)?e[n].push(t):et(e,n,[t])});function Gp(e,t,n,i){e=ve(e)?e:Gt(e),n=n&&!i?q(n):0;var a=e.length;return n<0&&(n=ee(a+n,0)),pr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&Wt(e,t,n)>-1}var Vp=N(function(e,t,n){var i=-1,a=typeof t=="function",s=ve(e)?h(e.length):[];return ht(e,function(l){s[++i]=a?me(t,l,n):dn(l,t,n)}),s}),$p=Xn(function(e,t,n){et(e,n,t)});function ur(e,t){var n=A(e)?G:Za;return n(e,C(t,3))}function Hp(e,t,n,i){return e==null?[]:(A(t)||(t=t==null?[]:[t]),n=i?u:n,A(n)||(n=n==null?[]:[n]),eo(e,t,n))}var Zp=Xn(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Yp(e,t,n){var i=A(e)?xr:Ca,a=arguments.length<3;return i(e,C(t,4),n,a,ht)}function Xp(e,t,n){var i=A(e)?cl:Ca,a=arguments.length<3;return i(e,C(t,4),n,a,Ba)}function Qp(e,t){var n=A(e)?lt:Ka;return n(e,cr(C(t,3)))}function ef(e){var t=A(e)?Ma:Gc;return t(e)}function tf(e,t,n){(n?pe(e,t,n):t===u)?t=1:t=q(t);var i=A(e)?bc:Vc;return i(e,t)}function nf(e){var t=A(e)?Cc:Hc;return t(e)}function rf(e){if(e==null)return 0;if(ve(e))return pr(e)?Et(e):e.length;var t=le(e);return t==Me||t==Le?e.size:ti(e).length}function af(e,t,n){var i=A(e)?Er:Zc;return n&&pe(e,t,n)&&(t=u),i(e,C(t,3))}var of=N(function(e,t){if(e==null)return[];var n=t.length;return n>1&&pe(e,t[0],t[1])?t=[]:n>2&&pe(t[0],t[1],t[2])&&(t=[t[0]]),eo(e,oe(t,1),[])}),sr=Ml||function(){return re.Date.now()};function uf(e,t){if(typeof t!="function")throw new Ae(P);return e=q(e),function(){if(--e<1)return t.apply(this,arguments)}}function Ho(e,t,n){return t=n?u:t,t=e&&t==null?e.length:t,tt(e,Ue,u,u,u,u,t)}function Zo(e,t){var n;if(typeof t!="function")throw new Ae(P);return e=q(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=u),n}}var Oi=N(function(e,t,n){var i=U;if(n.length){var a=dt(n,Kt(Oi));i|=Te}return tt(e,i,t,n,a)}),Yo=N(function(e,t,n){var i=U|z;if(n.length){var a=dt(n,Kt(Yo));i|=Te}return tt(t,i,e,n,a)});function Xo(e,t,n){t=n?u:t;var i=tt(e,ae,u,u,u,u,u,t);return i.placeholder=Xo.placeholder,i}function Qo(e,t,n){t=n?u:t;var i=tt(e,Ee,u,u,u,u,u,t);return i.placeholder=Qo.placeholder,i}function eu(e,t,n){var i,a,s,l,c,f,v=0,_=!1,y=!1,w=!0;if(typeof e!="function")throw new Ae(P);t=Je(t)||0,$(n)&&(_=!!n.leading,y="maxWait"in n,s=y?ee(Je(n.maxWait)||0,t):s,w="trailing"in n?!!n.trailing:w);function b(Y){var Ke=i,ot=a;return i=a=u,v=Y,l=e.apply(ot,Ke),l}function T(Y){return v=Y,c=vn(J,t),_?b(Y):l}function F(Y){var Ke=Y-f,ot=Y-v,mu=t-Ke;return y?se(mu,s-ot):mu}function k(Y){var Ke=Y-f,ot=Y-v;return f===u||Ke>=t||Ke<0||y&&ot>=s}function J(){var Y=sr();if(k(Y))return x(Y);c=vn(J,F(Y))}function x(Y){return c=u,w&&i?b(Y):(i=a=u,l)}function be(){c!==u&&lo(c),v=0,i=f=a=c=u}function fe(){return c===u?l:x(sr())}function Ce(){var Y=sr(),Ke=k(Y);if(i=arguments,a=this,f=Y,Ke){if(c===u)return T(f);if(y)return lo(c),c=vn(J,t),b(f)}return c===u&&(c=vn(J,t)),l}return Ce.cancel=be,Ce.flush=fe,Ce}var sf=N(function(e,t){return ja(e,1,t)}),lf=N(function(e,t,n){return ja(e,Je(t)||0,n)});function cf(e){return tt(e,$t)}function lr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ae(P);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],s=n.cache;if(s.has(a))return s.get(a);var l=e.apply(this,i);return n.cache=s.set(a,l)||s,l};return n.cache=new(lr.Cache||Qe),n}lr.Cache=Qe;function cr(e){if(typeof e!="function")throw new Ae(P);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 df(e){return Zo(2,e)}var pf=Yc(function(e,t){t=t.length==1&&A(t[0])?G(t[0],we(C())):G(oe(t,1),we(C()));var n=t.length;return N(function(i){for(var a=-1,s=se(i.length,n);++a=t}),Ft=Va(function(){return arguments}())?Va:function(e){return H(e)&&L.call(e,"callee")&&!Na.call(e,"callee")},A=h.isArray,kf=ha?we(ha):Jc;function ve(e){return e!=null&&dr(e.length)&&!it(e)}function Z(e){return H(e)&&ve(e)}function If(e){return e===!0||e===!1||H(e)&&de(e)==Ht}var yt=Dl||Ei,Af=ga?we(ga):Wc;function qf(e){return H(e)&&e.nodeType===1&&!_n(e)}function Ff(e){if(e==null)return!0;if(ve(e)&&(A(e)||typeof e=="string"||typeof e.splice=="function"||yt(e)||zt(e)||Ft(e)))return!e.length;var t=le(e);if(t==Me||t==Le)return!e.size;if(gn(e))return!ti(e).length;for(var n in e)if(L.call(e,n))return!1;return!0}function Pf(e,t){return pn(e,t)}function Nf(e,t,n){n=typeof n=="function"?n:u;var i=n?n(e,t):u;return i===u?pn(e,t,u,n):!!i}function ki(e){if(!H(e))return!1;var t=de(e);return t==bn||t==ts||typeof e.message=="string"&&typeof e.name=="string"&&!_n(e)}function Jf(e){return typeof e=="number"&&Wa(e)}function it(e){if(!$(e))return!1;var t=de(e);return t==Cn||t==ji||t==es||t==rs}function nu(e){return typeof e=="number"&&e==q(e)}function dr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=st}function $(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function H(e){return e!=null&&typeof e=="object"}var ru=va?we(va):Ec;function Wf(e,t){return e===t||ei(e,t,_i(t))}function xf(e,t,n){return n=typeof n=="function"?n:u,ei(e,t,_i(t),n)}function Ef(e){return iu(e)&&e!=+e}function Uf(e){if(wd(e))throw new I(O);return $a(e)}function Mf(e){return e===null}function Lf(e){return e==null}function iu(e){return typeof e=="number"||H(e)&&de(e)==Yt}function _n(e){if(!H(e)||de(e)!=Ye)return!1;var t=Un(e);if(t===null)return!0;var n=L.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Jn.call(n)==Wl}var Ii=_a?we(_a):Uc;function Df(e){return nu(e)&&e>=-st&&e<=st}var au=ya?we(ya):Mc;function pr(e){return typeof e=="string"||!A(e)&&H(e)&&de(e)==Qt}function Se(e){return typeof e=="symbol"||H(e)&&de(e)==On}var zt=ma?we(ma):Lc;function jf(e){return e===u}function Bf(e){return H(e)&&le(e)==en}function Kf(e){return H(e)&&de(e)==as}var zf=nr(ni),Gf=nr(function(e,t){return e<=t});function ou(e){if(!e)return[];if(ve(e))return pr(e)?De(e):ge(e);if(rn&&e[rn])return bl(e[rn]());var t=le(e),n=t==Me?Br:t==Le?Fn:Gt;return n(e)}function at(e){if(!e)return e===0?e:0;if(e=Je(e),e===St||e===-St){var t=e<0?-1:1;return t*Zu}return e===e?e:0}function q(e){var t=at(e),n=t%1;return t===t?n?t-n:t:0}function uu(e){return e?kt(q(e),0,ze):0}function Je(e){if(typeof e=="number")return e;if(Se(e))return Rn;if($(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Oa(e);var n=Ts.test(e);return n||Is.test(e)?ol(e.slice(2),n?2:8):Os.test(e)?Rn:+e}function su(e){return Ve(e,_e(e))}function Vf(e){return e?kt(q(e),-st,st):e===0?e:0}function M(e){return e==null?"":Re(e)}var $f=jt(function(e,t){if(gn(t)||ve(t)){Ve(t,ie(t),e);return}for(var n in t)L.call(t,n)&&ln(e,n,t[n])}),lu=jt(function(e,t){Ve(t,_e(t),e)}),fr=jt(function(e,t,n,i){Ve(t,_e(t),e,i)}),Hf=jt(function(e,t,n,i){Ve(t,ie(t),e,i)}),Zf=nt(Hr);function Yf(e,t){var n=Dt(e);return t==null?n:La(n,t)}var Xf=N(function(e,t){e=j(e);var n=-1,i=t.length,a=i>2?t[2]:u;for(a&&pe(t[0],t[1],a)&&(i=1);++n1),s}),Ve(e,gi(e),n),i&&(n=Fe(n,ce|Ze|V,sd));for(var a=t.length;a--;)ui(n,t[a]);return n});function vh(e,t){return du(e,cr(C(t)))}var _h=nt(function(e,t){return e==null?{}:Bc(e,t)});function du(e,t){if(e==null)return{};var n=G(gi(e),function(i){return[i]});return t=C(t),to(e,n,function(i,a){return t(i,a[0])})}function yh(e,t,n){t=vt(t,e);var i=-1,a=t.length;for(a||(a=1,e=u);++it){var i=e;e=t,t=i}if(n||e%1||t%1){var a=xa();return se(e+a*(t-e+al("1e-"+((a+"").length-1))),t)}return ii(e,t)}var Ah=Bt(function(e,t,n){return t=t.toLowerCase(),e+(n?hu(t):t)});function hu(e){return Fi(M(e).toLowerCase())}function gu(e){return e=M(e),e&&e.replace(qs,yl).replace(Hs,"")}function qh(e,t,n){e=M(e),t=Re(t);var i=e.length;n=n===u?i:kt(q(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function Fh(e){return e=M(e),e&&cs.test(e)?e.replace(zi,ml):e}function Ph(e){return e=M(e),e&&vs.test(e)?e.replace(Tr,"\\$&"):e}var Nh=Bt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Jh=Bt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Wh=yo("toLowerCase");function xh(e,t,n){e=M(e),t=q(t);var i=t?Et(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return tr(jn(a),n)+e+tr(Dn(a),n)}function Eh(e,t,n){e=M(e),t=q(t);var i=t?Et(e):0;return t&&i>>0,n?(e=M(e),e&&(typeof t=="string"||t!=null&&!Ii(t))&&(t=Re(t),!t&&xt(e))?_t(De(e),0,n):e.split(t,n)):[]}var Kh=Bt(function(e,t,n){return e+(n?" ":"")+Fi(t)});function zh(e,t,n){return e=M(e),n=n==null?0:kt(q(n),0,e.length),t=Re(t),e.slice(n,n+t.length)==t}function Gh(e,t,n){var i=o.templateSettings;n&&pe(e,t,n)&&(t=u),e=M(e),t=fr({},t,i,Oo);var a=fr({},t.imports,i.imports,Oo),s=ie(a),l=jr(a,s),c,f,v=0,_=t.interpolate||Tn,y="__p += '",w=Kr((t.escape||Tn).source+"|"+_.source+"|"+(_===Gi?Cs:Tn).source+"|"+(t.evaluate||Tn).source+"|$","g"),b="//# sourceURL="+(L.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++el+"]")+` `;e.replace(w,function(k,J,x,be,fe,Ce){return x||(x=be),y+=e.slice(v,Ce).replace(Fs,wl),J&&(c=!0,y+=`' + __e(`+J+`) + '`),fe&&(f=!0,y+=`'; `+fe+`; __p += '`),x&&(y+=`' + ((__t = (`+x+`)) == null ? '' : __t) + '`),v=Ce+k.length,k}),y+=`'; `;var T=L.call(t,"variable")&&t.variable;if(!T)y=`with (obj) { `+y+` } `;else if(Ss.test(T))throw new I(te);y=(f?y.replace(os,""):y).replace(us,"$1").replace(ss,"$1;"),y="function("+(T||"obj")+`) { `+(T?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(c?", __e = _.escape":"")+(f?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+y+`return __p }`;var F=_u(function(){return E(s,b+"return "+y).apply(u,l)});if(F.source=y,ki(F))throw F;return F}function Vh(e){return M(e).toLowerCase()}function $h(e){return M(e).toUpperCase()}function Hh(e,t,n){if(e=M(e),e&&(n||t===u))return Oa(e);if(!e||!(t=Re(t)))return e;var i=De(e),a=De(t),s=Ta(i,a),l=ka(i,a)+1;return _t(i,s,l).join("")}function Zh(e,t,n){if(e=M(e),e&&(n||t===u))return e.slice(0,Aa(e)+1);if(!e||!(t=Re(t)))return e;var i=De(e),a=ka(i,De(t))+1;return _t(i,0,a).join("")}function Yh(e,t,n){if(e=M(e),e&&(n||t===u))return e.replace(kr,"");if(!e||!(t=Re(t)))return e;var i=De(e),a=Ta(i,De(t));return _t(i,a).join("")}function Xh(e,t){var n=vr,i=zu;if($(t)){var a="separator"in t?t.separator:a;n="length"in t?q(t.length):n,i="omission"in t?Re(t.omission):i}e=M(e);var s=e.length;if(xt(e)){var l=De(e);s=l.length}if(n>=s)return e;var c=n-Et(i);if(c<1)return i;var f=l?_t(l,0,c).join(""):e.slice(0,c);if(a===u)return f+i;if(l&&(c+=f.length-c),Ii(a)){if(e.slice(c).search(a)){var v,_=f;for(a.global||(a=Kr(a.source,M(Vi.exec(a))+"g")),a.lastIndex=0;v=a.exec(_);)var y=v.index;f=f.slice(0,y===u?c:y)}}else if(e.indexOf(Re(a),c)!=c){var w=f.lastIndexOf(a);w>-1&&(f=f.slice(0,w))}return f+i}function Qh(e){return e=M(e),e&&ls.test(e)?e.replace(Ki,kl):e}var eg=Bt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Fi=yo("toUpperCase");function vu(e,t,n){return e=M(e),t=n?u:t,t===u?Sl(e)?ql(e):fl(e):e.match(t)||[]}var _u=N(function(e,t){try{return me(e,u,t)}catch(n){return ki(n)?n:new I(n)}}),tg=nt(function(e,t){return Ie(t,function(n){n=$e(n),et(e,n,Oi(e[n],e))}),e});function ng(e){var t=e==null?0:e.length,n=C();return e=t?G(e,function(i){if(typeof i[1]!="function")throw new Ae(P);return[n(i[0]),i[1]]}):[],N(function(i){for(var a=-1;++ast)return[];var n=ze,i=se(e,ze);t=C(t),e-=ze;for(var a=Dr(i,t);++n0||t<0)?new W(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==u&&(t=q(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},W.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},W.prototype.toArray=function(){return this.take(ze)},Ge(W.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=o[i?"take"+(t=="last"?"Right":""):t],s=i||/^find/.test(t);a&&(o.prototype[t]=function(){var l=this.__wrapped__,c=i?[1]:arguments,f=l instanceof W,v=c[0],_=f||A(l),y=function(J){var x=a.apply(o,ct([J],c));return i&&w?x[0]:x};_&&n&&typeof v=="function"&&v.length!=1&&(f=_=!1);var w=this.__chain__,b=!!this.__actions__.length,T=s&&!w,F=f&&!b;if(!s&&_){l=F?l:new W(this);var k=e.apply(l,c);return k.__actions__.push({func:or,args:[y],thisArg:u}),new qe(k,w)}return T&&F?e.apply(this,c):(k=this.thru(y),T?i?k.value()[0]:k.value():k)})}),Ie(["pop","push","shift","sort","splice","unshift"],function(e){var t=Pn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var s=this.value();return t.apply(A(s)?s:[],a)}return this[n](function(l){return t.apply(A(l)?l:[],a)})}}),Ge(W.prototype,function(e,t){var n=o[t];if(n){var i=n.name+"";L.call(Lt,i)||(Lt[i]=[]),Lt[i].push({name:t,func:n})}}),Lt[Qn(u,z).name]=[{name:"wrapper",func:u}],W.prototype.clone=Xl,W.prototype.reverse=Ql,W.prototype.value=ec,o.prototype.at=Ap,o.prototype.chain=qp,o.prototype.commit=Fp,o.prototype.next=Pp,o.prototype.plant=Jp,o.prototype.reverse=Wp,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=xp,o.prototype.first=o.prototype.head,rn&&(o.prototype[rn]=Np),o},pt=Fl();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(re._=pt,define(function(){return pt})):bt?((bt.exports=pt)._=pt,Nr._=pt):re._=pt}).call(r)}),He=class{static encodeBytes(r){let d=btoa(String.fromCharCode(...new Uint8Array(r))).replace(/\+/g,"-").replace(/\//g,"_");return wu(d)}static decodeBytes(r){let d=r.replace(/-/g,"+").replace(/_/g,"/"),u=wu(d);return Uint8Array.from(atob(u),m=>m.charCodeAt(0))}},wu=r=>{let d=r.indexOf("=");return r.slice(0,d===-1?r.length:d)},We=class extends Error{statusCode;statusText;message;name;constructor(r,d){super(),this.name="PassageError",this.statusCode=d.status,this.statusText=d.statusText,this.message=this._parsePsgErrorResponse(r)}_parsePsgErrorResponse(r){try{return r=JSON.parse(r),r.error?r.error:""}catch{return r}}},xe=(r=>(r[r.MultipleChoice=300]="MultipleChoice",r[r.MovedPermanantly=301]="MovedPermanantly",r[r.Found=302]="Found",r[r.SeeOther=303]="SeeOther",r[r.NotModified=304]="NotModified",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",r[r.BadRequest=400]="BadRequest",r[r.Unauthorized=401]="Unauthorized",r[r.PaymentRequired=402]="PaymentRequired",r[r.Forbidden=403]="Forbidden",r[r.NotFound=404]="NotFound",r[r.MethodNotAllowed=405]="MethodNotAllowed",r[r.NotAcceptable=406]="NotAcceptable",r[r.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",r[r.RequestTimeout=408]="RequestTimeout",r[r.Conflict=409]="Conflict",r[r.Gone=410]="Gone",r[r.LengthRequired=411]="LengthRequired",r[r.PreconditionFailed=412]="PreconditionFailed",r[r.PayloadTooLarge=413]="PayloadTooLarge",r[r.URITooLong=414]="URITooLong",r[r.UnsupportedMediaType=415]="UnsupportedMediaType",r[r.RangeNotSatisfiable=416]="RangeNotSatisfiable",r[r.ExpectationFailed=417]="ExpectationFailed",r[r.MisdirectedRequest=421]="MisdirectedRequest",r[r.UnprocessableEntity=422]="UnprocessableEntity",r[r.Locked=423]="Locked",r[r.FailedDependency=424]="FailedDependency",r[r.TooEarly=425]="TooEarly",r[r.UpgradeRequired=426]="UpgradeRequired",r[r.PreconditionRequired=428]="PreconditionRequired",r[r.TooManyRequests=429]="TooManyRequests",r[r.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",r[r.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",r[r.InternalServerError=500]="InternalServerError",r[r.NotImplemented=501]="NotImplemented",r[r.BadGateway=502]="BadGateway",r[r.ServiceUnavailable=503]="ServiceUnavailable",r[r.GatewayTimeout=504]="GatewayTimeout",r[r.HTTPVersionNotSupported=505]="HTTPVersionNotSupported",r[r.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",r[r.InsufficientStorage=507]="InsufficientStorage",r[r.LoopDetected=508]="LoopDetected",r[r.NotExtended=510]="NotExtended",r[r.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",r[r.PSGCredObjectDoesNotExist=700]="PSGCredObjectDoesNotExist",r[r.PSGParsePublicKeyForNewDeviceFailed=701]="PSGParsePublicKeyForNewDeviceFailed",r[r.PSGParsePublicKeyForLoginFailed=702]="PSGParsePublicKeyForLoginFailed",r[r.PSGCouldNotGetUserCredential=703]="PSGCouldNotGetUserCredential",r[r.PSGLoginRequired=704]="PSGLoginRequired",r[r.PSGSecureContextRequired=705]="PSGSecureContextRequired",r[r.PSGSocialSessionStorageError=706]="PSGSocialSessionStorageError",r[r.PSGParsePublicKeyForRegistrationFailed=707]="PSGParsePublicKeyForRegistrationFailed",r[r.PSGCanAuthenticateWithPasskeyFailed=708]="PSGCanAuthenticateWithPasskeyFailed",r[r.PSGCanRegisterWithPasskeyFailed=709]="PSGCanRegisterWithPasskeyFailed",r[r.PSGCanUseConditionalMediationFailed=710]="PSGCanUseConditionalMediationFailed",r[r.PSGAuthOriginConfigurationError=711]="PSGAuthOriginConfigurationError",r[r.PSGMustRunInBrowserContext=712]="PSGMustRunInBrowserContext",r))(xe||{});var Qg=()=>async(r,d)=>{},ev=()=>async(r,d,...u)=>u,tv=()=>async(r,d,u)=>u.data,nv=()=>(r,d,u)=>{throw console.error(u),u},rv=()=>async(r,d)=>{},iv=()=>({onStart:Qg(),onBeforeRequest:ev(),onResponseSuccess:tv(),onError:nv(),onFinish:rv()}),av=(r,d,u,m)=>{let{onStart:R,onBeforeRequest:O,onResponseSuccess:P,onError:te,onFinish:ne}=iv(),{onStart:Oe=R,onBeforeRequest:ue=O,onResponseSuccess:ce=P,onError:Ze=te,onFinish:V=ne}=u;return async(...X)=>{Oe&&await Oe(m,d);try{let D;ue?D=await ue(m,d,...X):D=X;let U=await d.apply(r,D),z;return ce?z=await ce(m,d,U):z=U.data,z}catch(D){throw Ze?await Ze(m,d,D):D}finally{V&&await V(m,d)}}},yn=Su(bu()),ov=(r,d)=>({lookupValue:(u,m,R)=>R!=null?(0,yn.get)(m,u,(0,yn.get)(r,u,R)):(0,yn.get)(m,u,(0,yn.get)(r,u,(0,yn.get)(d,u,void 0)))}),uv=Su(bu());function sv(r){return"response"in r}var lv={},cv=(r,d)=>{let{lookupValue:u}=ov(r,lv),m=async(V,X)=>{},R=async(V,X,...D)=>{let U=u("requestNormalizer",V),z=U?U(D):D;if(u("requiresAppId",V)){if(!d)throw new Error("App ID is required.");z.unshift(`${d}`)}return z},O=async(V,X,D)=>{let U=u("responseDataKey",V),z;U?z=(0,uv.get)(D,U,void 0):z=D;let wt=u("responseSerializer",V),ae;wt?ae=await wt(z):ae=z;let Ee=u("onResponseSuccess",V);return Ee&&await Ee(z,ae),ae},P=async(V,X)=>{},te=async(V,X,D)=>{if(!sv(D))throw D;let U=D.response,z=await U.text();return new We(z,U)},ne=()=>m,Oe=()=>R,ue=()=>O,ce=()=>P,Ze=()=>te;return{handlers:()=>({onStart:ne(),onBeforeRequest:Oe(),onResponseSuccess:ue(),onFinish:ce(),onError:Ze()})}},dv="https://auth.passage.id/v1".replace(/\/+$/,""),Cu=class{constructor(r={}){this.configuration=r}set config(r){this.configuration=r}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dv}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ku}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let r=this.configuration.apiKey;if(r)return typeof r=="function"?r:()=>r}get accessToken(){let r=this.configuration.accessToken;if(r)return typeof r=="function"?r:async()=>r}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}},pv=new Cu,Ou=class Tu{constructor(d=pv){this.configuration=d,this.middleware=d.middleware}static jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");middleware;withMiddleware(...d){let u=this.clone();return u.middleware=u.middleware.concat(...d),u}withPreMiddleware(...d){let u=d.map(m=>({pre:m}));return this.withMiddleware(...u)}withPostMiddleware(...d){let u=d.map(m=>({post:m}));return this.withMiddleware(...u)}isJsonMime(d){return d?Tu.jsonRegex.test(d):!1}async request(d,u){let{url:m,init:R}=await this.createFetchParams(d,u),O=await this.fetchApi(m,R);if(O&&O.status>=200&&O.status<300)return O;throw new gv(O,"Response returned an error code")}async createFetchParams(d,u){let m=this.configuration.basePath+d.path;d.query!==void 0&&Object.keys(d.query).length!==0&&(m+="?"+this.configuration.queryParamsStringify(d.query));let R=Object.assign({},this.configuration.headers,d.headers);Object.keys(R).forEach(ue=>R[ue]===void 0?delete R[ue]:{});let O=typeof u=="function"?u:async()=>u,P={method:d.method,headers:R,body:d.body,credentials:this.configuration.credentials},te={...P,...await O({init:P,context:d})},ne;hv(te.body)||te.body instanceof URLSearchParams||fv(te.body)?ne=te.body:this.isJsonMime(R["Content-Type"])?ne=JSON.stringify(te.body):ne=te.body;let Oe={...te,body:ne};return{url:m,init:Oe}}fetchApi=async(d,u)=>{let m={url:d,init:u};for(let O of this.middleware)O.pre&&(m=await O.pre({fetch:this.fetchApi,...m})||m);let R;try{R=await(this.configuration.fetchApi||fetch)(m.url,m.init)}catch(O){for(let P of this.middleware)P.onError&&(R=await P.onError({fetch:this.fetchApi,url:m.url,init:m.init,error:O,response:R?R.clone():void 0})||R);if(R===void 0)throw O instanceof Error?new vv(O,"The request failed and the interceptors did not return an alternative response"):O}for(let O of this.middleware)O.post&&(R=await O.post({fetch:this.fetchApi,url:m.url,init:m.init,response:R.clone()})||R);return R};clone(){let d=this.constructor,u=new d(this.configuration);return u.middleware=this.middleware.slice(),u}};function fv(r){return typeof Blob<"u"&&r instanceof Blob}function hv(r){return typeof FormData<"u"&&r instanceof FormData}var gv=class extends Error{constructor(r,d){super(d),this.response=r}name="ResponseError"},vv=class extends Error{constructor(r,d){super(d),this.cause=r}name="FetchError"},he=class extends Error{constructor(r,d){super(d),this.field=r}name="RequiredError"};function ku(r,d=""){return Object.keys(r).map(u=>Iu(u,r[u],d)).filter(u=>u.length>0).join("&")}function Iu(r,d,u=""){let m=u+(u.length?`[${r}]`:r);if(d instanceof Array){let R=d.map(O=>encodeURIComponent(String(O))).join(`&${encodeURIComponent(m)}=`);return`${encodeURIComponent(m)}=${R}`}if(d instanceof Set){let R=Array.from(d);return Iu(r,R,u)}return d instanceof Date?`${encodeURIComponent(m)}=${encodeURIComponent(d.toISOString())}`:d instanceof Object?ku(d,m):`${encodeURIComponent(m)}=${encodeURIComponent(String(d))}`}var mt=class{constructor(r,d=u=>u){this.raw=r,this.transformer=d}async value(){return this.transformer(await this.raw.json())}};function _v(r){return r==null?r:{attestationObject:r.attestationObject,clientDataJSON:r.clientDataJSON,transports:r.transports}}function Au(r){return r==null?r:{authenticatorAttachment:r.authenticatorAttachment,clientExtensionResults:r.clientExtensionResults,id:r.id,rawId:r.rawId,response:_v(r.response),transports:r.transports,type:r.type}}function yv(r){return mv(r,!1)}function mv(r,d){return r==null?r:{icon:r.icon==null?void 0:r.icon,id:r.id==null?void 0:r.id,name:r.name==null?void 0:r.name}}function wv(r){return Rv(r,!1)}function Rv(r,d){return r==null?r:{displayName:r.displayName==null?void 0:r.displayName,icon:r.icon==null?void 0:r.icon,id:r.id==null?void 0:r.id,name:r.name==null?void 0:r.name}}function Sv(r){return bv(r,!1)}function bv(r,d){return r==null?r:{id:r.id==null?void 0:r.id,transports:r.transports==null?void 0:r.transports,type:r.type==null?void 0:r.type}}function Cv(r){return Ov(r,!1)}function Ov(r,d){return r==null?r:{alg:r.alg==null?void 0:r.alg,type:r.type==null?void 0:r.type}}function Tv(r){return kv(r,!1)}function kv(r,d){return r==null?r:{authenticatorAttachment:r.authenticatorAttachment==null?void 0:r.authenticatorAttachment,requireResidentKey:r.requireResidentKey==null?void 0:r.requireResidentKey,residentKey:r.residentKey==null?void 0:r.residentKey,userVerification:r.userVerification==null?void 0:r.userVerification}}function Iv(r){return Av(r,!1)}function Av(r,d){return r==null?r:{attestation:r.attestation==null?void 0:r.attestation,authenticatorSelection:r.authenticatorSelection==null?void 0:Tv(r.authenticatorSelection),challenge:r.challenge==null?void 0:r.challenge,excludeCredentials:r.excludeCredentials==null?void 0:r.excludeCredentials.map(Sv),extensions:r.extensions==null?void 0:r.extensions,pubKeyCredParams:r.pubKeyCredParams==null?void 0:r.pubKeyCredParams.map(Cv),rp:r.rp==null?void 0:yv(r.rp),timeout:r.timeout==null?void 0:r.timeout,user:r.user==null?void 0:wv(r.user)}}function qv(r){return Fv(r,!1)}function Fv(r,d){return r==null?r:{publicKey:r.publicKey==null?void 0:Iv(r.publicKey)}}function qu(r){return Pv(r,!1)}function Pv(r,d){return r==null?r:{challenge:qv(r.challenge),id:r.id}}var Nv=(r=>(r.Active="active",r.Inactive="inactive",r.Pending="pending",r))(Nv||{});function Jv(r){return Wv(r,!1)}function Wv(r,d){return r}var xv=(r=>(r.Passkey="passkey",r.SecurityKey="security_key",r.Platform="platform",r))(xv||{});function Ev(r){return Uv(r,!1)}function Uv(r,d){return r}function Mv(r){return Lv(r,!1)}function Lv(r,d){return r==null?r:{email:r.email,emailVerified:r.email_verified,id:r.id,phone:r.phone,phoneVerified:r.phone_verified,status:Jv(r.status),userMetadata:r.user_metadata,webauthn:r.webauthn,webauthnTypes:r.webauthn_types?.map(Ev)??[]}}var Dv=(r=>(r.S="s",r.M="m",r.H="h",r.D="d",r))(Dv||{});var jv=(r=>(r.Helvetica="Helvetica",r.Arial="Arial",r.ArialBlack="Arial Black",r.Verdana="Verdana",r.Tahoma="Tahoma",r.TrebuchetMs="Trebuchet MS",r.Impact="Impact",r.GillSans="Gill Sans",r.TimesNewRoman="Times New Roman",r.Georgia="Georgia",r.Palatino="Palatino",r.Baskerville="Baskerville",r.AndalMono="Andal\xE9 Mono",r.Courier="Courier",r.Lucida="Lucida",r.Monaco="Monaco",r.BradleyHand="Bradley Hand",r.BrushScriptMt="Brush Script MT",r.Luminari="Luminari",r.ComicSansMs="Comic Sans MS",r))(jv||{});var Bv=(r=>(r.MagicLink="magic_link",r.Otp="otp",r.None="none",r))(Bv||{});function Kv(r){return zv(r,!1)}function zv(r,d){return r==null?r:{authToken:r.auth_token,redirectUrl:r.redirect_url,refreshToken:r.refresh_token==null?void 0:r.refresh_token,refreshTokenExpiration:r.refresh_token_expiration==null?void 0:r.refresh_token_expiration}}function Gv(r){return Vv(r,!1)}function Vv(r,d){return r==null?r:{authResult:Kv(r.auth_result)}}function $v(r){return r==null?r:{authenticatorData:r.authenticatorData,clientDataJSON:r.clientDataJSON,signature:r.signature,userHandle:r.userHandle}}function Hv(r){return r==null?r:{authenticatorAttachment:r.authenticatorAttachment,clientExtensionResults:r.clientExtensionResults,id:r.id,rawId:r.rawId,response:$v(r.response),type:r.type}}function Zv(r){return r==null?r:{handshake_id:r.handshakeId,handshake_response:Hv(r.handshakeResponse),transaction_id:r.transactionId}}function Yv(r){return r==null?r:{transaction_id:r.transactionId}}function Xv(r){return Qv(r,!1)}function Qv(r,d){return r==null?r:{id:r.id,transports:r.transports==null?void 0:r.transports,type:r.type}}function e_(r){return t_(r,!1)}function t_(r,d){return r==null?r:{allowCredentials:r.allowCredentials==null?void 0:r.allowCredentials.map(Xv),challenge:r.challenge,extensions:r.extensions==null?void 0:r.extensions,rpId:r.rpId==null?void 0:r.rpId,timeout:r.timeout==null?void 0:r.timeout,userVerification:r.userVerification==null?void 0:r.userVerification}}function n_(r){return r_(r,!1)}function r_(r,d){return r==null?r:{publicKey:e_(r.publicKey)}}function i_(r){return a_(r,!1)}function a_(r,d){return r==null?r:{challenge:n_(r.challenge),id:r.id}}function o_(r){return u_(r,!1)}function u_(r,d){return r==null?r:{handshake:i_(r.handshake),transactionId:r.transaction_id==null?void 0:r.transaction_id}}var Mi=(r=>(r.Platform="platform",r.CrossPlatform="cross-platform",r.Any="any",r))(Mi||{});var s_=(r=>(r.Apple="apple",r.Google="google",r))(s_||{});function l_(r){return c_(r,!1)}function c_(r,d){return r==null?r:{id:r.id}}var d_=(r=>(r.Request="invalid_request",r.ClientVersion="invalid_client_version",r))(d_||{});var p_=(r=>(r.DiscoverableLoginFailed="discoverable_login_failed",r.WebauthnLoginFailed="webauthn_login_failed",r.InvalidMagicLink="invalid_magic_link",r.InvalidAccessToken="invalid_access_token",r.InvalidRefreshToken="invalid_refresh_token",r.ExceededAttempts="exceeded_attempts",r))(p_||{});var f_=(r=>(r.IdentifierNotVerified="identifier_not_verified",r.OperationNotAllowed="operation_not_allowed",r.UserNotActive="user_not_active",r))(f_||{});var h_=(r=>(r.AppNotFound="app_not_found",r.UserNotFound="user_not_found",r.MagicLinkNotFound="magic_link_not_found",r.SocialConnectionNotFound="social_connection_not_found",r.TransactionNotFound="transaction_not_found",r))(h_||{});var g_=(r=>(r.UserHasNoPasskeys="user_has_no_passkeys",r))(g_||{});var v_=(r=>(r.InternalServerError="internal_server_error",r))(v_||{});function Fu(r){return __(r,!1)}function __(r,d){return r==null?r:{nonce:r.nonce}}function y_(r){return m_(r,!1)}function m_(r,d){return r==null?r:{otpId:r.otp_id}}function w_(r){return r==null?r:{identifier:r.identifier,language:r.language,magic_link_path:r.magicLinkPath}}function R_(r){return S_(r,!1)}function S_(r,d){return r==null?r:{magicLink:l_(r.magic_link)}}function b_(r){return r==null?r:{identifier:r.identifier,language:r.language}}function C_(r){return r==null?r:{handshake_id:r.handshakeId,handshake_response:Au(r.handshakeResponse),user_id:r.userId}}function O_(r){return r==null?r:{handshake_id:r.handshakeId,handshake_response:Au(r.handshakeResponse),transaction_id:r.transactionId}}function T_(r){return r==null?r:{identifier:r.identifier,authenticator_attachment:r.authenticatorAttachment}}function k_(r){return I_(r,!1)}function I_(r,d){return r==null?r:{handshake:qu(r.handshake),user:r.user==null?void 0:Mv(r.user)}}function A_(r){return r==null?r:{transaction_id:r.transactionId,authenticator_attachment:r.authenticatorAttachment}}function q_(r){return F_(r,!1)}function F_(r,d){return r==null?r:{handshake:qu(r.handshake),transactionId:r.transaction_id==null?void 0:r.transaction_id}}var Pu=class extends Ou{async authenticateWebauthnFinishWithTransactionRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling authenticateWebauthnFinishWithTransaction().');if(r.authenticateWebAuthnFinishWithTransactionRequest==null)throw new he("authenticateWebAuthnFinishWithTransactionRequest",'Required parameter "authenticateWebAuthnFinishWithTransactionRequest" was null or undefined when calling authenticateWebauthnFinishWithTransaction().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/authenticate/transactions/webauthn/finish".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:Zv(r.authenticateWebAuthnFinishWithTransactionRequest)},d);return new mt(R,O=>Fu(O))}async authenticateWebauthnFinishWithTransaction(r,d,u){return await(await this.authenticateWebauthnFinishWithTransactionRaw({appId:r,authenticateWebAuthnFinishWithTransactionRequest:d},u)).value()}async authenticateWebauthnStartWithTransactionRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling authenticateWebauthnStartWithTransaction().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/authenticate/transactions/webauthn/start".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:Yv(r.authenticateWebAuthnStartWithTransactionRequest)},d);return new mt(R,O=>o_(O))}async authenticateWebauthnStartWithTransaction(r,d,u){return await(await this.authenticateWebauthnStartWithTransactionRaw({appId:r,authenticateWebAuthnStartWithTransactionRequest:d},u)).value()}};var P_=(r=>(r.Apple="apple",r.Github="github",r.Google="google",r))(P_||{});var N_=(r=>(r.UserCancelledAuthorize="user_cancelled_authorize",r))(N_||{}),J_=(r=>(r.UserCancelledAuthorize="user_cancelled_authorize",r))(J_||{}),W_=(r=>(r.Apple="apple",r.Github="github",r.Google="google",r.Passage="passage",r))(W_||{}),x_=(r=>(r.InteractionRequired="interaction_required",r.LoginRequired="login_required",r.AccountSelectionRequired="account_selection_required",r.ConsentRequired="consent_required",r.InvalidRequestUri="invalid_request_uri",r.InvalidRequestObject="invalid_request_object",r.RequestNotSupported="request_not_supported",r.RequestUriNotSupported="request_uri_not_supported",r.RegistrationNotSupported="registration_not_supported",r))(x_||{}),E_=(r=>(r.InteractionRequired="interaction_required",r.LoginRequired="login_required",r.AccountSelectionRequired="account_selection_required",r.ConsentRequired="consent_required",r.InvalidRequestUri="invalid_request_uri",r.InvalidRequestObject="invalid_request_object",r.RequestNotSupported="request_not_supported",r.RequestUriNotSupported="request_uri_not_supported",r.RegistrationNotSupported="registration_not_supported",r))(E_||{});var Nu=class extends Ou{async registerMagicLinkRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerMagicLink().');if(r.user==null)throw new he("user",'Required parameter "user" was null or undefined when calling registerMagicLink().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/magic-link".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:w_(r.user)},d);return new mt(R,O=>R_(O))}async registerMagicLink(r,d,u){return await(await this.registerMagicLinkRaw({appId:r,user:d},u)).value()}async registerOneTimePasscodeRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerOneTimePasscode().');if(r.registerOneTimePasscodeRequest==null)throw new he("registerOneTimePasscodeRequest",'Required parameter "registerOneTimePasscodeRequest" was null or undefined when calling registerOneTimePasscode().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/otp".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:b_(r.registerOneTimePasscodeRequest)},d);return new mt(R,O=>y_(O))}async registerOneTimePasscode(r,d,u){return await(await this.registerOneTimePasscodeRaw({appId:r,registerOneTimePasscodeRequest:d},u)).value()}async registerWebauthnFinishRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnFinish().');if(r.registerWebAuthnFinishRequest==null)throw new he("registerWebAuthnFinishRequest",'Required parameter "registerWebAuthnFinishRequest" was null or undefined when calling registerWebauthnFinish().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/webauthn/finish".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:C_(r.registerWebAuthnFinishRequest)},d);return new mt(R,O=>Gv(O))}async registerWebauthnFinish(r,d,u){return await(await this.registerWebauthnFinishRaw({appId:r,registerWebAuthnFinishRequest:d},u)).value()}async registerWebauthnFinishWithTransactionRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnFinishWithTransaction().');if(r.registerWebAuthnFinishWithTransactionRequest==null)throw new he("registerWebAuthnFinishWithTransactionRequest",'Required parameter "registerWebAuthnFinishWithTransactionRequest" was null or undefined when calling registerWebauthnFinishWithTransaction().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/transactions/webauthn/finish".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:O_(r.registerWebAuthnFinishWithTransactionRequest)},d);return new mt(R,O=>Fu(O))}async registerWebauthnFinishWithTransaction(r,d,u){return await(await this.registerWebauthnFinishWithTransactionRaw({appId:r,registerWebAuthnFinishWithTransactionRequest:d},u)).value()}async registerWebauthnStartRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnStart().');if(r.registerWebAuthnStartRequest==null)throw new he("registerWebAuthnStartRequest",'Required parameter "registerWebAuthnStartRequest" was null or undefined when calling registerWebauthnStart().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/webauthn/start".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:T_(r.registerWebAuthnStartRequest)},d);return new mt(R,O=>k_(O))}async registerWebauthnStart(r,d,u){return await(await this.registerWebauthnStartRaw({appId:r,registerWebAuthnStartRequest:d},u)).value()}async registerWebauthnStartWithTransactionRaw(r,d){if(r.appId==null)throw new he("appId",'Required parameter "appId" was null or undefined when calling registerWebauthnStartWithTransaction().');if(r.registerWebAuthnStartWithTransactionRequest==null)throw new he("registerWebAuthnStartWithTransactionRequest",'Required parameter "registerWebAuthnStartWithTransactionRequest" was null or undefined when calling registerWebauthnStartWithTransaction().');let u={},m={};m["Content-Type"]="application/json";let R=await this.request({path:"/apps/{app_id}/register/transactions/webauthn/start".replace("{app_id}",encodeURIComponent(String(r.appId))),method:"POST",headers:m,query:u,body:A_(r.registerWebAuthnStartWithTransactionRequest)},d);return new mt(R,O=>q_(O))}async registerWebauthnStartWithTransaction(r,d,u){return await(await this.registerWebauthnStartWithTransactionRaw({appId:r,registerWebAuthnStartWithTransactionRequest:d},u)).value()}};var Ju=(r,d,u)=>{let{appId:m,basePath:R,authToken:O,additionalHeaders:P}=d,te={basePath:R,accessToken:O,headers:P},ne=new Cu(te),Oe=new r(ne),{handlers:ue}=cv(u??{},m),ce=(X,D,U={})=>V(X,{requiresAppId:!0,...D},U),Ze=(X,D,U={})=>V(X,{requiresAppId:!1,...D},U),V=(X,D,U={})=>{let{onStart:z,onBeforeRequest:wt,onResponseSuccess:ae,onError:Ee,onFinish:Te}=ue(),{onStart:ut=z,onBeforeRequest:Ue=wt,onResponseSuccess:Rt=ae,onError:$t=Ee,onFinish:vr=Te}=U??{};return av(Oe,X,{onStart:ut,onBeforeRequest:Ue,onResponseSuccess:Rt,onError:$t,onFinish:vr},D)};return{service:Oe,wrapPassageAPIEndpoint:V,wrapPassageApplicationEndpoint:ce,wrapPassageNonApplicationEndpoint:Ze}};var Wu={URL:"https://auth.passage.id/v1",version:"@passageidentity/passage-flex-js 0.2.2",CAPTURE_EVENT_URL:"https://us-central1-passage-prod.cloudfunctions.net/capture-event",SENTRY_RELEASE:"passage-flex-js@0.2.2-prod",SENTRY_PROJECT:"passage-flex-js",SENTRY_PROJECT_DSN:"",SENTRY_PROJECT_ENV:"prod",SENTRY_PROJECT_VERSION:"0.2.2"};var hr=Wu;function xu(){return{"Passage-Flex-Version":hr.version??""}}var Vt=class{wrapPassageApplicationEndpoint;service;constructor(d,u){let m={appId:d,basePath:hr.URL,additionalHeaders:xu()},{wrapPassageApplicationEndpoint:R,service:O}=Ju(u,m);this.service=O,this.wrapPassageApplicationEndpoint=R}};var mn=class extends Vt{constructor(d){super(d,Nu)}async withWebAuthn(d,u){let R=await this.wrapPassageApplicationEndpoint(this.service.registerWebauthnStartWithTransaction,{})({transactionId:d,authenticatorAttachment:u?.authenticatorAttachment??Mi.Platform}),O=R.handshake.challenge.publicKey,{credential:P,transports:te}=await Eu.CreateCredentialUtils.createCredential(O).catch(ue=>{throw new We("Error creating creadential",{status:xe.PSGParsePublicKeyForRegistrationFailed,statusText:ue.message})}),ne=new Uint8Array(P?.response.attestationObject);return await this.wrapPassageApplicationEndpoint(this.service.registerWebauthnFinishWithTransaction,{responseDataKey:"nonce"})({transactionId:d,handshakeId:R.handshake.id,handshakeResponse:{rawId:He.encodeBytes(P?.rawId),id:P?.id,type:P?.type,response:{attestationObject:He.encodeBytes(ne),clientDataJSON:He.encodeBytes(P?.response.clientDataJSON)},transports:te}})}};var Uu=require("@passageidentity/webauthnutils");var wn=class extends Vt{constructor(d){super(d,Pu)}async withWebAuthn(d,u){let R=await this.wrapPassageApplicationEndpoint(this.service.authenticateWebauthnStartWithTransaction,{})({transactionId:d}),O=R.handshake.challenge.publicKey,P=await Uu.GetCredentialUtils.getCredential(O,u).catch(ne=>{throw new We("Error getting credential",{status:xe.PSGParsePublicKeyForLoginFailed,statusText:ne.message})});if(!P)throw new We("Error getting credential: no assertion found",{status:xe.PSGParsePublicKeyForLoginFailed,statusText:"No assertion returned"});return await this.wrapPassageApplicationEndpoint(this.service.authenticateWebauthnFinishWithTransaction,{responseDataKey:"nonce"})({transactionId:d,handshakeId:R.handshake.id,handshakeResponse:{id:P.id,rawId:He.encodeBytes(P.rawId),type:P.type,response:{clientDataJSON:He.encodeBytes(P.response.clientDataJSON),authenticatorData:He.encodeBytes(P.response.authenticatorData),signature:He.encodeBytes(P.response.signature),userHandle:He.encodeBytes(P.response.userHandle)}}})}};var Mu=require("@passageidentity/webauthnutils");async function Lu(){try{return(await Mu.CreateCredentialUtils.createCredentialAvailable()).isAvailable}catch{throw new We("error checking browser for webAuthn passkey regsitration availability",{status:xe.PSGCanRegisterWithPasskeyFailed,statusText:"PSG can register with passkey failed"})}}var Du=require("@passageidentity/webauthnutils");async function ju(){try{return(await Du.GetCredentialUtils.getCredentialAvailable()).isAvailable}catch{throw new We("error checking browser for webAuthn passkey authentication availability",{status:xe.PSGCanAuthenticateWithPasskeyFailed,statusText:"PSG can authenticate with passkey failed"})}}var Bu=require("@passageidentity/webauthnutils");async function Ku(){try{let r=await Bu.GetCredentialUtils.getCredentialAvailable();return!!(r.isAvailable&&r.conditionalUI)}catch{throw new We("Error checking browser for webAuthn passkey autofill availability",{status:xe.PSGCanUseConditionalMediationFailed,statusText:"PSG can use conditional mediation failed"})}}var gr=class{registerApi;authenticateApi;constructor(d){this.registerApi=new mn(d),this.authenticateApi=new wn(d)}async register(d,u){return this._getAbortController().abort(),await this.registerApi.withWebAuthn(d,u)}async authenticate(d={}){if(d.isConditionalMediation){let u=this._getAbortController().signal;return await this.authenticateApi.withWebAuthn(void 0,{mediation:"conditional",signal:u})}else return this._getAbortController().abort(),await this.authenticateApi.withWebAuthn(d.transactionId)}async canRegisterPasskey(){return await Lu()}async canAuthenticateWithPasskey(){return await ju()}async canUseConditionalMediation(){return await Ku()}_getAbortController(){let d=globalThis;return(d.__PASSAGE__===void 0||d.__PASSAGE__.abortController===void 0)&&(d.__PASSAGE__={abortController:new AbortController}),d.__PASSAGE__.abortController}};var Li=class{passkey;constructor(d){this.passkey=new gr(d)}};0&&(module.exports={PassageFlex}); /*! 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 *) */ //#