/*! For license information please see auth.7a6ba4612115126f9b59.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.swh=e():(t.swh=t.swh||{},t.swh.auth=e())}(self,(function(){return function(){var t={87757:function(t,e,r){t.exports=r(35666)},59537:function(t,e,r){"use strict";r.d(e,{L3:function(){return a},e_:function(){return i},ry:function(){return o}});r(87757);var n=r(31955);function o(t){if(!t.ok)throw t;return t}function i(t,e,r){return void 0===e&&(e={}),void 0===r&&(r=null),e["X-CSRFToken"]=n.Z.get("csrftoken"),fetch(t,{credentials:"include",headers:e,method:"POST",body:r})}function a(){history.replaceState("",document.title,window.location.pathname+window.location.search)}},35666:function(t){var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n=f;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=T(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?d:h,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",h="suspendedYield",p="executing",d="completed",v={};function y(){}function m(){}function w(){}var g={};g[i]=function(){return this};var b=Object.getPrototypeOf,k=b&&b(b(C([])));k&&k!==r&&n.call(k,i)&&(g=k);var x=w.prototype=y.prototype=Object.create(g);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function T(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function C(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o
Below is your token.
\n'+o+"",swh.webapp.showModalHtml("Display bearer token",u),t.next=21;break;case 13:return t.prev=13,t.t0=t.catch(1),t.next=17,t.t0.text();case 17:s=t.sent,l="Internal server error.",400===t.t0.status&&(l=s),swh.webapp.showModalHtml("Display bearer token",c(l));case 21:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function p(t){return d.apply(this,arguments)}function d(){return(d=(0,e.Z)(i().mark((function e(r){var n,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={token_ids:r},e.prev=1,e.next=4,(0,a.e_)(Urls.oidc_revoke_bearer_tokens(),{},JSON.stringify(n));case 4:o=e.sent,(0,a.ry)(o),s(),$("#swh-token-form-message").html(u("Bearer token"+(r.length>1?"s":"")+" successfully revoked.")),t.draw(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),$("#swh-token-form-message").html(c("Internal server error."));case 14:case"end":return e.stop()}}),e,null,[[1,11]])})))).apply(this,arguments)}function v(t){p([t])}function y(){for(var e=[],r=t.rows().data(),n=0;n
'+r+'
\n \n \n ');swh.webapp.showModalHtml(o[t].modalTitle,i),$("#swh-token-form").submit((function(r){r.preventDefault(),r.stopPropagation(),o[t].submitCallback(e)}))}else o[t].submitCallback(e)}function w(){$(document).ready((function(){t=$("#swh-bearer-tokens-table").on("error.dt",(function(t,e,r,n){$("#swh-origin-save-request-list-error").text("An error occurred while retrieving the tokens list"),console.log(n)})).DataTable({serverSide:!0,ajax:Urls.oidc_list_bearer_tokens(),columns:[{data:"creation_date",name:"creation_date",render:function(t,e,r){return"display"===e?new Date(t).toLocaleString():t}},{render:function(t,e,r){return'\n '}}],ordering:!1,searching:!1,scrollY:"50vh",scrollCollapse:!0}),$("#swh-oidc-profile-tokens-tab").on("shown.bs.tab",(function(){t.draw(),window.location.hash="#tokens"})),$("#swh-oidc-profile-account-tab").on("shown.bs.tab",(function(){(0,a.L3)()})),"#tokens"===window.location.hash&&$('.nav-tabs a[href="#swh-oidc-profile-tokens"]').tab("show")}))}}(),n}()})); //# sourceMappingURL=auth.7a6ba4612115126f9b59.js.map