@flarehr/cars-calculator 2.3.49 → 2.3.57

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 (119) hide show
  1. package/dist/lib/cars-calculator/cars-calculator.esm.js +1 -1
  2. package/dist/lib/cars-calculator/cars-calculator.js +1 -1
  3. package/dist/lib/cars-calculator/{p-b7e7dc0f.system.entry.js → p-08f08988.system.entry.js} +1 -1
  4. package/dist/lib/cars-calculator/{p-0b08c63c.system.js → p-19b00569.system.js} +1 -1
  5. package/dist/lib/cars-calculator/{p-92efd97a.system.entry.js → p-2f318de8.system.entry.js} +1 -1
  6. package/dist/lib/cars-calculator/{p-cc24e248.js → p-34be9e94.js} +1 -1
  7. package/dist/lib/cars-calculator/{p-9e42ba48.system.entry.js → p-3986811b.system.entry.js} +1 -1
  8. package/dist/lib/cars-calculator/{p-69382409.entry.js → p-40adf333.entry.js} +1 -1
  9. package/dist/lib/cars-calculator/p-45d6fbc2.system.js +1 -0
  10. package/dist/lib/cars-calculator/{p-82b4b9ca.entry.js → p-5feb27ac.entry.js} +1 -1
  11. package/dist/lib/cars-calculator/{p-5e27b626.js → p-628050dd.js} +1 -1
  12. package/dist/lib/cars-calculator/{p-f91aa986.system.js → p-6339bd49.system.js} +1 -1
  13. package/dist/lib/cars-calculator/{p-a0ed3a75.system.js → p-63ad215f.system.js} +1 -1
  14. package/dist/lib/cars-calculator/{p-03836e14.entry.js → p-6a379ac2.entry.js} +1 -1
  15. package/dist/lib/cars-calculator/p-7062880e.js +1 -0
  16. package/dist/lib/cars-calculator/{p-20a242dc.entry.js → p-7141bc11.entry.js} +1 -1
  17. package/dist/lib/cars-calculator/{p-ac38cb9d.system.entry.js → p-7234d34c.system.entry.js} +1 -1
  18. package/dist/lib/cars-calculator/{p-9cc8b374.system.entry.js → p-7fed1bfc.system.entry.js} +1 -1
  19. package/dist/lib/cars-calculator/{p-192dd4a3.system.js → p-8d4bb973.system.js} +1 -1
  20. package/dist/lib/cars-calculator/{p-25e24da6.system.entry.js → p-94ba6def.system.entry.js} +1 -1
  21. package/dist/lib/cars-calculator/{p-5efd0fbd.entry.js → p-a54b8d09.entry.js} +1 -1
  22. package/dist/lib/cars-calculator/{p-50451ff0.entry.js → p-aa6eeef5.entry.js} +1 -1
  23. package/dist/lib/cars-calculator/{p-98bd1117.system.entry.js → p-aa7dc5dc.system.entry.js} +1 -1
  24. package/dist/lib/cars-calculator/{p-819cfa63.js → p-ab3a7737.js} +1 -1
  25. package/dist/lib/cars-calculator/{p-821b5928.entry.js → p-af1b58b9.entry.js} +1 -1
  26. package/dist/lib/cars-calculator/{p-78c4dce3.system.js → p-b41f72c8.system.js} +1 -1
  27. package/dist/lib/cars-calculator/{p-598f4a0b.system.js → p-b51215ae.system.js} +1 -1
  28. package/dist/lib/cars-calculator/{p-69960bb6.system.js → p-bdb3fb61.system.js} +1 -1
  29. package/dist/lib/cars-calculator/{p-5c2cc99d.js → p-bf086b51.js} +1 -1
  30. package/dist/lib/cars-calculator/p-c39a8fe9.entry.js +1 -0
  31. package/dist/lib/cars-calculator/p-c3b6466e.js +1 -0
  32. package/dist/lib/cars-calculator/{p-3126f655.system.entry.js → p-c3d37683.system.entry.js} +1 -1
  33. package/dist/lib/cars-calculator/p-c49546ea.entry.js +1 -0
  34. package/dist/lib/cars-calculator/{p-88c232fe.system.entry.js → p-c77c24a6.system.entry.js} +1 -1
  35. package/dist/lib/cars-calculator/{p-1bc2b206.system.js → p-c9562e73.system.js} +1 -1
  36. package/dist/lib/cars-calculator/p-cbc447c7.system.entry.js +1 -0
  37. package/dist/lib/cars-calculator/{p-2e1b766b.system.entry.js → p-cd0073f4.system.entry.js} +1 -1
  38. package/dist/lib/cars-calculator/{p-c35d387e.js → p-d14b00d9.js} +1 -1
  39. package/dist/lib/cars-calculator/{p-c4cda1ba.entry.js → p-e385dbe0.entry.js} +1 -1
  40. package/dist/lib/cars-calculator/{p-066d8e7b.js → p-f3effa5d.js} +1 -1
  41. package/dist/lib/cars-calculator/{p-4b3e246f.js → p-fa160c9f.js} +1 -1
  42. package/dist/lib/cars-calculator/{p-8ec3baa9.system.js → p-fa7a5280.system.js} +1 -1
  43. package/dist/lib/cars-calculator/{p-e45ce69c.entry.js → p-ffa283e3.entry.js} +1 -1
  44. package/dist/lib/cjs/ap-ben-asset_15.cjs.entry.js +1 -1
  45. package/dist/lib/cjs/ap-ben-benefit-card.cjs.entry.js +3 -3
  46. package/dist/lib/cjs/ap-ben-benefit-list-item.cjs.entry.js +3 -3
  47. package/dist/lib/cjs/ap-ben-benefit-url_10.cjs.entry.js +6 -6
  48. package/dist/lib/cjs/ap-ben-benefits-list_3.cjs.entry.js +3 -3
  49. package/dist/lib/cjs/ap-ben-benefits-page.cjs.entry.js +4 -4
  50. package/dist/lib/cjs/ap-ben-confirm-dialog_4.cjs.entry.js +3 -3
  51. package/dist/lib/cjs/ap-ben-edit-benefit-page_5.cjs.entry.js +4 -4
  52. package/dist/lib/cjs/ap-ben-loading-page_2.cjs.entry.js +4 -4
  53. package/dist/lib/cjs/ap-ben-oidc-callback-page.cjs.entry.js +2 -2
  54. package/dist/lib/cjs/api-client-00edc9b6.js +107 -0
  55. package/dist/lib/cjs/{app-globals-086f9d49.js → app-globals-dec360ac.js} +1 -1
  56. package/dist/lib/cjs/{authentication.service-11c30071.js → authentication.service-12f9ead3.js} +1 -1
  57. package/dist/lib/cjs/benefits-app-host.cjs.entry.js +2 -2
  58. package/dist/lib/cjs/{benefits-app.query-97410065.js → benefits-app.query-98898e4c.js} +2 -2
  59. package/dist/lib/cjs/{benefits.api-053c4334.js → benefits.api-a4bd9804.js} +1 -1
  60. package/dist/lib/cjs/cars-calculator.cjs.js +2 -2
  61. package/dist/lib/cjs/{datorama-akita-792b4d1d.js → datorama-akita-bb801820.js} +15 -5
  62. package/dist/lib/cjs/{event-tracking.service-6ae64142.js → event-tracking.service-fcc820f1.js} +1 -1
  63. package/dist/lib/cjs/loader.cjs.js +2 -2
  64. package/dist/lib/cjs/{manage-benefits.service-04883c9b.js → manage-benefits.service-f45b4602.js} +3 -3
  65. package/dist/lib/cjs/{role-management.service-120cb99a.js → role-management.service-2109723c.js} +2 -2
  66. package/dist/lib/esm/ap-ben-asset_15.entry.js +1 -1
  67. package/dist/lib/esm/ap-ben-benefit-card.entry.js +3 -3
  68. package/dist/lib/esm/ap-ben-benefit-list-item.entry.js +3 -3
  69. package/dist/lib/esm/ap-ben-benefit-url_10.entry.js +6 -6
  70. package/dist/lib/esm/ap-ben-benefits-list_3.entry.js +3 -3
  71. package/dist/lib/esm/ap-ben-benefits-page.entry.js +4 -4
  72. package/dist/lib/esm/ap-ben-confirm-dialog_4.entry.js +3 -3
  73. package/dist/lib/esm/ap-ben-edit-benefit-page_5.entry.js +4 -4
  74. package/dist/lib/esm/ap-ben-loading-page_2.entry.js +4 -4
  75. package/dist/lib/esm/ap-ben-oidc-callback-page.entry.js +2 -2
  76. package/dist/lib/esm/api-client-a68152b8.js +99 -0
  77. package/dist/lib/esm/{app-globals-aa396171.js → app-globals-2a868a4d.js} +1 -1
  78. package/dist/lib/esm/{authentication.service-05da74e1.js → authentication.service-905f97c2.js} +1 -1
  79. package/dist/lib/esm/benefits-app-host.entry.js +2 -2
  80. package/dist/lib/esm/{benefits-app.query-9179a170.js → benefits-app.query-bfee691f.js} +2 -2
  81. package/dist/lib/esm/{benefits.api-5ecab17a.js → benefits.api-806ca0bc.js} +1 -1
  82. package/dist/lib/esm/cars-calculator.js +2 -2
  83. package/dist/lib/esm/{datorama-akita-e42d9911.js → datorama-akita-d2413fd0.js} +15 -5
  84. package/dist/lib/esm/{event-tracking.service-bc65ac3b.js → event-tracking.service-8d44e7ac.js} +1 -1
  85. package/dist/lib/esm/loader.js +2 -2
  86. package/dist/lib/esm/{manage-benefits.service-08338cf7.js → manage-benefits.service-aca7df4c.js} +3 -3
  87. package/dist/lib/esm/{role-management.service-0e339b49.js → role-management.service-a7592363.js} +2 -2
  88. package/dist/lib/esm-es5/ap-ben-asset_15.entry.js +1 -1
  89. package/dist/lib/esm-es5/ap-ben-benefit-card.entry.js +1 -1
  90. package/dist/lib/esm-es5/ap-ben-benefit-list-item.entry.js +1 -1
  91. package/dist/lib/esm-es5/ap-ben-benefit-url_10.entry.js +1 -1
  92. package/dist/lib/esm-es5/ap-ben-benefits-list_3.entry.js +1 -1
  93. package/dist/lib/esm-es5/ap-ben-benefits-page.entry.js +1 -1
  94. package/dist/lib/esm-es5/ap-ben-confirm-dialog_4.entry.js +1 -1
  95. package/dist/lib/esm-es5/ap-ben-edit-benefit-page_5.entry.js +1 -1
  96. package/dist/lib/esm-es5/ap-ben-loading-page_2.entry.js +1 -1
  97. package/dist/lib/esm-es5/ap-ben-oidc-callback-page.entry.js +1 -1
  98. package/dist/lib/esm-es5/api-client-a68152b8.js +1 -0
  99. package/dist/lib/esm-es5/{app-globals-aa396171.js → app-globals-2a868a4d.js} +1 -1
  100. package/dist/lib/esm-es5/{authentication.service-05da74e1.js → authentication.service-905f97c2.js} +1 -1
  101. package/dist/lib/esm-es5/benefits-app-host.entry.js +1 -1
  102. package/dist/lib/esm-es5/{benefits-app.query-9179a170.js → benefits-app.query-bfee691f.js} +1 -1
  103. package/dist/lib/esm-es5/{benefits.api-5ecab17a.js → benefits.api-806ca0bc.js} +1 -1
  104. package/dist/lib/esm-es5/cars-calculator.js +1 -1
  105. package/dist/lib/esm-es5/{datorama-akita-e42d9911.js → datorama-akita-d2413fd0.js} +1 -1
  106. package/dist/lib/esm-es5/{event-tracking.service-bc65ac3b.js → event-tracking.service-8d44e7ac.js} +1 -1
  107. package/dist/lib/esm-es5/loader.js +1 -1
  108. package/dist/lib/esm-es5/{manage-benefits.service-08338cf7.js → manage-benefits.service-aca7df4c.js} +1 -1
  109. package/dist/lib/esm-es5/{role-management.service-0e339b49.js → role-management.service-a7592363.js} +1 -1
  110. package/package.json +7 -3
  111. package/dist/lib/cars-calculator/p-1bdb5093.entry.js +0 -1
  112. package/dist/lib/cars-calculator/p-307f91bf.system.entry.js +0 -1
  113. package/dist/lib/cars-calculator/p-56fb974f.entry.js +0 -1
  114. package/dist/lib/cars-calculator/p-69cf2679.system.js +0 -1
  115. package/dist/lib/cars-calculator/p-dc58dd5c.js +0 -1
  116. package/dist/lib/cars-calculator/p-df0a267a.js +0 -1
  117. package/dist/lib/cjs/api-client-a3c12426.js +0 -107
  118. package/dist/lib/esm/api-client-8974d2bd.js +0 -99
  119. package/dist/lib/esm-es5/api-client-8974d2bd.js +0 -1
@@ -0,0 +1 @@
1
+ var __extends=this&&this.__extends||function(){var t=function(e,r){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=e[r]};return t(e,r)};return function(e,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();var __awaiter=this&&this.__awaiter||function(t,e,r,n){function o(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function c(t){try{f(n["throw"](t))}catch(t){i(t)}}function f(t){t.done?r(t.value):o(t.value).then(u,c)}f((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(t){return function(e){return f([t,e])}}function f(u){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:r.label++;return{value:u[1],done:false};case 5:r.label++;o=u[1];u=[0];continue;case 7:u=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1];i=u;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(u);break}if(i[2])r.ops.pop();r.trys.pop();continue}u=e.call(t,r)}catch(t){u=[6,t];o=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-9a8c9350.system.js","./p-0045ce79.system.js","./p-19b00569.system.js"],(function(t){"use strict";var e,r,n,o,i,u,c;return{setters:[function(t){e=t.b;r=t.n;n=t.i;o=t.f},function(t){i=t.g},function(t){u=t.S;c=t.a}],execute:function(){var f=function(){function t(){}t.prototype.getUserProfile=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,vt.instance.url("users/self").get().json()];case 1:return[2,t.sent()]}}))}))};t.prototype.getBasicProfileByEmail=function(t){return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){switch(n.label){case 0:return[4,vt.instance.url("users?email="+t).get().notFound((function(){return null})).json()];case 1:r=n.sent();return[2,e(r)]}}))}))};return t}();var a=t("u",new f);var l=function(){function t(){}t.toDomain=function(t){return{basicProfile:t.basicProfile,benefitsProfile:t.benefitsProfile}};return t}();t("U",l);function s(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function p(t){return!!t&&!!t[Z]}function y(t){return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var r=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===tt}(t)||Array.isArray(t)||!!t[Y]||!!t.constructor[Y]||_(t)||O(t))}function d(t,e,r){void 0===r&&(r=!1),0===v(t)?(r?Object.keys:et)(t).forEach((function(n){r&&"symbol"==typeof n||e(n,t[n],t)})):t.forEach((function(r,n){return e(n,r,t)}))}function v(t){var e=t[Z];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:_(t)?2:O(t)?3:0}function h(t,e){return 2===v(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function b(t,e){return 2===v(t)?t.get(e):t[e]}function P(t,e,r){var n=v(t);2===n?t.set(e,r):3===n?(t.delete(e),t.add(r)):t[e]=r}function g(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function _(t){return q&&t instanceof Map}function O(t){return H&&t instanceof Set}function m(t){return t.o||t.t}function w(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=rt(t);delete e[Z];for(var r=et(e),n=0;n<r.length;n++){var o=r[n],i=e[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(e[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[o]})}return Object.create(Object.getPrototypeOf(t),e)}function j(t,e){return void 0===e&&(e=!1),A(t)||p(t)||!y(t)?t:(v(t)>1&&(t.set=t.add=t.clear=t.delete=I),Object.freeze(t),e&&d(t,(function(t,e){return j(e,!0)}),!0),t)}function I(){s(2)}function A(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function D(t){var e=nt[t];return e||s(18,t),e}function S(){return J}function x(t,e){e&&(D("Patches"),t.u=[],t.s=[],t.v=e)}function F(t){E(t),t.p.forEach(k),t.p=null}function E(t){t===J&&(J=t.l)}function R(t){return J={p:[],l:J,h:t,m:!0,_:0}}function k(t){var e=t[Z];0===e.i||1===e.i?e.j():e.O=!0}function U(t,e){e._=e.p.length;var r=e.p[0],n=void 0!==t&&t!==r;return e.h.g||D("ES5").S(e,t,n),n?(r[Z].P&&(F(e),s(4)),y(t)&&(t=z(e,t),e.l||K(e,t)),e.u&&D("Patches").M(r[Z],t,e.u,e.s)):t=z(e,r,[]),F(e),e.u&&e.v(e.u,e.s),t!==V?t:void 0}function z(t,e,r){if(A(e))return e;var n=e[Z];if(!n)return d(e,(function(o,i){return B(t,n,e,o,i,r)}),!0),e;if(n.A!==t)return e;if(!n.P)return K(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=w(n.k):n.o;d(3===n.i?new Set(o):o,(function(e,i){return B(t,n,o,e,i,r)})),K(t,o,!1),r&&t.u&&D("Patches").R(n,r,t.u,t.s)}return n.o}function B(t,e,r,n,o,i){if(p(o)){var u=z(t,o,i&&e&&3!==e.i&&!h(e.D,n)?i.concat(n):void 0);if(P(r,n,u),!p(u))return;t.m=!1}if(y(o)&&!A(o)){if(!t.h.F&&t._<1)return;z(t,o),e&&e.A.l||K(t,o)}}function K(t,e,r){void 0===r&&(r=!1),t.h.F&&t.m&&j(e,r)}function M(t,e){var r=t[Z];return(r?m(r):t)[e]}function C(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function N(t){t.P||(t.P=!0,t.l&&N(t.l))}function T(t){t.o||(t.o=w(t.t))}function W(t,e,r){var n=_(e)?D("MapSet").N(e,r):O(e)?D("MapSet").T(e,r):t.g?function(t,e){var r=Array.isArray(t),n={i:r?1:0,A:e?e.A:S(),P:!1,I:!1,D:{},l:e,t:t,k:null,o:null,j:null,C:!1},o=n,i=ot;r&&(o=[n],i=it);var u=Proxy.revocable(o,i),c=u.revoke,f=u.proxy;return n.k=f,n.j=c,f}(e,r):D("ES5").J(e,r);return(r?r.A:S()).p.push(n),n}function X(t){return p(t)||s(22,t),function t(e){if(!y(e))return e;var r,n=e[Z],o=v(e);if(n){if(!n.P&&(n.i<4||!D("ES5").K(n)))return n.t;n.I=!0,r=$(e,o),n.I=!1}else r=$(e,o);return d(r,(function(e,o){n&&b(n.t,e)===o||P(r,e,t(o))})),3===o?new Set(r):r}(t)}function $(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return w(t)}var G,J,L="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),q="undefined"!=typeof Map,H="undefined"!=typeof Set,Q="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,V=L?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),Y=L?Symbol.for("immer-draftable"):"__$immer_draftable",Z=L?Symbol.for("immer-state"):"__$immer_state",tt=""+Object.prototype.constructor,et="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,rt=Object.getOwnPropertyDescriptors||function(t){var e={};return et(t).forEach((function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)})),e},nt={},ot={get:function(t,e){if(e===Z)return t;var r=m(t);if(!h(r,e))return function(t,e,r){var n,o=C(e,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(t.k):void 0}(t,r,e);var n=r[e];return t.I||!y(n)?n:n===M(t.t,e)?(T(t),t.o[e]=W(t.A.h,n,t)):n},has:function(t,e){return e in m(t)},ownKeys:function(t){return Reflect.ownKeys(m(t))},set:function(t,e,r){var n=C(m(t),e);if(null==n?void 0:n.set)return n.set.call(t.k,r),!0;if(!t.P){var o=M(m(t),e),i=null==o?void 0:o[Z];if(i&&i.t===r)return t.o[e]=r,t.D[e]=!1,!0;if(g(r,o)&&(void 0!==r||h(t.t,e)))return!0;T(t),N(t)}return t.o[e]===r&&"number"!=typeof r&&(void 0!==r||e in t.o)||(t.o[e]=r,t.D[e]=!0,!0)},deleteProperty:function(t,e){return void 0!==M(t.t,e)||e in t.t?(t.D[e]=!1,T(t),N(t)):delete t.D[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=m(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n?{writable:!0,configurable:1!==t.i||"length"!==e,enumerable:n.enumerable,value:r[e]}:n},defineProperty:function(){s(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){s(12)}},it={};d(ot,(function(t,e){it[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),it.deleteProperty=function(t,e){return ot.deleteProperty.call(this,t[0],e)},it.set=function(t,e,r){return ot.set.call(this,t[0],e,r,t[0])};var ut=function(){function t(t){var e=this;this.g=Q,this.F=!0,this.produce=function(t,r,n){if("function"==typeof t&&"function"!=typeof r){var o=r;r=t;var i=e;return function(t){var e=this;void 0===t&&(t=o);for(var n=arguments.length,u=Array(n>1?n-1:0),c=1;c<n;c++)u[c-1]=arguments[c];return i.produce(t,(function(t){var n;return(n=r).call.apply(n,[e,t].concat(u))}))}}var u;if("function"!=typeof r&&s(6),void 0!==n&&"function"!=typeof n&&s(7),y(t)){var c=R(e),f=W(e,t,void 0),a=!0;try{u=r(f),a=!1}finally{a?F(c):E(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(t){return x(c,n),U(t,c)}),(function(t){throw F(c),t})):(x(c,n),U(u,c))}if(!t||"object"!=typeof t){if((u=r(t))===V)return;return void 0===u&&(u=t),e.F&&j(u,!0),u}s(21,t)},this.produceWithPatches=function(t,r){return"function"==typeof t?function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e.produceWithPatches(r,(function(e){return t.apply(void 0,[e].concat(o))}))}:[e.produce(t,r,(function(t,e){n=t,o=e})),n,o];var n,o},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var e=t.prototype;return e.createDraft=function(t){y(t)||s(8),p(t)&&(t=X(t));var e=R(this),r=W(this,t,void 0);return r[Z].C=!0,E(e),r},e.finishDraft=function(t,e){var r=t&&t[Z];var n=r.A;return x(n,e),U(void 0,n)},e.setAutoFreeze=function(t){this.F=t},e.setUseProxies=function(t){t&&!Q&&s(20),this.g=t},e.applyPatches=function(t,e){var r;for(r=e.length-1;r>=0;r--){var n=e[r];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}var o=D("Patches").$;return p(t)?o(t,e):this.produce(t,(function(t){return o(t,e.slice(r+1))}))},t}(),ct=new ut,ft=t("f",ct.produce);ct.produceWithPatches.bind(ct);ct.setAutoFreeze.bind(ct);ct.setUseProxies.bind(ct);ct.applyPatches.bind(ct);ct.createDraft.bind(ct);ct.finishDraft.bind(ct);var at=undefined&&undefined.__decorate||function(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,u;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")i=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)if(u=t[c])i=(o<3?u(i):o>3?u(e,r,i):u(e,r))||i;return o>3&&i&&Object.defineProperty(e,r,i),i};function lt(){return{user:r}}var st=function(t){__extends(e,t);function e(){return t.call(this,lt())||this}return e}(c);st=at([u({name:"benefits-app",resettable:true,producerFn:ft})],st);var pt=t("c",new st);var yt=function(){function t(){}Object.defineProperty(t,"profileId",{get:function(){if(n(this._profileId)){throw Error("ProfileId is missing.")}return this._profileId.value},set:function(t){this._profileId=e(t)},enumerable:false,configurable:true});Object.defineProperty(t,"accountId",{set:function(t){this._accountId=e(t)},enumerable:false,configurable:true});Object.defineProperty(t,"accountIdOrDefault",{get:function(){return i(this._accountId,"")},enumerable:false,configurable:true});t.prototype.loadSignedInUserProfileAsync=function(){return __awaiter(this,void 0,void 0,(function(){var r,n,o;return __generator(this,(function(i){switch(i.label){case 0:o=(n=l).toDomain;return[4,a.getUserProfile()];case 1:r=o.apply(n,[i.sent()]);t.accountId=r.basicProfile.accountId;pt.update((function(t){t.user=e(r)}));return[2]}}))}))};Object.defineProperty(t,"partnerIdOrDefault",{get:function(){return i(this._partnerId,"")},enumerable:false,configurable:true});return t}();t("a",yt);yt._profileId=r;yt._accountId=r;yt._partnerId=r;var dt=t("b",new yt);var vt=function(){function t(){}t.setParameters=function(t,e){this._apiBaseUrl=t;this._jwt=e};Object.defineProperty(t,"instance",{get:function(){return o(this._apiBaseUrl).headers({Authorization:"Bearer "+this._jwt,"X-PROFILE-ID":yt.profileId,"X-ACCOUNT-ID":yt.accountIdOrDefault,"X-PARTNER-ID":yt.partnerIdOrDefault})},enumerable:false,configurable:true});return t}();t("B",vt)}}}));
@@ -1 +1 @@
1
- import{r as s,h as t,g as e}from"./p-91e1cdd0.js";import{O as o}from"./p-556fdb43.js";import{b as r}from"./p-c35d387e.js";import"./p-df0a267a.js";import"./p-2c9dd7c4.js";import"./p-7ad92407.js";import"./p-066d8e7b.js";import"./p-ea120e31.js";import"./p-054d1471.js";import"./p-f63d9d89.js";const i=class{constructor(t){s(this,t)}render(){if(this.benefits)return t("div",{class:"list-group"},this.benefits.map((s=>t("ap-ben-benefit-list-item",{class:"list-group-item px-4 py-2",benefitWithId:s}))))}},a=class{constructor(t){s(this,t),this.shopifyUrl=o.none}render(){return t("div",{class:"card fl-card-background border-0 mb-4 py-0"},t("a",{target:"_blank",rel:"noopener noreferrer",href:o.toUndefined(this.shopifyUrl),class:"text-reset text-decoration-none",onClick:()=>r.trackPageViewedAsync({pageId:"discounts"})},t("div",{class:"card-body p-0"},t("div",{class:"row m-0"},t("div",{class:"col-12 col-lg-6 col-xl-7 px-3"},t("div",{class:"pl-lg-5 pl-2 pt-lg-4 pt-sm-0 pt-xs-0"},t("h1",{class:"font-weight-bold my-4"},"Access exclusive discounts and vouchers."),t("p",{class:"mb-4"},"Choose from leading retailers including Woolworths, JB Hi-Fi, Caltex and Hoyts Cinemas."),t("a",{target:"_blank",rel:"noopener noreferrer",class:"btn btn-light bg-white mb-4 px-3 py-2"},t("h6",{class:"m-0"},"Browse discounts")))),t("div",{class:"col-6 d-none d-lg-block col-xl-4 ml-auto overflow-hidden text-right p-0 rounded"},t("img",{src:e("./assets/Hero_Background.png"),class:"fl-logo-container h-100"}))))))}static get assetsDirs(){return["assets"]}};a.style="ap-ben-hero-banner .card.fl-card-background{background-color:#febd55}ap-ben-hero-banner .fl-logo-container{-o-object-fit:contain;object-fit:contain;position:absolute;left:0}";const n=class{constructor(t){s(this,t)}render(){if(this.benefits)return t("div",{class:"list-group list-group-horizontal-md mb-4"},this.benefits.map((s=>t("a",{href:"#",class:"list-group-item list-group-item-action p-4"},t("ap-ben-benefit-card",{key:s.benefitId,benefitWithId:s})))))}};export{i as ap_ben_benefits_list,a as ap_ben_hero_banner,n as ap_ben_promoted_benefits}
1
+ import{r as s,h as t,g as e}from"./p-91e1cdd0.js";import{O as o}from"./p-556fdb43.js";import{b as r}from"./p-d14b00d9.js";import"./p-7062880e.js";import"./p-2c9dd7c4.js";import"./p-7ad92407.js";import"./p-f3effa5d.js";import"./p-ea120e31.js";import"./p-054d1471.js";import"./p-f63d9d89.js";const i=class{constructor(t){s(this,t)}render(){if(this.benefits)return t("div",{class:"list-group"},this.benefits.map((s=>t("ap-ben-benefit-list-item",{class:"list-group-item px-4 py-2",benefitWithId:s}))))}},a=class{constructor(t){s(this,t),this.shopifyUrl=o.none}render(){return t("div",{class:"card fl-card-background border-0 mb-4 py-0"},t("a",{target:"_blank",rel:"noopener noreferrer",href:o.toUndefined(this.shopifyUrl),class:"text-reset text-decoration-none",onClick:()=>r.trackPageViewedAsync({pageId:"discounts"})},t("div",{class:"card-body p-0"},t("div",{class:"row m-0"},t("div",{class:"col-12 col-lg-6 col-xl-7 px-3"},t("div",{class:"pl-lg-5 pl-2 pt-lg-4 pt-sm-0 pt-xs-0"},t("h1",{class:"font-weight-bold my-4"},"Access exclusive discounts and vouchers."),t("p",{class:"mb-4"},"Choose from leading retailers including Woolworths, JB Hi-Fi, Caltex and Hoyts Cinemas."),t("a",{target:"_blank",rel:"noopener noreferrer",class:"btn btn-light bg-white mb-4 px-3 py-2"},t("h6",{class:"m-0"},"Browse discounts")))),t("div",{class:"col-6 d-none d-lg-block col-xl-4 ml-auto overflow-hidden text-right p-0 rounded"},t("img",{src:e("./assets/Hero_Background.png"),class:"fl-logo-container h-100"}))))))}static get assetsDirs(){return["assets"]}};a.style="ap-ben-hero-banner .card.fl-card-background{background-color:#febd55}ap-ben-hero-banner .fl-logo-container{-o-object-fit:contain;object-fit:contain;position:absolute;left:0}";const n=class{constructor(t){s(this,t)}render(){if(this.benefits)return t("div",{class:"list-group list-group-horizontal-md mb-4"},this.benefits.map((s=>t("a",{href:"#",class:"list-group-item list-group-item-action p-4"},t("ap-ben-benefit-card",{key:s.benefitId,benefitWithId:s})))))}};export{i as ap_ben_benefits_list,a as ap_ben_hero_banner,n as ap_ben_promoted_benefits}
@@ -1,4 +1,4 @@
1
- import{O as t,c as n,a as i,g as r}from"./p-556fdb43.js";import{n as e,c as o,s,f as u,i as a}from"./p-2c9dd7c4.js";import{S as f,a as h,Q as c}from"./p-066d8e7b.js";class v{constructor(t){this.factory=t,this._value=e}get value(){if(o(this._value))return this._value.value;const t=this.factory();return this._value=s(t),t}}var l;!function(t){t[t.Unauthorized=0]="Unauthorized",t[t.SignInPending=1]="SignInPending",t[t.Authenticated=2]="Authenticated",t[t.SignOutPending=3]="SignOutPending",t[t.Error=4]="Error"}(l||(l={}));let d=class extends h{constructor(){super({authenticationState:l.Unauthorized,jwt:e,appConfiguration:e})}};d=function(t,n,i,r){var e,o=arguments.length,s=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,n,i,r);else for(var u=t.length-1;u>=0;u--)(e=t[u])&&(s=(o<3?e(s):o>3?e(n,i,s):e(n,i))||s);return o>3&&s&&Object.defineProperty(n,i,s),s}([f({name:"benefits-host",resettable:!0})],d);const F=new d,p=new class{constructor(){this._appRootUrl=new v((()=>this.resolveRootUrl())),this.getAppRootUrl=(t=!0)=>this._appRootUrl.value+(t?"/":""),this.getAppHostUrl=()=>`${window.location.origin}${this.getAppRootUrl()}`.replace(/\/$/,"")}async loadConfigurationAsync(n){const i=await u(n).get().json();F.update({appConfiguration:t.fromNullable(i)})}resolveRootUrl(){const n=t.fromNullable(window.location.pathname.match(/^\/benefits\/embed\/v1.0\/web/));if(t.isNone(n))throw Error("Unsupported host URL");return n.value[0]}},w=r(n((function(t){t.exports=function(t){var n={};function i(r){if(n[r])return n[r].exports;var e=n[r]={i:r,l:!1,exports:{}};return t[r].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=t,i.c=n,i.d=function(t,n,r){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,n){if(1&n&&(t=i(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)i.d(r,e,function(n){return t[n]}.bind(null,e));return r},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=22)}([function(t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),r={debug:function(){},info:function(){},warn:function(){},error:function(){}},e=void 0,o=void 0;(n.Log=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.reset=function(){o=3,e=r},t.debug=function(){if(o>=4){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.debug.apply(e,Array.from(n))}},t.info=function(){if(o>=3){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.info.apply(e,Array.from(n))}},t.warn=function(){if(o>=2){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.warn.apply(e,Array.from(n))}},t.error=function(){if(o>=1){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.error.apply(e,Array.from(n))}},i(t,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 o},set:function(t){if(!(0<=t&&t<=4))throw new Error("Invalid log level");o=t}},{key:"logger",get:function(){return e},set:function(t){if(!t.debug&&t.info&&(t.debug=t.info),!(t.debug&&t.info&&t.warn&&t.error))throw new Error("Invalid logger");e=t}}]),t}()).reset()},function(t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),r={setInterval:function(t){function n(n,i){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(t,n){return setInterval(t,n)})),clearInterval:function(t){function n(n){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(t){return clearInterval(t)}))},e=!1,o=null;n.Global=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t._testing=function(){e=!0},t.setXMLHttpRequest=function(t){o=t},i(t,null,[{key:"location",get:function(){if(!e)return location}},{key:"localStorage",get:function(){if(!e&&"undefined"!=typeof window)return localStorage}},{key:"sessionStorage",get:function(){if(!e&&"undefined"!=typeof window)return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!e&&"undefined"!=typeof window)return o||XMLHttpRequest}},{key:"timer",get:function(){if(!e)return r}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.MetadataService=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(7);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var u=".well-known/openid-configuration";n.MetadataService=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!n)throw e.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=n,this._jsonService=new i(["application/jwk-set+json"])}return t.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function(){var t=this;return this._settings.metadata?(e.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(e.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(n){return e.Log.debug("MetadataService.getMetadata: json received"),t._settings.metadata=Object.assign({},t._settings.metadataSeed||{},n),t._settings.metadata}))):(e.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",t)},t.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},t.prototype._getMetadataProperty=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.Log.debug("MetadataService.getMetadataProperty for: "+t),this.getMetadata().then((function(i){if(e.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===i[t]){if(!0===n)return void e.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+t);throw e.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+t),new Error("Metadata does not contain property "+t)}return i[t]}))},t.prototype.getSigningKeys=function(){var t=this;return this._settings.signingKeys?(e.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(n){return e.Log.debug("MetadataService.getSigningKeys: jwks_uri received",n),t._jsonService.getJson(n).then((function(n){if(e.Log.debug("MetadataService.getSigningKeys: key set received",n),!n.keys)throw e.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return t._settings.signingKeys=n.keys,t._settings.signingKeys}))}))},r(t,[{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(u)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=u))),this._metadataUrl}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.UrlUtility=void 0;var r=i(0),e=i(1);n.UrlUtility=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.addQueryParam=function(t,n,i){return t.indexOf("?")<0&&(t+="?"),"?"!==t[t.length-1]&&(t+="&"),t+=encodeURIComponent(n),(t+="=")+encodeURIComponent(i)},t.parseUrlFragment=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.Global;"string"!=typeof t&&(t=i.location.href);var o=t.lastIndexOf(n);o>=0&&(t=t.substr(o+1)),"?"===n&&(o=t.indexOf("#"))>=0&&(t=t.substr(0,o));for(var s,u={},a=/([^&=]+)=([^&]*)/g,f=0;s=a.exec(t);)if(u[decodeURIComponent(s[1])]=decodeURIComponent(s[2].replace(/\+/g," ")),f++>50)return r.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var h in u)return u;return{}},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.JoseUtil=void 0;var r=i(26),e=function(t){return t&&t.__esModule?t:{default:t}}(i(33));n.JoseUtil=(0,e.default)({jws:r.jws,KeyUtil:r.KeyUtil,X509:r.X509,crypto:r.crypto,hextob64u:r.hextob64u,b64tohex:r.b64tohex,AllowedSigningAlgs:r.AllowedSigningAlgs})},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.OidcClientSettings=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),o=i(0),s=i(23),u=i(6),a=i(24),f=i(2);function h(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var c=".well-known/openid-configuration",v="id_token",l="openid",d="client_secret_post";n.OidcClientSettings=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.authority,e=n.metadataUrl,o=n.metadata,c=n.signingKeys,F=n.metadataSeed,p=n.client_id,w=n.client_secret,g=n.response_type,m=void 0===g?v:g,y=n.scope,E=void 0===y?l:y,S=n.redirect_uri,k=n.post_logout_redirect_uri,b=n.client_authentication,_=void 0===b?d:b,A=n.prompt,C=n.display,R=n.max_age,P=n.ui_locales,I=n.acr_values,T=n.resource,M=n.response_mode,j=n.filterProtocolClaims,N=void 0===j||j,D=n.loadUserInfo,U=void 0===D||D,B=n.staleStateAge,O=void 0===B?900:B,x=n.clockSkew,V=void 0===x?300:x,K=n.clockService,J=void 0===K?new s.ClockService:K,q=n.userInfoJwtIssuer,H=void 0===q?"OP":q,W=n.mergeClaims,$=void 0!==W&&W,z=n.stateStore,Y=void 0===z?new u.WebStorageStateStore:z,L=n.ResponseValidatorCtor,G=void 0===L?a.ResponseValidator:L,Z=n.MetadataServiceCtor,Q=void 0===Z?f.MetadataService:Z,X=n.extraQueryParams,tt=void 0===X?{}:X,nt=n.extraTokenParams,it=void 0===nt?{}:nt;h(this,t),this._authority=i,this._metadataUrl=e,this._metadata=o,this._metadataSeed=F,this._signingKeys=c,this._client_id=p,this._client_secret=w,this._response_type=m,this._scope=E,this._redirect_uri=S,this._post_logout_redirect_uri=k,this._client_authentication=_,this._prompt=A,this._display=C,this._max_age=R,this._ui_locales=P,this._acr_values=I,this._resource=T,this._response_mode=M,this._filterProtocolClaims=!!N,this._loadUserInfo=!!U,this._staleStateAge=O,this._clockSkew=V,this._clockService=J,this._userInfoJwtIssuer=H,this._mergeClaims=!!$,this._stateStore=Y,this._validator=new G(this),this._metadataService=new Q(this),this._extraQueryParams="object"===(void 0===tt?"undefined":r(tt))?tt:{},this._extraTokenParams="object"===(void 0===it?"undefined":r(it))?it:{}}return t.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},e(t,[{key:"client_id",get:function(){return this._client_id},set:function(t){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=t}},{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(t){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=t}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(c)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=c)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(t){this._metadata=t}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(t){this._metadataSeed=t}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(t){this._signingKeys=t}},{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(t){this._extraQueryParams="object"===(void 0===t?"undefined":r(t))?t:{}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(t){this._extraTokenParams="object"===(void 0===t?"undefined":r(t))?t:{}}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.WebStorageStateStore=void 0;var r=i(0),e=i(1);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.WebStorageStateStore=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.prefix,r=void 0===i?"oidc.":i,s=n.store,u=void 0===s?e.Global.localStorage:s;o(this,t),this._store=u,this._prefix=r}return t.prototype.set=function(t,n){return r.Log.debug("WebStorageStateStore.set",t),this._store.setItem(t=this._prefix+t,n),Promise.resolve()},t.prototype.get=function(t){r.Log.debug("WebStorageStateStore.get",t);var n=this._store.getItem(t=this._prefix+t);return Promise.resolve(n)},t.prototype.remove=function(t){r.Log.debug("WebStorageStateStore.remove",t);var n=this._store.getItem(t=this._prefix+t);return this._store.removeItem(t),Promise.resolve(n)},t.prototype.getAllKeys=function(){r.Log.debug("WebStorageStateStore.getAllKeys");for(var t=[],n=0;n<this._store.length;n++){var i=this._store.key(n);0===i.indexOf(this._prefix)&&t.push(i.substr(this._prefix.length))}return Promise.resolve(t)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.JsonService=void 0;var r=i(0),e=i(1);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.JsonService=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.Global.XMLHttpRequest,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),this._contentTypes=n&&Array.isArray(n)?n.slice():[],this._contentTypes.push("application/json"),r&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=i,this._jwtHandler=r}return t.prototype.getJson=function(t,n){var i=this;if(!t)throw r.Log.error("JsonService.getJson: No url passed"),new Error("url");return r.Log.debug("JsonService.getJson, url: ",t),new Promise((function(e,o){var s=new i._XMLHttpRequest;s.open("GET",t);var u=i._contentTypes,a=i._jwtHandler;s.onload=function(){if(r.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var n=s.getResponseHeader("Content-Type");if(n){var i=u.find((function(t){if(n.startsWith(t))return!0}));if("application/jwt"==i)return void a(s).then(e,o);if(i)try{return void e(JSON.parse(s.responseText))}catch(t){return r.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}}o(Error("Invalid response Content-Type: "+n+", from URL: "+t))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){r.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},n&&(r.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+n)),s.send()}))},t.prototype.postForm=function(t,n,i){var e=this;if(!t)throw r.Log.error("JsonService.postForm: No url passed"),new Error("url");return r.Log.debug("JsonService.postForm, url: ",t),new Promise((function(o,s){var u=new e._XMLHttpRequest;u.open("POST",t);var a=e._contentTypes;u.onload=function(){if(r.Log.debug("JsonService.postForm: HTTP response received, status",u.status),200!==u.status){if(400===u.status&&(i=u.getResponseHeader("Content-Type"))&&a.find((function(t){if(i.startsWith(t))return!0})))try{var n=JSON.parse(u.responseText);if(n&&n.error)return r.Log.error("JsonService.postForm: Error from server: ",n.error),void s(new Error(n.error))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error(u.statusText+" ("+u.status+")"))}else{var i;if((i=u.getResponseHeader("Content-Type"))&&a.find((function(t){if(i.startsWith(t))return!0})))try{return void o(JSON.parse(u.responseText))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error("Invalid response Content-Type: "+i+", from URL: "+t))}},u.onerror=function(){r.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var f="";for(var h in n){var c=n[h];c&&(f.length>0&&(f+="&"),f+=encodeURIComponent(h),f+="=",f+=encodeURIComponent(c))}u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==i&&u.setRequestHeader("Authorization","Basic "+btoa(i)),u.send(f)}))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SigninRequest=void 0;var r=i(0),e=i(3),o=i(13);n.SigninRequest=function(){function t(n){var i=n.url,s=n.client_id,u=n.redirect_uri,a=n.response_type,f=n.scope,h=n.authority,c=n.data,v=n.prompt,l=n.display,d=n.max_age,F=n.ui_locales,p=n.id_token_hint,w=n.login_hint,g=n.acr_values,m=n.resource,y=n.response_mode,E=n.request,S=n.request_uri,k=n.extraQueryParams,b=n.request_type,_=n.client_secret,A=n.extraTokenParams,C=n.skipUserInfo;if(function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),!i)throw r.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw r.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!u)throw r.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!a)throw r.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!f)throw r.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!h)throw r.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var R=t.isOidc(a),P=t.isCode(a);y||(y=t.isCode(a)?"query":null),this.state=new o.SigninState({nonce:R,data:c,client_id:s,authority:h,redirect_uri:u,code_verifier:P,request_type:b,response_mode:y,client_secret:_,scope:f,extraTokenParams:A,skipUserInfo:C}),i=e.UrlUtility.addQueryParam(i,"client_id",s),i=e.UrlUtility.addQueryParam(i,"redirect_uri",u),i=e.UrlUtility.addQueryParam(i,"response_type",a),i=e.UrlUtility.addQueryParam(i,"scope",f),i=e.UrlUtility.addQueryParam(i,"state",this.state.id),R&&(i=e.UrlUtility.addQueryParam(i,"nonce",this.state.nonce)),P&&(i=e.UrlUtility.addQueryParam(i,"code_challenge",this.state.code_challenge),i=e.UrlUtility.addQueryParam(i,"code_challenge_method","S256"));var I={prompt:v,display:l,max_age:d,ui_locales:F,id_token_hint:p,login_hint:w,acr_values:g,resource:m,request:E,request_uri:S,response_mode:y};for(var T in I)I[T]&&(i=e.UrlUtility.addQueryParam(i,T,I[T]));for(var M in k)i=e.UrlUtility.addQueryParam(i,M,k[M]);this.url=i}return t.isOidc=function(t){return!!t.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function(t){return!!t.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t.isCode=function(t){return!!t.split(/\s+/g).filter((function(t){return"code"===t}))[0]},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.State=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=function(t){return t&&t.__esModule?t:{default:t}}(i(14));function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.State=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.id,r=n.data,e=n.created,u=n.request_type;s(this,t),this._id=i||(0,o.default)(),this._data=r,this._created="number"==typeof e&&e>0?e:parseInt(Date.now()/1e3),this._request_type=u}return t.prototype.toStorageString=function(){return e.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function(n){return e.Log.debug("State.fromStorageString"),new t(JSON.parse(n))},t.clearStaleState=function(n,i){var r=Date.now()/1e3-i;return n.getAllKeys().then((function(i){e.Log.debug("State.clearStaleState: got keys",i);for(var o=[],s=function(s){var u=i[s];a=n.get(u).then((function(i){var o=!1;if(i)try{var s=t.fromStorageString(i);e.Log.debug("State.clearStaleState: got item from key: ",u,s.created),s.created<=r&&(o=!0)}catch(t){e.Log.error("State.clearStaleState: Error parsing state for key",u,t.message),o=!0}else e.Log.debug("State.clearStaleState: no item in storage for key: ",u),o=!0;if(o)return e.Log.debug("State.clearStaleState: removed item for key: ",u),n.remove(u)})),o.push(a)},u=0;u<i.length;u++){var a;s(u)}return e.Log.debug("State.clearStaleState: waiting on promise count:",o.length),Promise.all(o)}))},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.OidcClient=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(5),s=i(12),u=i(8),a=i(34),f=i(35),h=i(36),c=i(13),v=i(9);function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.OidcClient=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l(this,t),this._settings=n instanceof o.OidcClientSettings?n:new o.OidcClientSettings(n)}return t.prototype.createSigninRequest=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.response_type,r=n.scope,o=n.redirect_uri,s=n.data,a=n.state,f=n.prompt,h=n.display,c=n.max_age,v=n.ui_locales,l=n.id_token_hint,d=n.login_hint,F=n.acr_values,p=n.resource,w=n.request,g=n.request_uri,m=n.response_mode,y=n.extraQueryParams,E=n.extraTokenParams,S=n.request_type,k=n.skipUserInfo,b=arguments[1];e.Log.debug("OidcClient.createSigninRequest");var _=this._settings.client_id;r=r||this._settings.scope,o=o||this._settings.redirect_uri,f=f||this._settings.prompt,h=h||this._settings.display,c=c||this._settings.max_age,v=v||this._settings.ui_locales,F=F||this._settings.acr_values,p=p||this._settings.resource,m=m||this._settings.response_mode,y=y||this._settings.extraQueryParams,E=E||this._settings.extraTokenParams;var A=this._settings.authority;return u.SigninRequest.isCode(i=i||this._settings.response_type)&&"code"!==i?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(n){e.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",n);var C=new u.SigninRequest({url:n,client_id:_,redirect_uri:o,response_type:i,scope:r,data:s||a,authority:A,prompt:f,display:h,max_age:c,ui_locales:v,id_token_hint:l,login_hint:d,acr_values:F,resource:p,request:w,request_uri:g,extraQueryParams:y,extraTokenParams:E,request_type:S,response_mode:m,client_secret:t._settings.client_secret,skipUserInfo:k}),R=C.state;return(b=b||t._stateStore).set(R.id,R.toStorageString()).then((function(){return C}))}))},t.prototype.readSigninResponseState=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.Log.debug("OidcClient.readSigninResponseState");var r="query"===this._settings.response_mode||!this._settings.response_mode&&u.SigninRequest.isCode(this._settings.response_type),o=r?"?":"#",s=new a.SigninResponse(t,o);if(!s.state)return e.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));n=n||this._stateStore;var f=i?n.remove.bind(n):n.get.bind(n);return f(s.state).then((function(t){if(!t)throw e.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:c.SigninState.fromStorageString(t),response:s}}))},t.prototype.processSigninResponse=function(t,n){var i=this;return e.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(t,n,!0).then((function(t){var n=t.state,r=t.response;return e.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),i._validator.validateSigninResponse(n,r)}))},t.prototype.createSignoutRequest=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.id_token_hint,r=n.data,o=n.state,s=n.post_logout_redirect_uri,u=n.extraQueryParams,a=n.request_type,h=arguments[1];return e.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,u=u||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(n){if(!n)throw e.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");e.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",n);var c=new f.SignoutRequest({url:n,id_token_hint:i,post_logout_redirect_uri:s,data:r||o,extraQueryParams:u,request_type:a}),v=c.state;return v&&(e.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(h=h||t._stateStore).set(v.id,v.toStorageString())),c}))},t.prototype.readSignoutResponseState=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.Log.debug("OidcClient.readSignoutResponseState");var r=new h.SignoutResponse(t);if(!r.state)return e.Log.debug("OidcClient.readSignoutResponseState: No state in response"),r.error?(e.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",r.error),Promise.reject(new s.ErrorResponse(r))):Promise.resolve({state:void 0,response:r});var o=r.state;n=n||this._stateStore;var u=i?n.remove.bind(n):n.get.bind(n);return u(o).then((function(t){if(!t)throw e.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:v.State.fromStorageString(t),response:r}}))},t.prototype.processSignoutResponse=function(t,n){var i=this;return e.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(t,n,!0).then((function(t){var n=t.state,r=t.response;return n?(e.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),i._validator.validateSignoutResponse(n,r)):(e.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),r)}))},t.prototype.clearStaleState=function(t){return e.Log.debug("OidcClient.clearStaleState"),v.State.clearStaleState(t=t||this._stateStore,this.settings.staleStateAge)},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.TokenClient=void 0;var r=i(7),e=i(2),o=i(0);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.TokenClient=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService;if(s(this,t),!n)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=n,this._jsonService=new i,this._metadataService=new u(this._settings)}return t.prototype.exchangeCode=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(n=Object.assign({},n)).grant_type=n.grant_type||"authorization_code",n.client_id=n.client_id||this._settings.client_id,n.client_secret=n.client_secret||this._settings.client_secret,n.redirect_uri=n.redirect_uri||this._settings.redirect_uri;var i=void 0,r=n._client_authentication||this._settings._client_authentication;return delete n._client_authentication,n.code?n.redirect_uri?n.code_verifier?n.client_id?n.client_secret||"client_secret_basic"!=r?("client_secret_basic"==r&&(i=n.client_id+":"+n.client_secret,delete n.client_id,delete n.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),t._jsonService.postForm(r,n,i).then((function(t){return o.Log.debug("TokenClient.exchangeCode: response received"),t}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},t.prototype.exchangeRefreshToken=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(n=Object.assign({},n)).grant_type=n.grant_type||"refresh_token",n.client_id=n.client_id||this._settings.client_id,n.client_secret=n.client_secret||this._settings.client_secret;var i=void 0,r=n._client_authentication||this._settings._client_authentication;return delete n._client_authentication,n.refresh_token?n.client_id?("client_secret_basic"==r&&(i=n.client_id+":"+n.client_secret,delete n.client_id,delete n.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),t._jsonService.postForm(r,n,i).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),t}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorResponse=void 0;var r=i(0);function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}n.ErrorResponse=function(t){function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=i.error,u=i.error_description,a=i.error_uri,f=i.state,h=i.session_state;if(e(this,n),!s)throw r.Log.error("No error passed to ErrorResponse"),new Error("error");var c=o(this,t.call(this,u||s));return c.name="ErrorResponse",c.error=s,c.error_description=u,c.error_uri=a,c.state=f,c.session_state=h,c}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}(n,t),n}(Error)},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SigninState=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(9),s=i(4),u=function(t){return t&&t.__esModule?t:{default:t}}(i(14));function a(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}n.SigninState=function(t){function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.nonce,e=i.authority,o=i.client_id,h=i.redirect_uri,c=i.code_verifier,v=i.response_mode,l=i.client_secret,d=i.scope,F=i.extraTokenParams,p=i.skipUserInfo;a(this,n);var w=f(this,t.call(this,arguments[0]));if(!0===r?w._nonce=(0,u.default)():r&&(w._nonce=r),!0===c?w._code_verifier=(0,u.default)()+(0,u.default)()+(0,u.default)():c&&(w._code_verifier=c),w.code_verifier){var g=s.JoseUtil.hashString(w.code_verifier,"SHA256");w._code_challenge=s.JoseUtil.hexToBase64Url(g)}return w._redirect_uri=h,w._authority=e,w._client_id=o,w._response_mode=v,w._client_secret=l,w._scope=d,w._extraTokenParams=F,w._skipUserInfo=p,w}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}(n,t),n.prototype.toStorageString=function(){return e.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})},n.fromStorageString=function(t){return e.Log.debug("SigninState.fromStorageString"),new n(JSON.parse(t))},r(n,[{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}}]),n}(o.State)},function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){return("undefined"!=i&&null!==i&&void 0!==i.getRandomValues?r:e)().replace(/-/g,"")};var i="undefined"!=typeof window?window.crypto||window.msCrypto:null;function r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^i.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function e(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=n.default},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.User=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0);n.User=function(){function t(n){var i=n.id_token,r=n.session_state,e=n.access_token,o=n.refresh_token,s=n.token_type,u=n.scope,a=n.profile,f=n.expires_at,h=n.state;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.id_token=i,this.session_state=r,this.access_token=e,this.refresh_token=o,this.token_type=s,this.scope=u,this.profile=a,this.expires_at=f,this.state=h}return t.prototype.toStorageString=function(){return e.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})},t.fromStorageString=function(n){return e.Log.debug("User.fromStorageString"),new t(JSON.parse(n))},r(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var n=parseInt(t);if("number"==typeof n&&n>0){var i=parseInt(Date.now()/1e3);this.expires_at=i+n}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.AccessTokenEvents=void 0;var r=i(0),e=i(46);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.AccessTokenEvents=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.accessTokenExpiringNotificationTime,r=void 0===i?60:i,s=n.accessTokenExpiringTimer,u=void 0===s?new e.Timer("Access token expiring"):s,a=n.accessTokenExpiredTimer,f=void 0===a?new e.Timer("Access token expired"):a;o(this,t),this._accessTokenExpiringNotificationTime=r,this._accessTokenExpiring=u,this._accessTokenExpired=f}return t.prototype.load=function(t){if(t.access_token&&void 0!==t.expires_in){var n=t.expires_in;if(r.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",n),n>0){var i=n-this._accessTokenExpiringNotificationTime;i<=0&&(i=1),r.Log.debug("AccessTokenEvents.load: registering expiring timer in:",i),this._accessTokenExpiring.init(i)}else r.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var e=n+1;r.Log.debug("AccessTokenEvents.load: registering expired timer in:",e),this._accessTokenExpired.init(e)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function(){r.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.Event=void 0;var r=i(0);n.Event=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=n,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var n=this._callbacks.findIndex((function(n){return n===t}));n>=0&&this._callbacks.splice(n,1)},t.prototype.raise=function(){r.Log.debug("Event: Raising event: "+this._name);for(var t=0;t<this._callbacks.length;t++){var n;(n=this._callbacks)[t].apply(n,arguments)}},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SessionMonitor=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(19),s=i(1);function u(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.SessionMonitor=function(){function t(n){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(u(this,t),!n)throw e.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=n,this._CheckSessionIFrameCtor=r,this._timer=a,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?i._start(t):i._settings.monitorAnonymousSession&&i._userManager.querySessionStatus().then((function(t){var n={session_state:t.session_state};t.sub&&t.sid&&(n.profile={sub:t.sub,sid:t.sid}),i._start(n)})).catch((function(t){e.Log.error("SessionMonitor ctor: error from querySessionStatus:",t.message)}))})).catch((function(t){e.Log.error("SessionMonitor ctor: error from getUser:",t.message)})))}return t.prototype._start=function(t){var n=this,i=t.session_state;i&&(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,e.Log.debug("SessionMonitor._start: session_state:",i,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,e.Log.debug("SessionMonitor._start: session_state:",i,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(i):this._metadataService.getCheckSessionIframe().then((function(t){if(t){e.Log.debug("SessionMonitor._start: Initializing check session iframe");var r=n._client_id,o=n._checkSessionInterval,s=n._stopCheckSessionOnError;n._checkSessionIFrame=new n._CheckSessionIFrameCtor(n._callback.bind(n),r,t,o,s),n._checkSessionIFrame.load().then((function(){n._checkSessionIFrame.start(i)}))}else e.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){e.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function(){var t=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(e.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var n=this._timer.setInterval((function(){t._timer.clearInterval(n),t._userManager.querySessionStatus().then((function(n){var i={session_state:n.session_state};n.sub&&n.sid&&(i.profile={sub:n.sub,sid:n.sid}),t._start(i)})).catch((function(t){e.Log.error("SessionMonitor: error from querySessionStatus:",t.message)}))}),1e3)},t.prototype._callback=function(){var t=this;this._userManager.querySessionStatus().then((function(n){var i=!0;n?n.sub===t._sub?(i=!1,t._checkSessionIFrame.start(n.session_state),n.sid===t._sid?e.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",n.session_state):(e.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",n.session_state),t._userManager.events._raiseUserSessionChanged())):e.Log.debug("SessionMonitor._callback: Different subject signed into OP:",n.sub):e.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),i&&(t._sub?(e.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),t._userManager.events._raiseUserSignedOut()):(e.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),t._userManager.events._raiseUserSignedIn()))})).catch((function(n){t._sub&&(e.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",n.message),t._userManager.events._raiseUserSignedOut())}))},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.CheckSessionIFrame=void 0;var r=i(0);function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.CheckSessionIFrame=function(){function t(n,i,r,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e(this,t),this._callback=n,this._client_id=i,this._url=r,this._interval=o||2e3,this._stopOnError=s;var u=r.indexOf("/",r.indexOf("//")+2);this._frame_origin=r.substr(0,u),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=r}return t.prototype.load=function(){var t=this;return new Promise((function(n){t._frame.onload=function(){n()},window.document.body.appendChild(t._frame),t._boundMessageEvent=t._message.bind(t),window.addEventListener("message",t._boundMessageEvent,!1)}))},t.prototype._message=function(t){t.origin===this._frame_origin&&t.source===this._frame.contentWindow&&("error"===t.data?(r.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===t.data?(r.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):r.Log.debug("CheckSessionIFrame: "+t.data+" message from check session op iframe"))},t.prototype.start=function(t){var n=this;if(this._session_state!==t){r.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=t;var i=function(){n._frame.contentWindow.postMessage(n._client_id+" "+n._session_state,n._frame_origin)};i(),this._timer=window.setInterval(i,this._interval)}},t.prototype.stop=function(){this._session_state=null,this._timer&&(r.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.TokenRevocationClient=void 0;var r=i(0),e=i(2),o=i(1);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var u="access_token",a="refresh_token";n.TokenRevocationClient=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService;if(s(this,t),!n)throw r.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=n,this._XMLHttpRequestCtor=i,this._metadataService=new u(this._settings)}return t.prototype.revoke=function(t,n){var i=this,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!t)throw r.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(e!==u&&e!=a)throw r.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(o){if(o)return r.Log.debug("TokenRevocationClient.revoke: Revoking "+e),i._revoke(o,i._settings.client_id,i._settings.client_secret,t,e);if(n)throw r.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function(t,n,i,e,o){var s=this;return new Promise((function(u,a){var f=new s._XMLHttpRequestCtor;f.open("POST",t),f.onload=function(){r.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",f.status),200===f.status?u():a(Error(f.statusText+" ("+f.status+")"))},f.onerror=function(){r.Log.debug("TokenRevocationClient.revoke: Network Error."),a("Network Error")};var h="client_id="+encodeURIComponent(n);i&&(h+="&client_secret="+encodeURIComponent(i)),h+="&token_type_hint="+encodeURIComponent(o),h+="&token="+encodeURIComponent(e),f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(h)}))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.CordovaPopupWindow=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0);n.CordovaPopupWindow=function(){function t(n){var i=this;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,n){i._resolve=t,i._reject=n})),this.features=n.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=n.popupWindowTarget||"_blank",this.redirect_uri=n.startUrl,e.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return t.prototype._isInAppBrowserInstalled=function(t){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some((function(n){return t.hasOwnProperty(n)}))},t.prototype.navigate=function(t){if(t&&t.url){if(!window.cordova)return this._error("cordova is undefined");var n=window.cordova.require("cordova/plugin_list").metadata;if(!1===this._isInAppBrowserInstalled(n))return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(t.url,this.target,this.features),this._popup?(e.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},t.prototype._loadStartCallback=function(t){0===t.url.indexOf(this.redirect_uri)&&this._success({url:t.url})},t.prototype._exitCallback=function(t){this._error(t)},t.prototype._success=function(t){this._cleanup(),e.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),e.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._popup&&(e.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},r(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0});var r=i(0),e=i(10),o=i(5),s=i(6),u=i(37),a=i(38),f=i(16),h=i(2),c=i(48),v=i(49),l=i(19),d=i(20),F=i(18),p=i(1),w=i(15),g=i(50);n.default={Version:g.Version,Log:r.Log,OidcClient:e.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:u.InMemoryWebStorage,UserManager:a.UserManager,AccessTokenEvents:f.AccessTokenEvents,MetadataService:h.MetadataService,CordovaPopupNavigator:c.CordovaPopupNavigator,CordovaIFrameNavigator:v.CordovaIFrameNavigator,CheckSessionIFrame:l.CheckSessionIFrame,TokenRevocationClient:d.TokenRevocationClient,SessionMonitor:F.SessionMonitor,Global:p.Global,User:w.User},t.exports=n.default},function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ClockService=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.ResponseValidator=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=i(0),o=i(2),s=i(25),u=i(11),a=i(12),f=i(4);function h(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var c=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];n.ResponseValidator=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.JoseUtil,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:u.TokenClient;if(h(this,t),!n)throw e.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=n,this._metadataService=new i(this._settings),this._userInfoService=new r(this._settings),this._joseUtil=a,this._tokenClient=new c(this._settings)}return t.prototype.validateSigninResponse=function(t,n){var i=this;return e.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(t,n).then((function(n){return e.Log.debug("ResponseValidator.validateSigninResponse: state processed"),i._validateTokens(t,n).then((function(n){return e.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),i._processClaims(t,n).then((function(t){return e.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function(t,n){return t.id!==n.state?(e.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(e.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),n.state=t.data,n.error?(e.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",n.error),Promise.reject(new a.ErrorResponse(n))):Promise.resolve(n))},t.prototype._processSigninParams=function(t,n){if(t.id!==n.state)return e.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!t.client_id)return e.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!t.authority)return e.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!==t.authority)return e.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=t.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==t.client_id)return e.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=t.client_id;return e.Log.debug("ResponseValidator._processSigninParams: state validated"),n.state=t.data,n.error?(e.Log.warn("ResponseValidator._processSigninParams: Response was error",n.error),Promise.reject(new a.ErrorResponse(n))):t.nonce&&!n.id_token?(e.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!t.nonce&&n.id_token?(e.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):t.code_verifier&&!n.code?(e.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!t.code_verifier&&n.code?(e.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(n.scope||(n.scope=t.scope),Promise.resolve(n))},t.prototype._processClaims=function(t,n){var i=this;if(n.isOpenIdConnect){if(e.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),n.profile=this._filterProtocolClaims(n.profile),!0!==t.skipUserInfo&&this._settings.loadUserInfo&&n.access_token)return e.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(n.access_token).then((function(t){return e.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),t.sub!==n.profile.sub?(e.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"))):(n.profile=i._mergeClaims(n.profile,t),e.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",n.profile),n)}));e.Log.debug("ResponseValidator._processClaims: not loading user info")}else e.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(n)},t.prototype._mergeClaims=function(t,n){var i=Object.assign({},t);for(var e in n){var o=n[e];Array.isArray(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];i[e]?Array.isArray(i[e])?i[e].indexOf(u)<0&&i[e].push(u):i[e]!==u&&(i[e]="object"===(void 0===u?"undefined":r(u))&&this._settings.mergeClaims?this._mergeClaims(i[e],u):[i[e],u]):i[e]=u}}return i},t.prototype._filterProtocolClaims=function(t){e.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",t);var n=Object.assign({},t);return this._settings._filterProtocolClaims?(c.forEach((function(t){delete n[t]})),e.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",n)):e.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),n},t.prototype._validateTokens=function(t,n){return n.code?(e.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(t,n)):n.id_token?n.access_token?(e.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(t,n)):(e.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(t,n)):(e.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(n))},t.prototype._processCode=function(t,n){var i=this,o={client_id:t.client_id,client_secret:t.client_secret,code:n.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier};return t.extraTokenParams&&"object"===r(t.extraTokenParams)&&Object.assign(o,t.extraTokenParams),this._tokenClient.exchangeCode(o).then((function(r){for(var o in r)n[o]=r[o];return n.id_token?(e.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),i._validateIdTokenAttributes(t,n)):(e.Log.debug("ResponseValidator._processCode: token response successful, returning response"),n)}))},t.prototype._validateIdTokenAttributes=function(t,n){var i=this;return this._metadataService.getIssuer().then((function(r){var o=t.client_id,s=i._settings.clockSkew;return e.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",s),i._settings.getEpochTime().then((function(u){return i._joseUtil.validateJwtAttributes(n.id_token,r,o,s,u).then((function(i){return t.nonce&&t.nonce!==i.nonce?(e.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):i.sub?(n.profile=i,n):(e.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},t.prototype._validateIdTokenAndAccessToken=function(t,n){var i=this;return this._validateIdToken(t,n).then((function(t){return i._validateAccessToken(t)}))},t.prototype._getSigningKeyForJwt=function(t){var n=this;return this._metadataService.getSigningKeys().then((function(i){var r=t.header.kid;if(!i)return e.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));e.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var o=void 0;if(r)o=i.filter((function(t){return t.kid===r}))[0];else{if((i=n._filterByAlg(i,t.header.alg)).length>1)return e.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"));o=i[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function(t){var n=this;return this._getSigningKeyForJwt(t).then((function(i){return i?Promise.resolve(i):(n._metadataService.resetSigningKeys(),n._getSigningKeyForJwt(t))}))},t.prototype._validateIdToken=function(t,n){var i=this;if(!t.nonce)return e.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var r=this._joseUtil.parseJwt(n.id_token);return r&&r.header&&r.payload?t.nonce!==r.payload.nonce?(e.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(o){return e.Log.debug("ResponseValidator._validateIdToken: Received issuer"),i._getSigningKeyForJwtWithSingleRetry(r).then((function(s){if(!s)return e.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 u=t.client_id,a=i._settings.clockSkew;return e.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",a),i._joseUtil.validateJwt(n.id_token,s,o,u,a).then((function(){return e.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),r.payload.sub?(n.profile=r.payload,n):(e.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(e.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",r),Promise.reject(new Error("Failed to parse id_token")))},t.prototype._filterByAlg=function(t,n){var i=null;if(n.startsWith("RS"))i="RSA";else if(n.startsWith("PS"))i="PS";else{if(!n.startsWith("ES"))return e.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",n),[];i="EC"}return e.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",i),t=t.filter((function(t){return t.kty===i})),e.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",i,t.length),t},t.prototype._validateAccessToken=function(t){if(!t.profile)return e.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!t.profile.at_hash)return e.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!t.id_token)return e.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var n=this._joseUtil.parseJwt(t.id_token);if(!n||!n.header)return e.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",n),Promise.reject(new Error("Failed to parse id_token"));var i=n.header.alg;if(!i||5!==i.length)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i),Promise.reject(new Error("Unsupported alg: "+i));var r=i.substr(2,3);if(!r)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i,r),Promise.reject(new Error("Unsupported alg: "+i));if(256!==(r=parseInt(r))&&384!==r&&512!==r)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i,r),Promise.reject(new Error("Unsupported alg: "+i));var o="sha"+r,s=this._joseUtil.hashString(t.access_token,o);if(!s)return e.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var u=s.substr(0,s.length/2),a=this._joseUtil.hexToBase64Url(u);return a!==t.profile.at_hash?(e.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",a,t.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(e.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(t))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.UserInfoService=void 0;var r=i(7),e=i(2),o=i(0),s=i(4);function u(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.UserInfoService=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(u(this,t),!n)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=n,this._jsonService=new i(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new a(this._settings),this._joseUtil=f}return t.prototype.getClaims=function(t){var n=this;return t?this._metadataService.getUserInfoEndpoint().then((function(i){return o.Log.debug("UserInfoService.getClaims: received userinfo url",i),n._jsonService.getJson(i,t).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t.prototype._getClaimsFromJwt=function t(n){var i=this;try{var r=this._joseUtil.parseJwt(n.responseText);if(!r||!r.header||!r.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",r),Promise.reject(new Error("Failed to parse id_token"));var e=r.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":s=this._metadataService.getIssuer();break;case"ANY":s=Promise.resolve(r.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(t){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+t),i._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var u=void 0;if(e)u=s.filter((function(t){return t.kid===e}))[0];else{if((s=i._filterByAlg(s,r.header.alg)).length>1)return o.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"));u=s[0]}if(!u)return o.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 a=i._settings.client_id,f=i._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",f),i._joseUtil.validateJwt(n.responseText,u,t,a,f,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),r.payload}))}))}))}catch(t){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",t.message),void reject(t)}},t.prototype._filterByAlg=function(t,n){var i=null;if(n.startsWith("RS"))i="RSA";else if(n.startsWith("PS"))i="PS";else{if(!n.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",n),[];i="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",i),t=t.filter((function(t){return t.kty===i})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",i,t.length),t},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.AllowedSigningAlgs=n.b64tohex=n.hextob64u=n.crypto=n.X509=n.KeyUtil=n.jws=void 0;var r=i(27);n.jws=r.jws,n.KeyUtil=r.KEYUTIL,n.X509=r.X509,n.crypto=r.crypto,n.hextob64u=r.hextob64u,n.b64tohex=r.b64tohex,n.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(t,n,i){(function(t){Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r={};
1
+ import{O as t,c as n,a as i,g as r}from"./p-556fdb43.js";import{n as e,c as o,s,f as u,i as a}from"./p-2c9dd7c4.js";import{S as f,a as h,Q as c}from"./p-f3effa5d.js";class v{constructor(t){this.factory=t,this._value=e}get value(){if(o(this._value))return this._value.value;const t=this.factory();return this._value=s(t),t}}var l;!function(t){t[t.Unauthorized=0]="Unauthorized",t[t.SignInPending=1]="SignInPending",t[t.Authenticated=2]="Authenticated",t[t.SignOutPending=3]="SignOutPending",t[t.Error=4]="Error"}(l||(l={}));let d=class extends h{constructor(){super({authenticationState:l.Unauthorized,jwt:e,appConfiguration:e})}};d=function(t,n,i,r){var e,o=arguments.length,s=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,n,i,r);else for(var u=t.length-1;u>=0;u--)(e=t[u])&&(s=(o<3?e(s):o>3?e(n,i,s):e(n,i))||s);return o>3&&s&&Object.defineProperty(n,i,s),s}([f({name:"benefits-host",resettable:!0})],d);const F=new d,p=new class{constructor(){this._appRootUrl=new v((()=>this.resolveRootUrl())),this.getAppRootUrl=(t=!0)=>this._appRootUrl.value+(t?"/":""),this.getAppHostUrl=()=>`${window.location.origin}${this.getAppRootUrl()}`.replace(/\/$/,"")}async loadConfigurationAsync(n){const i=await u(n).get().json();F.update({appConfiguration:t.fromNullable(i)})}resolveRootUrl(){const n=t.fromNullable(window.location.pathname.match(/^\/benefits\/embed\/v1.0\/web/));if(t.isNone(n))throw Error("Unsupported host URL");return n.value[0]}},w=r(n((function(t){t.exports=function(t){var n={};function i(r){if(n[r])return n[r].exports;var e=n[r]={i:r,l:!1,exports:{}};return t[r].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=t,i.c=n,i.d=function(t,n,r){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,n){if(1&n&&(t=i(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var e in t)i.d(r,e,function(n){return t[n]}.bind(null,e));return r},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=22)}([function(t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),r={debug:function(){},info:function(){},warn:function(){},error:function(){}},e=void 0,o=void 0;(n.Log=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.reset=function(){o=3,e=r},t.debug=function(){if(o>=4){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.debug.apply(e,Array.from(n))}},t.info=function(){if(o>=3){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.info.apply(e,Array.from(n))}},t.warn=function(){if(o>=2){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.warn.apply(e,Array.from(n))}},t.error=function(){if(o>=1){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];e.error.apply(e,Array.from(n))}},i(t,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 o},set:function(t){if(!(0<=t&&t<=4))throw new Error("Invalid log level");o=t}},{key:"logger",get:function(){return e},set:function(t){if(!t.debug&&t.info&&(t.debug=t.info),!(t.debug&&t.info&&t.warn&&t.error))throw new Error("Invalid logger");e=t}}]),t}()).reset()},function(t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),r={setInterval:function(t){function n(n,i){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(t,n){return setInterval(t,n)})),clearInterval:function(t){function n(n){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(t){return clearInterval(t)}))},e=!1,o=null;n.Global=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t._testing=function(){e=!0},t.setXMLHttpRequest=function(t){o=t},i(t,null,[{key:"location",get:function(){if(!e)return location}},{key:"localStorage",get:function(){if(!e&&"undefined"!=typeof window)return localStorage}},{key:"sessionStorage",get:function(){if(!e&&"undefined"!=typeof window)return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!e&&"undefined"!=typeof window)return o||XMLHttpRequest}},{key:"timer",get:function(){if(!e)return r}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.MetadataService=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(7);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var u=".well-known/openid-configuration";n.MetadataService=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!n)throw e.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=n,this._jsonService=new i(["application/jwk-set+json"])}return t.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function(){var t=this;return this._settings.metadata?(e.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(e.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(n){return e.Log.debug("MetadataService.getMetadata: json received"),t._settings.metadata=Object.assign({},t._settings.metadataSeed||{},n),t._settings.metadata}))):(e.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",t)},t.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},t.prototype._getMetadataProperty=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.Log.debug("MetadataService.getMetadataProperty for: "+t),this.getMetadata().then((function(i){if(e.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===i[t]){if(!0===n)return void e.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+t);throw e.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+t),new Error("Metadata does not contain property "+t)}return i[t]}))},t.prototype.getSigningKeys=function(){var t=this;return this._settings.signingKeys?(e.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(n){return e.Log.debug("MetadataService.getSigningKeys: jwks_uri received",n),t._jsonService.getJson(n).then((function(n){if(e.Log.debug("MetadataService.getSigningKeys: key set received",n),!n.keys)throw e.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return t._settings.signingKeys=n.keys,t._settings.signingKeys}))}))},r(t,[{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(u)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=u))),this._metadataUrl}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.UrlUtility=void 0;var r=i(0),e=i(1);n.UrlUtility=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.addQueryParam=function(t,n,i){return t.indexOf("?")<0&&(t+="?"),"?"!==t[t.length-1]&&(t+="&"),t+=encodeURIComponent(n),(t+="=")+encodeURIComponent(i)},t.parseUrlFragment=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.Global;"string"!=typeof t&&(t=i.location.href);var o=t.lastIndexOf(n);o>=0&&(t=t.substr(o+1)),"?"===n&&(o=t.indexOf("#"))>=0&&(t=t.substr(0,o));for(var s,u={},a=/([^&=]+)=([^&]*)/g,f=0;s=a.exec(t);)if(u[decodeURIComponent(s[1])]=decodeURIComponent(s[2].replace(/\+/g," ")),f++>50)return r.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var h in u)return u;return{}},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.JoseUtil=void 0;var r=i(26),e=function(t){return t&&t.__esModule?t:{default:t}}(i(33));n.JoseUtil=(0,e.default)({jws:r.jws,KeyUtil:r.KeyUtil,X509:r.X509,crypto:r.crypto,hextob64u:r.hextob64u,b64tohex:r.b64tohex,AllowedSigningAlgs:r.AllowedSigningAlgs})},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.OidcClientSettings=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),o=i(0),s=i(23),u=i(6),a=i(24),f=i(2);function h(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var c=".well-known/openid-configuration",v="id_token",l="openid",d="client_secret_post";n.OidcClientSettings=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.authority,e=n.metadataUrl,o=n.metadata,c=n.signingKeys,F=n.metadataSeed,p=n.client_id,w=n.client_secret,g=n.response_type,m=void 0===g?v:g,y=n.scope,E=void 0===y?l:y,S=n.redirect_uri,k=n.post_logout_redirect_uri,b=n.client_authentication,_=void 0===b?d:b,A=n.prompt,C=n.display,R=n.max_age,P=n.ui_locales,I=n.acr_values,T=n.resource,M=n.response_mode,j=n.filterProtocolClaims,N=void 0===j||j,D=n.loadUserInfo,U=void 0===D||D,B=n.staleStateAge,O=void 0===B?900:B,x=n.clockSkew,V=void 0===x?300:x,K=n.clockService,J=void 0===K?new s.ClockService:K,q=n.userInfoJwtIssuer,H=void 0===q?"OP":q,W=n.mergeClaims,$=void 0!==W&&W,z=n.stateStore,Y=void 0===z?new u.WebStorageStateStore:z,L=n.ResponseValidatorCtor,G=void 0===L?a.ResponseValidator:L,Z=n.MetadataServiceCtor,Q=void 0===Z?f.MetadataService:Z,X=n.extraQueryParams,tt=void 0===X?{}:X,nt=n.extraTokenParams,it=void 0===nt?{}:nt;h(this,t),this._authority=i,this._metadataUrl=e,this._metadata=o,this._metadataSeed=F,this._signingKeys=c,this._client_id=p,this._client_secret=w,this._response_type=m,this._scope=E,this._redirect_uri=S,this._post_logout_redirect_uri=k,this._client_authentication=_,this._prompt=A,this._display=C,this._max_age=R,this._ui_locales=P,this._acr_values=I,this._resource=T,this._response_mode=M,this._filterProtocolClaims=!!N,this._loadUserInfo=!!U,this._staleStateAge=O,this._clockSkew=V,this._clockService=J,this._userInfoJwtIssuer=H,this._mergeClaims=!!$,this._stateStore=Y,this._validator=new G(this),this._metadataService=new Q(this),this._extraQueryParams="object"===(void 0===tt?"undefined":r(tt))?tt:{},this._extraTokenParams="object"===(void 0===it?"undefined":r(it))?it:{}}return t.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},e(t,[{key:"client_id",get:function(){return this._client_id},set:function(t){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=t}},{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(t){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=t}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(c)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=c)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(t){this._metadata=t}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(t){this._metadataSeed=t}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(t){this._signingKeys=t}},{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(t){this._extraQueryParams="object"===(void 0===t?"undefined":r(t))?t:{}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(t){this._extraTokenParams="object"===(void 0===t?"undefined":r(t))?t:{}}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.WebStorageStateStore=void 0;var r=i(0),e=i(1);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.WebStorageStateStore=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.prefix,r=void 0===i?"oidc.":i,s=n.store,u=void 0===s?e.Global.localStorage:s;o(this,t),this._store=u,this._prefix=r}return t.prototype.set=function(t,n){return r.Log.debug("WebStorageStateStore.set",t),this._store.setItem(t=this._prefix+t,n),Promise.resolve()},t.prototype.get=function(t){r.Log.debug("WebStorageStateStore.get",t);var n=this._store.getItem(t=this._prefix+t);return Promise.resolve(n)},t.prototype.remove=function(t){r.Log.debug("WebStorageStateStore.remove",t);var n=this._store.getItem(t=this._prefix+t);return this._store.removeItem(t),Promise.resolve(n)},t.prototype.getAllKeys=function(){r.Log.debug("WebStorageStateStore.getAllKeys");for(var t=[],n=0;n<this._store.length;n++){var i=this._store.key(n);0===i.indexOf(this._prefix)&&t.push(i.substr(this._prefix.length))}return Promise.resolve(t)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.JsonService=void 0;var r=i(0),e=i(1);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.JsonService=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.Global.XMLHttpRequest,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),this._contentTypes=n&&Array.isArray(n)?n.slice():[],this._contentTypes.push("application/json"),r&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=i,this._jwtHandler=r}return t.prototype.getJson=function(t,n){var i=this;if(!t)throw r.Log.error("JsonService.getJson: No url passed"),new Error("url");return r.Log.debug("JsonService.getJson, url: ",t),new Promise((function(e,o){var s=new i._XMLHttpRequest;s.open("GET",t);var u=i._contentTypes,a=i._jwtHandler;s.onload=function(){if(r.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var n=s.getResponseHeader("Content-Type");if(n){var i=u.find((function(t){if(n.startsWith(t))return!0}));if("application/jwt"==i)return void a(s).then(e,o);if(i)try{return void e(JSON.parse(s.responseText))}catch(t){return r.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}}o(Error("Invalid response Content-Type: "+n+", from URL: "+t))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){r.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},n&&(r.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+n)),s.send()}))},t.prototype.postForm=function(t,n,i){var e=this;if(!t)throw r.Log.error("JsonService.postForm: No url passed"),new Error("url");return r.Log.debug("JsonService.postForm, url: ",t),new Promise((function(o,s){var u=new e._XMLHttpRequest;u.open("POST",t);var a=e._contentTypes;u.onload=function(){if(r.Log.debug("JsonService.postForm: HTTP response received, status",u.status),200!==u.status){if(400===u.status&&(i=u.getResponseHeader("Content-Type"))&&a.find((function(t){if(i.startsWith(t))return!0})))try{var n=JSON.parse(u.responseText);if(n&&n.error)return r.Log.error("JsonService.postForm: Error from server: ",n.error),void s(new Error(n.error))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error(u.statusText+" ("+u.status+")"))}else{var i;if((i=u.getResponseHeader("Content-Type"))&&a.find((function(t){if(i.startsWith(t))return!0})))try{return void o(JSON.parse(u.responseText))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error("Invalid response Content-Type: "+i+", from URL: "+t))}},u.onerror=function(){r.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var f="";for(var h in n){var c=n[h];c&&(f.length>0&&(f+="&"),f+=encodeURIComponent(h),f+="=",f+=encodeURIComponent(c))}u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==i&&u.setRequestHeader("Authorization","Basic "+btoa(i)),u.send(f)}))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SigninRequest=void 0;var r=i(0),e=i(3),o=i(13);n.SigninRequest=function(){function t(n){var i=n.url,s=n.client_id,u=n.redirect_uri,a=n.response_type,f=n.scope,h=n.authority,c=n.data,v=n.prompt,l=n.display,d=n.max_age,F=n.ui_locales,p=n.id_token_hint,w=n.login_hint,g=n.acr_values,m=n.resource,y=n.response_mode,E=n.request,S=n.request_uri,k=n.extraQueryParams,b=n.request_type,_=n.client_secret,A=n.extraTokenParams,C=n.skipUserInfo;if(function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),!i)throw r.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw r.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!u)throw r.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!a)throw r.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!f)throw r.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!h)throw r.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var R=t.isOidc(a),P=t.isCode(a);y||(y=t.isCode(a)?"query":null),this.state=new o.SigninState({nonce:R,data:c,client_id:s,authority:h,redirect_uri:u,code_verifier:P,request_type:b,response_mode:y,client_secret:_,scope:f,extraTokenParams:A,skipUserInfo:C}),i=e.UrlUtility.addQueryParam(i,"client_id",s),i=e.UrlUtility.addQueryParam(i,"redirect_uri",u),i=e.UrlUtility.addQueryParam(i,"response_type",a),i=e.UrlUtility.addQueryParam(i,"scope",f),i=e.UrlUtility.addQueryParam(i,"state",this.state.id),R&&(i=e.UrlUtility.addQueryParam(i,"nonce",this.state.nonce)),P&&(i=e.UrlUtility.addQueryParam(i,"code_challenge",this.state.code_challenge),i=e.UrlUtility.addQueryParam(i,"code_challenge_method","S256"));var I={prompt:v,display:l,max_age:d,ui_locales:F,id_token_hint:p,login_hint:w,acr_values:g,resource:m,request:E,request_uri:S,response_mode:y};for(var T in I)I[T]&&(i=e.UrlUtility.addQueryParam(i,T,I[T]));for(var M in k)i=e.UrlUtility.addQueryParam(i,M,k[M]);this.url=i}return t.isOidc=function(t){return!!t.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function(t){return!!t.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t.isCode=function(t){return!!t.split(/\s+/g).filter((function(t){return"code"===t}))[0]},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.State=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=function(t){return t&&t.__esModule?t:{default:t}}(i(14));function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.State=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.id,r=n.data,e=n.created,u=n.request_type;s(this,t),this._id=i||(0,o.default)(),this._data=r,this._created="number"==typeof e&&e>0?e:parseInt(Date.now()/1e3),this._request_type=u}return t.prototype.toStorageString=function(){return e.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function(n){return e.Log.debug("State.fromStorageString"),new t(JSON.parse(n))},t.clearStaleState=function(n,i){var r=Date.now()/1e3-i;return n.getAllKeys().then((function(i){e.Log.debug("State.clearStaleState: got keys",i);for(var o=[],s=function(s){var u=i[s];a=n.get(u).then((function(i){var o=!1;if(i)try{var s=t.fromStorageString(i);e.Log.debug("State.clearStaleState: got item from key: ",u,s.created),s.created<=r&&(o=!0)}catch(t){e.Log.error("State.clearStaleState: Error parsing state for key",u,t.message),o=!0}else e.Log.debug("State.clearStaleState: no item in storage for key: ",u),o=!0;if(o)return e.Log.debug("State.clearStaleState: removed item for key: ",u),n.remove(u)})),o.push(a)},u=0;u<i.length;u++){var a;s(u)}return e.Log.debug("State.clearStaleState: waiting on promise count:",o.length),Promise.all(o)}))},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.OidcClient=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(5),s=i(12),u=i(8),a=i(34),f=i(35),h=i(36),c=i(13),v=i(9);function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.OidcClient=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l(this,t),this._settings=n instanceof o.OidcClientSettings?n:new o.OidcClientSettings(n)}return t.prototype.createSigninRequest=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.response_type,r=n.scope,o=n.redirect_uri,s=n.data,a=n.state,f=n.prompt,h=n.display,c=n.max_age,v=n.ui_locales,l=n.id_token_hint,d=n.login_hint,F=n.acr_values,p=n.resource,w=n.request,g=n.request_uri,m=n.response_mode,y=n.extraQueryParams,E=n.extraTokenParams,S=n.request_type,k=n.skipUserInfo,b=arguments[1];e.Log.debug("OidcClient.createSigninRequest");var _=this._settings.client_id;r=r||this._settings.scope,o=o||this._settings.redirect_uri,f=f||this._settings.prompt,h=h||this._settings.display,c=c||this._settings.max_age,v=v||this._settings.ui_locales,F=F||this._settings.acr_values,p=p||this._settings.resource,m=m||this._settings.response_mode,y=y||this._settings.extraQueryParams,E=E||this._settings.extraTokenParams;var A=this._settings.authority;return u.SigninRequest.isCode(i=i||this._settings.response_type)&&"code"!==i?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(n){e.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",n);var C=new u.SigninRequest({url:n,client_id:_,redirect_uri:o,response_type:i,scope:r,data:s||a,authority:A,prompt:f,display:h,max_age:c,ui_locales:v,id_token_hint:l,login_hint:d,acr_values:F,resource:p,request:w,request_uri:g,extraQueryParams:y,extraTokenParams:E,request_type:S,response_mode:m,client_secret:t._settings.client_secret,skipUserInfo:k}),R=C.state;return(b=b||t._stateStore).set(R.id,R.toStorageString()).then((function(){return C}))}))},t.prototype.readSigninResponseState=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.Log.debug("OidcClient.readSigninResponseState");var r="query"===this._settings.response_mode||!this._settings.response_mode&&u.SigninRequest.isCode(this._settings.response_type),o=r?"?":"#",s=new a.SigninResponse(t,o);if(!s.state)return e.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));n=n||this._stateStore;var f=i?n.remove.bind(n):n.get.bind(n);return f(s.state).then((function(t){if(!t)throw e.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:c.SigninState.fromStorageString(t),response:s}}))},t.prototype.processSigninResponse=function(t,n){var i=this;return e.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(t,n,!0).then((function(t){var n=t.state,r=t.response;return e.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),i._validator.validateSigninResponse(n,r)}))},t.prototype.createSignoutRequest=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.id_token_hint,r=n.data,o=n.state,s=n.post_logout_redirect_uri,u=n.extraQueryParams,a=n.request_type,h=arguments[1];return e.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,u=u||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(n){if(!n)throw e.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");e.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",n);var c=new f.SignoutRequest({url:n,id_token_hint:i,post_logout_redirect_uri:s,data:r||o,extraQueryParams:u,request_type:a}),v=c.state;return v&&(e.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(h=h||t._stateStore).set(v.id,v.toStorageString())),c}))},t.prototype.readSignoutResponseState=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.Log.debug("OidcClient.readSignoutResponseState");var r=new h.SignoutResponse(t);if(!r.state)return e.Log.debug("OidcClient.readSignoutResponseState: No state in response"),r.error?(e.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",r.error),Promise.reject(new s.ErrorResponse(r))):Promise.resolve({state:void 0,response:r});var o=r.state;n=n||this._stateStore;var u=i?n.remove.bind(n):n.get.bind(n);return u(o).then((function(t){if(!t)throw e.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:v.State.fromStorageString(t),response:r}}))},t.prototype.processSignoutResponse=function(t,n){var i=this;return e.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(t,n,!0).then((function(t){var n=t.state,r=t.response;return n?(e.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),i._validator.validateSignoutResponse(n,r)):(e.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),r)}))},t.prototype.clearStaleState=function(t){return e.Log.debug("OidcClient.clearStaleState"),v.State.clearStaleState(t=t||this._stateStore,this.settings.staleStateAge)},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.TokenClient=void 0;var r=i(7),e=i(2),o=i(0);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.TokenClient=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService;if(s(this,t),!n)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=n,this._jsonService=new i,this._metadataService=new u(this._settings)}return t.prototype.exchangeCode=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(n=Object.assign({},n)).grant_type=n.grant_type||"authorization_code",n.client_id=n.client_id||this._settings.client_id,n.client_secret=n.client_secret||this._settings.client_secret,n.redirect_uri=n.redirect_uri||this._settings.redirect_uri;var i=void 0,r=n._client_authentication||this._settings._client_authentication;return delete n._client_authentication,n.code?n.redirect_uri?n.code_verifier?n.client_id?n.client_secret||"client_secret_basic"!=r?("client_secret_basic"==r&&(i=n.client_id+":"+n.client_secret,delete n.client_id,delete n.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),t._jsonService.postForm(r,n,i).then((function(t){return o.Log.debug("TokenClient.exchangeCode: response received"),t}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},t.prototype.exchangeRefreshToken=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(n=Object.assign({},n)).grant_type=n.grant_type||"refresh_token",n.client_id=n.client_id||this._settings.client_id,n.client_secret=n.client_secret||this._settings.client_secret;var i=void 0,r=n._client_authentication||this._settings._client_authentication;return delete n._client_authentication,n.refresh_token?n.client_id?("client_secret_basic"==r&&(i=n.client_id+":"+n.client_secret,delete n.client_id,delete n.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),t._jsonService.postForm(r,n,i).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),t}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorResponse=void 0;var r=i(0);function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}n.ErrorResponse=function(t){function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=i.error,u=i.error_description,a=i.error_uri,f=i.state,h=i.session_state;if(e(this,n),!s)throw r.Log.error("No error passed to ErrorResponse"),new Error("error");var c=o(this,t.call(this,u||s));return c.name="ErrorResponse",c.error=s,c.error_description=u,c.error_uri=a,c.state=f,c.session_state=h,c}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}(n,t),n}(Error)},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SigninState=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(9),s=i(4),u=function(t){return t&&t.__esModule?t:{default:t}}(i(14));function a(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}n.SigninState=function(t){function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.nonce,e=i.authority,o=i.client_id,h=i.redirect_uri,c=i.code_verifier,v=i.response_mode,l=i.client_secret,d=i.scope,F=i.extraTokenParams,p=i.skipUserInfo;a(this,n);var w=f(this,t.call(this,arguments[0]));if(!0===r?w._nonce=(0,u.default)():r&&(w._nonce=r),!0===c?w._code_verifier=(0,u.default)()+(0,u.default)()+(0,u.default)():c&&(w._code_verifier=c),w.code_verifier){var g=s.JoseUtil.hashString(w.code_verifier,"SHA256");w._code_challenge=s.JoseUtil.hexToBase64Url(g)}return w._redirect_uri=h,w._authority=e,w._client_id=o,w._response_mode=v,w._client_secret=l,w._scope=d,w._extraTokenParams=F,w._skipUserInfo=p,w}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}(n,t),n.prototype.toStorageString=function(){return e.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})},n.fromStorageString=function(t){return e.Log.debug("SigninState.fromStorageString"),new n(JSON.parse(t))},r(n,[{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}}]),n}(o.State)},function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){return("undefined"!=i&&null!==i&&void 0!==i.getRandomValues?r:e)().replace(/-/g,"")};var i="undefined"!=typeof window?window.crypto||window.msCrypto:null;function r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^i.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function e(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=n.default},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.User=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0);n.User=function(){function t(n){var i=n.id_token,r=n.session_state,e=n.access_token,o=n.refresh_token,s=n.token_type,u=n.scope,a=n.profile,f=n.expires_at,h=n.state;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.id_token=i,this.session_state=r,this.access_token=e,this.refresh_token=o,this.token_type=s,this.scope=u,this.profile=a,this.expires_at=f,this.state=h}return t.prototype.toStorageString=function(){return e.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})},t.fromStorageString=function(n){return e.Log.debug("User.fromStorageString"),new t(JSON.parse(n))},r(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var n=parseInt(t);if("number"==typeof n&&n>0){var i=parseInt(Date.now()/1e3);this.expires_at=i+n}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.AccessTokenEvents=void 0;var r=i(0),e=i(46);function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.AccessTokenEvents=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.accessTokenExpiringNotificationTime,r=void 0===i?60:i,s=n.accessTokenExpiringTimer,u=void 0===s?new e.Timer("Access token expiring"):s,a=n.accessTokenExpiredTimer,f=void 0===a?new e.Timer("Access token expired"):a;o(this,t),this._accessTokenExpiringNotificationTime=r,this._accessTokenExpiring=u,this._accessTokenExpired=f}return t.prototype.load=function(t){if(t.access_token&&void 0!==t.expires_in){var n=t.expires_in;if(r.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",n),n>0){var i=n-this._accessTokenExpiringNotificationTime;i<=0&&(i=1),r.Log.debug("AccessTokenEvents.load: registering expiring timer in:",i),this._accessTokenExpiring.init(i)}else r.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var e=n+1;r.Log.debug("AccessTokenEvents.load: registering expired timer in:",e),this._accessTokenExpired.init(e)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function(){r.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.Event=void 0;var r=i(0);n.Event=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=n,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var n=this._callbacks.findIndex((function(n){return n===t}));n>=0&&this._callbacks.splice(n,1)},t.prototype.raise=function(){r.Log.debug("Event: Raising event: "+this._name);for(var t=0;t<this._callbacks.length;t++){var n;(n=this._callbacks)[t].apply(n,arguments)}},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SessionMonitor=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0),o=i(19),s=i(1);function u(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.SessionMonitor=function(){function t(n){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(u(this,t),!n)throw e.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=n,this._CheckSessionIFrameCtor=r,this._timer=a,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?i._start(t):i._settings.monitorAnonymousSession&&i._userManager.querySessionStatus().then((function(t){var n={session_state:t.session_state};t.sub&&t.sid&&(n.profile={sub:t.sub,sid:t.sid}),i._start(n)})).catch((function(t){e.Log.error("SessionMonitor ctor: error from querySessionStatus:",t.message)}))})).catch((function(t){e.Log.error("SessionMonitor ctor: error from getUser:",t.message)})))}return t.prototype._start=function(t){var n=this,i=t.session_state;i&&(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,e.Log.debug("SessionMonitor._start: session_state:",i,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,e.Log.debug("SessionMonitor._start: session_state:",i,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(i):this._metadataService.getCheckSessionIframe().then((function(t){if(t){e.Log.debug("SessionMonitor._start: Initializing check session iframe");var r=n._client_id,o=n._checkSessionInterval,s=n._stopCheckSessionOnError;n._checkSessionIFrame=new n._CheckSessionIFrameCtor(n._callback.bind(n),r,t,o,s),n._checkSessionIFrame.load().then((function(){n._checkSessionIFrame.start(i)}))}else e.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){e.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function(){var t=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(e.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var n=this._timer.setInterval((function(){t._timer.clearInterval(n),t._userManager.querySessionStatus().then((function(n){var i={session_state:n.session_state};n.sub&&n.sid&&(i.profile={sub:n.sub,sid:n.sid}),t._start(i)})).catch((function(t){e.Log.error("SessionMonitor: error from querySessionStatus:",t.message)}))}),1e3)},t.prototype._callback=function(){var t=this;this._userManager.querySessionStatus().then((function(n){var i=!0;n?n.sub===t._sub?(i=!1,t._checkSessionIFrame.start(n.session_state),n.sid===t._sid?e.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",n.session_state):(e.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",n.session_state),t._userManager.events._raiseUserSessionChanged())):e.Log.debug("SessionMonitor._callback: Different subject signed into OP:",n.sub):e.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),i&&(t._sub?(e.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),t._userManager.events._raiseUserSignedOut()):(e.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),t._userManager.events._raiseUserSignedIn()))})).catch((function(n){t._sub&&(e.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",n.message),t._userManager.events._raiseUserSignedOut())}))},r(t,[{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}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.CheckSessionIFrame=void 0;var r=i(0);function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.CheckSessionIFrame=function(){function t(n,i,r,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e(this,t),this._callback=n,this._client_id=i,this._url=r,this._interval=o||2e3,this._stopOnError=s;var u=r.indexOf("/",r.indexOf("//")+2);this._frame_origin=r.substr(0,u),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=r}return t.prototype.load=function(){var t=this;return new Promise((function(n){t._frame.onload=function(){n()},window.document.body.appendChild(t._frame),t._boundMessageEvent=t._message.bind(t),window.addEventListener("message",t._boundMessageEvent,!1)}))},t.prototype._message=function(t){t.origin===this._frame_origin&&t.source===this._frame.contentWindow&&("error"===t.data?(r.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===t.data?(r.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):r.Log.debug("CheckSessionIFrame: "+t.data+" message from check session op iframe"))},t.prototype.start=function(t){var n=this;if(this._session_state!==t){r.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=t;var i=function(){n._frame.contentWindow.postMessage(n._client_id+" "+n._session_state,n._frame_origin)};i(),this._timer=window.setInterval(i,this._interval)}},t.prototype.stop=function(){this._session_state=null,this._timer&&(r.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.TokenRevocationClient=void 0;var r=i(0),e=i(2),o=i(1);function s(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var u="access_token",a="refresh_token";n.TokenRevocationClient=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService;if(s(this,t),!n)throw r.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=n,this._XMLHttpRequestCtor=i,this._metadataService=new u(this._settings)}return t.prototype.revoke=function(t,n){var i=this,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!t)throw r.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(e!==u&&e!=a)throw r.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(o){if(o)return r.Log.debug("TokenRevocationClient.revoke: Revoking "+e),i._revoke(o,i._settings.client_id,i._settings.client_secret,t,e);if(n)throw r.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function(t,n,i,e,o){var s=this;return new Promise((function(u,a){var f=new s._XMLHttpRequestCtor;f.open("POST",t),f.onload=function(){r.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",f.status),200===f.status?u():a(Error(f.statusText+" ("+f.status+")"))},f.onerror=function(){r.Log.debug("TokenRevocationClient.revoke: Network Error."),a("Network Error")};var h="client_id="+encodeURIComponent(n);i&&(h+="&client_secret="+encodeURIComponent(i)),h+="&token_type_hint="+encodeURIComponent(o),h+="&token="+encodeURIComponent(e),f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(h)}))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.CordovaPopupWindow=void 0;var r=function(){function t(t,n){for(var i=0;i<n.length;i++){var r=n[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}}(),e=i(0);n.CordovaPopupWindow=function(){function t(n){var i=this;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,n){i._resolve=t,i._reject=n})),this.features=n.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=n.popupWindowTarget||"_blank",this.redirect_uri=n.startUrl,e.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return t.prototype._isInAppBrowserInstalled=function(t){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some((function(n){return t.hasOwnProperty(n)}))},t.prototype.navigate=function(t){if(t&&t.url){if(!window.cordova)return this._error("cordova is undefined");var n=window.cordova.require("cordova/plugin_list").metadata;if(!1===this._isInAppBrowserInstalled(n))return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(t.url,this.target,this.features),this._popup?(e.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},t.prototype._loadStartCallback=function(t){0===t.url.indexOf(this.redirect_uri)&&this._success({url:t.url})},t.prototype._exitCallback=function(t){this._error(t)},t.prototype._success=function(t){this._cleanup(),e.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),e.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._popup&&(e.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},r(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0});var r=i(0),e=i(10),o=i(5),s=i(6),u=i(37),a=i(38),f=i(16),h=i(2),c=i(48),v=i(49),l=i(19),d=i(20),F=i(18),p=i(1),w=i(15),g=i(50);n.default={Version:g.Version,Log:r.Log,OidcClient:e.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:u.InMemoryWebStorage,UserManager:a.UserManager,AccessTokenEvents:f.AccessTokenEvents,MetadataService:h.MetadataService,CordovaPopupNavigator:c.CordovaPopupNavigator,CordovaIFrameNavigator:v.CordovaIFrameNavigator,CheckSessionIFrame:l.CheckSessionIFrame,TokenRevocationClient:d.TokenRevocationClient,SessionMonitor:F.SessionMonitor,Global:p.Global,User:w.User},t.exports=n.default},function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ClockService=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.ResponseValidator=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=i(0),o=i(2),s=i(25),u=i(11),a=i(12),f=i(4);function h(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var c=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];n.ResponseValidator=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.JoseUtil,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:u.TokenClient;if(h(this,t),!n)throw e.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=n,this._metadataService=new i(this._settings),this._userInfoService=new r(this._settings),this._joseUtil=a,this._tokenClient=new c(this._settings)}return t.prototype.validateSigninResponse=function(t,n){var i=this;return e.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(t,n).then((function(n){return e.Log.debug("ResponseValidator.validateSigninResponse: state processed"),i._validateTokens(t,n).then((function(n){return e.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),i._processClaims(t,n).then((function(t){return e.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function(t,n){return t.id!==n.state?(e.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(e.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),n.state=t.data,n.error?(e.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",n.error),Promise.reject(new a.ErrorResponse(n))):Promise.resolve(n))},t.prototype._processSigninParams=function(t,n){if(t.id!==n.state)return e.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!t.client_id)return e.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!t.authority)return e.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!==t.authority)return e.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=t.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==t.client_id)return e.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=t.client_id;return e.Log.debug("ResponseValidator._processSigninParams: state validated"),n.state=t.data,n.error?(e.Log.warn("ResponseValidator._processSigninParams: Response was error",n.error),Promise.reject(new a.ErrorResponse(n))):t.nonce&&!n.id_token?(e.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!t.nonce&&n.id_token?(e.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):t.code_verifier&&!n.code?(e.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!t.code_verifier&&n.code?(e.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(n.scope||(n.scope=t.scope),Promise.resolve(n))},t.prototype._processClaims=function(t,n){var i=this;if(n.isOpenIdConnect){if(e.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),n.profile=this._filterProtocolClaims(n.profile),!0!==t.skipUserInfo&&this._settings.loadUserInfo&&n.access_token)return e.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(n.access_token).then((function(t){return e.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),t.sub!==n.profile.sub?(e.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"))):(n.profile=i._mergeClaims(n.profile,t),e.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",n.profile),n)}));e.Log.debug("ResponseValidator._processClaims: not loading user info")}else e.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(n)},t.prototype._mergeClaims=function(t,n){var i=Object.assign({},t);for(var e in n){var o=n[e];Array.isArray(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];i[e]?Array.isArray(i[e])?i[e].indexOf(u)<0&&i[e].push(u):i[e]!==u&&(i[e]="object"===(void 0===u?"undefined":r(u))&&this._settings.mergeClaims?this._mergeClaims(i[e],u):[i[e],u]):i[e]=u}}return i},t.prototype._filterProtocolClaims=function(t){e.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",t);var n=Object.assign({},t);return this._settings._filterProtocolClaims?(c.forEach((function(t){delete n[t]})),e.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",n)):e.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),n},t.prototype._validateTokens=function(t,n){return n.code?(e.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(t,n)):n.id_token?n.access_token?(e.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(t,n)):(e.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(t,n)):(e.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(n))},t.prototype._processCode=function(t,n){var i=this,o={client_id:t.client_id,client_secret:t.client_secret,code:n.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier};return t.extraTokenParams&&"object"===r(t.extraTokenParams)&&Object.assign(o,t.extraTokenParams),this._tokenClient.exchangeCode(o).then((function(r){for(var o in r)n[o]=r[o];return n.id_token?(e.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),i._validateIdTokenAttributes(t,n)):(e.Log.debug("ResponseValidator._processCode: token response successful, returning response"),n)}))},t.prototype._validateIdTokenAttributes=function(t,n){var i=this;return this._metadataService.getIssuer().then((function(r){var o=t.client_id,s=i._settings.clockSkew;return e.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",s),i._settings.getEpochTime().then((function(u){return i._joseUtil.validateJwtAttributes(n.id_token,r,o,s,u).then((function(i){return t.nonce&&t.nonce!==i.nonce?(e.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):i.sub?(n.profile=i,n):(e.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},t.prototype._validateIdTokenAndAccessToken=function(t,n){var i=this;return this._validateIdToken(t,n).then((function(t){return i._validateAccessToken(t)}))},t.prototype._getSigningKeyForJwt=function(t){var n=this;return this._metadataService.getSigningKeys().then((function(i){var r=t.header.kid;if(!i)return e.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));e.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var o=void 0;if(r)o=i.filter((function(t){return t.kid===r}))[0];else{if((i=n._filterByAlg(i,t.header.alg)).length>1)return e.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"));o=i[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function(t){var n=this;return this._getSigningKeyForJwt(t).then((function(i){return i?Promise.resolve(i):(n._metadataService.resetSigningKeys(),n._getSigningKeyForJwt(t))}))},t.prototype._validateIdToken=function(t,n){var i=this;if(!t.nonce)return e.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var r=this._joseUtil.parseJwt(n.id_token);return r&&r.header&&r.payload?t.nonce!==r.payload.nonce?(e.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(o){return e.Log.debug("ResponseValidator._validateIdToken: Received issuer"),i._getSigningKeyForJwtWithSingleRetry(r).then((function(s){if(!s)return e.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 u=t.client_id,a=i._settings.clockSkew;return e.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",a),i._joseUtil.validateJwt(n.id_token,s,o,u,a).then((function(){return e.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),r.payload.sub?(n.profile=r.payload,n):(e.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(e.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",r),Promise.reject(new Error("Failed to parse id_token")))},t.prototype._filterByAlg=function(t,n){var i=null;if(n.startsWith("RS"))i="RSA";else if(n.startsWith("PS"))i="PS";else{if(!n.startsWith("ES"))return e.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",n),[];i="EC"}return e.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",i),t=t.filter((function(t){return t.kty===i})),e.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",i,t.length),t},t.prototype._validateAccessToken=function(t){if(!t.profile)return e.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!t.profile.at_hash)return e.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!t.id_token)return e.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var n=this._joseUtil.parseJwt(t.id_token);if(!n||!n.header)return e.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",n),Promise.reject(new Error("Failed to parse id_token"));var i=n.header.alg;if(!i||5!==i.length)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i),Promise.reject(new Error("Unsupported alg: "+i));var r=i.substr(2,3);if(!r)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i,r),Promise.reject(new Error("Unsupported alg: "+i));if(256!==(r=parseInt(r))&&384!==r&&512!==r)return e.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",i,r),Promise.reject(new Error("Unsupported alg: "+i));var o="sha"+r,s=this._joseUtil.hashString(t.access_token,o);if(!s)return e.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var u=s.substr(0,s.length/2),a=this._joseUtil.hexToBase64Url(u);return a!==t.profile.at_hash?(e.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",a,t.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(e.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(t))},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.UserInfoService=void 0;var r=i(7),e=i(2),o=i(0),s=i(4);function u(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}n.UserInfoService=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.MetadataService,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(u(this,t),!n)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=n,this._jsonService=new i(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new a(this._settings),this._joseUtil=f}return t.prototype.getClaims=function(t){var n=this;return t?this._metadataService.getUserInfoEndpoint().then((function(i){return o.Log.debug("UserInfoService.getClaims: received userinfo url",i),n._jsonService.getJson(i,t).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t.prototype._getClaimsFromJwt=function t(n){var i=this;try{var r=this._joseUtil.parseJwt(n.responseText);if(!r||!r.header||!r.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",r),Promise.reject(new Error("Failed to parse id_token"));var e=r.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":s=this._metadataService.getIssuer();break;case"ANY":s=Promise.resolve(r.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(t){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+t),i._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var u=void 0;if(e)u=s.filter((function(t){return t.kid===e}))[0];else{if((s=i._filterByAlg(s,r.header.alg)).length>1)return o.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"));u=s[0]}if(!u)return o.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 a=i._settings.client_id,f=i._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",f),i._joseUtil.validateJwt(n.responseText,u,t,a,f,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),r.payload}))}))}))}catch(t){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",t.message),void reject(t)}},t.prototype._filterByAlg=function(t,n){var i=null;if(n.startsWith("RS"))i="RSA";else if(n.startsWith("PS"))i="PS";else{if(!n.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",n),[];i="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",i),t=t.filter((function(t){return t.kty===i})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",i,t.length),t},t}()},function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.AllowedSigningAlgs=n.b64tohex=n.hextob64u=n.crypto=n.X509=n.KeyUtil=n.jws=void 0;var r=i(27);n.jws=r.jws,n.KeyUtil=r.KEYUTIL,n.X509=r.X509,n.crypto=r.crypto,n.hextob64u=r.hextob64u,n.b64tohex=r.b64tohex,n.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(t,n,i){(function(t){Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r={};
2
2
  /*!
3
3
  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
4
4
  Code licensed under the BSD License:
@@ -1 +1 @@
1
- var __extends=this&&this.__extends||function(){var e=function(t,n){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]};return e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r["throw"](e))}catch(e){a(e)}}function s(e){e.done?n(e.value):i(e.value).then(o,u)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(t){return s([e,t])}}function s(o){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(a=o[0]&2?i["return"]:o[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;if(i=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;i=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1];a=o;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(o);break}if(a[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-0b08c63c.system.js","./p-835322bf.system.js","./p-9a8c9350.system.js","./p-69cf2679.system.js","./p-01cc3fd8.system.js","./p-78c4dce3.system.js","./p-0045ce79.system.js"],(function(e){"use strict";var t,n,r,i,a,o,u,s,f,c,l,d,p,v,h,g,y,m,b,B,_;return{setters:[function(e){t=e.S;n=e.a;r=e.Q},function(e){i=e._;a=e.O},function(e){o=e.n;u=e.e;s=e.t;f=e.a;c=e.g;l=e.s;d=e.b;p=e.i;v=e.c;h=e.m},function(e){g=e.f;y=e.B},function(e){m=e.w},function(e){b=e.b},function(e){B=e.a;_=e.b}],execute:function(){var w="/";var A="./";var x=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");var D=function(e,t){var n=[];var r=0;var i=0;var a="";var o=t&&t.delimiter||w;var u=t&&t.delimiters||A;var s=false;var f;while((f=x.exec(e))!==null){var c=f[0];var l=f[1];var d=f.index;a+=e.slice(i,d);i=d+c.length;if(l){a+=l[1];s=true;continue}var p="";var v=e[i];var h=f[2];var g=f[3];var y=f[4];var m=f[5];if(!s&&a.length){var b=a.length-1;if(u.indexOf(a[b])>-1){p=a[b];a=a.slice(0,b)}}if(a){n.push(a);a="";s=false}var B=p!==""&&v!==undefined&&v!==p;var _=m==="+"||m==="*";var D=m==="?"||m==="*";var E=p||o;var L=g||y;n.push({name:h||r++,prefix:p,delimiter:E,optional:D,repeat:_,partial:B,pattern:L?j(L):"[^"+S(E)+"]+?"})}if(a||i<e.length){n.push(a+e.substr(i))}return n};var S=function(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")};var j=function(e){return e.replace(/([=!:$/()])/g,"\\$1")};var E=function(e){return e&&e.sensitive?"":"i"};var L=function(e,t){if(!t)return e;var n=e.source.match(/\((?!\?)/g);if(n){for(var r=0;r<n.length;r++){t.push({name:r,prefix:null,delimiter:null,optional:false,repeat:false,partial:false,pattern:null})}}return e};var P=function(e,t,n){var r=[];for(var i=0;i<e.length;i++){r.push($(e[i],t,n).source)}return new RegExp("(?:"+r.join("|")+")",E(n))};var O=function(e,t,n){return k(D(e,n),t,n)};var k=function(e,t,n){n=n||{};var r=n.strict;var i=n.end!==false;var a=S(n.delimiter||w);var o=n.delimiters||A;var u=[].concat(n.endsWith||[]).map(S).concat("$").join("|");var s="";var f=false;for(var c=0;c<e.length;c++){var l=e[c];if(typeof l==="string"){s+=S(l);f=c===e.length-1&&o.indexOf(l[l.length-1])>-1}else{var d=S(l.prefix||"");var p=l.repeat?"(?:"+l.pattern+")(?:"+d+"(?:"+l.pattern+"))*":l.pattern;if(t)t.push(l);if(l.optional){if(l.partial){s+=d+"("+p+")?"}else{s+="(?:"+d+"("+p+"))?"}}else{s+=d+"("+p+")"}}}if(i){if(!r)s+="(?:"+a+")?";s+=u==="$"?"$":"(?="+u+")"}else{if(!r)s+="(?:"+a+"(?="+u+"))?";if(!f)s+="(?="+a+"|"+u+")"}return new RegExp("^"+s,E(n))};var $=function(e,t,n){if(e instanceof RegExp){return L(e,t)}if(Array.isArray(e)){return P(e,t,n)}return O(e,t,n)};var I=e("h",(function(e,t){return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)}));var R=e("i",(function(e,t){return I(e,t)?e.substr(t.length):e}));var C=e("s",(function(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}));var F=e("d",(function(e){return e.charAt(0)==="/"?e:"/"+e}));var T=e("k",(function(e){return e.charAt(0)==="/"?e.substr(1):e}));var U=function(e){var t=e||"/";var n="";var r="";var i=t.indexOf("#");if(i!==-1){r=t.substr(i);t=t.substr(0,i)}var a=t.indexOf("?");if(a!==-1){n=t.substr(a);t=t.substr(0,a)}return{pathname:t,search:n==="?"?"":n,hash:r==="#"?"":r,query:{},key:""}};var V=e("j",(function(e){var t=e.pathname,n=e.search,r=e.hash;var i=t||"/";if(n&&n!=="?"){i+=n.charAt(0)==="?"?n:"?"+n}if(r&&r!=="#"){i+=r.charAt(0)==="#"?r:"#"+r}return i}));var H=function(e){if(!e){return{}}return(/^[?#]/.test(e)?e.slice(1):e).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1];e[r]=i?decodeURIComponent(i.replace(/\+/g," ")):"";return e}),{})};var q=function(e){return e.charAt(0)==="/"};var G=e("g",(function(e){return Math.random().toString(36).substr(2,e)}));var M=function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1){e[n]=e[r]}e.pop()};var N=function(e,t){if(t===void 0){t=""}var n=t&&t.split("/")||[];var r;var i=0;var a=e&&e.split("/")||[];var o=e&&q(e);var u=t&&q(t);var s=o||u;if(e&&q(e)){n=a}else if(a.length){n.pop();n=n.concat(a)}if(!n.length){return"/"}if(n.length){var f=n[n.length-1];r=f==="."||f===".."||f===""}else{r=false}for(var c=n.length;c>=0;c--){var l=n[c];if(l==="."){M(n,c)}else if(l===".."){M(n,c);i++}else if(i){M(n,c);i--}}if(!s){for(;i--;i){n.unshift("..")}}if(s&&n[0]!==""&&(!n[0]||!q(n[0]))){n.unshift("")}var d=n.join("/");if(r&&d.substr(-1)!=="/"){d+="/"}return d};var W=function(e,t){if(e===t){return true}if(e==null||t==null){return false}if(Array.isArray(e)){return Array.isArray(t)&&e.length===t.length&&e.every((function(e,n){return W(e,t[n])}))}var n=typeof e;var r=typeof t;if(n!==r){return false}if(n==="object"){var i=e.valueOf();var a=t.valueOf();if(i!==e||a!==t){return W(i,a)}var o=Object.keys(e);var u=Object.keys(t);if(o.length!==u.length){return false}return o.every((function(n){return W(e[n],t[n])}))}return false};var J=e("l",(function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&W(e.state,t.state)}));var Q=e("f",(function(e,t,n,r){var i;if(typeof e==="string"){i=U(e);if(t!==undefined){i.state=t}}else{i=Object.assign({pathname:""},e);if(i.search&&i.search.charAt(0)!=="?"){i.search="?"+i.search}if(i.hash&&i.hash.charAt(0)!=="#"){i.hash="#"+i.hash}if(t!==undefined&&i.state===undefined){i.state=t}}try{i.pathname=decodeURI(i.pathname)}catch(e){if(e instanceof URIError){throw new URIError('Pathname "'+i.pathname+'" could not be decoded. '+"This is likely caused by an invalid percent-encoding.")}else{throw e}}i.key=n;if(r){if(!i.pathname){i.pathname=r.pathname}else if(i.pathname.charAt(0)!=="/"){i.pathname=N(i.pathname,r.pathname)}}else{if(!i.pathname){i.pathname="/"}}i.query=H(i.search||"");return i}));var z=0;var K={};var X=1e4;var Y=function(e,t){var n=""+t.end+t.strict;var r=K[n]||(K[n]={});var i=JSON.stringify(e);if(r[i]){return r[i]}var a=[];var o=$(e,a,t);var u={re:o,keys:a};if(z<X){r[i]=u;z+=1}return u};var Z=e("c",(function(e,t){if(t===void 0){t={}}if(typeof t==="string"){t={path:t}}var n=t.path,r=n===void 0?"/":n,i=t.exact,a=i===void 0?false:i,o=t.strict,u=o===void 0?false:o;var s=Y(r,{end:a,strict:u}),f=s.re,c=s.keys;var l=f.exec(e);if(!l){return null}var d=l[0],p=l.slice(1);var v=e===d;if(a&&!v){return null}return{path:r,url:r==="/"&&d===""?"/":d,isExact:v,params:c.reduce((function(e,t,n){e[t.name]=p[n];return e}),{})}}));var ee=e("n",(function(e,t){if(e==null&&t==null){return true}if(t==null){return false}return e&&t&&e.path===t.path&&e.url===t.url&&W(e.params,t.params)}));var te=undefined&&undefined.__decorate||function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)if(o=e[u])a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a;return i>3&&a&&Object.defineProperty(t,n,a),a};var ne=e("B",["Appliances & Electronics","Automotive","Banking","Clothing & Footwear","Clubs","Entertainment","Food, Drink & Groceries","Fuel","Health, Beauty & Fitness","Homeware & Hardware","Learning","Pets","Shopping & Retail","Social","Sports & Leisure","Technology","Travel & Accommodation","Wellbeing & Health Services","Other","None"]);function re(){return{manageBenefitsPageState:{enabledBenefits:[],disabledBenefits:[]},selectedBenefit:o,draftBenefit:o}}var ie=function(e){__extends(t,e);function t(){return e.call(this,re())||this}return t}(n);ie=te([t({name:"manage-benefits",resettable:true,producerFn:g})],ie);var ae=new ie;var oe=function(e){__extends(t,e);function t(t){var n=e.call(this,t)||this;n.store=t;n.managedBenefits$=n.select((function(e){return e.manageBenefitsPageState}));n.selectedBenefit$=n.select((function(e){return e.selectedBenefit}));n.draftBenefit$=n.select((function(e){return e.draftBenefit}));n.draftBenefitUrl$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.url})))}));n.draftBenefitIcon$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.icon})))}));n.draftBenefitAttachment$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.attachment})))}));n.isLoading$=n.selectLoading();return n}return t}(r);var ue=e("e",new oe(ae));var se=function(){function e(){}e.fromDraftBenefit=function(e){return{title:B(e.title),subtitle:B(e.subtitle),category:B(e.category),description:s(e.description),url:s(e.url),attachments:f((function(){return[]}),(function(e){return[e]}))(e.attachment),icon:s(e.icon),backdrop:null}};return e}();var fe=function(){function e(){}e.prototype.getPageStateAsync=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,y.instance.url("benefits/ui/manage-page").get().json()]}))}))};e.prototype.loadBenefitForEditingAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,y.instance.url("benefits/edit/"+e).get().json()]}))}))};e.prototype.postCommandAsync=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){n={command:t};return[2,y.instance.url("benefits/edit/"+c((function(){return""}))(e)).post(n).badRequest((function(){throw new Error("Failed to execute benefit command")})).text()]}))}))};return e}();var ce=new fe;var le=function(){function e(){}e.toCustomBenefitsListEntry=function(e){return{id:e.benefitId,title:e.benefit.title,category:e.benefit.category,lastModifiedDate:l(e.metadata.updatedAt),visibility:e.visibility}};e.toBenefit=function(e){var t=e.benefit.attachments!==null&&e.benefit.attachments.length>0?l(e.benefit.attachments[0]):o;return{id:_(e.benefitId),title:_(e.benefit.title),subtitle:_(e.benefit.subtitle),category:_(e.benefit.category),description:d(e.benefit.description),url:d(e.benefit.url),attachment:t,icon:d(e.benefit.icon)}};return e}();var de=function(){function e(){}e.toDomain=function(e){return{enabledBenefits:e.activeAccountBenefits.map(le.toCustomBenefitsListEntry),disabledBenefits:e.inactiveAccountBenefits.map(le.toCustomBenefitsListEntry)}};return e}();var pe=function(e){__extends(t,e);function t(t){var n=e.call(this,t)||this;n.store=t;n.manageBenefitsPageState$=n.select((function(e){return e.manageBenefitsPageState}));n.isLoading$=n.selectLoading();return n}return t}(r);var ve=e("b",new pe(ae));var he=function(){function e(){}e.prototype.loadExistingBenefitForEditingAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r;var i=this;return __generator(this,(function(a){switch(a.label){case 0:ae.update((function(e){e.selectedBenefit=o}));ae.setLoading(true);r=(n=le).toBenefit;return[4,ce.loadBenefitForEditingAsync(e)];case 1:t=r.apply(n,[a.sent()]);ae.update((function(e){e.selectedBenefit=l(t);e.draftBenefit=l(i.existingBenefitToDraft(t))}));ae.setLoading(false);return[2]}}))}))};e.prototype.createDraftBenefit=function(){var e={title:o,category:o,subtitle:o,description:o,url:o,attachment:o,icon:o,isValid:false,isDirty:false};ae.update((function(t){t.selectedBenefit=o;t.draftBenefit=l(e)}))};e.prototype.clearDraftBenefit=function(){ae.update((function(e){e.draftBenefit=o}))};e.prototype.updateDraftBenefit=function(e){ae.update((function(t){t.draftBenefit=l(e)}))};e.prototype.publishDraftBenefitAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=ve.getValue().draftBenefit;if(p(e)){return[2]}this.assertDraftIsValid(e.value);ae.setLoading(true);t=ve.getValue().selectedBenefit;if(!v(t))return[3,2];n={updateAccountBenefit:se.fromDraftBenefit(e.value)};return[4,ce.postCommandAsync(t.value.id,n)];case 1:i.sent();return[3,4];case 2:r={createAccountBenefit:se.fromDraftBenefit(e.value)};return[4,ce.postCommandAsync(o,r)];case 3:i.sent();i.label=4;case 4:ae.setLoading(false);return[2]}}))}))};e.prototype.deleteSelectedBenefitAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=ve.getValue().selectedBenefit;if(!v(e))return[3,2];ae.setLoading(true);return[4,ce.postCommandAsync(e.value.id,"deleteAccountBenefit")];case 1:t.sent();ae.setLoading(false);t.label=2;case 2:return[2]}}))}))};e.prototype.updateDraftUrl=function(e){this.updateDraft((function(t){t.url=d(e);t.isDirty=true}))};e.prototype.clearDraftUrl=function(){this.updateDraft((function(e){e.url=o;e.isDirty=true}))};e.prototype.uploadAttachmentAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:ae.setLoading(true);n.label=1;case 1:n.trys.push([1,,3,4]);return[4,m(b.postDocumentAsync({file:e}),500)];case 2:t=n.sent();this.updateDraft((function(e){e.attachment=l(t);e.isDirty=true}));return[3,4];case 3:ae.setLoading(false);return[7];case 4:return[2]}}))}))};e.prototype.clearAttachment=function(){this.updateDraft((function(e){e.attachment=o;e.isDirty=true}))};e.prototype.uploadIconAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:ae.setLoading(true);n.label=1;case 1:n.trys.push([1,,3,4]);return[4,m(b.postIconAsync({file:e}),500)];case 2:t=n.sent();this.updateDraft((function(e){e.icon=l(t);e.isDirty=true}));return[3,4];case 3:ae.setLoading(false);return[7];case 4:return[2]}}))}))};e.prototype.clearIcon=function(){this.updateDraft((function(e){e.icon=o;e.isDirty=true}))};e.prototype.assertDraftIsValid=function(e){var t=v(e.title)&&v(e.category);if(!t)throw Error("Draft benefit is not valid")};e.prototype.updateDraft=function(e){ae.update((function(t){t.draftBenefit=i.pipe(t.draftBenefit,h(g(e)))}))};e.prototype.existingBenefitToDraft=function(e){return{title:e.title,category:e.category,subtitle:e.subtitle,description:e.description,url:e.url,attachment:e.attachment,icon:e.icon,isValid:true,isDirty:false}};return e}();var ge=e("a",new he);var ye=function(){function e(){}e.prototype.loadPageStateAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:ae.setLoading(true);return[4,ce.getPageStateAsync()];case 1:e=t.sent();ae.update((function(t){t.manageBenefitsPageState=de.toDomain(e)}));ae.setLoading(false);return[2]}}))}))};e.prototype.enableBenefitAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,ce.postCommandAsync(a.some(e),"enableAccountBenefit")];case 1:t.sent();ae.update((function(t){var n=t.manageBenefitsPageState.disabledBenefits.findIndex((function(t){return t.id===e}));if(n===-1)return;var r=t.manageBenefitsPageState.disabledBenefits.splice(n,1)[0];r.visibility.isEnabled=true;t.manageBenefitsPageState.enabledBenefits.push(r)}));return[2]}}))}))};e.prototype.disableBenefitAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,ce.postCommandAsync(a.some(e),"disableAccountBenefit")];case 1:t.sent();ae.update((function(t){var n=t.manageBenefitsPageState.enabledBenefits.findIndex((function(t){return t.id===e}));if(n===-1)return;var r=t.manageBenefitsPageState.enabledBenefits.splice(n,1)[0];r.visibility.isEnabled=false;t.manageBenefitsPageState.disabledBenefits.push(r)}));return[2]}}))}))};return e}();var me=e("m",new ye)}}}));
1
+ var __extends=this&&this.__extends||function(){var e=function(t,n){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]};return e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r["throw"](e))}catch(e){a(e)}}function s(e){e.done?n(e.value):i(e.value).then(o,u)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(t){return s([e,t])}}function s(o){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(a=o[0]&2?i["return"]:o[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;if(i=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;i=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1];a=o;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(o);break}if(a[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-19b00569.system.js","./p-835322bf.system.js","./p-9a8c9350.system.js","./p-45d6fbc2.system.js","./p-01cc3fd8.system.js","./p-b41f72c8.system.js","./p-0045ce79.system.js"],(function(e){"use strict";var t,n,r,i,a,o,u,s,f,c,l,d,p,v,h,g,y,m,b,B,_;return{setters:[function(e){t=e.S;n=e.a;r=e.Q},function(e){i=e._;a=e.O},function(e){o=e.n;u=e.e;s=e.t;f=e.a;c=e.g;l=e.s;d=e.b;p=e.i;v=e.c;h=e.m},function(e){g=e.f;y=e.B},function(e){m=e.w},function(e){b=e.b},function(e){B=e.a;_=e.b}],execute:function(){var w="/";var A="./";var x=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");var D=function(e,t){var n=[];var r=0;var i=0;var a="";var o=t&&t.delimiter||w;var u=t&&t.delimiters||A;var s=false;var f;while((f=x.exec(e))!==null){var c=f[0];var l=f[1];var d=f.index;a+=e.slice(i,d);i=d+c.length;if(l){a+=l[1];s=true;continue}var p="";var v=e[i];var h=f[2];var g=f[3];var y=f[4];var m=f[5];if(!s&&a.length){var b=a.length-1;if(u.indexOf(a[b])>-1){p=a[b];a=a.slice(0,b)}}if(a){n.push(a);a="";s=false}var B=p!==""&&v!==undefined&&v!==p;var _=m==="+"||m==="*";var D=m==="?"||m==="*";var E=p||o;var L=g||y;n.push({name:h||r++,prefix:p,delimiter:E,optional:D,repeat:_,partial:B,pattern:L?j(L):"[^"+S(E)+"]+?"})}if(a||i<e.length){n.push(a+e.substr(i))}return n};var S=function(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")};var j=function(e){return e.replace(/([=!:$/()])/g,"\\$1")};var E=function(e){return e&&e.sensitive?"":"i"};var L=function(e,t){if(!t)return e;var n=e.source.match(/\((?!\?)/g);if(n){for(var r=0;r<n.length;r++){t.push({name:r,prefix:null,delimiter:null,optional:false,repeat:false,partial:false,pattern:null})}}return e};var P=function(e,t,n){var r=[];for(var i=0;i<e.length;i++){r.push($(e[i],t,n).source)}return new RegExp("(?:"+r.join("|")+")",E(n))};var O=function(e,t,n){return k(D(e,n),t,n)};var k=function(e,t,n){n=n||{};var r=n.strict;var i=n.end!==false;var a=S(n.delimiter||w);var o=n.delimiters||A;var u=[].concat(n.endsWith||[]).map(S).concat("$").join("|");var s="";var f=false;for(var c=0;c<e.length;c++){var l=e[c];if(typeof l==="string"){s+=S(l);f=c===e.length-1&&o.indexOf(l[l.length-1])>-1}else{var d=S(l.prefix||"");var p=l.repeat?"(?:"+l.pattern+")(?:"+d+"(?:"+l.pattern+"))*":l.pattern;if(t)t.push(l);if(l.optional){if(l.partial){s+=d+"("+p+")?"}else{s+="(?:"+d+"("+p+"))?"}}else{s+=d+"("+p+")"}}}if(i){if(!r)s+="(?:"+a+")?";s+=u==="$"?"$":"(?="+u+")"}else{if(!r)s+="(?:"+a+"(?="+u+"))?";if(!f)s+="(?="+a+"|"+u+")"}return new RegExp("^"+s,E(n))};var $=function(e,t,n){if(e instanceof RegExp){return L(e,t)}if(Array.isArray(e)){return P(e,t,n)}return O(e,t,n)};var I=e("h",(function(e,t){return new RegExp("^"+t+"(\\/|\\?|#|$)","i").test(e)}));var R=e("i",(function(e,t){return I(e,t)?e.substr(t.length):e}));var C=e("s",(function(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}));var F=e("d",(function(e){return e.charAt(0)==="/"?e:"/"+e}));var T=e("k",(function(e){return e.charAt(0)==="/"?e.substr(1):e}));var U=function(e){var t=e||"/";var n="";var r="";var i=t.indexOf("#");if(i!==-1){r=t.substr(i);t=t.substr(0,i)}var a=t.indexOf("?");if(a!==-1){n=t.substr(a);t=t.substr(0,a)}return{pathname:t,search:n==="?"?"":n,hash:r==="#"?"":r,query:{},key:""}};var V=e("j",(function(e){var t=e.pathname,n=e.search,r=e.hash;var i=t||"/";if(n&&n!=="?"){i+=n.charAt(0)==="?"?n:"?"+n}if(r&&r!=="#"){i+=r.charAt(0)==="#"?r:"#"+r}return i}));var H=function(e){if(!e){return{}}return(/^[?#]/.test(e)?e.slice(1):e).split("&").reduce((function(e,t){var n=t.split("="),r=n[0],i=n[1];e[r]=i?decodeURIComponent(i.replace(/\+/g," ")):"";return e}),{})};var q=function(e){return e.charAt(0)==="/"};var G=e("g",(function(e){return Math.random().toString(36).substr(2,e)}));var M=function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1){e[n]=e[r]}e.pop()};var N=function(e,t){if(t===void 0){t=""}var n=t&&t.split("/")||[];var r;var i=0;var a=e&&e.split("/")||[];var o=e&&q(e);var u=t&&q(t);var s=o||u;if(e&&q(e)){n=a}else if(a.length){n.pop();n=n.concat(a)}if(!n.length){return"/"}if(n.length){var f=n[n.length-1];r=f==="."||f===".."||f===""}else{r=false}for(var c=n.length;c>=0;c--){var l=n[c];if(l==="."){M(n,c)}else if(l===".."){M(n,c);i++}else if(i){M(n,c);i--}}if(!s){for(;i--;i){n.unshift("..")}}if(s&&n[0]!==""&&(!n[0]||!q(n[0]))){n.unshift("")}var d=n.join("/");if(r&&d.substr(-1)!=="/"){d+="/"}return d};var W=function(e,t){if(e===t){return true}if(e==null||t==null){return false}if(Array.isArray(e)){return Array.isArray(t)&&e.length===t.length&&e.every((function(e,n){return W(e,t[n])}))}var n=typeof e;var r=typeof t;if(n!==r){return false}if(n==="object"){var i=e.valueOf();var a=t.valueOf();if(i!==e||a!==t){return W(i,a)}var o=Object.keys(e);var u=Object.keys(t);if(o.length!==u.length){return false}return o.every((function(n){return W(e[n],t[n])}))}return false};var J=e("l",(function(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&W(e.state,t.state)}));var Q=e("f",(function(e,t,n,r){var i;if(typeof e==="string"){i=U(e);if(t!==undefined){i.state=t}}else{i=Object.assign({pathname:""},e);if(i.search&&i.search.charAt(0)!=="?"){i.search="?"+i.search}if(i.hash&&i.hash.charAt(0)!=="#"){i.hash="#"+i.hash}if(t!==undefined&&i.state===undefined){i.state=t}}try{i.pathname=decodeURI(i.pathname)}catch(e){if(e instanceof URIError){throw new URIError('Pathname "'+i.pathname+'" could not be decoded. '+"This is likely caused by an invalid percent-encoding.")}else{throw e}}i.key=n;if(r){if(!i.pathname){i.pathname=r.pathname}else if(i.pathname.charAt(0)!=="/"){i.pathname=N(i.pathname,r.pathname)}}else{if(!i.pathname){i.pathname="/"}}i.query=H(i.search||"");return i}));var z=0;var K={};var X=1e4;var Y=function(e,t){var n=""+t.end+t.strict;var r=K[n]||(K[n]={});var i=JSON.stringify(e);if(r[i]){return r[i]}var a=[];var o=$(e,a,t);var u={re:o,keys:a};if(z<X){r[i]=u;z+=1}return u};var Z=e("c",(function(e,t){if(t===void 0){t={}}if(typeof t==="string"){t={path:t}}var n=t.path,r=n===void 0?"/":n,i=t.exact,a=i===void 0?false:i,o=t.strict,u=o===void 0?false:o;var s=Y(r,{end:a,strict:u}),f=s.re,c=s.keys;var l=f.exec(e);if(!l){return null}var d=l[0],p=l.slice(1);var v=e===d;if(a&&!v){return null}return{path:r,url:r==="/"&&d===""?"/":d,isExact:v,params:c.reduce((function(e,t,n){e[t.name]=p[n];return e}),{})}}));var ee=e("n",(function(e,t){if(e==null&&t==null){return true}if(t==null){return false}return e&&t&&e.path===t.path&&e.url===t.url&&W(e.params,t.params)}));var te=undefined&&undefined.__decorate||function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)if(o=e[u])a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a;return i>3&&a&&Object.defineProperty(t,n,a),a};var ne=e("B",["Appliances & Electronics","Automotive","Banking","Clothing & Footwear","Clubs","Entertainment","Food, Drink & Groceries","Fuel","Health, Beauty & Fitness","Homeware & Hardware","Learning","Pets","Shopping & Retail","Social","Sports & Leisure","Technology","Travel & Accommodation","Wellbeing & Health Services","Other","None"]);function re(){return{manageBenefitsPageState:{enabledBenefits:[],disabledBenefits:[]},selectedBenefit:o,draftBenefit:o}}var ie=function(e){__extends(t,e);function t(){return e.call(this,re())||this}return t}(n);ie=te([t({name:"manage-benefits",resettable:true,producerFn:g})],ie);var ae=new ie;var oe=function(e){__extends(t,e);function t(t){var n=e.call(this,t)||this;n.store=t;n.managedBenefits$=n.select((function(e){return e.manageBenefitsPageState}));n.selectedBenefit$=n.select((function(e){return e.selectedBenefit}));n.draftBenefit$=n.select((function(e){return e.draftBenefit}));n.draftBenefitUrl$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.url})))}));n.draftBenefitIcon$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.icon})))}));n.draftBenefitAttachment$=n.select((function(e){return i.pipe(e.draftBenefit,u((function(e){return e.attachment})))}));n.isLoading$=n.selectLoading();return n}return t}(r);var ue=e("e",new oe(ae));var se=function(){function e(){}e.fromDraftBenefit=function(e){return{title:B(e.title),subtitle:B(e.subtitle),category:B(e.category),description:s(e.description),url:s(e.url),attachments:f((function(){return[]}),(function(e){return[e]}))(e.attachment),icon:s(e.icon),backdrop:null}};return e}();var fe=function(){function e(){}e.prototype.getPageStateAsync=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,y.instance.url("benefits/ui/manage-page").get().json()]}))}))};e.prototype.loadBenefitForEditingAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,y.instance.url("benefits/edit/"+e).get().json()]}))}))};e.prototype.postCommandAsync=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){n={command:t};return[2,y.instance.url("benefits/edit/"+c((function(){return""}))(e)).post(n).badRequest((function(){throw new Error("Failed to execute benefit command")})).text()]}))}))};return e}();var ce=new fe;var le=function(){function e(){}e.toCustomBenefitsListEntry=function(e){return{id:e.benefitId,title:e.benefit.title,category:e.benefit.category,lastModifiedDate:l(e.metadata.updatedAt),visibility:e.visibility}};e.toBenefit=function(e){var t=e.benefit.attachments!==null&&e.benefit.attachments.length>0?l(e.benefit.attachments[0]):o;return{id:_(e.benefitId),title:_(e.benefit.title),subtitle:_(e.benefit.subtitle),category:_(e.benefit.category),description:d(e.benefit.description),url:d(e.benefit.url),attachment:t,icon:d(e.benefit.icon)}};return e}();var de=function(){function e(){}e.toDomain=function(e){return{enabledBenefits:e.activeAccountBenefits.map(le.toCustomBenefitsListEntry),disabledBenefits:e.inactiveAccountBenefits.map(le.toCustomBenefitsListEntry)}};return e}();var pe=function(e){__extends(t,e);function t(t){var n=e.call(this,t)||this;n.store=t;n.manageBenefitsPageState$=n.select((function(e){return e.manageBenefitsPageState}));n.isLoading$=n.selectLoading();return n}return t}(r);var ve=e("b",new pe(ae));var he=function(){function e(){}e.prototype.loadExistingBenefitForEditingAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r;var i=this;return __generator(this,(function(a){switch(a.label){case 0:ae.update((function(e){e.selectedBenefit=o}));ae.setLoading(true);r=(n=le).toBenefit;return[4,ce.loadBenefitForEditingAsync(e)];case 1:t=r.apply(n,[a.sent()]);ae.update((function(e){e.selectedBenefit=l(t);e.draftBenefit=l(i.existingBenefitToDraft(t))}));ae.setLoading(false);return[2]}}))}))};e.prototype.createDraftBenefit=function(){var e={title:o,category:o,subtitle:o,description:o,url:o,attachment:o,icon:o,isValid:false,isDirty:false};ae.update((function(t){t.selectedBenefit=o;t.draftBenefit=l(e)}))};e.prototype.clearDraftBenefit=function(){ae.update((function(e){e.draftBenefit=o}))};e.prototype.updateDraftBenefit=function(e){ae.update((function(t){t.draftBenefit=l(e)}))};e.prototype.publishDraftBenefitAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=ve.getValue().draftBenefit;if(p(e)){return[2]}this.assertDraftIsValid(e.value);ae.setLoading(true);t=ve.getValue().selectedBenefit;if(!v(t))return[3,2];n={updateAccountBenefit:se.fromDraftBenefit(e.value)};return[4,ce.postCommandAsync(t.value.id,n)];case 1:i.sent();return[3,4];case 2:r={createAccountBenefit:se.fromDraftBenefit(e.value)};return[4,ce.postCommandAsync(o,r)];case 3:i.sent();i.label=4;case 4:ae.setLoading(false);return[2]}}))}))};e.prototype.deleteSelectedBenefitAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=ve.getValue().selectedBenefit;if(!v(e))return[3,2];ae.setLoading(true);return[4,ce.postCommandAsync(e.value.id,"deleteAccountBenefit")];case 1:t.sent();ae.setLoading(false);t.label=2;case 2:return[2]}}))}))};e.prototype.updateDraftUrl=function(e){this.updateDraft((function(t){t.url=d(e);t.isDirty=true}))};e.prototype.clearDraftUrl=function(){this.updateDraft((function(e){e.url=o;e.isDirty=true}))};e.prototype.uploadAttachmentAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:ae.setLoading(true);n.label=1;case 1:n.trys.push([1,,3,4]);return[4,m(b.postDocumentAsync({file:e}),500)];case 2:t=n.sent();this.updateDraft((function(e){e.attachment=l(t);e.isDirty=true}));return[3,4];case 3:ae.setLoading(false);return[7];case 4:return[2]}}))}))};e.prototype.clearAttachment=function(){this.updateDraft((function(e){e.attachment=o;e.isDirty=true}))};e.prototype.uploadIconAsync=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:ae.setLoading(true);n.label=1;case 1:n.trys.push([1,,3,4]);return[4,m(b.postIconAsync({file:e}),500)];case 2:t=n.sent();this.updateDraft((function(e){e.icon=l(t);e.isDirty=true}));return[3,4];case 3:ae.setLoading(false);return[7];case 4:return[2]}}))}))};e.prototype.clearIcon=function(){this.updateDraft((function(e){e.icon=o;e.isDirty=true}))};e.prototype.assertDraftIsValid=function(e){var t=v(e.title)&&v(e.category);if(!t)throw Error("Draft benefit is not valid")};e.prototype.updateDraft=function(e){ae.update((function(t){t.draftBenefit=i.pipe(t.draftBenefit,h(g(e)))}))};e.prototype.existingBenefitToDraft=function(e){return{title:e.title,category:e.category,subtitle:e.subtitle,description:e.description,url:e.url,attachment:e.attachment,icon:e.icon,isValid:true,isDirty:false}};return e}();var ge=e("a",new he);var ye=function(){function e(){}e.prototype.loadPageStateAsync=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:ae.setLoading(true);return[4,ce.getPageStateAsync()];case 1:e=t.sent();ae.update((function(t){t.manageBenefitsPageState=de.toDomain(e)}));ae.setLoading(false);return[2]}}))}))};e.prototype.enableBenefitAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,ce.postCommandAsync(a.some(e),"enableAccountBenefit")];case 1:t.sent();ae.update((function(t){var n=t.manageBenefitsPageState.disabledBenefits.findIndex((function(t){return t.id===e}));if(n===-1)return;var r=t.manageBenefitsPageState.disabledBenefits.splice(n,1)[0];r.visibility.isEnabled=true;t.manageBenefitsPageState.enabledBenefits.push(r)}));return[2]}}))}))};e.prototype.disableBenefitAsync=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,ce.postCommandAsync(a.some(e),"disableAccountBenefit")];case 1:t.sent();ae.update((function(t){var n=t.manageBenefitsPageState.enabledBenefits.findIndex((function(t){return t.id===e}));if(n===-1)return;var r=t.manageBenefitsPageState.enabledBenefits.splice(n,1)[0];r.visibility.isEnabled=false;t.manageBenefitsPageState.disabledBenefits.push(r)}));return[2]}}))}))};return e}();var me=e("m",new ye)}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function c(t){try{u(r["throw"](t))}catch(t){o(t)}}function u(t){t.done?n(t.value):i(t.value).then(a,c)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(t){a=[6,t];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-69cf2679.system.js"],(function(t){"use strict";var e;return{setters:[function(t){e=t.B}],execute:function(){var n=function(){function t(){}t.prototype.postTrackEventAsync=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,e.instance.url("benefits/track-event").post(t).res()]}))}))};return t}();var r=new n;var i=function(){function t(){}t.prototype.trackAppLoadedAsync=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.trackEventAsync("appLoaded")]}))}))};t.prototype.trackPageViewedAsync=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.trackEventAsync({pageViewed:t})]}))}))};t.prototype.trackBenefitLinkClickedAsync=function(t){var e=t.benefitId,n=t.benefit;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t={benefitId:e,attachment:"link",category:n.category,subtitle:n.subtitle,title:n.title};return[2,this.trackEventAsync({benefitSelected:t})]}))}))};t.prototype.trackBenefitAttachmentClickedAsync=function(t){var e=t.benefitId,n=t.benefit;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t={benefitId:e,attachment:"document",category:n.category,subtitle:n.subtitle,title:n.title};return[2,this.trackEventAsync({benefitSelected:t})]}))}))};t.prototype.trackEventAsync=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,r.postTrackEventAsync({event:t})];case 1:n.sent();return[3,3];case 2:e=n.sent();return[2];case 3:return[2]}}))}))};return t}();var o=t("b",new i)}}}));
1
+ var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function c(t){try{u(r["throw"](t))}catch(t){o(t)}}function u(t){t.done?n(t.value):i(t.value).then(a,c)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(t){a=[6,t];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-45d6fbc2.system.js"],(function(t){"use strict";var e;return{setters:[function(t){e=t.B}],execute:function(){var n=function(){function t(){}t.prototype.postTrackEventAsync=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,e.instance.url("benefits/track-event").post(t).res()]}))}))};return t}();var r=new n;var i=function(){function t(){}t.prototype.trackAppLoadedAsync=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.trackEventAsync("appLoaded")]}))}))};t.prototype.trackPageViewedAsync=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.trackEventAsync({pageViewed:t})]}))}))};t.prototype.trackBenefitLinkClickedAsync=function(t){var e=t.benefitId,n=t.benefit;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t={benefitId:e,attachment:"link",category:n.category,subtitle:n.subtitle,title:n.title};return[2,this.trackEventAsync({benefitSelected:t})]}))}))};t.prototype.trackBenefitAttachmentClickedAsync=function(t){var e=t.benefitId,n=t.benefit;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t={benefitId:e,attachment:"document",category:n.category,subtitle:n.subtitle,title:n.title};return[2,this.trackEventAsync({benefitSelected:t})]}))}))};t.prototype.trackEventAsync=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,r.postTrackEventAsync({event:t})];case 1:n.sent();return[3,3];case 2:e=n.sent();return[2];case 3:return[2]}}))}))};return t}();var o=t("b",new i)}}}));