@flarehr/apollo-benefits 2.12.366 → 2.12.368

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/assets/banner-icon-dd5e974a.js +456 -0
  2. package/dist/assets/{contentful-service-ec08fb7b.js → contentful-service-aef0566a.js} +2 -2
  3. package/dist/assets/formik.esm-f59e445c.js +8 -0
  4. package/dist/assets/header-c8b1645a.js +1 -0
  5. package/dist/assets/index-3dc81d1d.js +1 -0
  6. package/dist/assets/index-52c3a920.js +2 -0
  7. package/dist/assets/index-572ac200.js +1 -0
  8. package/dist/assets/index-728c5d9e.js +28 -0
  9. package/dist/assets/index-a63bc832.js +1 -0
  10. package/dist/assets/index-b80f1ed5.js +1 -0
  11. package/dist/assets/index-c5c3bb02.js +1 -0
  12. package/dist/assets/index-c5f8d653.js +1 -0
  13. package/dist/assets/index-d499c1ee.js +1 -0
  14. package/dist/assets/index-fee1b285.js +1 -0
  15. package/dist/assets/{item-details-35ad7588.js → item-details-f4dde7c7.js} +2 -2
  16. package/dist/assets/loading-state-63ca3a52.js +1 -0
  17. package/dist/assets/modal-240be87a.js +1 -0
  18. package/dist/assets/motion-0b0c6f7d.js +1 -0
  19. package/dist/assets/pillar-tag-20509680.js +1 -0
  20. package/dist/assets/use-feature-flag-f624fbae.js +1 -0
  21. package/dist/assets/vendor-ece7687a.js +107 -0
  22. package/dist/index.html +27 -2
  23. package/dist/sw-esm.js +4 -1
  24. package/package.json +1 -1
  25. package/dist/assets/banner-icon-0117e93c.js +0 -456
  26. package/dist/assets/formik.esm-d8b8267f.js +0 -8
  27. package/dist/assets/header-e651d68b.js +0 -1
  28. package/dist/assets/index-24d35a11.js +0 -28
  29. package/dist/assets/index-58cc2d72.js +0 -1
  30. package/dist/assets/index-7ce86e27.js +0 -1
  31. package/dist/assets/index-84b83088.js +0 -1
  32. package/dist/assets/index-bd9ee342.js +0 -1
  33. package/dist/assets/index-c1d302f8.js +0 -1
  34. package/dist/assets/index-c40b5413.js +0 -107
  35. package/dist/assets/index-cfddcd4c.js +0 -1
  36. package/dist/assets/index-e7929e3d.js +0 -1
  37. package/dist/assets/index-f88c4655.js +0 -2
  38. package/dist/assets/loading-state-4b750837.js +0 -1
  39. package/dist/assets/modal-e9f61093.js +0 -1
  40. package/dist/assets/motion-aecc8ecb.js +0 -1
  41. package/dist/assets/pillar-tag-d2869d71.js +0 -1
  42. package/dist/assets/use-feature-flag-17b4c424.js +0 -1
@@ -1,107 +0,0 @@
1
- var $l=Object.defineProperty;var Wl=(e,t,n)=>t in e?$l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ze=(e,t,n)=>(Wl(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(s){if(s.ep)return;s.ep=!0;const u=n(s);fetch(s.href,u)}})();const di={type:null,entityIds:null,skip:!1,payload:null};let Go=!1;function Jl(){Go=!1}function dr(e,t,n){Et(e,t,n),Go=!0}function Et(e,t,n){Go===!1&&(di.type=e,di.entityIds=t,di.payload=n)}function zl(e,t){return function(n,r,s){const u=s.value;return s.value=function(...c){return dr(e,t),u.apply(this,c)},s}}function $r(e,t){return e.hasOwnProperty(t)}function Di(e){return Array.isArray(e)}function su(e){return e.hasOwnProperty("active")}function au(e){return Di(e)}function uu({active:e,ids:t,entities:n}){return au(e)?Yl(e,t):$r(n,e)===!1?null:e}function Yl(e,t){const n=e.filter(r=>t.indexOf(r)>-1);return n.length===e.length?e:n}function Gl({state:e,entities:t,idKey:n,options:r={},preAddEntity:s}){let u={},c=[],g=!1;for(const p of t)if($r(e.entities,p[n])===!1){const h=s(p),d=h[n];u[d]=h,r.prepend?c.unshift(d):c.push(d),g=!0}return g?{newState:{...e,entities:{...e.entities,...u},ids:r.prepend?[...c,...e.ids]:[...e.ids,...c]},newIds:c}:null}function Un(e){return e==null}function dn(e){return Un(e)?[]:Array.isArray(e)?e:[e]}var wo=function(e,t){return wo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},wo(e,t)};function un(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");wo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Qo(e,t,n,r){var s=arguments.length,u=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,t,n,r);else for(var g=e.length-1;g>=0;g--)(c=e[g])&&(u=(s<3?c(u):s>3?c(t,n,u):c(t,n))||u);return s>3&&u&&Object.defineProperty(t,n,u),u}function vn(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Ql(e,t,n,r){function s(u){return u instanceof n?u:new n(function(c){c(u)})}return new(n||(n=Promise))(function(u,c){function g(d){try{h(r.next(d))}catch(f){c(f)}}function p(d){try{h(r.throw(d))}catch(f){c(f)}}function h(d){d.done?u(d.value):s(d.value).then(g,p)}h((r=r.apply(e,t||[])).next())})}function cu(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},r,s,u,c;return c={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function g(h){return function(d){return p([h,d])}}function p(h){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,h[0]&&(n=0)),n;)try{if(r=1,s&&(u=h[0]&2?s.return:h[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,h[1])).done)return u;switch(s=0,u&&(h=[h[0]&2,u.value]),h[0]){case 0:case 1:u=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,s=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!u||h[1]>u[0]&&h[1]<u[3])){n.label=h[1];break}if(h[0]===6&&n.label<u[1]){n.label=u[1],u=h;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(h);break}u[2]&&n.ops.pop(),n.trys.pop();continue}h=t.call(e,n)}catch(d){h=[6,d],s=0}finally{r=u=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function mr(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yr(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,u=[],c;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)u.push(s.value)}catch(g){c={error:g}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return u}function _r(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,u;r<s;r++)(u||!(r in t))&&(u||(u=Array.prototype.slice.call(t,0,r)),u[r]=t[r]);return e.concat(u||Array.prototype.slice.call(t))}function pr(e){return this instanceof pr?(this.v=e,this):new pr(e)}function Xl(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),s,u=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(m){r[m]&&(s[m]=function(b){return new Promise(function(w,C){u.push([m,b,w,C])>1||g(m,b)})})}function g(m,b){try{p(r[m](b))}catch(w){f(u[0][3],w)}}function p(m){m.value instanceof pr?Promise.resolve(m.value.v).then(h,d):f(u[0][2],m)}function h(m){g("next",m)}function d(m){g("throw",m)}function f(m,b){m(b),u.shift(),u.length&&g(u[0][0],u[0][1])}}function Zl(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof mr=="function"?mr(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(u){n[u]=e[u]&&function(c){return new Promise(function(g,p){c=e[u](c),s(g,p,c.done,c.value)})}}function s(u,c,g,p){Promise.resolve(p).then(function(h){u({value:h,done:g})},c)}}function Ge(e){return typeof e=="function"}function lu(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ro=lu(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
2
- `+n.map(function(r,s){return s+1+") "+r.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function Si(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Yr=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,u;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var g=mr(c),p=g.next();!p.done;p=g.next()){var h=p.value;h.remove(this)}}catch(C){t={error:C}}finally{try{p&&!p.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}else c.remove(this);var d=this.initialTeardown;if(Ge(d))try{d()}catch(C){u=C instanceof ro?C.errors:[C]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var m=mr(f),b=m.next();!b.done;b=m.next()){var w=b.value;try{Ys(w)}catch(C){u=u??[],C instanceof ro?u=_r(_r([],yr(u)),yr(C.errors)):u.push(C)}}}catch(C){r={error:C}}finally{try{b&&!b.done&&(s=m.return)&&s.call(m)}finally{if(r)throw r.error}}}if(u)throw new ro(u)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ys(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Si(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Si(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),fu=Yr.EMPTY;function hu(e){return e instanceof Yr||e&&"closed"in e&&Ge(e.remove)&&Ge(e.add)&&Ge(e.unsubscribe)}function Ys(e){Ge(e)?e():e.unsubscribe()}var du={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Eo={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var s=Eo.delegate;return s!=null&&s.setTimeout?s.setTimeout.apply(s,_r([e,t],yr(n))):setTimeout.apply(void 0,_r([e,t],yr(n)))},clearTimeout:function(e){var t=Eo.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function pu(e){Eo.setTimeout(function(){throw e})}function Fo(){}function pi(e){e()}var Xo=function(e){un(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,hu(n)&&n.add(r)):r.destination=rf,r}return t.create=function(n,r,s){return new Ao(n,r,s)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Yr),ef=Function.prototype.bind;function io(e,t){return ef.call(e,t)}var tf=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){ci(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){ci(r)}else ci(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){ci(n)}},e}(),Ao=function(e){un(t,e);function t(n,r,s){var u=e.call(this)||this,c;if(Ge(n)||!n)c={next:n??void 0,error:r??void 0,complete:s??void 0};else{var g;u&&du.useDeprecatedNextContext?(g=Object.create(n),g.unsubscribe=function(){return u.unsubscribe()},c={next:n.next&&io(n.next,g),error:n.error&&io(n.error,g),complete:n.complete&&io(n.complete,g)}):c=n}return u.destination=new tf(c),u}return t}(Xo);function ci(e){pu(e)}function nf(e){throw e}var rf={closed:!0,next:Fo,error:nf,complete:Fo},Zo=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Li(e){return e}function of(e){return e.length===0?Li:e.length===1?e[0]:function(n){return e.reduce(function(r,s){return s(r)},n)}}var Nt=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var s=this,u=af(t)?t:new Ao(t,n,r);return pi(function(){var c=s,g=c.operator,p=c.source;u.add(g?g.call(u,p):p?s._subscribe(u):s._trySubscribe(u))}),u},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=Gs(n),new n(function(s,u){var c=new Ao({next:function(g){try{t(g)}catch(p){u(p),c.unsubscribe()}},error:u,complete:s});r.subscribe(c)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[Zo]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return of(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=Gs(t),new t(function(r,s){var u;n.subscribe(function(c){return u=c},function(c){return s(c)},function(){return r(u)})})},e.create=function(t){return new e(t)},e}();function Gs(e){var t;return(t=e??du.Promise)!==null&&t!==void 0?t:Promise}function sf(e){return e&&Ge(e.next)&&Ge(e.error)&&Ge(e.complete)}function af(e){return e&&e instanceof Xo||sf(e)&&hu(e)}function uf(e){return Ge(e==null?void 0:e.lift)}function cn(e){return function(t){if(uf(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Xt(e,t,n,r,s){return new cf(e,t,n,r,s)}var cf=function(e){un(t,e);function t(n,r,s,u,c,g){var p=e.call(this,n)||this;return p.onFinalize=c,p.shouldUnsubscribe=g,p._next=r?function(h){try{r(h)}catch(d){n.error(d)}}:e.prototype._next,p._error=u?function(h){try{u(h)}catch(d){n.error(d)}finally{this.unsubscribe()}}:e.prototype._error,p._complete=s?function(){try{s()}catch(h){n.error(h)}finally{this.unsubscribe()}}:e.prototype._complete,p}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(Xo),lf=lu(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),_n=function(e){un(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new Qs(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new lf},t.prototype.next=function(n){var r=this;pi(function(){var s,u;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var c=mr(r.currentObservers),g=c.next();!g.done;g=c.next()){var p=g.value;p.next(n)}}catch(h){s={error:h}}finally{try{g&&!g.done&&(u=c.return)&&u.call(c)}finally{if(s)throw s.error}}}})},t.prototype.error=function(n){var r=this;pi(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var s=r.observers;s.length;)s.shift().error(n)}})},t.prototype.complete=function(){var n=this;pi(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,s=this,u=s.hasError,c=s.isStopped,g=s.observers;return u||c?fu:(this.currentObservers=null,g.push(n),new Yr(function(){r.currentObservers=null,Si(g,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,s=r.hasError,u=r.thrownError,c=r.isStopped;s?n.error(u):c&&n.complete()},t.prototype.asObservable=function(){var n=new Nt;return n.source=this,n},t.create=function(n,r){return new Qs(n,r)},t}(Nt),Qs=function(e){un(t,e);function t(n,r){var s=e.call(this)||this;return s.destination=n,s.source=r,s}return t.prototype.next=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,n)},t.prototype.error=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&s!==void 0?s:fu},t}(_n),wi=function(e){un(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,r=n.hasError,s=n.thrownError,u=n._value;if(r)throw s;return this._throwIfClosed(),u},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t}(_n),es={now:function(){return(es.delegate||Date).now()},delegate:void 0},gu=function(e){un(t,e);function t(n,r,s){n===void 0&&(n=1/0),r===void 0&&(r=1/0),s===void 0&&(s=es);var u=e.call(this)||this;return u._bufferSize=n,u._windowTime=r,u._timestampProvider=s,u._buffer=[],u._infiniteTimeWindow=!0,u._infiniteTimeWindow=r===1/0,u._bufferSize=Math.max(1,n),u._windowTime=Math.max(1,r),u}return t.prototype.next=function(n){var r=this,s=r.isStopped,u=r._buffer,c=r._infiniteTimeWindow,g=r._timestampProvider,p=r._windowTime;s||(u.push(n),!c&&u.push(g.now()+p)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),s=this,u=s._infiniteTimeWindow,c=s._buffer,g=c.slice(),p=0;p<g.length&&!n.closed;p+=u?1:2)n.next(g[p]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,s=n._timestampProvider,u=n._buffer,c=n._infiniteTimeWindow,g=(c?1:2)*r;if(r<1/0&&g<u.length&&u.splice(0,u.length-g),!c){for(var p=s.now(),h=0,d=1;d<u.length&&u[d]<=p;d+=2)h=d;h&&u.splice(0,h+1)}},t}(_n),ff=function(e){un(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t}(Yr),Ei={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var s=Ei.delegate;return s!=null&&s.setInterval?s.setInterval.apply(s,_r([e,t],yr(n))):setInterval.apply(void 0,_r([e,t],yr(n)))},clearInterval:function(e){var t=Ei.delegate;return((t==null?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},hf=function(e){un(t,e);function t(n,r){var s=e.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.pending=!1,s}return t.prototype.schedule=function(n,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var u=this.id,c=this.scheduler;return u!=null&&(this.id=this.recycleAsyncId(c,u,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(c,this.id,r),this},t.prototype.requestAsyncId=function(n,r,s){return s===void 0&&(s=0),Ei.setInterval(n.flush.bind(n,this),s)},t.prototype.recycleAsyncId=function(n,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&Ei.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(n,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var s=!1,u;try{this.work(n)}catch(c){s=!0,u=c||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),u},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,s=n.scheduler,u=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Si(u,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ff),Xs=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=es.now,e}(),df=function(e){un(t,e);function t(n,r){r===void 0&&(r=Xs.now);var s=e.call(this,n,r)||this;return s.actions=[],s._active=!1,s}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var s;this._active=!0;do if(s=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,s){for(;n=r.shift();)n.unsubscribe();throw s}},t}(Xs),vu=new df(hf),pf=vu,mu=new Nt(function(e){return e.complete()});function yu(e){return e&&Ge(e.schedule)}function _u(e){return e[e.length-1]}function $v(e){return Ge(_u(e))?e.pop():void 0}function bu(e){return yu(_u(e))?e.pop():void 0}var Su=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function wu(e){return Ge(e==null?void 0:e.then)}function Eu(e){return Ge(e[Zo])}function Fu(e){return Symbol.asyncIterator&&Ge(e==null?void 0:e[Symbol.asyncIterator])}function Au(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function gf(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Pu=gf();function ku(e){return Ge(e==null?void 0:e[Pu])}function Cu(e){return Xl(this,arguments,function(){var n,r,s,u;return cu(this,function(c){switch(c.label){case 0:n=e.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,pr(n.read())];case 3:return r=c.sent(),s=r.value,u=r.done,u?[4,pr(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,pr(s)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Iu(e){return Ge(e==null?void 0:e.getReader)}function er(e){if(e instanceof Nt)return e;if(e!=null){if(Eu(e))return vf(e);if(Su(e))return mf(e);if(wu(e))return yf(e);if(Fu(e))return Tu(e);if(ku(e))return _f(e);if(Iu(e))return bf(e)}throw Au(e)}function vf(e){return new Nt(function(t){var n=e[Zo]();if(Ge(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function mf(e){return new Nt(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function yf(e){return new Nt(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,pu)})}function _f(e){return new Nt(function(t){var n,r;try{for(var s=mr(e),u=s.next();!u.done;u=s.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(g){n={error:g}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}t.complete()})}function Tu(e){return new Nt(function(t){Sf(e,t).catch(function(n){return t.error(n)})})}function bf(e){return Tu(Cu(e))}function Sf(e,t){var n,r,s,u;return Ql(this,void 0,void 0,function(){var c,g;return cu(this,function(p){switch(p.label){case 0:p.trys.push([0,5,6,11]),n=Zl(e),p.label=1;case 1:return[4,n.next()];case 2:if(r=p.sent(),!!r.done)return[3,4];if(c=r.value,t.next(c),t.closed)return[2];p.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return g=p.sent(),s={error:g},[3,11];case 6:return p.trys.push([6,,9,10]),r&&!r.done&&(u=n.return)?[4,u.call(n)]:[3,8];case 7:p.sent(),p.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function In(e,t,n,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var u=t.schedule(function(){n(),s?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(u),!s)return u}function Ru(e,t){return t===void 0&&(t=0),cn(function(n,r){n.subscribe(Xt(r,function(s){return In(r,e,function(){return r.next(s)},t)},function(){return In(r,e,function(){return r.complete()},t)},function(s){return In(r,e,function(){return r.error(s)},t)}))})}function Ou(e,t){return t===void 0&&(t=0),cn(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function wf(e,t){return er(e).pipe(Ou(t),Ru(t))}function Ef(e,t){return er(e).pipe(Ou(t),Ru(t))}function Ff(e,t){return new Nt(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Af(e,t){return new Nt(function(n){var r;return In(n,t,function(){r=e[Pu](),In(n,t,function(){var s,u,c;try{s=r.next(),u=s.value,c=s.done}catch(g){n.error(g);return}c?n.complete():n.next(u)},0,!0)}),function(){return Ge(r==null?void 0:r.return)&&r.return()}})}function Nu(e,t){if(!e)throw new Error("Iterable cannot be null");return new Nt(function(n){In(n,t,function(){var r=e[Symbol.asyncIterator]();In(n,t,function(){r.next().then(function(s){s.done?n.complete():n.next(s.value)})},0,!0)})})}function Pf(e,t){return Nu(Cu(e),t)}function kf(e,t){if(e!=null){if(Eu(e))return wf(e,t);if(Su(e))return Ff(e,t);if(wu(e))return Ef(e,t);if(Fu(e))return Nu(e,t);if(ku(e))return Af(e,t);if(Iu(e))return Pf(e,t)}throw Au(e)}function Gr(e,t){return t?kf(e,t):er(e)}function Uu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=bu(e);return Gr(e,n)}function xu(e){return!!e&&(e instanceof Nt||Ge(e.lift)&&Ge(e.subscribe))}function Cf(e){return e instanceof Date&&!isNaN(e)}function kr(e,t){return cn(function(n,r){var s=0;n.subscribe(Xt(r,function(u){r.next(e.call(t,u,s++))}))})}function If(e,t,n,r,s,u,c,g){var p=[],h=0,d=0,f=!1,m=function(){f&&!p.length&&!h&&t.complete()},b=function(C){return h<r?w(C):p.push(C)},w=function(C){u&&t.next(C),h++;var I=!1;er(n(C,d++)).subscribe(Xt(t,function(R){s==null||s(R),u?b(R):t.next(R)},function(){I=!0},void 0,function(){if(I)try{h--;for(var R=function(){var F=p.shift();c?In(t,c,function(){return w(F)}):w(F)};p.length&&h<r;)R();m()}catch(F){t.error(F)}}))};return e.subscribe(Xt(t,b,function(){f=!0,m()})),function(){g==null||g()}}function ts(e,t,n){return n===void 0&&(n=1/0),Ge(t)?ts(function(r,s){return kr(function(u,c){return t(r,u,s,c)})(er(e(r,s)))},n):(typeof t=="number"&&(n=t),cn(function(r,s){return If(r,s,e,n)}))}function Tf(e){return e===void 0&&(e=1/0),ts(Li,e)}function Rf(){return Tf(1)}function Of(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Rf()(Gr(e,bu(e)))}function Nf(e,t,n){e===void 0&&(e=0),n===void 0&&(n=pf);var r=-1;return t!=null&&(yu(t)?n=t:r=t),new Nt(function(s){var u=Cf(e)?+e-n.now():e;u<0&&(u=0);var c=0;return n.schedule(function(){s.closed||(s.next(c++),0<=r?this.schedule(void 0,r):s.complete())},u)})}function ns(e,t){return cn(function(n,r){var s=0;n.subscribe(Xt(r,function(u){return e.call(t,u,s++)&&r.next(u)}))})}function Po(e){return e<=0?function(){return mu}:cn(function(t,n){var r=0;t.subscribe(Xt(n,function(s){++r<=e&&(n.next(s),e<=r&&n.complete())}))})}function Uf(){return cn(function(e,t){e.subscribe(Xt(t,Fo))})}function xf(e){return kr(function(){return e})}function Du(e,t){return t?function(n){return Of(t.pipe(Po(1),Uf()),n.pipe(Du(e)))}:ts(function(n,r){return er(e(n,r)).pipe(Po(1),xf(n))})}function Lu(e,t){t===void 0&&(t=vu);var n=Nf(e,t);return Du(function(){return n})}function Mu(e,t){return t===void 0&&(t=Li),e=e??Df,cn(function(n,r){var s,u=!0;n.subscribe(Xt(r,function(c){var g=t(c);(u||!e(s,g))&&(u=!1,s=g,r.next(c))}))})}function Df(e,t){return e===t}function Lf(e){return ns(function(t,n){return e<=n})}function ju(e,t){return cn(function(n,r){var s=null,u=0,c=!1,g=function(){return c&&!s&&r.complete()};n.subscribe(Xt(r,function(p){s==null||s.unsubscribe();var h=0,d=u++;er(e(p,d)).subscribe(s=Xt(r,function(f){return r.next(t?t(p,f,d,h++):f)},function(){s=null,g()}))},function(){c=!0,g()}))})}function Mf(e,t,n){var r=Ge(e)||t||n?{next:e,error:t,complete:n}:e;return r?cn(function(s,u){var c;(c=r.subscribe)===null||c===void 0||c.call(r);var g=!0;s.subscribe(Xt(u,function(p){var h;(h=r.next)===null||h===void 0||h.call(r,p),u.next(p)},function(){var p;g=!1,(p=r.complete)===null||p===void 0||p.call(r),u.complete()},function(p){var h;g=!1,(h=r.error)===null||h===void 0||h.call(r,p),u.error(p)},function(){var p,h;g&&((p=r.unsubscribe)===null||p===void 0||p.call(r)),(h=r.finalize)===null||h===void 0||h.call(r)}))}):Li}const jf="id";function Bn(e){return Di(e)?e.length===0:!1}function Ft(e){return typeof e=="function"}function rs(e){const t=typeof e;return e!=null&&(t=="object"||t=="function")}let Bu={resettable:!1,ttl:null,producerFn:void 0};function Zs(){return Bu}function Bf(){return Bu.producerFn}function Hu(e){return Un(e)===!1}const Ku=new _n,Vu=new gu(50,5e3),Hf=new _n;function Kf(e){Ku.next(e)}function Vf(e){Vu.next(e)}function qf(e,t){Hf.next({storeName:e,action:t})}const Mi=typeof window<"u",$f=!Mi,ea=()=>{try{return typeof localStorage<"u"}catch{return!1}},Wf=()=>{try{return typeof sessionStorage<"u"}catch{return!1}},on={},qu={};Mi&&(window.$$stores=on,window.$$queries=qu);var Fi;(function(e){e.ASC="asc",e.DESC="desc"})(Fi||(Fi={}));function Wv(e,t=Fi.ASC){return function(n,r){if(!n.hasOwnProperty(e)||!r.hasOwnProperty(e))return 0;const s=typeof n[e]=="string"?n[e].toUpperCase():n[e],u=typeof r[e]=="string"?r[e].toUpperCase():r[e];let c=0;return s>u?c=1:s<u&&(c=-1),t==Fi.DESC?c*-1:c}}var kn;(function(e){e.Set="Set",e.Add="Add",e.Update="Update",e.Remove="Remove"})(kn||(kn={}));let is=!0;function Jf(){is=!1,Mi&&(delete window.$$stores,delete window.$$queries)}function rt(){return is}function zf(e,t,n){let r;if(Di(e))r=e;else if(rs(e)){if(Un(n))return;e=Object.assign({wrap:!0},e);const s=t.indexOf(n);if(e.prev){const u=s===0;if(u&&!e.wrap)return;r=u?t[t.length-1]:t[s-1]}else if(e.next){const u=t.length===s+1;if(u&&!e.wrap)return;r=u?t[0]:t[s+1]}}else{if(e===n)return;r=e}return r}const Yf=()=>({entities:{},ids:[],loading:!0,error:null});function Hr(e){return e===void 0}function Gf({state:e,ids:t}){if(Un(t))return Qf(e);const n=e.entities;let r={};for(const u of e.ids)t.includes(u)===!1&&(r[u]=n[u]);const s={...e,entities:r,ids:e.ids.filter(u=>t.includes(u)===!1)};return su(e)&&(s.active=uu(s)),s}function Qf(e){return{...e,entities:{},ids:[],active:au(e.active)?[]:null}}function Xf(e,t,n){const r={entities:{},ids:[]};for(const s of e){const u=n(s);r.entities[u[t]]=u,r.ids.push(u[t])}return r}function Zf(e){return e.entities&&e.ids}function ta(e,t){let n={};for(const r of Object.keys(e))n[r]=t(e[r]);return n}function eh({state:e,entities:t,idKey:n,preAddEntity:r,isNativePreAdd:s}){let u,c;if(Di(t)){const p=Xf(t,n,r);u=p.entities,c=p.ids}else Zf(t)?(u=s?t.entities:ta(t.entities,r),c=t.ids):(u=s?t:ta(t,r),c=Object.keys(u).map(p=>isNaN(p)?p:Number(p)));const g={...e,entities:u,ids:c,loading:!1};return su(e)&&(g.active=uu(g)),g}function $u(e){Object.freeze(e);const t=typeof e=="function",n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!=="caller"&&r!=="callee"&&r!=="arguments")&&e[r]!==null&&(typeof e[r]=="object"||typeof e[r]=="function")&&!Object.isFrozen(e[r])&&$u(e[r])}),e}function th(e,t){e||console.error(`@StoreConfig({ name }) is missing in ${t}`)}function Wu(e){return e!=null&&`${e}`!="false"}function ko(e){return Wu(e)&&e.constructor.name==="Object"}const gi="akitaConfig";function Ju(e){return function(t){t[gi]={idKey:"id"};for(let n=0,r=Object.keys(e);n<r.length;n++){const s=r[n];s==="name"?t[gi].storeName=e[s]:t[gi][s]=e[s]}}}const nh=new _n,zu=new wi(!1),Tn={activeTransactions:0,batchTransaction:null};function rh(){Yu()||(Tn.batchTransaction=new _n),Tn.activeTransactions++,zu.next(!0)}function ih(){--Tn.activeTransactions===0&&(Tn.batchTransaction.next(!0),Tn.batchTransaction.complete(),zu.next(!1),nh.next(!0))}function Yu(){return Tn.activeTransactions>0}function oh(){return Tn.batchTransaction?Tn.batchTransaction.asObservable():Uu(!0)}function os(e,t=void 0){rh();try{return e.apply(t)}finally{dr("@Transaction"),ih()}}function Gu(){return function(e,t,n){const r=n.value;return n.value=function(...s){return os(()=>r.apply(this,s),this)},n}}class ss{constructor(t,n={}){this.options=n,this.inTransaction=!1,this.cache={active:new wi(!1),ttl:null},this.onInit(t)}setLoading(t=!1){t!==this._value().loading&&(rt()&&Et("Set Loading"),this._setState(n=>({...n,loading:t})))}setHasCache(t,n={restartTTL:!1}){if(t!==this.cache.active.value&&this.cache.active.next(t),n.restartTTL){const r=this.getCacheTTL();r&&(this.cache.ttl!==null&&clearTimeout(this.cache.ttl),this.cache.ttl=setTimeout(()=>this.setHasCache(!1),r))}}getValue(){return this.storeValue}setError(t){t!==this._value().error&&(rt()&&Et("Set Error"),this._setState(n=>({...n,error:t})))}_select(t){return this.store.asObservable().pipe(kr(n=>t(n.state)),Mu())}_value(){return this.storeValue}_cache(){return this.cache.active}get config(){return this.constructor[gi]||{}}get storeName(){return this.config.storeName||this.options.storeName||this.options.name}get deepFreeze(){return this.config.deepFreezeFn||this.options.deepFreezeFn||$u}get cacheConfig(){return this.config.cache||this.options.cache}get _producerFn(){return this.config.producerFn||this.options.producerFn||Bf()}get resettable(){return Hu(this.config.resettable)?this.config.resettable:this.options.resettable}_setState(t,n=!0){if(Ft(t)){const r=t(this._value());this.storeValue=is?this.deepFreeze(r):r}else this.storeValue=t;if(!this.store){this.store=new wi({state:this.storeValue}),rt()&&this.store.subscribe(({action:r})=>{r&&qf(this.storeName,r)});return}if(Yu()){this.handleTransaction();return}this.dispatch(this.storeValue,n)}reset(){this.isResettable()&&(rt()&&Et("Reset"),this._setState(()=>Object.assign({},this._initialState)),this.setHasCache(!1))}update(t){rt()&&Et("Update");let n;const r=this._value();Ft(t)?n=Ft(this._producerFn)?this._producerFn(r,t):t(r):n=t;const s=this.akitaPreUpdate(r,{...r,...n}),u=ko(r)?s:new r.constructor(s);this._setState(u)}updateStoreConfig(t){this.options={...this.options,...t}}akitaPreUpdate(t,n){return n}destroy(){!(Mi?window.hmrEnabled:!1)&&this===on[this.storeName]&&(delete on[this.storeName],Kf(this.storeName),this.setHasCache(!1),this.cache.active.complete(),this.store.complete())}onInit(t){on[this.storeName]=this,this._setState(()=>t),Vf(this.storeName),this.isResettable()&&(this._initialState=t),rt()&&th(this.storeName,this.constructor.name)}dispatch(t,n=!0){let r;n&&(r=di,Jl()),this.store.next({state:t,action:r})}watchTransaction(){oh().subscribe(()=>{this.inTransaction=!1,this.dispatch(this._value())})}isResettable(){return this.resettable===!1?!1:this.resettable||Zs().resettable}handleTransaction(){this.inTransaction||(this.watchTransaction(),this.inTransaction=!0)}getCacheTTL(){return this.cacheConfig&&this.cacheConfig.ttl||Zs().ttl}}function sh({state:e,ids:t,idKey:n,newStateOrFn:r,preUpdateEntity:s,producerFn:u,onEntityIdChanges:c}){const g={};let p=!1,h;for(const m of t){if($r(e.entities,m)===!1)continue;const b=e.entities[m];let w;Ft(r)?w=Ft(u)?u(b,r):r(b):w=r;const C=w.hasOwnProperty(n)&&w[n]!==b[n];let I;h=m,C&&(p=!0,h=w[n]);const R={...b,...w};ko(b)?I=R:ko(w)?I=new b.constructor(R):I=new w.constructor(R),g[h]=s(b,I)}let d=e.ids,f=e.entities;if(p){const[m]=t,{[m]:b,...w}=e.entities;f=w,d=e.ids.map(C=>C===m?h:C),c(m,h)}return{...e,entities:{...f,...g},ids:d}}var na;class br extends ss{constructor(t={},n={}){super({...Yf(),...t},n),this.options=n,this.entityActions=new _n,this.entityIdChanges=new _n}get selectEntityAction$(){return this.entityActions.asObservable()}get selectEntityIdChanges$(){return this.entityIdChanges.asObservable()}get idKey(){return this.config.idKey||this.options.idKey||jf}set(t,n={}){if(Un(t))return;rt()&&Et("Set Entity");const r=this.akitaPreAddEntity===br.prototype.akitaPreAddEntity;this.setHasCache(!0,{restartTTL:!0}),this._setState(s=>{const u=eh({state:s,entities:t,idKey:this.idKey,preAddEntity:this.akitaPreAddEntity.bind(this),isNativePreAdd:r});return Hr(n.activeId)===!1&&(u.active=n.activeId),u}),this.hasInitialUIState()&&this.handleUICreation(),this.entityActions.next({type:kn.Set,ids:this.ids})}add(t,n={loading:!1}){const r=dn(t);if(Bn(r))return;const s=Gl({state:this._value(),preAddEntity:this.akitaPreAddEntity.bind(this),entities:r,idKey:this.idKey,options:n});s&&(rt()&&Et("Add Entity"),s.newState.loading=n.loading,this._setState(()=>s.newState),this.hasInitialUIState()&&this.handleUICreation(!0),this.entityActions.next({type:kn.Add,ids:s.newIds}))}update(t,n){if(Hr(n)){super.update(t);return}let r=[];if(Ft(t)?r=this.ids.filter(u=>t(this.entities[u])):r=Un(t)?this.ids:dn(t),Bn(r))return;rt()&&Et("Update Entity",r);let s;this._setState(u=>sh({idKey:this.idKey,ids:r,preUpdateEntity:this.akitaPreUpdateEntity.bind(this),state:u,newStateOrFn:n,producerFn:this._producerFn,onEntityIdChanges:(c,g)=>{s={oldId:c,newId:g},this.entityIdChanges.next({...s,pending:!0})}})),s&&this.entityIdChanges.next({...s,pending:!1}),this.entityActions.next({type:kn.Update,ids:r})}upsert(t,n,r,s={}){const u=dn(t),c=f=>m=>$r(this.entities,m)===f,g=Ft(r)?s.baseClass:r?r.baseClass:void 0,p=Ft(g),h=u.filter(c(!0)),d=u.filter(c(!1)).map(f=>{const m=typeof n=="function"?n({}):n,w={...Ft(r)?r(f,m):m,[this.idKey]:f};return p?new g(w):w});this.update(h,n),this.add(d),rt()&&dr("Upsert Entity")}upsertMany(t,n={}){const r=[],s=[],u={};for(const c of t){const g=this.akitaPreCheckEntity(c),p=g[this.idKey];if($r(this.entities,p)){const h=this._value().entities[p],d={...this._value().entities[p],...g},f=n.baseClass?new n.baseClass(d):d,m=this.akitaPreUpdateEntity(h,f),b=m[this.idKey];u[b]=m,s.push(b)}else{const h=n.baseClass?new n.baseClass(g):g,d=this.akitaPreAddEntity(h),f=d[this.idKey];r.push(f),u[f]=d}}rt()&&dr("Upsert Many"),this._setState(c=>({...c,ids:r.length?[...c.ids,...r]:c.ids,entities:{...c.entities,...u},loading:!!n.loading})),s.length&&this.entityActions.next({type:kn.Update,ids:s}),r.length&&this.entityActions.next({type:kn.Add,ids:r}),r.length&&this.hasUIStore()&&this.handleUICreation(!0)}replace(t,n){const r=dn(t);if(Bn(r))return;const s={};for(const u of r)s[u]={...n,[this.idKey]:u};rt()&&Et("Replace Entity",t),this._setState(u=>({...u,entities:{...u.entities,...s}}))}move(t,n){const r=this.ids.slice();r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),rt()&&Et("Move Entity"),this._setState(s=>({...s,entities:{...s.entities},ids:r}))}remove(t){if(Bn(this.ids))return;const n=Hu(t);let r=[];Ft(t)?r=this.ids.filter(s=>t(this.entities[s])):r=n?dn(t):this.ids,!Bn(r)&&(rt()&&Et("Remove Entity",r),this._setState(s=>Gf({state:s,ids:r})),n||this.setHasCache(!1),this.handleUIRemove(r),this.entityActions.next({type:kn.Remove,ids:r}))}updateActive(t){const n=dn(this.active);rt()&&Et("Update Active",n),this.update(n,t)}setActive(t){const n=zf(t,this.ids,this.active);n!==void 0&&(rt()&&Et("Set Active",n),this._setActive(n))}addActive(t){const n=dn(t);Bn(n)||n.every(s=>this.active.indexOf(s)>-1)||(rt()&&Et("Add Active",t),this._setState(s=>{const u=Array.from(new Set([...s.active,...n]));return{...s,active:u}}))}removeActive(t){const n=dn(t);Bn(n)||!n.some(s=>this.active.indexOf(s)>-1)||(rt()&&Et("Remove Active",t),this._setState(s=>({...s,active:Array.isArray(s.active)?s.active.filter(u=>n.indexOf(u)===-1):null})))}toggleActive(t){const n=dn(t),r=c=>g=>this.active.includes(g)===c,s=n.filter(r(!0)),u=n.filter(r(!1));this.removeActive(s),this.addActive(u),rt()&&dr("Toggle Active")}createUIStore(t={},n={}){const r={name:`UI/${this.storeName}`,idKey:this.idKey};return this.ui=new ra(t,{...r,...n}),this.ui}destroy(){super.destroy(),this.ui instanceof br&&this.ui.destroy(),this.entityActions.complete()}akitaPreUpdateEntity(t,n){return n}akitaPreAddEntity(t){return t}akitaPreCheckEntity(t){return t}get ids(){return this._value().ids}get entities(){return this._value().entities}get active(){return this._value().active}_setActive(t){this._setState(n=>({...n,active:t}))}handleUICreation(t=!1){const n=this.ids,r=Ft(this.ui._akitaCreateEntityFn);let s;const u=c=>{const g=this.entities[c],p=r?this.ui._akitaCreateEntityFn(g):this.ui._akitaCreateEntityFn;return{[this.idKey]:g[this.idKey],...p}};t?s=this.ids.filter(c=>Hr(this.ui.entities[c])).map(u):s=n.map(u),t?this.ui.add(s):this.ui.set(s)}hasInitialUIState(){return this.hasUIStore()&&Hr(this.ui._akitaCreateEntityFn)===!1}handleUIRemove(t){this.hasUIStore()&&this.ui.remove(t)}hasUIStore(){return this.ui instanceof ra}}Qo([Gu(),vn("design:type",Function),vn("design:paramtypes",[Object,Object,Object,Object]),vn("design:returntype",void 0)],br.prototype,"upsert",null);Qo([Gu(),vn("design:type",Function),vn("design:paramtypes",[typeof(na=typeof T<"u"&&T)=="function"?na:Object]),vn("design:returntype",void 0)],br.prototype,"toggleActive",null);class ra extends br{constructor(t={},n={}){super(t,n)}setInitialEntityState(t){this._akitaCreateEntityFn=t}}function ah(){return ns(e=>e!=null)}function uh(e){return function(t,n){const r=Ft(e[0]);return e.some(s=>r?s(t)!==s(n):t[s]!==n[s])===!1}}function ch(e){return typeof e=="string"}const lh="akitaQueryConfig";class as{constructor(t){this.store=t,this.__store__=t,rt()&&(qu[t.storeName]=this)}select(t){let n;if(Ft(t))n=t;else if(ch(t))n=r=>r[t];else{if(Array.isArray(t))return this.store._select(r=>r).pipe(Mu(uh(t)),kr(r=>Ft(t[0])?t.map(s=>s(r)):t.reduce((s,u)=>(s[u]=r[u],s),{})));n=r=>r}return this.store._select(n)}selectLoading(){return this.select(t=>t.loading)}selectError(){return this.select(t=>t.error)}getValue(){return this.store._value()}selectHasCache(){return this.store._cache().asObservable()}getHasCache(){return this.store._cache().value}get config(){return this.constructor[lh]}}function Co(e,t){return t.split(".").length===1?e:t.split(".").slice(1).join(".").split(".").reduce((r,s)=>r&&r[s],e)}function Qu(e,t,n,r=!1){const s=t.split(".");if(s.length===1)return{...e,...n};e={...e};const u=s.length-2;return t.split(".").slice(1).reduce((g,p,h)=>h!==u?(g[p]={...g[p]},g&&g[p]):(g[p]=r||Array.isArray(g[p])||!rs(g[p])?n:{...g[p],...n},g&&g[p]),e),e}let fh=!1;const hh=new gu(1);function dh(){return fh}function ph(e){return e&&Ft(e.then)}function jr(e){return ph(e)||xu(e)?Gr(e):Uu(e)}function gh(e){const t={key:"AkitaStores",enableInNonBrowser:!1,storage:ea()?localStorage:e.storage,deserialize:JSON.parse,serialize:JSON.stringify,include:[],select:[],persistOnDestroy:!1,preStorageUpdate:function(U,K){return K},preStoreUpdate:function(U,K){return K},skipStorageUpdate:dh,preStorageUpdateOperator:()=>U=>U},{storage:n,enableInNonBrowser:r,deserialize:s,serialize:u,include:c,select:g,key:p,preStorageUpdate:h,persistOnDestroy:d,preStorageUpdateOperator:f,preStoreUpdate:m,skipStorageUpdate:b}=Object.assign({},t,e);if($f&&!r||!n)return;const w=c.length>0,C=g.length>0;let I,R;w&&(I=c.reduce((U,K)=>{if(Ft(K))U.fns.push(K);else{const X=K.split(".")[0];U[X]=K}return U},{fns:[]})),C&&(R=g.reduce((U,K)=>(U[K.storeName]=K,U),{}));let F={};const A={},x=[],O=[];function N(U){jr(U).subscribe(()=>{const K=O.shift();K&&N(K)})}const E=ea()&&n===localStorage||Wf()&&n===sessionStorage;return jr(n.getItem(p)).subscribe(U=>{let K=rs(U)?U:s(U||"{}");function X(fe){K.$cache={...K.$cache||{},...fe},K=Object.assign({},K,A),O.push(n.setItem(p,E?u(K):K)),N(O.shift())}function M(fe,be){F[fe]=on[fe]._select(Se=>Co(Se,be)).pipe(Lf(1),kr(Se=>C&&R[fe]?R[fe](Se):Se),ns(()=>b()===!1),f()).subscribe(Se=>{A[fe]=h(fe,Se),Promise.resolve().then(()=>X({[fe]:on[fe]._cache().getValue()}))})}function ue(fe,be,Se){if(fe in K){Et("@PersistState"),be._setState(Oe=>Qu(Oe,Se,m(fe,K[fe],Oe)));const Ce=K.$cache?K.$cache[fe]:!1;on[fe].setHasCache(Ce,{restartTTL:!0})}}x.push(Ku.subscribe(fe=>{F[fe]&&(d===!1&&X({[fe]:!1}),F[fe].unsubscribe(),delete F[fe])})),x.push(Vu.subscribe(fe=>{if(fe==="router")return;const be=on[fe];if(w){let Se=I[fe];if(!Se)if(I.fns.some(Oe=>Oe(fe)))Se=fe;else return;ue(fe,be,Se),M(fe,Se)}else ue(fe,be,fe),M(fe,fe)})),hh.next(!0)}),{destroy(){x.forEach(U=>U.unsubscribe());for(let U=0,K=Object.keys(F);U<K.length;U++){const X=K[U];F[X].unsubscribe()}F={}},clear(){n.clear()},clearStore(U){if(Un(U)){jr(n.setItem(p,"{}")).subscribe();return}const K=n.getItem(p);jr(K).subscribe(X=>{const M=s(X||"{}");M[U]&&(delete M[U],jr(n.setItem(p,u(M))).subscribe())})}}}class vh{constructor(t,n){this.query=t,n&&n.resetFn}getQuery(){return this.query}getStore(){return this.getQuery().__store__}isEntityBased(t){return Wu(t)}selectSource(t,n){return this.isEntityBased(t)?this.getQuery().selectEntity(t).pipe(ah()):n?this.getQuery().select(r=>Co(r,this.withStoreName(n))):this.getQuery().select()}getSource(t,n){if(this.isEntityBased(t))return this.getQuery().getEntity(t);const r=this.getQuery().getValue();return n?Co(r,this.withStoreName(n)):r}withStoreName(t){return`${this.storeName}.${t}`}get storeName(){return this.getStore().storeName}updateStore(t,n,r,s=!1){if(this.isEntityBased(n)){const u=this.getStore();s?u.replace(n,t):u.update(n,t)}else{if(r){this.getStore()._setState(c=>Qu(c,this.withStoreName(r),t,!0));return}const u=s?t:c=>({...c,...t});this.getStore()._setState(u)}}onReset(t){const n=this.getStore().reset;this.getStore().reset=(...r)=>{setTimeout(()=>{n.apply(this.getStore(),r),t()})}}}const mh={pagesControls:!1,range:!1,startWith:1,cacheTimeout:void 0,clearStoreWithCache:!0};class yh extends vh{constructor(t,n={}){super(t,{resetFn:()=>{this.initial=!1,this.destroy({clearCache:!0,currentPage:1})}}),this.query=t,this.config=n,this.metadata=new Map,this.pages=new Map,this.pagination={currentPage:1,perPage:0,total:0,lastPage:0,data:[]},this.initial=!0,this.isLoading$=this.query.selectLoading().pipe(Lu(0)),this.config={...mh,...n};const{startWith:r,cacheTimeout:s}=this.config;this.page=new wi(r),xu(s)&&(this.clearCacheSubscription=s.subscribe(()=>this.clearCache()))}get pageChanges(){return this.page.asObservable()}get currentPage(){return this.pagination.currentPage}get isFirst(){return this.currentPage===1}get isLast(){return this.currentPage===this.pagination.lastPage}withControls(){return this.config.pagesControls=!0,this}withRange(){return this.config.range=!0,this}setLoading(t=!0){this.getStore().setLoading(t)}update(t){this.pagination=t,this.addPage(t.data)}addPage(t){this.pages.set(this.currentPage,{ids:t.map(n=>n[this.getStore().idKey])}),this.getStore().upsertMany(t)}clearCache(t={}){this.initial||(dr("@Pagination - Clear Cache"),t.clearStore!==!1&&(this.config.clearStoreWithCache||t.clearStore)&&this.getStore().remove(),this.pages=new Map,this.metadata=new Map),this.initial=!1}clearPage(t){this.pages.delete(t)}destroy({clearCache:t,currentPage:n}={}){this.clearCacheSubscription&&this.clearCacheSubscription.unsubscribe(),t&&this.clearCache(),Hr(n)||this.setPage(n),this.initial=!0}isPageActive(t){return this.currentPage===t}setPage(t){(t!==this.currentPage||!this.hasPage(t))&&this.page.next(this.pagination.currentPage=t)}nextPage(){this.currentPage!==this.pagination.lastPage&&this.setPage(this.pagination.currentPage+1)}prevPage(){this.pagination.currentPage>1&&this.setPage(this.pagination.currentPage-1)}setLastPage(){this.setPage(this.pagination.lastPage)}setFirstPage(){this.setPage(1)}hasPage(t){return this.pages.has(t)}getPage(t){let n=this.pagination.currentPage;return this.hasPage(n)?this.selectPage(n):(this.setLoading(!0),Gr(t()).pipe(ju(r=>(n=r.currentPage,os(()=>{this.setLoading(!1),this.update(r)}),this.selectPage(n)))))}getQuery(){return this.query}refreshCurrentPage(){Un(this.currentPage)===!1&&(this.clearPage(this.currentPage),this.setPage(this.currentPage))}getFrom(){return this.isFirst?1:(this.currentPage-1)*this.pagination.perPage+1}getTo(){return this.isLast?this.pagination.total:this.currentPage*this.pagination.perPage}selectPage(t){return this.query.selectAll({asObject:!0}).pipe(Po(1),kr(n=>{const r={...this.pagination,data:this.pages.get(t).ids.map(c=>n[c])},{range:s,pagesControls:u}=this.config;return isNaN(this.pagination.total)&&(r.lastPage===1?r.total=r.data?r.data.length:0:r.total=r.perPage*r.lastPage,this.pagination.total=r.total),s&&(r.from=this.getFrom(),r.to=this.getTo()),u&&(r.pageControls=_h(this.pagination.total,this.pagination.perPage)),r}))}}Qo([zl("@Pagination - New Page"),vn("design:type",Function),vn("design:paramtypes",[Object]),vn("design:returntype",void 0)],yh.prototype,"update",null);function _h(e,t){const n=Math.ceil(e/t),r=[];for(let s=0;s<n;s++)r.push(s+1);return r}function bh(e){e=Object.assign({},{exclude:[]},e);const n=Object.keys(on);os(()=>{for(const r of n){const s=on[r];e.exclude?e.exclude.indexOf(s.storeName)===-1&&s.reset():s.reset()}})}var Io;(function(e){e.Update="UPDATE"})(Io||(Io={}));Io.Update+"";var pn;(function(e){e.Update="UPDATE",e.AddEntities="ADD_ENTITIES",e.SetEntities="SET_ENTITIES",e.UpdateEntities="UPDATE_ENTITIES",e.RemoveEntities="REMOVE_ENTITIES",e.UpsertEntities="UPSERT_ENTITIES",e.UpsertManyEntities="UPSERT_MANY_ENTITIES"})(pn||(pn={}));pn.Update+"",pn.AddEntities+"",pn.SetEntities+"",pn.UpdateEntities+"",pn.RemoveEntities+"",pn.UpsertEntities+"",pn.UpsertManyEntities+"";const Sh="modulepreload",wh=function(e){return"/benefits/app/"+e},ia={},us=function(t,n,r){if(!n||n.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(n.map(u=>{if(u=wh(u),u in ia)return;ia[u]=!0;const c=u.endsWith(".css"),g=c?'[rel="stylesheet"]':"";if(!!r)for(let d=s.length-1;d>=0;d--){const f=s[d];if(f.href===u&&(!c||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${g}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Sh,c||(h.as="script",h.crossOrigin=""),h.href=u,document.head.appendChild(h),c)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})})).then(()=>t()).catch(u=>{const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=u,window.dispatchEvent(c),!c.defaultPrevented)throw u})};var Qr,me,Xu,Vn,oa,Zu,To,ec,gr={},tc=[],Eh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ji=Array.isArray;function gn(e,t){for(var n in t)e[n]=t[n];return e}function nc(e){var t=e.parentNode;t&&t.removeChild(e)}function et(e,t,n){var r,s,u,c={};for(u in t)u=="key"?r=t[u]:u=="ref"?s=t[u]:c[u]=t[u];if(arguments.length>2&&(c.children=arguments.length>3?Qr.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(u in e.defaultProps)c[u]===void 0&&(c[u]=e.defaultProps[u]);return Vr(e,c,r,s,null)}function Vr(e,t,n,r,s){var u={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:s??++Xu};return s==null&&me.vnode!=null&&me.vnode(u),u}function Ai(){return{current:null}}function xe(e){return e.children}function Vt(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__d||n.__e;return typeof e.type=="function"?Wr(e):null}function rc(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return rc(e)}}function Ro(e){(!e.__d&&(e.__d=!0)&&Vn.push(e)&&!Pi.__r++||oa!==me.debounceRendering)&&((oa=me.debounceRendering)||Zu)(Pi)}function Pi(){var e,t,n,r,s,u,c,g,p;for(Vn.sort(To);e=Vn.shift();)e.__d&&(t=Vn.length,r=void 0,s=void 0,u=void 0,g=(c=(n=e).__v).__e,(p=n.__P)&&(r=[],s=[],(u=gn({},c)).__v=c.__v+1,cs(p,c,u,n.__n,p.ownerSVGElement!==void 0,c.__h!=null?[g]:null,r,g??Wr(c),c.__h,s),ac(r,c,s),c.__e!=g&&rc(c)),Vn.length>t&&Vn.sort(To));Pi.__r=0}function ic(e,t,n,r,s,u,c,g,p,h,d){var f,m,b,w,C,I,R,F,A,x=0,O=r&&r.__k||tc,N=O.length,E=N,U=t.length;for(n.__k=[],f=0;f<U;f++)(w=n.__k[f]=(w=t[f])==null||typeof w=="boolean"||typeof w=="function"?null:typeof w=="string"||typeof w=="number"||typeof w=="bigint"?Vr(null,w,null,null,w):ji(w)?Vr(xe,{children:w},null,null,null):w.__b>0?Vr(w.type,w.props,w.key,w.ref?w.ref:null,w.__v):w)!=null?(w.__=n,w.__b=n.__b+1,(F=Fh(w,O,R=f+x,E))===-1?b=gr:(b=O[F]||gr,O[F]=void 0,E--),cs(e,w,b,s,u,c,g,p,h,d),C=w.__e,(m=w.ref)&&b.ref!=m&&(b.ref&&ls(b.ref,null,w),d.push(m,w.__c||C,w)),C!=null&&(I==null&&(I=C),(A=b===gr||b.__v===null)?F==-1&&x--:F!==R&&(F===R+1?x++:F>R?E>U-R?x+=F-R:x--:x=F<R&&F==R-1?F-R:0),R=f+x,typeof w.type!="function"||F===R&&b.__k!==w.__k?typeof w.type=="function"||F===R&&!A?w.__d!==void 0?(p=w.__d,w.__d=void 0):p=C.nextSibling:p=sc(e,C,p):p=oc(w,p,e),typeof n.type=="function"&&(n.__d=p))):(b=O[f])&&b.key==null&&b.__e&&(b.__e==p&&(b.__=r,p=Wr(b)),Oo(b,b,!1),O[f]=null);for(n.__e=I,f=N;f--;)O[f]!=null&&(typeof n.type=="function"&&O[f].__e!=null&&O[f].__e==n.__d&&(n.__d=O[f].__e.nextSibling),Oo(O[f],O[f]))}function oc(e,t,n){for(var r,s=e.__k,u=0;s&&u<s.length;u++)(r=s[u])&&(r.__=e,t=typeof r.type=="function"?oc(r,t,n):sc(n,r.__e,t));return t}function Qt(e,t){return t=t||[],e==null||typeof e=="boolean"||(ji(e)?e.some(function(n){Qt(n,t)}):t.push(e)),t}function sc(e,t,n){return n==null||n.parentNode!==e?e.insertBefore(t,null):t==n&&t.parentNode!=null||e.insertBefore(t,n),t.nextSibling}function Fh(e,t,n,r){var s=e.key,u=e.type,c=n-1,g=n+1,p=t[n];if(p===null||p&&s==p.key&&u===p.type)return n;if(r>(p!=null?1:0))for(;c>=0||g<t.length;){if(c>=0){if((p=t[c])&&s==p.key&&u===p.type)return c;c--}if(g<t.length){if((p=t[g])&&s==p.key&&u===p.type)return g;g++}}return-1}function Ah(e,t,n,r,s){var u;for(u in n)u==="children"||u==="key"||u in t||ki(e,u,null,n[u],r);for(u in t)s&&typeof t[u]!="function"||u==="children"||u==="key"||u==="value"||u==="checked"||n[u]===t[u]||ki(e,u,t[u],n[u],r)}function sa(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Eh.test(t)?n:n+"px"}function ki(e,t,n,r,s){var u;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||sa(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||sa(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")u=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+u]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,u?ua:aa,u)):e.removeEventListener(t,u?ua:aa,u);else if(t!=="dangerouslySetInnerHTML"){if(s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function aa(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(me.event?me.event(e):e)}function ua(e){return this.l[e.type+!0](me.event?me.event(e):e)}function cs(e,t,n,r,s,u,c,g,p,h){var d,f,m,b,w,C,I,R,F,A,x,O,N,E,U,K=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(p=n.__h,g=t.__e=n.__e,t.__h=null,u=[g]),(d=me.__b)&&d(t);e:if(typeof K=="function")try{if(R=t.props,F=(d=K.contextType)&&r[d.__c],A=d?F?F.props.value:d.__:r,n.__c?I=(f=t.__c=n.__c).__=f.__E:("prototype"in K&&K.prototype.render?t.__c=f=new K(R,A):(t.__c=f=new Vt(R,A),f.constructor=K,f.render=kh),F&&F.sub(f),f.props=R,f.state||(f.state={}),f.context=A,f.__n=r,m=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),K.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=gn({},f.__s)),gn(f.__s,K.getDerivedStateFromProps(R,f.__s))),b=f.props,w=f.state,f.__v=t,m)K.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(K.getDerivedStateFromProps==null&&R!==b&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(R,A),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(R,f.__s,A)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(f.props=R,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(X){X&&(X.__=t)}),x=0;x<f._sb.length;x++)f.__h.push(f._sb[x]);f._sb=[],f.__h.length&&c.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(R,f.__s,A),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(b,w,C)})}if(f.context=A,f.props=R,f.__P=e,f.__e=!1,O=me.__r,N=0,"prototype"in K&&K.prototype.render){for(f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),E=0;E<f._sb.length;E++)f.__h.push(f._sb[E]);f._sb=[]}else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++N<25);f.state=f.__s,f.getChildContext!=null&&(r=gn(gn({},r),f.getChildContext())),m||f.getSnapshotBeforeUpdate==null||(C=f.getSnapshotBeforeUpdate(b,w)),ic(e,ji(U=d!=null&&d.type===xe&&d.key==null?d.props.children:d)?U:[U],t,n,r,s,u,c,g,p,h),f.base=t.__e,t.__h=null,f.__h.length&&c.push(f),I&&(f.__E=f.__=null)}catch(X){t.__v=null,(p||u!=null)&&(t.__e=g,t.__h=!!p,u[u.indexOf(g)]=null),me.__e(X,t,n)}else u==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ph(n.__e,t,n,r,s,u,c,p,h);(d=me.diffed)&&d(t)}function ac(e,t,n){for(var r=0;r<n.length;r++)ls(n[r],n[++r],n[++r]);me.__c&&me.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(u){u.call(s)})}catch(u){me.__e(u,s.__v)}})}function Ph(e,t,n,r,s,u,c,g,p){var h,d,f,m=n.props,b=t.props,w=t.type,C=0;if(w==="svg"&&(s=!0),u!=null){for(;C<u.length;C++)if((h=u[C])&&"setAttribute"in h==!!w&&(w?h.localName===w:h.nodeType===3)){e=h,u[C]=null;break}}if(e==null){if(w===null)return document.createTextNode(b);e=s?document.createElementNS("http://www.w3.org/2000/svg",w):document.createElement(w,b.is&&b),u=null,g=!1}if(w===null)m===b||g&&e.data===b||(e.data=b);else{if(u=u&&Qr.call(e.childNodes),d=(m=n.props||gr).dangerouslySetInnerHTML,f=b.dangerouslySetInnerHTML,!g){if(u!=null)for(m={},C=0;C<e.attributes.length;C++)m[e.attributes[C].name]=e.attributes[C].value;(f||d)&&(f&&(d&&f.__html==d.__html||f.__html===e.innerHTML)||(e.innerHTML=f&&f.__html||""))}if(Ah(e,b,m,s,g),f)t.__k=[];else if(ic(e,ji(C=t.props.children)?C:[C],t,n,r,s&&w!=="foreignObject",u,c,u?u[0]:n.__k&&Wr(n,0),g,p),u!=null)for(C=u.length;C--;)u[C]!=null&&nc(u[C]);g||("value"in b&&(C=b.value)!==void 0&&(C!==e.value||w==="progress"&&!C||w==="option"&&C!==m.value)&&ki(e,"value",C,m.value,!1),"checked"in b&&(C=b.checked)!==void 0&&C!==e.checked&&ki(e,"checked",C,m.checked,!1))}return e}function ls(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){me.__e(r,n)}}function Oo(e,t,n){var r,s;if(me.unmount&&me.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ls(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(u){me.__e(u,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Oo(r[s],t,n||typeof e.type!="function");n||e.__e==null||nc(e.__e),e.__=e.__e=e.__d=void 0}function kh(e,t,n){return this.constructor(e,n)}function Sr(e,t,n){var r,s,u,c;me.__&&me.__(e,t),s=(r=typeof n=="function")?null:n&&n.__k||t.__k,u=[],c=[],cs(t,e=(!r&&n||t).__k=et(xe,null,[e]),s||gr,gr,t.ownerSVGElement!==void 0,!r&&n?[n]:s?null:t.firstChild?Qr.call(t.childNodes):null,u,!r&&n?n:s?s.__e:t.firstChild,r,c),ac(u,e,c)}function fs(e,t){Sr(e,t,fs)}function uc(e,t,n){var r,s,u,c,g=gn({},e.props);for(u in e.type&&e.type.defaultProps&&(c=e.type.defaultProps),t)u=="key"?r=t[u]:u=="ref"?s=t[u]:g[u]=t[u]===void 0&&c!==void 0?c[u]:t[u];return arguments.length>2&&(g.children=arguments.length>3?Qr.call(arguments,2):n),Vr(e.type,g,r||e.key,s||e.ref,null)}function Zt(e,t){var n={__c:t="__cC"+ec++,__:e,Consumer:function(r,s){return r.children(s)},Provider:function(r){var s,u;return this.getChildContext||(s=[],(u={})[t]=this,this.getChildContext=function(){return u},this.shouldComponentUpdate=function(c){this.props.value!==c.value&&s.some(function(g){g.__e=!0,Ro(g)})},this.sub=function(c){s.push(c);var g=c.componentWillUnmount;c.componentWillUnmount=function(){s.splice(s.indexOf(c),1),g&&g.call(c)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Qr=tc.slice,me={__e:function(e,t,n,r){for(var s,u,c;t=t.__;)if((s=t.__c)&&!s.__)try{if((u=s.constructor)&&u.getDerivedStateFromError!=null&&(s.setState(u.getDerivedStateFromError(e)),c=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),c=s.__d),c)return s.__E=s}catch(g){e=g}throw e}},Xu=0,Vt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=gn({},this.state),typeof e=="function"&&(e=e(gn({},n),this.props)),e&&gn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ro(this))},Vt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ro(this))},Vt.prototype.render=xe,Vn=[],Zu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,To=function(e,t){return e.__v.__b-t.__v.__b},Pi.__r=0,ec=0;var bn,Ue,oo,ca,wr=0,cc=[],vi=[],la=me.__b,fa=me.__r,ha=me.diffed,da=me.__c,pa=me.unmount;function tr(e,t){me.__h&&me.__h(Ue,e,wr||t),wr=0;var n=Ue.__H||(Ue.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vi}),n.__[e]}function ht(e){return wr=1,Cr(dc,e)}function Cr(e,t,n){var r=tr(bn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):dc(void 0,t),function(g){var p=r.__N?r.__N[0]:r.__[0],h=r.t(p,g);p!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=Ue,!Ue.u)){var s=function(g,p,h){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(m){return m.__c});if(d.every(function(m){return!m.__N}))return!u||u.call(this,g,p,h);var f=!1;return d.forEach(function(m){if(m.__N){var b=m.__[0];m.__=m.__N,m.__N=void 0,b!==m.__[0]&&(f=!0)}}),!(!f&&r.__c.props===g)&&(!u||u.call(this,g,p,h))};Ue.u=!0;var u=Ue.shouldComponentUpdate,c=Ue.componentWillUpdate;Ue.componentWillUpdate=function(g,p,h){if(this.__e){var d=u;u=void 0,s(g,p,h),u=d}c&&c.call(this,g,p,h)},Ue.shouldComponentUpdate=s}return r.__N||r.__}function Ne(e,t){var n=tr(bn++,3);!me.__s&&hs(n.__H,t)&&(n.__=e,n.i=t,Ue.__H.__h.push(n))}function nr(e,t){var n=tr(bn++,4);!me.__s&&hs(n.__H,t)&&(n.__=e,n.i=t,Ue.__h.push(n))}function Be(e){return wr=5,yt(function(){return{current:e}},[])}function lc(e,t,n){wr=6,nr(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function yt(e,t){var n=tr(bn++,7);return hs(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function lr(e,t){return wr=8,yt(function(){return e},t)}function en(e){var t=Ue.context[e.__c],n=tr(bn++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Ue)),t.props.value):e.__}function fc(e,t){me.useDebugValue&&me.useDebugValue(t?t(e):e)}function Ch(e){var t=tr(bn++,10),n=ht();return t.__=e,Ue.componentDidCatch||(Ue.componentDidCatch=function(r,s){t.__&&t.__(r,s),n[1](r)}),[n[0],function(){n[1](void 0)}]}function hc(){var e=tr(bn++,11);if(!e.__){for(var t=Ue.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ih(){for(var e;e=cc.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mi),e.__H.__h.forEach(No),e.__H.__h=[]}catch(t){e.__H.__h=[],me.__e(t,e.__v)}}me.__b=function(e){Ue=null,la&&la(e)},me.__r=function(e){fa&&fa(e),bn=0;var t=(Ue=e.__c).__H;t&&(oo===Ue?(t.__h=[],Ue.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=vi,n.__N=n.i=void 0})):(t.__h.forEach(mi),t.__h.forEach(No),t.__h=[],bn=0)),oo=Ue},me.diffed=function(e){ha&&ha(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cc.push(t)!==1&&ca===me.requestAnimationFrame||((ca=me.requestAnimationFrame)||Th)(Ih)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vi&&(n.__=n.__V),n.i=void 0,n.__V=vi})),oo=Ue=null},me.__c=function(e,t){t.some(function(n){try{n.__h.forEach(mi),n.__h=n.__h.filter(function(r){return!r.__||No(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],me.__e(r,n.__v)}}),da&&da(e,t)},me.unmount=function(e){pa&&pa(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{mi(r)}catch(s){t=s}}),n.__H=void 0,t&&me.__e(t,n.__v))};var ga=typeof requestAnimationFrame=="function";function Th(e){var t,n=function(){clearTimeout(r),ga&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ga&&(t=requestAnimationFrame(n))}function mi(e){var t=Ue,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ue=t}function No(e){var t=Ue;e.__c=e.__(),Ue=t}function hs(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function dc(e,t){return typeof t=="function"?t(e):t}let ar;const Rh=(e,t)=>{if(ar=void 0,t&&t.type==="click"){if(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0)return e;const n=t.target.closest("a[href]");if(!n||n.origin!=location.origin||/^#/.test(n.getAttribute("href"))||!/^(_?self)?$/i.test(n.target))return e;ar=!0,t.preventDefault(),t=n.href.replace(location.origin,"")}else typeof t=="string"?ar=!0:t=location.pathname+location.search;return ar===!0?history.pushState(null,"",t):ar===!1&&history.replaceState(null,"",t),t};function ds(e){const[t,n]=Cr(Rh,e.url||location.pathname+location.search),r=ar===!0,s=yt(()=>{const u=new URL(t,location.origin),c=u.pathname.replace(/(.)\/$/g,"$1");return{url:t,path:c,query:Object.fromEntries(u.searchParams),route:n,wasPush:r}},[t]);return nr(()=>(addEventListener("click",n),addEventListener("popstate",n),()=>{removeEventListener("click",n),removeEventListener("popstate",n)}),[]),et(ds.ctx.Provider,{value:s},e.children)}Promise.resolve();ds.ctx=Zt({});Zt({});const va=me.__e;me.__e=(e,t,n)=>{if(e&&e.then){let r=t;for(;r=r.__;)if(r.__c&&r.__c.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),t.__k||(t.__k=[]),r.__c.__c(e,t)}va&&va(e,t,n)};let ma;function Oh(e,t){if(typeof window>"u")return;let n=document.querySelector("script[type=isodata]");t=t||n&&n.parentNode||document.body,!ma&&n?fs(e,t):Sr(e,t),ma=!0}function pc(e,t){for(var n in t)e[n]=t[n];return e}function Uo(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function so(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Ci(e){this.props=e}function gc(e,t){function n(s){var u=this.props.ref,c=u==s.ref;return!c&&u&&(u.call?u(null):u.current=null),t?!t(this.props,s)||!c:Uo(this.props,s)}function r(s){return this.shouldComponentUpdate=n,et(e,s)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Ci.prototype=new Vt).isPureReactComponent=!0,Ci.prototype.shouldComponentUpdate=function(e,t){return Uo(this.props,e)||Uo(this.state,t)};var ya=me.__b;me.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ya&&ya(e)};var Nh=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Xr(e){function t(n){var r=pc({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=Nh,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var _a=function(e,t){return e==null?null:Qt(Qt(e).map(t))},vc={map:_a,forEach:_a,count:function(e){return e?Qt(e).length:0},only:function(e){var t=Qt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Qt},Uh=me.__e;me.__e=function(e,t,n,r){if(e.then){for(var s,u=t;u=u.__;)if((s=u.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t)}Uh(e,t,n,r)};var ba=me.unmount;function mc(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=pc({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return mc(r,t,n)})),e}function yc(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return yc(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function vr(){this.__u=0,this.t=null,this.__b=null}function _c(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Zr(e){var t,n,r;function s(u){if(t||(t=e()).then(function(c){n=c.default||c},function(c){r=c}),r)throw r;if(!n)throw t;return et(n,u)}return s.displayName="Lazy",s.__f=!0,s}function fr(){this.u=null,this.o=null}me.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),ba&&ba(e)},(vr.prototype=new Vt).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var s=_c(r.__v),u=!1,c=function(){u||(u=!0,n.__R=null,s?s(g):g())};n.__R=c;var g=function(){if(!--r.__u){if(r.state.__a){var h=r.state.__a;r.__v.__k[0]=yc(h,h.__c.__P,h.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.t.pop();)d.forceUpdate()}},p=t.__h===!0;r.__u++||p||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(c,c)},vr.prototype.componentWillUnmount=function(){this.t=[]},vr.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=mc(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&et(xe,null,e.fallback);return s&&(s.__h=null),[et(xe,null,t.__a?null:e.children),s]};var Sa=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function xh(e){return this.getChildContext=function(){return e.context},e.children}function Dh(e){var t=this,n=e.i;t.componentWillUnmount=function(){Sr(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,s){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Sr(et(xh,{context:t.context},e.__v),t.l)}function bc(e,t){var n=et(Dh,{__v:e,i:t});return n.containerInfo=t,n}(fr.prototype=new Vt).__a=function(e){var t=this,n=_c(t.__v),r=t.o.get(e);return r[0]++,function(s){var u=function(){t.props.revealOrder?(r.push(s),Sa(t,e,r)):s()};n?n(u):u()}},fr.prototype.render=function(e){this.u=null,this.o=new Map;var t=Qt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},fr.prototype.componentDidUpdate=fr.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Sa(e,n,t)})};var Sc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Lh=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Mh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,jh=/[A-Z0-9]/g,Bh=typeof document<"u",Hh=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function wc(e,t,n){return t.__k==null&&(t.textContent=""),Sr(e,t),typeof n=="function"&&n(),e?e.__c:null}function Ec(e,t,n){return fs(e,t),typeof n=="function"&&n(),e?e.__c:null}Vt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Vt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var wa=me.event;function Kh(){}function Vh(){return this.cancelBubble}function qh(){return this.defaultPrevented}me.event=function(e){return wa&&(e=wa(e)),e.persist=Kh,e.isPropagationStopped=Vh,e.isDefaultPrevented=qh,e.nativeEvent=e};var ps,$h={enumerable:!1,configurable:!0,get:function(){return this.class}},Ea=me.vnode;me.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,s={};for(var u in n){var c=n[u];if(!(u==="value"&&"defaultValue"in n&&c==null||Bh&&u==="children"&&r==="noscript"||u==="class"||u==="className")){var g=u.toLowerCase();u==="defaultValue"&&"value"in n&&n.value==null?u="value":u==="download"&&c===!0?c="":g==="ondoubleclick"?u="ondblclick":g!=="onchange"||r!=="input"&&r!=="textarea"||Hh(n.type)?g==="onfocus"?u="onfocusin":g==="onblur"?u="onfocusout":Mh.test(u)?u=g:r.indexOf("-")===-1&&Lh.test(u)?u=u.replace(jh,"-$&").toLowerCase():c===null&&(c=void 0):g=u="oninput",g==="oninput"&&s[u=g]&&(u="oninputCapture"),s[u]=c}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=Qt(n.children).forEach(function(p){p.props.selected=s.value.indexOf(p.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=Qt(n.children).forEach(function(p){p.props.selected=s.multiple?s.defaultValue.indexOf(p.props.value)!=-1:s.defaultValue==p.props.value})),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",$h)):(n.className&&!n.class||n.class&&n.className)&&(s.class=s.className=n.className),t.props=s}(e),e.$$typeof=Sc,Ea&&Ea(e)};var Fa=me.__r;me.__r=function(e){Fa&&Fa(e),ps=e.__c};var Aa=me.diffed;me.diffed=function(e){Aa&&Aa(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),ps=null};var Fc={ReactCurrentDispatcher:{current:{readContext:function(e){return ps.__n[e.__c].props.value}}}},Wh="17.0.2";function Ac(e){return et.bind(null,e)}function Ir(e){return!!e&&e.$$typeof===Sc}function Pc(e){return Ir(e)&&e.type===xe}function gs(e){return Ir(e)?uc.apply(null,arguments):e}function kc(e){return!!e.__k&&(Sr(null,e),!0)}function Cc(e){return e&&(e.base||e.nodeType===1&&e)||null}var Ic=function(e,t){return e(t)},Tc=function(e,t){return e(t)},Rc=xe;function vs(e){e()}function Oc(e){return e}function Nc(){return[!1,vs]}var Uc=nr,xc=Ir;function Dc(e,t){var n=t(),r=ht({h:{__:n,v:t}}),s=r[0].h,u=r[1];return nr(function(){s.__=n,s.v=t,so(s.__,t())||u({h:s})},[e,n,t]),Ne(function(){return so(s.__,s.v())||u({h:s}),e(function(){so(s.__,s.v())||u({h:s})})},[e]),n}var Ye={useState:ht,useId:hc,useReducer:Cr,useEffect:Ne,useLayoutEffect:nr,useInsertionEffect:Uc,useTransition:Nc,useDeferredValue:Oc,useSyncExternalStore:Dc,startTransition:vs,useRef:Be,useImperativeHandle:lc,useMemo:yt,useCallback:lr,useContext:en,useDebugValue:fc,version:"17.0.2",Children:vc,render:wc,hydrate:Ec,unmountComponentAtNode:kc,createPortal:bc,createElement:et,createContext:Zt,createFactory:Ac,cloneElement:gs,createRef:Ai,Fragment:xe,isValidElement:Ir,isElement:xc,isFragment:Pc,findDOMNode:Cc,Component:Vt,PureComponent:Ci,memo:gc,forwardRef:Xr,flushSync:Tc,unstable_batchedUpdates:Ic,StrictMode:Rc,Suspense:vr,SuspenseList:fr,lazy:Zr,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fc};const Pa=Object.freeze(Object.defineProperty({__proto__:null,Children:vc,Component:Vt,Fragment:xe,PureComponent:Ci,StrictMode:Rc,Suspense:vr,SuspenseList:fr,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fc,cloneElement:gs,createContext:Zt,createElement:et,createFactory:Ac,createPortal:bc,createRef:Ai,default:Ye,findDOMNode:Cc,flushSync:Tc,forwardRef:Xr,hydrate:Ec,isElement:xc,isFragment:Pc,isValidElement:Ir,lazy:Zr,memo:gc,render:wc,startTransition:vs,unmountComponentAtNode:kc,unstable_batchedUpdates:Ic,useCallback:lr,useContext:en,useDebugValue:fc,useDeferredValue:Oc,useEffect:Ne,useErrorBoundary:Ch,useId:hc,useImperativeHandle:lc,useInsertionEffect:Uc,useLayoutEffect:nr,useMemo:yt,useReducer:Cr,useRef:Be,useState:ht,useSyncExternalStore:Dc,useTransition:Nc,version:Wh},Symbol.toStringTag,{value:"Module"}));var Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jv(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Mc={exports:{}};(function(e,t){(function(){function n(){var r=window,s=document;if("scrollBehavior"in s.documentElement.style&&r.__forceSmoothScrollPolyfill__!==!0)return;var u=r.HTMLElement||r.Element,c=468,g={scroll:r.scroll||r.scrollTo,scrollBy:r.scrollBy,elementScroll:u.prototype.scroll||f,scrollIntoView:u.prototype.scrollIntoView},p=r.performance&&r.performance.now?r.performance.now.bind(r.performance):Date.now;function h(x){var O=["MSIE ","Trident/","Edge/"];return new RegExp(O.join("|")).test(x)}var d=h(r.navigator.userAgent)?1:0;function f(x,O){this.scrollLeft=x,this.scrollTop=O}function m(x){return .5*(1-Math.cos(Math.PI*x))}function b(x){if(x===null||typeof x!="object"||x.behavior===void 0||x.behavior==="auto"||x.behavior==="instant")return!0;if(typeof x=="object"&&x.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+x.behavior+" is not a valid value for enumeration ScrollBehavior.")}function w(x,O){if(O==="Y")return x.clientHeight+d<x.scrollHeight;if(O==="X")return x.clientWidth+d<x.scrollWidth}function C(x,O){var N=r.getComputedStyle(x,null)["overflow"+O];return N==="auto"||N==="scroll"}function I(x){var O=w(x,"Y")&&C(x,"Y"),N=w(x,"X")&&C(x,"X");return O||N}function R(x){for(;x!==s.body&&I(x)===!1;)x=x.parentNode||x.host;return x}function F(x){var O=p(),N,E,U,K=(O-x.startTime)/c;K=K>1?1:K,N=m(K),E=x.startX+(x.x-x.startX)*N,U=x.startY+(x.y-x.startY)*N,x.method.call(x.scrollable,E,U),(E!==x.x||U!==x.y)&&r.requestAnimationFrame(F.bind(r,x))}function A(x,O,N){var E,U,K,X,M=p();x===s.body?(E=r,U=r.scrollX||r.pageXOffset,K=r.scrollY||r.pageYOffset,X=g.scroll):(E=x,U=x.scrollLeft,K=x.scrollTop,X=f),F({scrollable:E,method:X,startTime:M,startX:U,startY:K,x:O,y:N})}r.scroll=r.scrollTo=function(){if(arguments[0]!==void 0){if(b(arguments[0])===!0){g.scroll.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:r.scrollY||r.pageYOffset);return}A.call(r,s.body,arguments[0].left!==void 0?~~arguments[0].left:r.scrollX||r.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:r.scrollY||r.pageYOffset)}},r.scrollBy=function(){if(arguments[0]!==void 0){if(b(arguments[0])){g.scrollBy.call(r,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}A.call(r,s.body,~~arguments[0].left+(r.scrollX||r.pageXOffset),~~arguments[0].top+(r.scrollY||r.pageYOffset))}},u.prototype.scroll=u.prototype.scrollTo=function(){if(arguments[0]!==void 0){if(b(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");g.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}var x=arguments[0].left,O=arguments[0].top;A.call(this,this,typeof x>"u"?this.scrollLeft:~~x,typeof O>"u"?this.scrollTop:~~O)}},u.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(b(arguments[0])===!0){g.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},u.prototype.scrollIntoView=function(){if(b(arguments[0])===!0){g.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}var x=R(this),O=x.getBoundingClientRect(),N=this.getBoundingClientRect();x!==s.body?(A.call(this,x,x.scrollLeft+N.left-O.left,x.scrollTop+N.top-O.top),r.getComputedStyle(x).position!=="fixed"&&r.scrollBy({left:O.left,top:O.top,behavior:"smooth"})):r.scrollBy({left:N.left,top:N.top,behavior:"smooth"})}}e.exports={polyfill:n}})()})(Mc);var Jh=Mc.exports;const zh=Lc(Jh);as.prototype.selectCached=function(e,t=n=>null){return this.selectHasCache().pipe(Lu(0),ju(n=>n?mu:Gr(e()).pipe(Mf(t))))};globalThis&&globalThis.__spreadArray;function Yh(e){return e}function Gh(e){return function(){return e}}var Qh=Gh(void 0);function jc(e,t,n,r,s,u,c,g,p){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return s(r(n(t(e))));case 6:return u(s(r(n(t(e)))));case 7:return c(u(s(r(n(t(e))))));case 8:return g(c(u(s(r(n(t(e)))))));case 9:return p(g(c(u(s(r(n(t(e))))))));default:{for(var h=arguments[0],d=1;d<arguments.length;d++)h=arguments[d](h);return h}}}globalThis&&globalThis.__spreadArray;var Xh=function(e){return e._tag==="Some"},Zh={_tag:"None"},ed=function(e){return{_tag:"Some",value:e}},It=Zh,Bi=ed,zv=function(e){return function(t){return xn(t)?It:Bi(e(t.value))}},$n=Xh,xn=function(e){return e._tag==="None"},td=function(e,t){return function(n){return xn(n)?e():t(n.value)}},Bc=td,Hc=Bc,nd=function(e){return function(t){return xn(t)?e():t.value}},rd=nd,sn=function(e){return e==null?It:Bi(e)},Yv=function(e){return function(t){return xn(t)?It:sn(e(t.value))}},Gv=Bc(Qh,Yh);function Ii(){return Ii=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ii.apply(this,arguments)}var hr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(hr||(hr={}));var ka=function(e){return e},Ca="beforeunload",id="hashchange",od="popstate";function sd(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,s=r.history;function u(){var U=Ra(r.location.hash.substr(1)),K=U.pathname,X=K===void 0?"/":K,M=U.search,ue=M===void 0?"":M,fe=U.hash,be=fe===void 0?"":fe,Se=s.state||{};return[Se.idx,ka({pathname:X,search:ue,hash:be,state:Se.usr||null,key:Se.key||"default"})]}var c=null;function g(){if(c)b.call(c),c=null;else{var U=hr.Pop,K=u(),X=K[0],M=K[1];if(b.length){if(X!=null){var ue=d-X;ue&&(c={action:U,location:M,retry:function(){N(ue*-1)}},N(ue))}}else A(U)}}r.addEventListener(od,g),r.addEventListener(id,function(){var U=u(),K=U[1];ao(K)!==ao(f)&&g()});var p=hr.Pop,h=u(),d=h[0],f=h[1],m=Ta(),b=Ta();d==null&&(d=0,s.replaceState(Ii({},s.state,{idx:d}),""));function w(){var U=document.querySelector("base"),K="";if(U&&U.getAttribute("href")){var X=r.location.href,M=X.indexOf("#");K=M===-1?X:X.slice(0,M)}return K}function C(U){return w()+"#"+(typeof U=="string"?U:ao(U))}function I(U,K){return K===void 0&&(K=null),ka(Ii({pathname:f.pathname,hash:"",search:""},typeof U=="string"?Ra(U):U,{state:K,key:ad()}))}function R(U,K){return[{usr:U.state,key:U.key,idx:K},C(U)]}function F(U,K,X){return!b.length||(b.call({action:U,location:K,retry:X}),!1)}function A(U){p=U;var K=u();d=K[0],f=K[1],m.call({action:p,location:f})}function x(U,K){var X=hr.Push,M=I(U,K);function ue(){x(U,K)}if(F(X,M,ue)){var fe=R(M,d+1),be=fe[0],Se=fe[1];try{s.pushState(be,"",Se)}catch{r.location.assign(Se)}A(X)}}function O(U,K){var X=hr.Replace,M=I(U,K);function ue(){O(U,K)}if(F(X,M,ue)){var fe=R(M,d),be=fe[0],Se=fe[1];s.replaceState(be,"",Se),A(X)}}function N(U){s.go(U)}var E={get action(){return p},get location(){return f},createHref:C,push:x,replace:O,go:N,back:function(){N(-1)},forward:function(){N(1)},listen:function(K){return m.push(K)},block:function(K){var X=b.push(K);return b.length===1&&r.addEventListener(Ca,Ia),function(){X(),b.length||r.removeEventListener(Ca,Ia)}}};return E}function Ia(e){e.preventDefault(),e.returnValue=""}function Ta(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function ad(){return Math.random().toString(36).substr(2,8)}function ao(e){var t=e.pathname,n=t===void 0?"/":t,r=e.search,s=r===void 0?"":r,u=e.hash,c=u===void 0?"":u;return s&&s!=="?"&&(n+=s.charAt(0)==="?"?s:"?"+s),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function Ra(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var ud={};function Kc(e,t){for(var n in t)e[n]=t[n];return e}function Vc(e,t,n){var r=/(?:\?([^#]*))?(#.*)?$/,s=e.match(r),u={},c;if(s&&s[1])for(var g=s[1].split("&"),p=0;p<g.length;p++){var h=g[p].split("=");u[decodeURIComponent(h[0])]=decodeURIComponent(h.slice(1).join("="))}e=xo(e.replace(r,"")),t=xo(t||"");for(var d=Math.max(e.length,t.length),f=0;f<d;f++)if(t[f]&&t[f].charAt(0)===":"){var m=t[f].replace(/(^:|[+*?]+$)/g,""),b=(t[f].match(/[+*?]+$/)||ud)[0]||"",w=~b.indexOf("+"),C=~b.indexOf("*"),I=e[f]||"";if(!I&&!C&&(b.indexOf("?")<0||w)){c=!1;break}if(u[m]=decodeURIComponent(I),w||C){u[m]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){c=!1;break}return n.default!==!0&&c===!1?!1:u}function cd(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function ld(e,t){return e.index=t,e.rank=dd(e),e.props}function xo(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function fd(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}function hd(e){return xo(e).map(fd).join("")}function dd(e){return e.props.default?0:hd(e.props.path)}var Lt=null,Wn=[],Do=[],pd={};function gd(e,t){t===void 0&&(t="push"),Lt&&Lt[t]?Lt[t](e):typeof history<"u"&&history[t+"State"]&&history[t+"State"](null,null,e)}function Hi(){var e;return Lt&&Lt.location?e=Lt.location:Lt&&Lt.getCurrentLocation?e=Lt.getCurrentLocation():e=typeof location<"u"?location:pd,""+(e.pathname||"")+(e.search||"")}function Qn(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),vd(e)&&gd(e,t?"replace":"push"),qc(e)}function vd(e){for(var t=Wn.length;t--;)if(Wn[t].canRoute(e))return!0;return!1}function qc(e){for(var t=!1,n=0;n<Wn.length;n++)Wn[n].routeTo(e)===!0&&(t=!0);for(var r=Do.length;r--;)Do[r](e);return t}function $c(e){if(!(!e||!e.getAttribute)){var t=e.getAttribute("href"),n=e.getAttribute("target");if(!(!t||!t.match(/^\//g)||n&&!n.match(/^_?self$/i)))return Qn(t)}}function md(e){if(!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.button!==0))return $c(e.currentTarget||e.target||this),Wc(e)}function Wc(e){return e&&(e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault()),!1}function yd(e){if(!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.button!==0)){var t=e.target;do if(String(t.nodeName).toUpperCase()==="A"&&t.getAttribute("href")){if(t.hasAttribute("native"))return;if($c(t))return Wc(e)}while(t=t.parentNode)}}var Oa=!1;function _d(){Oa||(typeof addEventListener=="function"&&(Lt||addEventListener("popstate",function(){qc(Hi())}),addEventListener("click",yd)),Oa=!0)}var Sn=function(e){function t(n){e.call(this,n),n.history&&(Lt=n.history),this.state={url:n.url||Hi()},_d()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.shouldComponentUpdate=function(r){return r.static!==!0?!0:r.url!==this.props.url||r.onChange!==this.props.onChange},t.prototype.canRoute=function(r){var s=Qt(this.props.children);return this.getMatchingChildren(s,r,!1).length>0},t.prototype.routeTo=function(r){this.setState({url:r});var s=this.canRoute(r);return this.updating||this.forceUpdate(),s},t.prototype.componentWillMount=function(){Wn.push(this),this.updating=!0},t.prototype.componentDidMount=function(){var r=this;Lt&&(this.unlisten=Lt.listen(function(s){r.routeTo(""+(s.pathname||"")+(s.search||""))})),this.updating=!1},t.prototype.componentWillUnmount=function(){typeof this.unlisten=="function"&&this.unlisten(),Wn.splice(Wn.indexOf(this),1)},t.prototype.componentWillUpdate=function(){this.updating=!0},t.prototype.componentDidUpdate=function(){this.updating=!1},t.prototype.getMatchingChildren=function(r,s,u){return r.filter(ld).sort(cd).map(function(c){var g=Vc(s,c.props.path,c.props);if(g){if(u!==!1){var p={url:s,matches:g};return Kc(p,g),delete p.ref,delete p.key,uc(c,p)}return c}}).filter(Boolean)},t.prototype.render=function(r,s){var u=r.children,c=r.onChange,g=s.url,p=this.getMatchingChildren(Qt(u),g,!0),h=p[0]||null,d=this.previousUrl;return g!==d&&(this.previousUrl=g,typeof c=="function"&&c({router:this,url:g,previous:d,active:p,current:h})),h},t}(Vt),bd=function(e){return et("a",Kc({onClick:md},e))},ur=function(e){return et(e.component,e)};Sn.subscribers=Do;Sn.getCurrentUrl=Hi;Sn.route=Qn;Sn.Router=Sn;Sn.Route=ur;Sn.Link=bd;Sn.exec=Vc;const Sd="application/json",Jc="Content-Type",sr=Symbol(),zc=Symbol();function Na(e={}){var t;return(t=Object.entries(e).find(([n])=>n.toLowerCase()===Jc.toLowerCase()))===null||t===void 0?void 0:t[1]}function Ua(e){return/^application\/.*json.*/.test(e)}const Jn=function(e,t,n=!1){return Object.entries(t).reduce((r,[s,u])=>{const c=e[s];return Array.isArray(c)&&Array.isArray(u)?r[s]=n?[...c,...u]:u:typeof c=="object"&&typeof u=="object"?r[s]=Jn(c,u,n):r[s]=u,r},{...e})},Er={options:{},errorType:"text",polyfills:{},polyfill(e,t=!0,n=!1,...r){const s=this.polyfills[e]||(typeof self<"u"?self[e]:null)||(typeof global<"u"?global[e]:null);if(t&&!s)throw new Error(e+" is not defined");return n&&s?new s(...r):s}};function wd(e,t=!1){Er.options=t?e:Jn(Er.options,e)}function Ed(e,t=!1){Er.polyfills=t?e:Jn(Er.polyfills,e)}function Fd(e){Er.errorType=e}const Ad=e=>t=>e.reduceRight((n,r)=>r(n),t)||t;class Yc extends Error{}const Pd=e=>{const t=Object.create(null);e=e._addons.reduce((A,x)=>x.beforeRequest&&x.beforeRequest(A,e._options,t)||A,e);const{_url:n,_options:r,_config:s,_catchers:u,_resolvers:c,_middlewares:g,_addons:p}=e,h=new Map(u),d=Jn(s.options,r);let f=n;const m=Ad(g)((A,x)=>(f=A,s.polyfill("fetch")(A,x)))(n,d),b=new Error,w=m.catch(A=>{throw{[sr]:A}}).then(A=>{if(!A.ok){const x=new Yc;if(x.cause=b,x.stack=x.stack+`
4
- CAUSE: `+b.stack,x.response=A,x.url=f,A.type==="opaque")throw x;return A.text().then(O=>{var N;if(x.message=O,s.errorType==="json"||((N=A.headers.get("Content-Type"))===null||N===void 0?void 0:N.split(";")[0])==="application/json")try{x.json=JSON.parse(O)}catch{}throw x.text=O,x.status=A.status,x})}return A}),C=A=>A.catch(x=>{const O=x.hasOwnProperty(sr),N=O?x[sr]:x,E=(N==null?void 0:N.status)&&h.get(N.status)||h.get(N==null?void 0:N.name)||O&&h.has(sr)&&h.get(sr);if(E)return E(N,e);const U=h.get(zc);if(U)return U(N,e);throw N}),I=A=>x=>C(A?w.then(O=>O&&O[A]()).then(O=>x?x(O):O):w.then(O=>x?x(O):O)),R={_wretchReq:e,_fetchReq:m,_sharedState:t,res:I(null),json:I("json"),blob:I("blob"),formData:I("formData"),arrayBuffer:I("arrayBuffer"),text:I("text"),error(A,x){return h.set(A,x),this},badRequest(A){return this.error(400,A)},unauthorized(A){return this.error(401,A)},forbidden(A){return this.error(403,A)},notFound(A){return this.error(404,A)},timeout(A){return this.error(408,A)},internalError(A){return this.error(500,A)},fetchError(A){return this.error(sr,A)}},F=p.reduce((A,x)=>({...A,...x.resolver}),R);return c.reduce((A,x)=>x(A,e),F)},kd={_url:"",_options:{},_config:Er,_catchers:new Map,_resolvers:[],_deferred:[],_middlewares:[],_addons:[],addon(e){return{...this,_addons:[...this._addons,e],...e.wretch}},errorType(e){return{...this,_config:{...this._config,errorType:e}}},polyfills(e,t=!1){return{...this,_config:{...this._config,polyfills:t?e:Jn(this._config.polyfills,e)}}},url(e,t=!1){if(t)return{...this,_url:e};const n=this._url.split("?");return{...this,_url:n.length>1?n[0]+e+"?"+n[1]:this._url+e}},options(e,t=!1){return{...this,_options:t?e:Jn(this._options,e)}},headers(e){return{...this,_options:Jn(this._options,{headers:e||{}})}},accept(e){return this.headers({Accept:e})},content(e){return this.headers({[Jc]:e})},auth(e){return this.headers({Authorization:e})},catcher(e,t){const n=new Map(this._catchers);return n.set(e,t),{...this,_catchers:n}},catcherFallback(e){return this.catcher(zc,e)},resolve(e,t=!1){return{...this,_resolvers:t?[e]:[...this._resolvers,e]}},defer(e,t=!1){return{...this,_deferred:t?[e]:[...this._deferred,e]}},middlewares(e,t=!1){return{...this,_middlewares:t?e:[...this._middlewares,...e]}},fetch(e=this._options.method,t="",n=null){let r=this.url(t).options({method:e});const s=Na(r._options.headers),u=typeof n=="object"&&(!r._options.headers||!s||Ua(s));return r=n?u?r.json(n,s):r.body(n):r,Pd(r._deferred.reduce((c,g)=>g(c,c._url,c._options),r))},get(e=""){return this.fetch("GET",e)},delete(e=""){return this.fetch("DELETE",e)},put(e,t=""){return this.fetch("PUT",t,e)},post(e,t=""){return this.fetch("POST",t,e)},patch(e,t=""){return this.fetch("PATCH",t,e)},head(e=""){return this.fetch("HEAD",e)},opts(e=""){return this.fetch("OPTIONS",e)},body(e){return{...this,_options:{...this._options,body:e}}},json(e,t){const n=Na(this._options.headers);return this.content(t||Ua(n)&&n||Sd).body(JSON.stringify(e))}};function wn(e="",t={}){return{...kd,_url:e,_options:t}}wn.default=wn;wn.options=wd;wn.errorType=Fd;wn.polyfills=Ed;wn.WretchError=Yc;class Xn{static setParameters(t,n){this._apiBaseUrl=t,this._jwt=n}static get instance(){return wn(this._apiBaseUrl).headers({Authorization:`Bearer ${this._jwt}`})}}ze(Xn,"_apiBaseUrl"),ze(Xn,"_jwt");class Cd extends Xn{}class qr{static setParameters(t,n,r){this._apiBaseUrl=t,this._jwt=n,this._profileId=r}static get instance(){return wn(this._apiBaseUrl).headers({Authorization:`Bearer ${this._jwt}`,"X-PROFILE-ID":this._profileId})}}ze(qr,"_apiBaseUrl"),ze(qr,"_jwt"),ze(qr,"_profileId");var Id=0;function le(e,t,n,r,s,u){var c,g,p={};for(g in t)g=="ref"?c=t[g]:p[g]=t[g];var h={type:e,props:p,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Id,__source:s,__self:u};if(typeof e=="function"&&(c=e.defaultProps))for(g in c)p[g]===void 0&&(p[g]=c[g]);return me.vnode&&me.vnode(h),h}const Td=({size:e})=>le("svg",{className:`animate-spin h-${e??5} w-${e??5}`,viewBox:"0 0 24 24",fill:"none",children:[le("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),le("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),Ki=()=>le("div",{className:"flex justify-center items-center h-screen text-primary",children:[le(Td,{size:5}),le("div",{className:"pl-3 text-xl font-light text-primary",children:"Loading..."})]}),Gc="/benefits/app/assets/logo-a34e9b4b.png",Rd=()=>le("div",{className:"flex flex-col justify-center items-center h-screen text-grey-900",children:[le("img",{className:"block h-8 w-auto",src:Gc,alt:"Flare Benefits"}),le("h1",{className:"mt-8",children:"You have been successfully logged out of Flare Benefits"})]});var Bt={};(function(e){var t=Ie&&Ie.__spreadArray||function(E,U,K){if(K||arguments.length===2)for(var X=0,M=U.length,ue;X<M;X++)(ue||!(X in U))&&(ue||(ue=Array.prototype.slice.call(U,0,X)),ue[X]=U[X]);return E.concat(ue||Array.prototype.slice.call(U))};Object.defineProperty(e,"__esModule",{value:!0}),e.dual=e.getEndomorphismMonoid=e.not=e.SK=e.hole=e.pipe=e.untupled=e.tupled=e.absurd=e.decrement=e.increment=e.tuple=e.flow=e.flip=e.constVoid=e.constUndefined=e.constNull=e.constFalse=e.constTrue=e.constant=e.unsafeCoerce=e.identity=e.apply=e.getRing=e.getSemiring=e.getMonoid=e.getSemigroup=e.getBooleanAlgebra=void 0;var n=function(E){return function(){return{meet:function(U,K){return function(X){return E.meet(U(X),K(X))}},join:function(U,K){return function(X){return E.join(U(X),K(X))}},zero:function(){return E.zero},one:function(){return E.one},implies:function(U,K){return function(X){return E.implies(U(X),K(X))}},not:function(U){return function(K){return E.not(U(K))}}}}};e.getBooleanAlgebra=n;var r=function(E){return function(){return{concat:function(U,K){return function(X){return E.concat(U(X),K(X))}}}}};e.getSemigroup=r;var s=function(E){var U=(0,e.getSemigroup)(E);return function(){return{concat:U().concat,empty:function(){return E.empty}}}};e.getMonoid=s;var u=function(E){return{add:function(U,K){return function(X){return E.add(U(X),K(X))}},zero:function(){return E.zero},mul:function(U,K){return function(X){return E.mul(U(X),K(X))}},one:function(){return E.one}}};e.getSemiring=u;var c=function(E){var U=(0,e.getSemiring)(E);return{add:U.add,mul:U.mul,one:U.one,zero:U.zero,sub:function(K,X){return function(M){return E.sub(K(M),X(M))}}}};e.getRing=c;var g=function(E){return function(U){return U(E)}};e.apply=g;function p(E){return E}e.identity=p,e.unsafeCoerce=p;function h(E){return function(){return E}}e.constant=h,e.constTrue=h(!0),e.constFalse=h(!1),e.constNull=h(null),e.constUndefined=h(void 0),e.constVoid=e.constUndefined;function d(E){return function(){for(var U=[],K=0;K<arguments.length;K++)U[K]=arguments[K];return U.length>1?E(U[1],U[0]):function(X){return E(X)(U[0])}}}e.flip=d;function f(E,U,K,X,M,ue,fe,be,Se){switch(arguments.length){case 1:return E;case 2:return function(){return U(E.apply(this,arguments))};case 3:return function(){return K(U(E.apply(this,arguments)))};case 4:return function(){return X(K(U(E.apply(this,arguments))))};case 5:return function(){return M(X(K(U(E.apply(this,arguments)))))};case 6:return function(){return ue(M(X(K(U(E.apply(this,arguments))))))};case 7:return function(){return fe(ue(M(X(K(U(E.apply(this,arguments)))))))};case 8:return function(){return be(fe(ue(M(X(K(U(E.apply(this,arguments))))))))};case 9:return function(){return Se(be(fe(ue(M(X(K(U(E.apply(this,arguments)))))))))}}}e.flow=f;function m(){for(var E=[],U=0;U<arguments.length;U++)E[U]=arguments[U];return E}e.tuple=m;function b(E){return E+1}e.increment=b;function w(E){return E-1}e.decrement=w;function C(E){throw new Error("Called `absurd` function which should be uncallable")}e.absurd=C;function I(E){return function(U){return E.apply(void 0,U)}}e.tupled=I;function R(E){return function(){for(var U=[],K=0;K<arguments.length;K++)U[K]=arguments[K];return E(U)}}e.untupled=R;function F(E,U,K,X,M,ue,fe,be,Se){switch(arguments.length){case 1:return E;case 2:return U(E);case 3:return K(U(E));case 4:return X(K(U(E)));case 5:return M(X(K(U(E))));case 6:return ue(M(X(K(U(E)))));case 7:return fe(ue(M(X(K(U(E))))));case 8:return be(fe(ue(M(X(K(U(E)))))));case 9:return Se(be(fe(ue(M(X(K(U(E))))))));default:{for(var Ce=arguments[0],Oe=1;Oe<arguments.length;Oe++)Ce=arguments[Oe](Ce);return Ce}}}e.pipe=F,e.hole=C;var A=function(E,U){return U};e.SK=A;function x(E){return function(U){return!E(U)}}e.not=x;var O=function(){return{concat:function(E,U){return f(E,U)},empty:p}};e.getEndomorphismMonoid=O;var N=function(E,U){var K=typeof E=="number"?function(X){return X.length>=E}:E;return function(){var X=Array.from(arguments);return K(arguments)?U.apply(this,X):function(M){return U.apply(void 0,t([M],X,!1))}}};e.dual=N})(Bt);function zt(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(s){return"'"+s+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Fr(e){return!!e&&!!e[Mt]}function Zn(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var s=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return s===Object||typeof s=="function"&&Function.toString.call(s)===jd}(e)||Array.isArray(e)||!!e[Ka]||!!(!((t=e.constructor)===null||t===void 0)&&t[Ka])||ms(e)||ys(e))}function Jr(e,t,n){n===void 0&&(n=!1),Tr(e)===0?(n?Object.keys:Es)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,s){return t(s,r,e)})}function Tr(e){var t=e[Mt];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:ms(e)?2:ys(e)?3:0}function Lo(e,t){return Tr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Od(e,t){return Tr(e)===2?e.get(t):e[t]}function Qc(e,t,n){var r=Tr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Nd(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function ms(e){return Ld&&e instanceof Map}function ys(e){return Md&&e instanceof Set}function Hn(e){return e.o||e.t}function _s(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Bd(e);delete t[Mt];for(var n=Es(t),r=0;r<n.length;r++){var s=n[r],u=t[s];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(t[s]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[s]})}return Object.create(Object.getPrototypeOf(e),t)}function bs(e,t){return t===void 0&&(t=!1),Ss(e)||Fr(e)||!Zn(e)||(Tr(e)>1&&(e.set=e.add=e.clear=e.delete=Ud),Object.freeze(e),t&&Jr(e,function(n,r){return bs(r,!0)},!0)),e}function Ud(){zt(2)}function Ss(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function an(e){var t=Hd[e];return t||zt(18,e),t}function xa(){return zr}function uo(e,t){t&&(an("Patches"),e.u=[],e.s=[],e.v=t)}function Ti(e){Mo(e),e.p.forEach(xd),e.p=null}function Mo(e){e===zr&&(zr=e.l)}function Da(e){return zr={p:[],l:zr,h:e,m:!0,_:0}}function xd(e){var t=e[Mt];t.i===0||t.i===1?t.j():t.g=!0}function co(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||an("ES5").S(t,e,r),r?(n[Mt].P&&(Ti(t),zt(4)),Zn(e)&&(e=Ri(t,e),t.l||Oi(t,e)),t.u&&an("Patches").M(n[Mt].t,e,t.u,t.s)):e=Ri(t,n,[]),Ti(t),t.u&&t.v(t.u,t.s),e!==Xc?e:void 0}function Ri(e,t,n){if(Ss(t))return t;var r=t[Mt];if(!r)return Jr(t,function(g,p){return La(e,r,t,g,p,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Oi(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var s=r.i===4||r.i===5?r.o=_s(r.k):r.o,u=s,c=!1;r.i===3&&(u=new Set(s),s.clear(),c=!0),Jr(u,function(g,p){return La(e,r,s,g,p,n,c)}),Oi(e,s,!1),n&&e.u&&an("Patches").N(r,n,e.u,e.s)}return r.o}function La(e,t,n,r,s,u,c){if(Fr(s)){var g=Ri(e,s,u&&t&&t.i!==3&&!Lo(t.R,r)?u.concat(r):void 0);if(Qc(n,r,g),!Fr(g))return;e.m=!1}else c&&n.add(s);if(Zn(s)&&!Ss(s)){if(!e.h.D&&e._<1)return;Ri(e,s),t&&t.A.l||Oi(e,s)}}function Oi(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&bs(t,n)}function lo(e,t){var n=e[Mt];return(n?Hn(n):e)[t]}function Ma(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function jo(e){e.P||(e.P=!0,e.l&&jo(e.l))}function fo(e){e.o||(e.o=_s(e.t))}function Bo(e,t,n){var r=ms(t)?an("MapSet").F(t,n):ys(t)?an("MapSet").T(t,n):e.O?function(s,u){var c=Array.isArray(s),g={i:c?1:0,A:u?u.A:xa(),P:!1,I:!1,R:{},l:u,t:s,k:null,o:null,j:null,C:!1},p=g,h=Ho;c&&(p=[g],h=Kr);var d=Proxy.revocable(p,h),f=d.revoke,m=d.proxy;return g.k=m,g.j=f,m}(t,n):an("ES5").J(t,n);return(n?n.A:xa()).p.push(r),r}function Dd(e){return Fr(e)||zt(22,e),function t(n){if(!Zn(n))return n;var r,s=n[Mt],u=Tr(n);if(s){if(!s.P&&(s.i<4||!an("ES5").K(s)))return s.t;s.I=!0,r=ja(n,u),s.I=!1}else r=ja(n,u);return Jr(r,function(c,g){s&&Od(s.t,c)===g||Qc(r,c,t(g))}),u===3?new Set(r):r}(e)}function ja(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return _s(e)}var Ba,zr,ws=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Ld=typeof Map<"u",Md=typeof Set<"u",Ha=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Xc=ws?Symbol.for("immer-nothing"):((Ba={})["immer-nothing"]=!0,Ba),Ka=ws?Symbol.for("immer-draftable"):"__$immer_draftable",Mt=ws?Symbol.for("immer-state"):"__$immer_state",jd=""+Object.prototype.constructor,Es=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Bd=Object.getOwnPropertyDescriptors||function(e){var t={};return Es(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},Hd={},Ho={get:function(e,t){if(t===Mt)return e;var n=Hn(e);if(!Lo(n,t))return function(s,u,c){var g,p=Ma(u,c);return p?"value"in p?p.value:(g=p.get)===null||g===void 0?void 0:g.call(s.k):void 0}(e,n,t);var r=n[t];return e.I||!Zn(r)?r:r===lo(e.t,t)?(fo(e),e.o[t]=Bo(e.A.h,r,e)):r},has:function(e,t){return t in Hn(e)},ownKeys:function(e){return Reflect.ownKeys(Hn(e))},set:function(e,t,n){var r=Ma(Hn(e),t);if(r!=null&&r.set)return r.set.call(e.k,n),!0;if(!e.P){var s=lo(Hn(e),t),u=s==null?void 0:s[Mt];if(u&&u.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(Nd(n,s)&&(n!==void 0||Lo(e.t,t)))return!0;fo(e),jo(e)}return e.o[t]===n&&(n!==void 0||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return lo(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,fo(e),jo(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Hn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){zt(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){zt(12)}},Kr={};Jr(Ho,function(e,t){Kr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Kr.deleteProperty=function(e,t){return Kr.set.call(this,e,t,void 0)},Kr.set=function(e,t,n){return Ho.set.call(this,e[0],t,n,e[0])};var Kd=function(){function e(n){var r=this;this.O=Ha,this.D=!0,this.produce=function(s,u,c){if(typeof s=="function"&&typeof u!="function"){var g=u;u=s;var p=r;return function(C){var I=this;C===void 0&&(C=g);for(var R=arguments.length,F=Array(R>1?R-1:0),A=1;A<R;A++)F[A-1]=arguments[A];return p.produce(C,function(x){var O;return(O=u).call.apply(O,[I,x].concat(F))})}}var h;if(typeof u!="function"&&zt(6),c!==void 0&&typeof c!="function"&&zt(7),Zn(s)){var d=Da(r),f=Bo(r,s,void 0),m=!0;try{h=u(f),m=!1}finally{m?Ti(d):Mo(d)}return typeof Promise<"u"&&h instanceof Promise?h.then(function(C){return uo(d,c),co(C,d)},function(C){throw Ti(d),C}):(uo(d,c),co(h,d))}if(!s||typeof s!="object"){if((h=u(s))===void 0&&(h=s),h===Xc&&(h=void 0),r.D&&bs(h,!0),c){var b=[],w=[];an("Patches").M(s,h,b,w),c(b,w)}return h}zt(21,s)},this.produceWithPatches=function(s,u){if(typeof s=="function")return function(h){for(var d=arguments.length,f=Array(d>1?d-1:0),m=1;m<d;m++)f[m-1]=arguments[m];return r.produceWithPatches(h,function(b){return s.apply(void 0,[b].concat(f))})};var c,g,p=r.produce(s,u,function(h,d){c=h,g=d});return typeof Promise<"u"&&p instanceof Promise?p.then(function(h){return[h,c,g]}):[p,c,g]},typeof(n==null?void 0:n.useProxies)=="boolean"&&this.setUseProxies(n.useProxies),typeof(n==null?void 0:n.autoFreeze)=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){Zn(n)||zt(8),Fr(n)&&(n=Dd(n));var r=Da(this),s=Bo(this,n,void 0);return s[Mt].C=!0,Mo(r),s},t.finishDraft=function(n,r){var s=n&&n[Mt],u=s.A;return uo(u,r),co(void 0,u)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!Ha&&zt(20),this.O=n},t.applyPatches=function(n,r){var s;for(s=r.length-1;s>=0;s--){var u=r[s];if(u.path.length===0&&u.op==="replace"){n=u.value;break}}s>-1&&(r=r.slice(s+1));var c=an("Patches").$;return Fr(n)?c(n,r):this.produce(n,function(g){return c(g,r)})},e}(),jt=new Kd,Zc=jt.produce;jt.produceWithPatches.bind(jt);jt.setAutoFreeze.bind(jt);jt.setUseProxies.bind(jt);jt.applyPatches.bind(jt);jt.createDraft.bind(jt);jt.finishDraft.bind(jt);var Va,qa;const Qv=["money","mind","body","work","life"];var Vd=(e=>(e.WellbeingHub="wellbeing",e.FlareApp="flareMobileApp",e.SalaryPackagingCars="salaryPackagingCars",e))(Vd||{});const qd=["default","pba"];function $d(){return{user:It,config:It,navTab:"benefits",appView:"employee",redirectPath:It,mode:"default"}}let Wd=(Va=Ju({name:"benefits-app",resettable:!0,producerFn:Zc}),Va(qa=class extends ss{constructor(){super($d())}})||qa);const Rn=new Wd;class Jd extends as{constructor(n){super(n);ze(this,"signedInUser$",this.select(n=>n.user));ze(this,"appConfig$",this.select(n=>n.config));ze(this,"navPage$",this.select(n=>n.navTab));ze(this,"appView$",this.select(n=>n.appView));ze(this,"signedInUserRole$",this.select(n=>Bt.pipe(n.user,Hc(()=>"user",r=>r.benefitsProfile.role))));this.store=n}}const Rr=new Jd(Rn);function yi(e,t){return jc(e,rd(()=>t))}function Zv(e){return yi(e,null)}function Ko(e,t="Option value is none."){if(xn(e))throw new Error(t);return e.value}function $a(e,t){return jc(e,Hc(()=>t===null,n=>n===t))}const zd=()=>{const e=async()=>{const r=await wn(`${window.location.origin}/benefits/app/config.json`).get().json();Rn.update({config:Bi(r)})},t=()=>Ko(Rr.getValue().config);return{fetchConfigAsync:e,getConfig:t,getPublicBackendUrl:()=>t().apiBaseUrl.replace("backend","public")}},zn=zd();function Ni(e,t){const n=new URLSearchParams(t);return sn(n.get(e))}function ho(e,t){const n=new URLSearchParams(t.replace(/^#+/,""));return sn(n.get(e))}const e0=e=>{if(e!=null&&e.startsWith(zn.getConfig().apiGatewayBaseUrl+"/benefits/app/#"))return e.split("#")[1]},Yd=()=>{const e="redirectPath",t="mode",n=s=>{Rn.update({redirectPath:s})},r=s=>{Rn.update({mode:s})};return{extractRedirectPath:()=>{const s=Ni(e,window.location.search);$n(s)&&n(s)},extractMode(){const s=Ni(t,window.location.search);$n(s)&&qd.includes(s.value)&&r(s.value)},redirectToPathIfExists(){const s=Rr.getValue().redirectPath;$n(s)&&(n(It),Qn(s.value))}}},Vo=Yd();var cr={},Ar={},vt={},Or={};(function(e){var t=Ie&&Ie.__spreadArray||function(E,U,K){if(K||arguments.length===2)for(var X=0,M=U.length,ue;X<M;X++)(ue||!(X in U))&&(ue||(ue=Array.prototype.slice.call(U,0,X)),ue[X]=U[X]);return E.concat(ue||Array.prototype.slice.call(U))};Object.defineProperty(e,"__esModule",{value:!0}),e.flatMapReader=e.flatMapTask=e.flatMapIO=e.flatMapEither=e.flatMapOption=e.flatMapNullable=e.liftOption=e.liftNullable=e.fromReadonlyNonEmptyArray=e.has=e.emptyRecord=e.emptyReadonlyArray=e.tail=e.head=e.isNonEmpty=e.singleton=e.right=e.left=e.isRight=e.isLeft=e.some=e.none=e.isSome=e.isNone=void 0;var n=Bt,r=function(E){return E._tag==="None"};e.isNone=r;var s=function(E){return E._tag==="Some"};e.isSome=s,e.none={_tag:"None"};var u=function(E){return{_tag:"Some",value:E}};e.some=u;var c=function(E){return E._tag==="Left"};e.isLeft=c;var g=function(E){return E._tag==="Right"};e.isRight=g;var p=function(E){return{_tag:"Left",left:E}};e.left=p;var h=function(E){return{_tag:"Right",right:E}};e.right=h;var d=function(E){return[E]};e.singleton=d;var f=function(E){return E.length>0};e.isNonEmpty=f;var m=function(E){return E[0]};e.head=m;var b=function(E){return E.slice(1)};e.tail=b,e.emptyReadonlyArray=[],e.emptyRecord={},e.has=Object.prototype.hasOwnProperty;var w=function(E){return t([E[0]],E.slice(1),!0)};e.fromReadonlyNonEmptyArray=w;var C=function(E){return function(U,K){return function(){for(var X=[],M=0;M<arguments.length;M++)X[M]=arguments[M];var ue=U.apply(void 0,X);return E.fromEither(ue==null?(0,e.left)(K.apply(void 0,X)):(0,e.right)(ue))}}};e.liftNullable=C;var I=function(E){return function(U,K){return function(){for(var X=[],M=0;M<arguments.length;M++)X[M]=arguments[M];var ue=U.apply(void 0,X);return E.fromEither((0,e.isNone)(ue)?(0,e.left)(K.apply(void 0,X)):(0,e.right)(ue.value))}}};e.liftOption=I;var R=function(E,U){return(0,n.dual)(3,function(K,X,M){return U.flatMap(K,(0,e.liftNullable)(E)(X,M))})};e.flatMapNullable=R;var F=function(E,U){return(0,n.dual)(3,function(K,X,M){return U.flatMap(K,(0,e.liftOption)(E)(X,M))})};e.flatMapOption=F;var A=function(E,U){return(0,n.dual)(2,function(K,X){return U.flatMap(K,function(M){return E.fromEither(X(M))})})};e.flatMapEither=A;var x=function(E,U){return(0,n.dual)(2,function(K,X){return U.flatMap(K,function(M){return E.fromIO(X(M))})})};e.flatMapIO=x;var O=function(E,U){return(0,n.dual)(2,function(K,X){return U.flatMap(K,function(M){return E.fromTask(X(M))})})};e.flatMapTask=O;var N=function(E,U){return(0,n.dual)(2,function(K,X){return U.flatMap(K,function(M){return E.fromReader(X(M))})})};e.flatMapReader=N})(Or);var Gd=Ie&&Ie.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Qd=Ie&&Ie.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Xd=Ie&&Ie.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Gd(t,e,n);return Qd(t,e),t};Object.defineProperty(vt,"__esModule",{value:!0});vt.sequenceS=vt.sequenceT=vt.getApplySemigroup=vt.apS=vt.apSecond=vt.apFirst=vt.ap=void 0;var Zd=Bt,ep=Xd(Or);function tp(e,t){return function(n){return function(r){return e.ap(e.map(r,function(s){return function(u){return t.ap(s,u)}}),n)}}}vt.ap=tp;function np(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}vt.apFirst=np;function rp(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}vt.apSecond=rp;function ip(e){return function(t,n){return function(r){return e.ap(e.map(r,function(s){return function(u){var c;return Object.assign({},s,(c={},c[t]=u,c))}}),n)}}}vt.apS=ip;function op(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(s){return function(u){return t.concat(s,u)}}),r)}}}}vt.getApplySemigroup=op;function Fs(e,t,n){return function(r){for(var s=Array(n.length+1),u=0;u<n.length;u++)s[u]=n[u];return s[n.length]=r,t===0?e.apply(null,s):Fs(e,t-1,s)}}var po={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(s){return[e,t,n,r,s]}}}}}};function sp(e){return ep.has.call(po,e)||(po[e]=Fs(Zd.tuple,e-1,[])),po[e]}function ap(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,s=sp(r),u=e.map(t[0],s),c=1;c<r;c++)u=e.ap(u,t[c]);return u}}vt.sequenceT=ap;function up(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var s;return s={},s[e[0]]=n,s[e[1]]=r,s}};case 3:return function(n){return function(r){return function(s){var u;return u={},u[e[0]]=n,u[e[1]]=r,u[e[2]]=s,u}}};case 4:return function(n){return function(r){return function(s){return function(u){var c;return c={},c[e[0]]=n,c[e[1]]=r,c[e[2]]=s,c[e[3]]=u,c}}}};case 5:return function(n){return function(r){return function(s){return function(u){return function(c){var g;return g={},g[e[0]]=n,g[e[1]]=r,g[e[2]]=s,g[e[3]]=u,g[e[4]]=c,g}}}}};default:return Fs(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var s={},u=0;u<t;u++)s[e[u]]=n[u];return s},t-1,[])}}function cp(e){return function(t){for(var n=Object.keys(t),r=n.length,s=up(n),u=e.map(t[n[0]],s),c=1;c<r;c++)u=e.ap(u,t[n[c]]);return u}}vt.sequenceS=cp;var ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.asUnit=ft.as=ft.getFunctorComposition=ft.let=ft.bindTo=ft.flap=ft.map=void 0;var lp=Bt;function el(e,t){return function(n){return function(r){return e.map(r,function(s){return t.map(s,n)})}}}ft.map=el;function fp(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}ft.flap=fp;function hp(e){return function(t){return function(n){return e.map(n,function(r){var s;return s={},s[t]=r,s})}}}ft.bindTo=hp;function dp(e){return function(t,n){return function(r){return e.map(r,function(s){var u;return Object.assign({},s,(u={},u[t]=n(s),u))})}}}ft.let=dp;function pp(e,t){var n=el(e,t);return{map:function(r,s){return(0,lp.pipe)(r,n(s))}}}ft.getFunctorComposition=pp;function tl(e){return function(t,n){return e.map(t,function(){return n})}}ft.as=tl;function gp(e){var t=tl(e);return function(n){return t(n,void 0)}}ft.asUnit=gp;Object.defineProperty(Ar,"__esModule",{value:!0});Ar.getApplicativeComposition=Ar.getApplicativeMonoid=void 0;var nl=vt,vp=Bt,mp=ft;function yp(e){var t=(0,nl.getApplySemigroup)(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}Ar.getApplicativeMonoid=yp;function _p(e,t){var n=(0,mp.getFunctorComposition)(e,t).map,r=(0,nl.ap)(e,t);return{map:n,of:function(s){return e.of(t.of(s))},ap:function(s,u){return(0,vp.pipe)(s,r(u))}}}Ar.getApplicativeComposition=_p;var mn={};Object.defineProperty(mn,"__esModule",{value:!0});mn.bind=mn.tap=mn.chainFirst=void 0;function bp(e){var t=rl(e);return function(n){return function(r){return t(r,n)}}}mn.chainFirst=bp;function rl(e){return function(t,n){return e.chain(t,function(r){return e.map(n(r),function(){return r})})}}mn.tap=rl;function Sp(e){return function(t,n){return function(r){return e.chain(r,function(s){return e.map(n(s),function(u){var c;return Object.assign({},s,(c={},c[t]=u,c))})})}}}mn.bind=Sp;var it={},wp=Ie&&Ie.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Ep=Ie&&Ie.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Fp=Ie&&Ie.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&wp(t,e,n);return Ep(t,e),t};Object.defineProperty(it,"__esModule",{value:!0});it.tapEither=it.filterOrElse=it.chainFirstEitherK=it.chainEitherK=it.fromEitherK=it.chainOptionK=it.fromOptionK=it.fromPredicate=it.fromOption=void 0;var Ap=mn,il=Bt,Yn=Fp(Or);function ol(e){return function(t){return function(n){return e.fromEither(Yn.isNone(n)?Yn.left(t()):Yn.right(n.value))}}}it.fromOption=ol;function Pp(e){return function(t,n){return function(r){return e.fromEither(t(r)?Yn.right(r):Yn.left(n(r)))}}}it.fromPredicate=Pp;function sl(e){var t=ol(e);return function(n){var r=t(n);return function(s){return(0,il.flow)(s,r)}}}it.fromOptionK=sl;function kp(e,t){var n=sl(e);return function(r){var s=n(r);return function(u){return function(c){return t.chain(c,s(u))}}}}it.chainOptionK=kp;function As(e){return function(t){return(0,il.flow)(t,e.fromEither)}}it.fromEitherK=As;function Cp(e,t){var n=As(e);return function(r){return function(s){return t.chain(s,n(r))}}}it.chainEitherK=Cp;function Ip(e,t){var n=al(e,t);return function(r){return function(s){return n(s,r)}}}it.chainFirstEitherK=Ip;function Tp(e,t){return function(n,r){return function(s){return t.chain(s,function(u){return e.fromEither(n(u)?Yn.right(u):Yn.left(r(u)))})}}}it.filterOrElse=Tp;function al(e,t){var n=As(e),r=(0,Ap.tap)(t);return function(s,u){return r(s,n(u))}}it.tapEither=al;var ul={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.and=e.or=e.not=e.Contravariant=e.getMonoidAll=e.getSemigroupAll=e.getMonoidAny=e.getSemigroupAny=e.URI=e.contramap=void 0;var t=Bt,n=function(f,m){return(0,t.pipe)(f,(0,e.contramap)(m))},r=function(f){return function(m){return(0,t.flow)(f,m)}};e.contramap=r,e.URI="Predicate";var s=function(){return{concat:function(f,m){return(0,t.pipe)(f,(0,e.or)(m))}}};e.getSemigroupAny=s;var u=function(){return{concat:(0,e.getSemigroupAny)().concat,empty:t.constFalse}};e.getMonoidAny=u;var c=function(){return{concat:function(f,m){return(0,t.pipe)(f,(0,e.and)(m))}}};e.getSemigroupAll=c;var g=function(){return{concat:(0,e.getSemigroupAll)().concat,empty:t.constTrue}};e.getMonoidAll=g,e.Contravariant={URI:e.URI,contramap:n};var p=function(f){return function(m){return!f(m)}};e.not=p;var h=function(f){return function(m){return function(b){return m(b)||f(b)}}};e.or=h;var d=function(f){return function(m){return function(b){return m(b)&&f(b)}}};e.and=d})(ul);var cl={},Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.concatAll=Kt.endo=Kt.filterSecond=Kt.filterFirst=Kt.reverse=void 0;var Rp=function(e){return{concat:function(t,n){return e.concat(n,t)}}};Kt.reverse=Rp;var Op=function(e){return function(t){return{concat:function(n,r){return e(n)?t.concat(n,r):r}}}};Kt.filterFirst=Op;var Np=function(e){return function(t){return{concat:function(n,r){return e(r)?t.concat(n,r):n}}}};Kt.filterSecond=Np;var Up=function(e){return function(t){return{concat:function(n,r){return t.concat(e(n),e(r))}}}};Kt.endo=Up;var xp=function(e){return function(t){return function(n){return n.reduce(function(r,s){return e.concat(r,s)},t)}}};Kt.concatAll=xp;var ll={},fl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eqDate=e.eqNumber=e.eqString=e.eqBoolean=e.eq=e.strictEqual=e.getStructEq=e.getTupleEq=e.Contravariant=e.getMonoid=e.getSemigroup=e.eqStrict=e.URI=e.contramap=e.tuple=e.struct=e.fromEquals=void 0;var t=Bt,n=function(d){return{equals:function(f,m){return f===m||d(f,m)}}};e.fromEquals=n;var r=function(d){return(0,e.fromEquals)(function(f,m){for(var b in d)if(!d[b].equals(f[b],m[b]))return!1;return!0})};e.struct=r;var s=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];return(0,e.fromEquals)(function(m,b){return d.every(function(w,C){return w.equals(m[C],b[C])})})};e.tuple=s;var u=function(d,f){return(0,t.pipe)(d,(0,e.contramap)(f))},c=function(d){return function(f){return(0,e.fromEquals)(function(m,b){return f.equals(d(m),d(b))})}};e.contramap=c,e.URI="Eq",e.eqStrict={equals:function(d,f){return d===f}};var g={equals:function(){return!0}},p=function(){return{concat:function(d,f){return(0,e.fromEquals)(function(m,b){return d.equals(m,b)&&f.equals(m,b)})}}};e.getSemigroup=p;var h=function(){return{concat:(0,e.getSemigroup)().concat,empty:g}};e.getMonoid=h,e.Contravariant={URI:e.URI,contramap:u},e.getTupleEq=e.tuple,e.getStructEq=e.struct,e.strictEqual=e.eqStrict.equals,e.eq=e.Contravariant,e.eqBoolean=e.eqStrict,e.eqString=e.eqStrict,e.eqNumber=e.eqStrict,e.eqDate={equals:function(d,f){return d.valueOf()===f.valueOf()}}})(fl);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ordDate=e.ordNumber=e.ordString=e.ordBoolean=e.ord=e.getDualOrd=e.getTupleOrd=e.between=e.clamp=e.max=e.min=e.geq=e.leq=e.gt=e.lt=e.equals=e.trivial=e.Contravariant=e.getMonoid=e.getSemigroup=e.URI=e.contramap=e.reverse=e.tuple=e.fromCompare=e.equalsDefault=void 0;var t=fl,n=Bt,r=function(N){return function(E,U){return E===U||N(E,U)===0}};e.equalsDefault=r;var s=function(N){return{equals:(0,e.equalsDefault)(N),compare:function(E,U){return E===U?0:N(E,U)}}};e.fromCompare=s;var u=function(){for(var N=[],E=0;E<arguments.length;E++)N[E]=arguments[E];return(0,e.fromCompare)(function(U,K){for(var X=0;X<N.length-1;X++){var M=N[X].compare(U[X],K[X]);if(M!==0)return M}return N[X].compare(U[X],K[X])})};e.tuple=u;var c=function(N){return(0,e.fromCompare)(function(E,U){return N.compare(U,E)})};e.reverse=c;var g=function(N,E){return(0,n.pipe)(N,(0,e.contramap)(E))},p=function(N){return function(E){return(0,e.fromCompare)(function(U,K){return E.compare(N(U),N(K))})}};e.contramap=p,e.URI="Ord";var h=function(){return{concat:function(N,E){return(0,e.fromCompare)(function(U,K){var X=N.compare(U,K);return X!==0?X:E.compare(U,K)})}}};e.getSemigroup=h;var d=function(){return{concat:(0,e.getSemigroup)().concat,empty:(0,e.fromCompare)(function(){return 0})}};e.getMonoid=d,e.Contravariant={URI:e.URI,contramap:g},e.trivial={equals:n.constTrue,compare:(0,n.constant)(0)};var f=function(N){return function(E){return function(U){return U===E||N.compare(U,E)===0}}};e.equals=f;var m=function(N){return function(E,U){return N.compare(E,U)===-1}};e.lt=m;var b=function(N){return function(E,U){return N.compare(E,U)===1}};e.gt=b;var w=function(N){return function(E,U){return N.compare(E,U)!==1}};e.leq=w;var C=function(N){return function(E,U){return N.compare(E,U)!==-1}};e.geq=C;var I=function(N){return function(E,U){return E===U||N.compare(E,U)<1?E:U}};e.min=I;var R=function(N){return function(E,U){return E===U||N.compare(E,U)>-1?E:U}};e.max=R;var F=function(N){var E=(0,e.min)(N),U=(0,e.max)(N);return function(K,X){return function(M){return U(E(M,X),K)}}};e.clamp=F;var A=function(N){var E=(0,e.lt)(N),U=(0,e.gt)(N);return function(K,X){return function(M){return!(E(M,K)||U(M,X))}}};e.between=A,e.getTupleOrd=e.tuple,e.getDualOrd=e.reverse,e.ord=e.Contravariant;function x(N,E){return N<E?-1:N>E?1:0}var O={equals:t.eqStrict.equals,compare:x};e.ordBoolean=O,e.ordString=O,e.ordNumber=O,e.ordDate=(0,n.pipe)(e.ordNumber,(0,e.contramap)(function(N){return N.valueOf()}))})(ll);(function(e){var t=Ie&&Ie.__createBinding||(Object.create?function(F,A,x,O){O===void 0&&(O=x);var N=Object.getOwnPropertyDescriptor(A,x);(!N||("get"in N?!A.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return A[x]}}),Object.defineProperty(F,O,N)}:function(F,A,x,O){O===void 0&&(O=x),F[O]=A[x]}),n=Ie&&Ie.__setModuleDefault||(Object.create?function(F,A){Object.defineProperty(F,"default",{enumerable:!0,value:A})}:function(F,A){F.default=A}),r=Ie&&Ie.__importStar||function(F){if(F&&F.__esModule)return F;var A={};if(F!=null)for(var x in F)x!=="default"&&Object.prototype.hasOwnProperty.call(F,x)&&t(A,F,x);return n(A,F),A};Object.defineProperty(e,"__esModule",{value:!0}),e.semigroupProduct=e.semigroupSum=e.semigroupString=e.getFunctionSemigroup=e.semigroupAny=e.semigroupAll=e.fold=e.getIntercalateSemigroup=e.getMeetSemigroup=e.getJoinSemigroup=e.getDualSemigroup=e.getStructSemigroup=e.getTupleSemigroup=e.getFirstSemigroup=e.getLastSemigroup=e.getObjectSemigroup=e.semigroupVoid=e.concatAll=e.last=e.first=e.intercalate=e.tuple=e.struct=e.reverse=e.constant=e.max=e.min=void 0;var s=Bt,u=r(Or),c=r(Kt),g=r(ll),p=function(F){return{concat:g.min(F)}};e.min=p;var h=function(F){return{concat:g.max(F)}};e.max=h;var d=function(F){return{concat:function(){return F}}};e.constant=d,e.reverse=c.reverse;var f=function(F){return{concat:function(A,x){var O={};for(var N in F)u.has.call(F,N)&&(O[N]=F[N].concat(A[N],x[N]));return O}}};e.struct=f;var m=function(){for(var F=[],A=0;A<arguments.length;A++)F[A]=arguments[A];return{concat:function(x,O){return F.map(function(N,E){return N.concat(x[E],O[E])})}}};e.tuple=m;var b=function(F){return function(A){return{concat:function(x,O){return A.concat(x,A.concat(F,O))}}}};e.intercalate=b;var w=function(){return{concat:s.identity}};e.first=w;var C=function(){return{concat:function(F,A){return A}}};e.last=C,e.concatAll=c.concatAll,e.semigroupVoid=(0,e.constant)(void 0);var I=function(){return{concat:function(F,A){return Object.assign({},F,A)}}};e.getObjectSemigroup=I,e.getLastSemigroup=e.last,e.getFirstSemigroup=e.first,e.getTupleSemigroup=e.tuple,e.getStructSemigroup=e.struct,e.getDualSemigroup=e.reverse,e.getJoinSemigroup=e.max,e.getMeetSemigroup=e.min,e.getIntercalateSemigroup=e.intercalate;function R(F){var A=(0,e.concatAll)(F);return function(x,O){return O===void 0?A(x):A(x)(O)}}e.fold=R,e.semigroupAll={concat:function(F,A){return F&&A}},e.semigroupAny={concat:function(F,A){return F||A}},e.getFunctionSemigroup=s.getSemigroup,e.semigroupString={concat:function(F,A){return F+A}},e.semigroupSum={concat:function(F,A){return F+A}},e.semigroupProduct={concat:function(F,A){return F*A}}})(cl);var hl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.right=e.left=e.flap=e.Functor=e.Bifunctor=e.URI=e.bimap=e.mapLeft=e.map=e.separated=void 0;var t=Bt,n=ft,r=function(m,b){return{left:m,right:b}};e.separated=r;var s=function(m,b){return(0,t.pipe)(m,(0,e.map)(b))},u=function(m,b){return(0,t.pipe)(m,(0,e.mapLeft)(b))},c=function(m,b,w){return(0,t.pipe)(m,(0,e.bimap)(b,w))},g=function(m){return function(b){return(0,e.separated)((0,e.left)(b),m((0,e.right)(b)))}};e.map=g;var p=function(m){return function(b){return(0,e.separated)(m((0,e.left)(b)),(0,e.right)(b))}};e.mapLeft=p;var h=function(m,b){return function(w){return(0,e.separated)(m((0,e.left)(w)),b((0,e.right)(w)))}};e.bimap=h,e.URI="Separated",e.Bifunctor={URI:e.URI,mapLeft:u,bimap:c},e.Functor={URI:e.URI,map:s},e.flap=(0,n.flap)(e.Functor);var d=function(m){return m.left};e.left=d;var f=function(m){return m.right};e.right=f})(hl);var On={},Dp=Ie&&Ie.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Lp=Ie&&Ie.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Mp=Ie&&Ie.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Dp(t,e,n);return Lp(t,e),t};Object.defineProperty(On,"__esModule",{value:!0});On.filterE=On.witherDefault=On.wiltDefault=void 0;var Wa=Mp(Or);function jp(e,t){return function(n){var r=e.traverse(n);return function(s,u){return n.map(r(s,u),t.separate)}}}On.wiltDefault=jp;function Bp(e,t){return function(n){var r=e.traverse(n);return function(s,u){return n.map(r(s,u),t.compact)}}}On.witherDefault=Bp;function Hp(e){return function(t){var n=e.wither(t);return function(r){return function(s){return n(s,function(u){return t.map(r(u),function(c){return c?Wa.some(u):Wa.none})})}}}}On.filterE=Hp;var Vi={};Object.defineProperty(Vi,"__esModule",{value:!0});Vi.guard=void 0;function Kp(e,t){return function(n){return n?t.of(void 0):e.zero()}}Vi.guard=Kp;(function(e){var t=Ie&&Ie.__createBinding||(Object.create?function(oe,ae,de,He){He===void 0&&(He=de);var st=Object.getOwnPropertyDescriptor(ae,de);(!st||("get"in st?!ae.__esModule:st.writable||st.configurable))&&(st={enumerable:!0,get:function(){return ae[de]}}),Object.defineProperty(oe,He,st)}:function(oe,ae,de,He){He===void 0&&(He=de),oe[He]=ae[de]}),n=Ie&&Ie.__setModuleDefault||(Object.create?function(oe,ae){Object.defineProperty(oe,"default",{enumerable:!0,value:ae})}:function(oe,ae){oe.default=ae}),r=Ie&&Ie.__importStar||function(oe){if(oe&&oe.__esModule)return oe;var ae={};if(oe!=null)for(var de in oe)de!=="default"&&Object.prototype.hasOwnProperty.call(oe,de)&&t(ae,oe,de);return n(ae,oe),ae};Object.defineProperty(e,"__esModule",{value:!0}),e.Witherable=e.wilt=e.wither=e.Traversable=e.sequence=e.traverse=e.Filterable=e.partitionMap=e.partition=e.filterMap=e.filter=e.Compactable=e.separate=e.compact=e.Extend=e.extend=e.Alternative=e.guard=e.Zero=e.zero=e.Alt=e.alt=e.altW=e.orElse=e.Foldable=e.reduceRight=e.foldMap=e.reduce=e.Monad=e.Chain=e.flatMap=e.Applicative=e.Apply=e.ap=e.Pointed=e.of=e.asUnit=e.as=e.Functor=e.map=e.getMonoid=e.getOrd=e.getEq=e.getShow=e.URI=e.getRight=e.getLeft=e.fromPredicate=e.some=e.none=void 0,e.getFirstMonoid=e.getApplyMonoid=e.getApplySemigroup=e.option=e.mapNullable=e.getRefinement=e.chainFirst=e.chain=e.sequenceArray=e.traverseArray=e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex=e.traverseReadonlyNonEmptyArrayWithIndex=e.ApT=e.apS=e.bind=e.let=e.bindTo=e.Do=e.exists=e.elem=e.toUndefined=e.toNullable=e.chainNullableK=e.fromNullableK=e.tryCatchK=e.tryCatch=e.fromNullable=e.chainFirstEitherK=e.chainEitherK=e.fromEitherK=e.duplicate=e.tapEither=e.tap=e.flatten=e.apSecond=e.apFirst=e.flap=e.getOrElse=e.getOrElseW=e.fold=e.match=e.foldW=e.matchW=e.isNone=e.isSome=e.FromEither=e.fromEither=e.MonadThrow=e.throwError=void 0,e.getLastMonoid=void 0;var s=Ar,u=vt,c=r(mn),g=it,p=Bt,h=ft,d=r(Or),f=ul,m=cl,b=hl,w=On,C=Vi;e.none=d.none,e.some=d.some;function I(oe){return function(ae){return oe(ae)?(0,e.some)(ae):e.none}}e.fromPredicate=I;var R=function(oe){return oe._tag==="Right"?e.none:(0,e.some)(oe.left)};e.getLeft=R;var F=function(oe){return oe._tag==="Left"?e.none:(0,e.some)(oe.right)};e.getRight=F;var A=function(oe,ae){return(0,p.pipe)(oe,(0,e.map)(ae))},x=function(oe,ae){return(0,p.pipe)(oe,(0,e.ap)(ae))},O=function(oe,ae,de){return(0,p.pipe)(oe,(0,e.reduce)(ae,de))},N=function(oe){var ae=(0,e.foldMap)(oe);return function(de,He){return(0,p.pipe)(de,ae(He))}},E=function(oe,ae,de){return(0,p.pipe)(oe,(0,e.reduceRight)(ae,de))},U=function(oe){var ae=(0,e.traverse)(oe);return function(de,He){return(0,p.pipe)(de,ae(He))}},K=function(oe,ae){return(0,p.pipe)(oe,(0,e.alt)(ae))},X=function(oe,ae){return(0,p.pipe)(oe,(0,e.filter)(ae))},M=function(oe,ae){return(0,p.pipe)(oe,(0,e.filterMap)(ae))},ue=function(oe,ae){return(0,p.pipe)(oe,(0,e.extend)(ae))},fe=function(oe,ae){return(0,p.pipe)(oe,(0,e.partition)(ae))},be=function(oe,ae){return(0,p.pipe)(oe,(0,e.partitionMap)(ae))};e.URI="Option";var Se=function(oe){return{show:function(ae){return(0,e.isNone)(ae)?"none":"some(".concat(oe.show(ae.value),")")}}};e.getShow=Se;var Ce=function(oe){return{equals:function(ae,de){return ae===de||((0,e.isNone)(ae)?(0,e.isNone)(de):(0,e.isNone)(de)?!1:oe.equals(ae.value,de.value))}}};e.getEq=Ce;var Oe=function(oe){return{equals:(0,e.getEq)(oe).equals,compare:function(ae,de){return ae===de?0:(0,e.isSome)(ae)?(0,e.isSome)(de)?oe.compare(ae.value,de.value):1:-1}}};e.getOrd=Oe;var qe=function(oe){return{concat:function(ae,de){return(0,e.isNone)(ae)?de:(0,e.isNone)(de)?ae:(0,e.some)(oe.concat(ae.value,de.value))},empty:e.none}};e.getMonoid=qe;var Fe=function(oe){return function(ae){return(0,e.isNone)(ae)?e.none:(0,e.some)(oe(ae.value))}};e.map=Fe,e.Functor={URI:e.URI,map:A},e.as=(0,p.dual)(2,(0,h.as)(e.Functor)),e.asUnit=(0,h.asUnit)(e.Functor),e.of=e.some,e.Pointed={URI:e.URI,of:e.of};var Ee=function(oe){return function(ae){return(0,e.isNone)(ae)||(0,e.isNone)(oe)?e.none:(0,e.some)(ae.value(oe.value))}};e.ap=Ee,e.Apply={URI:e.URI,map:A,ap:x},e.Applicative={URI:e.URI,map:A,ap:x,of:e.of},e.flatMap=(0,p.dual)(2,function(oe,ae){return(0,e.isNone)(oe)?e.none:ae(oe.value)}),e.Chain={URI:e.URI,map:A,ap:x,chain:e.flatMap},e.Monad={URI:e.URI,map:A,ap:x,of:e.of,chain:e.flatMap};var Te=function(oe,ae){return function(de){return(0,e.isNone)(de)?oe:ae(oe,de.value)}};e.reduce=Te;var ct=function(oe){return function(ae){return function(de){return(0,e.isNone)(de)?oe.empty:ae(de.value)}}};e.foldMap=ct;var De=function(oe,ae){return function(de){return(0,e.isNone)(de)?oe:ae(de.value,oe)}};e.reduceRight=De,e.Foldable={URI:e.URI,reduce:O,foldMap:N,reduceRight:E},e.orElse=(0,p.dual)(2,function(oe,ae){return(0,e.isNone)(oe)?ae():oe}),e.altW=e.orElse,e.alt=e.orElse,e.Alt={URI:e.URI,map:A,alt:K};var _t=function(){return e.none};e.zero=_t,e.Zero={URI:e.URI,zero:e.zero},e.guard=(0,C.guard)(e.Zero,e.Pointed),e.Alternative={URI:e.URI,map:A,ap:x,of:e.of,alt:K,zero:e.zero};var Pt=function(oe){return function(ae){return(0,e.isNone)(ae)?e.none:(0,e.some)(oe(ae))}};e.extend=Pt,e.Extend={URI:e.URI,map:A,extend:ue},e.compact=(0,e.flatMap)(p.identity);var $t=(0,b.separated)(e.none,e.none),Tt=function(oe){return(0,e.isNone)(oe)?$t:(0,b.separated)((0,e.getLeft)(oe.value),(0,e.getRight)(oe.value))};e.separate=Tt,e.Compactable={URI:e.URI,compact:e.compact,separate:e.separate};var ot=function(oe){return function(ae){return(0,e.isNone)(ae)?e.none:oe(ae.value)?ae:e.none}};e.filter=ot;var bt=function(oe){return function(ae){return(0,e.isNone)(ae)?e.none:oe(ae.value)}};e.filterMap=bt;var dt=function(oe){return function(ae){return(0,b.separated)(X(ae,(0,f.not)(oe)),X(ae,oe))}};e.partition=dt;var Y=function(oe){return(0,p.flow)((0,e.map)(oe),e.separate)};e.partitionMap=Y,e.Filterable={URI:e.URI,map:A,compact:e.compact,separate:e.separate,filter:X,filterMap:M,partition:fe,partitionMap:be};var _=function(oe){return function(ae){return function(de){return(0,e.isNone)(de)?oe.of(e.none):oe.map(ae(de.value),e.some)}}};e.traverse=_;var S=function(oe){return function(ae){return(0,e.isNone)(ae)?oe.of(e.none):oe.map(ae.value,e.some)}};e.sequence=S,e.Traversable={URI:e.URI,map:A,reduce:O,foldMap:N,reduceRight:E,traverse:U,sequence:e.sequence};var z=(0,w.witherDefault)(e.Traversable,e.Compactable),G=(0,w.wiltDefault)(e.Traversable,e.Compactable),Z=function(oe){var ae=z(oe);return function(de){return function(He){return ae(He,de)}}};e.wither=Z;var se=function(oe){var ae=G(oe);return function(de){return function(He){return ae(He,de)}}};e.wilt=se,e.Witherable={URI:e.URI,map:A,reduce:O,foldMap:N,reduceRight:E,traverse:U,sequence:e.sequence,compact:e.compact,separate:e.separate,filter:X,filterMap:M,partition:fe,partitionMap:be,wither:z,wilt:G};var ge=function(){return e.none};e.throwError=ge,e.MonadThrow={URI:e.URI,map:A,ap:x,of:e.of,chain:e.flatMap,throwError:e.throwError},e.fromEither=e.getRight,e.FromEither={URI:e.URI,fromEither:e.fromEither},e.isSome=d.isSome;var we=function(oe){return oe._tag==="None"};e.isNone=we;var Re=function(oe,ae){return function(de){return(0,e.isNone)(de)?oe():ae(de.value)}};e.matchW=Re,e.foldW=e.matchW,e.match=e.matchW,e.fold=e.match;var Pe=function(oe){return function(ae){return(0,e.isNone)(ae)?oe():ae.value}};e.getOrElseW=Pe,e.getOrElse=e.getOrElseW,e.flap=(0,h.flap)(e.Functor),e.apFirst=(0,u.apFirst)(e.Apply),e.apSecond=(0,u.apSecond)(e.Apply),e.flatten=e.compact,e.tap=(0,p.dual)(2,c.tap(e.Chain)),e.tapEither=(0,p.dual)(2,(0,g.tapEither)(e.FromEither,e.Chain)),e.duplicate=(0,e.extend)(p.identity),e.fromEitherK=(0,g.fromEitherK)(e.FromEither),e.chainEitherK=(0,g.chainEitherK)(e.FromEither,e.Chain),e.chainFirstEitherK=e.tapEither;var $e=function(oe){return oe==null?e.none:(0,e.some)(oe)};e.fromNullable=$e;var lt=function(oe){try{return(0,e.some)(oe())}catch{return e.none}};e.tryCatch=lt;var St=function(oe){return function(){for(var ae=[],de=0;de<arguments.length;de++)ae[de]=arguments[de];return(0,e.tryCatch)(function(){return oe.apply(void 0,ae)})}};e.tryCatchK=St;var Ut=function(oe){return(0,p.flow)(oe,e.fromNullable)};e.fromNullableK=Ut;var ye=function(oe){return function(ae){return(0,e.isNone)(ae)?e.none:(0,e.fromNullable)(oe(ae.value))}};e.chainNullableK=ye,e.toNullable=(0,e.match)(p.constNull,p.identity),e.toUndefined=(0,e.match)(p.constUndefined,p.identity);function Le(oe){return function(ae,de){if(de===void 0){var He=Le(oe);return function(st){return He(ae,st)}}return(0,e.isNone)(de)?!1:oe.equals(ae,de.value)}}e.elem=Le;var ke=function(oe){return function(ae){return(0,e.isNone)(ae)?!1:oe(ae.value)}};e.exists=ke,e.Do=(0,e.of)(d.emptyRecord),e.bindTo=(0,h.bindTo)(e.Functor);var tn=(0,h.let)(e.Functor);e.let=tn,e.bind=c.bind(e.Chain),e.apS=(0,u.apS)(e.Apply),e.ApT=(0,e.of)(d.emptyReadonlyArray);var ni=function(oe){return function(ae){var de=oe(0,d.head(ae));if((0,e.isNone)(de))return e.none;for(var He=[de.value],st=1;st<ae.length;st++){var Qe=oe(st,ae[st]);if((0,e.isNone)(Qe))return e.none;He.push(Qe.value)}return(0,e.some)(He)}};e.traverseReadonlyNonEmptyArrayWithIndex=ni;var D=function(oe){var ae=(0,e.traverseReadonlyNonEmptyArrayWithIndex)(oe);return function(de){return d.isNonEmpty(de)?ae(de):e.ApT}};e.traverseReadonlyArrayWithIndex=D,e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex;var Dn=function(oe){return(0,e.traverseReadonlyArrayWithIndex)(function(ae,de){return oe(de)})};e.traverseArray=Dn,e.sequenceArray=(0,e.traverseArray)(p.identity),e.chain=e.flatMap,e.chainFirst=e.tap;function xt(oe){return function(ae){return(0,e.isSome)(oe(ae))}}e.getRefinement=xt,e.mapNullable=e.chainNullableK,e.option={URI:e.URI,map:A,of:e.of,ap:x,chain:e.flatMap,reduce:O,foldMap:N,reduceRight:E,traverse:U,sequence:e.sequence,zero:e.zero,alt:K,extend:ue,compact:e.compact,separate:e.separate,filter:X,filterMap:M,partition:fe,partitionMap:be,wither:z,wilt:G,throwError:e.throwError},e.getApplySemigroup=(0,u.getApplySemigroup)(e.Apply),e.getApplyMonoid=(0,s.getApplicativeMonoid)(e.Applicative);var he=function(){return(0,e.getMonoid)((0,m.first)())};e.getFirstMonoid=he;var ri=function(){return(0,e.getMonoid)((0,m.last)())};e.getLastMonoid=ri})(cr);var dl={exports:{}};(function(e,t){(function(r,s){e.exports=s()})(Ie,function(){return function(n){var r={};function s(u){if(r[u])return r[u].exports;var c=r[u]={i:u,l:!1,exports:{}};return n[u].call(c.exports,c,c.exports,s),c.l=!0,c.exports}return s.m=n,s.c=r,s.d=function(u,c,g){s.o(u,c)||Object.defineProperty(u,c,{enumerable:!0,get:g})},s.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},s.t=function(u,c){if(1&c&&(u=s(u)),8&c||4&c&&typeof u=="object"&&u&&u.__esModule)return u;var g=Object.create(null);if(s.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:u}),2&c&&typeof u!="string")for(var p in u)s.d(g,p,(function(h){return u[h]}).bind(null,p));return g},s.n=function(u){var c=u&&u.__esModule?function(){return u.default}:function(){return u};return s.d(c,"a",c),c},s.o=function(u,c){return Object.prototype.hasOwnProperty.call(u,c)},s.p="",s(s.s=22)}([function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function h(d,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(d,b.key,b)}}return function(d,f,m){return f&&h(d.prototype,f),m&&h(d,m),d}}(),c={debug:function(){},info:function(){},warn:function(){},error:function(){}},g=void 0,p=void 0;(r.Log=function(){function h(){(function(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")})(this,h)}return h.reset=function(){p=3,g=c},h.debug=function(){if(p>=4){for(var f=arguments.length,m=Array(f),b=0;b<f;b++)m[b]=arguments[b];g.debug.apply(g,Array.from(m))}},h.info=function(){if(p>=3){for(var f=arguments.length,m=Array(f),b=0;b<f;b++)m[b]=arguments[b];g.info.apply(g,Array.from(m))}},h.warn=function(){if(p>=2){for(var f=arguments.length,m=Array(f),b=0;b<f;b++)m[b]=arguments[b];g.warn.apply(g,Array.from(m))}},h.error=function(){if(p>=1){for(var f=arguments.length,m=Array(f),b=0;b<f;b++)m[b]=arguments[b];g.error.apply(g,Array.from(m))}},u(h,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return p},set:function(f){if(!(0<=f&&f<=4))throw new Error("Invalid log level");p=f}},{key:"logger",get:function(){return g},set:function(f){if(!f.debug&&f.info&&(f.debug=f.info),!(f.debug&&f.info&&f.warn&&f.error))throw new Error("Invalid logger");g=f}}]),h}()).reset()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function h(d,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(d,b.key,b)}}return function(d,f,m){return f&&h(d.prototype,f),m&&h(d,m),d}}(),c={setInterval:function(h){function d(f,m){return h.apply(this,arguments)}return d.toString=function(){return h.toString()},d}(function(h,d){return setInterval(h,d)}),clearInterval:function(h){function d(f){return h.apply(this,arguments)}return d.toString=function(){return h.toString()},d}(function(h){return clearInterval(h)})},g=!1,p=null;r.Global=function(){function h(){(function(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")})(this,h)}return h._testing=function(){g=!0},h.setXMLHttpRequest=function(f){p=f},u(h,null,[{key:"location",get:function(){if(!g)return location}},{key:"localStorage",get:function(){if(!g&&typeof window<"u")return localStorage}},{key:"sessionStorage",get:function(){if(!g&&typeof window<"u")return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!g&&typeof window<"u")return p||XMLHttpRequest}},{key:"timer",get:function(){if(!g)return c}}]),h}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.MetadataService=void 0;var u=function(){function d(f,m){for(var b=0;b<m.length;b++){var w=m[b];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(f,w.key,w)}}return function(f,m,b){return m&&d(f.prototype,m),b&&d(f,b),f}}(),c=s(0),g=s(7);function p(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")}var h=".well-known/openid-configuration";r.MetadataService=function(){function d(f){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.JsonService;if(p(this,d),!f)throw c.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=f,this._jsonService=new m(["application/jwk-set+json"])}return d.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},d.prototype.getMetadata=function(){var m=this;return this._settings.metadata?(c.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(c.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then(function(b){c.Log.debug("MetadataService.getMetadata: json received");var w=m._settings.metadataSeed||{};return m._settings.metadata=Object.assign({},w,b),m._settings.metadata})):(c.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},d.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},d.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},d.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},d.prototype.getTokenEndpoint=function(){var m=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return this._getMetadataProperty("token_endpoint",m)},d.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},d.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},d.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},d.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},d.prototype._getMetadataProperty=function(m){var b=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return c.Log.debug("MetadataService.getMetadataProperty for: "+m),this.getMetadata().then(function(w){if(c.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),w[m]===void 0){if(b===!0)return void c.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+m);throw c.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+m),new Error("Metadata does not contain property "+m)}return w[m]})},d.prototype.getSigningKeys=function(){var m=this;return this._settings.signingKeys?(c.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then(function(b){return c.Log.debug("MetadataService.getSigningKeys: jwks_uri received",b),m._jsonService.getJson(b).then(function(w){if(c.Log.debug("MetadataService.getSigningKeys: key set received",w),!w.keys)throw c.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return m._settings.signingKeys=w.keys,m._settings.signingKeys})})},u(d,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(h)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=h))),this._metadataUrl}}]),d}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.UrlUtility=void 0;var u=s(0),c=s(1);r.UrlUtility=function(){function g(){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,g)}return g.addQueryParam=function(h,d,f){return h.indexOf("?")<0&&(h+="?"),h[h.length-1]!=="?"&&(h+="&"),h+=encodeURIComponent(d),h+="=",h+=encodeURIComponent(f)},g.parseUrlFragment=function(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#",f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.Global;typeof h!="string"&&(h=f.location.href);var m=h.lastIndexOf(d);m>=0&&(h=h.substr(m+1)),d==="?"&&(m=h.indexOf("#"))>=0&&(h=h.substr(0,m));for(var b,w={},C=/([^&=]+)=([^&]*)/g,I=0;b=C.exec(h);)if(w[decodeURIComponent(b[1])]=decodeURIComponent(b[2].replace(/\+/g," ")),I++>50)return u.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",h),{error:"Response exceeded expected number of parameters"};for(var R in w)return w;return{}},g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.JoseUtil=void 0;var u=s(26),c=function(p){return p&&p.__esModule?p:{default:p}}(s(33));r.JoseUtil=(0,c.default)({jws:u.jws,KeyUtil:u.KeyUtil,X509:u.X509,crypto:u.crypto,hextob64u:u.hextob64u,b64tohex:u.b64tohex,AllowedSigningAlgs:u.AllowedSigningAlgs})},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.OidcClientSettings=void 0;var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R},c=function(){function R(F,A){for(var x=0;x<A.length;x++){var O=A[x];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(F,O.key,O)}}return function(F,A,x){return A&&R(F.prototype,A),x&&R(F,x),F}}(),g=s(0),p=s(23),h=s(6),d=s(24),f=s(2);function m(R,F){if(!(R instanceof F))throw new TypeError("Cannot call a class as a function")}var b=".well-known/openid-configuration",w="id_token",C="openid",I="client_secret_post";r.OidcClientSettings=function(){function R(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=F.authority,x=F.metadataUrl,O=F.metadata,N=F.signingKeys,E=F.metadataSeed,U=F.client_id,K=F.client_secret,X=F.response_type,M=X===void 0?w:X,ue=F.scope,fe=ue===void 0?C:ue,be=F.redirect_uri,Se=F.post_logout_redirect_uri,Ce=F.client_authentication,Oe=Ce===void 0?I:Ce,qe=F.prompt,Fe=F.display,Ee=F.max_age,Te=F.ui_locales,ct=F.acr_values,De=F.resource,_t=F.response_mode,Pt=F.filterProtocolClaims,$t=Pt===void 0||Pt,Tt=F.loadUserInfo,ot=Tt===void 0||Tt,bt=F.staleStateAge,dt=bt===void 0?900:bt,Y=F.clockSkew,_=Y===void 0?300:Y,S=F.clockService,z=S===void 0?new p.ClockService:S,G=F.userInfoJwtIssuer,Z=G===void 0?"OP":G,se=F.mergeClaims,ge=se!==void 0&&se,we=F.stateStore,Re=we===void 0?new h.WebStorageStateStore:we,Pe=F.ResponseValidatorCtor,$e=Pe===void 0?d.ResponseValidator:Pe,lt=F.MetadataServiceCtor,St=lt===void 0?f.MetadataService:lt,Ut=F.extraQueryParams,ye=Ut===void 0?{}:Ut,Le=F.extraTokenParams,ke=Le===void 0?{}:Le;m(this,R),this._authority=A,this._metadataUrl=x,this._metadata=O,this._metadataSeed=E,this._signingKeys=N,this._client_id=U,this._client_secret=K,this._response_type=M,this._scope=fe,this._redirect_uri=be,this._post_logout_redirect_uri=Se,this._client_authentication=Oe,this._prompt=qe,this._display=Fe,this._max_age=Ee,this._ui_locales=Te,this._acr_values=ct,this._resource=De,this._response_mode=_t,this._filterProtocolClaims=!!$t,this._loadUserInfo=!!ot,this._staleStateAge=dt,this._clockSkew=_,this._clockService=z,this._userInfoJwtIssuer=Z,this._mergeClaims=!!ge,this._stateStore=Re,this._validator=new $e(this),this._metadataService=new St(this),this._extraQueryParams=(ye===void 0?"undefined":u(ye))==="object"?ye:{},this._extraTokenParams=(ke===void 0?"undefined":u(ke))==="object"?ke:{}}return R.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},c(R,[{key:"client_id",get:function(){return this._client_id},set:function(A){if(this._client_id)throw g.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=A}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function(){return this._client_authentication}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(A){if(this._authority)throw g.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=A}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(b)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=b)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(A){this._metadata=A}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(A){this._metadataSeed=A}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(A){this._signingKeys=A}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(A){(A===void 0?"undefined":u(A))==="object"?this._extraQueryParams=A:this._extraQueryParams={}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(A){(A===void 0?"undefined":u(A))==="object"?this._extraTokenParams=A:this._extraTokenParams={}}}]),R}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.WebStorageStateStore=void 0;var u=s(0),c=s(1);function g(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}r.WebStorageStateStore=function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=h.prefix,f=d===void 0?"oidc.":d,m=h.store,b=m===void 0?c.Global.localStorage:m;g(this,p),this._store=b,this._prefix=f}return p.prototype.set=function(d,f){return u.Log.debug("WebStorageStateStore.set",d),d=this._prefix+d,this._store.setItem(d,f),Promise.resolve()},p.prototype.get=function(d){u.Log.debug("WebStorageStateStore.get",d),d=this._prefix+d;var f=this._store.getItem(d);return Promise.resolve(f)},p.prototype.remove=function(d){u.Log.debug("WebStorageStateStore.remove",d),d=this._prefix+d;var f=this._store.getItem(d);return this._store.removeItem(d),Promise.resolve(f)},p.prototype.getAllKeys=function(){u.Log.debug("WebStorageStateStore.getAllKeys");for(var d=[],f=0;f<this._store.length;f++){var m=this._store.key(f);m.indexOf(this._prefix)===0&&d.push(m.substr(this._prefix.length))}return Promise.resolve(d)},p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.JsonService=void 0;var u=s(0),c=s(1);function g(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}r.JsonService=function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c.Global.XMLHttpRequest,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;g(this,p),h&&Array.isArray(h)?this._contentTypes=h.slice():this._contentTypes=[],this._contentTypes.push("application/json"),f&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=d,this._jwtHandler=f}return p.prototype.getJson=function(d,f){var m=this;if(!d)throw u.Log.error("JsonService.getJson: No url passed"),new Error("url");return u.Log.debug("JsonService.getJson, url: ",d),new Promise(function(b,w){var C=new m._XMLHttpRequest;C.open("GET",d);var I=m._contentTypes,R=m._jwtHandler;C.onload=function(){if(u.Log.debug("JsonService.getJson: HTTP response received, status",C.status),C.status===200){var F=C.getResponseHeader("Content-Type");if(F){var A=I.find(function(x){if(F.startsWith(x))return!0});if(A=="application/jwt")return void R(C).then(b,w);if(A)try{return void b(JSON.parse(C.responseText))}catch(x){return u.Log.error("JsonService.getJson: Error parsing JSON response",x.message),void w(x)}}w(Error("Invalid response Content-Type: "+F+", from URL: "+d))}else w(Error(C.statusText+" ("+C.status+")"))},C.onerror=function(){u.Log.error("JsonService.getJson: network error"),w(Error("Network Error"))},f&&(u.Log.debug("JsonService.getJson: token passed, setting Authorization header"),C.setRequestHeader("Authorization","Bearer "+f)),C.send()})},p.prototype.postForm=function(d,f,m){var b=this;if(!d)throw u.Log.error("JsonService.postForm: No url passed"),new Error("url");return u.Log.debug("JsonService.postForm, url: ",d),new Promise(function(w,C){var I=new b._XMLHttpRequest;I.open("POST",d);var R=b._contentTypes;I.onload=function(){if(u.Log.debug("JsonService.postForm: HTTP response received, status",I.status),I.status!==200){if(I.status===400&&(N=I.getResponseHeader("Content-Type"))&&R.find(function(E){if(N.startsWith(E))return!0}))try{var O=JSON.parse(I.responseText);if(O&&O.error)return u.Log.error("JsonService.postForm: Error from server: ",O.error),void C(new Error(O.error))}catch(E){return u.Log.error("JsonService.postForm: Error parsing JSON response",E.message),void C(E)}C(Error(I.statusText+" ("+I.status+")"))}else{var N;if((N=I.getResponseHeader("Content-Type"))&&R.find(function(E){if(N.startsWith(E))return!0}))try{return void w(JSON.parse(I.responseText))}catch(E){return u.Log.error("JsonService.postForm: Error parsing JSON response",E.message),void C(E)}C(Error("Invalid response Content-Type: "+N+", from URL: "+d))}},I.onerror=function(){u.Log.error("JsonService.postForm: network error"),C(Error("Network Error"))};var F="";for(var A in f){var x=f[A];x&&(F.length>0&&(F+="&"),F+=encodeURIComponent(A),F+="=",F+=encodeURIComponent(x))}I.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),m!==void 0&&I.setRequestHeader("Authorization","Basic "+btoa(m)),I.send(F)})},p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SigninRequest=void 0;var u=s(0),c=s(3),g=s(13);r.SigninRequest=function(){function p(h){var d=h.url,f=h.client_id,m=h.redirect_uri,b=h.response_type,w=h.scope,C=h.authority,I=h.data,R=h.prompt,F=h.display,A=h.max_age,x=h.ui_locales,O=h.id_token_hint,N=h.login_hint,E=h.acr_values,U=h.resource,K=h.response_mode,X=h.request,M=h.request_uri,ue=h.extraQueryParams,fe=h.request_type,be=h.client_secret,Se=h.extraTokenParams,Ce=h.skipUserInfo;if(function(De,_t){if(!(De instanceof _t))throw new TypeError("Cannot call a class as a function")}(this,p),!d)throw u.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!f)throw u.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!m)throw u.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!b)throw u.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!w)throw u.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!C)throw u.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var Oe=p.isOidc(b),qe=p.isCode(b);K||(K=p.isCode(b)?"query":null),this.state=new g.SigninState({nonce:Oe,data:I,client_id:f,authority:C,redirect_uri:m,code_verifier:qe,request_type:fe,response_mode:K,client_secret:be,scope:w,extraTokenParams:Se,skipUserInfo:Ce}),d=c.UrlUtility.addQueryParam(d,"client_id",f),d=c.UrlUtility.addQueryParam(d,"redirect_uri",m),d=c.UrlUtility.addQueryParam(d,"response_type",b),d=c.UrlUtility.addQueryParam(d,"scope",w),d=c.UrlUtility.addQueryParam(d,"state",this.state.id),Oe&&(d=c.UrlUtility.addQueryParam(d,"nonce",this.state.nonce)),qe&&(d=c.UrlUtility.addQueryParam(d,"code_challenge",this.state.code_challenge),d=c.UrlUtility.addQueryParam(d,"code_challenge_method","S256"));var Fe={prompt:R,display:F,max_age:A,ui_locales:x,id_token_hint:O,login_hint:N,acr_values:E,resource:U,request:X,request_uri:M,response_mode:K};for(var Ee in Fe)Fe[Ee]&&(d=c.UrlUtility.addQueryParam(d,Ee,Fe[Ee]));for(var Te in ue)d=c.UrlUtility.addQueryParam(d,Te,ue[Te]);this.url=d}return p.isOidc=function(d){return!!d.split(/\s+/g).filter(function(f){return f==="id_token"})[0]},p.isOAuth=function(d){return!!d.split(/\s+/g).filter(function(f){return f==="token"})[0]},p.isCode=function(d){return!!d.split(/\s+/g).filter(function(f){return f==="code"})[0]},p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.State=void 0;var u=function(){function h(d,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(d,b.key,b)}}return function(d,f,m){return f&&h(d.prototype,f),m&&h(d,m),d}}(),c=s(0),g=function(d){return d&&d.__esModule?d:{default:d}}(s(14));function p(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")}r.State=function(){function h(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=d.id,m=d.data,b=d.created,w=d.request_type;p(this,h),this._id=f||(0,g.default)(),this._data=m,this._created=typeof b=="number"&&b>0?b:parseInt(Date.now()/1e3),this._request_type=w}return h.prototype.toStorageString=function(){return c.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},h.fromStorageString=function(f){return c.Log.debug("State.fromStorageString"),new h(JSON.parse(f))},h.clearStaleState=function(f,m){var b=Date.now()/1e3-m;return f.getAllKeys().then(function(w){c.Log.debug("State.clearStaleState: got keys",w);for(var C=[],I=function(x){var O=w[x];F=f.get(O).then(function(N){var E=!1;if(N)try{var U=h.fromStorageString(N);c.Log.debug("State.clearStaleState: got item from key: ",O,U.created),U.created<=b&&(E=!0)}catch(K){c.Log.error("State.clearStaleState: Error parsing state for key",O,K.message),E=!0}else c.Log.debug("State.clearStaleState: no item in storage for key: ",O),E=!0;if(E)return c.Log.debug("State.clearStaleState: removed item for key: ",O),f.remove(O)}),C.push(F)},R=0;R<w.length;R++){var F;I(R)}return c.Log.debug("State.clearStaleState: waiting on promise count:",C.length),Promise.all(C)})},u(h,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),h}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.OidcClient=void 0;var u=function(){function I(R,F){for(var A=0;A<F.length;A++){var x=F[A];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(R,x.key,x)}}return function(R,F,A){return F&&I(R.prototype,F),A&&I(R,A),R}}(),c=s(0),g=s(5),p=s(12),h=s(8),d=s(34),f=s(35),m=s(36),b=s(13),w=s(9);function C(I,R){if(!(I instanceof R))throw new TypeError("Cannot call a class as a function")}r.OidcClient=function(){function I(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};C(this,I),R instanceof g.OidcClientSettings?this._settings=R:this._settings=new g.OidcClientSettings(R)}return I.prototype.createSigninRequest=function(){var F=this,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=A.response_type,O=A.scope,N=A.redirect_uri,E=A.data,U=A.state,K=A.prompt,X=A.display,M=A.max_age,ue=A.ui_locales,fe=A.id_token_hint,be=A.login_hint,Se=A.acr_values,Ce=A.resource,Oe=A.request,qe=A.request_uri,Fe=A.response_mode,Ee=A.extraQueryParams,Te=A.extraTokenParams,ct=A.request_type,De=A.skipUserInfo,_t=arguments[1];c.Log.debug("OidcClient.createSigninRequest");var Pt=this._settings.client_id;x=x||this._settings.response_type,O=O||this._settings.scope,N=N||this._settings.redirect_uri,K=K||this._settings.prompt,X=X||this._settings.display,M=M||this._settings.max_age,ue=ue||this._settings.ui_locales,Se=Se||this._settings.acr_values,Ce=Ce||this._settings.resource,Fe=Fe||this._settings.response_mode,Ee=Ee||this._settings.extraQueryParams,Te=Te||this._settings.extraTokenParams;var $t=this._settings.authority;return h.SigninRequest.isCode(x)&&x!=="code"?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then(function(Tt){c.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",Tt);var ot=new h.SigninRequest({url:Tt,client_id:Pt,redirect_uri:N,response_type:x,scope:O,data:E||U,authority:$t,prompt:K,display:X,max_age:M,ui_locales:ue,id_token_hint:fe,login_hint:be,acr_values:Se,resource:Ce,request:Oe,request_uri:qe,extraQueryParams:Ee,extraTokenParams:Te,request_type:ct,response_mode:Fe,client_secret:F._settings.client_secret,skipUserInfo:De}),bt=ot.state;return(_t=_t||F._stateStore).set(bt.id,bt.toStorageString()).then(function(){return ot})})},I.prototype.readSigninResponseState=function(F,A){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];c.Log.debug("OidcClient.readSigninResponseState");var O=this._settings.response_mode==="query"||!this._settings.response_mode&&h.SigninRequest.isCode(this._settings.response_type),N=O?"?":"#",E=new d.SigninResponse(F,N);if(!E.state)return c.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));A=A||this._stateStore;var U=x?A.remove.bind(A):A.get.bind(A);return U(E.state).then(function(K){if(!K)throw c.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:b.SigninState.fromStorageString(K),response:E}})},I.prototype.processSigninResponse=function(F,A){var x=this;return c.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(F,A,!0).then(function(O){var N=O.state,E=O.response;return c.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),x._validator.validateSigninResponse(N,E)})},I.prototype.createSignoutRequest=function(){var F=this,A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=A.id_token_hint,O=A.data,N=A.state,E=A.post_logout_redirect_uri,U=A.extraQueryParams,K=A.request_type,X=arguments[1];return c.Log.debug("OidcClient.createSignoutRequest"),E=E||this._settings.post_logout_redirect_uri,U=U||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then(function(M){if(!M)throw c.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");c.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",M);var ue=new f.SignoutRequest({url:M,id_token_hint:x,post_logout_redirect_uri:E,data:O||N,extraQueryParams:U,request_type:K}),fe=ue.state;return fe&&(c.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(X=X||F._stateStore).set(fe.id,fe.toStorageString())),ue})},I.prototype.readSignoutResponseState=function(F,A){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];c.Log.debug("OidcClient.readSignoutResponseState");var O=new m.SignoutResponse(F);if(!O.state)return c.Log.debug("OidcClient.readSignoutResponseState: No state in response"),O.error?(c.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",O.error),Promise.reject(new p.ErrorResponse(O))):Promise.resolve({state:void 0,response:O});var N=O.state;A=A||this._stateStore;var E=x?A.remove.bind(A):A.get.bind(A);return E(N).then(function(U){if(!U)throw c.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:w.State.fromStorageString(U),response:O}})},I.prototype.processSignoutResponse=function(F,A){var x=this;return c.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(F,A,!0).then(function(O){var N=O.state,E=O.response;return N?(c.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),x._validator.validateSignoutResponse(N,E)):(c.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),E)})},I.prototype.clearStaleState=function(F){return c.Log.debug("OidcClient.clearStaleState"),F=F||this._stateStore,w.State.clearStaleState(F,this.settings.staleStateAge)},u(I,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),I}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.TokenClient=void 0;var u=s(7),c=s(2),g=s(0);function p(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")}r.TokenClient=function(){function h(d){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.JsonService,m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.MetadataService;if(p(this,h),!d)throw g.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=d,this._jsonService=new f,this._metadataService=new m(this._settings)}return h.prototype.exchangeCode=function(){var f=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(m=Object.assign({},m)).grant_type=m.grant_type||"authorization_code",m.client_id=m.client_id||this._settings.client_id,m.client_secret=m.client_secret||this._settings.client_secret,m.redirect_uri=m.redirect_uri||this._settings.redirect_uri;var b=void 0,w=m._client_authentication||this._settings._client_authentication;return delete m._client_authentication,m.code?m.redirect_uri?m.code_verifier?m.client_id?m.client_secret||w!="client_secret_basic"?(w=="client_secret_basic"&&(b=m.client_id+":"+m.client_secret,delete m.client_id,delete m.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(C){return g.Log.debug("TokenClient.exchangeCode: Received token endpoint"),f._jsonService.postForm(C,m,b).then(function(I){return g.Log.debug("TokenClient.exchangeCode: response received"),I})})):(g.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(g.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(g.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(g.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(g.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},h.prototype.exchangeRefreshToken=function(){var f=this,m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(m=Object.assign({},m)).grant_type=m.grant_type||"refresh_token",m.client_id=m.client_id||this._settings.client_id,m.client_secret=m.client_secret||this._settings.client_secret;var b=void 0,w=m._client_authentication||this._settings._client_authentication;return delete m._client_authentication,m.refresh_token?m.client_id?(w=="client_secret_basic"&&(b=m.client_id+":"+m.client_secret,delete m.client_id,delete m.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(C){return g.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),f._jsonService.postForm(C,m,b).then(function(I){return g.Log.debug("TokenClient.exchangeRefreshToken: response received"),I})})):(g.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(g.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},h}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.ErrorResponse=void 0;var u=s(0);function c(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function g(p,h){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!h||typeof h!="object"&&typeof h!="function"?p:h}r.ErrorResponse=function(p){function h(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=d.error,m=d.error_description,b=d.error_uri,w=d.state,C=d.session_state;if(c(this,h),!f)throw u.Log.error("No error passed to ErrorResponse"),new Error("error");var I=g(this,p.call(this,m||f));return I.name="ErrorResponse",I.error=f,I.error_description=m,I.error_uri=b,I.state=w,I.session_state=C,I}return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}(h,p),h}(Error)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SigninState=void 0;var u=function(){function m(b,w){for(var C=0;C<w.length;C++){var I=w[C];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(b,I.key,I)}}return function(b,w,C){return w&&m(b.prototype,w),C&&m(b,C),b}}(),c=s(0),g=s(9),p=s(4),h=function(b){return b&&b.__esModule?b:{default:b}}(s(14));function d(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function f(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||typeof b!="object"&&typeof b!="function"?m:b}r.SigninState=function(m){function b(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=w.nonce,I=w.authority,R=w.client_id,F=w.redirect_uri,A=w.code_verifier,x=w.response_mode,O=w.client_secret,N=w.scope,E=w.extraTokenParams,U=w.skipUserInfo;d(this,b);var K=f(this,m.call(this,arguments[0]));if(C===!0?K._nonce=(0,h.default)():C&&(K._nonce=C),A===!0?K._code_verifier=(0,h.default)()+(0,h.default)()+(0,h.default)():A&&(K._code_verifier=A),K.code_verifier){var X=p.JoseUtil.hashString(K.code_verifier,"SHA256");K._code_challenge=p.JoseUtil.hexToBase64Url(X)}return K._redirect_uri=F,K._authority=I,K._client_id=R,K._response_mode=x,K._client_secret=O,K._scope=N,K._extraTokenParams=E,K._skipUserInfo=U,K}return function(C,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);C.prototype=Object.create(I&&I.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(C,I):C.__proto__=I)}(b,m),b.prototype.toStorageString=function(){return c.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},b.fromStorageString=function(C){return c.Log.debug("SigninState.fromStorageString"),new b(JSON.parse(C))},u(b,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),b}(g.State)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return(u!="undefined"&&u!==null&&u.getRandomValues!==void 0?c:g)().replace(/-/g,"")};var u=typeof window<"u"?window.crypto||window.msCrypto:null;function c(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(p){return(p^u.getRandomValues(new Uint8Array(1))[0]&15>>p/4).toString(16)})}function g(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(p){return(p^16*Math.random()>>p/4).toString(16)})}n.exports=r.default},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.User=void 0;var u=function(){function g(p,h){for(var d=0;d<h.length;d++){var f=h[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,h,d){return h&&g(p.prototype,h),d&&g(p,d),p}}(),c=s(0);r.User=function(){function g(p){var h=p.id_token,d=p.session_state,f=p.access_token,m=p.refresh_token,b=p.token_type,w=p.scope,C=p.profile,I=p.expires_at,R=p.state;(function(A,x){if(!(A instanceof x))throw new TypeError("Cannot call a class as a function")})(this,g),this.id_token=h,this.session_state=d,this.access_token=f,this.refresh_token=m,this.token_type=b,this.scope=w,this.profile=C,this.expires_at=I,this.state=R}return g.prototype.toStorageString=function(){return c.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},g.fromStorageString=function(h){return c.Log.debug("User.fromStorageString"),new g(JSON.parse(h))},u(g,[{key:"expires_in",get:function(){if(this.expires_at){var h=parseInt(Date.now()/1e3);return this.expires_at-h}},set:function(h){var d=parseInt(h);if(typeof d=="number"&&d>0){var f=parseInt(Date.now()/1e3);this.expires_at=f+d}}},{key:"expired",get:function(){var h=this.expires_in;if(h!==void 0)return h<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.AccessTokenEvents=void 0;var u=s(0),c=s(46);function g(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}r.AccessTokenEvents=function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=h.accessTokenExpiringNotificationTime,f=d===void 0?60:d,m=h.accessTokenExpiringTimer,b=m===void 0?new c.Timer("Access token expiring"):m,w=h.accessTokenExpiredTimer,C=w===void 0?new c.Timer("Access token expired"):w;g(this,p),this._accessTokenExpiringNotificationTime=f,this._accessTokenExpiring=b,this._accessTokenExpired=C}return p.prototype.load=function(d){if(d.access_token&&d.expires_in!==void 0){var f=d.expires_in;if(u.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",f),f>0){var m=f-this._accessTokenExpiringNotificationTime;m<=0&&(m=1),u.Log.debug("AccessTokenEvents.load: registering expiring timer in:",m),this._accessTokenExpiring.init(m)}else u.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var b=f+1;u.Log.debug("AccessTokenEvents.load: registering expired timer in:",b),this._accessTokenExpired.init(b)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},p.prototype.unload=function(){u.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},p.prototype.addAccessTokenExpiring=function(d){this._accessTokenExpiring.addHandler(d)},p.prototype.removeAccessTokenExpiring=function(d){this._accessTokenExpiring.removeHandler(d)},p.prototype.addAccessTokenExpired=function(d){this._accessTokenExpired.addHandler(d)},p.prototype.removeAccessTokenExpired=function(d){this._accessTokenExpired.removeHandler(d)},p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.Event=void 0;var u=s(0);r.Event=function(){function c(g){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,c),this._name=g,this._callbacks=[]}return c.prototype.addHandler=function(p){this._callbacks.push(p)},c.prototype.removeHandler=function(p){var h=this._callbacks.findIndex(function(d){return d===p});h>=0&&this._callbacks.splice(h,1)},c.prototype.raise=function(){u.Log.debug("Event: Raising event: "+this._name);for(var p=0;p<this._callbacks.length;p++){var h;(h=this._callbacks)[p].apply(h,arguments)}},c}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SessionMonitor=void 0;var u=function(){function d(f,m){for(var b=0;b<m.length;b++){var w=m[b];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(f,w.key,w)}}return function(f,m,b){return m&&d(f.prototype,m),b&&d(f,b),f}}(),c=s(0),g=s(19),p=s(1);function h(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")}r.SessionMonitor=function(){function d(f){var m=this,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.CheckSessionIFrame,w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.Global.timer;if(h(this,d),!f)throw c.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=f,this._CheckSessionIFrameCtor=b,this._timer=w,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then(function(C){C?m._start(C):m._settings.monitorAnonymousSession&&m._userManager.querySessionStatus().then(function(I){var R={session_state:I.session_state};I.sub&&I.sid&&(R.profile={sub:I.sub,sid:I.sid}),m._start(R)}).catch(function(I){c.Log.error("SessionMonitor ctor: error from querySessionStatus:",I.message)})}).catch(function(C){c.Log.error("SessionMonitor ctor: error from getUser:",C.message)}))}return d.prototype._start=function(m){var b=this,w=m.session_state;w&&(m.profile?(this._sub=m.profile.sub,this._sid=m.profile.sid,c.Log.debug("SessionMonitor._start: session_state:",w,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,c.Log.debug("SessionMonitor._start: session_state:",w,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(w):this._metadataService.getCheckSessionIframe().then(function(C){if(C){c.Log.debug("SessionMonitor._start: Initializing check session iframe");var I=b._client_id,R=b._checkSessionInterval,F=b._stopCheckSessionOnError;b._checkSessionIFrame=new b._CheckSessionIFrameCtor(b._callback.bind(b),I,C,R,F),b._checkSessionIFrame.load().then(function(){b._checkSessionIFrame.start(w)})}else c.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")}).catch(function(C){c.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",C.message)}))},d.prototype._stop=function(){var m=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(c.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var b=this._timer.setInterval(function(){m._timer.clearInterval(b),m._userManager.querySessionStatus().then(function(w){var C={session_state:w.session_state};w.sub&&w.sid&&(C.profile={sub:w.sub,sid:w.sid}),m._start(C)}).catch(function(w){c.Log.error("SessionMonitor: error from querySessionStatus:",w.message)})},1e3)},d.prototype._callback=function(){var m=this;this._userManager.querySessionStatus().then(function(b){var w=!0;b?b.sub===m._sub?(w=!1,m._checkSessionIFrame.start(b.session_state),b.sid===m._sid?c.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",b.session_state):(c.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",b.session_state),m._userManager.events._raiseUserSessionChanged())):c.Log.debug("SessionMonitor._callback: Different subject signed into OP:",b.sub):c.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),w&&(m._sub?(c.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),m._userManager.events._raiseUserSignedOut()):(c.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),m._userManager.events._raiseUserSignedIn()))}).catch(function(b){m._sub&&(c.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",b.message),m._userManager.events._raiseUserSignedOut())})},u(d,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),d}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.CheckSessionIFrame=void 0;var u=s(0);function c(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")}r.CheckSessionIFrame=function(){function g(p,h,d,f){var m=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];c(this,g),this._callback=p,this._client_id=h,this._url=d,this._interval=f||2e3,this._stopOnError=m;var b=d.indexOf("/",d.indexOf("//")+2);this._frame_origin=d.substr(0,b),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=d}return g.prototype.load=function(){var h=this;return new Promise(function(d){h._frame.onload=function(){d()},window.document.body.appendChild(h._frame),h._boundMessageEvent=h._message.bind(h),window.addEventListener("message",h._boundMessageEvent,!1)})},g.prototype._message=function(h){h.origin===this._frame_origin&&h.source===this._frame.contentWindow&&(h.data==="error"?(u.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):h.data==="changed"?(u.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):u.Log.debug("CheckSessionIFrame: "+h.data+" message from check session op iframe"))},g.prototype.start=function(h){var d=this;if(this._session_state!==h){u.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=h;var f=function(){d._frame.contentWindow.postMessage(d._client_id+" "+d._session_state,d._frame_origin)};f(),this._timer=window.setInterval(f,this._interval)}},g.prototype.stop=function(){this._session_state=null,this._timer&&(u.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.TokenRevocationClient=void 0;var u=s(0),c=s(2),g=s(1);function p(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}var h="access_token",d="refresh_token";r.TokenRevocationClient=function(){function f(m){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.Global.XMLHttpRequest,w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.MetadataService;if(p(this,f),!m)throw u.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=m,this._XMLHttpRequestCtor=b,this._metadataService=new w(this._settings)}return f.prototype.revoke=function(b,w){var C=this,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"access_token";if(!b)throw u.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(I!==h&&I!=d)throw u.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then(function(R){if(R){u.Log.debug("TokenRevocationClient.revoke: Revoking "+I);var F=C._settings.client_id,A=C._settings.client_secret;return C._revoke(R,F,A,b,I)}if(w)throw u.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")})},f.prototype._revoke=function(b,w,C,I,R){var F=this;return new Promise(function(A,x){var O=new F._XMLHttpRequestCtor;O.open("POST",b),O.onload=function(){u.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",O.status),O.status===200?A():x(Error(O.statusText+" ("+O.status+")"))},O.onerror=function(){u.Log.debug("TokenRevocationClient.revoke: Network Error."),x("Network Error")};var N="client_id="+encodeURIComponent(w);C&&(N+="&client_secret="+encodeURIComponent(C)),N+="&token_type_hint="+encodeURIComponent(R),N+="&token="+encodeURIComponent(I),O.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),O.send(N)})},f}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.CordovaPopupWindow=void 0;var u=function(){function g(p,h){for(var d=0;d<h.length;d++){var f=h[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,h,d){return h&&g(p.prototype,h),d&&g(p,d),p}}(),c=s(0);r.CordovaPopupWindow=function(){function g(p){var h=this;(function(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")})(this,g),this._promise=new Promise(function(d,f){h._resolve=d,h._reject=f}),this.features=p.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=p.popupWindowTarget||"_blank",this.redirect_uri=p.startUrl,c.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return g.prototype._isInAppBrowserInstalled=function(h){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some(function(d){return h.hasOwnProperty(d)})},g.prototype.navigate=function(h){if(h&&h.url){if(!window.cordova)return this._error("cordova is undefined");var d=window.cordova.require("cordova/plugin_list").metadata;if(this._isInAppBrowserInstalled(d)===!1)return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(h.url,this.target,this.features),this._popup?(c.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},g.prototype._loadStartCallback=function(h){h.url.indexOf(this.redirect_uri)===0&&this._success({url:h.url})},g.prototype._exitCallback=function(h){this._error(h)},g.prototype._success=function(h){this._cleanup(),c.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(h)},g.prototype._error=function(h){this._cleanup(),c.Log.error(h),this._reject(new Error(h))},g.prototype.close=function(){this._cleanup()},g.prototype._cleanup=function(){this._popup&&(c.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},u(g,[{key:"promise",get:function(){return this._promise}}]),g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0});var u=s(0),c=s(10),g=s(5),p=s(6),h=s(37),d=s(38),f=s(16),m=s(2),b=s(48),w=s(49),C=s(19),I=s(20),R=s(18),F=s(1),A=s(15),x=s(50);r.default={Version:x.Version,Log:u.Log,OidcClient:c.OidcClient,OidcClientSettings:g.OidcClientSettings,WebStorageStateStore:p.WebStorageStateStore,InMemoryWebStorage:h.InMemoryWebStorage,UserManager:d.UserManager,AccessTokenEvents:f.AccessTokenEvents,MetadataService:m.MetadataService,CordovaPopupNavigator:b.CordovaPopupNavigator,CordovaIFrameNavigator:w.CordovaIFrameNavigator,CheckSessionIFrame:C.CheckSessionIFrame,TokenRevocationClient:I.TokenRevocationClient,SessionMonitor:R.SessionMonitor,Global:F.Global,User:A.User},n.exports=r.default},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.ClockService=function(){function u(){(function(g,p){if(!(g instanceof p))throw new TypeError("Cannot call a class as a function")})(this,u)}return u.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},u}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.ResponseValidator=void 0;var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},c=s(0),g=s(2),p=s(25),h=s(11),d=s(12),f=s(4);function m(w,C){if(!(w instanceof C))throw new TypeError("Cannot call a class as a function")}var b=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];r.ResponseValidator=function(){function w(C){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.MetadataService,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.UserInfoService,F=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.JoseUtil,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:h.TokenClient;if(m(this,w),!C)throw c.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=C,this._metadataService=new I(this._settings),this._userInfoService=new R(this._settings),this._joseUtil=F,this._tokenClient=new A(this._settings)}return w.prototype.validateSigninResponse=function(I,R){var F=this;return c.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(I,R).then(function(A){return c.Log.debug("ResponseValidator.validateSigninResponse: state processed"),F._validateTokens(I,A).then(function(x){return c.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),F._processClaims(I,x).then(function(O){return c.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),O})})})},w.prototype.validateSignoutResponse=function(I,R){return I.id!==R.state?(c.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(c.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),R.state=I.data,R.error?(c.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",R.error),Promise.reject(new d.ErrorResponse(R))):Promise.resolve(R))},w.prototype._processSigninParams=function(I,R){if(I.id!==R.state)return c.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!I.client_id)return c.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!I.authority)return c.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==I.authority)return c.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=I.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==I.client_id)return c.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=I.client_id;return c.Log.debug("ResponseValidator._processSigninParams: state validated"),R.state=I.data,R.error?(c.Log.warn("ResponseValidator._processSigninParams: Response was error",R.error),Promise.reject(new d.ErrorResponse(R))):I.nonce&&!R.id_token?(c.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!I.nonce&&R.id_token?(c.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):I.code_verifier&&!R.code?(c.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!I.code_verifier&&R.code?(c.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(R.scope||(R.scope=I.scope),Promise.resolve(R))},w.prototype._processClaims=function(I,R){var F=this;if(R.isOpenIdConnect){if(c.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),R.profile=this._filterProtocolClaims(R.profile),I.skipUserInfo!==!0&&this._settings.loadUserInfo&&R.access_token)return c.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(R.access_token).then(function(A){return c.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),A.sub!==R.profile.sub?(c.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(R.profile=F._mergeClaims(R.profile,A),c.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",R.profile),R)});c.Log.debug("ResponseValidator._processClaims: not loading user info")}else c.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(R)},w.prototype._mergeClaims=function(I,R){var F=Object.assign({},I);for(var A in R){var x=R[A];Array.isArray(x)||(x=[x]);for(var O=0;O<x.length;O++){var N=x[O];F[A]?Array.isArray(F[A])?F[A].indexOf(N)<0&&F[A].push(N):F[A]!==N&&((N===void 0?"undefined":u(N))==="object"&&this._settings.mergeClaims?F[A]=this._mergeClaims(F[A],N):F[A]=[F[A],N]):F[A]=N}}return F},w.prototype._filterProtocolClaims=function(I){c.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",I);var R=Object.assign({},I);return this._settings._filterProtocolClaims?(b.forEach(function(F){delete R[F]}),c.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",R)):c.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),R},w.prototype._validateTokens=function(I,R){return R.code?(c.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(I,R)):R.id_token?R.access_token?(c.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(I,R)):(c.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(I,R)):(c.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(R))},w.prototype._processCode=function(I,R){var F=this,A={client_id:I.client_id,client_secret:I.client_secret,code:R.code,redirect_uri:I.redirect_uri,code_verifier:I.code_verifier};return I.extraTokenParams&&u(I.extraTokenParams)==="object"&&Object.assign(A,I.extraTokenParams),this._tokenClient.exchangeCode(A).then(function(x){for(var O in x)R[O]=x[O];return R.id_token?(c.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),F._validateIdTokenAttributes(I,R)):(c.Log.debug("ResponseValidator._processCode: token response successful, returning response"),R)})},w.prototype._validateIdTokenAttributes=function(I,R){var F=this;return this._metadataService.getIssuer().then(function(A){var x=I.client_id,O=F._settings.clockSkew;return c.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",O),F._settings.getEpochTime().then(function(N){return F._joseUtil.validateJwtAttributes(R.id_token,A,x,O,N).then(function(E){return I.nonce&&I.nonce!==E.nonce?(c.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):E.sub?(R.profile=E,R):(c.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})})},w.prototype._validateIdTokenAndAccessToken=function(I,R){var F=this;return this._validateIdToken(I,R).then(function(A){return F._validateAccessToken(A)})},w.prototype._getSigningKeyForJwt=function(I){var R=this;return this._metadataService.getSigningKeys().then(function(F){var A=I.header.kid;if(!F)return c.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));c.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var x=void 0;if(A)x=F.filter(function(O){return O.kid===A})[0];else{if((F=R._filterByAlg(F,I.header.alg)).length>1)return c.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));x=F[0]}return Promise.resolve(x)})},w.prototype._getSigningKeyForJwtWithSingleRetry=function(I){var R=this;return this._getSigningKeyForJwt(I).then(function(F){return F?Promise.resolve(F):(R._metadataService.resetSigningKeys(),R._getSigningKeyForJwt(I))})},w.prototype._validateIdToken=function(I,R){var F=this;if(!I.nonce)return c.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var A=this._joseUtil.parseJwt(R.id_token);return A&&A.header&&A.payload?I.nonce!==A.payload.nonce?(c.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then(function(x){return c.Log.debug("ResponseValidator._validateIdToken: Received issuer"),F._getSigningKeyForJwtWithSingleRetry(A).then(function(O){if(!O)return c.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var N=I.client_id,E=F._settings.clockSkew;return c.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",E),F._joseUtil.validateJwt(R.id_token,O,x,N,E).then(function(){return c.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),A.payload.sub?(R.profile=A.payload,R):(c.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})}):(c.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",A),Promise.reject(new Error("Failed to parse id_token")))},w.prototype._filterByAlg=function(I,R){var F=null;if(R.startsWith("RS"))F="RSA";else if(R.startsWith("PS"))F="PS";else{if(!R.startsWith("ES"))return c.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",R),[];F="EC"}return c.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",F),I=I.filter(function(A){return A.kty===F}),c.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",F,I.length),I},w.prototype._validateAccessToken=function(I){if(!I.profile)return c.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!I.profile.at_hash)return c.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!I.id_token)return c.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var R=this._joseUtil.parseJwt(I.id_token);if(!R||!R.header)return c.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",R),Promise.reject(new Error("Failed to parse id_token"));var F=R.header.alg;if(!F||F.length!==5)return c.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F),Promise.reject(new Error("Unsupported alg: "+F));var A=F.substr(2,3);if(!A)return c.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,A),Promise.reject(new Error("Unsupported alg: "+F));if((A=parseInt(A))!==256&&A!==384&&A!==512)return c.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,A),Promise.reject(new Error("Unsupported alg: "+F));var x="sha"+A,O=this._joseUtil.hashString(I.access_token,x);if(!O)return c.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",x),Promise.reject(new Error("Failed to validate at_hash"));var N=O.substr(0,O.length/2),E=this._joseUtil.hexToBase64Url(N);return E!==I.profile.at_hash?(c.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",E,I.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(c.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(I))},w}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.UserInfoService=void 0;var u=s(7),c=s(2),g=s(0),p=s(4);function h(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")}r.UserInfoService=function(){function d(f){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.JsonService,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c.MetadataService,w=arguments.length>3&&arguments[3]!==void 0?arguments[3]:p.JoseUtil;if(h(this,d),!f)throw g.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=f,this._jsonService=new m(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new b(this._settings),this._joseUtil=w}return d.prototype.getClaims=function(m){var b=this;return m?this._metadataService.getUserInfoEndpoint().then(function(w){return g.Log.debug("UserInfoService.getClaims: received userinfo url",w),b._jsonService.getJson(w,m).then(function(C){return g.Log.debug("UserInfoService.getClaims: claims received",C),C})}):(g.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},d.prototype._getClaimsFromJwt=function(m){var b=this;try{var w=this._joseUtil.parseJwt(m.responseText);if(!w||!w.header||!w.payload)return g.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",w),Promise.reject(new Error("Failed to parse id_token"));var C=w.header.kid,I=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":I=this._metadataService.getIssuer();break;case"ANY":I=Promise.resolve(w.payload.iss);break;default:I=Promise.resolve(this._settings.userInfoJwtIssuer)}return I.then(function(R){return g.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+R),b._metadataService.getSigningKeys().then(function(F){if(!F)return g.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));g.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var A=void 0;if(C)A=F.filter(function(N){return N.kid===C})[0];else{if((F=b._filterByAlg(F,w.header.alg)).length>1)return g.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));A=F[0]}if(!A)return g.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var x=b._settings.client_id,O=b._settings.clockSkew;return g.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",O),b._joseUtil.validateJwt(m.responseText,A,R,x,O,void 0,!0).then(function(){return g.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),w.payload})})})}catch(R){return g.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",R.message),void reject(R)}},d.prototype._filterByAlg=function(m,b){var w=null;if(b.startsWith("RS"))w="RSA";else if(b.startsWith("PS"))w="PS";else{if(!b.startsWith("ES"))return g.Log.debug("UserInfoService._filterByAlg: alg not supported: ",b),[];w="EC"}return g.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",w),m=m.filter(function(C){return C.kty===w}),g.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",w,m.length),m},d}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.AllowedSigningAlgs=r.b64tohex=r.hextob64u=r.crypto=r.X509=r.KeyUtil=r.jws=void 0;var u=s(27);r.jws=u.jws,r.KeyUtil=u.KEYUTIL,r.X509=u.X509,r.crypto=u.crypto,r.hextob64u=u.hextob64u,r.b64tohex=u.b64tohex,r.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(n,r,s){(function(u){Object.defineProperty(r,"__esModule",{value:!0});var c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},g={userAgent:!1},p={};/*!
5
- Copyright (c) 2011, Yahoo! Inc. All rights reserved.
6
- Code licensed under the BSD License:
7
- http://developer.yahoo.com/yui/license.html
8
- version: 2.9.0
9
- */if(h===void 0)var h={};h.lang={extend:function(i,a,l){if(!a||!i)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var v=function(){};if(v.prototype=a.prototype,i.prototype=new v,i.prototype.constructor=i,i.superclass=a.prototype,a.prototype.constructor==Object.prototype.constructor&&(a.prototype.constructor=a),l){var y;for(y in l)i.prototype[y]=l[y];var P=function(){},B=["toString","valueOf"];try{/MSIE/.test(g.userAgent)&&(P=function(j,H){for(y=0;y<B.length;y+=1){var q=B[y],W=H[q];typeof W=="function"&&W!=Object.prototype[q]&&(j[q]=W)}})}catch{}P(i.prototype,l)}}};/*! CryptoJS v3.1.2 core-fix.js
10
- * code.google.com/p/crypto-js
11
- * (c) 2009-2013 by Jeff Mott. All rights reserved.
12
- * code.google.com/p/crypto-js/wiki/License
13
- * THIS IS FIX of 'core.js' to fix Hmac issue.
14
- * https://code.google.com/p/crypto-js/issues/detail?id=84
15
- * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
16
- */var d,f,m,b,w,C,I,R,F,A,x,O=O||(d=Math,m=(f={}).lib={},b=m.Base=function(){function o(){}return{extend:function(a){o.prototype=this;var l=new o;return a&&l.mixIn(a),l.hasOwnProperty("init")||(l.init=function(){l.$super.init.apply(this,arguments)}),l.init.prototype=l,l.$super=this,l},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var l in a)a.hasOwnProperty(l)&&(this[l]=a[l]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),w=m.WordArray=b.extend({init:function(i,a){i=this.words=i||[],this.sigBytes=a??4*i.length},toString:function(i){return(i||I).stringify(this)},concat:function(i){var a=this.words,l=i.words,v=this.sigBytes,y=i.sigBytes;if(this.clamp(),v%4)for(var P=0;P<y;P++){var B=l[P>>>2]>>>24-P%4*8&255;a[v+P>>>2]|=B<<24-(v+P)%4*8}else for(P=0;P<y;P+=4)a[v+P>>>2]=l[P>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=d.ceil(a/4)},clone:function(){var i=b.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],l=0;l<i;l+=4)a.push(4294967296*d.random()|0);return new w.init(a,i)}}),C=f.enc={},I=C.Hex={stringify:function(i){for(var a=i.words,l=i.sigBytes,v=[],y=0;y<l;y++){var P=a[y>>>2]>>>24-y%4*8&255;v.push((P>>>4).toString(16)),v.push((15&P).toString(16))}return v.join("")},parse:function(i){for(var a=i.length,l=[],v=0;v<a;v+=2)l[v>>>3]|=parseInt(i.substr(v,2),16)<<24-v%8*4;return new w.init(l,a/2)}},R=C.Latin1={stringify:function(i){for(var a=i.words,l=i.sigBytes,v=[],y=0;y<l;y++){var P=a[y>>>2]>>>24-y%4*8&255;v.push(String.fromCharCode(P))}return v.join("")},parse:function(i){for(var a=i.length,l=[],v=0;v<a;v++)l[v>>>2]|=(255&i.charCodeAt(v))<<24-v%4*8;return new w.init(l,a)}},F=C.Utf8={stringify:function(i){try{return decodeURIComponent(escape(R.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return R.parse(unescape(encodeURIComponent(i)))}},A=m.BufferedBlockAlgorithm=b.extend({reset:function(){this._data=new w.init,this._nDataBytes=0},_append:function(i){typeof i=="string"&&(i=F.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes},_process:function(i){var a=this._data,l=a.words,v=a.sigBytes,y=this.blockSize,P=v/(4*y),B=(P=i?d.ceil(P):d.max((0|P)-this._minBufferSize,0))*y,L=d.min(4*B,v);if(B){for(var j=0;j<B;j+=y)this._doProcessBlock(l,j);var H=l.splice(0,B);a.sigBytes-=L}return new w.init(H,L)},clone:function(){var i=b.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0}),m.Hasher=A.extend({cfg:b.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset()},reset:function(){A.reset.call(this),this._doReset()},update:function(i){return this._append(i),this._process(),this},finalize:function(i){return i&&this._append(i),this._doFinalize()},blockSize:16,_createHelper:function(i){return function(a,l){return new i.init(l).finalize(a)}},_createHmacHelper:function(i){return function(a,l){return new x.HMAC.init(i,l).finalize(a)}}}),x=f.algo={},f);(function(o){var i,a=(i=O).lib,l=a.Base,v=a.WordArray;(i=i.x64={}).Word=l.extend({init:function(P,B){this.high=P,this.low=B}}),i.WordArray=l.extend({init:function(P,B){P=this.words=P||[],this.sigBytes=B??8*P.length},toX32:function(){for(var P=this.words,B=P.length,L=[],j=0;j<B;j++){var H=P[j];L.push(H.high),L.push(H.low)}return v.create(L,this.sigBytes)},clone:function(){for(var P=l.clone.call(this),B=P.words=this.words.slice(0),L=B.length,j=0;j<L;j++)B[j]=B[j].clone();return P}})})(),function(){var o=O,i=o.lib.WordArray;o.enc.Base64={stringify:function(l){var v=l.words,y=l.sigBytes,P=this._map;l.clamp(),l=[];for(var B=0;B<y;B+=3)for(var L=(v[B>>>2]>>>24-B%4*8&255)<<16|(v[B+1>>>2]>>>24-(B+1)%4*8&255)<<8|v[B+2>>>2]>>>24-(B+2)%4*8&255,j=0;4>j&&B+.75*j<y;j++)l.push(P.charAt(L>>>6*(3-j)&63));if(v=P.charAt(64))for(;l.length%4;)l.push(v);return l.join("")},parse:function(l){var v=l.length,y=this._map;(P=y.charAt(64))&&(P=l.indexOf(P))!=-1&&(v=P);for(var P=[],B=0,L=0;L<v;L++)if(L%4){var j=y.indexOf(l.charAt(L-1))<<L%4*2,H=y.indexOf(l.charAt(L))>>>6-L%4*2;P[B>>>2]|=(j|H)<<24-B%4*8,B++}return i.create(P,B)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(o){for(var i=O,a=(v=i.lib).WordArray,l=v.Hasher,v=i.algo,y=[],P=[],B=function(ne){return 4294967296*(ne-(0|ne))|0},L=2,j=0;64>j;){var H;e:{H=L;for(var q=o.sqrt(H),W=2;W<=q;W++)if(!(H%W)){H=!1;break e}H=!0}H&&(8>j&&(y[j]=B(o.pow(L,.5))),P[j]=B(o.pow(L,1/3)),j++),L++}var Q=[];v=v.SHA256=l.extend({_doReset:function(){this._hash=new a.init(y.slice(0))},_doProcessBlock:function(ne,re){for(var k=this._hash.words,V=k[0],$=k[1],J=k[2],te=k[3],ie=k[4],ve=k[5],ce=k[6],Ae=k[7],pe=0;64>pe;pe++){if(16>pe)Q[pe]=0|ne[re+pe];else{var _e=Q[pe-15],Me=Q[pe-2];Q[pe]=((_e<<25|_e>>>7)^(_e<<14|_e>>>18)^_e>>>3)+Q[pe-7]+((Me<<15|Me>>>17)^(Me<<13|Me>>>19)^Me>>>10)+Q[pe-16]}_e=Ae+((ie<<26|ie>>>6)^(ie<<21|ie>>>11)^(ie<<7|ie>>>25))+(ie&ve^~ie&ce)+P[pe]+Q[pe],Me=((V<<30|V>>>2)^(V<<19|V>>>13)^(V<<10|V>>>22))+(V&$^V&J^$&J),Ae=ce,ce=ve,ve=ie,ie=te+_e|0,te=J,J=$,$=V,V=_e+Me|0}k[0]=k[0]+V|0,k[1]=k[1]+$|0,k[2]=k[2]+J|0,k[3]=k[3]+te|0,k[4]=k[4]+ie|0,k[5]=k[5]+ve|0,k[6]=k[6]+ce|0,k[7]=k[7]+Ae|0},_doFinalize:function(){var ne=this._data,re=ne.words,k=8*this._nDataBytes,V=8*ne.sigBytes;return re[V>>>5]|=128<<24-V%32,re[14+(V+64>>>9<<4)]=o.floor(k/4294967296),re[15+(V+64>>>9<<4)]=k,ne.sigBytes=4*re.length,this._process(),this._hash},clone:function(){var ne=l.clone.call(this);return ne._hash=this._hash.clone(),ne}}),i.SHA256=l._createHelper(v),i.HmacSHA256=l._createHmacHelper(v)}(Math),function(){function o(){return l.create.apply(l,arguments)}for(var i=O,a=i.lib.Hasher,l=(y=i.x64).Word,v=y.WordArray,y=i.algo,P=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],B=[],L=0;80>L;L++)B[L]=o();y=y.SHA512=a.extend({_doReset:function(){this._hash=new v.init([new l.init(1779033703,4089235720),new l.init(3144134277,2227873595),new l.init(1013904242,4271175723),new l.init(2773480762,1595750129),new l.init(1359893119,2917565137),new l.init(2600822924,725511199),new l.init(528734635,4215389547),new l.init(1541459225,327033209)])},_doProcessBlock:function(H,q){for(var W=($=this._hash.words)[0],Q=$[1],ee=$[2],ne=$[3],re=$[4],k=$[5],V=$[6],$=$[7],J=W.high,te=W.low,ie=Q.high,ve=Q.low,ce=ee.high,Ae=ee.low,pe=ne.high,_e=ne.low,Me=re.high,We=re.low,Ve=k.high,Ot=k.low,wt=V.high,kt=V.low,Ze=$.high,at=$.low,gt=J,Ct=te,Nr=ie,rr=ve,Ur=ce,ir=Ae,eo=pe,xr=_e,Wt=Me,Ht=We,ai=Ve,Dr=Ot,ui=wt,Lr=kt,to=Ze,Mr=at,Jt=0;80>Jt;Jt++){var Ln=B[Jt];if(16>Jt)var fn=Ln.high=0|H[q+2*Jt],Je=Ln.low=0|H[q+2*Jt+1];else{fn=((Je=(fn=B[Jt-15]).high)>>>1|(hn=fn.low)<<31)^(Je>>>8|hn<<24)^Je>>>7;var hn=(hn>>>1|Je<<31)^(hn>>>8|Je<<24)^(hn>>>7|Je<<25),or=((Je=(or=B[Jt-2]).high)>>>19|(ut=or.low)<<13)^(Je<<3|ut>>>29)^Je>>>6,ut=(ut>>>19|Je<<13)^(ut<<3|Je>>>29)^(ut>>>6|Je<<26),no=(Je=B[Jt-7]).high,Mn=(jn=B[Jt-16]).high,jn=jn.low;fn=(fn=(fn=fn+no+((Je=hn+Je.low)>>>0<hn>>>0?1:0))+or+((Je=Je+ut)>>>0<ut>>>0?1:0))+Mn+((Je=Je+jn)>>>0<jn>>>0?1:0),Ln.high=fn,Ln.low=Je}no=Wt&ai^~Wt&ui,jn=Ht&Dr^~Ht&Lr,Ln=gt&Nr^gt&Ur^Nr&Ur;var Vl=Ct&rr^Ct&ir^rr&ir,ql=(hn=(gt>>>28|Ct<<4)^(gt<<30|Ct>>>2)^(gt<<25|Ct>>>7),or=(Ct>>>28|gt<<4)^(Ct<<30|gt>>>2)^(Ct<<25|gt>>>7),(ut=P[Jt]).high),zs=ut.low;Mn=to+((Wt>>>14|Ht<<18)^(Wt>>>18|Ht<<14)^(Wt<<23|Ht>>>9))+((ut=Mr+((Ht>>>14|Wt<<18)^(Ht>>>18|Wt<<14)^(Ht<<23|Wt>>>9)))>>>0<Mr>>>0?1:0),to=ui,Mr=Lr,ui=ai,Lr=Dr,ai=Wt,Dr=Ht,Wt=eo+(Mn=(Mn=(Mn=Mn+no+((ut=ut+jn)>>>0<jn>>>0?1:0))+ql+((ut=ut+zs)>>>0<zs>>>0?1:0))+fn+((ut=ut+Je)>>>0<Je>>>0?1:0))+((Ht=xr+ut|0)>>>0<xr>>>0?1:0)|0,eo=Ur,xr=ir,Ur=Nr,ir=rr,Nr=gt,rr=Ct,gt=Mn+(Ln=hn+Ln+((Je=or+Vl)>>>0<or>>>0?1:0))+((Ct=ut+Je|0)>>>0<ut>>>0?1:0)|0}te=W.low=te+Ct,W.high=J+gt+(te>>>0<Ct>>>0?1:0),ve=Q.low=ve+rr,Q.high=ie+Nr+(ve>>>0<rr>>>0?1:0),Ae=ee.low=Ae+ir,ee.high=ce+Ur+(Ae>>>0<ir>>>0?1:0),_e=ne.low=_e+xr,ne.high=pe+eo+(_e>>>0<xr>>>0?1:0),We=re.low=We+Ht,re.high=Me+Wt+(We>>>0<Ht>>>0?1:0),Ot=k.low=Ot+Dr,k.high=Ve+ai+(Ot>>>0<Dr>>>0?1:0),kt=V.low=kt+Lr,V.high=wt+ui+(kt>>>0<Lr>>>0?1:0),at=$.low=at+Mr,$.high=Ze+to+(at>>>0<Mr>>>0?1:0)},_doFinalize:function(){var H=this._data,q=H.words,W=8*this._nDataBytes,Q=8*H.sigBytes;return q[Q>>>5]|=128<<24-Q%32,q[30+(Q+128>>>10<<5)]=Math.floor(W/4294967296),q[31+(Q+128>>>10<<5)]=W,H.sigBytes=4*q.length,this._process(),this._hash.toX32()},clone:function(){var H=a.clone.call(this);return H._hash=this._hash.clone(),H},blockSize:32}),i.SHA512=a._createHelper(y),i.HmacSHA512=a._createHmacHelper(y)}(),function(){var o=O,i=(v=o.x64).Word,a=v.WordArray,l=(v=o.algo).SHA512,v=v.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var P=l._doFinalize.call(this);return P.sigBytes-=16,P}});o.SHA384=l._createHelper(v),o.HmacSHA384=l._createHmacHelper(v)}();/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
17
- */var N,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function U(o){var i,a,l="";for(i=0;i+3<=o.length;i+=3)a=parseInt(o.substring(i,i+3),16),l+=E.charAt(a>>6)+E.charAt(63&a);for(i+1==o.length?(a=parseInt(o.substring(i,i+1),16),l+=E.charAt(a<<2)):i+2==o.length&&(a=parseInt(o.substring(i,i+2),16),l+=E.charAt(a>>2)+E.charAt((3&a)<<4)),"=";(3&l.length)>0;)l+="=";return l}function K(o){var i,a,l,v="",y=0;for(i=0;i<o.length&&o.charAt(i)!="=";++i)(l=E.indexOf(o.charAt(i)))<0||(y==0?(v+=Ce(l>>2),a=3&l,y=1):y==1?(v+=Ce(a<<2|l>>4),a=15&l,y=2):y==2?(v+=Ce(a),v+=Ce(l>>2),a=3&l,y=3):(v+=Ce(a<<2|l>>4),v+=Ce(15&l),y=0));return y==1&&(v+=Ce(a<<2)),v}function X(o){var i,a=K(o),l=new Array;for(i=0;2*i<a.length;++i)l[i]=parseInt(a.substring(2*i,2*i+2),16);return l}function M(o,i,a){o!=null&&(typeof o=="number"?this.fromNumber(o,i,a):i==null&&typeof o!="string"?this.fromString(o,256):this.fromString(o,i))}function ue(){return new M(null)}g.appName=="Microsoft Internet Explorer"?(M.prototype.am=function(i,a,l,v,y,P){for(var B=32767&a,L=a>>15;--P>=0;){var j=32767&this[i],H=this[i++]>>15,q=L*j+H*B;y=((j=B*j+((32767&q)<<15)+l[v]+(1073741823&y))>>>30)+(q>>>15)+L*H+(y>>>30),l[v++]=1073741823&j}return y},N=30):g.appName!="Netscape"?(M.prototype.am=function(i,a,l,v,y,P){for(;--P>=0;){var B=a*this[i++]+l[v]+y;y=Math.floor(B/67108864),l[v++]=67108863&B}return y},N=26):(M.prototype.am=function(i,a,l,v,y,P){for(var B=16383&a,L=a>>14;--P>=0;){var j=16383&this[i],H=this[i++]>>14,q=L*j+H*B;y=((j=B*j+((16383&q)<<14)+l[v]+y)>>28)+(q>>14)+L*H,l[v++]=268435455&j}return y},N=28),M.prototype.DB=N,M.prototype.DM=(1<<N)-1,M.prototype.DV=1<<N,M.prototype.FV=Math.pow(2,52),M.prototype.F1=52-N,M.prototype.F2=2*N-52;var fe,be,Se=new Array;for(fe="0".charCodeAt(0),be=0;be<=9;++be)Se[fe++]=be;for(fe="a".charCodeAt(0),be=10;be<36;++be)Se[fe++]=be;for(fe="A".charCodeAt(0),be=10;be<36;++be)Se[fe++]=be;function Ce(o){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(o)}function Oe(o,i){var a=Se[o.charCodeAt(i)];return a??-1}function qe(o){var i=ue();return i.fromInt(o),i}function Fe(o){var i,a=1;return(i=o>>>16)!=0&&(o=i,a+=16),(i=o>>8)!=0&&(o=i,a+=8),(i=o>>4)!=0&&(o=i,a+=4),(i=o>>2)!=0&&(o=i,a+=2),(i=o>>1)!=0&&(o=i,a+=1),a}function Ee(o){this.m=o}function Te(o){this.m=o,this.mp=o.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<o.DB-15)-1,this.mt2=2*o.t}function ct(o,i){return o&i}function De(o,i){return o|i}function _t(o,i){return o^i}function Pt(o,i){return o&~i}function $t(o){if(o==0)return-1;var i=0;return!(65535&o)&&(o>>=16,i+=16),!(255&o)&&(o>>=8,i+=8),!(15&o)&&(o>>=4,i+=4),!(3&o)&&(o>>=2,i+=2),!(1&o)&&++i,i}function Tt(o){for(var i=0;o!=0;)o&=o-1,++i;return i}function ot(){}function bt(o){return o}function dt(o){this.r2=ue(),this.q3=ue(),M.ONE.dlShiftTo(2*o.t,this.r2),this.mu=this.r2.divide(o),this.m=o}Ee.prototype.convert=function(i){return i.s<0||i.compareTo(this.m)>=0?i.mod(this.m):i},Ee.prototype.revert=function(i){return i},Ee.prototype.reduce=function(i){i.divRemTo(this.m,null,i)},Ee.prototype.mulTo=function(i,a,l){i.multiplyTo(a,l),this.reduce(l)},Ee.prototype.sqrTo=function(i,a){i.squareTo(a),this.reduce(a)},Te.prototype.convert=function(i){var a=ue();return i.abs().dlShiftTo(this.m.t,a),a.divRemTo(this.m,null,a),i.s<0&&a.compareTo(M.ZERO)>0&&this.m.subTo(a,a),a},Te.prototype.revert=function(i){var a=ue();return i.copyTo(a),this.reduce(a),a},Te.prototype.reduce=function(i){for(;i.t<=this.mt2;)i[i.t++]=0;for(var a=0;a<this.m.t;++a){var l=32767&i[a],v=l*this.mpl+((l*this.mph+(i[a]>>15)*this.mpl&this.um)<<15)&i.DM;for(i[l=a+this.m.t]+=this.m.am(0,v,i,a,0,this.m.t);i[l]>=i.DV;)i[l]-=i.DV,i[++l]++}i.clamp(),i.drShiftTo(this.m.t,i),i.compareTo(this.m)>=0&&i.subTo(this.m,i)},Te.prototype.mulTo=function(i,a,l){i.multiplyTo(a,l),this.reduce(l)},Te.prototype.sqrTo=function(i,a){i.squareTo(a),this.reduce(a)},M.prototype.copyTo=function(i){for(var a=this.t-1;a>=0;--a)i[a]=this[a];i.t=this.t,i.s=this.s},M.prototype.fromInt=function(i){this.t=1,this.s=i<0?-1:0,i>0?this[0]=i:i<-1?this[0]=i+this.DV:this.t=0},M.prototype.fromString=function(i,a){var l;if(a==16)l=4;else if(a==8)l=3;else if(a==256)l=8;else if(a==2)l=1;else if(a==32)l=5;else{if(a!=4)return void this.fromRadix(i,a);l=2}this.t=0,this.s=0;for(var v=i.length,y=!1,P=0;--v>=0;){var B=l==8?255&i[v]:Oe(i,v);B<0?i.charAt(v)=="-"&&(y=!0):(y=!1,P==0?this[this.t++]=B:P+l>this.DB?(this[this.t-1]|=(B&(1<<this.DB-P)-1)<<P,this[this.t++]=B>>this.DB-P):this[this.t-1]|=B<<P,(P+=l)>=this.DB&&(P-=this.DB))}l==8&&128&i[0]&&(this.s=-1,P>0&&(this[this.t-1]|=(1<<this.DB-P)-1<<P)),this.clamp(),y&&M.ZERO.subTo(this,this)},M.prototype.clamp=function(){for(var i=this.s&this.DM;this.t>0&&this[this.t-1]==i;)--this.t},M.prototype.dlShiftTo=function(i,a){var l;for(l=this.t-1;l>=0;--l)a[l+i]=this[l];for(l=i-1;l>=0;--l)a[l]=0;a.t=this.t+i,a.s=this.s},M.prototype.drShiftTo=function(i,a){for(var l=i;l<this.t;++l)a[l-i]=this[l];a.t=Math.max(this.t-i,0),a.s=this.s},M.prototype.lShiftTo=function(i,a){var l,v=i%this.DB,y=this.DB-v,P=(1<<y)-1,B=Math.floor(i/this.DB),L=this.s<<v&this.DM;for(l=this.t-1;l>=0;--l)a[l+B+1]=this[l]>>y|L,L=(this[l]&P)<<v;for(l=B-1;l>=0;--l)a[l]=0;a[B]=L,a.t=this.t+B+1,a.s=this.s,a.clamp()},M.prototype.rShiftTo=function(i,a){a.s=this.s;var l=Math.floor(i/this.DB);if(l>=this.t)a.t=0;else{var v=i%this.DB,y=this.DB-v,P=(1<<v)-1;a[0]=this[l]>>v;for(var B=l+1;B<this.t;++B)a[B-l-1]|=(this[B]&P)<<y,a[B-l]=this[B]>>v;v>0&&(a[this.t-l-1]|=(this.s&P)<<y),a.t=this.t-l,a.clamp()}},M.prototype.subTo=function(i,a){for(var l=0,v=0,y=Math.min(i.t,this.t);l<y;)v+=this[l]-i[l],a[l++]=v&this.DM,v>>=this.DB;if(i.t<this.t){for(v-=i.s;l<this.t;)v+=this[l],a[l++]=v&this.DM,v>>=this.DB;v+=this.s}else{for(v+=this.s;l<i.t;)v-=i[l],a[l++]=v&this.DM,v>>=this.DB;v-=i.s}a.s=v<0?-1:0,v<-1?a[l++]=this.DV+v:v>0&&(a[l++]=v),a.t=l,a.clamp()},M.prototype.multiplyTo=function(i,a){var l=this.abs(),v=i.abs(),y=l.t;for(a.t=y+v.t;--y>=0;)a[y]=0;for(y=0;y<v.t;++y)a[y+l.t]=l.am(0,v[y],a,y,0,l.t);a.s=0,a.clamp(),this.s!=i.s&&M.ZERO.subTo(a,a)},M.prototype.squareTo=function(i){for(var a=this.abs(),l=i.t=2*a.t;--l>=0;)i[l]=0;for(l=0;l<a.t-1;++l){var v=a.am(l,a[l],i,2*l,0,1);(i[l+a.t]+=a.am(l+1,2*a[l],i,2*l+1,v,a.t-l-1))>=a.DV&&(i[l+a.t]-=a.DV,i[l+a.t+1]=1)}i.t>0&&(i[i.t-1]+=a.am(l,a[l],i,2*l,0,1)),i.s=0,i.clamp()},M.prototype.divRemTo=function(i,a,l){var v=i.abs();if(!(v.t<=0)){var y=this.abs();if(y.t<v.t)return a!=null&&a.fromInt(0),void(l!=null&&this.copyTo(l));l==null&&(l=ue());var P=ue(),B=this.s,L=i.s,j=this.DB-Fe(v[v.t-1]);j>0?(v.lShiftTo(j,P),y.lShiftTo(j,l)):(v.copyTo(P),y.copyTo(l));var H=P.t,q=P[H-1];if(q!=0){var W=q*(1<<this.F1)+(H>1?P[H-2]>>this.F2:0),Q=this.FV/W,ee=(1<<this.F1)/W,ne=1<<this.F2,re=l.t,k=re-H,V=a??ue();for(P.dlShiftTo(k,V),l.compareTo(V)>=0&&(l[l.t++]=1,l.subTo(V,l)),M.ONE.dlShiftTo(H,V),V.subTo(P,P);P.t<H;)P[P.t++]=0;for(;--k>=0;){var $=l[--re]==q?this.DM:Math.floor(l[re]*Q+(l[re-1]+ne)*ee);if((l[re]+=P.am(0,$,l,k,0,H))<$)for(P.dlShiftTo(k,V),l.subTo(V,l);l[re]<--$;)l.subTo(V,l)}a!=null&&(l.drShiftTo(H,a),B!=L&&M.ZERO.subTo(a,a)),l.t=H,l.clamp(),j>0&&l.rShiftTo(j,l),B<0&&M.ZERO.subTo(l,l)}}},M.prototype.invDigit=function(){if(this.t<1)return 0;var i=this[0];if(!(1&i))return 0;var a=3&i;return(a=(a=(a=(a=a*(2-(15&i)*a)&15)*(2-(255&i)*a)&255)*(2-((65535&i)*a&65535))&65535)*(2-i*a%this.DV)%this.DV)>0?this.DV-a:-a},M.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},M.prototype.exp=function(i,a){if(i>4294967295||i<1)return M.ONE;var l=ue(),v=ue(),y=a.convert(this),P=Fe(i)-1;for(y.copyTo(l);--P>=0;)if(a.sqrTo(l,v),(i&1<<P)>0)a.mulTo(v,y,l);else{var B=l;l=v,v=B}return a.revert(l)},M.prototype.toString=function(i){if(this.s<0)return"-"+this.negate().toString(i);var a;if(i==16)a=4;else if(i==8)a=3;else if(i==2)a=1;else if(i==32)a=5;else{if(i!=4)return this.toRadix(i);a=2}var l,v=(1<<a)-1,y=!1,P="",B=this.t,L=this.DB-B*this.DB%a;if(B-- >0)for(L<this.DB&&(l=this[B]>>L)>0&&(y=!0,P=Ce(l));B>=0;)L<a?(l=(this[B]&(1<<L)-1)<<a-L,l|=this[--B]>>(L+=this.DB-a)):(l=this[B]>>(L-=a)&v,L<=0&&(L+=this.DB,--B)),l>0&&(y=!0),y&&(P+=Ce(l));return y?P:"0"},M.prototype.negate=function(){var i=ue();return M.ZERO.subTo(this,i),i},M.prototype.abs=function(){return this.s<0?this.negate():this},M.prototype.compareTo=function(i){var a=this.s-i.s;if(a!=0)return a;var l=this.t;if((a=l-i.t)!=0)return this.s<0?-a:a;for(;--l>=0;)if((a=this[l]-i[l])!=0)return a;return 0},M.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Fe(this[this.t-1]^this.s&this.DM)},M.prototype.mod=function(i){var a=ue();return this.abs().divRemTo(i,null,a),this.s<0&&a.compareTo(M.ZERO)>0&&i.subTo(a,a),a},M.prototype.modPowInt=function(i,a){var l;return l=i<256||a.isEven()?new Ee(a):new Te(a),this.exp(i,l)},M.ZERO=qe(0),M.ONE=qe(1),ot.prototype.convert=bt,ot.prototype.revert=bt,ot.prototype.mulTo=function(i,a,l){i.multiplyTo(a,l)},ot.prototype.sqrTo=function(i,a){i.squareTo(a)},dt.prototype.convert=function(i){if(i.s<0||i.t>2*this.m.t)return i.mod(this.m);if(i.compareTo(this.m)<0)return i;var a=ue();return i.copyTo(a),this.reduce(a),a},dt.prototype.revert=function(i){return i},dt.prototype.reduce=function(i){for(i.drShiftTo(this.m.t-1,this.r2),i.t>this.m.t+1&&(i.t=this.m.t+1,i.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);i.compareTo(this.r2)<0;)i.dAddOffset(1,this.m.t+1);for(i.subTo(this.r2,i);i.compareTo(this.m)>=0;)i.subTo(this.m,i)},dt.prototype.mulTo=function(i,a,l){i.multiplyTo(a,l),this.reduce(l)},dt.prototype.sqrTo=function(i,a){i.squareTo(a),this.reduce(a)};var Y=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],_=(1<<26)/Y[Y.length-1];/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
18
- */function S(){this.i=0,this.j=0,this.S=new Array}M.prototype.chunkSize=function(i){return Math.floor(Math.LN2*this.DB/Math.log(i))},M.prototype.toRadix=function(i){if(i==null&&(i=10),this.signum()==0||i<2||i>36)return"0";var a=this.chunkSize(i),l=Math.pow(i,a),v=qe(l),y=ue(),P=ue(),B="";for(this.divRemTo(v,y,P);y.signum()>0;)B=(l+P.intValue()).toString(i).substr(1)+B,y.divRemTo(v,y,P);return P.intValue().toString(i)+B},M.prototype.fromRadix=function(i,a){this.fromInt(0),a==null&&(a=10);for(var l=this.chunkSize(a),v=Math.pow(a,l),y=!1,P=0,B=0,L=0;L<i.length;++L){var j=Oe(i,L);j<0?i.charAt(L)=="-"&&this.signum()==0&&(y=!0):(B=a*B+j,++P>=l&&(this.dMultiply(v),this.dAddOffset(B,0),P=0,B=0))}P>0&&(this.dMultiply(Math.pow(a,P)),this.dAddOffset(B,0)),y&&M.ZERO.subTo(this,this)},M.prototype.fromNumber=function(i,a,l){if(typeof a=="number")if(i<2)this.fromInt(1);else for(this.fromNumber(i,l),this.testBit(i-1)||this.bitwiseTo(M.ONE.shiftLeft(i-1),De,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>i&&this.subTo(M.ONE.shiftLeft(i-1),this);else{var v=new Array,y=7&i;v.length=1+(i>>3),a.nextBytes(v),y>0?v[0]&=(1<<y)-1:v[0]=0,this.fromString(v,256)}},M.prototype.bitwiseTo=function(i,a,l){var v,y,P=Math.min(i.t,this.t);for(v=0;v<P;++v)l[v]=a(this[v],i[v]);if(i.t<this.t){for(y=i.s&this.DM,v=P;v<this.t;++v)l[v]=a(this[v],y);l.t=this.t}else{for(y=this.s&this.DM,v=P;v<i.t;++v)l[v]=a(y,i[v]);l.t=i.t}l.s=a(this.s,i.s),l.clamp()},M.prototype.changeBit=function(i,a){var l=M.ONE.shiftLeft(i);return this.bitwiseTo(l,a,l),l},M.prototype.addTo=function(i,a){for(var l=0,v=0,y=Math.min(i.t,this.t);l<y;)v+=this[l]+i[l],a[l++]=v&this.DM,v>>=this.DB;if(i.t<this.t){for(v+=i.s;l<this.t;)v+=this[l],a[l++]=v&this.DM,v>>=this.DB;v+=this.s}else{for(v+=this.s;l<i.t;)v+=i[l],a[l++]=v&this.DM,v>>=this.DB;v+=i.s}a.s=v<0?-1:0,v>0?a[l++]=v:v<-1&&(a[l++]=this.DV+v),a.t=l,a.clamp()},M.prototype.dMultiply=function(i){this[this.t]=this.am(0,i-1,this,0,0,this.t),++this.t,this.clamp()},M.prototype.dAddOffset=function(i,a){if(i!=0){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=i;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}},M.prototype.multiplyLowerTo=function(i,a,l){var v,y=Math.min(this.t+i.t,a);for(l.s=0,l.t=y;y>0;)l[--y]=0;for(v=l.t-this.t;y<v;++y)l[y+this.t]=this.am(0,i[y],l,y,0,this.t);for(v=Math.min(i.t,a);y<v;++y)this.am(0,i[y],l,y,0,a-y);l.clamp()},M.prototype.multiplyUpperTo=function(i,a,l){--a;var v=l.t=this.t+i.t-a;for(l.s=0;--v>=0;)l[v]=0;for(v=Math.max(a-this.t,0);v<i.t;++v)l[this.t+v-a]=this.am(a-v,i[v],l,0,0,this.t+v-a);l.clamp(),l.drShiftTo(1,l)},M.prototype.modInt=function(i){if(i<=0)return 0;var a=this.DV%i,l=this.s<0?i-1:0;if(this.t>0)if(a==0)l=this[0]%i;else for(var v=this.t-1;v>=0;--v)l=(a*l+this[v])%i;return l},M.prototype.millerRabin=function(i){var a=this.subtract(M.ONE),l=a.getLowestSetBit();if(l<=0)return!1;var v=a.shiftRight(l);(i=i+1>>1)>Y.length&&(i=Y.length);for(var y=ue(),P=0;P<i;++P){y.fromInt(Y[Math.floor(Math.random()*Y.length)]);var B=y.modPow(v,this);if(B.compareTo(M.ONE)!=0&&B.compareTo(a)!=0){for(var L=1;L++<l&&B.compareTo(a)!=0;)if((B=B.modPowInt(2,this)).compareTo(M.ONE)==0)return!1;if(B.compareTo(a)!=0)return!1}}return!0},M.prototype.clone=function(){var i=ue();return this.copyTo(i),i},M.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},M.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},M.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},M.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},M.prototype.toByteArray=function(){var i=this.t,a=new Array;a[0]=this.s;var l,v=this.DB-i*this.DB%8,y=0;if(i-- >0)for(v<this.DB&&(l=this[i]>>v)!=(this.s&this.DM)>>v&&(a[y++]=l|this.s<<this.DB-v);i>=0;)v<8?(l=(this[i]&(1<<v)-1)<<8-v,l|=this[--i]>>(v+=this.DB-8)):(l=this[i]>>(v-=8)&255,v<=0&&(v+=this.DB,--i)),128&l&&(l|=-256),y==0&&(128&this.s)!=(128&l)&&++y,(y>0||l!=this.s)&&(a[y++]=l);return a},M.prototype.equals=function(i){return this.compareTo(i)==0},M.prototype.min=function(i){return this.compareTo(i)<0?this:i},M.prototype.max=function(i){return this.compareTo(i)>0?this:i},M.prototype.and=function(i){var a=ue();return this.bitwiseTo(i,ct,a),a},M.prototype.or=function(i){var a=ue();return this.bitwiseTo(i,De,a),a},M.prototype.xor=function(i){var a=ue();return this.bitwiseTo(i,_t,a),a},M.prototype.andNot=function(i){var a=ue();return this.bitwiseTo(i,Pt,a),a},M.prototype.not=function(){for(var i=ue(),a=0;a<this.t;++a)i[a]=this.DM&~this[a];return i.t=this.t,i.s=~this.s,i},M.prototype.shiftLeft=function(i){var a=ue();return i<0?this.rShiftTo(-i,a):this.lShiftTo(i,a),a},M.prototype.shiftRight=function(i){var a=ue();return i<0?this.lShiftTo(-i,a):this.rShiftTo(i,a),a},M.prototype.getLowestSetBit=function(){for(var i=0;i<this.t;++i)if(this[i]!=0)return i*this.DB+$t(this[i]);return this.s<0?this.t*this.DB:-1},M.prototype.bitCount=function(){for(var i=0,a=this.s&this.DM,l=0;l<this.t;++l)i+=Tt(this[l]^a);return i},M.prototype.testBit=function(i){var a=Math.floor(i/this.DB);return a>=this.t?this.s!=0:(this[a]&1<<i%this.DB)!=0},M.prototype.setBit=function(i){return this.changeBit(i,De)},M.prototype.clearBit=function(i){return this.changeBit(i,Pt)},M.prototype.flipBit=function(i){return this.changeBit(i,_t)},M.prototype.add=function(i){var a=ue();return this.addTo(i,a),a},M.prototype.subtract=function(i){var a=ue();return this.subTo(i,a),a},M.prototype.multiply=function(i){var a=ue();return this.multiplyTo(i,a),a},M.prototype.divide=function(i){var a=ue();return this.divRemTo(i,a,null),a},M.prototype.remainder=function(i){var a=ue();return this.divRemTo(i,null,a),a},M.prototype.divideAndRemainder=function(i){var a=ue(),l=ue();return this.divRemTo(i,a,l),new Array(a,l)},M.prototype.modPow=function(i,a){var l,v,y=i.bitLength(),P=qe(1);if(y<=0)return P;l=y<18?1:y<48?3:y<144?4:y<768?5:6,v=y<8?new Ee(a):a.isEven()?new dt(a):new Te(a);var B=new Array,L=3,j=l-1,H=(1<<l)-1;if(B[1]=v.convert(this),l>1){var q=ue();for(v.sqrTo(B[1],q);L<=H;)B[L]=ue(),v.mulTo(q,B[L-2],B[L]),L+=2}var W,Q,ee=i.t-1,ne=!0,re=ue();for(y=Fe(i[ee])-1;ee>=0;){for(y>=j?W=i[ee]>>y-j&H:(W=(i[ee]&(1<<y+1)-1)<<j-y,ee>0&&(W|=i[ee-1]>>this.DB+y-j)),L=l;!(1&W);)W>>=1,--L;if((y-=L)<0&&(y+=this.DB,--ee),ne)B[W].copyTo(P),ne=!1;else{for(;L>1;)v.sqrTo(P,re),v.sqrTo(re,P),L-=2;L>0?v.sqrTo(P,re):(Q=P,P=re,re=Q),v.mulTo(re,B[W],P)}for(;ee>=0&&!(i[ee]&1<<y);)v.sqrTo(P,re),Q=P,P=re,re=Q,--y<0&&(y=this.DB-1,--ee)}return v.revert(P)},M.prototype.modInverse=function(i){var a=i.isEven();if(this.isEven()&&a||i.signum()==0)return M.ZERO;for(var l=i.clone(),v=this.clone(),y=qe(1),P=qe(0),B=qe(0),L=qe(1);l.signum()!=0;){for(;l.isEven();)l.rShiftTo(1,l),a?(y.isEven()&&P.isEven()||(y.addTo(this,y),P.subTo(i,P)),y.rShiftTo(1,y)):P.isEven()||P.subTo(i,P),P.rShiftTo(1,P);for(;v.isEven();)v.rShiftTo(1,v),a?(B.isEven()&&L.isEven()||(B.addTo(this,B),L.subTo(i,L)),B.rShiftTo(1,B)):L.isEven()||L.subTo(i,L),L.rShiftTo(1,L);l.compareTo(v)>=0?(l.subTo(v,l),a&&y.subTo(B,y),P.subTo(L,P)):(v.subTo(l,v),a&&B.subTo(y,B),L.subTo(P,L))}return v.compareTo(M.ONE)!=0?M.ZERO:L.compareTo(i)>=0?L.subtract(i):L.signum()<0?(L.addTo(i,L),L.signum()<0?L.add(i):L):L},M.prototype.pow=function(i){return this.exp(i,new ot)},M.prototype.gcd=function(i){var a=this.s<0?this.negate():this.clone(),l=i.s<0?i.negate():i.clone();if(a.compareTo(l)<0){var v=a;a=l,l=v}var y=a.getLowestSetBit(),P=l.getLowestSetBit();if(P<0)return a;for(y<P&&(P=y),P>0&&(a.rShiftTo(P,a),l.rShiftTo(P,l));a.signum()>0;)(y=a.getLowestSetBit())>0&&a.rShiftTo(y,a),(y=l.getLowestSetBit())>0&&l.rShiftTo(y,l),a.compareTo(l)>=0?(a.subTo(l,a),a.rShiftTo(1,a)):(l.subTo(a,l),l.rShiftTo(1,l));return P>0&&l.lShiftTo(P,l),l},M.prototype.isProbablePrime=function(i){var a,l=this.abs();if(l.t==1&&l[0]<=Y[Y.length-1]){for(a=0;a<Y.length;++a)if(l[0]==Y[a])return!0;return!1}if(l.isEven())return!1;for(a=1;a<Y.length;){for(var v=Y[a],y=a+1;y<Y.length&&v<_;)v*=Y[y++];for(v=l.modInt(v);a<y;)if(v%Y[a++]==0)return!1}return l.millerRabin(i)},M.prototype.square=function(){var i=ue();return this.squareTo(i),i},S.prototype.init=function(i){var a,l,v;for(a=0;a<256;++a)this.S[a]=a;for(l=0,a=0;a<256;++a)l=l+this.S[a]+i[a%i.length]&255,v=this.S[a],this.S[a]=this.S[l],this.S[l]=v;this.i=0,this.j=0},S.prototype.next=function(){var i;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,i=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=i,this.S[i+this.S[this.i]&255]};var z,G,Z;/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
19
- */function se(){(function(i){G[Z++]^=255&i,G[Z++]^=i>>8&255,G[Z++]^=i>>16&255,G[Z++]^=i>>24&255,Z>=256&&(Z-=256)})(new Date().getTime())}if(G==null){var ge;if(G=new Array,Z=0,p!==void 0&&(p.crypto!==void 0||p.msCrypto!==void 0)){var we=p.crypto||p.msCrypto;if(we.getRandomValues){var Re=new Uint8Array(32);for(we.getRandomValues(Re),ge=0;ge<32;++ge)G[Z++]=Re[ge]}else if(g.appName=="Netscape"&&g.appVersion<"5"){var Pe=p.crypto.random(32);for(ge=0;ge<Pe.length;++ge)G[Z++]=255&Pe.charCodeAt(ge)}}for(;Z<256;)ge=Math.floor(65536*Math.random()),G[Z++]=ge>>>8,G[Z++]=255&ge;Z=0,se()}function $e(){if(z==null){for(se(),(z=function(){return new S}()).init(G),Z=0;Z<G.length;++Z)G[Z]=0;Z=0}return z.next()}function lt(){}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
20
- */function St(o,i){return new M(o,i)}function Ut(o,i,a){for(var l="",v=0;l.length<i;)l+=a(String.fromCharCode.apply(String,o.concat([(4278190080&v)>>24,(16711680&v)>>16,(65280&v)>>8,255&v]))),v+=1;return l}function ye(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
21
- */function Le(o,i){this.x=i,this.q=o}function ke(o,i,a,l){this.curve=o,this.x=i,this.y=a,this.z=l??M.ONE,this.zinv=null}function tn(o,i,a){this.q=o,this.a=this.fromBigInteger(i),this.b=this.fromBigInteger(a),this.infinity=new ke(this,null,null)}lt.prototype.nextBytes=function(i){var a;for(a=0;a<i.length;++a)i[a]=$e()},ye.prototype.doPublic=function(i){return i.modPowInt(this.e,this.n)},ye.prototype.setPublic=function(i,a){if(this.isPublic=!0,this.isPrivate=!1,typeof i!="string")this.n=i,this.e=a;else{if(!(i!=null&&a!=null&&i.length>0&&a.length>0))throw"Invalid RSA public key";this.n=St(i,16),this.e=parseInt(a,16)}},ye.prototype.encrypt=function(i){var a=function(P,B){if(B<P.length+11)throw"Message too long for RSA";for(var L=new Array,j=P.length-1;j>=0&&B>0;){var H=P.charCodeAt(j--);H<128?L[--B]=H:H>127&&H<2048?(L[--B]=63&H|128,L[--B]=H>>6|192):(L[--B]=63&H|128,L[--B]=H>>6&63|128,L[--B]=H>>12|224)}L[--B]=0;for(var q=new lt,W=new Array;B>2;){for(W[0]=0;W[0]==0;)q.nextBytes(W);L[--B]=W[0]}return L[--B]=2,L[--B]=0,new M(L)}(i,this.n.bitLength()+7>>3);if(a==null)return null;var l=this.doPublic(a);if(l==null)return null;var v=l.toString(16);return 1&v.length?"0"+v:v},ye.prototype.encryptOAEP=function(i,a,l){var v=function(L,j,H,q){var W=D.crypto.MessageDigest,Q=D.crypto.Util,ee=null;if(H||(H="sha1"),typeof H=="string"&&(ee=W.getCanonicalAlgName(H),q=W.getHashLength(ee),H=function(ce){return Dt(Q.hashHex(nn(ce),ee))}),L.length+2*q+2>j)throw"Message too long for RSA";var ne,re="";for(ne=0;ne<j-L.length-2*q-2;ne+=1)re+="\0";var k=H("")+re+""+L,V=new Array(q);new lt().nextBytes(V);var $=Ut(V,k.length,H),J=[];for(ne=0;ne<k.length;ne+=1)J[ne]=k.charCodeAt(ne)^$.charCodeAt(ne);var te=Ut(J,V.length,H),ie=[0];for(ne=0;ne<V.length;ne+=1)ie[ne+1]=V[ne]^te.charCodeAt(ne);return new M(ie.concat(J))}(i,this.n.bitLength()+7>>3,a,l);if(v==null)return null;var y=this.doPublic(v);if(y==null)return null;var P=y.toString(16);return 1&P.length?"0"+P:P},ye.prototype.type="RSA",Le.prototype.equals=function(i){return i==this||this.q.equals(i.q)&&this.x.equals(i.x)},Le.prototype.toBigInteger=function(){return this.x},Le.prototype.negate=function(){return new Le(this.q,this.x.negate().mod(this.q))},Le.prototype.add=function(i){return new Le(this.q,this.x.add(i.toBigInteger()).mod(this.q))},Le.prototype.subtract=function(i){return new Le(this.q,this.x.subtract(i.toBigInteger()).mod(this.q))},Le.prototype.multiply=function(i){return new Le(this.q,this.x.multiply(i.toBigInteger()).mod(this.q))},Le.prototype.square=function(){return new Le(this.q,this.x.square().mod(this.q))},Le.prototype.divide=function(i){return new Le(this.q,this.x.multiply(i.toBigInteger().modInverse(this.q)).mod(this.q))},ke.prototype.getX=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ke.prototype.getY=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ke.prototype.equals=function(i){return i==this||(this.isInfinity()?i.isInfinity():i.isInfinity()?this.isInfinity():!!i.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(i.z)).mod(this.curve.q).equals(M.ZERO)&&i.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(i.z)).mod(this.curve.q).equals(M.ZERO))},ke.prototype.isInfinity=function(){return this.x==null&&this.y==null||this.z.equals(M.ZERO)&&!this.y.toBigInteger().equals(M.ZERO)},ke.prototype.negate=function(){return new ke(this.curve,this.x,this.y.negate(),this.z)},ke.prototype.add=function(i){if(this.isInfinity())return i;if(i.isInfinity())return this;var a=i.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(i.z)).mod(this.curve.q),l=i.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(i.z)).mod(this.curve.q);if(M.ZERO.equals(l))return M.ZERO.equals(a)?this.twice():this.curve.getInfinity();var v=new M("3"),y=this.x.toBigInteger(),P=this.y.toBigInteger(),B=(i.x.toBigInteger(),i.y.toBigInteger(),l.square()),L=B.multiply(l),j=y.multiply(B),H=a.square().multiply(this.z),q=H.subtract(j.shiftLeft(1)).multiply(i.z).subtract(L).multiply(l).mod(this.curve.q),W=j.multiply(v).multiply(a).subtract(P.multiply(L)).subtract(H.multiply(a)).multiply(i.z).add(a.multiply(L)).mod(this.curve.q),Q=L.multiply(this.z).multiply(i.z).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(q),this.curve.fromBigInteger(W),Q)},ke.prototype.twice=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var i=new M("3"),a=this.x.toBigInteger(),l=this.y.toBigInteger(),v=l.multiply(this.z),y=v.multiply(l).mod(this.curve.q),P=this.curve.a.toBigInteger(),B=a.square().multiply(i);M.ZERO.equals(P)||(B=B.add(this.z.square().multiply(P)));var L=(B=B.mod(this.curve.q)).square().subtract(a.shiftLeft(3).multiply(y)).shiftLeft(1).multiply(v).mod(this.curve.q),j=B.multiply(i).multiply(a).subtract(y.shiftLeft(1)).shiftLeft(2).multiply(y).subtract(B.square().multiply(B)).mod(this.curve.q),H=v.square().multiply(v).shiftLeft(3).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(L),this.curve.fromBigInteger(j),H)},ke.prototype.multiply=function(i){if(this.isInfinity())return this;if(i.signum()==0)return this.curve.getInfinity();var a,l=i,v=l.multiply(new M("3")),y=this.negate(),P=this,B=this.curve.q.subtract(i),L=B.multiply(new M("3")),j=new ke(this.curve,this.x,this.y),H=j.negate();for(a=v.bitLength()-2;a>0;--a){P=P.twice();var q=v.testBit(a);q!=l.testBit(a)&&(P=P.add(q?this:y))}for(a=L.bitLength()-2;a>0;--a){j=j.twice();var W=L.testBit(a);W!=B.testBit(a)&&(j=j.add(W?j:H))}return P},ke.prototype.multiplyTwo=function(i,a,l){var v;v=i.bitLength()>l.bitLength()?i.bitLength()-1:l.bitLength()-1;for(var y=this.curve.getInfinity(),P=this.add(a);v>=0;)y=y.twice(),i.testBit(v)?y=l.testBit(v)?y.add(P):y.add(this):l.testBit(v)&&(y=y.add(a)),--v;return y},tn.prototype.getQ=function(){return this.q},tn.prototype.getA=function(){return this.a},tn.prototype.getB=function(){return this.b},tn.prototype.equals=function(i){return i==this||this.q.equals(i.q)&&this.a.equals(i.a)&&this.b.equals(i.b)},tn.prototype.getInfinity=function(){return this.infinity},tn.prototype.fromBigInteger=function(i){return new Le(this.q,i)},tn.prototype.decodePointHex=function(i){switch(parseInt(i.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(i.length-2)/2,l=i.substr(2,a),v=i.substr(a+2,a);return new ke(this,this.fromBigInteger(new M(l,16)),this.fromBigInteger(new M(v,16)));default:return null}},Le.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ke.prototype.getEncoded=function(o){var i=function(P,B){var L=P.toByteArrayUnsigned();if(B<L.length)L=L.slice(L.length-B);else for(;B>L.length;)L.unshift(0);return L},a=this.getX().toBigInteger(),l=this.getY().toBigInteger(),v=i(a,32);return o?l.isEven()?v.unshift(2):v.unshift(3):(v.unshift(4),v=v.concat(i(l,32))),v},ke.decodeFrom=function(o,i){i[0];var a=i.length-1,l=i.slice(1,1+a/2),v=i.slice(1+a/2,1+a);l.unshift(0),v.unshift(0);var y=new M(l),P=new M(v);return new ke(o,o.fromBigInteger(y),o.fromBigInteger(P))},ke.decodeFromHex=function(o,i){i.substr(0,2);var a=i.length-2,l=i.substr(2,a/2),v=i.substr(2+a/2,a/2),y=new M(l,16),P=new M(v,16);return new ke(o,o.fromBigInteger(y),o.fromBigInteger(P))},ke.prototype.add2D=function(o){if(this.isInfinity())return o;if(o.isInfinity())return this;if(this.x.equals(o.x))return this.y.equals(o.y)?this.twice():this.curve.getInfinity();var i=o.x.subtract(this.x),a=o.y.subtract(this.y).divide(i),l=a.square().subtract(this.x).subtract(o.x),v=a.multiply(this.x.subtract(l)).subtract(this.y);return new ke(this.curve,l,v)},ke.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var o=this.curve.fromBigInteger(M.valueOf(2)),i=this.curve.fromBigInteger(M.valueOf(3)),a=this.x.square().multiply(i).add(this.curve.a).divide(this.y.multiply(o)),l=a.square().subtract(this.x.multiply(o)),v=a.multiply(this.x.subtract(l)).subtract(this.y);return new ke(this.curve,l,v)},ke.prototype.multiply2D=function(o){if(this.isInfinity())return this;if(o.signum()==0)return this.curve.getInfinity();var i,a=o,l=a.multiply(new M("3")),v=this.negate(),y=this;for(i=l.bitLength()-2;i>0;--i){y=y.twice();var P=l.testBit(i);P!=a.testBit(i)&&(y=y.add2D(P?this:v))}return y},ke.prototype.isOnCurve=function(){var o=this.getX().toBigInteger(),i=this.getY().toBigInteger(),a=this.curve.getA().toBigInteger(),l=this.curve.getB().toBigInteger(),v=this.curve.getQ(),y=i.multiply(i).mod(v),P=o.multiply(o).multiply(o).add(a.multiply(o)).add(l).mod(v);return y.equals(P)},ke.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ke.prototype.validate=function(){var o=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var i=this.getX().toBigInteger(),a=this.getY().toBigInteger();if(i.compareTo(M.ONE)<0||i.compareTo(o.subtract(M.ONE))>0)throw new Error("x coordinate out of bounds");if(a.compareTo(M.ONE)<0||a.compareTo(o.subtract(M.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(o).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
22
- */var ni=function(){var o=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),a={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
23
- `,r:"\r",t:" "};function l(P,B,L){return B?a[B]:String.fromCharCode(parseInt(L,16))}var v=new String(""),y=Object.hasOwnProperty;return function(P,B){var L,j,H=P.match(o),q=H[0],W=!1;q==="{"?L={}:q==="["?L=[]:(L=[],W=!0);for(var Q=[L],ee=1-W,ne=H.length;ee<ne;++ee){var re;switch((q=H[ee]).charCodeAt(0)){default:(re=Q[0])[j||re.length]=+q,j=void 0;break;case 34:if((q=q.substring(1,q.length-1)).indexOf("\\")!==-1&&(q=q.replace(i,l)),re=Q[0],!j){if(!(re instanceof Array)){j=q||v;break}j=re.length}re[j]=q,j=void 0;break;case 91:re=Q[0],Q.unshift(re[j||re.length]=[]),j=void 0;break;case 93:Q.shift();break;case 102:(re=Q[0])[j||re.length]=!1,j=void 0;break;case 110:(re=Q[0])[j||re.length]=null,j=void 0;break;case 116:(re=Q[0])[j||re.length]=!0,j=void 0;break;case 123:re=Q[0],Q.unshift(re[j||re.length]={}),j=void 0;break;case 125:Q.shift()}}if(W){if(Q.length!==1)throw new Error;L=L[0]}else if(Q.length)throw new Error;return B&&(L=function k(V,$){var J=V[$];if(J&&(J===void 0?"undefined":c(J))==="object"){var te=null;for(var ie in J)if(y.call(J,ie)&&J!==V){var ve=k(J,ie);ve!==void 0?J[ie]=ve:(te||(te=[]),te.push(ie))}if(te)for(var ce=te.length;--ce>=0;)delete J[te[ce]]}return B.call(V,$,J)}({"":L},"")),L}}();D!==void 0&&D||(r.KJUR=D={}),D.asn1!==void 0&&D.asn1||(D.asn1={}),D.asn1.ASN1Util=new function(){this.integerToByteHex=function(o){var i=o.toString(16);return i.length%2==1&&(i="0"+i),i},this.bigIntToMinTwosComplementsHex=function(o){var i=o.toString(16);if(i.substr(0,1)!="-")i.length%2==1?i="0"+i:i.match(/^[0-7]/)||(i="00"+i);else{var a=i.substr(1).length;a%2==1?a+=1:i.match(/^[0-7]/)||(a+=2);for(var l="",v=0;v<a;v++)l+="f";i=new M(l,16).xor(o).add(M.ONE).toString(16).replace(/^-/,"")}return i},this.getPEMStringFromHex=function(o,i){return Rt(o,i)},this.newObject=function(o){var i=D.asn1,a=i.ASN1Object,l=i.DERBoolean,v=i.DERInteger,y=i.DERBitString,P=i.DEROctetString,B=i.DERNull,L=i.DERObjectIdentifier,j=i.DEREnumerated,H=i.DERUTF8String,q=i.DERNumericString,W=i.DERPrintableString,Q=i.DERTeletexString,ee=i.DERIA5String,ne=i.DERUTCTime,re=i.DERGeneralizedTime,k=i.DERVisibleString,V=i.DERBMPString,$=i.DERSequence,J=i.DERSet,te=i.DERTaggedObject,ie=i.ASN1Util.newObject;if(o instanceof i.ASN1Object)return o;var ve=Object.keys(o);if(ve.length!=1)throw new Error("key of param shall be only one.");var ce=ve[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+ce+":")==-1)throw new Error("undefined key: "+ce);if(ce=="bool")return new l(o[ce]);if(ce=="int")return new v(o[ce]);if(ce=="bitstr")return new y(o[ce]);if(ce=="octstr")return new P(o[ce]);if(ce=="null")return new B(o[ce]);if(ce=="oid")return new L(o[ce]);if(ce=="enum")return new j(o[ce]);if(ce=="utf8str")return new H(o[ce]);if(ce=="numstr")return new q(o[ce]);if(ce=="prnstr")return new W(o[ce]);if(ce=="telstr")return new Q(o[ce]);if(ce=="ia5str")return new ee(o[ce]);if(ce=="utctime")return new ne(o[ce]);if(ce=="gentime")return new re(o[ce]);if(ce=="visstr")return new k(o[ce]);if(ce=="bmpstr")return new V(o[ce]);if(ce=="asn1")return new a(o[ce]);if(ce=="seq"){for(var Ae=o[ce],pe=[],_e=0;_e<Ae.length;_e++){var Me=ie(Ae[_e]);pe.push(Me)}return new $({array:pe})}if(ce=="set"){for(Ae=o[ce],pe=[],_e=0;_e<Ae.length;_e++)Me=ie(Ae[_e]),pe.push(Me);return new J({array:pe})}if(ce=="tag"){var We=o[ce];if(Object.prototype.toString.call(We)==="[object Array]"&&We.length==3){var Ve=ie(We[2]);return new te({tag:We[0],explicit:We[1],obj:Ve})}return new te(We)}},this.jsonToASN1HEX=function(o){return this.newObject(o).getEncodedHex()}},D.asn1.ASN1Util.oidHexToInt=function(o){for(var i="",a=parseInt(o.substr(0,2),16),l=(i=Math.floor(a/40)+"."+a%40,""),v=2;v<o.length;v+=2){var y=("00000000"+parseInt(o.substr(v,2),16).toString(2)).slice(-8);l+=y.substr(1,7),y.substr(0,1)=="0"&&(i=i+"."+new M(l,2).toString(10),l="")}return i},D.asn1.ASN1Util.oidIntToHex=function(o){var i=function(L){var j=L.toString(16);return j.length==1&&(j="0"+j),j},a=function(L){var j="",H=new M(L,10).toString(2),q=7-H.length%7;q==7&&(q=0);for(var W="",Q=0;Q<q;Q++)W+="0";for(H=W+H,Q=0;Q<H.length-1;Q+=7){var ee=H.substr(Q,7);Q!=H.length-7&&(ee="1"+ee),j+=i(parseInt(ee,2))}return j};if(!o.match(/^[0-9.]+$/))throw"malformed oid string: "+o;var l="",v=o.split("."),y=40*parseInt(v[0])+parseInt(v[1]);l+=i(y),v.splice(0,2);for(var P=0;P<v.length;P++)l+=a(v[P]);return l},D.asn1.ASN1Object=function(o){this.params=null,this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var i=this.hV.length/2,a=i.toString(16);if(a.length%2==1&&(a="0"+a),i<128)return a;var l=a.length/2;if(l>15)throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16);return(128+l).toString(16)+a},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(i){this.params=i},o!=null&&o.tlv!=null&&(this.hTLV=o.tlv,this.isModified=!1)},D.asn1.DERAbstractString=function(o){D.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(i){this.hTLV=null,this.isModified=!0,this.s=i,this.hV=Gi(this.s).toLowerCase()},this.setStringHex=function(i){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.getFreshValueHex=function(){return this.hV},o!==void 0&&(typeof o=="string"?this.setString(o):o.str!==void 0?this.setString(o.str):o.hex!==void 0&&this.setStringHex(o.hex))},h.lang.extend(D.asn1.DERAbstractString,D.asn1.ASN1Object),D.asn1.DERAbstractTime=function(o){D.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(i){var a=i.getTime()+6e4*i.getTimezoneOffset();return new Date(a)},this.formatDate=function(i,a,l){var v=this.zeroPadding,y=this.localDateToUTC(i),P=String(y.getFullYear());a=="utc"&&(P=P.substr(2,2));var B=P+v(String(y.getMonth()+1),2)+v(String(y.getDate()),2)+v(String(y.getHours()),2)+v(String(y.getMinutes()),2)+v(String(y.getSeconds()),2);if(l===!0){var L=y.getMilliseconds();if(L!=0){var j=v(String(L),3);B=B+"."+(j=j.replace(/[0]+$/,""))}}return B+"Z"},this.zeroPadding=function(i,a){return i.length>=a?i:new Array(a-i.length+1).join("0")+i},this.getString=function(){return this.s},this.setString=function(i){this.hTLV=null,this.isModified=!0,this.s=i,this.hV=de(i)},this.setByDateValue=function(i,a,l,v,y,P){var B=new Date(Date.UTC(i,a-1,l,v,y,P,0));this.setByDate(B)},this.getFreshValueHex=function(){return this.hV}},h.lang.extend(D.asn1.DERAbstractTime,D.asn1.ASN1Object),D.asn1.DERAbstractStructured=function(o){D.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(i){this.hTLV=null,this.isModified=!0,this.asn1Array=i},this.appendASN1Object=function(i){this.hTLV=null,this.isModified=!0,this.asn1Array.push(i)},this.asn1Array=new Array,o!==void 0&&o.array!==void 0&&(this.asn1Array=o.array)},h.lang.extend(D.asn1.DERAbstractStructured,D.asn1.ASN1Object),D.asn1.DERBoolean=function(o){D.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=o==0?"010100":"0101ff"},h.lang.extend(D.asn1.DERBoolean,D.asn1.ASN1Object),D.asn1.DERInteger=function(o){D.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(i){this.hTLV=null,this.isModified=!0,this.hV=D.asn1.ASN1Util.bigIntToMinTwosComplementsHex(i)},this.setByInteger=function(i){var a=new M(String(i),10);this.setByBigInteger(a)},this.setValueHex=function(i){this.hV=i},this.getFreshValueHex=function(){return this.hV},o!==void 0&&(o.bigint!==void 0?this.setByBigInteger(o.bigint):o.int!==void 0?this.setByInteger(o.int):typeof o=="number"?this.setByInteger(o):o.hex!==void 0&&this.setValueHex(o.hex))},h.lang.extend(D.asn1.DERInteger,D.asn1.ASN1Object),D.asn1.DERBitString=function(o){if(o!==void 0&&o.obj!==void 0){var i=D.asn1.ASN1Util.newObject(o.obj);o.hex="00"+i.getEncodedHex()}D.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(a){this.hTLV=null,this.isModified=!0,this.hV=a},this.setUnusedBitsAndHexValue=function(a,l){if(a<0||7<a)throw"unused bits shall be from 0 to 7: u = "+a;var v="0"+a;this.hTLV=null,this.isModified=!0,this.hV=v+l},this.setByBinaryString=function(a){var l=8-(a=a.replace(/0+$/,"")).length%8;l==8&&(l=0);for(var v=0;v<=l;v++)a+="0";var y="";for(v=0;v<a.length-1;v+=8){var P=a.substr(v,8),B=parseInt(P,2).toString(16);B.length==1&&(B="0"+B),y+=B}this.hTLV=null,this.isModified=!0,this.hV="0"+l+y},this.setByBooleanArray=function(a){for(var l="",v=0;v<a.length;v++)a[v]==1?l+="1":l+="0";this.setByBinaryString(l)},this.newFalseArray=function(a){for(var l=new Array(a),v=0;v<a;v++)l[v]=!1;return l},this.getFreshValueHex=function(){return this.hV},o!==void 0&&(typeof o=="string"&&o.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(o):o.hex!==void 0?this.setHexValueIncludingUnusedBits(o.hex):o.bin!==void 0?this.setByBinaryString(o.bin):o.array!==void 0&&this.setByBooleanArray(o.array))},h.lang.extend(D.asn1.DERBitString,D.asn1.ASN1Object),D.asn1.DEROctetString=function(o){if(o!==void 0&&o.obj!==void 0){var i=D.asn1.ASN1Util.newObject(o.obj);o.hex=i.getEncodedHex()}D.asn1.DEROctetString.superclass.constructor.call(this,o),this.hT="04"},h.lang.extend(D.asn1.DEROctetString,D.asn1.DERAbstractString),D.asn1.DERNull=function(){D.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},h.lang.extend(D.asn1.DERNull,D.asn1.ASN1Object),D.asn1.DERObjectIdentifier=function(o){D.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(i){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueOidString=function(i){var a=function(v){var y=function(W){var Q=W.toString(16);return Q.length==1&&(Q="0"+Q),Q},P=function(W){var Q="",ee=parseInt(W,10).toString(2),ne=7-ee.length%7;ne==7&&(ne=0);for(var re="",k=0;k<ne;k++)re+="0";for(ee=re+ee,k=0;k<ee.length-1;k+=7){var V=ee.substr(k,7);k!=ee.length-7&&(V="1"+V),Q+=y(parseInt(V,2))}return Q};try{if(!v.match(/^[0-9.]+$/))return null;var B="",L=v.split("."),j=40*parseInt(L[0],10)+parseInt(L[1],10);B+=y(j),L.splice(0,2);for(var H=0;H<L.length;H++)B+=P(L[H]);return B}catch{return null}}(i);if(a==null)throw new Error("malformed oid string: "+i);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=a},this.setValueName=function(i){var a=D.asn1.x509.OID.name2oid(i);if(a==="")throw new Error("DERObjectIdentifier oidName undefined: "+i);this.setValueOidString(a)},this.setValueNameOrOid=function(i){i.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(i):this.setValueName(i)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(i){typeof i=="string"?this.setValueNameOrOid(i):i.oid!==void 0?this.setValueNameOrOid(i.oid):i.name!==void 0?this.setValueNameOrOid(i.name):i.hex!==void 0&&this.setValueHex(i.hex)},o!==void 0&&this.setByParam(o)},h.lang.extend(D.asn1.DERObjectIdentifier,D.asn1.ASN1Object),D.asn1.DEREnumerated=function(o){D.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(i){this.hTLV=null,this.isModified=!0,this.hV=D.asn1.ASN1Util.bigIntToMinTwosComplementsHex(i)},this.setByInteger=function(i){var a=new M(String(i),10);this.setByBigInteger(a)},this.setValueHex=function(i){this.hV=i},this.getFreshValueHex=function(){return this.hV},o!==void 0&&(o.int!==void 0?this.setByInteger(o.int):typeof o=="number"?this.setByInteger(o):o.hex!==void 0&&this.setValueHex(o.hex))},h.lang.extend(D.asn1.DEREnumerated,D.asn1.ASN1Object),D.asn1.DERUTF8String=function(o){D.asn1.DERUTF8String.superclass.constructor.call(this,o),this.hT="0c"},h.lang.extend(D.asn1.DERUTF8String,D.asn1.DERAbstractString),D.asn1.DERNumericString=function(o){D.asn1.DERNumericString.superclass.constructor.call(this,o),this.hT="12"},h.lang.extend(D.asn1.DERNumericString,D.asn1.DERAbstractString),D.asn1.DERPrintableString=function(o){D.asn1.DERPrintableString.superclass.constructor.call(this,o),this.hT="13"},h.lang.extend(D.asn1.DERPrintableString,D.asn1.DERAbstractString),D.asn1.DERTeletexString=function(o){D.asn1.DERTeletexString.superclass.constructor.call(this,o),this.hT="14"},h.lang.extend(D.asn1.DERTeletexString,D.asn1.DERAbstractString),D.asn1.DERIA5String=function(o){D.asn1.DERIA5String.superclass.constructor.call(this,o),this.hT="16"},h.lang.extend(D.asn1.DERIA5String,D.asn1.DERAbstractString),D.asn1.DERVisibleString=function(o){D.asn1.DERIA5String.superclass.constructor.call(this,o),this.hT="1a"},h.lang.extend(D.asn1.DERVisibleString,D.asn1.DERAbstractString),D.asn1.DERBMPString=function(o){D.asn1.DERBMPString.superclass.constructor.call(this,o),this.hT="1e"},h.lang.extend(D.asn1.DERBMPString,D.asn1.DERAbstractString),D.asn1.DERUTCTime=function(o){D.asn1.DERUTCTime.superclass.constructor.call(this,o),this.hT="17",this.setByDate=function(i){this.hTLV=null,this.isModified=!0,this.date=i,this.s=this.formatDate(this.date,"utc"),this.hV=de(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=de(this.s)),this.hV},o!==void 0&&(o.str!==void 0?this.setString(o.str):typeof o=="string"&&o.match(/^[0-9]{12}Z$/)?this.setString(o):o.hex!==void 0?this.setStringHex(o.hex):o.date!==void 0&&this.setByDate(o.date))},h.lang.extend(D.asn1.DERUTCTime,D.asn1.DERAbstractTime),D.asn1.DERGeneralizedTime=function(o){D.asn1.DERGeneralizedTime.superclass.constructor.call(this,o),this.hT="18",this.withMillis=!1,this.setByDate=function(i){this.hTLV=null,this.isModified=!0,this.date=i,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=de(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=de(this.s)),this.hV},o!==void 0&&(o.str!==void 0?this.setString(o.str):typeof o=="string"&&o.match(/^[0-9]{14}Z$/)?this.setString(o):o.hex!==void 0?this.setStringHex(o.hex):o.date!==void 0&&this.setByDate(o.date),o.millis===!0&&(this.withMillis=!0))},h.lang.extend(D.asn1.DERGeneralizedTime,D.asn1.DERAbstractTime),D.asn1.DERSequence=function(o){D.asn1.DERSequence.superclass.constructor.call(this,o),this.hT="30",this.getFreshValueHex=function(){for(var i="",a=0;a<this.asn1Array.length;a++)i+=this.asn1Array[a].getEncodedHex();return this.hV=i,this.hV}},h.lang.extend(D.asn1.DERSequence,D.asn1.DERAbstractStructured),D.asn1.DERSet=function(o){D.asn1.DERSet.superclass.constructor.call(this,o),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var i=new Array,a=0;a<this.asn1Array.length;a++){var l=this.asn1Array[a];i.push(l.getEncodedHex())}return this.sortFlag==1&&i.sort(),this.hV=i.join(""),this.hV},o!==void 0&&o.sortflag!==void 0&&o.sortflag==0&&(this.sortFlag=!1)},h.lang.extend(D.asn1.DERSet,D.asn1.DERAbstractStructured),D.asn1.DERTaggedObject=function(o){D.asn1.DERTaggedObject.superclass.constructor.call(this);var i=D.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(a,l,v){this.hT=l,this.isExplicit=a,this.asn1Object=v,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=v.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,l),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(a){a.tag!=null&&(this.hT=a.tag),a.explicit!=null&&(this.isExplicit=a.explicit),a.tage!=null&&(this.hT=a.tage,this.isExplicit=!0),a.tagi!=null&&(this.hT=a.tagi,this.isExplicit=!1),a.obj!=null&&(a.obj instanceof i.ASN1Object?(this.asn1Object=a.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):c(a.obj)=="object"&&(this.asn1Object=i.ASN1Util.newObject(a.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},o!=null&&this.setByParam(o)},h.lang.extend(D.asn1.DERTaggedObject,D.asn1.ASN1Object);var D,Dn,xt,he=new function(){};function ri(o){for(var i=new Array,a=0;a<o.length;a++)i[a]=o.charCodeAt(a);return i}function oe(o){for(var i="",a=0;a<o.length;a++)i+=String.fromCharCode(o[a]);return i}function ae(o){for(var i="",a=0;a<o.length;a++){var l=o[a].toString(16);l.length==1&&(l="0"+l),i+=l}return i}function de(o){return ae(ri(o))}function He(o){return o=(o=(o=o.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function st(o){return o.length%4==2?o+="==":o.length%4==3&&(o+="="),o=(o=o.replace(/-/g,"+")).replace(/_/g,"/")}function Qe(o){return o.length%2==1&&(o="0"+o),He(U(o))}function Ke(o){return K(st(o))}function Gi(o){return ii(si(o))}function pt(o){return decodeURIComponent(oi(o))}function Dt(o){for(var i="",a=0;a<o.length-1;a+=2)i+=String.fromCharCode(parseInt(o.substr(a,2),16));return i}function nn(o){for(var i="",a=0;a<o.length;a++)i+=("0"+o.charCodeAt(a).toString(16)).slice(-2);return i}function Ls(o){return U(o)}function Ms(o){var i=Ls(o).replace(/(.{64})/g,`$1\r
24
- `);return i=i.replace(/\r\n$/,"")}function js(o){return K(o.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Rt(o,i){return"-----BEGIN "+i+`-----\r
25
- `+Ms(o)+`\r
26
- -----END `+i+`-----\r
27
- `}function rn(o,i){if(o.indexOf("-----BEGIN ")==-1)throw"can't find PEM header: "+i;return js(o=i!==void 0?(o=o.replace(new RegExp("^[^]*-----BEGIN "+i+"-----"),"")).replace(new RegExp("-----END "+i+"-----[^]*$"),""):(o=o.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Qi(o){var i,a,l,v,y,P,B,L,j,H,q;if(q=o.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return L=q[1],i=parseInt(L),L.length===2&&(50<=i&&i<100?i=1900+i:0<=i&&i<50&&(i=2e3+i)),a=parseInt(q[2])-1,l=parseInt(q[3]),v=parseInt(q[4]),y=parseInt(q[5]),P=parseInt(q[6]),B=0,(j=q[7])!==""&&(H=(j.substr(1)+"00").substr(0,3),B=parseInt(H)),Date.UTC(i,a,l,v,y,P,B);throw"unsupported zulu format: "+o}function Bs(o){return~~(Qi(o)/1e3)}function ii(o){return o.replace(/%/g,"")}function oi(o){return o.replace(/(..)/g,"%$1")}function Hs(o){var i="malformed IPv6 address";if(!o.match(/^[0-9A-Fa-f:]+$/))throw i;var a=(o=o.toLowerCase()).split(":").length-1;if(a<2)throw i;var l=":".repeat(7-a+2),v=(o=o.replace("::",l)).split(":");if(v.length!=8)throw i;for(var y=0;y<8;y++)v[y]=("0000"+v[y]).slice(-4);return v.join("")}function Ks(o){if(!o.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var i=(o=o.toLowerCase()).match(/.{1,4}/g),a=0;a<8;a++)i[a]=i[a].replace(/^0+/,""),i[a]==""&&(i[a]="0");var l=(o=":"+i.join(":")+":").match(/:(0:){2,}/g);if(l===null)return o.slice(1,-1);var v="";for(a=0;a<l.length;a++)l[a].length>v.length&&(v=l[a]);return(o=o.replace(v,"::")).slice(1,-1)}function Xi(o){var i="malformed hex value";if(!o.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw i;if(o.length!=8)return o.length==32?Ks(o):o;try{return parseInt(o.substr(0,2),16)+"."+parseInt(o.substr(2,2),16)+"."+parseInt(o.substr(4,2),16)+"."+parseInt(o.substr(6,2),16)}catch{throw i}}function si(o){for(var i=encodeURIComponent(o),a="",l=0;l<i.length;l++)i[l]=="%"?(a+=i.substr(l,3),l+=2):a=a+"%"+de(i[l]);return a}function Vs(o){return!(o.length%2!=0||!o.match(/^[0-9a-f]+$/)&&!o.match(/^[0-9A-F]+$/))}function Zi(o){return o.length%2==1?"0"+o:o.substr(0,1)>"7"?"00"+o:o}he.getLblen=function(o,i){if(o.substr(i+2,1)!="8")return 1;var a=parseInt(o.substr(i+3,1));return a==0?-1:0<a&&a<10?a+1:-2},he.getL=function(o,i){var a=he.getLblen(o,i);return a<1?"":o.substr(i+2,2*a)},he.getVblen=function(o,i){var a;return(a=he.getL(o,i))==""?-1:(a.substr(0,1)==="8"?new M(a.substr(2),16):new M(a,16)).intValue()},he.getVidx=function(o,i){var a=he.getLblen(o,i);return a<0?a:i+2*(a+1)},he.getV=function(o,i){var a=he.getVidx(o,i),l=he.getVblen(o,i);return o.substr(a,2*l)},he.getTLV=function(o,i){return o.substr(i,2)+he.getL(o,i)+he.getV(o,i)},he.getTLVblen=function(o,i){return 2+2*he.getLblen(o,i)+2*he.getVblen(o,i)},he.getNextSiblingIdx=function(o,i){return he.getVidx(o,i)+2*he.getVblen(o,i)},he.getChildIdx=function(o,i){var a,l,v,y=he,P=[];a=y.getVidx(o,i),l=2*y.getVblen(o,i),o.substr(i,2)=="03"&&(a+=2,l-=2),v=0;for(var B=a;v<=l;){var L=y.getTLVblen(o,B);if((v+=L)<=l&&P.push(B),B+=L,v>=l)break}return P},he.getNthChildIdx=function(o,i,a){return he.getChildIdx(o,i)[a]},he.getIdxbyList=function(o,i,a,l){var v,y,P=he;return a.length==0?l!==void 0&&o.substr(i,2)!==l?-1:i:(v=a.shift())>=(y=P.getChildIdx(o,i)).length?-1:P.getIdxbyList(o,y[v],a,l)},he.getIdxbyListEx=function(o,i,a,l){var v,y,P=he;if(a.length==0)return l!==void 0&&o.substr(i,2)!==l?-1:i;v=a.shift(),y=P.getChildIdx(o,i);for(var B=0,L=0;L<y.length;L++){var j=o.substr(y[L],2);if(typeof v=="number"&&!P.isContextTag(j)&&B==v||typeof v=="string"&&P.isContextTag(j,v))return P.getIdxbyListEx(o,y[L],a,l);P.isContextTag(j)||B++}return-1},he.getTLVbyList=function(o,i,a,l){var v=he,y=v.getIdxbyList(o,i,a,l);return y==-1||y>=o.length?null:v.getTLV(o,y)},he.getTLVbyListEx=function(o,i,a,l){var v=he,y=v.getIdxbyListEx(o,i,a,l);return y==-1?null:v.getTLV(o,y)},he.getVbyList=function(o,i,a,l,v){var y,P,B=he;return(y=B.getIdxbyList(o,i,a,l))==-1||y>=o.length?null:(P=B.getV(o,y),v===!0&&(P=P.substr(2)),P)},he.getVbyListEx=function(o,i,a,l,v){var y,P,B=he;return(y=B.getIdxbyListEx(o,i,a,l))==-1?null:(P=B.getV(o,y),o.substr(y,2)=="03"&&v!==!1&&(P=P.substr(2)),P)},he.getInt=function(o,i,a){a==null&&(a=-1);try{var l=o.substr(i,2);if(l!="02"&&l!="03")return a;var v=he.getV(o,i);return l=="02"?parseInt(v,16):function(P){try{var B=P.substr(0,2);if(B=="00")return parseInt(P.substr(2),16);var L=parseInt(B,16),j=P.substr(2),H=parseInt(j,16).toString(2);return H=="0"&&(H="00000000"),H=H.slice(0,0-L),parseInt(H,2)}catch{return-1}}(v)}catch{return a}},he.getOID=function(o,i,a){a==null&&(a=null);try{return o.substr(i,2)!="06"?a:function(v){if(!Vs(v))return null;try{var y=[],P=v.substr(0,2),B=parseInt(P,16);y[0]=new String(Math.floor(B/40)),y[1]=new String(B%40);for(var L=v.substr(2),j=[],H=0;H<L.length/2;H++)j.push(parseInt(L.substr(2*H,2),16));var q=[],W="";for(H=0;H<j.length;H++)128&j[H]?W+=qs((127&j[H]).toString(2),7):(W+=qs((127&j[H]).toString(2),7),q.push(new String(parseInt(W,2))),W="");var Q=y.join(".");return q.length>0&&(Q=Q+"."+q.join(".")),Q}catch{return null}}(he.getV(o,i))}catch{return a}},he.getOIDName=function(o,i,a){a==null&&(a=null);try{var l=he.getOID(o,i,a);if(l==a)return a;var v=D.asn1.x509.OID.oid2name(l);return v==""?l:v}catch{return a}},he.getString=function(o,i,a){a==null&&(a=null);try{return Dt(he.getV(o,i))}catch{return a}},he.hextooidstr=function(o){var i=function(W,Q){return W.length>=Q?W:new Array(Q-W.length+1).join("0")+W},a=[],l=o.substr(0,2),v=parseInt(l,16);a[0]=new String(Math.floor(v/40)),a[1]=new String(v%40);for(var y=o.substr(2),P=[],B=0;B<y.length/2;B++)P.push(parseInt(y.substr(2*B,2),16));var L=[],j="";for(B=0;B<P.length;B++)128&P[B]?j+=i((127&P[B]).toString(2),7):(j+=i((127&P[B]).toString(2),7),L.push(new String(parseInt(j,2))),j="");var H=a.join(".");return L.length>0&&(H=H+"."+L.join(".")),H},he.dump=function(o,i,a,l){var v=he,y=v.getV,P=v.dump,B=v.getChildIdx,L=o;o instanceof D.asn1.ASN1Object&&(L=o.getEncodedHex());var j=function(ce,Ae){return ce.length<=2*Ae?ce:ce.substr(0,Ae)+"..(total "+ce.length/2+"bytes).."+ce.substr(ce.length-Ae,Ae)};i===void 0&&(i={ommit_long_octet:32}),a===void 0&&(a=0),l===void 0&&(l="");var H,q=i.ommit_long_octet;if((H=L.substr(a,2))=="01")return(W=y(L,a))=="00"?l+`BOOLEAN FALSE
28
- `:l+`BOOLEAN TRUE
29
- `;if(H=="02")return l+"INTEGER "+j(W=y(L,a),q)+`
30
- `;if(H=="03"){var W=y(L,a);if(v.isASN1HEX(W.substr(2))){var Q=l+`BITSTRING, encapsulates
31
- `;return Q+=P(W.substr(2),i,0,l+" ")}return l+"BITSTRING "+j(W,q)+`
32
- `}if(H=="04")return W=y(L,a),v.isASN1HEX(W)?(Q=l+`OCTETSTRING, encapsulates
33
- `,Q+=P(W,i,0,l+" ")):l+"OCTETSTRING "+j(W,q)+`
34
- `;if(H=="05")return l+`NULL
35
- `;if(H=="06"){var ee=y(L,a),ne=D.asn1.ASN1Util.oidHexToInt(ee),re=D.asn1.x509.OID.oid2name(ne),k=ne.replace(/\./g," ");return re!=""?l+"ObjectIdentifier "+re+" ("+k+`)
36
- `:l+"ObjectIdentifier ("+k+`)
37
- `}if(H=="0a")return l+"ENUMERATED "+parseInt(y(L,a))+`
38
- `;if(H=="0c")return l+"UTF8String '"+pt(y(L,a))+`'
39
- `;if(H=="13")return l+"PrintableString '"+pt(y(L,a))+`'
40
- `;if(H=="14")return l+"TeletexString '"+pt(y(L,a))+`'
41
- `;if(H=="16")return l+"IA5String '"+pt(y(L,a))+`'
42
- `;if(H=="17")return l+"UTCTime "+pt(y(L,a))+`
43
- `;if(H=="18")return l+"GeneralizedTime "+pt(y(L,a))+`
44
- `;if(H=="1a")return l+"VisualString '"+pt(y(L,a))+`'
45
- `;if(H=="1e")return l+"BMPString '"+pt(y(L,a))+`'
46
- `;if(H=="30"){if(L.substr(a,4)=="3000")return l+`SEQUENCE {}
47
- `;Q=l+`SEQUENCE
48
- `;var V=i;if(((te=B(L,a)).length==2||te.length==3)&&L.substr(te[0],2)=="06"&&L.substr(te[te.length-1],2)=="04"){re=v.oidname(y(L,te[0]));var $=JSON.parse(JSON.stringify(i));$.x509ExtName=re,V=$}for(var J=0;J<te.length;J++)Q+=P(L,V,te[J],l+" ");return Q}if(H=="31"){Q=l+`SET
49
- `;var te=B(L,a);for(J=0;J<te.length;J++)Q+=P(L,i,te[J],l+" ");return Q}if(128&(H=parseInt(H,16))){var ie=31&H;if(32&H){for(Q=l+"["+ie+`]
50
- `,te=B(L,a),J=0;J<te.length;J++)Q+=P(L,i,te[J],l+" ");return Q}if(W=y(L,a),he.isASN1HEX(W)){var Q=l+"["+ie+`]
51
- `;return Q+=P(W,i,0,l+" ")}return(W.substr(0,8)=="68747470"||i.x509ExtName==="subjectAltName"&&ie==2)&&(W=pt(W)),Q=l+"["+ie+"] "+W+`
52
- `}return l+"UNKNOWN("+H+") "+y(L,a)+`
53
- `},he.isContextTag=function(o,i){var a,l;o=o.toLowerCase();try{a=parseInt(o,16)}catch{return-1}if(i===void 0)return(192&a)==128;try{return i.match(/^\[[0-9]+\]$/)!=null&&!((l=parseInt(i.substr(1,i.length-1),10))>31)&&(192&a)==128&&(31&a)==l}catch{return!1}},he.isASN1HEX=function(o){var i=he;if(o.length%2==1)return!1;var a=i.getVblen(o,0),l=o.substr(0,2),v=i.getL(o,0);return o.length-l.length-v.length==2*a},he.checkStrictDER=function(o,i,a,l,v){var y=he;if(a===void 0){if(typeof o!="string")throw new Error("not hex string");if(o=o.toLowerCase(),!D.lang.String.isHex(o))throw new Error("not hex string");a=o.length,v=(l=o.length/2)<128?1:Math.ceil(l.toString(16))+1}if(y.getL(o,i).length>2*v)throw new Error("L of TLV too long: idx="+i);var P=y.getVblen(o,i);if(P>l)throw new Error("value of L too long than hex: idx="+i);var B=y.getTLV(o,i),L=B.length-2-y.getL(o,i).length;if(L!==2*P)throw new Error("V string length and L's value not the same:"+L+"/"+2*P);if(i===0&&o.length!=B.length)throw new Error("total length and TLV length unmatch:"+o.length+"!="+B.length);var j=o.substr(i,2);if(j==="02"){var H=y.getVidx(o,i);if(o.substr(H,2)=="00"&&o.charCodeAt(H+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(j,16)){for(var q=y.getVblen(o,i),W=0,Q=y.getChildIdx(o,i),ee=0;ee<Q.length;ee++)W+=y.getTLV(o,Q[ee]).length,y.checkStrictDER(o,Q[ee],a,l,v);if(2*q!=W)throw new Error("sum of children's TLV length and L unmatch: "+2*q+"!="+W)}},he.oidname=function(o){var i=D.asn1;D.lang.String.isHex(o)&&(o=i.ASN1Util.oidHexToInt(o));var a=i.x509.OID.oid2name(o);return a===""&&(a=o),a},D!==void 0&&D||(r.KJUR=D={}),D.lang!==void 0&&D.lang||(D.lang={}),D.lang.String=function(){},typeof u=="function"?(r.utf8tob64u=Dn=function(i){return He(u.from(i,"utf8").toString("base64"))},r.b64utoutf8=xt=function(i){return u.from(st(i),"base64").toString("utf8")}):(r.utf8tob64u=Dn=function(i){return Qe(ii(si(i)))},r.b64utoutf8=xt=function(i){return decodeURIComponent(oi(Ke(i)))}),D.lang.String.isInteger=function(o){return!!o.match(/^[0-9]+$/)||!!o.match(/^-[0-9]+$/)},D.lang.String.isHex=function(o){return Vs(o)},D.lang.String.isBase64=function(o){return!(!(o=o.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||o.length%4!=0)},D.lang.String.isBase64URL=function(o){return!o.match(/[+/=]/)&&(o=st(o),D.lang.String.isBase64(o))},D.lang.String.isIntegerArray=function(o){return!!(o=o.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},D.lang.String.isPrintable=function(o){return o.match(/^[0-9A-Za-z '()+,-./:=?]*$/)!==null},D.lang.String.isIA5=function(o){return o.match(/^[\x20-\x21\x23-\x7f]*$/)!==null},D.lang.String.isMail=function(o){return o.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)!==null};var qs=function(i,a,l){return l==null&&(l="0"),i.length>=a?i:new Array(a-i.length+1).join(l)+i};D!==void 0&&D||(r.KJUR=D={}),D.crypto!==void 0&&D.crypto||(D.crypto={}),D.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:O.algo.MD5,sha1:O.algo.SHA1,sha224:O.algo.SHA224,sha256:O.algo.SHA256,sha384:O.algo.SHA384,sha512:O.algo.SHA512,ripemd160:O.algo.RIPEMD160},this.getDigestInfoHex=function(o,i){if(this.DIGESTINFOHEAD[i]===void 0)throw"alg not supported in Util.DIGESTINFOHEAD: "+i;return this.DIGESTINFOHEAD[i]+o},this.getPaddedDigestInfoHex=function(o,i,a){var l=this.getDigestInfoHex(o,i),v=a/4;if(l.length+22>v)throw"key is too short for SigAlg: keylen="+a+","+i;for(var y="0001",P="00"+l,B="",L=v-y.length-P.length,j=0;j<L;j+=2)B+="ff";return y+B+P},this.hashString=function(o,i){return new D.crypto.MessageDigest({alg:i}).digestString(o)},this.hashHex=function(o,i){return new D.crypto.MessageDigest({alg:i}).digestHex(o)},this.sha1=function(o){return this.hashString(o,"sha1")},this.sha256=function(o){return this.hashString(o,"sha256")},this.sha256Hex=function(o){return this.hashHex(o,"sha256")},this.sha512=function(o){return this.hashString(o,"sha512")},this.sha512Hex=function(o){return this.hashHex(o,"sha512")},this.isKey=function(o){return o instanceof ye||o instanceof D.crypto.DSA||o instanceof D.crypto.ECDSA}},D.crypto.Util.md5=function(o){return new D.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(o)},D.crypto.Util.ripemd160=function(o){return new D.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(o)},D.crypto.Util.SECURERANDOMGEN=new lt,D.crypto.Util.getRandomHexOfNbytes=function(o){var i=new Array(o);return D.crypto.Util.SECURERANDOMGEN.nextBytes(i),ae(i)},D.crypto.Util.getRandomBigIntegerOfNbytes=function(o){return new M(D.crypto.Util.getRandomHexOfNbytes(o),16)},D.crypto.Util.getRandomHexOfNbits=function(o){var i=o%8,a=new Array((o-i)/8+1);return D.crypto.Util.SECURERANDOMGEN.nextBytes(a),a[0]=(255<<i&255^255)&a[0],ae(a)},D.crypto.Util.getRandomBigIntegerOfNbits=function(o){return new M(D.crypto.Util.getRandomHexOfNbits(o),16)},D.crypto.Util.getRandomBigIntegerZeroToMax=function(o){for(var i=o.bitLength();;){var a=D.crypto.Util.getRandomBigIntegerOfNbits(i);if(o.compareTo(a)!=-1)return a}},D.crypto.Util.getRandomBigIntegerMinToMax=function(o,i){var a=o.compareTo(i);if(a==1)throw"biMin is greater than biMax";if(a==0)return o;var l=i.subtract(o);return D.crypto.Util.getRandomBigIntegerZeroToMax(l).add(o)},D.crypto.MessageDigest=function(o){this.setAlgAndProvider=function(i,a){if((i=D.crypto.MessageDigest.getCanonicalAlgName(i))!==null&&a===void 0&&(a=D.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&a=="cryptojs"){try{this.md=D.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i].create()}catch(l){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+l}this.updateString=function(l){this.md.update(l)},this.updateHex=function(l){var v=O.enc.Hex.parse(l);this.md.update(v)},this.digest=function(){return this.md.finalize().toString(O.enc.Hex)},this.digestString=function(l){return this.updateString(l),this.digest()},this.digestHex=function(l){return this.updateHex(l),this.digest()}}if(":sha256:".indexOf(i)!=-1&&a=="sjcl"){try{this.md=new sjcl.hash.sha256}catch(l){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+l}this.updateString=function(l){this.md.update(l)},this.updateHex=function(l){var v=sjcl.codec.hex.toBits(l);this.md.update(v)},this.digest=function(){var l=this.md.finalize();return sjcl.codec.hex.fromBits(l)},this.digestString=function(l){return this.updateString(l),this.digest()},this.digestHex=function(l){return this.updateHex(l),this.digest()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(i){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(i){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(i){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},o!==void 0&&o.alg!==void 0&&(this.algName=o.alg,o.prov===void 0&&(this.provName=D.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},D.crypto.MessageDigest.getCanonicalAlgName=function(o){return typeof o=="string"&&(o=(o=o.toLowerCase()).replace(/-/,"")),o},D.crypto.MessageDigest.getHashLength=function(o){var i=D.crypto.MessageDigest,a=i.getCanonicalAlgName(o);if(i.HASHLENGTH[a]===void 0)throw"not supported algorithm: "+o;return i.HASHLENGTH[a]},D.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},D.crypto.Mac=function(o){this.setAlgAndProvider=function(i,a){if((i=i.toLowerCase())==null&&(i="hmacsha1"),(i=i.toLowerCase()).substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+i;a===void 0&&(a=D.crypto.Util.DEFAULTPROVIDER[i]),this.algProv=i+"/"+a;var l=i.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(l)!=-1&&a=="cryptojs"){try{var v=D.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[l];this.mac=O.algo.HMAC.create(v,this.pass)}catch(y){throw"setAlgAndProvider hash alg set fail hashAlg="+l+"/"+y}this.updateString=function(y){this.mac.update(y)},this.updateHex=function(y){var P=O.enc.Hex.parse(y);this.mac.update(P)},this.doFinal=function(){return this.mac.finalize().toString(O.enc.Hex)},this.doFinalString=function(y){return this.updateString(y),this.doFinal()},this.doFinalHex=function(y){return this.updateHex(y),this.doFinal()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(i){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(i){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(i){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(i){if(typeof i=="string"){var a=i;return i.length%2!=1&&i.match(/^[0-9A-Fa-f]+$/)||(a=nn(i)),void(this.pass=O.enc.Hex.parse(a))}if((i===void 0?"undefined":c(i))!="object")throw"KJUR.crypto.Mac unsupported password type: "+i;if(a=null,i.hex!==void 0){if(i.hex.length%2!=0||!i.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+i.hex;a=i.hex}if(i.utf8!==void 0&&(a=Gi(i.utf8)),i.rstr!==void 0&&(a=nn(i.rstr)),i.b64!==void 0&&(a=K(i.b64)),i.b64u!==void 0&&(a=Ke(i.b64u)),a==null)throw"KJUR.crypto.Mac unsupported password type: "+i;this.pass=O.enc.Hex.parse(a)},o!==void 0&&(o.pass!==void 0&&this.setPassword(o.pass),o.alg!==void 0&&(this.algName=o.alg,o.prov===void 0&&(this.provName=D.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},D.crypto.Signature=function(o){var i=null;if(this._setAlgNames=function(){var a=this.algName.match(/^(.+)with(.+)$/);a&&(this.mdAlgName=a[1].toLowerCase(),this.pubkeyAlgName=a[2].toLowerCase(),this.pubkeyAlgName=="rsaandmgf1"&&this.mdAlgName=="sha"&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(a,l){for(var v="",y=l/4-a.length,P=0;P<y;P++)v+="0";return v+a},this.setAlgAndProvider=function(a,l){if(this._setAlgNames(),l!="cryptojs/jsrsa")throw new Error("provider not supported: "+l);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new D.crypto.MessageDigest({alg:this.mdAlgName})}catch(v){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+v)}this.init=function(v,y){var P=null;try{P=y===void 0?tt.getKey(v):tt.getKey(v,y)}catch(B){throw"init failed:"+B}if(P.isPrivate===!0)this.prvKey=P,this.state="SIGN";else{if(P.isPublic!==!0)throw"init failed.:"+P;this.pubKey=P,this.state="VERIFY"}},this.updateString=function(v){this.md.updateString(v)},this.updateHex=function(v){this.md.updateHex(v)},this.sign=function(){if(this.sHashHex=this.md.digest(),this.prvKey===void 0&&this.ecprvhex!==void 0&&this.eccurvename!==void 0&&D.crypto.ECDSA!==void 0&&(this.prvKey=new D.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ye&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ye&&this.pubkeyAlgName==="rsa")this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof D.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof D.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(v){return this.updateString(v),this.sign()},this.signHex=function(v){return this.updateHex(v),this.sign()},this.verify=function(v){if(this.sHashHex=this.md.digest(),this.pubKey===void 0&&this.ecpubhex!==void 0&&this.eccurvename!==void 0&&D.crypto.ECDSA!==void 0&&(this.pubKey=new D.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ye&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,v,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ye&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,v);if(D.crypto.ECDSA!==void 0&&this.pubKey instanceof D.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,v);if(D.crypto.DSA!==void 0&&this.pubKey instanceof D.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,v);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(a,l){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(a){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(a){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(a){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(a){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(a){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=o,o!==void 0&&(o.alg!==void 0&&(this.algName=o.alg,o.prov===void 0?this.provName=D.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=o.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),o.psssaltlen!==void 0&&(this.pssSaltLen=o.psssaltlen),o.prvkeypem!==void 0)){if(o.prvkeypas!==void 0)throw"both prvkeypem and prvkeypas parameters not supported";try{i=tt.getKey(o.prvkeypem),this.init(i)}catch(a){throw"fatal error to load pem private key: "+a}}},D.crypto.Cipher=function(o){},D.crypto.Cipher.encrypt=function(o,i,a){if(i instanceof ye&&i.isPublic){var l=D.crypto.Cipher.getAlgByKeyAndName(i,a);if(l==="RSA")return i.encrypt(o);if(l==="RSAOAEP")return i.encryptOAEP(o,"sha1");var v=l.match(/^RSAOAEP(\d+)$/);if(v!==null)return i.encryptOAEP(o,"sha"+v[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+a}throw"Cipher.encrypt: unsupported key or algorithm"},D.crypto.Cipher.decrypt=function(o,i,a){if(i instanceof ye&&i.isPrivate){var l=D.crypto.Cipher.getAlgByKeyAndName(i,a);if(l==="RSA")return i.decrypt(o);if(l==="RSAOAEP")return i.decryptOAEP(o,"sha1");var v=l.match(/^RSAOAEP(\d+)$/);if(v!==null)return i.decryptOAEP(o,"sha"+v[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+a}throw"Cipher.decrypt: unsupported key or algorithm"},D.crypto.Cipher.getAlgByKeyAndName=function(o,i){if(o instanceof ye){if(":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(i)!=-1)return i;if(i==null)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+i}throw"getAlgByKeyAndName: not supported algorithm name: "+i},D.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},D!==void 0&&D||(r.KJUR=D={}),D.crypto!==void 0&&D.crypto||(D.crypto={}),D.crypto.ECDSA=function(o){var i=Error,a=M,l=ke,v=D.crypto.ECDSA,y=D.crypto.ECParameterDB,P=v.getName,B=he,L=B.getVbyListEx,j=B.isASN1HEX,H=new lt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(q){return new a(q.bitLength(),H).mod(q.subtract(a.ONE)).add(a.ONE)},this.setNamedCurve=function(q){this.ecparams=y.getByName(q),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=q},this.setPrivateKeyHex=function(q){this.isPrivate=!0,this.prvKeyHex=q},this.setPublicKeyHex=function(q){this.isPublic=!0,this.pubKeyHex=q},this.getPublicKeyXYHex=function(){var q=this.pubKeyHex;if(q.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var W=this.ecparams.keylen/4;if(q.length!==2+2*W)throw"malformed public key hex length";var Q={};return Q.x=q.substr(2,W),Q.y=q.substr(2+W),Q},this.getShortNISTPCurveName=function(){var q=this.curveName;return q==="secp256r1"||q==="NIST P-256"||q==="P-256"||q==="prime256v1"?"P-256":q==="secp384r1"||q==="NIST P-384"||q==="P-384"?"P-384":null},this.generateKeyPairHex=function(){var q=this.ecparams.n,W=this.getBigRandom(q),Q=this.ecparams.G.multiply(W),ee=Q.getX().toBigInteger(),ne=Q.getY().toBigInteger(),re=this.ecparams.keylen/4,k=("0000000000"+W.toString(16)).slice(-re),V="04"+("0000000000"+ee.toString(16)).slice(-re)+("0000000000"+ne.toString(16)).slice(-re);return this.setPrivateKeyHex(k),this.setPublicKeyHex(V),{ecprvhex:k,ecpubhex:V}},this.signWithMessageHash=function(q){return this.signHex(q,this.prvKeyHex)},this.signHex=function(q,W){var Q=new a(W,16),ee=this.ecparams.n,ne=new a(q.substring(0,this.ecparams.keylen/4),16);do var re=this.getBigRandom(ee),k=this.ecparams.G.multiply(re).getX().toBigInteger().mod(ee);while(k.compareTo(a.ZERO)<=0);var V=re.modInverse(ee).multiply(ne.add(Q.multiply(k))).mod(ee);return v.biRSSigToASN1Sig(k,V)},this.sign=function(q,W){var Q=W,ee=this.ecparams.n,ne=a.fromByteArrayUnsigned(q);do var re=this.getBigRandom(ee),k=this.ecparams.G.multiply(re).getX().toBigInteger().mod(ee);while(k.compareTo(M.ZERO)<=0);var V=re.modInverse(ee).multiply(ne.add(Q.multiply(k))).mod(ee);return this.serializeSig(k,V)},this.verifyWithMessageHash=function(q,W){return this.verifyHex(q,W,this.pubKeyHex)},this.verifyHex=function(q,W,Q){try{var ee,ne,re=v.parseSigHex(W);ee=re.r,ne=re.s;var k=l.decodeFromHex(this.ecparams.curve,Q),V=new a(q.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(V,ee,ne,k)}catch{return!1}},this.verify=function(q,W,Q){var ee,ne,re;if(Bitcoin.Util.isArray(W)){var k=this.parseSig(W);ee=k.r,ne=k.s}else{if((W===void 0?"undefined":c(W))!=="object"||!W.r||!W.s)throw"Invalid value for signature";ee=W.r,ne=W.s}if(Q instanceof ke)re=Q;else{if(!Bitcoin.Util.isArray(Q))throw"Invalid format for pubkey value, must be byte array or ECPointFp";re=l.decodeFrom(this.ecparams.curve,Q)}var V=a.fromByteArrayUnsigned(q);return this.verifyRaw(V,ee,ne,re)},this.verifyRaw=function(q,W,Q,ee){var ne=this.ecparams.n,re=this.ecparams.G;if(W.compareTo(a.ONE)<0||W.compareTo(ne)>=0||Q.compareTo(a.ONE)<0||Q.compareTo(ne)>=0)return!1;var k=Q.modInverse(ne),V=q.multiply(k).mod(ne),$=W.multiply(k).mod(ne);return re.multiply(V).add(ee.multiply($)).getX().toBigInteger().mod(ne).equals(W)},this.serializeSig=function(q,W){var Q=q.toByteArraySigned(),ee=W.toByteArraySigned(),ne=[];return ne.push(2),ne.push(Q.length),(ne=ne.concat(Q)).push(2),ne.push(ee.length),(ne=ne.concat(ee)).unshift(ne.length),ne.unshift(48),ne},this.parseSig=function(q){var W;if(q[0]!=48)throw new Error("Signature not a valid DERSequence");if(q[W=2]!=2)throw new Error("First element in signature must be a DERInteger");var Q=q.slice(W+2,W+2+q[W+1]);if(q[W+=2+q[W+1]]!=2)throw new Error("Second element in signature must be a DERInteger");var ee=q.slice(W+2,W+2+q[W+1]);return W+=2+q[W+1],{r:a.fromByteArrayUnsigned(Q),s:a.fromByteArrayUnsigned(ee)}},this.parseSigCompact=function(q){if(q.length!==65)throw"Signature has the wrong length";var W=q[0]-27;if(W<0||W>7)throw"Invalid signature type";var Q=this.ecparams.n;return{r:a.fromByteArrayUnsigned(q.slice(1,33)).mod(Q),s:a.fromByteArrayUnsigned(q.slice(33,65)).mod(Q),i:W}},this.readPKCS5PrvKeyHex=function(q){if(j(q)===!1)throw new Error("not ASN.1 hex string");var W,Q,ee;try{W=L(q,0,["[0]",0],"06"),Q=L(q,0,[1],"04");try{ee=L(q,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=P(W),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(ee),this.setPrivateKeyHex(Q),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(q){if(j(q)===!1)throw new i("not ASN.1 hex string");var W,Q,ee;try{L(q,0,[1,0],"06"),W=L(q,0,[1,1],"06"),Q=L(q,0,[2,0,1],"04");try{ee=L(q,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new i("malformed PKCS#8 plain ECC private key")}if(this.curveName=P(W),this.curveName===void 0)throw new i("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(ee),this.setPrivateKeyHex(Q),this.isPublic=!1},this.readPKCS8PubKeyHex=function(q){if(j(q)===!1)throw new i("not ASN.1 hex string");var W,Q;try{L(q,0,[0,0],"06"),W=L(q,0,[0,1],"06"),Q=L(q,0,[1],"03")}catch{throw new i("malformed PKCS#8 ECC public key")}if(this.curveName=P(W),this.curveName===null)throw new i("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(Q)},this.readCertPubKeyHex=function(q,W){if(j(q)===!1)throw new i("not ASN.1 hex string");var Q,ee;try{Q=L(q,0,[0,5,0,1],"06"),ee=L(q,0,[0,5,1],"03")}catch{throw new i("malformed X.509 certificate ECC public key")}if(this.curveName=P(Q),this.curveName===null)throw new i("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(ee)},o!==void 0&&o.curve!==void 0&&(this.curveName=o.curve),this.curveName===void 0&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),o!==void 0&&(o.prv!==void 0&&this.setPrivateKeyHex(o.prv),o.pub!==void 0&&this.setPublicKeyHex(o.pub))},D.crypto.ECDSA.parseSigHex=function(o){var i=D.crypto.ECDSA.parseSigHexInHexRS(o);return{r:new M(i.r,16),s:new M(i.s,16)}},D.crypto.ECDSA.parseSigHexInHexRS=function(o){var i=he,a=i.getChildIdx,l=i.getV;if(i.checkStrictDER(o,0),o.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var v=a(o,0);if(v.length!=2)throw new Error("signature shall have two elements");var y=v[0],P=v[1];if(o.substr(y,2)!="02")throw new Error("1st item not ASN.1 integer");if(o.substr(P,2)!="02")throw new Error("2nd item not ASN.1 integer");return{r:l(o,y),s:l(o,P)}},D.crypto.ECDSA.asn1SigToConcatSig=function(o){var i=D.crypto.ECDSA.parseSigHexInHexRS(o),a=i.r,l=i.s;if(a.substr(0,2)=="00"&&a.length%32==2&&(a=a.substr(2)),l.substr(0,2)=="00"&&l.length%32==2&&(l=l.substr(2)),a.length%32==30&&(a="00"+a),l.length%32==30&&(l="00"+l),a.length%32!=0)throw"unknown ECDSA sig r length error";if(l.length%32!=0)throw"unknown ECDSA sig s length error";return a+l},D.crypto.ECDSA.concatSigToASN1Sig=function(o){if(o.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var i=o.substr(0,o.length/2),a=o.substr(o.length/2);return D.crypto.ECDSA.hexRSSigToASN1Sig(i,a)},D.crypto.ECDSA.hexRSSigToASN1Sig=function(o,i){var a=new M(o,16),l=new M(i,16);return D.crypto.ECDSA.biRSSigToASN1Sig(a,l)},D.crypto.ECDSA.biRSSigToASN1Sig=function(o,i){var a=D.asn1,l=new a.DERInteger({bigint:o}),v=new a.DERInteger({bigint:i});return new a.DERSequence({array:[l,v]}).getEncodedHex()},D.crypto.ECDSA.getName=function(o){return o==="2b8104001f"?"secp192k1":o==="2a8648ce3d030107"?"secp256r1":o==="2b8104000a"?"secp256k1":o==="2b81040021"?"secp224r1":o==="2b81040022"?"secp384r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(o)!==-1?"secp256r1":"|secp256k1|".indexOf(o)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(o)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(o)!==-1?"secp384r1":null},D!==void 0&&D||(r.KJUR=D={}),D.crypto!==void 0&&D.crypto||(D.crypto={}),D.crypto.ECParameterDB=new function(){var o={},i={};function a(l){return new M(l,16)}this.getByName=function(l){var v=l;if(i[v]!==void 0&&(v=i[l]),o[v]!==void 0)return o[v];throw"unregistered EC curve name: "+v},this.regist=function(l,v,y,P,B,L,j,H,q,W,Q,ee){o[l]={};var ne=a(y),re=a(P),k=a(B),V=a(L),$=a(j),J=new tn(ne,re,k),te=J.decodePointHex("04"+H+q);o[l].name=l,o[l].keylen=v,o[l].curve=J,o[l].G=te,o[l].n=V,o[l].h=$,o[l].oid=Q,o[l].info=ee;for(var ie=0;ie<W.length;ie++)i[W[ie]]=l}},D.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),D.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),D.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),D.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),D.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),D.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),D.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),D.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),D.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),D.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);var tt=function(){var o=function(j,H,q){return i(O.AES,j,H,q)},i=function(j,H,q,W){var Q=O.enc.Hex.parse(H),ee=O.enc.Hex.parse(q),ne=O.enc.Hex.parse(W),re={};re.key=ee,re.iv=ne,re.ciphertext=Q;var k=j.decrypt(re,ee,{iv:ne});return O.enc.Hex.stringify(k)},a=function(j,H,q){return l(O.AES,j,H,q)},l=function(j,H,q,W){var Q=O.enc.Hex.parse(H),ee=O.enc.Hex.parse(q),ne=O.enc.Hex.parse(W),re=j.encrypt(Q,ee,{iv:ne}),k=O.enc.Hex.parse(re.toString());return O.enc.Base64.stringify(k)},v={"AES-256-CBC":{proc:o,eproc:a,keylen:32,ivlen:16},"AES-192-CBC":{proc:o,eproc:a,keylen:24,ivlen:16},"AES-128-CBC":{proc:o,eproc:a,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(j,H,q){return i(O.TripleDES,j,H,q)},eproc:function(j,H,q){return l(O.TripleDES,j,H,q)},keylen:24,ivlen:8},"DES-CBC":{proc:function(j,H,q){return i(O.DES,j,H,q)},eproc:function(j,H,q){return l(O.DES,j,H,q)},keylen:8,ivlen:8}},y=function(j){var H={},q=j.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));q&&(H.cipher=q[1],H.ivsalt=q[2]);var W=j.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));W&&(H.type=W[1]);var Q=-1,ee=0;j.indexOf(`\r
54
- \r
55
- `)!=-1&&(Q=j.indexOf(`\r
56
- \r
57
- `),ee=2),j.indexOf(`
58
-
59
- `)!=-1&&(Q=j.indexOf(`
60
-
61
- `),ee=1);var ne=j.indexOf("-----END");if(Q!=-1&&ne!=-1){var re=j.substring(Q+2*ee,ne-ee);re=re.replace(/\s+/g,""),H.data=re}return H},P=function(j,H,q){for(var W=q.substring(0,16),Q=O.enc.Hex.parse(W),ee=O.enc.Utf8.parse(H),ne=v[j].keylen+v[j].ivlen,re="",k=null;;){var V=O.algo.MD5.create();if(k!=null&&V.update(k),V.update(ee),V.update(Q),k=V.finalize(),(re+=O.enc.Hex.stringify(k)).length>=2*ne)break}var $={};return $.keyhex=re.substr(0,2*v[j].keylen),$.ivhex=re.substr(2*v[j].keylen,2*v[j].ivlen),$},B=function(j,H,q,W){var Q=O.enc.Base64.parse(j),ee=O.enc.Hex.stringify(Q);return(0,v[H].proc)(ee,q,W)};return{version:"1.0.0",parsePKCS5PEM:function(j){return y(j)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(j,H,q){return P(j,H,q)},decryptKeyB64:function(j,H,q,W){return B(j,H,q,W)},getDecryptedKeyHex:function(j,H){var q=y(j),W=q.cipher,Q=q.ivsalt,ee=q.data,ne=P(W,H,Q).keyhex;return B(ee,W,ne,Q)},getEncryptedPKCS5PEMFromPrvKeyHex:function(j,H,q,W,Q){var ee="";if(W!==void 0&&W!=null||(W="AES-256-CBC"),v[W]===void 0)throw"KEYUTIL unsupported algorithm: "+W;Q!==void 0&&Q!=null||(Q=function(k){var V=O.lib.WordArray.random(k);return O.enc.Hex.stringify(V)}(v[W].ivlen).toUpperCase());var ne=function(k,V,$,J){return(0,v[V].eproc)(k,$,J)}(H,W,P(W,q,Q).keyhex,Q);return ee="-----BEGIN "+j+` PRIVATE KEY-----\r
62
- `,ee+=`Proc-Type: 4,ENCRYPTED\r
63
- `,ee+="DEK-Info: "+W+","+Q+`\r
64
- `,ee+=`\r
65
- `,ee+=ne.replace(/(.{64})/g,`$1\r
66
- `),ee+=`\r
67
- -----END `+j+` PRIVATE KEY-----\r
68
- `},parseHexOfEncryptedPKCS8:function(j){var H=he,q=H.getChildIdx,W=H.getV,Q={},ee=q(j,0);if(ee.length!=2)throw"malformed format: SEQUENCE(0).items != 2: "+ee.length;Q.ciphertext=W(j,ee[1]);var ne=q(j,ee[0]);if(ne.length!=2)throw"malformed format: SEQUENCE(0.0).items != 2: "+ne.length;if(W(j,ne[0])!="2a864886f70d01050d")throw"this only supports pkcs5PBES2";var re=q(j,ne[1]);if(ne.length!=2)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+re.length;var k=q(j,re[1]);if(k.length!=2)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+k.length;if(W(j,k[0])!="2a864886f70d0307")throw"this only supports TripleDES";Q.encryptionSchemeAlg="TripleDES",Q.encryptionSchemeIV=W(j,k[1]);var V=q(j,re[0]);if(V.length!=2)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+V.length;if(W(j,V[0])!="2a864886f70d01050c")throw"this only supports pkcs5PBKDF2";var $=q(j,V[1]);if($.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+$.length;Q.pbkdf2Salt=W(j,$[0]);var J=W(j,$[1]);try{Q.pbkdf2Iter=parseInt(J,16)}catch{throw"malformed format pbkdf2Iter: "+J}return Q},getPBKDF2KeyHexFromParam:function(j,H){var q=O.enc.Hex.parse(j.pbkdf2Salt),W=j.pbkdf2Iter,Q=O.PBKDF2(H,q,{keySize:6,iterations:W});return O.enc.Hex.stringify(Q)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(j,H){var q=rn(j,"ENCRYPTED PRIVATE KEY"),W=this.parseHexOfEncryptedPKCS8(q),Q=tt.getPBKDF2KeyHexFromParam(W,H),ee={};ee.ciphertext=O.enc.Hex.parse(W.ciphertext);var ne=O.enc.Hex.parse(Q),re=O.enc.Hex.parse(W.encryptionSchemeIV),k=O.TripleDES.decrypt(ee,ne,{iv:re});return O.enc.Hex.stringify(k)},getKeyFromEncryptedPKCS8PEM:function(j,H){var q=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(j,H);return this.getKeyFromPlainPrivatePKCS8Hex(q)},parsePlainPrivatePKCS8Hex:function(j){var H=he,q=H.getChildIdx,W=H.getV,Q={algparam:null};if(j.substr(0,2)!="30")throw"malformed plain PKCS8 private key(code:001)";var ee=q(j,0);if(ee.length!=3)throw"malformed plain PKCS8 private key(code:002)";if(j.substr(ee[1],2)!="30")throw"malformed PKCS8 private key(code:003)";var ne=q(j,ee[1]);if(ne.length!=2)throw"malformed PKCS8 private key(code:004)";if(j.substr(ne[0],2)!="06")throw"malformed PKCS8 private key(code:005)";if(Q.algoid=W(j,ne[0]),j.substr(ne[1],2)=="06"&&(Q.algparam=W(j,ne[1])),j.substr(ee[2],2)!="04")throw"malformed PKCS8 private key(code:006)";return Q.keyidx=H.getVidx(j,ee[2]),Q},getKeyFromPlainPrivatePKCS8PEM:function(j){var H=rn(j,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(H)},getKeyFromPlainPrivatePKCS8Hex:function(j){var H,q=this.parsePlainPrivatePKCS8Hex(j);if(q.algoid=="2a864886f70d010101")H=new ye;else if(q.algoid=="2a8648ce380401")H=new D.crypto.DSA;else{if(q.algoid!="2a8648ce3d0201")throw"unsupported private key algorithm";H=new D.crypto.ECDSA}return H.readPKCS8PrvKeyHex(j),H},_getKeyFromPublicPKCS8Hex:function(j){var H,q=he.getVbyList(j,0,[0,0],"06");if(q==="2a864886f70d010101")H=new ye;else if(q==="2a8648ce380401")H=new D.crypto.DSA;else{if(q!=="2a8648ce3d0201")throw"unsupported PKCS#8 public key hex";H=new D.crypto.ECDSA}return H.readPKCS8PubKeyHex(j),H},parsePublicRawRSAKeyHex:function(j){var H=he,q=H.getChildIdx,W=H.getV,Q={};if(j.substr(0,2)!="30")throw"malformed RSA key(code:001)";var ee=q(j,0);if(ee.length!=2)throw"malformed RSA key(code:002)";if(j.substr(ee[0],2)!="02")throw"malformed RSA key(code:003)";if(Q.n=W(j,ee[0]),j.substr(ee[1],2)!="02")throw"malformed RSA key(code:004)";return Q.e=W(j,ee[1]),Q},parsePublicPKCS8Hex:function(j){var H=he,q=H.getChildIdx,W=H.getV,Q={algparam:null},ee=q(j,0);if(ee.length!=2)throw"outer DERSequence shall have 2 elements: "+ee.length;var ne=ee[0];if(j.substr(ne,2)!="30")throw"malformed PKCS8 public key(code:001)";var re=q(j,ne);if(re.length!=2)throw"malformed PKCS8 public key(code:002)";if(j.substr(re[0],2)!="06")throw"malformed PKCS8 public key(code:003)";if(Q.algoid=W(j,re[0]),j.substr(re[1],2)=="06"?Q.algparam=W(j,re[1]):j.substr(re[1],2)=="30"&&(Q.algparam={},Q.algparam.p=H.getVbyList(j,re[1],[0],"02"),Q.algparam.q=H.getVbyList(j,re[1],[1],"02"),Q.algparam.g=H.getVbyList(j,re[1],[2],"02")),j.substr(ee[1],2)!="03")throw"malformed PKCS8 public key(code:004)";return Q.key=W(j,ee[1]).substr(2),Q}}}();tt.getKey=function(o,i,a){var l=(re=he).getChildIdx,v=(re.getV,re.getVbyList),y=D.crypto,P=y.ECDSA,B=y.DSA,L=ye,j=rn,H=tt;if(L!==void 0&&o instanceof L||P!==void 0&&o instanceof P||B!==void 0&&o instanceof B)return o;if(o.curve!==void 0&&o.xy!==void 0&&o.d===void 0)return new P({pub:o.xy,curve:o.curve});if(o.curve!==void 0&&o.d!==void 0)return new P({prv:o.d,curve:o.curve});if(o.kty===void 0&&o.n!==void 0&&o.e!==void 0&&o.d===void 0)return(_e=new L).setPublic(o.n,o.e),_e;if(o.kty===void 0&&o.n!==void 0&&o.e!==void 0&&o.d!==void 0&&o.p!==void 0&&o.q!==void 0&&o.dp!==void 0&&o.dq!==void 0&&o.co!==void 0&&o.qi===void 0)return(_e=new L).setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co),_e;if(o.kty===void 0&&o.n!==void 0&&o.e!==void 0&&o.d!==void 0&&o.p===void 0)return(_e=new L).setPrivate(o.n,o.e,o.d),_e;if(o.p!==void 0&&o.q!==void 0&&o.g!==void 0&&o.y!==void 0&&o.x===void 0)return(_e=new B).setPublic(o.p,o.q,o.g,o.y),_e;if(o.p!==void 0&&o.q!==void 0&&o.g!==void 0&&o.y!==void 0&&o.x!==void 0)return(_e=new B).setPrivate(o.p,o.q,o.g,o.y,o.x),_e;if(o.kty==="RSA"&&o.n!==void 0&&o.e!==void 0&&o.d===void 0)return(_e=new L).setPublic(Ke(o.n),Ke(o.e)),_e;if(o.kty==="RSA"&&o.n!==void 0&&o.e!==void 0&&o.d!==void 0&&o.p!==void 0&&o.q!==void 0&&o.dp!==void 0&&o.dq!==void 0&&o.qi!==void 0)return(_e=new L).setPrivateEx(Ke(o.n),Ke(o.e),Ke(o.d),Ke(o.p),Ke(o.q),Ke(o.dp),Ke(o.dq),Ke(o.qi)),_e;if(o.kty==="RSA"&&o.n!==void 0&&o.e!==void 0&&o.d!==void 0)return(_e=new L).setPrivate(Ke(o.n),Ke(o.e),Ke(o.d)),_e;if(o.kty==="EC"&&o.crv!==void 0&&o.x!==void 0&&o.y!==void 0&&o.d===void 0){var q=(pe=new P({curve:o.crv})).ecparams.keylen/4,W="04"+("0000000000"+Ke(o.x)).slice(-q)+("0000000000"+Ke(o.y)).slice(-q);return pe.setPublicKeyHex(W),pe}if(o.kty==="EC"&&o.crv!==void 0&&o.x!==void 0&&o.y!==void 0&&o.d!==void 0){q=(pe=new P({curve:o.crv})).ecparams.keylen/4,W="04"+("0000000000"+Ke(o.x)).slice(-q)+("0000000000"+Ke(o.y)).slice(-q);var Q=("0000000000"+Ke(o.d)).slice(-q);return pe.setPublicKeyHex(W),pe.setPrivateKeyHex(Q),pe}if(a==="pkcs5prv"){var ee,ne=o,re=he;if((ee=l(ne,0)).length===9)(_e=new L).readPKCS5PrvKeyHex(ne);else if(ee.length===6)(_e=new B).readPKCS5PrvKeyHex(ne);else{if(!(ee.length>2&&ne.substr(ee[1],2)==="04"))throw"unsupported PKCS#1/5 hexadecimal key";(_e=new P).readPKCS5PrvKeyHex(ne)}return _e}if(a==="pkcs8prv")return _e=H.getKeyFromPlainPrivatePKCS8Hex(o);if(a==="pkcs8pub")return H._getKeyFromPublicPKCS8Hex(o);if(a==="x509pub")return nt.getPublicKeyFromCertHex(o);if(o.indexOf("-END CERTIFICATE-",0)!=-1||o.indexOf("-END X509 CERTIFICATE-",0)!=-1||o.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return nt.getPublicKeyFromCertPEM(o);if(o.indexOf("-END PUBLIC KEY-")!=-1){var k=rn(o,"PUBLIC KEY");return H._getKeyFromPublicPKCS8Hex(k)}if(o.indexOf("-END RSA PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")==-1){var V=j(o,"RSA PRIVATE KEY");return H.getKey(V,null,"pkcs5prv")}if(o.indexOf("-END DSA PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")==-1){var $=v(Ve=j(o,"DSA PRIVATE KEY"),0,[1],"02"),J=v(Ve,0,[2],"02"),te=v(Ve,0,[3],"02"),ie=v(Ve,0,[4],"02"),ve=v(Ve,0,[5],"02");return(_e=new B).setPrivate(new M($,16),new M(J,16),new M(te,16),new M(ie,16),new M(ve,16)),_e}if(o.indexOf("-END EC PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")==-1)return V=j(o,"EC PRIVATE KEY"),H.getKey(V,null,"pkcs5prv");if(o.indexOf("-END PRIVATE KEY-")!=-1)return H.getKeyFromPlainPrivatePKCS8PEM(o);if(o.indexOf("-END RSA PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")!=-1){var ce=H.getDecryptedKeyHex(o,i),Ae=new ye;return Ae.readPKCS5PrvKeyHex(ce),Ae}if(o.indexOf("-END EC PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")!=-1){var pe,_e=v(Ve=H.getDecryptedKeyHex(o,i),0,[1],"04"),Me=v(Ve,0,[2,0],"06"),We=v(Ve,0,[3,0],"03").substr(2);if(D.crypto.OID.oidhex2name[Me]===void 0)throw"undefined OID(hex) in KJUR.crypto.OID: "+Me;return(pe=new P({curve:D.crypto.OID.oidhex2name[Me]})).setPublicKeyHex(We),pe.setPrivateKeyHex(_e),pe.isPublic=!1,pe}if(o.indexOf("-END DSA PRIVATE KEY-")!=-1&&o.indexOf("4,ENCRYPTED")!=-1){var Ve;return $=v(Ve=H.getDecryptedKeyHex(o,i),0,[1],"02"),J=v(Ve,0,[2],"02"),te=v(Ve,0,[3],"02"),ie=v(Ve,0,[4],"02"),ve=v(Ve,0,[5],"02"),(_e=new B).setPrivate(new M($,16),new M(J,16),new M(te,16),new M(ie,16),new M(ve,16)),_e}if(o.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return H.getKeyFromEncryptedPKCS8PEM(o,i);throw new Error("not supported argument")},tt.generateKeypair=function(o,i){if(o=="RSA"){var a=i;(P=new ye).generate(a,"10001"),P.isPrivate=!0,P.isPublic=!0;var l=new ye,v=P.n.toString(16),y=P.e.toString(16);return l.setPublic(v,y),l.isPrivate=!1,l.isPublic=!0,(B={}).prvKeyObj=P,B.pubKeyObj=l,B}if(o=="EC"){var P,B,L=i,j=new D.crypto.ECDSA({curve:L}).generateKeyPairHex();return(P=new D.crypto.ECDSA({curve:L})).setPublicKeyHex(j.ecpubhex),P.setPrivateKeyHex(j.ecprvhex),P.isPrivate=!0,P.isPublic=!1,(l=new D.crypto.ECDSA({curve:L})).setPublicKeyHex(j.ecpubhex),l.isPrivate=!1,l.isPublic=!0,(B={}).prvKeyObj=P,B.pubKeyObj=l,B}throw"unknown algorithm: "+o},tt.getPEM=function(o,i,a,l,v,y){var P=D,B=P.asn1,L=B.DERObjectIdentifier,j=B.DERInteger,H=B.ASN1Util.newObject,q=B.x509.SubjectPublicKeyInfo,W=P.crypto,Q=W.DSA,ee=W.ECDSA,ne=ye;function re(pe){return H({seq:[{int:0},{int:{bigint:pe.n}},{int:pe.e},{int:{bigint:pe.d}},{int:{bigint:pe.p}},{int:{bigint:pe.q}},{int:{bigint:pe.dmp1}},{int:{bigint:pe.dmq1}},{int:{bigint:pe.coeff}}]})}function k(pe){return H({seq:[{int:1},{octstr:{hex:pe.prvKeyHex}},{tag:["a0",!0,{oid:{name:pe.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+pe.pubKeyHex}}]}]})}function V(pe){return H({seq:[{int:0},{int:{bigint:pe.p}},{int:{bigint:pe.q}},{int:{bigint:pe.g}},{int:{bigint:pe.y}},{int:{bigint:pe.x}}]})}if((ne!==void 0&&o instanceof ne||Q!==void 0&&o instanceof Q||ee!==void 0&&o instanceof ee)&&o.isPublic==1&&(i===void 0||i=="PKCS8PUB"))return Rt(ie=new q(o).getEncodedHex(),"PUBLIC KEY");if(i=="PKCS1PRV"&&ne!==void 0&&o instanceof ne&&(a===void 0||a==null)&&o.isPrivate==1)return Rt(ie=re(o).getEncodedHex(),"RSA PRIVATE KEY");if(i=="PKCS1PRV"&&ee!==void 0&&o instanceof ee&&(a===void 0||a==null)&&o.isPrivate==1){var $=new L({name:o.curveName}).getEncodedHex(),J=k(o).getEncodedHex(),te="";return te+=Rt($,"EC PARAMETERS"),te+=Rt(J,"EC PRIVATE KEY")}if(i=="PKCS1PRV"&&Q!==void 0&&o instanceof Q&&(a===void 0||a==null)&&o.isPrivate==1)return Rt(ie=V(o).getEncodedHex(),"DSA PRIVATE KEY");if(i=="PKCS5PRV"&&ne!==void 0&&o instanceof ne&&a!==void 0&&a!=null&&o.isPrivate==1){var ie=re(o).getEncodedHex();return l===void 0&&(l="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",ie,a,l,y)}if(i=="PKCS5PRV"&&ee!==void 0&&o instanceof ee&&a!==void 0&&a!=null&&o.isPrivate==1)return ie=k(o).getEncodedHex(),l===void 0&&(l="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",ie,a,l,y);if(i=="PKCS5PRV"&&Q!==void 0&&o instanceof Q&&a!==void 0&&a!=null&&o.isPrivate==1)return ie=V(o).getEncodedHex(),l===void 0&&(l="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",ie,a,l,y);var ve=function(_e,Me){var We=ce(_e,Me);return new H({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:We.pbkdf2Salt}},{int:We.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:We.encryptionSchemeIV}}]}]}]},{octstr:{hex:We.ciphertext}}]}).getEncodedHex()},ce=function(_e,Me){var We=O.lib.WordArray.random(8),Ve=O.lib.WordArray.random(8),Ot=O.PBKDF2(Me,We,{keySize:6,iterations:100}),wt=O.enc.Hex.parse(_e),kt=O.TripleDES.encrypt(wt,Ot,{iv:Ve})+"",Ze={};return Ze.ciphertext=kt,Ze.pbkdf2Salt=O.enc.Hex.stringify(We),Ze.pbkdf2Iter=100,Ze.encryptionSchemeAlg="DES-EDE3-CBC",Ze.encryptionSchemeIV=O.enc.Hex.stringify(Ve),Ze};if(i=="PKCS8PRV"&&ne!=null&&o instanceof ne&&o.isPrivate==1){var Ae=re(o).getEncodedHex();return ie=H({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:Ae}}]}).getEncodedHex(),a===void 0||a==null?Rt(ie,"PRIVATE KEY"):Rt(J=ve(ie,a),"ENCRYPTED PRIVATE KEY")}if(i=="PKCS8PRV"&&ee!==void 0&&o instanceof ee&&o.isPrivate==1)return Ae=new H({seq:[{int:1},{octstr:{hex:o.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+o.pubKeyHex}}]}]}).getEncodedHex(),ie=H({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:o.curveName}}]},{octstr:{hex:Ae}}]}).getEncodedHex(),a===void 0||a==null?Rt(ie,"PRIVATE KEY"):Rt(J=ve(ie,a),"ENCRYPTED PRIVATE KEY");if(i=="PKCS8PRV"&&Q!==void 0&&o instanceof Q&&o.isPrivate==1)return Ae=new j({bigint:o.x}).getEncodedHex(),ie=H({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:o.p}},{int:{bigint:o.q}},{int:{bigint:o.g}}]}]},{octstr:{hex:Ae}}]}).getEncodedHex(),a===void 0||a==null?Rt(ie,"PRIVATE KEY"):Rt(J=ve(ie,a),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},tt.getKeyFromCSRPEM=function(o){var i=rn(o,"CERTIFICATE REQUEST");return tt.getKeyFromCSRHex(i)},tt.getKeyFromCSRHex=function(o){var i=tt.parseCSRHex(o);return tt.getKey(i.p8pubkeyhex,null,"pkcs8pub")},tt.parseCSRHex=function(o){var i=he,a=i.getChildIdx,l=i.getTLV,v={},y=o;if(y.substr(0,2)!="30")throw"malformed CSR(code:001)";var P=a(y,0);if(P.length<1)throw"malformed CSR(code:002)";if(y.substr(P[0],2)!="30")throw"malformed CSR(code:003)";var B=a(y,P[0]);if(B.length<3)throw"malformed CSR(code:004)";return v.p8pubkeyhex=l(y,B[2]),v},tt.getKeyID=function(o){var i=tt,a=he;typeof o=="string"&&o.indexOf("BEGIN ")!=-1&&(o=i.getKey(o));var l=rn(i.getPEM(o)),v=a.getIdxbyList(l,0,[1]),y=a.getV(l,v).substring(2);return D.crypto.Util.hashHex(y,"sha1")},tt.getJWKFromKey=function(o){var i={};if(o instanceof ye&&o.isPrivate)return i.kty="RSA",i.n=Qe(o.n.toString(16)),i.e=Qe(o.e.toString(16)),i.d=Qe(o.d.toString(16)),i.p=Qe(o.p.toString(16)),i.q=Qe(o.q.toString(16)),i.dp=Qe(o.dmp1.toString(16)),i.dq=Qe(o.dmq1.toString(16)),i.qi=Qe(o.coeff.toString(16)),i;if(o instanceof ye&&o.isPublic)return i.kty="RSA",i.n=Qe(o.n.toString(16)),i.e=Qe(o.e.toString(16)),i;if(o instanceof D.crypto.ECDSA&&o.isPrivate){if((l=o.getShortNISTPCurveName())!=="P-256"&&l!=="P-384")throw"unsupported curve name for JWT: "+l;var a=o.getPublicKeyXYHex();return i.kty="EC",i.crv=l,i.x=Qe(a.x),i.y=Qe(a.y),i.d=Qe(o.prvKeyHex),i}if(o instanceof D.crypto.ECDSA&&o.isPublic){var l;if((l=o.getShortNISTPCurveName())!=="P-256"&&l!=="P-384")throw"unsupported curve name for JWT: "+l;return a=o.getPublicKeyXYHex(),i.kty="EC",i.crv=l,i.x=Qe(a.x),i.y=Qe(a.y),i}throw"not supported key object"},ye.getPosArrayOfChildrenFromHex=function(o){return he.getChildIdx(o,0)},ye.getHexValueArrayOfChildrenFromHex=function(o){var i,a=he.getV,l=a(o,(i=ye.getPosArrayOfChildrenFromHex(o))[0]),v=a(o,i[1]),y=a(o,i[2]),P=a(o,i[3]),B=a(o,i[4]),L=a(o,i[5]),j=a(o,i[6]),H=a(o,i[7]),q=a(o,i[8]);return(i=new Array).push(l,v,y,P,B,L,j,H,q),i},ye.prototype.readPrivateKeyFromPEMString=function(o){var i=rn(o),a=ye.getHexValueArrayOfChildrenFromHex(i);this.setPrivateEx(a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])},ye.prototype.readPKCS5PrvKeyHex=function(o){var i=ye.getHexValueArrayOfChildrenFromHex(o);this.setPrivateEx(i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},ye.prototype.readPKCS8PrvKeyHex=function(o){var i,a,l,v,y,P,B,L,j=he,H=j.getVbyListEx;if(j.isASN1HEX(o)===!1)throw new Error("not ASN.1 hex string");try{i=H(o,0,[2,0,1],"02"),a=H(o,0,[2,0,2],"02"),l=H(o,0,[2,0,3],"02"),v=H(o,0,[2,0,4],"02"),y=H(o,0,[2,0,5],"02"),P=H(o,0,[2,0,6],"02"),B=H(o,0,[2,0,7],"02"),L=H(o,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(i,a,l,v,y,P,B,L)},ye.prototype.readPKCS5PubKeyHex=function(o){var i=he,a=i.getV;if(i.isASN1HEX(o)===!1)throw new Error("keyHex is not ASN.1 hex string");var l=i.getChildIdx(o,0);if(l.length!==2||o.substr(l[0],2)!=="02"||o.substr(l[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var v=a(o,l[0]),y=a(o,l[1]);this.setPublic(v,y)},ye.prototype.readPKCS8PubKeyHex=function(o){var i=he;if(i.isASN1HEX(o)===!1)throw new Error("not ASN.1 hex string");if(i.getTLVbyListEx(o,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var a=i.getTLVbyListEx(o,0,[1,0]);this.readPKCS5PubKeyHex(a)},ye.prototype.readCertPubKeyHex=function(o,i){var a,l;(a=new nt).readCertHex(o),l=a.getPublicKeyHex(),this.readPKCS8PubKeyHex(l)};var Ol=new RegExp("[^0-9a-f]","gi");function $s(o,i){for(var a="",l=i/4-o.length,v=0;v<l;v++)a+="0";return a+o}function Ws(o,i,a){for(var l="",v=0;l.length<i;)l+=Dt(a(nn(o+String.fromCharCode.apply(String,[(4278190080&v)>>24,(16711680&v)>>16,(65280&v)>>8,255&v])))),v+=1;return l}function Js(o){for(var i in D.crypto.Util.DIGESTINFOHEAD){var a=D.crypto.Util.DIGESTINFOHEAD[i],l=a.length;if(o.substring(0,l)==a)return[i,o.substring(l)]}return[]}function nt(o){var i,a=he,l=a.getChildIdx,v=a.getV,y=a.getTLV,P=a.getVbyList,B=a.getVbyListEx,L=a.getTLVbyList,j=a.getTLVbyListEx,H=a.getIdxbyList,q=a.getIdxbyListEx,W=a.getVidx,Q=a.oidname,ee=a.hextooidstr,ne=nt,re=rn;try{i=D.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch{}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){return this.hex===null||this.version!==0?this.version:L(this.hex,0,[0,0])!=="a003020102"?(this.version=1,this.foffset=-1,1):(this.version=3,3)},this.getSerialNumberHex=function(){return B(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var k=j(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(k)},this.getAlgorithmIdentifierName=function(k){for(var V in i)if(k===i[V])return V;return Q(B(k,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return L(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return ne.hex2dn(this.getIssuerHex())},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return L(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return ne.hex2dn(this.getSubjectHex())},this.getNotBefore=function(){var k=P(this.hex,0,[0,4+this.foffset,0]);return k=k.replace(/(..)/g,"%$1"),k=decodeURIComponent(k)},this.getNotAfter=function(){var k=P(this.hex,0,[0,4+this.foffset,1]);return k=k.replace(/(..)/g,"%$1"),k=decodeURIComponent(k)},this.getPublicKeyHex=function(){return a.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return H(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var k=this.getPublicKeyIdx();return H(this.hex,k,[1,0],"30")},this.getPublicKey=function(){return tt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var k=L(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(k)},this.getSignatureValueHex=function(){return P(this.hex,0,[2],"03",!0)},this.verifySignature=function(k){var V=this.getSignatureAlgorithmField(),$=this.getSignatureValueHex(),J=L(this.hex,0,[0],"30"),te=new D.crypto.Signature({alg:V});return te.init(k),te.updateHex(J),te.verify($)},this.parseExt=function(k){var V,$,J;if(k===void 0){if(J=this.hex,this.version!==3)return-1;V=H(J,0,[0,7,0],"30"),$=l(J,V)}else{J=rn(k);var te=H(J,0,[0,3,0,0],"06");if(v(J,te)!="2a864886f70d01090e")return void(this.aExtInfo=new Array);V=H(J,0,[0,3,0,1,0],"30"),$=l(J,V),this.hex=J}this.aExtInfo=new Array;for(var ie=0;ie<$.length;ie++){var ve={critical:!1},ce=0;l(J,$[ie]).length===3&&(ve.critical=!0,ce=1),ve.oid=a.hextooidstr(P(J,$[ie],[0],"06"));var Ae=H(J,$[ie],[1+ce]);ve.vidx=W(J,Ae),this.aExtInfo.push(ve)}},this.getExtInfo=function(k){var V=this.aExtInfo,$=k;if(k.match(/^[0-9.]+$/)||($=D.asn1.x509.OID.name2oid(k)),$!==""){for(var J=0;J<V.length;J++)if(V[J].oid===$)return V[J]}},this.getExtBasicConstraints=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("basicConstraints");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"basicConstraints"};if(V&&(J.critical=!0),k==="3000")return J;if(k==="30030101ff")return J.cA=!0,J;if(k.substr(0,12)==="30060101ff02"){var te=v(k,10),ie=parseInt(te,16);return J.cA=!0,J.pathLen=ie,J}throw new Error("hExtV parse error: "+k)},this.getExtKeyUsage=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("keyUsage");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"keyUsage"};return V&&(J.critical=!0),J.names=this.getExtKeyUsageString(k).split(","),J},this.getExtKeyUsageBin=function(k){if(k===void 0){var V=this.getExtInfo("keyUsage");if(V===void 0)return"";k=y(this.hex,V.vidx)}if(k.length!=8&&k.length!=10)throw new Error("malformed key usage value: "+k);var $="000000000000000"+parseInt(k.substr(6),16).toString(2);return k.length==8&&($=$.slice(-8)),k.length==10&&($=$.slice(-16)),($=$.replace(/0+$/,""))==""&&($="0"),$},this.getExtKeyUsageString=function(k){for(var V=this.getExtKeyUsageBin(k),$=new Array,J=0;J<V.length;J++)V.substr(J,1)=="1"&&$.push(nt.KEYUSAGE_NAME[J]);return $.join(",")},this.getExtSubjectKeyIdentifier=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("subjectKeyIdentifier");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"subjectKeyIdentifier"};V&&(J.critical=!0);var te=v(k,0);return J.kid={hex:te},J},this.getExtAuthorityKeyIdentifier=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("authorityKeyIdentifier");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"authorityKeyIdentifier"};V&&(J.critical=!0);for(var te=l(k,0),ie=0;ie<te.length;ie++){var ve=k.substr(te[ie],2);if(ve==="80"&&(J.kid={hex:v(k,te[ie])}),ve==="a1"){var ce=y(k,te[ie]),Ae=this.getGeneralNames(ce);J.issuer=Ae[0].dn}ve==="82"&&(J.sn={hex:v(k,te[ie])})}return J},this.getExtExtKeyUsage=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("extKeyUsage");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"extKeyUsage",array:[]};V&&(J.critical=!0);for(var te=l(k,0),ie=0;ie<te.length;ie++)J.array.push(Q(v(k,te[ie])));return J},this.getExtExtKeyUsageName=function(){var k=this.getExtInfo("extKeyUsage");if(k===void 0)return k;var V=new Array,$=y(this.hex,k.vidx);if($==="")return V;for(var J=l($,0),te=0;te<J.length;te++)V.push(Q(v($,J[te])));return V},this.getExtSubjectAltName=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("subjectAltName");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"subjectAltName",array:[]};return V&&(J.critical=!0),J.array=this.getGeneralNames(k),J},this.getExtIssuerAltName=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("issuerAltName");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"issuerAltName",array:[]};return V&&(J.critical=!0),J.array=this.getGeneralNames(k),J},this.getGeneralNames=function(k){for(var V=l(k,0),$=[],J=0;J<V.length;J++){var te=this.getGeneralName(y(k,V[J]));te!==void 0&&$.push(te)}return $},this.getGeneralName=function(k){var V=k.substr(0,2),$=v(k,0),J=Dt($);return V=="81"?{rfc822:J}:V=="82"?{dns:J}:V=="86"?{uri:J}:V=="87"?{ip:Xi($)}:V=="a4"?{dn:this.getX500Name($)}:void 0},this.getExtSubjectAltName2=function(){var k,V,$,J=this.getExtInfo("subjectAltName");if(J===void 0)return J;for(var te=new Array,ie=y(this.hex,J.vidx),ve=l(ie,0),ce=0;ce<ve.length;ce++)$=ie.substr(ve[ce],2),k=v(ie,ve[ce]),$==="81"&&(V=pt(k),te.push(["MAIL",V])),$==="82"&&(V=pt(k),te.push(["DNS",V])),$==="84"&&(V=nt.hex2dn(k,0),te.push(["DN",V])),$==="86"&&(V=pt(k),te.push(["URI",V])),$==="87"&&(V=Xi(k),te.push(["IP",V]));return te},this.getExtCRLDistributionPoints=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("cRLDistributionPoints");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"cRLDistributionPoints",array:[]};V&&(J.critical=!0);for(var te=l(k,0),ie=0;ie<te.length;ie++){var ve=y(k,te[ie]);J.array.push(this.getDistributionPoint(ve))}return J},this.getDistributionPoint=function(k){for(var V={},$=l(k,0),J=0;J<$.length;J++){var te=k.substr($[J],2),ie=y(k,$[J]);te=="a0"&&(V.dpname=this.getDistributionPointName(ie))}return V},this.getDistributionPointName=function(k){for(var V={},$=l(k,0),J=0;J<$.length;J++){var te=k.substr($[J],2),ie=y(k,$[J]);te=="a0"&&(V.full=this.getGeneralNames(ie))}return V},this.getExtCRLDistributionPointsURI=function(){var k=this.getExtInfo("cRLDistributionPoints");if(k===void 0)return k;for(var V=new Array,$=l(this.hex,k.vidx),J=0;J<$.length;J++)try{var te=pt(P(this.hex,$[J],[0,0,0],"86"));V.push(te)}catch{}return V},this.getExtAIAInfo=function(){var k=this.getExtInfo("authorityInfoAccess");if(k===void 0)return k;for(var V={ocsp:[],caissuer:[]},$=l(this.hex,k.vidx),J=0;J<$.length;J++){var te=P(this.hex,$[J],[0],"06"),ie=P(this.hex,$[J],[1],"86");te==="2b06010505073001"&&V.ocsp.push(pt(ie)),te==="2b06010505073002"&&V.caissuer.push(pt(ie))}return V},this.getExtAuthorityInfoAccess=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("authorityInfoAccess");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"authorityInfoAccess",array:[]};V&&(J.critical=!0);for(var te=l(k,0),ie=0;ie<te.length;ie++){var ve=B(k,te[ie],[0],"06"),ce=pt(P(k,te[ie],[1],"86"));if(ve=="2b06010505073001")J.array.push({ocsp:ce});else{if(ve!="2b06010505073002")throw new Error("unknown method: "+ve);J.array.push({caissuer:ce})}}return J},this.getExtCertificatePolicies=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("certificatePolicies");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"certificatePolicies",array:[]};V&&(J.critical=!0);for(var te=l(k,0),ie=0;ie<te.length;ie++){var ve=y(k,te[ie]),ce=this.getPolicyInformation(ve);J.array.push(ce)}return J},this.getPolicyInformation=function(k){var V={},$=P(k,0,[0],"06");V.policyoid=Q($);var J=q(k,0,[1],"30");if(J!=-1){V.array=[];for(var te=l(k,J),ie=0;ie<te.length;ie++){var ve=y(k,te[ie]),ce=this.getPolicyQualifierInfo(ve);V.array.push(ce)}}return V},this.getPolicyQualifierInfo=function(k){var V={},$=P(k,0,[0],"06");if($==="2b06010505070201"){var J=B(k,0,[1],"16");V.cps=Dt(J)}else if($==="2b06010505070202"){var te=L(k,0,[1],"30");V.unotice=this.getUserNotice(te)}return V},this.getUserNotice=function(k){for(var V={},$=l(k,0),J=0;J<$.length;J++){var te=y(k,$[J]);te.substr(0,2)!="30"&&(V.exptext=this.getDisplayText(te))}return V},this.getDisplayText=function(k){var V={};return V.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[k.substr(0,2)],V.str=Dt(v(k,0)),V},this.getExtCRLNumber=function(k,V){var $={extname:"cRLNumber"};if(V&&($.critical=!0),k.substr(0,2)=="02")return $.num={hex:v(k,0)},$;throw new Error("hExtV parse error: "+k)},this.getExtCRLReason=function(k,V){var $={extname:"cRLReason"};if(V&&($.critical=!0),k.substr(0,2)=="0a")return $.code=parseInt(v(k,0),16),$;throw new Error("hExtV parse error: "+k)},this.getExtOcspNonce=function(k,V){var $={extname:"ocspNonce"};V&&($.critical=!0);var J=v(k,0);return $.hex=J,$},this.getExtOcspNoCheck=function(k,V){var $={extname:"ocspNoCheck"};return V&&($.critical=!0),$},this.getExtAdobeTimeStamp=function(k,V){if(k===void 0&&V===void 0){var $=this.getExtInfo("adobeTimeStamp");if($===void 0)return;k=y(this.hex,$.vidx),V=$.critical}var J={extname:"adobeTimeStamp"};V&&(J.critical=!0);var te=l(k,0);if(te.length>1){var ie=y(k,te[1]),ve=this.getGeneralName(ie);ve.uri!=null&&(J.uri=ve.uri)}if(te.length>2){var ce=y(k,te[2]);ce=="0101ff"&&(J.reqauth=!0),ce=="010100"&&(J.reqauth=!1)}return J},this.getX500NameRule=function(k){for(var V=null,$=[],J=0;J<k.length;J++)for(var te=k[J],ie=0;ie<te.length;ie++)$.push(te[ie]);for(J=0;J<$.length;J++){var ve=$[J],ce=ve.ds,Ae=ve.value,pe=ve.type;if(ce!="prn"&&ce!="utf8"&&ce!="ia5")return"mixed";if(ce=="ia5"){if(pe!="CN")return"mixed";if(D.lang.String.isMail(Ae))continue;return"mixed"}if(pe=="C"){if(ce=="prn")continue;return"mixed"}if(V==null)V=ce;else if(V!==ce)return"mixed"}return V??"prn"},this.getX500Name=function(k){var V=this.getX500NameArray(k);return{array:V,str:this.dnarraytostr(V)}},this.getX500NameArray=function(k){for(var V=[],$=l(k,0),J=0;J<$.length;J++)V.push(this.getRDN(y(k,$[J])));return V},this.getRDN=function(k){for(var V=[],$=l(k,0),J=0;J<$.length;J++)V.push(this.getAttrTypeAndValue(y(k,$[J])));return V},this.getAttrTypeAndValue=function(k){var V={type:null,value:null,ds:null},$=l(k,0),J=P(k,$[0],[],"06"),te=P(k,$[1],[]),ie=D.asn1.ASN1Util.oidHexToInt(J);return V.type=D.asn1.x509.OID.oid2atype(ie),V.value=Dt(te),V.ds=this.HEX2STAG[k.substr($[1],2)],V},this.readCertPEM=function(k){this.readCertHex(re(k))},this.readCertHex=function(k){this.hex=k,this.getVersion();try{H(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(){var k={};return k.version=this.getVersion(),k.serial={hex:this.getSerialNumberHex()},k.sigalg=this.getSignatureAlgorithmField(),k.issuer=this.getIssuer(),k.notbefore=this.getNotBefore(),k.notafter=this.getNotAfter(),k.subject=this.getSubject(),k.sbjpubkey=Rt(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(k.ext=this.getExtParamArray()),k.sighex=this.getSignatureValueHex(),k},this.getExtParamArray=function(k){k==null&&q(this.hex,0,[0,"[3]"])!=-1&&(k=j(this.hex,0,[0,"[3]",0],"30"));for(var V=[],$=l(k,0),J=0;J<$.length;J++){var te=y(k,$[J]),ie=this.getExtParam(te);ie!=null&&V.push(ie)}return V},this.getExtParam=function(k){var V=l(k,0).length;if(V!=2&&V!=3)throw new Error("wrong number elements in Extension: "+V+" "+k);var $=ee(P(k,0,[0],"06")),J=!1;V==3&&L(k,0,[1])=="0101ff"&&(J=!0);var te=L(k,0,[V-1,0]),ie=void 0;if($=="2.5.29.14"?ie=this.getExtSubjectKeyIdentifier(te,J):$=="2.5.29.15"?ie=this.getExtKeyUsage(te,J):$=="2.5.29.17"?ie=this.getExtSubjectAltName(te,J):$=="2.5.29.18"?ie=this.getExtIssuerAltName(te,J):$=="2.5.29.19"?ie=this.getExtBasicConstraints(te,J):$=="2.5.29.31"?ie=this.getExtCRLDistributionPoints(te,J):$=="2.5.29.32"?ie=this.getExtCertificatePolicies(te,J):$=="2.5.29.35"?ie=this.getExtAuthorityKeyIdentifier(te,J):$=="2.5.29.37"?ie=this.getExtExtKeyUsage(te,J):$=="1.3.6.1.5.5.7.1.1"?ie=this.getExtAuthorityInfoAccess(te,J):$=="2.5.29.20"?ie=this.getExtCRLNumber(te,J):$=="2.5.29.21"?ie=this.getExtCRLReason(te,J):$=="1.3.6.1.5.5.7.48.1.2"?ie=this.getExtOcspNonce(te,J):$=="1.3.6.1.5.5.7.48.1.5"?ie=this.getExtOcspNoCheck(te,J):$=="1.2.840.113583.1.1.9.1"&&(ie=this.getExtAdobeTimeStamp(te,J)),ie!=null)return ie;var ve={extname:$,extn:te};return J&&(ve.critical=!0),ve},this.findExt=function(k,V){for(var $=0;$<k.length;$++)if(k[$].extname==V)return k[$];return null},this.updateExtCDPFullURI=function(k,V){var $=this.findExt(k,"cRLDistributionPoints");if($!=null&&$.array!=null){for(var J=$.array,te=0;te<J.length;te++)if(J[te].dpname!=null&&J[te].dpname.full!=null)for(var ie=J[te].dpname.full,ve=0;ve<ie.length;ve++){var ce=ie[te];ce.uri!=null&&(ce.uri=V)}}},this.updateExtAIAOCSP=function(k,V){var $=this.findExt(k,"authorityInfoAccess");if($!=null&&$.array!=null)for(var J=$.array,te=0;te<J.length;te++)J[te].ocsp!=null&&(J[te].ocsp=V)},this.updateExtAIACAIssuer=function(k,V){var $=this.findExt(k,"authorityInfoAccess");if($!=null&&$.array!=null)for(var J=$.array,te=0;te<J.length;te++)J[te].caissuer!=null&&(J[te].caissuer=V)},this.dnarraytostr=function(k){return"/"+k.map(function(V){return function(J){return J.map(function(te){return function(ve){return ve.type+"="+ve.value}(te)}).join("+")}(V)}).join("/")},this.getInfo=function(){var k,V,$,J=function(Ot){return JSON.stringify(Ot.array).replace(/[\[\]\{\}\"]/g,"")},te=function(Ot){for(var wt="",kt=Ot.array,Ze=0;Ze<kt.length;Ze++){var at=kt[Ze];if(wt+=" policy oid: "+at.policyoid+`
69
- `,at.array!==void 0)for(var gt=0;gt<at.array.length;gt++){var Ct=at.array[gt];Ct.cps!==void 0&&(wt+=" cps: "+Ct.cps+`
70
- `)}}return wt},ie=function(Ot){for(var wt="",kt=Ot.array,Ze=0;Ze<kt.length;Ze++){var at=kt[Ze];try{at.dpname.full[0].uri!==void 0&&(wt+=" "+at.dpname.full[0].uri+`
71
- `)}catch{}try{at.dname.full[0].dn.hex!==void 0&&(wt+=" "+nt.hex2dn(at.dpname.full[0].dn.hex)+`
72
- `)}catch{}}return wt},ve=function(Ot){for(var wt="",kt=Ot.array,Ze=0;Ze<kt.length;Ze++){var at=kt[Ze];at.caissuer!==void 0&&(wt+=" caissuer: "+at.caissuer+`
73
- `),at.ocsp!==void 0&&(wt+=" ocsp: "+at.ocsp+`
74
- `)}return wt};if(k=`Basic Fields
75
- `,k+=" serial number: "+this.getSerialNumberHex()+`
76
- `,k+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
77
- `,k+=" issuer: "+this.getIssuerString()+`
78
- `,k+=" notBefore: "+this.getNotBefore()+`
79
- `,k+=" notAfter: "+this.getNotAfter()+`
80
- `,k+=" subject: "+this.getSubjectString()+`
81
- `,k+=` subject public key info:
82
- `,k+=" key algorithm: "+(V=this.getPublicKey()).type+`
83
- `,V.type==="RSA"&&(k+=" n="+Zi(V.n.toString(16)).substr(0,16)+`...
84
- `,k+=" e="+Zi(V.e.toString(16))+`
85
- `),($=this.aExtInfo)!=null){k+=`X509v3 Extensions:
86
- `;for(var ce=0;ce<$.length;ce++){var Ae=$[ce],pe=D.asn1.x509.OID.oid2name(Ae.oid);pe===""&&(pe=Ae.oid);var _e="";if(Ae.critical===!0&&(_e="CRITICAL"),k+=" "+pe+" "+_e+`:
87
- `,pe==="basicConstraints"){var Me=this.getExtBasicConstraints();Me.cA===void 0?k+=` {}
88
- `:(k+=" cA=true",Me.pathLen!==void 0&&(k+=", pathLen="+Me.pathLen),k+=`
89
- `)}else if(pe==="keyUsage")k+=" "+this.getExtKeyUsageString()+`
90
- `;else if(pe==="subjectKeyIdentifier")k+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
91
- `;else if(pe==="authorityKeyIdentifier"){var We=this.getExtAuthorityKeyIdentifier();We.kid!==void 0&&(k+=" kid="+We.kid.hex+`
92
- `)}else pe==="extKeyUsage"?k+=" "+this.getExtExtKeyUsage().array.join(", ")+`
93
- `:pe==="subjectAltName"?k+=" "+J(this.getExtSubjectAltName())+`
94
- `:pe==="cRLDistributionPoints"?k+=ie(this.getExtCRLDistributionPoints()):pe==="authorityInfoAccess"?k+=ve(this.getExtAuthorityInfoAccess()):pe==="certificatePolicies"&&(k+=te(this.getExtCertificatePolicies()))}}return k+="signature algorithm: "+this.getSignatureAlgorithmName()+`
95
- `,k+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
96
- `},typeof o=="string"&&(o.indexOf("-----BEGIN")!=-1?this.readCertPEM(o):D.lang.String.isHex(o)&&this.readCertHex(o))}ye.prototype.sign=function(o,i){var a=function(v){return D.crypto.Util.hashString(v,i)}(o);return this.signWithMessageHash(a,i)},ye.prototype.signWithMessageHash=function(o,i){var a=St(D.crypto.Util.getPaddedDigestInfoHex(o,i,this.n.bitLength()),16);return $s(this.doPrivate(a).toString(16),this.n.bitLength())},ye.prototype.signPSS=function(o,i,a){var l=function(y){return D.crypto.Util.hashHex(y,i)}(nn(o));return a===void 0&&(a=-1),this.signWithMessageHashPSS(l,i,a)},ye.prototype.signWithMessageHashPSS=function(o,i,a){var l,v=Dt(o),y=v.length,P=this.n.bitLength()-1,B=Math.ceil(P/8),L=function(k){return D.crypto.Util.hashHex(k,i)};if(a===-1||a===void 0)a=y;else if(a===-2)a=B-y-2;else if(a<-2)throw new Error("invalid salt length");if(B<y+a+2)throw new Error("data too long");var j="";a>0&&(j=new Array(a),new lt().nextBytes(j),j=String.fromCharCode.apply(String,j));var H=Dt(L(nn("\0\0\0\0\0\0\0\0"+v+j))),q=[];for(l=0;l<B-a-y-2;l+=1)q[l]=0;var W=String.fromCharCode.apply(String,q)+""+j,Q=Ws(H,W.length,L),ee=[];for(l=0;l<W.length;l+=1)ee[l]=W.charCodeAt(l)^Q.charCodeAt(l);var ne=65280>>8*B-P&255;for(ee[0]&=~ne,l=0;l<y;l++)ee.push(H.charCodeAt(l));return ee.push(188),$s(this.doPrivate(new M(ee)).toString(16),this.n.bitLength())},ye.prototype.verify=function(o,i){var a=St(i=(i=i.replace(Ol,"")).replace(/[ \n]+/g,""),16);if(a.bitLength()>this.n.bitLength())return 0;var l=Js(this.doPublic(a).toString(16).replace(/^1f+00/,""));if(l.length==0)return!1;var v=l[0];return l[1]==function(P){return D.crypto.Util.hashString(P,v)}(o)},ye.prototype.verifyWithMessageHash=function(o,i){if(i.length!=Math.ceil(this.n.bitLength()/4))return!1;var a=St(i,16);if(a.bitLength()>this.n.bitLength())return 0;var l=Js(this.doPublic(a).toString(16).replace(/^1f+00/,""));return l.length==0?!1:(l[0],l[1]==o)},ye.prototype.verifyPSS=function(o,i,a,l){var v=function(P){return D.crypto.Util.hashHex(P,a)}(nn(o));return l===void 0&&(l=-1),this.verifyWithMessageHashPSS(v,i,a,l)},ye.prototype.verifyWithMessageHashPSS=function(o,i,a,l){if(i.length!=Math.ceil(this.n.bitLength()/4))return!1;var v,y=new M(i,16),P=function($){return D.crypto.Util.hashHex($,a)},B=Dt(o),L=B.length,j=this.n.bitLength()-1,H=Math.ceil(j/8);if(l===-1||l===void 0)l=L;else if(l===-2)l=H-L-2;else if(l<-2)throw new Error("invalid salt length");if(H<L+l+2)throw new Error("data too long");var q=this.doPublic(y).toByteArray();for(v=0;v<q.length;v+=1)q[v]&=255;for(;q.length<H;)q.unshift(0);if(q[H-1]!==188)throw new Error("encoded message does not end in 0xbc");var W=(q=String.fromCharCode.apply(String,q)).substr(0,H-L-1),Q=q.substr(W.length,L),ee=65280>>8*H-j&255;if(W.charCodeAt(0)&ee)throw new Error("bits beyond keysize not zero");var ne=Ws(Q,W.length,P),re=[];for(v=0;v<W.length;v+=1)re[v]=W.charCodeAt(v)^ne.charCodeAt(v);re[0]&=~ee;var k=H-L-l-2;for(v=0;v<k;v+=1)if(re[v]!==0)throw new Error("leftmost octets not zero");if(re[k]!==1)throw new Error("0x01 marker not found");return Q===Dt(P(nn("\0\0\0\0\0\0\0\0"+B+String.fromCharCode.apply(String,re.slice(-l)))))},ye.SALT_LEN_HLEN=-1,ye.SALT_LEN_MAX=-2,ye.SALT_LEN_RECOVER=-2,nt.hex2dn=function(o,i){if(i===void 0&&(i=0),o.substr(i,2)!=="30")throw new Error("malformed DN");for(var a=new Array,l=he.getChildIdx(o,i),v=0;v<l.length;v++)a.push(nt.hex2rdn(o,l[v]));return"/"+(a=a.map(function(y){return y.replace("/","\\/")})).join("/")},nt.hex2rdn=function(o,i){if(i===void 0&&(i=0),o.substr(i,2)!=="31")throw new Error("malformed RDN");for(var a=new Array,l=he.getChildIdx(o,i),v=0;v<l.length;v++)a.push(nt.hex2attrTypeValue(o,l[v]));return(a=a.map(function(y){return y.replace("+","\\+")})).join("+")},nt.hex2attrTypeValue=function(o,i){var a=he,l=a.getV;if(i===void 0&&(i=0),o.substr(i,2)!=="30")throw new Error("malformed attribute type and value");var v=a.getChildIdx(o,i);v.length!==2||o.substr(v[0],2);var y=l(o,v[0]),P=D.asn1.ASN1Util.oidHexToInt(y);return D.asn1.x509.OID.oid2atype(P)+"="+Dt(l(o,v[1]))},nt.getPublicKeyFromCertHex=function(o){var i=new nt;return i.readCertHex(o),i.getPublicKey()},nt.getPublicKeyFromCertPEM=function(o){var i=new nt;return i.readCertPEM(o),i.getPublicKey()},nt.getPublicKeyInfoPropOfCertPEM=function(o){var i,a,l=he.getVbyList,v={};return v.algparam=null,(i=new nt).readCertPEM(o),a=i.getPublicKeyHex(),v.keyhex=l(a,0,[1],"03").substr(2),v.algoid=l(a,0,[0,0],"06"),v.algoid==="2a8648ce3d0201"&&(v.algparam=l(a,0,[0,1],"06")),v},nt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],D!==void 0&&D||(r.KJUR=D={}),D.jws!==void 0&&D.jws||(D.jws={}),D.jws.JWS=function(){var o=D.jws.JWS.isSafeJSONString;this.parseJWS=function(i,a){if(this.parsedJWS===void 0||!a&&this.parsedJWS.sigvalH===void 0){var l=i.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(l==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var v=l[1],y=l[2],P=l[3],B=v+"."+y;if(this.parsedJWS={},this.parsedJWS.headB64U=v,this.parsedJWS.payloadB64U=y,this.parsedJWS.sigvalB64U=P,this.parsedJWS.si=B,!a){var L=Ke(P),j=St(L,16);this.parsedJWS.sigvalH=L,this.parsedJWS.sigvalBI=j}var H=xt(v),q=xt(y);if(this.parsedJWS.headS=H,this.parsedJWS.payloadS=q,!o(H,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+H}}},D.jws.JWS.sign=function(o,i,a,l,v){var y,P,B,L=D,j=L.jws.JWS,H=j.readSafeJSONString,q=j.isSafeJSONString,W=L.crypto,Q=(W.ECDSA,W.Mac),ee=W.Signature,ne=JSON;if(typeof i!="string"&&(i===void 0?"undefined":c(i))!="object")throw"spHeader must be JSON string or object: "+i;if((i===void 0?"undefined":c(i))=="object"&&(P=i,y=ne.stringify(P)),typeof i=="string"){if(!q(y=i))throw"JWS Head is not safe JSON string: "+y;P=H(y)}if(B=a,(a===void 0?"undefined":c(a))=="object"&&(B=ne.stringify(a)),o!=""&&o!=null||P.alg===void 0||(o=P.alg),o!=""&&o!=null&&P.alg===void 0&&(P.alg=o,y=ne.stringify(P)),o!==P.alg)throw"alg and sHeader.alg doesn't match: "+o+"!="+P.alg;var re=null;if(j.jwsalg2sigalg[o]===void 0)throw"unsupported alg name: "+o;re=j.jwsalg2sigalg[o];var k=Dn(y)+"."+Dn(B),V="";if(re.substr(0,4)=="Hmac"){if(l===void 0)throw"mac key shall be specified for HS* alg";var $=new Q({alg:re,prov:"cryptojs",pass:l});$.updateString(k),V=$.doFinal()}else if(re.indexOf("withECDSA")!=-1){(te=new ee({alg:re})).init(l,v),te.updateString(k);var J=te.sign();V=D.crypto.ECDSA.asn1SigToConcatSig(J)}else{var te;re!="none"&&((te=new ee({alg:re})).init(l,v),te.updateString(k),V=te.sign())}return k+"."+Qe(V)},D.jws.JWS.verify=function(o,i,a){var l,v=D,y=v.jws.JWS,P=y.readSafeJSONString,B=v.crypto,L=B.ECDSA,j=B.Mac,H=B.Signature;c(ye)!==void 0&&(l=ye);var q=o.split(".");if(q.length!==3)return!1;var W=q[0]+"."+q[1],Q=Ke(q[2]),ee=P(xt(q[0])),ne=null,re=null;if(ee.alg===void 0)throw"algorithm not specified in header";if(re=(ne=ee.alg).substr(0,2),a!=null&&Object.prototype.toString.call(a)==="[object Array]"&&a.length>0&&(":"+a.join(":")+":").indexOf(":"+ne+":")==-1)throw"algorithm '"+ne+"' not accepted in the list";if(ne!="none"&&i===null)throw"key shall be specified to verify.";if(typeof i=="string"&&i.indexOf("-----BEGIN ")!=-1&&(i=tt.getKey(i)),!(re!="RS"&&re!="PS"||i instanceof l))throw"key shall be a RSAKey obj for RS* and PS* algs";if(re=="ES"&&!(i instanceof L))throw"key shall be a ECDSA obj for ES* algs";var k=null;if(y.jwsalg2sigalg[ee.alg]===void 0)throw"unsupported alg name: "+ne;if((k=y.jwsalg2sigalg[ne])=="none")throw"not supported";if(k.substr(0,4)=="Hmac"){if(i===void 0)throw"hexadecimal key shall be specified for HMAC";var V=new j({alg:k,pass:i});return V.updateString(W),Q==V.doFinal()}if(k.indexOf("withECDSA")!=-1){var $,J=null;try{J=L.concatSigToASN1Sig(Q)}catch{return!1}return($=new H({alg:k})).init(i),$.updateString(W),$.verify(J)}return($=new H({alg:k})).init(i),$.updateString(W),$.verify(Q)},D.jws.JWS.parse=function(o){var i,a,l,v=o.split("."),y={};if(v.length!=2&&v.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return i=v[0],a=v[1],v.length==3&&(l=v[2]),y.headerObj=D.jws.JWS.readSafeJSONString(xt(i)),y.payloadObj=D.jws.JWS.readSafeJSONString(xt(a)),y.headerPP=JSON.stringify(y.headerObj,null," "),y.payloadObj==null?y.payloadPP=xt(a):y.payloadPP=JSON.stringify(y.payloadObj,null," "),l!==void 0&&(y.sigHex=Ke(l)),y},D.jws.JWS.verifyJWT=function(o,i,a){var l=D.jws,v=l.JWS,y=v.readSafeJSONString,P=v.inArray,B=v.includedArray,L=o.split("."),j=L[0],H=L[1],q=(Ke(L[2]),y(xt(j))),W=y(xt(H));if(q.alg===void 0)return!1;if(a.alg===void 0)throw"acceptField.alg shall be specified";if(!P(q.alg,a.alg)||W.iss!==void 0&&c(a.iss)==="object"&&!P(W.iss,a.iss)||W.sub!==void 0&&c(a.sub)==="object"&&!P(W.sub,a.sub))return!1;if(W.aud!==void 0&&c(a.aud)==="object"){if(typeof W.aud=="string"){if(!P(W.aud,a.aud))return!1}else if(c(W.aud)=="object"&&!B(W.aud,a.aud))return!1}var Q=l.IntDate.getNow();return a.verifyAt!==void 0&&typeof a.verifyAt=="number"&&(Q=a.verifyAt),a.gracePeriod!==void 0&&typeof a.gracePeriod=="number"||(a.gracePeriod=0),!(W.exp!==void 0&&typeof W.exp=="number"&&W.exp+a.gracePeriod<Q)&&!(W.nbf!==void 0&&typeof W.nbf=="number"&&Q<W.nbf-a.gracePeriod)&&!(W.iat!==void 0&&typeof W.iat=="number"&&Q<W.iat-a.gracePeriod)&&(W.jti===void 0||a.jti===void 0||W.jti===a.jti)&&!!v.verify(o,i,a.alg)},D.jws.JWS.includedArray=function(o,i){var a=D.jws.JWS.inArray;if(o===null||(o===void 0?"undefined":c(o))!=="object"||typeof o.length!="number")return!1;for(var l=0;l<o.length;l++)if(!a(o[l],i))return!1;return!0},D.jws.JWS.inArray=function(o,i){if(i===null||(i===void 0?"undefined":c(i))!=="object"||typeof i.length!="number")return!1;for(var a=0;a<i.length;a++)if(i[a]==o)return!0;return!1},D.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},D.jws.JWS.isSafeJSONString=function(o,i,a){var l=null;try{return((l=ni(o))===void 0?"undefined":c(l))!="object"||l.constructor===Array?0:(i&&(i[a]=l),1)}catch{return 0}},D.jws.JWS.readSafeJSONString=function(o){var i=null;try{return((i=ni(o))===void 0?"undefined":c(i))!="object"||i.constructor===Array?null:i}catch{return null}},D.jws.JWS.getEncodedSignatureValueFromJWS=function(o){var i=o.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(i==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return i[1]},D.jws.JWS.getJWKthumbprint=function(o){if(o.kty!=="RSA"&&o.kty!=="EC"&&o.kty!=="oct")throw"unsupported algorithm for JWK Thumprint";var i="{";if(o.kty==="RSA"){if(typeof o.n!="string"||typeof o.e!="string")throw"wrong n and e value for RSA key";i+='"e":"'+o.e+'",',i+='"kty":"'+o.kty+'",',i+='"n":"'+o.n+'"}'}else if(o.kty==="EC"){if(typeof o.crv!="string"||typeof o.x!="string"||typeof o.y!="string")throw"wrong crv, x and y value for EC key";i+='"crv":"'+o.crv+'",',i+='"kty":"'+o.kty+'",',i+='"x":"'+o.x+'",',i+='"y":"'+o.y+'"}'}else if(o.kty==="oct"){if(typeof o.k!="string")throw"wrong k value for oct(symmetric) key";i+='"kty":"'+o.kty+'",',i+='"k":"'+o.k+'"}'}var a=nn(i);return Qe(D.crypto.Util.hashHex(a,"sha256"))},D.jws.IntDate={},D.jws.IntDate.get=function(o){var i=D.jws.IntDate,a=i.getNow,l=i.getZulu;if(o=="now")return a();if(o=="now + 1hour")return a()+3600;if(o=="now + 1day")return a()+86400;if(o=="now + 1month")return a()+2592e3;if(o=="now + 1year")return a()+31536e3;if(o.match(/Z$/))return l(o);if(o.match(/^[0-9]+$/))return parseInt(o);throw"unsupported format: "+o},D.jws.IntDate.getZulu=function(o){return Bs(o)},D.jws.IntDate.getNow=function(){return~~(new Date/1e3)},D.jws.IntDate.intDate2UTCString=function(o){return new Date(1e3*o).toUTCString()},D.jws.IntDate.intDate2Zulu=function(o){var i=new Date(1e3*o);return("0000"+i.getUTCFullYear()).slice(-4)+("00"+(i.getUTCMonth()+1)).slice(-2)+("00"+i.getUTCDate()).slice(-2)+("00"+i.getUTCHours()).slice(-2)+("00"+i.getUTCMinutes()).slice(-2)+("00"+i.getUTCSeconds()).slice(-2)+"Z"},r.SecureRandom=lt,r.rng_seed_time=se,r.BigInteger=M,r.RSAKey=ye;var Nl=D.crypto.EDSA;r.EDSA=Nl;var Ul=D.crypto.DSA;r.DSA=Ul;var xl=D.crypto.Signature;r.Signature=xl;var Dl=D.crypto.MessageDigest;r.MessageDigest=Dl;var Ll=D.crypto.Mac;r.Mac=Ll;var Ml=D.crypto.Cipher;r.Cipher=Ml,r.KEYUTIL=tt,r.ASN1HEX=he,r.X509=nt,r.CryptoJS=O,r.b64tohex=K,r.b64toBA=X,r.stoBA=ri,r.BAtos=oe,r.BAtohex=ae,r.stohex=de,r.stob64=function(i){return U(de(i))},r.stob64u=function(i){return He(U(de(i)))},r.b64utos=function(i){return oe(X(st(i)))},r.b64tob64u=He,r.b64utob64=st,r.hex2b64=U,r.hextob64u=Qe,r.b64utohex=Ke,r.utf8tob64u=Dn,r.b64utoutf8=xt,r.utf8tob64=function(i){return U(ii(si(i)))},r.b64toutf8=function(i){return decodeURIComponent(oi(K(i)))},r.utf8tohex=Gi,r.hextoutf8=pt,r.hextorstr=Dt,r.rstrtohex=nn,r.hextob64=Ls,r.hextob64nl=Ms,r.b64nltohex=js,r.hextopem=Rt,r.pemtohex=rn,r.hextoArrayBuffer=function(i){if(i.length%2!=0)throw"input is not even length";if(i.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var a=new ArrayBuffer(i.length/2),l=new DataView(a),v=0;v<i.length/2;v++)l.setUint8(v,parseInt(i.substr(2*v,2),16));return a},r.ArrayBuffertohex=function(i){for(var a="",l=new DataView(i),v=0;v<i.byteLength;v++)a+=("00"+l.getUint8(v).toString(16)).slice(-2);return a},r.zulutomsec=Qi,r.zulutosec=Bs,r.zulutodate=function(i){return new Date(Qi(i))},r.datetozulu=function(i,a,l){var v,y=i.getUTCFullYear();if(a){if(y<1950||2049<y)throw"not proper year for UTCTime: "+y;v=(""+y).slice(-2)}else v=("000"+y).slice(-4);if(v+=("0"+(i.getUTCMonth()+1)).slice(-2),v+=("0"+i.getUTCDate()).slice(-2),v+=("0"+i.getUTCHours()).slice(-2),v+=("0"+i.getUTCMinutes()).slice(-2),v+=("0"+i.getUTCSeconds()).slice(-2),l){var P=i.getUTCMilliseconds();P!==0&&(v+="."+(P=(P=("00"+P).slice(-3)).replace(/0+$/g,"")))}return v+="Z"},r.uricmptohex=ii,r.hextouricmp=oi,r.ipv6tohex=Hs,r.hextoipv6=Ks,r.hextoip=Xi,r.iptohex=function(i){var a="malformed IP address";if(!(i=i.toLowerCase(i)).match(/^[0-9.]+$/)){if(i.match(/^[0-9a-f:]+$/)&&i.indexOf(":")!==-1)return Hs(i);throw a}var l=i.split(".");if(l.length!==4)throw a;var v="";try{for(var y=0;y<4;y++)v+=("0"+parseInt(l[y]).toString(16)).slice(-2);return v}catch{throw a}},r.encodeURIComponentAll=si,r.newline_toUnix=function(i){return i=i.replace(/\r\n/gm,`
97
- `)},r.newline_toDos=function(i){return i=(i=i.replace(/\r\n/gm,`
98
- `)).replace(/\n/gm,`\r
99
- `)},r.hextoposhex=Zi,r.intarystrtohex=function(i){i=(i=(i=i.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return i.split(/,/).map(function(a,l,v){var y=parseInt(a);if(y<0||255<y)throw"integer not in range 0-255";return("00"+y.toString(16)).slice(-2)}).join("")}catch(a){throw"malformed integer array string: "+a}},r.strdiffidx=function(i,a){var l=i.length;i.length>a.length&&(l=a.length);for(var v=0;v<l;v++)if(i.charCodeAt(v)!=a.charCodeAt(v))return v;return i.length!=a.length?l:-1},r.KJUR=D;var jl=D.crypto;r.crypto=jl;var Bl=D.asn1;r.asn1=Bl;var Hl=D.jws;r.jws=Hl;var Kl=D.lang;r.lang=Kl}).call(this,s(28).Buffer)},function(n,r,s){(function(u){/*!
100
- * The buffer module from node.js, for the browser.
101
- *
102
- * @author Feross Aboukhadijeh <http://feross.org>
103
- * @license MIT
104
- */var c=s(30),g=s(31),p=s(32);function h(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function d(Y,_){if(h()<_)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(Y=new Uint8Array(_)).__proto__=f.prototype:(Y===null&&(Y=new f(_)),Y.length=_),Y}function f(Y,_,S){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(Y,_,S);if(typeof Y=="number"){if(typeof _=="string")throw new Error("If encoding is specified then the first argument must be a string");return w(this,Y)}return m(this,Y,_,S)}function m(Y,_,S,z){if(typeof _=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&_ instanceof ArrayBuffer?function(Z,se,ge,we){if(se.byteLength,ge<0||se.byteLength<ge)throw new RangeError("'offset' is out of bounds");if(se.byteLength<ge+(we||0))throw new RangeError("'length' is out of bounds");return se=ge===void 0&&we===void 0?new Uint8Array(se):we===void 0?new Uint8Array(se,ge):new Uint8Array(se,ge,we),f.TYPED_ARRAY_SUPPORT?(Z=se).__proto__=f.prototype:Z=C(Z,se),Z}(Y,_,S,z):typeof _=="string"?function(Z,se,ge){if(typeof ge=="string"&&ge!==""||(ge="utf8"),!f.isEncoding(ge))throw new TypeError('"encoding" must be a valid string encoding');var we=0|R(se,ge),Re=(Z=d(Z,we)).write(se,ge);return Re!==we&&(Z=Z.slice(0,Re)),Z}(Y,_,S):function(Z,se){if(f.isBuffer(se)){var ge=0|I(se.length);return(Z=d(Z,ge)).length===0||se.copy(Z,0,0,ge),Z}if(se){if(typeof ArrayBuffer<"u"&&se.buffer instanceof ArrayBuffer||"length"in se)return typeof se.length!="number"||function(Re){return Re!=Re}(se.length)?d(Z,0):C(Z,se);if(se.type==="Buffer"&&p(se.data))return C(Z,se.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(Y,_)}function b(Y){if(typeof Y!="number")throw new TypeError('"size" argument must be a number');if(Y<0)throw new RangeError('"size" argument must not be negative')}function w(Y,_){if(b(_),Y=d(Y,_<0?0:0|I(_)),!f.TYPED_ARRAY_SUPPORT)for(var S=0;S<_;++S)Y[S]=0;return Y}function C(Y,_){var S=_.length<0?0:0|I(_.length);Y=d(Y,S);for(var z=0;z<S;z+=1)Y[z]=255&_[z];return Y}function I(Y){if(Y>=h())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h().toString(16)+" bytes");return 0|Y}function R(Y,_){if(f.isBuffer(Y))return Y.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(Y)||Y instanceof ArrayBuffer))return Y.byteLength;typeof Y!="string"&&(Y=""+Y);var S=Y.length;if(S===0)return 0;for(var z=!1;;)switch(_){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":case void 0:return ot(Y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*S;case"hex":return S>>>1;case"base64":return bt(Y).length;default:if(z)return ot(Y).length;_=(""+_).toLowerCase(),z=!0}}function F(Y,_,S){var z=!1;if((_===void 0||_<0)&&(_=0),_>this.length||((S===void 0||S>this.length)&&(S=this.length),S<=0)||(S>>>=0)<=(_>>>=0))return"";for(Y||(Y="utf8");;)switch(Y){case"hex":return Oe(this,_,S);case"utf8":case"utf-8":return fe(this,_,S);case"ascii":return Se(this,_,S);case"latin1":case"binary":return Ce(this,_,S);case"base64":return ue(this,_,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qe(this,_,S);default:if(z)throw new TypeError("Unknown encoding: "+Y);Y=(Y+"").toLowerCase(),z=!0}}function A(Y,_,S){var z=Y[_];Y[_]=Y[S],Y[S]=z}function x(Y,_,S,z,G){if(Y.length===0)return-1;if(typeof S=="string"?(z=S,S=0):S>2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),S=+S,isNaN(S)&&(S=G?0:Y.length-1),S<0&&(S=Y.length+S),S>=Y.length){if(G)return-1;S=Y.length-1}else if(S<0){if(!G)return-1;S=0}if(typeof _=="string"&&(_=f.from(_,z)),f.isBuffer(_))return _.length===0?-1:O(Y,_,S,z,G);if(typeof _=="number")return _&=255,f.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?G?Uint8Array.prototype.indexOf.call(Y,_,S):Uint8Array.prototype.lastIndexOf.call(Y,_,S):O(Y,[_],S,z,G);throw new TypeError("val must be string, number or Buffer")}function O(Y,_,S,z,G){var Z,se=1,ge=Y.length,we=_.length;if(z!==void 0&&((z=String(z).toLowerCase())==="ucs2"||z==="ucs-2"||z==="utf16le"||z==="utf-16le")){if(Y.length<2||_.length<2)return-1;se=2,ge/=2,we/=2,S/=2}function Re(St,Ut){return se===1?St[Ut]:St.readUInt16BE(Ut*se)}if(G){var Pe=-1;for(Z=S;Z<ge;Z++)if(Re(Y,Z)===Re(_,Pe===-1?0:Z-Pe)){if(Pe===-1&&(Pe=Z),Z-Pe+1===we)return Pe*se}else Pe!==-1&&(Z-=Z-Pe),Pe=-1}else for(S+we>ge&&(S=ge-we),Z=S;Z>=0;Z--){for(var $e=!0,lt=0;lt<we;lt++)if(Re(Y,Z+lt)!==Re(_,lt)){$e=!1;break}if($e)return Z}return-1}function N(Y,_,S,z){S=Number(S)||0;var G=Y.length-S;z?(z=Number(z))>G&&(z=G):z=G;var Z=_.length;if(Z%2!=0)throw new TypeError("Invalid hex string");z>Z/2&&(z=Z/2);for(var se=0;se<z;++se){var ge=parseInt(_.substr(2*se,2),16);if(isNaN(ge))return se;Y[S+se]=ge}return se}function E(Y,_,S,z){return dt(ot(_,Y.length-S),Y,S,z)}function U(Y,_,S,z){return dt(function(Z){for(var se=[],ge=0;ge<Z.length;++ge)se.push(255&Z.charCodeAt(ge));return se}(_),Y,S,z)}function K(Y,_,S,z){return U(Y,_,S,z)}function X(Y,_,S,z){return dt(bt(_),Y,S,z)}function M(Y,_,S,z){return dt(function(Z,se){for(var ge,we,Re,Pe=[],$e=0;$e<Z.length&&!((se-=2)<0);++$e)we=(ge=Z.charCodeAt($e))>>8,Re=ge%256,Pe.push(Re),Pe.push(we);return Pe}(_,Y.length-S),Y,S,z)}function ue(Y,_,S){return _===0&&S===Y.length?c.fromByteArray(Y):c.fromByteArray(Y.slice(_,S))}function fe(Y,_,S){S=Math.min(Y.length,S);for(var z=[],G=_;G<S;){var Z,se,ge,we,Re=Y[G],Pe=null,$e=Re>239?4:Re>223?3:Re>191?2:1;if(G+$e<=S)switch($e){case 1:Re<128&&(Pe=Re);break;case 2:(192&(Z=Y[G+1]))==128&&(we=(31&Re)<<6|63&Z)>127&&(Pe=we);break;case 3:Z=Y[G+1],se=Y[G+2],(192&Z)==128&&(192&se)==128&&(we=(15&Re)<<12|(63&Z)<<6|63&se)>2047&&(we<55296||we>57343)&&(Pe=we);break;case 4:Z=Y[G+1],se=Y[G+2],ge=Y[G+3],(192&Z)==128&&(192&se)==128&&(192&ge)==128&&(we=(15&Re)<<18|(63&Z)<<12|(63&se)<<6|63&ge)>65535&&we<1114112&&(Pe=we)}Pe===null?(Pe=65533,$e=1):Pe>65535&&(Pe-=65536,z.push(Pe>>>10&1023|55296),Pe=56320|1023&Pe),z.push(Pe),G+=$e}return function(St){var Ut=St.length;if(Ut<=be)return String.fromCharCode.apply(String,St);for(var ye="",Le=0;Le<Ut;)ye+=String.fromCharCode.apply(String,St.slice(Le,Le+=be));return ye}(z)}r.Buffer=f,r.SlowBuffer=function(_){return+_!=_&&(_=0),f.alloc(+_)},r.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=u.TYPED_ARRAY_SUPPORT!==void 0?u.TYPED_ARRAY_SUPPORT:function(){try{var _=new Uint8Array(1);return _.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},_.foo()===42&&typeof _.subarray=="function"&&_.subarray(1,1).byteLength===0}catch{return!1}}(),r.kMaxLength=h(),f.poolSize=8192,f._augment=function(Y){return Y.__proto__=f.prototype,Y},f.from=function(Y,_,S){return m(null,Y,_,S)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(Y,_,S){return function(G,Z,se,ge){return b(Z),Z<=0?d(G,Z):se!==void 0?typeof ge=="string"?d(G,Z).fill(se,ge):d(G,Z).fill(se):d(G,Z)}(null,Y,_,S)},f.allocUnsafe=function(Y){return w(null,Y)},f.allocUnsafeSlow=function(Y){return w(null,Y)},f.isBuffer=function(_){return!(_==null||!_._isBuffer)},f.compare=function(_,S){if(!f.isBuffer(_)||!f.isBuffer(S))throw new TypeError("Arguments must be Buffers");if(_===S)return 0;for(var z=_.length,G=S.length,Z=0,se=Math.min(z,G);Z<se;++Z)if(_[Z]!==S[Z]){z=_[Z],G=S[Z];break}return z<G?-1:G<z?1:0},f.isEncoding=function(_){switch(String(_).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(_,S){if(!p(_))throw new TypeError('"list" argument must be an Array of Buffers');if(_.length===0)return f.alloc(0);var z;if(S===void 0)for(S=0,z=0;z<_.length;++z)S+=_[z].length;var G=f.allocUnsafe(S),Z=0;for(z=0;z<_.length;++z){var se=_[z];if(!f.isBuffer(se))throw new TypeError('"list" argument must be an Array of Buffers');se.copy(G,Z),Z+=se.length}return G},f.byteLength=R,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var _=this.length;if(_%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var S=0;S<_;S+=2)A(this,S,S+1);return this},f.prototype.swap32=function(){var _=this.length;if(_%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var S=0;S<_;S+=4)A(this,S,S+3),A(this,S+1,S+2);return this},f.prototype.swap64=function(){var _=this.length;if(_%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var S=0;S<_;S+=8)A(this,S,S+7),A(this,S+1,S+6),A(this,S+2,S+5),A(this,S+3,S+4);return this},f.prototype.toString=function(){var _=0|this.length;return _===0?"":arguments.length===0?fe(this,0,_):F.apply(this,arguments)},f.prototype.equals=function(_){if(!f.isBuffer(_))throw new TypeError("Argument must be a Buffer");return this===_||f.compare(this,_)===0},f.prototype.inspect=function(){var _="",S=r.INSPECT_MAX_BYTES;return this.length>0&&(_=this.toString("hex",0,S).match(/.{2}/g).join(" "),this.length>S&&(_+=" ... ")),"<Buffer "+_+">"},f.prototype.compare=function(_,S,z,G,Z){if(!f.isBuffer(_))throw new TypeError("Argument must be a Buffer");if(S===void 0&&(S=0),z===void 0&&(z=_?_.length:0),G===void 0&&(G=0),Z===void 0&&(Z=this.length),S<0||z>_.length||G<0||Z>this.length)throw new RangeError("out of range index");if(G>=Z&&S>=z)return 0;if(G>=Z)return-1;if(S>=z)return 1;if(this===_)return 0;for(var se=(Z>>>=0)-(G>>>=0),ge=(z>>>=0)-(S>>>=0),we=Math.min(se,ge),Re=this.slice(G,Z),Pe=_.slice(S,z),$e=0;$e<we;++$e)if(Re[$e]!==Pe[$e]){se=Re[$e],ge=Pe[$e];break}return se<ge?-1:ge<se?1:0},f.prototype.includes=function(_,S,z){return this.indexOf(_,S,z)!==-1},f.prototype.indexOf=function(_,S,z){return x(this,_,S,z,!0)},f.prototype.lastIndexOf=function(_,S,z){return x(this,_,S,z,!1)},f.prototype.write=function(_,S,z,G){if(S===void 0)G="utf8",z=this.length,S=0;else if(z===void 0&&typeof S=="string")G=S,z=this.length,S=0;else{if(!isFinite(S))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");S|=0,isFinite(z)?(z|=0,G===void 0&&(G="utf8")):(G=z,z=void 0)}var Z=this.length-S;if((z===void 0||z>Z)&&(z=Z),_.length>0&&(z<0||S<0)||S>this.length)throw new RangeError("Attempt to write outside buffer bounds");G||(G="utf8");for(var se=!1;;)switch(G){case"hex":return N(this,_,S,z);case"utf8":case"utf-8":return E(this,_,S,z);case"ascii":return U(this,_,S,z);case"latin1":case"binary":return K(this,_,S,z);case"base64":return X(this,_,S,z);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,_,S,z);default:if(se)throw new TypeError("Unknown encoding: "+G);G=(""+G).toLowerCase(),se=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var be=4096;function Se(Y,_,S){var z="";S=Math.min(Y.length,S);for(var G=_;G<S;++G)z+=String.fromCharCode(127&Y[G]);return z}function Ce(Y,_,S){var z="";S=Math.min(Y.length,S);for(var G=_;G<S;++G)z+=String.fromCharCode(Y[G]);return z}function Oe(Y,_,S){var z=Y.length;(!_||_<0)&&(_=0),(!S||S<0||S>z)&&(S=z);for(var G="",Z=_;Z<S;++Z)G+=Tt(Y[Z]);return G}function qe(Y,_,S){for(var z=Y.slice(_,S),G="",Z=0;Z<z.length;Z+=2)G+=String.fromCharCode(z[Z]+256*z[Z+1]);return G}function Fe(Y,_,S){if(Y%1!=0||Y<0)throw new RangeError("offset is not uint");if(Y+_>S)throw new RangeError("Trying to access beyond buffer length")}function Ee(Y,_,S,z,G,Z){if(!f.isBuffer(Y))throw new TypeError('"buffer" argument must be a Buffer instance');if(_>G||_<Z)throw new RangeError('"value" argument is out of bounds');if(S+z>Y.length)throw new RangeError("Index out of range")}function Te(Y,_,S,z){_<0&&(_=65535+_+1);for(var G=0,Z=Math.min(Y.length-S,2);G<Z;++G)Y[S+G]=(_&255<<8*(z?G:1-G))>>>8*(z?G:1-G)}function ct(Y,_,S,z){_<0&&(_=4294967295+_+1);for(var G=0,Z=Math.min(Y.length-S,4);G<Z;++G)Y[S+G]=_>>>8*(z?G:3-G)&255}function De(Y,_,S,z,G,Z){if(S+z>Y.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function _t(Y,_,S,z,G){return G||De(Y,0,S,4),g.write(Y,_,S,z,23,4),S+4}function Pt(Y,_,S,z,G){return G||De(Y,0,S,8),g.write(Y,_,S,z,52,8),S+8}f.prototype.slice=function(_,S){var z,G=this.length;if((_=~~_)<0?(_+=G)<0&&(_=0):_>G&&(_=G),(S=S===void 0?G:~~S)<0?(S+=G)<0&&(S=0):S>G&&(S=G),S<_&&(S=_),f.TYPED_ARRAY_SUPPORT)(z=this.subarray(_,S)).__proto__=f.prototype;else{var Z=S-_;z=new f(Z,void 0);for(var se=0;se<Z;++se)z[se]=this[se+_]}return z},f.prototype.readUIntLE=function(_,S,z){_|=0,S|=0,z||Fe(_,S,this.length);for(var G=this[_],Z=1,se=0;++se<S&&(Z*=256);)G+=this[_+se]*Z;return G},f.prototype.readUIntBE=function(_,S,z){_|=0,S|=0,z||Fe(_,S,this.length);for(var G=this[_+--S],Z=1;S>0&&(Z*=256);)G+=this[_+--S]*Z;return G},f.prototype.readUInt8=function(_,S){return S||Fe(_,1,this.length),this[_]},f.prototype.readUInt16LE=function(_,S){return S||Fe(_,2,this.length),this[_]|this[_+1]<<8},f.prototype.readUInt16BE=function(_,S){return S||Fe(_,2,this.length),this[_]<<8|this[_+1]},f.prototype.readUInt32LE=function(_,S){return S||Fe(_,4,this.length),(this[_]|this[_+1]<<8|this[_+2]<<16)+16777216*this[_+3]},f.prototype.readUInt32BE=function(_,S){return S||Fe(_,4,this.length),16777216*this[_]+(this[_+1]<<16|this[_+2]<<8|this[_+3])},f.prototype.readIntLE=function(_,S,z){_|=0,S|=0,z||Fe(_,S,this.length);for(var G=this[_],Z=1,se=0;++se<S&&(Z*=256);)G+=this[_+se]*Z;return G>=(Z*=128)&&(G-=Math.pow(2,8*S)),G},f.prototype.readIntBE=function(_,S,z){_|=0,S|=0,z||Fe(_,S,this.length);for(var G=S,Z=1,se=this[_+--G];G>0&&(Z*=256);)se+=this[_+--G]*Z;return se>=(Z*=128)&&(se-=Math.pow(2,8*S)),se},f.prototype.readInt8=function(_,S){return S||Fe(_,1,this.length),128&this[_]?-1*(255-this[_]+1):this[_]},f.prototype.readInt16LE=function(_,S){S||Fe(_,2,this.length);var z=this[_]|this[_+1]<<8;return 32768&z?4294901760|z:z},f.prototype.readInt16BE=function(_,S){S||Fe(_,2,this.length);var z=this[_+1]|this[_]<<8;return 32768&z?4294901760|z:z},f.prototype.readInt32LE=function(_,S){return S||Fe(_,4,this.length),this[_]|this[_+1]<<8|this[_+2]<<16|this[_+3]<<24},f.prototype.readInt32BE=function(_,S){return S||Fe(_,4,this.length),this[_]<<24|this[_+1]<<16|this[_+2]<<8|this[_+3]},f.prototype.readFloatLE=function(_,S){return S||Fe(_,4,this.length),g.read(this,_,!0,23,4)},f.prototype.readFloatBE=function(_,S){return S||Fe(_,4,this.length),g.read(this,_,!1,23,4)},f.prototype.readDoubleLE=function(_,S){return S||Fe(_,8,this.length),g.read(this,_,!0,52,8)},f.prototype.readDoubleBE=function(_,S){return S||Fe(_,8,this.length),g.read(this,_,!1,52,8)},f.prototype.writeUIntLE=function(_,S,z,G){_=+_,S|=0,z|=0,G||Ee(this,_,S,z,Math.pow(2,8*z)-1,0);var Z=1,se=0;for(this[S]=255&_;++se<z&&(Z*=256);)this[S+se]=_/Z&255;return S+z},f.prototype.writeUIntBE=function(_,S,z,G){_=+_,S|=0,z|=0,G||Ee(this,_,S,z,Math.pow(2,8*z)-1,0);var Z=z-1,se=1;for(this[S+Z]=255&_;--Z>=0&&(se*=256);)this[S+Z]=_/se&255;return S+z},f.prototype.writeUInt8=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,1,255,0),f.TYPED_ARRAY_SUPPORT||(_=Math.floor(_)),this[S]=255&_,S+1},f.prototype.writeUInt16LE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[S]=255&_,this[S+1]=_>>>8):Te(this,_,S,!0),S+2},f.prototype.writeUInt16BE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[S]=_>>>8,this[S+1]=255&_):Te(this,_,S,!1),S+2},f.prototype.writeUInt32LE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[S+3]=_>>>24,this[S+2]=_>>>16,this[S+1]=_>>>8,this[S]=255&_):ct(this,_,S,!0),S+4},f.prototype.writeUInt32BE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[S]=_>>>24,this[S+1]=_>>>16,this[S+2]=_>>>8,this[S+3]=255&_):ct(this,_,S,!1),S+4},f.prototype.writeIntLE=function(_,S,z,G){if(_=+_,S|=0,!G){var Z=Math.pow(2,8*z-1);Ee(this,_,S,z,Z-1,-Z)}var se=0,ge=1,we=0;for(this[S]=255&_;++se<z&&(ge*=256);)_<0&&we===0&&this[S+se-1]!==0&&(we=1),this[S+se]=(_/ge>>0)-we&255;return S+z},f.prototype.writeIntBE=function(_,S,z,G){if(_=+_,S|=0,!G){var Z=Math.pow(2,8*z-1);Ee(this,_,S,z,Z-1,-Z)}var se=z-1,ge=1,we=0;for(this[S+se]=255&_;--se>=0&&(ge*=256);)_<0&&we===0&&this[S+se+1]!==0&&(we=1),this[S+se]=(_/ge>>0)-we&255;return S+z},f.prototype.writeInt8=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,1,127,-128),f.TYPED_ARRAY_SUPPORT||(_=Math.floor(_)),_<0&&(_=255+_+1),this[S]=255&_,S+1},f.prototype.writeInt16LE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[S]=255&_,this[S+1]=_>>>8):Te(this,_,S,!0),S+2},f.prototype.writeInt16BE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[S]=_>>>8,this[S+1]=255&_):Te(this,_,S,!1),S+2},f.prototype.writeInt32LE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[S]=255&_,this[S+1]=_>>>8,this[S+2]=_>>>16,this[S+3]=_>>>24):ct(this,_,S,!0),S+4},f.prototype.writeInt32BE=function(_,S,z){return _=+_,S|=0,z||Ee(this,_,S,4,2147483647,-2147483648),_<0&&(_=4294967295+_+1),f.TYPED_ARRAY_SUPPORT?(this[S]=_>>>24,this[S+1]=_>>>16,this[S+2]=_>>>8,this[S+3]=255&_):ct(this,_,S,!1),S+4},f.prototype.writeFloatLE=function(_,S,z){return _t(this,_,S,!0,z)},f.prototype.writeFloatBE=function(_,S,z){return _t(this,_,S,!1,z)},f.prototype.writeDoubleLE=function(_,S,z){return Pt(this,_,S,!0,z)},f.prototype.writeDoubleBE=function(_,S,z){return Pt(this,_,S,!1,z)},f.prototype.copy=function(_,S,z,G){if(z||(z=0),G||G===0||(G=this.length),S>=_.length&&(S=_.length),S||(S=0),G>0&&G<z&&(G=z),G===z||_.length===0||this.length===0)return 0;if(S<0)throw new RangeError("targetStart out of bounds");if(z<0||z>=this.length)throw new RangeError("sourceStart out of bounds");if(G<0)throw new RangeError("sourceEnd out of bounds");G>this.length&&(G=this.length),_.length-S<G-z&&(G=_.length-S+z);var Z,se=G-z;if(this===_&&z<S&&S<G)for(Z=se-1;Z>=0;--Z)_[Z+S]=this[Z+z];else if(se<1e3||!f.TYPED_ARRAY_SUPPORT)for(Z=0;Z<se;++Z)_[Z+S]=this[Z+z];else Uint8Array.prototype.set.call(_,this.subarray(z,z+se),S);return se},f.prototype.fill=function(_,S,z,G){if(typeof _=="string"){if(typeof S=="string"?(G=S,S=0,z=this.length):typeof z=="string"&&(G=z,z=this.length),_.length===1){var Z=_.charCodeAt(0);Z<256&&(_=Z)}if(G!==void 0&&typeof G!="string")throw new TypeError("encoding must be a string");if(typeof G=="string"&&!f.isEncoding(G))throw new TypeError("Unknown encoding: "+G)}else typeof _=="number"&&(_&=255);if(S<0||this.length<S||this.length<z)throw new RangeError("Out of range index");if(z<=S)return this;var se;if(S>>>=0,z=z===void 0?this.length:z>>>0,_||(_=0),typeof _=="number")for(se=S;se<z;++se)this[se]=_;else{var ge=f.isBuffer(_)?_:ot(new f(_,G).toString()),we=ge.length;for(se=0;se<z-S;++se)this[se+S]=ge[se%we]}return this};var $t=/[^+\/0-9A-Za-z-_]/g;function Tt(Y){return Y<16?"0"+Y.toString(16):Y.toString(16)}function ot(Y,_){var S;_=_||1/0;for(var z=Y.length,G=null,Z=[],se=0;se<z;++se){if((S=Y.charCodeAt(se))>55295&&S<57344){if(!G){if(S>56319){(_-=3)>-1&&Z.push(239,191,189);continue}if(se+1===z){(_-=3)>-1&&Z.push(239,191,189);continue}G=S;continue}if(S<56320){(_-=3)>-1&&Z.push(239,191,189),G=S;continue}S=65536+(G-55296<<10|S-56320)}else G&&(_-=3)>-1&&Z.push(239,191,189);if(G=null,S<128){if((_-=1)<0)break;Z.push(S)}else if(S<2048){if((_-=2)<0)break;Z.push(S>>6|192,63&S|128)}else if(S<65536){if((_-=3)<0)break;Z.push(S>>12|224,S>>6&63|128,63&S|128)}else{if(!(S<1114112))throw new Error("Invalid code point");if((_-=4)<0)break;Z.push(S>>18|240,S>>12&63|128,S>>6&63|128,63&S|128)}}return Z}function bt(Y){return c.toByteArray(function(S){if((S=function(G){return G.trim?G.trim():G.replace(/^\s+|\s+$/g,"")}(S).replace($t,"")).length<2)return"";for(;S.length%4!=0;)S+="=";return S}(Y))}function dt(Y,_,S,z){for(var G=0;G<z&&!(G+S>=_.length||G>=Y.length);++G)_[G+S]=Y[G];return G}}).call(this,s(29))},function(n,r){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch{typeof window=="object"&&(s=window)}n.exports=s},function(n,r,s){r.byteLength=function(w){var C=f(w),I=C[0],R=C[1];return 3*(I+R)/4-R},r.toByteArray=function(w){var C,I,R=f(w),F=R[0],A=R[1],x=new g(function(U,K,X){return 3*(K+X)/4-X}(0,F,A)),O=0,N=A>0?F-4:F;for(I=0;I<N;I+=4)C=c[w.charCodeAt(I)]<<18|c[w.charCodeAt(I+1)]<<12|c[w.charCodeAt(I+2)]<<6|c[w.charCodeAt(I+3)],x[O++]=C>>16&255,x[O++]=C>>8&255,x[O++]=255&C;return A===2&&(C=c[w.charCodeAt(I)]<<2|c[w.charCodeAt(I+1)]>>4,x[O++]=255&C),A===1&&(C=c[w.charCodeAt(I)]<<10|c[w.charCodeAt(I+1)]<<4|c[w.charCodeAt(I+2)]>>2,x[O++]=C>>8&255,x[O++]=255&C),x},r.fromByteArray=function(w){for(var C,I=w.length,R=I%3,F=[],A=16383,x=0,O=I-R;x<O;x+=A)F.push(m(w,x,x+A>O?O:x+A));return R===1?(C=w[I-1],F.push(u[C>>2]+u[C<<4&63]+"==")):R===2&&(C=(w[I-2]<<8)+w[I-1],F.push(u[C>>10]+u[C>>4&63]+u[C<<2&63]+"=")),F.join("")};for(var u=[],c=[],g=typeof Uint8Array<"u"?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,d=p.length;h<d;++h)u[h]=p[h],c[p.charCodeAt(h)]=h;function f(b){var w=b.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var C=b.indexOf("=");return C===-1&&(C=w),[C,C===w?0:4-C%4]}function m(b,w,C){for(var I,R,F=[],A=w;A<C;A+=3)I=(b[A]<<16&16711680)+(b[A+1]<<8&65280)+(255&b[A+2]),F.push(u[(R=I)>>18&63]+u[R>>12&63]+u[R>>6&63]+u[63&R]);return F.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(n,r){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */r.read=function(s,u,c,g,p){var h,d,f=8*p-g-1,m=(1<<f)-1,b=m>>1,w=-7,C=c?p-1:0,I=c?-1:1,R=s[u+C];for(C+=I,h=R&(1<<-w)-1,R>>=-w,w+=f;w>0;h=256*h+s[u+C],C+=I,w-=8);for(d=h&(1<<-w)-1,h>>=-w,w+=g;w>0;d=256*d+s[u+C],C+=I,w-=8);if(h===0)h=1-b;else{if(h===m)return d?NaN:1/0*(R?-1:1);d+=Math.pow(2,g),h-=b}return(R?-1:1)*d*Math.pow(2,h-g)},r.write=function(s,u,c,g,p,h){var d,f,m,b=8*h-p-1,w=(1<<b)-1,C=w>>1,I=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=g?0:h-1,F=g?1:-1,A=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(f=isNaN(u)?1:0,d=w):(d=Math.floor(Math.log(u)/Math.LN2),u*(m=Math.pow(2,-d))<1&&(d--,m*=2),(u+=d+C>=1?I/m:I*Math.pow(2,1-C))*m>=2&&(d++,m/=2),d+C>=w?(f=0,d=w):d+C>=1?(f=(u*m-1)*Math.pow(2,p),d+=C):(f=u*Math.pow(2,C-1)*Math.pow(2,p),d=0));p>=8;s[c+R]=255&f,R+=F,f/=256,p-=8);for(d=d<<p|f,b+=p;b>0;s[c+R]=255&d,R+=F,d/=256,b-=8);s[c+R-F]|=128*A}},function(n,r){var s={}.toString;n.exports=Array.isArray||function(u){return s.call(u)=="[object Array]"}},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(g){var p=g.jws,h=g.KeyUtil,d=g.X509,f=g.crypto,m=g.hextob64u,b=g.b64tohex,w=g.AllowedSigningAlgs;return function(){function C(){(function(R,F){if(!(R instanceof F))throw new TypeError("Cannot call a class as a function")})(this,C)}return C.parseJwt=function(R){u.Log.debug("JoseUtil.parseJwt");try{var F=p.JWS.parse(R);return{header:F.headerObj,payload:F.payloadObj}}catch(A){u.Log.error(A)}},C.validateJwt=function(R,F,A,x,O,N,E){u.Log.debug("JoseUtil.validateJwt");try{if(F.kty==="RSA")if(F.e&&F.n)F=h.getKey(F);else{if(!F.x5c||!F.x5c.length)return u.Log.error("JoseUtil.validateJwt: RSA key missing key material",F),Promise.reject(new Error("RSA key missing key material"));var U=b(F.x5c[0]);F=d.getPublicKeyFromCertHex(U)}else{if(F.kty!=="EC")return u.Log.error("JoseUtil.validateJwt: Unsupported key type",F&&F.kty),Promise.reject(new Error(F.kty));if(!(F.crv&&F.x&&F.y))return u.Log.error("JoseUtil.validateJwt: EC key missing key material",F),Promise.reject(new Error("EC key missing key material"));F=h.getKey(F)}return C._validateJwt(R,F,A,x,O,N,E)}catch(K){return u.Log.error(K&&K.message||K),Promise.reject("JWT validation failed")}},C.validateJwtAttributes=function(R,F,A,x,O,N){x||(x=0),O||(O=parseInt(Date.now()/1e3));var E=C.parseJwt(R).payload;if(!E.iss)return u.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(E.iss!==F)return u.Log.error("JoseUtil._validateJwt: Invalid issuer in token",E.iss),Promise.reject(new Error("Invalid issuer in token: "+E.iss));if(!E.aud)return u.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(E.aud===A||Array.isArray(E.aud)&&E.aud.indexOf(A)>=0))return u.Log.error("JoseUtil._validateJwt: Invalid audience in token",E.aud),Promise.reject(new Error("Invalid audience in token: "+E.aud));if(E.azp&&E.azp!==A)return u.Log.error("JoseUtil._validateJwt: Invalid azp in token",E.azp),Promise.reject(new Error("Invalid azp in token: "+E.azp));if(!N){var U=O+x,K=O-x;if(!E.iat)return u.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(U<E.iat)return u.Log.error("JoseUtil._validateJwt: iat is in the future",E.iat),Promise.reject(new Error("iat is in the future: "+E.iat));if(E.nbf&&U<E.nbf)return u.Log.error("JoseUtil._validateJwt: nbf is in the future",E.nbf),Promise.reject(new Error("nbf is in the future: "+E.nbf));if(!E.exp)return u.Log.error("JoseUtil._validateJwt: exp was not provided"),Promise.reject(new Error("exp was not provided"));if(E.exp<K)return u.Log.error("JoseUtil._validateJwt: exp is in the past",E.exp),Promise.reject(new Error("exp is in the past:"+E.exp))}return Promise.resolve(E)},C._validateJwt=function(R,F,A,x,O,N,E){return C.validateJwtAttributes(R,A,x,O,N,E).then(function(U){try{return p.JWS.verify(R,F,w)?U:(u.Log.error("JoseUtil._validateJwt: signature validation failed"),Promise.reject(new Error("signature validation failed")))}catch(K){return u.Log.error(K&&K.message||K),Promise.reject(new Error("signature validation failed"))}})},C.hashString=function(R,F){try{return f.Util.hashString(R,F)}catch(A){u.Log.error(A)}},C.hexToBase64Url=function(R){try{return m(R)}catch(F){u.Log.error(F)}},C}()};var u=s(0);n.exports=r.default},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SigninResponse=void 0;var u=function(){function p(h,d){for(var f=0;f<d.length;f++){var m=d[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}return function(h,d,f){return d&&p(h.prototype,d),f&&p(h,f),h}}(),c=s(3);function g(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}r.SigninResponse=function(){function p(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#";g(this,p);var f=c.UrlUtility.parseUrlFragment(h,d);this.error=f.error,this.error_description=f.error_description,this.error_uri=f.error_uri,this.code=f.code,this.state=f.state,this.id_token=f.id_token,this.session_state=f.session_state,this.access_token=f.access_token,this.token_type=f.token_type,this.scope=f.scope,this.profile=void 0,this.expires_in=f.expires_in}return u(p,[{key:"expires_in",get:function(){if(this.expires_at){var d=parseInt(Date.now()/1e3);return this.expires_at-d}},set:function(d){var f=parseInt(d);if(typeof f=="number"&&f>0){var m=parseInt(Date.now()/1e3);this.expires_at=m+f}}},{key:"expired",get:function(){var d=this.expires_in;if(d!==void 0)return d<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SignoutRequest=void 0;var u=s(0),c=s(3),g=s(9);r.SignoutRequest=function p(h){var d=h.url,f=h.id_token_hint,m=h.post_logout_redirect_uri,b=h.data,w=h.extraQueryParams,C=h.request_type;if(function(F,A){if(!(F instanceof A))throw new TypeError("Cannot call a class as a function")}(this,p),!d)throw u.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var I in f&&(d=c.UrlUtility.addQueryParam(d,"id_token_hint",f)),m&&(d=c.UrlUtility.addQueryParam(d,"post_logout_redirect_uri",m),b&&(this.state=new g.State({data:b,request_type:C}),d=c.UrlUtility.addQueryParam(d,"state",this.state.id))),w)d=c.UrlUtility.addQueryParam(d,I,w[I]);this.url=d}},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SignoutResponse=void 0;var u=s(3);r.SignoutResponse=function c(g){(function(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")})(this,c);var p=u.UrlUtility.parseUrlFragment(g,"?");this.error=p.error,this.error_description=p.error_description,this.error_uri=p.error_uri,this.state=p.state}},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.InMemoryWebStorage=void 0;var u=function(){function g(p,h){for(var d=0;d<h.length;d++){var f=h[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,h,d){return h&&g(p.prototype,h),d&&g(p,d),p}}(),c=s(0);r.InMemoryWebStorage=function(){function g(){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,g),this._data={}}return g.prototype.getItem=function(h){return c.Log.debug("InMemoryWebStorage.getItem",h),this._data[h]},g.prototype.setItem=function(h,d){c.Log.debug("InMemoryWebStorage.setItem",h),this._data[h]=d},g.prototype.removeItem=function(h){c.Log.debug("InMemoryWebStorage.removeItem",h),delete this._data[h]},g.prototype.key=function(h){return Object.getOwnPropertyNames(this._data)[h]},u(g,[{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}}]),g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.UserManager=void 0;var u=function(){function A(x,O){for(var N=0;N<O.length;N++){var E=O[N];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(x,E.key,E)}}return function(x,O,N){return O&&A(x.prototype,O),N&&A(x,N),x}}(),c=s(0),g=s(10),p=s(39),h=s(15),d=s(45),f=s(47),m=s(18),b=s(8),w=s(20),C=s(11),I=s(4);function R(A,x){if(!(A instanceof x))throw new TypeError("Cannot call a class as a function")}function F(A,x){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!x||typeof x!="object"&&typeof x!="function"?A:x}r.UserManager=function(A){function x(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.SilentRenewService,E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.SessionMonitor,U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:w.TokenRevocationClient,K=arguments.length>4&&arguments[4]!==void 0?arguments[4]:C.TokenClient,X=arguments.length>5&&arguments[5]!==void 0?arguments[5]:I.JoseUtil;R(this,x),O instanceof p.UserManagerSettings||(O=new p.UserManagerSettings(O));var M=F(this,A.call(this,O));return M._events=new d.UserManagerEvents(O),M._silentRenewService=new N(M),M.settings.automaticSilentRenew&&(c.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),M.startSilentRenew()),M.settings.monitorSession&&(c.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),M._sessionMonitor=new E(M)),M._tokenRevocationClient=new U(M._settings),M._tokenClient=new K(M._settings),M._joseUtil=X,M}return function(N,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof E);N.prototype=Object.create(E&&E.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),E&&(Object.setPrototypeOf?Object.setPrototypeOf(N,E):N.__proto__=E)}(x,A),x.prototype.getUser=function(){var N=this;return this._loadUser().then(function(E){return E?(c.Log.info("UserManager.getUser: user loaded"),N._events.load(E,!1),E):(c.Log.info("UserManager.getUser: user not found in storage"),null)})},x.prototype.removeUser=function(){var N=this;return this.storeUser(null).then(function(){c.Log.info("UserManager.removeUser: user removed from storage"),N._events.unload()})},x.prototype.signinRedirect=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(N=Object.assign({},N)).request_type="si:r";var E={useReplaceToNavigate:N.useReplaceToNavigate};return this._signinStart(N,this._redirectNavigator,E).then(function(){c.Log.info("UserManager.signinRedirect: successful")})},x.prototype.signinRedirectCallback=function(N){return this._signinEnd(N||this._redirectNavigator.url).then(function(E){return E.profile&&E.profile.sub?c.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",E.profile.sub):c.Log.info("UserManager.signinRedirectCallback: no sub"),E})},x.prototype.signinPopup=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(N=Object.assign({},N)).request_type="si:p";var E=N.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return E?(N.redirect_uri=E,N.display="popup",this._signin(N,this._popupNavigator,{startUrl:E,popupWindowFeatures:N.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:N.popupWindowTarget||this.settings.popupWindowTarget}).then(function(U){return U&&(U.profile&&U.profile.sub?c.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",U.profile.sub):c.Log.info("UserManager.signinPopup: no sub")),U})):(c.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},x.prototype.signinPopupCallback=function(N){return this._signinCallback(N,this._popupNavigator).then(function(E){return E&&(E.profile&&E.profile.sub?c.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",E.profile.sub):c.Log.info("UserManager.signinPopupCallback: no sub")),E}).catch(function(E){c.Log.error(E.message)})},x.prototype.signinSilent=function(){var N=this,E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return E=Object.assign({},E),this._loadUser().then(function(U){return U&&U.refresh_token?(E.refresh_token=U.refresh_token,N._useRefreshToken(E)):(E.request_type="si:s",E.id_token_hint=E.id_token_hint||N.settings.includeIdTokenInSilentRenew&&U&&U.id_token,U&&N._settings.validateSubOnSilentRenew&&(c.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",U.profile.sub),E.current_sub=U.profile.sub),N._signinSilentIframe(E))})},x.prototype._useRefreshToken=function(){var N=this,E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(E).then(function(U){return U?U.access_token?N._loadUser().then(function(K){if(K){var X=Promise.resolve();return U.id_token&&(X=N._validateIdTokenFromTokenRefreshToken(K.profile,U.id_token)),X.then(function(){return c.Log.debug("UserManager._useRefreshToken: refresh token response success"),K.id_token=U.id_token||K.id_token,K.access_token=U.access_token,K.refresh_token=U.refresh_token||K.refresh_token,K.expires_in=U.expires_in,N.storeUser(K).then(function(){return N._events.load(K),K})})}return null}):(c.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(c.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))})},x.prototype._validateIdTokenFromTokenRefreshToken=function(N,E){var U=this;return this._metadataService.getIssuer().then(function(K){return U.settings.getEpochTime().then(function(X){return U._joseUtil.validateJwtAttributes(E,K,U._settings.client_id,U._settings.clockSkew,X).then(function(M){return M?M.sub!==N.sub?(c.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):M.auth_time&&M.auth_time!==N.auth_time?(c.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):M.azp&&M.azp!==N.azp?(c.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!M.azp&&N.azp?(c.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(c.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))})})})},x.prototype._signinSilentIframe=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=N.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return E?(N.redirect_uri=E,N.prompt=N.prompt||"none",this._signin(N,this._iframeNavigator,{startUrl:E,silentRequestTimeout:N.silentRequestTimeout||this.settings.silentRequestTimeout}).then(function(U){return U&&(U.profile&&U.profile.sub?c.Log.info("UserManager.signinSilent: successful, signed in sub: ",U.profile.sub):c.Log.info("UserManager.signinSilent: no sub")),U})):(c.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},x.prototype.signinSilentCallback=function(N){return this._signinCallback(N,this._iframeNavigator).then(function(E){return E&&(E.profile&&E.profile.sub?c.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",E.profile.sub):c.Log.info("UserManager.signinSilentCallback: no sub")),E})},x.prototype.signinCallback=function(N){var E=this;return this.readSigninResponseState(N).then(function(U){var K=U.state;return U.response,K.request_type==="si:r"?E.signinRedirectCallback(N):K.request_type==="si:p"?E.signinPopupCallback(N):K.request_type==="si:s"?E.signinSilentCallback(N):Promise.reject(new Error("invalid response_type in state"))})},x.prototype.signoutCallback=function(N,E){var U=this;return this.readSignoutResponseState(N).then(function(K){var X=K.state,M=K.response;return X?X.request_type==="so:r"?U.signoutRedirectCallback(N):X.request_type==="so:p"?U.signoutPopupCallback(N,E):Promise.reject(new Error("invalid response_type in state")):M})},x.prototype.querySessionStatus=function(){var N=this,E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(E=Object.assign({},E)).request_type="si:s";var U=E.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return U?(E.redirect_uri=U,E.prompt="none",E.response_type=E.response_type||this.settings.query_status_response_type,E.scope=E.scope||"openid",E.skipUserInfo=!0,this._signinStart(E,this._iframeNavigator,{startUrl:U,silentRequestTimeout:E.silentRequestTimeout||this.settings.silentRequestTimeout}).then(function(K){return N.processSigninResponse(K.url).then(function(X){if(c.Log.debug("UserManager.querySessionStatus: got signin response"),X.session_state&&X.profile.sub)return c.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",X.profile.sub),{session_state:X.session_state,sub:X.profile.sub,sid:X.profile.sid};c.Log.info("querySessionStatus successful, user not authenticated")}).catch(function(X){if(X.session_state&&N.settings.monitorAnonymousSession&&(X.message=="login_required"||X.message=="consent_required"||X.message=="interaction_required"||X.message=="account_selection_required"))return c.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:X.session_state};throw X})})):(c.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},x.prototype._signin=function(N,E){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._signinStart(N,E,K).then(function(X){return U._signinEnd(X.url,N)})},x.prototype._signinStart=function(N,E){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return E.prepare(K).then(function(X){return c.Log.debug("UserManager._signinStart: got navigator window handle"),U.createSigninRequest(N).then(function(M){return c.Log.debug("UserManager._signinStart: got signin request"),K.url=M.url,K.id=M.state.id,X.navigate(K)}).catch(function(M){throw X.close&&(c.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),X.close()),M})})},x.prototype._signinEnd=function(N){var E=this,U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.processSigninResponse(N).then(function(K){c.Log.debug("UserManager._signinEnd: got signin response");var X=new h.User(K);if(U.current_sub){if(U.current_sub!==X.profile.sub)return c.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",X.profile.sub),Promise.reject(new Error("login_required"));c.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return E.storeUser(X).then(function(){return c.Log.debug("UserManager._signinEnd: user stored"),E._events.load(X),X})})},x.prototype._signinCallback=function(N,E){c.Log.debug("UserManager._signinCallback");var U=this._settings.response_mode==="query"||!this._settings.response_mode&&b.SigninRequest.isCode(this._settings.response_type)?"?":"#";return E.callback(N,void 0,U)},x.prototype.signoutRedirect=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(N=Object.assign({},N)).request_type="so:r";var E=N.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;E&&(N.post_logout_redirect_uri=E);var U={useReplaceToNavigate:N.useReplaceToNavigate};return this._signoutStart(N,this._redirectNavigator,U).then(function(){c.Log.info("UserManager.signoutRedirect: successful")})},x.prototype.signoutRedirectCallback=function(N){return this._signoutEnd(N||this._redirectNavigator.url).then(function(E){return c.Log.info("UserManager.signoutRedirectCallback: successful"),E})},x.prototype.signoutPopup=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(N=Object.assign({},N)).request_type="so:p";var E=N.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return N.post_logout_redirect_uri=E,N.display="popup",N.post_logout_redirect_uri&&(N.state=N.state||{}),this._signout(N,this._popupNavigator,{startUrl:E,popupWindowFeatures:N.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:N.popupWindowTarget||this.settings.popupWindowTarget}).then(function(){c.Log.info("UserManager.signoutPopup: successful")})},x.prototype.signoutPopupCallback=function(N,E){return E===void 0&&typeof N=="boolean"&&(E=N,N=null),this._popupNavigator.callback(N,E,"?").then(function(){c.Log.info("UserManager.signoutPopupCallback: successful")})},x.prototype._signout=function(N,E){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._signoutStart(N,E,K).then(function(X){return U._signoutEnd(X.url)})},x.prototype._signoutStart=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=this,U=arguments[1],K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return U.prepare(K).then(function(X){return c.Log.debug("UserManager._signoutStart: got navigator window handle"),E._loadUser().then(function(M){return c.Log.debug("UserManager._signoutStart: loaded current user from storage"),(E._settings.revokeAccessTokenOnSignout?E._revokeInternal(M):Promise.resolve()).then(function(){var ue=N.id_token_hint||M&&M.id_token;return ue&&(c.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),N.id_token_hint=ue),E.removeUser().then(function(){return c.Log.debug("UserManager._signoutStart: user removed, creating signout request"),E.createSignoutRequest(N).then(function(fe){return c.Log.debug("UserManager._signoutStart: got signout request"),K.url=fe.url,fe.state&&(K.id=fe.state.id),X.navigate(K)})})})}).catch(function(M){throw X.close&&(c.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),X.close()),M})})},x.prototype._signoutEnd=function(N){return this.processSignoutResponse(N).then(function(E){return c.Log.debug("UserManager._signoutEnd: got signout response"),E})},x.prototype.revokeAccessToken=function(){var N=this;return this._loadUser().then(function(E){return N._revokeInternal(E,!0).then(function(U){if(U)return c.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),E.access_token=null,E.refresh_token=null,E.expires_at=null,E.token_type=null,N.storeUser(E).then(function(){c.Log.debug("UserManager.revokeAccessToken: user stored"),N._events.load(E)})})}).then(function(){c.Log.info("UserManager.revokeAccessToken: access token revoked successfully")})},x.prototype._revokeInternal=function(N,E){var U=this;if(N){var K=N.access_token,X=N.refresh_token;return this._revokeAccessTokenInternal(K,E).then(function(M){return U._revokeRefreshTokenInternal(X,E).then(function(ue){return M||ue||c.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),M||ue})})}return Promise.resolve(!1)},x.prototype._revokeAccessTokenInternal=function(N,E){return!N||N.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(N,E).then(function(){return!0})},x.prototype._revokeRefreshTokenInternal=function(N,E){return N?this._tokenRevocationClient.revoke(N,E,"refresh_token").then(function(){return!0}):Promise.resolve(!1)},x.prototype.startSilentRenew=function(){this._silentRenewService.start()},x.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},x.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then(function(N){return N?(c.Log.debug("UserManager._loadUser: user storageString loaded"),h.User.fromStorageString(N)):(c.Log.debug("UserManager._loadUser: no user storageString"),null)})},x.prototype.storeUser=function(N){if(N){c.Log.debug("UserManager.storeUser: storing user");var E=N.toStorageString();return this._userStore.set(this._userStoreKey,E)}return c.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},u(x,[{key:"_redirectNavigator",get:function(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function(){return this.settings.iframeNavigator}},{key:"_userStore",get:function(){return this.settings.userStore}},{key:"events",get:function(){return this._events}},{key:"_userStoreKey",get:function(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),x}(g.OidcClient)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.UserManagerSettings=void 0;var u=function(){function C(I,R){for(var F=0;F<R.length;F++){var A=R[F];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}return function(I,R,F){return R&&C(I.prototype,R),F&&C(I,F),I}}(),c=(s(0),s(5)),g=s(40),p=s(41),h=s(43),d=s(6),f=s(1),m=s(8);function b(C,I){if(!(C instanceof I))throw new TypeError("Cannot call a class as a function")}function w(C,I){if(!C)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!I||typeof I!="object"&&typeof I!="function"?C:I}r.UserManagerSettings=function(C){function I(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=R.popup_redirect_uri,A=R.popup_post_logout_redirect_uri,x=R.popupWindowFeatures,O=R.popupWindowTarget,N=R.silent_redirect_uri,E=R.silentRequestTimeout,U=R.automaticSilentRenew,K=U!==void 0&&U,X=R.validateSubOnSilentRenew,M=X!==void 0&&X,ue=R.includeIdTokenInSilentRenew,fe=ue===void 0||ue,be=R.monitorSession,Se=be===void 0||be,Ce=R.monitorAnonymousSession,Oe=Ce!==void 0&&Ce,qe=R.checkSessionInterval,Fe=qe===void 0?2e3:qe,Ee=R.stopCheckSessionOnError,Te=Ee===void 0||Ee,ct=R.query_status_response_type,De=R.revokeAccessTokenOnSignout,_t=De!==void 0&&De,Pt=R.accessTokenExpiringNotificationTime,$t=Pt===void 0?60:Pt,Tt=R.redirectNavigator,ot=Tt===void 0?new g.RedirectNavigator:Tt,bt=R.popupNavigator,dt=bt===void 0?new p.PopupNavigator:bt,Y=R.iframeNavigator,_=Y===void 0?new h.IFrameNavigator:Y,S=R.userStore,z=S===void 0?new d.WebStorageStateStore({store:f.Global.sessionStorage}):S;b(this,I);var G=w(this,C.call(this,arguments[0]));return G._popup_redirect_uri=F,G._popup_post_logout_redirect_uri=A,G._popupWindowFeatures=x,G._popupWindowTarget=O,G._silent_redirect_uri=N,G._silentRequestTimeout=E,G._automaticSilentRenew=K,G._validateSubOnSilentRenew=M,G._includeIdTokenInSilentRenew=fe,G._accessTokenExpiringNotificationTime=$t,G._monitorSession=Se,G._monitorAnonymousSession=Oe,G._checkSessionInterval=Fe,G._stopCheckSessionOnError=Te,ct?G._query_status_response_type=ct:arguments[0]&&arguments[0].response_type?G._query_status_response_type=m.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":G._query_status_response_type="id_token",G._revokeAccessTokenOnSignout=_t,G._redirectNavigator=ot,G._popupNavigator=dt,G._iframeNavigator=_,G._userStore=z,G}return function(F,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof A);F.prototype=Object.create(A&&A.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),A&&(Object.setPrototypeOf?Object.setPrototypeOf(F,A):F.__proto__=A)}(I,C),u(I,[{key:"popup_redirect_uri",get:function(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function(){return this._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function(){return this._query_status_response_type}},{key:"revokeAccessTokenOnSignout",get:function(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function(){return this._redirectNavigator}},{key:"popupNavigator",get:function(){return this._popupNavigator}},{key:"iframeNavigator",get:function(){return this._iframeNavigator}},{key:"userStore",get:function(){return this._userStore}}]),I}(c.OidcClientSettings)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.RedirectNavigator=void 0;var u=function(){function g(p,h){for(var d=0;d<h.length;d++){var f=h[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,h,d){return h&&g(p.prototype,h),d&&g(p,d),p}}(),c=s(0);r.RedirectNavigator=function(){function g(){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,g)}return g.prototype.prepare=function(){return Promise.resolve(this)},g.prototype.navigate=function(h){return h&&h.url?(h.useReplaceToNavigate?window.location.replace(h.url):window.location=h.url,Promise.resolve()):(c.Log.error("RedirectNavigator.navigate: No url provided"),Promise.reject(new Error("No url provided")))},u(g,[{key:"url",get:function(){return window.location.href}}]),g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.PopupNavigator=void 0;var u=s(0),c=s(42);r.PopupNavigator=function(){function g(){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,g)}return g.prototype.prepare=function(h){var d=new c.PopupWindow(h);return Promise.resolve(d)},g.prototype.callback=function(h,d,f){u.Log.debug("PopupNavigator.callback");try{return c.PopupWindow.notifyOpener(h,d,f),Promise.resolve()}catch(m){return Promise.reject(m)}},g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.PopupWindow=void 0;var u=function(){function p(h,d){for(var f=0;f<d.length;f++){var m=d[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}return function(h,d,f){return d&&p(h.prototype,d),f&&p(h,f),h}}(),c=s(0),g=s(3);r.PopupWindow=function(){function p(h){var d=this;(function(w,C){if(!(w instanceof C))throw new TypeError("Cannot call a class as a function")})(this,p),this._promise=new Promise(function(b,w){d._resolve=b,d._reject=w});var f=h.popupWindowTarget||"_blank",m=h.popupWindowFeatures||"location=no,toolbar=no,width=500,height=500,left=100,top=100;";this._popup=window.open("",f,m),this._popup&&(c.Log.debug("PopupWindow.ctor: popup successfully created"),this._checkForPopupClosedTimer=window.setInterval(this._checkForPopupClosed.bind(this),500))}return p.prototype.navigate=function(d){return this._popup?d&&d.url?(c.Log.debug("PopupWindow.navigate: Setting URL in popup"),this._id=d.id,this._id&&(window["popupCallback_"+d.id]=this._callback.bind(this)),this._popup.focus(),this._popup.window.location=d.url):(this._error("PopupWindow.navigate: no url provided"),this._error("No url provided")):this._error("PopupWindow.navigate: Error opening popup window"),this.promise},p.prototype._success=function(d){c.Log.debug("PopupWindow.callback: Successful response from popup window"),this._cleanup(),this._resolve(d)},p.prototype._error=function(d){c.Log.error("PopupWindow.error: ",d),this._cleanup(),this._reject(new Error(d))},p.prototype.close=function(){this._cleanup(!1)},p.prototype._cleanup=function(d){c.Log.debug("PopupWindow.cleanup"),window.clearInterval(this._checkForPopupClosedTimer),this._checkForPopupClosedTimer=null,delete window["popupCallback_"+this._id],this._popup&&!d&&this._popup.close(),this._popup=null},p.prototype._checkForPopupClosed=function(){this._popup&&!this._popup.closed||this._error("Popup window closed")},p.prototype._callback=function(d,f){this._cleanup(f),d?(c.Log.debug("PopupWindow.callback success"),this._success({url:d})):(c.Log.debug("PopupWindow.callback: Invalid response from popup"),this._error("Invalid response from popup"))},p.notifyOpener=function(d,f,m){if(window.opener){if(d=d||window.location.href){var b=g.UrlUtility.parseUrlFragment(d,m);if(b.state){var w="popupCallback_"+b.state,C=window.opener[w];C?(c.Log.debug("PopupWindow.notifyOpener: passing url message to opener"),C(d,f)):c.Log.warn("PopupWindow.notifyOpener: no matching callback found on opener")}else c.Log.warn("PopupWindow.notifyOpener: no state found in response url")}}else c.Log.warn("PopupWindow.notifyOpener: no window.opener. Can't complete notification.")},u(p,[{key:"promise",get:function(){return this._promise}}]),p}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.IFrameNavigator=void 0;var u=s(0),c=s(44);r.IFrameNavigator=function(){function g(){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,g)}return g.prototype.prepare=function(h){var d=new c.IFrameWindow(h);return Promise.resolve(d)},g.prototype.callback=function(h){u.Log.debug("IFrameNavigator.callback");try{return c.IFrameWindow.notifyParent(h),Promise.resolve()}catch(d){return Promise.reject(d)}},g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.IFrameWindow=void 0;var u=function(){function g(p,h){for(var d=0;d<h.length;d++){var f=h[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}return function(p,h,d){return h&&g(p.prototype,h),d&&g(p,d),p}}(),c=s(0);r.IFrameWindow=function(){function g(p){var h=this;(function(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")})(this,g),this._promise=new Promise(function(d,f){h._resolve=d,h._reject=f}),this._boundMessageEvent=this._message.bind(this),window.addEventListener("message",this._boundMessageEvent,!1),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.width=0,this._frame.height=0,window.document.body.appendChild(this._frame)}return g.prototype.navigate=function(h){if(h&&h.url){var d=h.silentRequestTimeout||1e4;c.Log.debug("IFrameWindow.navigate: Using timeout of:",d),this._timer=window.setTimeout(this._timeout.bind(this),d),this._frame.src=h.url}else this._error("No url provided");return this.promise},g.prototype._success=function(h){this._cleanup(),c.Log.debug("IFrameWindow: Successful response from frame window"),this._resolve(h)},g.prototype._error=function(h){this._cleanup(),c.Log.error(h),this._reject(new Error(h))},g.prototype.close=function(){this._cleanup()},g.prototype._cleanup=function(){this._frame&&(c.Log.debug("IFrameWindow: cleanup"),window.removeEventListener("message",this._boundMessageEvent,!1),window.clearTimeout(this._timer),window.document.body.removeChild(this._frame),this._timer=null,this._frame=null,this._boundMessageEvent=null)},g.prototype._timeout=function(){c.Log.debug("IFrameWindow.timeout"),this._error("Frame window timed out")},g.prototype._message=function(h){if(c.Log.debug("IFrameWindow.message"),this._timer&&h.origin===this._origin&&h.source===this._frame.contentWindow&&typeof h.data=="string"&&(h.data.startsWith("http://")||h.data.startsWith("https://"))){var d=h.data;d?this._success({url:d}):this._error("Invalid response from frame")}},g.notifyParent=function(h){c.Log.debug("IFrameWindow.notifyParent"),(h=h||window.location.href)&&(c.Log.debug("IFrameWindow.notifyParent: posting url message to parent"),window.parent.postMessage(h,location.protocol+"//"+location.host))},u(g,[{key:"promise",get:function(){return this._promise}},{key:"_origin",get:function(){return location.protocol+"//"+location.host}}]),g}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.UserManagerEvents=void 0;var u=s(0),c=s(16),g=s(17);r.UserManagerEvents=function(p){function h(d){(function(b,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")})(this,h);var f=function(b,w){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!w||typeof w!="object"&&typeof w!="function"?b:w}(this,p.call(this,d));return f._userLoaded=new g.Event("User loaded"),f._userUnloaded=new g.Event("User unloaded"),f._silentRenewError=new g.Event("Silent renew error"),f._userSignedIn=new g.Event("User signed in"),f._userSignedOut=new g.Event("User signed out"),f._userSessionChanged=new g.Event("User session changed"),f}return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}(h,p),h.prototype.load=function(f){var m=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];u.Log.debug("UserManagerEvents.load"),p.prototype.load.call(this,f),m&&this._userLoaded.raise(f)},h.prototype.unload=function(){u.Log.debug("UserManagerEvents.unload"),p.prototype.unload.call(this),this._userUnloaded.raise()},h.prototype.addUserLoaded=function(f){this._userLoaded.addHandler(f)},h.prototype.removeUserLoaded=function(f){this._userLoaded.removeHandler(f)},h.prototype.addUserUnloaded=function(f){this._userUnloaded.addHandler(f)},h.prototype.removeUserUnloaded=function(f){this._userUnloaded.removeHandler(f)},h.prototype.addSilentRenewError=function(f){this._silentRenewError.addHandler(f)},h.prototype.removeSilentRenewError=function(f){this._silentRenewError.removeHandler(f)},h.prototype._raiseSilentRenewError=function(f){u.Log.debug("UserManagerEvents._raiseSilentRenewError",f.message),this._silentRenewError.raise(f)},h.prototype.addUserSignedIn=function(f){this._userSignedIn.addHandler(f)},h.prototype.removeUserSignedIn=function(f){this._userSignedIn.removeHandler(f)},h.prototype._raiseUserSignedIn=function(){u.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},h.prototype.addUserSignedOut=function(f){this._userSignedOut.addHandler(f)},h.prototype.removeUserSignedOut=function(f){this._userSignedOut.removeHandler(f)},h.prototype._raiseUserSignedOut=function(){u.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},h.prototype.addUserSessionChanged=function(f){this._userSessionChanged.addHandler(f)},h.prototype.removeUserSessionChanged=function(f){this._userSessionChanged.removeHandler(f)},h.prototype._raiseUserSessionChanged=function(){u.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},h}(c.AccessTokenEvents)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.Timer=void 0;var u=function(){function f(m,b){for(var w=0;w<b.length;w++){var C=b[w];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(m,C.key,C)}}return function(m,b,w){return b&&f(m.prototype,b),w&&f(m,w),m}}(),c=s(0),g=s(1),p=s(17);function h(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!m||typeof m!="object"&&typeof m!="function"?f:m}r.Timer=function(f){function m(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g.Global.timer,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;h(this,m);var I=d(this,f.call(this,b));return I._timer=w,I._nowFunc=C||function(){return Date.now()/1e3},I}return function(w,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);w.prototype=Object.create(C&&C.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(w,C):w.__proto__=C)}(m,f),m.prototype.init=function(w){w<=0&&(w=1),w=parseInt(w);var C=this.now+w;if(this.expiration===C&&this._timerHandle)c.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),c.Log.debug("Timer.init timer "+this._name+" for duration:",w),this._expiration=C;var I=5;w<I&&(I=w),this._timerHandle=this._timer.setInterval(this._callback.bind(this),1e3*I)}},m.prototype.cancel=function(){this._timerHandle&&(c.Log.debug("Timer.cancel: ",this._name),this._timer.clearInterval(this._timerHandle),this._timerHandle=null)},m.prototype._callback=function(){var w=this._expiration-this.now;c.Log.debug("Timer.callback; "+this._name+" timer expires in:",w),this._expiration<=this.now&&(this.cancel(),f.prototype.raise.call(this))},u(m,[{key:"now",get:function(){return parseInt(this._nowFunc())}},{key:"expiration",get:function(){return this._expiration}}]),m}(p.Event)},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.SilentRenewService=void 0;var u=s(0);r.SilentRenewService=function(){function c(g){(function(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")})(this,c),this._userManager=g}return c.prototype.start=function(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then(function(p){}).catch(function(p){u.Log.error("SilentRenewService.start: Error from getUser:",p.message)}))},c.prototype.stop=function(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},c.prototype._tokenExpiring=function(){var p=this;this._userManager.signinSilent().then(function(h){u.Log.debug("SilentRenewService._tokenExpiring: Silent token renewal successful")},function(h){u.Log.error("SilentRenewService._tokenExpiring: Error from signinSilent:",h.message),p._userManager.events._raiseSilentRenewError(h)})},c}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.CordovaPopupNavigator=void 0;var u=s(21);r.CordovaPopupNavigator=function(){function c(){(function(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")})(this,c)}return c.prototype.prepare=function(p){var h=new u.CordovaPopupWindow(p);return Promise.resolve(h)},c}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.CordovaIFrameNavigator=void 0;var u=s(21);r.CordovaIFrameNavigator=function(){function c(){(function(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")})(this,c)}return c.prototype.prepare=function(p){p.popupWindowFeatures="hidden=yes";var h=new u.CordovaPopupWindow(p);return Promise.resolve(h)},c}()},function(n,r,s){Object.defineProperty(r,"__esModule",{value:!0}),r.Version="1.11.5"}])})})(dl);var Vp=dl.exports;const li=Lc(Vp);class qp{constructor(t){ze(this,"_value",It);this.factory=t}get value(){if($n(this._value))return this._value.value;const t=this.factory();return this._value=Bi(t),t}}var Ja,za,Yt=(e=>(e[e.Unauthorized=0]="Unauthorized",e[e.SignInPending=1]="SignInPending",e[e.Authenticated=2]="Authenticated",e[e.SignOutPending=3]="SignOutPending",e[e.Error=4]="Error",e))(Yt||{});function $p(){return{authStatus:0,jwt:It}}let Wp=(Ja=Ju({name:"authentication",resettable:!0,producerFn:Zc}),Ja(za=class extends ss{constructor(){super($p())}})||za);const Kn=new Wp;var _i=(e=>(e.SignIn="callback",e.SignOut="logout",e.SilentRefresh="silent-refresh",e))(_i||{});class Jp{constructor(){ze(this,"userManager");ze(this,"tokenQueryParameter","token");ze(this,"b2cJwtQueryParameter","b2cJwt");ze(this,"profileIdQueryParameter","profileId");ze(this,"getHostOidcUrl",()=>`${window.location.origin}/benefits/app/#/oidc`);this.userManager=new qp(()=>{const t=new li.UserManager(this.userManagerSettings());return t.events.addAccessTokenExpired(()=>this.signOutRedirectAsync()),t.events.addUserLoaded(this.sessionUpdatedHandler),this.configureLogging(),t})}tokenExists(t){const n=Ni(this.tokenQueryParameter,t);return cr.isSome(n)}b2cJwtExists(t){const n=ho(this.b2cJwtQueryParameter,t);return cr.isSome(n)}isOidcRoute(t){return t.includes("callback")||t.includes("logout")||t.includes("silent-refresh")}async initFromB2cJwt(t,n){const r=Ko(ho(this.b2cJwtQueryParameter,n),`"${this.b2cJwtQueryParameter}" fragment is required`),s=Ko(ho(this.profileIdQueryParameter,n),`"${this.profileIdQueryParameter}" fragment is required`);qr.setParameters(zn.getConfig().workplaceBackendUrl,r,s);const u=await qr.instance.url("token").get().json();window.location.href=t+"?token="+u.token}async initFromToken(t,n){if(this.isOidcRoute(t))return;const r=Ni(this.tokenQueryParameter,n);if(cr.isNone(r))throw Kn.update({authStatus:Yt.Error}),Error(`"${this.tokenQueryParameter}" URL query parameter is required`);await this.signInRedirectAsync(r)}signOutRedirectAsync(){return Kn.update({authStatus:Yt.SignOutPending}),this.userManager.value.signoutRedirect()}async signInRedirectCallbackAsync(){await this.userManager.value.signinRedirectCallback(window.location.href.replace("/oidc/callback?","")),Kn.update({authStatus:Yt.Authenticated})}async signOutRedirectCallbackAsync(){await this.userManager.value.signoutRedirectCallback(),bh()}async silentRefreshCallbackAsync(){await this.userManager.value.signinSilentCallback()}async signOut(){return Kn.update({authStatus:Yt.Unauthorized,jwt:cr.none})}async signInRedirectAsync(t){Kn.update({authStatus:Yt.SignInPending}),await this.userManager.value.signinRedirect({extraQueryParams:{irt:t.value}})}sessionUpdatedHandler(t){Kn.update({jwt:cr.fromNullable(t.access_token)})}userManagerSettings(){return{authority:zn.getConfig().oidcAuthority,client_id:"apollo-benefits-ui",redirect_uri:`${this.getHostOidcUrl()}/callback?`,response_type:"id_token token",scope:"openid",post_logout_redirect_uri:`${this.getHostOidcUrl()}/logout?`,silent_redirect_uri:`${this.getHostOidcUrl()}/silent-refresh?`,automaticSilentRenew:!0,accessTokenExpiringNotificationTime:10,filterProtocolClaims:!0,loadUserInfo:!0,clockSkew:2592e3}}configureLogging(){li.Log.logger=console,li.Log.level=li.Log.DEBUG}}const yn=new Jp,zp=({mode:e})=>{const[t,n]=ht(!1);return Ne(()=>{(async()=>{switch(e){case _i.SignIn:await yn.signInRedirectCallbackAsync(),window.location.hash="#",Qn("/"),Vo.redirectToPathIfExists();break;case _i.SignOut:await yn.signOutRedirectCallbackAsync(),n(!0);break;case _i.SilentRefresh:await yn.silentRefreshCallbackAsync();break}})()},[]),t?le(Rd,{}):le(Ki,{})},Yp=({fragment:e})=>(Ne(()=>{(async()=>await yn.initFromB2cJwt(window.location.pathname,e))()},[]),le(Ki,{}));class Gp extends as{constructor(n){super(n);ze(this,"authState$",this.select());this.store=n}get isUnauthorized(){return this.getValue().authStatus===Yt.Unauthorized||this.getValue().authStatus===Yt.Error}get isAuthorized(){return this.getValue().authStatus===Yt.Authenticated}get jwt(){const n=this.getValue().jwt;return $n(n)?n.value:""}}const pl=new Gp(Kn);var Qp=Object.defineProperty,Xp=(e,t,n)=>t in e?Qp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,go=(e,t,n)=>(Xp(e,typeof t!="symbol"?t+"":t,n),n);let Zp=class{constructor(){go(this,"current",this.detect()),go(this,"handoffState","pending"),go(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Gn=new Zp,qt=(e,t)=>{Gn.isServer?Ne(e,t):nr(e,t)};function Nn(e){let t=Be(e);return qt(()=>{t.current=e},[e]),t}function eg(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function En(){let e=[],t={addEventListener(n,r,s,u){return n.addEventListener(r,s,u),t.add(()=>n.removeEventListener(r,s,u))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return eg(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,s){let u=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:s}),this.add(()=>{Object.assign(n.style,{[r]:u})})},group(n){let r=En();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let s of e.splice(r,1))s()}},dispose(){for(let n of e.splice(0))n()}};return t}function qi(){let[e]=ht(En);return Ne(()=>()=>e.dispose(),[e]),e}let je=function(e){let t=Nn(e);return Ye.useCallback((...n)=>t.current(...n),[t])};function tg(){let e=typeof document>"u";return"useSyncExternalStore"in Pa?(t=>t.useSyncExternalStore)(Pa)(()=>()=>{},()=>!1,()=>!e):!1}function Ps(){let e=tg(),[t,n]=ht(Gn.isHandoffComplete);return t&&Gn.isHandoffComplete===!1&&n(!1),Ne(()=>{t!==!0&&n(!0)},[t]),Ne(()=>Gn.handoff(),[]),e?!1:t}var Ya;let ei=(Ya=Ye.useId)!=null?Ya:function(){let e=Ps(),[t,n]=Ye.useState(e?()=>Gn.nextId():null);return qt(()=>{t===null&&n(Gn.nextId())},[t]),t!=null?""+t:void 0};function At(e,t,...n){if(e in t){let s=t[e];return typeof s=="function"?s(...n):s}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(s=>`"${s}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,At),r}function ti(e){return Gn.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let qo=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var $o=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))($o||{}),ng=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ng||{}),rg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(rg||{});function gl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(qo)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ks=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ks||{});function Cs(e,t=0){var n;return e===((n=ti(e))==null?void 0:n.body)?!1:At(t,{0(){return e.matches(qo)},1(){let r=e;for(;r!==null;){if(r.matches(qo))return!0;r=r.parentElement}return!1}})}function vl(e){let t=ti(e);En().nextFrame(()=>{t&&!Cs(t.activeElement,0)&&og(e)})}var ig=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(ig||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function og(e){e==null||e.focus({preventScroll:!0})}let sg=["textarea","input"].join(",");function ag(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,sg))!=null?n:!1}function ml(e,t=n=>n){return e.slice().sort((n,r)=>{let s=t(n),u=t(r);if(s===null||u===null)return 0;let c=s.compareDocumentPosition(u);return c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ug(e,t){return cg(gl(),t,{relativeTo:e})}function cg(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:s=[]}={}){let u=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,c=Array.isArray(e)?n?ml(e):e:gl(e);s.length>0&&c.length>1&&(c=c.filter(b=>!s.includes(b))),r=r??u.activeElement;let g=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),h=t&32?{preventScroll:!0}:{},d=0,f=c.length,m;do{if(d>=f||d+f<=0)return 0;let b=p+d;if(t&16)b=(b+f)%f;else{if(b<0)return 3;if(b>=f)return 1}m=c[b],m==null||m.focus(h),d+=g}while(m!==u.activeElement);return t&6&&ag(m)&&m.select(),2}function fi(e,t,n){let r=Nn(t);Ne(()=>{function s(u){r.current(u)}return document.addEventListener(e,s,n),()=>document.removeEventListener(e,s,n)},[e,n])}function lg(e,t,n){let r=Nn(t);Ne(()=>{function s(u){r.current(u)}return window.addEventListener(e,s,n),()=>window.removeEventListener(e,s,n)},[e,n])}function fg(e,t,n=!0){let r=Be(!1);Ne(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function s(c,g){if(!r.current||c.defaultPrevented)return;let p=g(c);if(p===null||!p.getRootNode().contains(p)||!p.isConnected)return;let h=function d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let d of h){if(d===null)continue;let f=d instanceof HTMLElement?d:d.current;if(f!=null&&f.contains(p)||c.composed&&c.composedPath().includes(f))return}return!Cs(p,ks.Loose)&&p.tabIndex!==-1&&c.preventDefault(),t(c,p)}let u=Be(null);fi("pointerdown",c=>{var g,p;r.current&&(u.current=((p=(g=c.composedPath)==null?void 0:g.call(c))==null?void 0:p[0])||c.target)},!0),fi("mousedown",c=>{var g,p;r.current&&(u.current=((p=(g=c.composedPath)==null?void 0:g.call(c))==null?void 0:p[0])||c.target)},!0),fi("click",c=>{u.current&&(s(c,()=>u.current),u.current=null)},!0),fi("touchend",c=>s(c,()=>c.target instanceof HTMLElement?c.target:null),!0),lg("blur",c=>s(c,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Ga(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function yl(e,t){let[n,r]=ht(()=>Ga(e));return qt(()=>{r(Ga(e))},[e.type,e.as]),qt(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let _l=Symbol();function hg(e,t=!0){return Object.assign(e,{[_l]:t})}function Fn(...e){let t=Be(e);Ne(()=>{t.current=e},[e]);let n=je(r=>{for(let s of t.current)s!=null&&(typeof s=="function"?s(r):s.current=r)});return e.every(r=>r==null||(r==null?void 0:r[_l]))?void 0:n}function dg({container:e,accept:t,walk:n,enabled:r=!0}){let s=Be(t),u=Be(n);Ne(()=>{s.current=t,u.current=n},[t,n]),qt(()=>{if(!e||!r)return;let c=ti(e);if(!c)return;let g=s.current,p=u.current,h=Object.assign(f=>g(f),{acceptNode:g}),d=c.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,h,!1);for(;d.nextNode();)p(d.currentNode)},[e,r,s,u])}function pg(e){throw new Error("Unexpected object: "+e)}var Gt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Gt||{});function gg(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),s=r??-1,u=(()=>{switch(e.focus){case 0:return n.findIndex(c=>!t.resolveDisabled(c));case 1:{let c=n.slice().reverse().findIndex((g,p,h)=>s!==-1&&h.length-p-1>=s?!1:!t.resolveDisabled(g));return c===-1?c:n.length-1-c}case 2:return n.findIndex((c,g)=>g<=s?!1:!t.resolveDisabled(c));case 3:{let c=n.slice().reverse().findIndex(g=>!t.resolveDisabled(g));return c===-1?c:n.length-1-c}case 4:return n.findIndex(c=>t.resolveId(c)===e.id);case 5:return null;default:pg(e)}})();return u===-1?r:u}function Ui(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var Pr=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Pr||{}),Cn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Cn||{});function An({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:s,visible:u=!0,name:c}){let g=bl(t,e);if(u)return hi(g,n,r,c);let p=s??0;if(p&2){let{static:h=!1,...d}=g;if(h)return hi(d,n,r,c)}if(p&1){let{unmount:h=!0,...d}=g;return At(h?0:1,{0(){return null},1(){return hi({...d,hidden:!0,style:{display:"none"}},n,r,c)}})}return hi(g,n,r,c)}function hi(e,t={},n,r){let{as:s=n,children:u,refName:c="ref",...g}=vo(e,["unmount","static"]),p=e.ref!==void 0?{[c]:e.ref}:{},h=typeof u=="function"?u(t):u;"className"in g&&g.className&&typeof g.className=="function"&&(g.className=g.className(t));let d={};if(t){let f=!1,m=[];for(let[b,w]of Object.entries(t))typeof w=="boolean"&&(f=!0),w===!0&&m.push(b);f&&(d["data-headlessui-state"]=m.join(" "))}if(s===xe&&Object.keys(Qa(g)).length>0){if(!Ir(h)||Array.isArray(h)&&h.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(g).map(w=>` - ${w}`).join(`
105
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(w=>` - ${w}`).join(`
106
- `)].join(`
107
- `));let f=h.props,m=typeof(f==null?void 0:f.className)=="function"?(...w)=>Ui(f==null?void 0:f.className(...w),g.className):Ui(f==null?void 0:f.className,g.className),b=m?{className:m}:{};return gs(h,Object.assign({},bl(h.props,Qa(vo(g,["ref"]))),d,p,vg(h.ref,p.ref),b))}return et(s,Object.assign({},vo(g,["ref"]),s!==xe&&p,s!==xe&&d),h)}function vg(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}}function bl(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let s in r)s.startsWith("on")&&typeof r[s]=="function"?(n[s]!=null||(n[s]=[]),n[s].push(r[s])):t[s]=r[s];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](s,...u){let c=n[r];for(let g of c){if((s instanceof Event||(s==null?void 0:s.nativeEvent)instanceof Event)&&s.defaultPrevented)return;g(s,...u)}}});return t}function ln(e){var t;return Object.assign(Xr(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Qa(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function vo(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Sl(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&mg(n)?!1:r}function mg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let Is=Zt(null);Is.displayName="OpenClosedContext";var mt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(mt||{});function $i(){return en(Is)}function Ts({value:e,children:t}){return Ye.createElement(Is.Provider,{value:e},t)}var Xe=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Xe||{});function Xa(e){return[e.screenX,e.screenY]}function yg(){let e=Be([-1,-1]);return{wasMoved(t){let n=Xa(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Xa(t)}}}function _g(...e){return yt(()=>ti(...e),[...e])}function Rs(){let e=Be(!1);return qt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Za;let bg=(Za=Ye.startTransition)!=null?Za:function(e){e()};var Sg=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Sg||{}),wg=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e))(wg||{});let Eg={0:e=>({...e,disclosureState:At(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Os=Zt(null);Os.displayName="DisclosureContext";function Ns(e){let t=en(Os);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ns),n}return t}let Us=Zt(null);Us.displayName="DisclosureAPIContext";function wl(e){let t=en(Us);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wl),n}return t}let xs=Zt(null);xs.displayName="DisclosurePanelContext";function Fg(){return en(xs)}function Ag(e,t){return At(t.type,Eg,e,t)}let Pg=xe;function kg(e,t){let{defaultOpen:n=!1,...r}=e,s=Be(null),u=Fn(t,hg(I=>{s.current=I},e.as===void 0||e.as===xe)),c=Be(null),g=Be(null),p=Cr(Ag,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:g,panelRef:c,buttonId:null,panelId:null}),[{disclosureState:h,buttonId:d},f]=p,m=je(I=>{f({type:1});let R=ti(s);if(!R||!d)return;let F=(()=>I?I instanceof HTMLElement?I:I.current instanceof HTMLElement?I.current:R.getElementById(d):R.getElementById(d))();F==null||F.focus()}),b=yt(()=>({close:m}),[m]),w=yt(()=>({open:h===0,close:m}),[h,m]),C={ref:u};return Ye.createElement(Os.Provider,{value:p},Ye.createElement(Us.Provider,{value:b},Ye.createElement(Ts,{value:At(h,{0:mt.Open,1:mt.Closed})},An({ourProps:C,theirProps:r,slot:w,defaultTag:Pg,name:"Disclosure"}))))}let Cg="button";function Ig(e,t){let n=ei(),{id:r=`headlessui-disclosure-button-${n}`,...s}=e,[u,c]=Ns("Disclosure.Button"),g=Fg(),p=g===null?!1:g===u.panelId,h=Be(null),d=Fn(h,t,p?null:u.buttonRef);Ne(()=>{if(!p)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,p]);let f=je(R=>{var F;if(p){if(u.disclosureState===1)return;switch(R.key){case Xe.Space:case Xe.Enter:R.preventDefault(),R.stopPropagation(),c({type:0}),(F=u.buttonRef.current)==null||F.focus();break}}else switch(R.key){case Xe.Space:case Xe.Enter:R.preventDefault(),R.stopPropagation(),c({type:0});break}}),m=je(R=>{switch(R.key){case Xe.Space:R.preventDefault();break}}),b=je(R=>{var F;Sl(R.currentTarget)||e.disabled||(p?(c({type:0}),(F=u.buttonRef.current)==null||F.focus()):c({type:0}))}),w=yt(()=>({open:u.disclosureState===0}),[u]),C=yl(e,h),I=p?{ref:d,type:C,onKeyDown:f,onClick:b}:{ref:d,id:r,type:C,"aria-expanded":u.disclosureState===0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:f,onKeyUp:m,onClick:b};return An({ourProps:I,theirProps:s,slot:w,defaultTag:Cg,name:"Disclosure.Button"})}let Tg="div",Rg=Pr.RenderStrategy|Pr.Static;function Og(e,t){let n=ei(),{id:r=`headlessui-disclosure-panel-${n}`,...s}=e,[u,c]=Ns("Disclosure.Panel"),{close:g}=wl("Disclosure.Panel"),p=Fn(t,u.panelRef,b=>{bg(()=>c({type:b?4:5}))});Ne(()=>(c({type:3,panelId:r}),()=>{c({type:3,panelId:null})}),[r,c]);let h=$i(),d=(()=>h!==null?(h&mt.Open)===mt.Open:u.disclosureState===0)(),f=yt(()=>({open:u.disclosureState===0,close:g}),[u,g]),m={ref:p,id:r};return Ye.createElement(xs.Provider,{value:u.panelId},An({ourProps:m,theirProps:s,slot:f,defaultTag:Tg,features:Rg,visible:d,name:"Disclosure.Panel"}))}let Ng=ln(kg),Ug=ln(Ig),xg=ln(Og),mo=Object.assign(Ng,{Button:Ug,Panel:xg}),eu=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function tu(e){var t,n;let r=(t=e.innerText)!=null?t:"",s=e.cloneNode(!0);if(!(s instanceof HTMLElement))return r;let u=!1;for(let g of s.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))g.remove(),u=!0;let c=u?(n=s.innerText)!=null?n:"":r;return eu.test(c)&&(c=c.replace(eu,"")),c}function Dg(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(s=>{let u=document.getElementById(s);if(u){let c=u.getAttribute("aria-label");return typeof c=="string"?c.trim():tu(u).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return tu(e).trim()}function Lg(e){let t=Be(""),n=Be("");return je(()=>{let r=e.current;if(!r)return"";let s=r.innerText;if(t.current===s)return n.current;let u=Dg(r).trim().toLowerCase();return t.current=s,n.current=u,u})}var Mg=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Mg||{}),jg=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(jg||{}),Bg=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(Bg||{});function yo(e,t=n=>n){let n=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,r=ml(t(e.items.slice()),u=>u.dataRef.current.domRef.current),s=n?r.indexOf(n):null;return s===-1&&(s=null),{items:r,activeItemIndex:s}}let Hg={1(e){return e.menuState===1?e:{...e,activeItemIndex:null,menuState:1}},0(e){return e.menuState===0?e:{...e,__demoMode:!1,menuState:0}},2:(e,t)=>{var n;let r=yo(e),s=gg(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeItemIndex:s,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),s=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find(c=>{var g;return((g=c.dataRef.current.textValue)==null?void 0:g.startsWith(r))&&!c.dataRef.current.disabled}),u=s?e.items.indexOf(s):-1;return u===-1||u===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:u,activationTrigger:1}},4(e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},5:(e,t)=>{let n=yo(e,r=>[...r,{id:t.id,dataRef:t.dataRef}]);return{...e,...n}},6:(e,t)=>{let n=yo(e,r=>{let s=r.findIndex(u=>u.id===t.id);return s!==-1&&r.splice(s,1),r});return{...e,...n,activationTrigger:1}}},Ds=Zt(null);Ds.displayName="MenuContext";function Wi(e){let t=en(Ds);if(t===null){let n=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wi),n}return t}function Kg(e,t){return At(t.type,Hg,e,t)}let Vg=xe;function qg(e,t){let{__demoMode:n=!1,...r}=e,s=Cr(Kg,{__demoMode:n,menuState:n?0:1,buttonRef:Ai(),itemsRef:Ai(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:u,itemsRef:c,buttonRef:g},p]=s,h=Fn(t);fg([g,c],(b,w)=>{var C;p({type:1}),Cs(w,ks.Loose)||(b.preventDefault(),(C=g.current)==null||C.focus())},u===0);let d=je(()=>{p({type:1})}),f=yt(()=>({open:u===0,close:d}),[u,d]),m={ref:h};return Ye.createElement(Ds.Provider,{value:s},Ye.createElement(Ts,{value:At(u,{0:mt.Open,1:mt.Closed})},An({ourProps:m,theirProps:r,slot:f,defaultTag:Vg,name:"Menu"})))}let $g="button";function Wg(e,t){var n;let r=ei(),{id:s=`headlessui-menu-button-${r}`,...u}=e,[c,g]=Wi("Menu.Button"),p=Fn(c.buttonRef,t),h=qi(),d=je(C=>{switch(C.key){case Xe.Space:case Xe.Enter:case Xe.ArrowDown:C.preventDefault(),C.stopPropagation(),g({type:0}),h.nextFrame(()=>g({type:2,focus:Gt.First}));break;case Xe.ArrowUp:C.preventDefault(),C.stopPropagation(),g({type:0}),h.nextFrame(()=>g({type:2,focus:Gt.Last}));break}}),f=je(C=>{switch(C.key){case Xe.Space:C.preventDefault();break}}),m=je(C=>{if(Sl(C.currentTarget))return C.preventDefault();e.disabled||(c.menuState===0?(g({type:1}),h.nextFrame(()=>{var I;return(I=c.buttonRef.current)==null?void 0:I.focus({preventScroll:!0})})):(C.preventDefault(),g({type:0})))}),b=yt(()=>({open:c.menuState===0}),[c]),w={ref:p,id:s,type:yl(e,c.buttonRef),"aria-haspopup":"menu","aria-controls":(n=c.itemsRef.current)==null?void 0:n.id,"aria-expanded":c.menuState===0,onKeyDown:d,onKeyUp:f,onClick:m};return An({ourProps:w,theirProps:u,slot:b,defaultTag:$g,name:"Menu.Button"})}let Jg="div",zg=Pr.RenderStrategy|Pr.Static;function Yg(e,t){var n,r;let s=ei(),{id:u=`headlessui-menu-items-${s}`,...c}=e,[g,p]=Wi("Menu.Items"),h=Fn(g.itemsRef,t),d=_g(g.itemsRef),f=qi(),m=$i(),b=(()=>m!==null?(m&mt.Open)===mt.Open:g.menuState===0)();Ne(()=>{let F=g.itemsRef.current;F&&g.menuState===0&&F!==(d==null?void 0:d.activeElement)&&F.focus({preventScroll:!0})},[g.menuState,g.itemsRef,d]),dg({container:g.itemsRef.current,enabled:g.menuState===0,accept(F){return F.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:F.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(F){F.setAttribute("role","none")}});let w=je(F=>{var A,x;switch(f.dispose(),F.key){case Xe.Space:if(g.searchQuery!=="")return F.preventDefault(),F.stopPropagation(),p({type:3,value:F.key});case Xe.Enter:if(F.preventDefault(),F.stopPropagation(),p({type:1}),g.activeItemIndex!==null){let{dataRef:O}=g.items[g.activeItemIndex];(x=(A=O.current)==null?void 0:A.domRef.current)==null||x.click()}vl(g.buttonRef.current);break;case Xe.ArrowDown:return F.preventDefault(),F.stopPropagation(),p({type:2,focus:Gt.Next});case Xe.ArrowUp:return F.preventDefault(),F.stopPropagation(),p({type:2,focus:Gt.Previous});case Xe.Home:case Xe.PageUp:return F.preventDefault(),F.stopPropagation(),p({type:2,focus:Gt.First});case Xe.End:case Xe.PageDown:return F.preventDefault(),F.stopPropagation(),p({type:2,focus:Gt.Last});case Xe.Escape:F.preventDefault(),F.stopPropagation(),p({type:1}),En().nextFrame(()=>{var O;return(O=g.buttonRef.current)==null?void 0:O.focus({preventScroll:!0})});break;case Xe.Tab:F.preventDefault(),F.stopPropagation(),p({type:1}),En().nextFrame(()=>{ug(g.buttonRef.current,F.shiftKey?$o.Previous:$o.Next)});break;default:F.key.length===1&&(p({type:3,value:F.key}),f.setTimeout(()=>p({type:4}),350));break}}),C=je(F=>{switch(F.key){case Xe.Space:F.preventDefault();break}}),I=yt(()=>({open:g.menuState===0}),[g]),R={"aria-activedescendant":g.activeItemIndex===null||(n=g.items[g.activeItemIndex])==null?void 0:n.id,"aria-labelledby":(r=g.buttonRef.current)==null?void 0:r.id,id:u,onKeyDown:w,onKeyUp:C,role:"menu",tabIndex:0,ref:h};return An({ourProps:R,theirProps:c,slot:I,defaultTag:Jg,features:zg,visible:b,name:"Menu.Items"})}let Gg=xe;function Qg(e,t){let n=ei(),{id:r=`headlessui-menu-item-${n}`,disabled:s=!1,...u}=e,[c,g]=Wi("Menu.Item"),p=c.activeItemIndex!==null?c.items[c.activeItemIndex].id===r:!1,h=Be(null),d=Fn(t,h);qt(()=>{if(c.__demoMode||c.menuState!==0||!p||c.activationTrigger===0)return;let O=En();return O.requestAnimationFrame(()=>{var N,E;(E=(N=h.current)==null?void 0:N.scrollIntoView)==null||E.call(N,{block:"nearest"})}),O.dispose},[c.__demoMode,h,p,c.menuState,c.activationTrigger,c.activeItemIndex]);let f=Lg(h),m=Be({disabled:s,domRef:h,get textValue(){return f()}});qt(()=>{m.current.disabled=s},[m,s]),qt(()=>(g({type:5,id:r,dataRef:m}),()=>g({type:6,id:r})),[m,r]);let b=je(()=>{g({type:1})}),w=je(O=>{if(s)return O.preventDefault();g({type:1}),vl(c.buttonRef.current)}),C=je(()=>{if(s)return g({type:2,focus:Gt.Nothing});g({type:2,focus:Gt.Specific,id:r})}),I=yg(),R=je(O=>I.update(O)),F=je(O=>{I.wasMoved(O)&&(s||p||g({type:2,focus:Gt.Specific,id:r,trigger:0}))}),A=je(O=>{I.wasMoved(O)&&(s||p&&g({type:2,focus:Gt.Nothing}))}),x=yt(()=>({active:p,disabled:s,close:b}),[p,s,b]);return An({ourProps:{id:r,ref:d,role:"menuitem",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,disabled:void 0,onClick:w,onFocus:C,onPointerEnter:R,onMouseEnter:R,onPointerMove:F,onMouseMove:F,onPointerLeave:A,onMouseLeave:A},theirProps:u,slot:x,defaultTag:Gg,name:"Menu.Item"})}let Xg=ln(qg),Zg=ln(Wg),ev=ln(Yg),tv=ln(Qg),Br=Object.assign(Xg,{Button:Zg,Items:ev,Item:tv});function nv(e=0){let[t,n]=ht(e),r=Rs(),s=lr(p=>{r.current&&n(h=>h|p)},[t,r]),u=lr(p=>!!(t&p),[t]),c=lr(p=>{r.current&&n(h=>h&~p)},[n,r]),g=lr(p=>{r.current&&n(h=>h^p)},[n]);return{flags:t,addFlag:s,hasFlag:u,removeFlag:c,toggleFlag:g}}function rv(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function _o(e,...t){e&&t.length>0&&e.classList.add(...t)}function bo(e,...t){e&&t.length>0&&e.classList.remove(...t)}function iv(e,t){let n=En();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:s}=getComputedStyle(e),[u,c]=[r,s].map(p=>{let[h=0]=p.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return h}),g=u+c;if(g!==0){n.group(h=>{h.setTimeout(()=>{t(),h.dispose()},g),h.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&h.dispose()})});let p=n.addEventListener(e,"transitionend",h=>{h.target===h.currentTarget&&(t(),p())})}else t();return n.add(()=>t()),n.dispose}function ov(e,t,n,r){let s=n?"enter":"leave",u=En(),c=r!==void 0?rv(r):()=>{};s==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let g=At(s,{enter:()=>t.enter,leave:()=>t.leave}),p=At(s,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),h=At(s,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return bo(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),_o(e,...t.base,...g,...h),u.nextFrame(()=>{bo(e,...t.base,...g,...h),_o(e,...t.base,...g,...p),iv(e,()=>(bo(e,...t.base,...g),_o(e,...t.base,...t.entered),c()))}),u.dispose}function sv({immediate:e,container:t,direction:n,classes:r,onStart:s,onStop:u}){let c=Rs(),g=qi(),p=Nn(n);qt(()=>{e&&(p.current="enter")},[e]),qt(()=>{let h=En();g.add(h.dispose);let d=t.current;if(d&&p.current!=="idle"&&c.current)return h.dispose(),s.current(p.current),h.add(ov(d,r.current,p.current==="enter",()=>{h.dispose(),u.current(p.current)})),h.dispose},[n])}function Pn(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let Ji=Zt(null);Ji.displayName="TransitionContext";var av=(e=>(e.Visible="visible",e.Hidden="hidden",e))(av||{});function uv(){let e=en(Ji);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function cv(){let e=en(zi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let zi=Zt(null);zi.displayName="NestingContext";function Yi(e){return"children"in e?Yi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function El(e,t){let n=Nn(e),r=Be([]),s=Rs(),u=qi(),c=je((b,w=Cn.Hidden)=>{let C=r.current.findIndex(({el:I})=>I===b);C!==-1&&(At(w,{[Cn.Unmount](){r.current.splice(C,1)},[Cn.Hidden](){r.current[C].state="hidden"}}),u.microTask(()=>{var I;!Yi(r)&&s.current&&((I=n.current)==null||I.call(n))}))}),g=je(b=>{let w=r.current.find(({el:C})=>C===b);return w?w.state!=="visible"&&(w.state="visible"):r.current.push({el:b,state:"visible"}),()=>c(b,Cn.Unmount)}),p=Be([]),h=Be(Promise.resolve()),d=Be({enter:[],leave:[],idle:[]}),f=je((b,w,C)=>{p.current.splice(0),t&&(t.chains.current[w]=t.chains.current[w].filter(([I])=>I!==b)),t==null||t.chains.current[w].push([b,new Promise(I=>{p.current.push(I)})]),t==null||t.chains.current[w].push([b,new Promise(I=>{Promise.all(d.current[w].map(([R,F])=>F)).then(()=>I())})]),w==="enter"?h.current=h.current.then(()=>t==null?void 0:t.wait.current).then(()=>C(w)):C(w)}),m=je((b,w,C)=>{Promise.all(d.current[w].splice(0).map(([I,R])=>R)).then(()=>{var I;(I=p.current.shift())==null||I()}).then(()=>C(w))});return yt(()=>({children:r,register:g,unregister:c,onStart:f,onStop:m,wait:h,chains:d}),[g,c,r,f,m,d,h])}function lv(){}let fv=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function nu(e){var t;let n={};for(let r of fv)n[r]=(t=e[r])!=null?t:lv;return n}function hv(e){let t=Be(nu(e));return Ne(()=>{t.current=nu(e)},[e]),t}let dv="div",Fl=Pr.RenderStrategy;function pv(e,t){var n,r;let{beforeEnter:s,afterEnter:u,beforeLeave:c,afterLeave:g,enter:p,enterFrom:h,enterTo:d,entered:f,leave:m,leaveFrom:b,leaveTo:w,...C}=e,I=Be(null),R=Fn(I,t),F=(n=C.unmount)==null||n?Cn.Unmount:Cn.Hidden,{show:A,appear:x,initial:O}=uv(),[N,E]=ht(A?"visible":"hidden"),U=cv(),{register:K,unregister:X}=U;Ne(()=>K(I),[K,I]),Ne(()=>{if(F===Cn.Hidden&&I.current){if(A&&N!=="visible"){E("visible");return}return At(N,{hidden:()=>X(I),visible:()=>K(I)})}},[N,I,K,X,A,F]);let M=Nn({base:Pn(C.className),enter:Pn(p),enterFrom:Pn(h),enterTo:Pn(d),entered:Pn(f),leave:Pn(m),leaveFrom:Pn(b),leaveTo:Pn(w)}),ue=hv({beforeEnter:s,afterEnter:u,beforeLeave:c,afterLeave:g}),fe=Ps();Ne(()=>{if(fe&&N==="visible"&&I.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,N,fe]);let be=O&&!x,Se=x&&A&&O,Ce=(()=>!fe||be?"idle":A?"enter":"leave")(),Oe=nv(0),qe=je(De=>At(De,{enter:()=>{Oe.addFlag(mt.Opening),ue.current.beforeEnter()},leave:()=>{Oe.addFlag(mt.Closing),ue.current.beforeLeave()},idle:()=>{}})),Fe=je(De=>At(De,{enter:()=>{Oe.removeFlag(mt.Opening),ue.current.afterEnter()},leave:()=>{Oe.removeFlag(mt.Closing),ue.current.afterLeave()},idle:()=>{}})),Ee=El(()=>{E("hidden"),X(I)},U);sv({immediate:Se,container:I,classes:M,direction:Ce,onStart:Nn(De=>{Ee.onStart(I,De,qe)}),onStop:Nn(De=>{Ee.onStop(I,De,Fe),De==="leave"&&!Yi(Ee)&&(E("hidden"),X(I))})});let Te=C,ct={ref:R};return Se?Te={...Te,className:Ui(C.className,...M.current.enter,...M.current.enterFrom)}:(Te.className=Ui(C.className,(r=I.current)==null?void 0:r.className),Te.className===""&&delete Te.className),Ye.createElement(zi.Provider,{value:Ee},Ye.createElement(Ts,{value:At(N,{visible:mt.Open,hidden:mt.Closed})|Oe.flags},An({ourProps:ct,theirProps:Te,defaultTag:dv,features:Fl,visible:N==="visible",name:"Transition.Child"})))}function gv(e,t){let{show:n,appear:r=!1,unmount:s=!0,...u}=e,c=Be(null),g=Fn(c,t);Ps();let p=$i();if(n===void 0&&p!==null&&(n=(p&mt.Open)===mt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,d]=ht(n?"visible":"hidden"),f=El(()=>{d("hidden")}),[m,b]=ht(!0),w=Be([n]);qt(()=>{m!==!1&&w.current[w.current.length-1]!==n&&(w.current.push(n),b(!1))},[w,n]);let C=yt(()=>({show:n,appear:r,initial:m}),[n,r,m]);Ne(()=>{if(n)d("visible");else if(!Yi(f))d("hidden");else{let A=c.current;if(!A)return;let x=A.getBoundingClientRect();x.x===0&&x.y===0&&x.width===0&&x.height===0&&d("hidden")}},[n,f]);let I={unmount:s},R=je(()=>{var A;m&&b(!1),(A=e.beforeEnter)==null||A.call(e)}),F=je(()=>{var A;m&&b(!1),(A=e.beforeLeave)==null||A.call(e)});return Ye.createElement(zi.Provider,{value:f},Ye.createElement(Ji.Provider,{value:C},An({ourProps:{...I,as:xe,children:Ye.createElement(Al,{ref:g,...I,...u,beforeEnter:R,beforeLeave:F})},theirProps:{},defaultTag:xe,features:Fl,visible:h==="visible",name:"Transition"})))}function vv(e,t){let n=en(Ji)!==null,r=$i()!==null;return Ye.createElement(Ye.Fragment,null,!n&&r?Ye.createElement(Wo,{ref:t,...e}):Ye.createElement(Al,{ref:t,...e}))}let Wo=ln(gv),Al=ln(pv),mv=ln(vv),yv=Object.assign(Wo,{Child:mv,Root:Wo});function _v({title:e,titleId:t,...n},r){return et("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?et("title",{id:t},e):null,et("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"}))}const bv=Xr(_v),Sv=bv;function wv({title:e,titleId:t,...n},r){return et("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?et("title",{id:t},e):null,et("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}))}const Ev=Xr(wv),Fv=Ev;function Jo(...e){return e.filter(Boolean).join(" ")}const r0=e=>`${e[0].toUpperCase()}${e.slice(1)}`,ru=({user:{featureFlags:e}})=>{const[t,n]=ht(It),r=yt(()=>{const s=new Map([["benefits","/"]]);return e.wellbeing&&s.set("wellbeing","/wellbeing-hub"),Array.from(s)},[]);return Ne(()=>{const s=[Rr.navPage$.subscribe(u=>{n(sn(u))})];return()=>{s.map(u=>u.unsubscribe())}},[]),le("nav",{className:"-mb-px flex","aria-label":"Tabs",children:r.map(([s,u])=>le("div",{onClick:async()=>{n(sn(s)),Qn(u)},className:Jo($a(t,s)?"border-primary text-primary":"border-transparent text-gray-500","cursor-pointer hover:text-gray-700 hover:border-gray-300 px-4 md:ml-4 flex-grow md:flex-grow-0","py-4 text-center border-b-4 text-base leading-6 font-semibold cursor-pointer capitalize"),"aria-current":$a(t,s)?"page":void 0,children:le("span",{children:s})},s))})},Av=()=>{const[e,t]=ht("employee");return Ne(()=>{const n=[Rr.appView$.subscribe(t)];return()=>{n.map(r=>r.unsubscribe())}},[]),le("span",{className:"relative z-0 inline-flex shadow-sm rounded-md",children:[le("button",{type:"button",className:Jo(e==="admin"?"text-primary bg-white cursor-default":"text-gray-700 bg-gray-50","relative inline-flex items-center px-4 py-1 rounded-l-md border border-gray-300 text-sm font-medium hover:bg-white focus:z-10 focus:outline-none"),onClick:()=>{e!=="admin"&&Qn("/admin")},children:"Admin view"}),le("button",{type:"button",className:Jo(e==="employee"?"text-primary bg-white cursor-default":"text-gray-700 bg-gray-50","-ml-px relative inline-flex items-center px-4 py-1 rounded-r-md border border-gray-300 text-sm font-medium hover:bg-white focus:z-10 focus:outline-none"),onClick:()=>{e!=="employee"&&Qn("/")},children:"Employee view"})]})},Pv=[{name:"Admin view",href:"#/admin"},{name:"Employee view",href:"#/"}],Pl=()=>le("span",{className:"inline-block h-8 w-8 rounded-full overflow-hidden bg-white border",children:le("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24",children:le("path",{d:"M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"})})}),kv=({user:e})=>le(xe,{children:le(Br,{as:"div",className:"z-30 relative inline-block text-left",children:({open:t})=>le(xe,{children:[le("div",{children:le(Br.Button,{className:`max-w-xs bg-white flex items-center text-sm rounded-full hover:outline-none hover:ring-2 hover:ring-offset-2 hover:ring-primary ${t?"outline-none ring-2 ring-offset-2 ring-primary":""} `,children:le(Pl,{})})}),le(yv,{enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:le(Br.Items,{className:"absolute right-0 mt-2 w-56 divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:le("div",{className:"px-1 py-1 ",children:[le(Br.Item,{children:()=>le("div",{className:"mx-3 py-2",children:[le("div",{className:"text-base font-medium text-gray-800",children:e.basicProfile.firstName}),le("div",{className:"text-sm font-medium text-gray-500",children:e.basicProfile.email})]})}),le("div",{className:"border-t border-grey-900",children:le(Br.Item,{children:({active:n})=>le("button",{onClick:()=>yn.signOutRedirectAsync(),className:`${n?"bg-secondary text-primary rounded-md":"text-gray-900 "} group flex w-full items-center mt-2 mb-1 px-3 py-2 text-sm font-medium`,children:"Logout"})})})]})})})]})})}),Cv=e=>{const t=e.user;if(xn(t))return le(xe,{});const[n,r]=ht(!1),s=t.value.benefitsProfile.role!=="user";return Ne(()=>{const u=[Rr.appView$.subscribe(c=>{r(c==="employee")})];return()=>{u.map(c=>c.unsubscribe())}},[]),le(xe,{children:le(mo,{as:"nav",className:"bg-gray-50 border-0 md:border-b md:border-gray-200",children:({open:u})=>le(xe,{children:[le("div",{className:`mx-auto px-4 sm:px-6 lg:px-8 border-b border-gray-200 md:border-none ${s&&!n?"":"max-w-7xl"}`,children:le("div",{className:"flex justify-between h-16",children:[le("div",{className:"flex",children:le("div",{className:"flex-shrink-0 flex items-center",children:le("img",{className:"block h-8 w-auto",src:Gc,alt:"Flare Benefits"})})}),le("div",{className:"ml-10 flex flex-wrap flex-grow content-end",children:le("div",{className:"hidden sm:block",children:n&&le(ru,{user:t.value})})}),le("div",{className:"flex flex-wrap content-center",children:le("div",{className:"hidden md:block",children:s&&le(Av,{})})}),le("div",{className:"hidden md:ml-6 md:flex md:items-center",children:le(kv,{user:t.value})}),le("div",{className:"-mr-2 flex items-center md:hidden",children:le(mo.Button,{className:"bg-white inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",children:[le("span",{className:"sr-only",children:"Open main menu"}),u?le(Fv,{className:"block h-6 w-6","aria-hidden":"true"}):le(Sv,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),le(mo.Panel,{className:"md:hidden",children:le("div",{className:"pt-4 pb-3 border-b border-gray-200",children:[le("div",{className:"flex items-center px-4",children:[le("div",{className:"flex-shrink-0",children:le(Pl,{})}),le("div",{className:"ml-3",children:[le("div",{className:"text-base font-medium text-gray-800",children:t.value.basicProfile.firstName}),le("div",{className:"text-sm font-medium text-gray-500",children:t.value.basicProfile.email})]})]}),le("div",{className:"mt-3 space-y-1",children:[s&&le(xe,{children:Pv.map(c=>le("a",{href:c.href,className:"block px-4 py-2 text-base font-medium text-gray-500 hover:text-primary hover:bg-secondary",children:c.name},c.name))}),le("a",{onClick:()=>yn.signOutRedirectAsync(),className:"block cursor-pointer px-4 py-2 text-base font-medium text-gray-500 hover:text-primary hover:bg-secondary",children:"Logout"})]})]})}),n&&le("div",{className:"sm:hidden bg-white border-b border-gray-200",children:le(ru,{user:t.value})})]})})})};class Iv{async postTrackEventAsync(t){return Xn.instance.url("benefits/track-event").post(t).res()}}const Tv=new Iv;class Rv{async trackAppLoadedAsync(){return this.trackEventAsync("appLoaded")}async trackBenefitsOpenedAsync(){return this.trackEventAsync("benefitsOpened")}async trackAppOfferViewedAsync(){return this.trackEventAsync("appOfferViewed")}async trackAppOfferAcceptedAsync(){return this.trackEventAsync("appOfferAccepted")}async trackWellbeingOpenedAsync(){return this.trackEventAsync("wellbeingOpened")}async trackAdminOpenedAsync(){return this.trackEventAsync("adminOpened")}async trackMarketplaceOfferViewedAsync(t,n,r){const s={offer:t,experiment:n,treatment:r};return this.trackEventAsync({marketplaceOfferViewed:s})}async trackMarketplaceOfferAcceptedAsync(t,n,r){const s={offer:t,experiment:n,treatment:r};return this.trackEventAsync({marketplaceOfferAccepted:s})}async trackPerksListViewedAsync(t){const n={pillar:t};return this.trackEventAsync({perksListViewed:n})}async trackEntriesListViewedAsync(t){const n={pillar:t};return this.trackEventAsync({entriesListViewed:n})}async trackFeaturePerkViewedAsync({benefitId:t,benefit:n}){const r={perkId:t,perkPillar:n.category,perkTitle:n.title,placement:"feature"};return this.trackEventAsync({perkViewed:r})}async trackExplorePerkViewedAsync({benefitId:t,benefit:n}){const r={perkId:t,perkPillar:n.category,perkTitle:n.title,placement:"explore"};return this.trackEventAsync({perkViewed:r})}async trackDocumentClickedAsync({benefitId:t,benefit:n}){const r={perkId:t,perkPillar:n.category,perkTitle:n.title,type:"document"};return this.trackEventAsync({attachmentOpened:r})}async trackPerkVisitedAsync({benefitId:t,benefit:n}){const r={perkId:t,perkPillar:n.category,perkTitle:n.title};return this.trackEventAsync({perkVisited:r})}async trackPerksListSearched(t){const n={query:t};return this.trackEventAsync({perksListSearched:n})}async trackRoleAssignedAsync(t){return this.trackEventAsync({roleAssigned:t})}async trackEntryViewed(t){return this.trackEventAsync({entryViewed:t})}async trackEntriesListSearchedAsync(t){const n={query:t};return this.trackEventAsync({entriesListSearched:n})}async trackEventAsync(t){try{await Tv.postTrackEventAsync({event:t})}catch{return}}}const kl=new Rv;function zo(e){this.message=e}zo.prototype=new Error,zo.prototype.name="InvalidCharacterError";var iu=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new zo("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,u=0,c="";r=t.charAt(u++);~r&&(n=s%4?64*n+r:r,s++%4)?c+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return c};function Ov(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(n){return decodeURIComponent(iu(n).replace(/(.)/g,function(r,s){var u=s.charCodeAt(0).toString(16).toUpperCase();return u.length<2&&(u="0"+u),"%"+u}))}(t)}catch{return iu(t)}}function xi(e){this.message=e}function Nv(e,t){if(typeof e!="string")throw new xi("Invalid token specified");var n=(t=t||{}).header===!0?0:1;try{return JSON.parse(Ov(e.split(".")[n]))}catch(r){throw new xi("Invalid token specified: "+r.message)}}xi.prototype=new Error,xi.prototype.name="InvalidTokenError";class Uv{async getUserProfile(){return await Xn.instance.url("users/self").get().json()}async getBasicProfileByEmail(t){const n=await Xn.instance.url(`users?email=${t}`).get().notFound(()=>null).json();return sn(n)}}const xv=new Uv;class Dv{constructor(){ze(this,"basicProfile");ze(this,"benefitsProfile");ze(this,"featureFlags")}static toDomain(t){return{basicProfile:t.basicProfile,benefitsProfile:t.benefitsProfile,featureFlags:t.featureFlags}}}const qn=class qn{static get profileId(){if(xn(this._profileId))throw Error("ProfileId is missing.");return this._profileId.value}static set profileId(t){this._profileId=sn(t)}static set accountId(t){this._accountId=sn(t)}static get profileIdOrDefault(){return yi(this._profileId,"")}static get accountIdOrDefault(){return yi(this._accountId,"")}static get partnerIdOrDefault(){return yi(this._partnerId,"")}extractProfileId(t){const n=sn(Nv(t).sub);if(xn(n))throw Error("profileId property is missing.");qn.profileId=n.value}async loadSignedInUserProfileAsync(){const t=Dv.toDomain(await xv.getUserProfile());qn.accountId=t.basicProfile.accountId,Rn.update(n=>{n.user=sn(t)})}};ze(qn,"_profileId",It),ze(qn,"_accountId",It),ze(qn,"_partnerId",It);let Yo=qn;const Cl=Ye.createContext(It),Il=Ye.createContext(!1),ou=new Yo,bi=()=>{const e=en(Cl);return Ne(()=>{kl.trackAppOfferAcceptedAsync()},[]),le(xe,{children:[le(Cv,{user:e}),le("workplace-link",{"access-token":pl.jwt,"backend-url":zn.getConfig().apiGatewayBaseUrl})]})},Tl=()=>{const e=Hi(),t=e.startsWith("state")||e.startsWith("code")||e.startsWith("error");return le(xe,{children:t?le(bi,{}):le("div",{className:"notfound",children:[le("h1",{children:"Error 404"}),le("p",{children:"That page doesn't exist."}),le("a",{href:"#/",children:le("h4",{children:"Back to Home"})})]})})};function So(e){return Ye.useContext(Il)?et(e.component,e):le(Ki,{})}const Rl=e=>{analytics.identify(e.basicProfile.profileId,{profile:e.basicProfile.profileId,account:e.basicProfile.accountId,partner:e.basicProfile.partnerId,benefitsRole:e.benefitsProfile.role})},Lv=e=>{const t=`${e.eventName} ${e.eventAction}`,n={...e};delete n.eventName,delete n.eventAction,analytics.track(t,n)},Mv=e=>()=>{},i0={identifyUser:Rl,trackEvent:Lv,handleTrackingOnClick:Mv},jv=e=>({listen:t=>e.listen(({location:n})=>t(n)),location:e.location,push:e.push,replace:e.replace}),Bv=Zr(()=>us(()=>import("./index-cfddcd4c.js").then(e=>e.i),["assets/index-cfddcd4c.js","assets/use-feature-flag-17b4c424.js"])),Hv=Zr(()=>us(()=>import("./index-f88c4655.js"),["assets/index-f88c4655.js","assets/banner-icon-0117e93c.js","assets/index-e7929e3d.js","assets/pillar-tag-d2869d71.js","assets/contentful-service-ec08fb7b.js","assets/promise-76b37e88.js","assets/motion-aecc8ecb.js"])),Kv=Zr(()=>us(()=>import("./index-84b83088.js"),["assets/index-84b83088.js","assets/banner-icon-0117e93c.js","assets/index-e7929e3d.js","assets/pillar-tag-d2869d71.js","assets/use-feature-flag-17b4c424.js","assets/item-details-35ad7588.js","assets/modal-e9f61093.js"])),Vv=()=>{const[e,t]=ht({user:It}),[n,r]=ht(!1),[s,u]=ht(!1);if(typeof window<"u"&&window.location.pathname.replace("/benefits/app","")!=="/")return window.location.pathname="/benefits/app/",null;Ne(()=>{(async()=>{if(await zn.fetchConfigAsync(),Vo.extractRedirectPath(),Vo.extractMode(),yn.tokenExists(window.location.search)){await yn.signOut(),await yn.initFromToken(window.location.pathname,window.location.search);return}u(!0)})();const g=[Rr.signedInUser$.subscribe(p=>{t({user:p}),$n(p)&&Rl(p.value)}),pl.authState$.subscribe(async({authStatus:p,jwt:h})=>{$n(h)&&p===Yt.Authenticated?(Xn.setParameters(zn.getConfig().apiBaseUrl,h.value),Cd.setParameters(zn.getConfig().apiV2BaseUrl,h.value),ou.extractProfileId(h.value),await ou.loadSignedInUserProfileAsync(),r(p===Yt.Authenticated)):r(!1)})];return()=>{g.map(p=>p.unsubscribe())}},[]);const c=g=>{switch(g.url.replace(/^\/+/,"").split("/")[0]){case"":Rn.update({appView:"employee",navTab:"benefits"});break;case"admin":Rn.update({appView:"admin",navTab:"benefits"});break;case"wellbeing-hub":Rn.update({appView:"employee",navTab:"wellbeing"});break}};return Ne(()=>{s&&n&&kl.trackAppLoadedAsync()},[s,n]),s?le("div",{id:"preact_root",className:"min-h-screen bg-white",children:le(Il.Provider,{value:n,children:le(Cl.Provider,{value:e.user,children:le(Sn,{history:jv(sd()),onChange:c,children:[le(So,{path:"/",component:Kv}),le(So,{path:"/wellbeing-hub/:subroute*",component:Hv}),le(So,{path:"/admin/:subroute*",component:Bv}),le(ur,{path:"/oidc/:mode*",component:zp}),le(ur,{path:"/b2c/:fragment",component:Yp}),le(ur,{path:"/workplace-link",component:bi}),le(ur,{path:"state=:fragment*",component:bi}),le(ur,{path:"/code*",component:bi}),le(Tl,{default:!0})]})})})}):le(Ki,{})};typeof window<"u"&&(gh({storage:window.sessionStorage,key:"benefits-client-v2"}),Jf(),zh.polyfill());Oh(le(ds,{children:le(vr,{fallback:Tl,children:le(Vv,{})})}),document.body);export{eg as $,Pa as A,Sv as B,Ie as C,sn as D,br as E,yt as F,en as G,Cv as H,zn as I,$n as J,Vd as K,Gc as L,Zr as M,zv as N,cr as O,Qv as P,as as Q,Sn as R,Ju as S,ln as T,Cl as U,An as V,je as W,Fv as X,lg as Y,Nn as Z,us as _,yv as a,Mu as a$,Fn as a0,Ps as a1,_g as a2,At as a3,cg as a4,$o as a5,qi as a6,Rs as a7,og as a8,ng as a9,r0 as aA,Lc as aB,Mf as aC,Xn as aD,ss as aE,xv as aF,jc as aG,Dv as aH,Td as aI,Bi as aJ,Ko as aK,Cd as aL,qp as aM,ju as aN,Uu as aO,os as aP,rd as aQ,Yv as aR,Gv as aS,e0 as aT,_r as aU,bu as aV,$v as aW,Gr as aX,In as aY,Li as aZ,Nf as a_,Zt as aa,hg as ab,Gn as ac,qt as ad,bc as ae,ei as af,En as ag,Pr as ah,$i as ai,mt as aj,Cr as ak,Ai as al,lr as am,fg as an,Xe as ao,Sl as ap,yr as aq,Su as ar,ts as as,er as at,Nt as au,Ge as av,cn as aw,Xt as ax,vu as ay,Rr as az,xe as b,Di as b0,Bn as b1,Ft as b2,Wv as b3,dn as b4,Un as b5,Hr as b6,ch as b7,Wu as b8,ns as b9,Hu as ba,lc as bb,vc as bc,nr as bd,Vt as be,yl as bf,Qa as bg,Uc as bh,hc as bi,Jo as c,jv as d,kl as e,Zc as f,Zv as g,ht as h,sd as i,ur as j,Xr as k,Bt as l,Hc as m,It as n,le as o,Ne as p,kr as q,yi as r,i0 as s,Gu as t,xn as u,Qn as v,Ye as w,Be as x,et as y,Jv as z};